criyle/codenet-compile-errors huggingface dataset:
Language: C++

bool isDone(vector<int> box)
{
    for (int i = 0; i < box.size(); i++)
    {
        if (box[i] != 0)
        {
            return false;
        }
    }
    return true;
}

bool isZero(vector<int> box)
{
    for (int i = 0; i < box.size(); i++)
    {
        if (box[i] == 0)
        {
            return true;
        }
    }
    return false;
}

int main(void)
{
    int N;
    cin >> N;

    vector<int> h(N);
    for (int i = 0; i < N; i++)
    {
        cin >> h[i];
    }

    int cnt = 0;
    while (isDone(h) == false)
    {
        if (isZero(h) == false)
        {
            // -1 from every pos
            for (int i = 0; i < N; i++)
            {
                h[i]--;
                // printf("%d ", h[i]);
            }
            // printf("\n");
        }
        else
        {
            bool start_found = false;
            bool goal_found = false;
            for (int i = 0; i < N; i++)
            {
                if (h[i] > 0)
                {
                    start_found = true;
                    h[i]--;
                }
                else if (h[i] == 0 && start_found == true)
                {
                    goal_found = true;
                }
                if (start_found == true && goal_found == true)
                {
                    break;
                }
            }
        }
        // for (int i = 0; i < N; i++)
        // {
        //     printf("%d ", h[i]);
        // }
        // printf("\n");
        cnt++;
    }
    cout << cnt << endl;
    return (0);
}

Compiler output:
a.cc:1:13: error: 'vector' was not declared in this scope
    1 | bool isDone(vector<int> box)
      |             ^~~~~~
a.cc:1:20: error: expected primary-expression before 'int'
    1 | bool isDone(vector<int> box)
      |                    ^~~
a.cc:13:13: error: 'vector' was not declared in this scope
   13 | bool isZero(vector<int> box)
      |             ^~~~~~
a.cc:13:20: error: expected primary-expression before 'int'
   13 | bool isZero(vector<int> box)
      |                    ^~~
a.cc: In function 'int main()':
a.cc:28:5: error: 'cin' was not declared in this scope
   28 |     cin >> N;
      |     ^~~
a.cc:30:5: error: 'vector' was not declared in this scope
   30 |     vector<int> h(N);
      |     ^~~~~~
a.cc:30:12: error: expected primary-expression before 'int'
   30 |     vector<int> h(N);
      |            ^~~
a.cc:33:16: error: 'h' was not declared in this scope
   33 |         cin >> h[i];
      |                ^
a.cc:37:19: error: 'h' was not declared in this scope
   37 |     while (isDone(h) == false)
      |                   ^
a.cc:37:20: error: 'isDone' cannot be used as a function
   37 |     while (isDone(h) == false)
      |                    ^
a.cc:39:19: error: 'isZero' cannot be used as a function
   39 |         if (isZero(h) == false)
      |             ~~~~~~^~~
a.cc:77:5: error: 'cout' was not declared in this scope
   77 |     cout << cnt << endl;
      |     ^~~~
a.cc:77:20: error: 'endl' was not declared in this scope
   77 |     cout << cnt << endl;
      |                    ^~~~
Language: C

#include <stdio.h>

void main(){
int N;
scanf("%d",&N);
int i;
int ans = 0;
int prev = 0;
for(i=0;i<N;i++){
int now;
scanf("%d",%now);
if(now<ans){
ans+=now;
}
prev=now;
}
printf("%d\n",ans);
}

Compiler output:
main.c: In function 'main':
main.c:11:12: error: expected expression before '%' token
   11 | scanf("%d",%now);
      |            ^
Language: C++


#include<iostream>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip>//setprecision
#include<math.h>
#include <functional>
#include<climits>
using namespace std;
#define rep(i, n)        for(int i=0; i<(int)(n); ++i)
#define ll  long long 
#define mod 1000000007
  vector<ll>to[1000005];
int main(){
  ll a,b,c=0,d=0;cin>>a;
  rep(i,a){
    cin>>b;
    d+=max(b-c,0);
    c=b;
  }
  cout<<d;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:11: error: no matching function for call to 'max(long long int, int)'
   32 |     d+=max(b-c,0);
      |        ~~~^~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:32:11: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   32 |     d+=max(b-c,0);
      |        ~~~^~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:5:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:32:11: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   32 |     d+=max(b-c,0);
      |        ~~~^~~~~~~
Language: C++

#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include <map>
#include <cmath>
#include <string>
#include <algorithm>
#include <math.h>
using namespace std;

#define rep(i, o) for (int i = 0; i < (o); ++i)
#define REP(i,a,b)for(int i=(int)(a);(i)<(int)(b);i++)
#define NUM 1e5

typedef long long ll;
typedef unsigned long long ull;

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll c, ll d) { return c / gcd(c, d) * d; }

