2. (3) In the class, there are $N<40$ students. All of them took a math test. A student is considered to have passed the test if they scored at least 65 points. It turned out that the average score of all students was 66, the average score of those who passed was 71, and the average score of those who did not pass was 56. Later, an error was found in the condition of one of the problems, and all students were given an additional 5 points. After this, the average score of those who passed became 75, and those who did not pass - 59. How many students are in the class?

(ItaMO 2010, p1)
Answer: $N=12, N=24$ or $N=36$.

Let $x$ be the number of boys who successfully wrote during the first count, $y$ be the number of the other boys, and $d$ be the number of boys who failed during the first count but succeeded during the second count. Then

$$
66(x+y)=71 x+56 y \quad \Rightarrow \quad x=2 y
$$

Since $x+y<40$, then $y<40 / 3<14$. The average score of all boys during the second count is $66+5=71$, so

$$
71(x+y)=75(x+d)+59(y-d) \quad \Rightarrow \quad y=4 d
$$

We get the options: $(x, y, z)=(8,4,1),(x, y, z)=(16,8,2)$ and $(x, y, z)=$ $(24,12,3)$. The first case can be realized, for example, if three boys scored 54 points each, one scored 62 points, and 8 scored 71 points each during the first count. Examples for the second and third cases can be obtained by doubling and tripling the first example.