Buggy python submission (verdict: Time Limit Exceeded):
H, W = map(int, input().split())

S = []
for i in range(H):
  S.append(list(input()))

dp = [[0] * W for h in range(H)]
dp1 = [[[0, 0] for w in range(W+1)] for h in range(H+1)]
for h in range(H):
  for w in range(W):
    if S[h][w] == '#':
      continue
    
    dp1[h+1][w+1] = [dp1[h][w+1][0]+1, dp1[h+1][w][1]+1]
    dp[h][w] = sum(dp1[h+1][w+1])


ans = 0
dp2 = [[[0, 0] for w in range(W+1)] for i in range(H+1)]
for h in range(H-1, -1, -1):
  for w in range(W-1, -1, -1):
    if S[h][w] == '#':
      continue

    dp2[h][w] = [dp2[h+1][w][0]+1, dp2[h][w+1][1]+1]
    dp[h][w] += sum(dp2[h][w])
    ans = max(ans, dp[h][w]-3)

print(ans)


Fixed submission:
import numpy as np

H, W = map(int, input().split())

S = np.ones([H+2, W+2], dtype=bool)
for h in range(H):
  S[h+1] = np.array(['.'] + list(input()) + ['.']) == '.'

dp1 = np.zeros([H+2, W+2, 2], dtype=int) # [up, left]
for h in range(H):
  dp1[h+1, :, 0] = (dp1[h, :, 0] + 1)*S[h+1]

for w in range(W):
  dp1[:, w+1, 1] = (dp1[:, w, 1] + 1)*S[:, w+1]

dp2 = np.zeros([H+2, W+2, 2], dtype=int) # [down, right]
for h in range(H, 0, -1):
  dp2[h, :, 0] = (dp2[h+1, :, 0] + 1)*S[h]

for w in range(W, 0, -1):
  dp2[:, w, 1] = (dp2[:, w+1, 1] + 1)*S[:, w]

print(np.max((np.sum(dp1, axis=2)+np.sum(dp2, axis=2))[1:-1, 1:-1])-3)

Buggy python submission (verdict: Time Limit Exceeded):
H, W = map(int, input().split())

S = []
for i in range(H):
  S.append(list(input()))

dp = [[0] * W for h in range(H)]
dp1 = [[[0, 0] for w in range(W+1)] for h in range(H+1)]
for h in range(H):
  for w in range(W):
    if S[h][w] == '#':
      continue
    
    dp1[h+1][w+1] = [dp1[h][w+1][0]+1, dp1[h+1][w][1]+1]
    dp[h][w] = sum(dp1[h+1][w+1])


ans = 0
dp2 = [[[0, 0] for w in range(W+1)] for i in range(H+1)]
for h in range(H-1, -1, -1):
  for w in range(W-1, -1, -1):
    if S[h][w] == '#':
      continue

    dp2[h][w] = [dp2[h+1][w][0]+1, dp2[h][w+1][1]+1]
    dp[h][w] += sum(dp2[h][w])
    ans = max(ans, dp[h][w]-3)

print(ans)

Fixed submission:
import numpy as np

H, W = map(int, input().split())

S = np.ones([H+2, W+2], dtype=bool)
for h in range(H):
  S[h+1] = np.array(['.'] + list(input()) + ['.']) == '.'

dp1 = np.zeros([H+2, W+2, 2], dtype=int) # [up, left]
for h in range(H):
  dp1[h+1, :, 0] = (dp1[h, :, 0] + 1)*S[h+1]

for w in range(W):
  dp1[:, w+1, 1] = (dp1[:, w, 1] + 1)*S[:, w+1]

dp2 = np.zeros([H+2, W+2, 2], dtype=int) # [down, right]
for h in range(H, 0, -1):
  dp2[h, :, 0] = (dp2[h+1, :, 0] + 1)*S[h]

for w in range(W, 0, -1):
  dp2[:, w, 1] = (dp2[:, w+1, 1] + 1)*S[:, w]

print(np.max((np.sum(dp1, axis=2)+np.sum(dp2, axis=2))[1:-1, 1:-1])-3)

Buggy python submission (verdict: Time Limit Exceeded):
H, W = map(int, input().split())

S = []
for i in range(H):
  S.append(list(input()))

dp = [[0] * W for h in range(H)]
dp1 = [[[0, 0] for w in range(W+1)] for h in range(H+1)]
for h in range(H):
  for w in range(W):
    if S[h][w] == '#':
      continue
    
    dp1[h+1][w+1] = [dp1[h][w+1][0]+1, dp1[h+1][w][1]+1]
    dp[h][w] = sum(dp1[h+1][w+1])


ans = 0
dp2 = [[[0, 0] for w in range(W+1)] for i in range(H+1)]
for h in range(H)[::-1]:
  for w in range(W)[::-1]:
    if S[h][w] == '#':
      continue

    dp2[h][w] = [dp2[h+1][w][0]+1, dp2[h][w+1][1]+1]
    dp[h][w] += sum(dp2[h][w])
    ans = max(ans, dp[h][w]-3)

