Language: C++

//繝・Φ繝励Ξ
#include <bits/stdc++.h>
#define int long long
#define REP(i,n) for(int i = 0; i < (n); ++i)
#define FOR(i,a,b)  for(int i = (a); i <= (b); ++i)
#define ALL(v) (v).begin(),(v).end()

using namespace std;
//constexpr int MOD = 10e9+7;
//constexpr int INF = 1LL << 60;
template <class T> inline bool chmin(T& a, T b){if(a > b){ a = b; return 1;} return 0;}  
template <class T> inline bool chmax(T& a, T b){if(a < b){ a = b; return 1;} return 0;}  
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
//

int calc(int * h ,int n)
{
    REP(i,n)
    {
        if(h[i] <= 0)
        {
            if(i == 0)
            {
                return calc(h+1,n);
            }
            if(i == n-1)
            {
                return calc(h,n-1);
            }
            int *h1=h;
            int * h2 = &h[i+1];
            return calc(h1,i-1) + calc(h2,n-i);
        }
    }
    REP(i,n)
    {
        (h[i])--;
    }
    
    return calc(h,n);

}

signed main (){
   ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
   int N;
   cin >> N;
   int h[N];
   REP(i,N){
       cin >>h[i];
   }

   cout << calc(h,N) << endl;
}
//繝・Φ繝励Ξ
#include <bits/stdc++.h>
#define int long long
#define REP(i,n) for(int i = 0; i < (n); ++i)
#define FOR(i,a,b)  for(int i = (a); i <= (b); ++i)
#define ALL(v) (v).begin(),(v).end()

using namespace std;
//constexpr int MOD = 10e9+7;
//constexpr int INF = 1LL << 60;
template <class T> inline bool chmin(T& a, T b){if(a > b){ a = b; return 1;} return 0;}  
template <class T> inline bool chmax(T& a, T b){if(a < b){ a = b; return 1;} return 0;}  
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
//

int calc(int * h ,int n)
{
    REP(i,n)
    {
        if(h[i] <= 0)
        {
            if(i == 0)
            {
                return calc(h+1,n);
            }
            if(i == n-1)
            {
                return calc(h,n-1);
            }
            int *h1=h;
            int * h2 = &h[i+1];
            return calc(h1,i-1) + calc(h2,n-i);
        }
    }
    REP(i,n)
    {
        (h[i])--;
    }
    
    return calc(h,n);

}

signed main (){
   ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
   int N;
   cin >> N;
   int h[N];
   REP(i,N){
       cin >>h[i];
   }

   cout << calc(h,N) << endl;
}


Compiler output:
a.cc:65:32: error: redefinition of 'template<class T> bool chmin(T&, T)'
   65 | template <class T> inline bool chmin(T& a, T b){if(a > b){ a = b; return 1;} return 0;}
      |                                ^~~~~
a.cc:11:32: note: 'template<class T> bool chmin(T&, T)' previously declared here
   11 | template <class T> inline bool chmin(T& a, T b){if(a > b){ a = b; return 1;} return 0;}
      |                                ^~~~~
a.cc:66:32: error: redefinition of 'template<class T> bool chmax(T&, T)'
   66 | template <class T> inline bool chmax(T& a, T b){if(a < b){ a = b; return 1;} return 0;}
      |                                ^~~~~
a.cc:12:32: note: 'template<class T> bool chmax(T&, T)' previously declared here
   12 | template <class T> inline bool chmax(T& a, T b){if(a < b){ a = b; return 1;} return 0;}
      |                                ^~~~~
a.cc:67:11: error: redefinition of 'const long long int dx []'
   67 | const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
      |           ^~
a.cc:13:11: note: 'const long long int dx [8]' previously defined here
   13 | const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
      |           ^~
a.cc:67:47: error: redefinition of 'const long long int dy []'
   67 | const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
      |                                               ^~
a.cc:13:47: note: 'const long long int dy [8]' previously defined here
   13 | const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
      |                                               ^~
a.cc:70:5: error: redefinition of 'long long int calc(long long int*, long long int)'
   70 | int calc(int * h ,int n)
      |     ^~~~
a.cc:16:5: note: 'long long int calc(long long int*, long long int)' previously defined here
   16 | int calc(int * h ,int n)
      |     ^~~~
a.cc:98:8: error: redefinition of 'int main()'
   98 | signed main (){
      |        ^~~~
a.cc:44:8: note: 'int main()' previously defined here
   44 | signed main (){
      |        ^~~~