For this Question: Given an array arr[] of N positive elements. The task is to find the Maximum AND Value generated by any pair of element from the array.

Note: AND is bitwise '&' operator.The first line of the input contains a single integer T, denoting the number of test cases. Then T test cases follow. Each test- case has two lines of the input, the first line contains an integer denoting the size of an array N and the second line of input contains N positive integers



Constraints:
1 <= T <= 50
1 <= N <= 10000
1 <= arr[i] <= 10000For each testcase, print Maximum AND Value of a pair in a separate line.Input:
2
4
4 8 12 16
4
4 8 16 2

Output:
8
0

Explanation:
Testcase 1: Pair (8, 12) has the Maximum AND Value i. e. 8.
Testcase 2: Maximum AND Value is 0., I have written this Solution Code: #include<bits/stdc++.h> 
using namespace std; 
  
// Utility function to check number of elements 
// having set msb as of pattern 
int checkBit(int pattern, int arr[], int n) 
{ 
    int count = 0; 
    for (int i = 0; i < n; i++) 
        if ((pattern & arr[i]) == pattern) 
            count++; 
    return count; 
} 
  
// Function for finding maximum and value pair 
int maxAND (int arr[], int n) 
{ 
    int res = 0, count; 
  
    // iterate over total of 30bits from msb to lsb 
    for (int bit = 31; bit >= 0; bit--) 
    { 
        // find the count of element having set  msb 
        count = checkBit(res | (1 << bit),arr,n); 
  
        // if count >= 2 set particular bit in result 
        if ( count >= 2 )         
            res |= (1 << bit);         
    } 
  
    return res; 
} 
  
#define qw1 freopen("input1.txt", "r", stdin); freopen("output1.txt", "w", stdout);
#define qw2 freopen("input2.txt", "r", stdin); freopen("output2.txt", "w", stdout);
#define qw3 freopen("input3.txt", "r", stdin); freopen("output3.txt", "w", stdout);
#define qw4 freopen("input4.txt", "r", stdin); freopen("output4.txt", "w", stdout);
#define qw5 freopen("input5.txt", "r", stdin); freopen("output5.txt", "w", stdout);
#define qw6 freopen("input6.txt", "r", stdin); freopen("output6.txt", "w", stdout);
#define qw freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
 
// Driver function 
int main() 
{ 
     #ifndef ONLINE_JUDGE
		
	#endif
    int t;
    cin>>t;
    while(t>0)
    {
    	t--;
    	int n;
    	cin>>n;
    	
    	int arr[n];
    	for(int i=0;i<n;i++)
    	{
    		cin>>arr[i];
    	}
    	cout<<maxAND(arr,n)<<endl;
    }
    return 0; 
}, In this Programming Language: C++, Now tell me if this Code is compilable or not?