I keep getting this run time exception on codechef compiler, don't know what i am doing wrong. I know the problem is in Scanner class but couldn't figure out what is it ? (Don't want to use Buffered Reader)
import java.util.*;
import java.lang.*;
import java.io.*;
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner in = new Scanner(System.in);
int t = in.nextInt();
for (int t_i=0;t_i<t;t_i++ )
{
long n = in.nextLong();
long x = in.nextLong();
long rem=n%x;
System.out.println(rem);
}
}
}
Input: 1 10 3
Gives run time exception.