Buggy python submission (verdict: Time Limit Exceeded):
def resolve():
        n, k = map(int, input().split())
        a = list(map(int, input().split()))
        bn1 = [0] * n
        bn2 = [0] * n
        s = 0
        t = 0
        chec=0
        for _ in range(k):
            for i in range(n):
                b1 = max(i - a[i], 0)
                b2 = min(i + a[i], n - 1)
                bn1[b1] += 1
                bn2[b2] += 1
            for i in range(n):
                s += bn1[i]
                a[i] = s
            s = 0
            for i in range(1, n):
                t += bn2[i - 1]
                a[i] -= t
                if a[i]==n:
                    chec+=1

            if chec==n:
                break
            chec=0
            t = 0
            bn1 = [0] * n
            bn2 = [0] * n
        c = [str(x) for x in a]
        L = " ".join(c)
        print(L)
resolve()

Fixed submission:
def resolve():
        n, k = map(int, input().split())
        a = list(map(int, input().split()))
        bn1 = [0] * n
        s = 0
        t = 0
        chec = 0
        for _ in range(k):
            for i in range(n):
                b1 = max(i - a[i], 0)
                b2 = min(i + a[i], n - 1)
                bn1[b1] += 1
                if b2<n-1:
                    bn1[b2+1] -= 1
            for i in range(n):
                s += bn1[i]
                a[i] = s
                if s==n:
                    chec+=1
            s = 0
            if chec == n:
                break
            chec = 0
            bn1 = [0] * n
        c = [str(x) for x in a]
        L = " ".join(c)
        print(L)
resolve()

Buggy python submission (verdict: Time Limit Exceeded):
def resolve():
        n, k = map(int, input().split())
        a = list(map(int, input().split()))
        bn1 = [0] * n
        bn2 = [0] * n
        s = 0
        t = 0
        check=[0]*n
        for _ in range(k):
            for i in range(n):
                b1 = max(i - a[i], 0)
                b2 = min(i + a[i], n - 1)
                bn1[b1] += 1
                bn2[b2] += 1
            for i in range(n):
                s += bn1[i]
                a[i] = s
            s = 0
            for i in range(1, n):
                t += bn2[i - 1]
                a[i] -= t
                if a[i]==n and check[i]==0:
                    check[i]=1
            if sum(check)==n:
                break
            t = 0
            bn1 = [0] * n
            bn2 = [0] * n
        c = [str(x) for x in a]
        L = " ".join(c)
        print(L)
resolve()

Fixed submission:
def resolve():
        n, k = map(int, input().split())
        a = list(map(int, input().split()))
        bn1 = [0] * n
        s = 0
        t = 0
        chec = 0
        for _ in range(k):
            for i in range(n):
                b1 = max(i - a[i], 0)
                b2 = min(i + a[i], n - 1)
                bn1[b1] += 1
                if b2<n-1:
                    bn1[b2+1] -= 1
            for i in range(n):
                s += bn1[i]
                a[i] = s
                if s==n:
                    chec+=1
            s = 0
            if chec == n:
                break
            chec = 0
            bn1 = [0] * n
        c = [str(x) for x in a]
        L = " ".join(c)
        print(L)
resolve()

Buggy python submission (verdict: Time Limit Exceeded):
def resolve():
    n, k = map(int, input().split())
    a = list(map(int, input().split()))
    bn1=[0]*n
    bn2 = [0] * n
    s=0
    t=0
    for _ in range(k):
        for i in range(n):
            b1=max(i-a[i],0)
            b2=min(i+a[i],n-1)
            bn1[b1]+=1
            bn2[b2]+=1
        for i in range(n):
            s+=bn1[i]
            a[i]=s
        s=0
        for i in range(1,n):
            t+=bn2[i-1]
            a[i]-=t
        t=0
        bn1 = [0] * n
        bn2 = [0] * n
    c = [str(x) for x in a]
    L=" ".join(c)
    print(L)
resolve()

Fixed submission:
def resolve():
        n, k = map(int, input().split())
        a = list(map(int, input().split()))
        bn1 = [0] * n
        s = 0
        t = 0
        chec = 0
        for _ in range(k):
            for i in range(n):
                b1 = max(i - a[i], 0)
                b2 = min(i + a[i], n - 1)
                bn1[b1] += 1
                if b2<n-1:
                    bn1[b2+1] -= 1
            for i in range(n):
                s += bn1[i]
                a[i] = s
                if s==n:
                    chec+=1
            s = 0
            if chec == n:
                break
            chec = 0
            bn1 = [0] * n
        c = [str(x) for x in a]
        L = " ".join(c)
        print(L)
resolve()