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]]++;
 
    ll ans = 0;
    for (auto itr = cnt.begin(); itr != cnt.end(); itr++) {
        ll rev = 1LL << 32LL;
        REP(j,31) {
            rev >>= 1LL;
            ll revt = rev - itr->first;
            if (cnt.find(revt) != cnt.end()) {
                if (revt == itr->first) {
                    
                } else {
                    ll m = min(cnt[revt], cnt[itr->first]);
                    cnt[revt] -= m;
                    cnt[itr->first] -= m;
                    ans += m;
                }
            }
        }
    }
 
    for (auto itr = cnt.begin(); itr != cnt.end(); itr++) {
        if (itr->first / 2 * 2 == itr->first) {
            ans += itr->second / 2;
        }
    }
 
    cout << ans << endl;
 
    return 0;
}
#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]]++;

    ll ans = 0;
    for (auto itr = cnt.begin(); itr != cnt.end(); itr++) {
        ll rev = 1LL;
        REP(j,31) {
            rev >>= 1LL;
            ll revt = rev - itr->first;
            if (cnt.find(revt) != cnt.end()) {
                if (revt == itr->first) {
                    
                } else {
                    ll m = min(cnt[revt], cnt[itr->first]);
                    cnt[revt] -= m;
                    cnt[itr->first] -= m;
                    ans += m;
                }
            }
        }
    }

    for (auto itr = cnt.begin(); itr != cnt.end(); itr++) {
        if (itr->first / 2 * 2 == itr->first) {
            ans += itr->second / 2;
        }
    }

    cout << ans << endl;

    return 0;
}


Compiler output:
a.cc:94:4: error: redefinition of 'll N'
   94 | ll N;
      |    ^
a.cc:28:4: note: 'll N' previously declared here
   28 | ll N;
      |    ^
a.cc:95:4: error: redefinition of 'll A [200010]'
   95 | ll A[200010];
      |    ^
a.cc:29:4: note: 'll A [200010]' previously declared here
   29 | ll A[200010];
      |    ^
a.cc:96:15: error: redefinition of 'std::map<long long int, long long int> cnt'
   96 | map < ll,ll > cnt;
      |               ^~~
a.cc:30:15: note: 'std::map<long long int, long long int> cnt' previously declared here
   30 | map < ll,ll > cnt;
      |               ^~~
a.cc:98:5: error: redefinition of 'int main()'
   98 | int main ()
      |     ^~~~
a.cc:32:5: note: 'int main()' previously defined here
   32 | int main ()
      |     ^~~~