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

h, w = map(int, input().split())
S = list(list(input()) for _ in range(h))
S = np.array(S)

def get_dp(d, width, height):
  pos = np.array([[i for i in range(width)]]*height)
  obs_pos = []
  for i in range(height):
    obs_pos.append(pos[i][d[i]=='#'].tolist()+[width])
  dp = np.zeros_like(d, dtype=int)
  for y in range(height):
    s = 0
    for p in obs_pos[y]:
      dp[y][s:p] = p-s
      s = p+1
  return dp

dp_row = get_dp(S, w, h)
dp_col = get_dp(S.T, h, w)
print((dp_row+dp_col.T).max() - 1)

Fixed submission:
import numpy as np

h, w = map(int, input().split())
S = list(list(input()) for _ in range(h))
S = np.array(S)
S_int = np.zeros_like(S, dtype=int)
S_int[S=='.'] = 1

def getLR(d, width, height):
  L = np.zeros_like(d)
  R = L.copy()
  L[:][0] = 0
  R[:][-1] = 0
  for i in range(1, width):
    ridx = width - 1 - i
    L[:,i] = d[:,i] * (L[:,i-1] + d[:,i-1])
    R[:,ridx] = d[:,ridx] * (R[:,ridx+1] + d[:,ridx+1])
  return L, R

L, R = getLR(S_int, w, h)
U, D = getLR(S_int.T, h, w)
print((L+R+U.T+D.T).max() + 1)

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

h, w = map(int, input().split())
S = list(list(input()) for _ in range(h))
S = np.array(S)
data = np.zeros_like(S, dtype=int)
data[S=='.'] = 1

def get_dp(d, width):
  dp = d.copy()
  for i, row in enumerate(d):
    for j in range(1, width):
      val = row[j]
      if val > 0:
        n = dp[i][j-1]
        dp[i][j] += n
        dp[i, j-n:j] += 1
  return dp

dp_row = get_dp(data, w)
dp_col = get_dp(data.T, h)
print((dp_row+dp_col.T).max() - 1)

Fixed submission:
import numpy as np

h, w = map(int, input().split())
S = list(list(input()) for _ in range(h))
S = np.array(S)
S_int = np.zeros_like(S, dtype=int)
S_int[S=='.'] = 1

def getLR(d, width, height):
  L = np.zeros_like(d)
  R = L.copy()
  L[:][0] = 0
  R[:][-1] = 0
  for i in range(1, width):
    ridx = width - 1 - i
    L[:,i] = d[:,i] * (L[:,i-1] + d[:,i-1])
    R[:,ridx] = d[:,ridx] * (R[:,ridx+1] + d[:,ridx+1])
  return L, R

L, R = getLR(S_int, w, h)
U, D = getLR(S_int.T, h, w)
print((L+R+U.T+D.T).max() + 1)

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

h, w = map(int, input().split())
S = [str(input()) for _ in range(h)]
data = []
for s in S:
  row = []
  for c in s:
    row.append(1 if c=='.' else 0)
  data.append(row)
data = np.array(data, dtype=int)

def get_dp(d, width):
  dp = d.copy()
  for i, row in enumerate(d):
    for j in range(1, width):
      val = row[j]
      if val > 0:
        n = dp[i][j-1]
        dp[i][j] += n
        for k in range(n):
          dp[i][j-k-1] += 1
  return dp

dp_row = get_dp(data, w)
dp_col = get_dp(data.T, h)
print((dp_row+dp_col.T).max() - 1)

Fixed submission:
import numpy as np

h, w = map(int, input().split())
S = list(list(input()) for _ in range(h))
S = np.array(S)
S_int = np.zeros_like(S, dtype=int)
S_int[S=='.'] = 1

def getLR(d, width, height):
  L = np.zeros_like(d)
  R = L.copy()
  L[:][0] = 0
  R[:][-1] = 0
  for i in range(1, width):
    ridx = width - 1 - i
    L[:,i] = d[:,i] * (L[:,i-1] + d[:,i-1])
    R[:,ridx] = d[:,ridx] * (R[:,ridx+1] + d[:,ridx+1])
  return L, R

L, R = getLR(S_int, w, h)
U, D = getLR(S_int.T, h, w)
print((L+R+U.T+D.T).max() + 1)