Language: Java

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int n;
ll a[252521];

int main(){
  scanf("%d",&n);
  REP(i,n)scanf("%lld",a+i);
  multiset<ll> S;
  REP(i,n)S.insert(a[i]);
  int ans = 0;
  while(S.size()){
    ll x = *S.rbegin(); S.erase(S.find(x));
    ll y;
    FORR(i,0,32){
      ll sum = 1ll<<i;
      y = sum - x;
      if(S.count(y)>0)break;
      y = -1;
    }
    if(y!=-1){
      S.erase(S.find(y));
      ans++;
    }
  }
  printf("%d\n",ans);
  return 0;
}


Compiler output:
Main.java:1: error: illegal character: '#'
#include <bits/stdc++.h>
^
Main.java:1: error: class, interface, enum, or record expected
#include <bits/stdc++.h>
         ^
Main.java:5: error: class, interface, enum, or record expected
typedef long long ll;
^
Main.java:6: error: class, interface, enum, or record expected
typedef vector<int> vi;
^
Main.java:7: error: class, interface, enum, or record expected
typedef vector<ll> vl;
^
Main.java:8: error: class, interface, enum, or record expected
typedef pair<int,int> pii;
^
Main.java:9: error: class, interface, enum, or record expected
typedef pair<ll,ll> pll;
^
Main.java:11: error: class, interface, enum, or record expected
typedef int _loop_int;
^
Main.java:12: error: illegal character: '#'
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
^
Main.java:12: error: class, interface, enum, or record expected
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
        ^
Main.java:12: error: class, interface, enum, or record expected
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
                                   ^
Main.java:12: error: class, interface, enum, or record expected
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
                                                    ^
Main.java:13: error: illegal character: '#'
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
^
Main.java:13: error: class, interface, enum, or record expected
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
                                                  ^
Main.java:13: error: class, interface, enum, or record expected
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
                                                                   ^
Main.java:14: error: illegal character: '#'
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)
^
Main.java:14: error: class, interface, enum, or record expected
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)
                                                     ^
Main.java:14: error: class, interface, enum, or record expected
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)
                                                                       ^
Main.java:16: error: illegal character: '#'
#define DEBUG(x) cout<<#x<<": "<<x<<endl
^
Main.java:16: error: illegal character: '#'
#define DEBUG(x) cout<<#x<<": "<<x<<endl
                       ^
Main.java:17: error: illegal character: '#'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
^
Main.java:17: error: illegal character: '#'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
                           ^
Main.java:17: error: class, interface, enum, or record expected
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
                                   ^
Main.java:17: error: class, interface, enum, or record expected
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
                                                                  ^
Main.java:18: error: illegal character: '#'
#define ALL(a) (a).begin(),(a).end()
^
Main.java:20: error: illegal character: '#'
#define CHMIN(a,b) a=min((a),(b))
^
Main.java:21: error: illegal character: '#'
#define CHMAX(a,b) a=max((a),(b))
^
Main.java:25: error: illegal character: '#'
#define FIX(a) ((a)%MOD+MOD)%MOD
^
Main.java:25: error: class, interface, enum, or record expected
#define FIX(a) ((a)%MOD+MOD)%MOD
        ^
Main.java:29: error: class, interface, enum, or record expected
const Real EPS = 1e-11;
^
Main.java:30: error: illegal character: '#'
#define EQ0(x) (abs(x)<EPS)
^
Main.java:30: error: class, interface, enum, or record expected
#define EQ0(x) (abs(x)<EPS)
        ^
Main.java:31: error: illegal character: '#'
#define EQ(a,b) (abs(a-b)<EPS)
^
Main.java:34: error: unnamed classes are a preview feature and are disabled by default.
int n;
^
  (use --enable-preview to enable unnamed classes)
Main.java:35: error: class, interface, enum, or record expected
ll a[252521];
^
Main.java:47: error: not a statement
      ll sum = 1ll<<i;
                  ^
Main.java:38: error: illegal start of expression
  scanf("%d",&n);
             ^
Main.java:39: error: ';' expected
  REP(i,n)scanf("%lld",a+i);
          ^
Main.java:41: error: ';' expected
  REP(i,n)S.insert(a[i]);
          ^
Main.java:44: error: illegal start of expression
    ll x = *S.rbegin(); S.erase(S.find(x));
           ^
Main.java:46: error: ';' expected
    FORR(i,0,32){
                ^
Main.java:47: error: ';' expected
      ll sum = 1ll<<i;
                 ^
42 errors