Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
a = list(map(int, input().split()))
for j in range(min(k, 41)):
  b = [0]*n
  for i in range(n):
    l = max(0, i-a[i])
    r = min(n, i+a[i]+1)
    b[l] += 1
    if r < n:
      b[r] -= 1
  for i in range(1, n): 
    b[i]+=b[i-1]
  a = b

print(" ".join(list(map(str, a))))
      
  


Fixed submission:
n, k = map(int, input().split())
a = list(map(int, input().split()))
for j in range(min(k, 41)):
  b = [0]*n
  for i in range(n):
    l = max(0, i-a[i])
    r = min(n, i+a[i]+1)
    b[l] += 1
    if r < n:
      b[r] -= 1
  for i in range(1, n): 
    b[i]+=b[i-1]
  a = b

print(" ".join(list(map(str, a))))

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
a = list(map(int, input().split()))
for j in range(k):
  b = [0]*n
  for i in range(n):
    l = max(0, i-a[i])
    r = min(n, i+a[i]+1)
    b[l] += 1
    if r < n:
      b[r] -= 1
  for i in range(1, n): 
    b[i]+=b[i-1]
  a = b
  if a.count(n) == n:
    break
print(" ".join(list(map(str, a))))
      
  


Fixed submission:
n, k = map(int, input().split())
a = list(map(int, input().split()))
for j in range(min(k, 41)):
  b = [0]*n
  for i in range(n):
    l = max(0, i-a[i])
    r = min(n, i+a[i]+1)
    b[l] += 1
    if r < n:
      b[r] -= 1
  for i in range(1, n): 
    b[i]+=b[i-1]
  a = b

print(" ".join(list(map(str, a))))

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n, k = map(int, input().split())
a = np.array(list(map(int, input().split())))
for j in range(k):
  b = np.array([0]*n)
  for i in range(n):
    b[max(0, i-a[i]):min(n, i+a[i]+1)] += 1
  a = b
  if np.count_nonzero(a == n) == n:
    break
print(" ".join(list(map(str, a))))
      
  

Fixed submission:
n, k = map(int, input().split())
a = list(map(int, input().split()))
for j in range(min(k, 41)):
  b = [0]*n
  for i in range(n):
    l = max(0, i-a[i])
    r = min(n, i+a[i]+1)
    b[l] += 1
    if r < n:
      b[r] -= 1
  for i in range(1, n): 
    b[i]+=b[i-1]
  a = b

print(" ".join(list(map(str, a))))

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
tenjo = n
a = list(map(int, input().split()))
for j in range(k):
  b = [0]*n
  for i in range(n):
    if max(0, i-a[i]) + min(n, i+a[i]+1) >= n:
      tenjo -= 1
    for e in range(max(0, i-a[i]), min(n, i+a[i]+1)):
      b[e] += 1
  a = b
  if a.count(tenjo) == n:
    break
print(" ".join(list(map(str, a))))
      
  

Fixed submission:
n, k = map(int, input().split())
a = list(map(int, input().split()))
for j in range(min(k, 41)):
  b = [0]*n
  for i in range(n):
    l = max(0, i-a[i])
    r = min(n, i+a[i]+1)
    b[l] += 1
    if r < n:
      b[r] -= 1
  for i in range(1, n): 
    b[i]+=b[i-1]
  a = b

print(" ".join(list(map(str, a))))

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
a = list(map(int, input().split()))
for j in range(k):
  b = [0]*n
  for i in range(n):
    for e in range(max(0, i-a[i]), min(n, i+a[i]+1)):
      b[e] += 1
  a = b
  if a.count(n) == n:
    break
print(" ".join(list(map(str, a))))
      
  

Fixed submission:
n, k = map(int, input().split())
a = list(map(int, input().split()))
for j in range(min(k, 41)):
  b = [0]*n
  for i in range(n):
    l = max(0, i-a[i])
    r = min(n, i+a[i]+1)
    b[l] += 1
    if r < n:
      b[r] -= 1
  for i in range(1, n): 
    b[i]+=b[i-1]
  a = b

print(" ".join(list(map(str, a))))