Let $M$ be a subset of the set of 2021 integers $\{1,2,3, \ldots, 2021\}$ such that for any three elements (not necessarily distinct) $a, b, c$ of $M$ we have $|a+b-c|>10$. Determine the largest possible number of elements of $M$.
The set $M=\{1016,1017, \ldots, 2021\}$ has 1006 elements and satisfies the required property, since $a, b, c \in M$ implies that $a+b-c \geqslant 1016+1016-2021=11$. We will show that this is optimal.

Suppose $M$ satisfies the condition in the problem. Let $k$ be the minimal element of $M$. Then $k=|k+k-k|>10 \Rightarrow k \geqslant 11$. Note also that for every $m$, the integers $m, m+k-10$ cannot both belong to $M$, since $k+m-(m+k-10)=10$.

Claim 1: $M$ contains at most $k-10$ out of any $2 k-20$ consecutive integers.

Proof: We can partition the set $\{m, m+1, \ldots, m+2 k-21\}$ into $k-10$ pairs as follows:

$$
\{m, m+k-10\},\{m+1, m+k-9\}, \ldots,\{m+k-11, m+2 k-21\}
$$

It remains to note that $M$ can contain at most one element of each pair.

Claim 2: $M$ contains at most $[(t+k-10) / 2]$ out of any $t$ consecutive integers.

Proof: Write $t=q(2 k-20)+r$ with $r \in\{0,1,2 \ldots, 2 k-21\}$. From the set of the first $q(2 k-20)$ integers, by Claim 1 at most $q(k-10)$ can belong to $M$. Also by claim 1, it follows that from the last $r$ integers, at $\operatorname{most} \min \{r, k-10\}$ can belong to $M$.

Thus,

- If $r \leqslant k-10$, then at most

$$
q(k-10)+r=\frac{t+r}{2} \leqslant \frac{t+k-10}{2} \text { integers belong to } M
$$

- If $r>k-10$, then at most

$$
q(k-10)+k-10=\frac{t-r+2(k-10)}{2} \leqslant \frac{t+k-10}{2} \text { integers belong to } M
$$

By Claim 2, the number of elements of $M$ amongst $k+1, k+2, \ldots, 2021$ is at most

$$
\left[\frac{(2021-k)+(k-10)}{2}\right]=1005
$$

Since amongst $\{1,2, \ldots, k\}$ only $k$ belongs to $M$, we conclude that $M$ has at most 1006 elements as claimed.