Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10000)

import numpy as np

h,w = map(int,input().split())
s = []

for i in range(h):
    s.append(list(input()))

from collections import deque

def bfs(i,j,dist):
    seen[i][j] = dist
    lis = [[i-1,j],[i,j-1],[i+1,j],[i,j+1]]
    for place in lis:
        if place[0]<0 or place[0]>=h or place[1]<0 or place[1]>=w:
            continue
        if seen[place[0]][place[1]] != -1 or s[place[0]][place[1]]=="#":
            continue
        que.append([place[0],place[1],dist+1])
    if len(que):
        new = que.popleft()
        bfs(new[0],new[1],new[2])
    else:
        return


mx = 0
for i in range(h):
    for  j in range(w):
        if s[i][j]=="#":
            continue
        seen = [[-1 for _ in range(w)]for _ in range(h)]
        que = deque()
        bfs(i,j,0)
        ast = np.array(seen)
        tmp = np.amax(ast)
        mx = max(mx,tmp)
        #print(seen)
            #print(*seen,sep="\n")
print(mx)


Fixed submission:
import sys
sys.setrecursionlimit(3000)

import numpy as np

h,w = map(int,input().split())
s = []

for i in range(h):
    s.append(list(input()))

from collections import deque

def bfs(i,j,dist):
    seen[i][j] = dist
    lis = [[i-1,j],[i,j-1],[i+1,j],[i,j+1]]
    for place in lis:
        if place[0]<0 or place[0]>=h or place[1]<0 or place[1]>=w:
            continue
        if seen[place[0]][place[1]] != -1 or s[place[0]][place[1]]=="#":
            continue
        if [place[0],place[1],dist+1] in que:
            continue
        que.append([place[0],place[1],dist+1])
    if len(que):
        new = que.popleft()
        bfs(new[0],new[1],new[2])
    else:
        return


mx = 0
for i in range(h):
    for  j in range(w):
        if s[i][j]=="#":
            continue
        seen = [[-1 for _ in range(w)]for _ in range(h)]
        que = deque()
        bfs(i,j,0)
        ast = np.array(seen)
        tmp = np.amax(ast)
        mx = max(mx,tmp)
        #print(seen)
            #print(*seen,sep="\n")
print(mx)

Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(2000)
h,w = map(int,input().split())
s = []

for i in range(h):
    s.append(list(input()))

from collections import deque

def bfs(i,j,dist):
    seen[i][j] = dist
    lis = [[i-1,j],[i,j-1],[i+1,j],[i,j+1]]
    for place in lis:
        if place[0]<0 or place[0]>=h or place[1]<0 or place[1]>=w:
            continue
        if seen[place[0]][place[1]] != -1 or s[place[0]][place[1]]=="#":
            continue
        que.append([place[0],place[1],dist+1])
    if len(que):
        new = que.popleft()
        bfs(new[0],new[1],new[2])
    else:
        return


mx = 0
for i in range(h):
    for  j in range(w):
        if s[i][j]=="#":
            continue
        seen = [[-1 for _ in range(w)]for _ in range(h)]
        que = deque()
        bfs(i,j,0)
        mx = max(mx,max(max(seen)))
        #print(seen)
#print(seen)
print(mx)


Fixed submission:
import sys
sys.setrecursionlimit(3000)

import numpy as np

h,w = map(int,input().split())
s = []

for i in range(h):
    s.append(list(input()))

from collections import deque

def bfs(i,j,dist):
    seen[i][j] = dist
    lis = [[i-1,j],[i,j-1],[i+1,j],[i,j+1]]
    for place in lis:
        if place[0]<0 or place[0]>=h or place[1]<0 or place[1]>=w:
            continue
        if seen[place[0]][place[1]] != -1 or s[place[0]][place[1]]=="#":
            continue
        if [place[0],place[1],dist+1] in que:
            continue
        que.append([place[0],place[1],dist+1])
    if len(que):
        new = que.popleft()
        bfs(new[0],new[1],new[2])
    else:
        return


mx = 0
for i in range(h):
    for  j in range(w):
        if s[i][j]=="#":
            continue
        seen = [[-1 for _ in range(w)]for _ in range(h)]
        que = deque()
        bfs(i,j,0)
        ast = np.array(seen)
        tmp = np.amax(ast)
        mx = max(mx,tmp)
        #print(seen)
            #print(*seen,sep="\n")
print(mx)

Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(2000)
h,w = map(int,input().split())
s = []

for i in range(h):
    s.append(list(input()))

from collections import deque

def bfs(i,j,dist):
    seen[i][j] = dist
    lis = [[i-1,j],[i,j-1],[i+1,j],[i,j+1]]
    for place in lis:
        if place[0]<0 or place[0]>=h or place[1]<0 or place[1]>=w:
            continue
        if seen[place[0]][place[1]] != -1 or s[place[0]][place[1]]=="#":
            continue
        que.append([place[0],place[1],dist+1])
    if len(que):
        new = que.popleft()
        bfs(new[0],new[1],new[2])
    else:
        return


mx = 0
for i in range(h):
    for  j in range(w):
        if s[i][j]=="#":
            continue
        seen = [[-1 for _ in range(w)]for _ in range(h)]
        que = deque()
        bfs(i,j,0)
        mx = max(mx,max(max(seen)))
        print(seen)
#print(seen)
print(mx)


Fixed submission:
import sys
sys.setrecursionlimit(3000)

import numpy as np

h,w = map(int,input().split())
s = []

for i in range(h):
    s.append(list(input()))

from collections import deque

def bfs(i,j,dist):
    seen[i][j] = dist
    lis = [[i-1,j],[i,j-1],[i+1,j],[i,j+1]]
    for place in lis:
        if place[0]<0 or place[0]>=h or place[1]<0 or place[1]>=w:
            continue
        if seen[place[0]][place[1]] != -1 or s[place[0]][place[1]]=="#":
            continue
        if [place[0],place[1],dist+1] in que:
            continue
        que.append([place[0],place[1],dist+1])
    if len(que):
        new = que.popleft()
        bfs(new[0],new[1],new[2])
    else:
        return


mx = 0
for i in range(h):
    for  j in range(w):
        if s[i][j]=="#":
            continue
        seen = [[-1 for _ in range(w)]for _ in range(h)]
        que = deque()
        bfs(i,j,0)
        ast = np.array(seen)
        tmp = np.amax(ast)
        mx = max(mx,tmp)
        #print(seen)
            #print(*seen,sep="\n")
print(mx)