Buggy python submission (verdict: Time Limit Exceeded):
from numba import jit


def solve(N, K, A):
    for _ in range(K):
        imos = [0] * (N+1)
        for i in range(N):
            left = max(0, i-A[i])
            right = min(N-1, i+A[i])+1
            imos[left] += 1
            imos[right] += -1

        next_A = [0] * N
        next_A[0] = imos[0]
        for i in range(1, N):
            next_A[i] = next_A[i-1] + imos[i]

        if A == next_A:
            return A
        A = next_A
    return A


N, K = map(int, input().split())
A = [int(x) for x in input().split()]
print(" ".join([str(x) for x in solve(N, K, A)]))


Fixed submission:
from numba import jit


@jit
def solve(N, K, A):
    for _ in range(K):
        imos = [0] * (N+1)
        for i in range(N):
            left = max(0, i-A[i])
            right = min(N-1, i+A[i])+1
            imos[left] += 1
            imos[right] += -1

        next_A = [0] * N
        next_A[0] = imos[0]
        for i in range(1, N):
            next_A[i] = next_A[i-1] + imos[i]

        if A == next_A:
            return A
        A = next_A
    return A


N, K = map(int, input().split())
A = [int(x) for x in input().split()]
print(" ".join([str(x) for x in solve(N, K, A)]))

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
A = [int(x) for x in input().split()]
for _ in range(K):
    imos = [0] * (N+1)
    for i in range(N):
        left = max(0, i-A[i])
        right = min(N-1, i+A[i])+1
        imos[left] += 1
        imos[right] += -1

    next_A = [0] * N
    next_A[0] = imos[0]
    for i in range(1, N):
        next_A[i] = next_A[i-1] + imos[i]

    is_all_equal = True
    for i in range(N):
        if A[i] != next_A[i]:
            is_all_equal = False
            break
    if is_all_equal:
        break
    A = next_A
print(" ".join([str(x) for x in A]))


Fixed submission:
from numba import jit


@jit
def solve(N, K, A):
    for _ in range(K):
        imos = [0] * (N+1)
        for i in range(N):
            left = max(0, i-A[i])
            right = min(N-1, i+A[i])+1
            imos[left] += 1
            imos[right] += -1

        next_A = [0] * N
        next_A[0] = imos[0]
        for i in range(1, N):
            next_A[i] = next_A[i-1] + imos[i]

        if A == next_A:
            return A
        A = next_A
    return A


N, K = map(int, input().split())
A = [int(x) for x in input().split()]
print(" ".join([str(x) for x in solve(N, K, A)]))

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
A = [int(x) for x in input().split()]
for _ in range(K):
    imos = [0] * (N+1)
    for i in range(N):
        left = max(0, i-A[i])
        right = min(N-1, i+A[i])+1
        imos[left] += 1
        imos[right] += -1

    next_A = [0] * N
    next_A[0] = imos[0]
    for i in range(1, N):
        next_A[i] = next_A[i-1] + imos[i]
    A = next_A

    is_all_max = True
    for i in range(N):
        if A[i] != N:
            is_all_max = False
            break
    if is_all_max:
        break
print(" ".join([str(x) for x in A]))


Fixed submission:
from numba import jit


@jit
def solve(N, K, A):
    for _ in range(K):
        imos = [0] * (N+1)
        for i in range(N):
            left = max(0, i-A[i])
            right = min(N-1, i+A[i])+1
            imos[left] += 1
            imos[right] += -1

        next_A = [0] * N
        next_A[0] = imos[0]
        for i in range(1, N):
            next_A[i] = next_A[i-1] + imos[i]

        if A == next_A:
            return A
        A = next_A
    return A


N, K = map(int, input().split())
A = [int(x) for x in input().split()]
print(" ".join([str(x) for x in solve(N, K, A)]))

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
A = [int(x) for x in input().split()]
for _ in range(K):
    imos = [0] * (N+1)
    for i in range(N):
        left = max(0, i-A[i])
        right = min(N-1, i+A[i])+1
        imos[left] += 1
        imos[right] += -1
    next_A = [0] * N
    next_A[0] = imos[0]
    for i in range(1, N):
        next_A[i] = next_A[i-1] + imos[i]
    A = next_A
print(" ".join([str(x) for x in A]))


Fixed submission:
from numba import jit


@jit
def solve(N, K, A):
    for _ in range(K):
        imos = [0] * (N+1)
        for i in range(N):
            left = max(0, i-A[i])
            right = min(N-1, i+A[i])+1
            imos[left] += 1
            imos[right] += -1

        next_A = [0] * N
        next_A[0] = imos[0]
        for i in range(1, N):
            next_A[i] = next_A[i-1] + imos[i]

        if A == next_A:
            return A
        A = next_A
    return A


N, K = map(int, input().split())
A = [int(x) for x in input().split()]
print(" ".join([str(x) for x in solve(N, K, A)]))

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
A = [int(x) for x in input().split()]
for _ in range(K):
    next_A = [0] * N
    for i in range(N):
        for j in range(max(0, i-A[i]), min(N-1, i+A[i])+1):
            next_A[j] += 1
    A = next_A
print(" ".join([str(x) for x in A]))


Fixed submission:
from numba import jit


@jit
def solve(N, K, A):
    for _ in range(K):
        imos = [0] * (N+1)
        for i in range(N):
            left = max(0, i-A[i])
            right = min(N-1, i+A[i])+1
            imos[left] += 1
            imos[right] += -1

        next_A = [0] * N
        next_A[0] = imos[0]
        for i in range(1, N):
            next_A[i] = next_A[i-1] + imos[i]

        if A == next_A:
            return A
        A = next_A
    return A


N, K = map(int, input().split())
A = [int(x) for x in input().split()]
print(" ".join([str(x) for x in solve(N, K, A)]))