# The strange forest

In the forest of change there are strange creatures:

17 puzzs, 55 lings and 6 stacs.

If one species meets the other, then they become the third.
For example: If a puzz meets a stac, then they merge into a ling.

This causes that at some point only one of the three species is left.

Can you find the maximum number of this kind ?

Hint :

It's helpful if you determined the last kind.

First observation:

The parity of the sum of two given stacks is invariant throughout the whole process. Therefore, two stacks whose sum is an odd number cannot be boiled down to $$(0,0)$$. It follows that in the end, only stacs can remain alone in the forest.

Now

$$17, 55, 6\to 0, 38, 23\to 19,19,4\to 0,0,23$$

is optimal because

the difference between $$17$$ and $$55$$ implies that at some point, some stacs need to be sacrificed to level the number of puzzs and lings. Burning stacs with lings is the only way to do so and it needs to be done $$\frac{38}{2}=19$$ times.

Note (to explain why there can be no "what if we did this or that first" trick): the order in which you perform the operations doesn't matter. In the end, there is a number of operations of the kind $$(+1,-1,-1)$$, $$(-1,+1,-1)$$, $$(-1,-1,+1)$$, and the only relevant data is how many of each you have.