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

buf = sys.stdin.buffer
R,C = map(int,buf.readline().split())
# +1周分だけ
black = np.zeros((H+2,W+2),dtype=np.bool)
# \nがあることに注意
black[1:-1,1:] = (np.frombuffer(buf.read(H*(W+1)),dtype='S1') == b'#').reshape(H,W+1)

INF = 10 ** 4
dist = np.zeros((H,W),dtype=np.int8)
# .のところは０それ以外はINFで初期化
dist[~black[1:-1,1:-1]] = INF
# 右、左、下、上と展開させていく感じ
for n in range(1,H):
    np.minimum(dist[n-1]+1,dist[n],out=dist[n])
for n in range(H-2,-1,-1):
    np.minimum(dist[n+1]+1,dist[n],out=dist[n])
for n in range(1,W):
    np.minimum(dist[:,n-1]+1,dist[:,n],out=dist[:,n])
for n in range(W-2,-1,-1):
    np.minimum(dist[:,n+1]+1,dist[:,n],out=dist[:,n])

print(dist.max())

Fixed submission:
import numpy as np
import sys
# https://atcoder.jp/contests/agc033/submissions/6021787
buf = sys.stdin.buffer
H,W = map(int,buf.readline().split())
# +1周分だけ
black = np.zeros((H+2,W+2),dtype=np.bool)
# \nがあることに注意
black[1:-1,1:] = (np.frombuffer(buf.read(H*(W+1)),dtype='S1') == b'#').reshape(H,W+1)

INF = 10 ** 4
dist = np.zeros((H,W),dtype=np.int16)
# .のところは０それ以外はINFで初期化
dist[~black[1:-1,1:-1]] = INF
# 右、左、下、上と展開させていく感じ
for n in range(1,H):
    np.minimum(dist[n-1]+1,dist[n],out=dist[n])
for n in range(H-2,-1,-1):
    np.minimum(dist[n+1]+1,dist[n],out=dist[n])
for n in range(1,W):
    np.minimum(dist[:,n-1]+1,dist[:,n],out=dist[:,n])
for n in range(W-2,-1,-1):
    np.minimum(dist[:,n+1]+1,dist[:,n],out=dist[:,n])

print(dist.max())

Buggy python submission (verdict: Time Limit Exceeded):
import sys
import numpy as np

def main():
    buf = sys.stdin.buffer
    R,C = map(int,buf.readline().split())
    # \nが含まれるから列要素の数が+1
    black = (np.frombuffer(buf.read(R*(C+1)),dtype='S1') == b'#')
    sharps = np.where(black==True)[0]

    coord_x = np.array([[j for i in range(C)] for j in range(R)])
    coord_y = np.array([[i for i in range(C)] for j in range(R)])

    sharps = sharps[sharps%(C+1)!=C]

    sharps_x = sharps//(C+1)
    sharps_y = sharps%(C+1)
    for i,(one_sharp_x,one_sharp_y) in enumerate(zip(sharps_x,sharps_y)):
        #one_sharp_x = one//(C+1)
        #one_sharp_y = one%(C+1)
        if i == 0:
            result_np = abs(coord_x-one_sharp_x) + abs(coord_y-one_sharp_y)
        else:
            result_np = np.minimum(result_np,abs(coord_x-one_sharp_x) + abs(coord_y-one_sharp_y))

    print(max(result_np.flatten()))

if __name__ == '__main__':
    main()

Fixed submission:
import numpy as np
import sys
# https://atcoder.jp/contests/agc033/submissions/6021787
buf = sys.stdin.buffer
H,W = map(int,buf.readline().split())
# +1周分だけ
black = np.zeros((H+2,W+2),dtype=np.bool)
# \nがあることに注意
black[1:-1,1:] = (np.frombuffer(buf.read(H*(W+1)),dtype='S1') == b'#').reshape(H,W+1)

