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

#include<cstdio>
#include<cctype>
const int maxn=200010,inf=0x7fffffff;
int n;
int a[maxn];
bool v[maxn];
int ans;
int In() {
    register char c;
    for(;c=getchar(),c!='-'&&!isdigit(c););
    register bool f=c=='-';
    register int s=f?0:c-'0';
    for(;c=getchar(),isdigit(c);)s=s*10+c-'0';
    return f?-s:s;
}
int main() {
	n=In();
	for(register int i=1;i<=n;++i)a[i]=In();
	std::sort(a+1,a+n+1);
	for(register int i=30;i>=1;--i) {
		register int l=1,r=n;
		for(register int p=1<<i;l<r;) {
			for(;l<r&&v[r];--r);
			for(;l<r&&a[l]+a[r]<p;++l);
			for(;l<r&&v[l];++l);
			if(l>=r) break
			if(a[l]+a[r]==p) v[l]=v[r]=1,ans+=p,++l,--r;
		}
	}
	printf("%d\n",ans);
	return 0;
}

Compiler output:
a.cc: In function 'int In()':
a.cc:9:19: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
    9 |     register char c;
      |                   ^
a.cc:11:19: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   11 |     register bool f=c=='-';
      |                   ^
a.cc:12:18: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   12 |     register int s=f?0:c-'0';
      |                  ^
a.cc: In function 'int main()':
a.cc:18:26: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   18 |         for(register int i=1;i<=n;++i)a[i]=In();
      |                          ^
a.cc:19:14: error: 'sort' is not a member of 'std'
   19 |         std::sort(a+1,a+n+1);
      |              ^~~~
