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


@njit('i8[:](i8,i8,i8[:])')
def solve(N, K, A):
    for _ in range(K):
        B = np.zeros(N + 1, dtype=np.int64)
        for i in range(N):
            B[max(0, i - A[i])] += 1
            B[min(N, i + A[i] + 1)] -= 1
        if np.all(B == N):
            return B
        A = np.cumsum(B)[:-1]
    return A


N, K = map(int, input().split())
A = np.array(input().split(), dtype=int)
print(' '.join(map(str, solve(N, K, A))))


Fixed submission:
import numpy as np
from numba import njit


@njit
def solve(N, K, A):
    for _ in range(K):
        B = np.zeros(N + 1, dtype=np.int64)
        for i in range(N):
            a = A[i]
            B[max(0, i - a)] += 1
            B[min(N, i + a + 1)] -= 1
        A = np.cumsum(B)[:-1]
        if np.all(A == N):
            return A
    return A


N, K = map(int, input().split())
A = np.array(input().split(), dtype=int)
print(' '.join(map(str, solve(N, K, A))))

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


N, K = map(int, input().split())
A = np.array(input().split(), dtype=int)
for k in range(K):
    B = np.zeros(N + 1, dtype=int)
    for i in range(N):
        a = A[i]
        B[max(0, i - a)] += 1
        B[min(N, i + a + 1)] -= 1
    A = np.cumsum(B)[:-1]
    if np.all(A == N):
        break
print(' '.join(map(str, A)))

Fixed submission:
import numpy as np
from numba import njit


@njit
def solve(N, K, A):
    for _ in range(K):
        B = np.zeros(N + 1, dtype=np.int64)
        for i in range(N):
            a = A[i]
            B[max(0, i - a)] += 1
            B[min(N, i + a + 1)] -= 1
        A = np.cumsum(B)[:-1]
        if np.all(A == N):
            return A
    return A


N, K = map(int, input().split())
A = np.array(input().split(), dtype=int)
print(' '.join(map(str, solve(N, K, A))))

Buggy python submission (verdict: Runtime Error):
import numpy as np


N, K = map(int, input().split())
A = np.array(list(map(int, input().split())))
for k in range(K):
    B_acc = np.zeros(N + 1, dtype=int)
    for i in range(N):
        a = A[i]
        B_acc[max(0, i - a)] += 1
        B_acc[min(N, i + a + 1)] -= 1
    B_acc = np.cumsum(B_acc)
    A = B_acc[:-1]
    if all(a == N for a in A):
        break
print(' '.join(map(str, A)))

Fixed submission:
import numpy as np
from numba import njit


@njit
def solve(N, K, A):
    for _ in range(K):
        B = np.zeros(N + 1, dtype=np.int64)
        for i in range(N):
            a = A[i]
            B[max(0, i - a)] += 1
            B[min(N, i + a + 1)] -= 1
        A = np.cumsum(B)[:-1]
        if np.all(A == N):
            return A
    return A


N, K = map(int, input().split())
A = np.array(input().split(), dtype=int)
print(' '.join(map(str, solve(N, K, 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 k in range(K):
    B_acc = np.zeros(N + 1, dtype=int)
    for i in range(N):
        a = A[i]
        B_acc[max(0, i - a)] += 1
        B_acc[min(N, i + a + 1)] -= 1
    B_acc = np.cumsum(B_acc)
    A = B_acc[:-1]
    if all(a == N for a in A):
        break
print(' '.join(map(str, A)))

Fixed submission:
import numpy as np
from numba import njit


@njit
def solve(N, K, A):
    for _ in range(K):
        B = np.zeros(N + 1, dtype=np.int64)
        for i in range(N):
            a = A[i]
            B[max(0, i - a)] += 1
            B[min(N, i + a + 1)] -= 1
        A = np.cumsum(B)[:-1]
        if np.all(A == N):
            return A
    return A


N, K = map(int, input().split())
A = np.array(input().split(), dtype=int)
print(' '.join(map(str, solve(N, K, A))))

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
A = list(map(int, input().split()))

for i in range(min(K, 100)):
    B = [0] * N
    for j in range(N):
        cnt = 0
        for k in range(N):
            if k - A[k] - 0.5 <= j <= k + A[k] + 0.5:
                cnt += 1
        B[j] = cnt
    A = B[:]
print(*A)



Fixed submission:
import numpy as np
from numba import njit


@njit
def solve(N, K, A):
    for _ in range(K):
        B = np.zeros(N + 1, dtype=np.int64)
        for i in range(N):
            a = A[i]
            B[max(0, i - a)] += 1
            B[min(N, i + a + 1)] -= 1
        A = np.cumsum(B)[:-1]
        if np.all(A == N):
            return A
    return A


N, K = map(int, input().split())
A = np.array(input().split(), dtype=int)
print(' '.join(map(str, solve(N, K, A))))