Fake Binary stuff (FAKEBIN) Unexpected TLE

This was the least complex code I could create in Java.
Please tell where can the complexity be reduced?
Thanks in advance!

Code :
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();
	for( int j=0; j<a ; j++){
	int b = in.nextInt();
	int sum =0;
	for (int i =0; i<b ; i++)
	{int h = in.nextInt();
	sum += h ;
	    
	}
	System.out.println(sum);
	}
}

}

Here’s the link for my solution: CodeChef: Practical coding for everyone
Here’s the link for the problem: CodeChef: Practical coding for everyone

Scanner class is very slow for competitive coding in java.

Refer below link for alternate input methods.

1 Like