di-zhang-fdu/OlympiadExtended huggingface dataset:
Subfield: Number Theory


Question: Let $a$ and $b$ be positive integers such that $a ! b !$ is a multiple of $a !+b !$. Prove that $3 a \geqslant 2 b+2$.

Solution:
If $a>b$, we immediately get $3 a \geqslant 2 b+2$. In the case $a=b$, the required inequality is equivalent to $a \geqslant 2$, which can be checked easily since $(a, b)=(1,1)$ does not satisfy $a !+b ! \mid a ! b !$. We now assume $a<b$ and denote $c=b-a$. The required inequality becomes $a \geqslant 2 c+2$.

Suppose, to the contrary, that $a \leqslant 2 c+1$. Define $M=\frac{b !}{a !}=(a+1)(a+2) \cdots(a+c)$. Since $a !+b ! \mid a ! b !$ implies $1+M \mid a ! M$, we obtain $1+M \mid a !$. Note that we must have $c<a$; otherwise $1+M>a !$, which is impossible. We observe that $c ! \mid M$ since $M$ is a product of $c$ consecutive integers. Thus $\operatorname{gcd}(1+M, c !)=1$, which implies

$$
1+M \mid \frac{a !}{c !}=(c+1)(c+2) \cdots a
\tag{1}
$$

If $a \leqslant 2 c$, then $\frac{a !}{c !}$ is a product of $a-c \leqslant c$ integers not exceeding $a$ whereas $M$ is a product of $c$ integers exceeding $a$. Therefore, $1+M>\frac{a !}{c !}$, which is a contradiction.

It remains to exclude the case $a=2 c+1$. Since $a+1=2(c+1)$, we have $c+1 \mid M$. Hence, we can deduce from (1) that $1+M \mid(c+2)(c+3) \cdots a$. Now $(c+2)(c+3) \cdots a$ is a product of $a-c-1=c$ integers not exceeding $a$; thus it is smaller than $1+M$. Again, we arrive at a contradiction.
we may assume that $a<b$ and let $c=b-a$. Suppose, to the contrary, that $a \leqslant 2 c+1$. From $a !+b$ ! $\mid a ! b$ !, we have

$$
N=1+(a+1)(a+2) \cdots(a+c) \mid(a+c) !
$$

which implies that all prime factors of $N$ are at most $a+c$.

Let $p$ be a prime factor of $N$. If $p \leqslant c$ or $p \geqslant a+1$, then $p$ divides one of $a+1, \ldots, a+c$ which is impossible. Hence $a \geqslant p \geqslant c+1$. Furthermore, we must have $2 p>a+c$; otherwise, $a+1 \leqslant 2 c+2 \leqslant 2 p \leqslant a+c$ so $p \mid N-1$, again impossible. Thus, we have $p \in\left(\frac{a+c}{2}, a\right]$, and $p^{2} \nmid(a+c)$ ! since $2 p>a+c$. Therefore, $p^{2} \nmid N$ as well.

If $a \leqslant c+2$, then the interval $\left(\frac{a+c}{2}, a\right]$ contains at most one integer and hence at most one prime number, which has to be $a$. Since $p^{2} \nmid N$, we must have $N=p=a$ or $N=1$, which is absurd since $N>a \geqslant 1$. Thus, we have $a \geqslant c+3$, and so $\frac{a+c+1}{2} \geqslant c+2$. It follows that $p$ lies in the interval $[c+2, a]$.

Thus, every prime appearing in the prime factorization of $N$ lies in the interval $[c+2, a]$, and its exponent is exactly 1. So we must have $N \mid(c+2)(c+3) \cdots a$. However, $(c+2)(c+3) \cdots a$ is a product of $a-c-1 \leqslant c$ numbers not exceeding $a$, so it is less than $N$. This is a contradiction.
Subfield: Number Theory


Question: Let $m$ and $n$ be positive integers such that $m>n$. Define $x_{k}=(m+k) /(n+k)$ for $k=$ $1,2, \ldots, n+1$. Prove that if all the numbers $x_{1}, x_{2}, \ldots, x_{n+1}$ are integers, then $x_{1} x_{2} \cdots x_{n+1}-1$ is divisible by an odd prime.

