USA TST 2023 Solutions
United States of America - Team Selection Test
Andrew Gu, Evan Chen, and Gopal Goel
$64^{\text {rd }}$ IMO 2022 Japan and $12^{\text {th }}$ EGMO 2023 Slovenia
# Contents
0 Problems ..... 2
1 Solutions to Day 1 ..... 3
1.1 USA TST 2023/1, proposed by Kevin Cong ..... 3
1.2 USA TST 2023/2, proposed by Kevin Cong ..... 5
1.3 USA TST 2023/3, proposed by Sean Li ..... 12
2 Solutions to Day 2 ..... 15
2.1 USA TST 2023/4, proposed by Carl Schildkraut ..... 15
2.2 USA TST 2023/5, proposed by Nikolai Beluhov ..... 16
2.3 USA TST 2023/6, proposed by Maxim Li ..... 20
## §0 Problems
1. There are 2022 equally spaced points on a circular track $\gamma$ of circumference 2022. The points are labeled $A_{1}, A_{2}, \ldots, A_{2022}$ in some order, each label used once. Initially, Bunbun the Bunny begins at $A_{1}$. She hops along $\gamma$ from $A_{1}$ to $A_{2}$, then from $A_{2}$ to $A_{3}$, until she reaches $A_{2022}$, after which she hops back to $A_{1}$. When hopping from $P$ to $Q$, she always hops along the shorter of the two $\operatorname{arcs} \overparen{P Q}$ of $\gamma$; if $\overline{P Q}$ is a diameter of $\gamma$, she moves along either semicircle.
Determine the maximal possible sum of the lengths of the 2022 arcs which Bunbun traveled, over all possible labellings of the 2022 points.
2. Let $A B C$ be an acute triangle. Let $M$ be the midpoint of side $B C$, and let $E$ and $F$ be the feet of the altitudes from $B$ and $C$, respectively. Suppose that the common external tangents to the circumcircles of triangles $B M E$ and $C M F$ intersect at a point $K$, and that $K$ lies on the circumcircle of $A B C$. Prove that line $A K$ is perpendicular to line $B C$.
3. Consider pairs $(f, g)$ of functions from the set of nonnegative integers to itself such that
- $f(0) \geq f(1) \geq f(2) \geq \cdots \geq f(300) \geq 0 ;$
- $f(0)+f(1)+f(2)+\cdots+f(300) \leq 300$;
- for any 20 nonnegative integers $n_{1}, n_{2}, \ldots, n_{20}$, not necessarily distinct, we have
$$
g\left(n_{1}+n_{2}+\cdots+n_{20}\right) \leq f\left(n_{1}\right)+f\left(n_{2}\right)+\cdots+f\left(n_{20}\right) .
$$
Determine the maximum possible value of $g(0)+g(1)+\cdots+g(6000)$ over all such pairs of functions.
4. For nonnegative integers $a$ and $b$, denote their bitwise xor by $a \oplus b$. (For example, $9 \oplus 10=1001_{2} \oplus 1010_{2}=0011_{2}=3$.)
Find all positive integers $a$ such that for any integers $x>y \geq 0$, we have
$$
x \oplus a x \neq y \oplus a y .
$$
5. Let $m$ and $n$ be fixed positive integers. Tsvety and Freyja play a game on an infinite grid of unit square cells. Tsvety has secretly written a real number inside of each cell so that the sum of the numbers within every rectangle of size either $m \times n$ or $n \times m$ is zero. Freyja wants to learn all of these numbers.
One by one, Freyja asks Tsvety about some cell in the grid, and Tsvety truthfully reveals what number is written in it. Freyja wins if, at any point, Freyja can simultaneously deduce the number written in every cell of the entire infinite grid. (If this never occurs, Freyja has lost the game and Tsvety wins.)
In terms of $m$ and $n$, find the smallest number of questions that Freyja must ask to win, or show that no finite number of questions can suffice.
6. Fix a function $f: \mathbb{N} \rightarrow \mathbb{N}$ and for any $m, n \in \mathbb{N}$ define
$$
\Delta(m, n)=\underbrace{f(f(\ldots f}_{f(n) \text { times }}(m) \ldots))-\underbrace{f(f(\ldots f}_{f(m) \text { times }}(n) \ldots)) .
$$
Suppose $\Delta(m, n) \neq 0$ for any distinct $m, n \in \mathbb{N}$. Show that $\Delta$ is unbounded, meaning that for any constant $C$ there exist $m, n \in \mathbb{N}$ with $|\Delta(m, n)|>C$.
## §1 Solutions to Day 1
## §1.1 USA TST 2023/1, proposed by Kevin Cong
Available online at https://aops.com/community/p26685816.
## Problem statement
There are 2022 equally spaced points on a circular track $\gamma$ of circumference 2022. The points are labeled $A_{1}, A_{2}, \ldots, A_{2022}$ in some order, each label used once. Initially, Bunbun the Bunny begins at $A_{1}$. She hops along $\gamma$ from $A_{1}$ to $A_{2}$, then from $A_{2}$ to $A_{3}$, until she reaches $A_{2022}$, after which she hops back to $A_{1}$. When hopping from $P$ to $Q$, she always hops along the shorter of the two $\operatorname{arcs} \overparen{P Q}$ of $\gamma$; if $\overline{P Q}$ is a diameter of $\gamma$, she moves along either semicircle.
Determine the maximal possible sum of the lengths of the 2022 arcs which Bunbun traveled, over all possible labellings of the 2022 points.
Replacing 2022 with $2 n$, the answer is $2 n^{2}-2 n+2$. (When $n=1011$, the number is 2042222.)

