Help me in solving CFRTEST problem

My issue

xception in thread “main” java.util.NoSuchElementException
at java.base/java.util.Scanner.throwFor(Scanner.java:937)
at java.base/java.util.Scanner.next(Scanner.java:1594)
at java.base/java.util.Scanner.nextInt(Scanner.java:2258)
at java.base/java.util.Scanner.nextInt(Scanner.java:2212)
at Codechef.main(Main.java:17)

My code

/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;
import java.util.Scanner;

/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		Scanner sc= new Scanner(System.in);
		int T=sc.nextInt();
		for(int t=0;t<T;T++){
		    int frndNo=sc.nextInt();
		     Set<Integer> frndreq= new TreeSet<>();
		     for(int j=0;j<frndNo;j++){
		         frndreq.add(sc.nextInt());
		     }
		     int savefrnd=0;
		     int lastday=0;
		     for(int req:frndreq){
		         if(req>lastday){
		             savefrnd++;
		             lastday=req;
		         }
		     }
		     System.out.println(savefrnd);
		    }
		    
		   sc.close(); 
	}
}

Learning course: Arrays, Strings & Sorting
Problem Link: Devu and friendship testing Practice Problem in - CodeChef

@mahasinkhan132
plzz refer the following java code for debugging

/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;
import java.util.Scanner;

/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		Scanner s=new Scanner(System.in);
		int t=s.nextInt();
		while(t-->0){
		    int n=s.nextInt();
		    int[] arr=new int[n];
		    for(int i=0;i<n;i++){
		        arr[i]=s.nextInt();
		    }
		    HashSet<Integer> hs=new HashSet<>();
		    for(int i=0;i<n;i++){
		        hs.add(arr[i]);
		    }
		   System.out.println(hs.size());
		}
		}
}