# Group By

*English translation by SOTA – AI Community of the Russian original. Organisers who would like this translation removed can email sota.ai.community@gmail.com.*

*Task 4 of the municipal stage (Moscow) of the All-Russian School Olympiad (VsOSh) 2025/26 in artificial intelligence, grades 9–11 (variant III). Original: [tasks-ai-9-11-mun-msk-25-26.pdf](https://vos.olimpiada.ru/upload/files/Arhive_tasks/2025-26/mun/ai/tasks-ai-9-11-mun-msk-25-26.pdf).*

An electronic testing system records the results of pupils' tests, which you can download in [XLSX](https://lab.sirius.online/smt-portal/content/_image/0effa7fbaa0656e1855397104ba75e4b8256540d), [ODS](https://lab.sirius.online/smt-portal/files/08e4f777f83cbbaf61d53b6a61e040ab9cc53a31.ods) or [CSV](https://lab.sirius.online/smt-portal/content/_image/4443dd3559f8649824ea854e28a90a5dc61b554f) format. The file contains five columns:

- `student_id` — the pupil's identifier (integer);
- `subject` — the subject in which the test was taken (string);
- `score` — the score obtained (real number);
- `cheat_flag` — suspicion of cheating (True/False);
- `attempt_no` — the attempt number (integer; 1 means the first attempt).

Perform the following operations on the data:

1. Clean the score column: replace empty values with 0, also replace values less than 0 with 0, and replace values greater than 100 with 100.
2. Delete the rows where `cheat_flag` = True.
3. Keep only the rows that correspond to the first attempt, that is, those where `attempt_no` = 1.
4. For each pupil, compute their average score across subjects: the mean of all `score` values that remain after the operations above.

How many pupils have an average score in the range $60 \leqslant$ `avg_score` $< 80$?

*Translator's note: this task's points are not stated in the statement paper (whose total is 600 points); the official answers give a maximum of 100 points (exact match of the answer).*