Solution:
Assume that $x_{1}, x_{2}, \ldots, x_{n+1}$ are integers. Define the integers

$$
a_{k}=x_{k}-1=\frac{m+k}{n+k}-1=\frac{m-n}{n+k}>0
$$

for $k=1,2, \ldots, n+1$.

Let $P=x_{1} x_{2} \cdots x_{n+1}-1$. We need to prove that $P$ is divisible by an odd prime, or in other words, that $P$ is not a power of 2 . To this end, we investigate the powers of 2 dividing the numbers $a_{k}$.

Let $2^{d}$ be the largest power of 2 dividing $m-n$, and let $2^{c}$ be the largest power of 2 not exceeding $2 n+1$. Then $2 n+1 \leqslant 2^{c+1}-1$, and so $n+1 \leqslant 2^{c}$. We conclude that $2^{c}$ is one of the numbers $n+1, n+2, \ldots, 2 n+1$, and that it is the only multiple of $2^{c}$ appearing among these numbers. Let $\ell$ be such that $n+\ell=2^{c}$. Since $\frac{m-n}{n+\ell}$ is an integer, we have $d \geqslant c$. Therefore, $2^{d-c+1} \nmid a_{\ell}=\frac{m-n}{n+\ell}$, while $2^{d-c+1} \mid a_{k}$ for all $k \in\{1, \ldots, n+1\} \backslash\{\ell\}$.

Computing modulo $2^{d-c+1}$, we get

$$
P=\left(a_{1}+1\right)\left(a_{2}+1\right) \cdots\left(a_{n+1}+1\right)-1 \equiv\left(a_{\ell}+1\right) \cdot 1^{n}-1 \equiv a_{\ell} \not \equiv 0 \quad\left(\bmod 2^{d-c+1}\right) .
$$

Therefore, $2^{d-c+1} \nmid P$.

On the other hand, for any $k \in\{1, \ldots, n+1\} \backslash\{\ell\}$, we have $2^{d-c+1} \mid a_{k}$. So $P \geqslant a_{k} \geqslant 2^{d-c+1}$, and it follows that $P$ is not a power of 2 .
Subfield: Algebra


Question: Let $z_{0}<z_{1}<z_{2}<\cdots$ be an infinite sequence of positive integers. Prove that there exists a unique integer $n \geqslant 1$ such that

$$
z_{n}<\frac{z_{0}+z_{1}+\cdots+z_{n}}{n} \leqslant z_{n+1}
\tag{1}
$$

Solution:
For $n=1,2, \ldots$ define

$$
d_{n}=\left(z_{0}+z_{1}+\cdots+z_{n}\right)-n z_{n}
$$

The sign of $d_{n}$ indicates whether the first inequality in (1) holds; i.e., it is satisfied if and only if $d_{n}>0$.

Notice that

$$
n z_{n+1}-\left(z_{0}+z_{1}+\cdots+z_{n}\right)=(n+1) z_{n+1}-\left(z_{0}+z_{1}+\cdots+z_{n}+z_{n+1}\right)=-d_{n+1}
$$

so the second inequality in (1) is equivalent to $d_{n+1} \leqslant 0$. Therefore, we have to prove that there is a unique index $n \geqslant 1$ that satisfies $d_{n}>0 \geqslant d_{n+1}$.

By its definition the sequence $d_{1}, d_{2}, \ldots$ consists of integers and we have

$$
d_{1}=\left(z_{0}+z_{1}\right)-1 \cdot z_{1}=z_{0}>0
$$

From

$d_{n+1}-d_{n}=\left(\left(z_{0}+\cdots+z_{n}+z_{n+1}\right)-(n+1) z_{n+1}\right)-\left(\left(z_{0}+\cdots+z_{n}\right)-n z_{n}\right)=n\left(z_{n}-z_{n+1}\right)<0$

we can see that $d_{n+1}<d_{n}$ and thus the sequence strictly decreases.

