Buggy python submission (verdict: Time Limit Exceeded):
h,w=map(int,input().split())
M=[list(input()) for i in range(h)]
D=[[0]*w for i in range(h)]
U=[[0]*w for i in range(h)]
R=[[0]*w for i in range(h)]
L=[[0]*w for i in range(h)]

for i in range(h):
    c=0
    for j in range(w):
        if M[i][j]=='.':
            c+=1
            R[i][j]=c
        else:
            c=0
for i in range(h):
    c=0
    for j in range(w):
        if M[i][w-1-j]=='.':
            c+=1
            L[i][w-1-j]=c
        else:
            c=0
for j in range(w):
    c=0
    for i in range(h):
        if M[i][j]=='.':
            c+=1
            D[i][j]=c
        else:
            c=0
for j in range(w):
    c=0
    for i in range(h):
        if M[h-1-i][j]=='.':
            c+=1
            U[h-1-i][j]=c
        else:
            c=0
r=0
for i in range(h):
    for j in range(w):
        r=max(r,R[i][j]+L[i][j]+D[i][j]+U[i][j]-3)
print(r)

Fixed submission:
h,w=map(int,input().split())
M=[list(input()) for i in range(h)]
D=[[0]*w for i in range(h)]
U=[[0]*w for i in range(h)]
R=[[0]*w for i in range(h)]
L=[[0]*w for i in range(h)]

for i in range(h):
    c=0
    for j in range(w):
        if M[i][j]=='.':
            c+=1
            R[i][j]=c
        else:
            c=0
for i in range(h):
    c=0
    for j in range(w):
        if M[i][w-1-j]=='.':
            c+=1
            L[i][w-1-j]=c
        else:
            c=0
for j in range(w):
    c=0
    for i in range(h):
        if M[i][j]=='.':
            c+=1
            D[i][j]=c
        else:
            c=0
for j in range(w):
    c=0
    for i in range(h):
        if M[h-1-i][j]=='.':
            c+=1
            U[h-1-i][j]=c
        else:
            c=0
r=0
for i in range(h):
    for j in range(w):
        r=max(r,R[i][j]+L[i][j]+D[i][j]+U[i][j]-3)
print(r)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
from itertools import groupby

h,w=map(int,input().split())
M=np.array([list(input()) for i in range(h)])
L=np.array([[0]*w for i in range(h)])

for i in range(w):
	c=0
	for k,g in groupby(M[:,i]):
		l=len(list(g))
		if k=='.':
			L[c:c+l,i]+=l
		c+=l

for i in range(h):
	c=0
	for k,g in groupby(M[i,:]):
		l=len(list(g))
		if k=='.':
			L[i,c:c+l]+=l
		c+=l

print(np.amax(L)-1)


Fixed submission:
h,w=map(int,input().split())
M=[list(input()) for i in range(h)]
D=[[0]*w for i in range(h)]
U=[[0]*w for i in range(h)]
R=[[0]*w for i in range(h)]
L=[[0]*w for i in range(h)]

for i in range(h):
    c=0
    for j in range(w):
        if M[i][j]=='.':
            c+=1
            R[i][j]=c
        else:
            c=0
for i in range(h):
    c=0
    for j in range(w):
        if M[i][w-1-j]=='.':
            c+=1
            L[i][w-1-j]=c
        else:
            c=0
for j in range(w):
    c=0
    for i in range(h):
        if M[i][j]=='.':
            c+=1
            D[i][j]=c
        else:
            c=0
for j in range(w):
    c=0
    for i in range(h):
        if M[h-1-i][j]=='.':
            c+=1
            U[h-1-i][j]=c
        else:
            c=0
r=0
for i in range(h):
    for j in range(w):
        r=max(r,R[i][j]+L[i][j]+D[i][j]+U[i][j]-3)
print(r)

Buggy python submission (verdict: Runtime Error):
import numpy as np
from itertools import groupby

h,w=map(int,input().split())
M=np.array([list(input()) for i in range(h)])
L=np.array([[0]*w for i in range(h)])

for i in range(w):
	c=0
	for k,g in groupby(M[:,i]):
		l=len(list(g))
		if k=='.':
			L[c:c+l,i]+=l
		c+=l

for i in range(h):
	c=0
	for k,g in groupby(M[i,:]):
		l=len(list(g))
		if k=='.':
			L[i,c:c+l]+=l
		c+=l

print(np.amax(L)-1)


Fixed submission:
h,w=map(int,input().split())
M=[list(input()) for i in range(h)]
D=[[0]*w for i in range(h)]
U=[[0]*w for i in range(h)]
R=[[0]*w for i in range(h)]
L=[[0]*w for i in range(h)]

