Buggy python submission (verdict: Time Limit Exceeded):
import sys
import numpy as np
#from numba import njit

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

#@njit('(i8[::1],)', cache=True)
def update(A):
    N = len(A)
    B = np.zeros_like(A)
    for i, x in enumerate(A):
        l = max(0, i - x)
        r = min(N - 1, i + x)
        B[l] += 1
        if r + 1 < N:
            B[r + 1] -= 1
    B = np.cumsum(B)
    return B

N, K = map(int, readline().split())
A = np.array(read().split(), np.int64)

K = min(K, 100)
for _ in range(K):
    A = update(A)
print(' '.join(A.astype(str)))


Fixed submission:
from itertools import accumulate
#from operator import add

N,K = map(int,input().split())
A = map(int,input().split()) 
for k in range(K):
    B = [0] * N
    for i,x in enumerate(A):
        L = max(0, i-x)
        R = min(N-1, i+x)
        B[L] += 1
        if R+1 != N:
            B[R+1] -= 1
    #L = accumulate(B,add) 
    L = list(accumulate(B))[:]
    if L == A:
        break
    A = L
print(*A)

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import accumulate
from operator import add

N,K = map(int,input().split())
A = map(int,input().split()) 
for k in range(K):
    B = [0] * N
    for i,x in enumerate(A):
        L = max(0, i-x)
        R = min(N-1, i+x)
        B[L] += 1
        if R+1 != N:
            B[R+1] -= 1
    T = accumulate(B,add) 
    if T == A:
        break
    A = T
print(*A)    

Fixed submission:
from itertools import accumulate
#from operator import add

N,K = map(int,input().split())
A = map(int,input().split()) 
for k in range(K):
    B = [0] * N
    for i,x in enumerate(A):
        L = max(0, i-x)
        R = min(N-1, i+x)
        B[L] += 1
        if R+1 != N:
            B[R+1] -= 1
    #L = accumulate(B,add) 
    L = list(accumulate(B))[:]
    if L == A:
        break
    A = L
print(*A)

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import accumulate
from operator import add

N,K,*A = map(int,open(0).read().split())

for k in range(K):
    B = [0] * N
    for i,x in enumerate(A):
        left = max(0, i-x)
        right = min(N-1, i+x)
        B[left] += 1
        if right+1 != N:
            B[right+1] -= 1
    A = list(accumulate(B,add))    
print(*A,sep=" ")

Fixed submission:
from itertools import accumulate
#from operator import add

N,K = map(int,input().split())
A = map(int,input().split()) 
for k in range(K):
    B = [0] * N
    for i,x in enumerate(A):
        L = max(0, i-x)
        R = min(N-1, i+x)
        B[L] += 1
        if R+1 != N:
            B[R+1] -= 1
    #L = accumulate(B,add) 
    L = list(accumulate(B))[:]
    if L == A:
        break
    A = L
print(*A)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N,K,*A = map(int,open(0).read().split())
na = np.array(A)
K = min(K,100)

for i in range(K):
    if all(na) == N:
        break
    B = [0] * N
    nb = np.array(B)
    for n in range(N):
        L = max(0, n-na[n])
        R = min(N-1 , n + na[n])
        nb[L] += 1
        if R+1 != N:
            nb[R+1] -= 1
      
    na = nb.cumsum()        
 
print(*na,sep=" ")    
   


Fixed submission:
from itertools import accumulate
#from operator import add

N,K = map(int,input().split())
A = map(int,input().split()) 
for k in range(K):
    B = [0] * N
    for i,x in enumerate(A):
        L = max(0, i-x)
        R = min(N-1, i+x)
        B[L] += 1
        if R+1 != N:
            B[R+1] -= 1
    #L = accumulate(B,add) 
    L = list(accumulate(B))[:]
    if L == A:
        break
    A = L
print(*A)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N,K,*A = map(int,open(0).read().split())
na = np.array(A)

for i in range(K):
    if all(na) == N:
        break
    B = [0] * N
    nb = np.array(B)
    for n in range(N):
        L = max(0, n-na[n])
        R = min(N-1 , n + na[n])
        nb[L] += 1
        if R+1 != N:
            nb[R+1] -= 1
      
    na = nb.cumsum()        
 
print(*na,sep=" ")    
   


Fixed submission:
from itertools import accumulate
#from operator import add

N,K = map(int,input().split())
A = map(int,input().split()) 
for k in range(K):
    B = [0] * N
    for i,x in enumerate(A):
        L = max(0, i-x)
        R = min(N-1, i+x)
        B[L] += 1
        if R+1 != N:
            B[R+1] -= 1
    #L = accumulate(B,add) 
    L = list(accumulate(B))[:]
    if L == A:
        break
    A = L
print(*A)

Buggy python submission (verdict: Runtime Error):
import numpy as np

N,K,*A = map(int,open(0).read().split())
na = np.array(A)

for i in range(K):
    if all(na) == N:
        break
    B = [0] * N
    nb = np.array(B)
    for n in range(N):
        L = max(0, n-na[n])
        R = min(N-1 , n + na[n])
        nb[L] += 1
        if R+1 != N:
            nb[R+1] -= 1
      
    na = nb.cumsum()        
 
print(*na,sep=" ")    
   


Fixed submission:
from itertools import accumulate
#from operator import add

N,K = map(int,input().split())
A = map(int,input().split()) 
for k in range(K):
    B = [0] * N
    for i,x in enumerate(A):
        L = max(0, i-x)
        R = min(N-1, i+x)
        B[L] += 1
        if R+1 != N:
            B[R+1] -= 1
    #L = accumulate(B,add) 
    L = list(accumulate(B))[:]
    if L == A:
        break
    A = L
