Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
A = list(map(int, input().split()))

for _ in range(min(K, 50)):
    lamp = [0 for i in range(N + 1)]
    for i in range(N):
        lamp[max(0, i - A[i])] += 1
        lamp[min(N, i + A[i] + 1)] -= 1

    for i in range(N):
        lamp[i] += lamp[i - 1]
    A = lamp

[print(A[i], end=' ') for i in range(N)]
print()


Fixed submission:
N, K = map(int, input().split())
A = list(map(int, input().split()))

for i in range(min(K, 50)):
    B = [0 for i in range(N)]
    for j in range(0, N):
        l = max(0, j - A[j])
        r = min(N - 1, j + A[j])
        B[l] += 1
        if r + 1 < N:
            B[r + 1] -= 1

    for j in range(1, N):
        B[j] += B[j - 1]
        
    A = B

[print(i, end=' ') for i in B]
print()

Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
A = list(map(int, input().split()))

for _ in range(min(K, 50)):
    lamp = [0 for i in range(N + 1)]
    for i in range(N):
        lamp[max(0, i - A[i])] += 1
        lamp[min(N, i + A[i] + 1)] -= 1

    for i in range(N):
        lamp[i] += lamp[i - 1]
    A = lamp

[print(A[i], end=' ') if i != N - 1 else print(A[i]) for i in range(N)]


Fixed submission:
N, K = map(int, input().split())
A = list(map(int, input().split()))

for i in range(min(K, 50)):
    B = [0 for i in range(N)]
    for j in range(0, N):
        l = max(0, j - A[j])
        r = min(N - 1, j + A[j])
        B[l] += 1
        if r + 1 < N:
            B[r + 1] -= 1

    for j in range(1, N):
        B[j] += B[j - 1]
        
    A = B

[print(i, end=' ') for i in B]
print()

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

for _ in range(min(K, 50)):
    lamp = [0 for i in range(N + 1)]
    for i in range(N):
        lamp[max(0, i - A[i])] += 1
        lamp[min(N, i + A[i] + 1)] -= 1

    ans = 0
    for i in range(N):
        ans += lamp[i]
        A[i] = min(ans, N)

[print(A[i], end=' ') if i != N - 1 else print(A[i]) for i in range(N)]


Fixed submission:
N, K = map(int, input().split())
A = list(map(int, input().split()))

for i in range(min(K, 50)):
    B = [0 for i in range(N)]
    for j in range(0, N):
        l = max(0, j - A[j])
        r = min(N - 1, j + A[j])
        B[l] += 1
        if r + 1 < N:
            B[r + 1] -= 1

    for j in range(1, N):
        B[j] += B[j - 1]
        
    A = B

[print(i, end=' ') for i in B]
print()

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

for _ in range(min(K, 100)):
    lamp = [0 for i in range(N + 1)]
    for i in range(N):
        lamp[max(0, i - A[i])] += 1
        lamp[min(N, i + A[i] + 1)] -= 1

    ans = 0
    for i in range(N):
        ans += lamp[i]
        A[i] = min(ans, N)

[print(A[i], end=' ') if i != N - 1 else print(A[i]) for i in range(N)]


Fixed submission:
N, K = map(int, input().split())
A = list(map(int, input().split()))

for i in range(min(K, 50)):
    B = [0 for i in range(N)]
    for j in range(0, N):
        l = max(0, j - A[j])
        r = min(N - 1, j + A[j])
        B[l] += 1
        if r + 1 < N:
            B[r + 1] -= 1

    for j in range(1, N):
        B[j] += B[j - 1]
        
    A = B

[print(i, end=' ') for i in B]
print()

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

for _ in range(min(K, int(N ** 0.5))):
    lamp = [0 for i in range(N + 1)]
    for i in range(N):
        lamp[max(0, i - A[i])] += 1
        lamp[min(N, i + A[i] + 1)] -= 1

    ans = 0
    for i in range(N):
        ans += lamp[i]
        A[i] = min(ans, N)

