Buggy python submission (verdict: Time Limit Exceeded):
H,W = list(map(int, input().split()))
S = [[0 if s=='#' else 1 for s in input()] for _ in range(H)] #S[h][w]

SH = [[0]*W for _ in range(H)]
SH_ = [[0]*W for _ in range(H)]

SV = [[0]*W for _ in range(H)]
SV_ = [[0]*W for _ in range(H)]

#horizontal
for h in range(H):
  SH[h][0] = S[h][0]
  for w in range(1,W):
    if S[h][w]:
      SH[h][w] = SH[h][w-1] + 1
  
  SH_[h][-1] = S[h][-1]
  for w in range(W-1)[::-1]:
    if S[h][w]:
      SH_[h][w] = SH_[h][w+1] + 1
  

#vertical
for w in range(W):
  SV[0][w] = S[0][w]
  for h in range(1,H):
    if S[h][w]:
      SV[h][w] = SV[h-1][w] + 1
  
  SV_[-1][w] = S[-1][w]
  for h in range(H-1)[::-1]:
    if S[h][w]:
      SV_[h][w] = SV_[h+1][w] + 1

#print(SH + SH_)
#print(SV + SV_)

ans = 0
for h in range(H):
  for w in range(W):
    ans = max(ans, SH[h][w] + SH_[h][w] + SV[h][w] + SV_[h][w] -3)

print(ans)

Fixed submission:
H,W = list(map(int, input().split()))
S = [[0 if s=='#' else 1 for s in input()] for _ in range(H)] #S[h][w]

SH = [[0]*W for _ in range(H)]
SH_ = [[0]*W for _ in range(H)]

SV = [[0]*W for _ in range(H)]
SV_ = [[0]*W for _ in range(H)]

#horizontal
for h in range(H):
  SH[h][0] = S[h][0]
  for w in range(1,W):
    if S[h][w]:
      SH[h][w] = SH[h][w-1] + 1
  
  SH_[h][-1] = S[h][-1]
  for w in range(W-1)[::-1]:
    if S[h][w]:
      SH_[h][w] = SH_[h][w+1] + 1
  

#vertical
for w in range(W):
  SV[0][w] = S[0][w]
  for h in range(1,H):
    if S[h][w]:
      SV[h][w] = SV[h-1][w] + 1
  
  SV_[-1][w] = S[-1][w]
  for h in range(H-1)[::-1]:
    if S[h][w]:
      SV_[h][w] = SV_[h+1][w] + 1

#print(SH + SH_)
#print(SV + SV_)

ans = 0
for h in range(H):
  for w in range(W):
    ans = max(ans, SH[h][w] + SH_[h][w] + SV[h][w] + SV_[h][w] -3)

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
H,W = list(map(int, input().split()))
S = [[1 if s=='.' else 0 for s in input()] for _ in range(H)] #S[h][w]

import numpy as np
S = np.array(S)
#print(S)

SH = np.zeros((H,W), dtype='int')
SH_ = np.zeros((H,W), dtype='int')

SV = np.zeros((H,W), dtype='int')
SV_ = np.zeros((H,W), dtype='int')

#horizontal
for h in range(H):
  SH[h][0] = S[h][0]
  for w in range(1,W):
    if S[h][w]:
      SH[h][w] = SH[h][w-1] + 1
  
  SH_[h][-1] = S[h][-1]
  for w in range(W-1)[::-1]:
    if S[h][w]:
      SH_[h][w] = SH_[h][w+1] + 1
  

#vertical
for w in range(W):
  SV[0][w] = S[0][w]
  for h in range(1,H):
    if S[h][w]:
      SV[h][w] = SV[h-1][w] + 1
  
  SV_[-1][w] = S[-1][w]
  for h in range(H-1)[::-1]:
    if S[h][w]:
      SV_[h][w] = SV_[h+1][w] + 1

#print(SH + SH_)
#print(SV + SV_)

print(np.max(SH+SH_+SV+SV_) -3)

Fixed submission:
H,W = list(map(int, input().split()))
S = [[0 if s=='#' else 1 for s in input()] for _ in range(H)] #S[h][w]

SH = [[0]*W for _ in range(H)]
SH_ = [[0]*W for _ in range(H)]

SV = [[0]*W for _ in range(H)]
SV_ = [[0]*W for _ in range(H)]

#horizontal
for h in range(H):
  SH[h][0] = S[h][0]
  for w in range(1,W):
    if S[h][w]:
      SH[h][w] = SH[h][w-1] + 1
  
  SH_[h][-1] = S[h][-1]
  for w in range(W-1)[::-1]:
    if S[h][w]:
      SH_[h][w] = SH_[h][w+1] + 1
  

#vertical
for w in range(W):
  SV[0][w] = S[0][w]
  for h in range(1,H):
    if S[h][w]:
      SV[h][w] = SV[h-1][w] + 1
  
  SV_[-1][w] = S[-1][w]
  for h in range(H-1)[::-1]:
    if S[h][w]:
      SV_[h][w] = SV_[h+1][w] + 1

#print(SH + SH_)
#print(SV + SV_)

ans = 0
for h in range(H):
  for w in range(W):
    ans = max(ans, SH[h][w] + SH_[h][w] + SV[h][w] + SV_[h][w] -3)

print(ans)