func_code_string: #include <bits/stdc++.h>   using namespace std;   using VI = vector<int>;   using VVI = vector<VI>;   using PII = pair<int, int>;   using LL = long long;   using VL = vector<LL>;   using VVL = vector<VL>;   using PLL = pair<LL, LL>;   using VS = vector<string>;   template <class S, class T>   istream& operator>>(istream& is, pair<S, T>& p) {     return is >> p.first >> p.second;   }   template <class T>   istream& operator>>(istream& is, vector<T>& xs) {     for (auto& x : xs) is >> x;     return is;   }   template <class S, class T>   ostream& operator<<(ostream& os, const pair<S, T>& p) {     return os << p.first <<     << p.second;   }   template <class T>   ostream& operator<<(ostream& os, const vector<T>& xs) {     for (unsigned int i = 0; i < xs.size(); ++i) os << (i ?     :   ) << xs[i];     return os;   }   template <class T>   void maxi(T& x, T y) {     if (x < y) x = y;   }   template <class T>   void mini(T& x, T y) {     if (x > y) x = y;   }   const double EPS = 1e-10;   const double PI = acos(-1.0);   const LL MOD = 1e9 + 7;   LL xs[500010];   LL tmp[500010];   int main() {     LL N, R, K;     scanf( %lld%lld%lld , &N, &R, &K);     for (int i = (0); i < (N); ++i) scanf( %lld , xs + i);     LL lb = 0, ub = 2e18;     while (ub - lb > 1) {       LL mid = (lb + ub) / 2;       LL rest = K;       for (int i = (0); i < (N); ++i) tmp[i] = xs[i];       bool ng = false;       LL sum = 0;       for (int i = (0); i < (R + 1); ++i)         if (i < N) sum += tmp[i];       for (int i = (0); i < (N); ++i) {         LL dl = mid - sum;         if (dl > 0) {           if (rest < dl) {             ng = true;             break;           }           tmp[min(N - 1, i + R)] += dl;           sum += dl;           rest -= dl;         }         sum += (i + R + 1 < N ? tmp[i + R + 1] : 0ll);         sum -= (i - R >= 0 ? tmp[i - R] : 0ll);       }       if (ng)         ub = mid;       else         lb = mid;     }     printf( %lld n , lb);     return 0;   }   