Hence, we have a decreasing sequence $d_{1}>d_{2}>\ldots$ of integers such that its first element $d_{1}$ is positive. The sequence must drop below 0 at some point, and thus there is a unique index $n$, that is the index of the last positive term, satisfying $d_{n}>0 \geqslant d_{n+1}$.
Subfield: Algebra


Question: Define the function $f:(0,1) \rightarrow(0,1)$ by

$$
f(x)= \begin{cases}x+\frac{1}{2} & \text { if } x<\frac{1}{2} \\ x^{2} & \text { if } x \geqslant \frac{1}{2}\end{cases}
$$

Let $a$ and $b$ be two real numbers such that $0<a<b<1$. We define the sequences $a_{n}$ and $b_{n}$ by $a_{0}=a, b_{0}=b$, and $a_{n}=f\left(a_{n-1}\right), b_{n}=f\left(b_{n-1}\right)$ for $n>0$. Show that there exists a positive integer $n$ such that

$$
\left(a_{n}-a_{n-1}\right)\left(b_{n}-b_{n-1}\right)<0 .
$$

Solution:
Note that

$$
f(x)-x=\frac{1}{2}>0
$$

if $x<\frac{1}{2}$ and

$$
f(x)-x=x^{2}-x<0
$$

if $x \geqslant \frac{1}{2}$. So if we consider $(0,1)$ as being divided into the two subintervals $I_{1}=\left(0, \frac{1}{2}\right)$ and $I_{2}=\left[\frac{1}{2}, 1\right)$, the inequality

$$
\left(a_{n}-a_{n-1}\right)\left(b_{n}-b_{n-1}\right)=\left(f\left(a_{n-1}\right)-a_{n-1}\right)\left(f\left(b_{n-1}\right)-b_{n-1}\right)<0
$$

holds if and only if $a_{n-1}$ and $b_{n-1}$ lie in distinct subintervals.

Let us now assume, to the contrary, that $a_{k}$ and $b_{k}$ always lie in the same subinterval. Consider the distance $d_{k}=\left|a_{k}-b_{k}\right|$. If both $a_{k}$ and $b_{k}$ lie in $I_{1}$, then

$$
d_{k+1}=\left|a_{k+1}-b_{k+1}\right|=\left|a_{k}+\frac{1}{2}-b_{k}-\frac{1}{2}\right|=d_{k}
$$

If, on the other hand, $a_{k}$ and $b_{k}$ both lie in $I_{2}$, then $\min \left(a_{k}, b_{k}\right) \geqslant \frac{1}{2}$ and $\max \left(a_{k}, b_{k}\right)=$ $\min \left(a_{k}, b_{k}\right)+d_{k} \geqslant \frac{1}{2}+d_{k}$, which implies

$$
d_{k+1}=\left|a_{k+1}-b_{k+1}\right|=\left|a_{k}^{2}-b_{k}^{2}\right|=\left|\left(a_{k}-b_{k}\right)\left(a_{k}+b_{k}\right)\right| \geqslant\left|a_{k}-b_{k}\right|\left(\frac{1}{2}+\frac{1}{2}+d_{k}\right)=d_{k}\left(1+d_{k}\right) \geqslant d_{k}
$$

This means that the difference $d_{k}$ is non-decreasing, and in particular $d_{k} \geqslant d_{0}>0$ for all $k$.

We can even say more. If $a_{k}$ and $b_{k}$ lie in $I_{2}$, then

$$
d_{k+2} \geqslant d_{k+1} \geqslant d_{k}\left(1+d_{k}\right) \geqslant d_{k}\left(1+d_{0}\right)
$$

If $a_{k}$ and $b_{k}$ both lie in $I_{1}$, then $a_{k+1}$ and $b_{k+1}$ both lie in $I_{2}$, and so we have

$$
d_{k+2} \geqslant d_{k+1}\left(1+d_{k+1}\right) \geqslant d_{k+1}\left(1+d_{0}\right)=d_{k}\left(1+d_{0}\right)
$$

In either case, $d_{k+2} \geqslant d_{k}\left(1+d_{0}\right)$, and inductively we get

$$
d_{2 m} \geqslant d_{0}\left(1+d_{0}\right)^{m}
$$

