In the tin, there were red and green candies. Čeněk ate $\frac{2}{5}$ of all the red candies and Zuzka ate $\frac{3}{5}$ of all the green candies. Now, the red candies make up $\frac{3}{8}$ of all the candies in the tin.

How many candies were there in the tin at least originally?

(L. Růžičková)

Hint. How many candies of each color could, or could not, have been originally in the tin?
Both Čeněk and Zuzka ate several fifths of the candies of the respective color. Therefore, the original number of both red and green candies must be divisible by five. We will consider the smallest number divisible by five as the original number of red candies and try to express the number of green candies:

- If there were originally 5 red candies, 3 would remain after eating. These 3 candies would constitute $\frac{3}{8}$ of all remaining candies, meaning there would be 8 remaining candies in total, and 5 of them would be green. These 5 candies would have to constitute the remaining $\frac{2}{5}$ of all green candies, which is not possible.
- If there were originally 10 red candies, 6 would remain after eating. These 6 candies would constitute $\frac{3}{8}$ of all remaining candies, meaning there would be 16 remaining candies in total, and 10 of them would be green. These 10 candies would have to constitute the remaining $\frac{2}{5}$ of all green candies, so the total number of green candies originally would be 25.

The smallest number of candies that could have been in the tin originally is $10+25=35$.

Another hint. What fraction of the remaining candies were green candies?

Another solution. The red candies constituted $\frac{3}{8}$ of all remaining candies after eating, so the green candies constituted $\frac{5}{8}$ of all remaining candies, meaning the number of remaining green candies must be divisible by five.

Zuzka ate $\frac{3}{5}$ of the green candies, leaving $\frac{2}{5}$ of the original number of green candies, so the number of remaining green candies must also be divisible by two. In total, the number of remaining green candies must be divisible by ten.

The smallest possible number of remaining green candies is 10. In this case, the original number of green candies would be 25, the number of remaining red candies would be 6, and the original number of red candies would be 10.

The smallest number of candies that could have been in the tin originally is $10+25=35$.

Note. The previous considerations can be graphically illustrated as follows:

![](https://cdn.mathpix.com/cropped/2024_04_17_46b1947d893b2b50fba1g-6.jpg?height=257&width=1291&top_left_y=2027&top_left_x=385)

Using the unknowns $c$, and $z$, which represent the original numbers of red and green candies, respectively, the problem can be formulated as follows:

$$
\frac{3}{5} c=\frac{3}{8}\left(\frac{3}{5} c+\frac{2}{5} z\right)
$$

where $c$ and $z$ are numbers divisible by five and $\frac{3}{5} c+\frac{2}{5} z$ is divisible by eight. The previous expression can be simplified to

$$
8 c=3 c+2 z, \quad \text { or } \quad 5 c=2 z .
$$

The smallest $c$ and $z$ that satisfy all the given conditions are $c=2 \cdot 5=10$ and $z=5 \cdot 5=25$.