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

inputs = open(0).readlines()
n, m, k = map(int, inputs[0].split())
AB = [tuple(map(int, ab.split())) for ab in inputs[1:m+1]]
CD = [tuple(map(int, cd.split())) for cd in inputs[m+1:]]

def dfs(root, graph):
        nodes, stack = [], [root]
        while stack:
            current_node = stack.pop()
            if current_node in nodes:
                continue
            nodes.append(current_node)
            for n in graph[current_node]:
                if n not in nodes:
                    stack.append(n)
        return nodes

friends = [set() for _ in range(n)]
for n0, n1 in AB:
    friends[n0-1].add(n1-1)
    friends[n1-1].add(n0-1)
blocks = [set() for _ in range(n)]
for n0, n1 in CD:
    blocks[n0-1].add(n1-1)
    blocks[n1-1].add(n0-1)

connected_nodes = {}
candidates = []
for i in range(n):
    if i not in connected_nodes:
        nodes = set(dfs(i, friends))
        for j in nodes:
            connected_nodes[j] = nodes
    else:
        nodes = connected_nodes[i]
    candidates.append(len(nodes) - len(friends[i]) - len(nodes & blocks[i]) - 1)
print(*candidates)

### FIXED CODE ###

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.root = [-1]*(n+1)
        self.rnk = [0]*(n+1)

    def find_root(self, x):
        if(self.root[x] < 0):
            return x
        else:
            self.root[x] = self.find_root(self.root[x])
            return self.root[x]
    
    def unite(self, x, y):
        x, y = self.find_root(x), self.find_root(y)
        if(x == y):
            return
        elif(self.rnk[x] > self.rnk[y]):
            self.root[x] += self.root[y]
            self.root[y] = x
        else:
            self.root[y] += self.root[x]
            self.root[x] = y
            if(self.rnk[x] == self.rnk[y]):
                self.rnk[y] += 1
    
    def is_same_group(self, x, y):
        return self.find_root(x) == self.find_root(y)

    def count(self, x):
        return -self.root[self.find_root(x)]
    
    def __str__(self):
        return 'UnionFind(n: {}, root: {}, rnk: {})'.format(self.n, self.root, self.rnk)
    
    def __repr__(self):
        return self.__str__()

inputs = open(0).readlines()
n, m, k = map(int, inputs[0].split())
AB = [tuple(map(int, ab.split())) for ab in inputs[1:m+1]]
CD = [tuple(map(int, cd.split())) for cd in inputs[m+1:]]

uf = UnionFind(n)
friends = [set() for _ in range(n)]
for n0, n1 in AB:
    uf.unite(n0-1, n1-1)
    friends[n0-1].add(n1-1)
    friends[n1-1].add(n0-1)

blocks = [set() for _ in range(n)]
for n0, n1 in CD:
    if uf.is_same_group(n0-1, n1-1):
        blocks[n0-1].add(n1-1)
        blocks[n1-1].add(n0-1)

candidates = []
for i in range(n):
    candidates.append(uf.count(i) - len(friends[i]) - len(blocks[i]) - 1)
print(*candidates)
### BUGGY CODE ###

from fractions import gcd
from functools import reduce

def lcm_base(x, y):
    return (x * y) // gcd(x, y)

def lcm(numbers):
    return reduce(lcm_base, numbers, 1)

N = int(input())
A = [int(x) for x in input().split()]
t = lcm(A)

