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

def next(A):
    t = len(A)
    L = np.zeros(t)
    for i in range(t):
        m = max(0,int(i-A[i]))
        M = min(t,int(i+A[i]+1))
        L[m:M] += np.ones(M-m)
    return L

N,K = [int(i) for i in input().split()]
A = np.array([int(i) for i in input().split()])

for _ in range(K):
    A = next(A)
    for a in A:
        if a != N:
            break
    else:
        break
A = [str(int(i)) for i in A]
print(" ".join(A))


Fixed submission:
N,K = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]

for _ in range(K):
    new = [0]*N
    for i in range(N):
        m = max(0,i-A[i])
        new[m] += 1
        if i+A[i]+1 < N:
            new[i+A[i]+1] -= 1
    A[0] = new[0]
    for i in range(1,N):
        new[i] += new[i-1]
        A[i] = new[i]
    for a in A:
        if a != N:
            break
    else:
        break

A = [str(i) for i in A]
print(" ".join(A))

Buggy python submission (verdict: Time Limit Exceeded):
N,K = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]

for _ in range(K):
    new = [0]*N
    for i in range(N):
        m = max(0,i-A[i])
        new[m] += 1
        if i+A[i]+1 < N:
            new[i+A[i]+1] -= 1
    A[0] = new[0]
    for i in range(1,N):
        new[i] += new[i-1]
        A[i] = new[i]

A = [str(i) for i in A]
print(" ".join(A))

Fixed submission:
N,K = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]

for _ in range(K):
    new = [0]*N
    for i in range(N):
        m = max(0,i-A[i])
        new[m] += 1
        if i+A[i]+1 < N:
            new[i+A[i]+1] -= 1
    A[0] = new[0]
    for i in range(1,N):
        new[i] += new[i-1]
        A[i] = new[i]
    for a in A:
        if a != N:
            break
    else:
        break

A = [str(i) for i in A]
print(" ".join(A))

Buggy python submission (verdict: Time Limit Exceeded):
N,K = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]

for _ in range(K):
    new = [0]*N
    for i in range(N):
        m = max(0,i-A[i])
        new[m] += 1
        if i+A[i]+1 < N:
            new[i+A[i]+1] -= 1
    for i in range(1,N):
        new[i] += new[i-1]
    A = new

A = [str(i) for i in A]
print(" ".join(A))

Fixed submission:
N,K = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]

for _ in range(K):
    new = [0]*N
    for i in range(N):
        m = max(0,i-A[i])
        new[m] += 1
        if i+A[i]+1 < N:
            new[i+A[i]+1] -= 1
    A[0] = new[0]
    for i in range(1,N):
        new[i] += new[i-1]
        A[i] = new[i]
    for a in A:
        if a != N:
            break
    else:
        break

A = [str(i) for i in A]
print(" ".join(A))

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

def next(A):
    t = len(A)
    L = np.zeros(t)
    for i in range(t):
        m = max(0,int(i-A[i]))
        M = min(t,int(i+A[i]+1))
        L[m:M] += np.ones(M-m)
    return L

N,K = [int(i) for i in input().split()]
A = np.array([int(i) for i in input().split()])

for _ in range(K):
    A = next(A)
A = [str(int(i)) for i in A]
print(" ".join(A))

Fixed submission:
N,K = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]

for _ in range(K):
    new = [0]*N
    for i in range(N):
        m = max(0,i-A[i])
        new[m] += 1
        if i+A[i]+1 < N:
            new[i+A[i]+1] -= 1
    A[0] = new[0]
    for i in range(1,N):
        new[i] += new[i-1]
        A[i] = new[i]
    for a in A:
        if a != N:
            break
    else:
        break

A = [str(i) for i in A]
print(" ".join(A))