Please help

problem: TLG Problem - CodeChef
my solution:

/* package codechef; // don’t place package name! */

import java.util.;
import java.lang.
;
import java.io.*;

/* Name of the class has to be “Main” only if the class is public. */
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
Scanner in = new Scanner(System.in);
int a = in.nextInt();
int b[] = new int[2];
int lead = 0;
int p=0;
for (int i=0; i<a;i++){
int a1 = in.nextInt();
int a2 = in.nextInt();
int a3 = a1-a2;
if(a3>=0){
b[0] = 1;
b[1] = a3;
if(lead =< b[1]){
lead = b[1];
p = 1;
}
}else{
b[0] = 2;
b[1] = -a3;
if(lead < b[1]){
lead = b[1];
p = 2;
}
}
}
System.out.println(p+" "+lead);
}
}

it shows wrong answer

You have to add the new value of A1 and A2 to the old ones that is you have to keep the cumulative sum and then use it to find the lead.

Please share direct link to your solution from next time it’s really hard to read it here
: /