Language: C++

#include <bits/stdc++.h>
#define ll long long int
using namespace std;
string s,s1;
ll ar[250007],cr[200098],a,b, test, sum,t,x=0,p,q,y,i,j,k=0,l,cnteven=0,w=0,cnt;
map<ll,ll>mp,br;
void func()
{
    k=0;
    while(mp[k]<=268435456)
    {
        if(k>0)
            mp[++k]=mp[k-1]*2;
        else
            mp[++k]=2;
    }
}
int main()
{
    func();
    ll test;
    cin>>a;
    cnt=0;
    for(i=1; i<=a; i++)
    {
        cin>>ar[i];
        br[ar[i]]+=1;
    }
    sort(ar+1,ar+a+1);

    for(i=a; i>=1; i--)
    {
        if(br[ar[i]]>=1)
            for(j=k; j>=1; j--)
            {
                ll c=mp[j];
                x=c-ar[i];
                if(br[x]==1&&ar[i]!=x)
                {
                    cnt++;
                    br[ar[i]]--;
                    br[x]--;
                    break;
                }
            }
    }


    cout<<cnt;
}
#include <bits/stdc++.h>
#define ll long long int
using namespace std;
string s,s1;
ll ar[250007],cr[200098],a,b, test, sum,t,x=0,p,q,y,i,j,k=0,l,cnteven=0,w=0,cnt;
map<ll,ll>mp,br;
void func()
{
    k=0;
    while(mp[k]<=268435456)
    {
        if(k>0)
            mp[++k]=mp[k-1]*2;
        else
            mp[++k]=2;
    }
}
int main()
{
    func();
    ll test;
    cin>>a;
    cnt=0;
    for(i=1; i<=a; i++)
    {
        cin>>ar[i];
        br[ar[i]]+=1;
    }
    sort(ar+1,ar+a+1);

    for(i=a; i>=1; i--)
    {
        if(br[ar[i]]>=1)
            for(j=k; j>=1; j--)
            {
                ll c=mp[j];
                x=c-ar[i];
                if(br[x]==1&&ar[i]!=x)
                {
                    cnt++;
                    br[ar[i]]--;
                    br[x]--;
                    break;
                }
            }
    }


    cout<<cnt;
}


Compiler output:
a.cc:54:8: error: redefinition of 'std::string s'
   54 | string s,s1;
      |        ^
a.cc:4:8: note: 'std::string s' previously declared here
    4 | string s,s1;
      |        ^
a.cc:54:10: error: redefinition of 'std::string s1'
   54 | string s,s1;
      |          ^~
a.cc:4:10: note: 'std::string s1' previously declared here
    4 | string s,s1;
      |          ^~
a.cc:55:4: error: redefinition of 'long long int ar [250007]'
   55 | ll ar[250007],cr[200098],a,b, test, sum,t,x=0,p,q,y,i,j,k=0,l,cnteven=0,w=0,cnt;
      |    ^~
a.cc:5:4: note: 'long long int ar [250007]' previously declared here
    5 | ll ar[250007],cr[200098],a,b, test, sum,t,x=0,p,q,y,i,j,k=0,l,cnteven=0,w=0,cnt;
      |    ^~
a.cc:55:15: error: redefinition of 'long long int cr [200098]'
   55 | ll ar[250007],cr[200098],a,b, test, sum,t,x=0,p,q,y,i,j,k=0,l,cnteven=0,w=0,cnt;
      |               ^~
a.cc:5:15: note: 'long long int cr [200098]' previously declared here
    5 | ll ar[250007],cr[200098],a,b, test, sum,t,x=0,p,q,y,i,j,k=0,l,cnteven=0,w=0,cnt;
      |               ^~
a.cc:55:26: error: redefinition of 'long long int a'
   55 | ll ar[250007],cr[200098],a,b, test, sum,t,x=0,p,q,y,i,j,k=0,l,cnteven=0,w=0,cnt;
      |                          ^
a.cc:5:26: note: 'long long int a' previously declared here
    5 | ll ar[250007],cr[200098],a,b, test, sum,t,x=0,p,q,y,i,j,k=0,l,cnteven=0,w=0,cnt;
      |                          ^