INF = 10 ** 4
dist = np.zeros((H,W),dtype=np.int16)
# .のところは０それ以外はINFで初期化
dist[~black[1:-1,1:-1]] = INF
# 右、左、下、上と展開させていく感じ
for n in range(1,H):
    np.minimum(dist[n-1]+1,dist[n],out=dist[n])
for n in range(H-2,-1,-1):
    np.minimum(dist[n+1]+1,dist[n],out=dist[n])
for n in range(1,W):
    np.minimum(dist[:,n-1]+1,dist[:,n],out=dist[:,n])
for n in range(W-2,-1,-1):
    np.minimum(dist[:,n+1]+1,dist[:,n],out=dist[:,n])

print(dist.max())

Buggy python submission (verdict: Runtime Error):
def main():
    buf = sys.stdin.buffer
    R,C = map(int,buf.readline().split())
    # \nが含まれるから列要素の数が+1
    black = (np.frombuffer(buf.read(R*(C+1)),dtype='S1') == b'#')
    sharps = np.where(black==True)[0]

    coord_x = np.array([[j for i in range(C)] for j in range(R)])
    coord_y = np.array([[i for i in range(C)] for j in range(R)])

    sharps = sharps[sharps%(C+1)!=C]

    sharps_x = sharps//(C+1)
    sharps_y = sharps%(C+1)
    for i,(one_sharp_x,one_sharp_y) in enumerate(zip(sharps_x,sharps_y)):
        #one_sharp_x = one//(C+1)
        #one_sharp_y = one%(C+1)
        if i == 0:
            result_np = abs(coord_x-one_sharp_x) + abs(coord_y-one_sharp_y)
        else:
            result_np = np.minimum(result_np,abs(coord_x-one_sharp_x) + abs(coord_y-one_sharp_y))

    print(max(result_np.flatten()))

if __name__ == '__main__':
    main()

Fixed submission:
import numpy as np
import sys
# https://atcoder.jp/contests/agc033/submissions/6021787
buf = sys.stdin.buffer
H,W = map(int,buf.readline().split())
# +1周分だけ
black = np.zeros((H+2,W+2),dtype=np.bool)
# \nがあることに注意
black[1:-1,1:] = (np.frombuffer(buf.read(H*(W+1)),dtype='S1') == b'#').reshape(H,W+1)

INF = 10 ** 4
dist = np.zeros((H,W),dtype=np.int16)
# .のところは０それ以外はINFで初期化
dist[~black[1:-1,1:-1]] = INF
# 右、左、下、上と展開させていく感じ
for n in range(1,H):
    np.minimum(dist[n-1]+1,dist[n],out=dist[n])
for n in range(H-2,-1,-1):
    np.minimum(dist[n+1]+1,dist[n],out=dist[n])
for n in range(1,W):
    np.minimum(dist[:,n-1]+1,dist[:,n],out=dist[:,n])
for n in range(W-2,-1,-1):
    np.minimum(dist[:,n+1]+1,dist[:,n],out=dist[:,n])

print(dist.max())

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

def main()
buf = sys.stdin.buffer
R,C = map(int,buf.readline().split())
# \nが含まれるから列要素の数が+1
black = (np.frombuffer(buf.read(R*(C+1)),dtype='S1') == b'#')
sharps = np.where(black==True)[0]

coord_x = np.array([[j for i in range(C)] for j in range(R)])
coord_y = np.array([[i for i in range(C)] for j in range(R)])

sharps = sharps[sharps%(C+1)!=C]

sharps_x = sharps//(C+1)
sharps_y = sharps%(C+1)
for i,(one_sharp_x,one_sharp_y) in enumerate(zip(sharps_x,sharps_y)):
    #one_sharp_x = one//(C+1)
    #one_sharp_y = one%(C+1)
    if i == 0:
        result_np = abs(coord_x-one_sharp_x) + abs(coord_y-one_sharp_y)
    else:
        result_np = np.minimum(result_np,abs(coord_x-one_sharp_x) + abs(coord_y-one_sharp_y))

