func_code_string: #include <bits/stdc++.h>   using namespace std;   long long int mod = 1e9 + 7;   long long int expo(long long int base, long long int exponent,                      long long int mod) {     long long int ans = 1;     while (exponent > 0) {       if (exponent % 2 == 1) {         ans *= base;         ans %= mod;       }       base *= base;       base %= mod;       exponent /= 2;     }     return ans;   }   const long long int M = 3000006;   long long int f[M], inv[M];   void compute() {     f[0] = 1;     for (long long int i = 1; i <= M - 1; i++) {       f[i] = (1LL * i * f[i - 1]) % mod;     }     inv[M - 1] = expo(f[M - 1], mod - 2, mod);     for (long long int i = M - 2; i >= 0; i--) {       inv[i] = (1LL * (i + 1) * inv[i + 1]) % mod;     }   }   long long int C(long long int n, long long int r) {     return (1LL * ((1LL * f[n] * inv[r]) % mod) * inv[n - r]) % mod;   }   long long int h[100005];   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     int tests = 1;     while (tests--) {       long long int i, j, n;       cin >> n;       for (long long int i = 1; i <= n; i++) cin >> h[i];       long long int tmp = 0;       vector<long long int> res(n + 1);       for (long long int i = 1; i <= n; i++) {         tmp = min(tmp, h[i] - i);         res[i] = tmp + i;       }       tmp = 0;       for (i = n; i >= 1; i--) {         tmp = min(tmp, h[i] - (n + 1 - i));         res[i] = min(res[i], tmp + (n + 1 - i));       }       long long int ans = 0;       for (long long int i = 1; i <= n; i++) ans = max(ans, res[i]);       cout << ans;     }     return 0;   }   