9.6. There are 2013 cards with the digit 1 written on them, and 2013 cards with the digit 2 written on them. Vasya forms a 4026-digit number from these cards. In one move, Petya can swap two cards and pay Vasya 1 ruble. The process ends when Petya gets a number divisible by 11. What is the maximum amount Vasya can earn if Petya aims to pay as little as possible?

(P. Kozhevnikov)
Answer: 5 rubles.

Solution. Consider a 4026-digit number $A$, consisting of

2013 ones and 2013 twos. Suppose in this number, there are $k$ ones and $\ell=2013-k$ twos in the odd positions, then there will be $k$ twos and $\ell$ ones in the even positions (here $k$ can take any integer value from 0 to 2013). The difference between the sum of the digits in the odd positions and the sum of the digits in the even positions is $(k+2 \ell)-(2 k+\ell)=\ell-k=2013-2 k$. Since 2013 is divisible by 11, the number $A$ is divisible by 11 if and only if $k$ is divisible by 11.

In one move, $k$ can change by no more than 1. Therefore, if Vasya initially forms a number $A$ for which, say, $k=5$ (obviously, this is possible), then, obviously, Petya will need at least 5 moves to change $k$ by 1 to first obtain a number for which $k$ is divisible by 11 (i.e., $k=0$ or $k=11$).

We will show that, conversely, five moves are always enough for Petya. By swapping a one in an odd position with a two in an even position, he can decrease $k$ by 1 in one move, as long as $k \neq 0$. Similarly, by swapping a two in an odd position with a one in an even position, he can increase $k$ by 1 in one move, as long as $k \neq 2013$. Let the initial number given by Vasya give a remainder $r$ when divided by 11. If $r=0$, then the initial number is already divisible by 11, and nothing needs to be done. If $1 \leqslant r \leqslant 5$, then in $r$ operations, Petya can decrease $k$ by $r$ to the nearest number divisible by 11. If $6 \leqslant r \leqslant 10$, then in $11-r \leqslant 5$ operations, Petya can increase $k$ by $11-r$ to the nearest number divisible by 11 (this is possible because the largest possible value of $k=2013$ is divisible by 11).

Remark. If the boys had $n$ cards with the digits 1 and 2 each, the answer in a similar problem would depend on the remainder of $n$ when divided by 11 - even for large $n$. For example, if $n=2000$, then Petya needs to ensure that $k$ has a remainder of 10 when divided by 11; thus, if $k=2000$ or $k=0$, Petya might need 10 moves.

Therefore, the complete solution to the problem should significantly use the fact that $n=2013$.

Comment. Only the answer - 0 points.

An example of a number that cannot be transformed as required in fewer than 5 moves is provided, and it is proven that this number is exactly such - 3 points.

It is proven only that from any number, a number divisible by 11 can be obtained in no more than 5 moves - 3 points.

If the solution does not use the fact that $n=2013$ - no more than 5 points.

The divisibility rule for 11 can be used without proof.