Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
lamps = list(map(int,input().split()))
for ki in range(k):
    lamplog = [0]*(n+1)
    for i in range(n):
        lamplog[max(0,i-lamps[i])  ] += 1   #先端を出す
        lamplog[min(i+lamps[i]+1,n)] -= 1   #末尾を出す
    # print(lamplog)
    for i in range(n):                      #累積和を計算
        lamplog[i+1] += lamplog[i]
    # print(lamplog)
    lamplog.pop()
    if(lamplog == lamps):                   #１つ前の結果と今回の結果が同じだったら。
        break
    lamps = lamplog                         #今回の結果を記録

ans = ""
for i in range(len(lamplog)):
    ans += str(lamplog[i]) +" "
print(ans.rstrip())


Fixed submission:
from numba import jit
@jit
def main():
    n,k = map(int,input().split())
    lamps = list(map(int,input().split()))
    for ki in range(k):
        lamplog = [0]*(n+1)
        for i in range(n):
            lamplog[max(0,i-lamps[i])  ] += 1   #先端を出す
            lamplog[min(i+lamps[i]+1,n)] -= 1   #末尾を出す
        # print(lamplog)
        for i in range(n):                      #累積和を計算
            lamplog[i+1] += lamplog[i]
        # print(lamplog)
        lamplog.pop()
        if(lamplog == lamps):                   #１つ前の結果と今回の結果が同じだったら。
            break
        lamps = lamplog                         #今回の結果を記録
    return lamplog

lamplog = main()
ans = ""
for i in range(len(lamplog)):
    ans += str(lamplog[i]) +" "
print(ans.rstrip())

Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
lamps = list(map(int,input().split()))
for ki in range(k):
    lamplog = [0]*(n+1)
    for i in range(n):
        lamplog[max(0,i-lamps[i])  ] += 1   #先端を出す
        lamplog[min(i+lamps[i]+1,n)] -= 1   #末尾を出す
    # print(lamplog)
    for i in range(n):                      #累積和を計算
        lamplog[i+1] += lamplog[i]
    # print(lamplog)
    lamplog.pop()
    if(lamplog == lamps):                   #１つ前の結果と今回の結果が同じだったら。
        break
    lamps = lamplog                         #今回の結果を記録

ans = ""
for i in range(len(lamplog)):
    ans += str(lamplog[i]) +" "
print(ans.rstrip())

Fixed submission:
from numba import jit
@jit
def main():
    n,k = map(int,input().split())
    lamps = list(map(int,input().split()))
    for ki in range(k):
        lamplog = [0]*(n+1)
        for i in range(n):
            lamplog[max(0,i-lamps[i])  ] += 1   #先端を出す
            lamplog[min(i+lamps[i]+1,n)] -= 1   #末尾を出す
        # print(lamplog)
        for i in range(n):                      #累積和を計算
            lamplog[i+1] += lamplog[i]
        # print(lamplog)
        lamplog.pop()
        if(lamplog == lamps):                   #１つ前の結果と今回の結果が同じだったら。
            break
        lamps = lamplog                         #今回の結果を記録
    return lamplog

lamplog = main()
ans = ""
for i in range(len(lamplog)):
    ans += str(lamplog[i]) +" "
print(ans.rstrip())

Buggy python submission (verdict: Time Limit Exceeded):
import copy as cp
n,k = map(int,input().split())
lamps = list(map(int,input().split()))
for j in range(min(k,41)):
    lamp_io = [0]*n
    for i in range(len(lamps)):
        if(i == 0):
            for k in range(1,lamps[i]+1):
                if(i+k <= n-1):
                    lamp_io[k] += 1
                else:
                    break
            lamp_io[i] += 1
        elif(i == n-1):
            for k in range(1,lamps[i]+1):
                if(i-k >= 0):
                    lamp_io[i-k] += 1
                else:
                    break
            lamp_io[i] += 1
        else:
            for k in range(1,lamps[i]+1):
                a = 0
                b = 0
                if(i+k <= n-1):
                    lamp_io[i+k] += 1
                else:
                    a = 1
                if(i-k >= 0):
                    lamp_io[i-k] += 1
                else:
                    b = 1
                if(a == 1 and b == 1):
                    break
            lamp_io[i] += 1
        # print(lamp_io)    
    lamps = cp.copy(lamp_io)
ans = ""
for i in range(len(lamp_io)):
    ans += str(lamp_io[i]) +" "
print(ans.rstrip())

Fixed submission:
from numba import jit
@jit
def main():
    n,k = map(int,input().split())
    lamps = list(map(int,input().split()))
    for ki in range(k):
        lamplog = [0]*(n+1)
        for i in range(n):
            lamplog[max(0,i-lamps[i])  ] += 1   #先端を出す
            lamplog[min(i+lamps[i]+1,n)] -= 1   #末尾を出す
        # print(lamplog)
        for i in range(n):                      #累積和を計算
            lamplog[i+1] += lamplog[i]
        # print(lamplog)
        lamplog.pop()
        if(lamplog == lamps):                   #１つ前の結果と今回の結果が同じだったら。
            break
        lamps = lamplog                         #今回の結果を記録
    return lamplog

lamplog = main()
ans = ""
for i in range(len(lamplog)):
    ans += str(lamplog[i]) +" "
print(ans.rstrip())

