The problem in brief
A class of 30 students took a maths test: the mean score was 75, the median 78 and the standard deviation 5. Two latecomers then sit the test and both score 90. You must give the new class mean (two decimals), then answer a question about a "praise" rule: a student is praised when their score is above the median (still 78) by more than the new standard deviation. Darkhan scored exactly 78 and may retake the test once; what is the smallest integer score that earns him the praise?
The catch is that you never see the 30 individual scores. The whole problem is about what you can still compute from three summary numbers.
How you are scored
The answer is one line with two numbers: the new mean with two decimals, then an integer. It is an exact-answer task.
Our answer, derived below and checked with exact fractions in solution.py:
A word of warning: the answer key published with the statement in the community archive reads 76.00 83. We could not reproduce either number under any reasonable reading (see the last section): is , not , and every convention for the standard deviation gives a threshold above 83.98. We explain our derivation step by step so that you can judge for yourself.
The key idea
Means and variances can be updated without the raw data, because they only depend on two totals, the sum and the sum of squares:
The last identity ("mean of the squares minus square of the mean") follows from expanding .
So from you recover , add the new students to both totals, and convert back. Statisticians call sufficient statistics; in machine learning the same trick computes means and variances over a dataset that does not fit in memory, in one streaming pass (this is how batch normalisation keeps its running statistics, and how StandardScaler.partial_fit works).
Question by question
1. The new mean
The 30 original scores sum to . Adding the two 90s gives over students:
Sanity check: two scores 15 points above the old mean, diluted among 32 students, should raise the mean by about . They do.
Answer: 75.94.
2. The new standard deviation
With the population convention (divide by ), gives the original sum of squares:
Add the two newcomers: . Then
A more intuitive route to the same number decomposes the squared deviations around the new mean :
and . The decomposition shows why the spread grew so much: the two 90s are far from the centre and their squared distance (about 198 each) dominates.
Note that the median plays no role in these computations: the median cannot be updated from summary numbers, which is exactly why the statement has to tell you that it stayed at 78.
3. Darkhan's minimum retake score
The praise rule asks for a score with
The smallest integer above is 85. A score of 84 is a gain of only 6 points, short of 6.05.
Does the retake itself change the standard deviation? A careful contestant should worry: if Darkhan's 78 is replaced by , the class statistics move too. Redo the computation with and . At the standard deviation becomes , and the gain still beats it. At the gain loses against both the frozen value (6.05) and the recomputed one (6.18). The answer is the same under both readings, which is reassuring.

Answer: 85.
Is the answer robust to the conventions?
The statement does not say whether "standard deviation" divides by (population) or (sample). We recomputed every combination:
| original sd 5 read as | new sd computed as | new sd | threshold | answer |
|---|---|---|---|---|
| population | population | 6.0515 | 84.05 | 85 |
| population | sample | 6.1484 | 84.15 | 85 |
| sample | sample | 6.0824 | 84.08 | 85 |
| sample | population | 5.9866 | 83.99 | 84 |
| any, retake recomputed | same convention | 6.18 to 6.35 | 84.2 to 84.4 | 85 |
Only the inconsistent mix (sample before, population after) gives 84. The published key 76.00 83 corresponds to rounding the mean to 76 and then using the old deviation 5 with "at least" instead of "more than" (), which contradicts the statement twice ("new standard deviation", "exceeds"). We therefore keep 75.94 85.
Results
| approach | mean | retake | verdict |
|---|---|---|---|
| totals , updated, population sd, frozen threshold | 75.94 | 85 | our answer |
| same, standard deviation recomputed after the retake | 75.94 | 85 | same answer, more careful |
| sample sd () throughout | 75.94 | 85 | same |
| forgets the newcomers in the sd (uses 5) | 75.94 | 84 | wrong: the rule says "new" sd |
| mean of the two group means | 82.50 | wrong: groups have different sizes | |
| published key | 76.00 | 83 | not reproducible from the statement |
What to remember
- Mean and variance only need , and . Recover these totals, update them, convert back: it is the streaming formula behind running statistics in ML.
- A few far-away points inflate the standard deviation a lot, because deviations are squared: two scores 14 points from the centre raised it from 5 to 6.05.
- The median cannot be updated from summaries, unlike the mean; this is one reason robust statistics are more expensive to maintain.
- "Strictly more than" with an integer answer means the next integer after the threshold. Write the inequality before rounding.
- When a statement is ambiguous, check whether the ambiguity matters (here: versus , threshold frozen or not). If all readings agree, you can answer with confidence.