Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

def main():
    H, W = map(int, input().split())
    s = [list(input().strip()) for i in range(H)]

    left = [[0] * W for i in range(H)]
    right = [[0] * W for i in range(H)]
    up = [[0] * W for i in range(H)]
    down = [[0] * W for i in range(H)]

    for i in range(H):
        count = 0
        for j in range(W):
            if s[i][j] == ".":
                count += 1
                left[i][j] = count
            else:
                count = 0
                left[i][j] = count
        count = 0
        for j in range(W-1, -1, -1):
            if s[i][j] == ".":
                count += 1
                right[i][j] = count
            else:
                count = 0
                right[i][j] = count

    for j in range(W):
        count = 0
        for i in range(H):
            if s[i][j] == ".":
                count += 1
                down[i][j] = count
            else:
                count = 0
                down[i][j] = count
        count = 0
        for i in range(H-1, -1, -1):
            if s[i][j] == ".":
                count += 1
                up[i][j] = count
            else:
                count = 0
                up[i][j] = count
    
    ans = 0
    for i in range(H):
        for j in range(W):
            ans = max(ans, left[i][j] + right[i][j] + up[i][j] + down[i][j] - 3)
    print(ans)


if __name__ == "__main__":
    main()

Fixed submission:
import numpy as np

h, w = map(int, input().split())

up = np.zeros((h, w), dtype=int)
down = np.zeros((h, w), dtype=int)
right = np.zeros((h, w), dtype=int)
left = np.zeros((h, w), dtype=int)

map = np.array([list(input()) for i in range(h)]) == "."

for i in range(1, h):
    up[i] = (up[i-1] + 1) * map[i-1]
    down[h-1-i] = (down[h-i] + 1) * map[h-i]
for j in range(1, w):
    left[:,j] = (left[:,j-1] + 1) * map[:,j-1]
    right[:,w-1-j] = (right[:,w-j] + 1) * map[:,w-j]

print(((up+down+right+left+1) * map).max())

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

row = [[[-1,-1] for i in range(w)] for j in range(h)]
col = [[[-1,-1] for i in range(w)] for j in range(h)]

for i in range(h):
    tmp = input()
    count_l = 0
    count_r = 0
    for j in range(w):
        if tmp[j] == ".":
            row[i][j][0] = count_l
            count_l += 1
        else:
            count_l = 0
        if tmp[w-1-j] == ".":
            row[i][w-1-j][1] = count_r
            count_r += 1
        else:
            count_r = 0

for j in range(w):
    count_u = 0
    count_d = 0
    for i in range(h):
        if row[i][j][0] >= 0:
            col[i][j][0] = count_u
            count_u += 1
        else:
            count_u = 0
        if row[h-1-i][j][0] >= 0:
            col[h-1-i][j][1] = count_d
            count_d += 1
        else:
            count_d = 0

ans = 0
for i in range(h):
    for j in range(w):
        ans = max(ans, row[i][j][0] + row[i][j][1] + col[i][j][0] + col[i][j][1] + 1)

print(ans)


Fixed submission:
import numpy as np

h, w = map(int, input().split())

up = np.zeros((h, w), dtype=int)
down = np.zeros((h, w), dtype=int)
right = np.zeros((h, w), dtype=int)
left = np.zeros((h, w), dtype=int)

map = np.array([list(input()) for i in range(h)]) == "."

for i in range(1, h):
    up[i] = (up[i-1] + 1) * map[i-1]
    down[h-1-i] = (down[h-i] + 1) * map[h-i]
for j in range(1, w):
    left[:,j] = (left[:,j-1] + 1) * map[:,j-1]
    right[:,w-1-j] = (right[:,w-j] + 1) * map[:,w-j]

print(((up+down+right+left+1) * map).max())