【 Construction. The construction for $n=5$ shown on the left half of the figure easily generalizes for all $n$.
Remark. The validity of this construction can also be seen from the below proof.
ब First proof of bound. Let $d_{i}$ be the shorter distance from $A_{2 i-1}$ to $A_{2 i+1}$.
Claim - The distance of the leg of the journey $A_{2 i-1} \rightarrow A_{2 i} \rightarrow A_{2 i+1}$ is at most $2 n-d_{i}$.
Proof. Of the two arcs from $A_{2 i-1}$ to $A_{2 i+1}$, Bunbun will travel either $d_{i}$ or $2 n-d_{i}$. One of those arcs contains $A_{2 i}$ along the way. So we get a bound of $\max \left(d_{i}, 2 n-d_{i}\right)=2 n-d_{i}$.
That means the total distance is at most
$$
\sum_{i=1}^{n}\left(2 n-d_{i}\right)=2 n^{2}-\left(d_{1}+d_{2}+\cdots+d_{n}\right)
$$
Claim - We have
$$
d_{1}+d_{2}+\cdots+d_{n} \geq 2 n-2
$$
Proof. The left-hand side is the sum of the walk $A_{1} \rightarrow A_{3} \rightarrow \cdots \rightarrow A_{2 n-1} \rightarrow A_{1}$. Among the $n$ points here, two of them must have distance at least $n-1$ apart; the other $d_{i}$ 's contribute at least 1 each. So the bound is $(n-1)+(n-1) \cdot 1=2 n-2$.
Second proof of bound. Draw the $n$ diameters through the $2 n$ arc midpoints, as shown on the right half of the figure for $n=5$ in red.
Claim (Interpretation of distances) - The distance between any two points equals the number of diameters crossed to travel between the points.
Proof. Clear.
With this in mind, call a diameter critical if it is crossed by all $2 n$ arcs.
Claim - At most one diameter is critical.
Proof. Suppose there were two critical diameters; these divide the circle into four arcs. Then all $2 n$ arcs cross both diameters, and so travel between opposite arcs. But this means that points in two of the four arcs are never accessed - contradiction.
Claim - Every diameter is crossed an even number of times.
Proof. Clear: the diameter needs to be crossed an even number of times for the loop to return to its origin.
This immediately implies that the maximum possible total distance is achieved when one diameter is crossed all $2 n$ times, and every other diameter is crossed $2 n-2$ times, for a total distance of at most
$$
n \cdot(2 n-2)+2=2 n^{2}-2 n+2
$$
## §1.2 USA TST 2023/2, proposed by Kevin Cong
Available online at https://aops.com/community/p26685484.
## Problem statement
Let $A B C$ be an acute triangle. Let $M$ be the midpoint of side $B C$, and let $E$ and $F$ be the feet of the altitudes from $B$ and $C$, respectively. Suppose that the common external tangents to the circumcircles of triangles $B M E$ and $C M F$ intersect at a point $K$, and that $K$ lies on the circumcircle of $A B C$. Prove that line $A K$ is perpendicular to line $B C$.
We present several distinct approaches.
\I Inversion solution submitted by Ankan Bhattacharya and Nikolai Beluhov. Let $H$ be the orthocenter of $\triangle A B C$. We use inversion in the circle with diameter $\overline{B C}$. We identify a few images:
- The circumcircles of $\triangle B M E$ and $\triangle C M F$ are mapped to lines $B E$ and $C F$.
- The common external tangents are mapped to the two circles through $M$ which are tangent to lines $B E$ and $C F$.
- The image of $K$, denoted $K^{*}$, is the second intersection of these circles.
- The assertion that $K$ lies on $(A B C)$ is equivalent to $K^{*}$ lying on $(B H C)$.
However, now $K^{*}$ is simple to identify directly: it's just the reflection of $M$ in the bisector of $\angle B H C$.

