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

#pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
#define SIZE 300005
#define MOD 1000000007LL
#define EPS 1e-10
#define INF 2147483647
#define LLINF 9223372036854775807LL
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define DOWN(i,b,a) for(int i=b;i>=a;i--)
#define SET(a,c) memset(a,c,sizeof a)
#define BIT(i,j) ((i)>>(j))&1
#define ALL(o) (o).begin(), (o).end()
#define ERASE(o) (o).erase(unique((o).begin(),(o).end()), (o).end())
#define SQ(x) ((x)*(x))
using namespace std;
typedef int_fast64_t ll;
typedef pair<ll,ll> Pll;
typedef pair<int, int> Pii;
typedef pair<double, double> Pdd;
typedef complex<double> dcomplex;
template<typename T> inline void priv(vector<T>a){REP(i,a.size()){cerr<<a[i]<<((i==a.size()-1)?"\n":" ");}}
inline void fastio(){cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15);}
ll gcd(ll a,ll b){ll c=max(a,b);ll d=min(a,b);return c==0||d==0?c:gcd(c%d,d);}
ll lcm(ll a,ll b){return a==0||b==0?0:a*b/gcd(a,b);}
ll modfact(ll a){ll b=1;FOR(i,2,a)b=b*i%MOD;return b;}
ll modpow(ll a, ll n){ll b=1;while (n>0){if(n&1)b=b*a%MOD;a=a*a%MOD;n>>=1;}return b;}
ll modcomb(ll n, ll k){ll b=1;k=min(n-k,k);DOWN(i,n,n-k+1)b=b*i%MOD;return b*modpow(modfact(k),MOD-2)%MOD;}

int N, ans = 0;
ll A[200000];
bool B[200000] = {false};

