why i get wrong answere problem chefadv

i applied all test cases in my code but it is giving wrong answere
here is my code
https://www.codechef.com/viewsolution/20085192

This is an ongoing competition. The rules forbid sharing your code - and luckily for you the system also blocks it. General advice is to read the specification carefully and make up new test cases for yourself.