Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

import fractions
import collections

A, B = map(int, input().split())

GCD = fractions.gcd(A, B)





def primes_ordered_dict(n):
    #
    prime_list = []
    non_prime_list = []
    number_dict = collections.OrderedDict(
        ((i, None) for i in range(n + 1)))
    #
    del number_dict[0]
    del number_dict[1]
    while True:
        # get prime
        prime, _ = number_dict.popitem(False)
        if A % prime == 0 and B % prime == 0:
            prime_list.append(prime)
        # break
        if not (prime * prime <= n):
            break
        # get non primes
        non_prime_list.append(prime * prime)
        for k in number_dict:
            if prime * k <= n:
                non_prime_list.append(prime * k)
            else:
                break
        # delete non primes
        for non_prime in non_prime_list:
            del number_dict[non_prime]
        non_prime_list.clear()

    # add rest of numbers as prime
    prime_list.extend(
        [prime for prime, _ in number_dict.items() if A % prime == 0 and B % prime == 0])

    return prime_list

if GCD == 1:
    print(1)
else:
    print(len(primes_ordered_dict(GCD))+1)

### FIXED CODE ###

import collections
import math

A, B = map(int, input().split())


def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
     # divisors.sort()
    return divisors



def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True

A_div = set(make_divisors(A))
B_div = set(make_divisors(B))
common_div = (A_div & B_div)

cnt = 1
for c in common_div:
    if is_prime(c):
        cnt += 1

print(cnt)
### BUGGY CODE ###

import heapq


def heappush_max(heap, item):
    heap.append(item)
    heapq._siftdown_max(heap, 0, len(heap) - 1)


def heappop_max(heap):
    lastelt = heap.pop()
    if heap:
        return_item = heap[0]
        heap[0] = lastelt
        heapq._siftup_max(heap, 0)
        return return_item
    return lastelt


X, Y, Z, K = map(int, input().split())
A = sorted([int(i) for i in input().split()], reverse=True)
B = sorted([int(i) for i in input().split()], reverse=True)
C = sorted([int(i) for i in input().split()], reverse=True)
ans = []
heap_queue = []
for i in range(X):
    for j in range(Y):
        for k in range(Z):
            heappush_max(heap_queue, A[i] + B[j] + C[k])
for k in range(K):
    print(heappop_max(heap_queue))


### FIXED CODE ###

def main():
    X, Y, Z, K = map(int, input().split())
    A = [int(i) for i in input().split()]
    B = [int(i) for i in input().split()]
    C = [int(i) for i in input().split()]

    AB = []
    ABappend = AB.append
    for i in range(X):
        for j in range(Y):
            ABappend(A[i] + B[j])
    AB.sort(reverse=True)
    ABC = []
    ABCappend = ABC.append
    for i in range(min(K, X*Y)):
        for j in range(Z):
            ABCappend(AB[i] + C[j])
    ABC.sort(reverse=True)
    print('\n'.join(map(str, ABC[:K])))


if __name__ == '__main__':
    main()
### BUGGY CODE ###

n,m = map(int,input().split())
a = [int(input()) for _ in range(m)]
dp=[0 for _ in range(n+1)]
dp[0]=1
for i in range(1,n+1):
    if i in a:
        continue
    else:
        if i==1:
            dp[1]=1
        else:
            dp[i] = dp[i-1]+dp[i-2]
print(dp[n]%1000000007)

### FIXED CODE ###

n,m = map(int,input().split())
ans = [1]*(n+1)
for i in range(m):
    a = int(input())
    ans[a] = 0
    
for i in range(2,n+1):
    if ans[i]==0:
        continue
    else:
        ans[i] = ans[i-2] + ans[i-1]
print(ans[n]%(10**9+7))
### BUGGY CODE ###

import numpy as np
N = int(input())
A = np.array(list(map(int, input().split())))

K = len(bin(np.max(A))) - 2

