Buggy python submission (verdict: Runtime Error):
import numpy as np

def solve():
    H,W=map(int,input().split(' '))
    max_value = H+W
    values =[]
    for i in range(H):
      values.append([0 if i == '#' else max_value for i in list(input())])
    values = np.array(values)

    for x in range(W-1):
        values[:,x+1] = np.minimum(values[:,x]+1,values[:,x+1])
    for x in range(W-1,0,-1):
        values[:,x] = np.minimum(values[:,x+1]+1,values[:,x])
    for x in range(H-1):
        values[x+1,:] = np.minimum(values[x,:]+1,values[x+1,:])
    for x in range(H-1,0,-1):
        values[x,:] = np.minimum(values[x+1,:]+1,values[x,:])

    print(np.max(values),)
solve()

Fixed submission:
import numpy as np

def solve():
    H,W=map(int,input().split(' '))
    max_value = H+W
    values =[]
    for i in range(H):
      values.append([0 if i == '#' else max_value for i in list(input())])
    values = np.array(values)

    for x in range(W-1):
        values[:,x+1] = np.minimum(values[:,x]+1,values[:,x+1])
    for x in range(W-1,0,-1):
        values[:,x-1] = np.minimum(values[:,x-1],values[:,x]+1)
    for x in range(H-1):
        values[x+1,:] = np.minimum(values[x,:]+1,values[x+1,:])
    print('')
    for x in range(H-1,0,-1):
        values[x-1,:] = np.minimum(values[x,:]+1,values[x-1,:])
    print(np.max(values))
solve()

Buggy python submission (verdict: Time Limit Exceeded):
def solve():
    H,W=list(map(int,input().split(' ')))
    darker =[]
    cnt = 0
    for i in range(H):
        darker.append(list(input()))
    for i in range(H):
        darker[i].insert(0,'.')
        darker[i].append('.')
    darker.insert(0,['.' for i in range(W+2)])
    darker.append(['.' for i in range(W+2)])
    while True:
        tmp=[]
        for i in range(1,H+1):
            for j in range(1,W+1):
                if darker[i][j] =='.':
                    if darker[i-1][j] =="#" or darker[i][j-1] =="#" or darker[i+1][j] =='#' or darker[i][j+1] =='#':
                        tmp.append([i,j])
        if len(tmp) ==0:
            break
        for i,j in tmp:
            darker[i][j] ='#'

        cnt +=1
    return cnt

print(solve())

Fixed submission:
import numpy as np

def solve():
    H,W=map(int,input().split(' '))
    max_value = H+W
    values =[]
    for i in range(H):
      values.append([0 if i == '#' else max_value for i in list(input())])
    values = np.array(values)

    for x in range(W-1):
        values[:,x+1] = np.minimum(values[:,x]+1,values[:,x+1])
    for x in range(W-1,0,-1):
        values[:,x-1] = np.minimum(values[:,x-1],values[:,x]+1)
    for x in range(H-1):
        values[x+1,:] = np.minimum(values[x,:]+1,values[x+1,:])
    print('')
    for x in range(H-1,0,-1):
        values[x-1,:] = np.minimum(values[x,:]+1,values[x-1,:])
    print(np.max(values))
solve()

Buggy python submission (verdict: Time Limit Exceeded):
def solve():
    H,W=list(map(int,input().split(' ')))
    darker =[]
    cnt = 0
    for i in range(H):
        darker.append(list(input()))
    for i in range(H):
        darker[i].insert(0,'.')
        darker[i].append('.')
    darker.insert(0,['.' for i in range(W+2)])
    darker.append(['.' for i in range(W+2)])
    while True:
        tmp=[]
        for i in range(1,H+1):
            for j in range(1,W+1):
                if darker[i][j] =='.':
                    if darker[i-1][j] =="#" or darker[i][j-1] =="#" or darker[i+1][j] =='#' or darker[i][j+1] =='#':
                        tmp.append([i,j])
        if len(tmp) ==0:
            break
        for i in range(0,H+2):
            for j in range(0,W+2):
                if [i,j] in tmp:
                    darker[i][j]='#'

        cnt +=1
    return cnt

print(solve())

Fixed submission:
import numpy as np

def solve():
    H,W=map(int,input().split(' '))
    max_value = H+W
    values =[]
    for i in range(H):
      values.append([0 if i == '#' else max_value for i in list(input())])
    values = np.array(values)

    for x in range(W-1):
        values[:,x+1] = np.minimum(values[:,x]+1,values[:,x+1])
    for x in range(W-1,0,-1):
        values[:,x-1] = np.minimum(values[:,x-1],values[:,x]+1)
    for x in range(H-1):
        values[x+1,:] = np.minimum(values[x,:]+1,values[x+1,:])
    print('')
    for x in range(H-1,0,-1):
        values[x-1,:] = np.minimum(values[x,:]+1,values[x-1,:])
    print(np.max(values))
solve()

Buggy python submission (verdict: Time Limit Exceeded):
def solve():
    H,W=list(map(int,input().split(' ')))
    darker =[]
    cnt = 0
    for i in range(H):
        darker.append(list(input()))
    for i in range(H):
        darker[i].insert(0,'.')
        darker[i].append('.')
    darker.insert(0,['.' for i in range(W+2)])
    darker.append(['.' for i in range(W+2)])
    while True:
        c = 0
        tmp=[]
        for i in range(1,H+1):
            for j in range(1,W+1):
                if darker[i][j] =='#':
                    c +=1
                    if darker[i-1][j] =='.':
                        tmp.append([i-1,j])
                    if darker[i][j-1] =='.':
                        tmp.append([i,j-1])
                    if darker[i+1][j] == '.':
                        tmp.append([i+1,j])
                    if darker[i][j+1] =='.':
                        tmp.append([i,j+1])
        if c ==H*W:
            break
        for i in range(0,H+2):
            for j in range(0,W+2):
                if [i,j] in tmp:
                    darker[i][j]='#'

        cnt +=1
    return cnt

print(solve())

Fixed submission:
import numpy as np

def solve():
    H,W=map(int,input().split(' '))
    max_value = H+W
    values =[]
    for i in range(H):
      values.append([0 if i == '#' else max_value for i in list(input())])
    values = np.array(values)

    for x in range(W-1):
        values[:,x+1] = np.minimum(values[:,x]+1,values[:,x+1])
    for x in range(W-1,0,-1):
        values[:,x-1] = np.minimum(values[:,x-1],values[:,x]+1)
    for x in range(H-1):
        values[x+1,:] = np.minimum(values[x,:]+1,values[x+1,:])
    print('')
    for x in range(H-1,0,-1):
        values[x-1,:] = np.minimum(values[x,:]+1,values[x-1,:])
    print(np.max(values))
solve()