Buggy python submission (verdict: Runtime Error):
import sys
import numpy as np
import copy
from itertools import accumulate
input=sys.stdin.readline
def main():
    N,K = map(int,input().split())
    A = list(map(int,input().split()))
    ans = copy.deepcopy(A)
    for _ in range(K):
        cumsum = [0]*N
        for i,a in enumerate(ans):
            l = max(0,i-a)
            r = min(N-1,i+a)
            cumsum[l] += 1
            if r+1 < N:
                cumsum[r+1] -= 1
        ans = list(accumulate(cumsum))
        if ans[0] == N:
            break
    print(*ans)
    
if __name__ == '__main__':
    main()

Fixed submission:
import sys
import copy
from itertools import accumulate
input=sys.stdin.readline
def main():
    N,K = map(int,input().split())
    A = list(map(int,input().split()))
    ans = copy.deepcopy(A)
    for _ in range(K):
        cumsum = [0]*N
        for i,a in enumerate(ans):
            l = max(0,i-a)
            r = min(N-1,i+a)
            cumsum[l] += 1
            if r+1 < N:
                cumsum[r+1] -= 1
        ans = list(accumulate(cumsum))
        if ans[0] == N:
            break
    print(*ans)
    
if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
import sys
import numpy as np
import copy
from itertools import accumulate
input=sys.stdin.readline
def main():
    N,K = map(int,input().split())
    A = list(map(int,input().split()))
    ans = copy.deepcopy(A)
    for _ in range(K):
        cumsum = [0]*N
        for i,a in enumerate(ans):
            l = max(0,i-a)
            r = min(N-1,i+a)
            cumsum[l] += 1
            if r+1 < N:
                cumsum[r+1] -= 1
        ans = list(accumulate(cumsum))
        if ans[0] == N:
            break
    print(*ans)
    
if __name__ == '__main__':
    main()

Fixed submission:
import sys
import copy
from itertools import accumulate
input=sys.stdin.readline
def main():
    N,K = map(int,input().split())
    A = list(map(int,input().split()))
    ans = copy.deepcopy(A)
    for _ in range(K):
        cumsum = [0]*N
        for i,a in enumerate(ans):
            l = max(0,i-a)
            r = min(N-1,i+a)
            cumsum[l] += 1
            if r+1 < N:
                cumsum[r+1] -= 1
        ans = list(accumulate(cumsum))
        if ans[0] == N:
            break
    print(*ans)
    
if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
import sys
import numpy as np
import copy
input=sys.stdin.readline
def main():
    N,K = map(int,input().split())
    A = list(map(int,input().split()))
    lighted = np.array([0]*N)
    for i,a in enumerate(A):
        area = len(lighted[max(0,i-a):min(i+a,N-1)+1])
        lighted[max(0,i-a):min(i+a,N-1)+1] += np.array([1]*area)
    print(*A)
    print(lighted)
    
    for _ in range(K-1):
        tmp = np.array([0]*N)
        for i,a in enumerate(lighted):
            area = len(tmp[max(0,i-a):min(i+a,N-1)+1])
            tmp[max(0,i-a):min(i+a,N-1)+1] += np.array([1]*area)
        lighted = copy.deepcopy(tmp)
        if lighted[0] == N:
            break
        print(lighted)
    print(lighted)
if __name__ == '__main__':
    main()

Fixed submission:
import sys
import copy
from itertools import accumulate
input=sys.stdin.readline
def main():
    N,K = map(int,input().split())
    A = list(map(int,input().split()))
    ans = copy.deepcopy(A)
    for _ in range(K):
        cumsum = [0]*N
        for i,a in enumerate(ans):
            l = max(0,i-a)
            r = min(N-1,i+a)
            cumsum[l] += 1
            if r+1 < N:
                cumsum[r+1] -= 1
        ans = list(accumulate(cumsum))
        if ans[0] == N:
            break
    print(*ans)
    
if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
import sys
import numpy as np
import copy
input = sys.stdin.readline
def main():
    N,K = map(int,input().split())
    A = list(map(int,input().split()))
    lighted = np.array([0]*N)
    for i,a in enumerate(A):
        area = len(lighted[max(0,i-a):min(i+a,N-1)+1])
        lighted[max(0,i-a):min(i+a,N-1)+1] += np.array([1]*area)
    
    for _ in range(K-1):
        tmp = np.array([0]*N)
        for i,a in enumerate(lighted):
            area = len(tmp[max(0,i-a):min(i+a,N-1)+1])
            tmp[max(0,i-a):min(i+a,N-1)+1] += np.array([1]*area)
        lighted = copy.deepcopy(tmp)
        if lighted[0] == N:
            break
    print(lighted)
if __name__ == '__main__':
    main()

Fixed submission:
import sys
import copy
from itertools import accumulate
input=sys.stdin.readline
def main():
    N,K = map(int,input().split())
    A = list(map(int,input().split()))
    ans = copy.deepcopy(A)
    for _ in range(K):
        cumsum = [0]*N
        for i,a in enumerate(ans):
            l = max(0,i-a)
            r = min(N-1,i+a)
            cumsum[l] += 1
            if r+1 < N:
                cumsum[r+1] -= 1
        ans = list(accumulate(cumsum))
        if ans[0] == N:
            break
    print(*ans)
    
if __name__ == '__main__':
    main()