ans = 0
mod = 10 ** 9 + 7
power = 1

for i in range(K):
    bit = sum(A >> i & 1)
    ans += power * bit * (N - bit)
    ans %= mod
    power *= 2
    power %= mod

print(ans)

### FIXED CODE ###

import numpy as np
N = int(input())
A = np.array(list(map(int, input().split())))

K = len(bin(np.max(A))) - 2

ans = 0
mod = 10 ** 9 + 7
N %= mod

for i in range(K):
    bit = np.count_nonzero(A >> i & 1) % mod
    ans += 2 ** i * bit * (N - bit)
    ans %= mod
    
print(ans)
### BUGGY CODE ###

import sys

def is_prime(x,y):
    while(y < x):
        if(x % y == 0):
            return 0
        y += 2
    return 1

a = ""
l = []
count = 0
for input in sys.stdin:
    a += input
l = (a.split())
b = int(l[0])
l = sorted(set(l[1:]))
for i in l:
    if(int(i) == 2):
        count += 1
    elif(int(i) > 2 and int(i) % 2 != 0 and is_prime(int(i),3) == 1):
        count += 1
print count


### FIXED CODE ###

import sys

def is_prime(x):
    if(x <= 3 and x > 1):
        return True
    elif(x % 2 == 0 or x % 3 == 0 or x < 2):
        return False
    i = 5
    while(i * i <= x):
        if(x % i == 0 or x % (i + 2) == 0):
            return False
        i += 6
    return True

l = []
count = 0
for input in sys.stdin:
    l.append(int(input))
for data in range(1,len(l)):
    if(is_prime(l[data]) == True):
        count += 1
print count
### BUGGY CODE ###

N=int(input())
A=[int(input()) for i in range(N)]
for i in range(N):
    print(max(A[:i]+A[i+1:]))

### FIXED CODE ###

N=int(input())
A=[int(input()) for i in range(N)]
maximum=max(A)
maximum2=sorted(A)[-2]
for a in A:
    if a!=maximum:
        print(maximum)
    else:
        print(maximum2)
### BUGGY CODE ###

MOD = 10**9 + 7
n, oddness = [int(item) for item in input().split()]
# Oddness must be even
if oddness % 2 ==  1:
    print(0)
    exit()
oddness //= 2
max_oddness = 1300 + n
max_pending = n + 1

dp = [[[0] * (max_oddness) for _ in range(max_pending)] for _ in range(n)]
dp[0][0][0] = 1
dp[0][1][1] = 1
for i in range(1, n):
    for j in range(i+1):
        # Too many pending items 
        if j > n // 2:
            break
        for k in range(1300):
            # Connect in line
            # Oddness increase by num of pending item
            dp[i][j][k+j] += dp[i-1][j][k]
            # Choose 1 from pending items
            dp[i][j][k+j] += dp[i-1][j][k] * j*2 
            dp[i][j][k+j] %= MOD
            # Choose 2 from pending items
            if j > 0:
                dp[i][j-1][k+j-1] += dp[i-1][j][k] * j*j
                dp[i][j-1][k+j-1] %= MOD 
            # Do nothing 
            dp[i][j+1][k+j+1] += dp[i-1][j][k] 
            dp[i][j+1][k+j+1] %= MOD 

print(dp[n-1][0][oddness])

### FIXED CODE ###

MOD = 10**9 + 7
n, oddness = [int(item) for item in input().split()]
# Oddness must be even
if oddness % 2 ==  1:
    print(0)
    exit()
oddness //= 2
max_oddness = n*n + n
max_pending = n + 1

