4. Dad is preparing gifts. He distributed 115 candies into bags, with each bag containing a different number of candies. In the three smallest gifts, there are 20 candies, and in the three largest gifts, there are 50 candies. How many bags are the candies distributed into? How many candies are in the smallest gift?
Answer: 10 packages, 5 candies.

Solution. Let's number the gifts from the smallest to the largest, from 1 to $n$. If the third gift has 7 or fewer candies, then the three smallest gifts have no more than $7+6+5=18$ candies. This contradicts the condition. Therefore, the third gift has at least 8 candies. Similarly, the third from the last gift has no more than 15 candies $(16+17+18=51>50)$.

Remove the three largest and the three smallest gifts. In the remaining gifts, there will be $115-20-$ $50=45$ candies, and each has between 9 and 14 candies. Three packages are clearly not enough $(14+13+12=39)$, and five would be too many $(9+10+11+12+13=55)$. Therefore, 45 candies are distributed in 4 packages. This is possible: $47=9+11+12+13$. Note that the fourth package cannot have more than 9 candies: $10+11+12+13=46>45$.

If the fourth package has 9 candies, then the third has no more than 8, the second no more than 7, so the first package has no less than $20-8-7=5$ candies. But no more than that, since $6+7+8=21$.

Criteria. Only the answer - 0 points. Only correct estimates for the third from the beginning and the third from the end package - 3 points. Only a justified answer for the number of packages - 5 points. Full solution - 7 points.