Language: C++

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional>

#define int long long
#define ld long double
#define db double
#define endl "\n"
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define RAND mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
#define pb push_back
#define mp make_pair
#define all(x) x.begin(), x.end()
#define debx cout << " X " << endl;
#define deby cout << " Y " << endl;
#define debz cout << " Z " << endl;
#define deb(x) cout << '>' << #x << ':' << x << endl;

const long double PI = 3.14159265358979323846264338;
const long long INF = 1000000000000000000;
const long long INF1 = 1000000000;
const long long MOD = 1000000007;
// const long long MOD = 998244353;

using namespace __gnu_pbds; 
using namespace std;
template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update> ; 
/*  
    find_by_order() - Returns an iterator to the k-th largest element (counting from zero) 
    order_of_key()  - The number of items in a set that are strictly smaller than our item 
    Rest same as set
*/
 
int mpow(int a, int b){
    a %= MOD;
    if(!b)
        return 1;
    int temp = mpow(a, b/2);
    temp = (temp*temp) % MOD;
    if(b%2)
        return (a * temp) % MOD;
    return temp;
}
int _pow(int a, int b){
    if(!b)
        return 1;
    int temp = _pow(a, b/2);
    temp = (temp * temp);
    if(b%2)
        return (a * temp);
    return temp;
}
int mod_in(int n){
    return mpow(n, MOD-2);
}
int cl(int a, int b){
    if(a%b)
        return 1 + a/b;
    return a/b;
}

class SegTree{
    private:
        int *st = new int[10000000];
        int *lazy = new int[10000000];
        int n = 0;
    public:
        SegTree(int x){
            n = x;
            for(int i=0 ; i<4*x ; i++)
                st[i] = lazy[i] = 0;    
        }
        
        void update(int lo, int hi, int val){
            up(1, 1, n, lo, hi, val);
        }

        int query(int lo, int hi){
            return q(1, 1, n, lo, hi);
        }

        void up(int node, int l, int r, int lo, int hi, int val){
            if(lazy[node]){
                st[node] += lazy[node] * (r-l+1);
                if(r!=l){
                    lazy[2*node] += lazy[node];
                    lazy[2*node+1] += lazy[node];
                }
                lazy[node] = 0;
            }
            if(l>r || l>hi || lo>r)
                return;
            if(l>=lo && r<=hi){
                st[node] += (r-l+1) * val;
                if(r!=l){
                    lazy[2*node] += val;
                    lazy[2*node+1] += val;
                }
                return;
            }
            int mid = (l+r) / 2;
            up(2*node, l, mid, lo, hi, val);    
            up(2*node+1, mid+1, r, lo, hi, val);
            st[node] = st[2*node] + st[2*node+1];
            return;
        }
 
        int q(int node, int l, int r, int lo, int hi){
            if(lazy[node]){
                st[node] += lazy[node] * (r-l+1);
                if(r!=l){
                    lazy[2*node] += lazy[node];
                    lazy[2*node+1] += lazy[node];
                }
                lazy[node] = 0;
            }
            if(l>r || l>hi || lo>r)
                return 0;
            if(l>=lo && r<=hi){
                return st[node] ;
            }
            int mid = (l+r) / 2;
            int q1 = q(2*node, l, mid, lo, hi);    
            int q2 = q(2*node+1, mid+1, r, lo, hi);
            return q1 + q2;
        }
  
        void clear(){
            delete st;
            delete lazy;
        }
};

int32_t main(){
    fastio;
    int n, k;
    cin >> n >> k;
    if(k >= (int) log(n) + 13)){
        for(int i=0 ; i<n ; i++)
            cout << n << " ";
        exit(0);
    }
    int a[n+5];
    for(int i=1 ; i<=n ; i++){
        cin >> a[i];
    }
    SegTree st = SegTree(n);
    int Z = min(k, (int) log(n) + 13);
    for(int j=0 ; j<Z ; j++){
        for(int i=1 ; i<=n ; i++){
            int l = max(1ll, i - a[i]);
            int r = min(n, i + a[i]);
            st.update(l, r, 1);
        }
        for(int i=1 ; i<=n ; i++){
            a[i] = st.query(i,i) ;
            st.update(i, i, -a[i]);
        }
    }
    for(int i=1 ; i<=n ; i++)
        cout << a[i] << " ";
}


Compiler output:
a.cc: In function 'int32_t main()':
a.cc:140:31: error: expected primary-expression before ')' token
  140 |     if(k >= (int) log(n) + 13)){
      |                               ^