mod = 10**9+7
ans = 0
for i in range(N):
    ans = (ans + t//A[i])%mod

print(ans)


### FIXED CODE ###

from fractions import gcd

def lcm_base(x, y):
    return (x * y) // gcd(x, y)

def lcm(numbers):
    t = 1
    for n in numbers:
        t = lcm_base(t, n)
    return t

N = int(input())
A = [int(x) for x in input().split()]

mod = 10**9+7
ans = 0
t = lcm(A)
t %= mod
for i in range(N):
    ans = (ans + t*pow(A[i],mod-2, mod))%mod

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

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

    A.sort()
    A.reverse()

    i = 1
    j = 1
    while j < N:
        if A[j - 1] / 2 <= sum(A[j:]):
            i += 1
        else:
            break
        j += 1
    print(str(i))

main()

### FIXED CODE ###

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

    A.sort()
    i = 1
    j = N - 1
    x = sum(A)
    while j > 0:
        if (x - A[j]) * 2 >= A[j]:
            i += 1
        else:
            break
        x -= A[j]
        j -= 1
    print(str(i))

main()
### BUGGY CODE ###

import sys
from bisect import bisect_left
#inpurt = sys.stdin.readline
a, b, q = map(int, input().split())
INF = 10 ** 11
s = [-INF]
s_append = s.append
for i in range(a):
    si = int(input())
    s_append(si)
s_append(INF)
t = [-INF]
#t_append = t.append
for i in range(b):
    ti = int(input())
    t.append(ti)
t.append(INF)
x = []
#x_append = x.append
for i in range(q):
    xi = int(input())
    x.append(xi)

for xi in x:
    index_s = bisect_left(s, xi)
    s1 = xi - s[index_s - 1]
    s2 = s[index_s] - xi
    index_t = bisect_left(t, xi)
    t1 = xi - t[index_t - 1]
    t2 = t[index_t] -xi
    print(min(max(s1, t1), max(s2, t2), min(s1, t2) * 2 + max(s1, t2), min(s2, t1) * 2 + max(s2, t1)))


### FIXED CODE ###

import bisect
import sys
input = sys.stdin.readline
A, B, Q = list(map(int, input().split()))
s = [int(input()) for i in range(A)]
t = [int(input()) for i in range(B)]
s.append(-100000000000);s.append(100000000000)
t.append(-100000000000);t.append(100000000000)
s = sorted(s, reverse=False)
t = sorted(t, reverse=False)

for i in range(Q):
    xi = int(input())
    sr = s[bisect.bisect_left(s, xi)]
    sl = s[bisect.bisect_left(s, xi) - 1]
    tr = t[bisect.bisect_left(t, xi)]
    tl = t[bisect.bisect_left(t, xi) - 1]

    ans = min(max(sr, tr) - xi, xi - min(sl, tl),
              tr - sl + min(tr - xi, xi - sl), sr - tl + min(sr - xi, xi - tl))
    print(ans)
### BUGGY CODE ###

arr = input().split()
n = int(arr[0])
m = int(arr[1])

a = [0] * m
b = [0] * m

for i in range(m):
    tmp = input().split()
    a[i] = int(tmp[0])
    b[i] = int(tmp[1])

mat = [[0] * n for i in range(n)]

for i in range(m):
    mat[a[i]-1][b[i]-1] = 1
    #mat[b[i]-1][a[i]-1] = 1

path = []
for i in range(n):
    if mat[0][i] == 1:
        path.append(i)

flag = False
for i in range(len(path)):
        if mat[path[i]][n-1] == 1: 
            flag = True
            break

if flag == True:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')
    


### FIXED CODE ###

arr = input().split()
n = int(arr[0])
m = int(arr[1])

x = []
y = []

for i in range(m):
    a,b = map(int, input().split())
    if a == 1:
        x.append(b)
    if b == n:
        y.append(a)

if len(set(x+y)) < len(x) + len(y):
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')
### BUGGY CODE ###

n, x = map(int, input().split())
a = list(map(int, input().split()))

a.sort()

MOD = 10 ** 9 + 7

S = [0] * (x+1)
T = [0] * (x+1)

S[x] = 1

for i in range(n-1, -1, -1):
    T = [0] * (x + 1)
    for j in range(x+1):
        S[j] %= MOD
        T[j] += S[j] * i % MOD
        T[j % a[i]] += S[j]
    S, T = T, S

print(sum(i * S[i] % MOD for i in range(a[0]) ) % MOD)


### FIXED CODE ###

n, x = map(int, input().split())
a = list(map(int, input().split()))

a.sort()

MOD = 10 ** 9 + 7

S = [0] * (x+1)
T = [0] * (x+1)

S[x] = 1

for i in range(n-1, -1, -1):
    T = [0] * (x + 1)
    for j in range(x+1):
        S[j] %= MOD
        T[j] += S[j] * i % MOD
        T[j % a[i]] += S[j]
    S, T = T, S

print(sum(i * S[i] % MOD for i in range(a[0]) ) % MOD)
### BUGGY CODE ###

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

sum_set = []
for i in range(k + 1):
    for j in range(k + 1):
        m = s - i - j
        if 0 <= m <= k:
            comb = [i, j, m]
            sum_set.append(comb)
print(len(sum_set))


### FIXED CODE ###

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

count = 0
for i in range(k + 1):
    for j in range(k + 1):
        m = s - i - j
        if 0 <= m <= k:
            count += 1
print(count)
### BUGGY CODE ###

#17:11
inf = 10 ** 10
n,m = map(int,input().split())
pre = [inf for i in range(n)]
ans = n
for _ in range(m):
  x,y,z = map(int,input().split())
  x -= 1
  y -= 1
  X = [x]
  Y = [y]
  while pre[x] != inf:
    X.append(x)
    x = pre[x]
  while pre[y] != inf:
    Y.append(y)
    y = pre[y]
  if x != y:
    ans -= 1
    for xx in X:
      pre[xx] = y
    for yy in Y:
      pre[yy] = y
    pre[x] = y
#print(pre)
print(ans)

### FIXED CODE ###

#解説チラ見
n,m = map(int,input().split())
ans = n
pre = [i for i in range(n)]
for _ in range(m):
  x,y,z = map(lambda x: int(x)-1, input().split())
  X = [x]
  while pre[x] != x:
    x = pre[x]
    X.append(x)
  Y = [y]
  while pre[y] != y:
    y = pre[y]
    Y.append(y)
  if x != y:
    ans -= 1
    for xx in X:
      pre[xx] = y
    for yy in Y:
      pre[yy] = y
    pre[x] = y
print(ans)
### BUGGY CODE ###

A, B = map(int,input().split())
ans = 1
if A % 2 == 0 and B % 2 == 0:
    ans += 1
    while A % 2 == 0 and B % 2 == 0:
        A /= 2
        B /= 2
if A % 3 == 0 and B % 3 == 0:
    ans += 1
    while A % 3 == 0 and B % 3 == 0:
        A /= 3
        B /= 3
if A % 5 == 0 and B % 5 == 0:
    ans += 1
    while A % 5 == 0 and B % 5 == 0:
        A /= 5
        B /= 5

i = 3
while 2*i + 1 <= A and 2*i + 1 <= B:
    k = 2*i + 1
    if k % 3 == 0 or k % 5 == 0:
        i += 1
        continue
    elif A % k == 0 and B % k == 0:
        ans += 1
        A /= k
        B /= k
        while A % k == 0 and B % k == 0:
            A /= k
            B /= k
        i += 1
    else:
        i += 1
print(ans)

### FIXED CODE ###

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

def ssb(n):
    a = {1}
    while n % 2 == 0:
        a.add(2)
        n /= 2
    i = 3
    while i ** 2 <= n:
        if n % i == 0:
            a.add(i)
            n /= i
        else:
            i += 2
    if n != 1:
        a.add(n)
    return a

a = ssb(A)
b = ssb(B)

print(len(a&b))
### BUGGY CODE ###

s = input()
q = int(input())

head = ''
tail = ''
flip = 0

for _ in range(q):
	query = input().split()
	if query[0] == '1':
		flip ^= 1
	else:
		f = query[1]
		c = query[2]
		if (f == '1' and flip == 0) or (f == '2' and flip == 1):
			head += c
		else:
			tail += c

if flip:
	head, tail = tail, head
	s = s[::-1]

print(head[::-1] + s + tail)

### FIXED CODE ###

s = input()
q = int(input())

head = []
tail = []
flip = 0

for i in range(q):
	query = input().split()
	if query[0] == '1':
		flip ^= 1
	else:
		f = int(query[1]) - 1
		c = query[2]
		if (f ^ flip) == 0:
			head.append(c)
		else:
			tail.append(c)

if flip:
	head, tail = tail, head
	s = s[::-1]

head = ''.join(head)
tail = ''.join(tail)

print(head[::-1] + s + tail)
### BUGGY CODE ###

import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect, bisect_left, bisect_right

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

def divisor(n): #nの約数を全て求める
    i = 1
    table = []
    while i * i <= n:
        if n%i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return table


A, B = MAP()
a = divisor(A)
b = divisor(B)
a = set(a)
b = set(b)
kouyaku = a & b

ans = 1
for y in kouyaku:
    if len(divisor(y)) == 2:
        ans += 1
print(ans)
    


### FIXED CODE ###

import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

def divisor(n): #nの約数を全て求める
    i = 1
    table = []
    while i * i <= n:
        if n%i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return table

def is_prime(n):
    for i in range(2, n + 1):
        if i * i > n:
            break
        if n % i == 0:
            return False
    return n != 1

a, b = MAP()
kouyaku = list(set(divisor(a)) & set(divisor(b)))

ans = 0
for k in kouyaku:
    if is_prime(k):
        ans += 1
print(ans+1)
### BUGGY CODE ###

n,k = map(int,input().split())
a = list(map(int,input().split()))
b = set(a)
c = []
for i in b:
  c.append(a.count(i))
c.sort(reverse=True)
#if len(c) == k:
  #print(0)
#else:
print(sum(c[k:]))

### FIXED CODE ###

import collections
n,k = map(int,input().split())
a = list(map(int,input().split()))
c = collections.Counter(a)
values, counts = zip(*c.most_common())
print(sum(counts[k:]))
### BUGGY CODE ###

S = input()
q = int(input())
Q = [list(input().split()) for _ in range(q)]

flg = True
for i in Q:
  if i[0] == "1":
    flg = not flg
  else:
    if flg == True:
      if i[1] == "1":
        S = i[2] + S
      else:
        S = S + i[2]
    else:
      if i[1] == "2":
        S = i[2] + S
      else:
        S = S + i[2]
if flg:
  print(S)
else:
  print(S[::-1])

        

### FIXED CODE ###

from collections import deque
S = list(input())
q = int(input())
Q = [list(input().split()) for _ in range(q)]

ds = deque(S)

flg = True
for i in Q:
  if i[0] == "1":
    flg = not flg
  else:
    if flg == True:
      if i[1] == "1":
        ds.appendleft(i[2])
      else:
        ds.append(i[2])
    else:
      if i[1] == "2":
        ds.appendleft(i[2])
      else:
        ds.append(i[2])
if flg:
  print("".join(ds))
else:
  print("".join(ds)[::-1])
### BUGGY CODE ###

A, B, M = map(int, input().split())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]

