Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
H,W = map(int,input().split())
S = [list(input()) for i in range(H)]
G_jouge = []
G_sayu = []
for h in range(H):
    G_migi = []
    G_hidari = []
    r = 0
    l = 0
    for w in range(W):
        if S[h][w] == '.':
            G_migi.append(r)
            r += 1
        else:
            r = 0
            G_migi.append(r)
        if S[h][W-1-w] == '.':
            G_hidari.append(l)
            l += 1
        else:
            l = 0
            G_hidari.append(l)
    G_sayu.append([G_hidari[W-1-i]+G_migi[i] for i in range(W)])
for w in range(W):
    G_migi = []
    G_hidari = []
    r = 0
    l = 0
    for h in range(H):
        if S[h][w] == '.':
            G_migi.append(r)
            r += 1
        else:
            r = 0
            G_migi.append(r)
        if S[H-1-h][w] == '.':
            G_hidari.append(l)
            l += 1
        else:
            l = 0
            G_hidari.append(l)
    G_jouge.append([G_hidari[H-1-i]+G_migi[i] for i in range(H)])

ans = 0
for h in range(H):
    for w in range(W):
        ans = max(ans,G_sayu[h][w]+G_jouge[w][h])
print(ans+1)


Fixed submission:
H,W = map(int,input().split())
S = [list(input()) for i in range(H)]

G_jouge = []
G_sayu = []
for h in range(H):
    G_migi = []
    G_hidari = []
    r = 0
    l = 0
    for w in range(W):
        if S[h][w] == '.':
            G_migi.append(r)
            r += 1
        else:
            r = 0
            G_migi.append(r)
        if S[h][W-1-w] == '.':
            G_hidari.append(l)
            l += 1
        else:
            l = 0
            G_hidari.append(l)
    G_sayu.append([G_hidari[W-1-i]+G_migi[i] for i in range(W)])
for w in range(W):
    G_migi = []
    G_hidari = []
    r = 0
    l = 0
    for h in range(H):
        if S[h][w] == '.':
            G_migi.append(r)
            r += 1
        else:
            r = 0
            G_migi.append(r)
        if S[H-1-h][w] == '.':
            G_hidari.append(l)
            l += 1
        else:
            l = 0
            G_hidari.append(l)
    G_jouge.append([G_hidari[H-1-i]+G_migi[i] for i in range(H)])

ans = 0
for h in range(H):
    for w in range(W):
        ans = max(ans,G_sayu[h][w]+G_jouge[w][h])
print(ans+1)

Buggy python submission (verdict: Runtime Error):
N = int(input())
W = list(map(int,input().split()))
R = [W[0]]
for i in range(1,N):
    R.append(R[i-1] + W[i])
s = sum(W)

ans = 1000

for i in range(N):
    ans = min(ans,abs(R[i]-(s-R[i])))
print(ans)
"""

"""
H,W = map(int,input().split())
S = [list(input()) for i in range(H)]

G_jouge = []
G_sayu = []
for h in range(H):
    G_migi = []
    G_hidari = []
    r = 0
    l = 0
    for w in range(W):
        if S[h][w] == '.':
            G_migi.append(r)
            r += 1
        else:
            r = 0
            G_migi.append(r)
        if S[h][W-1-w] == '.':
            G_hidari.append(l)
            l += 1
        else:
            l = 0
            G_hidari.append(l)
    G_sayu.append([G_hidari[W-1-i]+G_migi[i] for i in range(W)])
for w in range(W):
    G_migi = []
    G_hidari = []
    r = 0
    l = 0
    for h in range(H):
        if S[h][w] == '.':
            G_migi.append(r)
            r += 1
        else:
            r = 0
            G_migi.append(r)
        if S[H-1-h][w] == '.':
            G_hidari.append(l)
            l += 1
        else:
            l = 0
            G_hidari.append(l)
    G_jouge.append([G_hidari[H-1-i]+G_migi[i] for i in range(H)])

ans = 0
for h in range(H):
    for w in range(W):
        ans = max(ans,G_sayu[h][w]+G_jouge[w][h])
print(ans+1)

Fixed submission:
H,W = map(int,input().split())
S = [list(input()) for i in range(H)]

G_jouge = []
G_sayu = []
for h in range(H):
    G_migi = []
    G_hidari = []
    r = 0
    l = 0
    for w in range(W):
        if S[h][w] == '.':
            G_migi.append(r)
            r += 1
        else:
            r = 0
            G_migi.append(r)
        if S[h][W-1-w] == '.':
            G_hidari.append(l)
            l += 1
        else:
            l = 0
            G_hidari.append(l)
    G_sayu.append([G_hidari[W-1-i]+G_migi[i] for i in range(W)])
for w in range(W):
    G_migi = []
    G_hidari = []
    r = 0
    l = 0
    for h in range(H):
        if S[h][w] == '.':
            G_migi.append(r)
            r += 1
        else:
            r = 0
            G_migi.append(r)
        if S[H-1-h][w] == '.':
            G_hidari.append(l)
            l += 1
        else:
            l = 0
            G_hidari.append(l)
    G_jouge.append([G_hidari[H-1-i]+G_migi[i] for i in range(H)])

ans = 0
for h in range(H):
    for w in range(W):
        ans = max(ans,G_sayu[h][w]+G_jouge[w][h])
print(ans+1)