for i in range(h):
    c=0
    for j in range(w):
        if M[i][j]=='.':
            c+=1
            R[i][j]=c
        else:
            c=0
for i in range(h):
    c=0
    for j in range(w):
        if M[i][w-1-j]=='.':
            c+=1
            L[i][w-1-j]=c
        else:
            c=0
for j in range(w):
    c=0
    for i in range(h):
        if M[i][j]=='.':
            c+=1
            D[i][j]=c
        else:
            c=0
for j in range(w):
    c=0
    for i in range(h):
        if M[h-1-i][j]=='.':
            c+=1
            U[h-1-i][j]=c
        else:
            c=0
r=0
for i in range(h):
    for j in range(w):
        r=max(r,R[i][j]+L[i][j]+D[i][j]+U[i][j]-3)
print(r)

Buggy python submission (verdict: Runtime Error):
import numpy as np
from itertools import groupby

h,w=map(int,input().split())
M=np.array([list(input()) for i in range(h)])
C=np.array([[0]*w for i in range(h)])
R=np.array([[0]*w for i in range(h)])
L=np.array([[0]*w for i in range(h)])

for i in range(w):
	c=0
	for k,g in groupby(M[:,i]):
		l=len(list(g))
		if k=='#':
			C[c:c+l,i]=0
		else:
			C[c:c+l,i]=l
		c+=l

for i in range(h):
	c=0
	for k,g in groupby(M[i,:]):
		l=len(list(g))
		if k=='#':
			R[i,c:c+l]=0
		else:
			R[i,c:c+l]=l
		c+=l

r=0
for i in range(h):
	for j in range(w):
		r=max(r,C[i][j]+R[i][j]-1)
print(r)


Fixed submission:
h,w=map(int,input().split())
M=[list(input()) for i in range(h)]
D=[[0]*w for i in range(h)]
U=[[0]*w for i in range(h)]
R=[[0]*w for i in range(h)]
L=[[0]*w for i in range(h)]

for i in range(h):
    c=0
    for j in range(w):
        if M[i][j]=='.':
            c+=1
            R[i][j]=c
        else:
            c=0
for i in range(h):
    c=0
    for j in range(w):
        if M[i][w-1-j]=='.':
            c+=1
            L[i][w-1-j]=c
        else:
            c=0
for j in range(w):
    c=0
    for i in range(h):
        if M[i][j]=='.':
            c+=1
            D[i][j]=c
        else:
            c=0
for j in range(w):
    c=0
    for i in range(h):
        if M[h-1-i][j]=='.':
            c+=1
            U[h-1-i][j]=c
        else:
            c=0
r=0
for i in range(h):
    for j in range(w):
        r=max(r,R[i][j]+L[i][j]+D[i][j]+U[i][j]-3)
print(r)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
from itertools import groupby

h,w=map(int,input().split())
M=np.array([list(input()) for i in range(h)])
C=np.array([[0]*w for i in range(h)])
R=np.array([[0]*w for i in range(h)])
L=np.array([[0]*w for i in range(h)])

for i in range(w):
	c=0
	for k,g in groupby(M[:,i]):
		l=len(list(g))
		if k=='#':
			C[c:c+l,i]=0
		else:
			C[c:c+l,i]=l
		c+=l

for i in range(h):
	c=0
	for k,g in groupby(M[i,:]):
		l=len(list(g))
		if k=='#':
			R[i,c:c+l]=0
		else:
			R[i,c:c+l]=l
		c+=l

r=0
for i in range(h):
	for j in range(w):
		r=max(r,C[i][j]+R[i][j]-1)
print(r)


Fixed submission:
h,w=map(int,input().split())
M=[list(input()) for i in range(h)]
D=[[0]*w for i in range(h)]
U=[[0]*w for i in range(h)]
R=[[0]*w for i in range(h)]
L=[[0]*w for i in range(h)]

for i in range(h):
    c=0
    for j in range(w):
        if M[i][j]=='.':
            c+=1
            R[i][j]=c
        else:
            c=0
for i in range(h):
    c=0
    for j in range(w):
        if M[i][w-1-j]=='.':
            c+=1
            L[i][w-1-j]=c
        else:
            c=0
for j in range(w):
    c=0
    for i in range(h):
        if M[i][j]=='.':
            c+=1
            D[i][j]=c
        else:
            c=0
for j in range(w):
    c=0
    for i in range(h):
        if M[h-1-i][j]=='.':
            c+=1
            U[h-1-i][j]=c
        else:
            c=0
r=0
for i in range(h):
    for j in range(w):
        r=max(r,R[i][j]+L[i][j]+D[i][j]+U[i][j]-3)
print(r)