In particular, $\overline{H K^{*}}$ is a symmedian of $\triangle B H C$. However, since $K^{*}$ lies on $(B H C)$, this means $\left(H K^{*} ; B C\right)=-1$.
Then, we obtain that $\overline{B C}$ bisects $\angle H M K^{*} \equiv \angle H M K$. However, $K$ also lies on $(A B C)$, which forces $K$ to be the reflection of $H$ in $\overline{B C}$. Thus $\overline{A K} \perp \overline{B C}$, as wanted.
ๆ Solution with coaxial circles (Pitchayut Saengrungkongka). Let $H$ be the orthocenter of $\triangle A B C$. Let $Q$ be the second intersection of $\odot(B M E)$ and $\odot(C M F)$. We first prove the following well-known properties of $Q$.
Claim - $Q$ is the Miquel point of $B C E F$. In particular, $Q$ lies on both $\odot(A E F)$ and $\odot(A B C)$.
Proof. Follows since $B C E F$ is cyclic with $M$ being the circumcenter.
Claim - $A(Q, H ; B, C)=-1$.
Proof. By the radical center theorem on $\odot(A E F), \odot(A B C)$, and $\odot(B C E F)$, we get that $A Q, E F$, and $B C$ are concurrent. Now, the result follows from a well-known harmonic property.
Now, we get to the meat of the solution. Let the circumcircle of $\odot(Q M K)$ meet $B C$ again at $T \neq M$. The key claim is the following.
Claim - $Q T$ is tangent to $\odot(B Q C)$.
Proof. We use the "forgotten coaxiality lemma".
$$
\begin{aligned}
\frac{B T}{T C} & =\frac{T B \cdot T M}{T C \cdot T M} \\
& =\frac{\operatorname{pow}(T, \odot(B M E))}{\operatorname{pow}(T, \odot(C M F))} \\
& =\frac{\operatorname{pow}(K, \odot(B M E))}{\operatorname{pow}(K, \odot(C M F))} \\
& =\left(\frac{r_{\odot(B M E)}}{r_{\odot(C M F)}}\right)^{2} \\
& =\left(\frac{B Q / \sin \angle Q M B}{C Q / \sin \angle Q M C}\right)^{2} \\
& =\frac{B Q^{2}}{C Q^{2}}
\end{aligned}
$$
implying the result.
To finish, let $O$ be the center of $\odot(A B C)$. Then, from the claim, $\angle O Q T=90^{\circ}=$ $\angle O M T$, so $O$ also lies on $\odot(Q M T K)$. Thus, $\angle O K T=90^{\circ}$, so $K T$ is also tangent to $\odot(A B C)$ as well. This implies that $Q B K C$ is harmonic quadrilateral, and the result follows from the second claim.
【 Solution by Luke Robitaille. Let $Q$ be the second intersection of $\odot(B M E)$ and $\odot(C M F)$. We use the first two claims of the previous solution. In particular, $Q \in$ $\odot(A B C)$. We have the following claim.
Claim (Also appeared in ISL 2017 G7) - We have $\measuredangle Q K M=\measuredangle Q B M+\measuredangle Q C M$.
Proof. Let $K Q$ and $K M$ meet $\odot(B M E)$ again at $Q^{\prime}$ and $M^{\prime}$. Then, by homothety, $\measuredangle Q^{\prime} Q M^{\prime}=\measuredangle Q C M$, so
$$
\begin{aligned}
\measuredangle Q K M & =\measuredangle Q^{\prime} Q M^{\prime}+\measuredangle Q M^{\prime} M \\
& =\measuredangle Q C M+\measuredangle Q B M,
\end{aligned}
$$
as desired.
Now, we extend $K M$ to meet $\odot(A B C)$ again at $Q_{1}$. We have
$$
\begin{aligned}
\measuredangle Q_{1} Q B=\measuredangle Q_{1} K B & =\measuredangle Q_{1} K Q+\measuredangle Q C B \\
& =\measuredangle M K Q+\measuredangle Q K B \\
& =(\measuredangle M B Q+\measuredangle M C Q)+\measuredangle Q C B \\
& =\measuredangle C B Q,
\end{aligned}
$$
implying that $Q Q_{1} \| B C$. This implies that $Q B K C$ is harmonic quadrilateral, so we are done.
I Synthetic solution due to Andrew Gu (Harvard 2026). Define $O_{1}$ and $O_{2}$ as the circumcenters of $(B M E)$ and $(C M F)$. Let $T$ be the point on $(A B C)$ such that $\overline{A T} \perp \overline{B C}$. Denote by $L$ the midpoint of minor arc $\overparen{B C}$.
We are going to ignore the condition that $K$ lies on the circumcircle of $A B C$, and prove the following unconditional result:
## Proposition
The points $T, L, K$ are collinear.
This will solve the problem because if $K$ is on the circumcircle of $A B C$, it follows $K=T$ or $K=L$; but $K=L$ can never occur since $O_{1}$ and $O_{2}$ are obviously on different sides of line $L M$ so line $L M$ must meet $O_{1} O_{2}$ inside segment $O_{1} O_{2}$, and $K$ lies outside this segment.

