WA in CHEFMOVR

I am not able to solve my error in CHEFMOVR problem of August long challenge. Can someone please help me in solving it.


(https://ideone.com/ZniCVW)

Thanks in advance .

Unable to find a TC where your code fails. But i think there can be bugs due to how you are dealing with them. You can refer to my solution and see if you can find out the difference-

https://www.codechef.com/viewsolution/14775292

EDIT: Your code is failing for large values :confused:

Input
1
4 1
1 1 1 99999997
Your Output
124999997
Correct Output
149999994
1 Like