dp = [[[0] * (max_oddness) for _ in range(max_pending)] for _ in range(n)]
oddness_itr = [item for item in range(n*n)]
for i in range(n):
    if i == 0:
        dp[0][0][0] = 1
        dp[0][1][1] = 1
        continue
    for j in range(i+1):
        for k in oddness_itr:
            # Connect in line
            # Oddness increase by num of pending item
            dp[i][j][k+j] += dp[i-1][j][k]
            # Choose 1 from pending
            dp[i][j][k+j] += dp[i-1][j][k] * j*2 
            dp[i][j][k+j] %= MOD
            # Choose 2 from pending
            if j > 0:
                dp[i][j-1][k+j-1] += dp[i-1][j][k] * j*j
                dp[i][j-1][k+j-1] %= MOD 
            # Do nothing 
            dp[i][j+1][k+j+1] += dp[i-1][j][k] 
            dp[i][j+1][k+j+1] %= MOD 

print(dp[n-1][0][oddness])
### BUGGY CODE ###

# 貰うDP
N,K=map(int,input().split())
h=[int(_) for _ in input().split()]

INF=10**9
dp=[INF]*(N)
dp[0]=0

for n in range(1,N):
    dp[n]=min([dp[k] + abs(h[n] - h[k]) for k in range(max(0,n-K), n)])
print(dp[N-1])

### FIXED CODE ###

# 貰うDP
N,K=map(int,input().split())
h=list(map(int,input().split()))
INF=10**9
dp=[INF]*(N)
dp[0]=0

for n in range(1,N):
    dp[n]=min([dp[k] + abs(h[n] - h[k]) for k in range(max(0,n-K), n)])
print(dp[N-1])
### BUGGY CODE ###

from itertools import accumulate
n = int(input())
a = [int(i) for i in input().split()]
b = list(accumulate(a))
ans = 0
c = list(set(b))
for cc in c:
    num = b.count(cc)
    ans += (num * (num - 1)) // 2
ans += b.count(0)
print(ans)

### FIXED CODE ###

