Why my code is giving RunTime Error(nzec) even though code looks ok

Why my below code for Gray-Similar code problem is giving error. Even though logic looks fine to me, can someone please help me what’s wrong here. Thanks

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

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

/* 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
{
Scanner sc=new Scanner(System.in);

	int n = sc.nextInt();
	long arr[] = new long[n];
	for(int i=0;i<n;i++)
		arr[i] = sc.nextLong();
		
	if(n>=130){
	    System.out.println("Yes");
	}
	else{
		boolean flag = calculateElseCondition(arr,n);
    	if(flag)
    		System.out.println("Yes");
    	else
    		System.out.println("No");
		}

    sc.close();
}

public static boolean calculateElseCondition(long arr[],int n){
		for(int i=0;i<n;i++){
			for(int j=i+1;j<n;j++){
				for(int k=j+1;k<n;k++){
					for(int l=k+1;l<n;l++){
						//System.out.println(arr[i]+" "+arr[j]+" "+arr[k]+" "+arr[l]+" ");
		               if((arr[i]^arr[j]^arr[k]^arr[l]) == 0L){
				         return true;
		               }
		          } 
		          
		        }
		}
		}
		return false;
}

}

Consider the test input:

4
18446744073709551615 1 1 1
1 Like