Buggy python submission (verdict: Time Limit Exceeded):
import sys
from itertools import accumulate
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))

def main():
    n,k = map(int,sys.stdin.readline().rstrip().split())
    a = LI()
    for _ in range(k):
        table = [0]*(n+1)
        for i,x in enumerate(a):
            table[max(0,i-x)] += 1
            table[min(n-1,i+x)+1] -=1
        a = list(accumulate(table))[:-1]
    print(*a)
    return

if __name__=='__main__':
    main()

Fixed submission:
import sys
from itertools import accumulate

def solve(n,k,a):
    for _ in range(k):
        if a==[n]*n:    return a
        t = [0]*(n+1)
        for i,x in enumerate(a):
            t[max(0,i-x)] += 1
            t[min(n,i+x+1)] -=1
        a = list(accumulate(t))[:-1]
    return a

n,k = map(int,sys.stdin.readline().rstrip().split())
a = list(map(int,sys.stdin.readline().rstrip().split()))

print(*solve(n,k,a))

Buggy python submission (verdict: Time Limit Exceeded):
import sys
import itertools
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))

def solve(n,a):
    table = [0]*(n+1)
    for i,x in enumerate(a):
        table[max(0,i-x)] += 1
        table[min(n-1,i+x)+1] -=1
    return list(itertools.accumulate(table))[:-1]

def main():
    n,k = map(int,sys.stdin.readline().rstrip().split())
    a = LI()
    for _ in range(k):
        a = solve(n,a)
    for rep in a:
        print(rep,end=' ')

if __name__=='__main__':
    main()

Fixed submission:
import sys
from itertools import accumulate

def solve(n,k,a):
    for _ in range(k):
        if a==[n]*n:    return a
        t = [0]*(n+1)
        for i,x in enumerate(a):
            t[max(0,i-x)] += 1
            t[min(n,i+x+1)] -=1
        a = list(accumulate(t))[:-1]
    return a

n,k = map(int,sys.stdin.readline().rstrip().split())
a = list(map(int,sys.stdin.readline().rstrip().split()))

print(*solve(n,k,a))

Buggy python submission (verdict: Time Limit Exceeded):
import sys 
from collections import deque
import itertools
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))

def main():
    tmp = deque(LI())
    n,k = tmp.popleft(),tmp.popleft()
    a = LI()
    for _ in range(k):
        table = [0]*(n+1)
        for j in range(n):
            table[max(0,j-a[j])] += 1
            table[min(n-1,j+a[j])+1] -=1
        a = list(itertools.accumulate(table))
    for i in range(n):
        print(str(a[i])+' ',end='')
    return

if __name__=='__main__':
    main()

Fixed submission:
import sys
from itertools import accumulate

def solve(n,k,a):
    for _ in range(k):
        if a==[n]*n:    return a
        t = [0]*(n+1)
        for i,x in enumerate(a):
            t[max(0,i-x)] += 1
            t[min(n,i+x+1)] -=1
        a = list(accumulate(t))[:-1]
    return a

n,k = map(int,sys.stdin.readline().rstrip().split())
a = list(map(int,sys.stdin.readline().rstrip().split()))

print(*solve(n,k,a))

Buggy python submission (verdict: Time Limit Exceeded):
import sys 
from collections import deque
import itertools
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))

def main():
    tmp = deque(LI())
    n,k = tmp.popleft(),tmp.popleft()
    a = LI()
    for _ in range(k):
        table = [0]*(n+1)
        for j in range(n):
            table[max(0,j-a[j])] += 1
            table[min(n-1,j+a[j])+1] -=1
        a = list(itertools.accumulate(table))
    for i in range(n):
        print(str(a[i])+' ',end='')
    return

if __name__=='__main__':
    main()

Fixed submission:
import sys
from itertools import accumulate

