CHN04 solving

This is the link to the problem - CHN04 Problem - CodeChef - and my solution to this - CodeChef: Practical coding for everyone
-Can’t get what is the problem but I keep getting WA
-Can someone help?