Language: C++

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

int N;
int H[105];
ll mo=1000000007;

ll modpow(ll a, ll n = mo-2) {
	ll r=1;a%=mo;
	while(n) r=r*((n%2)?a:1)%mo,a=a*a%mo,n>>=1;
	return r;
}

pair<ll,ll> hoge(int L,int R,int v) {
	ll dp1=1,dp2=1;
	int i;
	
	if(L>R) return {-1,1};
	
	int mi=1<<30;
	for(i=L;i<=R;i++) mi=min(mi,H[i]);
	int W=R-L+1;
	for(i=L;i<=R;i++) if(mi!=H[i]) W--;
	
	int pre=L-1;
	for(i=L;i<=R;i++) {
		if(mi==H[i]) {
			auto r=hoge(pre+1,i-1,mi);
			if(r.first>=0) {
				(dp1*=r.first)%=mo;
				(dp2*=r.first+r.second)%=mo;
			}
			
			pre=i;
		}
	}
	auto r=hoge(pre+1,R,mi);
	if(r.first>=0) {
		(dp1*=r.first)%=mo;
		(dp2*=r.first+r.second)%=mo;
	}
	
	(dp2=dp2*modpow(2,W)+(modpow(2,mi-v)+mo-2)*dp1)%=mo;
	(dp1*=modpow(2,mi-v))%=mo;
	
	return {dp1,dp2};
}

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N;
	for(i=1;i<=N;i++) cin>>H[i];
	cout<<hoge(1,N,0).second<<endl;
}

int main()
{
        solve();
}

Compiler output:
a.cc:6:1: error: 'll' does not name a type
    6 | ll mo=1000000007;
      | ^~
a.cc:8:1: error: 'll' does not name a type
    8 | ll modpow(ll a, ll n = mo-2) {
      | ^~
a.cc:14:6: error: 'll' was not declared in this scope
   14 | pair<ll,ll> hoge(int L,int R,int v) {
      |      ^~
a.cc:14:9: error: 'll' was not declared in this scope
   14 | pair<ll,ll> hoge(int L,int R,int v) {
      |         ^~
a.cc:14:11: error: template argument 1 is invalid
   14 | pair<ll,ll> hoge(int L,int R,int v) {
      |           ^
a.cc:14:11: error: template argument 2 is invalid
a.cc: In function 'int hoge(int, int, int)':
a.cc:15:9: error: 'll' was not declared in this scope
   15 |         ll dp1=1,dp2=1;
      |         ^~
a.cc:18:29: error: cannot convert '<brace-enclosed initializer list>' to 'int' in return
   18 |         if(L>R) return {-1,1};
      |                             ^
a.cc:29:30: error: request for member 'first' in 'r', which is of non-class type 'int'
   29 |                         if(r.first>=0) {
      |                              ^~~~~
a.cc:30:34: error: 'dp1' was not declared in this scope
   30 |                                 (dp1*=r.first)%=mo;
      |                                  ^~~
a.cc:30:41: error: request for member 'first' in 'r', which is of non-class type 'int'
   30 |                                 (dp1*=r.first)%=mo;
      |                                         ^~~~~
a.cc:30:49: error: 'mo' was not declared in this scope; did you mean 'mi'?
   30 |                                 (dp1*=r.first)%=mo;
      |                                                 ^~
      |                                                 mi
a.cc:31:34: error: 'dp2' was not declared in this scope; did you mean 'dup2'?
   31 |                                 (dp2*=r.first+r.second)%=mo;
      |                                  ^~~
      |                                  dup2
a.cc:31:41: error: request for member 'first' in 'r', which is of non-class type 'int'
   31 |                                 (dp2*=r.first+r.second)%=mo;
      |                                         ^~~~~
a.cc:31:49: error: request for member 'second' in 'r', which is of non-class type 'int'
   31 |                                 (dp2*=r.first+r.second)%=mo;
      |                                                 ^~~~~~
a.cc:38:14: error: request for member 'first' in 'r', which is of non-class type 'int'
   38 |         if(r.first>=0) {
      |              ^~~~~
a.cc:39:18: error: 'dp1' was not declared in this scope
   39 |                 (dp1*=r.first)%=mo;
      |                  ^~~
a.cc:39:25: error: request for member 'first' in 'r', which is of non-class type 'int'
   39 |                 (dp1*=r.first)%=mo;
      |                         ^~~~~
a.cc:39:33: error: 'mo' was not declared in this scope; did you mean 'mi'?
   39 |                 (dp1*=r.first)%=mo;
      |                                 ^~
      |                                 mi
a.cc:40:18: error: 'dp2' was not declared in this scope; did you mean 'dup2'?
   40 |                 (dp2*=r.first+r.second)%=mo;
      |                  ^~~
      |                  dup2
a.cc:40:25: error: request for member 'first' in 'r', which is of non-class type 'int'
   40 |                 (dp2*=r.first+r.second)%=mo;
      |                         ^~~~~
a.cc:40:33: error: request for member 'second' in 'r', which is of non-class type 'int'
   40 |                 (dp2*=r.first+r.second)%=mo;
      |                                 ^~~~~~
a.cc:43:10: error: 'dp2' was not declared in this scope; did you mean 'dup2'?
   43 |         (dp2=dp2*modpow(2,W)+(modpow(2,mi-v)+mo-2)*dp1)%=mo;
      |          ^~~
      |          dup2
a.cc:43:18: error: 'modpow' was not declared in this scope
   43 |         (dp2=dp2*modpow(2,W)+(modpow(2,mi-v)+mo-2)*dp1)%=mo;
      |                  ^~~~~~
a.cc:43:46: error: 'mo' was not declared in this scope; did you mean 'mi'?
   43 |         (dp2=dp2*modpow(2,W)+(modpow(2,mi-v)+mo-2)*dp1)%=mo;
      |                                              ^~
      |                                              mi
a.cc:43:52: error: 'dp1' was not declared in this scope
   43 |         (dp2=dp2*modpow(2,W)+(modpow(2,mi-v)+mo-2)*dp1)%=mo;
      |                                                    ^~~
a.cc:46:24: error: cannot convert '<brace-enclosed initializer list>' to 'int' in return
   46 |         return {dp1,dp2};
      |                        ^
a.cc: In function 'void solve()':
a.cc:54:27: error: request for member 'second' in 'hoge(1, N, 0)', which is of non-class type 'int'
   54 |         cout<<hoge(1,N,0).second<<endl;
      |                           ^~~~~~