My issue
Index 3 out of bound for length 3
My code
/* 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 sc = new Scanner(System.in);
int t = sc.nextInt();
int n = sc.nextInt();
int a[]=new int[n];
int b[]=new int[n];
int count = 0;
for(int i=0;i<=t;i++){
for(int j =0;j<=n;j++){
for( j=0;j<n;j++){
a[j]=sc.nextInt();
}
for( j=0;j<n;j++){
b[j]=sc.nextInt();
}
if(a[j]<=(2*b[j])||b[j]<=(2*a[j])){
count++;
}
}
}
System.out.println(count);
}
}
Learning course: Arrays using Java
Problem Link: CodeChef: Practical coding for everyone