WA in COMPILER

Guys please help me out here, I’ve tested a lot of test cases and getting the correct output but it’s still giving me WA when I submit it.
https://www.codechef.com/viewsolution/36226635