from itertools import accumulate
import collections
n = int(input())
a = [int(i) for i in input().split()]
b = list(accumulate(a))
c = collections.Counter(b)
ans = sum([((num * (num - 1)) // 2) for num in c.values()])
ans += c[0]
print(ans)
### BUGGY CODE ###

a,b = (int(i) for i in input().split())
ans = 0
while a <= b:
  ans ^= a
  a += 1
print(ans)

### FIXED CODE ###

a,b = (int(i) for i in input().split())
ans = 0
if a % 2 == 0:
  temp = (b - a + 1) % 4 
  for i in range(b-temp+1,b+1):
    ans ^= i
else:
  temp = (b - a) % 4 
  ans ^= a
  for i in range(b-temp+1,b+1):
    ans ^= i
print(ans)
### BUGGY CODE ###

import sys
input = sys.stdin.buffer.readline

H, N = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(N)]
INF = 10 ** 15

dp = [INF] * (H + 1)
dp[0] = 0
for a, b in AB:
  for i in range(H):
    if dp[i] != INF:
      dp[min(i + a, H)] = min(dp[min(i + a, H)], dp[i] + b)

print(dp[-1])

### FIXED CODE ###

import sys
input = sys.stdin.buffer.readline

H, N = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(N)]

INF = 10 ** 15
dp = [INF] * (H + 1)
dp[0] = 0

answer = INF
for a, b in AB:
  for i in range(H + 1):
    if dp[i] != INF:
      if i + a < H:
        dp[i + a] = min(dp[i + a], dp[i] + b)
      else:
        answer = min(dp[i] + b, answer)
        
print(answer)
### BUGGY CODE ###

a,b,x=map(int,input().split())
s=0
for i in range(a,b+1):
    if (i%x==0):
        s+=1
print(s)
        


### FIXED CODE ###

a,b,x=map(int,input().split())
if a==0:
    s=b//x+1
else:
    s=b//x-(a-1)//x
print(s)
### BUGGY CODE ###

from collections import Counter
N, K =  map(int, (input().split(' ')))
sushi = [tuple(map(int, input().split(' '))) for _ in range(N)]
all_sushi = sorted(sushi, key=lambda x: -x[1])
default_sushi = all_sushi[:K]
amari = all_sushi[K:]
counter = Counter([i[0] for i in default_sushi])
result = []
def calc_value(sushi):
    return sum([i[1] for i in sushi]) + len(counter)**2

fs = []
def change_sushi(sushi):
    oishisa = sum([i[1] for i in sushi])
    fs.append(oishisa + len(counter)**2)
    for s in sushi[::-1]:
        if counter[s[0]] >= 2:
            for i, a in enumerate(amari):
                if a[0] not in counter:
                    counter[s[0]] -= 1
                    counter[a[0]] += 1
                    oishisa = oishisa - s[1] + a[1]
                    #amari = amari[:i] + amari[i+1:]
                    #sushi = [a] + sushi[:-1]
                    #return sushi
                    fs.append(oishisa + len(counter)**2)
    print(max(fs))
    exit()
            
    
def get_sushi(sushi):
    #result.append(calc_value(sushi))
    changed_sushi = change_sushi(sushi)
    #if not changed_sushi:
        #print(max(result))
        #return
    #get_sushi(changed_sushi)

get_sushi(default_sushi)


### FIXED CODE ###

from collections import Counter
N, K =  map(int, (input().split(' ')))
sushi = [tuple(map(int, input().split(' '))) for _ in range(N)]
all_sushi = sorted(sushi, key=lambda x: -x[1])
default_sushi = all_sushi[:K]
amari = all_sushi[K:]
len_amari = len(amari)
counter = Counter([i[0] for i in default_sushi])
result = []
def calc_value(sushi):
    return sum([i[1] for i in sushi]) + len(counter)**2

fs = []
def change_sushi(sushi):
    oishisa = sum([i[1] for i in sushi])
    fs.append(oishisa + len(counter)**2)
    amari_index = 0
    for s in sushi[::-1]:
        if counter[s[0]] >= 2:
            while amari_index < len_amari:
                a = amari[amari_index]
                amari_index += 1
                if a[0] not in counter:
                    counter[s[0]] -= 1
                    counter[a[0]] += 1
                    oishisa = oishisa - s[1] + a[1]
                    fs.append(oishisa + len(counter)**2)
                    break
    print(max(fs))
    exit()
            
    
def get_sushi(sushi):
    #result.append(calc_value(sushi))
    changed_sushi = change_sushi(sushi)
    #if not changed_sushi:
        #print(max(result))
        #return
    #get_sushi(changed_sushi)

get_sushi(default_sushi)
### BUGGY CODE ###

import collections

# 入力
N = int(input())
c = collections.Counter(list(map(int, input().split())))

# DPテーブルを初期化
dp = [[[0 for k in range(310)] for j in range(310)] for i in range(310)]


for k in range(c[3] + 1):
    for j in range(c[2]+c[3]-k + 1):
        for i in range(c[1]+c[2]+c[3]-j-k + 1):
            if i == j == k == 0:
                continue
            dp[i][j][k] = (N+i*dp[i - 1][j][k]+j *
                           dp[i + 1][j - 1][k]+k*dp[i][j + 1][k - 1])/(i+j+k)


# 答えを得て出力
print(dp[c[1]][c[2]][c[3]])


### FIXED CODE ###

import collections

# 入力
N = int(input())
c = collections.Counter(list(map(int, input().split())))

# DPテーブルを初期化
dp = [[[0.0 for k in range(310)] for j in range(310)] for i in range(310)]


for k in range(0, c[3] + 1):
    for j in range(0, c[2]+c[3]-k + 1):
        for i in range(0, c[1]+c[2]+c[3]-j-k + 1):
            if i == j == k == 0:
                continue
            dp[i][j][k] = (N+i*dp[i - 1][j][k]+j *
                           dp[i + 1][j - 1][k]+k*dp[i][j + 1][k - 1])/(i+j+k)


# 答えを得て出力
print(dp[c[1]][c[2]][c[3]])
### BUGGY CODE ###

S=input()
Q=int(input())
for i in range(Q):
  q = input()
  if len(q)==1:S=S[::-1]
  else:
    n,f,c=q.split()
    if f=='1':S=c+S
    else:S=S+c
print(S)

### FIXED CODE ###

S=input()
Q=int(input())
rev = 0
front, back=[],[]
for i in range(Q):
  q = input()
  if len(q)==1:rev = 1- rev
  else:
    n,f,c=q.split()
    if f=='1' and rev==0:
      front.append(c)
    elif f=='2' and rev==1:
      front.append(c)
    elif f=='1' and rev==1:
      back.append(c)
    elif f=='2' and rev == 0:
      back.append(c)

if rev==0:
  S = ''.join(front[::-1]) + S + ''.join(back)
else:
  S = ''.join(back[::-1]) + S[::-1] + ''.join(front)
print(S)
### BUGGY CODE ###

def main():
    A = list(map(int,input().split()))
    N = A[0]
    X = A[1]
    Y = A[2]
    list1 = [[0 for i in range(N)] for j in range(N)]
    ans = [0 for i in range(N-1)]

    for i in range(N):
        for j in range(N):
            if abs(i-j) == 1:
                list1[i][j] = 1
            elif i == X-1 and j == Y-1:
                list1[i][j] = 1
            elif i == Y-1 and j == X-1:
                list1[i][j] = 1
            else:
                list1[i][j] = N*2

    for l in range(N):
        for i in range(N):
            for j in range(N):
                list1[i][j] = min(list1[i][j], list1[i][l]+list1[l][j])

    for i in range(N):
        for j in range(i+1,N):
            if(list1[i][j] < N):
                ans[list1[i][j]-1] += 1

    for i in ans:
        print(i)


main()

### FIXED CODE ###

def main():
    A = list(map(int,input().split()))
    N = A[0]
    X = A[1]
    Y = A[2]
    list1 = [[0 for i in range(N)] for j in range(N)]
    ans = [0 for i in range(N-1)]

    for i in range(N):
        for j in range(i+1,N):
            list1[i][j] = min(j-i,abs(X-1-i)+1+abs(j-Y+1), abs(Y-1-i)+1+abs(j-X+1))
            ans[list1[i][j]-1] += 1

    for i in ans:
        print(i)


main()
### BUGGY CODE ###

import sys
n = int(sys.stdin.readline())
A = [int(sys.stdin.readline()) for _ in range(n)]
tmp = sorted(A)
for i in range(n):
    if A[i] == max(A):
        print(tmp[-2])
    else:
        print(max(A))

### FIXED CODE ###

import sys
n = int(sys.stdin.readline())
A = [int(sys.stdin.readline()) for _ in range(n)]
tmp = sorted(A)
maxa = max(A)
for i in range(n):
    if A[i] == maxa:
        print(tmp[-2])
    else:
        print(maxa)
### BUGGY CODE ###

def solve():
    n, m = map(int, raw_input().split())
    edge = {v:[] for v in range(1,n+1)}
    dist = {}
    for i in range(m):
        l, r, d = map(int, raw_input().split())
        edge[l].append(r)
        edge[r].append(l)
        dist[l,r] = d
        dist[r,l] = -d
    return "Yes" if ok(edge, dist, n) else "No"

def ok(edge, dist, n):
    used = [False] * (n+1)
    used[0] = True
    path = {}
    for s in range(1, n+1):
        if used[s]:
            continue
        que = [s]
        path[s, s] = 0
        used[s] = True
        while que:
            u = que.pop(0)
            for v in edge[u]:
                d = path[s,u] + dist[u,v]
                if not (s,v) in path:
                    path[s,v] = d
                    if not used[v]:
                        que.append(v)
                    used[v] = True
                elif d != path[s,v]:
                    return False
    return True

print solve()

### FIXED CODE ###

def solve():
    n, m = map(int, raw_input().split())
    edge = {v:[] for v in range(1,n+1)}
    dist = {}
    for i in range(m):
        l, r, d = map(int, raw_input().split())
        edge[l].append(r)
        edge[r].append(l)
        dist[l,r] = d
        dist[r,l] = -d
    return "Yes" if ok(edge, dist, n) else "No"

def ok(edge, dist, n):
    used = [False] * (n+1)
    used[0] = True
    path = {}
    for s in range(1, n+1):
        if used[s]:
            continue
        que = [s]
        path[s, s] = 0
        used[s] = True
        while que:
            u = que.pop()
            for v in edge[u]:
                d = path[s,u] + dist[u,v]
                if not used[v]:
                    path[s,v] = d
                    que.append(v)
                    used[v] = True
                elif d != path[s,v]:
                    return False
    return True

print solve()
### BUGGY CODE ###

import sys
input = sys.stdin.readline
num = []
num = [int(i) for i in input().split()]

gate = []

for temp in range(num[1]):
    temp = []
    temp = [int(i) for i in input().split()]
    gate.append(temp)

check = [0] * num[0]

for temp in gate:
    while temp[0] <= temp[1]:
        check[temp[0]-1] += 1
        temp[0] += 1

print(check.count(num[1]))

### FIXED CODE ###

import sys
input = sys.stdin.readline
num = []
num = [int(i) for i in input().split()]

syou = []
dai = []

for temp in range(num[1]):
    suuzi = []
    suuzi = [int(i) for i in input().split()]
    syou.append(suuzi[0])
    dai.append(suuzi[1])

result= min(dai) - max(syou) + 1
if result > 0:
    print(result)
else:
    print(0)
### BUGGY CODE ###

import collections
import math
s = input()
n = len(s)
cnt = 0
lista = []
for i in range(n):
    inta = int(s[-i - 1:n])
    lista.append(inta)
listb = []
for i in range(n):
    intb = lista[i] % 2019
    listb.append(intb)
c = collections.Counter(listb)
for i in listb:
    if i == 0:
        cnt += 1
for i in c.most_common():
    match = i[1]
    if match >= 2:
        cnt += match * (match - 1) // 2
    else:
       break
print(cnt)

### FIXED CODE ###

mod = [0]
pw = 1
for c in input()[::-1]:
    # 大きい数字での計算方法
    # a と z が互いに素のとき
    # x == y (mod z)なら
    # ax == ay (mod z)
    # 10000 == 1924 (mod 2019)
    # 100000 == 19240 (mod 2019)
    # 100000 == 1060 (mod 2019) 前のpwを10で掛けた分に2019を割る
    mod.append((int(c) * pw + mod[-1]) % 2019)
    pw = pw * 10 % 2019
from collections import *
# 8646 % 2019 = 余り570
# 282668646 % 2019 = 余り570
# 282668646 - 8646 = 282660000
# 282660000 % 2019 = 140000 余り0
# 余りが同じものをn(n - 1) / 2する
print(sum(v * (v - 1) // 2 for v in Counter(mod).values()))
### BUGGY CODE ###

import numpy as np

N = int(input())


def search_prime_num(x):
    max = int(np.sqrt(x))
    seachList = [i for i in range(2, x + 1)]
    primeNum = []
    while seachList[0] <= max:
        primeNum.append(seachList[0])
        tmp = seachList[0]
        seachList = [i for i in seachList if i % tmp != 0]
    primeNum.extend(seachList)
    return primeNum


factor_list = search_prime_num(N)


def factorization(n):
    arr = []
    temp = n
    for i in factor_list:
        if i > int(-(-n**0.5//1))+1:
            break
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])

    if temp != 1:
        arr.append([temp, 1])

    if arr == []:
        arr.append([n, 1])

    return arr


ans = 1

for j in range(2, N):
    factors = factorization(j)
    buf = 1
    for factor in factors:
        buf *= (factor[1] + 1)
    ans += buf

print(ans)


### FIXED CODE ###

N = int(input())

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

print(ans)
### BUGGY CODE ###

import sys
N = int(input())
num_list = list(map(int, input().split()))
c = 1
for i in range(N):
        c = c * num_list[i]

if c <= 10 ** 18:
    print(c)
else:
    print(-1)

### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
ans = 1

if 0 in A:
  ans = 0
  N = 0

for i in range(N):
  ans *= A[i]
  if ans > 10**18:
    ans = -1
    break

print(ans)
### BUGGY CODE ###

from copy import deepcopy
dp = {}
dpa = {}

N = int(input())
A = list(map(int, input().split()))

balls = {}
fact = 1
for (i, a) in enumerate(A):
  if a in balls:
    balls[a] += 1
  else:
    balls[a] = 1

for a in A:
  if not a in dpa:
    check_balls = deepcopy(balls)
    check_balls[a] -= 1
    res = 0
    for count in check_balls.values():
      if not count in dp:
        dp[count] = count * (count-1) // 2
      res += dp[count]
    dpa[a] = res
  print(dpa[a])

### FIXED CODE ###

from copy import deepcopy
dp = {0: 0}

N = int(input())
A = list(map(int, input().split()))

balls = {}
fact = 1
for (i, a) in enumerate(A):
  count = i+1
  dp[count] = count * (count-1) // 2
  if a in balls:
    balls[a] += 1
  else:
    balls[a] = 1

res = 0
for count in balls.values():
  res += dp[count]

for a in A:
  print(res - dp[balls[a]] + dp[balls[a]-1])
### BUGGY CODE ###

H, W = map(int, input().split())
S = []
for i in range(H):
  S.append(str(input()))
  
def main(i, j):
  global S
  global H
  global W
  a = 1
  u, d, l, r = i, i, j, j
  while u > 0:
    u -= 1
    if S[u][j] == '.':
      a += 1
    else:
      break
  while d < H-1:
    d += 1
    if S[d][j] == '.':
      a += 1
    else:
      break
  while l > 0:
    l -= 1
    if S[i][l] == '.':
      a += 1
    else:
      break
  while r < W-1:
    r += 1
    if S[i][r] == '.':
      a += 1
    else:
      break
  return a
  
ans = 0
for i in range(H):
  for j in range(W):
    if S[i][j] == '.':
      ans = max(ans, main(i, j))
print(ans)


### FIXED CODE ###

H, W = map(int, input().split())
S = []
l1 = []
for i in range(H):
  s = str(input())
  S.append(s)
  tmp = []
  cnt = 0
  flag = False
  for j in s:
    if flag:
      if j == '.':
        cnt += 1
      else:
        for k in range(cnt):
          tmp.append(cnt)
        cnt = 0
        tmp.append(0)
        flag = False
    else:
      if j == '.':
        flag = True
        cnt += 1
      else:
        tmp.append(0)
  if cnt > 0:
    for k in range(cnt):
      tmp.append(cnt)
  l1.append(tmp)

l2 = []
for i in range(W):
  tmp = []
  cnt = 0
  flag = False
  for j in range(H):
    x = S[j][i]
    if flag:
      if x == '.':
        cnt += 1
      else:
        for k in range(cnt):
          tmp.append(cnt)
        cnt = 0
        tmp.append(0)
        flag = False
    else:
      if x == '.':
        flag = True
        cnt += 1
      else:
        tmp.append(0)
  if cnt > 0:
    for k in range(cnt):
      tmp.append(cnt)
  l2.append(tmp)

ans = [[0]*W for i in range(H)]
m = 0
for i in range(H):
  for j in range(W):
    if (l1[i][j]>0) and (l2[j][i]>0):
      ans[i][j] = l1[i][j] + l2[j][i] - 1
    else:
      ans[i][j] = l1[i][j] + l2[j][i]
    m = max(m, ans[i][j])
print(m)