Language: C++

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
using ll = long long;
using ldb = long double;
using pa = pair < ll, ll >;
using vec = vector < ll >;
 
template < typename T > using index_set = tree < T, null_type, less < T >, rb_tree_tag, tree_order_statistics_node_update >;
template < typename T > using MinPriorityQueue = priority_queue < T, vector < T >, greater < T > >;

#define pb push_back
#define po pop_back
#define mp make_pair
#define mt make_tuple
#define unique_sort(x) sort(all(x)), x.resize(distance(x.begin(), unique(all(x))))
#define F  first
#define S  second
#define int ll
#define f(i,x,n) for(ll i=x;i<n;i++) 
#define all(c) c.begin(),c.end()
#define str string
#define edl "\n"
#define add insert
#define tm (tl+tr)/2
#define child 2*v
#define ceils(s,n) (s+n-1)/n
#define cot continue
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL)

const int MOD = 1e9 + 7, INF = INT_MAX, N = 2e5 + 10;
const double PI = acos(-1);
const ll LINF = LLONG_MAX;
ll seg[4*N];
ll lazy[4*N];
ll a[N],n,query,V[N];

void push(ll v){
    seg[child]+=lazy[v];
    lazy[child]+=lazy[v];
    seg[child+1]+=lazy[v];
    lazy[child+1]+=lazy[v];
    lazy[v]=0;
}
void update(ll v,ll tl,ll tr,ll ql,ll qr,ll val){
    
    if(ql>qr){
        return ;
    }
    if(ql == tl and qr==tr){
        seg[v]+=val;
        lazy[v]+=val;
    }
    else{
        push(v);
        update(child,tl,tm,ql,min(qr,tm),val);
        update(child+1,tm+1,tr,max(ql,tm+1),qr,val);
        seg[v]=seg[child]+seg[child+1];
    }
}
ll rquery(ll v,ll tl,ll tr,ll ql,ll qr){
    if(ql>qr){
        return 0;
    }
    if(ql<=tl and tr<=qr){
        return seg[v];
    }
    push(v);
    return rquery(child,tl,tm,ql,min(qr,tm))+rquery(child+1,tm+1,tr,max(ql,tm+1),qr);
}
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int k;
      // #ifndef ONLINE_JUDGE
      //   freopen("input.txt", "r", stdin);
      //   // freopen("output.txt","w",stdout);
      // #endif
    cin >> n >> k;
    f(i,1,n+1){
        cin >> V[i];  
    }
    ldb r = pow(n,0.333);
    if(k >= 38 or k >= r){
    	f(i,1,n+1){
    		cout << n << " ";
    	}
    	return 0;
    }
    // int c1 = 0;
    while(k--){
    	// c1++;
    	f(i,1,n+1){
    		int a1 = max(1ll,i-V[i]);
    		int a2 = min(n,i + V[i]);
    		update(1,1,n,a1,a2,1);
    		// cout << a1 << " " << a2 << "\n";
    	}
    	int c = 0;
    	f(i,1,n+1){
    		V[i] =rquery(1,1,n,i,i);
    		update(1,1,n,i,i,-V[i]);
    		c += (V[i] >= n);
    		// cout << V[i] << " ";
    	}
    	if(c == n){
    		// cout << c1 << "\n";
    		for(int i = 1;i <= n;i++){
    			cout << V[i] << " ";
    		}
    		return 0;
    	}
    }
    for(int i = 1;i <= n;i++){
    	cout << V[i] << " ";
    }
    return 0;
}
 #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
using ll = long long;
using ldb = long double;
using pa = pair < ll, ll >;
using vec = vector < ll >;
 
template < typename T > using index_set = tree < T, null_type, less < T >, rb_tree_tag, tree_order_statistics_node_update >;
template < typename T > using MinPriorityQueue = priority_queue < T, vector < T >, greater < T > >;

#define pb push_back
#define po pop_back
#define mp make_pair
#define mt make_tuple
#define unique_sort(x) sort(all(x)), x.resize(distance(x.begin(), unique(all(x))))
#define F  first
#define S  second
#define int ll
#define f(i,x,n) for(ll i=x;i<n;i++) 
#define all(c) c.begin(),c.end()
#define str string
#define edl "\n"
#define add insert
#define tm (tl+tr)/2
#define child 2*v
#define ceils(s,n) (s+n-1)/n
#define cot continue
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL)

const int MOD = 1e9 + 7, INF = INT_MAX, N = 2e5 + 10;
const double PI = acos(-1);
const ll LINF = LLONG_MAX;
ll seg[4*N];
ll lazy[4*N];
ll a[N],n,query,V[N];

