Can anyone help me in pointing out the mistake in the following code. https://ideone.com/sKgw82 . Link to problem: http://www.spoj.com/problems/MON2012/
The code works fine for a number of cases but fails for example on this:
10
2 242966381 327413017
1 67000825 246554533
1 4837100 129083468
1 4315186 45018152
1 44945551 434618545
2 8666104 46382746
2 139394355 665849988
1 511560864 664064083
2 -77248963 566857601
1 54142520 126738107