Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
#from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi
#from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [LI()for i in range(n)]
inf = 10**17
mod = 10**9 + 7

h,w=MI()
mat1 =[[] for i in range(h)]
mat2 =[[0 for j in range(w)] for i in range(h)]
mat3 =[[0 for j in range(w)] for i in range(h)]
mat4 =[[0 for j in range(w)] for i in range(h)]
mat5 =[[0 for j in range(w)] for i in range(h)]


for i in range(h):
    s=input().rstrip()
    for j in range(w):
        mat1[i].append(s[j])
#print(mat1)

for i in range(h):
    for j in range(w):
        if mat1[i][j]=="#":
            mat2[i][j]=0
        else:
            if j==0:
                mat2[i][j]=1
            else:
                mat2[i][j]=mat2[i][j-1]+1
#print(mat2)

for i in range(h):
    for j in reversed(range(w)):
        #print(i,j)
        if mat1[i][j]=="#":
            mat3[i][j]=0
        else:
            if j==w-1:
                mat3[i][j]=1
            else:
                mat3[i][j]=mat3[i][j+1]+1
#print(mat3)

for i in range(w):
    for j in range(h):
        if mat1[j][i]=="#":
            mat4[j][i]=0
        else:
            if j==0:
                mat4[j][i]=1
            else:
                mat4[j][i]=mat4[j-1][i]+1
#print(mat4)

for i in range(w):
    for j in reversed(range(h)):
        if mat1[j][i]=="#":
            mat5[j][i]=0
        else:
            if j==h-1:
                mat5[j][i]=1
            else:
                mat5[j][i]=mat5[j+1][i]+1
#print(mat5)
mx=0
for i in range(h):
    for j in range(w):
        if mat1[i][j]==".":
            ans=mat2[i][j]+mat3[i][j]+mat4[i][j]+mat5[i][j]-3
            if ans>mx:
                mx=ans
print(mx)

Fixed submission:
# coding: utf-8
import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

H, W = lr()
S = [list(sr()) for _ in range(H)]
S = np.array([[1 if x == '.' else 0 for x in row] for row in S], np.bool)
up = np.zeros((H, W), np.int32)
down = np.zeros((H, W), np.int32)
right = np.zeros((H, W), np.int32)
left = np.zeros((H, W), np.int32)
for i in range(H-1):
    up[i+1] = (1+up[i]) * S[i]
for i in range(H-1, 0, -1):
    down[i-1] = (1+down[i]) * S[i]
for i in range(W-1):
    left[:, i+1] = (1+left[:, i]) * S[:, i]
    #行列の列を取り出す時の記法
for i in range(W-1, 0, -1):
    right[:, i-1] = (1+right[:, i]) * S[:, i]


answer = ((up + down + left + right) * S).max() + 1
#自身を数えないことで特殊な場合をなくしている
print(answer)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
#from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi
#from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [LI()for i in range(n)]
inf = 10**17
mod = 10**9 + 7

h,w=MI()
mat1 =[[] for i in range(h)]
mat2 =[[0 for j in range(w)] for i in range(h)]
mat3 =[[0 for j in range(w)] for i in range(h)]
mat4 =[[0 for j in range(w)] for i in range(h)]
mat5 =[[0 for j in range(w)] for i in range(h)]


for i in range(h):
    s=input().rstrip()
    for j in range(w):
        mat1[i].append(s[j])
#print(mat1)

for i in range(h):
    for j in range(w):
        if mat1[i][j]=="#":
            mat2[i][j]=0
        else:
            if j==0:
                mat2[i][j]=1
            else:
                mat2[i][j]=mat2[i][j-1]+1
#print(mat2)

for i in range(h):
    for j in reversed(range(w)):
        #print(i,j)
        if mat1[i][j]=="#":
            mat3[i][j]=0
        else:
            if j==w-1:
                mat3[i][j]=1
            else:
                mat3[i][j]=mat3[i][j+1]+1
#print(mat3)

for i in range(w):
    for j in range(h):
        if mat1[j][i]=="#":
            mat4[j][i]=0
        else:
            if j==0:
                mat4[j][i]=1
            else:
                mat4[j][i]=mat4[j-1][i]+1
#print(mat4)

for i in range(w):
    for j in reversed(range(h)):
        if mat1[j][i]=="#":
            mat5[j][i]=0
        else:
            if j==h-1:
                mat5[j][i]=1
            else:
                mat5[j][i]=mat5[j+1][i]+1
#print(mat5)
mx=0
for i in range(h):
    for j in range(w):
        if mat1[i][j]==".":
            ans=mat2[i][j]+mat3[i][j]+mat4[i][j]+mat5[i][j]-3
            if ans>mx:
                mx=ans
print(mx)

Fixed submission:
# coding: utf-8
import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

H, W = lr()
S = [list(sr()) for _ in range(H)]
S = np.array([[1 if x == '.' else 0 for x in row] for row in S], np.bool)
up = np.zeros((H, W), np.int32)
down = np.zeros((H, W), np.int32)
right = np.zeros((H, W), np.int32)
left = np.zeros((H, W), np.int32)
for i in range(H-1):
    up[i+1] = (1+up[i]) * S[i]
for i in range(H-1, 0, -1):
    down[i-1] = (1+down[i]) * S[i]
for i in range(W-1):
    left[:, i+1] = (1+left[:, i]) * S[:, i]
    #行列の列を取り出す時の記法
for i in range(W-1, 0, -1):
    right[:, i-1] = (1+right[:, i]) * S[:, i]


answer = ((up + down + left + right) * S).max() + 1
#自身を数えないことで特殊な場合をなくしている
print(answer)