Task 2. In $1^{\text {st }}$ grade, each child was asked to write down two numbers: the number of their classmates and the number of their female classmates (in that exact order; the child does not count themselves). Each child wrote one number correctly, and the other number was off by exactly 2. Among the answers received were: $(12,18),(15,15),(11,15)$. How many boys and how many girls are in the class?
Answer: 13 boys and 16 girls.

Solution. First solution. Let's denote the children who gave the answers (12,18), (15,15), (11,15) as A, B, and C, respectively. Note that if there are $m$ boys in the class, then the first number in the girls' answers has the same parity as $m$, and in the boys' answers - the opposite. Therefore, children B and C are of the same gender, and A is of the other gender.

The first numbers in the answers of B and C differ by 4, so they are both incorrect. Thus, the number of classmates for B and C is 13, and the number of female classmates is 15.

If B and C are boys, then there are 14 boys and 15 girls in the class. In this case, girl A would have 14 classmates and 14 female classmates, and her answer (12,18) would contradict the condition. Therefore, B and C are girls, and there are 13 boys and 16 girls in the class.

Second solution. Suppose a child wrote the numbers $(m, d)$. If he wrote both numbers correctly, then he would have written one of the four options: $(m-2, d),(m+2, d),(m, d-2),(m, d+2)$. Then, if this child is a boy, there are four possible options for the number of boys and girls in the class: $(m-1, d),(m+3, d),(m+1, d-2)$, and $(m+1, d+2)$. Similarly, if this child is a girl, the possible options in this case are: $(m-2, d+1),(m+2, d+1),(m, d-1),(m, d+3)$.

Thus, each answer gives us eight options for how many boys and girls could be in the class, one of which must be correct:

for (12,18) these are (11,18),(15,18),(13,16),(13,20),(10,19),(14,19),(12,17),(12,21);

for (15,15) these are (14,15),(18,15),(16,13),(16,17),(13,16),(17,16),(15,14),(15,18);

for (11,15) these are (10,15),(14,15),(12,13),(12,17),(9,16),(13,16),(11,14),(11,18).

It remains to note that only the option (13,16) appears in all three rows.