Assign to each side $b$ of a convex polygon $P$
the maximum area of a triangle that has $b$ as a side and is contained in $P$.
Show that the sum of the areas assigned to the sides of $P$ is at least twice the area of $P$.

Solution:
We say a polygon in almost convex
if all its angles are at most $180\dg$.

Note that given any convex or almost convex polygon,
we can take any side $b$ and add another vertex on it, and the sum of the labels doesn't change
(since the label of a side is the length of the side times the distance of the farthest point).

Let $N$ be an even integer.
Then any almost convex $N$-gon with area $S$
should have an inscribed triangle with area at least $2S/N$.

The main work is the proof of the lemma.

Label the polygon $P_0 P_1 \dots P_{N-1}$.
Consider the $N/2$ major diagonals of the almost convex $N$-gon,
$P_0 P_{N/2}$, $P_1 P_{N/2+1}$, et cetera.
A butterfly refers to a self-intersecting quadrilateral
$P_i P_{i+1} P_{i+1+N/2} P_{i+N/2}$.
An example of a butterfly is shown below for $N=8$.
[Figure omitted]

Every point $X$ in the polygon is contained in the wingspan of some butterfly.

Consider a windmill-like process which

starts from some oriented red line $P_0 P_{N/2}$, oriented to face $P_0 P_{N/2}$
rotates through $P_0 P_{N/2} \cap P_1 P_{N/2+1}$ to get line $P_1 P_{N/2+1}$,
rotates through $P_1 P_{N/2+1} \cap P_2 P_{N/2+2}$ to get line $P_2 P_{N/2+2}$,
\dots et cetera, until returning to line $P_{N/2} P_0$,
but in the reverse orientation.

At the end of the process, every point in the plane has switched sides with our moving line.
The moment that $X$ crosses the moving red line, we get it contained in a butterfly, as needed.

If $ABDC = P_i P_{i+1} P_{i+1+N/2} P_{i+N/2}$ is a butterfly,
one of the triangles $ABC$, $BCD$, $CDA$, $DAB$
has area at least that of the butterfly.

Let the diagonals of the butterfly meet at $O$,
and let $a = AO$, $b = BO$, $c = CO$, $d = DO$.
If we assume WLOG $d = \min(a,b,c,d)$
then it follows $[ABC] = [AOB] + [BOC] \ge [AOB] + [COD]$, as needed.

Now, since the $N/2$ butterflies cover an area of $S$,
it follows that one of the butterflies
has area at least $S / (N/2) = 2S/N$,
and so that butterfly gives a triangle with area at least $2S/N$,
completing the proof of the lemma.

Main proof.:
Let $a_1$, \dots, $a_n$ be the numbers assigned to the sides.
Assume for contradiction $a_1 + \dots + a_n < 2S$.
We pick even integers $m_1$, $m_2$, \dots, $m_n$ such that

\frac{a_1}{S} &< \frac{2m_1}{m_1 + \dots + m_n} \\
\frac{a_2}{S} &< \frac{2m_2}{m_1 + \dots + m_n} \\
&\vdotswithin\le \\
\frac{a_n}{S} &< \frac{2m_n}{m_1 + \dots + m_n}.

which is possible by rational approximation,
since the right-hand sides sum to $2$ and the left-hand sides sum to strictly less than $2$.

Now we break every side of $P$ into $m_i$ equal parts
to get an almost convex $N$-gon, where $N = m_1 + \dots + m_n$.

The main lemma then gives us a triangle $\Delta$ of the almost convex $N$-gon
which has area at least $\frac{2S}{N}$.
If $\Delta$ used the $i$th side then it then follows the label $a_i$ on that side should be
at least $m_i \cdot \frac{2S}{N}$, contradiction.


Real numbers $a_1$, $a_2$, \dots, $a_n$ are fixed.
For each $1 \le i \le n$ we let
$d_i = \max\{a_j : 1 \le j \le i\} - \min\{a_j : i \le j \le n\}$
and let $d = \max \{d_i : 1 \le i \le n\}$.

[(a)]
Prove that for any real numbers $x_1 \le \dots \le x_n$ we have
$
\max \left\{ \left| x_i - a_i \right| :
1 \le i \le n \right\}
\ge 1/2 d.
$
Moreover, show that there exists some
choice of $x_1 \le \dots \le x_n$ which achieves equality.

Solution:
Note that we can dispense of $d_i$ immediately
by realizing that the definition of $d$ just says
$ d = \max_{1 \le i \le j \le n} ( a_i - a_j ). $

If $a_1 \le \dots \le a_n$ are already nondecreasing
then $d = 0$ and there is nothing to prove
(for the equality case, just let $x_i = a_i$),
so we will no longer consider this case.

Otherwise, consider any indices $i < j$ with $a_i > a_j$.
We first prove (a) by applying the following claim
with $p = a_i$ and $q = a_j$:

For any $p \le q$, we have
either $|p - a_i| \ge 1/2(a_i-a_j)$
or $|q - a_j| \ge 1/2(a_i-a_j)$.

Assume for contradiction both are false.
Then $p > a_i - 1/2(a_i-a_j)
= a_j + 1/2(a_i-a_j) > q$, contradiction.

As for (b), we let $i < j$ be any indices for which
$a_i - a_j = d > 0$ achieves the maximal difference.
We then define $x_\bullet$ in three steps:

We set $x_k = \frac{a_i + a_j}{2}$ for $k = i, \dots, j$.
We recursively set $x_{k} = \max(x_{k-1}, a_k)$
for $k = j+1, j+2, \dots$.
We recursively set $x_{k} = \min(x_{k+1}, a_k)$
for $k = i-1, i-2, \dots$.

By definition, these $x_\bullet$ are weakly increasing.
To prove this satisfies (b) we only need to check that
$ \left| x_k - a_k \right| \le \frac{a_i-a_j}{2} \qquad
(\star) $
for any index $k$ (as equality holds for $k = i$ or $k = j$).

We note $(\star)$ holds for $i < k < j$ by construction.
For $k > j$, note that $x_k \in \{a_j, a_{j+1}, \dots, a_k\}$
by construction, so $(\star)$ follows from our choice of $i$ and $j$
giving the largest possible difference; the case $k < i$ is similar.


Consider five points $A$, $B$, $C$, $D$ and $E$
such that $ABCD$ is a parallelogram and $BCED$ is a cyclic quadrilateral.
Let $\ell$ be a line passing through $A$.
Suppose that $\ell$ intersects the interior of the segment $DC$ at $F$
and intersects line $BC$ at $G$.
Suppose also that $EF = EG = EC$.
Prove that $\ell$ is the bisector of angle $ DAB$.

Solution:
Let $M$, $N$, $P$ denote the midpoints of $CF$, $CG$, $AC$
(noting $P$ is also the midpoint of $BD$).

By a homothety at $C$ with ratio $1/2$,
we find $MNP$ is the image of line $\ell \equiv AGF$.

[Figure omitted]

However, since we also have $EM \perp CF$
and $EN \perp CG$ (from $EF=EG=EC$)
we conclude $PMN$ is the Simson line of $E$ with respect to $\triangle BCD$,
which implies $EP \perp BD$.
In other words, $EP$ is the perpendicular bisector of $BD$,
so $E$ is the midpoint of arc $\widehat{BCD}$.

Finally,

∠(AB, \ell) &= ∠(CD, MNP) = ∠ CMN = ∠ CEN \\
&= 90\dg - ∠ NCE = 90\dg + ∠ ECB

which means that $\ell$ is parallel to a bisector of $\angle BCD$,
and hence to one of $\angle BAD$.
(Moreover since $F$ lies on the interior of $CD$,
it is actually the internal bisector.)


In a mathematical competition some competitors are (mutual) friends.
Call a group of competitors a clique if each two of them are friends.
Given that the largest size of a clique is even,
prove that the competitors can be arranged into two rooms
such that the largest size of a clique contained in one room
is the same as the largest size of a clique contained in the other room.

Solution:
Take the obvious graph interpretation $G$.
We paint red any vertices in one of the maximal cliques $K$,
which we assume has $2r$ vertices, and paint the remaining vertices green.
We let $\alpha(\bullet)$ denote the clique number.

Initially, let the two rooms $A = K$, $B = G-K$.

We can move at most $r$ vertices of $A$ into $B$
to arrive at $\alpha(A) \le \alpha(B) \le \alpha(A)+1$.

This is actually obvious by discrete continuity.
We move one vertex at a time, noting $\alpha(A)$ decreases by one at each step,
while $\alpha(B)$ increases by either zero or one at each step.

We stop once $\alpha(B) \ge \alpha(A)$, which happens before we have moved $r$ vertices
(since then we have $\alpha(B) \ge r = \alpha(A)$).
The conclusion follows.

So let's consider the situation
$ \alpha(A) = k \ge r \qquad\text{and}\qquad \alpha(B) = k+1. $

At this point $A$ is a set of $k$ red vertices,
while $B$ has the remaining $2r-k$ red vertices (and all the green ones).
An example is shown below with $k=4$ and $2r = 6$.

[Figure omitted]

Now, if we can move any red vertex from $B$ back to $A$
without changing the clique number of $B$, we do so, and win.

Otherwise, it must be the case that every
$(k+1)$-clique in $B$ uses every red vertex in $B$.
For each $(k+1)$-clique in $B$ (in arbitrary order), we do the following procedure.

If all $k+1$ vertices are still green, pick one and re-color it blue.
This is possible since $k+1 > 2r-k$.
Otherwise, do nothing.

Then we move all the blue vertices from $B$ to $A$,
one at a time, in the same order we re-colored them.
This forcibly decreases the clique number of $B$ to $k$,
since the clique number is $k+1$ just before the last blue vertex is moved,
and strictly less than $k+1$ (hence equal to $k$) immediately after that.

After this, $\alpha(A) = k$ still holds.

Assume not, and we have a $(k+1)$-clique
which uses $b$ blue vertices and $(k+1)-b$ red vertices in $A$.
Together with the $2r-k$ red vertices already in $B$ we then get a clique of size
$ b + ( (k+1-b) ) + ( 2r-k ) = 2r + 1 $
which is a contradiction.

