Buggy python submission (verdict: Time Limit Exceeded):
import copy
n,k,*A = map(int,open(0).read().split())

A_1 = copy.deepcopy(A)
A_2 = copy.deepcopy(A)
for _ in range(k):
    A_1_1 = copy.deepcopy(A)
    if _ == 0:A = [0] * n
    for i,d in enumerate(A_1):
        if d >= max(n-i,i):continue
        for j in range(i-d,i+d+1):
            if 0<=j<n:
                if _ != 0 and i-A_2[i]<=j<=i+A_2[i]:continue
                A[j] += 1
    A_2 = copy.deepcopy(A_1); A_1 = copy.deepcopy(A)
    up = True
    for i,c in enumerate(A):
        if c < max(n-i,i+1):
            up = False          
    if up:
        break
print(*A)


Fixed submission:
import copy
n,k,*A = map(int,open(0).read().split())
for _ in range(min(50,k)):
    B = [0] * (n+1)
    for i,d in enumerate(A):
        start = max(0,i-d)
        B[start] += 1
        end = min(n,i+d+1)
        B[end] -= 1
    light = 0 
    for i,b in enumerate(B[:n]):
        light += b
        A[i] = light

print(*A)

Buggy python submission (verdict: Time Limit Exceeded):
import copy
n,k,*A = map(int,open(0).read().split())

A_1 = copy.deepcopy(A)
A_2 = copy.deepcopy(A)
for _ in range(k):
    A_1_1 = copy.deepcopy(A)
    if _ == 0:A = [0] * n
    for i,d in enumerate(A_1):
        for j in range(i-d,i+d+1):
            if 0<=j<n:
                if _ != 0 and i-A_2[i]<=j<=i+A_2[i]:continue
                A[j] += 1
    A_2 = copy.deepcopy(A_1); A_1 = copy.deepcopy(A)
    up = True
    for c in A:
        if c != n:
            up = False          
    if up:
        break
print(*A)


Fixed submission:
import copy
n,k,*A = map(int,open(0).read().split())
for _ in range(min(50,k)):
    B = [0] * (n+1)
    for i,d in enumerate(A):
        start = max(0,i-d)
        B[start] += 1
        end = min(n,i+d+1)
        B[end] -= 1
    light = 0 
    for i,b in enumerate(B[:n]):
        light += b
        A[i] = light

print(*A)

Buggy python submission (verdict: Time Limit Exceeded):
import copy
n,k,*A = map(int,open(0).read().split())

for _ in range(k):
    C = [0] * n
    for i,d in enumerate(A):
        for j in range(i-d,i+d+1):
            if 0<=j<n:
                C[j] += 1
    A = copy.deepcopy(C)

    up = True
    for c in C:
        if c != n:
            up = False          
    if up:
        break

print(*C)


Fixed submission:
import copy
n,k,*A = map(int,open(0).read().split())
for _ in range(min(50,k)):
    B = [0] * (n+1)
    for i,d in enumerate(A):
        start = max(0,i-d)
        B[start] += 1
        end = min(n,i+d+1)
        B[end] -= 1
    light = 0 
    for i,b in enumerate(B[:n]):
        light += b
        A[i] = light

print(*A)

Buggy python submission (verdict: Time Limit Exceeded):
import copy
n,k,*A = map(int,open(0).read().split())

for _ in range(k):
    C = [0] * n
    for i,d in enumerate(A):
        for j in range(i-d,i+d+1):
            if 0<=j<n:
                C[j] += 1
    A = copy.deepcopy(C)

print(*C)


Fixed submission:
import copy
n,k,*A = map(int,open(0).read().split())
for _ in range(min(50,k)):
    B = [0] * (n+1)
    for i,d in enumerate(A):
        start = max(0,i-d)
        B[start] += 1
        end = min(n,i+d+1)
        B[end] -= 1
    light = 0 
    for i,b in enumerate(B[:n]):
        light += b
        A[i] = light

print(*A)