Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
def main():
    H, W = map(int,input().split())
    s = [list(map(str,input())) for _ in range(H)]
    dist = [[-1]*W for _ in range(H)]
    
    q = deque([])
    for i in range(H):
        for j in range(W):
            if s[i][j] == "#":
                dist[i][j] = 0
                q.append((i, j))
    
    ans = 0
    while q:
        x, y = q.popleft()
        dx = [1, -1, 0, 0]
        dy = [0, 0, 1, -1]
        for i in range(4):
            nx = x+dx[i]
            ny = y+dy[i]
            if (0 <= nx < H and 0 <= ny < W and dist[nx][ny] == -1 and s[nx][ny] == '.'):
                dist[nx][ny] = dist[x][y] + 1
                q.append((nx, ny))
                ans = max(ans, dist[nx][ny])
                
    print(ans)

if __name__ == "__main__":
    main()
                

Fixed submission:
import numpy
H,W = map(int,input().split())
a_list = []
INF = 10**10
for i in range(H):
    str = input()
    a_list.append([0 if i == "#" else INF for i in list(str)])

a_list = numpy.array(a_list)
for x in range(W-1):
    a_list[:,x+1] = numpy.minimum(a_list[:,x]+1,a_list[:,x+1])
    a_list[:,-x-2] = numpy.minimum(a_list[:,-x-1]+1,a_list[:,-x-2])

for y in range(H-1):
    a_list[y+1,:] = numpy.minimum(a_list[y,:]+1,a_list[y+1,:])
    a_list[-y-2,:] = numpy.minimum(a_list[-y-1,:]+1,a_list[-y-2,:])

print(a_list.max())

Buggy python submission (verdict: Runtime Error):
from collections import deque
def main():
    H, W = map(int,input().split())
    s = [list(map(str,input())) for _ in range(W)]
    dist = [[-1]*W for _ in range(H)]
    
    q = deque([])
    for i in range(H):
        for j in range(W):
            if s[i][j] == "#":
                dist[i][j] = 0
                q.append((i, j))
    
    ans = 0
    while q:
        x, y = q.popleft()
        dx = [1, -1, 0, 0]
        dy = [0, 0, 1, -1]
        for i in range(4):
            nx = x+dx[i]
            ny = y+dy[i]
            if (0 <= nx < H and 0 <= ny < W and dist[nx][ny] == -1 and s[nx][ny] == '.'):
                dist[nx][ny] = dist[x][y] + 1
                q.append((nx, ny))
                ans = max(ans, dist[nx][ny])
                
    print(ans)

if __name__ == "__main__":
    main()
                

Fixed submission:
import numpy
H,W = map(int,input().split())
a_list = []
INF = 10**10
for i in range(H):
    str = input()
    a_list.append([0 if i == "#" else INF for i in list(str)])

a_list = numpy.array(a_list)
for x in range(W-1):
    a_list[:,x+1] = numpy.minimum(a_list[:,x]+1,a_list[:,x+1])
    a_list[:,-x-2] = numpy.minimum(a_list[:,-x-1]+1,a_list[:,-x-2])

for y in range(H-1):
    a_list[y+1,:] = numpy.minimum(a_list[y,:]+1,a_list[y+1,:])
    a_list[-y-2,:] = numpy.minimum(a_list[-y-1,:]+1,a_list[-y-2,:])

print(a_list.max())

Buggy python submission (verdict: Time Limit Exceeded):
H,W = map(int,input().split())
a_list = []
for i in range(H):
    str = input()
    a_list.append(list(str))

INF = 10**10

for i in range(H):
    for j in range(W):
        if a_list[i][j] == "#":
            a_list[i][j] = 0
        else:
            a_list[i][j] = INF

for i in range(H):
    for j in range(W-1):
        a_list[i][j+1] = min(a_list[i][j]+1,a_list[i][j+1])
        a_list[i][-j-2] = min(a_list[i][-j-1]+1,a_list[i][-j-2])

for i in range(W):
    for j in range(H-1):
        a_list[j+1][i] = min(a_list[j][i]+1,a_list[j+1][i])
        a_list[-j-2][i] = min(a_list[-j-1][i]+1,a_list[-j-2][i])

ans = 0
for i in range(H):
    ans = max(ans,max(a_list[i]))

print(ans)

Fixed submission:
import numpy
H,W = map(int,input().split())
a_list = []
INF = 10**10
for i in range(H):
    str = input()
    a_list.append([0 if i == "#" else INF for i in list(str)])

a_list = numpy.array(a_list)
for x in range(W-1):
    a_list[:,x+1] = numpy.minimum(a_list[:,x]+1,a_list[:,x+1])
    a_list[:,-x-2] = numpy.minimum(a_list[:,-x-1]+1,a_list[:,-x-2])

for y in range(H-1):
    a_list[y+1,:] = numpy.minimum(a_list[y,:]+1,a_list[y+1,:])
    a_list[-y-2,:] = numpy.minimum(a_list[-y-1,:]+1,a_list[-y-2,:])

print(a_list.max())

Buggy python submission (verdict: Runtime Error):
H,W = map(int,input().split())
a_list = []
for i in range(H):
    str = input()
    a_list.append(list(str))

def clear(A):
    
    INF = 100000000

    distance = [[INF for i in range(W)] for j in range(H)]

    def bfs():
        queue = []
        already = []

        for i in range(W):
            for j in range(H):
                if A[i][j] == "#":
                    queue.insert(0,(i,j))
                    already.insert(0,(i,j))
                    distance[i][j] = 0

        while len(queue):
            x, y = queue.pop()

            for i in range(0, 4):
                nx, ny = x + [1, 0, -1, 0][i], y + [0, 1, 0, -1][i]

                if (0 <= nx and nx < W and 0 <= ny and ny < H and \
                    A[nx][ny] == '.' and distance[nx][ny] == INF):
                    queue.insert(0, (nx, ny))
                    already.insert(0, (nx,ny))
                    distance[nx][ny] = distance[x][y] + 1

        max_dis = 0
        for i in range(H):
            max_dis = max(max_dis,max(distance[i]))

        return max_dis

    return bfs()

print (clear(a_list))

Fixed submission:
import numpy
H,W = map(int,input().split())
a_list = []
INF = 10**10
for i in range(H):
    str = input()
    a_list.append([0 if i == "#" else INF for i in list(str)])

a_list = numpy.array(a_list)
for x in range(W-1):
    a_list[:,x+1] = numpy.minimum(a_list[:,x]+1,a_list[:,x+1])
    a_list[:,-x-2] = numpy.minimum(a_list[:,-x-1]+1,a_list[:,-x-2])

for y in range(H-1):
    a_list[y+1,:] = numpy.minimum(a_list[y,:]+1,a_list[y+1,:])
    a_list[-y-2,:] = numpy.minimum(a_list[-y-1,:]+1,a_list[-y-2,:])

print(a_list.max())