For sufficiently large $m$, the right-hand side is greater than 1 , but since $a_{2 m}, b_{2 m}$ both lie in $(0,1)$, we must have $d_{2 m}<1$, a contradiction.

Thus there must be a positive integer $n$ such that $a_{n-1}$ and $b_{n-1}$ do not lie in the same subinterval, which proves the desired statement.
Subfield: Algebra


Question: Determine all functions $f: \mathbb{Z} \rightarrow \mathbb{Z}$ satisfying

$$
f(f(m)+n)+f(m)=f(n)+f(3 m)+2014
\tag{1}
$$

for all integers $m$ and $n$.

Solution:
Let $f$ be a function satisfying (1). Set $C=1007$ and define the function $g: \mathbb{Z} \rightarrow \mathbb{Z}$ by $g(m)=f(3 m)-f(m)+2 C$ for all $m \in \mathbb{Z}$; in particular, $g(0)=2 C$. Now (1) rewrites as

$$
f(f(m)+n)=g(m)+f(n)
$$

for all $m, n \in \mathbb{Z}$. By induction in both directions it follows that

$$
f(t f(m)+n)=\operatorname{tg}(m)+f(n)
\tag{2}
$$

holds for all $m, n, t \in \mathbb{Z}$. Applying this, for any $r \in \mathbb{Z}$, to the triples $(r, 0, f(0))$ and $(0,0, f(r))$ in place of $(m, n, t)$ we obtain

$$
f(0) g(r)=f(f(r) f(0))-f(0)=f(r) g(0) \text {. }
$$

Now if $f(0)$ vanished, then $g(0)=2 C>0$ would entail that $f$ vanishes identically, contrary to (1). Thus $f(0) \neq 0$ and the previous equation yields $g(r)=\alpha f(r)$, where $\alpha=\frac{g(0)}{f(0)}$ is some nonzero constant.

So the definition of $g$ reveals $f(3 m)=(1+\alpha) f(m)-2 C$, i.e.,

$$
f(3 m)-\beta=(1+\alpha)(f(m)-\beta)
\tag{3}
$$

for all $m \in \mathbb{Z}$, where $\beta=\frac{2 C}{\alpha}$. By induction on $k$ this implies

$$
f\left(3^{k} m\right)-\beta=(1+\alpha)^{k}(f(m)-\beta)
\tag{4}
$$

for all integers $k \geqslant 0$ and $m$.

Since $3 \nmid 2014$, there exists by (1) some value $d=f(a)$ attained by $f$ that is not divisible by 3 . Now by (2) we have $f(n+t d)=f(n)+t g(a)=f(n)+\alpha \cdot t f(a)$, i.e.,

$$
f(n+t d)=f(n)+\alpha \cdot t d
\tag{5}
$$

for all $n, t \in \mathbb{Z}$.

Let us fix any positive integer $k$ with $d \mid\left(3^{k}-1\right)$, which is possible, since $\operatorname{gcd}(3, d)=1$. E.g., by the Euler-Fermat theorem, we may take $k=\varphi(|d|)$. Now for each $m \in \mathbb{Z}$ we get

$$
f\left(3^{k} m\right)=f(m)+\alpha\left(3^{k}-1\right) m
$$

from (5), which in view of (4) yields $\left((1+\alpha)^{k}-1\right)(f(m)-\beta)=\alpha\left(3^{k}-1\right) m$. Since $\alpha \neq 0$, the right hand side does not vanish for $m \neq 0$, wherefore the first factor on the left hand side cannot vanish either. It follows that

$$
f(m)=\frac{\alpha\left(3^{k}-1\right)}{(1+\alpha)^{k}-1} \cdot m+\beta
$$



So $f$ is a linear function, say $f(m)=A m+\beta$ for all $m \in \mathbb{Z}$ with some constant $A \in \mathbb{Q}$. Plugging this into (1) one obtains $\left(A^{2}-2 A\right) m+(A \beta-2 C)=0$ for all $m$, which is equivalent to the conjunction of

$$
A^{2}=2 A \quad \text { and } \quad A \beta=2 C .
\tag{6}
$$

The first equation is equivalent to $A \in\{0,2\}$, and as $C \neq 0$ the second one gives

