Problem 4.6. Fourth-grader Vasya goes to the cafeteria every school day and buys either 9 marshmallows, or 2 meat pies, or 4 marshmallows and 1 meat pie. Sometimes Vasya is so busy socializing with classmates that he doesn't buy anything at all. Over 15 school days, Vasya bought 30 marshmallows and 9 meat pies. How many of those days did he not buy anything?
Answer: 7.

Solution. Let's consider all the options for how many times Vasya could have bought 9 marshmallows - it is clear that this could not have happened more than three times.

Suppose Vasya never bought 9 marshmallows. Then he bought 30 marshmallows in packs of 4 on some days, but 30 is not divisible by 4. Contradiction.

Suppose Vasya bought 9 marshmallows exactly once. Then the remaining $30-9=21$ marshmallows he bought in packs of 4 on some days, but 21 is not divisible by 4. Contradiction.

Suppose Vasya bought 9 marshmallows exactly twice. Then the remaining $30-9 \cdot 2=12$ marshmallows he bought in packs of 4 on some days. This means there were exactly 3 days when Vasya bought 4 marshmallows and 1 meat pie. Since the remaining $9-3=6$ meat pies he bought in packs of 2, this happened exactly three times. Then the number of days when Vasya did not buy anything was exactly $15-2-3-3=7$.

Suppose Vasya bought 9 marshmallows exactly three times. Then the remaining $30-9 \cdot 3=3$ marshmallows he bought in packs of 4 on some days, but 3 is not divisible by 4. Contradiction.