HELP WITH JAVA

question : CodeChef: Practical coding for everyone

solution in java : CodeChef: Practical coding for everyone

solution in cpp : CodeChef: Practical coding for everyone

whats the problem in my java code please?

Check the following update to your code.

Accepted

1 Like

Can you tell me why my code was giving error
And also i just noticed single change that is cin.next().getByte()
Is it the only difference and if so then whats the problem in using nextLine()
Please tell me
Thank you

The only real difference between the accepted code and the buggy code is using the standard Scanner class available in java.util.* package.

It seems that the buffered Reader class declared in your code fails to read the program data correctly for some test cases, even though N \le 100 for all test cases.