a.cc:55:28: error: redefinition of 'long long int b'
   55 | ll ar[250007],cr[200098],a,b, test, sum,t,x=0,p,q,y,i,j,k=0,l,cnteven=0,w=0,cnt;
      |                            ^
a.cc:5:28: note: 'long long int b' previously declared here
    5 | ll ar[250007],cr[200098],a,b, test, sum,t,x=0,p,q,y,i,j,k=0,l,cnteven=0,w=0,cnt;
      |                            ^
a.cc:55:31: error: redefinition of 'long long int test'
   55 | ll ar[250007],cr[200098],a,b, test, sum,t,x=0,p,q,y,i,j,k=0,l,cnteven=0,w=0,cnt;
      |                               ^~~~
a.cc:5:31: note: 'long long int test' previously declared here
    5 | ll ar[250007],cr[200098],a,b, test, sum,t,x=0,p,q,y,i,j,k=0,l,cnteven=0,w=0,cnt;
      |                               ^~~~
a.cc:55:37: error: redefinition of 'long long int sum'
   55 | ll ar[250007],cr[200098],a,b, test, sum,t,x=0,p,q,y,i,j,k=0,l,cnteven=0,w=0,cnt;
      |                                     ^~~
a.cc:5:37: note: 'long long int sum' previously declared here
    5 | ll ar[250007],cr[200098],a,b, test, sum,t,x=0,p,q,y,i,j,k=0,l,cnteven=0,w=0,cnt;
      |                                     ^~~
a.cc:55:41: error: redefinition of 'long long int t'
   55 | ll ar[250007],cr[200098],a,b, test, sum,t,x=0,p,q,y,i,j,k=0,l,cnteven=0,w=0,cnt;
      |                                         ^
a.cc:5:41: note: 'long long int t' previously declared here
    5 | ll ar[250007],cr[200098],a,b, test, sum,t,x=0,p,q,y,i,j,k=0,l,cnteven=0,w=0,cnt;
      |                                         ^
a.cc:55:43: error: redefinition of 'long long int x'
   55 | ll ar[250007],cr[200098],a,b, test, sum,t,x=0,p,q,y,i,j,k=0,l,cnteven=0,w=0,cnt;
      |                                           ^
a.cc:5:43: note: 'long long int x' previously defined here
    5 | ll ar[250007],cr[200098],a,b, test, sum,t,x=0,p,q,y,i,j,k=0,l,cnteven=0,w=0,cnt;
      |                                           ^
a.cc:55:47: error: redefinition of 'long long int p'
   55 | ll ar[250007],cr[200098],a,b, test, sum,t,x=0,p,q,y,i,j,k=0,l,cnteven=0,w=0,cnt;
      |                                               ^
a.cc:5:47: note: 'long long int p' previously declared here
    5 | ll ar[250007],cr[200098],a,b, test, sum,t,x=0,p,q,y,i,j,k=0,l,cnteven=0,w=0,cnt;
      |                                               ^
a.cc:55:49: error: redefinition of 'long long int q'
   55 | ll ar[250007],cr[200098],a,b, test, sum,t,x=0,p,q,y,i,j,k=0,l,cnteven=0,w=0,cnt;
      |                                                 ^
a.cc:5:49: note: 'long long int q' previously declared here
    5 | ll ar[250007],cr[200098],a,b, test, sum,t,x=0,p,q,y,i,j,k=0,l,cnteven=0,w=0,cnt;
      |                                                 ^
a.cc:55:51: error: redefinition of 'long long int y'
   55 | ll ar[250007],cr[200098],a,b, test, sum,t,x=0,p,q,y,i,j,k=0,l,cnteven=0,w=0,cnt;
      |                                                   ^
a.cc:5:51: note: 'long long int y' previously declared here
    5 | ll ar[250007],cr[200098],a,b, test, sum,t,x=0,p,q,y,i,j,k=0,l,cnteven=0,w=0,cnt;
      |                                                   ^
a.cc:55:53: error: redefinition of 'long long int i'
   55 | ll ar[250007],cr[200098],a,b, test, sum,t,x=0,p,q,y,i,j,k=0,l,cnteven=0,w=0,cnt;
      |                                                     ^
