Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
A = [*map(int, input().split())]
for i in range(k):
    B = [0]*(n+1)
    for j in range(n):
        l = max(0, j - A[j])
        r = min(n, j + A[j] + 1)
        B[l] += 1; B[r] -= 1
    for j in range(n-1): B[j+1] += B[j]
    B.pop()
    if A == B: break
    A = B
print(*A, sep=' ')


Fixed submission:
n,k = map(int,input().split())
A=[*map(int,input().split())]
for i in range(k):
    B = [0]*n
    for j in range(n):
        d = A[j] # 強さ
        l = max(0, j-d) # 範囲
        r = j+d+1 # 範囲
        B[l] += 1
        if r <= n-1: B[r] -= 1
    is_same = True
    for j in range(n-1):
        B[j+1] = B[j+1] + B[j]
        if B[j+1] != n: is_same = False
    # print(B)
    if is_same: break
    A = B
# print(B)
print(*B,sep=' ')

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
A = [*map(int, input().split())]
for i in range(k):
    B = [0]*n
    for j in range(n):
        l = max(0, j-A[j])
        r = j + A[j] + 1
        B[l] += 1
        if r <= n-1: B[r] -= 1
    is_same = True
    for j in range(n-1):
        B[j+1] = B[j+1] + B[j]
        if B[j+1] != n: is_same = False
    if is_same: break
    A = B
print(*B,sep=' ')


Fixed submission:
n,k = map(int,input().split())
A=[*map(int,input().split())]
for i in range(k):
    B = [0]*n
    for j in range(n):
        d = A[j] # 強さ
        l = max(0, j-d) # 範囲
        r = j+d+1 # 範囲
        B[l] += 1
        if r <= n-1: B[r] -= 1
    is_same = True
    for j in range(n-1):
        B[j+1] = B[j+1] + B[j]
        if B[j+1] != n: is_same = False
    # print(B)
    if is_same: break
    A = B
# print(B)
print(*B,sep=' ')

Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
A=[*map(int,input().split())]
# print(n,k)
# print(A)
# B = []
m = min({19,k,n})
# B = [[0]*n for _ in range(m+1)]
# B[0] = A
# print('m',m)
# print(B)
for i in range(m):

    # print(i,B)
    B = [0]*n

    for j in range(n):
        d = A[j] # 強さ
        l = max(0, j-d) # 範囲
        r = j+d+1 # 範囲
        # print('j,d,l,r',j,d,l,r)
        B[l] += 1
        if r <= n-1: B[r] -= 1

    for j in range(n-1):
        B[j+1] = B[j+1] + B[j]
    A = B

# print('---')
# print(B)
# for i in range(n-1):
#     B[i+1] = B[i+1] + B[i]
# print(B)
print(*B,sep=' ')
# print(A)
# print(*A, sep=' ')


Fixed submission:
n,k = map(int,input().split())
A=[*map(int,input().split())]
for i in range(k):
    B = [0]*n
    for j in range(n):
        d = A[j] # 強さ
        l = max(0, j-d) # 範囲
        r = j+d+1 # 範囲
        B[l] += 1
        if r <= n-1: B[r] -= 1
    is_same = True
    for j in range(n-1):
        B[j+1] = B[j+1] + B[j]
        if B[j+1] != n: is_same = False
    # print(B)
    if is_same: break
    A = B
# print(B)
print(*B,sep=' ')

Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
A=[*map(int,input().split())]
# print(n,k)
# print(A)
B = []
for i in range(min({18,k,n})):
    # print(i,A)
    B = [0]*n
    for j in range(n):
        d = A[j] # 強さ
        l = max(0, j-d) # 範囲
        r = min(n-1, j+d) # 範囲
        # print('j,d,l,r',j,d,l,r)
        for k in range(l,r+1): # [l,r]
            B[k] += 1
    A = B

print(*A, sep=' ')


Fixed submission:
n,k = map(int,input().split())
A=[*map(int,input().split())]
for i in range(k):
    B = [0]*n
    for j in range(n):
        d = A[j] # 強さ
        l = max(0, j-d) # 範囲
        r = j+d+1 # 範囲
        B[l] += 1
        if r <= n-1: B[r] -= 1
    is_same = True
    for j in range(n-1):
        B[j+1] = B[j+1] + B[j]
        if B[j+1] != n: is_same = False
    # print(B)
    if is_same: break
    A = B
# print(B)
print(*B,sep=' ')

Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
A=[*map(int,input().split())]
# print(n,k)
# print(A)
B = []
for i in range(min(20,k)):
    B = [0]*n
    for j in range(n):
        d = A[j] # 強さ
        x = j + 1
        l = max(1, abs(x-d)) # 範囲
        r = min(n, abs(x+d)) # 範囲
        # print('x,l,r',x,l,r)
        for k in range(l-1,r): # (l,r)
            B[k] += 1
        # print('---')
    # print(B)
    A = B

print(*A, sep=' ')


Fixed submission:
n,k = map(int,input().split())
A=[*map(int,input().split())]
for i in range(k):
    B = [0]*n
    for j in range(n):
        d = A[j] # 強さ
        l = max(0, j-d) # 範囲
        r = j+d+1 # 範囲
        B[l] += 1
        if r <= n-1: B[r] -= 1
    is_same = True
    for j in range(n-1):
        B[j+1] = B[j+1] + B[j]
        if B[j+1] != n: is_same = False
    # print(B)
    if is_same: break
    A = B
# print(B)
print(*B,sep=' ')

Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
A=[*map(int,input().split())]
# print(n,k)
# print(A)
B = []
for i in range(k):
    B = [0]*n
    for j in range(n):
        d = A[j] # 強さ
        x = j + 1
        l = max(1, abs(x-d)) # 範囲
        r = min(n, abs(x+d)) # 範囲
        # print('x,l,r',x,l,r)
        for k in range(l-1,r): # (l,r)
            B[k] += 1
        # print('---')
    # print(B)
    A = B

print(*A, sep=' ')


Fixed submission:
n,k = map(int,input().split())
A=[*map(int,input().split())]
for i in range(k):
    B = [0]*n
    for j in range(n):
        d = A[j] # 強さ
        l = max(0, j-d) # 範囲
        r = j+d+1 # 範囲
        B[l] += 1
        if r <= n-1: B[r] -= 1
    is_same = True
    for j in range(n-1):
        B[j+1] = B[j+1] + B[j]
        if B[j+1] != n: is_same = False
    # print(B)
    if is_same: break
    A = B
# print(B)
print(*B,sep=' ')