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

#include<bits/stdc++.h>
using namespace std;
long long N, A[200009], cnt;
multiset<long long> S;
int main() {
	cin >> N;
	for (int i = 0; i < N; i++) cin >> A[i];
	sort(A, A + N);
	for (int i = N - 1; i >= 0; i--) {
		bool flag = false;
		for (int j = 0; j < 32; j++) {
			long long ret = (1LL << j) - A[i];
			if (A[i] > ret) continue;
			auto itr = S.lower_bund(ret);
			if (itr != S.end() && *itr == ret) {
				S.erase(itr);
				cnt++;
				flag = true;
				break;
			}
		}
		if (flag == false) {
			S.insert(A[i]);
		}
	}
	cout << cnt << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:38: error: 'class std::multiset<long long int>' has no member named 'lower_bund'; did you mean 'lower_bound'?
   14 |                         auto itr = S.lower_bund(ret);
      |                                      ^~~~~~~~~~
      |                                      lower_bound
Language: C

#include<stdio.h>
#include<stdlib.h>

int compare_int(const void *a,const void *b){
	return *(long long*)a-*(long long*)b;
}

long long ru2(int n){
	int i;
	long long r=1;
	for(i=0;i<n;i++)r=r*2;
	return r;
}

struct num{
	long long a;
	int no;
}

int main(){
	int i,j,k,n,ans=0,f[2000]={0},c=0;
	long long a[2000],r2[41];
	for(i=0;i<=40;i++)r2[i]=ru2(i);
	scanf("%d",&n);
	for(i=0;i<n;i++)scanf("%lld",&a[i]);
	qsort(a,n,sizeof(long long),compare_int);
	struct num at[2000];
	for(i=0;i<n;i++){
		if(at[c].a!=a[i]){
			at[++c].a=a[i];
			at[c].no=1;
		}else at[c].no++;
	}
	for(i=c-1;i>=0;i--){
		for(j=0;j<=40;j++){
			if(at[i].a<r2[j]&&r2[j]<=2*at[i].a){
				int lb=-1,ub=n;
				while(ub-lb>1){
					int mid=(ub+lb)/2;
					if(at[mid].a>=(r2[j]-at[i].a))ub=mid;
					else lb=mid;
				}
				if(at[i].a+at[ub].a==r2[j]){
					if((i!=ub&&at[i].no>0&&at[ub].no>0)||(i==ub&&at[i].no>1)){
						at[i].no--;
						at[ub].no--;
						ans++;
					}
				}
			}
		}
	}
	printf("%d\n",ans);
	return 0;
}


Compiler output:
main.c:20:1: error: expected ';', identifier or '(' before 'int'
   20 | int main(){
      | ^~~
Language: C

#include<stdio.h>
#include<stdlib.h>

int compare_int(const void *a,const void *b){
	return *(long long*)a-*(long long*)b;
}

long long ru2(int n){
	int i;
	long long r=1;
	for(i=0;i<n;i++)r=r*2;
	return r;
}

int main(){
	int i,j,k,n,ans=0,f[200000]={0};
	long long a[200000],r2[41];
	for(i=0;i<=40;i++)r2[i]=ru2(i);
	scanf("%d",&n);
	for(i=0;i<n;i++)scanf("%lld",&a[i]);
	qsort(a,n,sizeof(long long),compare_int);
	for(i=n-1;i>=0;i--){
		for(j=0;j<=40;j++){
			if(a[i]<r2[j]&&r2[j]<=2*a[i]&&f[i]==0){
				int lb=-1,ub=n;
				while(ub-lb>1){
					int mid=(ub+lb)/2;
					if(a[mid]>=(r2[j]-a[i]))ub=mid;
					else lb=mid;
				}
				if(a[i]+a[ub]==r2[j]){
					if(f[ub]==0&&ub!=i){
						f[i]=1;
						f[ub]=1;
						ans++;
					}else{
						for(k=ub+1;a[k]==a[ub];k++){
							if(k>=)break;
							if(f[k]==0&&k!=i){
								f[k]=1;
								f[i]=1;
								ans++;
								break;
							}
						}
					}
				}
			}
		}
	}
	printf("%d\n",ans);
	return 0;
}


Compiler output:
main.c: In function 'main':
main.c:38:63: error: expected expression before ')' token
   38 |                                                         if(k>=)break;
      |                                                               ^
Language: C++

#include<bits/stdc++.h>
#define int long long
#define f(i,n) for(int i=0;i<n;i++)
#define F first
#define S second
#define mod 1000000007
#define P pair<int,int>
using namespace std;
vector<int> v;
int j[50];
signed main(){
	int n,c,ans=0;
	cin>>n;
	f(i,n){
		cin>>c;
		v.push_back(c);
	}
	sort(v.begin(),v.end());
	j[0]=1;
	for(int i=1;i<31;i++)j[i]=j[i-1]*2;
	for(int i=n-1;i>=1;i--){
		f(k,31){
			if(j[k]>v[i]){
				if(binary_search(v.begin(),v.begin()+i,j[k]-v[i])){
					ans++;
					auto Itr=upper_bound(v.begin(),v.begin()+i,j[k]-v[i])-1;
					v.erase(v.begin()+(z-v.begin()));
					i--;
				}
				break;
			}
		}
	}
	cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:60: error: 'z' was not declared in this scope
   27 |                                         v.erase(v.begin()+(z-v.begin()));
      |                                                            ^
Language: C++

#include<bits/stdc++.h>
#define int long long
#define f(i,n) for(int i=0;i<n;i++)
#define F first
#define S second
#define mod 1000000007
#define P pair<int,int>
using namespace std;
vector<int> v;
int j[50];
signed main(){
	int n,c,ans=0;
	cin>>n;
	f(i,n){
		cin>>c;
		v.push_back(c);
	}
	sort(v.begin(),v.end());
	j[0]=1;
	for(int i=1;i<50;i++)j[i]=j[i-1]*2;
	for(int i=n-1;i>=1;i--){
		f(k,50){
			if(j[k]>v[i]){
				if(binary_search(v.begin(),v.begin()+i,j[k]-v[i])){
					ans++;
					auto z=upper_bound(v.begin(),v.begin()+i,j[k]-v[i])-1
					v.erase(v.begin()+(z-v.begin()));
					i--;
				}
				break;
			}
		}
	}
	cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:41: error: expected ',' or ';' before 'v'
   27 |                                         v.erase(v.begin()+(z-v.begin()));
      |                                         ^
Language: C++

#include <iostream>
#include <map>
#include <vector>
using namespace std;

int beki(int x)
{
  int res = 1;
  while (res <= x)
    res *= 2;
  return res;
}
int main()
{
  vector<int> v;
  map<int, int> m;
  int i, n, tmp, max;

  cin >> n;
  for (i = 0; i < n; i++)
  {
    scanf("%d", &tmp);
    v.push_back(tmp);
    m[tmp]++;
  }
  sort(v.begin(), v.end(), greater<int>());
  int ans = 0;
  for (i = 0; i < n; i++)
  {
    if (m[v[i]] == 0)
    {
      continue;
    }

    int hoge = beki(v[i]) - v[i];
    m[v[i]]--;
    if (m.count(hoge) && m[hoge] != 0)
    {
      ans++;
      m[hoge]--;
    }
  }
  cout << ans;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:26:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   26 |   sort(v.begin(), v.end(), greater<int>());
      |   ^~~~
      |   short
Language: C++

#include<bits/stdc++.h>
using namespace std;
map<int,int>vis;
int n,ans,k,a[200005];
int tmp[50]={1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768,65536,131072,262144,524288,1048576,2097152,4194304,8388608,16777216,33554432,67108864,134217728,268435456,536870912,1073741824};
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		vis[a[i]]++;
	}
	sort(a+1,a+n+1);
	for(int i=n;i>=1;i--)
	{
		int pos=upper_bound(tmp,tmp+30,a[i])-tmp;
		k=tmp[pos]-a[i];
		if(k!=a[i]&&vis[k])||k==a[i]&&vis[k]>1&&pos!=31&&vis[a[i]])
		{
			ans++;
			vis[k]--;
			vis[a[i]]--;
		}
	}
	printf("%d\n",ans);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:36: error: expected primary-expression before '||' token
   19 |                 if(k!=a[i]&&vis[k])||k==a[i]&&vis[k]>1&&pos!=31&&vis[a[i]])
      |                                    ^~
Language: C

#include <stdio.h>
#include <stdlib.h>

#define IS_SQUARE(d) (((d) & ((d) - 1)) == 0)

int compare_int(const void *a, const void *b)
{
	// 降順 
	return *(int *) b - *(int *) a;
}

int main(int argc, char *argv[])
{
	int n, i, c;
	int j;
	int a[200000];
	
	int x, y;
	int l_x, l_y;
	
	scanf("%d", &n);

	for (i = 0; i < n; i++) {
		scanf("%d", &a[i]);
	}
	
	qsort(a, n, sizeof(int), compare_int);

	c = 0;
	l_x = 0;
	l_y = 0;

	for (i = 0; i < n; i++) {
		x = a[i];
		if (x == 0) {continue;}
		j = i + 1;
		if (l_x == x)&&(l_y > i) {
			j = l_y + 1;
		}
		for (; j < n; j++) {
			y = a[j];
			if (y == 0) {continue;}
			if (IS_SQUARE(x + y)) {
				a[j] = 0;
				c++;
				break;
			}
		}
		l_x = x;
		l_y = j;
	}

	printf("%d\n", c);
	
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:37:32: error: expected identifier before '(' token
   37 |                 if (l_x == x)&&(l_y > i) {
      |                                ^
Language: C++

#include <iostream>
#include <algorithm>
#include <map>
#include <vector>
#include <queue>
#include <utility>
using namespace std;
#define ll long long

ll two[32];

void init () {
  two[0] = 1;
  for (ll i = 1; i <= 31; i++) {
    two[i] = two[i - 1] * 2;  
  }  
}

int main () {
  init();  
  map<ll, queue<ll> > box;
  ll n;
  cin >> n;
  ll a[n];
  for (ll i = 0; i < n; i++) {
    cin >> a[i];
    for (int j = 1; j <= 31; j++) {
      ll sub = two[j] - a[i];
      if (box[sub].empty() == false) {
        ll subsub = box[sub].top();
        box[sub].pop();
        if (box[sub].empty()) {
          box[sub].push(subsub);  
        }
      }  
    }
    box[a[i]].push(i);
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:30:30: error: 'std::map<long long int, std::queue<long long int> >::mapped_type' {aka 'class std::queue<long long int>'} has no member named 'top'; did you mean 'pop'?
   30 |         ll subsub = box[sub].top();
      |                              ^~~
      |                              pop
Language: C++

#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
#include <cmath>
#define int long long
using namespace std;

int N, i, j, ans;
vector<int> A;
map<int, int> cntA;
int pow2s[33];

int main(void) {
    pow2s[0] = 1;
    for (i=1; i<=32; i++) {
        pow2s[i] = pow2s[i-1] * 2;
    }
    cin >> N;
    int tmp;
    for (i=0; i<N; i++) {
        cin >> tmp;
        A.push_back(tmp);
        cntA[tmp]++;
    }
    sort(A.begin(), A.end());
    reverse(A.begin(), A.end());
    
    ans = 0;
    for (i=0; i<A.size(); i++) {
        //まず，作れる２べきを探す
        for (j=0; j<32; j++) {
            if (pow2s[j] <= A[i] && A[i] < pow2s[j+1]) {
                break;
            }
        }
        //このとき，pow2s[j+1]が作れる２べき
        int pair_num = pow2s[j+1] - A[i];
        cntA[A[i]]--;
        if (cntA[pair_num] > 0) { //ペアがある
            cntA[pair_num]--;
            ans++;
        }
    }
    cout << ans << endl;
    
    return 0;
}


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

#include <cstdio>
#include <math.h>
#include <algorithm>
 
const int MAX_N = 200000;
 
long long int p[MAX_N];

long long int c = 0;
int n = 0;
long long int ret = 0;
int lowid, midid, highid;
long long int target = 0;

long long int nearPow = 1;

int find = 0;
 
void quickSort(long long int numbers[], int array_size) {
  std::sort(numbers, numbers + array_size);
}

void erase(int *ptr, int *last) {
  while ( ++ptr < last ) {
    *(ptr - 1) = *ptr;
  }
}

void solve(int x) {
  if (x > 0){
    if ((p[x - 1] & (p[x - 1] - 1)) == 0) {
      if (p[x - 2] == p[x - 1]) {
        c += 1;
        solve(x - 2);
      } else {
        solve(x - 1);
      }
    } else if (p[x-1] % 2 == 0) {
      nearPow = pow(2.0, (floor(log2(p[x - 1] - 1)) + 1.0));
      target = nearPow - p[x - 1];
  
      highid = x;
      lowid = 0;
      find = 0;

      while (lowid <= highid) {
        midid = (lowid + highid) / 2;
        if (p[midid] == target) {
          while (p[midid] == p[midid - 1]) {
            midid -= 1;
          }
          c += 1;
          find = 1;
          break;
        } else if (p[midid] < target) {
          lowid = midid + 1;
        } else {
          highid = midid - 1;
        }
      }
      if (find == 1) {
        p.erase(p.begin() + midid);
        solve(x - 2);
      } else {
        solve(x - 1);
      }
    }
  }
}
 
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%lld", &p[i]);
  }
  for (int i = 0; i < n; i++) {
    p[i] *= 2;
  }
  quickSort(p, n);
  solve(n);
  printf("%lld\n", c);
 
  return 0;
}


Compiler output:
a.cc: In function 'void solve(int)':
a.cc:62:11: error: request for member 'erase' in 'p', which is of non-class type 'long long int [200000]'
   62 |         p.erase(p.begin() + midid);
      |           ^~~~~
a.cc:62:19: error: request for member 'begin' in 'p', which is of non-class type 'long long int [200000]'
   62 |         p.erase(p.begin() + midid);
      |                   ^~~~~
Language: C++

#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cctype>
#include<algorithm>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<cstring>
//#include<windows.h>
//#include<time.h>
#define pb push_back
#define fi first
#define se second
#define mer make_pair
#define mme memset
using namespace std;

const double pie1=3.1415926;//π1
const double pie2=3.14159265358979;//π2
const double pie3=3.14159265358979323846;//π3
const int vbi=999999999;
const int vli=-vbi;
const long long vbl=999999999999999999;
const long long vll=-vbl;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<pii,int> piii;
typedef pair<pii,pii> pi4;
typedef pair<pll,ll> plll;
typedef pair<int,pii> ipii;
typedef pair<ll,pll> lpll;
typedef pair<pll,pll> pl4;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpi;
typedef vector<pll> vpl;
typedef set<int> sti;
typedef set<ll> stl;
typedef set<pii> spi;
typedef set<pll> spl;
priority_queue<int> pqi;
priority_queue<ll> pql;
queue<int> qi;
queue<ll> ql;

void bin_v(){
	char bin[1000];
	gets(bin);
}

bool pss(int a){
	for(int i=2;i<=sqrt(a);i++)
		if(a%i==0)
			return false;
	return true;
}
/////////////////////////////////////////////////////////////////////////////////////////
vector<ll> cf;
map<ll,int> mp;

void make_cf(){
	ll sum=1;
	for(int i=1;i<=31;i++){
		sum*=2;
		cf.pb(sum);
	}
}

int main(){
	//my name is Veex
	make_cf();
	ios::sync_with_stdio(false);
	int n;
	cin>>n;
	ll a[n+10];
	for(int i=1;i<=n;i++){
		cin>>a[i];
		mp[a[i]]++;
	}
	sort(a+1,a+n+1);
	reverse(a+1,a+n+1);
	int sum=0;
	for(int i=1;i<=n;i++){
		if(mp[a[i]]<=0)
			continue;
		int x=*upper_bound(cf.begin(),cf.end(),a[i]);
		x=x-a[i];
//		cout<<a[i]<<' '<<x<<endl;
		if((x==a[i]&&mp[x]>=2)||(x!=a[i]&&mp[x]>=1)){
			mp[x]--;
			mp[a[i]]--;
			sum++;
		}
		else
			mp[a[i]]--;
	}
	cout<<sum;
	return 0;
}


Compiler output:
a.cc: In function 'void bin_v()':
a.cc:53:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
   53 |         gets(bin);
      |         ^~~~
      |         getw
Language: C++

#include<bits/stdc++.h>
using namespace std;
inline bool cmp(int &a,int &b){
	return a>b;
}
int main(){
	map<int,int>mp;vector<int>num;
	int n;cin>>n;num.resize(n);
	int ans=0;
	for(int i=0;i<n;i++){
		cin>>num[i];
	}
	sort(num.begin(),num.end(),cmp);
	for(int i=0;i<n;i++){
		mp[num[i]]++;
	}
	for(int i=0;i<n;i++){
		if(mp[num[i]]==0)continue;
		int t=1;
		for(;num[i]=>t;){
			t<<=1;
		}
		if(mp[t-num[i]]==0){
			continue;
		}
		mp[t-num[i]]--;
		ans++;
	}
	cout<<ans<<endl;
	return 0;
} 
/*
3
1 2 3

5
3 11 14 5 13
*/

Compiler output:
a.cc: In function 'int main()':
a.cc:20:29: error: expected primary-expression before '>' token
   20 |                 for(;num[i]=>t;){
      |                             ^
Language: C++

#include<bits/stdc++.h>
#define mp make_pair
#define pb push_back
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int > vi;
typedef pair<int ,int > pii;
typedef vector<pii> vii;
const int inf=0x3f3f3f3f, maxn=1000007, mod=1e9+7;
const ll linf=0x3f3f3f3f3f3f3f3fLL;
const ll P=19260817;
ll h[maxn];
map<long long  ,int > cnt;
ll a[maxn];
int n,ans;
int main(){
	h[0]=1;
	for(int i=1;i<=31;i++)h[i]=h[i-1]*2LL;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)scanf("%lld",&a[i]),cnt[a[i]]++;
	sort(a+1,a+n+1);
	for(int i=n;i>=1;i--){
		for(int j=1;j<=30;j++){
				if(cnt[h[j+1]-a[i]]>0){
					ans++,cnt[a[i]]--,cnt[h[1+j]-a[i]]--;
					break;
				}
			}
		}
	}
	printf("%d\n",ans);
    return 0;
}


Compiler output:
a.cc:32:15: error: expected constructor, destructor, or type conversion before '(' token
   32 |         printf("%d\n",ans);
      |               ^
a.cc:33:5: error: expected unqualified-id before 'return'
   33 |     return 0;
      |     ^~~~~~
a.cc:34:1: error: expected declaration before '}' token
   34 | }
      | ^
Language: C++

#include<bits/stdc++.h>
#define mp make_pair
#define pb push_back
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int > vi;
typedef pair<int ,int > pii;
typedef vector<pii> vii;
const int inf=0x3f3f3f3f, maxn=1000007, mod=1e9+7;
const ll linf=0x3f3f3f3f3f3f3f3fLL;
const ll P=19260817;
ll h[maxn];
map<long long  ,int > cnt;
ll a[maxn];
int n,ans;
int main(){
	h[0]=1;
	for(int i=1;i<=31;i++)h[i]=h[i-1]*2LL;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)scanf("%d",&a[i]),cnt[a[i]]++;
	sort(a+1,a+n+1);
	for(int i=n;i>=1;i--){
		for(int j=1;j<=30;j++){
				if(cnt[h[j+1]-a[i]]>0){
					ans++,cnt[a[i]]--,cnt[h[1+j]-a[i]]--;
					break;
				}
			}
		}
	}
	printf("%d\n",ans);
    return 0;
}