def solve(n,k,a):
    for _ in range(k):
        if a==[n]*n:    return a
        t = [0]*(n+1)
        for i,x in enumerate(a):
            t[max(0,i-x)] += 1
            t[min(n,i+x+1)] -=1
        a = list(accumulate(t))[:-1]
    return a

n,k = map(int,sys.stdin.readline().rstrip().split())
a = list(map(int,sys.stdin.readline().rstrip().split()))

print(*solve(n,k,a))

Buggy python submission (verdict: Runtime Error):
import sys 
from collections import deque
import numpy as np
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def R(x):
    r = round(x)
    if r+0.5 <= x:
        r += 1
    return int(r)

def main():
    tmp = deque(LI())
    n,k = tmp.popleft(),tmp.popleft()
    a = LI()
    for _ in range(k):
        table = np.zeros(n)
        for j in range(n):
            left = R(max(0,j-a[j]-0.5))
            right = int(min(n-1,j+a[j]+0.5))
            table[left:right+1] += 1
        a = table[:]
    for i in range(n):
        print(str(a[i])+' ',end='')
    return

if __name__=='__main__':
    main()

Fixed submission:
import sys
from itertools import accumulate

def solve(n,k,a):
    for _ in range(k):
        if a==[n]*n:    return a
        t = [0]*(n+1)
        for i,x in enumerate(a):
            t[max(0,i-x)] += 1
            t[min(n,i+x+1)] -=1
        a = list(accumulate(t))[:-1]
    return a

n,k = map(int,sys.stdin.readline().rstrip().split())
a = list(map(int,sys.stdin.readline().rstrip().split()))

print(*solve(n,k,a))

Buggy python submission (verdict: Time Limit Exceeded):
import sys 
from collections import deque
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def R(x):
    r = round(x)
    if r+0.5 <= x:
        r += 1
    return r

def main():
    tmp = deque(LI())
    n,k = tmp.popleft(),tmp.popleft()
    a = LI()
    for _ in range(k):
        table = [0]*n
        for j in range(n):
            left = R(max(0,j-a[j]-0.5))
            right = int(min(n-1,j+a[j]+0.5))
            for u in range(left,right+1):
                table[u] += 1
        a = table[:]
    for i in range(n):
        print(str(a[i])+' ',end='')
    return

if __name__=='__main__':
    main()

Fixed submission:
import sys
from itertools import accumulate

def solve(n,k,a):
    for _ in range(k):
        if a==[n]*n:    return a
        t = [0]*(n+1)
        for i,x in enumerate(a):
            t[max(0,i-x)] += 1
            t[min(n,i+x+1)] -=1
        a = list(accumulate(t))[:-1]
    return a

n,k = map(int,sys.stdin.readline().rstrip().split())
a = list(map(int,sys.stdin.readline().rstrip().split()))

print(*solve(n,k,a))

Buggy python submission (verdict: Time Limit Exceeded):
import sys 
from collections import deque
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def R(x):
    r = round(x)
    if r+0.5 <= x:
        r += 1
    return r

def main():
    tmp = deque(LI())
    n,k = tmp.popleft(),tmp.popleft()
    a = LI()
    for _ in range(k):
        table = [0]*n
        for j in range(n):
            left = R(max(0,j-a[j]-0.5))
            right = int(min(n-1,j+a[j]+0.5))
            for u in range(left,right+1):
                table[u] += 1
        a = table[:]
    for i in range(n):
        print(str(a[i])+' ',end='')
    return

if __name__=='__main__':
    main()

Fixed submission:
import sys
from itertools import accumulate

def solve(n,k,a):
    for _ in range(k):
        if a==[n]*n:    return a
        t = [0]*(n+1)
        for i,x in enumerate(a):
            t[max(0,i-x)] += 1
            t[min(n,i+x+1)] -=1
        a = list(accumulate(t))[:-1]
    return a

n,k = map(int,sys.stdin.readline().rstrip().split())
a = list(map(int,sys.stdin.readline().rstrip().split()))

print(*solve(n,k,a))