Need Help in CHCBOX

Problem-https://www.codechef.com/COOK116B/problems/CHCBOX
Solution-https://www.codechef.com/viewsolution/30670670

I am not able to figure why i am getting WA in this?

Please someone help whats the problem or you can give test cases too!
Thanks!!

I made custom test cases too which are giving the right output but i don’t know why I am getting WA!