func_code_string: #include <bits/stdc++.h>   using namespace std;   long long arr[500005];   long long brr[500005];   long long total[500005];   int n, r;   bool fnc(long long mid, long long k) {     for (int i = 1; i <= n; i++) brr[i] = 0;     long long d = 0;     for (int i = 1; i <= n; i++) {       d += brr[i];       if (total[i] + d < mid) {         long long x = (mid - (total[i] + d));         d += x;         int j = min(i + 2 * r + 1, n + 1);         brr[j] -= x;         k -= x;         if (k < 0) return 0;       }     }     return 1;   }   int main() {     long long k;     scanf( %d %d %I64d , &n, &r, &k);     for (int i = 1; i <= n; i++) scanf( %I64d , &arr[i]);     for (int i = 1; i <= n; i++) {       if (r == 0) {         brr[i] += arr[i];         brr[i + 1] -= arr[i];       } else {         int j = max(i - r, 1);         brr[j] += arr[i];         j = min(i + r + 1, n + 1);         brr[j] -= arr[i];       }     }     long long d = 0;     for (int i = 1; i <= n; i++) {       d += brr[i];       total[i] = d;     }     long long mn = total[1];     for (int i = 2; i <= n; i++) mn = min(total[i], mn);     long long l = 0, h = 4000000000000000000;     long long ans = mn;     while (l <= h) {       long long mid = (l + h) / 2;       bool flag = fnc(mid, k);       if (flag) {         ans = mid;         l = mid + 1;       } else         h = mid - 1;     }     cout << ans << endl;   }   