Feedback for RECNDNOS problem

Problem Link: RECNDNOS Problem - CodeChef

Feedback

i am not able to find failed test cases can somebody help me

@ritika991052
whats your logic or code??

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 i=0;i<t;i++){
int n=sc.nextInt();
int a[]=new int[n];
HashSet hs=new HashSet<>();
for(int j=0;j<n;j++)
{
a[j]=sc.nextInt();

	    }
	   
	    for(int k=0;k<n;k++)
	    {
	       hs.add(a[k]);
	        
	        
	    }
	    
	 HashMap<Integer,Integer>hm=new HashMap<>();
	    
	    int max=Integer.MIN_VALUE;

	    for(int p:hs){
	        
	        int c=0 ,temp=0,s=0;
	        while(s<n ){
	            if(p==a[s]){
	              while(s<n && p==a[s]  ){
	                  temp++;
	                  s++;
	              }
	              if(temp%2==0){
	                  int cale=(temp/2);
	                  c=c+cale;
	                  temp=0;
	              }
	              else{
	                 int calo= (temp/2)+ (temp%2) ;
	                 c=c+calo;
	                 temp=0;
	              }
	              
	              
	            }
	            else{
	              
	                s++;
	                //System.out.print (s);
	            }
	        }
	   
	            
	                if(!hm.containsKey(p)){
	                    hm.put(p,c);
	                }
	           
	        }
	        
	      
	      int ans= 0 ;
	       for (Map.Entry<Integer,Integer> mapElement : hm.entrySet()) {
	           int value=mapElement.getValue();
	           if(value>max){
	               max=value;
	                ans=mapElement.getKey();
	                
	                
	           }
	       }
	        System.out.println(ans);
	       
	       
	       
	       
	        }

@ritika991052
I have not good hands on java .
if u want i can send u c++ code.