$$
A=2 \quad \text { and } \quad \beta=C .
\tag{7}
$$

This shows that $f$ is indeed the function mentioned in the answer and as the numbers found in (7) do indeed satisfy the equations (6) this function is indeed as desired.

Final answer: $f(n) = 2 n+1007$
Subfield: Combinatorics


Question: We have $2^{m}$ sheets of paper, with the number 1 written on each of them. We perform the following operation. In every step we choose two distinct sheets; if the numbers on the two sheets are $a$ and $b$, then we erase these numbers and write the number $a+b$ on both sheets. Prove that after $m 2^{m-1}$ steps, the sum of the numbers on all the sheets is at least $4^{m}$.

Solution:
Let $P_{k}$ be the product of the numbers on the sheets after $k$ steps.

Suppose that in the $(k+1)^{\text {th }}$ step the numbers $a$ and $b$ are replaced by $a+b$. In the product, the number $a b$ is replaced by $(a+b)^{2}$, and the other factors do not change. Since $(a+b)^{2} \geqslant 4 a b$, we see that $P_{k+1} \geqslant 4 P_{k}$. Starting with $P_{0}=1$, a straightforward induction yields

$$
P_{k} \geqslant 4^{k}
$$

for all integers $k \geqslant 0$; in particular

$$
P_{m \cdot 2^{m-1}} \geqslant 4^{m \cdot 2^{m-1}}=\left(2^{m}\right)^{2^{m}}
$$

so by the AM-GM inequality, the sum of the numbers written on the sheets after $m 2^{m-1}$ steps is at least

$$
2^{m} \cdot \sqrt[2^{m}]{P_{m \cdot 2^{m-1}}} \geqslant 2^{m} \cdot 2^{m}=4^{m}
$$
Subfield: Combinatorics


Question: Construct a tetromino by attaching two $2 \times 1$ dominoes along their longer sides such that the midpoint of the longer side of one domino is a corner of the other domino. This construction yields two kinds of tetrominoes with opposite orientations. Let us call them Sand Z-tetrominoes, respectively.

<img_4003>

S-tetrominoes

<img_3692>

Z-tetrominoes

Assume that a lattice polygon $P$ can be tiled with $S$-tetrominoes. Prove than no matter how we tile $P$ using only $\mathrm{S}$ - and Z-tetrominoes, we always use an even number of Z-tetrominoes.

Solution:
We may assume that polygon $P$ is the union of some squares of an infinite chessboard. Colour the squares of the chessboard with two colours as the figure below illustrates.

<img_3847>

Observe that no matter how we tile $P$, any S-tetromino covers an even number of black squares, whereas any Z-tetromino covers an odd number of them. As $P$ can be tiled exclusively by S-tetrominoes, it contains an even number of black squares. But if some S-tetrominoes and some Z-tetrominoes cover an even number of black squares, then the number of Z-tetrominoes must be even.
Let us assign coordinates to the squares of the infinite chessboard in such a way that the squares of $P$ have nonnegative coordinates only, and that the first coordinate increases as one moves to the right, while the second coordinate increases as one moves upwards. Write the integer $3^{i} \cdot(-3)^{j}$ into the square with coordinates $(i, j)$, as in the following figure:

| $\vdots$ |  |  |  |  |  |
| :---: | :---: | :---: | :---: | :---: | :---: |
| 81 | $\vdots$ |  |  |  |  |
| -27 | -81 | $\vdots$ |  |  |  |
| 9 | 27 | 81 | $\cdots$ |  |  |
| -3 | -9 | -27 | -81 | $\ldots$ |  |
| 1 | 3 | 9 | 27 | 81 | $\ldots$ |

The sum of the numbers written into four squares that can be covered by an $S$-tetromino is either of the form

$$
3^{i} \cdot(-3)^{j} \cdot\left(1+3+3 \cdot(-3)+3^{2} \cdot(-3)\right)=-32 \cdot 3^{i} \cdot(-3)^{j}
$$

(for the first type of $S$-tetrominoes), or of the form

$$
3^{i} \cdot(-3)^{j} \cdot\left(3+3 \cdot(-3)+(-3)+(-3)^{2}\right)=0
$$