print(*A)

Buggy python submission (verdict: Time Limit Exceeded):
N,K,*A = map(int,open(0).read().split())

for k in range(K):
    if all(A) == N:
        break
    B = [0] * N
    for n in range(N):
        L = max(0, n-A[n])
        R = min(N-1 , n + A[n])
        B[L] += 1
        if R+1 != N:
            B[R+1] -= 1
    
    ruiseki = [0] * N
    ruiseki[0] = B[0]
    for i in range(1,N):
        ruiseki[i] = ruiseki[i-1] + B[i]
        
    A = ruiseki[:]
print(*ruiseki,sep=" ")    
   


Fixed submission:
from itertools import accumulate
#from operator import add

N,K = map(int,input().split())
A = map(int,input().split()) 
for k in range(K):
    B = [0] * N
    for i,x in enumerate(A):
        L = max(0, i-x)
        R = min(N-1, i+x)
        B[L] += 1
        if R+1 != N:
            B[R+1] -= 1
    #L = accumulate(B,add) 
    L = list(accumulate(B))[:]
    if L == A:
        break
    A = L
print(*A)

Buggy python submission (verdict: Time Limit Exceeded):
from numba import jit

@jit
def f(lst):
    for n in range(N):
        L = max(0, n-lst[n])
        R = min(N-1 , n + lst[n])
        B[L] += 1
        if R+1 != N:
            B[R+1] -= 1
    return B     
    
@jit
def f2(lst):
    for i in range(1,N):
        ruiseki[i] = ruiseki[i-1] + lst[i]
    return ruiseki    

N,K,*A = map(int,open(0).read().split())

for k in range(K):
    if all(A) == N:
        break
    B = [0] * N
    B = f(A)
   
    ruiseki = [0] * N
    ruiseki[0] = B[0]
    A = f2(B)
print(*ruiseki,sep=" ")    
   

Fixed submission:
from itertools import accumulate
#from operator import add

N,K = map(int,input().split())
A = map(int,input().split()) 
for k in range(K):
    B = [0] * N
    for i,x in enumerate(A):
        L = max(0, i-x)
        R = min(N-1, i+x)
        B[L] += 1
        if R+1 != N:
            B[R+1] -= 1
    #L = accumulate(B,add) 
    L = list(accumulate(B))[:]
    if L == A:
        break
    A = L
print(*A)

Buggy python submission (verdict: Time Limit Exceeded):
N,K,*A = map(int,open(0).read().split())

for k in range(K):
    if all(A) == N:
        break
    B = [0] * N
    for n in range(N):
        L = max(0, n-A[n])
        R = min(N-1 , n + A[n])
        B[L] += 1
        if R+1 != N:
            B[R+1] -= 1
    
    ruiseki = [0] * N
    ruiseki[0] = B[0]
    for i in range(1,N):
        ruiseki[i] = ruiseki[i-1] + B[i]
        
    A = ruiseki[:]
print(*ruiseki,sep=" ")    
   

Fixed submission:
from itertools import accumulate
#from operator import add

N,K = map(int,input().split())
A = map(int,input().split()) 
for k in range(K):
    B = [0] * N
    for i,x in enumerate(A):
        L = max(0, i-x)
        R = min(N-1, i+x)
        B[L] += 1
        if R+1 != N:
            B[R+1] -= 1
    #L = accumulate(B,add) 
    L = list(accumulate(B))[:]
    if L == A:
        break
    A = L
print(*A)

Buggy python submission (verdict: Runtime Error):
N,K,*A = map(int,open(0).read().split())

for k in range(K):
    if len(set(A)) == 1:
        break
    B = [0] * N
    for n in range(N):
        L = max(0, n-A[n])
        R = min(N-1 , n + A[n])
        B[L] += 1
        if R+1 != N:
            B[R+1] -= 1
    
    ruiseki = [0] * N
    ruiseki[0] = B[0]
    for i in range(1,N):
        ruiseki[i] = ruiseki[i-1] + B[i]
        
    A = ruiseki[:]
print(*ruiseki,sep=" ")    
   

Fixed submission:
from itertools import accumulate
#from operator import add

N,K = map(int,input().split())
A = map(int,input().split()) 
for k in range(K):
    B = [0] * N
    for i,x in enumerate(A):
        L = max(0, i-x)
        R = min(N-1, i+x)
        B[L] += 1
        if R+1 != N:
            B[R+1] -= 1
    #L = accumulate(B,add) 
    L = list(accumulate(B))[:]
    if L == A:
        break
    A = L
print(*A)

Buggy python submission (verdict: Time Limit Exceeded):
N,K,*A = map(int,open(0).read().split())

for i in range(K):
    after = [0] * N 
    for a in range(N):
        if A[a] == 0:
            after[a] += 1
        else:
            left = max(0,a-A[a])
            right = min(a+A[a],N-1)
            for aa in range(left, right+1):
                after[aa] += 1
    A = after[:]                
print(*after,sep=" ")                    
                
        

Fixed submission:
from itertools import accumulate
#from operator import add

N,K = map(int,input().split())
A = map(int,input().split()) 
for k in range(K):
    B = [0] * N
    for i,x in enumerate(A):
        L = max(0, i-x)
        R = min(N-1, i+x)
        B[L] += 1
        if R+1 != N:
            B[R+1] -= 1
    #L = accumulate(B,add) 
    L = list(accumulate(B))[:]
    if L == A:
        break
    A = L
print(*A)