[print(A[i], end=' ') if i != N - 1 else print(A[i]) for i in range(N)]


Fixed submission:
N, K = map(int, input().split())
A = list(map(int, input().split()))

for i in range(min(K, 50)):
    B = [0 for i in range(N)]
    for j in range(0, N):
        l = max(0, j - A[j])
        r = min(N - 1, j + A[j])
        B[l] += 1
        if r + 1 < N:
            B[r + 1] -= 1

    for j in range(1, N):
        B[j] += B[j - 1]
        
    A = B

[print(i, end=' ') for i in B]
print()

Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
A = list(map(int, input().split()))

for _ in range(min(K, N ** 0.5)):
    lamp = [0 for i in range(N + 1)]
    for i in range(N):
        lamp[max(0, i - A[i])] += 1
        lamp[min(N, i + A[i] + 1)] -= 1

    ans = 0
    for i in range(N):
        ans += lamp[i]
        A[i] = min(ans, N)

[print(A[i], end=' ') if i != N - 1 else print(A[i]) for i in range(N)]


Fixed submission:
N, K = map(int, input().split())
A = list(map(int, input().split()))

for i in range(min(K, 50)):
    B = [0 for i in range(N)]
    for j in range(0, N):
        l = max(0, j - A[j])
        r = min(N - 1, j + A[j])
        B[l] += 1
        if r + 1 < N:
            B[r + 1] -= 1

    for j in range(1, N):
        B[j] += B[j - 1]
        
    A = B

[print(i, end=' ') for i in B]
print()

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
A = list(map(int, input().split()))
tmpA = [1 for i in range(N)]
tmpB = []

for i in range(min(K, 50)):
    tmpA = [1 for i in range(N)]
    tmpB = []
    for j in range(N):
        tmpA[j] += len(tmpB)
        tmpB = list(filter(lambda x:x, map(lambda x:x-1, tmpB)))
        if A[j]:
            tmpB.append(A[j])
    
    tmpB = []
    for j in range(N - 1, -1 ,-1):
        tmpA[j] += len(tmpB)
        tmpB = list(filter(lambda x:x, map(lambda x:x-1, tmpB)))
        if A[j]:
            tmpB.append(A[j])

    A = tmpA

[print(i, end=' ') for i in A]
print()


Fixed submission:
N, K = map(int, input().split())
A = list(map(int, input().split()))

for i in range(min(K, 50)):
    B = [0 for i in range(N)]
    for j in range(0, N):
        l = max(0, j - A[j])
        r = min(N - 1, j + A[j])
        B[l] += 1
        if r + 1 < N:
            B[r + 1] -= 1

    for j in range(1, N):
        B[j] += B[j - 1]
        
    A = B

[print(i, end=' ') for i in B]
print()

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
A = list(map(int, input().split()))
tmpA = [1 for i in range(N)]
tmpB = []

for i in range(K):
    tmpA = [1 for i in range(N)]
    tmpB = []
    for j in range(N):
        tmpA[j] += len(tmpB)
        tmpB = list(filter(lambda x:x, map(lambda x:x-1, tmpB)))
        if A[j]:
            tmpB.append(A[j])

    
    tmpB = []
    for j in range(N - 1, -1 ,-1):
        tmpA[j] += len(tmpB)
        tmpB = list(filter(lambda x:x, map(lambda x:x-1, tmpB)))
        if A[j]:
            tmpB.append(A[j])
            
    A = tmpA

[print(i, end=' ') for i in A]
print()


Fixed submission:
N, K = map(int, input().split())
A = list(map(int, input().split()))

for i in range(min(K, 50)):
    B = [0 for i in range(N)]
    for j in range(0, N):
        l = max(0, j - A[j])
        r = min(N - 1, j + A[j])
        B[l] += 1
        if r + 1 < N:
            B[r + 1] -= 1

    for j in range(1, N):
        B[j] += B[j - 1]
        
    A = B

[print(i, end=' ') for i in B]
print()