Help me in solving XSQR problem

My issue

My code is exceeding time limit and I dont know how to reduce time complexity

My code

#include <bits/stdc++.h>
using namespace std;

int main() {
	int t;
	cin >> t;
	while(t--) {
	    int n, x; 
	    long long count = 0;
	    cin >> n;
	    long long a[n];
	    unordered_map<long long, long long> m;
	    for(int i = 0 ; i < n ; ++i) {
	        cin >> a[i];
	        for(int j = i-1 ; j >= 0; --j) {
	            m[a[i] ^ a[j]]++;
	        }
	    }
	    
	    for(auto it : m) {
	        count += ((it.second)*(it.second-1))/2;
	    }
	    
	    cout << 8*count << endl;
 	}
}





Problem Link: Xometry (Easy Version) Practice Coding Problem

It’s strange because this exact code is accepted for some users
https://www.codechef.com/viewsolution/1093151736