About editorial Magical Girl and Colored Liquid Potions

so I was solving Qs from div 2(3*) based on rating , and I found quite old problems like from 2012s, 2014s, and most of the questions didn’t have an editorial .
one of the question was this –
Magical Girl and Colored Liquid Potions | CodeChef

so I solved the question – Solution: 74646570 | CodeChef

but it gave wrong answer… and I didn’t know why… and when I searched on the discussing form it said it gave wrong answer? I still don’t know whether my answer is correct or not ?
I have seen the submission and its a bit different from them.
can some one check my solution…