func_code_string: #include <bits/stdc++.h>   using namespace std;   long long mi, ma, n, d, k, l, r, mid, a[500007], b[500007], cnt[500007];   inline long long read() {     long long s = 0, w = 1;     char c = getchar();     for (; !isdigit(c); c = getchar())       if (c ==  - ) w = -1;     for (; isdigit(c); c = getchar()) s = (s << 3) + (s << 1) + (c ^ 48);     return (s * w);   }   inline bool check() {     long long num = 0, sum = 0;     for (int i = 1; i <= n; i++) {       long long delta = mid - cnt[i] - b[i] - sum;       if (delta <= 0) {         sum = sum + b[i];         continue;       }       num = num + delta;       if (num > k) {         for (int j = min(i + 2 * d, n); j; j--) b[j] = 0;         return false;       }       b[i] = b[i] + delta;       if (i + 2 * d < n) b[i + 2 * d + 1] = b[i + 2 * d + 1] - delta;       sum = sum + b[i];     }     for (int i = 1; i <= n; i++) b[i] = 0;     return true;   }   int main() {     n = read(), d = read(), k = read();     mi = LLONG_MAX;     for (int i = 1; i <= n; i++) {       long long x = read();       a[max(1LL, i - d)] = a[max(1LL, i - d)] + x;       if (i + d < n) a[i + d + 1] = a[i + d + 1] - x;     }     for (int i = 1; i <= n; i++)       cnt[i] = cnt[i - 1] + a[i], ma = max(ma, cnt[i]), mi = min(mi, cnt[i]);     l = mi, r = ma + k;     while (l < r) {       mid = (l + r + 1) >> 1;       if (check())         l = mid;       else         r = mid - 1;     }     printf( %lld n , l);     return 0;   }   