Last subtask( Chef and Icecream: CHFICRM)

https://www.codechef.com/viewsolution/34873230
I am stuck with the last sub-task. Can anyone help me with it? Thank you.

For 15 coin, if you have a 10 coin change, give priority to that. If you don’t, then give two 5 coins.

Your accepted solution.

Explanation: Assume your state is a = [2, 1, 0].
Peeps: 15\;10.
If you give two 5 rupee coin as change, then you can’t give change to the next person.