ENTEXAM - Editorial

import java.util.ArrayList;

import java.util.Scanner;

public class code {

public static void main(String args[])
{
	Scanner scan = new Scanner(System.in);
	Integer testCase = scan.nextInt();
	ArrayList<Integer> result = new ArrayList<>();
	if(testCase>=1 && testCase<=5)
	{
		for (int i = 0; i < testCase; i++) 
		{
			scan.nextLine();
			String str = scan.nextLine();
			String[] string = str.split(" ");
			Integer N = Integer.parseInt(string[0]);
			Integer K = Integer.parseInt(string[1]);
			Integer E = Integer.parseInt(string[2]);
			Integer M = Integer.parseInt(string[3]);
			if(K>=1 && K<N)
			{
				if(N>1 && N<10000)
				{
					if(M>1 && M<1000000000)
					{
						if(E>=1 && E<=4)
						{
							ArrayList<Integer> studentMarks = new ArrayList<>();
							for (int j = 0; j < N; j++) 
							{
								Integer sum=0;
								String str1 = scan.nextLine();
								String[] string1 = str1.split(" ");
								for (int l = 0; l < string1.length; l++) 
								{
									sum = sum+Integer.parseInt(string1[l]);
								}
								studentMarks.add(sum);
							}
							Integer his_marks = studentMarks.get(studentMarks.size()-1);
							studentMarks.remove(studentMarks.size()-1);
							for (int j = 1; j < studentMarks.size(); j++) 
							{
								Integer key = studentMarks.get(j);
								Integer k= j-1;
								while(k>=0 && studentMarks.get(k)>key)
								{
									studentMarks.set(k+1, studentMarks.get(k));
									k=k-1;
								}
								studentMarks.set(k+1,key);
							}
							Integer minimum_marks =studentMarks.get((studentMarks.size()-(N-K)));
							Integer required = (minimum_marks-his_marks)+1;
							result.add(required);
						}
					}
				}
			}
		}
	}
	for (Integer integer : result) {
		System.out.println(integer);
	}
}

}

What’s wrng with this one? Getting NZEC error!

https://www.codechef.com/viewsolution/15958617

Have a look at my solution and the comment on 20th line. Had to debug a lot to find that code chef compiler puts the value of 0 instead of increment by 1(number of people with that specific marks all total) in spite of using β€˜++’. But I get the right answer when using β€˜+1’ ironically.
Is there something wrong with in code chef compiler as ++ worked fine in visual c++ 2017

Got it finally

https://www.codechef.com/viewsolution/19164301
I have checked all cases where we get 0 as answer but it still shows wrong answer.Could someone find the error>