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

    Z = [N]*N

    while K > 0 and A != Z:
        K-=1
        B = [int(0)]*(N+1)
        for i in range(N):
            B[max(int(0),i-A[i])]+=1
            B[min(N-1,i+A[i])+1]-=1
        for i in range(1,N):
            B[i]+=B[i-1]

        A = B[0:N]

    print(' '.join(map(str,A)))

if __name__ == '__main__':
    main()

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

    Z = [N]*N

    while K > 0 and A != Z:
        K-=1
        B = [int(0)]*(N+1)
        for i in range(N):
            B[max(int(0),i-A[i])]+=1
            B[min(N-1,i+A[i])+1]-=1
        for i in range(1,N):
            B[i]+=B[i-1]

        A = B[0:N]

    print(' '.join(map(str,A)))

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
import numpy as np
N, K = map(int, input().split())
tmp = input().split(' ')
A = []
for i in range(N):
    A = A + [int(tmp[i])]

Z = np.array([[abs(j - i) for j in range(N)] for i in range(N)])

B = [0]*5
while K > 0:
    K = K - 1
    Ac = np.array([A]*N-Z)
    for i in range(N):
        B[i] = np.count_nonzero(Ac[i] >= 0)

    A[:] = B[:]

print(' '.join(map(str,A)))

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

    Z = [N]*N

    while K > 0 and A != Z:
        K-=1
        B = [int(0)]*(N+1)
        for i in range(N):
            B[max(int(0),i-A[i])]+=1
            B[min(N-1,i+A[i])+1]-=1
        for i in range(1,N):
            B[i]+=B[i-1]

        A = B[0:N]

    print(' '.join(map(str,A)))

if __name__ == '__main__':
    main()

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

    Z = [N]*N

    while K > 0 and A != Z:
        K-=1
        B = [int(0)]*(N+1)
        for i in range(N):
            B[max(int(0),i-A[i])]+=1
            B[min(N-1,i+A[i])+1]-=1
        for i in range(1,N):
            B[i]+=B[i-1]

        A = B[0:N]

    print(' '.join(map(str,A)))

if __name__ == '__main__':
    main()

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

    Z = [N]*N

    while K > 0 and A != Z:
        K-=1
        B = [int(0)]*(N+1)
        for i in range(N):
            B[max(int(0),i-A[i])]+=1
            B[min(N-1,i+A[i])+1]-=1
        for i in range(1,N):
            B[i]+=B[i-1]

        A = B[0:N]

    print(' '.join(map(str,A)))

if __name__ == '__main__':
    main()

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

Z = [N]*N

while K > 0 and A != Z:
    K = K - 1
    B = [0]*(N+1)
    for i in range(N):
        B[max(0,i-A[i])]+=1
        B[min(N-1,i+A[i])+1]-=1
    for i in range(1,N):
        B[i]+=B[i-1]

    A = B[0:N]

print(' '.join(map(str,A)))

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

    Z = [N]*N

    while K > 0 and A != Z:
        K-=1
        B = [int(0)]*(N+1)
        for i in range(N):
            B[max(int(0),i-A[i])]+=1
            B[min(N-1,i+A[i])+1]-=1
        for i in range(1,N):
            B[i]+=B[i-1]

        A = B[0:N]

    print(' '.join(map(str,A)))

if __name__ == '__main__':
    main()

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

for i in range(N):
    A = A + [int(tmp[i])]
Z = [N]*N

while K > 0 and A != Z:
    K = K - 1
    B = [0]*(N+1)
    for i in range(N):
        l = max(0,i-A[i])
        r = min(N-1,i+A[i])
        B[l]+=1
        B[r+1]-=1

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

        
print(' '.join(map(str,A)))

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

    Z = [N]*N

    while K > 0 and A != Z:
        K-=1
        B = [int(0)]*(N+1)
        for i in range(N):
            B[max(int(0),i-A[i])]+=1
            B[min(N-1,i+A[i])+1]-=1
        for i in range(1,N):
            B[i]+=B[i-1]

        A = B[0:N]

    print(' '.join(map(str,A)))

if __name__ == '__main__':
    main()

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

for i in range(N):
    A = A + [int(tmp[i])]
Z = [N]*N

while K > 0 and A != Z:
    K = K - 1
    B = [0]*(N+1)
    for i in range(N):
        l =  max(0,i-A[i])
        r =  min(N-1,i+A[i])
        B[l]+=1
        B[r+1]-=1

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

print(' '.join(map(str,A)))

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

    Z = [N]*N

    while K > 0 and A != Z:
        K-=1
        B = [int(0)]*(N+1)
        for i in range(N):
            B[max(int(0),i-A[i])]+=1
            B[min(N-1,i+A[i])+1]-=1
        for i in range(1,N):
            B[i]+=B[i-1]

        A = B[0:N]

    print(' '.join(map(str,A)))

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
tmp = input().split(' ')
A = []
for i in range(N):
    A = A + [int(tmp[i])]
