criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include "bits/stdc++.h"
#include <unorderd_map>
using namespace std;
typedef long long ll;
#define int ll
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a) (a).begin(),(a).end()
#define pb emplace_back


unorderd_map<int,int> f(vector<pii> data, int l, int r){
    assert(r-l<=20);
    int len = r-l;
    unorderd_map<int,int> ret;
    for(int bit = 0; bit < (1<<len); bit++){
        int sum_cost = 0;
        int sum_value = 0;
        rep(i,len){
            if(bit&(1<<i)){
                sum_cost += data[l+i].first;
                sum_value+= data[l+i].second;
            }
        }
        if(sum_cost==0)continue;
        ret[sum_cost] = sum_value;
    }
    
    int maxi = -1;
    for(auto elm:ret){
        elm.second = max(maxi,elm.second);
        maxi = max(maxi,elm.second);
    }
    
    return ret;
}
signed main(){
    int n,k;
    cin>>n>>k;
    vector<int> v(n);
    rep(i,n)cin>>v[i];
    
    vector<pii> data;
    for(int i=0;(1<<i)<=k;i++){
        int one_count = 0;
        rep(j,n){
            if(v[j]&(1<<i)){
                one_count++;
            }
        }
        if(one_count<(n+1)/2){
            int p = n-one_count;
            data.pb( pii(1<<i, (p-one_count)*(1<<i)) );
        }
    }
    
    mapunorderd_<int,int> mp1 = f(data, 0, data.size()/2);
    mapunorderd_<int,int> mp2 = f(data, data.size()/2, data.size());
    
    int ans = 0;
    for(auto elm:mp1){
        int less = k-elm.first;
        if(less<0)continue;
        int val = prev(mp2.upper_bound(less))->second;
        ans = max(ans,val+elm.second);
    }
    rep(i,n)ans+=v[i];
    cout<<ans<<endl;
}


Compiler output:
a.cc:2:10: fatal error: unorderd_map: No such file or directory
    2 | #include <unorderd_map>
      |          ^~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
#include <vector>
#include<list>
#include <algorithm>
#include <string>
#include <math.h>
#include<map>
#include <utility>
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)
#include <bitset>

#define INF (1e9)
typedef long long unsigned int ll;


int main()
{
    ll N,K;
	cin >> N >> K;
	ll A[N];

	int x = (int)log2(K)+1;

	bitset<12> bs[N];
	ll l;
	REP(i, N)
	{
		cin >> A[i];
		bs[i] = bitset<12>(A[i]);

	}
	int k=0;
	REP(i, x)
	{
		int ze = 0;
		int on = 0;
		REP(j, N)
		{
			if(bs[j][i]==1){
				on += 1;
			}else{
				ze += 1;
			}
		
		}
		
		if (on < ze)
		{
			k += pow(2, i);
		}
	}

	ll sum = 0;
	ll m = 0;
	if(K==0){
		cout << A[0] << endl;
	}else{
		REP(i, N)
		{
			sum += k ^ A[i];
		}
		cout << sum << endl;
	}
	return 0;
}#include <iostream>
#include <vector>
#include<list>
#include <algorithm>
#include <string>
#include <math.h>
#include<map>
#include <utility>
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)
#include <bitset>

#define INF (1e9)
typedef long long unsigned int ll;


int main()
{
    ll N,K;
	cin >> N >> K;
	ll A[N];

	int x = (int)log2(K)+1;

	bitset<12> bs[N];
	ll l;
	REP(i, N)
	{
		cin >> A[i];
		bs[i] = bitset<12>(A[i]);

	}
	int k=0;
	REP(i, x)
	{
		int ze = 0;
		int on = 0;
		REP(j, N)
		{
			if(bs[j][i]==1){
				on += 1;
			}else{
				ze += 1;
			}
		
		}
		
		if (on < ze)
		{
			k += pow(2, i);
		}
	}

	ll sum = 0;
	ll m = 0;
	if(K==0){
		cout << A[0] << endl;
	}else{
		REP(i, N)
		{
			sum += k ^ A[i];
		}
		cout << sum << endl;
	}
	return 0;
}

Compiler output:
a.cc:66:2: error: stray '#' in program
   66 | }#include <iostream>
      |  ^
a.cc:66:3: error: 'include' does not name a type
   66 | }#include <iostream>
      |   ^~~~~~~
a.cc:82:5: error: redefinition of 'int main()'
   82 | int main()
      |     ^~~~
a.cc:17:5: note: 'int main()' previously defined here
   17 | int main()
      |     ^~~~
Language: C++

#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <tuple>
#include <algorithm>
#include <map>
#include <pow>
using namespace std;
#define REP(n) for(int i=0;i<n;i++)
#define INF_32 0x7fffffff;



int main() {
	long long N,K;
	cin >> N >> K;
	
	vector<long long> A(N);
	int bit_count[100] = { 0 };
	int bit_K[100] = { 0 };
	long long comm_A = 0;
	REP(N) {
		long long tmp = 0;
		cin >> A[i];
		tmp = A[i];
		int j = 0;
		while (tmp) {
			bit_count[j++] += tmp & 1;
			tmp = tmp >> 1;
		}
	}
	int j = 0;
	long long tmp = K;
	while (tmp) {
		bit_K[j++] += tmp & 1;
		tmp = tmp >> 1;
	}
	
	int min_elem = *min_element( &bit_count[0],&bit_count[j]);

	long long sum_v = pow(2,j-1);
	long long f_in=0;
	int flag = 0;

	for (int i = j - 1; i >= 0; i--) {
		if (bit_count[i] == min_elem && flag == 0) {
			flag = 1;
			f_in += sum_v;
		}
		sum_v /= 2;
	}

	long long ans = 0;
	REP(N) {
		ans += (f_in ^ A[i]);
	}

	cout << ans;


	return 0;
}

Compiler output:
a.cc:8:10: fatal error: pow: No such file or directory
    8 | #include <pow>
      |          ^~~~~
compilation terminated.
Language: Java

import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int n = sc.nextInt();
		long k = sc.nextLong();
		int[] p=new int[44];
		int max=0;
		long sum=0;
		long c=1;
		for(int i = 0; i<n; i++){
			long a = sc.nextLong();
			sum+=a;
			int count=0;
			while(a>0){
				if((a & 1)==1){
					p[count]++;
				}
				a>>=1;
				count++;
			}
			if(max<count){
				max=count;
			}
		}
		for(int i = 0; i<max; i++){
			if((n-p[i])*2>n){
				sum+=c*((n-p[i])-p[i]);
			}
			c*=2;
		}
		long count1 = 1;
		while(k>0){
				if((k & 1)==1 && count>=max){
					sum+=n*Math.pow(2,count);
				}
				k>>=1;
				count1++;
			}
		System.out.println(sum);
	}
}

