**Prerequisites**:- None

Problem:- You’re given N rounds of Billiard, with the ith containing Si and Ti, The score of Player1 and Player2.

After each round calculate the total score of both players and find the leader of the game and its current lead.

Find the player who achieved the maximum lead in one of the given rounds and the maximum lead achieved.

**Explanation** :-

After each round : -

Update the total point of player 1 and 2,( S = S+Si , T = T+Ti )

Find the winner of the round according to the points, the player with maximum points wins the round.

Check the lead gained by the winner. If the lead is greater than any of the previous round lead, store it as the maximum lead with the player name (1 or 2).

**Solution** : -

**c++**

```
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin>>n;
int player= 0,lead = 0;
int s = 0,t = 0;
for(int i = 0; i < n; i++){
int si,ti;
cin>>si>>ti;
s = s+si;
t = t+ti;
if(s>t && s-t>lead){
lead = s-t;
player = 1;
}
else if(t-s>lead)
{
lead = t-s;
player = 2;
}
}
cout<<player<<" "<<lead;
}
```