Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
As = list(map(int, input().split()))
 
 
def change(arr):
  newAs = [0] * n
  for i, a in enumerate(arr):
    for t in range(max(i - a, 0), min(i + a + 1, n)):
      newAs[t] += 1
  return newAs
 
 
for temp in range(min(k, 40)):
  As = change(As)
print(' '.join(map(str, As)))


Fixed submission:
import math
from itertools import accumulate
n, k = map(int, input().split())
As = list(map(int, input().split()))
for i in range(min(41, k)):
  _As = [0]*(n+1)
  for j in range(n):
    l = max(0, j - As[j])
    r = min(n - 1, j + As[j])
    _As[l] += 1
    _As[r+1] -= 1
  As = list(accumulate(_As))[:-1]
print(' '.join([str(A) for A in As]))

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
As = list(map(int, input().split()))
 
 
def change(arr):
  newAs = [0] * n
  for i, a in enumerate(arr):
    for t in range(max(i - a, 0), min(i + a + 1, n)):
      newAs[t] += 1
  return newAs
 
 
for temp in range(min(k, 10**2)):
  As = change(As)
print(' '.join(map(str, As)))

Fixed submission:
import math
from itertools import accumulate
n, k = map(int, input().split())
As = list(map(int, input().split()))
for i in range(min(41, k)):
  _As = [0]*(n+1)
  for j in range(n):
    l = max(0, j - As[j])
    r = min(n - 1, j + As[j])
    _As[l] += 1
    _As[r+1] -= 1
  As = list(accumulate(_As))[:-1]
print(' '.join([str(A) for A in As]))

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
As = list(map(int, input().split()))
lastAs = [n] * n


def change(arr):
  newAs = [0] * n
  flag = False
  for i, a in enumerate(arr):
    if (a >= n):
      flag = True
    for t in range(max(i - a, 0), min(i + a + 1, n)):
      newAs[t] += 1
  return (flag, newAs)


def clean(arr):
  newAs = [0] * n
  for i, a in enumerate(arr):
    newAs[i] = min(n, a)
  return newAs


def change2(arr):
  newAs = [0] * n
  flag = True
  for i, a in enumerate(arr):
    for t in range(max(i - a, 0), min(i + a + 1, n)):
      newAs[t] += 1
  for a in newAs:
    if (a < n):
      flag = False
  return (flag, newAs)


for temp in range(k):
  flag, As = change(As)
  if (flag):
    As = clean(As)
    for temp2 in range(min(k - temp), 3):
      flag2, As = change(As)
      As = clean(As)
      if (flag2):
        print(' '.join(map(str, As)))
        exit()
print(' '.join(map(str, As)))


Fixed submission:
import math
from itertools import accumulate
n, k = map(int, input().split())
As = list(map(int, input().split()))
for i in range(min(41, k)):
  _As = [0]*(n+1)
  for j in range(n):
    l = max(0, j - As[j])
    r = min(n - 1, j + As[j])
    _As[l] += 1
    _As[r+1] -= 1
  As = list(accumulate(_As))[:-1]
print(' '.join([str(A) for A in As]))

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
As = list(map(int, input().split()))


def change(arr):
  newAs = [0] * n
  for i, a in enumerate(arr):
    for t in range(max(i - a, 0), min(i + a + 1, n)):
      newAs[t] += 1
  return newAs


for temp in range(min(k, 10**3)):
  As = change(As)
print(' '.join(map(str, As)))


Fixed submission:
import math
from itertools import accumulate
n, k = map(int, input().split())
As = list(map(int, input().split()))
for i in range(min(41, k)):
  _As = [0]*(n+1)
  for j in range(n):
    l = max(0, j - As[j])
    r = min(n - 1, j + As[j])
    _As[l] += 1
    _As[r+1] -= 1
  As = list(accumulate(_As))[:-1]
print(' '.join([str(A) for A in As]))

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
As = list(map(int, input().split()))


def change(arr):
  newAs = [0] * n
  for i, a in enumerate(arr):
    for t in range(max(i - a, 0), min(i + a + 1, n)):
      newAs[t] += 1
  return newAs


for temp in range(min(k, 10**4)):
  As = change(As)
print(' '.join(map(str, As)))

Fixed submission:
import math
from itertools import accumulate
n, k = map(int, input().split())
As = list(map(int, input().split()))
for i in range(min(41, k)):
  _As = [0]*(n+1)
  for j in range(n):
    l = max(0, j - As[j])
    r = min(n - 1, j + As[j])
    _As[l] += 1
    _As[r+1] -= 1
  As = list(accumulate(_As))[:-1]
print(' '.join([str(A) for A in As]))

Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
As = list(map(int, input().split()))


def change(arr):
  newAs = [0] * n
  for i, a in enumerate(arr):
    for t in range(max(i - a, 0), min(i + a + 1, n)):
      newAs[t] += 1
  return newAs


for temp in min(range(k),10**4)):
  As = change(As)
print(' '.join(map(str, As)))

Fixed submission:
import math
from itertools import accumulate
n, k = map(int, input().split())
As = list(map(int, input().split()))
for i in range(min(41, k)):
  _As = [0]*(n+1)
  for j in range(n):
    l = max(0, j - As[j])
    r = min(n - 1, j + As[j])
    _As[l] += 1
    _As[r+1] -= 1
  As = list(accumulate(_As))[:-1]
print(' '.join([str(A) for A in As]))

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
As = list(map(int, input().split()))

def change(arr):
  newAs = [0] * n
  for i, a in enumerate(arr):
    for t in range(max(i - a, 0), min(i + a + 1, n)):
      newAs[t] += 1
  return newAs


for temp in range(k):
  As = change(As)
print(' '.join(map(str, As)))

Fixed submission:
import math
from itertools import accumulate
n, k = map(int, input().split())
As = list(map(int, input().split()))
for i in range(min(41, k)):
  _As = [0]*(n+1)
  for j in range(n):
    l = max(0, j - As[j])
    r = min(n - 1, j + As[j])
    _As[l] += 1
    _As[r+1] -= 1
  As = list(accumulate(_As))[:-1]
print(' '.join([str(A) for A in As]))