Buggy python submission (verdict: Time Limit Exceeded):
H, W = map(int, input().split())
Map = []
for _ in range(H):
  List = list(input())
  Map.append(List)
L = [[0]*W for _ in range(H)]
D = [[0]*W for _ in range(H)]
R = [[0]*W for _ in range(H)]
U = [[0]*W for _ in range(H)]
for i in range(H):
  for j in range(W):
    if Map[i][j] == '#':
      L[i][j] = 0
    elif j == 0:
      L[i][j] = 1
    else:
      L[i][j] = L[i][j-1] + 1
for i in range(H):
  for j in range(W):
    if Map[i][j] == '#':
      D[i][j] = 0
    elif i == 0:
      D[i][j] = 1
    else:
      D[i][j] = D[i-1][j] + 1
for i in reversed(range(H)):
  for j in reversed(range(W)):
    if Map[i][j] == '#':
      R[i][j] = 0
    elif j == W - 1:
      R[i][j] = 1
    else:
      R[i][j] = R[i][j+1] + 1
for i in reversed(range(H)):
  for j in reversed(range(W)):
    if Map[i][j] == '#':
      U[i][j] = 0
    elif i == H - 1:
      U[i][j] = 1
    else:
      U[i][j] = U[i+1][j] + 1

Answer = 0
for i in range(H):
  for j in range(W):
    tmp = L[i][j] + R[i][j] + D[i][j] + U[i][j] -3
    if tmp > Answer:
      Answer = tmp
print(Answer)

Fixed submission:
import numpy as np
H,W = map(int,input().split())
Map=[list(input()) for h in range(H)]
Map=[[1 if s=='.' else 0 for s in Map[h]] for h in range(H)]
Map=np.array(Map,dtype=int)
L=Map.copy()
R=Map.copy()
U=Map.copy()
D=Map.copy()
for w in range(1,W):
    L[:,w]=(L[:,w-1]+1)*Map[:,w]
    R[:,-(1+w)]=(R[:,-w]+1)*Map[:,-(1+w)]
for h in range(1,H):
    U[h,:]=(U[h-1,:]+1)*Map[h,:]
    D[-(1+h),:]=(D[-h,:]+1)*Map[-(1+h),:]
print((L+R+U+D).max()-3)

Buggy python submission (verdict: Time Limit Exceeded):
H, W = map(int, input().split())
Map = []
for _ in range(H):
  List = list(input())
  Map.append(List)
points = [[0]*W for i in range(H)]
directions = [(1,0),(-1,0),(0,1),(0,-1)]
def countpoints(Map,i,j):
  ans = 1
  for direction in directions:
    p= i
    q = j
    while (0 <= p <= H-1) and (0 <= q <= W -1):
      p,q = p+direction[0],q+direction[1]
      if (p < 0 or H -1 < p) or (q < 0 or W-1 <q):
        break
      if Map[p][q] != '#':
        ans += 1
      else:
        break
  return ans
for i in range(H):
  for j in range(W):
    if Map[i][j] != '#':
      points[i][j] = countpoints(Map,i,j)
import numpy as np
results = np.array(points)
idx = np.unravel_index(np.argmax(results), results.shape)
print(results[idx])

Fixed submission:
import numpy as np
H,W = map(int,input().split())
Map=[list(input()) for h in range(H)]
Map=[[1 if s=='.' else 0 for s in Map[h]] for h in range(H)]
Map=np.array(Map,dtype=int)
L=Map.copy()
R=Map.copy()
U=Map.copy()
D=Map.copy()
for w in range(1,W):
    L[:,w]=(L[:,w-1]+1)*Map[:,w]
    R[:,-(1+w)]=(R[:,-w]+1)*Map[:,-(1+w)]
for h in range(1,H):
    U[h,:]=(U[h-1,:]+1)*Map[h,:]
    D[-(1+h),:]=(D[-h,:]+1)*Map[-(1+h),:]
print((L+R+U+D).max()-3)

Buggy python submission (verdict: Time Limit Exceeded):
H, W = map(int, input().split())
Map = []
for _ in range(H):
  List = list(input())
  Map.append(List)
points = [[0]*W for i in range(H)]
directions = [(1,0),(-1,0),(0,1),(0,-1)]
def countpoints(Map,i,j):
  ans = 1
  for direction in directions:
    p= i
    q = j
    while (0 <= p <= H-1) and (0 <= q <= W -1):
      p,q = p+direction[0],q+direction[1]
      if (p < 0 or H -1 < p) or (q < 0 or W-1 <q):
        break
      if Map[p][q] != '#':
        ans += 1
      else:
        break
  return ans
for i in range(H):
  for j in range(W):
    if Map[i][j] != '#':
      points[i][j] = countpoints(Map,i,j)
maxdata = []
for line in points:
  maxdata.append(max(line))
Answer = max(maxdata)
print(Answer)

Fixed submission:
import numpy as np
H,W = map(int,input().split())
Map=[list(input()) for h in range(H)]
Map=[[1 if s=='.' else 0 for s in Map[h]] for h in range(H)]
Map=np.array(Map,dtype=int)
L=Map.copy()
R=Map.copy()
U=Map.copy()
D=Map.copy()
for w in range(1,W):
    L[:,w]=(L[:,w-1]+1)*Map[:,w]
    R[:,-(1+w)]=(R[:,-w]+1)*Map[:,-(1+w)]
for h in range(1,H):
    U[h,:]=(U[h-1,:]+1)*Map[h,:]
    D[-(1+h),:]=(D[-h,:]+1)*Map[-(1+h),:]
print((L+R+U+D).max()-3)