Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long long> vll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef pair<int, int> pii;
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define vv(type, c, m, n, i) vector<vector<type>> c(m, vector<type>(n, i))
#define mat(type, c, m, n) vector<vector<type>> c(m, vector<type>(n));for(auto& r:c)for(auto& i:r)cin>>i;
#define rep(i,a,n) for(int i=(a), i##_len=(n); i<i##_len; ++i)
#define rrep(i,a,n) for(int i=(a), i##_len=(n); i>i##_len; --i)
#define each(x,y) for(auto &(x):(y))
#define var(type, ...)type __VA_ARGS__;Scan(__VA_ARGS__);
template<typename T> void Scan(T& t) { cin >> t; }
template<typename First, typename...Rest>void Scan(First& first, Rest&...rest) { cin >> first; Scan(rest...); }
#define vec(type, c, n) vector<type> c(n);for(auto& i:c) cin>>i;
#define len(x) ((int)(x).size())
#define mp make_pair
#define eb emplace_back
#define em emplace
#define pb pop_back
#define fi first
#define se second
#define get(a, i) get<i>(a)
#define bit_count __builtin_popcount
#define mt make_tuple
inline string zero(int a,string s,char c='0'){return string(a-len(s),c)+s;}
inline string zero(int a,int t,char c='0'){return zero(a, to_string(t), c);}
inline string zero(int a,ll t,char c='0'){return zero(a, to_string(t), c);}
#define mini min_element
#define maxi max_element
#define sum accumulate
#define chmax(a,b) if(a<b)a=b
#define chmin(a,b) if(a>b)a=b
template <class T> inline void print(T t){cout << t << '\n';}
template <class H, class... T> inline void print(H h, T... t){cout << h << " ";print(t...);}
ll solve() {
	var(int, n);
	vec(int, A, n);
	if (n < 2) {
		return 0;
	}
	sort(all(A));
	map<int, int> m;
	rep(i, 0, n) {
		++m[A[i]];
	}
	vi beki{0)};
	int be = 2;
	while (be <= A[n - 1] + A[n - 2]) {
		beki.eb(be);
		be *= 2;
	}
	ll ans = 0;
	int max_be = len(beki) - 1;
	rrep(i, n - 1, -1) {
		if (m[A[i]] < 1)
			continue;
		int c = max_be;
		while(beki[c] >= A[i]) {
			if (beki[c] == A[i] * 2) {
				--c;
				continue;
			}
			if (m[beki[c] - A[i]] > 0) {
				++ans;
				--m[beki[c] - A[i]];
				--m[A[i]];
			}
			--c;
		}
	}
	return ans;
}
int main() {
	print(solve());
	return 0;
}


Compiler output:
a.cc: In function 'll solve()':
a.cc:54:18: error: expected '}' before ')' token
   54 |         vi beki{0)};
      |                ~ ^
a.cc:54:18: error: expected ',' or ';' before ')' token
a.cc: At global scope:
a.cc:56:9: error: expected unqualified-id before 'while'
   56 |         while (be <= A[n - 1] + A[n - 2]) {
      |         ^~~~~
a.cc:61:26: error: 'beki' was not declared in this scope
   61 |         int max_be = len(beki) - 1;
      |                          ^~~~
a.cc:23:23: note: in definition of macro 'len'
   23 | #define len(x) ((int)(x).size())
      |                       ^
a.cc:17:21: error: expected unqualified-id before 'for'
   17 | #define rrep(i,a,n) for(int i=(a), i##_len=(n); i>i##_len; --i)
      |                     ^~~
a.cc:62:9: note: in expansion of macro 'rrep'
   62 |         rrep(i, n - 1, -1) {
      |         ^~~~
a.cc:62:14: error: 'i' does not name a type; did you mean 'vi'?
   62 |         rrep(i, n - 1, -1) {
      |              ^
a.cc:17:49: note: in definition of macro 'rrep'
   17 | #define rrep(i,a,n) for(int i=(a), i##_len=(n); i>i##_len; --i)
      |                                                 ^
a.cc:17:60: error: expected unqualified-id before '--' token
   17 | #define rrep(i,a,n) for(int i=(a), i##_len=(n); i>i##_len; --i)
      |                                                            ^~
a.cc:62:9: note: in expansion of macro 'rrep'
   62 |         rrep(i, n - 1, -1) {
      |         ^~~~
a.cc:79:9: error: expected unqualified-id before 'return'
   79 |         return ans;
      |         ^~~~~~
a.cc:80:1: error: expected declaration before '}' token
   80 | }
      | ^
a.cc: In function 'll solve()':
a.cc:54:19: warning: control reaches end of non-void function [-Wreturn-type]
   54 |         vi beki{0)};
      |                   ^