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

for i in range(K):
  newLightPow = [0]*(N+1)
  #print(lightPow)
  for pos in range(1, N+1):
    low = pos - lightPow[pos-1]
    high = pos + lightPow[pos-1]
    low = min(max(1, low), N)
    high = min(max(1, high), N)
    newLightPow[low-1] += 1
    newLightPow[high] -= 1
    #print("pos:"+str(pos))
    #print("low"+str(low)+" high"+str(high))
    #print(newLightPow)
    
  check = True
  for i in range(0, N):
    if (i > 0):
      newLightPow[i] += newLightPow[i-1]
    if (newLightPow[i] < N):
      check = False
  lightPow = newLightPow
  if (check):
    break

print(*lightPow[:-1])

Fixed submission:
import math
N, K = map(int, input().split())
lightPow = list(map(int, input().split()))

for i in range(K):
  newLightPow = [0]*(N+1)
  #print(lightPow)
  for pos in range(1, N+1):
    low = pos - lightPow[pos-1]
    high = pos + lightPow[pos-1]
    low = min(max(1, low), N)
    high = min(max(1, high), N)
    newLightPow[low-1] += 1
    newLightPow[high] -= 1
    #print("pos:"+str(pos))
    #print("low"+str(low)+" high"+str(high))
    #print(newLightPow)
    
  check = True
  for i in range(0, N):
    if (i > 0):
      newLightPow[i] += newLightPow[i-1]
    if (newLightPow[i] < N):
      check = False
  lightPow = newLightPow
  if (check):
    break

print(*lightPow[:-1])

Buggy python submission (verdict: Time Limit Exceeded):
import math
N, K = map(int, input().split())
lightPow = list(map(int, input().split()))
 
for i in range(K):
  newLightPow = [0]*(N+1)
  #print(lightPow)
  for pos in range(1, N+1):
    count = 0
    low = math.ceil(pos-(lightPow[pos-1]+0.5))
    high = math.floor(pos+(lightPow[pos-1]+0.5))
    low = min(max(1, low), N)
    high = min(max(1, high), N)
    newLightPow[low-1] += 1
    newLightPow[high] -= 1
    #print("pos:"+str(pos))
    #print("low"+str(low)+" high"+str(high))
    #print(newLightPow)
  check = True
  #print(newLightPow)
  for i in range(1, N):
    newLightPow[i] += newLightPow[i-1]
    if (newLightPow[i] < (N-1)):
      check = False
  lightPow = newLightPow
  if (check):
    break

print(*lightPow[:-1])

Fixed submission:
import math
N, K = map(int, input().split())
lightPow = list(map(int, input().split()))

for i in range(K):
  newLightPow = [0]*(N+1)
  #print(lightPow)
  for pos in range(1, N+1):
    low = pos - lightPow[pos-1]
    high = pos + lightPow[pos-1]
    low = min(max(1, low), N)
    high = min(max(1, high), N)
    newLightPow[low-1] += 1
    newLightPow[high] -= 1
    #print("pos:"+str(pos))
    #print("low"+str(low)+" high"+str(high))
    #print(newLightPow)
    
  check = True
  for i in range(0, N):
    if (i > 0):
      newLightPow[i] += newLightPow[i-1]
    if (newLightPow[i] < N):
      check = False
  lightPow = newLightPow
  if (check):
    break

print(*lightPow[:-1])

Buggy python submission (verdict: Time Limit Exceeded):
import math
N, K = map(int, input().split())
lightPow = list(map(int, input().split()))
 
for i in range(K):
  newLightPow = [0]*(N+1)
  #print(lightPow)
  for pos in range(1, N+1):
    count = 0
    low = math.ceil(pos-(lightPow[pos-1]+0.5))
    high = math.floor(pos+(lightPow[pos-1]+0.5))
    low = min(max(1, low), N)
    high = min(max(1, high), N)
    newLightPow[low-1] += 1
    newLightPow[high] -= 1
    #print("pos:"+str(pos))
    #print("low"+str(low)+" high"+str(high))
    #print(newLightPow)
  for i in range(1, N+1):
    newLightPow[i] += newLightPow[i-1]
  lightPow = newLightPow
  check = True
  for pow in lightPow:
    if (pow < (N-1)) :
      check = False
    if not (check):
      break
  if (check):
    break
  
print(*lightPow[:-1])

Fixed submission:
import math
N, K = map(int, input().split())
lightPow = list(map(int, input().split()))

for i in range(K):
  newLightPow = [0]*(N+1)
  #print(lightPow)
  for pos in range(1, N+1):
    low = pos - lightPow[pos-1]
    high = pos + lightPow[pos-1]
    low = min(max(1, low), N)
    high = min(max(1, high), N)
    newLightPow[low-1] += 1
    newLightPow[high] -= 1
    #print("pos:"+str(pos))
    #print("low"+str(low)+" high"+str(high))
    #print(newLightPow)
    
  check = True
  for i in range(0, N):
    if (i > 0):
      newLightPow[i] += newLightPow[i-1]
    if (newLightPow[i] < N):
      check = False
  lightPow = newLightPow
  if (check):
    break

print(*lightPow[:-1])

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