print(max(result_np.flatten()))

if __name__ == '__main__':
    main()


Fixed submission:
import numpy as np
import sys
# https://atcoder.jp/contests/agc033/submissions/6021787
buf = sys.stdin.buffer
H,W = map(int,buf.readline().split())
# +1周分だけ
black = np.zeros((H+2,W+2),dtype=np.bool)
# \nがあることに注意
black[1:-1,1:] = (np.frombuffer(buf.read(H*(W+1)),dtype='S1') == b'#').reshape(H,W+1)

INF = 10 ** 4
dist = np.zeros((H,W),dtype=np.int16)
# .のところは０それ以外はINFで初期化
dist[~black[1:-1,1:-1]] = INF
# 右、左、下、上と展開させていく感じ
for n in range(1,H):
    np.minimum(dist[n-1]+1,dist[n],out=dist[n])
for n in range(H-2,-1,-1):
    np.minimum(dist[n+1]+1,dist[n],out=dist[n])
for n in range(1,W):
    np.minimum(dist[:,n-1]+1,dist[:,n],out=dist[:,n])
for n in range(W-2,-1,-1):
    np.minimum(dist[:,n+1]+1,dist[:,n],out=dist[:,n])

print(dist.max())

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
import sys

buf = sys.stdin.buffer
R,C = map(int,buf.readline().split())
# \nが含まれるから列要素の数が+1
black = (np.frombuffer(buf.read(R*(C+1)),dtype='S1') == b'#')
sharps = np.where(black==True)[0]

coord_x = np.array([[j for i in range(C)] for j in range(R)])
coord_y = np.array([[i for i in range(C)] for j in range(R)])

sharps = sharps[sharps%(C+1)!=C]

sharps_x = sharps//(C+1)
sharps_y = sharps%(C+1)
for i,(one_sharp_x,one_sharp_y) in enumerate(zip(sharps_x,sharps_y)):
    #one_sharp_x = one//(C+1)
    #one_sharp_y = one%(C+1)
    if i == 0:
        result_np = abs(coord_x-one_sharp_x) + abs(coord_y-one_sharp_y)
    else:
        result_np = np.minimum(result_np,abs(coord_x-one_sharp_x) + abs(coord_y-one_sharp_y))

print(max(result_np.flatten()))

Fixed submission:
import numpy as np
import sys
# https://atcoder.jp/contests/agc033/submissions/6021787
buf = sys.stdin.buffer
H,W = map(int,buf.readline().split())
# +1周分だけ
black = np.zeros((H+2,W+2),dtype=np.bool)
# \nがあることに注意
black[1:-1,1:] = (np.frombuffer(buf.read(H*(W+1)),dtype='S1') == b'#').reshape(H,W+1)

INF = 10 ** 4
dist = np.zeros((H,W),dtype=np.int16)
# .のところは０それ以外はINFで初期化
dist[~black[1:-1,1:-1]] = INF
# 右、左、下、上と展開させていく感じ
for n in range(1,H):
    np.minimum(dist[n-1]+1,dist[n],out=dist[n])
for n in range(H-2,-1,-1):
    np.minimum(dist[n+1]+1,dist[n],out=dist[n])
for n in range(1,W):
    np.minimum(dist[:,n-1]+1,dist[:,n],out=dist[:,n])
for n in range(W-2,-1,-1):
    np.minimum(dist[:,n+1]+1,dist[:,n],out=dist[:,n])

print(dist.max())

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
import sys

buf = sys.stdin.buffer
R,C = map(int,buf.readline().split())
# \nが含まれるから列要素の数が+1
black = (np.frombuffer(buf.read(R*(C+1)),dtype='S1') == b'#')
sharps = np.where(black==True)[0]

coord_x = np.array([[j for i in range(C)] for j in range(R)])
coord_y = np.array([[i for i in range(C)] for j in range(R)])

