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

S = [[0 for w in range(W)] for h in range(H)]
for h in range(H):
    l = input()
    for w in range(W):
        if l[w]=="#":
            S[h][w] = 0
        else:
            S[h][w] = 1

Sh = [[0 for w in range(W)] for h in range(H)]

for h in range(H):
    se = []
    cnt = 0
    for w,val in enumerate(S[h]):
        if val == 1:
            cnt += 1
            se.append(w)
        else:
            for ww in se:
                Sh[h][ww] = cnt
            cnt = 0
            se = []
    for ww in se:
        Sh[h][ww] = cnt

Sw = [[0 for w in range(W)] for h in range(H)]

for w in range(W):
    se = []
    cnt = 0
    for h in range(H):
        val = S[h][w]
        if val == 1:
            cnt += 1
            se.append(h)
        else:
            for hh in se:
                Sw[hh][w] = cnt
            cnt = 0
            se = []
    for hh in se:
        Sw[hh][w] = cnt


mx = 0
for h in range(H):
    for w in range(W):
        mx = max(Sh[h][w] + Sw[h][w], mx)

print(max((mx-1,0)))


Fixed submission:
H,W = map(int,input().split())
# H,W = 2000,2000

S = [[0 for w in range(W)] for h in range(H)]
for h in range(H):
    l = input()
    for w in range(W):
        if l[w]=="#":
            S[h][w] = 0
        else:
            S[h][w] = 1

Sh = [[0 for w in range(W)] for h in range(H)]

for h in range(H):
    se = []
    cnt = 0
    for w,val in enumerate(S[h]):
        if val == 1:
            cnt += 1
            se.append(w)
        else:
            for ww in se:
                Sh[h][ww] = cnt
            cnt = 0
            se = []
    for ww in se:
        Sh[h][ww] = cnt

Sw = [[0 for w in range(W)] for h in range(H)]

for w in range(W):
    se = []
    cnt = 0
    for h in range(H):
        val = S[h][w]
        if val == 1:
            cnt += 1
            se.append(h)
        else:
            for hh in se:
                Sw[hh][w] = cnt
            cnt = 0
            se = []
    for hh in se:
        Sw[hh][w] = cnt


mx = 0
for h in range(H):
    for w in range(W):
        mx = max(Sh[h][w] + Sw[h][w], mx)

print(max((mx-1,0)))

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
H,W = map(int,input().split())
# H,W = 2000,2000

S = np.zeros((H,W),dtype=np.int)
for h in range(H):
    l = input()
    for w in range(W):
        if l[w]=="#":
            S[h,w] = 0
        else:
            S[h,w] = 1

Sh = np.zeros((H,W),dtype=np.int)


for h in range(H):
    se = []
    cnt = 0
    for w,val in enumerate(S[h]):
        if val == 1:
            cnt += 1
            se.append(w)
        else:
            for ww in se:
                Sh[h,ww] = cnt
            cnt = 0
            se = []
    for ww in se:
        Sh[h,ww] = cnt

Sw = np.zeros((H,W),dtype=np.int)

for w in range(W):
    se = []
    cnt = 0
    for h,val in enumerate(S[:,w]):
        if val == 1:
            cnt += 1
            se.append(h)
        else:
            for hh in se:
                Sw[hh,w] = cnt
            cnt = 0
            se = []
    for hh in se:
        Sw[hh,w] = cnt


print(max((Sh+Sw).max()-1,0))


Fixed submission:
H,W = map(int,input().split())
# H,W = 2000,2000

S = [[0 for w in range(W)] for h in range(H)]
for h in range(H):
    l = input()
    for w in range(W):
        if l[w]=="#":
            S[h][w] = 0
        else:
            S[h][w] = 1

Sh = [[0 for w in range(W)] for h in range(H)]

for h in range(H):
    se = []
    cnt = 0
    for w,val in enumerate(S[h]):
        if val == 1:
            cnt += 1
            se.append(w)
        else:
            for ww in se:
                Sh[h][ww] = cnt
            cnt = 0
            se = []
    for ww in se:
        Sh[h][ww] = cnt

Sw = [[0 for w in range(W)] for h in range(H)]

for w in range(W):
    se = []
    cnt = 0
    for h in range(H):
        val = S[h][w]
        if val == 1:
            cnt += 1
            se.append(h)
        else:
            for hh in se:
                Sw[hh][w] = cnt
            cnt = 0
            se = []
    for hh in se:
        Sw[hh][w] = cnt


mx = 0
for h in range(H):
    for w in range(W):
        mx = max(Sh[h][w] + Sw[h][w], mx)

print(max((mx-1,0)))

Buggy python submission (verdict: Runtime Error):
import numpy as np
H,W = map(int,input().split())
# H,W = 2000,2000

S = np.zeros((H,W),dtype=np.int)
for h in range(H):
    l = input()
    for w in range(W):
        if l[w]=="#":
            S[h,w] = 0
        else:
            S[h,w] = 1

Sh = np.zeros((H,W),dtype=np.int)


for h in range(H):
    se = []
    cnt = 0
    for w,val in enumerate(S[h]):
        if val == 1:
            cnt += 1
            se.append(w)
        else:
            for ww in se:
                Sh[h,ww] = cnt
            cnt = 0
            se = []
    for ww in se:
        Sh[h,ww] = cnt

Sw = np.zeros((H,W),dtype=np.int)

for w in range(W):
    se = []
    cnt = 0
    for h,val in enumerate(S[:,w]):
        if val == 1:
            cnt += 1
            se.append(h)
        else:
            for hh in se:
                Sw[hh,w] = cnt
            cnt = 0
            se = []
    for hh in se:
        Sw[hh,w] = cnt


print(max((Sh+Sw).max()-1,0))


Fixed submission:
H,W = map(int,input().split())
# H,W = 2000,2000

S = [[0 for w in range(W)] for h in range(H)]
for h in range(H):
    l = input()
    for w in range(W):
        if l[w]=="#":
            S[h][w] = 0
        else:
            S[h][w] = 1

Sh = [[0 for w in range(W)] for h in range(H)]

for h in range(H):
    se = []
    cnt = 0
    for w,val in enumerate(S[h]):
        if val == 1:
            cnt += 1
            se.append(w)
        else:
            for ww in se:
                Sh[h][ww] = cnt
            cnt = 0
            se = []
    for ww in se:
        Sh[h][ww] = cnt

Sw = [[0 for w in range(W)] for h in range(H)]

for w in range(W):
    se = []
    cnt = 0
    for h in range(H):
        val = S[h][w]
        if val == 1:
            cnt += 1
            se.append(h)
        else:
            for hh in se:
                Sw[hh][w] = cnt
            cnt = 0
            se = []
    for hh in se:
        Sw[hh][w] = cnt


mx = 0
for h in range(H):
    for w in range(W):
        mx = max(Sh[h][w] + Sw[h][w], mx)

print(max((mx-1,0)))