# the lead game:why is answer wrong?

//the lead game (easy) why answer not coming
#include<stdio.h>
int main()
{
long int cases,lead[10000],lead1[10000],a[10000],b[10000];
long int i,max=0,max1=0,w=0;
scanf("%ld",&cases);
for(i=0;i<cases;i++)
{
scanf("%ld",&a[i]);
scanf("%ld",&b[i]);
if(a[i]>b[i])
{
lead[i]=a[i]-b[i];
if(lead[i]>max)
{
max=lead[i];
}
}
else if(a[i]<b[i])
{
lead1[i]=b[i]-a[i];
if(lead1[i]>max1)
{
max1=lead1[i];
}
}
w=w+a[i]-b[i];
}
if(w<0)
{
printf(“1”);
}
if(w<0)
{
printf(“2”);
}
if(max>max1)
{
printf(" %ld",max);
}
if(max<max1)
{
printf(" %ld",max1);
}
return 0;
}

Brother observe this part of question carefully, Read it thoroughly ,

If you are still unable to figure out your mistake, then go through my submissions, i was committing same mistake,

Believe me you’ll enjoy debugging your code…

But i will recommend that observe the given pic carefully b4 reading my solutions, observe the explanation.

I think you have misunderstood the question, you have to find the total lead

``````2
2 1
2 40
``````

The answer should be 2 37