int main() {
    scanf("%d", &N);
    REP(i, N) scanf("%d", A+i);
    sort(A, A+N);
    for(int i=N-1; i>=0; i--) {
        int p = 0;
        while(A[i] >= 1LL<<p) p++; 
        ll x = (1LL<<p) - A[i];
        int j = lower_bound(A, A+N, x) - A;
        if(B[i]) continue;
        if(j < i && A[j] == x && !B[j]) {
            B[i] = true
            B[j] = true;
            A[j]--;
            ans++;
        }
    }
    printf("%d", ans);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:46:24: error: expected ';' before 'B'
   46 |             B[i] = true
      |                        ^
      |                        ;
   47 |             B[j] = true;
      |             ~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int a[1000000],x[1000000],;
int main()
{
    int t,i,j,m,n,cunt,c,b,y,z;
    cin>>t;
    cunt=0;
    for(i=0; i<t; i++)
    {
        cin>>a[i];
        x[i]=a[i];
    }
    for(i=0; i<t; i++)
    {
        b=0;
        for(j=t-1; j>i; j--)
        {
            if(a[i]==0)
                break;
            if(a[j]==0)
                continue;
            b=a[i]+a[j];
            for(;;)
            {
                if(b%2==0)
                    b=b/2;
                else
                    break;
            }
            if(b==1)
            {
                a[j]=0;
                a[i]=0;
                cunt++;
            }
        }
    }
    y=cunt;
    cunt=0;
    for(i=0; i<t; i++)
    {
        b=0;
        for(j=i-1; j<t; j++)
        {
            if(x[i]==0)
                break;
            if(x[j]==0)
                continue;
            b=x[i]+x[j];
            for(;;)
            {
                if(b%2==0)
                    b=b/2;
                else
                    break;
            }
            if(b==1)
            {
                x[j]=0;
                x[i]=0;
                cunt++;
            }
        }
    }
    z=cunt;
    int ans=y;
    if(z>y)ans=z;
    cout<<ans<<endl;
    return 0;
}


Compiler output:
a.cc:3:27: error: expected unqualified-id before ';' token
    3 | int a[1000000],x[1000000],;
      |                           ^
Language: C++

N = int(input())
ball = list(map(int, input().split()))
ball.sort(reverse = True)
dic = {}
for i in range(ball[0] + 1):
    dic[i] = 0
for x in ball:
    dic[x] += 1

ans = 0
for x in ball:
    if dic[x] != 0:
        y = 2**(x.bit_length()) - x
        if dic[y] != 0:
            if y == x and dic[y] == 1: 
                continue
            ans += 1
            dic[x] -= 1
            dic[y] -= 1
print(ans)

Compiler output:
a.cc:1:1: error: 'N' does not name a type
    1 | N = int(input())
      | ^
a.cc:5:1: error: expected unqualified-id before 'for'
    5 | for i in range(ball[0] + 1):
      | ^~~
Language: C++

#include <bits/stdc++.h>
#define ALL(v) v.begin(), v.end()
#define MOD 1000000007
#define INF 1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define req(i, j, n) for(int i = j; i <= (int)(n); i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

int pw2(int n){
  int t=1;
  while(t>n){
    t*=2;}
  return t;
}

int main() {
  int n;
  cin>>n;
  
  map<int, int> nu;
  
  for(int i=1;i<=n;i++){
   int a;
    cin>>a;
    if(nu.find(a)==nu.end())
      nu[a]=0;
    ++nu[a];
  }
  
  int ans=0;
  for(auto itr=nu.rbegin();itr!=nu.rend();itr++){
    int b=itr->first;
    int p=pw2(b)-b;
    
    if(b==p){
      ans+=nu[b]/2;}
    else{
      if(nu,find(p) == nu.end())continue;
      ans+=min(nu[b], nu[p]);
      nu[p]-=min(nu[b], nu[p]);
    }
  }
  
  cout<<ans<<endl;
  
  
  
  
  
  


}


Compiler output:
a.cc: In function 'int main()':
a.cc:40:17: error: no matching function for call to 'find(int&)'
   40 |       if(nu,find(p) == nu.end())continue;
      |             ~~~~^~~
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:3842:5: note: candidate: 'template<class _IIter, class _Tp> _IIter std::find(_IIter, _IIter, const _Tp&)'
 3842 |     find(_InputIterator __first, _InputIterator __last,
      |     ^~~~
/usr/include/c++/14/bits/stl_algo.h:3842: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:60:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator> std::find(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
   60 | find(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
      | ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:60:1: note:   candidate expects 4 arguments, 1 provided
In file included from /usr/include/c++/14/iterator:66,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:54:
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT, std::char_traits<_CharT> > >::__type std::find(istreambuf_iterator<_CharT, char_traits<_CharT> >, istreambuf_iterator<_CharT, char_traits<_CharT> >, const _CharT2&)'
  435 |     find(istreambuf_iterator<_CharT> __first,
      |     ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note:   candidate expects 3 arguments, 1 provided
Language: C++

#include <bits/stdc++.h>
#define ALL(v) v.begin(), v.end()
#define MOD 1000000007
#define INF 1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define req(i, j, n) for(int i = j; i <= (int)(n); i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

int pw2(int n){
  int t=1;
  while(t>n){
    t*=2;}
  return t;
}

int main() {
  int n;
  cin>>n;
  
  map<int, int> nu;
  
  for(int i=1;i<=n;i++){
   int a;
    cin>>a;
    if(nu.find(a)==nu.end())
      nu[a]=0;
    ++nu[a];
  }
  
  int ans=0;
  for(auto itr=nu.rbegin();itr!;nu.rend()+itr++){
    int b=itr->first;
    int p=pw2(b)-b;
    
    if(b==p){
      ans+=nu[b]/2;}
    else{
      if(nu,find(p) == nu.end())continue;
      ans+=min(nu[b], nu[p]);
      nu[p]-=min(nu[b], nu[p]);
    }
  }
  
  cout<<ans<<endl;
  
  
  
  
  
  


}


Compiler output:
a.cc: In function 'int main()':
a.cc:33:28: error: could not convert 'itr' from 'std::reverse_iterator<std::_Rb_tree_iterator<std::pair<const int, int> > >' to 'bool'
   33 |   for(auto itr=nu.rbegin();itr!;nu.rend()+itr++){
      |                            ^~~
      |                            |
      |                            std::reverse_iterator<std::_Rb_tree_iterator<std::pair<const int, int> > >
a.cc:33:31: error: expected ';' before '!' token
   33 |   for(auto itr=nu.rbegin();itr!;nu.rend()+itr++){
      |                               ^
      |                               ;
a.cc:33:32: error: expected primary-expression before ';' token
   33 |   for(auto itr=nu.rbegin();itr!;nu.rend()+itr++){
      |                                ^
a.cc:33:32: error: expected ')' before ';' token
   33 |   for(auto itr=nu.rbegin();itr!;nu.rend()+itr++){
      |      ~                         ^
      |                                )
a.cc:33:43: error: 'itr' was not declared in this scope
   33 |   for(auto itr=nu.rbegin();itr!;nu.rend()+itr++){
      |                                           ^~~
Language: C++

#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<math.h>
using namespace std;
#define mod (1000000000+7)
#define N (10007)
#define INF 1e16
typedef long long ll;
typedef pair<int,int> P;

bool used[200010];

int main(void){
	ll n;
	cin>>n;
	vector<ll>a(n),b(n),power;
	for(ll i=0;i<n;i++){
		cin>>a[i];
		}
	sort(a.begin(),a.end());
	for(ll i=1;i<64;i++){
		ll x=(ll)pow(2,i);
		power.push_back(x);
	}
	ll ans=0;
	while((ll)a.size()>1){
		ll asize=(ll)a.size()-1;
		auto itr=upper_bound(power.begin(),power.end(),a[asize]);
		if(itr==power.end()){
			a.erase(a.begin()+asize);
			continue;
		}
		ll x=(*itr);
		if(!binary_search(a.begin(),a.end(),x-a[asize])){
			a.erase(a.begin()+asize);
			continue;
		}
		itr=lower_bound(a.begin(),a.end(),x-a[asize]);
		if(itr==a.end()){
			a.erase(a.begin()+asize);
			continue;
		}
		ll index=itr-a.begin();
		if(assize==index){
			a.erase(a.begin()+asize);
			continue;
		}
		ans++;
		//cout<<asize<<" "<<index<<endl;
		a.erase(a.begin()+asize);
		a.erase(a.begin()+index);
	}
	cout<<ans<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:50:20: error: 'assize' was not declared in this scope; did you mean 'asize'?
   50 |                 if(assize==index){
      |                    ^~~~~~
      |                    asize
Language: C++

#include<bits/stdc++.h>
using namespace std;
using Int = long long;
signed main(){
    Int N;
    cin >> N;
    vector<Int>A(N);
    for(auto& e : A)
        cin >> e;
    map<Int,Int>mp,cnt;
    for(auto e : A){
        for(Int i = 1; i < 32; ++i){
            Int bit = (1LL << i);
            if( bit > e and cnt.find(bit - e) != cnt.end()){
                mp[bit - e]++;
            }
        }
        mp[e]++;
        cnt[e]++;
    }
    using tp = tuple<Int,Int>;
    vector<tp>data;
    for(auto e : A)
        data.emplace_back(mp[e],e);
    sort(data.begin(),data.end());
    Int ans = 0;
    for(auto p :  data){
        Int rank, key;
        tie(rank,key) = p;
        if(cnt[key] == 0) continue;
        Int trank = N + 1,tkey = -1;
        for(Int i = 1; i < 32; ++i){
            Int bit = (1LL << i);
            if(bit > key){
                Int dif = bit - key;
                if(mp.find(dif) != mp.end() and ( dif == key ? cnt[key] > 1 : cnt[dif] > 0))
                    trank =  mp[dif], tkey = dif;
            }
        }
        cnt[key]--; mp[key]--;
        if(tkey == -1) continue;
        cnt[key]--; mp[key]--; m
        ++ans;
    }
    cout << ans << endl;
}




Compiler output:
a.cc: In function 'int main()':
a.cc:42:32: error: 'm' was not declared in this scope
   42 |         cnt[key]--; mp[key]--; m
      |                                ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rept(k,i,n) for(int i = (k); i < (int)(n); i++)
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<long long,long long> Pll;

int main() {
    int n;cin>>n;
    vector<ll> by(0);
    vector<ll> a(n);
    vector<bool> ch(n,true);
    for(ll i=1;i<=20000000000;i*=2) by.push_back(i);
    rep(i,n)cin>>a[i];
    sort(a.begin(),a.end());
    int ans=0;
    
    for(int i=n-1;i>=0;i--){
        if(!ch[i]) continue;
        ll k=a[i];
        ll l=*upper_bound(by.begin(),by.end(),k); 
        ch[i]=false;   
        for(auto its=lower_bound(a.begin(),a.end(),l-k);its!=a.end()&&*its==l-k;its++){
            if(ch[its-a.begin()]){
                ans++;
                ch[its-a.begin()]=false;
                *its--
            //    cout<<a[i]<<" "<<*its<<endl;
                break;
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:23: error: expected ';' before 'break'
   29 |                 *its--
      |                       ^
      |                       ;
   30 |             //    cout<<a[i]<<" "<<*its<<endl;
   31 |                 break;
      |                 ~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
int main(){
    int n,ans=0;
    cin>>n;
    vector<int> A(n);
    map<int,int> num;
    rep(i,n) cin>>A[i],num[A[i]]++;
    sort(A.begin(),A.end(),greater<int>());
    rep(i,A.size()){
        num[A[i]]--;
        if(num[A[i]<=0) continue;
        int a=pow(2,int(log2(A[i]))+1)-A[i];
        if(num[a]>0) ans++,num[a]--;
    }
    cout<<ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:23: error: expected ']' before ')' token
   14 |         if(num[A[i]<=0) continue;
      |                       ^
      |                       ]
Language: C++

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

signed main(){
	int n,a[200010];
	cin >> n;
	multiset<int> st;
	for(int i = 0;i < n;i++){
		cin >> a[i];
		st.insert(a[i]);
	}
	sort(a,a + n,greater<int>());
	for(int i = 0;i < n;i++){
		int v = (1 << (32 - __builtin_clz(a[i]))) - a[i];
		if(st.count(v)){
			auto it = st.lower_bound(v);
			st.erase(it);
			ans++;
		}
	}
	cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:25: error: 'ans' was not declared in this scope; did you mean 'abs'?
   18 |                         ans++;
      |                         ^~~
      |                         abs
a.cc:21:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   21 |         cout << ans << endl;
      |                 ^~~
      |                 abs
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define pll pair<ll,ll>
#define rep(i,n) for(int i=0;i<n;i++)
#define sz(x) ((ll)(x).size())
#define pb push_back
#define mp make_pair
#define bit(n) (1LL<<(n))
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
const ll INF = 1LL<<60;
const ll mod = (int)1e9 + 7;

int main() {
    //ll N; cin >> N;
    //ll N,M; cin >> N >> M;
    //string S; cin >> S;
    //ll H,W; cin >> H >> W;
    int N;
    cin >> N;
    vector<ll> A(N);
    rep(i,N){
        cin >> A[i];
    }
    sort(all(A));
    ll sum=0;
  	bool use[N]=true;
    while(sz(A)){
      	if(use[sz(A)]){
      	ll las=A[sz(A)-1];
        ll num=las;
        ll p=0;
        while(num){
            num=num/2;
            p++;
        }
        ll bin=pow(2,p);
        auto itr=lower_bound(all(A),bin-las);
        int loc=itr-A.begin();
      	if(loc<sz(A)-1 && A[loc]==bin-las){
            sum++;
            A.pop_back();
          	use[loc]=false;
          
        }
        else{
         	A.pop_back();
        }
        }
        else{
            A.pop_back();
        }
    }
    cout << sum;
    
    


}

/*



 */



Compiler output:
a.cc: In function 'int main()':
a.cc:31:21: error: array must be initialized with a brace-enclosed initializer
   31 |         bool use[N]=true;
      |                     ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rrep(i,n) for(int (i)=((n)-1);(i)>=0;(i)--)
#define itn int
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
const long long INF = 1LL << 60;
const int MOD = 1000000007;
signed main(void){
    int n; cin>>n;
    vector <int> a(n); 
    map <int,int> ma;
    rep(i,n) {cin>>a[i]; ma[a[i]]++;}
    sort(a.begin(),a.end());
    int ans = 0;
    rrep(i,n){
        if(ma[now] == 0) continue;
        int now = a[i];
        int goal = 1LL;
        while(now>=goal) goal*= 2LL;
        int need = goal - a[i];
        if(a[i] == need){
            if(ma[need]>=2) ma[need]-=2, ans += 1;
        }else if(ma[goal-a[i]]) ma[goal-a[i]]--, ma[now]--, ans += 1; 
    }
    cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:15: error: 'now' was not declared in this scope; did you mean 'pow'?
   20 |         if(ma[now] == 0) continue;
      |               ^~~
      |               pow
Language: C

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

int main(){
    int n=0,s=0;
    int *p;
    int m=0;
    int k,l;
    scanf("%d%d%d",n s m);
    for(k=0,k<50000001,k++){
        l=l*2;
    for(n=0,n<100000000,n++){
        for(x=1,x<20001,x++){
            for(m=0,m<n,m++){
              if(x+n=l)
             s=s+1;
             printf("%d",s);
            }
        }
   }
}



Compiler output:
main.c: In function 'main':
main.c:9:21: error: expected ')' before 's'
    9 |     scanf("%d%d%d",n s m);
      |          ~          ^~
      |                     )
main.c:10:27: error: expected ';' before ')' token
   10 |     for(k=0,k<50000001,k++){
      |                           ^
      |                           ;
main.c:10:27: error: expected expression before ')' token
main.c:12:28: error: expected ';' before ')' token
   12 |     for(n=0,n<100000000,n++){
      |                            ^
      |                            ;
main.c:12:28: error: expected expression before ')' token
main.c:13:13: error: 'x' undeclared (first use in this function)
   13 |         for(x=1,x<20001,x++){
      |             ^
main.c:13:13: note: each undeclared identifier is reported only once for each function it appears in
main.c:13:28: error: expected ';' before ')' token
   13 |         for(x=1,x<20001,x++){
      |                            ^
      |                            ;
main.c:13:28: error: expected expression before ')' token
main.c:14:28: error: expected ';' before ')' token
   14 |             for(m=0,m<n,m++){
      |                            ^
      |                            ;
main.c:14:28: error: expected expression before ')' token
main.c:21:1: error: expected declaration or statement at end of input
   21 | }
      | ^
Language: C

#include<stdio.h>
int main(){
int N,i,p[],count=0;
scanf("%d\n",&N);
for(i=1;i<=N;i++){
scanf("%d ",&p[i]);
}
for(i=1;i<=N;i++){
if(p[i]>=1&&p[i]+p[i+1]){
count++;
}
}
printf("%d",&count);
}

Compiler output:
main.c: In function 'main':
main.c:3:9: error: array size missing in 'p'
    3 | int N,i,p[],count=0;
      |         ^
Language: C++

 #include<bits/stdc++.h>
using namespace std;
#define ll  long long
#define PB push_back
#define ld long double
#define ff first
#define ss second
# define st(v) (v).begin(),(v).end()
#define   pr pair<ll,ll>
const ll N = 1e5+4 , M=N,inf=(ll)1e9;
const ll mod=1e9+7;
ll fastAbs(ll n) { return (n ^ (n >> 31)) - (n >> 31); }
ll multiply(ll a, ll b){ return ((a % mod) * (b % mod)) % mod; }
ll add(ll a, ll b) {     return ((a % mod) + (b % mod)) % mod; }
ll sub(ll a, ll b) { return ((a%mod) - (b % mod)+ mod) % mod ; }
//map< pair<ll,ll> , ll > mp;
const ll dx[4] = {1,0,0,-1};
const ll dy[4] = {0,-1,1,0};
/////////////////////////////////////////////////////
const ll nmax = 2e9 + 5 ;
/////////////////////////////////////////////////////
void solve( ){
     int n ;
     cin >> n ;
     vector < ll > a(n) ;
     for( int i = 0 ; i < n;  i++) cin >> a[i] ;
     sort(st(a));
 	 map < ll , ll > mp ;
 	 for( int i = 0 ; i < n ; i++) mp[a[i]]++;
 	 ll ans =  0 ; 
 	 for( int i = n-1 ; i >=0 ; i--){
 	 	if(mp[a[i]]!=0){
 	 	  ll x = ceil(1.0*log2(a[i]));
 	 	  ll no = a[i];
 	 	  bool flag = false ;
 	 	  while(no<nmax){
 	 	  		no = powl(2,x) ;
 	 	  		x++;
 	 	  		if(mp.find(no-a[i])!=mp.end() && mp[no-a[i]]!=0){
 	 	  			mp[no-a[i]]--;
 	 	  			ans++;
 	 	  			mp[a[i]]--;
 	 	  			flag = true  ;
 	 	  			break ;
 	 	  		}
 	 	  }
  	 	}
 	 }
 	 cout << ans << " " ;
}
int main()
// {
//    #ifndef ONLINE_JUDGE
//     freopen("input.txt","r",stdin);
//     freopen("output.txt","w",stdout);
//     #endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll q=1;
    //cin >> q ;
    while(q--)
      solve();
}


Compiler output:
a.cc:57:5: error: expected initializer before 'ios_base'
   57 |     ios_base::sync_with_stdio(false);
      |     ^~~~~~~~
a.cc:58:5: error: 'cin' does not name a type
   58 |     cin.tie(NULL);
      |     ^~~
a.cc:59:5: error: 'cout' does not name a type
   59 |     cout.tie(NULL);
      |     ^~~~
a.cc:62:5: error: expected unqualified-id before 'while'
   62 |     while(q--)
      |     ^~~~~
a.cc:64:1: error: expected declaration before '}' token
   64 | }
      | ^
Language: C

#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,res=0;
	multiset<int> Set;
	int i,a;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&a);
		Set.insert(a);
	}
	while(!Set.empty()){
		auto it=Set.end();
		it--;
		int x=*it;
		Set.erase(it);
		for(i=1;i<=x;i*=2){
			if(Set.find(i-x)!=Set.end()){
				Set.erase(Set.find(i-x));
				res++;
			}
		} 
	}
	printf("%d\n",res);
} 

Compiler output:
main.c:1:9: fatal error: bits/stdc++.h: No such file or directory
    1 | #include<bits/stdc++.h>
      |         ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;
bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd_(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}
 
class UnionFind {
    public:
    //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
    vector<int> Parent;
    
    //クラスを作るときは、Parentの値を全て-1にする。
    //以下のようにすると全てバラバラの頂点として解釈できる。
    UnionFind(int N) {
        Parent = vector<int>(N, -1);
    }
    
    //Aがどのグループに属しているか調べる
    int root(int A) {
        if (Parent[A] < 0) return A;
        return Parent[A] = root(Parent[A]);
    }
    
    //自分のいるグループの頂点数を調べる
    int size(int A) {
        return -Parent[root(A)];//先祖をrootで取っておきたい。
    }
    
    //AとBをくっ付ける
    bool connect(int A, int B) {
        //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        A = root(A);
        B = root(B);
        if (A == B) {
            //すでにくっついてるからくっ付けない
            return false;
        }
        
        //大きい方(A)に小さいほう(B)をくっ付けたい
        //大小が逆だったらAとBをひっくり返す。
        if (size(A) < size(B)) swap(A, B);
        
        //Aのサイズを更新する
        Parent[A] += Parent[B];
        //Bの親をAに変更する
        Parent[B] = A;
        
        return true;
    }
};

int main(){
  
  int n;
  cin>>n;
  vector<long long> a(n);
  map<long long, int> mp;
  REP(i,n){
    cin>>a[i];
    mp[a[i]]++;
  }
  sort(a.begin(), a.end(), greater<long long>);
  
  long long target;
  int ans=0;
  //bool flag;
  REP(i,n){
    if(mp[a[i]]==0)continue;
    for(int p=30;p>=0;p--){
      target = (1LL<<p) - a[i];
      if(mp[target]>0){
        ans++;
        mp[a[i]]--;
        mp[target]--;
        break;
      }else{
        continue;
      }
    }
  }
  
  cout<<ans<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:99:46: error: expected primary-expression before ')' token
   99 |   sort(a.begin(), a.end(), greater<long long>);
      |                                              ^
Language: C++

#include<iostream>
#include<algorithm>
#include<deque>
using namespace std;
const int N=2e5+2;
int ar[N];
vector<int> lis,lis1;
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n,i,j,k,l,ans=0;
	cin>>n;
	for(i=1;i<=n;i++){
		cin>>ar[i];
	}
	sort(ar+1,ar+1+n);
	for(i=1;i<=n;i++){
		lis.push_back(ar[i]);
	}	
	for(j=30;j>=0;j--){
		if(!(j&1)){
			lis1.clear();
			k=0;
			l=lis.size()-1;
			while(l>k){
				if(lis[k]+lis[l]==(1<<j)){
					ans++;
					k++;
					l--;
				}
				else{
					if(lis[k]+lis[l]>(1<<j)){
						lis1.push_back(lis[l]);
						l--;
					}
					else{
						lis1.push_back(lis[k]);
						k++;
					}
				}
			}
			if(l==k){
				lis1.push_back(lis[l]);
			}
		}
		else{
			lis.clear();
			k=0;
			l=lis1.size()-1;
			while(l>k){
				if(lis1[k]+lis1[l]==(1<<j)){
					ans++;
					k++;
					l--;
				}
				else{
					if(lis1[k]+lis1[l]>(1<<j)){
						lis.push_back(lis1[l]);
						l--;
					}
					else{
						lis.push_back(lis1[k]);
						k++;
					}
				}
			}
			if(l==k){
				lis.push_back(lis1[l]);
			}
		}
	}
	cout<<ans;
}

Compiler output:
a.cc:7:1: error: 'vector' does not name a type
    7 | vector<int> lis,lis1;
      | ^~~~~~
a.cc: In function 'int main()':
a.cc:18:17: error: 'lis' was not declared in this scope
   18 |                 lis.push_back(ar[i]);
      |                 ^~~
a.cc:22:25: error: 'lis1' was not declared in this scope
   22 |                         lis1.clear();
      |                         ^~~~
a.cc:24:27: error: 'lis' was not declared in this scope
   24 |                         l=lis.size()-1;
      |                           ^~~
a.cc:47:25: error: 'lis' was not declared in this scope
   47 |                         lis.clear();
      |                         ^~~
a.cc:49:27: error: 'lis1' was not declared in this scope
   49 |                         l=lis1.size()-1;
      |                           ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int n,res,a,i;
multiset<int> s;
int main(){
	cin>>n;
	for(i=0;i<n;i++){
		cin>>a;
		s.insert(a);
	}
	while(!s.empty()){
		auto it=s.end();
		it--;
		int x=*it;
		s.erase(it);
		for(i=1;i<=x;i*=2);
		if(s.find(i-x)!=s.end()){
			s.erase(set.find(i-x));
			res++;
		}
	}
	cout<<res;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:36: error: missing template arguments before '.' token
   18 |                         s.erase(set.find(i-x));
      |                                    ^
Language: C++

#include<bits/stdc++.h>
#include<windows.h>
#include<conio.h>
#define P printf
#define warn cout<<'\a'
#define S(n) _sleep((int)n*1000)
#define setseed rand(time(NULL))
#define clear system("cls")
#define SC(n,a) cout<<fixed<<setprecision(n)<<q
#define srt(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define srz(a,n) sort(a,a+n)
#define rez(a,n) reverse(a,a+n)
#define mem(a,f) memset(a,f,sizeof(a))
#define rep(i,n) for(long long i=0;i<(long long)n;i++)
#define rep2(i,n) for(long long i=1;i<(long long)n;i++)
#define ll long long
using namespace std;
ll power[46];
void powermake()
{
	power[0]=1;
	rep2(i,46) power[i]=power[i-1]*2;
}
int main()
{
	powermake();
	ll n;
	int t,ans=0;
	cin>>n;
	ll a[n];
	rep(i,n) cin>>a[i];
	ll b[n];
	rep(i,n){
		rep(j,46)
		{
			ll m=power[j]-a[i];
			rep2(k,n)
				if(m==a[k])
					b[i]++;
		}
	}
	rep(i,n)
	{
		ll minv=2000000000;
		rep(j,46)
		{
			ll m2=power[j]-a[i];
			for(int k=i+1;k<n;k++)
			{
				if(a[k]==m2&&b[k]<minv&&b[k]!=-1)
				{
					minv=b[k];
					t=k;
				}
			}
		}
		ans++;
		b[t]=-1;
	}
	cout<<ans<<endl;
  return 0;
}

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

#include<bits/stdc++.h>
#include<windows.h>
#include<conio.h>
#define P printf
#define warn cout<<'\a'
#define S(n) _sleep((int)n*1000)
#define setseed rand(time(NULL))
#define clear system("cls")
#define SC(n,a) cout<<fixed<<setprecision(n)<<q
#define srt(a) sort(a.gegin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define srz(a,n) sort(a,a+n)
#define rez(a,n) reverse(a,a+n)
#define mem(a,f) memset(a,f,sizeof(a))
#define rep(i,n) for(long long i=0;i<(long long)n;i++)
#define rep2(i,n) for(long long i=1;i<(long long)n;i++)
#define ll long long
using namespace std;
ll power[46];
void powermake()
{
	power[0]=1;
	rep2(i,46) power[i]=power[i-1]*2;
}
int main()
{
	powermake();
	ll n;
	int t,ans=0;
	cin>>n;
	ll a[n];
	rep(i,n) cin>>a[i];
	ll b[n];
	rep(i,n){
		rep(j,46)
		{
			ll m=power[j]-a[i];
			rep2(k,n)
				if(m==a[k])
					b[i]++;
		}
	}
	rep(i,n)
	{
		ll minv=2000000000;
		rep(j,46)
		{
			ll m2=power[j]-a[i];
			for(int k=i+1;k<n;k++)
			{
				if(a[k]==m2&&b[k]<minv&&b[k]!=-1)
				{
					minv=b[k];
					t=k;
				}
			}
		}
		ans++;
		b[k]=-1;
	}
	cout<<ans<<endl;
  return 0;
}

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

#include<bits/stdc++.h>
using namespace std;
map<int,int> mp;
long long t[40];
int cnt=0;
int n,a[200000];
int main()
{
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
		mp[a[i]]++;
	}
	sort(a,a+n);
	long long last=2;
	while(1)
	{
		if(last>a[n-1]*2)
		break;
		t[cnt++]=last;
		last*=2;
	}
	int ans=0;
	for(int i=n-1;i>=0;i--)
	{
		int tmp=lower_bound(t,t+cnt,(long long)(a[i]))-t;
		if(mp[a[i]]>=2&&(long long)(a[i])==t[tmp]&&a[i-1]==a[i])
		{
			mp[a[i]]-=2;
			ans++;
		}
		if(mp[a[i]]>=1&&(long long)(a[i])!=t[tmp]&&mp[t[tmp]-((long long)(a[i])]))
		{
			mp[a[i]]--;
			mp[t[tmp]-a[i]]--;
			ans++;
		}
	}
	cout<<ans;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:33:88: error: expected ')' before ']' token
   33 |                 if(mp[a[i]]>=1&&(long long)(a[i])!=t[tmp]&&mp[t[tmp]-((long long)(a[i])]))
      |                                                                      ~                 ^
      |                                                                                        )
a.cc:38:18: error: expected ']' before '}' token
   38 |                 }
      |                  ^
      |                  ]
   39 |         }
      |         ~         
a.cc:38:18: error: expected ')' before '}' token
   38 |                 }
      |                  ^
      |                  )
   39 |         }
      |         ~         
a.cc:33:19: note: to match this '('
   33 |                 if(mp[a[i]]>=1&&(long long)(a[i])!=t[tmp]&&mp[t[tmp]-((long long)(a[i])]))
      |                   ^
a.cc:39:9: error: expected primary-expression before '}' token
   39 |         }
      |         ^
Language: C++

#include <iostream>
#include <set>
#define llint long long

using namespace std;

llint n;
multiset<llint> S, rem;

int main(void)
{
	cin >> n;
	llint a;
	for(int i = 1; i <= n; i++){
		cin >> a;
		rem.insert(a);
	}
	for(int i = 1; i < 33; i++) S.insert(1LL<<i);
	
	llint ans = 0;
	while(rem.size() >= 2){
		auto p = rem.end();
		p--;
		llint x = *p;
		rem.erase(p);
		
		y = *(S.upper_bound(x))-x;
		auto q = rem.lower_bound(y);
		if(q != rem.end() && *q == y){
			ans++;
			rem.erase(q);
		}
	}
	cout << ans << endl;
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:17: error: 'y' was not declared in this scope
   27 |                 y = *(S.upper_bound(x))-x;
      |                 ^
Language: C++

using namespace std;
typedef long long ll;
typedef vector<ll> vll;

int N;
ll A[200010];
int used[200010];

int b_search(int i, ll a){
  int ub=i, lb=-1;
  while(ub-lb>1){
    int mid=(ub+lb)/2;
    if(a>=A[mid]) lb=mid;
    else ub=mid;
  }
  return lb;
}

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

  sort(A, A+N);
  memset(used, 0, sizeof(used));

  int ans=0;

  for (int i=N-1;i>=1;--i){
    if (used[i]==1) continue;
  

  for (int t=1;t<40;++t){
    int j=b_search(i, (ll)pow(2, t)-A[i]);
    while(used[j]==1) j--;
    if(j==-1) break;
    if(A[j]+A[i]==(ll)pow(2, t)){
      ans++;
      used[j]=1;
      break;
    }
  }
}

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

Compiler output:
a.cc:3:9: error: 'vector' does not name a type
    3 | typedef vector<ll> vll;
      |         ^~~~~~
a.cc: In function 'int main()':
a.cc:20:3: error: 'cin' was not declared in this scope
   20 |   cin>>N;
      |   ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | using namespace std;
a.cc:25:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   25 |   sort(A, A+N);
      |   ^~~~
      |   short
a.cc:26:3: error: 'memset' was not declared in this scope
   26 |   memset(used, 0, sizeof(used));
      |   ^~~~~~
a.cc:1:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
  +++ |+#include <cstring>
    1 | using namespace std;
a.cc:35:27: error: 'pow' was not declared in this scope
   35 |     int j=b_search(i, (ll)pow(2, t)-A[i]);
      |                           ^~~
a.cc:46:3: error: 'cout' was not declared in this scope
   46 |   cout << ans << endl;
      |   ^~~~
a.cc:46:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:46:18: error: 'endl' was not declared in this scope
   46 |   cout << ans << endl;
      |                  ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | using namespace std;
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;

int N;
ll A[200010];
int used[200010];

int b_search(int i, ll a){
  int ub=i, lb=-1;
  while(ub-lb>1){
    int mid=(ub+lb)/2;
    if(a>=A[lb]) lb=mid;
    else ub=mid;
  }
  return lb;
}

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

  memset(used, 0, sizeof(used));

  int ans=0;

  for (int i=N-1;i>=1;--i){
    if (used[i]==1) continue;
  }

  for (int t=1;t<40;++t){
    int j=b_search(i, (ll)pow(2, t)-A[i]);
    while(used[j]==1) j--;
    if(j==-1) break;
    if(A[j]+A[i]==(ll)pow(2, t)){
      ans++;
      used[j]=1;
      break;
    }
  }

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

Compiler output:
a.cc: In function 'int main()':
a.cc:35:20: error: 'i' was not declared in this scope
   35 |     int j=b_search(i, (ll)pow(2, t)-A[i]);
      |                    ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;

int N;
ll A[200010];
int used[200010];

int b_search(int i, ll a){
  int ub=i, lb=-1;
  while(ub-lb>1){
    if(a>=A[lb]) lb=mid;
    else ub=mid;
  }
  return lb;
}

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

  memset(used, 0, sizeof(used));

  int ans=0;

  for (int i=N-1;i>=1;--i){
    if (used[i]==1) continue;
  }

  for (int t=1;t<40;++t){
    int j=b_search(i, (ll)pow(2, t)-A[i]);
    while(used[j]==1) j--;
    if(j==-1) break;
    if(A[j]+A[i]==(ll)pow(2, t)){
      ans++;
      used[j]=1;
      break;
    }
  }

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

Compiler output:
a.cc: In function 'int b_search(int, ll)':
a.cc:13:21: error: 'mid' was not declared in this scope
   13 |     if(a>=A[lb]) lb=mid;
      |                     ^~~
a.cc:14:13: error: 'mid' was not declared in this scope
   14 |     else ub=mid;
      |             ^~~
a.cc: In function 'int main()':
a.cc:34:20: error: 'i' was not declared in this scope
   34 |     int j=b_search(i, (ll)pow(2, t)-A[i]);
      |                    ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;

int N;
ll A[200010];
int used[200010];

int b_search(int i, int t){
  int ub=i, lb=-1;
  while(ub-lb>1){
    int mid=(ub+lb)/2;
    if(A[mid]+A[i]>=(ll)pow(2, t)) ub=mid;
    else lb=mid;
  }
  return ub;
}

int main(){
  cin>>N;
  for (int i=0;i<N;++i){ll a;cin>>a;A[i]=a;}
  sort(A.begin(), A.end());
  memset(used, 0, sizeof(used));
  
  int ans=0;

  for (int i=N-1;i>=1;--i){
    for (int t=1;t<40;++t){
      int j=b_search(i, t);
      ll a=A[j];
      while(A[j]==a&&used[j]==1&&j<i) j++;
      if(A[j]+A[i]==(ll)pow(2, t)&&j!=i){
        ans++;
        used[j]=1;
        break;
      }
    }
  }

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

Compiler output:
a.cc: In function 'int main()':
a.cc:23:10: error: request for member 'begin' in 'A', which is of non-class type 'll [200010]' {aka 'long long int [200010]'}
   23 |   sort(A.begin(), A.end());
      |          ^~~~~
a.cc:23:21: error: request for member 'end' in 'A', which is of non-class type 'll [200010]' {aka 'long long int [200010]'}
   23 |   sort(A.begin(), A.end());
      |                     ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;

int N;
ll A[N];
int used[N];

int b_search(int i, int t){
  int ub=i, lb=-1;
  while(ub-lb>1){
    int mid=(ub+lb)/2;
    if(A[mid]+A[i]>=(ll)pow(2, t)) ub=mid;
    else lb=mid;
  }
  return ub;
}

int main(){
  cin>>N;
  for (int i=0;i<N;++i){ll a;cin>>a;A[i]=a;}
  sort(A.begin(), A.end());
  memset(used, 0, sizeof(used));
  
  int ans=0;

  for (int i=N-1;i>=1;--i){
    for (int t=1;t<40;++t){
      int j=b_search(i, t);
      ll a=A[j];
      while(A[j]==a&&used[j]==1&&j<i) j++;
      if(A[j]+A[i]==(ll)pow(2, t)&&j!=i){
        ans++;
        used[j]=1;
        break;
      }
    }
  }

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

Compiler output:
a.cc:7:6: error: size of array 'A' is not an integral constant-expression
    7 | ll A[N];
      |      ^
a.cc:8:10: error: size of array 'used' is not an integral constant-expression
    8 | int used[N];
      |          ^
a.cc: In function 'int main()':
a.cc:23:10: error: request for member 'begin' in 'A', which is of non-class type 'll [1]' {aka 'long long int [1]'}
   23 |   sort(A.begin(), A.end());
      |          ^~~~~
a.cc:23:21: error: request for member 'end' in 'A', which is of non-class type 'll [1]' {aka 'long long int [1]'}
   23 |   sort(A.begin(), A.end());
      |                     ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef pair<int, int> ii;

int N;
vll A;

int b_search(int i, ll a){
  int lb=i, ub=N;
  while(ub-lb>1){
    int mid=(lb+ub)/2;
    if(A[mid]>=a) ub=mid;else{lb=mid;}
  }
  return ub;
}


int main(){
  cin>>N;
  for (int i=0;i<N;++i){
    ll a;cin>>a;A.push_back(a);
  }

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

  int used[N];
  memset(used, 0, sizeof(used));

  int cnt=0;
  for (int i=0;i<N;++i){
    if(used[j]==1) continue;
    for (int t=1;t<40;++t){
      int j=b_search(i, (ll)pow(2, t)-A[i]);
      while(used[j]==1){j++;}
      if(A[j]+A[i]==(ll)pow(2, t)){
        cnt++;
        used[j]=1;
        break;
      }
    }
  }

  cout << cnt << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:13: error: 'j' was not declared in this scope
   34 |     if(used[j]==1) continue;
      |             ^
Language: C++

#include <iostream>
#include <algorithm>
#include <vector> //動的配列
#include <string> 
#include <list> //双方向リスト
#include <map> //連想配列
#include <set> //集合
#include <stack>
#include <queue>
#include <cmath>



typedef long long ll;


using namespace std;

template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}


int n;


int binsearch(ll l[n],ll x,bool check[n]){
        int min=0,max=n-1,mid=0;
        while (true){
            int mid=(min+max)/2;
            if (l[mid]==x && check[mid]==true){
                break;
            } else if (mid==min || mid==max ||(l[mid]==x && check[mid]==false)){
                return n+5;
                break;
            } else if (l[mid]<x){
                min=mid;
            } else if (l[mid]>x){
                max=mid;
                //return binsearch(l,x,min,max,check);
            }
    }
        return mid;
}

int main(){
    cin>>n;
    ll a[n];
    bool check[n];
    for (int i=0;i<n;i++){
        cin>>a[i];
        check[i]=true;
    }
    sort(a,a+n);
    int ans=0;
    for (int i=n-1;i>-1;i--){
        //cout<<i<<check[i]<<endl;
        if (check[i]==true){
            check[i]=false;
            int k=30;
            while (a[i]<pow(2,k)){
                k-=1;
            }
        int ind=binsearch(a,pow(2,k+1)-a[i],check);
        //cout<<a[i]<<" "<<pow(2,k+1)-a[i]<<" "<<ind<<endl;
        if (ind<=n) {
            check[ind]=false;
            ans+=1;
        }
        
        //cout<<ind<<endl;   
        }
    }
    cout<<ans<<endl;
}

Compiler output:
a.cc:26:20: error: size of array 'l' is not an integral constant-expression
   26 | int binsearch(ll l[n],ll x,bool check[n]){
      |                    ^
a.cc:26:39: error: size of array 'check' is not an integral constant-expression
   26 | int binsearch(ll l[n],ll x,bool check[n]){
      |                                       ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define INCANT cin.tie(0), ios::sync_with_stdio(false), cout << fixed << setprecision(20);

main(){
    INCANT;
    int n, res = 0;
    in(n);
    int a[n];
    map<int, int> cnt;
    for(auto& i: a){
        cin >> i;
    }
    sort(a, a + n, greater<int>());

    for(auto& i: a){
        if(cnt[i]){
            cnt[i]--;
            res++;
        }else{
            cnt[(1<<(32 - __builtin_clz(i))) - i]++;
        }
    }
    
    cout << res;
}


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:8:5: error: 'in' was not declared in this scope; did you mean 'n'?
    8 |     in(n);
      |     ^~
      |     n
Language: C++

#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <iostream>
// #include <algorithm>
#include <array>
#include <vector>

#define N 100000

using namespace std;
typedef long long ll;

int main() {
  ll i, j;
  ll temp;
  int n;
  int n_check = 0;

  scanf("%d", &n);
  // array<ll, N> ar;
  vector<ll> ar(n);
  for (i = 0; i < n; i++) {
    scanf(" %lld", &ar[i]);
    n_check++;
  }
  // printf("%d", n_check);

  // for (i = 0; i < n; i++) {
  //   printf("%lld\n", ar[i]);
  // }
  // printf("end\n");

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

  int count = 0;
  ll last;
  ll* plast;
  while (ar.size()) {
    last = ar.back();
    // cout << "last: " << last << endl;
    ar.pop_back();
    for (auto x = ar.begin(); x != ar.end(); ++x) {
      temp = *x + last;
      if (!(temp & (temp - 1))) {
        count++;
        ar.erase(x);
        break;
      }
    }
  }

  printf("%d", count);

  
  return 0;
}

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

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 2e5 + 5;
int n,ans;
map <int, int> mp;
int poww[35];
int z[maxn];
int main()
{
    poww[0] = 1;
    for (int i = 1; i <= 30; ++i)
        poww[i] = poww[i - 1] * 2;
    scanf("%d", &n);
    for (int i = 0; i < n; ++i)
    {6
        scanf("%d", z + i);
        if (!mp.count(z[i]))
            mp[z[i]] = 1;
        else
            ++mp[z[i]];
    }
    sort(z, z + n);
    for (int i = 0; i < n; ++i)
    {
        int tmp = z[i];
        if (mp[z[i]] < 1)
            continue;
        --mp[z[i]];
        for (int j = 30; j >= 0; --j)
        {
            if (poww[j] < tmp)
                break;
            int t = poww[j] - tmp;
            if (!mp.count(t))
                continue;
            if (mp[t])
            {
                --mp[t];
                ++ans;
                break;
            }
        }
    }
    printf("%d\n", ans);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:7: error: expected ';' before 'scanf'
   16 |     {6
      |       ^
      |       ;
   17 |         scanf("%d", z + i);
      |         ~~~~~
Language: C++

#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
#define pb push_back
#define sz(i) (int)(i.size())
#define F first
#define S second
#define L long double
#define P pair<int, int>
const int inf = 0x3f3f3f3f3f3f3f3LL;
const int mod = (int)1e9 + 7;
using namespace std;
#if ONLINE_JUDGE
#define tr(...)
#define endl '\n'
#else
#include "../../tr.h"
#endif
template<class T> void smin(T& a, T val) {if (a > val) a = val;}template<class T> void smax(T& a, T val) {if (a < val) a = val;}
const int N = 2*(int)1e5 + 10;

int n, a[N];
vector<int> v;
map<int, int> M;

int check(int idx){
   for(auto it: v){
      if(M[it-idx] > 0){
         assert(it-idx <= idx);
         M[it-idx]--;
         return it-idx;
      }
   }
   return -1;
}

int32_t main(){_

   cin>>n;
   for (int i = 0; i < n; ++i)
   {
      cin>>a[i];
      M[a[i]]++;
   }
   
   v.pb(1);
   while(1){
      v.pb(v.back()*2);
      if(v.back() > 1e12)break;
   }

   int ans = 0;
   sort(a, a+n);
   reverse(a, a+n);

   for (int i = 0; i < n; ++i)
   {
      if(M[a[i]] == 0)continue;
      M[a[i]]--;
      int vals = check(a[i]);
      if(vals == -1)continue;
      ans++;
   }

   cout<<ans;
   #warning make sure N size is correct!
   return 0;
}

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

#include <iostream>
#include <math.h>
#include <vector>
using namespace std;

int main(){
    int N = 0;
    int ans = 0;
    cin >> N;
    vector<int> num(N);

    for(int i = 0;i < N;i++){
        cin >> num.at(i);
    }
    sort(num.begin(),num.end());
    reverse(num.begin(),num.end());

    for(int i = 0;i < N;i++){
        for(int j = i + 1;j < N;j++){
            int pair = num.at(i) + num.at(j);
            if(pair != num.at(j)){
                if((pair & (pair - 1)) == 0){
                    ans++;
                    num.at(j) = 0;
                }
            }
        }
    }
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:5: error: 'sort' was not declared in this scope; did you mean 'sqrt'?
   15 |     sort(num.begin(),num.end());
      |     ^~~~
      |     sqrt
a.cc:16:5: error: 'reverse' was not declared in this scope
   16 |     reverse(num.begin(),num.end());
      |     ^~~~~~~
Language: C++

#include<iostream>
#include<algorithm>
#include<string>
#include<sstream>
#include<vector>
using namespace std;
int bsearch(int b,int e,long* arr,long dst){
  if(b>e) return -1;
  if(arr[b]==dst) return b;
  if(arr[e]==dst) return e;
  int m = (b+e)/2;
  if(b==m) return -1;
  if(arr[m]<dst) return bsearch(m,e,arr,dst);
  else if(arr[m]>dst) return bsearch(b,m,arr,dst);
  return m;
}
int main() {
  int n;
  cin >> n;
  long a[200000];
  bool b[200000];
  for(int i=0;i<n;i++) {
    cin >> a[i];
    b[i] = false;
  }
  int count = 0;
  sort(a,a+n);
  reverse(a,a+n);
  for(int i=0;i<n;i++){
    long t = 1;
    while(t<=a[i]) t <<= 1;
    long ser = t - a[i];
    int lb = i,ub = n;
    while(lb+1<ub){
      long mid = (lb + ud) / 2;
      if(a[mid] > ser) lb = mid;
      else if(a[mid] == ser && b[mid]) lb = mid;
      else ub = mid;
    }
    if(ub == n) continue;
    if(a[ub] != ser) continue;
    b[ub] = true;
    count ++;
  }
  cout << count << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:35:24: error: 'ud' was not declared in this scope; did you mean 'ub'?
   35 |       long mid = (lb + ud) / 2;
      |                        ^~
      |                        ub