Buggy python submission (verdict: Time Limit Exceeded):
import sys
h,w=map(int,sys.stdin.readline().split())
from itertools import *
g=[input() for _ in range(h)]
cw=[[] for _ in range(h)]
for i in range(h):
  gw=[(s,len(list(c))) for s,c in groupby(g[i])]
  for s,c in gw:
    if s=='.': cw[i]+=[c]*c
    else: cw[i]+=[0]*c
gt=list(zip(*g))
ch=[[] for _ in range(w)]
for i in range(w):
  gh=[(s,len(list(c))) for s,c in groupby(gt[i])]
  for s,c in gh:
    if s=='.': ch[i]+=[c]*c
    else: ch[i]+=[0]*c
ch=list(zip(*ch))
print(max(cw[i][j]+ch[i][j]-1 for i in range(h) for j in range(w)))

Fixed submission:
h,w=map(int,input().split())
f=lambda:[[0]*w for _ in range(h)]
g=[input() for _ in range(h)]
l,r=f(),f()
for i in range(h):
  lc=rc=0
  for j in range(w):
    if g[i][j]=='.': lc+=1; l[i][j]=lc
    else: lc=0
    if g[i][-1-j]=='.': rc+=1; r[i][-1-j]=rc
    else: rc=0
d,u=f(),f()
for i in range(w):
  dc=uc=0
  for j in range(h):
    if g[j][i]=='.': dc+=1; d[j][i]=dc
    else: dc=0
    if g[-1-j][i]=='.': uc+=1; u[-1-j][i]=uc
    else: uc=0
print(max(l[i][j]+r[i][j]+d[i][j]+u[i][j]-3 for i in range(h) for j in range(w)))

Buggy python submission (verdict: Time Limit Exceeded):
h,w=map(int,input().split())
from itertools import *
g=[input() for _ in range(h)]
cw=[[] for _ in range(h)]
for i in range(h):
  gw=[(s,len(list(c))) for s,c in groupby(g[i])]
  for s,c in gw:
    if s=='.': cw[i]+=[c]*c
    else: cw[i]+=[0]*c
gt=list(zip(*g))
ch=[[] for _ in range(w)]
for i in range(w):
  gh=[(s,len(list(c))) for s,c in groupby(gt[i])]
  for s,c in gh:
    if s=='.': ch[i]+=[c]*c
    else: ch[i]+=[0]*c
ch=list(zip(*ch))
print(max(cw[i][j]+ch[i][j]-1 for i in range(h) for j in range(w)))

Fixed submission:
h,w=map(int,input().split())
f=lambda:[[0]*w for _ in range(h)]
g=[input() for _ in range(h)]
l,r=f(),f()
for i in range(h):
  lc=rc=0
  for j in range(w):
    if g[i][j]=='.': lc+=1; l[i][j]=lc
    else: lc=0
    if g[i][-1-j]=='.': rc+=1; r[i][-1-j]=rc
    else: rc=0
d,u=f(),f()
for i in range(w):
  dc=uc=0
  for j in range(h):
    if g[j][i]=='.': dc+=1; d[j][i]=dc
    else: dc=0
    if g[-1-j][i]=='.': uc+=1; u[-1-j][i]=uc
    else: uc=0
print(max(l[i][j]+r[i][j]+d[i][j]+u[i][j]-3 for i in range(h) for j in range(w)))

Buggy python submission (verdict: Time Limit Exceeded):
h,w=map(int,input().split())
from itertools import *
g=[input() for _ in range(h)]
cw=[[] for _ in range(h)]
for i in range(h):
  gw=[(s,len(list(c))) for s,c in groupby(g[i])]
  for s,c in gw:
    if s=='.': cw[i]+=[c]*c
    else: cw[i]+=[0]*c
gt=list(zip(*g))
ch=[[] for _ in range(w)]
for i in range(w):
  gh=[(s,len(list(c))) for s,c in groupby(gt[i])]
  for s,c in gh:
    if s=='.': ch[i]+=[c]*c
    else: ch[i]+=[0]*c
ch=list(zip(*ch))
print(max(cw[i][j]+ch[i][j]-1 for i in range(h) for j in range(w)))

Fixed submission:
h,w=map(int,input().split())
f=lambda:[[0]*w for _ in range(h)]
g=[input() for _ in range(h)]
l,r=f(),f()
for i in range(h):
  lc=rc=0
  for j in range(w):
    if g[i][j]=='.': lc+=1; l[i][j]=lc
    else: lc=0
    if g[i][-1-j]=='.': rc+=1; r[i][-1-j]=rc
    else: rc=0
d,u=f(),f()
for i in range(w):
  dc=uc=0
  for j in range(h):
    if g[j][i]=='.': dc+=1; d[j][i]=dc
    else: dc=0
    if g[-1-j][i]=='.': uc+=1; u[-1-j][i]=uc
    else: uc=0
print(max(l[i][j]+r[i][j]+d[i][j]+u[i][j]-3 for i in range(h) for j in range(w)))