by what name should i save my java file

Sir, I’m using Java to solve the problems, tell me two things.

  1. In what way I have to take inputs
  2. What name i have to give to my main class

Please, reply asap. Time is running.


Use bufferedInput for input and name main class as Main

See some example from old contests, for example one of my solutions is here

For Java based answers, I recommend the following:

i) Use public access specifier for the class containing main

ii) The class containing main, must be named as Main

iii) For input and output, use BufferedInputStream and BufferedOutputStream.

iv)If you wish to test your program the way Codechef tests it, then in your folder, create a file named input.txt (with all test cases, that is the input given in the program). Then run the commannd java Main < input.txt > output.txt. You will be able to see your output in output.txt file