Buggy python submission (verdict: Time Limit Exceeded):
import sys
import copy
from collections import deque
stdin = sys.stdin

mod = 10**9+7

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n, k = na()
a = na()

def calc_lux(a):
    res = [0 for _ in range(len(a))]
    cnt = 0
    for i in range(len(a)):
        light = a[i]
        if light==len(a) or (i <= light and n-1-i <= light):
            cnt += 1
            continue
        for j in range(max(0, i-light), min(n-1, i+light)+1, 1):
            res[j] += 1
    for i in range(len(res)):
        res[i] += cnt
    return res

for _ in range(k):
    # calc lux from a
    lux = calc_lux(a)

    if a==lux:
        a = lux
        break

    # overwrite a
    a = lux
    # print(lux)

print(" ".join([str(i) for i in a]))

Fixed submission:
import sys
import copy
from collections import deque
stdin = sys.stdin

mod = 10**9+7

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n, k = na()
a = na()

def calc_lux(a):
    imosu = [0 for _ in range(len(a))]
    res = [0 for _ in range(len(a))]
    cnt = 0
    for i in range(len(a)):
        light = a[i]
        le = max(0, i-light)
        imosu[le] += 1
        if i+light < n-1:
            imosu[i+light+1] -= 1

    tmp = 0
    for i in range(len(res)):
        tmp += imosu[i]
        res[i] += tmp
    return res

for _ in range(k):
    # calc lux from a
    lux = calc_lux(a)

    if a==lux:
        a = lux
        break

    # overwrite a
    a = lux
    # print(lux)

print(" ".join([str(i) for i in a]))

Buggy python submission (verdict: Time Limit Exceeded):
import sys
import copy
from collections import deque
stdin = sys.stdin

mod = 10**9+7

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n, k = na()
a = na()

def calc_lux(a):
    res = [0 for _ in range(len(a))]
    cnt = 0
    for i in range(len(a)):
        light = a[i]
        if light==len(a):
            cnt += 1
            continue
        for j in range(max(0, i-light), min(n-1, i+light)+1, 1):
            res[j] += 1
    for i in range(len(res)):
        res[i] += cnt
    return res

for _ in range(k):
    # calc lux from a
    lux = calc_lux(a)

    if a==lux:
        a = lux
        break

    # overwrite a
    a = lux
    # print(lux)

print(" ".join([str(i) for i in a]))

Fixed submission:
import sys
import copy
from collections import deque
stdin = sys.stdin

mod = 10**9+7

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n, k = na()
a = na()

def calc_lux(a):
    imosu = [0 for _ in range(len(a))]
    res = [0 for _ in range(len(a))]
    cnt = 0
    for i in range(len(a)):
        light = a[i]
        le = max(0, i-light)
        imosu[le] += 1
        if i+light < n-1:
            imosu[i+light+1] -= 1

    tmp = 0
    for i in range(len(res)):
        tmp += imosu[i]
        res[i] += tmp
    return res

for _ in range(k):
    # calc lux from a
    lux = calc_lux(a)

    if a==lux:
        a = lux
        break

    # overwrite a
    a = lux
    # print(lux)

print(" ".join([str(i) for i in a]))

Buggy python submission (verdict: Time Limit Exceeded):
import sys
import copy
from collections import deque
stdin = sys.stdin

mod = 10**9+7

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n, k = na()
a = na()

def calc_lux(a):
    res = [0 for _ in range(len(a))]
    for i in range(len(a)):
        light = a[i]
        for j in range(max(0, i-light), min(n-1, i+light)+1, 1):
            res[j] += 1
    return res

for _ in range(k):
    # calc lux from a
    lux = calc_lux(a)

    if a==lux:
        a = lux
        break

    # overwrite a
    a = lux
    # print(lux)

print(" ".join([str(i) for i in a]))

Fixed submission:
import sys
import copy
from collections import deque
stdin = sys.stdin

mod = 10**9+7

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n, k = na()
a = na()

def calc_lux(a):
    imosu = [0 for _ in range(len(a))]
    res = [0 for _ in range(len(a))]
    cnt = 0
    for i in range(len(a)):
        light = a[i]
        le = max(0, i-light)
        imosu[le] += 1
        if i+light < n-1:
            imosu[i+light+1] -= 1

    tmp = 0
    for i in range(len(res)):
        tmp += imosu[i]
        res[i] += tmp
    return res

for _ in range(k):
    # calc lux from a
    lux = calc_lux(a)

    if a==lux:
        a = lux
        break

    # overwrite a
    a = lux
    # print(lux)

print(" ".join([str(i) for i in a]))

Buggy python submission (verdict: Time Limit Exceeded):
import sys
import copy
from collections import deque
stdin = sys.stdin

mod = 10**9+7

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n, k = na()
a = na()

def calc_lux(a):
    res = [1 for _ in range(len(a))]
    for i in range(len(a)):
        light = a[i]
        for j in range(light):
            le = i - (j+1)
            ri = i + (j+1)
            if le >= 0:
                res[le] += 1
            if ri < n:
                res[ri] += 1
    return res

for _ in range(k):
    # calc lux from a
    lux = calc_lux(a)

    if a==lux:
        a = lux
        break

    # overwrite a
    a = lux

print(" ".join([str(i) for i in a]))

Fixed submission:
import sys
import copy
from collections import deque
stdin = sys.stdin

mod = 10**9+7

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n, k = na()
a = na()

def calc_lux(a):
    imosu = [0 for _ in range(len(a))]
    res = [0 for _ in range(len(a))]
    cnt = 0
    for i in range(len(a)):
        light = a[i]
        le = max(0, i-light)
        imosu[le] += 1
        if i+light < n-1:
            imosu[i+light+1] -= 1

    tmp = 0
    for i in range(len(res)):
        tmp += imosu[i]
        res[i] += tmp
    return res

for _ in range(k):
    # calc lux from a
    lux = calc_lux(a)

    if a==lux:
        a = lux
        break

    # overwrite a
    a = lux
    # print(lux)

print(" ".join([str(i) for i in a]))