Help Needed

Can anyone help me in the problem

, my code is giving correct answer of test cases which I got from editorial but still it is giving WA. Please help me if you can
https://www.codechef.com/viewsolution/39849909