Dragomir Grozev posted the following motivation on \href{https://dgrozev.wordpress.com/2019/12/05/splitting-the-cliques-of-a-graph-imo-2007-p3/}{his blog}:

I think, it's a natural idea to place all students in one room and begin
moving them one by one into the other one.
Then the max size of the cliques in the first and second room
increase (resp.\ decrease) at most with one.
So, there would be a moment both sizes are almost the same.
At that moment we may adjust something.

Trying the idea, I had some difficulties
keeping track of the maximal cliques in the both rooms.
It seemed easier all the students in one of the rooms to comprise a clique.
It could be achieved by moving only the members of the maximal clique.
Following this path the remaining obstacles can be overcome naturally.


In triangle $ABC$ the bisector of $\angle BCA$
meets the circumcircle again at $R$,
the perpendicular bisector of $BC$ at $P$,
and the perpendicular bisector of $AC$ at $Q$.
The midpoint of $BC$ is $K$ and the midpoint of $AC$ is $L$.
Prove that the triangles $RPK$ and $RQL$ have the same area.

Solution:
We first begin by proving the following claim.

We have $CQ = PR$ (equivalently, $CP = QR$).

Let $O = LQ \cap KP$ be the circumcenter.
Then
$ ∠ OPQ = ∠ KPC = 90\dg - ∠ PCK
= 90\dg - ∠ LCQ = ∠ ∠ CQL = ∠ PQO. $
Thus $OP = OQ$.
Since $OC = OR$ as well, we get the conclusion.

Denote by $X$ and $Y$ the feet from $R$ to $CA$
and $CB$, so $\triangle CXR \cong \triangle CYR$.
Then, let $t = \frac{CQ}{CR} = 1 - \frac{CP}{CR}$.

[Figure omitted]

Then it follows that
$ [RQL] = [XQL] = t(1-t) \cdot [XRC]
= t(1-t) \cdot [YCR] = [YKP] = [RKP] $
as needed.

Trigonometric approaches are very possible
(and easier to find) as well:
both areas work out to be $\frac 18 ab \tan 1/2 C$.


Let $a$ and $b$ be positive integers.
Show that if $4ab - 1$ divides $(4a^{2} - 1)^{2}$, then $a = b$.

Solution:
As usual,
$ 4ab-1 \mid (4a^2-1)^2 \iff 4ab-1 \mid (4ab \cdot a-b)^2
\iff 4ab-1 \mid (a-b)^2. $
Then we use a typical Vieta jumping argument.
Define $ k = \frac{(a-b)^2}{4ab-1}. $
Note that $k = 0 \iff a = b$.
So we will prove that $k > 0$ leads to a contradiction.

Indeed, suppose $(a, b)$ is a minimal solution with $a > b$
(we have $a \neq b$ since $k \neq 0$).
By Vieta jumping, $(b, \frac{b^2+k}{a})$ is also such a solution.
But now

\frac{b^2+k}{a} \ge a &\implies k \ge a^2 - b^2 \\
&\implies \frac{(a-b)^2}{4ab-1} \ge a^2-b^2 \\
&\implies a-b \ge (4ab-1)(a+b)

which is absurd for $a,b \in \ZZ_{>0}$.
(In the last step we divided by $a-b > 0$.)


Let $n$ be a positive integer.
Consider
$ S = \left\{ (x,y,z) \mid
x,y,z \in \{ 0, 1, \dots, n\}, \;
x+y+z > 0 \right\} $
as a set of $(n+1)^3-1$ points in the three-dimensional space.
Determine the smallest possible number of planes,
the union of which contains $S$ but does not include $(0,0,0)$.

Solution:
The answer is $3n$.
Here are two examples of constructions with $3n$ planes:

$x+y+z=i$ for $i=1,\dots,3n$.
$x=i$, $y=i$, $z=i$ for $i=1,\dots,n$.

Suppose for contradiction we have $N < 3n$ planes.
Let them be $a_i x + b_i y + c_i z + 1 = 0$, for $i = 1, \dots, N$.
Define the polynomials

A(x,y,z) &= \prod_{i=1}^n (x-i) \prod_{i=1}^n (y-i) \prod_{i=1}^n (z-i) \\
B(x,y,z) &= \prod_{i=1}^N ( a_i x + b_i y + c_i z + 1 ).

Note that $A(0,0,0) = (-1)^n (n!)^3 \neq 0$
and $B(0,0,0) = 1 \neq 0$,
but $A(x,y,z) = B(x,y,z) = 0$ for any $(x,y,z) \in S$.
Also, the coefficient of $x^n y^n z^n$ in $A$ is $1$,
while the coefficient of $x^n y^n z^n$ in $B$ is $0$.

Now, define
$ P(x,y,z) \coloneq A(x,y,z) - \lambda B(x,y,z). $
where $\lambda = \frac{A(0,0,0)}{B(0,0,0)} = (-1)^{n} (n!)^3$.
We now have that

$P(x,y,z) = 0$ for any $x,y,z \in \left\{ 0,1,\dots,n \right\}^3$.
But the coefficient of $x^n y^n z^n$ is $1$.

This is a contradiction to Alon's combinatorial nullstellensatz.


Let $H$ be the orthocenter of an acute-angled triangle $ABC$.
The circle $\Gamma_{A}$ centered at the midpoint of $BC$ and passing
through $H$ intersects the sideline $BC$ at points $A_1$ and $A_2$.
Similarly, define the points $B_1$, $B_2$, $C_1$, and $C_2$.
Prove that six points $A_1$, $A_2$, $B_1$, $B_2$, $C_1$, $C_2$ are concyclic.

Solution:
We show two solutions.

First solution using power of a point.:
Let $D$, $E$, $F$ be the centers of $\Gamma_A$, $\Gamma_B$, $\Gamma_C$
(in other words, the midpoints of the sides).

We first show that $B_1$, $B_2$, $C_1$, $C_2$ are concyclic.
It suffices to prove that $A$
lies on the radical axis of the circles $\Gamma_B$ and $\Gamma_C$.

[Figure omitted]

Let $X$ be the second intersection of $\Gamma_B$ and $\Gamma_C$.
Clearly $XH$ is perpendicular to the line
joining the centers of the circles, namely $EF$.
But $EF \parallel BC$, so $XH \perp BC$.
Since $AH \perp BC$ as well,
we find that $A$, $X$, $H$ are collinear, as needed.

Thus, $B_1$, $B_2$, $C_1$, $C_2$ are concyclic.
Similarly, $C_1$, $C_2$, $A_1$, $A_2$ are concyclic,
as are $A_1$, $A_2$, $B_1$, $B_2$.
Now if any two of these three circles coincide, we are done;
else the pairwise radical axii are not concurrent, contradiction.
(Alternatively, one can argue directly that $O$ is the center of all
three circles, by taking the perpendicular bisectors.)

Second solution using length chase (Ritwin Narra).:
We claim the circumcenter $O$ of $\triangle ABC$
is in fact the center of $(A_1A_2B_1B_2C_1C_2)$.

Define $D$, $E$, $F$ as before.
Then since $OD \perp A_1A_2$ and $DA_1 = DA_2$,
which means $OA_1 = OA_2$. Similarly, we have $OB_1 = OB_2$ and $OC_1 = OC_2$.

Now since $DA_1 = DA_2 = DH$, we have $OA_1^2 = OD^2 + HD^2$.
We seek to show
$ OD^2 + HD^2 = OE^2 + HE^2 = OF^2 + HF^2. $
This is clear by Appollonius's Theorem
since $D$, $E$, and $F$ lie on the nine-point circle,
which is centered at the midpoint of $OH$.


Let $x$, $y$, $z$ be real numbers with $xyz = 1$, all different from $1$.
Prove that
$ \frac{x^2}{(x-1)^2} + \frac{y^2}{(y-1)^2} + \frac{z^2}{(z-1)^2} \ge 1 $
and show that equality holds for infinitely many choices
of rational numbers $x$, $y$, $z$.

Solution:
Let $x=a/b$, $y=b/c$, $z=c/a$, so we want to show
$ (\frac{a}{a-b})^2+(\frac{b}{b-c})^2
+(\frac{c}{c-a})^2\ge 1.$
A boring computation shows this is equivalent to
$ \frac{(a^2b+b^2c+c^2a-3abc)^2}{(a-b)^2(b-c)^2(c-a)^2} \ge 0 $
which proves the inequality
(and it is unsurprising we are in such a situation,
given that there is an infinite curve of rationals).

For equality, it suffices to show there are infinitely many integer solutions to
$ a^2b+b^2c+c^2a=3abc \iff \frac ac + \frac ba + \frac ca = 3 $
or equivalently that there are infinitely many rational solutions to
$ u + v + \frac{1}{uv} = 3. $
For any $0 \neq u \in \QQ$ the real solution for $u$ is
$ v = \frac{-u + (u-1)\sqrt{1-4/u} + 3}{2} $
and there are certainly infinitely many rational numbers $u$
for which $1-4/u$ is a rational square
(say, $u = \frac{-4}{q^2-1}$ for $q \neq \pm 1$ a rational number).


Prove that there are infinitely many positive integers $n$
such that $n^2+1$ has a prime factor greater than $2n + \sqrt{2n}$.

Solution:
The idea is to pick the prime $p$ first!

Select any large prime $p \ge 2013$,
and let $h = \left\lceil \sqrt p \right\rceil$.
We will try to find an $n$ such that
$ n \le \frac 12 (p-h) \quad \text{and} \quad p \mid n^2+1. $
This implies $p \ge 2n+\sqrt{p}$
which is enough to ensure $p \ge 2n + \sqrt{2n}$.

Assume $p \equiv 1 \pmod 8$ henceforth.
Then there exists some $\frac 12 p < x < p$
such that $x^2 \equiv -1 \pmod p$,
and we set $ x = \frac{p+1}{2} + t. $

We have $t \ge \frac{h-1}{2}$ and hence may take $n = p-x$.

Assume for contradiction this is false; then

0 &\equiv 4(x^2+1) \pmod{p} \\
&= ( p+1+2t )^2 + 4 \\
&\equiv (2t+1)^2 + 4 \pmod{p} \\
&< h^2+4

So we have that $(2t+1)^2+4$ is positive and divisible by $p$,
yet at most $\left\lceil \sqrt{p} \right\rceil^2 + 4 < 2p$.
So it must be the case that $(2t+1)^2+4 = p$,
but this has no solutions modulo $8$.


Find all functions $f$ from the positive reals to the positive reals such that
$ \frac{f(w)^2 + f(x)^2}{f(y^2)+f(z^2)} = \frac{w^2+x^2}{y^2+z^2} $
for all positive real numbers $w$, $x$, $y$, $z$ satisfying $wx=yz$.

Solution:
The answers are $f(x) \equiv x$ and $f(x) \equiv 1/x$.
These work, so we show they are the only ones.

First, setting $(t,t,t,t)$ gives $f(t^2) = f(t)^2$.
In particular, $f(1) = 1$.
Next, setting $(t, 1, \sqrt t, \sqrt t)$ gives
$ \frac{f(t)^2 + 1}{2f(t)} = \frac{t^2 + 1}{2t} $
which as a quadratic implies $f(t) \in \{t, 1/t\}$.

Now assume $f(a) = a$ and $f(b) = 1/b$.
Setting $(\sqrt a, \sqrt b, 1, \sqrt{ab})$ gives
$ \frac{a + 1/b}{f(ab) + 1} = \frac{a+b}{ab+1}. $
One can check the two cases on $f(ab)$ each imply
$a=1$ and $b=1$ respectively.
Hence the only answers are those claimed.


Let $n$ and $k$ be positive integers with $k \geq n$ and $k - n$ an even number.
There are $2n$ lamps labelled $1$, $2$, \dots, $2n$ each of which can be either on or off.
Initially all the lamps are off.
We consider sequences of steps: at each step one of the lamps is switched
(from on to off or from off to on).
Let $N$ be the number of such sequences consisting of $k$ steps
and resulting in the state where lamps $1$ through $n$ are all on,
and lamps $n + 1$ through $2n$ are all off.
Let $M$ be number of such sequences consisting of $k$ steps,
resulting in the state where lamps $1$ through $n$ are all on,
and lamps $n + 1$ through $2n$ are all off,
but where none of the lamps $n + 1$ through $2n$ is ever switched on.
Determine $\frac{N}{M}$.

Solution:
The answer is $2^{k-n}$.

Consider the following map $\Psi$ from $N$-sequences to $M$-sequences:

change every instance of $n+1$ to $1$;
change every instance of $n+2$ to $2$;
[$\vdots$]
change every instance of $2n$ to $n$.

(For example, suppose $k=9$, $n=3$;
then $144225253 \mapsto 111222223$.)

Clearly this is map is well-defined and surjective.
So all that remains is:

Every $M$-sequence has exactly $2^{k-n}$ pre-images under $\Psi$.

Indeed, suppose that there are $c_1$ instances of lamp $1$.
Then we want to pick an odd subset of the $1$'s to change to $n+1$'s,
so $2^{c_1 - 1}$ ways to do this.
And so on.
Hence the number of pre-images is
$ \prod_i 2^{c_i - 1} = 2^{k-n}. \qedhere $


Let $ABCD$ be a convex quadrilateral with $BA \neq BC$.
Denote the incircles of triangles $ABC$ and $ADC$
by $\omega_1$ and $\omega_2$ respectively.
Suppose that there exists a circle $\omega$ tangent
to ray $BA$ beyond $A$ and to the ray $BC$ beyond $C$,
which is also tangent to the lines $AD$ and $CD$.
Prove that the common external tangents to
$\omega_1$ and $\omega_2$ intersect on $\omega$.

Solution:
By the external version of Pitot theorem, the existence
of $\omega$ implies that
$ BA + AD = CB + CD. $
Let $PQ$ and $ST$ be diameters of $\omega_1$ and $\omega_2$
with $P, T \in AC$.
Then the length relation on $ABCD$ implies that $P$ and $T$
are reflections about the midpoint of $AC$.

Now orient $AC$ horizontally and let $K$ be the ``uppermost'' point of $\omega$, as shown.

[Figure omitted]

Consequently, a homothety at $B$ maps $Q$, $T$, $K$ to each other
(since $T$ is the uppermost of the excircle, $Q$ of the incircle).
Similarly, a homothety at $D$ maps $P$, $S$, $K$ to each other.
As $PQ$ and $ST$ are parallel diameters
it then follows $K$ is the exsimilicenter of $\omega_1$ and $\omega_2$.


Let $n, k \ge 2$ be positive integers and let $a_1$, $a_2$, $a_3$, \dots, $a_k$
be distinct integers in the set $\left\{ 1,2,\dots,n \right\}$
such that $n$ divides $a_i(a_{i+1} - 1)$ for $i = 1,2,\dots,k-1$.
Prove that $n$ does not divide $a_k(a_1 - 1)$.

Solution:
We proceed indirectly and assume that
$ a_i (a_{i+1}-1) \equiv 0 \pmod n $
for $i = 1, \dots, k$ (indices taken modulo $k$).
We claim that this implies all the $a_i$ are equal modulo $n$.

Let $q = p^e$ be any prime power dividing $n$.
Then, $a_1 (a_2 - 1) \equiv 0 \pmod q$, so $p$ divides either $a_1$ or $a_2-1$.

If $p \mid a_1$, then $p \nmid a_1 - 1$. Then
$ a_k (a_1-1) \equiv 0 \pmod q \implies a_k \equiv 0 \pmod q. $
In particular, $p \mid a_k$.
So repeating this argument,
we get $a_{k-1} \equiv 0 \pmod q$, $a_{k-2} \equiv 0 \pmod q$, and so on.

Similarly, if $p \mid a_2 - 1$ then $p \nmid a_2$, and
$ a_2 (a_3-1) \equiv 0 \pmod q \implies a_3 \equiv 1 \pmod q. $
In particular, $p \mid a_3 - 1$.
So repeating this argument,
we get $a_4 \equiv 0 \pmod q$, $a_5 \equiv 0 \pmod q$, and so on.

Either way, we find $a_i \pmod q$ is constant (and either $0$ or $1$).

Since $q$ was an arbitrary prime power dividing $n$,
by Chinese remainder theorem we conclude that $a_i \pmod n$ is constant as well.
But this contradicts the assumption of distinctness.


Let $ABC$ be a triangle with circumcenter $O$.
The points $P$ and $Q$ are interior points of the sides $CA$ and $AB$ respectively.
Let $K$, $L$, $M$ be the midpoints of $BP$, $CQ$, $PQ$.
Suppose that $PQ$ is tangent to the circumcircle of $\triangle KLM$.
Prove that $OP = OQ$.

Solution:
By power of a point, we have $-AQ \cdot QB = OQ^2 - R^2$
and $-AP \cdot PC = OP^2 - R^2$.
Therefore, it suffices to show $AQ \cdot QB = AP \cdot PC$.

[Figure omitted]

As $ML \parallel AC$ and $MK \parallel AB$ we have that

∠ APQ &= ∠ LMP = ∠ LKM \\
∠ PQA &= ∠ KMQ = ∠ MLK

and consequently we have the (opposite orientation) similarity
$ \triangle APQ \overset{-}{\sim} \triangle MKL. $
Therefore
$ \frac{AQ}{AP} = \frac{ML}{MK} = \frac{2ML}{2MK} = \frac{PC}{QB} $
id est $AQ \cdot QB = AP \cdot PC$, which is what we wanted to prove.


Suppose that $s_1,s_2,s_3, \dotsc$ is a strictly increasing sequence of
positive integers such that the sub-sequences
$s_{s_1}$, $s_{s_2}$, $s_{s_3}$, \dots
and $s_{s_1 + 1}$, $s_{s_2 + 1}$, $s_{s_3 + 1}$, \dots
are both arithmetic progressions.
Prove that the sequence $s_1$, $s_2$, $s_3$, \dots\ is itself an arithmetic progression.

Solution:
We present two solutions.

First solution (Alex Zhai).:
Let $s(n) \coloneq s_n$ and write

s(s(n)) &= Dn + A \\
s(s(n)+1) &= D'n + B.

In light of the bounds $s(s(n)) \le s(s(n)+1) \le s(s(n+1))$
we right away recover $D = D'$ and $A \le B$.

Let $d_n = s(n+1)-s(n)$.
Note that $\sup d_n < \infty$ since $d_n$ is bounded above by $A$.

Then we let
$ m \coloneq \min d_n, \qquad M \coloneq \max d_n. $
Now suppose $a$ achieves the maximum, meaning $s(a+1)-s(a) = M$.
Then

\underbrace{d_{s(s(a))} + \dots + d_{s(s(a+1))-1}}_{D \text{ terms}}
&= \boxed{s(s(s(a+1))) - s(s(s(a)))} \\
&= (D \cdot s(a+1) + A) - (D \cdot s(a) + A) = DM.

Now $M$ was maximal hence $M = d_{s(s(a))} = \dots = d_{s(s(a+1))-1}$.
But $d_{s(s(a))} = B-A$ is a constant.
Hence $M = B-A$.
In the same way $m = B-A$ as desired.

Second solution.:
We retain the notation $D$, $A$, $B$ above,
as well as $m = \min_n s(n+1)-s(n) \ge B-A$.
We do the involution trick first as:
$ D = \boxed{s(s(s(n)+1)) - s(s(s(n)))} = s(Dn+B) - s(Dn+A) $
and hence we recover $D \ge m(B-A)$.

The edge case $D = B-A$ is easy since then $m=1$
and $D = s(Dn+B)-s(Dn+A)$ forces $s$ to be a constant shift.
So henceforth assume $D > B-A$.

The idea is that right now the $B$ terms are ``too big'',
so we want to use the involution trick in a way that makes as many
``$A$ minus $B$'' shape expressions as possible.
This motivates considering $s(s(s(n+1))) - s(s(s(n)+1)+1) > 0$,
since the first expression will have all $A$'s
and the second expression will have all $B$'s.
Calculation gives:

s(D(n+1)+A) - s(Dn+B+1)
&= \boxed{s(s(s(n+1))) - s(s(s(n)+1)+1)} \\
&= (Ds(n+1) + A) - (D(s(n)+1) + B) \\
&= D( s(n+1)-s(n) ) + A-B-D.

Then by picking $n$ achieving the minimum $m$,
$ \underbrace{m(D+A-B-1)}_{>0} \le s(s(s(n+1))) - s(s(s(n)+1)+1) \le Dm + A-B-D $
which becomes
$ ( D-m(B-A) ) + ( (B-A)-m ) \le 0. $
Since both of these quantities were supposed to be nonnegative,
we conclude $m = B-A$ and $D = m^2$.
Now the estimate $D = s(Dn+B) - s(Dn+A) \ge m(B-A)$ is actually sharp,
so it follows that $s(n)$ is arithmetic.


Let $ABC$ be a triangle with $AB = AC$.
The angle bisectors of $\angle CAB$ and $\angle ABC$
meet the sides $BC$ and $CA$ at $D$ and $E$, respectively.
Let $K$ be the incenter of triangle $ADC$.
Suppose that $\angle BEK = 45^\circ$.
Find all possible values of $\angle CAB$.

Solution:
Here is the solution presented in my book EGMO.

Let $I$ be the incenter of $ABC$,
and set $\angle DAC = 2x$ (so that $0\dg < x < 45\dg$).
From $\angle AIE = \angle DIC$, it is easy to compute
$
\angle KIE = 90\dg - 2x, \;
\angle ECI = 45\dg -x, \;
\angle IEK = 45\dg, \;
\angle KEC = 3x. $
Having chased all the angles we want, we need a relationship.
We can find it by considering the side ratio $\frac{IK}{KC}$.
Using the angle bisector theorem,
we can express this in terms of triangle $IDC$;
however we can also express it in terms of triangle $IEC$.

[Figure omitted]

By the law of sines, we obtain
$ \frac{IK}{KC} = \frac
{\sin 45\dg \cdot \frac{EK}{\sin ( 90\dg - 2x )}}
{\sin ( 3x ) \cdot \frac{EK}{\sin ( 45\dg-x )}}
= \frac{\sin 45\dg \sin ( 45\dg - x )}
{\sin ( 3x ) \sin ( 90\dg - 2x )}. $
Also, by the angle bisector theorem on $\triangle IDC$,
we have
$ \frac{IK}{KC} = \frac{ID}{DC}
= \frac{\sin ( 45\dg-x )}{\sin( 45\dg+x )}. $
Equating these and cancelling $\sin ( 45\dg-x ) \neq 0$ gives
$ \sin 45\dg \sin ( 45\dg + x )
= \sin 3x \sin ( 90\dg - 2x ). $

Applying the product-sum formula
(again, we are just trying to break down things as much as possible),
this just becomes
$ \cos( x ) - \cos ( 90\dg + x )
= \cos ( 5x-90\dg ) - \cos ( 90\dg+x ) $
or $\cos x = \cos ( 5x-90\dg )$.

At this point we are basically done;
the rest is making sure we do not miss any solutions
and write up the completion nicely.
One nice way to do this is by using product-sum in reverse as
$ 0 = \cos ( 5x-90\dg ) - \cos x
= 2 \sin ( 3x - 45\dg ) \sin ( 2x-45\dg ). $
This way we merely consider the two cases
$ \sin ( 3x-45\dg ) = 0 \text{ and }
\sin ( 2x - 45\dg ) = 0. $
Notice that $\sin\theta = 0$ if and only $\theta$
is an integer multiple of $180\dg$.
Using the bound $0\dg < x < 45\dg$,
it is easy to see that that the permissible values of $x$
are $x = 15\dg$ and $x = \frac{45}{2}\dg$.
As $\angle A = 4x$, this corresponds to $\angle A = 60\dg$
and $\angle A = 90\dg$, which can be seen to work.


Find all functions $f \colon \ZZ_{>0} \to \ZZ_{>0}$
such that for positive integers $a$ and $b$, the numbers
$ a, \qquad f(b), \qquad f(b+f(a)-1) $
are the sides of a non-degenerate triangle.

Solution:
The only function is the identity function (which works).
We prove it is the only one.

Let $P(a,b)$ denote the given statement.

We have $f(1) = 1$, and $f(f(n)) = n$.
(In particular $f$ is a bijection.)

Note that $ P(1,b) \implies f(b) = f(b+f(1)-1). $
Otherwise, the function $f$ is periodic modulo $N = f(1)-1 \ge 1$.
This is impossible since we can fix $b$ and let $a$ be arbitrarily
large in some residue class modulo $N$.

Hence $f(1)=1$, so taking $P(n,1)$ gives $f(f(n)) = n$.

Let $\delta = f(2)-1 > 0$.
Then for every $n$,
$ f(n+1) = f(n) + \delta
\quad\text{ or }\quad f(n-1) = f(n) + \delta $

Use
$ P(2, f(n)) \implies n-2 < f( f(n) + \delta ) < n+2. $
Let $y = f(f(n)+\delta)$, hence $n-2 < y < n+2$
and $f(y) = f(n)+\delta$.
But, remark that if $y = n$, we get $\delta = 0$, contradiction.
So $y \in \{n+1, n-1\}$ and that is all.

We now show $f$ is an arithmetic progression
with common difference $+\delta$.
Indeed we already know $f(1) = 1$ and $f(2) = 1+\delta$.
Now suppose $f(1)=1$, \dots, $f(n) = 1 + (n-1)\delta$.
Then by induction for any $n \ge 2$,
the second case can't hold,
so we have $f(n+1) = f(n)+\delta$, as desired.

Combined with $f(f(n)) = n$, we recover that $f$ is the identity.


Let $a_1$, $a_2$, \dots, $a_n$ be distinct positive integers and
let $M$ be a set of $n-1$ positive integers not containing $s = a_1 + \dots + a_n$.
A grasshopper is to jump along the real axis, starting at the point $0$ and
making $n$ jumps to the right with lengths $a_1$, $a_2$, \dots, $a_n$ in some order.
Prove that the order can be chosen in such a way that
the grasshopper never lands on any point in $M$.

Solution:
The proof is by induction on $n$.
Assume $a_1 < \dots < a_n$ and call each element of $M$ a mine.
Let $x = s - a_n$.
We consider four cases, based on whether $x$ has a mine
and whether there is a mine past $x$.

If $x$ has no mine, and there is a mine past $x$,
then at most $n-2$ mines in $[0, x]$ and so we use induction to reach $x$,
then leap from $x$ to $s$ and win.

If $x$ has no mine but there is also no mine to the right of $x$,
then let $m$ be the maximal mine.
By induction hypothesis on $M \setminus \{m\}$, there is a path to $x$
using $\{a_1, \dots, a_{n-1}\}$ which avoids mines except possibly $m$.
If the path hits the mine $m$ on the hop of length $a_k$,
we then swap that hop with $a_n$, and finish.

If $x$ has a mine, but there are no mines to the right of $x$,
we can repeat the previous case with $m = x$.

Now suppose $x$ has a mine, and there is a mine past $x$.
There should exist an integer $1 \le i \le n-1$
such that $s-a_i$ and $y = s-a_i-a_n$ both have no mine.
By induction hypothesis, we can then reach $y$ in $n-2$ steps
(as there are two mines to the right of $y$); then $y \to s-a_i \to s$ finishes.

It seems much of the difficulty of the problem is realizing induction will actually work.
Attempts at induction are, indeed, a total minefield (ha!),
and given the position P6 of the problem, it is expected that many contestants
will abandon induction after some cursory attempts fail.


Find all functions $f \colon \RR \to \RR$ such that for all $x,y \in \RR$,
$ f(\left\lfloor x\right\rfloor y) = f(x)\left\lfloor f(y)\right\rfloor. $

Solution:
The only solutions are $f(x) \equiv c$,
where $c = 0$ or $1 \le c < 2$.
It's easy to see these work.

Plug in $x=0$ to get $f(0) = f(0) \left\lfloor f(y) \right\rfloor$,
so either
$ 1 \le f(y) < 2 \quad \forall y
\qquad\text{or}\qquad f(0) = 0 $

In the first situation,
plug in $y=0$ to get $f(x) \left\lfloor f(0) \right\rfloor = f(0)$,
thus $f$ is constant.
Thus assume henceforth $f(0) = 0$.

Now set $x=y=1$ to get
$ f(1) = f(1) \left\lfloor f(1) \right\rfloor $
so either $f(1) = 0$ or $1 \le f(1) < 2$.
We split into cases:

If $f(1) = 0$, pick $x=1$ to get $f(y) \equiv 0$.
If $1 \le f(1) < 2$,
then $y=1$ gives
$ f(\left\lfloor x \right\rfloor) = f(x) $
from $y=1$, in particular $f(x) = 0$ for $0 \le x < 1$.
Choose $(x,y) = ( 2, 1/2 )$ to get
$f(1) = f(2) \left\lfloor f( 1/2 ) \right\rfloor = 0$.


Let $I$ be the incenter of a triangle $ABC$ and let $\Gamma$ be its circumcircle.
Let line $AI$ intersect $\Gamma$ again at $D$.
Let $E$ be a point on arc $\widehat{BDC}$ and $F$ a point on side $BC$ such that
$ \angle BAF = \angle CAE < \tfrac12 \angle BAC. $
Finally, let $G$ be the midpoint of $IF$.
Prove that $DG$ and $EI$ intersect on $\Gamma$.

Solution:
Let $EI$ meet $\Gamma$ again at $K$.
Then it suffices to show that $KD$ bisects $IF$.
Let $AF$ meet $\Gamma$ again at $H$, so $HE \parallel BC$.
By Pascal theorem on $ AHEKDD $
we then obtain that $P = AH \cap KD$ lies on a line through $I$
parallel to $BC$.

Let $I_A$ be the $A$-excenter,
and set $Q = I_AF \cap IP$, and $T = AIDI_A \cap BFC$.
Then
$ -1 = (AI;TI_A) \overset{F} = (IQ;\infty P) $
where $\infty$ is the point at infinity along $IPQ$.
Thus $P$ is the midpoint of $IQ$.
Since $D$ is the midpoint of $II_A$ by ``Fact 5'',
it follows that $DP$ bisects $IF$.

[Figure omitted]


Find all functions $g \colon \ZZ_{>0} \to \ZZ_{>0}$ such that
$ ( g(m)+n )( g(n)+m ) $
is always a perfect square.

Solution:
For $c \ge 0$, the function $g(n) = n+c$ works; we prove this is the only possibility.

First, the main point of the problem is that:

We have $g(n) \equiv g(n') \pmod p \implies n \equiv n' \pmod p$.

Pick a large integer $M$ such that
$ \nu_p(M+g(n)), \quad \nu_p(M+g(n')) \quad \text{are both odd}. $
(It's not hard to see this is always possible.)
Now, since each of

( M + g(n) )&( n + g(M) ) \\
( M + g(n') )&( n' + g(M) )

is a square, we get $n \equiv n' \equiv -g(M) \pmod p$.

This claim implies that

The numbers $g(n)$ and $g(n+1)$ differ by $\pm 1$ for any $n$, and
The function $g$ is injective.

It follows $g$ is a linear function with slope $\pm 1$, hence done.


Let $P$ be a point interior to triangle $ABC$ (with $CA \neq CB$).
The lines $AP$, $BP$ and $CP$ meet again its circumcircle $\Gamma$
at $K$, $L$, $M$, respectively.
The tangent line at $C$ to $\Gamma$ meets the line $AB$ at $S$.
Show that from $SC = SP$ follows $MK = ML$.

Solution:
We present two solutions using harmonic bundles.

First solution (Evan Chen).:
Let $N$ be the antipode of $M$, and let $NP$ meet $\Gamma$ again at $D$.
Focus only on $CDMN$ for now (ignoring the condition).
Then $C$ and $D$ are feet of altitudes in $\triangle MNP$;
it is well-known that the circumcircle of $\triangle CDP$
is orthogonal to $\Gamma$
(passing through the orthocenter of $\triangle MPN$).
[Figure omitted]
Now, we are given that point $S$ is such that $SC$
is tangent to $\Gamma$, and $SC = SP$.
It follows that $S$ is the circumcenter of $\triangle CDP$,
and hence $SC$ and $SD$ are tangents to $\Gamma$.

Then $-1 = (AB;CD) \overset{P}{=} (KL;MN)$.
Since $MN$ is a diameter, this implies $MK = ML$.

I think it's more natural to come up with
this solution in reverse.
Namely, suppose we define the points the other way:
let $SD$ be the other tangent, so $(AB;CD) = -1$.
Then project through $P$ to get $(KL;MN) = -1$,
where $N$ is the second intersection of $DP$.
However, if $ML = MK$ then $KMLN$ must be a kite.
Thus one can recover the solution in reverse.

Second solution (Sebastian Jeon).:
We have $ SP^2 = SC^2 = SA \cdot SB
\implies
∠ SPA = ∠ PBA = ∠ LBA = ∠ LKA = ∠ LKP $
(the latter half is Reim's theorem).
Therefore $SP$ and $LK$ are parallel.

Now, let $SP$ meet $\Gamma$ again at $X$ and $Y$,
and let $Q$ be the antipode of $P$ on $(S)$.
Then
$ SP^2 = SQ^2 = SX \cdot SY
\implies (PQ;XY) = -1 \implies \angle QCP = 90\dg $
that $CP$ bisects $\angle XCY$.
Since $XY \parallel KL$,
it follows $CP$ bisects to $\angle LCK$ too.


Each of the six boxes $B_1$, $B_2$, $B_3$, $B_4$, $B_5$, $B_6$
initially contains one coin.
The following two types of operations are allowed:

Choose a non-empty box $B_j$, $1\leq j \leq 5$,
remove one coin from $B_j$ and add two coins to $B_{j+1}$;
Choose a non-empty box $B_k$, $1\leq k \leq 4$,
remove one coin from $B_k$ and swap the contents
(possibly empty) of the boxes $B_{k+1}$ and $B_{k+2}$.

Solution:
First,

(1,1,1,1,1,1) &\to (0,3,1,0,3,1) \to (0,0,7,0,0,7) \\
&\to (0,0,6,2,0,7) \to (0,0,6,1,2,7) \to (0,0,6,1,0,11) \\
&\to (0,0,6,0,11,0) \to (0,0,5,11,0,0).

and henceforth we ignore boxes $B_1$ and $B_2$,
looking at just the last four boxes;
so we write the current position as $(5,11,0,0)$.

We prove a lemma:

Let $k \ge 0$ and $n > 0$.
From $(k,n,0,0)$ we may reach $(k-1,2^n,0,0)$.

Working with only the last three boxes for now,

(n,0,0) &\to (n-1, 2, 0) \to (n-1, 0, 4) \\
&\to (n-2, 4, 0) \to (n-2, 0, 8) \\
&\to (n-3, 8, 0) \to (n-3, 0, 16) \\
&\to \dots \to (1, 2^{n-1}, 0) \to (1, 0, 2^n) \to (0, 2^n, 0).

Finally we have $(k,n,0,0) \to (k,0,2^n,0) \to (k-1,2^n, 0,0)$.

Now from $(5,11,0,0)$ we go as follows:
(5,11,0,0) &\to (4, 2^{11}, 0, 0)
\to (3, 2^{2^{11}}, 0, 0)
\to (2, 2^{2^{2^{11}}}, 0, 0) \\
&\to ( 1, 2^{2^{2^{2^{11}}}}, 0, 0)
\to (0, 2^{2^{2^{2^{2^{11}}}}}, 0, 0).

Let $A = 2^{2^{2^{2^{2^{11}}}}} > 2010^{2010^{2010}} = B$.
Then by using move 2 repeatedly on the fourth box
(i.e., throwing away several coins by swapping the empty $B_5$ and $B_6$),
we go from $(0,A,0,0)$ to $(0,B/4,0,0)$.
From there we reach $(0,0,0,B)$.


Let $a_1, a_2, a_3, \dots$ be a sequence of positive real numbers, and $s$ be a positive integer, such that
$
a_n =
\max \{ a_k + a_{n-k} \mid 1 \leq k \leq n-1 \}
\text{ for all $n > s$}.
$
Prove there exist positive integers $\ell \leq s$ and $N$, such that
$
a_n =
a_{\ell} + a_{n - \ell} \text{ for all $n \ge N$}.
$

Solution:
Let $ w_1 = \frac{a_1}{1}, \quad w_2 = \frac{a_2}{2},
\quad \dots, \quad w_s = \frac{a_s}{s}. $
(The choice of the letter $w$ is for ``weight''.)
We claim the right choice of $\ell$
is the one maximizing $w_\ell$.

Our plan is to view each $a_n$ as a linear combination
of the weights $w_1, \dots, w_s$ and track their coefficients.

To this end, let's define an $n$-type
to be a vector $T = \left< t_1, \dots, t_s\right>$
of nonnegative integers such that

$n = t_1 + \dots + t_s$; and
$t_i$ is divisible by $i$ for every $i$.

We then define its valuation as $v(T) = \sum_{i=1}^s w_i t_i$.

Now we define a $n$-type to be valid
according to the following recursive rule.
For $1 \le n \le s$ the only valid $n$-types are

T_1 &= \left< 1, 0, 0, \dots, 0 \right> \\
T_2 &= \left< 0, 2, 0, \dots, 0 \right> \\
T_3 &= \left< 0, 0, 3, \dots, 0 \right> \\
&\vdotswithin= \\
T_s &= \left< 0, 0, 0, \dots, s \right>

for $n = 1, \dots, s$, respectively.
Then for any $n > s$, an $n$-type is valid
if it can be written as the sum of a valid $k$-type
and a valid $(n-k)$-type, componentwise.
These represent the linear combinations possible in the recursion;
in other words the recursion in the problem is phrased as
$ a_n = \max_{T \text{ is a valid $n$-type}} v(T). $

In fact, we have the following description of valid $n$-types:

Assume $n > s$.
Then an $n$-type $\left< t_1, \dots, t_s \right>$ is valid
if and only if either

there exist indices $i < j$ with $i+j > s$,
$t_i \ge i$ and $t_j \ge j$; or
there exists an index $i > s/2$
with $t_i \ge 2i$.

Immediate by forwards induction on $n > s$
that all $n$-types have this property.

The reverse direction is by downwards induction on $n$.
Indeed if $\sum_i \frac{t_i}{i} > 2$,
then we may subtract off on of $\{T_1, \dots, T_s\}$
while preserving the condition;
and the case $\sum_i \frac{t_i}{i} = 2$
is essentially by definition.

The claim is a bit confusingly stated in its two cases;
really the latter case should be thought of as the situation
$i=j$ but requiring that $t_i/i$ is counted with multiplicity.

Now, for each $n > s$ we pick a valid $n$-type $T_n$
with $a_n = v(T_n)$;
if there are ties, we pick one for which the $\ell$th
entry is as large as possible.

For any $n > s$ and index $i \neq \ell$,
the $i$th entry of $T_n$
is at most $2s + \ell i$.

If not, we can go back $i\ell$ steps to get
a valid $(n-i\ell)$-type $T$
achieved by decreasing the $i$th entry of $T_n$ by $i \ell$.
But then we can add $\ell$ to the $\ell$th entry $i$
times to get another $n$-type $T'$ which obviously
has valuation at least as large,
but with larger $\ell$th entry.

Now since all other entries in $T_n$ are bounded,
eventually the sequence $(T_n)_{n > s}$
just consists of repeatedly
adding $1$ to the $\ell$th entry, as required.

One big step is to consider $w_k = a_k / k$.
You can get this using wishful thinking
or by examining small cases.
(In addition this normalization makes it easier
to see why the largest $w$ plays an important role,
since then in the definition of type,
the $n$-types all have a sum of $n$.
Unfortunately, it makes the characterization
of valid $n$-types somewhat clumsier too.)


Given any set $A = \{a_1, a_2, a_3, a_4\}$ of four distinct
positive integers, we denote the sum $a_1+a_2+a_3+a_4$ by $s_A$.
Let $n_A$ denote the number of pairs $(i,j)$ with $1 \le i < j \le 4$
for which $a_i + a_j$ divides $s_A$.
Find all sets $A$ of four distinct positive integers which achieve
the largest possible value of $n_A$.

Solution:
There are two curves of solutions,
namely $\{x,5x,7x,11x\}$ and $\{x,11x,19x,29x\}$, for any positive integer $x$,
achieving $n_A = 4$ (easy to check).
We'll show that $n_A \le 4$ and equality holds only in one of the curves.

Let $A = \{a < b < c < d\}$.

We have $n_A \le 4$ with equality iff
$ a+b \mid c+d, \quad a+c \mid b+d, \quad a+d = b+c. $

Note $a+b \mid s_A \iff a+b \mid c+d$ etc.
Now $c+d \nmid a+b$ and $b+d \nmid a+c$ for size reasons, so we already have $n_A \le 4$;
moreover $a+d \mid b+c$ and $b+c \mid a+d$ if and only if $a+d = b+c$.

We now show the equality curve is the one above.
$ a+c \mid b+d \iff a+c \mid -a+2b+c \iff a+c \mid 2(b-a). $
Since $a+c > |b-a|$, so we must have $a+c=2(b-a)$.
So we now have

c &= 2b-3a \\
d &= b+c-a = 3b+c-4a.

The last condition is
$ a+b \mid c+d = 5b-7a \iff a+b \mid 12a. $
Now, let $x = \gcd(a,b)$.
The expressions for $c$ and $d$ above imply that
$x \mid c,d$ so we may scale down so that $x = 1$.
Then $\gcd(a+b,a) = \gcd(a,b) = 1$ and so $a+b \mid 12$.

We have $c > b$, so $3a < b$.
The only pairs $(a,b)$ with $3a < 2b$, $\gcd(a,b) = 1$ and $a+b \mid 12$
are $(a,b) \in \left\{ (1,5), (1,11) \right\}$ which give the solutions earlier.


Let $\mathcal{S}$ be a finite set of at least two points in the plane.
Assume that no three points of $\mathcal S$ are collinear.
A windmill is a process that starts with a
line $\ell$ going through a single point $P \in \mathcal S$.
The line rotates clockwise about the pivot $P$ until the first time
that the line meets some other point belonging to $\mathcal S$.
This point, $Q$, takes over as the new pivot,
and the line now rotates clockwise about $Q$,
until it next meets a point of $\mathcal S$.
This process continues indefinitely.

Show that we can choose a point $P$ in $\mathcal S$ and
a line $\ell$ going through $P$ such that the resulting windmill
uses each point of $\mathcal S$ as a pivot infinitely many times.

Solution:
Orient $\ell$ in some direction,
and color the plane such that its left half is red
and right half is blue.
The critical observation is that:

The number of points on the red side of $\ell$ does not change,
nor does the number of points on the blue side
(except at a moment when $\ell$ contains two points).

Thus, if $|\mathcal S| = n+1$,
it suffices to pick the initial configuration
so that there are $\left\lfloor n/2 \right\rfloor$
red and $\left\lceil n/2 \right\rceil$ blue points.
Then when the line $\ell$ does a full $180\dg$ rotation,
the red and blue sides ``switch'',
so the windmill has passed through every point.

(See official shortlist for verbose write-up;
this is deliberately short to make a point.)


Let $f \colon \RR \to \RR$ be a real-valued function
defined on the set of real numbers that satisfies
$ f(x+y) \leq yf(x) + f(f(x))$
for all real numbers $x$ and $y$.
Prove that $f(x) = 0$ for all $x \leq 0$.

Solution:
We begin by rewriting the given as
$ f(z) \le (z-x)f(x) + f(f(x)) \quad
\forall x,z \in \RR \qquad (\heartsuit) $
(which is better anyways since control over inputs to $f$ is more valuable).
We start by eliminating the double $f$:
let $z = f(w)$ to get
$ f(f(w)) \le (f(w)-x)f(x) + f(f(x)) $
and then use the symmetry trick to write
$ f(f(x)) \le (f(x)-w)f(w) + f(f(w)) $
so that when we sum we get
$ wf(w) + xf(x) \le 2f(x)f(w). $

Next we use cancellation trick: set $w = 2f(x)$ in the above to get
$ xf(x) \le 0 \quad \forall x \in \RR. \qquad (\spadesuit) $

For every $p \in \RR$, we have $f(p) \le 0$.

Assume $f(p) > 0$ for some $p \in \RR$.
Then for any negative number $z$,
$ 0 \overset{(\spadesuit)}{\le} f(z)
\overset{(\heartsuit)}{\le} (z-p)f(p) + f(f(p)). $
which is false if we let $z \to -\infty$.

Together with $(\spadesuit)$ we derive $f(x) = 0$ for $x < 0$.
Finally, letting $x$ and $z$ be any negative numbers
in $(\heartsuit)$, we get $f(0) \ge 0$, so $f(0) = 0$ too.

As another corollary of the claim, $f(f(x)) = 0$ for all $x$.

A nontrivial example of a working $f$ is to take
$ f(x) =
-\exp(\exp(\exp(x))) & x > 0 \\
0 & x \le 0.
$
or some other negative function growing rapidly in absolute value for $x > 0$.


Let $n > 0$ be an integer.
We are given a balance and $n$ weights of weight $2^0$, $2^1$, \dots, $2^{n-1}$.
We are to place each of the $n$ weights on the balance, one after another,
in such a way that the right pan is never heavier than the left pan.
At each step we choose one of the weights
that has not yet been placed on the balance,
and place it on either the left pan or the right pan,
until all of the weights have been placed.
Determine the number of ways in which this can be done.

Solution:
The answer is $a_n = (2n-1)!!$.

We refer to what we're counting as a valid $n$-sequence:
an order of which weights to place,
and whether to place them on the left or right pan.

We use induction, with $n=1$ being obvious.
Now consider the weight $2^0 = 1$.

If we delete it from any valid $n$-sequence,
we get a valid $(n-1)$-sequence with all weights doubled.
Given a valid $(n-1)$-sequence with all weights doubled,
we may insert $2^0 = 1$ it into $2n-1$ ways.
Indeed, we may insert it anywhere, and designate it either left or right,
except we may not designate right if we choose to insert
$2^0 = 1$ at the very beginning.

Consequently, we have that
$ a_n = (2n-1) \cdot a_{n-1}. $
Since $a_1 = 1$, the conclusion follows.

[Gabriel Levin]
An alternate approach can be done by considering the heaviest weight $2^{n-1}$
instead of the lightest weight $2^0=1$.
This gives a more complicated recursion:
$ a_n = \sum_{k=0}^{n-1} \binom{n-1}{k} 2^{n-k-1} (n-k-1)! a_k $
by summing over the index $k$ corresponding to the number of weights
placed before the heaviest weight $2^{n-1}$ is placed.

This recursion can then be rewritten as

a_n &= \sum_{k=0}^{n-1} \binom{n-1}{k} 2^{n-k-1} (n-k-1)! a_k \\
&= (n-1)! \sum_{k=0}^{n-1} \frac{2^{n-k-1}a_k}{k!} \\
&= 2(n-1)! \sum_{k=0}^{n-1} \frac{2^{(n-1)-k-1}a_k}{k!} \\
&= 2(n-1)(n-2)! ( \sum_{k=0}^{(n-1)-1} \frac{2^{(n-1)-k-1}a_k}{k!} ) + 2(n-1)! \frac{\frac12 a_{n-1}}{(n-1)!} \\
&= 2(n-1) a_{n-1} + a_{n-1} \\
&= (2n-1)a_{n-1}

and since $a_1 = 1$, we have $a_n = (2n-1)!!$ by induction on $n$.


Let $f \colon \ZZ \to \ZZ_{>0}$ be a function such that
$f(m-n) \mid f(m) - f(n)$ for $m,n \in \ZZ$.
Prove that if $m,n \in \ZZ$ satisfy $f(m) \le f(n)$
then $f(m) \mid f(n)$.

Solution:
Let $P(m,n)$ denote the given assertion.
First, we claim $f$ is even.
This is straight calculation:

$P(x,0) \implies f(x) \mid f(x)-f(0)
\implies f(x) \mid M \coloneq f(0)$.
$P(0,x) \implies f(-x) \mid M-f(x) \implies
f(-x) \mid f(x)$.
Analogously, $f(x) \mid f(-x)$.
So $f(x) = f(-x)$ and $f$ is even.

Let $x$, $y$, $z$ be integers with $x+y+z=0$.
Then among $f(x)$, $f(y)$, $f(z)$,
two of them are equal and divide the third.

Let $a = f(\pm x)$, $b = f(\pm y)$, $c = f(\pm z)$
be positive integers.
Note that

a &\mid b-c \\
b &\mid c-a \\
c &\mid a-b

from $P(y,-z)$ and similarly.
WLOG $c = \max(a,b,c)$; then $c > |a-b|$
so $a=b$. Thus $a=b \mid c$ from the first two.

This implies the problem,
by taking $x$ and $y$ in the previous claim
to be the integers $m$ and $n$.

At ,
Davi Medeiros gives the following characterization
of functions $f$ satisfying the hypothesis.

Pick $f(0)$, $k$ positive integers,
a chain $d_1 \mid d_2 \mid \dots \mid d_k$ of divisors of $f(0)$,
and positive integers $a_1,a_2,\dots,a_{k-1}$,
greater than $1$ (if $k=1$, $a_i$ doesn't exist, for every $i$).
We'll define $f$ as follows:

$f(n)=d_1$, for every integer $n$ that is not divisible by $a_1$;
$f(a_1n)=d_2$, for every integer $n$ that is not divisible by $a_2$;
$f(a_1a_2n)=d_3$, for every integer $n$ that is not divisible by $a_3$;
$f(a_1a_2a_3n)=d_4$, for every integer $n$ that is not divisible by $a_4$;
\dots
$f(a_1a_2 \dots a_{k-1}n)=d_k$, for every integer $n$;


Let $ABC$ be an acute triangle with circumcircle $\Gamma$.
Let $\ell$ be a tangent line to $\Gamma$, and let $\ell_a$, $\ell_b$, $\ell_c$ be the lines obtained
by reflecting $\ell$ in the lines $BC$, $CA$, and $AB$, respectively.
Show that the circumcircle of the triangle determined by the lines $\ell_a$, $\ell_b$, and $\ell_c$
is tangent to the circle $\Gamma$.

Solution:
This is a hard problem with many beautiful solutions.
The following solution is not very beautiful but not too hard to find during an olympiad,
as the only major insight it requires is the construction of $A_2$, $B_2$, and $C_2$.

[Figure omitted]

We apply complex numbers with $\omega$ the unit circle and $p=1$. Let $A_1 = \ell_B \cap \ell_C$, and let $a_2 = a^2$ (in other words, $A_2$ is the reflection of $P$ across the diameter of $\omega$ through $A$). Define the points $B_1$, $C_1$, $B_2$, $C_2$ similarly.

We claim that $A_1A_2$, $B_1B_2$, $C_1C_2$ concur at a point on $\Gamma$.

We begin by finding $A_1$. If we reflect the points $1+i$ and $1-i$ over $AB$, then we get two points $Z_1$, $Z_2$ with

z_1 &= a+b-ab(1-i) = a+b-ab+abi \\
z_2 &= a+b-ab(1+i) = a+b-ab-abi. \\
\intertext{Therefore,}
z_1 - z_2 &= 2abi \\
z_1z_2 - z_2{z_1}
&= -2i ( a+b+\frac1a+\frac1b-2 ).

Now $\ell_C$ is the line $Z_1Z_2$,
so with the analogous equation $\ell_B$ we obtain:

a_1 &= \frac{ -2i( a+b+\frac1a+\frac1b-2 )( 2ac i ) +
2i( a+c+\frac1a+\frac1c-2 )(2abi) }
{ ( -\frac{2}{ab}i )
( 2ac i ) - ( -\frac{2}{ac}i ) ( 2abi )} \\
&= \frac{[ c-b ]a^2 + [ \frac cb - \frac bc - 2c + 2b ]a + (c-b) }{\frac cb - \frac bc} \\
&= a + \frac{(c-b)[ a^2-2a+1 ]}{(c-b)(c+b)/bc} \\
&= a + \frac{bc}{b+c} (a-1)^2.

Then the second intersection of $A_1A_2$ with $\omega$ is given by

\frac{a_1-a_2}{1-a_2a_1}
&= \frac{a+\frac{bc}{b+c}(a-1)^2-a^2}{1-a-a^2 \cdot \frac{(1-1/a)^2}{b+c}} \\
&= \frac{a + \frac{bc}{b+c}(1-a)}{1 - \frac{1}{b+c}(1-a)} \\
&= \frac{ab+bc+ca - abc}{a+b+c-1}.

Thus, the claim is proved.

Finally, it suffices to show $A_1B_1 \parallel A_2B_2$.
One can also do this with complex numbers;
it amounts to showing $a^2-b^2$, $a-b$, $i$
(corresponding to $A_2 B_2$, $A_1 B_1$, $PP$)
have their arguments an arithmetic progression, equivalently
$ \frac{(a-b)^2}{i(a^2-b^2)} \in \RR
\iff
\frac{(a-b)^2}{i(a^2-b^2)}
= \frac{( \frac 1a-\frac1b )^2}
{\frac1i(\frac{1}{a^2}-\frac{1}{b^2})}
$
which is obvious.

One can use directed angle chasing for this last part too.
Let $BC$ meet $\ell$ at $K$ and $B_2C_2$ meet $\ell$ at $L$.
Evidently

-∠ B_2LP &= ∠ LPB_2 + ∠ PB_2L \\
&= 2 ∠ KPB + ∠ PB_2C_2 \\
&= 2 ∠ KPB + 2∠ PBC \\
&= -2∠ PKB \\
&= ∠ PKB_1

as required.


Let $ABC$ be a triangle and $J$ the center of the $A$-excircle.
This excircle is tangent to the side $BC$ at $M$,
and to the lines $AB$ and $AC$ at $K$ and $L$, respectively.
The lines $LM$ and $BJ$ meet at $F$, and the lines $KM$ and $CJ$ meet at $G$.
Let $S$ be the point of intersection of the lines $AF$ and $BC$,
and let $T$ be the point of intersection of the lines $AG$ and $BC$.
Prove that $M$ is the midpoint of $ST$.

Solution:
We employ barycentric coordinates with reference $\triangle ABC$.
As usual $a = BC$, $b = CA$, $c = AB$, $s = 1/2(a+b+c)$.

It's obvious that $K = ( -(s-c): s : 0)$, $M = ( 0 : s-b : s-c)$.
Also, $J = (-a : b : c)$.
We then obtain
$ G = ( -a: b : \frac{-as + (s-c)b}{s-b} ). $
It follows that
$ T = ( 0 : b : \frac{-as + (s-c)}{s-b} ) = ( 0 : b(s-b) : b(s-c) - as). $
Normalizing, we see that $T = ( 0, -\frac{b}{a}, 1 + \frac{b}{a} )$,
from which we quickly obtain $MT = s$.
Similarly, $MS = s$, so we're done.


Let $a_2$, $a_3$, \dots, $a_n$ be positive reals with product $1$,
where $n \ge 3$.
Show that
$ (1+a_2)^2 (1+a_3)^3 \dots (1+a_n)^n > n^n. $

Solution:
Try the dumbest thing possible: by AM-GM,

(1 + a_2)^2 &\ge 2^2 a_2 \\
(1 + a_3)^3 = ( 1/2 + 1/2 + a_3 )^3 &\ge \frac{3^3}{2^2} a_3 \\
(1 + a_4)^4 = ( \frac13 + \frac13 + \frac13 + a_4 )^4
&\ge \frac{4^4}{3^3} a_4 \\
&\vdotswithin=

and so on.
Multiplying these all gives the result.
The inequality is strict since it's not possible
that $a_2 = 1$, $a_3 = 1/2$, et cetera.


The liar's guessing game is a game played between two players $A$ and $B$.
The rules of the game depend on two fixed positive integers $k$ and $n$
which are known to both players.

At the start of the game $A$
chooses integers $x$ and $N$ with $1 \le x \le N$.
Player $A$ keeps $x$ secret, and truthfully tells $N$ to player $B$.
Player $B$ now tries to obtain information about $x$
by asking player $A$ questions as follows:
each question consists of $B$ specifying an arbitrary set $S$
of positive integers (possibly one specified in some previous question),
and asking $A$ whether $x$ belongs to $S$.
Player $B$ may ask as many questions as he wishes.
After each question, player $A$ must immediately answer
it with yes or no, but is allowed to lie as many times as she wants;
the only restriction is that, among any $k+1$ consecutive answers,
at least one answer must be truthful.

After $B$ has asked as many questions as he wants,
he must specify a set $X$ of at most $n$ positive integers.
If $x$ belongs to $X$, then $B$ wins;
otherwise, he loses.
Prove that:

[(a)]
If $n \ge 2^k$, then $B$ can guarantee a win.
For all sufficiently large $k$,
there exists an integer $n \ge (1.99)^k$
such that $B$ cannot guarantee a win.

Solution:
Call the players Alice and Bob.

\textbf{Part (a)}: We prove the following.

If $N \ge 2^k+1$, then in $2k+1$ questions,
Bob can rule out some number in $\{1, \dots, 2^k+1\}$
form being equal to $x$.

First, Bob asks the question $S_0 = \{ 2^k+1 \}$
until Alice answers ``yes''
or until Bob has asked $k+1$ questions.
If Alice answers ``no'' to all of these then Bob rules out $2^k+1$.
So let's assume Alice just said ``yes''.

Now let $T = \{1, \dots, 2^k\}$.
Then, he asks $k$-follow up questions $S_1$, \dots, $S_k$
defined as follows:

$S_1 = \{1, 3, 5, 7, \dots, 2^k-1\}$ consists of all numbers
in $T$ whose least significant digit in binary is $1$.
$S_2 = \{ 2, 3, 6, 7, \dots, 2^k-2, 2^k-1\}$
consists of all numbers in $T$ whose second least
significant digit in binary is $1$.
More generally $S_i$
consists of all numbers in $T$ whose $i$th least
significant digit in binary is $1$.

WLOG Alice answers these all as ``yes'' (the other cases are similar).
Among the last $k+1$ answers at least one must be truthful,
and the number $2^k$ (having zeros in all relevant digits)
does not appear in any of $S_0$, \dots, $S_k$ and is ruled out.

Thus in this way Bob can repeatedly find non-possibilities for $x$
(and then relabel the remaining candidates $1$, \dots, $N-1$)
until he arrives at a set of at most $2^k$ numbers.

\textbf{Part (b)}:
It suffices to consider $n = \left\lceil 1.99^k \right\rceil$
and $N = n+1$ for large $k$.
At the $t$th step, Bob asks some question $S_t$;
we phrase each of Alice's answers in the form ``$x \notin B_t$'',
where $B_t$ is either $S_t$ or its complement.
(You may think of these as ``bad sets'';
the idea is to show we can avoid having any number
appear in $k+1$ consecutive bad sets,
preventing Bob from ruling out any numbers.)

Main idea: for every number $1 \le x \le N$,
at time step $t$ we define its weight
to be $ w(x) = 1.998^e $
where $e$ is the largest number
such that $x \in B_{t-1} \cap B_{t-2} \cap \dots \cap B_{t-e}$.

Alice can ensure the total weight never exceeds $1.998^{k+1}$
for large $k$.

Let $W_{t}$ denote the sum of weights after the $t$th question.
We have $W_0 = N < 1000n$.
We will prove inductively that $W_t < 1000n$ always.

At time $t$, Bob specifies a question $S_t$.
We have Alice choose $B_t$ as whichever of $S_t$ or $S_t$
has lesser total weight, hence at most $W_t/2$.
The weights of for $B_t$ increase by a factor of $1.998$,
while the weights for $B_t$ all reset to $1$.
So the new total weight after time $t$ is
$ W_{t+1} \le 1.998 \cdot \frac{W_t}{2}
+ \# B_t \le 0.999 W_t + n. $
Thus if $W_t < 1000n$ then $W_{t+1} < 1000n$.

To finish, note that
$1000n < 1000 ( 1.99^k + 1 ) < 1.998^{k+1}$
for $k$ large.

In particular, no individual number can have weight $1.998^{k+1}$.
Thus for every time step $t$ we have
$ B_t \cap B_{t+1} \cap \dots \cap B_{t+k} = \varnothing. $
Then once Bob stops, if he declares a set of $n$ positive integers,
and $x$ is an integer Bob did not choose,
then Alice's question history is consistent with $x$ being Alice's number,
as among any $k+1$ consecutive answers
she claimed that $x \in B_t$ for some $t$ in that range.

[Motivation]
In our $B_t$ setup, let's think backwards.
The problem is equivalent to avoiding $e = k+1$ at any time step $t$,
for any number $x$.
That means

have at most two elements with $e = k$ at time $t-1$,
thus have at most four elements with $e = k-1$ at time $t-2$,
thus have at most eight elements with $e = k-2$ at time $t-3$,
and so on.

We already exploited this in solving part (a).
In any case it's now natural to try letting $w(x) = 2^e$,
so that all the cases above sum to ``equally bad'' situations:
since $8 \cdot 2^{k-2} = 4 \cdot 2^{k-1} = 2 \cdot 2^k$, say.

However, we then get $W_{t+1} \le 1/2 (2W_t) + n$,
which can increase without bound due to contributions
from numbers resetting to zero.
The way to fix this is to change the weight to $w(x) = 1.998^e$,
taking advantage of the little extra space we have
due to having $n \ge 1.99^k$ rather than $n \ge 2^k$.


Find all functions $f \colon \ZZ \to \ZZ$ such that,
for all integers $a$, $b$, $c$ that satisfy $a+b+c=0$,
the following equality holds:
$ f(a)^2+f(b)^2+f(c)^2 = 2f(a)f(b)+2f(b)f(c)+2f(c)f(a). $

Solution:
Answer: for arbitrary $k \in \ZZ$, we have
[(i)]
$f(x) = kx^2$,
$f(x) = 0$ for even $x$, and $f(x) = k$ for odd $x$, and
$f(x) = 0$ for $x \equiv 0 \pmod 4$,
$f(x) = k$ for odd $x$, and $f(x) = 4k$ for $x \equiv 2 \pmod 4$.

These can be painfully seen to work.
(It's more natural to think of these as
$f(x) = x^2$, $f(x) = x^2 \pmod 4$, $f(x) = x^2 \pmod 8$,
and multiples thereof.)

Set $a=b=c=0$ to get $f(0)=0$.
Then set $c=0$ to get $f(a) = f(-a)$, so $f$ is even.
Now $ f(a)^2 + f(b)^2 + f(a+b)^2
= 2f(a+b)( f(a)+f(b) ) + 2f(a)f(b) $
or
$ ( f(a+b) - ( f(a)+f(b) ) )^2
= 4f(a)f(b). $
Hence $f(a)f(b)$ is a perfect square for all $a,b \in \ZZ$.
So there exists a $\lambda$ such that $f(n) = \lambda g(n)^2$, where $g(n) \ge 0$.
From here we recover
$ \boxed{g(a+b) = \pm g(a) \pm g(b)}. $
Also $g(0) = 0$.

Let $k = g(1) \neq 0$.
We now split into cases on $g(2)$:

$g(2) = 0$. Put $b = 2$ in original to get
$g(a+2) = \pm g(a) = +g(a)$.
$g(2) = 2k$. Cases on $g(4)$:

$g(4) = 0$, then we get
$(g(n))_{n\ge0} = (0,1,2,1,0,1,2,1,\dots)$. This works.
$g(4) = 4k$. This only happens when
$g(1) = k$, $g(2) = 2k$, $g(3) = 3k$, $g(4) = 4k$.
Then

$g(5) = \pm 3k \pm 2k = \pm 4k \pm k$.
$g(6) = \pm4k \pm 2k = \pm5k \pm k$.
\dots

and so by induction $g(n) = nk$.


Let $ABC$ be a triangle with $\angle BCA = 90\dg$,
and let $D$ be the foot of the altitude from $C$.
Let $X$ be a point in the interior of the segment $CD$.
Let $K$ be the point on the segment $AX$ such that $BK = BC$.
Similarly, let $L$ be the point on the segment $BX$ such that $AL = AC$.
Let $M = AL \cap BK$.
Prove that $MK = ML$.

Solution:
Let $\omega_A$ and $\omega_B$ be the circles through $C$
centered at $A$ and $B$;
extend rays $AK$ and $BL$ to hit $\omega_B$ and $\omega_A$ again at $K^\ast$, $L^\ast$.
By radical center $X$,
we have $KLK^{\ast}L^{\ast}$ is cyclic,
say with circumcircle $\omega$.

[Figure omitted]

By orthogonality of $(A)$ and $(B)$ we find that
$AL$, $AL^\ast$,
$BK$, $BK^\ast$ are tangents to $\omega$
(in particular, $KLK^{\ast}L^{\ast}$ is harmonic).
In particular $MK$ and $ML$ are tangents to $\omega$,
so $MK = ML$.


Find all positive integers $n$
for which there exist non-negative integers $a_1, a_2, \dots, a_n$
such that
$ \frac{1}{2^{a_1}} + \frac{1}{2^{a_2}} + \dots + \frac{1}{2^{a_n}}
= \frac{1}{3^{a_1}} + \frac{2}{3^{a_2}} + \dots + \frac{n}{3^{a_n}}
= 1. $

Solution:
The answer is $n \equiv 1, 2 \pmod 4$.
To see these are necessary,
note that taking the latter equation modulo $2$ gives
$ 1 = \frac{1}{3^{a_1}} + \frac{2}{3^{a_2}} + \dots + \frac{n}{3^{a_n}}
\equiv 1 + 2 + .. + n \pmod 2. $

Now we prove these are sufficient.
The following nice construction was posted on AOPS
by the user \texttt{cfheolpiixn}.

If $n = 2k-1$ works then so does $n = 2k$.

Replace
$ \frac{k}{3^r} = \frac{k}{3^{r+1}} + \frac{2k}{3^{r+1}}.
\qquad(\ast) \qedhere $

If $n = 4k+2$ works then so does $n = 4k + 13$.

First use the identity
$
\frac{k+2}{3^r} = \frac{k+2}{3^{r+2}}
+ \frac{4k+ 3}{3^{r+3}}
+ \frac{4k+ 5}{3^{r+3}}
+ \frac{4k+ 7}{3^{r+3}}
+ \frac{4k+ 9}{3^{r+3}}
+ \frac{4k+11}{3^{r+3}}
+ \frac{4k+13}{3^{r+3}}
$
to fill in the odd numbers.
The even numbers can then be instantiated with $(\ast)$ too.

Thus it suffices to construct base cases
for $n = 1$, $n = 5$, $n = 9$.
They are

1 &= \frac{1}{3^0} \\
&= \frac{1}{3^2} + \frac{2}{3^2} + \frac{3}{3^2}
+ \frac{4}{3^3} + \frac{5}{3^3} \\
&= \frac{1}{3^2} + \frac{2}{3^3} + \frac{3}{3^3}
+ \frac{4}{3^3} + \frac{5}{3^3} + \frac{6}{3^4}
+ \frac{7}{3^4} + \frac{8}{3^4} + \frac{9}{3^4}.


Let $k$ and $n$ be positive integers.
Prove that there exist positive integers $m_1$, \dots, $m_k$
such that
$ 1 + \frac{2^k-1}{n} = ( 1 + \frac{1}{m_1} ) ( 1 + \frac{1}{m_2} )
\dots ( 1 + \frac{1}{m_k} ). $

Solution:
By induction on $k \ge 1$.
When $k = 1$ there is nothing to prove.

For the inductive step, if $n$ is even, write
$
\frac{n + (2^k-1)}{n}
= ( 1 + \frac{1}{n + (2^k-2)} ) \cdot \frac{\frac n2 + (2^{k-1}-1)}{\frac n2}
$
and use inductive hypothesis on the second term.
On the other hand if $n$ is odd then write
$
\frac{n + (2^k-1)}{n}
= ( 1 + \frac{1}{n} ) \cdot \frac{\frac{n+1}{2} + (2^{k-1}-1)}{\frac{n+1}2}
$
and use inductive hypothesis on the second term.


A configuration of $4027$ points in the plane is called
Colombian if it consists of $2013$ red points and $2014$ blue points,
and no three of the points of the configuration are collinear.
By drawing some lines, the plane is divided into several regions.
An arrangement of lines is good for a Colombian configuration
if the following two conditions are satisfied:

[(i)] No line passes through any point of the configuration.
[(ii)] No region contains points of both colors.

Solution:
The answer is $k \ge 2013$.

To see that $k = 2013$ is necessary,
consider a regular $4026$-gon and alternatively color the
points red and blue,
then place the last blue point anywhere
in general position (it doesn't matter).
Each side of the $4026$ is a red-blue line segment
which needs to be cut by one of the $k$ lines,
and each line can cut at most two of the segments.

Now, we prove that $k = 2013$ lines is sufficient.
Consider the convex hull of all the points.

If the convex hull has any red points,
cut that red point off from everyone else by a single line.
Then, for each of the remaining $2012$ red points,
break them into $1006$ pairs arbitrarily,
and for each pair $\{A, B\}$ draw two lines
parallel to $AB$ and close to them.

If the convex hull has two consecutive blue points,
cut those two blue points off from everyone else by a single line.
Then repeat the above construction
for the remaining $2012$ blue points.

The end.


Let the excircle of triangle $ABC$ opposite
the vertex $A$ be tangent to the side $BC$ at the point $A_1$.
Define the points $B_1$ on $CA$ and $C_1$ on $AB$ analogously,
using the excircles opposite $B$ and $C$, respectively.
Suppose that the circumcenter of triangle $A_1B_1C_1$ lies
on the circumcircle of triangle $ABC$.
Prove that triangle $ABC$ is right-angled.

Solution:
We ignore for now the given condition
and prove the following important lemma.

Let $(AB_1C_1)$ meet $(ABC)$ again at $X$.
From $BC_1 = B_1C$ follows $XC_1 = XB_1$,
and $X$ is the midpoint of major arc $\widehat{BC}$.

This follows from the fact that we have
a spiral similarity $\triangle XBC_1 \sim \triangle XCB_1$
which must actually be a spiral congruence
since $BC_1 = B_1C$.

We define the arc midpoints $Y$ and $Z$ similarly,
which lie on the perpendicular bisectors of
$A_1 C_1$, $A_1 B_1$.

[Figure omitted]

We now turn to the problem condition
which asserts the circumcenter $W$ of $\triangle A_1B_1C_1$
lies on $(ABC)$.

We may assume WLOG that $W = X$.

This is just configuration analysis,
since we already knew that the arc midpoints
both lie on $(ABC)$ and the relevant perpendicular bisectors.

Point $W$ lies on $(ABC)$ and hence outside $\triangle ABC$,
hence outside $\triangle A_1 B_1 C_1$.
Thus we may assume WLOG that $\angle B_1 A_1 C_1 > 90\dg$.
Then $A$ and $X$ lie on the same side of line $B_1 C_1$,
and since $W$ is supposed to lie both on $(ABC)$
and the perpendicular bisector of $B_1C_1$ it follows $W = X$.

Consequently, $XY$ and $XZ$
are exactly the perpendicular bisectors
of $A_1 C_1$, $A_1 B_1$.
The rest is angle chase, the fastest one is

\angle A &= \angle C_1 X B_1
= \angle C_1 X A_1 + \angle A_1 X B_1
= 2 \angle YXA_1 + 2 \angle A_1 X Z \\
&= 2 \angle YXZ = 180\dg - \angle A

which solves the problem.

Angle chasing is also possible even without
the points $Y$ and $Z$, though it takes much longer.
Introduce the Bevan point $V$ and use the fact
that $VA_1B_1C$ is cyclic (with diameter $VC$)
and similarly $VA_1C_1B$ is cyclic;
a calculation then gives $\angle CVB = 180\dg - 1/2 \angle A$.
Thus $V$ lies on the circle with diameter $I_b I_c$.


Let $ABC$ be an acute triangle with orthocenter $H$,
and let $W$ be a point on the side $BC$, between $B$ and $C$.
The points $M$ and $N$ are the feet of the altitudes
drawn from $B$ and $C$, respectively.
Suppose $\omega_1$ is the circumcircle of triangle $BWN$
and $X$ is a point such that $WX$ is a diameter of $\omega_1$.
Similarly, $\omega_2$ is the circumcircle of triangle $CWM$
and $Y$ is a point such that $WY$ is a diameter of $\omega_2$.
Show that the points $X$, $Y$, and $H$ are collinear.

Solution:
We present two solutions, an elementary one
and then an advanced one by moving points.

First solution, classical.:
Let $P$ be the second intersection of $\omega_1$ and $\omega_2$;
this is the Miquel point, so $P$ also lies on the circumcircle of $AMN$,
which is the circle with diameter $AH$.

[Figure omitted]

We now contend:

Points $P$, $H$, $X$ collinear.
(Similarly, points $P$, $H$, $Y$ are collinear.)

[Proof using power of a point]
By radical axis on $BNMC$, $\omega_1$, $\omega_2$,
it follows that $A$, $P$, $W$ are collinear.
We know that $\angle APH = 90\dg$, and also
$\angle XPW = 90\dg$ by construction.
Thus $P$, $H$, $X$ are collinear.

[Proof using angle chasing]
This is essentially Reim's theorem:
$ ∠ NPH = ∠ NAH = ∠ BAH = ∠ ABX = ∠ NBX = ∠ NPX $
as desired.
Alternatively, one may prove $A$, $P$, $W$ are collinear by
$∠ NPA = ∠ NMA = ∠ NMC = ∠ NBC = ∠ NBW = ∠ NPW$.

Second solution, by moving points.:
Fix $\triangle ABC$ and vary $W$.
Let $\infty$ be the point at infinity perpendicular to $BC$
for brevity.

By spiral similarity, the point $X$ moves linearly on $B\infty$
as $W$ varies linearly on $BC$.
Similarly, so does $Y$.
So in other words, the map $ X \mapsto W \mapsto Y $
is linear.
However, the map $ X \mapsto Y' \coloneq XH \cap C\infty $
is linear too.

To show that these maps are the same,
it suffices to check it thus at two points.

When $W = B$, the circle $(BNW)$
degenerates to the circle through $B$ tangent to $BC$,
and $X = CN \cap B\infty$.
We have $Y = Y' = C$.
When $W = C$, the result is analogous.
Although we don't need to do so,
it's also easy to check the result if $W$
is the foot from $A$
since then $XHWB$ and $YHWC$ are rectangles.


Suppose a function $f \colon \QQ_{>0} \to \RR$ satisfies:

[(i)] If $x,y \in \QQ_{>0}$, then $f(x)f(y) \ge f(xy)$.
[(ii)] If $x,y \in \QQ_{>0}$, then $f(x+y) \ge f(x) + f(y)$.
[(iii)] There exists a rational number $a > 1$ with $f(a) = a$.

Solution:
First, we dispense of negative situations by proving:

For any integer $n > 0$, we have $f(n) \ge n$.

Note by induction on (ii) we have $f(nx) \ge n f(x)$.
Taking $(x,y) = (a,1)$ in (i) gives $f(1) \ge 1$,
and hence $f(n) \ge n$.

The $f$ takes only positive values,
and hence by (ii) is strictly increasing.

[Proof, suggested by Gopal Goel]
Let $p,q > 0$ be integers.
Then $f(q) f(p/q) \ge f(p)$, and since both $\min(f(p), f(q)) > 0$
it follows $f(p/q) > 0$.

For any $x > 1$ we have $f(x) \ge x$.

Note that
$ f(x)^N \ge f(x^N) \ge f( \left\lfloor x^N \right\rfloor )
\ge \left\lfloor x^N \right\rfloor > x^N-1 $
for any integer $N$.
Since $N$ can be arbitrarily large, we conclude $f(x) \ge x$ for $x > 1$.

On the other hand, $f$ has arbitrarily large fixed points
(namely powers of $a$) so from (ii) we're essentially done.
First, for $x > 1$ pick a large $m$ and note
$ a^m = f(a^m) \ge f(a^m-x) + f(x) \ge (a^m-x)+x = a^m. $
Finally, for $x \le 1$ use
$ nf(x) = f(n)f(x) \ge f(nx) \ge nf(x) $
for large $n$.

Note that $a > 1$ is essential;
if $b \ge 1$ then $f(x) = bx^2$ works with unique fixed point $1/b \le 1$.


Let $n \ge 3$ be an integer, and consider a circle with $n + 1$ equally spaced points marked on it.
Consider all labellings of these points with the numbers
$0, 1, \dots , n$ such that each label is used exactly once;
two such labellings are considered to be the same if
one can be obtained from the other by a rotation of the circle.
A labelling is called beautiful if, for any four labels $a < b < c < d$ with $a + d = b + c$,
the chord joining the points labelled $a$ and $d$
does not intersect the chord joining the points labelled $b$ and $c$.
Let $M$ be the number of beautiful labellings,
and let $N$ be the number of ordered pairs $(x, y)$ of positive integers
such that $x + y \le n$ and $\gcd(x, y) = 1$.
Prove that $M = N + 1$.

Solution:
First, here are half of the beautiful labellings up to reflection for $n = 6$,
just for concreteness.

[Figure omitted]

Abbreviate ``beautiful labelling of points around a circle'' to ring.
Moreover, throughout the solution we will allow degenerate
chords that join a point to itself;
this has no effect on the problem statement.

The idea is to proceed by induction in the following way.
A ring of $[0,n]$ is called linear
if it is an arithmetic progression modulo $n+1$.
For example, the first two rings in the diagram
and the last one are linear for $n = 6$,
while the other three are not.

Of course we can move from any ring on $[0,n]$
to a ring on $[0,n-1]$ by deleting $n$.
We are going to prove that:

Each linear ring on $[0,n-1]$ yields exactly two
rings of $[0,n]$, and
Each nonlinear ring on $[0,n-1]$ yields exactly one
rings of $[0,n]$.

In light of the fact there are obviously $\varphi(n)$ linear rings on $[0,n]$,
the conclusion will follow by induction.

We say a set of chords (possibly degenerate) is pseudo-parallel
if for any three of them, one of them separates the two.
(Pictorially, one can perturb the endpoints along the circle
in order to make them parallel in Euclidean sense.)
The main structure lemma is going to be:

In any ring, the chords of sum $k$
(even including degenerate ones) are pseudo-parallel.

By induction on $n$.
By shifting, we may assume that one of the chords is $\{0,k\}$
and discard all numbers exceeding $k$; that is, assume $n = k$.
Suppose the other two chords are $\{a, n-a\}$ and $\{b, n-b\}$.
[Figure omitted]
We consider the chord $\{u,v\}$ directly above $\{0,n\}$, drawn in blue.
There are now three cases.

If $u+v = n$, then delete $0$ and $n$
and decrease everything by $1$.
Then the chords $\{a-1, n-a-1\}$, $\{b-1, n-b-1\}$, $\{u-1, v-1\}$
contradict the induction hypothesis.

If $u+v < n$, then search for the chord
$\{u+v, n-(u+v)\}$.
It lies on the other side of $\{0, n\}$
in light of chord $\{0,u+v\}$.
Now again delete $0$ and $n$ and decrease everything by $1$.
Then the chords $\{a-1, n-a-1\}$, $\{b-1, n-b-1\}$, $\{u+v-1, n-(u+v)-1\}$
contradict the induction hypothesis.

If $u+v > n$, apply the map $t \mapsto n-t$ to the entire ring.
This gives the previous case as now $(n-u)+(n-v) < n$.
\qedhere

Next, we give another characterization of linear rings.

A ring on $[0,n-1]$ is linear if and only if the point $0$
does not lie between two chords of sum $n$.

It's obviously true for linear rings.
Conversely, assume the property holds for some ring.
Note that the chords with sum $n-1$ are pseudo-parallel and encompass every point,
so they are actually parallel.
Similarly, the chords of sum $n$ are actually parallel
and encompass every point other than $0$.
So the map
$ t \mapsto n-t \mapsto (n-1)-(n-t) = t-1 \pmod n $
is rotation as desired.

Every nonlinear ring on $[0,n-1]$ induces exactly one ring on $[0,n]$.

Because the chords of sum $n$ are pseudo-parallel,
there is at most one possibility for the location $n$.

Conversely, we claim that this works.
The chords of sum $n$ (and less than $n$) are OK by construction, so
assume for contradiction that there exists $a,b,c \in \{1,\dots,n-1\}$
such that $a + b = n + c$.
Then, we can ``reflect'' them using the (pseudo-parallel)
chords of length $n$ to find that $(n-a) + (n-b) = 0 + (n-c)$,
and the chords joining $0$ to $n-c$ and $n-a$ to $n-b$ intersect,
by definition.
[Figure omitted]
This is a contradiction that the original numbers on $[0,n-1]$ form a ring.

Every linear ring on $[0,n-1]$ induces
exactly two rings on $[0,n]$.

Because the chords of sum $n$ are pseudo-parallel,
the point $n$ must lie either directly to the left or right of $0$.
For the same reason as in the previous proof, both of them work.


Let $a_0 < a_1 < a_2 < \dotsb$ be an infinite sequence of positive integers.
Prove that there exists a unique integer $n\geq 1$ such that
$ a_n < \frac{a_0+a_1+a_2+\dotsb+a_n}{n} \le a_{n+1}. $

Solution:
Fedor Petrov presents the following nice solution.
Let us define the sequence
$ b_n = ( a_n - a_{n-1} ) + \dots + ( a_n - a_1 ). $
Since $(a_n)_n$ is increasing, we get $(b_n)_n$ is strictly increasing,
and moreover $b_1 = 0$.
The problem requires an $n$ such that
$ b_n < a_0 \le b_{n+1} $
which obviously exists and is unique.


Let $n \ge 2$ be an integer.
Consider an $n \times n$ chessboard consisting of $n^2$ unit squares.
A configuration of $n$ rooks on this board is peaceful
if every row and every column contains exactly one rook.
Find the greatest positive integer $k$ such that,
for each peaceful configuration of $n$ rooks,
there is a $k \times k$ square which does not
contain a rook on any of its $k^2$ unit squares.

Solution:
The answer is $k = \left\lfloor \sqrt{n-1} \right\rfloor$.

Proof that the property holds when $n \ge k^2+1$.:
First, assume $n > k^2$ for some $k$.
We will prove we can find an empty $k \times k$ square.
Indeed, let $R$ be a rook in the uppermost column,
and draw $k$ squares of size $k \times k$ directly below it, aligned.
There are at most $k-1$ rooks among these squares, as desired.

[Figure omitted]

Construction for all $n \le k^2$.:
We first give an example where for $n = k^2$ showing there may be no empty $k \times k$ square.
We draw the example for $k=3$ (with the generalization being obvious);

[Figure omitted]

To show that this works,
consider for each rook drawing an $k \times k$ square of $X$'s
whose bottom-right hand corner is the rook (these may go off the board).
These indicate positions where one cannot
place the upper-left hand corner of any square.
It's easy to see that these cover the entire board,
except parts of the last $k-1$ columns,
which don't matter anyways.

It remains to check that $n \le k^2$ also all work
(omitting this step is a common mistake).
For this, we can delete rows and column to get an $n \times n$ board,
and then fill in any gaps where we accidentally deleted a rook.


Convex quadrilateral $ABCD$ has $\angle ABC = \angle CDA = 90\dg$.
Point $H$ is the foot of the perpendicular from $A$ to $BD$.
Points $S$ and $T$ lie on sides $AB$ and $AD$,
respectively, such that $H$ lies inside triangle $SCT$ and
$ \angle CHS - \angle CSB = 90^{\circ},
\quad \angle THC - \angle DTC = 90^{\circ}. $
Prove that line $BD$ is tangent to the circumcircle of triangle $TSH$.

Solution:
First solution (mine).:
First we rewrite the angle condition in a suitable way.

We have $\angle ATH = \angle TCH + 90\dg$.
Thus the circumcenter of $\triangle CTH$ lies on $AD$.
Similarly the circumcenter of $\triangle CSH$ lies on $AB$.

∠ ATH &= ∠ DTH \\
&= ∠ DTC + ∠ CTH \\
&= ∠ DTC - ∠ THC - ∠ HCT \\
&= 90\dg - ∠ HCT = 90\dg + ∠ TCH.

which implies conclusion.

[Figure omitted]

Let the perpendicular bisector of $TH$ meet $AH$ at $P$ now.
It suffices to show that $\frac{AP}{PH}$ is symmetric in $b = AD$ and $d=AB$,
because then $P$ will be the circumcenter of $\triangle TSH$.
To do this, set $AH = \frac{bd}{2R}$ and $AC=2R$.

Let $O$ denote the circumcenter of $\triangle CHT$.
Use the Law of Cosines on $\triangle ACO$ and $\triangle AHO$,
using variables $x=AO$ and $r=HO$.
We get that
$ r^2 = x^2 + AH^2 - 2x \cdot AH \cdot \frac{d}{2R} = x^2 + (2R)^2 - 2bx. $
By the angle bisector theorem,
$\frac{AP}{PH} = \frac{AO}{HO}$.

The rest is computation: notice that
$ r^2 - x^2 = h^2 - 2xh \cdot \frac{d}{2R} = (2R)^2 - 2bx $
where $h = AH = \frac{bd}{2R}$, whence
$ x = \frac{(2R)^2-h^2}{2b - 2h \cdot \frac{d}{2R}}. $
Moreover,
$ \frac{1}{2} ( \frac{r^2}{x^2}-1 )
= \frac{1}{x} ( \frac 2x R^2 - b ). $
Now, if we plug in the $x$ in the
right-hand side of the above, we obtain
$ \frac{2b-2h \cdot \frac{d}{2R}}{4R^2-h^2}
( \frac{2b-2h \cdot \frac{d}{2R}}{4R^2-h^2} \cdot 2R^2 - b)
= \frac{2h}{(4R^2-h^2)^2} ( b- h \cdot \frac{d}{2R} )
( -2hdR + bh^2 ). $
Pulling out a factor of $-2Rh$ from the rightmost term,
we get something that is symmetric in $b$ and $d$, as required.

Second solution (Victor Reis).:
Here is the fabled solution using inversion at $H$.
First, we rephrase the angle conditions in the following ways:

$AD \perp (THC)$,
which is equivalent to the claim from the first solution.
$AB \perp (SHC)$, by symmetry.
$AC \perp (ABCD)$, by definition.

Now for concreteness we will use a negative inversion at $H$
which swaps $B$ and $D$ and overlay it on the original diagram.
As usual we denote inverses with stars.

Let us describe the inverted problem.
We let $M$ and $N$ denote the midpoints of $A^\ast B^\ast$
and $A^\ast D^\ast$, which are the centers of
$(HA^\ast B^\ast)$ and $(HA^\ast D^\ast)$.
From $T^\ast C^\ast \perp (HA^\ast D^\ast)$,
we know have $C^\ast$, $M$, $T^\ast$ collinear.
Similarly, $C^\ast$, $N$, $S^\ast$ are collinear.
We have that $(A^\ast H C^\ast)$ is orthogonal to $(ABCD)$ which remains fixed.
We wish to show $T^\ast S^\ast$ and $MN$ are parallel.

[Figure omitted]

Lot $\omega$ denote the circumcircle of $\triangle A^\ast H C^\ast$,
which is orthogonal to the original circle $(ABCD)$.
It would suffices to show $(A^\ast H C^\ast)$
is an $H$-Apollonius circle with respect to $MN$,
from which we would get $C^\ast M / H M = C^\ast N / H N$.

However, $\omega$ through $H$ and $A$,
hence it center lies on line $MN$.
Moreover $\omega$ is orthogonal to $(A^\ast MN)$
(since $(A^\ast MN)$ and $(A^\ast BD)$ are homothetic).
This is enough (for example, if we let $O$ denote the center of $\omega$,
we now have $\mathrm{r}(\omega)^2 = OH^2 = OM \cdot ON$).
(Note in this proof that the fact that $C^\ast$ lies on $(ABCD)$
is not relevant.)


Let $P$ and $Q$ be on segment $BC$ of an acute triangle $ABC$
such that $\angle PAB=\angle BCA$ and $\angle CAQ=\angle ABC$.
Let $M$ and $N$ be points on $AP$ and $AQ$,
respectively, such that $P$ is the midpoint of $AM$
and $Q$ is the midpoint of $AN$.
Prove that $BM$ and $CN$ meet on the
circumcircle of $\triangle ABC$.

Solution:
We give three solutions.

First solution by harmonic bundles.:
Let $BM$ intersect the circumcircle again at $X$.

[Figure omitted]

The angle conditions imply that the tangent to $(ABC)$ at $B$
is parallel to $AP$.
Let $\infty$ be the point at infinity along line $AP$.
Then $ -1 = (AM;P\infty) \overset{B}{=} (AX;BC). $
Similarly, if $CN$ meets the circumcircle at $Y$
then $(AY;BC) = -1$ as well.
Hence $X=Y$, which implies the problem.

Second solution by similar triangles.:
Once one observes $\triangle CAQ \sim \triangle CBA$,
one can construct $D$ the reflection of $B$ across $A$,
so that $\triangle CAN \sim \triangle CBD$.
Similarly, letting $E$ be the reflection of $C$ across $A$,
we get $\triangle BAP \sim \triangle BCA
\implies \triangle BAM \sim \triangle BCE$.
Now to show $\angle ABM + \angle ACN = 180\dg$
it suffices to show $\angle EBC + \angle BCD = 180\dg$,
which follows since $BCDE$ is a parallelogram.

Third solution by barycentric coordinates.:
Since $PB = c^2/a$ we have
$ P = (0 : a^2-c^2 : c^2) $
so the reflection $\vec M = 2\vec P - \vec A$ has coordinates
$ M = (-a^2 : 2(a^2-c^2) : 2c^2). $

Similarly $N = (-a^2 : 2b^2 : 2(b^2-a^2))$. Thus
$ BM \cap CN = (-a^2 : 2b^2 : 2c^2) $
which clearly lies on the circumcircle,
and is in fact the point identified in the first solution.


For every positive integer $n$,
the Bank of Cape Town issues coins of denomination $\frac 1n$.
Given a finite collection of such coins (of not necessarily different denominations)
with total value at most $99 + \frac12$, prove that it is possible to split
this collection into $100$ or fewer groups, such that each group has total value at most $1$.

Solution:
We'll prove the result
for at most $k - \frac{k}{2k+1}$ with $k$ groups.
First, perform the following optimizations.

If any coin of size $\frac{1}{2m}$ appears twice,
then replace it with a single coin of size $\frac{1}{m}$.
If any coin of size $\frac{1}{2m+1}$ appears $2m+1$ times,
group it into a single group and induct downwards.

Apply this operation repeatedly until it cannot be done anymore.

Now construct boxes $B_0$, $B_1$, \dots, $B_{k-1}$.
In box $B_0$ put any coins of size $\tfrac 12$ (clearly there is at most one).
More generally for $m \ge 0$, $B_m$, put coins of size
$\frac{1}{2m+1}$ and $\frac{1}{2m+2}$
(there at most $2m$ of the former and at most one of the latter).
Note that
$ \text{total weight in $B_m$} \le 2m \cdot \frac{1}{2m+1} + \frac{1}{2m+2} < 1. $
Finally, place the remaining ``light'' coins of size at most $\frac{1}{2k+1}$ in a pile.

One way to explain where this boxing comes from is to imagine
what happens after applying the operation repeatedly until it can't be done any more.
We expect the most troublesome situation would be if the leftover coins are
as large as possible, which looks like
$ 1/2, \qquad \frac13 \times 2, \qquad \frac14, \qquad \frac15 \times 4,
\qquad \frac16, \qquad \frac17 \times 6, \qquad \frac 18, \qquad \dots $
Seeing this the boxing $B_i$ is quite reasonable because it groups these
into groups of almost $1$ without too much effort:

B_0 &\longrightarrow 1/2 \\
B_1 &\longrightarrow \frac13 \cdot 2 + \frac 14 = \frac{11}{12} \\
B_2 &\longrightarrow \frac15 \cdot 4 + \frac 16 = \frac{29}{30} \\
B_3 &\longrightarrow \frac17 \cdot 6 + \frac 18 = \frac{55}{56} \\
&\vdotswithin\longrightarrow

Then just toss coins from the pile into the boxes arbitrarily,
other than the proviso that no box should have its weight exceed $1$.
We claim this uses up all coins in the pile.
Assume not, and that some coin remains in the pile
when all the boxes are saturated.
Then all the boxes must have at least $1 -\frac{1}{2k+1}$,
meaning the total amount in the boxes is strictly greater than
$ k ( 1 - \frac{1}{2k+1} ) > k - \tfrac 12 $
which is a contradiction.

This gets a stronger bound $k - \frac{k}{2k+1}$ than the requested $k-\tfrac 12$.


A set of lines in the plane is in general position
if no two are parallel and no three pass through the same point.
A set of lines in general position cuts the plane into regions,
some of which have finite area; we call these its finite regions.
Prove that for all sufficiently large $n$,
in any set of $n$ lines in general position
it is possible to colour at least $\sqrt{n}$ lines blue
in such a way that none of its finite regions
has a completely blue boundary.

Solution:
Suppose we have colored $k$ of the lines blue, and that
it is not possible to color any additional lines.
That means any of the $n-k$ non-blue lines
is the side of some finite region with
an otherwise entirely blue perimeter.
For each such line $\ell$, select one such region,
and take the next counterclockwise vertex;
this is the intersection of two blue lines $v$.
We'll say $\ell$ is the eyelid of $v$.

[Figure omitted]

You can prove without too much difficulty that every intersection of two blue lines
has at most two eyelids.
Since there are $\binom k2$ such intersections, we see that
$ n-k \le 2 \binom k2 = k^2 - k$
so $n \le k^2$, as required.

In fact, $k = \sqrt n$ is ``sharp for greedy algorithms'',
as illustrated below for $k=3$:
[Figure omitted]


We say that a finite set $\mathcal{S}$ of points in the plane
is balanced if,
for any two different points $A$ and $B$ in $\mathcal{S}$,
there is a point $C$ in $\mathcal{S}$ such that $AC=BC$.
We say that $\mathcal{S}$ is center-free if for
any three different points $A$, $B$ and $C$ in $\mathcal{S}$,
there are no points $P$ in $\mathcal{S}$ such that $PA=PB=PC$.

\item[(a)] Show that for all integers $n\ge 3$,
there exists a balanced set consisting of $n$ points.
\item[(b)] Determine all integers $n\ge 3$ for which
there exists a balanced center-free set consisting of $n$ points.

Solution:
For part (a), take a circle centered at a point $O$,
and add $n-1$ additional points by adding pairs of points
separated by an arc of $60^{\circ}$ or similar triples.
An example for $n = 6$ is shown below.
[Figure omitted]

For part (b), the answer is odd $n$, achieved by taking a regular $n$-gon.
To show even $n$ fail, note that some point is on the perpendicular bisector of
$ \left\lceil \frac 1n \binom n2 \right\rceil = \frac{n}{2} $
pairs of points, which is enough.
(This is a standard double-counting argument.)

As an aside, there is a funny joke about this problem.
There are two types of people in the world:

Those who solve (b) quickly and then take forever to solve (a),
those who solve (a) quickly and then can't solve (b) at all.

(Empirically true when the Taiwan IMO 2014 team was working on it.)


Find all positive integers $a$, $b$, $c$ such that
each of $ab-c$, $bc-a$, $ca-b$ is a power of $2$
(possibly including $2^0=1$).

Solution:
Here is the solution of \textbf{Telv Cohl},
which is the shortest solution I am aware of.
We will prove the only solutions are $(2,2,2)$, $(2,2,3)$,
$(2,6,11)$ and $(3,5,7)$ and permutations.

WLOG assume $a \ge b \ge c > 1$, so $ab-c \ge ca-b \ge bc-a$.
We consider the following cases:

If $a$ is even, then

ca-b &= \gcd (ab-c, ca-b) \le \gcd (ab-c, a(ca-b)+ab-c) \\
&= \gcd( ab-c, c(a^2-1) ).

As $a^2-1$ is odd, we conclude $ca-b \le c$.
This implies $a=b=c=2$.

If $a$, $b$, $c$ are all odd, then $a > b > c > 1$ follows.
Then as before
$ ca-b \le \gcd (ab-c, c(a^2-1))
\le 2^{\nu_2(a^2-1)} \le 2a+2 \le 3a-b $
so $c = 3$ and $a = b+2$.
As $3a-b = ca-b \ge 2(bc-a) = 6b-2a$ we then conclude $a=7$ and $b=5$.

If $a$ is odd and $b$, $c$ are even, then $bc-a=1$
and hence $bc^2 - b - c = ca - b$.
Then from the miraculous identity
$ c^3-b-c = (1-c^2)(ab-c) + a(\underbrace{bc^2-b-c}_{=ca-b}) + (ca-b) $
so we conclude $\gcd(ab-c, ca-b) = \gcd(ab-c, c^3-b-c)$, in other words
$ bc^2-b-c = ca-b = \gcd(ab-c, ca-b) = \gcd(ab-c, c^3-b-c). $
We thus consider two more cases:

If $c^3-b-c \neq 0$ then
the above implies $|c^3-b-c| \ge bc^2-b-c$.
As $b \ge c > 1$, we must actually have $b = c$,
thus $a = c^2-1$.
Finally $ab-c = c(c^2-2)$ is a power of $2$, hence $b=c=2$, so $a=3$.

In the second case, assume $c^3-b-c = 0$, hence $c^3-c$.
From $bc-a=1$ we obtain $a=c^4-c^2-1$,
hence
$ ca-b = c^5-2c^3 = c^3(c^2-2) $
is a power of $2$, hence again $c = 2$.
Thus $a=11$ and $b=6$.

This finishes all cases, so the proof is done.


Let $ABC$ be an acute triangle with $AB > AC$.
Let $\Gamma$ be its circumcircle, $H$ its orthocenter, and $F$ the foot of the altitude from $A$.
Let $M$ be the midpoint of $BC$.
Let $Q$ be the point on $\Gamma$ such that $\angle HQA = 90\dg$
and let $K$ be the point on $\Gamma$ such that $\angle HKQ = 90\dg$.
Assume that the points $A$, $B$, $C$, $K$ and $Q$ are all different and lie on $\Gamma$ in this order.
Prove that the circumcircles of triangles $KQH$ and $FKM$ are tangent to each other.

Solution:
Let $L$ be on the nine-point circle with $\angle HML = 90^{\circ}$.
The negative inversion at $H$ swapping $\Gamma$ and nine-point circle maps
$ A \longleftrightarrow F, \quad
Q \longleftrightarrow M, \quad
K \longleftrightarrow L. $
In the inverted statement, we want line $ML$ to be tangent to $(AQL)$.

[Figure omitted]

$LM \parallel AQ$.

Both are perpendicular to $MHQ$.

$LA = LQ$.

Let $N$ and $T$ be the midpoints of $HQ$ and $AH$,
and $O$ the circumcenter.
As $MT$ is a diameter, we know $LTNM$ is a rectangle,
so $LT$ passes through $O$.
Since $LOT \perp AQ$ and $OA=OQ$, the proof is complete.

Together these two claims solve the problem.


Triangle $ABC$ has circumcircle $\Omega$ and circumcenter $O$.
A circle $\Gamma$ with center $A$
intersects the segment $BC$ at points $D$ and $E$,
such that $B$, $D$, $E$, and $C$ are all different
and lie on line $BC$ in this order.
Let $F$ and $G$ be the points of intersection of $\Gamma$ and $\Omega$,
such that $A$, $F$, $B$, $C$, and $G$ lie on $\Omega$ in this order.
Let $K = (BDF) \cap AB \neq B$
and $L = (CGE) \cap AC \neq C$
and assume these points do not lie on line $FG$.
Define $X = FK \cap GL$.
Prove that $X$ lies on the line $AO$.

Solution:
Since $AO \perp FG$ for obvious reasons,
we will only need to show that $XF = XG$,
or that $∠ KFG = ∠ LGF$.

Let line $FG$ meet $(BDF)$ and $(CGE)$
again at $F_2$ and $G_2$.
[Figure omitted]

Quadrilaterals $FBDF_2$ and $G_2ECG$ are similar,
actually homothetic through $FG \cap BC$.

This is essentially a repeated application
of being ``anti-parallel'' through $\angle(FG, BC)$.
Note the four angle relations

∠(FD, FG) = ∠(BC,GE) = ∠(G_2C,FG)
&\implies FD \parallel G_2C \\
∠(F_2B, FG) = ∠(BC,FD) = ∠(GE,FG)
&\implies F_2B \parallel GE \\
∠(FB, FG) = ∠(BC,GC) = ∠(G_2E,FG)
&\implies FB \parallel G_2E \\
∠(F_2D, FG) = ∠(BC,FB) = ∠(GC,FG)
&\implies F_2D \parallel GC.

This gives the desired homotheties.

To finish the angle chase,

∠ GFK = ∠ F_2BK &= ∠ F_2BF - ∠ ABF
= ∠ F_2DF - ∠ ABF \\
&= ∠ F_2DF - ∠ GCA
= ∠ GCG_2 - ∠ GCA \\
&= ∠ LCG_2 = ∠ LGF

as needed.
(Here $∠ ABF = ∠ GCA$ since $AF = AG$.)


Solve the functional equation
$ f(x+f(x+y)) + f(xy) = x + f(x+y) + yf(x) $
for $f \colon \RR \to \RR$.

Solution:
The answers are $f(x) \equiv x$ and $f(x) \equiv 2-x$.
Obviously, both of them work.

Let $P(x,y)$ be the given assertion.
We also will let $S = \{t \mid f(t) = t\}$
be the set of fixed points of $f$.

From $P(0,0)$ we get $f(f(0)) = 0$.
From $P(0,f(0))$ we get $2f(0) = f(0)^2$
and hence $f(0) \in \{0,2\}$.
From $P(x,1)$
we find that $x+f(x+1) \in S$ for all $x$.

We now solve the case $f(0) = 2$.

If $f(0) = 2$ then $f(x) \equiv 2-x$.

Let $t \in S$ be any fixed point.
Then $P(0,t)$ gives $2 = 2t$ or $t = 1$;
so $S = \{1\}$.
But we also saw $x+f(x+1) \in S$,
which implies $f(x) \equiv 2-x$.

Henceforth, assume $f(0) = 0$.

If $f(0) = 0$ then $f$ is odd.

Note that $P(1,-1) \implies f(1) + f(-1) = 1 - f(1)$
and $P(-1,1) \implies f(-1) + f(-1) = -1 + f(1)$,
together giving $f(1) = 1$ and $f(-1) = -1$.
To prove $f$ odd we now obtain more fixed points:

From $P(x,0)$ we find that $x+f(x) \in S$ for all $x \in \RR$.
From $P(x-1,1)$ we find that $x-1+f(x) \in S$ for all $x \in \RR$.
From $P(1, f(x)+x-1)$ we find $x+1+f(x) \in S$ for all $x \in \RR$.

Finally $P(x, -1)$ gives $f$ odd.

To finish from $f$ odd, notice that

P(x,-x) &\implies f(x) + f(-x^2) = x - xf(x) \\
P(-x,x) &\implies f(-x) + f(-x^2) = -x + xf(-x)

which upon subtracting gives $f(x) \equiv x$.


The sequence $a_1,a_2,\dots$ of integers satisfies the conditions:
[(i)]
$1\le a_j\le2015$ for all $j\ge1$,
$k+a_k\neq \ell+a_\ell$ for all $1\le k<\ell$.

Solution:
We give two equivalent solutions with different presentations,
one with ``arrows'' and the other by ``juggling''.

First solution (arrows).:
Consider the map
$ f \colon k \mapsto k + a_k. $
This map is injective, so if we draw all arrows of the form $k \mapsto f(k)$
we get a partition of $\NN$ into one or more ascending chains
(which skip by at most $2015$).

There are at most $2015$ such chains,
since among any $2015$ consecutive points in $\NN$
every chain must have an element.

We claim we may take $b$ to be the number of such chains,
and $N$ to be the largest of the start-points of all the chains.

Consider an interval $I = [m+1, n]$.
We have that
$ \sum_{m<j\le n} a_j = \sum_{\text{chain } c} [ \min \left\{ x > n, x \in c \right\}
- \min \left\{ x > m, x \in c \right\} ]. $
Thus the upper bound is proved by the calculation

\sum_{m<j\le n} (a_j-b)
&= \sum_{\text{chain } c} [ (\min \left\{ x > n, x \in c \right\} - n)
- (\min \left\{ x > m, x \in c \right\} - m) ] \\
&= \sum_{\text{chain } c} [ (\min \left\{ x > n, x \in c \right\} - n) ]
- \sum_{\text{chain } c} [
\min \left\{ x > m, x \in c \right\} - m ] \\
&\le (1+2015+2014+\dots+(2015-(b-2)))-(1+2+\dots+b) \\
&= (b-1)(2015-b)

from above (noting that $n+1$ has to belong to some chain).
The lower bound is similar.

Second solution (juggling).:
This solution is essentially the same, but phrased as a juggling problem.
Here is a solution in this interpretation:
we will consider several balls thrown in the air,
which may be at heights $0$, $1$, $2$, \dots, $2014$.
The process is as follows:

Initially, at time $t = 0$, there are no balls in the air.
Then at each integer time $t$ thereafter,
if there is a ball at height $0$, it is caught;
otherwise a ball is added to the juggler's hand.
This ball (either caught or added) is then thrown to a height of $a_t$.
Immediately afterwards, all balls have their height decreased by one.

The condition $a_k + k \neq \ell + a_\ell$ thus ensures that
no two balls are ever at the same height.
In particular, there will never be more than $2016$ balls,
since there are only $2015$ possible heights.

We claim we may set.

b &= \text{number of balls in entire process} \\
N &= \text{last moment in time at which a ball is added}.

Indeed, the key fact is that if we let $S_t$ denote
the sum of the height of all the balls just after time $t+1/2$, then
$ S_{t+1} - S_t = a_{t+1} - b $
After all, at each time step $t$, the caught ball is thrown to height $a_t$,
and then all balls have their height decreased by $1$,
from which the conclusion follows.
Hence the quantity in the problem is exactly equal to
$ \left|\sum_{j=m+1}^n (a_j-b) \right|
= \left| S_m - S_n \right|. $
For a fixed $b$, we easily have the inequalities
$0 + 1 + \dots + (b-1) \le S_t \le 2014 + 2013 + \dots + (2015-b)$.
Hence $|S_m - S_n| \le (b-1)(2015-b) \le 1007^2$ as desired.


In convex pentagon $ABCDE$ with $\angle B > 90\dg$,
let $F$ be a point on $AC$ such that $\angle FBC = 90\dg$.
It is given that $FA=FB$, $DA=DC$, $EA=ED$,
and rays $AC$ and $AD$ trisect $\angle BAE$.
Let $M$ be the midpoint of $CF$.
Let $X$ be the point such that $AMXE$ is a parallelogram.
Show that $FX$, $EM$, $BD$ are concurrent.

Solution:
Here is a ``long'' solution which I think
shows where the ``power'' in the configuration comes from
(it should be possible to come up with shorter solutions
by cutting more directly to the desired conclusion).
Throughout the proof, we let
$ \theta = \angle FAB = \angle FBA = \angle DAC = \angle DCA
= \angle EAD = \angle EDA. $

We begin by focusing just on $ABCD$ with point $F$,
ignoring for now the points $E$ and $X$
(and to some extent even point $M$).
It turns out this is a very familiar configuration.

[Central lemma]
The points $F$ and $C$
are the incenter and $A$-excenter of $\triangle DAB$.
Moreover, $\triangle DAB$ is isosceles with $DA = DB$.

The proof uses three observations:

We already know that $FAC$ is the angle bisector of $\angle ABD$.
We were given $\angle FBC = 90\dg$.
Next, note that $\triangle AFB \sim \triangle ADC$
(they are similar isosceles triangles).
From this it follows that $AF \cdot AC = AB \cdot AD$.

These three facts, together with $F$ lying inside $\triangle ABD$,
are enough to imply the result.

[Figure omitted]

The point $M$ is the midpoint of arc $\widehat{BD}$ of $(DAB)$,
and the center of cyclic quadrilateral $FDCB$.

Fact 5.

Using these observations as the anchor
for everything that follows,
we now prove several claims about $X$ and $E$ in succession.
[Figure omitted]

Point $E$ is the midpoint of arc $\widehat{AD}$
in $(ABMD)$, and hence lies on ray $BF$.

This follows from
$\angle EDA = \theta = \angle EBA$.

Points $X$ is the second intersection of ray $ED$
with $(BFDC)$.

First, $ED \parallel AC$ already since
$\angle AED = 180\dg - 2\theta$
and $\angle CAE = 2\theta$.

Now since $DB = DA$, we get $MB = MD = ED = EA$.
Thus, $MX = AE = MB$,
so $X$ also lies on the circle $(BFDC)$ centered at $M$.

The quadrilateral $EXMF$ is an isosceles trapezoid.

We already know $EX \parallel FM$.
Since $\angle EFA = 180\dg - \angle AFB = 2\theta = \angle FAE$,
we have $EF = EA$ as well (and $F \neq A$).
As $EXMA$ was a parallelogram,
it follows $EXMF$ is an isosceles trapezoid.

The problem then follows by radical axis theorem
on the three circles $(AEDMB)$, $(BFDXC)$ and $(EXMF)$.


Find all integers $n$ for which each cell of $n \times n$ table
can be filled with one of the letters $I$, $M$ and $O$ in such a way that:

\item In each row and column, one third of the entries are $I$,
one third are $M$ and one third are $O$; and
\item in any diagonal, if the number of entries on the diagonal is a multiple of three,
then one third of the entries are $I$, one third are $M$ and one third are $O$.

Note that an $n \times n$ table has $4n-2$ diagonals.

Solution:
The answer is $n$ divisible by $9$.

First we construct $n=9$ and by extension every multiple of $9$.
$
{|ccc|ccc|ccc|} \hline
I & I & I & M & M & M & O & O & O \\
M & M & M & O & O & O & I & I & I \\
O & O & O & I & I & I & M & M & M \\\hline
I & I & I & M & M & M & O & O & O \\
M & M & M & O & O & O & I & I & I \\
O & O & O & I & I & I & M & M & M \\\hline
I & I & I & M & M & M & O & O & O \\
M & M & M & O & O & O & I & I & I \\
O & O & O & I & I & I & M & M & M \\\hline

$

We now prove $9 \mid n$ is necessary.

Let $n = 3k$, which divides the given grid into $k^2$ sub-boxes
(of size $3 \times 3$ each).
We say a multiset of squares $S$ is clean if
the letters distribute equally among them;
note that unions of clean multisets are clean.

Consider the following clean sets (given to us by problem statement):

All columns indexed $2 \pmod 3$,
All rows indexed $2 \pmod 3$, and
All $4k-2$ diagonals mentioned in the problem.

Take their union.
This covers the center of each box four times,
and every other cell exactly once.
We conclude the set of $k^2$ center squares
are clean, hence $3 \mid k^2$ and so $9 \mid n$,
as desired.

Shown below is the sums over all diagonals only,
and of the entire union.
$
{|ccc|ccc|ccc|} \hline
1 & & 1 & 1 & & 1 & 1 & & 1 \\
& 2 & & & 2 & & & 2 & \\
1 & & 1 & 1 & & 1 & 1 & & 1 \\\hline
1 & & 1 & 1 & & 1 & 1 & & 1 \\
& 2 & & & 2 & & & 2 & \\
1 & & 1 & 1 & & 1 & 1 & & 1 \\\hline
1 & & 1 & 1 & & 1 & 1 & & 1 \\
& 2 & & & 2 & & & 2 & \\
1 & & 1 & 1 & & 1 & 1 & & 1 \\\hline

\qquad
{|ccc|ccc|ccc|} \hline
1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 \\
1 & 4 & 1 & 1 & 4 & 1 & 1 & 4 & 1 \\
1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 \\\hline
1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 \\
1 & 4 & 1 & 1 & 4 & 1 & 1 & 4 & 1 \\
1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 \\\hline
1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 \\
1 & 4 & 1 & 1 & 4 & 1 & 1 & 4 & 1 \\
1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 \\\hline

$