Buggy python submission (verdict: Runtime Error):
import copy as cp
n,k = map(int,input().split())
lamps = list(map(int,input().split()))
for j in range(k):
    lamplog = [0]*n
    lamp_io = [0]*n
    for i in range(len(lamps)):
        if(i == 0):
            lamplog[i]=[0,lamps[i]]
        elif(i == n-1):
            lamplog[i]=[n-(lamps[i]+1) ,n-1]
        else:
            lamplog[i]= [max(i-lamps[i],0),min(i+lamps[i],n-1)]
    for i in range(len(lamplog)):
        for l in range(lamplog[i][1]-lamplog[i][0]+1):
            lamp_io[lamplog[i][0]+l]+=1
    # print(lamplog)
    lamps = cp.copy(lamp_io)
ans = ""
for i in range(len(lamp_io)):
    ans += str(lamps[i]) +" "
print(ans.rstrip())

Fixed submission:
from numba import jit
@jit
def main():
    n,k = map(int,input().split())
    lamps = list(map(int,input().split()))
    for ki in range(k):
        lamplog = [0]*(n+1)
        for i in range(n):
            lamplog[max(0,i-lamps[i])  ] += 1   #先端を出す
            lamplog[min(i+lamps[i]+1,n)] -= 1   #末尾を出す
        # print(lamplog)
        for i in range(n):                      #累積和を計算
            lamplog[i+1] += lamplog[i]
        # print(lamplog)
        lamplog.pop()
        if(lamplog == lamps):                   #１つ前の結果と今回の結果が同じだったら。
            break
        lamps = lamplog                         #今回の結果を記録
    return lamplog

lamplog = main()
ans = ""
for i in range(len(lamplog)):
    ans += str(lamplog[i]) +" "
print(ans.rstrip())

Buggy python submission (verdict: Runtime Error):
import copy as cp
n,k = map(int,input().split())
lamps = list(map(int,input().split()))
for j in range(k):
    lamplog = [0]*n
    lamp_io = [0]*n
    for i in range(len(lamps)):
        if(i == 0):
            lamplog[i]=[0,lamps[i]]
        elif(i == n-1):
            lamplog[i]=[n-(lamps[i]+1) ,n-1]
        else:
            lamplog[i]= [max(i-lamps[i],0),min(i+lamps[i],n-1)]
    for i in range(len(lamplog)):
        for l in range(lamplog[i][1]-lamplog[i][0]+1):
            lamp_io[lamplog[i][0]+l]+=1
    # print(lamplog)
    lamps = cp.copy(lamp_io)
ans = ""
for i in range(len(lamp_io)):
    ans += str(lamp_io[i]) +" "
print(ans.rstrip())

Fixed submission:
from numba import jit
@jit
def main():
    n,k = map(int,input().split())
    lamps = list(map(int,input().split()))
    for ki in range(k):
        lamplog = [0]*(n+1)
        for i in range(n):
            lamplog[max(0,i-lamps[i])  ] += 1   #先端を出す
            lamplog[min(i+lamps[i]+1,n)] -= 1   #末尾を出す
        # print(lamplog)
        for i in range(n):                      #累積和を計算
            lamplog[i+1] += lamplog[i]
        # print(lamplog)
        lamplog.pop()
        if(lamplog == lamps):                   #１つ前の結果と今回の結果が同じだったら。
            break
        lamps = lamplog                         #今回の結果を記録
    return lamplog

lamplog = main()
ans = ""
for i in range(len(lamplog)):
    ans += str(lamplog[i]) +" "
print(ans.rstrip())

Buggy python submission (verdict: Time Limit Exceeded):
import copy as cp
n,k = map(int,input().split())
lamps = list(map(int,input().split()))
for j in range(k):
    lamp_io = [0]*n
    for i in range(len(lamps)):
        if(i == 0):
            for k in range(1,lamps[i]+1):
                if(i+k <= n-1):
                    lamp_io[k] += 1
                else:
                    break
            lamp_io[i] += 1
        elif(i == n-1):
            for k in range(1,lamps[i]+1):
                if(i-k >= 0):
                    lamp_io[i-k] += 1
                else:
                    break
            lamp_io[i] += 1
        else:
            for k in range(1,lamps[i]+1):
                a = 0
                b = 0
                if(i+k <= n-1):
                    lamp_io[i+k] += 1
                else:
                    a = 1
                if(i-k >= 0):
                    lamp_io[i-k] += 1
                else:
                    b = 1
                if(a == 1 and b == 1):
                    break
            lamp_io[i] += 1
        # print(lamp_io)    
    lamps = cp.copy(lamp_io)
ans = ""
for i in range(len(lamp_io)):
    ans += str(lamp_io[i]) +" "
print(ans.rstrip())

Fixed submission:
from numba import jit
@jit
def main():
    n,k = map(int,input().split())
    lamps = list(map(int,input().split()))
    for ki in range(k):
        lamplog = [0]*(n+1)
        for i in range(n):
            lamplog[max(0,i-lamps[i])  ] += 1   #先端を出す
            lamplog[min(i+lamps[i]+1,n)] -= 1   #末尾を出す
        # print(lamplog)
        for i in range(n):                      #累積和を計算
            lamplog[i+1] += lamplog[i]
        # print(lamplog)
        lamplog.pop()
        if(lamplog == lamps):                   #１つ前の結果と今回の結果が同じだったら。
            break
        lamps = lamplog                         #今回の結果を記録
    return lamplog

lamplog = main()
ans = ""
for i in range(len(lamplog)):
    ans += str(lamplog[i]) +" "
print(ans.rstrip())