#include
using namespace std;
int main()
{
int n;
cin>>n;
int s[n],t[n],res[n];
int counter;
for(int i=0;i<n;i++)
{
cin>>s[i];
cin>>t[i];
}
for(int i=0;i<n;i++)
{
if(s[i]>t[i])
res[i]=s[i]-t[i];
else
res[i]=t[i]-s[i];

``````}
int max=res[0];
for(int i=0;i<n;i++)
{
if(res[i]>max)
{
max=res[i];
counter=i;
}
}
if(s[counter]>t[counter])
cout<<"1"<<"\t"<<max;
else
cout<<"2"<<"\t"<<max;
``````

return 0;
}

``````>     for(ll i=0;i<n;i++){
>  		cin>>p1>>p2;
>  		sum1+=p1;
>  		sum2+=p2;
>  		if(sum1>sum2){
>  			win[i]=1;
>  			arr[i]=sum1-sum2; }
>  		else{
>  			win[i]=2;
>  			arr[i]=sum2-sum1; }
>  	}
``````

First read all the score of both one by one and calculate cumulative sum.
find difference at every stage and store winner value ‘1’ or ‘2’ in seperate array and also absolute difference at the stage .

``````ll lar=arr[0],larpos=1;
for(ll i=1;i<n;i++){
//cout<<win[i];
if(lar<arr[i])
{
lar=arr[i];
larpos=win[i];
}
}

cout<<larpos<<" "<<lar<<"\n";
``````

Now assume first score as maximum score and find maximum difference ,
here you will have winner in corresponding index in another array ‘win’ array .
just print them.