m = []

for i in range(M):
    x, y, z = map(int, input().split())
    m.append([x, y, z])

m.sort(key = lambda x: x[2], reverse=True)

for j in list(map(list, set(map(tuple, m)))):
    if a[m[0][0]-1] + b[m[0][1]-1] - m[0][2] >= 0 and a[m[0][0]-1] + b[m[0][1]-1] - m[0][2] < min(a) + min(b):
        print(a[m[0][0]-1] + b[m[0][1]-1] - m[0][2])
        exit()

print(min(a) + min(b))

### FIXED CODE ###

A, B, M = map(int, input().split())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]

m = []
am = min(a)
bm = min(b)

for i in range(M):
    x, y, z = map(int, input().split())

    m.append(a[x-1] + b[y-1] - z )



if am + bm > min(m):
    print(min(m))
else:
    print(am + bm)
### BUGGY CODE ###

N, K = map(int, input().split())
A = list(map(int, input().split()))
a = 1
for i in range(N):
    if i < K:
        a *= A[i]
    else:
        old = a
        a //= A[i - K]
        a *= A[i]
        ans = 'No'
        if a > old:
            ans = 'Yes'
        print(ans)

### FIXED CODE ###

N, K = map(int, input().split())
A = list(map(int, input().split()))
for i in range(N - K):
    ans = 'No'
    if A[i] < A[i + K]:
        ans = 'Yes'
    print(ans)
