Help me in solving CS2023_PON problem

My issue

My code

#include <iostream>
using namespace std;

int main() {
	// your code goes here
	int t;
	cin>>t;
	while(t--){
	    int n,x;
	    cin>>n>>x;
	    int a[n];
	    int count=0;
	    int z=0;
	    for(int i=1;i<=n;i++){
	        cin>>a[i];
	    }
	    
	    for(int i=1;i<=n;i++){
	        for(int j=i;j<=n;j++){
	            z=(a[i]&a[j]);
	            if(z==x){
	                count=1;
	                break;
	            }
	           
	        }
	    }
	  if(count==1){
	        cout<<"YES"<<endl;
	    }
	    else if(count==0){
	        cout<<"NO"<<endl;
	    }
	   
	}
	return 0;
}

Problem Link: CS2023_PON Problem - CodeChef