Language: C++

/*************Global variable  **************/
int N ;
char str[26];
std::map<char,int> M ;
/*******************************/

int main(){
  if (DEBUG){
    std::printf("******debug mode********\n");
  }
  cin >> N ;

  int a[N] ;
  int b[N ];
  REP(i,N){
    cin >> a[i];
  }
  REP(i,N){
    cin >> b[i];
  }
  int ans =0 ;
  int suma = 0 ;
  int sumb = 0 ;
  for(int i = 0 ; i < N ; i++){
    suma = b[N-1];
    sumb = b[i];
    for(int j = i+1 ; j < N ; j++){
      suma += a[j] +a[i] ;
      sumb += b[j] +a[i];
    } 
    if( max(suma,sumb) == sumb){
      ans += sumb ;
      cout << ans << endl;
      return 0 ;
    }

    ans += a[i];

    suma =0 ;
    sumb = 0 ;
  }
  ans += b[N-1];
  cout << ans << endl;



  if (DEBUG){
    std::printf("******debug********\n");

    std::printf("******debug********\n");
  }
  return 0 ;
}

//各地点までの部分和を計算する
void perSum(ll *a , ll *sum ,int n){
  int i ;
  sum[0] = a[0];
  for(i = 1 ; i < n ; i++){
    sum[i] = a[i] + sum[i-1];
  }

}


Compiler output:
a.cc:4:6: error: 'map' in namespace 'std' does not name a template type
    4 | std::map<char,int> M ;
      |      ^~~
a.cc:1:1: note: 'std::map' is defined in header '<map>'; this is probably fixable by adding '#include <map>'
  +++ |+#include <map>
    1 | /*************Global variable  **************/
a.cc: In function 'int main()':
a.cc:8:7: error: 'DEBUG' was not declared in this scope
    8 |   if (DEBUG){
      |       ^~~~~
a.cc:9:10: error: 'printf' is not a member of 'std'
    9 |     std::printf("******debug mode********\n");
      |          ^~~~~~
a.cc:11:3: error: 'cin' was not declared in this scope
   11 |   cin >> N ;
      |   ^~~
a.cc:15:7: error: 'i' was not declared in this scope
   15 |   REP(i,N){
      |       ^
a.cc:15:3: error: 'REP' was not declared in this scope
   15 |   REP(i,N){
      |   ^~~
a.cc:31:9: error: 'max' was not declared in this scope
   31 |     if( max(suma,sumb) == sumb){
      |         ^~~
a.cc:33:7: error: 'cout' was not declared in this scope
   33 |       cout << ans << endl;
      |       ^~~~
a.cc:33:22: error: 'endl' was not declared in this scope
   33 |       cout << ans << endl;
      |                      ^~~~
a.cc:43:3: error: 'cout' was not declared in this scope
   43 |   cout << ans << endl;
      |   ^~~~
a.cc:43:18: error: 'endl' was not declared in this scope
   43 |   cout << ans << endl;
      |                  ^~~~
a.cc:47:7: error: 'DEBUG' was not declared in this scope
   47 |   if (DEBUG){
      |       ^~~~~
a.cc:48:10: error: 'printf' is not a member of 'std'
   48 |     std::printf("******debug********\n");
      |          ^~~~~~
a.cc:50:10: error: 'printf' is not a member of 'std'
   50 |     std::printf("******debug********\n");
      |          ^~~~~~
a.cc: At global scope:
a.cc:56:6: error: variable or field 'perSum' declared void
   56 | void perSum(ll *a , ll *sum ,int n){
      |      ^~~~~~
a.cc:56:13: error: 'll' was not declared in this scope
   56 | void perSum(ll *a , ll *sum ,int n){
      |             ^~
a.cc:56:17: error: 'a' was not declared in this scope
   56 | void perSum(ll *a , ll *sum ,int n){
      |                 ^
a.cc:56:21: error: 'll' was not declared in this scope
   56 | void perSum(ll *a , ll *sum ,int n){
      |                     ^~
a.cc:56:25: error: 'sum' was not declared in this scope
   56 | void perSum(ll *a , ll *sum ,int n){
      |                         ^~~
a.cc:56:30: error: expected primary-expression before 'int'
   56 | void perSum(ll *a , ll *sum ,int n){
      |                              ^~~