Please help! Why did I get wrong answer in T>10 for the following code in XYPIZQ?

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

I guess the verdict is shown incorrectly as WA when it should be TLE as you have clearly exceeded the time limit of 1 sec for the question. Your program takes more than 2.6 sec which is clearly exceeds the time limit.
@vijju123 @admin ,please look into this.

It seems like something is wrong at the corner case:

4 
1000000000 1 1000000000 999999999 999999998 
1000000000 2 1000000000 999999999 999999998 
1000000000 3 1000000000 999999999 999999998 
1000000000 4 1000000000 999999999 999999998

should give the answer

1000000003 2000000001
1 666666667
1000000001 2000000001
1 666666667

But your code gives the following output:

800000007 1600000010
1 666666661
999999918 1999999835
1 666666661

I don’t know python but I guess there is some issue about 32-bit integers. Values of N may be small in the first subtask, so your code passes it, but gets wrong in the second one. The number of test cases, T, is most likely not a problem here.

//