### BUGGY CODE ###

#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入
import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
n = I()
A = readInts()
lis = []
prv = -1
for i in range(n):
    if prv != A[i]:
        lis.append(A[i])
        prv = A[i]
#print(lis)
#dp = [[[0] * ]
def dfs(money,kabu,now):
    global ans
    if now == len(lis):
        ans = max(money,ans)
        return;
    if kabu != 0:
        dfs(money + kabu*lis[now],0,now+1)
    if money//lis[now] >= 1:
        dfs(money - lis[now] * (money//lis[now]),money//lis[now],now+1)
    dfs(money,kabu,now+1)
ans = 1000
dfs(1000,0,0)
print(ans)


### FIXED CODE ###

#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入
import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
n = I()
A = readInts()
money = 1000
kabu = 0
for i in range(1,n):
    if A[i-1] < A[i]:
        kabu = money // A[i-1]
        money -= kabu * A[i-1]
        money += kabu * A[i]
        kabu = 0
    #print(money,kabu)
print(money)
### BUGGY CODE ###

n=int(input())
l=list(map(int,input().split()))
l=[x-i-1 for i,x in enumerate(l)]
ans=10**9
for i in l:
    cal=[abs(x-i) for x in l]
    ans=min(ans,sum(cal))
print(ans)

### FIXED CODE ###

n=int(input())
l=list(map(int,input().split()))
l=sorted([x-i-1 for i,x in enumerate(l)])
x=l[n//2]
print(sum([abs(i-x) for i in l]))
### BUGGY CODE ###

import sys 
input = sys.stdin.readline
# ABC140E
class SegTree:
    def __init__(self, init_val, n, ide_ele, seg_func):
        self.segfunc = seg_func
        self.num = 2**(n-1).bit_length()
        self.ide_ele = ide_ele
        self.seg=[self.ide_ele]*2*self.num
        for i in range(n):
            self.seg[i+self.num-1]=init_val[i]    
        for i in range(self.num-2,-1,-1) :
            self.seg[i]=self.segfunc(self.seg[2*i+1],self.seg[2*i+2]) 
        
    def update(self, k, x):
        k += self.num-1
        self.seg[k] = x
        while k+1:
            k = (k-1)//2
            self.seg[k] = self.segfunc(self.seg[k*2+1],self.seg[k*2+2])
        
    def query(self, p, q):
        if q<=p:
            return self.ide_ele
        p += self.num-1
        q += self.num-2
        res=self.ide_ele
        while q-p>1:
            if p&1 == 0:
                res = self.segfunc(res,self.seg[p])
            if q&1 == 1:
                res = self.segfunc(res,self.seg[q])
                q -= 1
            p = p//2
            q = (q-1)//2
        if p == q:
            res = self.segfunc(res,self.seg[p])
        else:
            res = self.segfunc(self.segfunc(res,self.seg[p]),self.seg[q])
        return res

n,Q=map(int,input().split())
xs,qs,tmp = [],[],set()
for _ in range(n):
    s,t,x=map(int,input().split())
    s,t,x=s-x-0.5,t-x-0.5,x
    xs.append((s,1,x))
    xs.append((t,0,x))
    tmp.add(x)
for _ in range(Q):
    qs.append(int(input()))

xs.sort()
mx = max(tmp) + 1
tmp = list(tmp)
x2i = dict()
for i, x in enumerate(tmp):
    x2i[x] = i

qi = 0
q = qs[qi]
XN = len(tmp)
st = SegTree([mx]*XN, XN, mx, min)
for t,r,x in xs:
    if q < t:
        c = st.query(0,XN)
        while True:
            if q < t:
                if c != mx:
                    print(c)
                else:
                    print(-1)
                Q-=1
                if Q == 0:
                    break
                qi += 1
                q = qs[qi]
            else:
                break
#    print(t,r,x)
    if Q==0:
        break
    if r:
        st.update(x2i[x], x)
    else:
        st.update(x2i[x], mx)
print("-1\n"*Q)


### FIXED CODE ###

import sys
input = sys.stdin.readline

n,Q=map(int,input().split())
b_num = 2**(n-1).bit_length()
mx = 10**9
segl=[mx]*2*b_num 

def update( k, x):
    k += b_num-1
    segl[k] = x
    while k+1:
        k = (k-1)//2
        segl[k] = min(segl[k*2+1],segl[k*2+2])
    
if __name__ == '__main__':
    xs = []
    for i in range(n):
        s,t,x=map(int,input().split())
        xs += [(s-x-0.4,True,x,i), (t-x-0.5,False,x,i)]
    for _ in range(Q):
        xs.append((int(input()),2))
    xs.sort(key=lambda x:x[0])
    for x in xs:
        if x[1]==2:
            print(segl[0] if segl[0]!= mx else -1)
            continue
        update(x[3], x[2] if x[1] else mx)
### BUGGY CODE ###

H,W = map(int,input().split())
S = [input().strip() for _ in range(H)]
A = [[[0,0] for _ in range(W)] for _ in range(H)]
for i in range(H):
    cur = 0
    cnt = 0
    for j in range(W):
        if S[i][j]=="#":
            if cnt>0:
                for k in range(cur,j):
                    A[i][k][0] = cnt
            cur=j+1
            cnt = 0
        else:
            cnt += 1
    if cnt>0:
        for k in range(cur,W):
            A[i][k][0] = cnt
for j in range(W):
    cur = 0
    cnt = 0
    for i in range(H):
        if S[i][j]=="#":
            if cnt>0:
                for k in range(cur,i):
                    A[k][j][1] = cnt
            cur = i+1
            cnt = 0
        else:
            cnt += 1
    if cnt>0:
        for k in range(cur,H):
            A[k][j][1] = cnt
B = [[0 for _ in range(W)] for _ in range(H)]
cmax = 0
for i in range(H):
    for j in range(W):
        if S[i][j]==".":
            B[i][j] = A[i][j][0]+A[i][j][1]-1
            cmax = max(cmax,B[i][j])
print(cmax)        

### FIXED CODE ###

H,W = map(int,input().split())
S = [input().strip() for _ in range(H)]
L = [[0 for _ in range(W)] for _ in range(H)]
R = [[0 for _ in range(W)] for _ in range(H)]
U = [[0 for _ in range(W)] for _ in range(H)]
D = [[0 for _ in range(W)] for _ in range(H)]
for i in range(H):
    for j in range(W):
        if j==0 and S[i][j]==".":
            L[i][j] = 1
        elif j>0 and S[i][j]==".":
            L[i][j] = L[i][j-1]+1
        if i==0 and S[i][j]==".":
            U[i][j] = 1
        elif i>0 and S[i][j]==".":
            U[i][j] = U[i-1][j]+1
for i in range(H-1,-1,-1):
    for j in range(W-1,-1,-1):
        if j==W-1 and S[i][j]==".":
            R[i][j] = 1
        elif j<W-1 and S[i][j]==".":
            R[i][j] = R[i][j+1]+1
        if i==H-1 and S[i][j]==".":
            D[i][j] = 1
        elif i>0 and S[i][j]==".":
            D[i][j] = D[i+1][j]+1
cmax = 0
for i in range(H):
    for j in range(W):
        cmax = max(cmax,L[i][j]+R[i][j]+U[i][j]+D[i][j]-3)
print(cmax)
### BUGGY CODE ###

#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	D_fix_2
# CreatedDate:  2020-06-14 21:50:10 +0900
# LastModified: 2020-06-14 23:05:46 +0900
#


import os
import sys
#import numpy as np
#import pandas as pd


def main():
    n=int(input())
    a=list(map(int,input().split()))
    a.sort()
    ans = [1]*n
    for i in range(n):
#        print(ans)
        if ans[i]==0:
            continue
        for j in range(n):
            if i==j:
                continue
            if a[i]==a[j]:
                ans[i]=0
            if a[j]%a[i]==0:
                ans[j]=0
            
    print(sum(ans))



if __name__ == "__main__":
    main()


### FIXED CODE ###

#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	D_fix_3
# CreatedDate:  2020-06-19 15:09:52 +0900
# LastModified: 2020-06-19 15:27:30 +0900
#


import os
import sys
# import numpy as np
# import pandas as pd


def main():
    _ = int(input())
    a_s = list(map(int, input().split()))
    m = max(a_s)+1
    cnt = [0 for _ in range(m)]

    for a in a_s:
        if cnt[a] != 0:
            cnt[a] = 2
            continue
        for n in range(a, m, a):
            cnt[n] += 1

    print(sum(cnt[a] for a in a_s if cnt[a]==1))


if __name__ == "__main__":
    main()