Compiler output:
Main.java:34: error: cannot find symbol
				if((k & 1)==1 && count>=max){
				                 ^
  symbol:   variable count
  location: class Main
Main.java:35: error: cannot find symbol
					sum+=n*Math.pow(2,count);
					                  ^
  symbol:   variable count
  location: class Main
2 errors
Language: C++

#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>

using namespace std;

#define REP(i, n) for(ll i = 0;i < n;i++)
#define REPR(i, n) for(ll i = n;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define FORR(i, m, n) for(ll i = m;i >= n;i--)
#define REPO(i, n) for(ll i = 1;i <= n;i++)
#define ll long long
#define INF 1999999999
#define MINF -1999999999
#define INF64 1999999999999999999
#define ALL(n) n.begin(),n.end()


ll n, k, s[1000], t[1000], up[1000], ut[1000], mxk = 0, ans = 0, now = 1, u,mxu = INF;
ll main() {
	cin >> n >> k;
	u = k;
	REP(i, n) {
		ll a;
		cin >> a;
		REPO(j, INF) {
			if (a == 0)break;
			else {
				if (a % 2 == 1)s[j]++;
				a /= 2;
			}
		}
	}
	REPO(i, INF) {
		if (k == 0)break;
		else {
			if (k % 2 == 1) {
				t[i]++;
				mxk = max(0ll, i);
			}
			else mxu = min(mxu, i);
			k /= 2;
		}
	}
	if (u == 0) {
		REPO(i, 500) {
			ans += now * s[i];
			now *= 2;
		}
		cout << ans << endl;
		return 0;
	}
	else {
		REPO(i, mxk) {
			up[i] = up[i - 1] + now * max(n - s[i], s[i]);
			now *= 2;
		}
		now = 1;
		REPO(i, mxk) {
			if (t[i] == 1) {
				if (i < mxu) ut[i] = max(up[i - 1] + now * max(n - s[i], s[i]), ut[i - 1] + now * max(n - s[i], s[i]));
				else ut[i] = max(up[i - 1] + now * s[i], ut[i - 1] + now * max(n - s[i], s[i]));
			}
			else ut[i] = ut[i - 1] + now * s[i];
			now *= 2;
		}
		
	}
	cout << ut[mxk] << endl;
}

Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

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

int main() {
    long long n, k;
    cin >> n >> k;
    cout << n << endl;
    cout << k << endl;
    long long a[100005];
    long long num0[45], num1[45];
    memset(num0, 0, sizeof(num0));
    memset(num1, 0, sizeof(num1));

    long long ans = 0;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < 45; j++) {
            if (a[i] == 0)
                break;
            if (a[i] % 2)
                num1[j]++;
            else
                num0[j]++;
            a[i] /= 2;
        }
    }
    long long t0[45];
    long long t1[45];
    long long dp[45];
    // dp[i]=iまでのt1をとったときの最大
    bool select0[45];
    dp[0] = 0;
    for (int i = 0; (1 << i) <= k; i++) {
        // if (num0[i] > num1[i]) {
        t1[i] = num0[i] * (1LL << i);
        // } else {
        t0[i] = num1[i] * (1LL << i);
        // }
        // cout << endl;
    }

    for (int i = 0; i < 45; i++) {
        if (dp[i - 1] < t1[i]) {
            select0[i] = false;
            dp[i] = t1;
        } else {
            dp[i] = dp[i - 1];
            ans += select[0];
        }
        for (int j = 0; j < 45; j++) {
            if (!select0[j])
                ans += t0[i];
            select0[j] = true;
        }
    }
    ans += dp[45];
    cout << ans;
}

// 1110 1000 1101 0100 1010 0101 0001 0000 0000 0000

Compiler output:
a.cc: In function 'int main()':
a.cc:47:21: error: invalid conversion from 'long long int*' to 'long long int' [-fpermissive]
   47 |             dp[i] = t1;
      |                     ^~
      |                     |
      |                     long long int*
a.cc:50:28: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   50 |             ans += select[0];
      |                            ^
a.cc:50:17: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   50 |             ans += select[0];
      |             ~~~~^~~~~~~~~~~~
a.cc:50:17: error: invalid conversion from 'int (*)(int, fd_set*, fd_set*, fd_set*, timeval*)' to 'long long int' [-fpermissive]
   50 |             ans += select[0];
      |             ~~~~^~~~~~~~~~~~
      |                 |
      |                 int (*)(int, fd_set*, fd_set*, fd_set*, timeval*)
Language: C++

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

int main() {
    long long n, k;
    cin >> n >> k;
    cout << n << endl;
    cout << k << endl;
    long long a[100005];
    long long num0[45], num1[45];
    memset(num0, 0, sizeof(num0));
    memset(num1, 0, sizeof(num1));

    long long ans = 0;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < 45; j++) {
            if (a[i] == 0)
                break;
            if (a[i] % 2)
                num1[j]++;
            else
                num0[j]++;
            a[i] /= 2;
        }
    }
    long long t0[45];
    long long t1[45];
    long long dp[45];
    // dp[i]=iまでのt1をとったときの最大
    bool select0[45];
    dp[0] = 0;
    for (int i = 0; (1 << i) <= k; i++) {
        // if (num0[i] > num1[i]) {
        t1[i] = num0[i] * (1LL << i);
        // } else {
        t0[i] = num1[i] * (1LL << i);
        // }
        // cout << endl;
    }

    long long dp[][];
    for (int i = 0; i < 45; i++) {
        if (dp[i - 1] < t1[i]) {
            select0[i] = false;
            dp[i] = t1;
        } else {
            dp[i] = dp[i - 1];
            ans += select[0];
        }
        for (int j = 0; j < 45; j++) {
            if (!select0[j])
                ans += t0[i];
            select0[j] = true;
        }
    }
    ans += dp[45];
    cout << ans;
}

// 1110 1000 1101 0100 1010 0101 0001 0000 0000 0000

Compiler output:
a.cc: In function 'int main()':
a.cc:44:15: error: declaration of 'dp' as multidimensional array must have bounds for all dimensions except the first
   44 |     long long dp[][];
      |               ^~
a.cc:48:21: error: invalid conversion from 'long long int*' to 'long long int' [-fpermissive]
   48 |             dp[i] = t1;
      |                     ^~
      |                     |
      |                     long long int*
a.cc:51:28: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   51 |             ans += select[0];
      |                            ^
a.cc:51:17: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   51 |             ans += select[0];
      |             ~~~~^~~~~~~~~~~~
a.cc:51:17: error: invalid conversion from 'int (*)(int, fd_set*, fd_set*, fd_set*, timeval*)' to 'long long int' [-fpermissive]
   51 |             ans += select[0];
      |             ~~~~^~~~~~~~~~~~
      |                 |
      |                 int (*)(int, fd_set*, fd_set*, fd_set*, timeval*)
Language: Java

import java.io.*;

class Main {


	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long k = sc.nextLong();
		int K = (int)k;
		long A[] = new long[N];
		for (int i=0;i<N;i++) {
			A[i] = sc.nextLong();
		}

		long B[] = new long[K+1];
		for (int i=0;i<K+1;i++) {
			B[i] = f(i,N,A);
		}
		Arrays.sort(B);
		System.out.println(B[K]);