Z = [N]*N
while K > 0 and A != Z:
    K = K - 1
    B = [0]*N
    for i in range(N):
        l =  max(0,i-A[i])
        r =  min(N-1,i+A[i])
        B[l] = B[l]+1
        if r+1 < N:
            B[r+1] = B[r+1]-1

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

print(' '.join(map(str,A)))

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

    Z = [N]*N

    while K > 0 and A != Z:
        K-=1
        B = [int(0)]*(N+1)
        for i in range(N):
            B[max(int(0),i-A[i])]+=1
            B[min(N-1,i+A[i])+1]-=1
        for i in range(1,N):
            B[i]+=B[i-1]

        A = B[0:N]

    print(' '.join(map(str,A)))

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
tmp = input().split(' ')
A = []
for i in range(N):
    A = A + [int(tmp[i])]

while K > 0 and A.count(N)!=N:
    K = K - 1
    B = [0]*N
    for i in range(N):
        l =  max(0,i-A[i])
        r =  min(N-1,i+A[i])
        B[l] = B[l]+1
        if r+1 < N:
            B[r+1] = B[r+1]-1

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

print(' '.join(map(str,A)))

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

    Z = [N]*N

    while K > 0 and A != Z:
        K-=1
        B = [int(0)]*(N+1)
        for i in range(N):
            B[max(int(0),i-A[i])]+=1
            B[min(N-1,i+A[i])+1]-=1
        for i in range(1,N):
            B[i]+=B[i-1]

        A = B[0:N]

    print(' '.join(map(str,A)))

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
tmp = input().split(' ')
A = []
for i in range(N):
    A = A + [int(tmp[i])]

while K > 0 and A.count(N)!=N:
    K = K - 1
    B = [0]*N
    for i in range(N):
        for j in range(N):
            if A[j] >= abs(j-i):
                B[i] = B[i]+1
    A = B

print(' '.join(map(str,A)))

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

    Z = [N]*N

    while K > 0 and A != Z:
        K-=1
        B = [int(0)]*(N+1)
        for i in range(N):
            B[max(int(0),i-A[i])]+=1
            B[min(N-1,i+A[i])+1]-=1
        for i in range(1,N):
            B[i]+=B[i-1]

        A = B[0:N]

    print(' '.join(map(str,A)))

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N, K = map(int, input().split())
tmp = input().split(' ')
A = []
for i in range(N):
    A = A + [int(tmp[i])]

Z = np.array([[abs(j - i) for j in range(N)] for i in range(N)])

B = [0]*5
while K > 0:
    K = K - 1
    Ac = np.array([A]*N-Z)
    for i in range(N):
        B[i] = np.count_nonzero(Ac[i] >= 0)

    A[:] = B[:]

print(' '.join(map(str,A)))

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

    Z = [N]*N

    while K > 0 and A != Z:
        K-=1
        B = [int(0)]*(N+1)
        for i in range(N):
            B[max(int(0),i-A[i])]+=1
            B[min(N-1,i+A[i])+1]-=1
        for i in range(1,N):
            B[i]+=B[i-1]

        A = B[0:N]

    print(' '.join(map(str,A)))

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N, K = map(int, input().split())
tmp = input().split(' ')
A = []
for i in range(N):
    A = A + [int(tmp[i])]

Z = np.array([[abs(j - i) for j in range(N)] for i in range(N)])

B = [0]*5
while K > 0:
    K = K - 1
    for i in range(N):
        B[i] = np.count_nonzero(A >= Z[i])

    A[:] = B[:]

print(' '.join(map(str,A)))

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

    Z = [N]*N

    while K > 0 and A != Z:
        K-=1
        B = [int(0)]*(N+1)
        for i in range(N):
            B[max(int(0),i-A[i])]+=1
            B[min(N-1,i+A[i])+1]-=1
        for i in range(1,N):
            B[i]+=B[i-1]

        A = B[0:N]

    print(' '.join(map(str,A)))

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
tmp = input().split(' ')
A = []
for i in range(N):
    A = A + [int(tmp[i])]

for k in range(K):
    B = [0]*N
    for i in range(N):
        for j in range(N):
            if A[j] >= abs(j-i):
                B[i] = B[i]+1
    A = B

print(' '.join(map(str,A)))

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

    Z = [N]*N

    while K > 0 and A != Z:
        K-=1
        B = [int(0)]*(N+1)
        for i in range(N):
            B[max(int(0),i-A[i])]+=1
            B[min(N-1,i+A[i])+1]-=1
        for i in range(1,N):
            B[i]+=B[i-1]

        A = B[0:N]

    print(' '.join(map(str,A)))

if __name__ == '__main__':
    main()