for i in range(K):
  newLightPow = [0]*N
  #print(lightPow)
  for pos in range(1, N+1):
    count = 0
    low = math.ceil(pos-(lightPow[pos-1]+0.5))
    high = math.floor(pos+(lightPow[pos-1]+0.5))
    low = min(max(1, low), N)
    high = min(max(1, high), N)
    for area in range(low, high+1):
      #print(area)
      newLightPow[area-1] += 1
    #print("pos:"+str(pos))
    #print("low"+str(low)+" high"+str(high))
    #print(newLightPow)
  lightPow = newLightPow
  check = True
  for pow in lightPow:
    if (pow < (N-1)) :
      check = False
    if not (check):
      break
  if (check):
    break
  
print(*lightPow)


Fixed submission:
import math
N, K = map(int, input().split())
lightPow = list(map(int, input().split()))

for i in range(K):
  newLightPow = [0]*(N+1)
  #print(lightPow)
  for pos in range(1, N+1):
    low = pos - lightPow[pos-1]
    high = pos + lightPow[pos-1]
    low = min(max(1, low), N)
    high = min(max(1, high), N)
    newLightPow[low-1] += 1
    newLightPow[high] -= 1
    #print("pos:"+str(pos))
    #print("low"+str(low)+" high"+str(high))
    #print(newLightPow)
    
  check = True
  for i in range(0, N):
    if (i > 0):
      newLightPow[i] += newLightPow[i-1]
    if (newLightPow[i] < N):
      check = False
  lightPow = newLightPow
  if (check):
    break

print(*lightPow[:-1])

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

for i in range(K):
  newLightPow = [0]*N
  #print(lightPow)
  for pos in range(1, N+1):
    count = 0
    low = math.ceil(pos-(lightPow[pos-1]+0.5))
    high = math.floor(pos+(lightPow[pos-1]+0.5))
    low = min(max(1, low), N)
    high = min(max(1, high), N)
    for area in range(low, high+1):
      #print(area)
      newLightPow[area-1] += 1
    #print("pos:"+str(pos))
    #print("low"+str(low)+" high"+str(high))
    #print(newLightPow)
  lightPow = newLightPow
  
print(*lightPow)


Fixed submission:
import math
N, K = map(int, input().split())
lightPow = list(map(int, input().split()))

for i in range(K):
  newLightPow = [0]*(N+1)
  #print(lightPow)
  for pos in range(1, N+1):
    low = pos - lightPow[pos-1]
    high = pos + lightPow[pos-1]
    low = min(max(1, low), N)
    high = min(max(1, high), N)
    newLightPow[low-1] += 1
    newLightPow[high] -= 1
    #print("pos:"+str(pos))
    #print("low"+str(low)+" high"+str(high))
    #print(newLightPow)
    
  check = True
  for i in range(0, N):
    if (i > 0):
      newLightPow[i] += newLightPow[i-1]
    if (newLightPow[i] < N):
      check = False
  lightPow = newLightPow
  if (check):
    break

print(*lightPow[:-1])

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

for i in range(K):
  newLightPow = [0]*N
  for pos in range(1, N+1):
    count = 0
    low = max(math.ceil(pos-(lightPow[pos-1]+0.5)), 1)
    high = max(math.floor(pos+(lightPow[pos-1]+0.5)), 1)

    for area in range(low, high+1):
      newLightPow[area-1] += 1
    #print(pos)
    #print("low"+str(low)+" high"+str(high))
    #print(newLightPow)
  lightPow = newLightPow
  
print(*lightPow)


Fixed submission:
import math
N, K = map(int, input().split())
lightPow = list(map(int, input().split()))

for i in range(K):
  newLightPow = [0]*(N+1)
  #print(lightPow)
  for pos in range(1, N+1):
    low = pos - lightPow[pos-1]
    high = pos + lightPow[pos-1]
    low = min(max(1, low), N)
    high = min(max(1, high), N)
    newLightPow[low-1] += 1
    newLightPow[high] -= 1
    #print("pos:"+str(pos))
    #print("low"+str(low)+" high"+str(high))
    #print(newLightPow)
    
  check = True
  for i in range(0, N):
    if (i > 0):
      newLightPow[i] += newLightPow[i-1]
    if (newLightPow[i] < N):
      check = False
  lightPow = newLightPow
  if (check):
    break

print(*lightPow[:-1])

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

for i in range(K):
  newLightPow = [0]*N
  for t_pos in range(1, N+1):
    count = 0
    for pos in range(1, N+1):
      low = float(pos)-(lightPow[pos-1]+0.5)
      high = float(pos)+(lightPow[pos-1]+0.5)
      #print(t_pos)
      #print("low"+str(low)+" high"+str(high))
      if ((low<=t_pos) and (t_pos<=high)):
        #print("yes")
        count += 1
    newLightPow[t_pos-1] = count
  lightPow = newLightPow
print(*lightPow)


Fixed submission:
import math
N, K = map(int, input().split())
lightPow = list(map(int, input().split()))

for i in range(K):
  newLightPow = [0]*(N+1)
  #print(lightPow)
  for pos in range(1, N+1):
    low = pos - lightPow[pos-1]
    high = pos + lightPow[pos-1]
    low = min(max(1, low), N)
    high = min(max(1, high), N)
    newLightPow[low-1] += 1
    newLightPow[high] -= 1
    #print("pos:"+str(pos))
    #print("low"+str(low)+" high"+str(high))
    #print(newLightPow)
    
  check = True
  for i in range(0, N):
    if (i > 0):
      newLightPow[i] += newLightPow[i-1]
    if (newLightPow[i] < N):
      check = False
  lightPow = newLightPow
  if (check):
    break

print(*lightPow[:-1])