Compiler output:
a.cc:32:15: error: expected constructor, destructor, or type conversion before '(' token
   32 |         printf("%d\n",ans);
      |               ^
a.cc:33:5: error: expected unqualified-id before 'return'
   33 |     return 0;
      |     ^~~~~~
a.cc:34:1: error: expected declaration before '}' token
   34 | }
      | ^
Language: C++

#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cctype>
#include<algorithm>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<cstring>
//#include<windows.h>
//#include<time.h>
#define pb push_back
#define fi first
#define se second
#define mer make_pair
#define mme memset
using namespace std;

const double pie1=3.1415926;//π1
const double pie2=3.14159265358979;//π2
const double pie3=3.14159265358979323846;//π3
const int vbi=999999999;
const int vli=-vbi;
const long long vbl=999999999999999999;
const long long vll=-vbl;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<pii,int> piii;
typedef pair<pii,pii> pi4;
typedef pair<pll,ll> plll;
typedef pair<int,pii> ipii;
typedef pair<ll,pll> lpll;
typedef pair<pll,pll> pl4;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpi;
typedef vector<pll> vpl;
typedef set<int> sti;
typedef set<ll> stl;
typedef set<pii> spi;
typedef set<pll> spl;
priority_queue<int> pqi;
priority_queue<ll> pql;
queue<int> qi;
queue<ll> ql;

