Runtime error in rise and fall of power

Can Someone please tell me what is wrong with my code( for the question (

You cannot use package other than default on CodeChef. And also you are incorrectly reading input, see .

  • For console apps, use a single Scanner to read from
    Java input classes such as Scanner and BufferedInputStream facilitate fast, nonblocking I/O by buffering an underlying input stream. Programs can create multiple wrappers on an InputStream. Programs that use multiple wrappers around a single input stream, however, can behave unpredictably depending on whether the wrappers allow look-ahead. An attacker can exploit this difference in behavior by, for example, redirecting (from a file) or by using the System.setIn() method to redirect In general, any input stream that supports nonblocking buffered I/O is susceptible to this form of misuse.

An input stream must not have more than one buffered wrapper. Instead, create and use only one wrapper per input stream, either by passing it as an argument to the methods that need it or by declaring it as a class variable.


I have tried a number of ways to input numbers to a Java program in CodeChef. None of them are working. Can you please explain me the correct way, so that CodeChef accepts my program?