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

n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
a = np.array(a, dtype=np.int64)

for i in range(k):
    b = np.zeros(n, dtype=np.int64)
    for j in range(n):
        lb = max(j - a[j], 0)
        ub = min(j + a[j], n - 1)

        b[lb] += 1
        if ub + 1 < n:
            b[ub + 1] -= 1

    a = b.cumsum()

    if np.all(a == n):
        break

print(' '.join(a.astype(str)))


Fixed submission:
import numpy as np
from numba import njit

@njit('i8,i8,i8[::1]', cache=True)
def fn(n, k, a):
    for _ in range(k):
        b = np.zeros(n, dtype=np.int64)
        for i in range(n):
            lb = max(i - a[i], 0)
            ub = min(i + a[i], n - 1)

            b[lb] += 1
            if ub + 1 < n:
                b[ub + 1] -= 1

        a = b.cumsum()
        if np.all(a == n):
            return a
    return a

n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
a = np.array(a, dtype=np.int64)

b = fn(n, k, a)
print(' '.join(b.astype(str)))

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

#print(an)
for i in range(k):
    b = [0] * n
    for j in range(n):
        lb = max(j - a[j], 0)
        ub = min(j + a[j], n - 1)

        b[lb] += 1
        if ub + 1 < n:
            b[ub + 1] -= 1
    #print(b)
    for j in range(1, n):
        b[j] += b[j - 1]

    #print('k =', i + 1)
    #print(b)
    if all(a == n for a in b):
        #print('done!')
        break
    a = b

print(' '.join(map(str, a)))


Fixed submission:
import numpy as np
from numba import njit

@njit('i8,i8,i8[::1]', cache=True)
def fn(n, k, a):
    for _ in range(k):
        b = np.zeros(n, dtype=np.int64)
        for i in range(n):
            lb = max(i - a[i], 0)
            ub = min(i + a[i], n - 1)

            b[lb] += 1
            if ub + 1 < n:
                b[ub + 1] -= 1

        a = b.cumsum()
        if np.all(a == n):
            return a
    return a

n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
a = np.array(a, dtype=np.int64)

b = fn(n, k, a)
print(' '.join(b.astype(str)))

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

ptr = 0
buf = [[a for a in an], [0] * len(an)]
#print(an)
for i in range(k):
    ib = buf[ptr]
    buf[ptr ^ 1] = [0] * len(an)
    ob = buf[ptr ^ 1]
    
    for j in range(n):
        s = ib[j]

        lb = max(j - s, 0)
        ub = min(j + s, len(an) - 1)
        for k_ in range(lb, ub + 1):
            ob[k_] += 1
    #print('k =', i + 1)
    #print(ob)
    ptr ^= 1
    if all(a == n for a in ob):
        #print('done!')
        break

print(' '.join(map(str, buf[ptr])))


Fixed submission:
import numpy as np
from numba import njit

@njit('i8,i8,i8[::1]', cache=True)
def fn(n, k, a):
    for _ in range(k):
        b = np.zeros(n, dtype=np.int64)
        for i in range(n):
            lb = max(i - a[i], 0)
            ub = min(i + a[i], n - 1)

            b[lb] += 1
            if ub + 1 < n:
                b[ub + 1] -= 1

        a = b.cumsum()
        if np.all(a == n):
            return a
    return a

n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
a = np.array(a, dtype=np.int64)

b = fn(n, k, a)
print(' '.join(b.astype(str)))

Buggy python submission (verdict: Time Limit Exceeded):
# ナイーブな解法。厳しいデータだとO(K*N), 2^2 x 10^10 でTLEになるはず

n, k = list(map(int, input().split()))
an = list(map(int, input().split()))

ptr = 0
buf = [[a for a in an], [0] * len(an)]
#print(an)
for i in range(k):
    ib = buf[ptr]
    buf[ptr ^ 1] = [0] * len(an)
    ob = buf[ptr ^ 1]
    
    for j in range(n):
        s = ib[j]

        lb = max(j - s, 0)
        ub = min(j + s, len(an) - 1)
        for k_ in range(lb, ub + 1):
            ob[k_] += 1
    #print('k =', i + 1)
    #print(ob)
    ptr ^= 1

print(' '.join(map(str, buf[ptr])))


Fixed submission:
import numpy as np
from numba import njit

@njit('i8,i8,i8[::1]', cache=True)
def fn(n, k, a):
    for _ in range(k):
        b = np.zeros(n, dtype=np.int64)
        for i in range(n):
            lb = max(i - a[i], 0)
            ub = min(i + a[i], n - 1)

            b[lb] += 1
            if ub + 1 < n:
                b[ub + 1] -= 1

        a = b.cumsum()
        if np.all(a == n):
            return a
    return a

n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
a = np.array(a, dtype=np.int64)

b = fn(n, k, a)
print(' '.join(b.astype(str)))