Buggy python submission (verdict: Time Limit Exceeded):
def solve():
  ans = 0
  H, W = map(int, input().split())
  S = [0]*(H+2)
  S[0] = '*'*(W+2)
  S[H+1] = '*'*(W+2)
  for h in range(1,H+1):
    S[h] = '*' + input() + '*'
  L = [[0]*(W+2) for _ in range(H+2)]
  R = [[0]*(W+2) for _ in range(H+2)]
  U = [[0]*(W+2) for _ in range(H+2)]
  D = [[0]*(W+2) for _ in range(H+2)]
  for h in range(1,H+2):
    for w in range(1,W+2):
      if S[h][w]=='.':
        if S[h][w-1]=='.':
          L[h][w] = L[h][w-1]+1
        if S[h-1][w]=='.':
          U[h][w] = U[h-1][w]+1
  for h in range(H+1,0,-1):
    for w in range(W+1,0,-1):
      if S[h][w]=='.':
        if S[h][w+1]=='.':
          R[h][w] = R[h][w+1]+1
        if S[h+1][w]=='.':
          D[h][w] = D[h+1][w]+1
  total = [[0]*(W+2) for _ in range(H+2)]
  for h in range(1,H+2):
    for w in range(1,W+2):
      if S[h][w]=='.':
        total[h][w] = L[h][w]+R[h][w]+U[h][w]+D[h][w]+1
        ans = max(ans,total[h][w])
  return ans
print(solve())

Fixed submission:
#import numpy as np
H, W = map(int, input().split())
S = [0]*H
counth = [[0]*W for _ in range(H)]  
countw = [[0]*W for _ in range(H)]

for i in range(H):
  S[i] = input()
  
for i in range(H):
  for j in range(W):
    if S[i][j]=='.':
      if counth[i][j]==0:
        b=False
        for k in range(j,W):
          if S[i][k]=='#':
            b = True
            break
        if b==False:
          k+=1
        #print(S[i][j:],l)
        for l in range(j,k):
          #print(i,j,l)
          counth[i][l]=k-j
      if countw[i][j]==0:
        b=False
        for k in range(i,H):
          if S[k][j]=='#':
            b=True
            break
        if b==False:
          k+=1
        #print(S[i:][j],m)
        for l in range(i,k):
          #print(i,j,l)
          countw[l][j]=k-i
      #print(i,j,count)
#print(counth,countw)
maxim = 0
for i in range(H):
  for j in range(W):
    maxim = int(max(maxim,counth[i][j]+countw[i][j]-1))
print(maxim)

Buggy python submission (verdict: Time Limit Exceeded):
#import numpy as np
H, W = map(int, input().split())
S = [0]*H
counth = [[0]*W for _ in range(H)]  
countw = [[0]*W for _ in range(H)]

for i in range(H):
  S[i] = input()
  
for i in range(H):
  for j in range(W):
    if S[i][j]=='.':
      if counth[i][j]==0:
        b=False
        for k in range(j,W):
          if S[i][k]=='#':
            b = True
            break
        if b==False:
          k+=1
        #print(S[i][j:],l)
        for l in range(j,k):
          #print(i,j,l)
          counth[i][l]=k-j
      if countw[i][j]==0:
        b=False
        for k in range(i,H):
          if S[k][j]=='#':
            b=True
            break
        if b==False:
          k+=1
        #print(S[i:][j],m)
        for l in range(i,k):
          #print(i,j,l)
          countw[l][j]=k-i
      #print(i,j,count)
#print(counth,countw)
maxim = 0
for i in range(H):
  for j in range(W):
    maxim = int(max(maxim,counth[i][j]+countw[i][j]-1))
print(maxim)

Fixed submission:
#import numpy as np
H, W = map(int, input().split())
S = [0]*H
counth = [[0]*W for _ in range(H)]  
countw = [[0]*W for _ in range(H)]

for i in range(H):
  S[i] = input()
  
for i in range(H):
  for j in range(W):
    if S[i][j]=='.':
      if counth[i][j]==0:
        b=False
        for k in range(j,W):
          if S[i][k]=='#':
            b = True
            break
        if b==False:
          k+=1
        #print(S[i][j:],l)
        for l in range(j,k):
          #print(i,j,l)
          counth[i][l]=k-j
      if countw[i][j]==0:
        b=False
        for k in range(i,H):
          if S[k][j]=='#':
            b=True
            break
        if b==False:
          k+=1
        #print(S[i:][j],m)
        for l in range(i,k):
          #print(i,j,l)
          countw[l][j]=k-i
      #print(i,j,count)
#print(counth,countw)
maxim = 0
for i in range(H):
  for j in range(W):
    maxim = int(max(maxim,counth[i][j]+countw[i][j]-1))
print(maxim)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
H, W = map(int, input().split())
S = [0]*H
count = np.zeros((H,W,2))

for i in range(H):
  S[i] = input()
  
for i in range(H):
  for j in range(W):
    if S[i][j]=='.':
      if count[i][j][0]==0:
        l = len(S[i][j:].split('#')[0])
        #print(S[i][j:],l)
        count[i,j:j+l,0]=l
      if count[i][j][1]==0:
        m = len(''.join([S[k][j] for k in range(i,H)]).split('#')[0])
        #print(S[i:][j],m)
        count[i:i+m,j,1]=m
      #print(i,j,count)
#print(count)
maxim = 0
for i in range(H):
  for j in range(W):
    maxim = int(max(maxim,np.sum(count[i][j])-1))
print(maxim)

Fixed submission:
#import numpy as np
H, W = map(int, input().split())
S = [0]*H
counth = [[0]*W for _ in range(H)]  
countw = [[0]*W for _ in range(H)]

for i in range(H):
  S[i] = input()
  
for i in range(H):
  for j in range(W):
    if S[i][j]=='.':
      if counth[i][j]==0:
        b=False
        for k in range(j,W):
          if S[i][k]=='#':
            b = True
            break
        if b==False:
          k+=1
        #print(S[i][j:],l)
        for l in range(j,k):
          #print(i,j,l)
          counth[i][l]=k-j
      if countw[i][j]==0:
        b=False
        for k in range(i,H):
          if S[k][j]=='#':
            b=True
            break
        if b==False:
          k+=1
        #print(S[i:][j],m)
        for l in range(i,k):
          #print(i,j,l)
          countw[l][j]=k-i
      #print(i,j,count)
#print(counth,countw)
maxim = 0
for i in range(H):
  for j in range(W):
    maxim = int(max(maxim,counth[i][j]+countw[i][j]-1))
print(maxim)