NZEC error in Bon Appetit problem in practce problems

import java.io.;
import java.util.
;

class test
{
public static void main(String args[]) throws IOException
{
InputStreamReader inp = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(inp);

	int t = Integer.parseInt(br.readLine());
	for(int i=0;i<t;i++)
	{
		String g = br.readLine();
		String s[] = g.split(" ");
		int cust = Integer.parseInt(s[0]);
		int comp = Integer.parseInt(s[1]);
		
		

		List<TreeMap<Integer,Integer>> tm = new ArrayList<TreeMap<Integer,Integer>>(comp+1);
		
		for(int h=0;h<comp+1;h++)
		{
			tm.add(new TreeMap<Integer,Integer>());
		}
		for(int j=0;j<cust;j++)
		{
			String s1[] = br.readLine().split(" ");
			int start = Integer.parseInt(s1[0]);
			int finish = Integer.parseInt(s1[1]);
			int compno = Integer.parseInt(s1[2]);

			tm.get(compno).put(finish,start);
				
			
		}
		int count=0;
		for(int q=0;q<=comp;q++)
		{
		  if(q>=1){
			int c = 1;
			int ff = 0;
			int ss = 0;
			
			for(int key:tm.get(q).keySet())
			{
				if(c==1)
				{
					ff = key;
					c++;
					count++;
					continue;
				}
				else
				{
					ss = tm.get(q).get(key);
					if(ss>=ff)
					{
						count++;
						ff = key;	
					}	
				}
			}
		  }	
		}
		System.out.println(count);
	}

}

}

I don’t know why this code gives NZEC error. For java it comes because of an exception.But on my machine it runs without any error. Please help me with this…