Language: C++

// VSCF.cpp : Defines the entry point for the console application.
//
#include <cassert>
#include <functional>
#include <cmath>
#include <list>
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <iterator>
#include <string>
#include <vector>
#include <set>
#include <deque>
#include <map>
#include <iomanip>
#include <sstream>
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
#define MP make_pair
#define FOR(v,p,k) for(int v=p;v<=k;++v)
#define FORD(v,p,k) for(int v=p;v>=k;--v)
#define REP(i,n) for(int i=0;i<(n);++i)
#define VAR(v,i) __typeof(i) v=(i)
#define FOREACH(i,c) for(VAR(i,(c).begin());i!=(c).end();++i)
#define PB push_back
#define ST first
#define ND second
#define SIZE(x) (int)x.size()
#define ALL(c) c.begin(),c.end()
#define int long long
#define MAXN 1000010
typedef long double LD;

template <typename T>
T modpow(T base, T exp, T modulus) {
	base %= modulus;
	T result = 1;
	while (exp > 0) {
		if (exp & 1) result = (result * base) % modulus;
		base = (base * base) % modulus;
		exp >>= 1;
	}
	return result;
}

#undef int
int main() {
#define int long long
	int n;
	cin >> n;
	vector<int> mtn(n);
	vector<int> inp1(n);
	vector<int> inp2(n);
	REP(i, n) {
		cin >> inp1[i];
	}
	REP(i, n) {
		cin >> inp2[i];
	}
	mtn[0] = inp1[0];
	mtn[n - 1] = inp2[n - 1];
	REP(i, n - 1) {
		if (inp1[i] < inp1[i + 1]) {
			mtn[i + 1] = inp1[i + 1];
		}
	}
	REP(i, n - 1) {
		if (inp2[n - i - 2] > inp2[n - i - 1]) {
			mtn[n - i - 2] = inp2[n - i - 2];
		}
	}
	int mx = 0;
	REP(i, n) {
		mx = max(mx, mtn[i]);
		if (mx != inp1[i]) {
			goto no;
		}
	}
	mx = 0;
	REP(i, n) {
		mx = max(mx, mtn[n - i - 1]);
		if (mx != inp2[n - i - 1]) {
			goto no;
		}
	}
	int result = 1;
	int mod = 1e9 + 7;
	int lastSet = mtn[0];
	int len = 0;
	for (int i = 1; i < n; i++) {
		if (mtn[i]) {
			if (mtn[i] >= lastSet) {
				result *= modpow(lastSet, len, mod);
				result %= mod;
			} else {
				result *= modpow(mtn[i], len, mod);
				result %= mod;
			}
			len = 0;
			lastSet = mtn[i];
		} else {
			len++;
		}
	}
	cout << result;
	return 0;
no:
	cout << 0;
	return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:109:1: error: jump to label 'no'
  109 | no:
      | ^~
a.cc:85:30: note:   from here
   85 |                         goto no;
      |                              ^~
a.cc:91:13: note:   crosses initialization of 'long long int len'
   91 |         int len = 0;
      |             ^~~
a.cc:90:13: note:   crosses initialization of 'long long int lastSet'
   90 |         int lastSet = mtn[0];
      |             ^~~~~~~
a.cc:89:13: note:   crosses initialization of 'long long int mod'
   89 |         int mod = 1e9 + 7;
      |             ^~~
a.cc:88:13: note:   crosses initialization of 'long long int result'
   88 |         int result = 1;
      |             ^~~~~~
a.cc:109:1: error: jump to label 'no'
  109 | no:
      | ^~
a.cc:78:30: note:   from here
   78 |                         goto no;
      |                              ^~
a.cc:91:13: note:   crosses initialization of 'long long int len'
   91 |         int len = 0;
      |             ^~~
a.cc:90:13: note:   crosses initialization of 'long long int lastSet'
   90 |         int lastSet = mtn[0];
      |             ^~~~~~~
a.cc:89:13: note:   crosses initialization of 'long long int mod'
   89 |         int mod = 1e9 + 7;
      |             ^~~
a.cc:88:13: note:   crosses initialization of 'long long int result'
   88 |         int result = 1;
      |             ^~~~~~