Problem TLG : Why is this solution wrong according to judge ? It works fine on my system.

#include
using namespace std;

int mod(int a){
int k=0;
if(a>=0)
k=a;
else
k=-a;

return k;

}

int main(){
int t,i,n=0,news,p=0,win=2;
int p1[10001],p2[10001],lead[10001],modLead[10001];
cin>>t;
if(t<=10000){

for(i=0;i<t;i++){
	cin>>p1[i];
	cin>>p2[i];
	n=n+p1[i]-p2[i];
	lead[i]=n;
	modLead[i]=mod(lead[i]);
	
}

news= modLead[0];
for(i=1;i<t;i++){
	if(modLead[i]>news){
		news=modLead[i];
		p=i;
	}
}

if(modLead[p]>0)
win=1;
cout<<win<<" "<<modLead[p];

return 0;

}
}

You have to print maximum LEAD obtained by the WINNING PLAYER in ANY ROUND. I don’t think your program is doing so.