and thus divisible by 32. For this reason, the sum of the numbers written into the squares of $P$, and thus also the sum of the numbers covered by $Z$-tetrominoes in the second covering, is likewise divisible by 32 . Now the sum of the entries of a $Z$-tetromino is either of the form

$$
3^{i} \cdot(-3)^{j} \cdot\left(3+3^{2}+(-3)+3 \cdot(-3)\right)=0
$$

(for the first type of $Z$-tetrominoes), or of the form

$$
3^{i} \cdot(-3)^{j} \cdot\left(1+(-3)+3 \cdot(-3)+3 \cdot(-3)^{2}\right)=16 \cdot 3^{i} \cdot(-3)^{j}
$$

i.e., 16 times an odd number. Thus in order to obtain a total that is divisible by 32, an even number of the latter kind of $Z$-tetrominoes needs to be used. Rotating everything by $90^{\circ}$, we find that the number of $Z$-tetrominoes of the first kind is even as well. So we have even proven slightly more than necessary.
Subfield: Combinatorics


Question: Consider $n \geqslant 3$ lines in the plane such that no two lines are parallel and no three have a common point. These lines divide the plane into polygonal regions; let $\mathcal{F}$ be the set of regions having finite area. Prove that it is possible to colour $\lceil\sqrt{n / 2}\rceil$ of the lines blue in such a way that no region in $\mathcal{F}$ has a completely blue boundary. (For a real number $x,\lceil x\rceil$ denotes the least integer which is not smaller than $x$.)

Solution:
Let $L$ be the given set of lines. Choose a maximal (by inclusion) subset $B \subseteq L$ such that when we colour the lines of $B$ blue, no region in $\mathcal{F}$ has a completely blue boundary. Let $|B|=k$. We claim that $k \geqslant\lceil\sqrt{n / 2}\rceil$.

Let us colour all the lines of $L \backslash B$ red. Call a point blue if it is the intersection of two blue lines. Then there are $\left(\begin{array}{l}k \\ 2\end{array}\right)$ blue points.

Now consider any red line $\ell$. By the maximality of $B$, there exists at least one region $A \in \mathcal{F}$ whose only red side lies on $\ell$. Since $A$ has at least three sides, it must have at least one blue vertex. Let us take one such vertex and associate it to $\ell$.

Since each blue point belongs to four regions (some of which may be unbounded), it is associated to at most four red lines. Thus the total number of red lines is at most $4\left(\begin{array}{l}k \\ 2\end{array}\right)$. On the other hand, this number is $n-k$, so

$$
n-k \leqslant 2 k(k-1), \quad \text { thus } n \leqslant 2 k^{2}-k \leqslant 2 k^{2} \text {, }
$$

and finally $k \geqslant\lceil\sqrt{n / 2}\rceil$, which gives the desired result.
Subfield: Combinatorics


Question: Let $M$ be a set of $n \geqslant 4$ points in the plane, no three of which are collinear. Initially these points are connected with $n$ segments so that each point in $M$ is the endpoint of exactly two segments. Then, at each step, one may choose two segments $A B$ and $C D$ sharing a common interior point and replace them by the segments $A C$ and $B D$ if none of them is present at this moment. Prove that it is impossible to perform $n^{3} / 4$ or more such moves.

Solution:
A line is said to be red if it contains two points of $M$. As no three points of $M$ are collinear, each red line determines a unique pair of points of $M$. Moreover, there are precisely $\left(\begin{array}{l}n \\ 2\end{array}\right)<\frac{n^{2}}{2}$ red lines. By the value of a segment we mean the number of red lines intersecting it in its interior, and the value of a set of segments is defined to be the sum of the values of its elements. We will prove that $(i)$ the value of the initial set of segments is smaller than $n^{3} / 2$ and that (ii) each step decreases the value of the set of segments present by at least 2 . Since such a value can never be negative, these two assertions imply the statement of the problem.

To show $(i)$ we just need to observe that each segment has a value that is smaller than $n^{2} / 2$. Thus the combined value of the $n$ initial segments is indeed below $n \cdot n^{2} / 2=n^{3} / 2$.

