func_code_string: #include <bits/stdc++.h>   using namespace std;   vector<long long> translate;   long long get(long long x) {     return lower_bound(translate.begin(), translate.end(), x) - translate.begin();   }   int main() {     ios_base::sync_with_stdio(0);     long long n;     cin >> n;     if (n == 1) {       cout << 1 << endl;       return 0;     }     long long a[n];     for (long long i = 0; i < n; i++) {       cin >> a[i];       translate.push_back(a[i]);     }     translate.push_back(0);     sort(translate.begin(), translate.end());     translate.resize(unique(translate.begin(), translate.end()) -                      translate.begin());     long long b[n];     for (long long i = 0; i < n; i++) {       b[i] = get(a[i]);     }     long long d[n][translate.size()];     fill(d[0], d[n - 1] + translate.size(), INT_MAX);     for (long long i = 0; i < n - 1; i++) {       long long benefit = 0;       for (long long j = 0; j <= b[i]; j++) {         if (i == 0) {           d[i][j] = translate[j] + (int)(j < b[i]);         }         if (d[i][benefit] + translate[j] - translate[benefit] >= d[i][j]) {           benefit = j;         }         long long temp = j;         if (j > b[i + 1]) temp = b[i + 1];         d[i + 1][temp] =             min(d[i + 1][temp],                 d[i][benefit] + max(translate[temp] - translate[benefit], 0ll) +                     (int)(temp != b[i + 1]));       }       if (b[i + 1] > b[i]) {         for (long long j = b[i] + 1; j <= b[i + 1]; j++) {           long long znach = d[i][benefit] + translate[j] - translate[benefit] +                             (int)(j != b[i + 1]);           d[i + 1][j] = min(d[i + 1][j], znach);         }       }     }     cout << *min_element(d[n - 1], d[n - 1] + translate.size());   }   