TLG getting WA

Can somebody please tell me why my code is not working ?

#include <stdio.h>
int max(int a[], int);
int main(void) {
int rounds,lead1=0,sum1=0;
scanf("%d",&rounds);
int si[rounds],ti[rounds],lead[rounds],sum[rounds];
for(int i=0; i < rounds; i++)
scanf("%d%d",&si[i],&ti[i]);
for(int i = 0; i < rounds; i++)
{

            sum[i] = si[i] - ti[i];
            lead1 = lead1 + sum[i];
            lead[i] = lead1;
}
for(int i = 0; i < rounds; i++)
    sum1 = sum1 + sum[i];
    if(sum1 > 0)
        printf("1 %d\n",max(lead,rounds));
    if(sum < 0)
        printf("2 %d\n",max(lead,rounds));
return 0;

}
int max(int a[], int n)
{
int max=0;
for(int i = 0; i < n; i++)
{
if(a[i] > max)
max = a[i];
}
return max;
}