int main() {
  ll n; 
  cin >> n;

  vector<ll> grand_garden(n); ll max_h = 0;
  rep(i, n) {
      cin >> grand_garden[i];
      max_h = max(grand_garden[i],max_h);
  }

  ll water_num = 0;
  while (true) {
    if (*max_element(grand_garden.begin(), grand_garden.end()) == 0) break;
    while (i < n) {
        if (grand_garden[i] == 0) i++;
        else
        {
            water_num++;
            while (i < n && grand_garden[i] > 0)
            {
                /* code */
                grand_garden[i]--;
                i++;
            }
        }
    }
  }
  cout << water_num << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:12: error: 'i' was not declared in this scope
   34 |     while (i < n) {
      |            ^
Language: C++

#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include <map>
#include <cmath>
#include <string>
#include <math.h>
using namespace std;

#define rep(i, o) for (int i = 0; i < (o); ++i)
#define REP(i,a,b)for(int i=(int)(a);(i)<(int)(b);i++)
#define NUM 1e5

typedef long long ll;
typedef unsigned long long ull;

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll c, ll d) { return c / gcd(c, d) * d; }

int main() {
  ll n; 
  cin >> n;

  vector<ll> grand_garden(n); ll max_h = 0;
  rep(i, n) {
      cin >> grand_garden[i];
      max_h = max(grand_garden[i],max_h);
  }

  ll water_num = 0;
  rep(g, max_h+1) {
    rep(i, n) {
        if (grand_garden[i] == 0) i++;
        else (grand_garden[i])
        {
            water_num++;
            while (i < n && grand_garden[i] > 0)
            {
                /* code */
                grand_garden[i]--;
                i++;
            }
        }
    }
  }
  cout << water_num << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:31: error: expected ';' before '{' token
   34 |         else (grand_garden[i])
      |                               ^
      |                               ;
   35 |         {
      |         ~                      
a.cc:34:29: warning: ignoring return value of 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = long long int; _Alloc = std::allocator<long long int>; reference = long long int&; size_type = long unsigned int]', declared with attribute 'nodiscard' [-Wunused-result]
   34 |         else (grand_garden[i])
      |                             ^
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:1128:7: note: declared here
 1128 |       operator[](size_type __n) _GLIBCXX_NOEXCEPT
      |       ^~~~~~~~
Language: C++

#include<algorithm>//sort(all(変数),greater<型名>())　で降順に
#include<bits/stdc++.h>
#include<cmath>//切り上げceil(値)
#include<deque>
#include<iomanip>//setprecision(数字)
#include<iostream>
#include<list>
#include<map>
#include<numeric> //xとyの最大公約数は__gcd(x,y),xとyの最小公倍数は(x*y)/__gcd
#include<queue>//priority_queue<型名> 変数：優先度付きキュー　最大値の探索が早い
#include<set>
#include<stack>
#include<string>
#include<vector> //*max_element(all(変数))で最大値を獲得
#define rep0(i,n)  for(ll i=0; i<n; i++)
#define rrep0(i,n) for(ll i=n-1; 0<=i; i--)
#define vll vector<ll>
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define INF 1e18
using ll = long long;
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main() {
  int n;  cin >> n;
  vector<int> h(n);  rep0(i,n) cin >> h[i];

  int tall = 0, ans = 0;
  rep(i,n){
    if(tall < h[i]) ans += h[i]-tall;
    tall = h[i];
    cout <<"i="<<i<<" ans="<< ans <<"\n";
  }
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:31:7: error: 'i' was not declared in this scope
   31 |   rep(i,n){
      |       ^
a.cc:31:3: error: 'rep' was not declared in this scope; did you mean 'rep0'?
   31 |   rep(i,n){
      |   ^~~
      |   rep0
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0;i < (n);i++)
using namespace std;
using ll = long long;
using pii = pair<int,int>;

int main(){
    int n;
    cin >> n;
    vector<int> h(n);
    rep(i,n) cin >> h[i];
    int res = 0;
    while(true){
        if(*max_element(h.begin(),h.end()) == 0) break;
        int i = 0;
        while(i < n){
            if(h[i] == 0)i++;
            else{
                res++;
                while(i < N && h[i] > 0){
                    h[i]--;
                    i++;
                }
            }
        }
    }
    cout << res << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:27: error: 'N' was not declared in this scope
   20 |                 while(i < N && h[i] > 0){
      |                           ^
Language: C++

#include <bits/stdc++.h>
using namespace std;

int n;
int h[101];

int main() {
    cin >> n;
    for(int i=0;i<n;i++) cin >> h[i];
    long long ans=0;
    h[n]=0;
    for(int i=1;i<=n;i++){
        if(h[i-1]>h[i]) ans+=h[i-1]-j[i];
    }
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:37: error: 'j' was not declared in this scope
   13 |         if(h[i-1]>h[i]) ans+=h[i-1]-j[i];
      |                                     ^
Language: C++

#include <bits/stdc++.h>
#define rep(i,s,n) for (int i=(s); i<(n); i++)
using namespace std;
using ll = long long;
 
int main()
{
    ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
 
    int N;
    cin >> N;
 
    vector<int> h(N);
    rep(i,N) cin >> h[i];
 
    int sum = h[0];
    rep(i,1,N) sum += max(h[i] - h[i - 1], 0);

    cout << sum << endl;
 
    return 0;
}

Compiler output:
a.cc:14:12: error: macro "rep" requires 3 arguments, but only 2 given
   14 |     rep(i,N) cin >> h[i];
      |            ^
a.cc:2:9: note: macro "rep" defined here
    2 | #define rep(i,s,n) for (int i=(s); i<(n); i++)
      |         ^~~
a.cc: In function 'int main()':
a.cc:14:5: error: 'rep' was not declared in this scope
   14 |     rep(i,N) cin >> h[i];
      |     ^~~
Language: C++

n = int(input())
h = list(map(int,input().split()))

from collections import deque

d = deque()

d.append(h)
ans = 0

while d:
    p = d.pop()
    if p:
        p_min = min(p)

        p0 = []
        pp = []

        for i in range(len(p)):
            pp.append(p[i]-p_min)
            if p[i] - p_min == 0:
                p0.append(i)
        ans += p_min
        '''
        print(ans)
        print(pp)
        print(p0)
        '''
    
        for i in range(len(p0)-1):
            d.append(pp[p0[i]+1:p0[i+1]]) 
        d.append(pp[:p0[0]])
        d.append(pp[p0[len(p0)-1]+1:])

print(ans)

Compiler output:
a.cc:24:9: error: empty character constant
   24 |         '''
      |         ^~
a.cc:24:11: warning: missing terminating ' character
   24 |         '''
      |           ^
a.cc:24:11: error: missing terminating ' character
a.cc:28:9: error: empty character constant
   28 |         '''
      |         ^~
a.cc:28:11: warning: missing terminating ' character
   28 |         '''
      |           ^
a.cc:28:11: error: missing terminating ' character
a.cc:1:1: error: 'n' does not name a type
    1 | n = int(input())
      | ^
Language: C++

// ref: https://drken1215.hatenablog.com/entry/2019/03/03/150200

#include <bits/stdc++.h>
using namespace std;

int main(){
    uint N; cin >> N;
    vector<int> vH(N);
    for(uint i=0; i<N; ++i){ cin>>vH[i]; }
    
    int64 cnt=0ll;
    for(uint i=0;;){
        bool isAllZero=true;
        while( i<vH.size() && vH[i]==0 ){ ++i; } // pass empty
        while( i<vH.size() && vH[i]!=0 ){ --vH[i]; ++i; isAllZero=false; }
        ++cnt;
        
        if(isAllZero){ break; }
        if(i==vH.size()){ i=0; }
    }
    cout << cnt << endl;
    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:5: error: 'int64' was not declared in this scope
   11 |     int64 cnt=0ll;
      |     ^~~~~
a.cc:16:11: error: 'cnt' was not declared in this scope; did you mean 'int'?
   16 |         ++cnt;
      |           ^~~
      |           int
a.cc:21:13: error: 'cnt' was not declared in this scope; did you mean 'int'?
   21 |     cout << cnt << endl;
      |             ^~~
      |             int
Language: C++

#include <bits/stdc++.h>
typedef long long ll;
using namespace std;

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define ALL(v) (v.begin(),v.end())
#define COUT(x) cout<<(x)<<endl

int main(){
    int n;
    cin >> n;
    int h[n];
    REP(i,n)cin >> h[i];

    int count = 0;
    while(1){
        if(*max_element(h.begin(),h.end())==0)break;
        while(i<n){
            if(h[i]==0)i++;
            else{
                ++count;
                while(i<n&&h[i]!=0){
                    h[i]--;
                    ++i;
                }
            }
        }
    }
    COUT(count);
    return 0;
} 

Compiler output:
a.cc: In function 'int main()':
a.cc:23:27: error: request for member 'begin' in 'h', which is of non-class type 'int [n]'
   23 |         if(*max_element(h.begin(),h.end())==0)break;
      |                           ^~~~~
a.cc:23:37: error: request for member 'end' in 'h', which is of non-class type 'int [n]'
   23 |         if(*max_element(h.begin(),h.end())==0)break;
      |                                     ^~~
a.cc:24:15: error: 'i' was not declared in this scope
   24 |         while(i<n){
      |               ^
Language: Java

import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    long[] h = new long[n];
    for(int i = 0; i < n; i++) {
      h[i] = sc.nextLong();
    }
    System.out.println(func(h));
  }

  public static long func(long[] h) {
    long m = Long.MAX_VALUE;
    for(int i = 0; i < h.size; i++) {
      if(m > h[i]) m = h[i];
    }
    ArrayList<Integer> list = new ArrayList<Integer>();
    for(int i = 0; i < h.size; i++) {
      if(h[i] == m) list.add(i);
    }
    long ret = m;
    for(int i = 0; i < list.size(); i++) {
      int t1 = list.get(i) + 1;
      int t2 = 0;
      if(i < list.size() - 1) {
        t2 = list.get(i + 1) - 1;
      } else {
        t2 = h.size - 1;
      }
      if(t2 >= t1) {
        long[] s = new long[t2 - t1 + 1];
        for(int j = 0; j < (t2 - t1 + 1); j++) {
          s[j] = h[t1 + j];
        }
        ret += func(s);
      }
    }
    return ret;
  }
}

Compiler output:
Main.java:16: error: cannot find symbol
    for(int i = 0; i < h.size; i++) {
                        ^
  symbol:   variable size
  location: variable h of type long[]
Main.java:20: error: cannot find symbol
    for(int i = 0; i < h.size; i++) {
                        ^
  symbol:   variable size
  location: variable h of type long[]
Main.java:30: error: cannot find symbol
        t2 = h.size - 1;
              ^
  symbol:   variable size
  location: variable h of type long[]
3 errors
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long; // ll は long long　と同じとする。
int main() {
    int N;
    cin >> N;
    vector <int> h(N);
    int sum = 0;
    int num = 0;
    for(int i = 0; i < N; i++){
        cin >> H.at(i);
        sum += abs(num - H.at(i));
        num = H.at(i);
    }
    sum += num;
    cout << sum / 2 << endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:16: error: 'H' was not declared in this scope
   11 |         cin >> H.at(i);
      |                ^
Language: C++

N = int(input())
h = [int(input()) for _ in range(N)]

x = min(h)

for i in range(0, h - 1):
    if h[i] > h[i + 1]:
        x = x + (h[i] - h[i + 1])

x = x + (h[N - 1] - min(h))
print(x)


Compiler output:
a.cc:1:1: error: 'N' does not name a type
    1 | N = int(input())
      | ^
Language: C

#include<stdio.h>
int main(void){
  int n=0;
  int h[n];
  int mizuyariCount=0;
  int l=0;
  int r=n;
  bool allZero=False;
  
  //本数指定
  scanf("%d",&n);
  for(int i=0;i<n;i++){
    //要素ごとの高さ指定
    scanf("%d",&h[i]);
  }
  
  //ここからmizuyari を Count
  while(allZero==True){
    
  	// l の指定
  	for(int j=0;j<n;j++){
    	if(h[n]!=0){
      	  l=j;
          break;
    	}
    }
      // r の指定
      for(int k=0;k<n;k++){
        if(h[n]==0){
          r = k -1;
        }
      }

    //0でない部分で水やり    
    for(l;l<r;l++){
      h[l] = h[l]-1;
    }
    mizuyariCount++;
  }
  printf(mizuyariCount);
  return 0;
  }
  

  

Compiler output:
main.c: In function 'main':
main.c:8:3: error: unknown type name 'bool'
    8 |   bool allZero=False;
      |   ^~~~
main.c:2:1: note: 'bool' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
    1 | #include<stdio.h>
  +++ |+#include <stdbool.h>
    2 | int main(void){
main.c:8:16: error: 'False' undeclared (first use in this function)
    8 |   bool allZero=False;
      |                ^~~~~
main.c:8:16: note: each undeclared identifier is reported only once for each function it appears in
main.c:18:18: error: 'True' undeclared (first use in this function)
   18 |   while(allZero==True){
      |                  ^~~~
main.c:40:10: error: passing argument 1 of 'printf' makes pointer from integer without a cast [-Wint-conversion]
   40 |   printf(mizuyariCount);
      |          ^~~~~~~~~~~~~
      |          |
      |          int
In file included from main.c:1:
/usr/include/stdio.h:363:43: note: expected 'const char * restrict' but argument is of type 'int'
  363 | extern int printf (const char *__restrict __format, ...);
      |                    ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n); i++)
#define INF 1000000000000
using ll = long long;


int main(){
  int n;
  vector<int>> h(n);
  rep(i,n) cin >> h.at(i);
  ll ans = h.at(0);
  rep(i,n-1){
    if(h.at(i)<h.at(i+1))ans+=(h.at(i+1)-h.at(i));
  }
  cout<<ans<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:13: error: expected unqualified-id before '>' token
   12 |   vector<int>> h(n);
      |             ^~
a.cc:13:19: error: 'h' was not declared in this scope
   13 |   rep(i,n) cin >> h.at(i);
      |                   ^
a.cc:14:12: error: 'h' was not declared in this scope
   14 |   ll ans = h.at(0);
      |            ^
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main() {
int N;
  cin >> N;
  int flo[110];
  for(int i = 0; i < N; i++){
    cin >> flo[i];
  }
  sort(flo.begin(), flo.end());
    reverse(flo.begin(), flo.end());
  int water = 0;
  for(int i = 1; i < N; i++){
    water += flo[0] - flo[i];
  }
  cout << water << endl;
  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:12: error: request for member 'begin' in 'flo', which is of non-class type 'int [110]'
   11 |   sort(flo.begin(), flo.end());
      |            ^~~~~
a.cc:11:25: error: request for member 'end' in 'flo', which is of non-class type 'int [110]'
   11 |   sort(flo.begin(), flo.end());
      |                         ^~~
a.cc:12:17: error: request for member 'begin' in 'flo', which is of non-class type 'int [110]'
   12 |     reverse(flo.begin(), flo.end());
      |                 ^~~~~
a.cc:12:30: error: request for member 'end' in 'flo', which is of non-class type 'int [110]'
   12 |     reverse(flo.begin(), flo.end());
      |                              ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main() {
int N;
  cin >> N;
  int flo[N];
  for(int i = 0; i < N; i++){
    cin >> flo[i];
  }
  sort(flo.begin(), flo.end());
    reverse(flo.begin(), flo.end());
  int water = 0;
  for(int i = 1; i < N; i++){
    water += flo[0] - flo[i];
  }
  cout << water << endl;
  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:12: error: request for member 'begin' in 'flo', which is of non-class type 'int [N]'
   11 |   sort(flo.begin(), flo.end());
      |            ^~~~~
a.cc:11:25: error: request for member 'end' in 'flo', which is of non-class type 'int [N]'
   11 |   sort(flo.begin(), flo.end());
      |                         ^~~
a.cc:12:17: error: request for member 'begin' in 'flo', which is of non-class type 'int [N]'
   12 |     reverse(flo.begin(), flo.end());
      |                 ^~~~~
a.cc:12:30: error: request for member 'end' in 'flo', which is of non-class type 'int [N]'
   12 |     reverse(flo.begin(), flo.end());
      |                              ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main() {
int N;
  cin >> N;
  int flo[N];
  for(int i = 0; i < N; i++){
    cin >> flo[i];
  }
  sort(begin.flo(), end.flo());
    reverse(begin.flo(), end.flo());
  int water = 0;
  for(int i = 1; i < N; i++){
    water += flo[0] - flo[i];
  }
  cout << water << endl;
  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:14: error: overloaded function with no contextual type information
   11 |   sort(begin.flo(), end.flo());
      |              ^~~
a.cc:11:25: error: overloaded function with no contextual type information
   11 |   sort(begin.flo(), end.flo());
      |                         ^~~
a.cc:12:19: error: overloaded function with no contextual type information
   12 |     reverse(begin.flo(), end.flo());
      |                   ^~~
a.cc:12:30: error: overloaded function with no contextual type information
   12 |     reverse(begin.flo(), end.flo());
      |                              ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main() {
  int N;
  cin >> N;

  vector<int> h(N);
  for (int i = 0; i < N; i++) cin >> h.at(i);
  
  vector<int>b(n) = sort(h.begin(), h.end());
  int base = b.at(0);
  
  int minv = 101;
  int maxv = -1;
  int total = 0;
  for (int i = 0; i < N; i++){
  }
 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:16: error: 'n' was not declared in this scope
   11 |   vector<int>b(n) = sort(h.begin(), h.end());
      |                ^
a.cc:11:19: error: expected ',' or ';' before '=' token
   11 |   vector<int>b(n) = sort(h.begin(), h.end());
      |                   ^
Language: C

#include<stdio.h>
int main(void){
  int n, h[110], m, i, s;
  scanf("%d", &n);
  for(m=0; m<n;m++){
    scanf("&d", &h[m]);
  }
  m=h[0];
  s=h[0];
  for(i=1; i<n; i++){
    s+=h[i]
    if(m<h[i]){
      m=h[i];
    }
  }
  printf("%d\n", n*m-s);
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:11:12: error: expected ';' before 'if'
   11 |     s+=h[i]
      |            ^
      |            ;
   12 |     if(m<h[i]){
      |     ~~
Language: C++

#include <iostream>
#include <vector>

void GrandGarden()
{
  int n;
  cin >> n;
  vector<int> h(n);
  for (int i = 0; i < n; i++)
  {
    cin >> h[i];
  }
 
  int ans = 0;
  for (int i = 0; i < n; i++)
  {
    while (h[i] > 0)
    {
      for (int j = i; j < n; j++)
      {
        if (h[j] > 0)
        {
          h[j]--;
          if (j + 1 == n) ans++;
        }
        else
        {
          ans++;
          break;
        }
      }
    }
  }

  cout << ans << endl;
  return;
}


int main()
{
  GrandGarden();
}


Compiler output:
a.cc: In function 'void GrandGarden()':
a.cc:7:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    7 |   cin >> n;
      |   ^~~
      |   std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:8:3: error: 'vector' was not declared in this scope
    8 |   vector<int> h(n);
      |   ^~~~~~
a.cc:8:3: note: suggested alternatives:
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_vector.h:428:11: note:   'std::vector'
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
/usr/include/c++/14/vector:93:13: note:   'std::pmr::vector'
   93 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
a.cc:8:10: error: expected primary-expression before 'int'
    8 |   vector<int> h(n);
      |          ^~~
a.cc:11:12: error: 'h' was not declared in this scope
   11 |     cin >> h[i];
      |            ^
a.cc:17:12: error: 'h' was not declared in this scope
   17 |     while (h[i] > 0)
      |            ^
a.cc:35:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   35 |   cout << ans << endl;
      |   ^~~~
      |   std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:35:18: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   35 |   cout << ans << endl;
      |                  ^~~~
      |                  std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
  ll n,x=0,ans=0;
  cin>>n>>x;
  vector<ll> d(n);
  for(ll i=0; i<n; i++) {
    ll a; cin>>a;
    d[i] = abs(x - a);
  }
  sort(d.begin(),d.end();
  for(ll i=0; i<n; i++){
    for(ll j=1; j<d[0]; j++){
      if(d[i] % j == 0) ans=max(ans,j);
    }
  }
  cout<<ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:25: error: expected ')' before ';' token
   13 |   sort(d.begin(),d.end();
      |       ~                 ^
      |                         )
Language: C++

#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;++i)
#include<string>
using namespace std;
typedef long long ll;
typedef pair<int, int>P;
//max=({});
//条件式が真ならwhileの中身を回し続ける
//printf("%d\n", ans);


int g[15][15];
const int INF = 1001001001;
const int di[] = { -1,0,1,0 };
const int dj[] = { 0,-1,0,1 };

//最大公約数
ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}

//素因数分解
vector<pair<ll, int>>factorize(ll n) {
	vector<pair<ll, int>>res;
	for (ll i = 2;i * i <= n;++i) {
		if (n % i)continue;
		res.emplace_back(i, 0);
		while (n % i == 0) {
			n /= i;
			res.back().second++;
		}
	}
	if (n != 1)res.emplace_back(n, 1);
	return res;
}

int main() {
	int n;
	cin >> n;
	vector<int>h(n);
	vector<int>f(n);
	vector<bool>flag(n,false);
	int ans = 0;
	rep(i, n) {
		while (h[i] > 0) {
			for (int r = i + 1;r < n;++i) {
				if (h[r] == 0)break;
			}
			for (int x = 1;x < r;++x)--h[x];
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:49:44: error: 'r' was not declared in this scope
   49 |                         for (int x = 1;x < r;++x)--h[x];
      |                                            ^
Language: C++

#include <bits/stdc++.h>
#include <algorithm>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(x) (x).begin(), (x).end()
#define PB(x) push_back(x)
#define MP(x,y) make_pair(x,y)
using namespace std;
typedef long long ll;
 
int main() {

    int n;
    cin>>n;
    vector<int> h(n);
    rep(i,n)    cin>>h.at(i);

    int ans=0;
    int active=0;
    rep(i,n) {
        if(active>=h[i]) {
            active=h[i]
        }
        else {
            ans+=h[i]-active;
            active=h[i];
        }
    }
    cout<<ans<<endl;
 
 return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:24: error: expected ';' before '}' token
   22 |             active=h[i]
      |                        ^
      |                        ;
   23 |         }
      |         ~
Language: C++

#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<cstring>
#include<math.h>
#include<bitset>
#include<queue>
#include<set>
#include<iomanip>
#include<math.h>
#include<assert.h>
#include<string>
#include<cstdlib>
#include<cctype>
#include<unordered_map>
#include<sstream>
#include<numeric>
#include<stack>
// #include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
constexpr ll INF = 1LL<<60;
const double INFD = 1e100;
const ll mod = 1000000007;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
};
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
};

// intやllをstringに変換
template<typename T> inline string toString(const T &a){
  ostringstream oss;
  oss << a;
  return oss.str();
};
// ----------------------------------------------------------------------------

int main(){
  int N;
  cin >> N;
  vector<int> h(N);
  for(int i=0; i<N; i++){
    cin >> h[i];
  }
  int ans = *min_element(h.begin(),h.end());
  for(int i=0; i<N-1; i++){
    if(h[i] > h[i+1]){
      ans += h[i]-h[i+1];
    }
    if(i == N-2){
      ans += h[N-1]-m;
    }
  }
  cout << ans << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:66:21: error: 'm' was not declared in this scope
   66 |       ans += h[N-1]-m;
      |                     ^
Language: C++

#include <iostream>
#include <vector>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++
#define all(x) (x).begin(), (x).end()

int main() {
  int N;
  cin >> N;
  vector<int> h(N);
  int ans = 0;
  for (int i = 0; i < N; i++) cin >> h[i];
  while (1) {
    int l = -1;
    int r = N;
    for (int i = 0; i < N; i++) {
      if (l < 0 && h[i] > 0) l = i;
      if (i > 0 && h[i] <= 0 && h[i - 1] > 0) {
        r = i;
        break;
      }
    }
    if (l < 0) l = 0;
    int hmin = 1000;
    for (int i = l; i < r; i++)
      if (h[i] > 0) hmin = min(hmin, h[i]);

    for (int i = l; i < r; i++) {
      h[i] -= hmin;
    }
    ans += hmin;

    int hmax = *max_element(h.begin(), h.end());
    if (hmax <= 0) break;
  }
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:33:17: error: 'max_element' was not declared in this scope
   33 |     int hmax = *max_element(h.begin(), h.end());
      |                 ^~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;

int water(vector<int> &h,int i,int n){
  if(n==1){
    return h.at(i);
  }
  int x=i;
  for(int j=i;j<i+n;j++){
    if(h.at(x)>h.at(j)){
      x=j;
    }
  }
  for(int j=i;j<i+n;j++){
    h.at(j)=h.at(j)-h.at(x);
  }
  return h.at(x)+water(h,i,x-i)+water(h,x+1,n-x-1);
  

int main(){
  int N;
  cin>>N;
  vector<int> h(N);
  for(int i=0;i<N;i++){
    cin>>h.at(i);
  }
  
  cout<<water(h,0,N)<<endl;
}

Compiler output:
a.cc: In function 'int water(std::vector<int>&, int, int)':
a.cc:20:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   20 | int main(){
      |         ^~
a.cc:20:9: note: remove parentheses to default-initialize a variable
   20 | int main(){
      |         ^~
      |         --
a.cc:20:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:20:11: error: a function-definition is not allowed here before '{' token
   20 | int main(){
      |           ^
a.cc:29:2: error: expected '}' at end of input
   29 | }
      |  ^
a.cc:4:38: note: to match this '{'
    4 | int water(vector<int> &h,int i,int n){
      |                                      ^
Language: C++

#include<iostream>
#include <vector>
using namespace std;

int countList(vector<int> list)
{
  	if (list.size() == 1) {
  		return list[0];
    }
  	int count = 0;
	int min = list[0];
	int min_id = 0;
  	for (int i = 1; i < list.size(); i++) {
    	if (min > list[i]) {
        	min = list[i];
          	min_id = i;
        }
    }
  	count += min;
  	for (int i = 0; i < min_id; i++) {
    	front_array.push_back(list[i]-min);
    }
    count += countList(front_array);
  	for (int i = min_id; i < list.size(); i++) {
    	back_array.push_back(list[i]-min);
    }
    count += countList(back_array);
  	return count;
}

int main()
{
	int N;
	cin >> N;
  	vector<int> list(N);
  	for (int i = 0; i< N; i++) {
    	cin >> list.at(i);
    }
	int count = countList(list);
  	cout << count << endl;
  	return 0;
}

Compiler output:
a.cc: In function 'int countList(std::vector<int>)':
a.cc:21:9: error: 'front_array' was not declared in this scope
   21 |         front_array.push_back(list[i]-min);
      |         ^~~~~~~~~~~
a.cc:23:24: error: 'front_array' was not declared in this scope
   23 |     count += countList(front_array);
      |                        ^~~~~~~~~~~
a.cc:25:9: error: 'back_array' was not declared in this scope
   25 |         back_array.push_back(list[i]-min);
      |         ^~~~~~~~~~
a.cc:27:24: error: 'back_array' was not declared in this scope
   27 |     count += countList(back_array);
      |                        ^~~~~~~~~~
Language: C++

#include<iostream>
#include <vector>
using namespace std;

int countList(vector<int> list)
{
	if (list.size() == 1) {
    	return list[0];
    }
  	int min = list[0];
	int min_id = 0;
  	for (int i = 1; i < list.size(); i++) {
    	if (min > list[i]) {
        	min = list[i];
          	min_id = i;
        }
    }
  	int count = min;
  	vector<int> front_array;
  	vector<int> back_array;
  
  	for (int i = 0; i < min_id; i++) {
    	front_array.push_back(list[i]);
    }
  	for (int i = min_id; i < list.size(); i++) {
    	back_array.push_back(list[i]);
    }
  	return count + countList(front_array) + countList(back_array);
}

int main()
{
	int N;
	cin >> N;
  	vector<int> list(N);
  	for (int i = 0; i< N; i++) {
    	cin >> list.at(i);
    }
	count = countList(list);
  	cout << count << endl;
  	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:9: error: 'count' was not declared in this scope
   39 |         count = countList(list);
      |         ^~~~~
Language: C++

n = int(input())
a = list(map(int,input().split()))
amin = min(a)
before = 0
ans = amin
count = 0
for i in range(n):
    now = a[i]-amin
    if before - now < 0:
        count += abs(before - now)
    before = now
print(ans+count)

Compiler output:
a.cc:1:1: error: 'n' does not name a type
    1 | n = int(input())
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;

int oka(vector<int> vec){
  if(vec.size() = 0) return 0;
  long int out = 0;
  vector<int> tmp = vec;
  sort(tmp.begin(), tmp.end());
  int mi = tmp.at(0);
  vector<int> a;
  for(int i = 0; i < vec.size(); i++){
    if(vec.at(i) == mi){
      out += oka(a);
    }else{
      a.push_back(vec.at(i) - mi);
    }
  }
  return out;
}

int main() {
  int n;
  cin >> n;
  vector<int> h(n);
  for(int i = 0; i < n; i++){
    cin >> h.at(i);
  }
  cout << oka(h);
}

Compiler output:
a.cc: In function 'int oka(std::vector<int>)':
a.cc:5:14: error: lvalue required as left operand of assignment
    5 |   if(vec.size() = 0) return 0;
      |      ~~~~~~~~^~
Language: C++

#include "stdafx.h"
#include <iostream>
#include <set>
#include <queue>
#include <vector>
#include <algorithm>
#include <math.h>
#include <cmath>
#include <string>
#include <cstring>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <tuple>
#include <numeric>
#include <assert.h>
#include <functional>
#include <unordered_map>

using namespace std;

/*-----------------------------------------------------------------------------
　定義
 -------------------------------------------------------------------------------*/
#define REP(i, n)				for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n)			for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define INF						2e9
#define MOD						(1000 * 1000 * 1000 + 7)
#define Ceil(x, n)				(((((x))+((n)-1))/n))		/* Nの倍数に切り上げ割り算 */
#define CeilN(x, n)				(((((x))+((n)-1))/n)*n)		/* Nの倍数に切り上げ */
#define FloorN(x, n)			((x)-(x)%(n))				/* Nの倍数に切り下げ */
#define IsOdd(x)				(((x)&0x01UL) == 0x01UL)			
#define IsEven(x)				(!IsOdd((x)))						
#define	BitSetV(Val,Bit)		((Val) |= (Bit))			
#define	BitTstV(Val,Bit)		((Val) & (Bit))				
#define ArrayLength(x)			(sizeof( x ) / sizeof( x[ 0 ]))
#define	MAX_QWORD				((QWORD)0xFFFFFFFFFFFFFFFF)
#define M_PI					3.14159265358979323846
typedef long long				ll;
typedef unsigned long long int	QWORD;
typedef pair<ll, ll>			P;

/*-----------------------------------------------------------------------------
　処理
 -------------------------------------------------------------------------------*/
int N;
int ans;
vector<int> h(N);
void dfs(int left, int right)
{
	while (true) {
		bool bFin = true;
		for (int i = left; i <= right; i++) {
			if (0 != h[i]) {
				bFin = false;
				break;
			}
		}

		if (bFin) {
			break;
		}

		for (int i = left; i <= right; i++) {
			if (0 < h[i]) {
				h[i]--;
			}
			if (0 == h[i]) {
				if (left != i) {
					dfs(left, i - 1);
				}
			}
		}
		ans++;
	}
}

int main()
{
	cin >> N;
	h.resize(N, 0);
	REP(i, N) cin >> h[i];
	dfs(0, N - 1);
	cout << ans << endl;
	return 0;
}


Compiler output:
a.cc:1:10: fatal error: stdafx.h: No such file or directory
    1 | #include "stdafx.h"
      |          ^~~~~~~~~~
compilation terminated.
Language: Java

import java.util.Scanner;

public class C {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] h = new int[N + 1];
    for (int i = 1; i <= N; i++) {
      h[i] = sc.nextInt();
    }
    int ans = 0;
    for (int i = 1; i <= N; i++) {
      int d = h[i] - h[i - 1];
      if (d > 0) {
        ans += d;
      }
    }
    System.out.println(ans);
  }
}


Compiler output:
Main.java:3: error: class C is public, should be declared in a file named C.java
public class C {
       ^
1 error
Language: C++

#include <bits/stdc++.h>
#define rp(i,n) for(int i=0; i < n; i++)
using namespace std;
int main(void){
  int n;
  cin >> n;
  vector<int> h(n+2);
  h[0]=0; h[n+1]=0;
  for(int i=1; i < n+1; i++){
    cin >> h[i];
  }
  int m[n+2];
  rp(i,n+1){m[i] = 1;}
  m[0]=0; m[n+1]=0;
  int count = 1;
  int sum = 0;
  rp(i,n+2){if(h[i]==0) m[i]=0}
  rp(i,100){
    for(int j=1; j < n+1; j++){
      if(h[j]==i){
        if(m[j+1]==1 && m[j-1] == 1){
          sum = sum+2;
        }
        else if(m[j+1]==1 && m[j-1] == 0){
          sum = sum+1;
        }
        else if(m[j+1]==0 && m[j-1] == 1){
          sum = sum+1;
        }
        else if(m[j+1]==0 && m[j-1] == 0){
          sum = sum-1;
        }
        m[j] = 0;
      }
    }
    count = count + sum;
  }
  cout << count << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:31: error: expected ';' before '}' token
   17 |   rp(i,n+2){if(h[i]==0) m[i]=0}
      |                               ^
      |                               ;
Language: C++

#include <bits/stdc++.h>
#define rp(i,n) for(int i=0; i < n; i++)
using namespace std;
int main(void){
  int n;
  cin >> n;
  vector<int> h(n+2);
  h[0]=0; h[n+1]=0;
  for(int i=1; i < n+1; i++){
    cin >> h[i];
  }
  int m[n+2];
  rp(i,n+1){m.at(i) = 1;}
  m[0]=0; m[n+1]=0;
  int count = 1;
  int sum = 0;
  rp(i,100){
    for(int j=1; j < n+1; j++){
      if(h[j]==i){
        if(m[j+1]==1 && m[j-1] == 1){
          sum = sum+2;
        }
        else if(m[j+1]==1 && m[j-1] == 0){
          sum = sum+1;
        }
        else if(m[j+1]==0 && m[j-1] == 1){
          sum = sum+1;
        }
        else if(m[j+1]==0 && m[j-1] == 0){
          sum = sum;
        }
        m[j] = 0;
      }
    }
    count *= sum;
    sum = 0;
  }
  cout << count << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:15: error: request for member 'at' in 'm', which is of non-class type 'int [(n + 2)]'
   13 |   rp(i,n+1){m.at(i) = 1;}
      |               ^~
Language: C++

#include <bits/stdc++.h>
#define rp(i,n) for(int i=0; i < n; i++)
using namespace std;
int main(void){
  int n;
  cin >> n;
  vector<int> h(n+2);
  h[0]=0; h[n+1]=0;
  for(int i=1; i < n+1; i++){
    cin >> h[i];
  }
  int m[n+2];
  rp(i,n+1){m.at(i) = 1;}
  m.at(0)=0; m.at(n+1)=0;
  int count = 1;
  int sum = 0;
  rp(i,100){
    for(int j=1; j < n+1; j++){
      if(h[j]==i){
        if(m[j+1]==1 && m[j-1] == 1){
          sum = sum+2;
        }
        else if(m[j+1]==1 && m[j-1] == 0){
          sum = sum+1;
        }
        else if(m[j+1]==0 && m[j-1] == 1){
          sum = sum+1;
        }
        else if(m[j+1]==0 && m[j-1] == 0){
          sum = sum;
        }
        m[j] = 0;
      }
    }
    count *= sum;
    sum = 0;
  }
  cout << count << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:15: error: request for member 'at' in 'm', which is of non-class type 'int [(n + 2)]'
   13 |   rp(i,n+1){m.at(i) = 1;}
      |               ^~
a.cc:14:5: error: request for member 'at' in 'm', which is of non-class type 'int [(n + 2)]'
   14 |   m.at(0)=0; m.at(n+1)=0;
      |     ^~
a.cc:14:16: error: request for member 'at' in 'm', which is of non-class type 'int [(n + 2)]'
   14 |   m.at(0)=0; m.at(n+1)=0;
      |                ^~
Language: C++

#include <bits/stdc++.h>
#define rp(i,n) for(int i=0; i < n; i++)
using namespace std;
int main(void){
  int n;
  cin >> n;
  vector<int> h(n+2);
  h[0]=0; h[n+1]=0;
  for(int i=1; i < n+1; i++){
    cin >> h[i];
  }
  int m[n+2];
  rp(i,n+1){m.at(i) = 1;}
  m.at(0)=0; m.at(n+1)=0;
  int count = 1;
  int sum = 0;
  rp(i,100){
    for(int j=1; j < n+1; j++){
      if(h[j]==i){
        if(m.at(j+1)==1 && m.at(j-1) == 1){
          sum = sum+2;
        }
        else if(m.at(j+1)==1 && m.at(j-1) == 0){
          sum = sum+1;
        }
        else if(m.at(j+1)==0 && m.at(j-1) == 1){
          sum = sum+1;
        }
        else if(m.at(j+1)==0 && m.at(j-1) == 0){
          sum = sum;
        }
        m.at(j) = 0;
      }
    }
    count *= sum;
    sum = 0;
  }
  cout << count << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:15: error: request for member 'at' in 'm', which is of non-class type 'int [(n + 2)]'
   13 |   rp(i,n+1){m.at(i) = 1;}
      |               ^~
a.cc:14:5: error: request for member 'at' in 'm', which is of non-class type 'int [(n + 2)]'
   14 |   m.at(0)=0; m.at(n+1)=0;
      |     ^~
a.cc:14:16: error: request for member 'at' in 'm', which is of non-class type 'int [(n + 2)]'
   14 |   m.at(0)=0; m.at(n+1)=0;
      |                ^~
a.cc:20:14: error: request for member 'at' in 'm', which is of non-class type 'int [(n + 2)]'
   20 |         if(m.at(j+1)==1 && m.at(j-1) == 1){
      |              ^~
a.cc:20:30: error: request for member 'at' in 'm', which is of non-class type 'int [(n + 2)]'
   20 |         if(m.at(j+1)==1 && m.at(j-1) == 1){
      |                              ^~
a.cc:23:19: error: request for member 'at' in 'm', which is of non-class type 'int [(n + 2)]'
   23 |         else if(m.at(j+1)==1 && m.at(j-1) == 0){
      |                   ^~
a.cc:23:35: error: request for member 'at' in 'm', which is of non-class type 'int [(n + 2)]'
   23 |         else if(m.at(j+1)==1 && m.at(j-1) == 0){
      |                                   ^~
a.cc:26:19: error: request for member 'at' in 'm', which is of non-class type 'int [(n + 2)]'
   26 |         else if(m.at(j+1)==0 && m.at(j-1) == 1){
      |                   ^~
a.cc:26:35: error: request for member 'at' in 'm', which is of non-class type 'int [(n + 2)]'
   26 |         else if(m.at(j+1)==0 && m.at(j-1) == 1){
      |                                   ^~
a.cc:29:19: error: request for member 'at' in 'm', which is of non-class type 'int [(n + 2)]'
   29 |         else if(m.at(j+1)==0 && m.at(j-1) == 0){
      |                   ^~
a.cc:29:35: error: request for member 'at' in 'm', which is of non-class type 'int [(n + 2)]'
   29 |         else if(m.at(j+1)==0 && m.at(j-1) == 0){
      |                                   ^~
a.cc:32:11: error: request for member 'at' in 'm', which is of non-class type 'int [(n + 2)]'
   32 |         m.at(j) = 0;
      |           ^~