Language: C++

#include<bits/stdc++.h>

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

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

    ll count = 0;
    for (ll t = 30; t > 0; t--) {
        for (ll i = n-1; i >= 0; i--) {
            if (memo[a[i]] == 0) continue;
            if (((1 << t) - a[i]) > a[n-1]) continue;
            ll front = lower_bound(a.begin(), a.end(), (1 << t) - a[i]) - a.begin();
            ll back = upper_bound(a.begin(), a.end(), (1 << t) - a[i]) - a.begin();
            if (front == back) continue;
            if (front > i) continue;
            if (front == i and 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:3:1: error: 'll' does not name a type
    3 | ll memo[1000000010];
      | ^~
a.cc: In function 'int main()':
a.cc:5:5: error: 'll' was not declared in this scope
    5 |     ll n;
      |     ^~
a.cc:6:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    6 |     cin >> n;
      |     ^~~
      |     std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
                 from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:6:12: error: 'n' was not declared in this scope; did you mean 'yn'?
    6 |     cin >> n;
      |            ^
      |            yn
a.cc:7:5: error: 'vector' was not declared in this scope
    7 |     vector<ll> a(n);
      |     ^~~~~~
a.cc:7:5: note: suggested alternatives:
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53:
/usr/include/c++/14/bits/stl_vector.h:428:11: note:   'std::vector'
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
/usr/include/c++/14/vector:93:13: note:   'std::pmr::vector'
   93 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
a.cc:7:16: error: 'a' was not declared in this scope
    7 |     vector<ll> a(n);
      |                ^
a.cc:8:12: error: expected ';' before 'i'
    8 |     for (ll i = 0; i < n; i++) {
      |            ^~
      |            ;
a.cc:8:20: error: 'i' was not declared in this scope
    8 |     for (ll i = 0; i < n; i++) {
      |                    ^
a.cc:10:9: error: 'memo' was not declared in this scope
   10 |         memo[a[i]] += 1;
      |         ^~~~
a.cc:13:5: error: 'sort' was not declared in this scope; did you mean 'std::sort'?
   13 |     sort(a.begin(), a.end());
      |     ^~~~
      |     std::sort
In file included from /usr/include/c++/14/algorithm:86,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: 'std::sort' declared here
  296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
      | ^~~~
a.cc:15:7: error: expected ';' before 'count'
   15 |     ll count = 0;
      |       ^~~~~~
      |       ;
a.cc:16:12: error: expected ';' before 't'
   16 |     for (ll t = 30; t > 0; t--) {
      |            ^~
      |            ;
a.cc:16:21: error: 't' was not declared in this scope; did you mean 'tm'?
   16 |     for (ll t = 30; t > 0; t--) {
      |                     ^
      |                     tm
a.cc:17:16: error: expected ';' before 'i'
   17 |         for (ll i = n-1; i >= 0; i--) {
      |                ^~
      |                ;
a.cc:17:26: error: 'i' was not declared in this scope
   17 |         for (ll i = n-1; i >= 0; i--) {
      |                          ^
a.cc:18:17: error: 'memo' was not declared in this scope
   18 |             if (memo[a[i]] == 0) continue;
      |                 ^~~~
a.cc:20:15: error: expected ';' before 'front'
   20 |             ll front = lower_bound(a.begin(), a.end(), (1 << t) - a[i]) - a.begin();
      |               ^~~~~~
      |               ;
a.cc:21:15: error: expected ';' before 'back'
   21 |             ll back = upper_bound(a.begin(), a.end(), (1 << t) - a[i]) - a.begin();
      |               ^~~~~
      |               ;
a.cc:22:17: error: 'front' was not declared in this scope
   22 |             if (front == back) continue;
      |                 ^~~~~
a.cc:22:26: error: 'back' was not declared in this scope
   22 |             if (front == back) continue;
      |                          ^~~~
a.cc:23:17: error: 'front' was not declared in this scope
   23 |             if (front > i) continue;
      |                 ^~~~~
a.cc:24:17: error: 'front' was not declared in this scope
   24 |             if (front == i and memo[a[i]] <= 1) continue;
      |                 ^~~~~
a.cc:24:32: error: 'memo' was not declared in this scope
   24 |             if (front == i and memo[a[i]] <= 1) continue;
      |                                ^~~~
a.cc:25:17: error: 'memo' was not declared in this scope
   25 |             if (memo[a[front]] >= 1) {
      |                 ^~~~
a.cc:25:24: error: 'front' was not declared in this scope
   25 |             if (memo[a[front]] >= 1) {
      |                        ^~~~~
a.cc:28:17: error: 'count' was not declared in this scope; did you mean 'std::count'?
   28 |                 count += 1;
      |                 ^~~~~
      |                 std::count
/usr/include/c++/14/pstl/glue_algorithm_defs.h:101:1: note: 'std::count' declared here
  101 | count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
      | ^~~~~
a.cc:34:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   34 |     cout << count << endl;
      |     ^~~~
      |     std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:34:13: error: 'count' was not declared in this scope; did you mean 'std::count'?
   34 |     cout << count << endl;
      |             ^~~~~
      |             std::count
/usr/include/c++/14/pstl/glue_algorithm_defs.h:101:1: note: 'std::count' declared here
  101 | count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
      | ^~~~~
a.cc:34:22: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   34 |     cout << count << endl;
      |                      ^~~~
      |                      std::endl
In file included from /usr/include/c++/14/istream:41,
                 from /usr/include/c++/14/sstream:40,
                 from /usr/include/c++/14/complex:45,
                 from /usr/include/c++/14/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~