Language: C++

//
//  DPC-yo-5-b.cpp
//  
//
//  Created by Yoshida Satoshi on 2018/11/24.
//

#include <stdio.h>
#include <iostream>
#include <vector>
#include <set>
#include <cmath>
#include <algorithm>

using namespace std;
typedef unsigned long long uull;

int main()
{
    ull n,k;
    ull a[2000];
    cin>>n>>k;
    for(ull i=0;i<n;i++) cin>>a[i];
    
    bool b[2000000][100];
    ull c[2000000];
    
    ull cnt=0;
    for(ull i=0;i<n;i++)
    {
        ull tmp=0;
        for(ull j=i;j<n;j++)
        {
            tmp+=a[j]*1ull;
            c[cnt]=tmp;
            cnt++;
        }
    }
    
    ull keta=0;
    
    for(ull i=0;i<n;i++)
    {
        for(ull j=0;j<100;j++)
        {
            b[i][j]=false;
        }
    }
    
    for(ull i=0;i<cnt;i++)
    {
        for(ull j=0;j<100;j++)
        {
            if(lldiv(c[i],2).rem==1) b[i][j]=true;
            c[i]=c[i]>>1;
            if(c[i]==0)
            {
                keta=max(keta,j);
                break;
            }
        }
    }
    keta=99;
    
    set<ull> st;
    for(ull i=0;i<cnt;i++)
    {
        st.insert(i);
    }
    
    ull ans=0;
    
    bool flag[100];
    
    for(int i=0;i<=keta;i++) flag[i]=false;
    
    for(ull i=keta;i>=0;i--)
    {
        ans=ans<<1;
        ull num=0;
        for(auto itr=st.begin();itr!=st.end();itr++)
        {
            if(b[*itr][i]) num++;
        }
        
        if(num<k) continue;
        
        ans++;
        
        for(auto itr=st.begin();itr!=st.end();itr++)
        {
            if(!b[*itr][i]) st.erase(itr);
        }
    }
    
    cout<<ans<<endl;
    
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:5: error: 'ull' was not declared in this scope; did you mean 'uull'?
   20 |     ull n,k;
      |     ^~~
      |     uull
a.cc:21:8: error: expected ';' before 'a'
   21 |     ull a[2000];
      |        ^~
      |        ;
a.cc:22:10: error: 'n' was not declared in this scope; did you mean 'yn'?
   22 |     cin>>n>>k;
      |          ^
      |          yn
a.cc:22:13: error: 'k' was not declared in this scope
   22 |     cin>>n>>k;
      |             ^
a.cc:23:12: error: expected ';' before 'i'
   23 |     for(ull i=0;i<n;i++) cin>>a[i];
      |            ^~
      |            ;
a.cc:23:17: error: 'i' was not declared in this scope
   23 |     for(ull i=0;i<n;i++) cin>>a[i];
      |                 ^
a.cc:23:31: error: 'a' was not declared in this scope
   23 |     for(ull i=0;i<n;i++) cin>>a[i];
      |                               ^
a.cc:26:8: error: expected ';' before 'c'
   26 |     ull c[2000000];
      |        ^~
      |        ;
a.cc:28:8: error: expected ';' before 'cnt'
   28 |     ull cnt=0;
      |        ^~~~
      |        ;
a.cc:29:12: error: expected ';' before 'i'
   29 |     for(ull i=0;i<n;i++)
      |            ^~
      |            ;
a.cc:29:17: error: 'i' was not declared in this scope
   29 |     for(ull i=0;i<n;i++)
      |                 ^
a.cc:31:12: error: expected ';' before 'tmp'
   31 |         ull tmp=0;
      |            ^~~~
      |            ;
a.cc:32:16: error: expected ';' before 'j'
   32 |         for(ull j=i;j<n;j++)
      |                ^~
      |                ;
a.cc:32:21: error: 'j' was not declared in this scope
   32 |         for(ull j=i;j<n;j++)
      |                     ^
a.cc:34:13: error: 'tmp' was not declared in this scope; did you mean 'tm'?
   34 |             tmp+=a[j]*1ull;
      |             ^~~
      |             tm
a.cc:34:18: error: 'a' was not declared in this scope
   34 |             tmp+=a[j]*1ull;
      |                  ^
a.cc:35:13: error: 'c' was not declared in this scope
   35 |             c[cnt]=tmp;
      |             ^
a.cc:35:15: error: 'cnt' was not declared in this scope; did you mean 'int'?
   35 |             c[cnt]=tmp;
      |               ^~~
      |               int
a.cc:40:8: error: expected ';' before 'keta'
   40 |     ull keta=0;
      |        ^~~~~
      |        ;
a.cc:42:12: error: expected ';' before 'i'
   42 |     for(ull i=0;i<n;i++)
      |            ^~
      |            ;
a.cc:42:17: error: 'i' was not declared in this scope
   42 |     for(ull i=0;i<n;i++)
      |                 ^
a.cc:44:16: error: expected ';' before 'j'
   44 |         for(ull j=0;j<100;j++)
      |                ^~
      |                ;
a.cc:44:21: error: 'j' was not declared in this scope
   44 |         for(ull j=0;j<100;j++)
      |                     ^
a.cc:50:12: error: expected ';' before 'i'
   50 |     for(ull i=0;i<cnt;i++)
      |            ^~
      |            ;
a.cc:50:17: error: 'i' was not declared in this scope
   50 |     for(ull i=0;i<cnt;i++)
      |                 ^
a.cc:50:19: error: 'cnt' was not declared in this scope; did you mean 'int'?
   50 |     for(ull i=0;i<cnt;i++)
      |                   ^~~
      |                   int
a.cc:52:16: error: expected ';' before 'j'
   52 |         for(ull j=0;j<100;j++)
      |                ^~
      |                ;
a.cc:52:21: error: 'j' was not declared in this scope
   52 |         for(ull j=0;j<100;j++)
      |                     ^
a.cc:54:22: error: 'c' was not declared in this scope
   54 |             if(lldiv(c[i],2).rem==1) b[i][j]=true;
      |                      ^
a.cc:55:13: error: 'c' was not declared in this scope
   55 |             c[i]=c[i]>>1;
      |             ^
a.cc:58:17: error: 'keta' was not declared in this scope
   58 |                 keta=max(keta,j);
      |                 ^~~~
a.cc:63:5: error: 'keta' was not declared in this scope
   63 |     keta=99;
      |     ^~~~
a.cc:65:12: error: template argument 2 is invalid
   65 |     set<ull> st;
      |            ^
a.cc:65:12: error: template argument 3 is invalid
a.cc:66:12: error: expected ';' before 'i'
   66 |     for(ull i=0;i<cnt;i++)
      |            ^~
      |            ;
a.cc:66:17: error: 'i' was not declared in this scope
   66 |     for(ull i=0;i<cnt;i++)
      |                 ^
a.cc:66:19: error: 'cnt' was not declared in this scope; did you mean 'int'?
   66 |     for(ull i=0;i<cnt;i++)
      |                   ^~~
      |                   int
a.cc:68:12: error: request for member 'insert' in 'st', which is of non-class type 'int'
   68 |         st.insert(i);
      |            ^~~~~~
a.cc:71:8: error: expected ';' before 'ans'
   71 |     ull ans=0;
      |        ^~~~
      |        ;
a.cc:77:12: error: expected ';' before 'i'
   77 |     for(ull i=keta;i>=0;i--)
      |            ^~
      |            ;
a.cc:77:20: error: 'i' was not declared in this scope
   77 |     for(ull i=keta;i>=0;i--)
      |                    ^
a.cc:79:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   79 |         ans=ans<<1;
      |         ^~~
      |         abs
a.cc:80:12: error: expected ';' before 'num'
   80 |         ull num=0;
      |            ^~~~
      |            ;
a.cc:81:25: error: request for member 'begin' in 'st', which is of non-class type 'int'
   81 |         for(auto itr=st.begin();itr!=st.end();itr++)
      |                         ^~~~~
a.cc:81:41: error: request for member 'end' in 'st', which is of non-class type 'int'
   81 |         for(auto itr=st.begin();itr!=st.end();itr++)
      |                                         ^~~
a.cc:83:28: error: 'num' was not declared in this scope; did you mean 'enum'?
   83 |             if(b[*itr][i]) num++;
      |                            ^~~
      |                            enum
a.cc:86:12: error: 'num' was not declared in this scope; did you mean 'enum'?
   86 |         if(num<k) continue;
      |            ^~~
      |            enum
a.cc:90:25: error: request for member 'begin' in 'st', which is of non-class type 'int'
   90 |         for(auto itr=st.begin();itr!=st.end();itr++)
      |                         ^~~~~
a.cc:90:41: error: request for member 'end' in 'st', which is of non-class type 'int'
   90 |         for(auto itr=st.begin();itr!=st.end();itr++)
      |                                         ^~~
a.cc:92:32: error: request for member 'erase' in 'st', which is of non-class type 'int'
   92 |             if(!b[*itr][i]) st.erase(itr);
      |                                ^~~~~
a.cc:96:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
   96 |     cout<<ans<<endl;
      |           ^~~
      |           abs