It remains to establish (ii). Suppose that at some moment we have two segments $A B$ and $C D$ sharing an interior point $S$, and that at the next moment we have the two segments $A C$ and $B D$ instead. Let $X_{A B}$ denote the set of red lines intersecting the segment $A B$ in its interior and let the sets $X_{A C}, X_{B D}$, and $X_{C D}$ be defined similarly. We are to prove that $\left|X_{A C}\right|+\left|X_{B D}\right|+2 \leqslant\left|X_{A B}\right|+\left|X_{C D}\right|$.

As a first step in this direction, we claim that

$$
\left|X_{A C} \cup X_{B D}\right|+2 \leqslant\left|X_{A B} \cup X_{C D}\right|
\tag{1}
$$

Indeed, if $g$ is a red line intersecting, e.g. the segment $A C$ in its interior, then it has to intersect the triangle $A C S$ once again, either in the interior of its side $A S$, or in the interior of its side $C S$, or at $S$, meaning that it belongs to $X_{A B}$ or to $X_{C D}$ (see Figure 1). Moreover, the red lines $A B$ and $C D$ contribute to $X_{A B} \cup X_{C D}$ but not to $X_{A C} \cup X_{B D}$. Thereby (1) is proved.

<img_3851>

Figure 1

<img_3747>

Figure 2

<img_3456>

Figure 3

Similarly but more easily one obtains

$$
\left|X_{A C} \cap X_{B D}\right| \leqslant\left|X_{A B} \cap X_{C D}\right|
\tag{2}
$$

Indeed, a red line $h$ appearing in $X_{A C} \cap X_{B D}$ belongs, for similar reasons as above, also to $X_{A B} \cap X_{C D}$. To make the argument precise, one may just distinguish the cases $S \in h$ (see Figure 2) and $S \notin h$ (see Figure 3). Thereby (2) is proved.

Adding (1) and (2) we obtain the desired conclusion, thus completing the solution of this problem.
Subfield: Geometry


Question: The points $P$ and $Q$ are chosen on the side $B C$ of an acute-angled triangle $A B C$ so that $\angle P A B=\angle A C B$ and $\angle Q A C=\angle C B A$. The points $M$ and $N$ are taken on the rays $A P$ and $A Q$, respectively, so that $A P=P M$ and $A Q=Q N$. Prove that the lines $B M$ and $C N$ intersect on the circumcircle of the triangle $A B C$.

Solution:
Denote by $S$ the intersection point of the lines $B M$ and $C N$. Let moreover $\beta=\angle Q A C=\angle C B A$ and $\gamma=\angle P A B=\angle A C B$. From these equalities it follows that the triangles $A B P$ and $C A Q$ are similar (see Figure 1). Therefore we obtain

$$
\frac{B P}{P M}=\frac{B P}{P A}=\frac{A Q}{Q C}=\frac{N Q}{Q C}
$$

Moreover,

$$
\angle B P M=\beta+\gamma=\angle C Q N
$$

Hence the triangles $B P M$ and $N Q C$ are similar. This gives $\angle B M P=\angle N C Q$, so the triangles $B P M$ and $B S C$ are also similar. Thus we get

$$
\angle C S B=\angle B P M=\beta+\gamma=180^{\circ}-\angle B A C
$$

which completes the solution.

<img_3301>

Figure 1

<img_3284>

Figure 2
As in the previous solution, denote by $S$ the intersection point of the lines $B M$ and $N C$. Let moreover the circumcircle of the triangle $A B C$ intersect the lines $A P$ and $A Q$ again at $K$ and $L$, respectively (see Figure 2).

Note that $\angle L B C=\angle L A C=\angle C B A$ and similarly $\angle K C B=\angle K A B=\angle B C A$. It implies that the lines $B L$ and $C K$ meet at a point $X$, being symmetric to the point $A$ with respect to the line $B C$. Since $A P=P M$ and $A Q=Q N$, it follows that $X$ lies on the line $M N$. Therefore, using PASCAL's theorem for the hexagon $A L B S C K$, we infer that $S$ lies on the circumcircle of the triangle $A B C$, which finishes the proof.