void bin_v(){
	char bin[1000];
	gets(bin);
}

bool pss(int a){
	for(int i=2;i<=sqrt(a);i++)
		if(a%i==0)
			return false;
	return true;
}
/////////////////////////////////////////////////////////////////////////////////////////
map<int,int> mp;
vector<int> cf;

void make_cf(){
	int sum=1;
	for(int i=1;i<=31;i++){
		sum*=2;
		cf.pb(sum);
	}
}

int main(){
	//my name is Veex
	ios::sync_with_stdio(false);
	make_cf();
	int n;
	cin>>n;
	int a[n+10];
	for(int i=1;i<=n;i++){
		cin>>a[i];
		mp[a[i]]++;
	}
	int sum=0;
	for(int i=1;i<=n;i++){
		if(mp[a[i]]<=0)
			continue;
		int x=*upper_bound(cf.begin(),cf.end(),a[i]);
		x-=a[i];
//		cout<<x<<endl;
		if((x==a[i]&&mp[x]>=2)||(x!=a[i]&&mp[x]>0)){
			mp[x]--;
			mp[a[i]]--;
			sum++;
		}
	}
	cout<<sum;
	return 0;
}

Compiler output:
a.cc: In function 'void bin_v()':
a.cc:53:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
   53 |         gets(bin);
      |         ^~~~
      |         getw
