Wrong Answer verdict on TIDRICE problem

My solution for the problem TIDRICE seems to be correct. But on running on codechef judge, it says “Wrong Answer”. I am not able to figure out the problem with my code, it seems to be working quite well, but it does not. Can anybody explain why ? Can somebody give examples of some test cases for which my code gives wrong answer ?

You can find the problem here - TIDRICE

My Solution Here

//