I recently solved the problen Chef and notebooks (CNOTE) from the march challenge.
I used java language.
I scored only 40 points after submitting.
The rest 60 points were for satisfying the following subtask
“Sum of N over all test cases in one test file does not exceed 10^6.”
For which I wrote the code as follows-

if(sum>Math.pow(10, 6))
System.exit(0);

Sum is a variable in which all the values of N are added in each test case.
Still it doesn’t accept it