func_code_string: #include <bits/stdc++.h>   using namespace std;   int dx[] = {0, 0, 1, -1, 1, -1, 1, -1};   int dy[] = {1, -1, 0, 0, -1, 1, 1, -1};   long long gcd(long long first, long long second) {     return !second ? first : gcd(second, first % second);   }   long long lcm(long long first, long long second) {     return (first / gcd(first, second)) * second;   }   void PLAY() {     cout << fixed << setprecision(15);     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);   }   const int MAX = 6e5;   long long n, r, k;   long long archers[MAX], dist[MAX];   bool valid(long long val) {     memset(dist, 0, sizeof dist);     long long tmp = 0, cursum = k;     for (int i = 1; i <= n; ++i) {       long long cur = val - archers[i] - tmp;       if (cur < 0) {         tmp += dist[i];         continue;       }       if (cur > cursum) return false;       cursum -= cur;       tmp += cur;       long long idx = min(i + 2 * r, n);       dist[idx] -= cur;       tmp += dist[i];     }     return true;   }   int main() {     PLAY();     cin >> n >> r >> k;     for (int i = 1; i <= n; i++) {       cin >> archers[i];       long long x = max(i - r, 1LL);       long long y = min(i + r, n) + 1;       dist[x] += archers[i];       dist[y] -= archers[i];     }     for (int i = 1; i <= n; i++) archers[i] = archers[i - 1] + dist[i];     long long lo = *min_element(archers + 1, archers + n + 1);     long long hi = lo + k + 1, res = lo;     while (lo <= hi) {       long long mid = (lo + hi) / 2;       if (valid(mid)) {         res = mid;         lo = mid + 1;       } else         hi = mid - 1;     }     cout << res << endl;     return 0;   }   