Language: C++

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define MM = 1000000000;
#define mod = MM + 7;
#define INF (ll)1e18
#define pi acos(-1.0)
#define MAX 100005
#define NIL -1
#define REP(i, n) for(int (i) = 0; (i < (int)(n)); (i)++)
int main(){
    vector<int> v;
    map<int, int> m;
    int n; cin >> n;
    REP(i, n){
        int a; cin >> a;
        m[a]++;
        v.push_back(a);
    }
    sort(v.begin(), v.end());
    reverse(v.begin(), v.end());
    ll ans = 0; 
    REP(i, n){
        ll a = v[i];
        if(m[a] != 0){
            ll b = 1;
            while(b < a)[
                b *= 2;
            ]
            if(b == a){
                if(m[a] >= 2){
                    m[a] -= 2;
                    ans++;
                }
            } else {
                ll c = b -a;
                if(m[c] != 0){
                    m[a]--;
                    m[c]--;
                    ans++;
                }
            }
        }
    }
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:18: error: expected ',' before '*=' token
   28 |                 b *= 2;
      |                  ^~~
      |                  ,
a.cc:28:19: error: expected identifier before '*=' token
   28 |                 b *= 2;
      |                   ^~
a.cc:28:23: error: expected ']' before ';' token
   28 |                 b *= 2;
      |                       ^
      |                       ]
a.cc: In lambda function:
a.cc:28:23: error: expected '{' before ';' token
a.cc: In function 'int main()':
a.cc:29:13: error: expected primary-expression before ']' token
   29 |             ]
      |             ^
