Buggy python submission (verdict: Time Limit Exceeded):
def func_R(li, s, hi):
    for wi, si in enumerate(s):
        if si == '#':
            li[hi][wi] = 0
        else:
            if wi == 0:
                li[hi][wi] = 1
            else:
                li[hi][wi] = li[hi][wi-1] + 1

def func_L(li, s, hi):
    for wi, si in enumerate(s[::-1]):
        wi = w - wi - 1
        if si == '#':
            li[hi][wi] = 0
        else:
            if wi == w-1:
                li[hi][wi] = 1
            else:
                li[hi][wi] = li[hi][wi+1] + 1

def func_U(li, s, wi):
    for hi, si in enumerate(s):
        if si == '#':
            li[hi][wi] = 0
        else:
            if hi == 0:
                li[hi][wi] = 1
            else:
                li[hi][wi] = li[hi-1][wi] + 1

def func_D(li, s, wi):
    for hi, si in enumerate(s[::-1]):
        hi = h - hi - 1
        if si == '#':
            li[hi][wi] = 0
        else:
            if hi == h-1:
                li[hi][wi] = 1
            else:
                li[hi][wi] = li[hi+1][wi] + 1

def main():
    import sys
    input = sys.stdin.readline
    global h, w
    h, w = map(int, input().split())
    L = [[0]*w for _ in range(h)]
    R = [[0]*w for _ in range(h)]
    U = [[0]*w for _ in range(h)]
    D = [[0]*w for _ in range(h)]
    s_list = ['']*w
    for hi in range(h):
        s = input()[:-1]
        func_L(L, s, hi)
        func_R(R, s, hi)
        for wi, si in enumerate(s):
            s_list[wi] += si

    for wi in range(w):
        s = s_list[wi]
        func_U(U, s, wi)
        func_D(D, s, wi)

    ans = 0
    for hi in range(h):
        for wi in range(w):
            ans = max(ans, L[hi][wi] + R[hi][wi] + U[hi][wi] + D[hi][wi])

    print(ans-3)

if __name__ == '__main__':
    main()


Fixed submission:
import numpy as np

def main():
    H, W = map(int, input().split())
    S = np.array([list(input()) for _ in range(H)]) == '.'

    L = np.zeros((H, W), dtype=int)
    R = np.zeros((H, W), dtype=int)
    U = np.zeros((H, W), dtype=int)
    D = np.zeros((H, W), dtype=int)

    for w in range(1, W):
        L[:, w] = (L[:, w-1] + 1) * S[:, w-1]
    for w in range(W-2, -1, -1):
        R[:, w] = (R[:, w+1] + 1) * S[:, w+1]
    for h in range(1, H):
        U[h, :] = (U[h-1, :] + 1) * S[h-1, :]
    for h in range(H-2, -1, -1):
        D[h, :] = (D[h+1, :] + 1) * S[h+1, :]

    print(((L+R+U+D)*S).max() + 1)

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def func_R(li, s, hi):
    for wi, si in enumerate(s):
        if si == '#':
            li[hi][wi] = 0
        else:
            if wi == 0:
                li[hi][wi] = 1
            else:
                li[hi][wi] = li[hi][wi-1] + 1

def func_L(li, s, hi):
    for wi, si in enumerate(s[::-1]):
        wi = w - wi - 1
        if si == '#':
            li[hi][wi] = 0
        else:
            if wi == w-1:
                li[hi][wi] = 1
            else:
                li[hi][wi] = li[hi][wi+1] + 1

def func_U(li, s, wi):
    for hi, si in enumerate(s):
        if si == '#':
            li[hi][wi] = 0
        else:
            if hi == 0:
                li[hi][wi] = 1
            else:
                li[hi][wi] = li[hi-1][wi] + 1

def func_D(li, s, wi):
    for hi, si in enumerate(s[::-1]):
        hi = h - hi - 1
        if si == '#':
            li[hi][wi] = 0
        else:
            if hi == h-1:
                li[hi][wi] = 1
            else:
                li[hi][wi] = li[hi+1][wi] + 1

