Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import collections
import math
import operator as op
from functools import reduce
import numpy as np
import math
import bisect
import heapq


MOD = 1000000007


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


def lcm(a, b):
    return a * b // gcd(a, b)


def get_inputs(cast_func=None):
    if cast_func is None:
        return input().split()
    else:
        return list(map(cast_func, input().split()))


def get_input(cast_func=None):
    if cast_func is None:
        return input()
    else:
        return cast_func(input())


def is_prime(n):
    if n == 1:
        return False
    for i in range(2, int(n**0.5)+1):
        if n % i == 0:
            return False
    return True


def main():
    S = get_input()

    def is_palindrome(s):
        if len(s) == 1:
            return True
        else:
            return s == s[::-1] and is_palindrome(s[:len(s)//2]) and is_palindrome(s[len(s)//2 + 1:])

    if is_palindrome(S):
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()


Fixed submission:
import collections
import math
import operator as op
from functools import reduce
import numpy as np
import math
import bisect
import heapq


MOD = 1000000007


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


def lcm(a, b):
    return a * b // gcd(a, b)


def get_inputs(cast_func=None):
    if cast_func is None:
        return input().split()
    else:
        return list(map(cast_func, input().split()))


def get_input(cast_func=None):
    if cast_func is None:
        return input()
    else:
        return cast_func(input())


def is_prime(n):
    if n == 1:
        return False
    for i in range(2, int(n**0.5)+1):
        if n % i == 0:
            return False
    return True


def main():
    S = get_input()

    def is_palindrome(s):
        if len(s) == 1:
            return True
        else:
            first = s[:len(s)//2]
            last = s[len(s)//2 + 1:]
            return s == s[::-1] and first == first[::-1] and last == last[::-1]

    if is_palindrome(S):
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
import collections
import math
import operator as op
from functools import reduce
from collections import Counter
import numpy as np
import math
import bisect
import heapq


MOD = 1000000007


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


def lcm(a, b):
    return a * b // gcd(a, b)


def get_inputs(cast_func=None):
    if cast_func is None:
        return input().split()
    else:
        return list(map(cast_func, input().split()))


def get_input(cast_func=None):
    if cast_func is None:
        return input()
    else:
        return cast_func(input())


def is_prime(n):
    if n == 1:
        return False
    for i in range(2, int(n**0.5)+1):
        if n % i == 0:
            return False
    return True


def main():
    S = get_input()
    Q = get_input(int)
    for _ in range(Q):
        query = get_input()
        if query[0] == "1":
            S = S[::-1]
        else:
            _, F, C = query.split(" ")
            if F == "1":
                S = C + S
            else:
                S = S + C
    print(S)


if __name__ == '__main__':
    main()


Fixed submission:
import collections
import math
import operator as op
from functools import reduce
from collections import Counter
import numpy as np
import math
import bisect
import heapq


MOD = 1000000007


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


def lcm(a, b):
    return a * b // gcd(a, b)


def get_inputs(cast_func=None):
    if cast_func is None:
        return input().split()
    else:
        return list(map(cast_func, input().split()))


def get_input(cast_func=None):
    if cast_func is None:
        return input()
    else:
        return cast_func(input())


def is_prime(n):
    if n == 1:
        return False
    for i in range(2, int(n**0.5)+1):
        if n % i == 0:
            return False
    return True


def main():
    S = get_input()
    Q = get_input(int)

    # NOTE: need to reverse
    heads = ""
    tails = ""
    direction = 1
    for _ in range(Q):
        query = get_input()
        if query[0] == "1":
            direction *= -1
        else:
            _, F, C = query.split(" ")
            if F == "1":
                if direction == 1:
                    heads += C
                else:
                    tails += C
            else:
                if direction == 1:
                    tails += C
                else:
                    heads += C
     
    if direction == 1:
        print(heads[::-1] + S + tails)
    else:
        print(tails[::-1] + S[::-1] + heads)


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
import collections
import math
import operator as op
from functools import reduce
import numpy as np
import math
import bisect


def main():
    A, B = list(map(int, input().split()))

    lcm = (A * B) // math.gcd(A, B)

    print(lcm)


if __name__ == '__main__':
    main()


Fixed submission:
import collections
import math
import operator as op
from functools import reduce
import numpy as np
import math
import bisect

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def lcm(a, b):
    return a * b // gcd (a, b)

def main():
    A, B = list(map(int, input().split()))

    ans = lcm(A, B)

    print(ans)


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
import collections
import math
import operator as op
from functools import reduce

import numpy as np
import math
import bisect


def main():
    N = int(input())
    L = list(map(int, input().split()))

    L.sort()
    # M = [L[i] + L[j] for i in range(N) for j in range(i+1, N)]
    # M.sort()

    ans = 0
    for i in range(N-2):
        for j in range(i+1, N-1):
            a = L[i]
            b = L[j]

            # l = bisect.bisect_right(L[j+1:], abs(a-b))
            l = 0
            # print(l)

            # Speed up
            if L[j+1] > a + b:
                r = -1
            elif L[-1] < a + b:
                r = len(L[j+1:]) - 1
            else:
                r = bisect.bisect_left(L[j+1:], a+b)-1
            # candidates: [l, r]

            ans += max(0, r - l + 1)

    print(ans)


if __name__ == '__main__':
    main()


Fixed submission:
import collections
import math
import operator as op
from functools import reduce

import numpy as np
import math
from bisect import bisect


def main():
    N = int(input())
    L = list(map(int, input().split()))

    L.sort()
    # M = [L[i] + L[j] for i in range(N) for j in range(i+1, N)]
    # M.sort()

    ans = 0
    for i in range(N-2):
        for j in range(i+1, N-1):

            ans += bisect(L,L[i]+L[j]-1)-j-1

    print(ans)


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
import collections
import math
import operator as op
from functools import reduce

import numpy as np
import math
import bisect


def main():
    N = int(input())
    L = list(map(int, input().split()))

    L.sort()

    ans = 0
    for i in range(N):
        for j in range(i+1, N):
            a = L[i]
            b = L[j]

            # l = bisect.bisect_right(L[j+1:], abs(a-b))
            l = 0
            # print(l)
            r = bisect.bisect_left(L[j+1:], a+b)-1
            # candidates: [l, r]

            ans += max(0, r - l + 1)

    print(ans)


if __name__ == '__main__':
    main()


Fixed submission:
import collections
import math
import operator as op
from functools import reduce

import numpy as np
import math
from bisect import bisect


def main():
    N = int(input())
    L = list(map(int, input().split()))

    L.sort()
    # M = [L[i] + L[j] for i in range(N) for j in range(i+1, N)]
    # M.sort()

    ans = 0
    for i in range(N-2):
        for j in range(i+1, N-1):

            ans += bisect(L,L[i]+L[j]-1)-j-1

    print(ans)


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
import copy


def main():
    N = int(input())
    ds = list(map(int, input().split()))
    ds = np.array(ds, dtype=np.int)
    ans = 0
    for K in range(int(np.max(ds))+1):
        if np.sum(ds >= K) == N // 2:
            ans += 1
    print(int(ans))


if __name__ == '__main__':
    main()


Fixed submission:
import numpy as np
import copy


def main():
    # N = int(input())
    # ds = list(map(int, input().split()))
    # ds = np.array(ds, dtype=np.int)
    # ans = 0
    # for K in range(int(np.max(ds))+1):
    #     if np.sum(ds >= K) == N // 2:
    #         ans += 1
    # print(int(ans))

    N = int(input())
    ds = list(map(int, input().split()))
    ds = np.array(ds, dtype=np.int)

    ds = np.sort(ds)

    ans = ds[N//2] - ds[N//2-1]
    print(int(ans))


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
import numpy as np
import copy
from collections import defaultdict
from heapq import heappush, heappop


def djkstra(adj_mat, src):
    dist = defaultdict(lambda: np.inf)
    dist[src] = 0

    prev = defaultdict(lambda: None)

    queue = []
    heappush(queue, (dist[src], src))

    while len(queue) > 0:
        dist_u, u = heappop(queue)
        vs = np.argwhere(adj_mat[u] > 0).flatten()
        for v in vs:
            weight = adj_mat[u, v]
            alt = dist_u + weight
            if alt < dist[v]:
                dist[v] = alt
                prev[v] = u
                heappush(queue, (alt, v))
    visited_edges = np.zeros_like(adj_mat, dtype=np.int32)

    for v in range(adj_mat.shape[0]):
        u = prev[v]
        if u is not None:
            visited_edges[u, v] = 1
            visited_edges[v, u] = 1

    return visited_edges


def main():
    N, M = map(int, input().split())
    adj_mat = np.zeros((N, N), dtype=np.int32)
    for _ in range(M):
        a, b, c = map(int, input().split())
        a -= 1
        b -= 1
        adj_mat[a, b] = c
        adj_mat[b, a] = c

    visited_edge_count = np.sum(
        np.stack([djkstra(adj_mat, src)[np.newaxis, :, :] for src in range(N)], axis=0), axis=0)
    out = np.sum(np.logical_and(adj_mat > 0, visited_edge_count == 0)) // 2
    print(out)


if __name__ == '__main__':
    main()


Fixed submission:
import numpy as np
import copy
from collections import defaultdict
from heapq import heappush, heappop


def djkstra(adj_mat, src):
    dist = defaultdict(lambda: np.inf)
    dist[src] = 0

    prev = defaultdict(lambda: None)

    queue = []
    heappush(queue, (dist[src], src))

    while len(queue) > 0:
        dist_u, u = heappop(queue)
        vs = np.argwhere(adj_mat[u] > 0).flatten()
        for v in vs:
            weight = adj_mat[u, v]
            alt = dist_u + weight
            if alt < dist[v]:
                dist[v] = alt
                prev[v] = u
                heappush(queue, (alt, v))
    visited_edges = np.zeros_like(adj_mat, dtype=np.int32)

    for v in range(adj_mat.shape[0]):
        u = prev[v]
        if u is not None:
            visited_edges[u, v] = 1
            visited_edges[v, u] = 1

    return visited_edges


def main():
    N, M = map(int, input().split())
    adj_mat = np.zeros((N, N), dtype=np.int32)
    for _ in range(M):
        a, b, c = map(int, input().split())
        a -= 1
        b -= 1
        adj_mat[a, b] = c
        adj_mat[b, a] = c

    visited_edge_count = np.sum(
        np.concatenate([djkstra(adj_mat, src)[np.newaxis, :, :] for src in range(N)], axis=0), axis=0)
    out = np.sum(np.logical_and(adj_mat > 0, visited_edge_count == 0)) // 2
    print(out)


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
n,m,x=map(int,input().split())
from itertools import combinations
l=[]
for i in range(n):
    l.append(list(map(int,input().split())))
l1=[]
for i in range(m):
    l1.append(i)
l2=[]
for i in range(1,m+1):
    lx=[0]*i
    a=0
    for lx in combinations(l1,i):
        ly=[0]*m
        for p in range(1,m+1):
            for k in lx:
                ly[p-1]+=l[k][p]
        for k in lx:
            a+=l[k][0]
        for j in ly:
            if j<x:
                a=0
                break
        if a!=0:
            l2.append(a)
print(min(l2))
                
                
                
        
    
            
        
    


Fixed submission:
n,m,x=map(int,input().split())
from itertools import combinations
l=[]
for i in range(n):
    l.append(list(map(int,input().split())))
l1=[]
for i in range(n):
    l1.append(i)
l2=[]
for i in range(1,n+1):
    lx=[0]*i
    lyy=[0]*m
    for lx in combinations(l1,i):
        ly=lyy.copy()
        a=0
        for p in range(1,m+1):
            for k in lx:
                ly[p-1]+=l[k][p]
        for k in lx:
            a+=l[k][0]
        for j in ly:
            if j<x:
                a=0
                break
        if a!=0:
            l2.append(a)
if len(l2)!=0:
    print(min(l2))
else:
    print(-1)
Buggy python submission (verdict: Runtime Error):
n,w=map(int,input().split())
if w>=n:
  print('unsafe')
 else:
  print('safe')
  

Fixed submission:
n,w=map(int,input().split())
if w>=n:
    print('unsafe')
else:
    print('safe')
Buggy python submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
if max(a)>max(b):
    print('Yes')
elif max(a)==max(b):
    if a+b>=c+d:
        print('Yes')
    else:
        print('No')
else:
    if min(a,b)>=min(c,d):
        print('Yes')
    else:
        print('No')
        
    

Fixed submission:
a,b,c,d=map(int,input().split())
ans=0
while a>0 and c>0:
    c-=b
    ans+=1
    if c<=0:
        break
    a-=d
    ans+=1
    if a<=0:
        break
if ans%2==0:
    print('No')
else:
    print('Yes')
Buggy python submission (verdict: Runtime Error):
n,w=map(int,input().split())
a=[0]*(w+1)
for i in range(n):
    b=a.copy()
    x,y=map(int,input().split())
    for j in range(min(x,w),w+1):
        b[j]=max(a[j-x]+y,a[j])
    a=b.copy()
print(max(a))
        



Fixed submission:
n=input()
from sys import stdin,stdout
l=list(map(int,stdin.readline().split()))
l1=[0,abs(l[1]-l[0])]
for i in range(2,n):
    l1.append(min(abs(l[i-1]-l[i])+l1[-1],abs(l[i-2]-l[i])+l1[-2]))
stdout.write(str(l1[-1])+'\n')
Buggy python submission (verdict: Runtime Error):
n,w=map(int,input().split())
a=[0]*(w+1)
for i in range(n):
    b=a.copy()
    x,y=map(int,input().split())
    for j in range(min(x,w),w+1):
        b[j]=max(a[j-x]+y,a[j])
    a=b.copy()
print(max(b))
        



Fixed submission:
n,w=map(int,input().split())
from copy import copy
a=[0]*(w+1)
for i in range(n):
    b=copy(a)
    x,y=map(int,input().split())
    for j in range(min(x,w),w+1):
        b[j]=max(a[j-x]+y,a[j])
    a=copy(b)
print(max(a))

Buggy python submission (verdict: Runtime Error):
n,w=map(int,input().split())
a=[0]*(w+1)
for i in range(n):
    b=a.copy()
    x,y=map(int,input().split())
    for j in range(min(x,w),w+1):
        b[j]=max(a[j-x]+y,a[j])
    a=b.copy()
print(max(a))
        



Fixed submission:
n,w=map(int,input().split())
from copy import copy
a=[0]*(w+1)
for i in range(n):
    b=copy(a)
    x,y=map(int,input().split())
    for j in range(min(x,w),w+1):
        b[j]=max(a[j-x]+y,a[j])
    a=copy(b)
print(max(a))
Buggy python submission (verdict: Runtime Error):
a, b, c = map(int, raw_input().split)
middle = (a + c)/2

if b == middle:
  print("YES")
else:
  print("NO")

Fixed submission:
a, b, c = [ int(i) for i in input().split() ]
middle = (a + c)/2
 
if b == middle:
  print("YES")
else:
  print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))
    visited = [0]
    now = 0
    for k in range(K):
        now = A[now] - 1
        if now in visited:
            start = visited.index(now)
            visited = visited[start:]
            shuki = k + 1 - start
            print(visited[(K - start) % shuki] + 1)
            return
        visited.append(now)
    print(visited[-1] + 1)



if __name__ == '__main__':
    main()


Fixed submission:
#!/usr/bin/env python3


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))
    visited = [0]
    visited_set = set()
    now = 0
    for k in range(K):
        now = A[now] - 1
        if now in visited_set:
            start = visited.index(now)
            shuki = k + 1 - start
            print(visited[start:][(K - start) % shuki] + 1)
            return
        visited.append(now)
        visited_set.add(now)
    print(visited[-1] + 1)



if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
import sys
import math

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

def lcm(x, y):
    return (x * y) // math.gcd(x, y)
    
A, B = lr()
print(lcm(A, B))

Fixed submission:
import sys
import fractions

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

A, B = lr()
print(lcm(A, B))
Buggy python submission (verdict: Time Limit Exceeded):
import sys
import bisect
sys.setrecursionlimit(10 ** 9)
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

_, M = lr()
A = lr()

A.sort()
for m in range(M):
    a = A[-1] // 2
    i = bisect.bisect_left(A, a)
    A.insert(i, a)
    A = A[:-1]
print(sum(A))


Fixed submission:
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

import heapq
n, m = lr()
a = list(map(lambda x: - int(x), input().split()))
heapq.heapify(a)
for i in range(m):
    b = heapq.heappop(a) * (-1)
    b //= 2
    heapq.heappush(a, -b)
print(-sum(a))
Buggy python submission (verdict: Runtime Error):
W, H, x, y = map(int, input().split())
print(W * H / 2, 1 if W / x == 2 and H / y == 2 else 0)


Fixed submission:
W, H, x, y = map(int, input().split())
print(W * H / 2, 1 if x != 0 and y != 0 and W / x == 2 and H / y == 2 else 0)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(10 ** 9)
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N, M = lr()
A = []
for m in range(M):
    a = ir()
    A.append(a)
C = [0 for _ in range(N+1)]
C[0] = 1
for i in range(len(C)):
    if i in A:
        continue
    if i >= 2:
        C[i] += C[i-2]
        C[i] += C[i-1]
        C[i] %= 1000000007
    elif i >= 1:
        C[i] += C[i-1]
        C[i] %= 1000000007

print(C[N] % 1000000007)


Fixed submission:
import sys
sys.setrecursionlimit(10 ** 9)
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N, M = lr()
A = {i: False for i in range(N+1)}
for m in range(M):
    a = ir()
    A[a] = True
C = [0 for _ in range(N+1)]
C[0] = 1
for i in range(len(C)):
    if A[i]:
        continue
    if i >= 2:
        C[i] += C[i-2]
        C[i] += C[i-1]
        C[i] %= 1000000007
    elif i >= 1:
        C[i] += C[i-1]
        C[i] %= 1000000007

print(C[N] % 1000000007)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(10 ** 9)
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N, M = lr()
A = []
for m in range(M):
    a = ir()
    A.append(a)
C = [0 for _ in range(N+1)]
C[0] = 1
for i in range(len(C)):
    if i in A:
        continue
    if i >= 2:
        C[i] += C[i-2]
    if i >= 1:
        C[i] += C[i-1]

print(C[N] % 1000000007)


Fixed submission:
import sys
sys.setrecursionlimit(10 ** 9)
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N, M = lr()
A = {i: False for i in range(N+1)}
for m in range(M):
    a = ir()
    A[a] = True
C = [0 for _ in range(N+1)]
C[0] = 1
for i in range(len(C)):
    if A[i]:
        continue
    if i >= 2:
        C[i] += C[i-2]
        C[i] += C[i-1]
        C[i] %= 1000000007
    elif i >= 1:
        C[i] += C[i-1]
        C[i] %= 1000000007

print(C[N] % 1000000007)
Buggy python submission (verdict: Time Limit Exceeded):
H, W = map(int, input().split())
lab = ["" for _ in range(H)]
L = [[0 for _ in range(W+2)] for _ in range(H+2)]
R = [[0 for _ in range(W+2)] for _ in range(H+2)]
D = [[0 for _ in range(W+2)] for _ in range(H+2)]
U = [[0 for _ in range(W+2)] for _ in range(H+2)]
for h in range(H):
    lab[h] = input()
for h in range(H):
    for w in range(W):
        if lab[h][w] == ".":
            L[h+1][w+1] = L[h+1][w] + 1
            U[h+1][w+1] = U[h][w+1] + 1
for h in range(H):
    for w in range(W):
        if lab[H-h-1][W-w-1] == ".":
            R[H-h][W-w] = R[H-h][W-w+1] + 1
            D[H-h][W-w] = D[H-h+1][W-w] + 1
m = 0
for h in range(H):
    for w in range(W):
        m = max(m, L[h+1][w+1] + R[h+1][w+1] + D[h+1][w+1] + U[h+1][w+1] - 3)
print(m)


Fixed submission:
import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

H, W = lr()

S = [list(sr()) for _ in range(H)]
S = np.array([[1 if x == '.' else 0 for x in row] for row in S])

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

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


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

Buggy python submission (verdict: Time Limit Exceeded):
H, W = map(int, input().split())
lab = ["" for _ in range(H)]
vir = [[0 for _ in range(W+2)] for _ in range(H+2)]
hor = [[0 for _ in range(W+2)] for _ in range(H+2)]
for h in range(H):
    lab[h] = input()
for h in range(H):
    for w in range(W):
        if lab[h][w] == ".":
            if vir[h][w+1] > 0:
                vir[h+1][w+1] = vir[h][w+1]
            else:
                for h2 in range(h, H):
                    if lab[h2][w] == '.':
                        vir[h+1][w+1] += 1
                    else:
                        break
            if hor[h+1][w] > 0:
                hor[h+1][w+1] = hor[h+1][w]
            else:
                for w2 in range(w, W):
                    if lab[h][w2] == '.':
                        hor[h+1][w+1] += 1
                    else:
                        break
m = 0
for h in range(H):
    for w in range(W):
        m = max(m, vir[h+1][w+1] + hor[h+1][w+1] - 1)
print(m)


Fixed submission:
import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

H, W = lr()

S = [list(sr()) for _ in range(H)]
S = np.array([[1 if x == '.' else 0 for x in row] for row in S])

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

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


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