func_code_string: #include <bits/stdc++.h>   using namespace std;   template <typename T, size_t N>   void PRINT_ARRAY(const T (&a)[N], int n = -1) {     if (!n) n = N;     for (int i = 0; i < n; i++) cout << a[i] <<    ;     cout <<   n ;   }   template <typename T, size_t N, size_t M>   void PRINT_ARRAY(const T (&a)[N][M], int n, int m) {     for (int i = 0; i < n; i++) PRINT_ARRAY(a[i], m);     cout <<   n ;   }   long long arr[3005], cost[3005], lessc, more, ans;   int n;   void solve() {     cin >> n;     for (int i = 0; i < n; i++) cin >> arr[i];     for (int i = 0; i < n; i++) cin >> cost[i];     ans = (int)(1e9 + 7);     for (int i = 1; i < n - 1; i++) {       lessc = (int)(1e9 + 7);       more = (int)(1e9 + 7);       for (int j = 0; j < i; j++)         if (arr[i] > arr[j]) lessc = min(lessc, cost[j]);       for (int j = i + 1; j < n; j++)         if (arr[j] > arr[i]) more = min(more, cost[j]);       ans = min(ans, cost[i] + lessc + more);     }     cout << (ans == (int)(1e9 + 7) ? -1 : ans);   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     ;     solve();   }   