a.cc:20:26: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   20 |         for(register int i=30;i>=1;--i) {
      |                          ^
a.cc:21:30: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   21 |                 register int l=1,r=n;
      |                              ^
a.cc:21:34: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   21 |                 register int l=1,r=n;
      |                                  ^
a.cc:22:34: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   22 |                 for(register int p=1<<i;l<r;) {
      |                                  ^
a.cc:26:39: error: expected ';' before 'if'
   26 |                         if(l>=r) break
      |                                       ^
      |                                       ;
   27 |                         if(a[l]+a[r]==p) v[l]=v[r]=1,ans+=p,++l,--r;
      |                         ~~
Language: C++

#include<stdio.h>
#include<stdlib.h>
int compare(const void *a,const void *b){
return *(int*)b-*(int*)a;
}
int main(){
int n,a[222222],ans=0,i,j,c[222222],l,r,p;
scanf("%d",&n);
for(i=0;i<222222;i++)
c[i]=0;
for(i=0;i<n;i++){
scanf("%d",&a[i]);
c[a[i]]++;
}
qsort(a,n,sizeof(int),compare);
for(i=0;i<n-1;i++){
if(c[i]>0){
p=1;
while(p<=a[i])
p=p*2;
l=i+1;
r=n-1;
while(1){
j=(l+r)/2;
if(a[i]+a[j]==p){
if(c[j]>0){
ans++;
c[j]--;
}
break;
}
if(l==r)
break;
if(a[i]+a[j]>p){
if(l==j)
l++;
else
l=j;
}
else
r=j;
}
printf("%d\n",ans);
return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:45:2: error: expected '}' at end of input
   45 | }
      |  ^
a.cc:16:19: note: to match this '{'
   16 | for(i=0;i<n-1;i++){
      |                   ^
a.cc:45:2: error: expected '}' at end of input
   45 | }
      |  ^
a.cc:6:11: note: to match this '{'
    6 | int main(){
      |           ^
Language: C++

#include<stdio.h>
#include<stdio.h>
int compare(const void *a,const void *b){
return *(int*)b-*(int*)a;
}
int main(){
int n,a[222222],ans=0,i,j,c[222222],l,r,p;
scanf("%d",&n);
for(i=0;i<222222;i++)
c[i]=0;
for(i=0;i<n;i++){
scanf("%d",&a[i]);
c[a[i]]++;
}
qsort(a,n,sizeof(int),compare);
for(i=0;i<n-1;i++){
if(c[i]>0){
p=1;
while(p<=a[i])
p=p*2;
l=i+1;
r=n-1;
while(1){
j=(l+r)/2;
if(a[i]+a[j]==p){
if(c[j]>0){
ans++;
c[j]--;
}
break;
}
if(l==r)
break;
if(a[i]+a[j]>p){
if(l==j)
l++;
else
l=j;
}
else
r=j;
}
printf("%d\n",ans);
return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:1: error: 'qsort' was not declared in this scope
   15 | qsort(a,n,sizeof(int),compare);
      | ^~~~~
a.cc:45:2: error: expected '}' at end of input
   45 | }
      |  ^
a.cc:16:19: note: to match this '{'
   16 | for(i=0;i<n-1;i++){
      |                   ^
a.cc:45:2: error: expected '}' at end of input
   45 | }
      |  ^
a.cc:6:11: note: to match this '{'
    6 | int main(){
      |           ^
Language: C++

#include<stdio.h>
#include<stdio.h>
int compare(const void *a,const void *b){
return *(int*)b-*(int*)a;
}
int main(){
int n,a[222222],ans=0,i,j,c[222222],l,r,p,i;
scanf("%d",&n);
for(i=0;i<222222;i++)
c[i]=0;
for(i=0;i<n;i++){
scanf("%d",&a[i]);
c[a[i]]++;
}
qsort(a,n,sizeof(int),compare);
for(i=0;i<n-1;i++){
if(c[i]>0){
p=1;
while(p<=a[i])
p=p*2;
l=i+1;
r=n-1;
while(1){
j=(l+r)/2;
if(a[i]+a[j]==p){
if(c[j]>0){
ans++;
c[j]--;
}
break;
}
if(l==r)
break;
if(a[i]+a[j]>p){
if(l==j)
l++;
else
l=j;
}
else
r=j;
}
printf("%d\n",ans);
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:43: error: redeclaration of 'int i'
    7 | int n,a[222222],ans=0,i,j,c[222222],l,r,p,i;
      |                                           ^
a.cc:7:23: note: 'int i' previously declared here
    7 | int n,a[222222],ans=0,i,j,c[222222],l,r,p,i;
      |                       ^
a.cc:15:1: error: 'qsort' was not declared in this scope
   15 | qsort(a,n,sizeof(int),compare);
      | ^~~~~
a.cc:45:2: error: expected '}' at end of input
   45 | }
      |  ^
a.cc:16:19: note: to match this '{'
   16 | for(i=0;i<n-1;i++){
      |                   ^
a.cc:45:2: error: expected '}' at end of input
   45 | }
      |  ^
a.cc:6:11: note: to match this '{'
    6 | int main(){
      |           ^
Language: C++

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

signed main(){
  int N;cin>>N;
  int a;
  map<int,int> m;
  for(int i=0;i<N;i++){
    cin>>a;
    m[a]++;
  }
  int k=1;
  set<int> s;
  for(int i=0;i<35;i++){
    s.emplace(k);
    k*=2;
  }
  int ans=0;
  for(auto p=m.rbegin();p!=m.rend();if((p->second)<=0)p++){
    while((p->second)>0){
      (p->second)--;
      if(m.count(*s.upper_bound(p->first))&& m[*s.upper_bound(p->first)-(p->first)]>0){
        ans++;
        m[*s.upper_bound(p->first)-(p->first)]--;
      }
    }
  }
  cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:37: error: expected primary-expression before 'if'
   20 |   for(auto p=m.rbegin();p!=m.rend();if((p->second)<=0)p++){
      |                                     ^~
a.cc:20:37: error: expected ')' before 'if'
   20 |   for(auto p=m.rbegin();p!=m.rend();if((p->second)<=0)p++){
      |      ~                              ^~
      |                                     )
a.cc:20:58: error: expected ';' before ')' token
   20 |   for(auto p=m.rbegin();p!=m.rend();if((p->second)<=0)p++){
      |                                                          ^
      |                                                          ;
Language: C++

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

signed main(){
  int N;cin>>N;
  int a;
  map<int,int> m;
  for(int i=0;i<N;i++){
    cin>>a;
    m[a]++;
  }
  int k=1;
  set<int> s;
  for(int i=0;i<35;i++){
    s.emplace(k);
    k*=2;
  }
  int ans=0;
  for(auto p=m.rbegin();p!=m.rend();if((p->second)<=0)p++){
    if((p->second)<=0)continue;
    (p->second)--;
    if(m.count(*s.upper_bound(p->first))&& m[*s.upper_bound(p->first)-(p->first)]>0){
      ans++;
      m[*s.upper_bound(p->first)-(p->first)]--;
    }
  }
  cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:37: error: expected primary-expression before 'if'
   20 |   for(auto p=m.rbegin();p!=m.rend();if((p->second)<=0)p++){
      |                                     ^~
a.cc:20:37: error: expected ')' before 'if'
   20 |   for(auto p=m.rbegin();p!=m.rend();if((p->second)<=0)p++){
      |      ~                              ^~
      |                                     )
a.cc:20:58: error: expected ';' before ')' token
   20 |   for(auto p=m.rbegin();p!=m.rend();if((p->second)<=0)p++){
      |                                                          ^
      |                                                          ;
Language: C++

#include<bits/extc++.h>
#define N 500005
using namespace std;
using namespace __gnu_cxx;
hash_map<int,int>mp;
int n,ans,a[N];
int main(){
	scanf("%d",&n);
	for (int i=1;i<=n;i++) scanf("%d",&a[i]),mp[a[i]]++;
	sort(a+1,a+n+1);
	for (int i=n;i;i--){
		for (int j=1;j<=(1<<30);j*=2){
			if (!mp[a[i]]) break;
			int x=j-a[i];
			if (mp[x]){
				if (x==a[i]){
					ans+=mp[a[i]]/2;
					mp[a[i]]%=2;
				}
				else {
					int t=min(mp[a[i]],mp[x]);
					ans+=t;mp[a[i]]-=t;mp[x]-=t;
				}
			}
			if (j==(1<<30)) break;
		}
	}
	printf("%d\n",ans);
	return 0;
}

Compiler output:
a.cc:5:1: error: 'hash_map' does not name a type
    5 | hash_map<int,int>mp;
      | ^~~~~~~~
a.cc: In function 'int main()':
a.cc:9:50: error: 'mp' was not declared in this scope
    9 |         for (int i=1;i<=n;i++) scanf("%d",&a[i]),mp[a[i]]++;
      |                                                  ^~
a.cc:13:30: error: 'mp' was not declared in this scope
   13 |                         if (!mp[a[i]]) break;
      |                              ^~
a.cc:15:29: error: 'mp' was not declared in this scope
   15 |                         if (mp[x]){
      |                             ^~
Language: C++

#include<bits/extc++.h>
#define N 500005
using namespace std;
hash_map<int,int>mp;
int n,ans,a[N];
int main(){
	scanf("%d",&n);
	for (int i=1;i<=n;i++) scanf("%d",&a[i]),mp[a[i]]++;
	sort(a+1,a+n+1);
	for (int i=n;i;i--){
		for (int j=1;j<=(1<<30);j*=2){
			if (!mp[a[i]]) break;
			int x=j-a[i];
			if (mp[x]){
				if (x==a[i]){
					ans+=mp[a[i]]/2;
					mp[a[i]]%=2;
				}
				else {
					int t=min(mp[a[i]],mp[x]);
					ans+=t;mp[a[i]]-=t;mp[x]-=t;
				}
			}
			if (j==(1<<30)) break;
		}
	}
	printf("%d\n",ans);
	return 0;
}

Compiler output:
a.cc:4:1: error: 'hash_map' does not name a type
    4 | hash_map<int,int>mp;
      | ^~~~~~~~
a.cc: In function 'int main()':
a.cc:8:50: error: 'mp' was not declared in this scope
    8 |         for (int i=1;i<=n;i++) scanf("%d",&a[i]),mp[a[i]]++;
      |                                                  ^~
a.cc:12:30: error: 'mp' was not declared in this scope
   12 |                         if (!mp[a[i]]) break;
      |                              ^~
a.cc:14:29: error: 'mp' was not declared in this scope
   14 |                         if (mp[x]){
      |                             ^~
Language: C++

import bisect

N = int(input())
A = list(map(int, input().split()))
list_ = [2 ** i for i in range(30)]
A.sort()

ans = 0
while(len(A) > 0):
    a = A.pop()
    tmp = [i - a for i in list_ if i - a > 0]
    for b in tmp:
        i = bisect.bisect_left(A, b)
        if i < len(A) and A[i] == b:
            ans += 1
            A.pop(i)
            break

print(ans)

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import bisect
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

#include <iostream>
#include <vector>
#include <unordered_map>
#include <algorithm>
#include <functional>
#include <map>
#include <cmath>
#include <stdio.h>

int bin_search(std::vector<long long>& A, long long x, int start) {
    int N = A.size();
    int L = start;
    int R = N;
    
    while (R - L > 1) {
        int M = (R + L) / 2;
        if (A[M] == x) return M;
        if (A[M] > x){
            L = M;
        }
        else {
            R = M;
        }

    }
    return -1;

}

int main() {
    int N;
    scanf("%d", &N);
    std::vector<long long> A(N);
    for (int i = 0; i < N; i++) {
        long long a;
        scanf("%lld", &a);
        A[i] = a;
    }
    std::sort(A.begin(), A.end(), std::greater<long long>());
    //std::unordered_map<int, std::vector<int>> pair_map;
    std::vector<bool> is_paired(N + 1, false);
    int count = 0;
    for (int i = 0; i < N; i++) {
        if(is_paired[i] == false) {
            bool is_break = false;
            for (int t = 1; t <= 32; t++) {
                long long t2 = long long(std::pow(2, t));
                
                int j = bin_search(A, t2 - A[i], i);

                if (j >= 0 && is_paired[j] == false) {
                    is_paired[i] = true;
                    is_paired[j] = true;
                    is_break = true;
                    count++;
                    break;
                    //pair_map[i].push_back(j);
                }
           }
        }
    }

    std::cout << count << std::endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:47:32: error: expected primary-expression before 'long'
   47 |                 long long t2 = long long(std::pow(2, t));
      |                                ^~~~
Language: C++

#include <iostream>
#include <vector>
#include <map>

using namespace std;
typedef long long int ll;
int N, a[200001];

void solve()
{
    map<int, int> M;
    for (int i = 0; i < n; i++)
    {
        int a;
        cin >> a[i];
        M[a[i]]++;
    }
    sort(a, a + N);
    int ret = 0;
    int pw = 1 << 30;
    for (int i = n - 1; i >= 0; i++)
    {
        if (M[a[i]])
        {
            M[a[i]]--;
            while (pw >= 2 && 2 * a[i] < pw)
                pw >>= 1;
            if (M.count(pw - a[i]) && M[pw - a[i]])
            {
                ret++;
                M[pw - a[i]]--;
            }
        }
    }
    cout << ret << endl;
}
int main()
{
    while (cin >> N)
    {
        solve();
    }
    return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:12:25: error: 'n' was not declared in this scope
   12 |     for (int i = 0; i < n; i++)
      |                         ^
a.cc:15:17: error: invalid types 'int[int]' for array subscript
   15 |         cin >> a[i];
      |                 ^
a.cc:16:12: error: invalid types 'int[int]' for array subscript
   16 |         M[a[i]]++;
      |            ^
a.cc:18:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   18 |     sort(a, a + N);
      |     ^~~~
      |     short
a.cc:21:18: error: 'n' was not declared in this scope
   21 |     for (int i = n - 1; i >= 0; i++)
      |                  ^
Language: C++

#include <iostream>
#include <vector>

using namespace std;

int main(){
  int N;
  cin >> N;
  vector<int> A;

  for (int i = 0; i < N; i++) {
    int a;
    cin >> a;
    A.push_back(a);
  }
  
  sort(A.begin(), A.end(), greater<int>());

  int res = 0;
  while (A.size() != 0) {
    for (int i = 1; i < A.size(); i++) {
      int n = A[0] + A[i];
      if (!(n & (n-1))) {
	res ++;
	A.erase(A.begin() + i);
	break;
      }
    }
    A.erase(A.begin());
  }
  cout << res << endl;
}


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

<>;$h{$_}++for@a=glob<>;
for$a(sort{$b-$a}@a){
	if($h{$a}-->0){$_=32;while(($b=2**$_---$a)>0){$%++,last if$h{$b}-->0}}
}
print$%

Compiler output:
a.cc:1:15: error: stray '@' in program
    1 | <>;$h{$_}++for@a=glob<>;
      |               ^
a.cc:2:18: error: stray '@' in program
    2 | for$a(sort{$b-$a}@a){
      |                  ^
a.cc:1:1: error: expected unqualified-id before '<' token
    1 | <>;$h{$_}++for@a=glob<>;
      | ^
a.cc:1:4: error: '$h' does not name a type
    1 | <>;$h{$_}++for@a=glob<>;
      |    ^~
a.cc:1:10: error: expected unqualified-id before '++' token
    1 | <>;$h{$_}++for@a=glob<>;
      |          ^~
a.cc:2:6: error: expected constructor, destructor, or type conversion before '(' token
    2 | for$a(sort{$b-$a}@a){
      |      ^
a.cc:2:19: error: 'a' does not name a type
    2 | for$a(sort{$b-$a}@a){
      |                   ^
a.cc:5:1: error: 'print$' does not name a type
    5 | print$%
      | ^~~~~~
Language: C++

#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cassert>
using namespace std;

#define REP(i,n) for (ll i = 0; i < n; i++)
template <class T> using reversed_priority_queue = priority_queue<T, vector<T>, greater<T> >;
typedef long long ll;

ll N;
ll A[200010];
map < ll,ll > cnt;

int main ()
{
    cin >> N;
    REP(i,N) cin >> A[i];
    REP(i,N) cnt[A[i]]++;
    sort(A, A + N);
    revrese(A, A + N);

    ll ans = 0;
    REP(i,N) {
        ll rev = 1LL << 32LL;
        REP(j,32) {
            rev >>= 1LL;
            ll revt = rev - A[i];
            if (revt == A[i]) {
                if (cnt[revt] >= 2) {
                    ans++;
                    cnt[revt] -= 2;
                    break;
                }
            } else {
                if (cnt[revt] > 0) {
                    ans++;
                    cnt[revt]--;
                    cnt[A[i]]--;
                    break;
                }
            }
        }
    }

    cout << ans << endl;

    return 0;
}




Compiler output:
a.cc: In function 'int main()':
a.cc:38:5: error: 'revrese' was not declared in this scope
   38 |     revrese(A, A + N);
      |     ^~~~~~~
Language: C++

#include "stdafx.h"
#include "iostream"
#include <algorithm>
using namespace std;
#define nmax 200000
bool check[nmax];
int A[nmax];
long long twos[60];
int n;

long long select(int v) {
	if (v == n - 1)return 0;
	if (check[v] == true)return select(v + 1);
	long long res=0;
	for (int i = 0; i < n; i++) {
		if (i == v)continue;
		if (check[i] == true)continue;
		for (int j = 0; j < 18; j++) {
			if (A[i] + A[v] == twos[j]) {
				check[i] = true;
				check[v] = true;
				res=max(select(v + 1)+1,res);
				check[i] = false;
				check[v] = false;
			}
		}
		
	}
	return res;
}
int main()
{
	long long two = 2;
	for (int i = 0; i < 60; i++) {
		twos[i] = two;
		two *= 2;
	}
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> A[i];
	}

	cout << select(0) << endl;
    return 0;
}




Compiler output:
a.cc:1:10: fatal error: stdafx.h: No such file or directory
    1 | #include "stdafx.h"
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>  // cin,cout
#include <stdio.h>   // printf,scanf (standard input/output)
#include <cmath>     // abs(x),pow(x,2)
#include <string>
#include <string.h>  // strlen, strcmp
#include <algorithm> // min,max, sort(v.begin(),v.end())
#include <vector>
#include <time.h>
using namespace std;

int result = 0;
int DD[200000] = {};

int Func(int k, int N, int A[]) {
    int pow2k = pow(2,k);
    int pow2k_1 = pow(2,k-1);
    int C_index = 0;
    while (A[C_index]<pow2k_1) {
        C_index += 1;
    }
    int N_b = C_index;
    int N_c = N - C_index;
    
    int index = 0;
    vector<int> D{};
    int N_d = 0;
    
    int temp_0 = 0;
    for (int i=0;i<N;i++) {
        if (A[i]==po2wk_1) temp_0 += 1;
    }
    result += temp_0/2;
    
    for (int i=0;i<N_c;i++) {
        int target = pow2k - A[N-1-i];
        while (A[index]<target) {
            D.push_back(A[index]);
            N_d += 1;
            index += 1;
            if (index==C_index) {index-=1; break;}
        }
        if (A[index]==target) {
            result += 1;
            index += 1;
        }
        if (index==C_index) {break;}
    }
    
    for (int i=0;i<N_d;i++) {
        DD[i] = D[i];
    }
    
    
    return N_d;
}


int main(){
    int N;
    cin >> N;
    int A[N];
    for (int i=0;i<N;i++) cin >> A[i];
    sort(A, A+N);
    
    int now = A[N-1];
    int k = 0;
    while (now>=pow(2,k)) {k += 1;}
    
    for (int i=0;i<N;i++) {
        DD[i] = A[i];
    }
    
    while (k>0) {
        N = Func(k, N, DD);
        k -= 1;
    }
    
    cout << result << endl;
    
    //A[] = D{}
    //N, D = Func(k, int N, int A[]);
    
    return 0;
}


Compiler output:
a.cc: In function 'int Func(int, int, int*)':
a.cc:30:19: error: 'po2wk_1' was not declared in this scope; did you mean 'pow2k_1'?
   30 |         if (A[i]==po2wk_1) temp_0 += 1;
      |                   ^~~~~~~
      |                   pow2k_1
Language: C++

二部グラフの最大マッチングじゃないの？？？？？
わかんにゃ～い

たぴ

Compiler output:
a.cc:1:1: error: '\U00004e8c\U000090e8\U000030b0\U000030e9\U000030d5\U0000306e\U00006700\U00005927\U000030de\U000030c3\U000030c1\U000030f3\U000030b0\U00003058\U00003083\U0000306a\U00003044\U0000306e\U0000ff1f\U0000ff1f\U0000ff1f\U0000ff1f\U0000ff1f' does not name a type
    1 | 二部グラフの最大マッチングじゃないの？？？？？
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

/*
O(nlogn)でできそうなのに実装ができない穀してくれーーーーーーーーー

まず受け取ってソートする
N以上の最小の2のべき乗数(Aとよぶ)は定数時間で求まる(ここはできた)

まだ調べてない配列の部分のうち、一番後ろの数Lとしたときに、A-Lを探索する
二部探索をするとlogN
でもって見つかったら使った部分を1073741825で潰す
このあと挿入ソートをするとO(2)でできる

これをN回繰り返すので、全体の計算量はO(nlogn)

でも無能なのでlonglongの二部探索が実装できない　とか言ってたらリファレンスのequal_rangeが見つかった
神か?早く僕を穀してくれ


*/

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 <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <unordered_map>
#include <stack>
#include <queue>
#include <string>

using namespace std;

int main(){
  int n,m,b,c;
  cin >> n;
  unordered_map<long, int>mp;
  long x = 1L<<32,ret=0;
  int i,j,k;
  vector<long> a(n);
  for(i=0;i<n;i++){
    cin >> a[i];
    //mp[a[i]]++;
  }
  //sort(a.begin(),a.end());
  //cout << x << endl;
  //while(x){
  for(j=0;j<33;x>>=1,j++){
    for(i=0;i<a.size();i++){
      //if(mp[x-a[i]]>0&&mp[a[i]]>0){
        if(a[i]==x-a[i]/*&&mp[a[i]]==1*/)continue;
        ret++;
        //mp[x-a[i]]--;
        //mp[a[i]]--;
        a[i]=a.back();
        a.pop_back();
        i--;
      }
    }
  }
  cout << ret << endl;
  return 0;
}


Compiler output:
a.cc:39:3: error: 'cout' does not name a type
   39 |   cout << ret << endl;
      |   ^~~~
a.cc:40:3: error: expected unqualified-id before 'return'
   40 |   return 0;
      |   ^~~~~~
a.cc:41:1: error: expected declaration before '}' token
   41 | }
      | ^
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric> // accumulate
#include <queue>
#include <string>
#include <cmath> // sqrt
using namespace std;
typedef long long ll;

int memo[1000000010]
int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        memo[a[i]] += 1;
    }

    sort(a.begin(), a.end());



    int count = 0;
    for (int t = 30; t > 0; t--) {
        for (int i = n-1; i >= 0; i--) {
            if (memo[a[i]] == 0) continue;
            if (((1 << t) - a[i]) > a[n-1]) continue;
            int front = lower_bound(a.begin(), a.end(), (1 << t) - a[i]) - a.begin();
            int back = upper_bound(a.begin(), a.end(), (1 << t) - a[i]) - a.begin();
            if (front == back) continue;
            if (front > i) continue;
            if (front == i && memo[a[i]] <= 1) continue;
            if (memo[a[front]] >= 1) {
                memo[a[front]] -= 1;
                memo[a[i]] -= 1;
                count += 1;
            }

        }
    }

    cout << count << endl;

    return 0;
}

Compiler output:
a.cc:12:1: error: expected initializer before 'int'
   12 | int main() {
      | ^~~
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric> // accumulate
#include <queue>
#include <string>
#include <cmath> // sqrt
using namespace std;
typedef long long ll;

int a[200010];
int memo[1000000010];

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

    sort(a.begin(), a.end());


    int count = 0;
    for (int t = 30; t > 0; t--) {
        for (int i = n-1; i >= 0; i--) {
            if (memo[a[i]] == 0) continue;
            if (((1 << t) - a[i]) > a[n-1]) continue;
            int front = lower_bound(a.begin(), a.end(), (1 << t) - a[i]) - a.begin();
            int back = upper_bound(a.begin(), a.end(), (1 << t) - a[i]) - a.begin();
            if (front == back) continue;
            if (front > i) continue;
            if (front == i && memo[a[i]] <= 1) continue;
            if (memo[a[front]] >= 1) {
                memo[a[front]] -= 1;
                memo[a[i]] -= 1;
                count += 1;
            }

        }
    }

    cout << count << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:12: error: request for member 'begin' in 'a', which is of non-class type 'int [200010]'
   22 |     sort(a.begin(), a.end());
      |            ^~~~~
a.cc:22:23: error: request for member 'end' in 'a', which is of non-class type 'int [200010]'
   22 |     sort(a.begin(), a.end());
      |                       ^~~
a.cc:30:39: error: request for member 'begin' in 'a', which is of non-class type 'int [200010]'
   30 |             int front = lower_bound(a.begin(), a.end(), (1 << t) - a[i]) - a.begin();
      |                                       ^~~~~
a.cc:30:50: error: request for member 'end' in 'a', which is of non-class type 'int [200010]'
   30 |             int front = lower_bound(a.begin(), a.end(), (1 << t) - a[i]) - a.begin();
      |                                                  ^~~
a.cc:30:78: error: request for member 'begin' in 'a', which is of non-class type 'int [200010]'
   30 |             int front = lower_bound(a.begin(), a.end(), (1 << t) - a[i]) - a.begin();
      |                                                                              ^~~~~
a.cc:31:38: error: request for member 'begin' in 'a', which is of non-class type 'int [200010]'
   31 |             int back = upper_bound(a.begin(), a.end(), (1 << t) - a[i]) - a.begin();
      |                                      ^~~~~
a.cc:31:49: error: request for member 'end' in 'a', which is of non-class type 'int [200010]'
   31 |             int back = upper_bound(a.begin(), a.end(), (1 << t) - a[i]) - a.begin();
      |                                                 ^~~
a.cc:31:77: error: request for member 'begin' in 'a', which is of non-class type 'int [200010]'
   31 |             int back = upper_bound(a.begin(), a.end(), (1 << t) - a[i]) - a.begin();
      |                                                                             ^~~~~
Language: C++

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

main(){
	int n;
	int ans=0;
	cin >> n;
	long long int a[n];
	for(int i=0;i<n;i++){
		cin >> a[i];
	}
	long long int beki2[40];
	beki2[0]=1;
	for(int i=1;i<40;i++){
		beki2[i]=beki2[i-1]*2;
	}
	sort(a,a+n);
	int mokuteki;
	for(int i=1;i<n;i++){
		for(int j=0;j<40;j++){
			if(a[i]<beki2[j]){
				//2のべき乗できる候補の値
				//mokutekiの値を足すと２のべき乗にできる
				mokuteki=beki2[j]-a[i];
				break;
			}
		}
		//mokuteki探し
		//時間が足りなければ二分探索実装
		int top=i;
		int middle=i/2;
		int low=0;
		while(){
			if(a[middle]<mokuteki){
				low=middle;
				if(top-middle>=2){
					middle=(top+middle)/2;
				}else if(top-middle==1){
					middle=top;
					low=middle;
				}else{
					break;
				}
				
			}else if(a[middle]==mokuteki){
				ans++;
				break;
			}else{
				top=middle;
				if(middle-low>=2){
					middle=(low+middle)/2;
				}else if(middle-low==1){
					middle=low;
					top=middle;
				}else{
					break;
				}
			}
		}
	}
	cout << ans <<endl;
}


Compiler output:
a.cc:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    5 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:34:23: error: expected primary-expression before ')' token
   34 |                 while(){
      |                       ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
 
int main(){
    int N, x;
    ll ans = 0;
    cin >> N;
    int A[200000], num[200000] = {};
    for(int i=0;i<N;i++)
        cin >> A[i];

    for(int i=0;i<N;i++){
        for(int j=i+1;j<N;j++){
            x = A[i] + B[j];
            if(!(x & (x-1))){
                ans++;
                num[i] += 1;
                num[j] += 1;
            } 
                
        }
    }

    for(int i=0;i<N;i++){
        if(num[i] > 0)
            ans++;
    }

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

Compiler output:
a.cc: In function 'int main()':
a.cc:15:24: error: 'B' was not declared in this scope
   15 |             x = A[i] + B[j];
      |                        ^
Language: C



#include <stdio.h>

int main()
{
  int num = 0,n;
  int a[200000];

  scanf("%d",&n);

  int i;

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


  int j,k,x;

      for(j=1;j<n;j++)
	for(k=j+1;k<n;k++)
	  if(a[j]<a[k])
	    {
	      x=a[j];a[j]=a[k];a[k]=x;
	    }
	
      
      for(j=0;j<n-1;j++)
	if(a[j]!=-1)
	for(k=j+1;k<n;k++)
	  {
	    if(a[k] != -1&&a[k]%2==a[j]%2)
	      {
		x = a[k] + a[j];

		while(x%2 != 1)
		  {
		    x /= 2;
		  };

		if(x == 1)
		  {
		    num++;
		    a[k] = -1;
		    break;
		  }
	      }
	  }
	}

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


Compiler output:
main.c:51:10: error: expected declaration specifiers or '...' before string constant
   51 |   printf("%d\n",num);
      |          ^~~~~~
main.c:51:17: error: unknown type name 'num'; did you mean 'enum'?
   51 |   printf("%d\n",num);
      |                 ^~~
      |                 enum
main.c:52:3: error: expected identifier or '(' before 'return'
   52 |   return 0;
      |   ^~~~~~
main.c:53:1: error: expected identifier or '(' before '}' token
   53 | }
      | ^
Language: C++

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

main(){
	int n;
	int ans=0;
	cin >> n;
	long long int a[n];
	for(int i=0;i<n;i++){
		cin >> a[i];
	}
	long long int beki2[40];
	beki2[0]=1;
	for(int i=1;i<40;i++){
		beki2[i]=beki2[i-1]*2;
	}
	sort(a,a+n);
	int mokuteki;
	for(int i=1;i<n;i++){
		for(int j=0;j<40;j++){
			if(a[i]<beki2[j]){
				//2のべき乗できる候補の値
				//mokutekiの値を足すと２のべき乗にできる
				mokuteki=beki2[j]-a[i];
				break;
			}
		}
		//mokuteki探し
		//時間が足りなければ二分探索実装
		top=i;
		middle=i/2;
		low=0;
		while(){
			if(a[middle]<mokuteki){
				low=middle;
				if(top-middle>=2){
					middle=(top+middle)/2;
				}else if(top-middle==1){
					middle=top;
					low=middle;
				}else{
					break;
				}
				
			}else if(a[k]==mokuteki){
				ans++;
				break;
			}else{
				top=middle;
				if(middle-low>=2){
					middle=(low+middle)/2;
				}else if(middle-low==1){
					middle=low;
					top=middle;
				}else{
					break;
				}
			}
		}
	}
	cout << ans <<endl;
}


Compiler output:
a.cc:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    5 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:31:17: error: 'top' was not declared in this scope
   31 |                 top=i;
      |                 ^~~
a.cc:32:17: error: 'middle' was not declared in this scope
   32 |                 middle=i/2;
      |                 ^~~~~~
a.cc:33:17: error: 'low' was not declared in this scope
   33 |                 low=0;
      |                 ^~~
a.cc:34:23: error: expected primary-expression before ')' token
   34 |                 while(){
      |                       ^
a.cc:46:36: error: 'k' was not declared in this scope
   46 |                         }else if(a[k]==mokuteki){
      |                                    ^
Language: C

#include<stdio.h>
 
int main()
{
  int array[200000];
   int i,j,num,result;
  int output;
  output=0;
  
  scanf("%d",&i);
  for(num=0;num<i;num++)
  {
    scanf("%d",&result);
    array[num]=result;
  }
  array[num]='\0';
  
  for(num=0;array[num+1]!='\0';num++)
  {
  for(j=1;array[j]!='\0';j++)
  {
    if((array[num]+array[j])%2==0)
    {
      output++;
    }
  }
  }
  
  printf("%d\n,"output);
}

Compiler output:
main.c: In function 'main':
main.c:29:17: error: expected ')' before 'output'
   29 |   printf("%d\n,"output);
      |         ~       ^~~~~~
      |                 )
Language: C

#inlcude<stdio.h>

int main()
{
  int array[200000];
   int i,j,num,result;
  int output;
  output=0;
  
  scanf("%d",&i);
  for(num=0;num<i;num++)
  {
    scanf("%d",&result);
    array[num]=result;
  }
  array[num]='\0';
  
  for(num=0;array[num+1]!='\0';num++)
  {
  for(j=1;array[j]!='\0';j++)
  {
    if((array[num]+array[j])%2==0)
    {
      output++;
    }
  }
  }
  
  printf("%d\n,"output);
}

Compiler output:
main.c:1:2: error: invalid preprocessing directive #inlcude; did you mean #include?
    1 | #inlcude<stdio.h>
      |  ^~~~~~~
      |  include
main.c: In function 'main':
main.c:10:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
   10 |   scanf("%d",&i);
      |   ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | #inlcude<stdio.h>
main.c:10:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
   10 |   scanf("%d",&i);
      |   ^~~~~
main.c:10:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:29:3: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   29 |   printf("%d\n,"output);
      |   ^~~~~~
main.c:29:3: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:29:3: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:29:3: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:29:17: error: expected ')' before 'output'
   29 |   printf("%d\n,"output);
      |         ~       ^~~~~~
      |                 )
Language: C++

#include<bits/stdc++.h>
using namespace std;
// g++ Main.cpp -std=gnu++1y -O2 -I/opt/boost/gcc/include -o main && ./main

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vll = vector<vl>;
using vii = vector<vi>;
using pii = pair<int, int>;

using vc = vector<char>;
using vcc = vector<vc>;
using vb = vector<bool>;
using vbb = vector<vb>;
using pll = pair<ll, ll>;

#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR(i, a, b) for(int (i) = a; (i) < (b);(i)++)
#define MAX(a, b) ((a > b) ? a : b)
#define MIN(a, b) ((a > b) ? b : a)

int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};


const int MOD = 1e9 + 7;


// n は 2以上の素数表を返す
vb Primes(int n){
  vector<bool> res(n + 1, true);
  res.at(0) = false; res.at(1) = false;
  for(int i = 2; i <= sqrt(n); i++){
    if(res.at(i)){
      for(int j = 2 * i; j <= n; j += i){
        res.at(j) = false;
      }
    }
  }
  return res;
}
// ===================================================


int main(){
  int n; cin >> n;
  vi data(n); REP(i, n) cin >> data.at(i); sort(data.begin(), data.end());
  int ans = 0;
  if(data[0] == 1){
    for(int i = 1; i < n; i++){
      if(data.at(i) != 1) break;
      else if(i % 2 == 1){
        ans++;
        data.at(i) = -MOD;
        data.at(i - 1) = -MOD;
      }
    }
  }

  for(int xxx = 30; xxx > 1; xxx--){
    int need = (1 << xxx);
    int head = 0, tail = n - 1;

    while(head < tail){
      int tmp = data.at(head) + data.at(tail);
      if(tmp == need){
        if(data.at(head) == 1) number_one--;
        data.at(head) = -MOD;
        data.at(tail) = -MOD;
        head++; tail--;
        ans++;
      }
      else if(tmp < need) head++;
      else{
        if(data.at(tail) > need) data.at(tail) -= need;
        tail--;
      }
      // end 条件分岐
    }
    sort(data.begin(), data.end());
    /*
    cout << xxx << " : ";
    for(int p = 0; p < n; p++){
      cout << data.at(p) << " ";
    }
    cout << ", ans = " << ans << "\n";
    */
  }
  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:69:32: error: 'number_one' was not declared in this scope
   69 |         if(data.at(head) == 1) number_one--;
      |                                ^~~~~~~~~~
Language: C++

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

int n;
long long a[N];
long long pw2[N];
map<long long, int> num;

inline bool cmp(long long x, long long y) { return x > y;}

inline long long get(long long x) {
    int now = 0;
    while (pw2[now] <= x) now++;
    return pw2[now];
}

int main() {
    cin >> n;
    for (int i = 1; i <= n; ++i)
        scanf("%lld", a + i), num[a[i]]++;
    pw2[0] = 1;
    for (int i = 1; i <= 50; ++i)
        pw2[i] = 1LL * pw2[i - 1] * 2;
    sort(a + 1, a + n + 1, cmp);
    long long ans = 0;
    for (int i = 1; i <= n; ++i) {
        if (num[a[i]] == 0) continue;
        long long t = get(a[i]);
        if (a[i] * 2 == t) ans += num[a[i]] / 2, a[i] %= 2;
        else while =num[a[i]] > 0 && num[t - a[i]] > 0) ans++, num[t - a[i]]--, num[a[i]]--;
    }
    cout << ans << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:31:20: error: expected '(' before '=' token
   31 |         else while =num[a[i]] > 0 && num[t - a[i]] > 0) ans++, num[t - a[i]]--, num[a[i]]--;
      |                    ^
      |                    (
a.cc:31:20: error: expected primary-expression before '=' token
Language: C++

#include "iostream"
using namespace std;
#define nmax 200000
bool check[nmax];
int dp[nmax];
int A[nmax];
bool map[nmax][nmax];
int n;
int select(int v) {
	int res;
	return res;
}
int main()
{
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> A[i];
	}

	cout << select(n - 1) << endl;
    return 0;
}



Compiler output:
/tmp/ccuRS4nj.o: in function `main':
a.cc:(.text+0x17): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccuRS4nj.o
a.cc:(.text+0x65): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccuRS4nj.o
a.cc:(.text+0x70): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccuRS4nj.o
collect2: error: ld returned 1 exit status
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a=0,b=0,n,c;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d",&c);
		if(c%2==0)
			b++;
		else
			a++;
	}
	printf("%d",max(a/2,b/2));
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:13: error: 'i' was not declared in this scope
    7 |         for(i=0;i<n;i++)
      |             ^
Language: C++

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

main(){
	int n;
	int ans=0;
	cin >> n;
	long long int a[n];
	for(int i=0;i<n;i++){
		cin >> a[i];
	}
	long long int beki2[40];
	beki2[0]=1;
	for(int i=1;i<40;i++){
		beki2[i]=beki2[i-1]*2;
	}
	sort(a,a+n);
	for(int i=1;i<n;i++){
		for(int j=0;j<40;j++){
			if(a[i]<beki2[j]){
				//2のべき乗できる候補の値
				//mokutekiの値を足すと２のべき乗にできる
				int mokuteki=beki2[j]-a[i];
				break;
			}
		}
		//kokuteki探し
		//時間が足りなければ二分探索実装
		for(int k=0;k<i;k++){
			if(a[k]==mokuteki){
				ans++;
				break;
			}else if(a[k]>=mokuteki){
				break;
			}
		}
	}
	cout << ans <<endl;
}


Compiler output:
a.cc:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    5 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:31:34: error: 'mokuteki' was not declared in this scope
   31 |                         if(a[k]==mokuteki){
      |                                  ^~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a=0,b=0,n,c;
	scanf("%d",n);
	for(i=0;i<n;i++)
	{
		scanf("%d",&c);
		if(c%2==0)
			b++;
		else
			a++;
	}
	printf("%d",max(a/2,b/2));
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:13: error: 'i' was not declared in this scope
    7 |         for(i=0;i<n;i++)
      |             ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main()
{
	int i,n;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
		scanf("%d",&a[i]);
	printf("5");
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:29: error: 'a' was not declared in this scope
    8 |                 scanf("%d",&a[i]);
      |                             ^
Language: C++

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

int main(void){
	int N;
	cin >> N;
	map<long long, long long> A;
	int count = 0;
	int max = 0;
	for(int cnt = 0; cnt < N; cnt++){
		long long a;
		cin >> a;
		A[a] ++;
		if(max < a){
			max = a;
		}
	}
	int index = log2(max) + 2;

	map<long long, long long> pairCount;
	for(int i = 1; i <= index; i++){
		for(auto itr = A.begin(); itr != A.end(); ++itr){
			if(itr->second == 0) continue;
			long long a = itr->first;
			int j = pow(2, i) - a;
			if(j < 1) continue;
			if((a == j && A[j] > 1) || (a != j && A[j] > 0)){
				pairCount[a]++;
				pairCount[j]++;
			}
		}
	}
	for(auto itr = pairCount.begin(); itr != pairCount.end(); itr++){
		if(itr->second == 2){
			for(int i = 1; i <= index; i++){
				long long a = itr->first;
				int j = pow(2, i) - a;
				if(j < 1) continue;
				if((a == j && A[j] > 1) || (a != j && A[j] > 0)){
					++count;
					A[itr->first] = 0;
					A[j] = 0;
					break;
				}
			}
		}
	}
	cout << count << endl;
	
	return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:23:21: error: 'log2' was not declared in this scope
   23 |         int index = log2(max) + 2;
      |                     ^~~~
a.cc:30:33: error: 'pow' was not declared in this scope
   30 |                         int j = pow(2, i) - a;
      |                                 ^~~
a.cc:42:41: error: 'pow' was not declared in this scope
   42 |                                 int j = pow(2, i) - a;
      |                                         ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int a[100001];
long long m[22];
int main()
{
	int n,i,j,k,s=0;
	m[1]=2;
	for(i=2;i<=20;i++)
	{
		m[i]=m[i-1]*2;
	}
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
	}
	sort(a);
	for(i=0;i<n-1;i++)
	{
		for(j=i+1;j<n;j++)
		{
			for(k=1;k<=20;k++)
			{
				if(a[i]+a[j]==m[k])
				{
					s++;
					break;
				} 
			}
		}
	} 
	printf("%d",s);
	return 0;	
} 

Compiler output:
a.cc: In function 'int main()':
a.cc:18:13: error: no matching function for call to 'sort(int [100001])'
   18 |         sort(a);
      |         ~~~~^~~
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:4762:5: note: candidate: 'template<class _RAIter> void std::sort(_RAIter, _RAIter)'
 4762 |     sort(_RandomAccessIterator __first, _RandomAccessIterator __last)
      |     ^~~~
/usr/include/c++/14/bits/stl_algo.h:4762:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algo.h:4793:5: note: candidate: 'template<class _RAIter, class _Compare> void std::sort(_RAIter, _RAIter, _Compare)'
 4793 |     sort(_RandomAccessIterator __first, _RandomAccessIterator __last,
      |     ^~~~
/usr/include/c++/14/bits/stl_algo.h:4793:5: note:   candidate expects 3 arguments, 1 provided
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator, class _Compare> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Compare)'
  292 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp);
      | ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note:   candidate expects 4 arguments, 1 provided
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator)'
  296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
      | ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note:   candidate expects 3 arguments, 1 provided
Language: C++

#include <iostream>
#include <string>

#include <vector>
#include <deque>
#include <list>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>

#include <algorithm>

int xxx(int x)
{
	for (int i = 0; i < 64; ++i) {
		if (x < (1 << i)) {
			return (1 << i) - x;
		}
	}
	return 0;
}

int main()
{
	long N;
	std::set<int, std::greater<int> > A;
	int n = 0;

	std::cin >> N;
	for (int i = 0; i < N; ++i) {
		int j;
		std::cin >> j;
		A.insert(j);
	}

	while (A.size() >= 2) {
		it = A.begin();
		int v = *it;
		A.erase(it);
		if ((v & (-v)) == v) {
			continue;
		}
		int u = xxx(v);
		auto jt = A.find(u);
		if (jt != A.end()) {
			A.erase(jt);
			++n;
			continue;
		}
	}

	std::cout << n << "\n";
}

Compiler output:
a.cc: In function 'int main()':
a.cc:38:17: error: 'it' was not declared in this scope; did you mean 'int'?
   38 |                 it = A.begin();
      |                 ^~
      |                 int
Language: C

#include <algorithm>
#include <climits>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef unsigned long ul;

ul N;

int main(int argc, char const *argv[]) {
  cin >> N;
  multiset<ul> as;
  ul maxA = 0;
  for (int i = 0; i < N; ++i) {
    ul a;
    cin >> a;
    maxA = max(a, maxA);
    as.insert(a);
  }
  ul maxPT = 1;
  while (maxPT < maxA)
    maxPT <<= 1;

  ul count;
  multiset<ul> used;
  for (ul pt = maxPT; pt > 1; pt >>= 1) {
    for (auto it = as.rbegin(); it != as.rend(); it++) {
      if (*it < (pt >> 1))
        break;
      if (used.count(*it) == as.count(*it))
        continue;
      ul a0 = *it, a1 = pt - *it;
      if (a0 != a1) {
        if (as.count(a1) > used.count(a1)) {
          ++count;
          used.insert(a0);
          used.insert(a1);
        }
      } else {
        if (as.count(a1) > used.count(a1) + 1) {
          ++count;
          used.insert(a0);
          used.insert(a1);
        }
      }
    }
  }

  cout << count << endl;
  return 0;
}


Compiler output:
main.c:1:10: fatal error: algorithm: No such file or directory
    1 | #include <algorithm>
      |          ^~~~~~~~~~~
compilation terminated.
Language: C++

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

using namespace std;

int main(int, char**)
{
	unsigned int n;
	vector<unsigned int> m;
	vector<unsigned int> p;
	list<int> d;
	unsigned long long ans = 0;
	std::cin >> n;

	unsigned int t = 2;
	p.push_back(t);
	while (t < 2000000000) {
		t *= 2;
		p.push_back(t);
	}

	m.resize(n);
	for (unsigned int i = 0; i < n; i++) {
		cin >> m[i];
	}
	
	sort(m.begin(), m.end());

	int i;
	for (i = n; i >= 0; i--) {
		for (int j = i - 1; j >= 0; j--) {
			for (list<int>::iterator k = d.begin(); k != d.end(); k++) {
				if (*k == j)
					j--;
			}
			unsigned int int b = m[i]+m[j];
			for (int k = 0; p[k] <= b; k++) {
				if (b == p[k]) {
					ans++;
					d.push_back(j);
					j = 0;
					break;
				}
			}
		}
	}

	cout << ans << endl;
	return 0;

}


Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:38:34: error: two or more data types in declaration of 'b'
   38 |                         unsigned int int b = m[i]+m[j];
      |                                  ^~~
a.cc:39:49: error: 'b' was not declared in this scope
   39 |                         for (int k = 0; p[k] <= b; k++) {
      |                                                 ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <algorithm>
int main() {
int N,i,j,a,b,c,d;
d=0;
c=0;
a=0;
 
  cin>>N;

int A[N]={0};
for(i=0;i<N;i++){
cin>>A[i];
}
sort(A,A+N,greater<int>());
 
for(i=0;i<N;i++){

b=1;
a=A[i];
for(j=0;;j++){
if(a==0){
break;
}
if(a>1){
a=a/2;
b=b*2;
} else{
break;
}
}
c=b*2-A[i];
A[i]=0;
for(j=0;j<M;j++){
if(c==A[i+j]){
A[j]=0;
d++;
break;
}
}
}
cout<<d<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:11: error: 'M' was not declared in this scope
   39 | for(j=0;j<M;j++){
      |           ^