Help me in solving SPC2025Q5 problem

My issue

im doing pairwise xor and producting with every value and at last see if it is in interval

My code

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

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(); // Number of test cases
        
        while (T-- > 0) {
            int N = sc.nextInt(); // Array size
            int L = sc.nextInt(); // Lower bound
            int R = sc.nextInt(); // Upper bound
            
            int[] A = new int[N];
            for (int i = 0; i < N; i++) {
                A[i] = sc.nextInt();
            }
            long product = 1;
            loop1:
            for(int i = 0 ; i < N ; i++){
                for(int j = i+1 ; j < N ; j++){
                    product *= A[i]^A[j];
                    if(product > R){
                        break loop1;
                    }
                }
            }
            if(product < L || product > R){
                System.out.println("NO");
            }else{
                System.out.println("YES");
            }
        }
	}
}

Problem Link: Halloween Array Practice Coding Problem

your code will not work when product may becomes 0 but because now it is greater than r you break the loop
test case
20 0 5
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 1