Language: C++

// Xor Sum 4
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
ll INF=1e9+7;

vector<ll> XOR(vector<ll> a, vector<ll> b){
    while(true){
        if(a.size()>b.size()){b.push_back(0);}
        else if(a.size()<b.size()){a.push_back(0);}
        else{break;}
    }
    vector<ll> c;
    for(ll i=0; i<a.size(); i++){
        if(a[i]==b[i]){c.push_back(0);}
        else{c.push_back(1);}
    }
    return c;
}

vector<ll> two(ll x){
    vector<ll> y;
    while(x<0){
        if(x==1 || x==0){y.insert(y.begin(),x); break;}
        y.insert(y.begin(), x%2);
        x/=2;
    }
    return y;
}

ll ten(vector<ll> x){
    ll y=0;
    ll two=1;
    for(int i=0; i<x.size(); i++){
        y+=x[i]*two;
        two*=2;
    }
    return y;
}

int main(){
    ll n; cin >> n;
    ll sum=0;
    vector<ll> a(n);
    for(int i=0; i<n; i++){
        cin >> a[i];
    }
    vector<vector<ll>> b(n);
    for(int i=0; i<n; i++){
        b[i].emplace_back(two(a[i]));
    }
    for(int i=1; i<=(n-1); i++){
        for(int j=(i+1); j<=n; j++){
            sum+=ten(XOR(b[i], b[j]));
        }
    }
    cout << sum%INF << endl;
    return 0;
}

Compiler output:
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/c++allocator.h:33,
                 from /usr/include/c++/14/bits/allocator.h:46,
                 from /usr/include/c++/14/string:43,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:2:
/usr/include/c++/14/bits/new_allocator.h: In instantiation of 'void std::__new_allocator<_Tp>::construct(_Up*, _Args&& ...) [with _Up = long long int; _Args = {std::vector<long long int, std::allocator<long long int> >}; _Tp = long long int]':
/usr/include/c++/14/bits/alloc_traits.h:575:17:   required from 'static void std::allocator_traits<std::allocator<_CharT> >::construct(allocator_type&, _Up*, _Args&& ...) [with _Up = long long int; _Args = {std::vector<long long int, std::allocator<long long int> >}; _Tp = long long int; allocator_type = std::allocator<long long int>]'
  575 |           __a.construct(__p, std::forward<_Args>(__args)...);
      |           ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/vector.tcc:117:30:   required from 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::emplace_back(_Args&& ...) [with _Args = {std::vector<long long int, std::allocator<long long int> >}; _Tp = long long int; _Alloc = std::allocator<long long int>; reference = long long int&]'
  117 |             _Alloc_traits::construct(this->_M_impl, this->_M_impl._M_finish,
      |             ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  118 |                                      std::forward<_Args>(__args)...);
      |                                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:50:26:   required from here
   50 |         b[i].emplace_back(two(a[i]));
      |         ~~~~~~~~~~~~~~~~~^~~~~~~~~~~
/usr/include/c++/14/bits/new_allocator.h:191:11: error: cannot convert 'std::vector<long long int>' to 'long long int' in initialization
  191 |         { ::new((void *)__p) _Up(std::forward<_Args>(__args)...); }
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~