Help me in solving TLG problem

My issue

The code seems good but it is giving one wrong answer. I can’t find what is it. Can anybody help me to solve this issue?

#include<stdio.h>
int main()
{
int n,a,b,i,pos;
scanf(“%d”,&n);
int lead[n],p[n];
for(i=0;i<n;i++)
{
scanf(“%d%d”,&a,&b);
if(a>b)
p[i]=1;
else
p[i]=2;
if(a==b)
lead[i]=0;
else
lead[i] = a > b ? a-b : b-a;
}
pos=0;
for(i=1;i<n;i++)
{
if(lead[i] > lead[i-1])
pos = i;
}
printf(“%d %d\n”,p[pos],lead[pos]);

}

My code

#include<stdio.h>
int main()
{
    int n,a,b,i,pos;
    scanf("%d",&n);
    int lead[n],p[n];
    for(i=0;i<n;i++)
    {
        scanf("%d%d",&a,&b);
        if(a>b) 
            p[i]=1;
        else 
            p[i]=2;
        if(a==b)
            lead[i]=0;
        else
            lead[i] = a > b ? a-b : b-a;
    }
    pos=0;
    for(i=1;i<n;i++)
    {
        if(lead[i] > lead[i-1])
            pos = i;
    }
    printf("%d %d\n",p[pos],lead[pos]);
    
}

Problem Link: TLG Problem - CodeChef

@murali_barla
U have to keep summing up the previous round score to the next round and them compare them .
plzz refer the following code

#include <stdio.h>
int main(void) {
	int n,i;
    scanf("%d",&n);
    int a[n],b[n],lead[n],win[n];
    for(i=0;i<n;i++)
    {
        scanf("%d%d",&a[i],&b[i]);
    }
    int sum1=0,sum2=0;
    for(i=0;i<n;i++)
    {
        sum1+=a[i];
        sum2+=b[i];
        if(sum1>sum2)
        {
            lead[i]=sum1-sum2;
            win[i]=1;
        }
        else{
            lead[i]=sum2-sum1;
            win[i]=2;
        }
 }
  int w=0,l=0;
 for(i=0;i<n;i++){
  if(l<=lead[i])
  {
   l=lead[i];
   w=win[i];
  }
 }
 printf("%d %d",w,l);
	return 0;
}