a.cc:5:53: note: 'long long int i' previously declared here
    5 | ll ar[250007],cr[200098],a,b, test, sum,t,x=0,p,q,y,i,j,k=0,l,cnteven=0,w=0,cnt;
      |                                                     ^
a.cc:55:55: error: redefinition of 'long long int j'
   55 | ll ar[250007],cr[200098],a,b, test, sum,t,x=0,p,q,y,i,j,k=0,l,cnteven=0,w=0,cnt;
      |                                                       ^
a.cc:5:55: note: 'long long int j' previously declared here
    5 | ll ar[250007],cr[200098],a,b, test, sum,t,x=0,p,q,y,i,j,k=0,l,cnteven=0,w=0,cnt;
      |                                                       ^
a.cc:55:57: error: redefinition of 'long long int k'
   55 | ll ar[250007],cr[200098],a,b, test, sum,t,x=0,p,q,y,i,j,k=0,l,cnteven=0,w=0,cnt;
      |                                                         ^
a.cc:5:57: note: 'long long int k' previously defined here
    5 | ll ar[250007],cr[200098],a,b, test, sum,t,x=0,p,q,y,i,j,k=0,l,cnteven=0,w=0,cnt;
      |                                                         ^
a.cc:55:61: error: redefinition of 'long long int l'
   55 | ll ar[250007],cr[200098],a,b, test, sum,t,x=0,p,q,y,i,j,k=0,l,cnteven=0,w=0,cnt;
      |                                                             ^
a.cc:5:61: note: 'long long int l' previously declared here
    5 | ll ar[250007],cr[200098],a,b, test, sum,t,x=0,p,q,y,i,j,k=0,l,cnteven=0,w=0,cnt;
      |                                                             ^
a.cc:55:63: error: redefinition of 'long long int cnteven'
   55 | ll ar[250007],cr[200098],a,b, test, sum,t,x=0,p,q,y,i,j,k=0,l,cnteven=0,w=0,cnt;
      |                                                               ^~~~~~~
a.cc:5:63: note: 'long long int cnteven' previously defined here
    5 | ll ar[250007],cr[200098],a,b, test, sum,t,x=0,p,q,y,i,j,k=0,l,cnteven=0,w=0,cnt;
      |                                                               ^~~~~~~
a.cc:55:73: error: redefinition of 'long long int w'
   55 | ll ar[250007],cr[200098],a,b, test, sum,t,x=0,p,q,y,i,j,k=0,l,cnteven=0,w=0,cnt;
      |                                                                         ^
a.cc:5:73: note: 'long long int w' previously defined here
    5 | ll ar[250007],cr[200098],a,b, test, sum,t,x=0,p,q,y,i,j,k=0,l,cnteven=0,w=0,cnt;
      |                                                                         ^
a.cc:55:77: error: redefinition of 'long long int cnt'
   55 | ll ar[250007],cr[200098],a,b, test, sum,t,x=0,p,q,y,i,j,k=0,l,cnteven=0,w=0,cnt;
      |                                                                             ^~~
a.cc:5:77: note: 'long long int cnt' previously declared here
    5 | ll ar[250007],cr[200098],a,b, test, sum,t,x=0,p,q,y,i,j,k=0,l,cnteven=0,w=0,cnt;
      |                                                                             ^~~
a.cc:56:11: error: redefinition of 'std::map<long long int, long long int> mp'
   56 | map<ll,ll>mp,br;
      |           ^~
a.cc:6:11: note: 'std::map<long long int, long long int> mp' previously declared here
    6 | map<ll,ll>mp,br;
      |           ^~
a.cc:56:14: error: redefinition of 'std::map<long long int, long long int> br'
   56 | map<ll,ll>mp,br;
      |              ^~
a.cc:6:14: note: 'std::map<long long int, long long int> br' previously declared here
    6 | map<ll,ll>mp,br;
      |              ^~
a.cc:57:6: error: redefinition of 'void func()'
   57 | void func()
      |      ^~~~
a.cc:7:6: note: 'void func()' previously defined here
    7 | void func()
      |      ^~~~
a.cc:68:5: error: redefinition of 'int main()'
   68 | int main()
      |     ^~~~
a.cc:18:5: note: 'int main()' previously defined here
   18 | int main()
      |     ^~~~