sharps = sharps[sharps%(C+1)!=C]
for i,one in enumerate(sharps):
    one_sharp_x = one//(C+1)
    one_sharp_y = one%(C+1)
    if i == 0:
        result_np = abs(coord_x-one_sharp_x) + abs(coord_y-one_sharp_y)
    else:
        result_np = np.minimum(result_np,abs(coord_x-one_sharp_x) + abs(coord_y-one_sharp_y))

print(max(result_np.flatten()))

Fixed submission:
import numpy as np
import sys
# https://atcoder.jp/contests/agc033/submissions/6021787
buf = sys.stdin.buffer
H,W = map(int,buf.readline().split())
# +1周分だけ
black = np.zeros((H+2,W+2),dtype=np.bool)
# \nがあることに注意
black[1:-1,1:] = (np.frombuffer(buf.read(H*(W+1)),dtype='S1') == b'#').reshape(H,W+1)

INF = 10 ** 4
dist = np.zeros((H,W),dtype=np.int16)
# .のところは０それ以外はINFで初期化
dist[~black[1:-1,1:-1]] = INF
# 右、左、下、上と展開させていく感じ
for n in range(1,H):
    np.minimum(dist[n-1]+1,dist[n],out=dist[n])
for n in range(H-2,-1,-1):
    np.minimum(dist[n+1]+1,dist[n],out=dist[n])
for n in range(1,W):
    np.minimum(dist[:,n-1]+1,dist[:,n],out=dist[:,n])
for n in range(W-2,-1,-1):
    np.minimum(dist[:,n+1]+1,dist[:,n],out=dist[:,n])

print(dist.max())

Buggy python submission (verdict: Runtime Error):
H,W = map(int,input().split())
m = ["" for _ in range(H)] 
import queue
q = queue.Queue()

#sharps = []
for i in range(H):
    m[i] = input()
    for j in enumerate(m[i]):
        if j[1] == "#":
            q.put((i,j[0]))
            
times_map = [0] * (H*W)
bool_map = [0]* (H*W)

counter = -1
while sum(bool_map) != H*W:
    counter +=1
    sharps = [q.get() for _ in range(q.qsize())]
    for one in sharps:
        if one[0] < 0 or one[0] >= H or one[1] < 0 or one[1] >= W:
            continue
        index = one[0]*(H)+one[1]
        if bool_map[index] == 0:
            times_map[index] = counter
            bool_map[index] = 1
            q.put((one[0]+1,one[1]))
            q.put((one[0]-1,one[1]))
            q.put((one[0],one[1]+1))
            q.put((one[0],one[1]-1))
            
print(counter)

Fixed submission:
import numpy as np
import sys
# https://atcoder.jp/contests/agc033/submissions/6021787
buf = sys.stdin.buffer
H,W = map(int,buf.readline().split())
# +1周分だけ
black = np.zeros((H+2,W+2),dtype=np.bool)
# \nがあることに注意
black[1:-1,1:] = (np.frombuffer(buf.read(H*(W+1)),dtype='S1') == b'#').reshape(H,W+1)

INF = 10 ** 4
dist = np.zeros((H,W),dtype=np.int16)
# .のところは０それ以外はINFで初期化
dist[~black[1:-1,1:-1]] = INF
# 右、左、下、上と展開させていく感じ
for n in range(1,H):
    np.minimum(dist[n-1]+1,dist[n],out=dist[n])
for n in range(H-2,-1,-1):
    np.minimum(dist[n+1]+1,dist[n],out=dist[n])
for n in range(1,W):
    np.minimum(dist[:,n-1]+1,dist[:,n],out=dist[:,n])
for n in range(W-2,-1,-1):
    np.minimum(dist[:,n+1]+1,dist[:,n],out=dist[:,n])

print(dist.max())

