Buggy python submission (verdict: Time Limit Exceeded):

import sys
sys.setrecursionlimit(10**6)

#n=int(input())
#n,m=list(map(int,input().split()))
#a=list(map(int,input().split()))
input_list = lambda : list(map(int,input().split()))

h,w=input_list()
a=[[s for s in  input()] for _ in range(h)]

l=[[0 for _ in range(w)] for _ in range(h)]
r=[[0 for _ in range(w)] for _ in range(h)]
u=[[0 for _ in range(w)] for _ in range(h)]
d=[[0 for _ in range(w)] for _ in range(h)]
#left
for w_i in range(1,w):
    for h_i in range(h):

        if a[h_i][w_i]=="#" or a[h_i][w_i-1]=="#":
            continue
        l[h_i][w_i]=l[h_i][w_i-1]+1
    
#right
for w_i in range(w-2,-1,-1):
    for h_i in range(h):

        if a[h_i][w_i]=="#" or a[h_i][w_i+1]=="#":
            continue
        r[h_i][w_i]=r[h_i][w_i+1]+1


#up
for w_i in range(w):
    for h_i in range(1,h):

        if a[h_i][w_i]=="#" or a[h_i-1][w_i]=="#":
            continue
        u[h_i][w_i]=u[h_i-1][w_i]+1


#down
for w_i in range(w):
    for h_i in range(h-2,-1,-1):

        if a[h_i][w_i]=="#" or a[h_i+1][w_i]=="#":
            continue
        d[h_i][w_i]=d[h_i+1][w_i]+1
ans=0
for w_i in range(w):
    for h_i in range(h):
        if a[h_i][w_i]=="#":
            continue
        cal=l[h_i][w_i]+r[h_i][w_i]+u[h_i][w_i]+d[h_i][w_i]+1
        ans=max(ans,cal)

print(ans)



Fixed submission:
#import numpy as np
h,w=list(map(int,input().split()))
s=[[i for i in input() ] for _ in range(h)]

l=[[1 if s[h_i][w_i]=="." else 0 for w_i in range(w)] for h_i in range(h)]
r=[[1 if s[h_i][w_i]=="." else 0 for w_i in range(w)] for h_i in range(h)]
u=[[1 if s[h_i][w_i]=="." else 0 for w_i in range(w)] for h_i in range(h)]
d=[[1 if s[h_i][w_i]=="." else 0 for w_i in range(w)] for h_i in range(h)]
for h_i in range(h):
    for w_i in range(w):
        rev_w=w-w_i-1
        rev_h=h-h_i-1
        if s[h_i][w_i]!="#" and w_i!=0:
            l[h_i][w_i]+=l[h_i][w_i-1]
        if s[h_i][rev_w]!="#" and w_i!=0:
            r[h_i][rev_w]+=r[h_i][rev_w+1]
        if s[h_i][w_i]!="#" and h_i!=0:
            u[h_i][w_i]+=u[h_i-1][w_i]
        if s[rev_h][w_i]!="#" and h_i!=0:
            d[rev_h][w_i]+=d[rev_h+1][w_i]
ans=0
for h_i in range(h):
    for w_i in range(w):
        tmp=l[h_i][w_i]+r[h_i][w_i]+u[h_i][w_i]+d[h_i][w_i]-3
        ans=max(ans,tmp)

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter 
from collections import defaultdict
from collections import deque
import math
import itertools
import heapq
import numpy as np
import sys
sys.setrecursionlimit(10**6)

#n=int(input())
#n,m=list(map(int,input().split()))
#a=list(map(int,input().split()))
input_list = lambda : list(map(int,input().split()))

h,w=input_list()
a=[[s for s in  input()] for _ in range(h)]

l=[[0 for _ in range(w)] for _ in range(h)]
r=[[0 for _ in range(w)] for _ in range(h)]
u=[[0 for _ in range(w)] for _ in range(h)]
d=[[0 for _ in range(w)] for _ in range(h)]

a=np.array(a)
l=np.array(l)
r=np.array(r)
u=np.array(u)
d=np.array(d)
#left
for w_i in range(1,w):
    for h_i in range(h):

        if a[h_i][w_i]=="#" or a[h_i][w_i-1]=="#":
            continue
        l[h_i][w_i]=l[h_i][w_i-1]+1
    
#right
for w_i in range(w-2,-1,-1):
    for h_i in range(h):

        if a[h_i][w_i]=="#" or a[h_i][w_i+1]=="#":
            continue
        r[h_i][w_i]=r[h_i][w_i+1]+1


#up
for w_i in range(w):
    for h_i in range(1,h):

        if a[h_i][w_i]=="#" or a[h_i-1][w_i]=="#":
            continue
        u[h_i][w_i]=u[h_i-1][w_i]+1


#down
for w_i in range(w):
    for h_i in range(h-2,-1,-1):

        if a[h_i][w_i]=="#" or a[h_i+1][w_i]=="#":
            continue
        d[h_i][w_i]=d[h_i+1][w_i]+1
ans=0
for w_i in range(w):
    for h_i in range(h):
        if a[h_i][w_i]=="#":
            continue
        cal=l[h_i][w_i]+r[h_i][w_i]+u[h_i][w_i]+d[h_i][w_i]+1
        ans=max(ans,cal)

print(ans)



Fixed submission:
#import numpy as np
h,w=list(map(int,input().split()))
s=[[i for i in input() ] for _ in range(h)]

l=[[1 if s[h_i][w_i]=="." else 0 for w_i in range(w)] for h_i in range(h)]
r=[[1 if s[h_i][w_i]=="." else 0 for w_i in range(w)] for h_i in range(h)]
u=[[1 if s[h_i][w_i]=="." else 0 for w_i in range(w)] for h_i in range(h)]
d=[[1 if s[h_i][w_i]=="." else 0 for w_i in range(w)] for h_i in range(h)]
for h_i in range(h):
    for w_i in range(w):
        rev_w=w-w_i-1
        rev_h=h-h_i-1
        if s[h_i][w_i]!="#" and w_i!=0:
            l[h_i][w_i]+=l[h_i][w_i-1]
        if s[h_i][rev_w]!="#" and w_i!=0:
            r[h_i][rev_w]+=r[h_i][rev_w+1]
        if s[h_i][w_i]!="#" and h_i!=0:
            u[h_i][w_i]+=u[h_i-1][w_i]
        if s[rev_h][w_i]!="#" and h_i!=0:
            d[rev_h][w_i]+=d[rev_h+1][w_i]
ans=0
for h_i in range(h):
    for w_i in range(w):
        tmp=l[h_i][w_i]+r[h_i][w_i]+u[h_i][w_i]+d[h_i][w_i]-3
        ans=max(ans,tmp)

print(ans)