Buggy python submission (verdict: Time Limit Exceeded):
h,w = map(int, input().split())
a = [list(input()) for _ in range(h)]
s = [[0]*w for i in range(h)]
for i in range(h):
    count = 0
    for j in range(w):
        if (a[i][j]=='.'):
            count += 1
            
        else:
            for k in range(j-1,j-count-1,-1):
                s[i][k]=count
            count = 0
    for k in range(w-1,w-count-1,-1):
        s[i][k]=count
    count = 0

t = [[0]*w for i in range(h)]
for i in range(w):
    count = 0
    for j in range(h):
        if (a[j][i]=='.'):
            count += 1
            
        else:
            for k in range(j-1,j-count-1,-1):
                t[k][i]=count
            count = 0
    for k in range(h-1,h-count-1,-1):
        t[k][i]=count
    count = 0

ans = 0
for i in range(h):
    for j in range(w):
        if (s[i][j]!=0):
            if (s[i][j]+t[i][j]-1 > ans):
                ans = s[i][j]+t[i][j]-1
print(ans)

Fixed submission:
h,w = map(int, input().split())
a = [list(input()) for _ in range(h)]
s = [[0]*w for i in range(h)]
for i in range(h):
    count = 0
    for j in range(w):
        if (a[i][j]=='.'):
            count += 1
            
        else:
            for k in range(j-1,j-count-1,-1):
                s[i][k]=count
            count = 0
    for k in range(w-1,w-count-1,-1):
        s[i][k]=count
    count = 0

t = [[0]*w for i in range(h)]
for i in range(w):
    count = 0
    for j in range(h):
        if (a[j][i]=='.'):
            count += 1
            
        else:
            for k in range(j-1,j-count-1,-1):
                t[k][i]=count
            count = 0
    for k in range(h-1,h-count-1,-1):
        t[k][i]=count
    count = 0

ans = 0
for i in range(h):
    for j in range(w):
        if (s[i][j]!=0):
            if (s[i][j]+t[i][j]-1 > ans):
                ans = s[i][j]+t[i][j]-1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import copy
h,w = map(int, input().split())
s = [list(input()) for _ in range(h)]
t = copy.deepcopy(s)
for i in range(h):
    count = 0
    for j in range(w):
        if (s[i][j]=='.'):
            count += 1
            
        else:
            for k in range(j-1,j-count-1,-1):
                s[i][k]=count
            count = 0
    for k in range(w-1,w-count-1,-1):
        s[i][k]=count
    count = 0

for i in range(w):
    count = 0
    for j in range(h):
        if (t[j][i]=='.'):
            count += 1
            
        else:
            for k in range(j-1,j-count-1,-1):
                t[k][i]=count
            count = 0
    for k in range(h-1,h-count-1,-1):
        t[k][i]=count
    count = 0

ans = 0
for i in range(h):
    for j in range(w):
        if (s[i][j]!="#"):
            if (s[i][j]+t[i][j]-1 > ans):
                ans = s[i][j]+t[i][j]-1
print(ans)

Fixed submission:
h,w = map(int, input().split())
a = [list(input()) for _ in range(h)]
s = [[0]*w for i in range(h)]
for i in range(h):
    count = 0
    for j in range(w):
        if (a[i][j]=='.'):
            count += 1
            
        else:
            for k in range(j-1,j-count-1,-1):
                s[i][k]=count
            count = 0
    for k in range(w-1,w-count-1,-1):
        s[i][k]=count
    count = 0

t = [[0]*w for i in range(h)]
for i in range(w):
    count = 0
    for j in range(h):
        if (a[j][i]=='.'):
            count += 1
            
        else:
            for k in range(j-1,j-count-1,-1):
                t[k][i]=count
            count = 0
    for k in range(h-1,h-count-1,-1):
        t[k][i]=count
    count = 0

ans = 0
for i in range(h):
    for j in range(w):
        if (s[i][j]!=0):
            if (s[i][j]+t[i][j]-1 > ans):
                ans = s[i][j]+t[i][j]-1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import copy
h,w = map(int, input().split())
s = [list(input()) for _ in range(h)]
t = copy.deepcopy(s)
for i in range(h):
    count = 0
    for j in range(w):
        if (s[i][j]=='.'):
            count += 1
            
        else:
            for k in range(j-1,j-count-1,-1):
                s[i][k]=count
            count = 0
    for k in range(w-1,w-count-1,-1):
        s[i][k]=count
    count = 0

for i in range(w):
    count = 0
    for j in range(h):
        if (t[j][i]=='.'):
            count += 1
            
        else:
            for k in range(j-1,j-count-1,-1):
                t[k][i]=count
            count = 0
    for k in range(h-1,h-count-1,-1):
        t[k][i]=count
    count = 0

ans = 0
for i in range(h):
    for j in range(w):
        if (s[i][j]!="#"):
            if (s[i][j]+t[i][j]-1 > ans):
                ans = s[i][j]+t[i][j]-1
print(ans)

Fixed submission:
h,w = map(int, input().split())
a = [list(input()) for _ in range(h)]
s = [[0]*w for i in range(h)]
for i in range(h):
    count = 0
    for j in range(w):
        if (a[i][j]=='.'):
            count += 1
            
        else:
            for k in range(j-1,j-count-1,-1):
                s[i][k]=count
            count = 0
    for k in range(w-1,w-count-1,-1):
        s[i][k]=count
    count = 0

t = [[0]*w for i in range(h)]
for i in range(w):
    count = 0
    for j in range(h):
        if (a[j][i]=='.'):
            count += 1
            
        else:
            for k in range(j-1,j-count-1,-1):
                t[k][i]=count
            count = 0
    for k in range(h-1,h-count-1,-1):
        t[k][i]=count
    count = 0

ans = 0
for i in range(h):
    for j in range(w):
        if (s[i][j]!=0):
            if (s[i][j]+t[i][j]-1 > ans):
                ans = s[i][j]+t[i][j]-1
print(ans)