void push(ll v){
    seg[child]+=lazy[v];
    lazy[child]+=lazy[v];
    seg[child+1]+=lazy[v];
    lazy[child+1]+=lazy[v];
    lazy[v]=0;
}
void update(ll v,ll tl,ll tr,ll ql,ll qr,ll val){
    
    if(ql>qr){
        return ;
    }
    if(ql == tl and qr==tr){
        seg[v]+=val;
        lazy[v]+=val;
    }
    else{
        push(v);
        update(child,tl,tm,ql,min(qr,tm),val);
        update(child+1,tm+1,tr,max(ql,tm+1),qr,val);
        seg[v]=seg[child]+seg[child+1];
    }
}
ll rquery(ll v,ll tl,ll tr,ll ql,ll qr){
    if(ql>qr){
        return 0;
    }
    if(ql<=tl and tr<=qr){
        return seg[v];
    }
    push(v);
    return rquery(child,tl,tm,ql,min(qr,tm))+rquery(child+1,tm+1,tr,max(ql,tm+1),qr);
}
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int k;
      // #ifndef ONLINE_JUDGE
      //   freopen("input.txt", "r", stdin);
      //   // freopen("output.txt","w",stdout);
      // #endif
    cin >> n >> k;
    f(i,1,n+1){
        cin >> V[i];  
    }
    ldb r = pow(n,0.333);
    if(k >= 38 or k >= r){
    	f(i,1,n+1){
    		cout << n << " ";
    	}
    	return 0;
    }
    // int c1 = 0;
    while(k--){
    	// c1++;
    	f(i,1,n+1){
    		int a1 = max(1ll,i-V[i]);
    		int a2 = min(n,i + V[i]);
    		update(1,1,n,a1,a2,1);
    		// cout << a1 << " " << a2 << "\n";
    	}
    	int c = 0;
    	f(i,1,n+1){
    		V[i] =rquery(1,1,n,i,i);
    		update(1,1,n,i,i,-V[i]);
    		c += (V[i] >= n);
    		// cout << V[i] << " ";
    	}
    	if(c == n){
    		// cout << c1 << "\n";
    		for(int i = 1;i <= n;i++){
    			cout << V[i] << " ";
    		}
    		return 0;
    	}
    }
    for(int i = 1;i <= n;i++){
    	cout << V[i] << " ";
    }
    return 0;
}
 

Compiler output:
a.cc:157:11: error: redefinition of 'const ll MOD'
  157 | const int MOD = 1e9 + 7, INF = INT_MAX, N = 2e5 + 10;
      |           ^~~
a.cc:35:11: note: 'const ll MOD' previously defined here
   35 | const int MOD = 1e9 + 7, INF = INT_MAX, N = 2e5 + 10;
      |           ^~~
a.cc:157:26: error: redefinition of 'const ll INF'
  157 | const int MOD = 1e9 + 7, INF = INT_MAX, N = 2e5 + 10;
      |                          ^~~
a.cc:35:26: note: 'const ll INF' previously defined here
   35 | const int MOD = 1e9 + 7, INF = INT_MAX, N = 2e5 + 10;
      |                          ^~~
a.cc:157:41: error: redefinition of 'const ll N'
  157 | const int MOD = 1e9 + 7, INF = INT_MAX, N = 2e5 + 10;
      |                                         ^
a.cc:35:41: note: 'const ll N' previously defined here
   35 | const int MOD = 1e9 + 7, INF = INT_MAX, N = 2e5 + 10;
      |                                         ^
a.cc:158:14: error: redefinition of 'const double PI'
  158 | const double PI = acos(-1);
      |              ^~
a.cc:36:14: note: 'const double PI' previously defined here
   36 | const double PI = acos(-1);
      |              ^~
a.cc:159:10: error: redefinition of 'const ll LINF'
  159 | const ll LINF = LLONG_MAX;
      |          ^~~~
a.cc:37:10: note: 'const ll LINF' previously defined here
   37 | const ll LINF = LLONG_MAX;
      |          ^~~~
a.cc:160:4: error: redefinition of 'll seg [800040]'
  160 | ll seg[4*N];
      |    ^~~
a.cc:38:4: note: 'll seg [800040]' previously declared here
   38 | ll seg[4*N];
      |    ^~~
a.cc:161:4: error: redefinition of 'll lazy [800040]'
  161 | ll lazy[4*N];
      |    ^~~~
a.cc:39:4: note: 'll lazy [800040]' previously declared here
   39 | ll lazy[4*N];
      |    ^~~~
a.cc:162:4: error: redefinition of 'll a [200010]'
  162 | ll a[N],n,query,V[N];
      |    ^
a.cc:40:4: note: 'll a [200010]' previously declared here
   40 | ll a[N],n,query,V[N];
      |    ^
a.cc:162:9: error: redefinition of 'll n'
  162 | ll a[N],n,query,V[N];
      |         ^
a.cc:40:9: note: 'll n' previously declared here
   40 | ll a[N],n,query,V[N];
      |         ^
a.cc:162:11: error: redefinition of 'll query'
  162 | ll a[N],n,query,V[N];
      |           ^~~~~
a.cc:40:11: note: 'll query' previously declared here
   40 | ll a[N],n,query,V[N];
      |           ^~~~~
a.cc:162:17: error: redefinition of 'll V [200010]'
  162 | ll a[N],n,query,V[N];
      |                 ^
a.cc:40:17: note: 'll V [200010]' previously declared here
   40 | ll a[N],n,query,V[N];
      |                 ^
a.cc:164:6: error: redefinition of 'void push(ll)'
  164 | void push(ll v){
      |      ^~~~
a.cc:42:6: note: 'void push(ll)' previously defined here
   42 | void push(ll v){
      |      ^~~~
a.cc:171:6: error: redefinition of 'void update(ll, ll, ll, ll, ll, ll)'
  171 | void update(ll v,ll tl,ll tr,ll ql,ll qr,ll val){
      |      ^~~~~~
a.cc:49:6: note: 'void update(ll, ll, ll, ll, ll, ll)' previously defined here
   49 | void update(ll v,ll tl,ll tr,ll ql,ll qr,ll val){
      |      ^~~~~~
a.cc:187:4: error: redefinition of 'll rquery(ll, ll, ll, ll, ll)'
  187 | ll rquery(ll v,ll tl,ll tr,ll ql,ll qr){
      |    ^~~~~~
a.cc:65:4: note: 'll rquery(ll, ll, ll, ll, ll)' previously defined here
   65 | ll rquery(ll v,ll tl,ll tr,ll ql,ll qr){
      |    ^~~~~~
a.cc:197:9: error: redefinition of 'int32_t main()'
  197 | int32_t main() {
      |         ^~~~
a.cc:75:9: note: 'int32_t main()' previously defined here
   75 | int32_t main() {
      |         ^~~~