a.cc:35:15: error: expected '}' before 'else'
   35 |             } else {
      |               ^~~~
a.cc:25:22: note: to match this '{'
   25 |         if(m[a] != 0){
      |                      ^
a.cc:36:24: error: 'b' was not declared in this scope
   36 |                 ll c = b -a;
      |                        ^
a.cc: At global scope:
a.cc:45:5: error: 'cout' does not name a type
   45 |     cout << ans << endl;
      |     ^~~~
a.cc:46:1: error: expected declaration before '}' token
   46 | }
      | ^
Language: C++

#include<iostream>
#include<map>
using namespace std;
const int N = 2e5 + 10;

long long a[N],n;
long long p[40];
map<long long,int> vis;
int main(){
    scanf("%lld",&n);
    p[0] = 1;
    int tmp = 0;
    while(p[tmp]<=1e9){
        tmp++;
        p[tmp] = p[tmp-1]*2;
    }
    p[tmp+1] = p[tmp]*2;

    for(int i=0;i<n;i++){
        scanf("%lld",&a[i]);
        vis[a[i]]++;
    }
    ll ans = 0;
    for(map<long long,int>::iterator it=vis.end();it!=vis.begin();it--){
        if(it->second == 0)continue;
        it->second--;
        int tt = 0;
        while(p[tt] <= it->first)tt++;
        if(vis[p[tt] - it->first] != 0){
            vis[p[tt] - it->first]--;
            ans++;
        }
    }
    printf("%lld\n",ans);
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:5: error: 'll' was not declared in this scope
   23 |     ll ans = 0;
      |     ^~
a.cc:31:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   31 |             ans++;
      |             ^~~
      |             abs
a.cc:34:21: error: 'ans' was not declared in this scope; did you mean 'abs'?
   34 |     printf("%lld\n",ans);
      |                     ^~~
      |                     abs
Language: C++

#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <list>

using namespace std;
long long main()
{
    long long N;
    cin >> N;
    std::vector<long long> v;

    for (long long i = 0; i < N; i++)
    {
        long long tmp;
        cin >> tmp;
        v.push_back(tmp);
    }
    sort(v.begin(), v.end());

    long long ans = 0;

    /*
    std::cout
        << std::boolalpha
        << std::binary_search(v.begin(), v.end(), 3, greater<long long>())
        << std::endl;
        */

    while (!v.empty())
    {
        long long pairOne = v.back();
        v.pop_back();
        long long pairTwo;

        if (v.empty())
        {
            break;
        }

        for (long long j = 2;; j *= 2)
        {
            if (j > pairOne)
            {
                pairTwo = j - pairOne;
                break;
            }
        }
        auto iter = lower_bound(v.begin(), v.end(), pairTwo);
        if (*iter == pairTwo)
        {
            v.erase(iter);
            ans++;
        }
    }

    cout << ans << endl;
}

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

#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <cstdio>
#include <multiset>
using namespace std;

const int MAX_N = 2e5+10;
int a[MAX_N];

void solve()
{
	sort(a, a+N);
	int ans = 0;
	multiset<int> have;
	for(int i=0;i<N;++i) have.emplace(a[i]);
	while(!have.empty()){
		long long biggest = *have.rbegin();
		have.erase(have.rbegin());
		long long sum = 1;
		while(sum <= biggest) sum <<= 1;
		auto it = have.find(sum-biggest);
		if(it != have.end()){
			ans++;
			have.erase(it);
		}
	}
	cout << ans << endl;
}

int main()
{
	cin >> N;
	for(int i=0;i<N;++i) cin >> a[i];
	solve();
	return 0;
}

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

#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int main(){
        long long n,j,target, vi, c=0;
        cin >> n;
        vector<long long> v(n,0);
        vector<bool> u(n,false);
        for(long long i=0;i<n;i++) cin>>v[i];
        sort(v.begin(), v.end());
        for(long long i=n-1;i>0;i--){
                if(u[i]) continue;
                u[i] = true;
                vi = v[i]
                for(target=(1<<30);;target/=2){
                        if(target>2*vi) continue;
                        if(target<=vi) break;
                        j=0;
                        while(j<i&&(v[j]+vi<target||u[j])) j++;
                        if(vi+v[j]==target&&!u[j]&&j<i){
                                c++;
                                u[j]=true;
                                break;
                        }
                }
        }
        cout<<c<<endl;
        return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:26: error: expected ';' before 'for'
   15 |                 vi = v[i]
      |                          ^
      |                          ;
   16 |                 for(target=(1<<30);;target/=2){
      |                 ~~~       
a.cc:16:46: error: expected ';' before ')' token
   16 |                 for(target=(1<<30);;target/=2){
      |                                              ^
      |                                              ;
Language: C++

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

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin>>n;
	long long v[n+10];
	for(int i=0;i<n;i++)
	cin>>v[i];
	sort(v.begin(),v.end());
	multiset<long long> ssi;
	for(int i=0;i<n;i++)
	{
	    ssi.insert(v[i]);
	}
	int res=0;
	while(!ssi.empty())
	{
	    long long x=*ssi.rbegin();
	   
	   while (!ssi.empty()) {
		long long x = *ssi.rbegin();
		ssi.erase(ssi.find(x));
		long long now = 1;
		while (now <= x)
			now *= 2;
		auto it = ssi.find(now - x);
		if (it == ssi.end())
			continue;
		ssi.erase(it);
		++res;
	}
	}
	cout<<res<<'\n';
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:16: error: request for member 'begin' in 'v', which is of non-class type 'long long int [(n + 10)]'
   12 |         sort(v.begin(),v.end());
      |                ^~~~~
a.cc:12:26: error: request for member 'end' in 'v', which is of non-class type 'long long int [(n + 10)]'
   12 |         sort(v.begin(),v.end());
      |                          ^~~
Language: C++

// you can use includes, for example:
// #include <algorithm>

// you can write to stdout for debugging purposes, e.g.
// cout << "this is a debug message" << endl;



#include<stdio.h>
#include<bits/stdc++.h>
#include<iostream>
bool isPowerOfTwo(int n) 
{ 
   return (ceil(log2(n)) == floor(log2(n))); 
}

void temp(){
  int a;
  std::cin>>a;
  //int * Numbers=(int*)calloc(a,sizeof(int));
  std::vector<int> odd,even;
  for(int i=0;i<a;i++){
    int temp;
    std::cin>>temp;
    if(temp%2==0){
      even.push_back(temp);
    }
    else{
      odd.push_back(temp);
    }
  }
  int oddSize,evenSize;
  int count=0;
  oddSize=odd.size();
  evenSize=even.size();
  int loopSize=evenSize>oddSize?evenSize:oddSize;
  
  
  for(int i=0;i<loopSize;i++){
    for(int j=i+1;j<loopSize;j++){
      if(i<oddSize &&j<oddSize){
        bool oddPow2=isPowerOfTwo(odd[i]+odd[j]);
        if(oddPow2){
          count++;
        }
      }
      if(i<evenSize&&j<evenSize){
        bool oddPow2=isPowerOfTwo(even[i]+even[j]);
        if(oddPow2){
          count++;
        }
      }
      
      
      
    }
  }
}

Compiler output:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

#include<stdio.h>
#include<iostream>
#include<stdlib>
bool isPowerOfTwo(int n) 
{ 
   return (ceil(log2(n)) == floor(log2(n))); 
} 


int main(){
  int a;
  std::cin>>a;
  //int * Numbers=(int*)calloc(a,sizeof(int));
  std::vector<int> Odd,even;
  for(int i=0;i<a;i++){
    int temp;
    std::cin>>temp;
    if(temp%2==0){
      even.push_back(temp);
    }
    else{
      odd.push_back(temp);
    }
  }
  int oddSize,evenSize;
  int count=0;
  oddSize=odd.size();
  evenSize=even.size();
  int loopSize=evenSize>oddSize?evenSize:oddSize;
  
  
  for(int i=0;i<loopSize;i++){
    for(int j=i+1;j<loopSize;j++){
      if(i<oddSize &&j<oddSize){
        bool oddPow2=isPowerOfTwo(odd[i]+odd[j]);
        if(oddPow2){
          count++;
        }
      }
      if(i<evenSize&&j<evenSize){
        bool oddPow2=isPowerOfTwo(even[i]+even[j]);
        if(oddPow2){
          count++;
        }
      }
      
      
      
    }
  }
}

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

#include <cstdio>
#include <math.h>
#include <set>
#include <algorithm>
 
const int MAX_N = 200000;
 
long long int p[MAX_N];

long long int c = 0;
int n = 0;
long long int ret = 0;
int lowid, midid, highid;
long long int target = 0;

long long int nearPow = 1;

int find = 0;
 
void quickSort(long long int numbers[], int array_size) {
  std::sort(numbers, numbers + array_size)
}

void solve(int x) {
  if (x > 0){
    if ((p[x - 1] & (p[x - 1] - 1)) == 0) {
      if (p[x - 2] == p[x - 1]) {
        c += 1;
        solve(x - 2);
      } else {
        solve(x - 1);
      }
    } else {
      nearPow = pow(2.0, (floor(log2(p[x - 1] - 1)) + 1.0));
      target = nearPow - p[x - 1];
  
      highid = x;
      lowid = 0;
      find = 0;

      while (lowid <= highid) {
        midid = (lowid + highid) / 2;
        if (p[midid] == target) {
          c += 1;
          find = 1;
          break;
        } else if (p[midid] < target) {
          lowid = midid + 1;
        } else {
          highid = midid - 1;
        }
      }
      if (find == 1) {
        for (int i = midid; i < x; i++) {
          p[i] = p[i + 1];
        }
        solve(x - 2);
      } else {
        solve(x - 1);
      }
    }
  }
}
 
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%lld", &p[i]);
  }
  quickSort(p, n);
  solve(n);
  printf("%lld\n", c);
 
  return 0;
}


Compiler output:
a.cc: In function 'void quickSort(long long int*, int)':
a.cc:21:43: error: expected ';' before '}' token
   21 |   std::sort(numbers, numbers + array_size)
      |                                           ^
      |                                           ;
   22 | }
      | ~
Language: C++

#include <iostream>
#include <cstdint>
#include <vector>
#include <set>

using namespace std;
typedef std::multiset<uint64_t> S;

uint64_t target(uint64_t x) {
  int b = 0;
  uint64_t temp = x;
  while(temp > 0) {
    temp = temp >> 1;
    b++;
  }
  return (1ull << (b)) - x;
}

S read() {
  uint64_t N;
  cin >> N;

  S s;
  for(uint64_t i=0; i<N; i++) {
    uint64_t x;
    cin >> x;
    s.insert(x);
  }

  return std::move(s);
}

int solve(S& s) {
  int num_pairs = 0;
  while(s.size() > 0) {
    auto last = s.end();
    last--;
    uint64_t t = target(*last);
    s.erase(last);
    auto found = s.find(t);
    if( found != s.end() ) {
      num_pairs++;
      s.erase(found);
    }
  }
  return num_pairs;
}

void test() {
  S s = {1,2,3};
  assert(solve(s)==1);

  S s2 = {3,11,14,5,13};
  assert(solve(s2)==2);

  S s3 = {1,1,3,7};
  assert(solve(s3) == 2);

  S s4 = {8,8,8,8};
  assert(solve(s4) == 2);

  S s5 = {1,9,5};
  assert(solve(s5) == 0);

  S s6 = {1,3,7,15};
  assert(solve(s6) == 1);
}

int main() {
  S s = read();
  int r = solve(s);
  cout << r << endl;

  return 0;
}



Compiler output:
a.cc: In function 'void test()':
a.cc:51:3: error: 'assert' was not declared in this scope
   51 |   assert(solve(s)==1);
      |   ^~~~~~
a.cc:5:1: note: 'assert' is defined in header '<cassert>'; this is probably fixable by adding '#include <cassert>'
    4 | #include <set>
  +++ |+#include <cassert>
    5 |
Language: C++

#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <list>
using std::list;

int main() {
	int N;
	scanf("%d", &N);

	int* A = new int[N];
	for (int i = 0; i < N; i++) {
		scanf("%d", &A[i]);
	}

	int ans = 0;
	//list<int>** AKouho = new list<int>*[N];
	//for (int i = 0; i < N; i++) {
	//	AKouho[i] = NULL;
	//}

	// 調査対象
	for (int i = 0; i < N; i++) {
		// 相手
		for (int j = 0; j < N; j++) {
			if (i != j) {
				// 調査するべき数
				int n = A[i] + A[j];
				if ((n & (n - 1)) == 0) {
					//if (AKouho[i] == NULL) AKouho[i] = new list<int>;
					//AKouho[i]->push_back(A[j]);
					ans++;
				}
			}
		}
	}

	//int max = 0;
	//for (int i = 0; i < N; i++) {
	//	if (AKouho[i] == NULL) continue;
	//	int size = AKouho[i]->size();
	//	if (size > max) max = size;
	//}

	int ans = 0;
	//for (int i = 0; i < N; i++) {
	//	if (AKouho[i] == NULL) continue;
	//	int size = AKouho[i]->size();
	//	if (size > 0) ans++;
	//}
	printf("%d\n", ans / 2);

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:45:13: error: redeclaration of 'int ans'
   45 |         int ans = 0;
      |             ^~~
a.cc:16:13: note: 'int ans' previously declared here
   16 |         int ans = 0;
      |             ^~~
Language: C++

#include <bits/stdc++.h>
// statics
using namespace std;
using int64 = int_fast64_t;
using PAIR = pair<int64, int64>;
constexpr int64 INF = 1LL << 40 - 1;
constexpr int64 LINF = 1LL << 60 + 1;
constexpr int MOD = 1e9 + 7;
constexpr int MAX_N = 1e5 + 1;

// init/input
#define int int64
#define INIT ios::sync_with_stdio(false);cin.tie(0);
#define VAR(type, ...) type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__);
template<typename T> void MACRO_VAR_Scan(T &t) {cin>>t;}
template<typename First, typename...Rest> void MACRO_VAR_Scan(First &first, Rest&...rest) {cin>>first;MACRO_VAR_Scan(rest...);}
#define VEC(type, c, n) vector<type> c(n);for(auto &&i:c)cin>>i;

// out
#define OUT(dist) cout<<(dist);
#define FOUT(n, dist) cout<<fixed<<setprecision(n)<<(dist);
#define SP cout<<" ";
#define BR cout<<endl;
#define zero(n) cout<<setfill('0')<<right<<setw(n)
#define debug(x) cerr<<#x<<":"<< (x);BR;

// utility
#define ALL(a) (a).begin(), (a).end()
#define EACH(i, a) for(auto &&i:(a))
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RFOR(i, a, b) for(int i=(b)-1;i>=0;--i)
#define REP(i, n) for(int i=0;i<(n);++i)
#define RREP(i, n) for(int i=(n)-1;i>=0;--i)


signed main() {
  INIT;
	VAR(int, n);
	map< int, int > mp;
	vector< int > a;
	REP(i, n) {
		VAR(int, j);
		a.push_back(j);
		mp[j]++;
	}

	sort(ALL(a));
	a.erase(unique(ALL(a)), a.end());

	int ans = 0;
	RREP(i, a.size()) {
		RREP(j, 31) {
            if (!mp.count(target) || !mp.count(a[i])) break;
			int target = (1 << j) - a[i];
			if (target == a[i]) {
				int tmp = mp[target] / 2;
				mp[target] -= tmp * 2;
				ans += tmp;
			} else {
				int tmp1 = mp[target];
				int tmp2 = mp[a[i]];
				mp[target] -= min(tmp1, tmp2);
				mp[a[i]] -= min(tmp1, tmp2);
				ans += min(tmp1, tmp2);
			}
		}
	}

	OUT(ans)BR;
  
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:53:27: error: 'target' was not declared in this scope
   53 |             if (!mp.count(target) || !mp.count(a[i])) break;
      |                           ^~~~~~
Language: C++

import java.util.*;

// Do not use int, use long!!

public class Main {
	public static void main(String args[]){
			Scanner sc = new Scanner(System.in);
			
			int n = sc.nextInt();  // n <= 2e5 so cannot N^2
			ArrayList<Integer> numbers = new ArrayList<Integer>();
			int counter = 0;
			for (int i = 0; i < n; i++) {
				numbers.add(sc.nextInt());
			}
			
			Collections.sort(numbers);

			while (numbers.size() >= 2) {
				int tmp = 0;
				for (int i = numbers.size()-2; i >= 0 ; i--) {
					if (nibeki(numbers.get(numbers.size()-1),numbers.get(i))) {
						numbers.remove(i);
						numbers.remove(numbers.size()-1);
						counter++;
						tmp++;
						break;
					}
				}
				if (tmp == 0) {
					numbers.remove(numbers.size()-1);
				}
				tmp = 0;
			}
			System.out.println(counter);
			sc.close();
		}
	
		public static boolean nibeki(int a, int b) {
			int c = a+b;
			while (c%2 == 0) {
				c = c/2;
			}
			if (c == 1) {
				return true;
			} else {
				return false;
			}
		}

}


Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.*;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:5:1: error: expected unqualified-id before 'public'
    5 | public class Main {
      | ^~~~~~
Language: C

#include<stdio.h>

long buffer[10000000];
int judge(long x){
    while(x>1){
        if (x%2 != 0)return 0;
        x/=2;
    }
    return 1;
}
void merge(long a[],long left,long right){
    if(left<right){
        long axis=(left+right)/2,i=left,p=0,q=left,r=0;
        merge(a,left,axis);
        merge(a,axis+1,right);
        while(i<=axis)buffer[p++]=a[i++];
        while(i<=right && r<p)a[q++]=(a[i]>=buffer[r])?a[i++]:buffer[r++];
        while(r<p)a[q++]=buffer[r++];
    }
}

int main(void){
    long c=0;
    long a[N];
    for(int i=0;i<N;i++)a[i]=i;
    merge(a,0,N-1);
    for(int i=0;i<N-1;i++){
        for(int j=N-1;j>i;j--){
            if(a[i]!=-1 && a[j]!=-1){
                if(judge(a[i]+a[j])==1){
                    a[i]=-1;
                    a[j]=-1;
                    c++;
                    break;
                }
            }
        }
    }
    printf("%ld\n",c);
    return 0;
}





Compiler output:
main.c: In function 'main':
main.c:24:12: error: 'N' undeclared (first use in this function)
   24 |     long a[N];
      |            ^
main.c:24:12: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#include <bits/stdc++.h>
using namespace std;
using int64 = int_fast64_t;
using PAIR = pair<int64, int64>;
constexpr int64 INF = 1LL << 40 - 1;
constexpr int64 LINF = 1LL << 60 + 1;
constexpr int MOD = 1e9 + 7;
constexpr int MAX_N = 1e5 + 1;
 
// init/input
#define int int64
#define INIT ios::sync_with_stdio(false);cin.tie(0);
#define VAR(type, ...) type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__);
template<typename T> void MACRO_VAR_Scan(T &t) {cin>>t;}
template<typename First, typename...Rest> void MACRO_VAR_Scan(First &first, Rest&...rest) {cin>>first;MACRO_VAR_Scan(rest...);}
#define VEC(type, c, n) vector<type> c(n);for(auto &&i:c)cin>>i;
 
// out
#define OUT(dist) cout<<(dist);
#define FOUT(n, dist) cout<<fixed<<setprecision(n)<<(dist);
#define SP cout<<" ";
#define BR cout<<endl;
#define zero(n) cout<<setfill('0')<<right<<setw(n)
#define debug(x) cerr<<#x<<":"<< (x);BR;
 
// utility
#define ALL(a) (a).begin(), (a).end()
#define EACH(i, a) for(auto &&i:(a))
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RFOR(i, a, b) for(int i=(b)-1;i>=0;--i)
#define REP(i, n) for(int i=0;i<(n);++i)
#define RREP(i, n) for(int i=(n)-1;i>=0;--i)
 
 
signed main() {
  INIT;
	VAR(int, n);
	map< int, int > mp;
	vector< int > a;
	REP(i, n) {
		VAR(int, j);
		a.push_back(j);
	}
 
	sort(ALL(a));
	a.erase(unique(ALL(a)), a.end());
 
	int ans = 0;
	RREP(i, a.size()) {
		RREP(j, 31) {
            if (2 * a[i] > (1LL << j)) break;

			if (target == a[i]) {
				int tmp = mp[target] / 2;
				mp[target] -= tmp * 2;
				ans += tmp;
			} else {
				int tmp1 = mp[target];
				int tmp2 = mp[a[i]];
				mp[target] -= min(tmp1, tmp2);
				mp[a[i]] -= min(tmp1, tmp2);
				ans += min(tmp1, tmp2);
			}
		}
		mp[a[i]]++;
	}
 
	OUT(ans)BR;
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:53:29: error: 'target' was not declared in this scope
   53 |                         if (target == a[i]) {
      |                             ^~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
using int64 = int_fast64_t;
using PAIR = pair<int64, int64>;
constexpr int64 INF = 1LL << 40 - 1;
constexpr int64 LINF = 1LL << 60 + 1;
constexpr int MOD = 1e9 + 7;
constexpr int MAX_N = 1e5 + 1;
 
// init/input
#define int int64
#define INIT ios::sync_with_stdio(false);cin.tie(0);
#define VAR(type, ...) type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__);
template<typename T> void MACRO_VAR_Scan(T &t) {cin>>t;}
template<typename First, typename...Rest> void MACRO_VAR_Scan(First &first, Rest&...rest) {cin>>first;MACRO_VAR_Scan(rest...);}
#define VEC(type, c, n) vector<type> c(n);for(auto &&i:c)cin>>i;
 
// out
#define OUT(dist) cout<<(dist);
#define FOUT(n, dist) cout<<fixed<<setprecision(n)<<(dist);
#define SP cout<<" ";
#define BR cout<<endl;
#define zero(n) cout<<setfill('0')<<right<<setw(n)
#define debug(x) cerr<<#x<<":"<< (x);BR;
 
// utility
#define ALL(a) (a).begin(), (a).end()
#define EACH(i, a) for(auto &&i:(a))
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RFOR(i, a, b) for(int i=(b)-1;i>=0;--i)
#define REP(i, n) for(int i=0;i<(n);++i)
#define RREP(i, n) for(int i=(n)-1;i>=0;--i)
 
 
signed main() {
  INIT;
	VAR(int, n);
	map< int, int > mp;
	vector< int > a;
	REP(i, n) {
		VAR(int, j);
		a.push_back(j);
	}
 
	sort(ALL(a));
	a.erase(unique(ALL(a)), a.end());
 
	int ans = 0;
	RREP(i, a.size()) {
		RREP(j, 31) {
            if (2 * a[i] + > (1LL << j)) break;

			if (target == a[i]) {
				int tmp = mp[target] / 2;
				mp[target] -= tmp * 2;
				ans += tmp;
			} else {
				int tmp1 = mp[target];
				int tmp2 = mp[a[i]];
				mp[target] -= min(tmp1, tmp2);
				mp[a[i]] -= min(tmp1, tmp2);
				ans += min(tmp1, tmp2);
			}
		}
		mp[a[i]]++;
	}
 
	OUT(ans)BR;
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:51:28: error: expected primary-expression before '>' token
   51 |             if (2 * a[i] + > (1LL << j)) break;
      |                            ^
a.cc:53:29: error: 'target' was not declared in this scope
   53 |                         if (target == a[i]) {
      |                             ^~~~~~
Language: C++

from math import log2
n = int(input())
a = sorted(list(map(int, input().split())))
ans = 0
while a:
    m = a.pop()
    k = (1<<m.bit_length()) - m
    if k in a:
        a.remove(k)
        ans += 1
print(ans)


Compiler output:
a.cc:1:1: error: 'from' does not name a type
    1 | from math import log2
      | ^~~~
Language: C++

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

const int maxn = 2e5+5;

bool b[maxn];
int a[maxn];
int i,j;

int main()
{
  int n;
  
  scanf("%d",&n);

  for(int i=1;i < n;i++) scanf("%d",&a[i]);

  sort(a+1, a+n+1);

  for(int s = 1 << 30; s ;s >> 1){
    j = n;
    for(int i = 1; i < n ;i++){
      if(!b[i])
	for( ; j > i && (a[i] + a[j] > s || b[j]) ;j--){
	  if(a[i] + a[j] == s){
	    b[i] = b[j] = 1;
	    ans++;}
	}
    }
  }
  printf("%d\n",ans);
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   27 |             ans++;}
      |             ^~~
      |             abs
a.cc:31:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   31 |   printf("%d\n",ans);
      |                 ^~~
      |                 abs
Language: C++

#include<iostream>
#include<algorithm>
#include<map>
#include<set>
#include<string>
#include<vector>
using namespace std;
using ll = long long;
using lli = long long int;
ll MM = 1000000000;
ll mod = MM + 7;
#define INF (ll)1e18

ll arr[] = {
    2, 4, 8, 16, 32, 64, 128, 256, 512,
    1024, 2048, 4096, 8192, 16384,
    32768, 65536, 131072, 262144,
    524288, 1048576, 2097152, 4194304,
    8388608, 16777216, 33554432,
    67108864, 134217728, 268435456,
    536870912, 1073741824,
    2147483648, 4294967296
};
signed main(){
    ll n; cin >> n;
    ll a[200001];
    vector<ll> b(n), c(n), d(n), e(n);
    int cnt = 0;
    for(int i = 0; i < n; i++){
        cin >> a[i];
        if(a[i]%2 == 0) b.push_back(a[i]);
        else c.push_back(a[i]);
    }
    for(ll i = 0; i < b.size(); i++){
        for(ll j = 0; j != i && j < b.size(); j++){
            d.push_back(b[i] + b[j]);
        }
    }
    for(ll i = 0; i < c.size(); i++){
        for(ll j = 0; j != i && j < c.size(); j++){
        e.push_back(c[i] + c[j]);
        }
    }
    for(ll i = 0; i < d.size(); i++){
        if(d[i] == arr) cnt++;
    } for(ll i = 0; i < e.size(); i++){
        if(d[i] == arr) cnt++;
    }
    cout << cnt/2 << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:45:17: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   45 |         if(d[i] == arr) cnt++;
a.cc:47:17: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   47 |         if(d[i] == arr) cnt++;
Language: C++

#include<cstdio>
#include<set>
#include<algorithm>
#include<iostream>
#define ll long long
using namespace std;
int n;
ll a[200001];
multiset<ll>s;
ll inv(ll x)
{
    ll t=1;
    while(t<=x) t<<=1;
    return t-x;
}
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++) scanf("%lld",&a[i]);
    sort(a+1,a+1+n);
    int ans=0;
    for(int i=n;i>=1;i--)
    {
        const auto& f=s.find(a[i]);
        if(f!=s.end()) ans++,s.erase(found);
        else s.insert(inv(a[i]));
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:38: error: 'found' was not declared in this scope
   25 |         if(f!=s.end()) ans++,s.erase(found);
      |                                      ^~~~~
Language: C++

#include <iostream>
using namespace std;

int main() {
    int N; scanf("%d", &N);
    int A[N]; for (int i{}; i < N; ++i) scanf("%d", &A[i]);
    bool used[N]; memset(used, 0, sizeof(bool) * N);
    sort(A, A + N, greater<int>());

    int count{};
    for (int i{}; i < N - 1; ++i) {
        if (used[i]) continue;
        for (int j{i+1}; j < N; ++j) {
            if (used[j]) continue;
            int x = A[i] + A[j];
            if (!(x & (x - 1))) {
                used[i] = true;
                used[j] = true;
                ++count;
                break;
            }
        }
    }

    printf("%d\n", count);
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:19: error: 'memset' was not declared in this scope
    7 |     bool used[N]; memset(used, 0, sizeof(bool) * N);
      |                   ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include <iostream>
  +++ |+#include <cstring>
    2 | using namespace std;
a.cc:8:5: error: 'sort' was not declared in this scope; did you mean 'short'?
    8 |     sort(A, A + N, greater<int>());
      |     ^~~~
      |     short
Language: C++

#include <cstdio>
#include <vector>
#include <cmath>

typedef long long ll;

using namespace std;

int main() {
    ll n, ans = 0, pos;
    scanf("%lld", &n);
    vector<ll> a(n);
    for (ll i = 0; i < n; ++i) scanf("%lld", a.begin() + i);
    sort(a.begin(), a.end());
    while (!a.empty()) {
        if (pos = find(a.begin(), a.end() - 1, (1 << (ll)(log2(a.back()))) - a.back()) - a.begin()) {
            ++ans;
            a.erase(a.begin() + pos, a.begin() + pos + 1);
        }
        a.pop_back();
    }
    printf("%lld\n", ans);
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:5: error: 'sort' was not declared in this scope; did you mean 'sqrt'?
   14 |     sort(a.begin(), a.end());
      |     ^~~~
      |     sqrt
a.cc:16:19: error: 'find' was not declared in this scope
   16 |         if (pos = find(a.begin(), a.end() - 1, (1 << (ll)(log2(a.back()))) - a.back()) - a.begin()) {
      |                   ^~~~