Language: C++

Last login: Sat Nov 24 20:52:05 on ttys001
MacBook-Pro-106:~ lisbun$ ls
Applications		Library			node_modules
Desktop			Movies			package-lock.json
Documents		Music			tmp
Downloads		Pictures
Dropbox			Public
MacBook-Pro-106:~ lisbun$ cd tmp
MacBook-Pro-106:tmp lisbun$ ls
CTF	SECCON	c	cpp	python	tool
MacBook-Pro-106:tmp lisbun$ cd cpp
MacBook-Pro-106:cpp lisbun$ ls
ABC042_B.cpp	ABC069_B.cpp	ABC082_A.cpp	ABC087_B.cpp	ABC093_A.cpp
ABC051_B.cpp	ABC071_B.cpp	ABC082_B.cpp	ABC088_A.cpp	ABC093_B.cpp
ABC053_B.cpp	ABC072_B.cpp	ABC083_B.cpp	ABC088_B.cpp	ABC093_C.cpp
ABC064_A.cpp	ABC080_B.cpp	ABC085_A.cpp	ABC090_B.cpp	AGC012_A.cpp
ABC067_B.cpp	ABC081_A.cpp	ABC085_B.cpp	ABC092_A.cpp	AGC025_A.cpp
ABC068_B.cpp	ABC081_B.cpp	ABC086_A.cpp	ABC092_B.cpp	ARC004_A.cpp
MacBook-Pro-106:cpp lisbun$ nvim DPCV_B.cpp
MacBook-Pro-106:cpp lisbun$ gcc DPCV_B.cpp 
DPCV_B.cpp:30:8: error: use of undeclared identifier 'True'; did you mean
      'true'?
        while(True){
              ^~~~
              true
DPCV_B.cpp:38:20: warning: expression result unused [-Wunused-value]
        for (int i=p;p>0;p/2){
                         ~^~
1 warning and 1 error generated.
MacBook-Pro-106:cpp lisbun$ nvim DPCV_B.cpp
MacBook-Pro-106:cpp lisbun$ nvim DPCV_B.cpp
MacBook-Pro-106:cpp lisbun$ gcc DPCV_B.cpp 
Undefined symbols for architecture x86_64:
  "std::__1::basic_istream<char, std::__1::char_traits<char> >::operator>>(int&)", referenced from:
      _main in DPCV_B-db6cfd.o
  "std::__1::basic_ostream<char, std::__1::char_traits<char> >::operator<<(int)", referenced from:
      _main in DPCV_B-db6cfd.o
  "std::__1::cin", referenced from:
      _main in DPCV_B-db6cfd.o
  "std::__1::cout", referenced from:
      _main in DPCV_B-db6cfd.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
MacBook-Pro-106:cpp lisbun$ nvim DPCV_B.cpp
MacBook-Pro-106:cpp lisbun$ gcc DPCV_B.cpp 
Undefined symbols for architecture x86_64:
  "std::__1::basic_istream<char, std::__1::char_traits<char> >::operator>>(int&)", referenced from:
      _main in DPCV_B-784ace.o
  "std::__1::basic_ostream<char, std::__1::char_traits<char> >::operator<<(int)", referenced from:
      _main in DPCV_B-784ace.o
  "std::__1::cin", referenced from:
      _main in DPCV_B-784ace.o
  "std::__1::cout", referenced from:
      _main in DPCV_B-784ace.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
MacBook-Pro-106:cpp lisbun$ nvim DPCV_B.cpp
MacBook-Pro-106:cpp lisbun$ gcc DPCV_B.cpp 
Undefined symbols for architecture x86_64:
  "std::__1::basic_istream<char, std::__1::char_traits<char> >::operator>>(int&)", referenced from:
      _main in DPCV_B-07eb27.o
  "std::__1::basic_ostream<char, std::__1::char_traits<char> >::operator<<(int)", referenced from:
      _main in DPCV_B-07eb27.o
  "std::__1::cin", referenced from:
      _main in DPCV_B-07eb27.o
  "std::__1::cout", referenced from:
      _main in DPCV_B-07eb27.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
MacBook-Pro-106:cpp lisbun$ nvim DPCV_B.cpp
MacBook-Pro-106:cpp lisbun$ nvim DPCV_B.cpp

#include <iostream>
using namespace std;

int main()
{
        int N,K;
        cin >> N >> K;
        int A_sum[1100];
        A_sum[0] = 0;
        for (int i=1;i<N+1;i++){
                int tmp;
                cin >> tmp;
                A_sum[i] = A_sum[i-1]+tmp;
        }

        int score[1000000];
        int count=0;
        int max = 0;
        for (int r=1;r<N+1;r++){
                for (int l=0;l<r;l++){
                        score[count] = A_sum[r]-A_sum[l];
                        if(score[count] > max){
                                max = score[count];
                        }
                        count+=1;
                }
        }

        int p = 1;
        while(true){
                if(p*2>max)
                        break;
                else
                        p *= 2;
        }

        int ans = 0;
        for (int i=p;p>0;p/=2){
                int count_a = 0;
                int count_b = 0;
                int score_a[1000000];
                int score_b[1000000];
                for (int j=0;j<count;j++){
                        if(score[j]>=i){
                                score[j] -= i;
                                score_a[count_a] = score[j];
                                count_a += 1;
                        }
                        score_b[count_b] = score[j];
                        count_b += 1;
                }
                if(count_a >= K){
                        ans += i;
                        for (int k=0;k<count_a;k++){
                                score[k] = score_a[k];
                        }
                        count = count_a;
                }
                else{
                        for (int k=0;k<count_b;k++){
                                score[k] = score_b[k];
                        }
                        count = count_b;
                }
        }

        cout << ans;
        return 0;
}


Compiler output:
a.cc:21:54: warning: multi-character character constant [-Wmultichar]
   21 | DPCV_B.cpp:30:8: error: use of undeclared identifier 'True'; did you mean
      |                                                      ^~~~~~
a.cc:22:7: warning: multi-character character constant [-Wmultichar]
   22 |       'true'?
      |       ^~~~~~
a.cc:61:23: error: exponent has no digits
   61 |       _main in DPCV_B-07eb27.o
      |                       ^~~~~~~~
a.cc:63:23: error: exponent has no digits
   63 |       _main in DPCV_B-07eb27.o
      |                       ^~~~~~~~
a.cc:65:23: error: exponent has no digits
   65 |       _main in DPCV_B-07eb27.o
      |                       ^~~~~~~~
a.cc:67:23: error: exponent has no digits
   67 |       _main in DPCV_B-07eb27.o
      |                       ^~~~~~~~
a.cc:1:1: error: 'Last' does not name a type
    1 | Last login: Sat Nov 24 20:52:05 on ttys001
      | ^~~~
a.cc:21:62: error: 'did' does not name a type
   21 | DPCV_B.cpp:30:8: error: use of undeclared identifier 'True'; did you mean
      |                                                              ^~~