func_code_string: #include <bits/stdc++.h>   using u32 = unsigned;   using u64 = unsigned long long;   int lg_ceil(u64 n) { return 63 - __builtin_clzll(2 * n - 1); }   int lg_floor(u32 n) { return 31 - __builtin_clz(n); }   template <class T>   struct sparse_table {     sparse_table() {}     sparse_table(std::vector<T>& V, std::function<T(T, T)> f)         : M(lg_ceil(V.size()), V), F(f) {       for (size_t i = 0; i + 1 < M.size(); i++) {         for (size_t j = 0; j + (1 << i) < M[i].size(); j++) {           M[i + 1][j] = F(M[i][j], M[i][j + (1 << i)]);         }       }     }     T query(int l, int r) {       int k = lg_floor(r - l);       return F(M[k][l], M[k][r - (1 << k)]);     }     std::vector<std::vector<T>> M;     std::function<T(T, T)> F;   };   template <class T>   struct mmax {     T operator()(const T& a, const T& b) { return std::max(a, b); }   };   template <class T>   struct mmin {     T operator()(const T& a, const T& b) { return std::min(a, b); }   };   template <class T>   std::vector<T> read(int n) {     std::vector<T> res(n);     for (auto& r : res) {       std::cin >> r;     }     return res;   }   int main() {     std::ios::sync_with_stdio(0), std::cin.tie(0), std::cout.tie(0);     int n;     std::cin >> n;     auto r = read<int>(n);     for (int i = 0; i < 2 * n; i++) {       r.push_back(r[i]);     }     if (n == 1) {       std::cout << 0 <<   n ;       return 0;     }     int lg = lg_ceil(n);     std::vector<std::vector<int>> ll(lg + 1, std::vector<int>(3 * n));     std::vector<std::vector<int>> rr(lg + 1, std::vector<int>(3 * n));     for (int i = 0; i < 3 * n; i++) {       ll[0][i] = std::max(i - r[i], 0);       rr[0][i] = std::min(i + r[i] + 1, 3 * n);     }     for (int j = 1; j <= lg; j++) {       sparse_table<int> lo(ll[j - 1], mmin<int>());       sparse_table<int> hi(rr[j - 1], mmax<int>());       for (int i = 0; i < 3 * n; i++) {         ll[j][i] = lo.query(ll[j - 1][i], rr[j - 1][i]);         rr[j][i] = hi.query(ll[j - 1][i], rr[j - 1][i]);       }     }     std::vector<int> left(n), right(n), sum(n), ans(n);     std::iota(begin(left), end(left), n);     std::iota(begin(right), end(right), n + 1);     for (int j = lg; j >= 0; j--) {       sparse_table<int> lo(ll[j], mmin<int>());       sparse_table<int> hi(rr[j], mmax<int>());       for (int i = 0; i < n; i++) {         int nl = lo.query(left[i], right[i]);         int nr = hi.query(left[i], right[i]);         if (nr - nl < n) {           left[i] = nl, right[i] = nr;           sum[i] += 1 << j;         } else {           ans[i] = sum[i] + (1 << j);         }       }     }     for (int a : ans) {       std::cout << a <<    ;     }     std::cout <<   n ;   }   