Buggy python submission (verdict: Runtime Error):
H,W = map(int,input().split())
m = ["" for _ in range(H)] 
import queue
import numpy as np
q = queue.Queue()

#sharps = []
for i in range(H):
    m[i] = input()
    for j in enumerate(m[i]):
        if j[1] == "#":
            q.put((i,j[0]))
            
times_map = np.zeros(H*W)
bool_map = np.zeros(H*W)

counter = -1
while sum(bool_map) != H*W:
    counter +=1
    sharps = [q.get() for _ in range(q.qsize())]
    for one in sharps:
        if one[0] < 0 or one[0] >= H or one[1] < 0 or one[1] >= W:
            continue
        index = one[0]*(H)+one[1]
        if bool_map[index] == 0:
            times_map[index] = counter
            bool_map[index] = 1
            q.put((one[0]+1,one[1]))
            q.put((one[0]-1,one[1]))
            q.put((one[0],one[1]+1))
            q.put((one[0],one[1]-1))
            
print(counter)

Fixed submission:
import numpy as np
import sys
# https://atcoder.jp/contests/agc033/submissions/6021787
buf = sys.stdin.buffer
H,W = map(int,buf.readline().split())
# +1周分だけ
black = np.zeros((H+2,W+2),dtype=np.bool)
# \nがあることに注意
black[1:-1,1:] = (np.frombuffer(buf.read(H*(W+1)),dtype='S1') == b'#').reshape(H,W+1)

INF = 10 ** 4
dist = np.zeros((H,W),dtype=np.int16)
# .のところは０それ以外はINFで初期化
dist[~black[1:-1,1:-1]] = INF
# 右、左、下、上と展開させていく感じ
for n in range(1,H):
    np.minimum(dist[n-1]+1,dist[n],out=dist[n])
for n in range(H-2,-1,-1):
    np.minimum(dist[n+1]+1,dist[n],out=dist[n])
for n in range(1,W):
    np.minimum(dist[:,n-1]+1,dist[:,n],out=dist[:,n])
for n in range(W-2,-1,-1):
    np.minimum(dist[:,n+1]+1,dist[:,n],out=dist[:,n])

print(dist.max())

Buggy python submission (verdict: Time Limit Exceeded):
H,W = map(int,input().split())
m = ["" for _ in range(H)] 
sharps = []
for i in range(H):
    m[i] = input()
    for j in enumerate(m[i]):
        if j[1] == "#":
            sharps += [(i,j[0])]

coord = [[(i,j)for i in range(W)] for j in range(H)]

ref_max = 0
for i in range(H):
    for j in range(W):
        tmp_max = min([abs(coord[i][j][0] - one[0]) + abs(coord[i][j][1] - one[1]) for one in sharps])
        if tmp_max > ref_max:
            ref_max = tmp_max
            
print(ref_max)

Fixed submission:
import numpy as np
import sys
# https://atcoder.jp/contests/agc033/submissions/6021787
buf = sys.stdin.buffer
H,W = map(int,buf.readline().split())
# +1周分だけ
black = np.zeros((H+2,W+2),dtype=np.bool)
# \nがあることに注意
black[1:-1,1:] = (np.frombuffer(buf.read(H*(W+1)),dtype='S1') == b'#').reshape(H,W+1)

INF = 10 ** 4
dist = np.zeros((H,W),dtype=np.int16)
# .のところは０それ以外はINFで初期化
dist[~black[1:-1,1:-1]] = INF
# 右、左、下、上と展開させていく感じ
for n in range(1,H):
    np.minimum(dist[n-1]+1,dist[n],out=dist[n])
for n in range(H-2,-1,-1):
    np.minimum(dist[n+1]+1,dist[n],out=dist[n])
for n in range(1,W):
    np.minimum(dist[:,n-1]+1,dist[:,n],out=dist[:,n])
for n in range(W-2,-1,-1):
    np.minimum(dist[:,n+1]+1,dist[:,n],out=dist[:,n])

print(dist.max())