Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
def main():
    h, w = map(int, input().split())
    s = np.array([list(input()) for _ in range(h)])
    t = np.zeros((h+2, w+2))
    t[1:-1, 1:-1][s == "."] = 1
    row = np.zeros((h+2, w+2))
    col = row.T.copy()
    for i in range(1, h+1):
        idx = np.where(t[i] == 0)
        dif = np.diff(idx[0])
        for j in range(np.size(idx) - 1):
            L, R = idx[0][j], idx[0][j+1]
            row[i][L+1] += dif[j]-1
            row[i][R] -= dif[j]-1
        row[i] = np.cumsum(row[i])
    t = t.T
    for i in range(1, w+1):
        idx = np.where(t[i] == 0)
        dif = np.diff(idx[0])
        for j in range(np.size(idx) - 1):
            L, R = idx[0][j], idx[0][j+1]
            col[i][L+1] += dif[j]-2
            col[i][R] -= dif[j]-2
        col[i] = np.cumsum(col[i])
    col = col.T
#    for i in range(h+2):
#        print(row[i])
#    print("")
#    for i in range(h+2):
#        print(col[i])
    cost = np.add(row, col)
    print(int(np.max(cost)))

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)])
    t = np.zeros((h+2, w+2))
    t[1:-1, 1:-1][s == "."] = 1
    row = np.zeros((h+2, w+2))
    col = np.zeros((w+2, h+2))
    for i in range(1, h+1):
        idx = np.where(t[i] == 0)[0]
        dif = np.diff(idx)
        row[i, idx[:-1]+1] += dif-1
        row[i, idx[1:]] -= dif-1
        row[i] = np.cumsum(row[i])
    t = t.T
    for i in range(1, w+1):
        idx = np.where(t[i] == 0)[0]
        dif = np.diff(idx)
        col[i, idx[:-1]] += dif-2
        col[i, idx[1:]] -= dif-2
        col[i] = np.cumsum(col[i])
    col = col.T
    cost = np.add(row, col)
    print(int(np.max(cost)))

if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
def main():
    h, w = map(int, input().split())
    s = np.array([list(input()) for _ in range(h)])
    t = np.zeros((h+2, w+2))
    t[1:-1, 1:-1][s == "."] = 1
    cost = np.zeros((h+2, w+2))
    for i in range(1, h+1):
        idx = np.where(t[i] == 0)
        for j in range(np.size(idx) - 1):
            L, R = idx[0][j], idx[0][j+1]
            cost[i][L+1:R] = np.add(cost[i][L+1:R], R-L-1)
    cost = cost.T
    t = t.T
    for i in range(1, w+1):
        idx = np.where(t[i] == 0)
        for j in range(np.size(idx) - 1):
            L, R = idx[0][j], idx[0][j+1]
            cost[i][L+1:R] = np.add(cost[i][L+1:R], R-L-1-1)
    print(int(np.max(cost)))

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)])
    t = np.zeros((h+2, w+2))
    t[1:-1, 1:-1][s == "."] = 1
    row = np.zeros((h+2, w+2))
    col = np.zeros((w+2, h+2))
    for i in range(1, h+1):
        idx = np.where(t[i] == 0)[0]
        dif = np.diff(idx)
        row[i, idx[:-1]+1] += dif-1
        row[i, idx[1:]] -= dif-1
        row[i] = np.cumsum(row[i])
    t = t.T
    for i in range(1, w+1):
        idx = np.where(t[i] == 0)[0]
        dif = np.diff(idx)
        col[i, idx[:-1]] += dif-2
        col[i, idx[1:]] -= dif-2
        col[i] = np.cumsum(col[i])
    col = col.T
    cost = np.add(row, col)
    print(int(np.max(cost)))

if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    h, w = map(int, input().split())
    s = [""]*(h+2)
    for j in range(w+2):
        s[0] += "#"
        s[h+1] += "#"
    for i in range(1, h+1):
        s[i] = "#" + input() + "#"
    cost = [[[0]*4 for j in range(w+2)] for i in range(h+2)]
    for i in range(1, h+1):
        for j in range(1, w+1):
            if s[i][j] == ".":
                cost[i][j][0] = 1
                cost[i][j][2] = 1
                cost[i][j][0] += cost[i-1][j][0]
                cost[i][j][2] += cost[i][j-1][2]
            if s[h+1-i][w+1-j] == ".":
                cost[h+1-i][w+1-j][1] = 1
                cost[h+1-i][w+1-j][3] = 1
                cost[h+1-i][w+1-j][1] += cost[h+1-i+1][w+1-j][1]
                cost[h+1-i][w+1-j][3] += cost[h+1-i][w+1-j+1][3]
    ans = 0
    for i in range(1, h+1):
        for j in range(1, w+1):
            if s[i][j] == ".":
                tmp = cost[i-1][j][0] + cost[i+1][j][1] + cost[i][j-1][2] + cost[i][j+1][3] + 1
                ans = ans if ans > tmp else tmp
    print(ans)

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)])
    t = np.zeros((h+2, w+2))
    t[1:-1, 1:-1][s == "."] = 1
    row = np.zeros((h+2, w+2))
    col = np.zeros((w+2, h+2))
    for i in range(1, h+1):
        idx = np.where(t[i] == 0)[0]
        dif = np.diff(idx)
        row[i, idx[:-1]+1] += dif-1
        row[i, idx[1:]] -= dif-1
        row[i] = np.cumsum(row[i])
    t = t.T
    for i in range(1, w+1):
        idx = np.where(t[i] == 0)[0]
        dif = np.diff(idx)
        col[i, idx[:-1]] += dif-2
        col[i, idx[1:]] -= dif-2
        col[i] = np.cumsum(col[i])
    col = col.T
    cost = np.add(row, col)
    print(int(np.max(cost)))

if __name__ == "__main__":
    main()