def main():
    import sys
    input = sys.stdin.readline
    global h, w
    h, w = map(int, input().split())
    L = [[0]*w for _ in range(h)]
    R = [[0]*w for _ in range(h)]
    U = [[0]*w for _ in range(h)]
    D = [[0]*w for _ in range(h)]
    s_list = ['']*w
    for hi in range(h):
        s = input()[:-1]
        func_L(L, s, hi)
        func_R(R, s, hi)
        for wi, si in enumerate(s):
            s_list[wi] += si

    for wi in range(w):
        s = s_list[wi]
        func_U(U, s, wi)
        func_D(D, s, wi)

    ans = 0
    for hi in range(h):
        for wi in range(w):
            ans = max(ans, L[hi][wi] + R[hi][wi] + U[hi][wi] + D[hi][wi])

    print(ans-3)

if __name__ == '__main__':
    main()


Fixed submission:
import numpy as np

def main():
    H, W = map(int, input().split())
    S = np.array([list(input()) for _ in range(H)]) == '.'

    L = np.zeros((H, W), dtype=int)
    R = np.zeros((H, W), dtype=int)
    U = np.zeros((H, W), dtype=int)
    D = np.zeros((H, W), dtype=int)

    for w in range(1, W):
        L[:, w] = (L[:, w-1] + 1) * S[:, w-1]
    for w in range(W-2, -1, -1):
        R[:, w] = (R[:, w+1] + 1) * S[:, w+1]
    for h in range(1, H):
        U[h, :] = (U[h-1, :] + 1) * S[h-1, :]
    for h in range(H-2, -1, -1):
        D[h, :] = (D[h+1, :] + 1) * S[h+1, :]

    print(((L+R+U+D)*S).max() + 1)

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def func_R(li, s, hi):
    for wi, si in enumerate(s):
        if si == '#':
            li[hi][wi] = 0
        else:
            if wi == 0:
                li[hi][wi] = 1
            else:
                li[hi][wi] = li[hi][wi-1] + 1

def func_L(li, s, hi):
    for wi, si in enumerate(s[::-1]):
        wi = w - wi - 1
        if si == '#':
            li[hi][wi] = 0
        else:
            if wi == w-1:
                li[hi][wi] = 1
            else:
                li[hi][wi] = li[hi][wi+1] + 1

def func_U(li, s, wi):
    for hi, si in enumerate(s):
        if si == '#':
            li[hi][wi] = 0
        else:
            if hi == 0:
                li[hi][wi] = 1
            else:
                li[hi][wi] = li[hi-1][wi] + 1

def func_D(li, s, wi):
    for hi, si in enumerate(s[::-1]):
        hi = h - hi - 1
        if si == '#':
            li[hi][wi] = 0
        else:
            if hi == h-1:
                li[hi][wi] = 1
            else:
                li[hi][wi] = li[hi+1][wi] + 1

def main():
    global h, w
    h, w = map(int, input().split())
    L = [[0]*w for _ in range(h)]
    R = [[0]*w for _ in range(h)]
    U = [[0]*w for _ in range(h)]
    D = [[0]*w for _ in range(h)]
    s_list = ['']*w
    for hi in range(h):
        s = input()
        func_L(L, s, hi)
        func_R(R, s, hi)
        for wi, si in enumerate(s):
            s_list[wi] += si

    for wi in range(w):
        s = s_list[wi]
        func_U(U, s, wi)
        func_D(D, s, wi)

    ans = 0
    for hi in range(h):
        for wi in range(w):
            ans = max(ans, L[hi][wi] + R[hi][wi] + U[hi][wi] + D[hi][wi])

    print(ans-3)

if __name__ == '__main__':
    main()


Fixed submission:
import numpy as np

def main():
    H, W = map(int, input().split())
    S = np.array([list(input()) for _ in range(H)]) == '.'

    L = np.zeros((H, W), dtype=int)
    R = np.zeros((H, W), dtype=int)
    U = np.zeros((H, W), dtype=int)
    D = np.zeros((H, W), dtype=int)

    for w in range(1, W):
        L[:, w] = (L[:, w-1] + 1) * S[:, w-1]
    for w in range(W-2, -1, -1):
        R[:, w] = (R[:, w+1] + 1) * S[:, w+1]
    for h in range(1, H):
        U[h, :] = (U[h-1, :] + 1) * S[h-1, :]
    for h in range(H-2, -1, -1):
        D[h, :] = (D[h+1, :] + 1) * S[h+1, :]

    print(((L+R+U+D)*S).max() + 1)

if __name__ == '__main__':
    main()