		int a=3;
		int b=1;
/*
		String D = Integer.toBinaryString(a);
		System.out.println(D);

		String B = Integer.toBinaryString(b);
		System.out.println(B);
*/
		int c = a^b;

	}

	static long f(long X,int N,long[] A) {
		long sum = 0;
		for (int i=0;i<N;i++) {
			sum += X^A[i];
		}
		return sum;
	}
}

Compiler output:
Main.java:7: error: cannot find symbol
		Scanner sc = new Scanner(System.in);
		^
  symbol:   class Scanner
  location: class Main
Main.java:7: error: cannot find symbol
		Scanner sc = new Scanner(System.in);
		                 ^
  symbol:   class Scanner
  location: class Main
Main.java:20: error: cannot find symbol
		Arrays.sort(B);
		^
  symbol:   variable Arrays
  location: class Main
3 errors
Language: C++

#include<iostream>
#include<algorithm>
#include<vector>
#include<cstdio>
#include<cmath>
#include<string>
#include<cstdlib>
#include<bitset>
#include<utility>

typedef long long ll;
#define INF 1000000000
#define MOD 1000000007

using namespace std;

ll dp[100001];

int main() {
	ll n, k;
	cin >> n >> k;
	vector<ll> a(n);

	for (int i = 0; i < n; i++) {
	    cin >> a[i];
	}

	ll ans = 0;
	for (int j = 0; j < k; j++) {
		for (int i = 0; i < n; i++) {
	    	bit += j ^ a[i];
		}
		if (ans < bit)
			ans = bit;
	}

	cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:31:17: error: 'bit' was not declared in this scope
   31 |                 bit += j ^ a[i];
      |                 ^~~
a.cc:33:27: error: 'bit' was not declared in this scope
   33 |                 if (ans < bit)
      |                           ^~~
Language: C++

// need
#include <iostream>
#include <algorithm>
// data structure
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <complex>
//#include <deque>
#include <valarray>
#include <unordered_map>
#include <array>
// stream
//#include <istream>
#include <sstream>
//#include <ostream>
#include <fstream>
// etc
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
//#include <chrono>
#include <random>
#include <numeric>
using namespace std;
 
int main()
{
  long N, K, k2;
  int kd = 0;
  long sum = 0;
  cin >> N >> K;
  k2 = K;
  long mask = 0;
  while(k2 > 0){
    k /= 2;
    kd++;
  }
  vector<int> b(kd);  
  vector<long> a(N);
  for(int i = 0; i < N; i++){
	cin >> a[i];
    for(int j = 0; j < kd; j++){
      if((a[i] & (1 << (kd -1))) != 0)
        b[i]++;
    }
  }
  for(int j = 0; j < kd; j++){
    if((N-1)/2 >= b[j]){
      mask |= (1 << j);
    }
  }
  if(mask >= K)
    mask &= (1 << (kd -1 ));
  
  for(int j = 0; j < N; j++){
    a[i] ^= mask;
    sum += a[i];
  }
  cout << sum << endl;
  
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:42:5: error: 'k' was not declared in this scope
   42 |     k /= 2;
      |     ^
a.cc:63:7: error: 'i' was not declared in this scope
   63 |     a[i] ^= mask;
      |       ^
Language: C++

#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <tuple>
#include <algorithm>
#include <map>
using namespace std;
#define REP(n) for(int i=0;i<n;i++)
#define INF_32 0x7fffffff;



int main() {
	long long N,K;
	cin >> N >> K;
	
	vector<long long> A(N);
	int bit_count[100] = { 0 };
	int bit_K[100] = { 0 };
	long long comm_A = 0;
	REP(N) {
		long long tmp = 0;
		cin >> A[i];
		tmp = A[i];
		int j = 0;
		while (tmp) {
			bit_count[j++] += tmp & 1;
			tmp = tmp >> 1;
		}
	}
	int j = 0;
	long long tmp = K;
	while (tmp) {
		bit_K[j++] += tmp & 1;
		tmp = tmp >> 1;
	}
	
	int min_elem = *min_element( &bit_count[0],&bit_count[j]);

	long long sum_v = pow(2,j-1);
	long long f_in=0;
	int flag = 0;

	for (int i = j - 1; i >= 0; i--) {
		if (bit_count[i] == min_elem && flag == 0) {
			flag = 1;
			f_in += sum_v;
		}
		sum_v /= 2;
	}

	long long ans = 0;
	REP(N) {
		ans += (f_in ^ A[i]);
	}

	cout << ans;


	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:41:27: error: 'pow' was not declared in this scope
   41 |         long long sum_v = pow(2,j-1);
      |                           ^~~
Language: C++

#include <iostream>
#include <algorithm>
using namespace std; 

int N;
long long int K, A[100005];

int b[100], b_save[100];
long long int NUM_b(void) {
	long long int ret = 0;
	for (int i = 45; i >= 1; i--) {
		ret *= 2;
		ret += b[i];
	}

	return ret;
}

int main(void) {

	cin >> N >> K;

	for (int i = 1; i <= N; i++) {
		cin >> A[i];
	}

	for (int i = 1; i <= 44; i++) {
		int sum = 0;
		for (int j = 1; j <= N; j++) {
			if ((1 << (i-1)) & A[j]) { sum++; }
		}

		if (N - sum > sum) { b[i] = 1; }
		else { b[i] = 0; }
	}

	/*
	int q = 43;
	while (K < NUM_b()) {
		b[q] = 0; q--;
	}

	long long int X = NUM_b();

	long long int ans = 0;

	for (int i = 1; i <= N; i++) {
		ans += X^A[i];
	}
	cout << ans << endl;
	*/

	int g = 0;
	long long int tmp = K;
	while (tmp) {
		tmp /= 2; g++;
	}

	for (int i = 1; i <= 44; i++) { b_save[i] = b[i]; }

	//========//
	for (int i = 50; i >= g; i--) { b[i] = 0; }
	long long int X = NUM_b();
	long long int ans1 = 0;
	for (int i = 1; i <= N; i++) {
		ans1 += X^A[i];
	}
	for (int i = 1; i <= 44; i++) { b[i] = b_save[i]; }
	//=========//
/*	for (int i = 50; i >= 1; i--) { b[i] = b_save[i]; }
	for (int i = 50; i >= g + 1; i--) { b[i] = 0; }
	b[g] = 1;
	for (int i = g - 1; i >= 1; i--) {
		int h = (K&(1 << (i - 1)));
		b[i] = min(b[i], h);
	}

	X = NUM_b();
	long long int ans2 = 0;
	for (int i = 1; i <= N; i++) {
		ans2 += X^A[i];
	}
	cout << max(ans1, ans2) << endl;
	*/


	for (int i = 50; i >= g + 1; i--) { b[i] = 0; }

	int sign = 0;

	for (int i = g; i >= 1; i--) {
		int h = K &(1 << (i - 1));
		if (sign == 1) {
			b[i] = b[i];
		}
		else {
			if (b[i] < h) { sign = 1; }
			else if (b[i] > h) { b[i] = h; }
		}

	}

	long long int X = NUM_b();

	long long int ans2 = 0;
	for (int i = 1; i <= N; i++) {
		ans2 += X^A[i];
	}

	cout << max(ans1,ans2) << endl;

	//system("pause");
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:103:23: error: redeclaration of 'long long int X'
  103 |         long long int X = NUM_b();
      |                       ^
a.cc:63:23: note: 'long long int X' previously declared here
   63 |         long long int X = NUM_b();
      |                       ^
Language: C++

#include<iostream>
#include<algorithm>
#include<queue>
#include<vector>
#include<cmath>

using namespace std;

#define INF 1000000000010

int n;
long long k;
long long a[100010];
long long f[INF];
vector<long long> V;
priority_queue<long long>Q;

int main(){
  cin >> n >> k;
  for(int i = 0; i < n; ++i){
    cin >> a[i];
    
  }
  for(int j = 0; j <= k; ++j){
    f[j] = 0;
    for(int i = 0; i < n; ++i){
       f[j] += (a[i] ^ j);
    }
    V.push_back(f[j]);
    //Q.push(f[j]);
    //cout << f[j] << endl;
    
  }
  sort(V.begin(), V.end());
  cout << V.back() << endl;
  //cout << Q.top() << endl;
  
}

Compiler output:
/tmp/ccjs1H2r.o: in function `main':
a.cc:(.text+0x12b): relocation truncated to fit: R_X86_64_PC32 against symbol `V' defined in .bss section in /tmp/ccjs1H2r.o
a.cc:(.text+0x154): relocation truncated to fit: R_X86_64_PC32 against symbol `V' defined in .bss section in /tmp/ccjs1H2r.o
a.cc:(.text+0x166): relocation truncated to fit: R_X86_64_PC32 against symbol `V' defined in .bss section in /tmp/ccjs1H2r.o
a.cc:(.text+0x180): relocation truncated to fit: R_X86_64_PC32 against symbol `V' defined in .bss section in /tmp/ccjs1H2r.o
/tmp/ccjs1H2r.o: in function `__static_initialization_and_destruction_0()':
a.cc:(.text+0x1c5): relocation truncated to fit: R_X86_64_PC32 against symbol `V' defined in .bss section in /tmp/ccjs1H2r.o
a.cc:(.text+0x1de): relocation truncated to fit: R_X86_64_PC32 against symbol `V' defined in .bss section in /tmp/ccjs1H2r.o
a.cc:(.text+0x1f7): relocation truncated to fit: R_X86_64_PC32 against symbol `Q' defined in .bss section in /tmp/ccjs1H2r.o
a.cc:(.text+0x210): relocation truncated to fit: R_X86_64_PC32 against symbol `Q' defined in .bss section in /tmp/ccjs1H2r.o
collect2: error: ld returned 1 exit status
Language: C++

fun main(args: Array<String>) {
    val (n, k) = readLine()!!.split(' ').map { it.toLong() }
    val kb = java.lang.Long.toBinaryString(k)
    val a = readLine()!!.split(' ')
            .map { java.lang.Long.toBinaryString(it.toLong()) }
            .map { it.padStart(kb.length,'0') }

    var x = 0L

    (0 until kb.length).forEach { i ->
        val c = a.filter { it.reversed()[i] == '0' }.count()
        if (c > n / 2) {
            x += 1L shl i
        }
    }

    println(a.map { java.lang.Long.parseLong(it, 2) xor x }.sum())
}


Compiler output:
a.cc:1:1: error: 'fun' does not name a type
    1 | fun main(args: Array<String>) {
      | ^~~
Language: C++

#include <bits/stdc++.h>
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
const int MOD = 1000000007;
const int INF = 1010000000;
const double EPS = 1e-10;
using namespace std;
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 

int main() {
  int n,k;cin>>n>>k;int a[100000];rep(i,n)cin>>a[i];
  int aa = a[0];
  repd(i,1,n){
    aa ^= a[i];
  }
  if(aa > k){
    aa = a&k;
  }else if(aa < k){
    int n = (1<<ceil(log2(k)));
    if(n+aa <= k){
      aa = n+aa;
    }else{
      aa = k;
    }
  }
  int ans = 0;
  rep(i,n){
    ans += a[i]^aa;
  }
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:11: error: invalid operands of types 'int [100000]' and 'int' to binary 'operator&'
   18 |     aa = a&k;
      |          ~^~
      |          | |
      |          | int
      |          int [100000]
a.cc:20:15: error: invalid operands of types 'int' and 'double' to binary 'operator<<'
   20 |     int n = (1<<ceil(log2(k)));
      |              ~^~~~~~~~~~~~~~~
      |              |      |
      |              int    double
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll MOD = 1000000007;
ll INFL = 1ll << 60;
ll INF = 1 << 30;

int main() {
  int n, k;
  cin >> n >> k;
  vector<ll> v(n);
  vector<int> a(50, 0);
  
  for (int i = 0; i < n; i++) {
    cin >> v[i];
    int hoge = v[i];
    for (int j = 0; hoge; j++) {
      a[j] += hoge % 2;
      hoge /= 2;
    }
  }

  int keta = 0, h = k;
  while (h) {
    keta++;
    h /= 2;
  }

  ll mok = 0;  // 目標の数
  for (int i = 0; pow(2, i) < k; i++) {
    if (a[i] * 2 <= n)
      mok += pow(2, i);
  // }
  // 
  // int ans = 0;
  // ll mask = ((1 << keta) - 1);
  // for (int i = k; 0 <= i; i--) {
  //   // cout << (((1 << keta) - 1) ^ (mok ^ i)) << endl;
  //   if ((mask ^ (mok ^ ans)) < (mask ^ (mok ^ i)))
  //     ans = i;
  // }
  // 
  // ll s = 0;
  // for (int i = 0; i < n; i++) {
  //   // cout << (v[i] ^ ans) << endl;
  //   s += (v[i] ^ ans);
  // }
  // cout << s << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:49:2: error: expected '}' at end of input
   49 | }
      |  ^
a.cc:8:12: note: to match this '{'
    8 | int main() {
      |            ^
Language: C++

#include<iostream>
#include<algorithm>
#include<queue>
#include<vector>
#include<cmath>

using namespace std;

#define INF 1000000000010

int n;
long long k;
long long a[100010];
long long f[INF];
vector<long long> V;
priority_queue<long long>Q;

int main(){
  cin >> n >> k;
  for(int i = 0; i < n; ++i){
    cin >> a[i];
    
  }
  for(int j = 0; j <= k; ++j){
    f[j] = 0;
    for(int i = 0; i < n; ++i){
       f[j] += (a[i] ^ j);
    }
    //V.push_back(f[j]);
    Q.push(f[j]);
    //cout << f[j] << endl;
    
  }
  //sort(V.begin(), V.end());
  //cout << V.back() << endl;
  cout << Q.top() << endl;
  
}

Compiler output:
/tmp/ccLoLdJS.o: in function `main':
a.cc:(.text+0x12a): relocation truncated to fit: R_X86_64_PC32 against symbol `Q' defined in .bss section in /tmp/ccLoLdJS.o
a.cc:(.text+0x153): relocation truncated to fit: R_X86_64_PC32 against symbol `Q' defined in .bss section in /tmp/ccLoLdJS.o
/tmp/ccLoLdJS.o: in function `__static_initialization_and_destruction_0()':
a.cc:(.text+0x194): relocation truncated to fit: R_X86_64_PC32 against symbol `V' defined in .bss section in /tmp/ccLoLdJS.o
a.cc:(.text+0x1ad): relocation truncated to fit: R_X86_64_PC32 against symbol `V' defined in .bss section in /tmp/ccLoLdJS.o
a.cc:(.text+0x1c6): relocation truncated to fit: R_X86_64_PC32 against symbol `Q' defined in .bss section in /tmp/ccLoLdJS.o
a.cc:(.text+0x1df): relocation truncated to fit: R_X86_64_PC32 against symbol `Q' defined in .bss section in /tmp/ccLoLdJS.o
collect2: error: ld returned 1 exit status
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
#define lint long long
#define P pair<int, int>
 
int main() {
    lint N, K;
    cin >> N >> K;
    
    lint A[N];
    
    for(int i = 0; i < N; ++i){
        cin >> A[i];
    }
    
    int bits = 0;
    
    while(((linnt)1<<bits) < K){
        bits++;
    }
//    cout << bits << endl;
    bool flag = true;
    lint num = 0;
    lint ans = 0;
    
    for(int b = bits - 1; b >= 0; --b){
        int cnt = 0;
        for(int i = 0; i < N; ++i){
            cnt += (A[i] >> b) & 1;
        }
//        cout << cnt << " ";
        lint kb = (K>>b)&1;
        
        if(flag){
            if(cnt < N - cnt){
                if(!kb){
                    continue;
                }
            }
            
            if((cnt >= N - cnt) && kb){
                flag = false;
            }
            
        }
        num += (1 << b) * (cnt < N - cnt);
    }
    
    for(int i = 0; i < N; ++i){
        ans += num^A[i];
    }
    
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:13: error: 'linnt' was not declared in this scope; did you mean 'lint'?
   19 |     while(((linnt)1<<bits) < K){
      |             ^~~~~
      |             lint
a.cc:19:19: error: expected ')' before numeric constant
   19 |     while(((linnt)1<<bits) < K){
      |           ~       ^
      |                   )
a.cc:21:6: error: expected ')' before 'bool'
   21 |     }
      |      ^
      |      )
   22 | //    cout << bits << endl;
   23 |     bool flag = true;
      |     ~~~~
a.cc:19:10: note: to match this '('
   19 |     while(((linnt)1<<bits) < K){
      |          ^
a.cc:35:12: error: 'flag' was not declared in this scope
   35 |         if(flag){
      |            ^~~~
Language: C++

#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <sstream>
#include <set>
#include <tuple>
#include <algorithm>
#include <memory>
#include <numeric>
#include <queue>
#include <functional>
#include <cmath>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);

	ll N, K;
	cin >> N >> K;

	ll bit_max = 0;
	if (K != 0)
	{
		ll t = K;
		ll tt = 0;
		while (true)
		{
			if (t == 0)
			{
				break;
			}
			t /= 2;
			tt++;
		}

		bit_max = tt;
	}

	vector<ll> A(N);
	for (ll i = 0; i < N; ++i)
	{
		cin >> A[i];
	}

	for (ll i = 0; i < N; ++i)
	{
		//cout << A[i] << endl;
		ll t = A[i];
		ll tt = 0;
		while (true)
		{
			if (t == 0)
			{
				break;
			}
			t /= 2;
			tt++;
		}

		bit_max = max(bit_max, tt);
	}

	vector<pair<ll, pair<ll, pair<ll, ll>>>> points; // point, risk

	//ll sum = 0;
	//ll sum_bak = 0;
	//ll bit_idx = bit_max+1;

	//ll tmp_X = 0;

	for (ll bit_idx = 0; bit_idx < bit_max; ++bit_idx)
	{
		ll n_on = 0;
		for (ll i = 0; i < N; ++i)
		{
			n_on += ((A[i] & (1 << bit_idx)) >> bit_idx);
		}

		//cout << n_on << endl;

		if (n_on * 2 > N)
		{
			// should be 0
			points.emplace_back(std::pow(2, bit_idx) * n_on, pair<ll, P>(std::pow(2, bit_idx) * (N - n_on), P(0, bit_idx)));
		}
		else
		{
			// should be 1
			//sum += pow(2, bit_idx) * (N - n_on);
			points.emplace_back(std::pow(2, bit_idx) * (N - n_on), pair<ll, P>(std::pow(2, bit_idx) * n_on, P(std::pow(2, bit_idx), bit_idx)));
		}

		//cout << n_on << endl;
		//cout << sum << endl;

		//bit_idx--;
	}

	//sort(points.begin(), points.end(), std::greater<pair<ll, pair<ll, pair<ll, ll>>>>());

	reverse(points.begin(), points.end());

	ll tmp_X = 0;
	ll sum = 0;

	for (const auto& p : points)
	{
		//cout << p.first << " " << p.second << endl;
	}

	//vector<ll> selected;

	for (const auto& p : points)
	{
		//if (find(selected.begin(), selected.end(), p.second.second.second) == selected.end())
		//{
			if (tmp_X + p.second.second.first > K)
			{
				sum += p.second.first;
				//selected.push_back(p.second.second.second);
				continue;
			}

			sum += p.first;
			//selected.push_back(p.second.second.second);
			//cout << p.first << " " << p.second << endl;

		}

	}


	cout << sum << endl;
	//cout << N << endl;
}

Compiler output:
a.cc:142:9: error: 'cout' does not name a type
  142 |         cout << sum << endl;
      |         ^~~~
a.cc:144:1: error: expected declaration before '}' token
  144 | }
      | ^
Language: C++

#include<iostream>
#include<algorithm>
#include<queue>
#include<vector>
#include<cmath>

using namespace std;

#define INF 1000000000002

long long n, k;
long long a[100010];
long long f[INF];
vector<long long> V;
priority_queue<long long>Q;

int main(){
  cin >> n >> k;
  for(int i = 0; i < n; ++i){
    cin >> a[i];
    
  }
  for(int j = 0; j <= k; ++j){
    f[j] = 0;
    for(int i = 0; i < n; ++i){
       f[j] += (a[i] ^ j);
    }
    //V.push_back(f[j]);
    Q.push(f[j]);
    //cout << f[j] << endl;
    
  }
  //sort(V.begin(), V.end());
  //cout << V.back() << endl;
  cout << Q.top() << endl;
  
}

Compiler output:
/tmp/ccc2IG9A.o: in function `main':
a.cc:(.text+0x138): relocation truncated to fit: R_X86_64_PC32 against symbol `Q' defined in .bss section in /tmp/ccc2IG9A.o
a.cc:(.text+0x161): relocation truncated to fit: R_X86_64_PC32 against symbol `Q' defined in .bss section in /tmp/ccc2IG9A.o
/tmp/ccc2IG9A.o: in function `__static_initialization_and_destruction_0()':
a.cc:(.text+0x1a2): relocation truncated to fit: R_X86_64_PC32 against symbol `V' defined in .bss section in /tmp/ccc2IG9A.o
a.cc:(.text+0x1bb): relocation truncated to fit: R_X86_64_PC32 against symbol `V' defined in .bss section in /tmp/ccc2IG9A.o
a.cc:(.text+0x1d4): relocation truncated to fit: R_X86_64_PC32 against symbol `Q' defined in .bss section in /tmp/ccc2IG9A.o
a.cc:(.text+0x1ed): relocation truncated to fit: R_X86_64_PC32 against symbol `Q' defined in .bss section in /tmp/ccc2IG9A.o
collect2: error: ld returned 1 exit status
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
using namespace std;
int one[100001][32];
void make_prefix(vector<long long int> A, int n)
{
	for (int j = 0; j < 32; j++)
		one[0][j] = 0;
	for (int i = 1; i <= n; i++)
	{
		long long int a = A[i - 1];
		for (int j = 0; j < 32; j++)
		{
			long long int x = pow(2, j);
			if (a & x)
				one[i][j] = 1 + one[i - 1][j];
			else
				one[i][j] = one[i - 1][j];
		}
	}
}
long long int Solve(long long int L,long long int R,long long int K)
{
	long long int l = L, r = R;
	long long int tot_bits = r - l + 1;
	long long int X = K;

	// Iterating over each bit 
	for (int i = 0; i < 31; i++)
	{

		// get 1's at ith bit between the 
		// range L-R by subtracting 1's till 
		// Rth number - 1's till L-1th number 
		int x = one[r][i] - one[l - 1][i];

		// If 1's are more than or equal to 0's 
		// then unset the ith bit from answer 
		if (x >= tot_bits - x)
		{
			int ith_bit = pow(2, i);

			// Set ith bit to 0 by doing 
			// Xor with 1 
			X = X ^ ith_bit;
		}
	}
	return X;
}

// Driver program 
int main()
{
	// Taking inputs 
	
	long long int n, q = 1;
	long long int K;
	cin >> n >> K;
	vector<long long int> A(n);
	int z = 0;
	for (int i = 0; i < n; i++)
	{
		cin >> A[i];
		if (A[i] == 0)
		{
			z++;
		}
	}
	make_prefix(A, n);
	long long int x = Solve(1, n, K);
	long long int ans = 0;
	for (int i = 0; i < n; i++)
	{
		ans += A[i] ^ x;
	}
	if (k!=0)
	{
		cout << ans << endl;
	}
	else
	{
		cout << A[0] << endl;
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:78:13: error: 'k' was not declared in this scope
   78 |         if (k!=0)
      |             ^
Language: C++

#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<algorithm>
#include<stdlib.h>
#define _USE_MATH_DEFINES
#include<math.h>
#include<numeric>
#include<iomanip>
#include<deque>
#include <boost/multiprecision/cpp_int.hpp>

namespace mp = boost::multiprecision;

using namespace std;

typedef pair<int, int> P;

bool pc1(const P& firstElof, const P& secondElof)
{//first降順
	return firstElof.first > secondElof.first;
}
bool pc2(const P& firstElof, const P& secondElof)
{//first昇順
	return firstElof.first < secondElof.first;
}
bool pc3(const P& firstElof, const P& secondElof)
{//second降順
	return firstElof.second > secondElof.second;
}
bool pc4(const P& firstElof, const P& secondElof)
{//second昇順
	return firstElof.second < secondElof.second;
}


int main() {
	int n; mp::uint256_t k;
	cin >> n >> k;
	vector<mp::uint256_t>a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	vector<int>bit(40);
	for (int i =0 ; i < n; i++) {
		for (int j = 39; j >= 0; j--) {
			if (a[i] & (1 << j)) {
				bit[j]++;
			}
		}
	}
	//for (int i = 0; i <= 39; i++) {
		//cout << bit[i] << endl;
	//}
	mp::uint256_t tmp= 0;
	mp::uint256_t ans= 0;
	for (int i = 39; i >=0; i--) {
		mp::uint256_t temp = tmp;
		if (bit[i] < n-bit[i]) {
			tmp |= (1 << i);
		}
		else {
			tmp |= (0 << i);
		}
		if (tmp <= k) {
			ans = tmp;
		}
		else {
			tmp = temp;
		}
	}
	
	//cout << ans << endl;
	mp::uint256_t = 0;
	for (int i =0 ; i < n; i++) {
		sum += ans xor a[i];
	}
	cout << sum << endl;
}




Compiler output:
a.cc:12:10: fatal error: boost/multiprecision/cpp_int.hpp: No such file or directory
   12 | #include <boost/multiprecision/cpp_int.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<algorithm>
#include<stdlib.h>
#define _USE_MATH_DEFINES
#include<math.h>
#include<numeric>
#include<iomanip>
#include<deque>
#include <boost/multiprecision/cpp_int.hpp>

namespace mp = boost::multiprecision;

using namespace std;

typedef pair<int, int> P;

bool pc1(const P& firstElof, const P& secondElof)
{//first降順
	return firstElof.first > secondElof.first;
}
bool pc2(const P& firstElof, const P& secondElof)
{//first昇順
	return firstElof.first < secondElof.first;
}
bool pc3(const P& firstElof, const P& secondElof)
{//second降順
	return firstElof.second > secondElof.second;
}
bool pc4(const P& firstElof, const P& secondElof)
{//second昇順
	return firstElof.second < secondElof.second;
}


int main() {
	int n; mp::uint256_t k;
	cin >> n >> k;
	vector<mp::uint256_t>a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	vector<int>bit(40);
	for (int i =0 ; i < n; i++) {
		for (int j = 39; j >= 0; j--) {
			if (a[i] & (1 << j)) {
				bit[j]++;
			}
		}
	}
	//for (int i = 0; i <= 39; i++) {
		//cout << bit[i] << endl;
	//}
	mp::uint256_t = 0;
	mp::uint256_t = 0;
	for (int i = 39; i >=0; i--) {
		mp::uint256_t = tmp;
		if (bit[i] < n-bit[i]) {
			tmp |= (1 << i);
		}
		else {
			tmp |= (0 << i);
		}
		if (tmp <= k) {
			ans = tmp;
		}
		else {
			tmp = temp;
		}
	}
	
	//cout << ans << endl;
	mp::uint256_t = 0;
	for (int i =0 ; i < n; i++) {
		sum += ans xor a[i];
	}
	cout << sum << endl;
}




Compiler output:
a.cc:12:10: fatal error: boost/multiprecision/cpp_int.hpp: No such file or directory
   12 | #include <boost/multiprecision/cpp_int.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

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

   typedef unsigned long long ll;
   typedef pair<ll, ll> Pii;
   typedef vector<ll> Vi;
   typedef vector<Vi> VVi;

   const double EPS = (1e-7);
   const ll INF =(1e13);
   const double PI = (acos(-1));
   const ll MOD = ll(1e9) + 7;

   #define REP(i, n) for(ll i = 0; i < (ll)(n); i++)
   #define REPR(i, n) for(ll i = n; i > -1; i--)
   #define FOR(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
   #define ALL(x) (x).begin(),(x).end()
   #define SORT(x) sort((x).begin(), (x).end())
   #define RSORT(x) sort((x).rbegin(), (x).rend())
   #define REVERSE(x) reverse((x).begin(), (x).end())
   #define SZ(x) ((ll)(x).size())
   #define pb push_back
   #define mp make_pair

   //chmax(a, b): a>bならaをbで更新　更新したときにtrueを返す
   //chmin(a, b): a<bならaをbで更新　更新したときにtrueを返す
   template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
   template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

   #define dump(x) cerr<< #x << "= " << (x) << endl;

   ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
   ll pow(ll a, ll b){if (b == 0) return 1; else if (b % 2 == 0) return pow(a * a, b / 2); else return pow(a * a, b / 2) * a;}
   ll pow(ll a, ll b, ll m){if (b == 0) return 1; else if (b % 2 == 0) return (pow(a * a, b / 2, m) % m); else return (pow(a * a, b / 2) * a) % m;}
   ll residue(ll a, ll m){return ((a % m) + m) % m;};

   ll dx[4]={1,0,-1,0};
   ll dy[4]={0,1,0,-1};
const ll MAX_N = 1e5, MAX_K = 50;
ll N, K;
ll A[MAX_N] = {};
ll B[MAX_K][MAX_N] = {};
ll C[MAX_K] = {};
ll s = 0;
ll log2(ll x){
   if(x == 1) return 0;
   return log2(x / 2) + 1;
}
ll f_max(ll x){
   //x以下のfの最大値
   if (x == 0) return s;
   if(x + 1 == pow(2, log2(x + 1))){
      //xが2べき - 1のとき
      ll ans = 0;
      REP(j, log2(x) + 1){
         ans += (1ull << j) * max(C[j], N - C[j]);
      }
      FOR(j, log2(x) + 1, 50){
         ans += (1ull << j) * C[j];
      }
      return ans;
   }
   else{
      ll fmax1 = f_max(pow(2, log2(x)) - 1); // 0 - 2^k - 1でのmax
      ll fmax2 = pow(2, log2(x)) * (N - 2 * C[log2(x)]) + f_max(x - pow(2, log2(x))); // x - 2^kでのmax
      //printf("fmax1 = %lld, fmax2 = %lld\n", fmax1, fmax2);
      return max(fmax1, fmax2);   
   }   
}
int main(){
   cin >> N >> K;
   REP(i, N) {
      cin >> A[i];
      s += A[i];
   }
   REP(j, 50){
      REP(i, N){
         B[j][i] = (A[i] >> j) & 1;
         C[j] += B[j][i];
      }
   }
   cout << f_max(K) << endl;
}


Compiler output:
a.cc:37:18: error: narrowing conversion of '-1' from 'int' to 'll' {aka 'long long unsigned int'} [-Wnarrowing]
   37 |    ll dx[4]={1,0,-1,0};
      |                  ^~
a.cc:38:20: error: narrowing conversion of '-1' from 'int' to 'll' {aka 'long long unsigned int'} [-Wnarrowing]
   38 |    ll dy[4]={0,1,0,-1};
      |                    ^~
Language: C++

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

int main(){
    long long N,K,n;
    long long res=0,ans=0;
    cin >> N >> K;

    vector<long long> v(N),vs(N);
    

    for (int i=0;i<N;i++){
        cin >> v[i];
        }
    vs = v;

    vector<long long> v2(40);     
    for (int i=0;i<N;i++){
        n = 0;
        while (v[i]>0){
            v2[n] += v[i]%2;
            v[i] /= 2;
            n++;
        }    
    }

    n = 39;
    reverse(v2.begin(), v2.end());
    for (long long i:v2){
        if (i<=N/2 && res+pow(2,n)<=K){
            res += pow(2,n);
        }
        n--;
        if (res>=K){
            break;
        }
    }

    for (long long i:vs){
        ans += i^res;
    }

    cout <<　ans << endl;
    }
    //sort(v.rbegin(), v.rend(), [](auto& x, auto& y){return x[1] < y[1];});

Compiler output:
a.cc:43:12: error: extended character 　 is not valid in an identifier
   43 |     cout <<　ans << endl;
      |            ^
a.cc: In function 'int main()':
a.cc:43:12: error: '\U00003000ans' was not declared in this scope
   43 |     cout <<　ans << endl;
      |            ^~~~~
Language: C++

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <typeinfo>
using namespace std;
using ll = long long;

int main() {

	ll n, k, sum=0,num=0;
	cin >> n >> k;
	vector<ll> a(n);

	for (int i = 0; i < n; i++)
		cin >> a[i];

	if (k == 0)
		cout << a[0] << endl;
	else {
		while (k > 1) {
			k /= 2;
			num++;
		}
		k = pow(2, num);

		for (int i = 0; i < n; i++)
		{
			sum += a[i] xor k;
		}

		cout << sum << endl;
	}
	
}


Compiler output:
a.cc: In function 'int main()':
a.cc:33:21: error: 'pow' was not declared in this scope
   33 |                 k = pow(2, num);
      |                     ^~~
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int one[100001][32];
void make_prefix(vector<long long int> A, int n)
{
	for (int j = 0; j < 32; j++)
		one[0][j] = 0;
	for (int i = 1; i <= n; i++)
	{
		long long int a = A[i - 1];
		for (int j = 0; j < 32; j++)
		{
			long long int x = pow(2, j);
			if (a & x)
				one[i][j] = 1 + one[i - 1][j];
			else
				one[i][j] = one[i - 1][j];
		}
	}
}
long long int Solve(long long int L,long long int R,long long int K)
{
	long long int l = L, r = R;
	long long int tot_bits = r - l + 1;
	long long int X = K;

	// Iterating over each bit 
	for (int i = 0; i < 31; i++)
	{

		// get 1's at ith bit between the 
		// range L-R by subtracting 1's till 
		// Rth number - 1's till L-1th number 
		int x = one[r][i] - one[l - 1][i];

		// If 1's are more than or equal to 0's 
		// then unset the ith bit from answer 
		if (x >= tot_bits - x)
		{
			int ith_bit = pow(2, i);

			// Set ith bit to 0 by doing 
			// Xor with 1 
			X = X ^ ith_bit;
		}
	}
	return X;
}

// Driver program 
int main()
{
	// Taking inputs 
	
	long long int n, q = 1;
	long long int K;
	cin >> n >> K;
	vector<long long int> A(n);
	for (int i = 0; i < n; i++)
	{
		cin >> A[i];
	}
	make_prefix(A, n);
	long long int x = Solve(1, n, K);
	long long int ans = 0;
	for (int i = 0; i < n; i++)
	{
		ans += A[i] ^ x;
	}
	if (n > 1)
	{
		cout << ans << endl;
	}
	else
	{
		cout << A[0] << endl;
	}
	return 0;
}


Compiler output:
a.cc: In function 'void make_prefix(std::vector<long long int>, int)':
a.cc:15:43: error: 'pow' was not declared in this scope
   15 |                         long long int x = pow(2, j);
      |                                           ^~~
a.cc: In function 'long long int Solve(long long int, long long int, long long int)':
a.cc:42:39: error: 'pow' was not declared in this scope
   42 |                         int ith_bit = pow(2, i);
      |                                       ^~~
Language: C++

#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
#include <stack>
#include <queue>
#include <deque>
#include <numeric>
#include <bits/stdc++.h>
#include <utility>
#include <iomanip>

#define ALL(obj) (obj).begin(), (obj).end()
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define RFOR(i,a,b) for(int i = (a); (b) <= i; i--)
#define REP(i,n) for(int i = 0; i < (n); i++)
#define RREP(i,n) for(int i = n; n <= i; i--)
#define ABS(a) ((a < 0) ? ((-1)*(a)) : (a))
#define elif else if
#define MOD 1000000007
#define INF (1<<29)

using namespace std;

#define ld long double
#define ll long long

map <int ,int> mpa,mpb;
typedef pair<ll, ll> P;
priority_queue<P, vector<P>, greater<P>> pque;

ll N,K;
ll N_MAX=1001000;
ll A[1001000];

int main(){
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> N >> K;

  for(int i=1;i<=N;i++){
    cin >> A[i];
  }
  if(K==0){
    ll op=0;
    for(int i=1;i<=N;i++){
      op+=A[i];
    }
    cout << op << endl;
    return 0;
  }

  ll B[1000]={0};
  ll a;

  for(int i=1;i<=N;i++){
    a=A[i];
    ll cnt=0;
    while(a>0){
      if(a%2==1){
        B[cnt]++;
        cnt++;
      }else{
        cnt++;
      }
      a/=2;
    }
  }

  ll dp=0;
  while(K>0){
    dp++;
    K/=2;
  }
  // Nのk乗をMで割った余りを返す
  ll pow_mod(ll n,ll k,ll m){
    if(k==0){
      return 1;
    }else if(k%2==1){
      return pow_mod(n,k-1,m)*n%m;
    }else{
      ll t=pow_mod(n,k/2,m);
      return (t*t)%m;
    }
  }

  ll sum=0;
  for(int i=0;i<dp-1;i++){
    if(N-B[i]>N/2){
      sum+=pow_mod(2,i,1);
    }
  }

  ll ans=0;
  for(int i=1;i<=N;i++){
    ans+=(sum^A[i]);
  }

  ll cnta=0;
  for(int i=sum+1;i<=K;i++){
    for(int i=1;i<=N;i++){
      cnta+=(sum^A[i]);
    }
    ans=max(ans,cnta);
  }

  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:82:29: error: a function-definition is not allowed here before '{' token
   82 |   ll pow_mod(ll n,ll k,ll m){
      |                             ^
a.cc:96:12: error: 'pow_mod' was not declared in this scope
   96 |       sum+=pow_mod(2,i,1);
      |            ^~~~~~~
Language: C++

#include<iostream>
#include<algorithm>
#include<queue>
#include<vector>
#include<cmath>

using namespace std;

#define INF 1000000000000

int n, k;
long long a[100010];
long long f[INF];
vector<long long> V;
priority_queue<long long>Q;
long long answer;

long long maxi(int b[]){
  long long maximum = 0;
  for(int i = 0; i < n;++i){
    if(b[i] < maximum){
      maximum = b[i];
    }
  }
  return maximum;
}

int main(){
  cin >> n >> k;
  for(int i = 0; i < n; ++i){
    cin >> a[i];
    
  }
  for(int j = 0; j <= k; ++j){
    f[j] = 0;
    for(int i = 0; i < n; ++i){
       f[j] += (a[i] ^ j);
    }
    //V.push_back(f[j]);
    Q.push(f[j]);
    //cout << f[j] << endl;
    
  }
  //sort(V.begin(), V.end());
  //cout << V.back() << endl;
  cout << Q.top() << endl;
  
}

Compiler output:
/tmp/cctS0ZrU.o: in function `main':
a.cc:(.text+0x192): relocation truncated to fit: R_X86_64_PC32 against symbol `Q' defined in .bss section in /tmp/cctS0ZrU.o
a.cc:(.text+0x1b4): relocation truncated to fit: R_X86_64_PC32 against symbol `Q' defined in .bss section in /tmp/cctS0ZrU.o
/tmp/cctS0ZrU.o: in function `__static_initialization_and_destruction_0()':
a.cc:(.text+0x1f5): relocation truncated to fit: R_X86_64_PC32 against symbol `V' defined in .bss section in /tmp/cctS0ZrU.o
a.cc:(.text+0x20e): relocation truncated to fit: R_X86_64_PC32 against symbol `V' defined in .bss section in /tmp/cctS0ZrU.o
a.cc:(.text+0x227): relocation truncated to fit: R_X86_64_PC32 against symbol `Q' defined in .bss section in /tmp/cctS0ZrU.o
a.cc:(.text+0x240): relocation truncated to fit: R_X86_64_PC32 against symbol `Q' defined in .bss section in /tmp/cctS0ZrU.o
collect2: error: ld returned 1 exit status
Language: C++

#include<iostream>
#include<algorithm>
#include<queue>
#include<vector>
#include<cmath>

using namespace std;

int n, k;
long long a[100010];
long long f[100000000000];
vector<long long> V;
priority_queue<long long>Q;
long long answer;

long long maxi(int b[]){
  long long maximum = 0;
  for(int i = 0; i < n;++i){
    if(b[i] < maximum){
      maximum = b[i];
    }
  }
  return maximum;
}

int main(){
  cin >> n >> k;
  for(int i = 0; i < n; ++i){
    cin >> a[i];
    
  }
  for(int j = 0; j <= k; ++j){
    f[j] = 0;
    for(int i = 0; i < n; ++i){
       f[j] += (a[i] ^ j);
    }
    //V.push_back(f[j]);
    Q.push(f[j]);
    //cout << f[j] << endl;
    
  }
  //sort(V.begin(), V.end());
  //cout << V.back() << endl;
  cout << Q.top() << endl;
  
}

Compiler output:
/tmp/ccOnHmdm.o: in function `main':
a.cc:(.text+0x192): relocation truncated to fit: R_X86_64_PC32 against symbol `Q' defined in .bss section in /tmp/ccOnHmdm.o
a.cc:(.text+0x1b4): relocation truncated to fit: R_X86_64_PC32 against symbol `Q' defined in .bss section in /tmp/ccOnHmdm.o
/tmp/ccOnHmdm.o: in function `__static_initialization_and_destruction_0()':
a.cc:(.text+0x1f5): relocation truncated to fit: R_X86_64_PC32 against symbol `V' defined in .bss section in /tmp/ccOnHmdm.o
a.cc:(.text+0x20e): relocation truncated to fit: R_X86_64_PC32 against symbol `V' defined in .bss section in /tmp/ccOnHmdm.o
a.cc:(.text+0x227): relocation truncated to fit: R_X86_64_PC32 against symbol `Q' defined in .bss section in /tmp/ccOnHmdm.o
a.cc:(.text+0x240): relocation truncated to fit: R_X86_64_PC32 against symbol `Q' defined in .bss section in /tmp/ccOnHmdm.o
collect2: error: ld returned 1 exit status