We now turn to the proof of the main lemma. Let $P_{1}$ and $P_{2}$ be the antipodes of $M$ on these circles.
Claim - Lines $A C$ and $L M$ meet at the antipode $Q_{1}$ of $B$ on $(B M E)$, so that $B P_{1} Q_{1} M$ is a rectangle. Similarly, lines $A B$ and $L M$ meet at the antipode $Q_{2}$ of $C$ on $(C M F)$, so that $C P_{2} Q_{2} M$ is a rectangle.
Proof. Let $Q_{1}^{\prime}=\omega_{1} \cap A C \neq E$. Then $\measuredangle B M Q_{1}^{\prime}=\measuredangle B E Q_{1}^{\prime}=90^{\circ}$ hence $Q_{1}^{\prime} \in L M$. The other half of the lemma follows similarly.
From this, it follows that $P_{1} Q_{1}=B M=\frac{1}{2} B C=M C=P_{2} Q_{2}$. Letting $r_{1}$ denote the radius of $\omega_{1}$ (and similarly for $\omega_{2}$ ), we deduce that $C Q_{1}=B Q_{1}=2 r_{1}$.
Claim - $K M=K L$.
Proof. I first claim that $\overline{C L}$ is the external bisector of $\angle Q_{1} C Q_{2}$; this follows from
$$
\measuredangle Q_{1} C L=\measuredangle A C L=\measuredangle A B L=\measuredangle Q_{2} B L=\measuredangle Q_{2} C L
$$
The external angle bisector theorem then gives an equality of directed ratios
$$
\frac{L Q_{1}}{L Q_{2}}=\frac{\left|C Q_{1}\right|}{\left|C Q_{2}\right|}=\frac{\left|B Q_{1}\right|}{\left|C Q_{2}\right|}=\frac{2 r_{1}}{2 r_{2}}=\frac{r_{1}}{r_{2}}
$$
Let the reflection of $M$ over $K$ be $P$; then $P$ lies on $\overline{P_{1} P_{2}}$ and
$$
\frac{P P_{1}}{P P_{2}}=\frac{2 K O_{1}}{2 K O_{2}}=\frac{K O_{1}}{K O_{2}}=\frac{r_{1}}{r_{2}}=\frac{L Q_{1}}{L Q_{2}}
$$
where again the ratios are directed. Projecting everything onto line $L M$, so that $P_{1}$ lands at $Q_{1}$ and $P_{2}$ lands at $Q_{2}$, we find that the projection of $P$ must land exactly at $L$.
Claim - Line $K M$ is an external angle bisector of $\angle O_{1} M O_{2}$.
Proof. Because $\frac{K O_{1}}{K O_{2}}=\frac{r_{1}}{r_{2}}=\frac{M O_{1}}{M O_{2}}$.
To finish, note that we know that $\overline{M P_{1}} \| \overline{C Q_{1}} \equiv \overline{A C}$ and $\overline{M P_{2}} \| \overline{B Q_{2}} \equiv \overline{A B}$, meaning the angles $\angle O_{1} M O_{2}$ and $\angle C A B$ have parallel legs. Hence, if $N$ is the antipode of $L$, it follows that $\overline{M K} \| \overline{A N}$. Now from $M K=K L$ and the fact that $A N L T$ is an isosceles trapezoid, we deduce that $\overline{L T}$ and $\overline{L K}$ are lines in the same direction (namely, the reflection of $M K \| A N$ across $\overline{B C}$ ), as needed.
【 Complex numbers approach with Apollonian circles, by Carl Schildkraut. We use complex numbers. As in the first approach, we will ignore the hypothesis that $K$ lies on ( $A B C$ ).
Let $Q:=(A H) \cap(A B C) \cap(A E F) \neq A$ be the Miquel point of $B F E C$ again. Construct the point $T$ on $(A B C)$ for which $A T \perp B C$; note that $T=-\frac{b c}{a}$. This time the unconditional result is:
## Proposition
We have $Q, M, T, K$ are concyclic (or collinear) on an Apollonian circle of $\overline{O_{1} O_{2}}$.
This will solve the original problem since once $K$ lies on $(A B C)$ it must be either $Q$ or $T$. But since $K$ is not on $(B M E), K \neq Q$, it will have to be $T$.
We now prove the proposition. Suppose $(A B C)$ is the unit circle and let $A=a, B=b$, $C=c$. Let $H=a+b+c$ be the orthocenter of $\triangle A B C$. By the usual formulas,
$$
E:=\frac{1}{2}\left(a+b+c-\frac{b c}{a}\right) .
$$
Let $O_{1}$ be the center of $(B M E)$ and $O_{2}$ be the center of $(C M F)$.
Claim (Calculation of the Miquel point) - We have $Q=\frac{2 a+b+c}{a\left(\frac{1}{a}+\frac{1}{b}+\frac{1}{c}\right)+1}$.
Proof. We now compute that $Q=q$ satisfies $\bar{q}=1 / q$ (since $Q$ is on the unit circle) and $\frac{q-h}{q-a} \in i \mathbb{R}$ (since $A Q \perp Q H$ ), which expands to
$$
0=\frac{q-h}{q-a}+\frac{1 / q-\bar{h}}{1 / q-1 / a}=\frac{q-h}{q-a}-\frac{a(1-q \bar{h})}{q-a}
$$
This solves to $q=\frac{h+a}{a \bar{h}+1}=\frac{2 a+b+c}{a \bar{h}+1}$.
Claim (Calculation of $O_{1}$ and $\left.O_{2}\right)-$ We have $O_{1}=\frac{b(2 a+b+c)}{2(a+b)}$ and $O_{2}=\frac{c(2 a+b+c)}{2(a+c)}$.
Proof. We now compute $O_{1}$ and $O_{2}$. For $x, y, z \in \mathbb{C}$, let $\operatorname{Circum}(x, y, z)$ denote the circumcenter of the triangle defined by vertices $x, y$, and $z$ in $\mathbb{C}$. We have
$$
\begin{aligned}
O_{1} & =\operatorname{Circum}(B, M, E) \\
& =b+\frac{1}{2} \operatorname{Circum}\left(0, c-b, \frac{(a-b)(b-c)}{b}\right) \\
& =b-\frac{b-c}{2 b} \operatorname{Circum}(0, b, b-a) \\
& =b-\frac{b-c}{2 b}(b-\operatorname{Circum}(0, b, a)) \\
& =b-\frac{b-c}{2 b}\left(b-\frac{a b}{a+b}\right)=b-\frac{b(b-c)}{2(a+b)}=\frac{b(2 a+b+c)}{2(a+b)}
\end{aligned}
$$
Similarly, $O_{2}=\frac{c(2 a+b+c)}{2(a+c)}$.
We are now going to prove the following:
Claim - We have
$$
\frac{T O_{1}}{T O_{2}}=\frac{M O_{1}}{M O_{2}}=\frac{Q O_{1}}{Q O_{2}}
$$
Proof. We now compute
$$
M O_{1}=B O_{1}=\left|b-\frac{b(2 a+b+c)}{2(a+b)}\right|=\left|\frac{b(b-c)}{2(a+b)}\right|=\frac{1}{2}\left|\frac{b-c}{a+b}\right|
$$
and
$Q O_{1}=\left|r-\frac{b(2 a+b+c)}{2(a+b)}\right|=\left|1-\frac{b(a+h)}{2(a+b) r}\right|=\left|1-\frac{b(a \bar{h}+1)}{2(a+b)}\right|=\left|\frac{a-\frac{a b}{c}}{2(a+b)}\right|=\frac{1}{2}\left|\frac{b-c}{a+b}\right|$.
This implies both (by symmetry) that $\frac{M O_{1}}{M O_{2}}=\frac{Q O_{1}}{Q O_{2}}=\left|\frac{a+c}{a+b}\right|$ and that $Q$ is on (BME) and $(C M F)$. Also,
$$
\frac{T O_{1}}{T O_{2}}=\frac{\left|\frac{b(2 a+b+c)}{2(a+b)}+\frac{b c}{a}\right|}{\left|\frac{c(2 a+b+c)}{2(a+c)}+\frac{b c}{a}\right|}=\left|\frac{\frac{b\left(2 a^{2}+a b+a c+2 a c+2 b c\right)}{2 a(a+b)}}{\frac{c\left(2 a^{2}+a b+a c+2 a b+2 b c\right)}{2 a(a+c)}}\right|=\left|\frac{a+c}{a+b}\right| \cdot\left|\frac{2 a^{2}+2 b c+a b+3 a c}{2 a^{2}+2 b c+3 a b+a c}\right|
$$
if $z=2 a^{2}+2 b c+a b+3 a c$, then $a^{2} b c \bar{z}=2 a^{2}+2 b c+3 a b+a c$, so the second term has magnitude 1. This means $\frac{T O_{1}}{T O_{2}}=\frac{M O_{1}}{M O_{2}}=\frac{Q O_{1}}{Q O_{2}}$, as desired.
To finish, note that this common ratio is the ratio between the radii of these two circles, so it is also $\frac{K O_{1}}{K O_{2}}$. By Apollonian circles the points $\{Q, M, T, K\}$ lie on a circle or a line.
## §1.3 USA TST 2023/3, proposed by Sean Li
Available online at https://aops.com/community/p26685437.
## Problem statement
Consider pairs $(f, g)$ of functions from the set of nonnegative integers to itself such that
- $f(0) \geq f(1) \geq f(2) \geq \cdots \geq f(300) \geq 0 ;$
- $f(0)+f(1)+f(2)+\cdots+f(300) \leq 300 ;$
- for any 20 nonnegative integers $n_{1}, n_{2}, \ldots, n_{20}$, not necessarily distinct, we have
$$
g\left(n_{1}+n_{2}+\cdots+n_{20}\right) \leq f\left(n_{1}\right)+f\left(n_{2}\right)+\cdots+f\left(n_{20}\right)
$$
Determine the maximum possible value of $g(0)+g(1)+\cdots+g(6000)$ over all such pairs of functions.
Replace $300=\frac{24 \cdot 25}{2}$ with $\frac{s(s+1)}{2}$ where $s=24$, and 20 with $k$. The answer is $115440=$ $\frac{k s(k s+1)}{2}$. Equality is achieved at $f(n)=\max (s-n, 0)$ and $g(n)=\max (k s-n, 0)$. To prove
$$
g\left(n_{1}+\cdots+n_{k}\right) \leq f\left(n_{1}\right)+\cdots+f\left(n_{k}\right)
$$
write it as
$$
\max \left(x_{1}+\cdots+x_{k}, 0\right) \leq \max \left(x_{1}, 0\right)+\cdots+\max \left(x_{k}, 0\right)
$$
with $x_{i}=s-n_{i}$. This can be proven from the $k=2$ case and induction.
It remains to show the upper bound. For this problem, define a partition to be a nonincreasing function $p: \mathbb{Z}_{\geq 0} \rightarrow \mathbb{Z}_{\geq 0}$ such that $p(n)=0$ for some $n$. The sum of $p$ is defined to be $\sum_{n=0}^{\infty} p(n)$, which is finite under the previous assumption. Let $L=\mathbb{Z}_{\geq 0}^{2}$. The Young diagram of the partition is the set of points
$$
\mathcal{P}:=\{(x, y) \in L: y
n \text {. }
$$
This is a partition with the same sum as $p$. Geometrically, the Young diagrams of $p$ and $p_{*}$ are reflections about $x=y$.
Since each $g(n)$ is independent, we may maximize each one separately for all $n$ and assume that
$$
g(n)=\min _{n_{1}+\cdots+n_{k}=n}\left(f\left(n_{1}\right)+\cdots+f\left(n_{k}\right)\right) .
$$
The conditions of the problem statement imply that $f\left(\frac{s(s+1)}{2}\right)=0$. Then, for any $n \leq k \frac{s(s+1)}{2}$, there exists an optimal combination $\left(n_{1}, \ldots, n_{k}\right)$ in $\left(^{*}\right)$ where all $n_{i}$ are at most $\frac{s(s+1)}{2}$, by replacing any term in an optimum greater than $\frac{s(s+1)}{2}$ by $\frac{s(s+1)}{2}$ and shifting the excess to smaller terms (because $f$ is nonincreasing). Therefore we may extend $f$ to a partition by letting $f(n)=0$ for $n>\frac{s(s+1)}{2}$ without affecting the relevant values of $g$. Then $\left(^{*}\right)$ implies that $g$ is a partition as well.
The problem can be restated as follows: $f$ is a partition with sum $\frac{s(s+1)}{2}$, and $g$ is a partition defined by $\left(^{*}\right)$. Find the maximum possible sum of $g$. The key claim is that the problem is the same under conjugation.
Claim - Under these conditions, we have
$$
g_{*}(n)=\min _{n_{1}+\cdots+n_{k}=n}\left(f_{*}\left(n_{1}\right)+\cdots+f_{*}\left(n_{k}\right)\right) .
$$
Proof. Let $\mathcal{F}$ and $\mathcal{G}$ be the Young diagrams of $f$ and $g$ respectively, and $\overline{\mathcal{F}}=L \backslash \mathcal{F}$ and $\overline{\mathcal{G}}=L \backslash \mathcal{G}$ be their complements. The lower boundary of $\overline{\mathcal{F}}$ is formed by the points $(n, f(n))$ for $i \in \mathbb{Z}_{\geq 0}$. By the definition of $g$, the lower boundary of $\overline{\mathcal{G}}$ consists of points $(n, g(n))$ which are formed by adding $k$ points of $\overline{\mathcal{F}}$. This means
$$
\overline{\mathcal{G}}=\underbrace{\overline{\mathcal{F}}+\cdots+\overline{\mathcal{F}}}_{k \overline{\mathcal{F}}^{\prime} \mathrm{s}}
$$
where + denotes set addition. This definition remains invariant under reflection about $x=y$, which swaps $f$ and $g$ with their conjugates.
Let $A$ be the sum of $g$. We now derive different bounds on $A$. First, by Hermite's identity
$$
n=\sum_{i=0}^{k-1}\left\lfloor\frac{n+i}{k}\right\rfloor
$$
we have
$$
\begin{aligned}
A & =\sum_{n=0}^{\infty} g(n) \\
& \leq \sum_{n=0}^{\infty} \sum_{i=0}^{k-1} f\left(\left\lfloor\frac{n+i}{k}\right\rfloor\right) \\
& =k^{2} \sum_{n=0}^{\infty} f(n)-\frac{k(k-1)}{2} f(0) \\
& =k^{2} \frac{s(s+1)}{2}-\frac{k(k-1)}{2} f(0) .
\end{aligned}
$$
By the claim, we also get the second bound $A \leq k^{2} \frac{s(s+1)}{2}-\frac{k(k-1)}{2} f_{*}(0)$.
For the third bound, note that $f\left(f_{*}(0)\right)=0$ and thus $g\left(k f_{*}(0)\right)=0$. Moreover,
$$
g\left(q f_{*}(0)+r\right) \leq q \cdot f\left(f_{*}(0)\right)+(k-q-1) f(0)+f(r)=(k-q-1) f(0)+f(r),
$$
so we have
$$
\begin{aligned}
A & =\sum_{\substack{0 \leq q