print(ans)

Fixed submission:
import numpy as np

H, W = map(int, input().split())

S = np.ones([H+2, W+2], dtype=bool)
for h in range(H):
  S[h+1] = np.array(['.'] + list(input()) + ['.']) == '.'

dp1 = np.zeros([H+2, W+2, 2], dtype=int) # [up, left]
for h in range(H):
  dp1[h+1, :, 0] = (dp1[h, :, 0] + 1)*S[h+1]

for w in range(W):
  dp1[:, w+1, 1] = (dp1[:, w, 1] + 1)*S[:, w+1]

dp2 = np.zeros([H+2, W+2, 2], dtype=int) # [down, right]
for h in range(H, 0, -1):
  dp2[h, :, 0] = (dp2[h+1, :, 0] + 1)*S[h]

for w in range(W, 0, -1):
  dp2[:, w, 1] = (dp2[:, w+1, 1] + 1)*S[:, w]

print(np.max((np.sum(dp1, axis=2)+np.sum(dp2, axis=2))[1:-1, 1:-1])-3)

Buggy python submission (verdict: Time Limit Exceeded):
H, W = map(int, input().split())

S = []
for i in range(H):
  S.append(list(input()))

dp1 = [[[0, 0] for w in range(W+1)] for i in range(H+1)]
for h in range(1, H+1):
  for w in range(1, W+1):
    if S[h-1][w-1] == '#':
      continue
    
    dp1[h][w] = [dp1[h-1][w][0]+1, dp1[h][w-1][1]+1]


dp2 = [[[0, 0] for w in range(W+1)] for i in range(H+1)]
for h in range(H)[::-1]:
  for w in range(W)[::-1]:
    if S[h][w] == '#':
      continue

    dp2[h][w] = [dp2[h+1][w][0]+1, dp2[h][w+1][1]+1]

ans = 0
for h in range(H):
  for w in range(W):
    ans = max(sum(dp1[h+1][w+1] + dp2[h][w])-3, ans)

print(ans)


Fixed submission:
import numpy as np

H, W = map(int, input().split())

S = np.ones([H+2, W+2], dtype=bool)
for h in range(H):
  S[h+1] = np.array(['.'] + list(input()) + ['.']) == '.'

dp1 = np.zeros([H+2, W+2, 2], dtype=int) # [up, left]
for h in range(H):
  dp1[h+1, :, 0] = (dp1[h, :, 0] + 1)*S[h+1]

for w in range(W):
  dp1[:, w+1, 1] = (dp1[:, w, 1] + 1)*S[:, w+1]

dp2 = np.zeros([H+2, W+2, 2], dtype=int) # [down, right]
for h in range(H, 0, -1):
  dp2[h, :, 0] = (dp2[h+1, :, 0] + 1)*S[h]

for w in range(W, 0, -1):
  dp2[:, w, 1] = (dp2[:, w+1, 1] + 1)*S[:, w]

print(np.max((np.sum(dp1, axis=2)+np.sum(dp2, axis=2))[1:-1, 1:-1])-3)

Buggy python submission (verdict: Time Limit Exceeded):
H, W = map(int, input().split())

S = []
for i in range(H):
  S.append(list(input()))

dp1 = [[[0, 0] for w in range(W+1)] for i in range(H+1)]
for h in range(1, H+1):
  for w in range(1, W+1):
    if S[h-1][w-1] == '#':
      continue
    
    dp1[h][w] = [dp1[h-1][w][0]+1, dp1[h][w-1][1]+1]


dp2 = [[[0, 0] for w in range(W+1)] for i in range(H+1)]
for h in range(H)[::-1]:
  for w in range(W)[::-1]:
    if S[h][w] == '#':
      continue

    dp2[h][w] = [dp2[h+1][w][0]+1, dp2[h][w+1][1]+1]

ans = 0
for h in range(H):
  for w in range(W):
    ans = max(sum(dp1[h+1][w+1] + dp2[h][w])-3, ans)

print(ans)

Fixed submission:
import numpy as np

H, W = map(int, input().split())

S = np.ones([H+2, W+2], dtype=bool)
for h in range(H):
  S[h+1] = np.array(['.'] + list(input()) + ['.']) == '.'

dp1 = np.zeros([H+2, W+2, 2], dtype=int) # [up, left]
for h in range(H):
  dp1[h+1, :, 0] = (dp1[h, :, 0] + 1)*S[h+1]

for w in range(W):
  dp1[:, w+1, 1] = (dp1[:, w, 1] + 1)*S[:, w+1]

dp2 = np.zeros([H+2, W+2, 2], dtype=int) # [down, right]
for h in range(H, 0, -1):
  dp2[h, :, 0] = (dp2[h+1, :, 0] + 1)*S[h]

for w in range(W, 0, -1):
  dp2[:, w, 1] = (dp2[:, w+1, 1] + 1)*S[:, w]

print(np.max((np.sum(dp1, axis=2)+np.sum(dp2, axis=2))[1:-1, 1:-1])-3)