Language: C++

#include<bits/stdc++.h>
using namespace std;
#define debug(n) cerr << #n << ':' << n << endl;
long long nextNum(long long x){
  long long ans = 1;
  while(ans <= x)ans<<=1;
  return ans;
}
int main(){
  int N; cin >> N;
  long long V(N);
  for(auto&&e:V){
    cin >> e;
  }
  bitset<1000000> bs;
  int ans = 0;
  sort(V.begin(), V.end(), greater<int>());
  for(int i = 0; i < N; ++i){
    if(bs[i] == 1)continue;
    bs[i] = 1;
    long long nxt = nextNum(V[i]);
    long long sc = nxt - V[i];
    int idx = lower_bound(V.begin(), V.end(), sc) - V.begin();
    if(sc != V[idx])continue;
    ans++;
    bs[idx]++;
  }
  cout << ans << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:15: error: 'begin' was not declared in this scope
   12 |   for(auto&&e:V){
      |               ^
a.cc:12:15: note: suggested alternatives:
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166,
                 from a.cc:1:
/usr/include/c++/14/valarray:1238:5: note:   'std::begin'
 1238 |     begin(const valarray<_Tp>& __va) noexcept
      |     ^~~~~
In file included from /usr/include/c++/14/filesystem:53,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:200:
/usr/include/c++/14/bits/fs_dir.h:608:3: note:   'std::filesystem::__cxx11::begin'
  608 |   begin(recursive_directory_iterator __iter) noexcept
      |   ^~~~~
a.cc:12:15: error: 'end' was not declared in this scope
   12 |   for(auto&&e:V){
      |               ^
a.cc:12:15: note: suggested alternatives:
/usr/include/c++/14/valarray:1265:5: note:   'std::end'
 1265 |     end(const valarray<_Tp>& __va) noexcept
      |     ^~~
/usr/include/c++/14/bits/fs_dir.h:613:3: note:   'std::filesystem::__cxx11::end'
  613 |   end(recursive_directory_iterator) noexcept
      |   ^~~
a.cc:17:10: error: request for member 'begin' in 'V', which is of non-class type 'long long int'
   17 |   sort(V.begin(), V.end(), greater<int>());
      |          ^~~~~
a.cc:17:21: error: request for member 'end' in 'V', which is of non-class type 'long long int'
   17 |   sort(V.begin(), V.end(), greater<int>());
      |                     ^~~
a.cc:21:30: error: invalid types 'long long int[int]' for array subscript
   21 |     long long nxt = nextNum(V[i]);
      |                              ^
a.cc:22:27: error: invalid types 'long long int[int]' for array subscript
   22 |     long long sc = nxt - V[i];
      |                           ^
a.cc:23:29: error: request for member 'begin' in 'V', which is of non-class type 'long long int'
   23 |     int idx = lower_bound(V.begin(), V.end(), sc) - V.begin();
      |                             ^~~~~
a.cc:23:40: error: request for member 'end' in 'V', which is of non-class type 'long long int'
   23 |     int idx = lower_bound(V.begin(), V.end(), sc) - V.begin();
      |                                        ^~~
a.cc:23:55: error: request for member 'begin' in 'V', which is of non-class type 'long long int'
   23 |     int idx = lower_bound(V.begin(), V.end(), sc) - V.begin();
      |                                                       ^~~~~
a.cc:24:15: error: invalid types 'long long int[int]' for array subscript
   24 |     if(sc != V[idx])continue;
      |               ^
a.cc:26:12: error: no 'operator++(int)' declared for postfix '++' [-fpermissive]
   26 |     bs[idx]++;
      |     ~~~~~~~^~