For any set $A=\left\{x_{1}, x_{2}, x_{3}, x_{4}, x_{5}\right\}$ of five distinct positive integers denote by $S_{A}$ the sum of its elements, and denote by $T_{A}$ the number of triples $(i, j, k)$ with $1 \leqslant i<j<k \leqslant 5$ for which $x_{i}+x_{j}+x_{k}$ divides $S_{A}$.

Find the largest possible value of $T_{A}$.
We will prove that the maximum value that $T_{A}$ can attain is 4. Let $A=$ $\left\{x_{1}, x_{2}, x_{3}, x_{4}, x_{5}\right\}$ be a set of five positive integers such that $x_{1} < x_{2} < x_{3} < x_{4} < x_{5}$. Analogously we can show that any triple of form $(x, y, 5)$ where $y > 2$ isn't good.

By above, the number of good triples can be at most 5 and only triples $(1,2,5),(2,3,4)$, $(1,3,4),(1,2,4),(1,2,3)$ can be good. But if triples $(1,2,5)$ and $(2,3,4)$ are simultaneously good we have that:

$$
x_{1} + x_{2} + x_{5} \mid x_{3} + x_{4} \Rightarrow x_{5} < x_{3} + x_{4}
$$

and

$$
x_{2} + x_{3} + x_{4} \mid x_{1} + x_{5} \Rightarrow x_{2} + x_{3} + x_{4} \leqslant x_{1} + x_{5} \stackrel{(1)}{<} x_{1} + x_{3} + x_{4} < x_{2} + x_{3} + x_{4},
$$

which is impossible. Therefore, $T_{A} \leqslant 4$.

Alternatively, one can prove the statement above by adding up the two inequalities $x_{1} + x_{2} + x_{4} < x_{3} + x_{4}$ and $x_{2} + x_{3} + x_{4} < x_{1} + x_{5}$ that are derived from the divisibilities.

To show that $T_{A} = 4$ is possible, consider the numbers $1, 2, 3, 4, 494$. This works because $6 \mid 498$, $7 \mid 497$, $8 \mid 496$, and $9 \mid 495$.

Remark. The motivation for construction is to realize that if we choose $x_{1}, x_{2}, x_{3}, x_{4}$ we can get all the conditions $x_{5}$ must satisfy. Let $S = x_{1} + x_{2} + x_{3} + x_{4}$. Now we have to choose $x_{5}$ such that

$$
S - x_{i} \mid x_{i} + x_{5} \text{, i.e. } x_{5} \equiv -x_{i} \quad \bmod \left(S - x_{i}\right) \forall i \in \{1, 2, 3, 4\}
$$

By the Chinese Remainder Theorem it is obvious that if $S - x_{1}, S - x_{2}, S - x_{3}, S - x_{4}$ are pairwise coprime, such $x_{5}$ must exist. To make all these numbers pairwise coprime it's natural to take $x_{1}, x_{2}, x_{3}, x_{4}$ to be all odd and then solve mod 3 issues. Fortunately it can be seen that $1, 5, 7, 11$ easily works because $13, 17, 19, 23$ are pairwise coprime.

However, even without the knowledge of this theorem it makes sense intuitively that this system must have a solution for some $x_{1}, x_{2}, x_{3}, x_{4}$. By taking $\left(x_{1}, x_{2}, x_{3}, x_{4}\right) = (1, 2, 3, 4)$ we get a pretty simple system which can be solved by hand rather easily.