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

n = int(input())
A = sorted(map(int, input().split()))

U = 10**6
line = [1]*(U+1)
ans = set()
depricated = set()
cnt = [0]*(U+1)
for a in A:
    cnt[a] += 1
    if cnt[a] == 2 and line[a]:
        depricated.add(a)
    if line[a]:
        ans.add(a)
        for p in range(2*a, U+1, a):
            line[p] = 0
print(len(ans)-len(depricated))


### FIXED CODE ###

n = int(input())
A = sorted(map(int, input().split()))
used = set()

U = A[-1]+1
is_prime = [1]*U
cnt = [0]*U
depri = 0
for a in A:
    cnt[a] += 1
    if cnt[a] == 2 and is_prime[a]:
        depri += 1
    if is_prime[a]:
        used.add(a)
        for q in range(2*a, U, a):
            is_prime[q] = 0
print(len(used)-depri)
### BUGGY CODE ###

N = int(input())

t, a = map(int, input().split())

for i in range(N - 1):
    nt, na = map(int, input().split())
    pt, pa = nt, na
    while pt < t or pa < a:
        pt += nt
        pa += na
    t = pt
    a = pa
print(t + a)


### FIXED CODE ###

N = int(input())

t, a = map(int, input().split())

for i in range(N - 1):
    nt, na = map(int, input().split())
    p = max(t // nt, a // na)
    pt = nt * p
    pa = na * p
    while pt < t or pa < a:
        pt += nt
        pa += na
    t = pt
    a = pa
print(t + a)
### BUGGY CODE ###

def main():
    S=list(str((input())))
    Q=int(input())
    for _ in range(Q):
        T=list(map(str,input().split()))
        if T[0]=="1":
            S.reverse()
        else:
            if T[1]=="1":
                S.insert(0,T[2])
            else:
                S.append(T[2])

    print("".join(S))

main()

### FIXED CODE ###

from collections import deque

S=deque(str((input())))
Q=int(input())
t=0
for _ in range(Q):
    T=list(map(str,input().split()))
    if T[0]=="1":
        t+=1
    else:
        if (T[1]=="1" and t%2 == 0) or (T[1]=="2" and t%2 != 0):
            S.appendleft(T[2])
        else:
            S.append(T[2])


if t%2 != 0:
    S.reverse()

print("".join(S))
### BUGGY CODE ###

S = input()[:-2]
while len(S) >= 0:
    if S[:len(S) // 2] == S[len(S) // 2:]:
        print(len(S))
    S = S[:-2]


### FIXED CODE ###

import sys
S = input()[:-2]
while len(S) > 0:
    if S[:len(S) // 2] == S[len(S) // 2:]:
        print(len(S))
        sys.exit()
    S = S[:-2]
### BUGGY CODE ###

from bisect import bisect_left
n = int(input())
lst = list(map(int,input().split()))
ans = 0
lst.sort()
for i in range(n):
    for j in range(i+1,n):
        b,c = lst[i],lst[j]
        pos = bisect_left(lst,b+c)
        tmp = n - 1 - pos
        for k in range(j+1,pos):
            x,y,z = lst[i],lst[j],lst[k]
            if x+y>z and y+z>x and z+x>y:
                ans += 1  
print(ans)

### FIXED CODE ###

from bisect import bisect_left
n = int(input())
lst = list(map(int,input().split()))
ans = 0

lst.sort()

for i in range(n):
    for j in range(i+1,n):
        b,c = lst[i],lst[j]
        posr = bisect_left(lst,b+c)
        posl = max(j+1,bisect_left(lst,abs(b-c)))
        ans += (posr - posl)
print(ans)
### BUGGY CODE ###

N = int(input())
A = tuple(map(int,input().split()))
mod = 1000000007
ans = 0
B = [0]*(N-1)
for i in range(N-1):
    B[i] = sum(A[i+1:])%mod
for i in range(N-1):
    ans += A[i]*B[i]%mod
    ans %= mod
print(ans)

### FIXED CODE ###

N = int(input())
A = tuple(map(int,input().split()))
mod = 10**9+7
B = [0]*N
for i in range(N):
    B[i] = A[i]**2
s1, s2 = 0, 0 
for i in range(N):
    s1 += A[i]
    s2 += B[i]
s1 = s1**2
ans = (s1 -s2)//2%mod
print(ans)
### BUGGY CODE ###

import sys
import math
import itertools as it
def i():return int(sys.stdin.readline().replace("\n",""))
def i2():return map(int,sys.stdin.readline().replace("\n","").split())
def s():return str(sys.stdin.readline().replace("\n",""))
def l():return list(sys.stdin.readline().replace("\n",""))
def intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def lx():return list(map(lambda x:int(x)*-1,sys.stdin.readline().replace("\n","").split()))
def t():return tuple(map(int,sys.stdin.readline().replace("\n","").split()))

if __name__ == "__main__":pass
n = i()
s = [input() for _ in range(n)]
s.sort()
ss = list(set(s))
ss.sort()
a = [0]*len(ss)
i = 0
while n-1 > i:
    if s[i] == s[i+1]:
        a[ss.index(s[i])] += 1
        i += 1
    else:
        i += 1
m = max(a)
for k in range(len(a)):
    if a[k] == m:
        print(ss[k])

### FIXED CODE ###

import sys
import math
import itertools as it
def i():return int(sys.stdin.readline().replace("\n",""))
def i2():return map(int,sys.stdin.readline().replace("\n","").split())
def s():return str(sys.stdin.readline().replace("\n",""))
def l():return list(sys.stdin.readline().replace("\n",""))
def intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def lx():return list(map(lambda x:int(x)*-1,sys.stdin.readline().replace("\n","").split()))
def t():return tuple(map(int,sys.stdin.readline().replace("\n","").split()))

if __name__ == "__main__":pass
n = i()
s = [input() for _ in range(n)]
s.sort()
ss = list(set(s))
ss.sort()
a = [0]*len(ss)
i = 0
j = 0
while n-1 > i:
    if s[i] == s[i+1]:
        a[j] += 1
        i += 1
    else:
        i += 1
        j += 1
m = max(a)
for k in range(len(a)):
    if m == a[k]:
        print(ss[k])
### BUGGY CODE ###

n = int(input())
l = [int(input()) for i in range(n)]
ans = 0
def f(now, i):
  global ans
  if not now % 10 == 0 and now > ans:
    ans = now

  if i >= n:
    return
  
  f(now+l[i] ,i+1)
  f(now, i+1)
f(0, 0)

print(ans)

### FIXED CODE ###

n = int(input())
l = [int(input()) for i in range(n)]
def f():
  ans = sum(l)
  if ans % 10 == 0:
    for i in sorted(l):
      if not (ans - i) % 10 == 0:
        return ans-i
    return 0
  else:
    return ans

print(f())
### BUGGY CODE ###

import bisect
n, m = list(map(int, input().split(' ')))
aaa = list(map(int, input().split(' ')))
aaa = sorted([-a for a in aaa])
len_aaa = len(aaa)

cccbbb = []
for i in range(m):
    b, c = list(map(int, input().split(' ')))
    cccbbb.append((-c, b))
cccbbb = sorted(cccbbb)
for c, b in cccbbb:
    index = bisect.bisect_left(aaa, c)
    if index < len_aaa:
        if b < len_aaa - index:
            ccc = [c] * b
            aaa = (aaa[:index] + ccc + aaa[index:len(aaa) - b])
        else:
            ccc = [c] * (len_aaa - index)
            aaa = (aaa[:index] + ccc)
    else:
        break
print(abs(sum(aaa)))

### FIXED CODE ###

import bisect
n, m = list(map(int, input().split(' ')))
aaa = list(map(int, input().split(' ')))
aaa = sorted([-a for a in aaa])[::-1]
len_aaa = len(aaa)

cccbbb = []
for i in range(m):
    b, c = list(map(int, input().split(' ')))
    cccbbb.append((-c, b))
cccbbb = sorted(cccbbb)
ccc = []
for c, b in cccbbb:
    ccc += [c] * b
    if len(ccc) > len_aaa:
        break
ans = 0
for i in range(len_aaa):
    c = ccc[i] if i < len(ccc) else 0
    ans += min(aaa[i], c)
print(abs(ans))
### BUGGY CODE ###

N,M,P = map(int,input().split())
edge = [[]for i in range(N)]
cost = [-float('inf')]*N
cost[0] = 0
for i in range(M):
    a,b,c = map(int,input().split())
    edge[a-1].append([b-1,c-P])

next = [0]*N
next[0] = 1
for i in range(N-1):
    nenext = [0] * N
    for j in range(N):
        if next[j] == 1:
            for b,c in edge[j]:
                cost[b] = max(cost[b],cost[j]+c)
                nenext[b] = 1
    next = nenext[:]


for j in range(N):
    for b,c in edge[j]:
        if cost[b] < cost[j]+c:
            cost[b] = float('inf')


next[0] = 1
for i in range(N-1):
    nenext = [0] * N
    for j in range(N):
        if next[j] == 1:
            for b,c in edge[j]:
                cost[b] = max(cost[b],cost[j]+c)
                nenext[b] = 1
    next = nenext[:]

if cost[-1] == float('inf'):
    print(-1)
else:
    print(max(cost[-1],0))

### FIXED CODE ###

N,M,P = map(int,input().split())
edge = []
cost = [-float('inf')]*N
cost[0] = 0
for i in range(M):
    a,b,c = map(int,input().split())
    edge.append([a-1,b-1,c-P])

for i in range(N-1):
    for a,b,c in edge:
        cost[b] = max(cost[b],cost[a]+c)


for a,b,c in edge:
    if cost[b] < cost[a]+c:
        cost[b] = float('inf')


for i in range(N-1):
    for a,b,c in edge:
        cost[b] = max(cost[b],cost[a]+c)

if cost[-1] == float('inf'):
    print(-1)
else:
    print(max(cost[-1],0))
### BUGGY CODE ###

s = list(input())
s.reverse()
s += ["0"]
n = len(s)
dp = [[10**7 for _ in range(2)] for _ in range(n+1)]
dp[0][0] = 0
for i in range(n):
	for j in range(2):
		x = int(s[i]) + j
		for a in range(10):
			kurisagaru = False
			if a >= x:
				b = 0
			else:
				b = 10 + a - x
				kurisagaru = True
			dp[i+1][kurisagaru] = min(dp[i+1][kurisagaru], dp[i][j]+a+b)
print(dp[n][0])

### FIXED CODE ###

s = list(input())
s.reverse()
s += ["0"]
n = len(s)
dp = [[10**7 for _ in range(2)] for _ in range(n+1)]
dp[0][0] = 0
for i in range(n):
	for j in range(2):
		x = int(s[i]) + j
		for a in range(10):
			kurisagaru = False
			if a >= x:
				b = 0
			else:
				b = 10 + a - x
				kurisagaru = True
			dp[i+1][kurisagaru] = min(dp[i+1][kurisagaru], dp[i][j]+a+b)
print(dp[n][0])
### BUGGY CODE ###

def bisect(lst, target, l, r):
    cent = (l + r) // 2

    if r - l == 1:
        return r

    if lst[cent] == target:
        return cent
    elif lst[cent] > target:
        return bisect(lst, target, l, cent)
    else:
        return bisect(lst, target, cent, r) 

N = int(input())
sm = []
buf = 0
for i in range(N + 1):
    sm.append(i + buf)
    buf += i

mx = bisect(sm, N, 0, N)

sub = sm[mx] - N

for i in range(1, mx + 1):
    if i != sub:
        print(i)

### FIXED CODE ###

def bisect(lst, target, l, r):
    cent = (l + r) // 2

    if r - l == 1:
        return r

    if lst[cent] == target:
        return cent
    elif lst[cent] > target:
        return bisect(lst, target, l, cent)
    else:
        return bisect(lst, target, cent, r) 

N = int(input())
sm = []
buf = 0
for i in range(N + 1):
    sm.append(i + buf)
    buf += i

mx = bisect(sm, N, 0, N)

sub = sm[mx] - N

for i in range(1, mx + 1):
    if i != sub:
        print(i)
### BUGGY CODE ###

from itertools import permutations


n, m, r = map(int, input().split())
towns = list(map(int, input().split()))

graph = [[0 for _ in range(n)] for _ in range(n)]

for i in range(m):
    a, b, c = map(int, input().split())
    a -= 1
    b -= 1
    graph[a][b] = c
    graph[b][a] = c

# ワーシャルフロイド

for k in range(n):
    for i in range(n):
        for j in range(n):
            graph[i][j] = min(graph[i][j], graph[i][k] + graph[k][j])

min_dist = 10**10
for route in permutations(towns, r):
    dist = 0
    for i in range(r-1):
        a = route[i] - 1
        b = route[i+1] - 1
        dist += graph[a][b]
    if dist < min_dist:
        min_dist = dist

print(min_dist)


### FIXED CODE ###

from itertools import permutations


N, M, R = map(int, input().split())
r = list(map(int, input().split()))
INF = float('inf')

graph = [[INF for _ in range(N)] for _ in range(N)]

for _ in range(M):
    a, b, c = map(int, input().split())
    graph[a-1][b-1] = c
    graph[b-1][a-1] = c

distance = [[float('inf') for _ in range(N)] for _ in range(N)]

for k in range(N):
    for i in range(N):
        for j in range(N):
            graph[i][j] = min(graph[i][j], graph[i][k] + graph[k][j])

total_min = INF
for i in permutations(r, len(r)):
    total = 0
    for j in range(len(r)-1):
        total += graph[i[j]-1][i[j-1]-1]
    if total < total_min:
        total_min = total

print(total_min)
### BUGGY CODE ###

from time import sleep
n, a, b = map(int, input().split())
sleep(1.99)
print(min(a * n, b))

### FIXED CODE ###

n,a,b=map(int,input().split());print(min(n*a,b))
### BUGGY CODE ###

k, s = map(int, input().split())
ans = 0

for x in range(k+1):
    for y in range(k+1):
        for z in range(k+1):
            if x + y + z == s:
                ans += 1

print(ans)

### FIXED CODE ###

k, s = map(int, input().split())
ans = 0

for x in range(k+1):
    for y in range(k+1):
        if x + y <= s and s - x - y <= k:
            ans += 1

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


from sys import stdin
import itertools

n = int(stdin.readline().rstrip())
ls = [int(x) for x in stdin.readline().rstrip().split()]

ans = 0
for v in itertools.combinations(ls, 3):
    a,b,c = [int(i) for i in v]
    if a<b+c and b<c+a and c<a+b:
                ans += 1

print(ans)


### FIXED CODE ###

from sys import stdin
from collections import defaultdict, deque, Counter
import sys
from bisect import bisect_left
import heapq
import math

sys.setrecursionlimit(1000000000)
MIN = -10 ** 9
MOD = 10 ** 9 + 7
INF = float("inf")
IINF = 10 ** 18

n = int(stdin.readline().rstrip())
l = list(map(int, stdin.readline().rstrip().split()))
#A, B, C = map(int, stdin.readline().rstrip().split())
#S = [list(stdin.buffer.readline().decode().rstrip()) for _ in range(h)]

l.sort()
ans = 0

for i in range(n):
    for j in range(i+1, n):
        t = l[i] + l[j]
        idx = bisect_left(l,t)
        ans += max(0,idx-j-1)

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

A,B,C,K = map(int,input().split())
if A >= K:
    for a in range(A+1):
        if a == K:
            print(a)
elif A+B >= K:
    for b in range(B+1):
        if A+b == K:
            print(A)
else:
    for c in range(C+1):
        if A+B+c == K:
            print(A-c)

### FIXED CODE ###

A,B,C,K = map(int,input().split())
if A >= K:
    print(K)
elif A+B >= K:
    print(A)
else:
    print(2*A+B-K)
### BUGGY CODE ###

import math

h,w,k = map(int,input().split())
s = [str(input()) for i in range(h)]
ans = h * w

if h == 1:
    print(math.ceil("1".count(s[0])/k))
    exit()

for i in range(2 ** (h-1)):
    ss = str(format(i,"b").zfill(h-1))
    cnt = 0
    zerocnt = 0
    key = 1
    for j in range(len(ss)):
        if ss[j] == "0":
            zerocnt += 1
    now = [0 for i in range(zerocnt+1)]

    for j in range(w):
        next = []
        num = 0
        for n in range(h):
            if s[n][j] == "1":
                num += 1
            if num > k:
                key = 0
            if n < h-1 and ss[n] == "0":
                next.append(num)
                num = 0
        next.append(num)
  #        print(next,now)
        keykey = 1
        for n in range(zerocnt+1):
            if keykey:
                if now[n] + next[n] > k:
                    now = next
                    cnt += 1
                    keykey = 0
                else:
                    now[n] += next[n]
  #    print(now)
  #    print(ans,cnt,zerocnt)
    if key:ans = min(ans,cnt+zerocnt)
print(ans)


### FIXED CODE ###

import math

h,w,k = map(int,input().split())
s = [str(input()) for i in range(h)]
ans = h * w

if h == 1:
    print(math.ceil("1".count(s[0])/k))
    exit()

for i in range(2 ** (h-1)):
    ss = str(format(i,"b").zfill(h-1))
    cnt = 0
    zerocnt = 0
    key = 1
    for j in range(len(ss)):
        if ss[j] == "0":
            zerocnt += 1
    now = [0 for i in range(zerocnt+1)]

    for j in range(w):
        next = []
        num = 0
        for n in range(h):
            if s[n][j] == "1":
                num += 1
            if num > k:
                key = 0
            if n < h-1 and ss[n] == "0":
                next.append(num)
                num = 0
        next.append(num)
  #        print(next,now)
        keykey = 1
        for n in range(zerocnt+1):
            if keykey:
                if now[n] + next[n] > k:
                    now = next
                    cnt += 1
                    keykey = 0
                else:
                    now[n] += next[n]
  #    print(now)
  #    print(ans,cnt,zerocnt)
    if key:ans = min(ans,cnt+zerocnt)
print(ans)
### BUGGY CODE ###

import numpy as np
n,m = map(int,input().split())
lis = list(map(int,input().split()))
path = [[] for i in range(n)]

for i in range(m):
    x,y = map(int,input().split())
    x -= 1;y -= 1
    path[x].append(y)
    path[y].append(x)

gone = np.array([-1] * n)
numberindex = set()
ans = 0

for i in range(n):
    if gone[i] == -1:
        now = [i]
        realnumber = np.array([0] * n)
        numberindex.add(i)
        while now:
            a = now.pop(0)
            gone[a] = 1
            numberindex.add(a)
            realnumber[lis[a]-1] = 1
            for go in path[a]:
                if gone[go] == -1:
                    now.append(go)
                    gone[go] = 1
        for num in numberindex:
            if realnumber[num] == 1:
                ans += 1
        numberindex = set()
print(ans)

### FIXED CODE ###

import numpy as np
n,m = map(int,input().split())
lis = list(map(int,input().split()))
path = [[] for i in range(n)]

for i in range(m):
    x,y = map(int,input().split())
    x -= 1;y -= 1
    path[x].append(y)
    path[y].append(x)

gone = np.array([-1] * n)
numberindex = set()
realnumber = set()
ans = 0

for i in range(n):
    if gone[i] == -1:
        now = [i]
        while now:
            a = now.pop(0)
            gone[a] = 1
            numberindex.add(a)
            realnumber.add(lis[a]-1)
            for go in path[a]:
                if gone[go] == -1:
                    now.append(go)
                    gone[go] = 1
        ans += len(realnumber & numberindex)
        realnumber,numberindex = set(),set()
print(ans)
### BUGGY CODE ###

def main():
    import heapq
    N, K = map(int, input().split())
    A = list(map(int, input().split()))
    if sum(A) <= K:
        print(0)
        return

    F = list(map(int, input().split()))

    A.sort()
    F.sort(reverse=True)
    q = []
    for i in range(N):
        heapq.heappush(q, (-(A[i]*F[i]), A[i], F[i]))

    for k in range(K):
        p, a, f = heapq.heappop(q)
        if p < 0:
            heapq.heappush(q, ((-(a-1)*f), a-1, f))
        else:
            break

    p, a, f = heapq.heappop(q)
    print(-p)
    return

main()

### FIXED CODE ###

N, K = map(int, input().split())
A = list(map(int, input().split()))
F = list(map(int, input().split()))
A.sort()
F.sort(reverse=True)

q = [0] * N
start = 0
end = 0
for i in range(N):
    q[i] = A[i] * F[i]
    end = max(end, q[i])

def check(now, K):
    cnt = 0
    for i in range(N):
        if q[i] - now > 0:
            cnt += (q[i] - now + F[i] - 1) // F[i]
            if cnt > K:
                return False
    return True

now = end // 2
while end > start + 1:
    if check(now, K):
        end = now
    else:
        start = now
    now = (start + end) // 2

if check(start, K):
    print(start)
else:
    print(end)
### BUGGY CODE ###

a=input()
counter=0
i=0
while i <len(a)-3:
    moji=a[i:i+3]
    for j in range(i+3,len(a)):
        moji+=a[j]
        if int(moji)%2019==0:
            counter+=1
            i=j-1
    i+=1
print(counter)

### FIXED CODE ###

a=reversed(input())
#num=len(a)
mod_list=[1]+[0]*2019
moji_int=0
Sn=0
tens=1
for i in a:
    tmp=int(i)*(tens)
    Sn=(Sn+tmp)%2019
    mod=Sn
    tens=tens*10%2019
    mod_list[mod]+=1
res=0
for i in mod_list:
    res+=int(i*(i-1)/2)
print(res)
### BUGGY CODE ###

import sys


def kensho(x,tlist):
    for lis in tlist:
        if((x>>(lis[1]-1)) & 1 == lis[2]):
            pass
        else:
            return -1

    return bin(x).count('1')


def main():
    N = int(input())
    xy=[]
    ans=0

    for i in range(1,N+1):
        An= int(input())
        for j in range(0,An):
            x, y = map(int, input().split())
            xy.append([i,x,y])

    cnt = N

    tlist=[]
    for x in range (2 ** cnt):
        for y in range(cnt):
            if((x>>y) & 1):
                for z in xy:
                    if(z[0]==y+1):
                        tlist.append(z)

        anstack = kensho(x,tlist)
        if(ans<anstack):
            ans=anstack

        tlist.clear()

    print(ans)

main()

### FIXED CODE ###

import sys

def kensho(x,tlist):
    for lis in tlist:
        if((x>>(lis[1]-1)) & 1 == lis[2]):
            pass
        else:
            return -1

    return bin(x).count('1')


def main():
    N = int(input())
    xy=[]
    ans=0

    for i in range(1,N+1):
        An= int(input())
        for j in range(0,An):
            x, y = map(int, input().split())
            xy.append([i,x,y])

    cnt = N

    tlist=[]
    for x in range (2 ** cnt):
        for y in range(cnt):
            if((x>>y) & 1):
                for z in xy:
                    if(z[0]==y+1):
                        tlist.append(z)

        anstack = kensho(x,tlist)
        if(ans<anstack):
            ans=anstack

        del tlist[:]

    print(ans)

main()
### BUGGY CODE ###

s = input()

arr = []
amari = [0 for i in range(2019)]
amari[0] +=1
ans = 0
cnt = 0
keta = 1
for i in range(len(s)):
    cnt = (cnt + int(s[-(i+1)]) * keta) % 2019
    arr.append(cnt)
    keta *=10

for i in range(len(arr)):
    amari[arr[i]] +=1    
    
for i in amari:
    ans = ans + i * (i-1) // 2
print(ans)

### FIXED CODE ###

s = input()

arr = []
amari = [0 for i in range(2019)]
amari[0] +=1
ans = 0
cnt = 0
keta = 1
for i in range(len(s)):
    cnt = (cnt + int(s[-(i+1)]) * keta) % 2019
    arr.append(cnt)
    keta =keta * 10 % 2019

for i in range(len(arr)):
    amari[arr[i]] +=1    
    
for i in amari:
    ans = ans + i * (i-1) // 2
print(ans)
### BUGGY CODE ###

H, W = map(int,input().split())
s = [list(input()) for i in range(H)]
sl = [[0]*(W) for _ in range(H)]
sr = [[0]*(W) for _ in range(H)]
su = [[0]*(W) for _ in range(H)]
sd = [[0]*(W) for _ in range(H)]

for i in range(H):
    for j in range(W):
        if s[i][j]=='.':
            if i==0:
                sl[i][j] = 1
            else:
                sl[i][j] = sl[i-1][j]+1
            if j==0:
                su[i][j]=1
            else:
                su[i][j] = su[i][j-1]+1
for i in list(range(H))[::-1]:
    for j in list(range(W))[::-1]:
        if s[i][j]=='.':
            if i==H-1:
                sr[i][j] = 1
            else:
                sr[i][j] = sr[i+1][j]+1
            if j==W-1:
                sd[i][j]=1
            else:
                sd[i][j] = sd[i][j+1]+1
ans = 0
for i in range(H):
    for j in range(W):
        if s[i][j]=='.':
            ans = max(ans, sl[i][j]+sr[i][j]+su[i][j]+sd[i][j]-3)
print(ans)

### FIXED CODE ###

H, W = map(int,input().split())
s = [list(input()) for i in range(H)]
sl = [[0]*(W) for _ in range(H)]
sr = [[0]*(W) for _ in range(H)]
su = [[0]*(W) for _ in range(H)]
sd = [[0]*(W) for _ in range(H)]

for i in range(H):
    for j in range(W):
        if s[i][j]=='.':
            if i==0:
                sl[i][j] = 1
            else:
                sl[i][j] = sl[i-1][j]+1
            if j==0:
                su[i][j]=1
            else:
                su[i][j] = su[i][j-1]+1
for i in list(range(H))[::-1]:
    for j in list(range(W))[::-1]:
        if s[i][j]=='.':
            if i==H-1:
                sr[i][j] = 1
            else:
                sr[i][j] = sr[i+1][j]+1
            if j==W-1:
                sd[i][j]=1
            else:
                sd[i][j] = sd[i][j+1]+1
ans = 0
for i in range(H):
    for j in range(W):
        if s[i][j]=='.':
            ans = max(ans, sl[i][j]+sr[i][j]+su[i][j]+sd[i][j]-3)
print(ans)