Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair <int, int> P;
#define rep( i, n, m ) for(int i = ( n ); i < ( m ); i++)
#define rep_d( i, n, m ) for(int i = ( n ) - 1; i >= ( m ); i--)
#define sort_asc( X ) sort(( X ).begin(), ( X ).end())
#define sort_desc( X ) sort(( X ).begin(), ( X ).end(), greater <>())

template <class T> bool chmax( T& a, T b );
template <class T> bool chmin( T& a, T b );
int* eratosthenes( int N );
bool bit_search( int pattern, int N );
template <class T> void cumulative_sum( T array, size_t N );

const ll INF = 1LL << 60;
const int k_mod = 1e9 + 7;

int main( void )
	int N;
	cin >> N;
	vector <int> vec( 65, 0 );
	int maximum = 0;
	rep( i, 0, N ){
		ll input; cin >> input;
		ll hoge = 1;
		rep(cnt, 0, 61){
			vec[ cnt ] += (bool)( input & hoge );
			hoge <<= 1;
		}
	}
	ll ans = 0;
	rep( i, 0, 61 ){
		ans += vec[i] * ( N - vec[i] ) % k_mod * (( ll )1 << i ) % k_mod;
		ans %= k_mod;
	}
	cout << ans << endl;
}

int* eratosthenes( int N ){
	int* prime_array = new int[ N + 1 ];
	int lim = N;
	prime_array[ 0 ] = 0;
	prime_array[ 1 ] = 0;
	rep( i, 2, N + 1 ){
		prime_array[ i ] = 1;
	}
	rep( i, 2, lim ){
		if (prime_array[ i ] == 0)
			continue;
		lim = N / i;
		for(int j = i * 2; j < N + 1; j += i){
			prime_array[ j ] = 0;
		}
	}
	return prime_array;
}
template <class T> void cumulative_sum( T array, size_t N ) {
	rep( i, 1, N + 1 ){
		array[ i ] += array[ i - 1 ];
	}
}
template <class T> bool chmax( T& a, T b ) {
	if (a < b){
		a = b; return true;
	}
	return false;
}
template <class T> bool chmin( T& a, T b ) {
	if (a > b){
		a = b; return true;
	}
	return false;
}
bool bit_search( int pattern, int N ){
	int cnt = 0;
	rep( bit, 0, N ){
		if (pattern & ( 1 << bit )){
			cnt++;
		}
	}
	return true;
}


Compiler output:
a.cc:20:9: error: expected initializer before 'int'
   20 |         int N;
      |         ^~~
a.cc:21:9: error: 'cin' does not name a type
   21 |         cin >> N;
      |         ^~~
a.cc:5:24: error: expected unqualified-id before 'for'
    5 | #define rep( i, n, m ) for(int i = ( n ); i < ( m ); i++)
      |                        ^~~
a.cc:24:9: note: in expansion of macro 'rep'
   24 |         rep( i, 0, N ){
      |         ^~~
a.cc:24:14: error: 'i' does not name a type
   24 |         rep( i, 0, N ){
      |              ^
a.cc:5:43: note: in definition of macro 'rep'
    5 | #define rep( i, n, m ) for(int i = ( n ); i < ( m ); i++)
      |                                           ^
a.cc:24:14: error: 'i' does not name a type
   24 |         rep( i, 0, N ){
      |              ^
a.cc:5:54: note: in definition of macro 'rep'
    5 | #define rep( i, n, m ) for(int i = ( n ); i < ( m ); i++)
      |                                                      ^
a.cc:5:24: error: expected unqualified-id before 'for'
    5 | #define rep( i, n, m ) for(int i = ( n ); i < ( m ); i++)
      |                        ^~~
a.cc:33:9: note: in expansion of macro 'rep'
   33 |         rep( i, 0, 61 ){
      |         ^~~
a.cc:33:14: error: 'i' does not name a type
   33 |         rep( i, 0, 61 ){
      |              ^
a.cc:5:43: note: in definition of macro 'rep'
    5 | #define rep( i, n, m ) for(int i = ( n ); i < ( m ); i++)
      |                                           ^
a.cc:33:14: error: 'i' does not name a type
   33 |         rep( i, 0, 61 ){
      |              ^
a.cc:5:54: note: in definition of macro 'rep'
    5 | #define rep( i, n, m ) for(int i = ( n ); i < ( m ); i++)
      |                                                      ^
a.cc:37:9: error: 'cout' does not name a type
   37 |         cout << ans << endl;
      |         ^~~~
a.cc:38:1: error: expected declaration before '}' token
   38 | }
      | ^