The Lead Game giving wrong answer??

The code works fine for simple test case but giving wrong answer on evaluation.

My code is at the following link - [link text][1]

Please tell me what is wrong in the code
[1]: https://ideone.com/VAZF91

Try with:

3

20 100

20 100

1000 0

The result should be player 1 with (1000+20+20)-(100+100)=840 lead points.

Your program gives player 1 with 1000 lead points.

Yes , according to the question it should give 1 1000 as output if i am not mistaken . The question link is - https://www.codechef.com/problems/TLG.
Please see to it.

Oh yes you are right , i misunderstood the question

Computaholics