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

import sys
input = sys.stdin.readline

def main():
  from collections import Counter
  n = int(input())
  A = tuple(map(int, input().split()))
  C = Counter(A)
  def f(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)
      return divisors

  ans = 0
  for a in A:
      for j in f(a):
          if j == a:
              if C[j] > 1:
                  break
          else:
              if C[j] > 0:
                  break
      else:
          ans += 1
  print(ans)
if __name__ == "__main__":
  main()

### FIXED CODE ###

import sys
input = sys.stdin.readline
from collections import Counter

n = int(input())
A = sorted(map(int, input().split()))
U = 10**6
B = [0]*(U+1)
C = Counter(A)
ans = 0
for a in A:
  if B[a]:
    continue
  if C[a] == 1:
    ans += 1
  for j in range(a, U+1, a):
    B[j] = 1
print(ans)
### BUGGY CODE ###

n=1000000
p=[1]*(n+1)
pr=[]
p[0],p[1]=0,0
for i in range(2,int(n**0.5)+1):
    if p[i]:        
        for j in range(i*i,n,i):
            p[j]=0
for i in range(2,n):
    if p[i]:
        pr.append(int(i))
while 1:
    l=int(input())
    if l==0:break
    ans=-l
    while l:
        l-=1
        a,m=map(int,input().split())
        j=0
        while j<len(pr) and pr[j]<=a+m:
            if(pr[j]>=a-m):ans+=1
            j+=1
    print(ans)

### FIXED CODE ###

import bisect
n=1000000
p=[1]*(n+1)
p[0],p[1]=0,0
for i in range(2,int(n**0.5)+1):
    if p[i]:        
        for j in range(i*i,n+1,i):
            p[j]=0
p=[i for i in range(n+1) if p[i]==1]
while 1:
    n=int(input())
    ans=-n
    if n==0:break
    while n:
        n-=1
        a,m=map(int,input().split())
        ans+=bisect.bisect_left(p,a+m+1)-bisect.bisect_left(p,a-m)
    print(ans)
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10 ** 9)
input = sys.stdin.readline

N, Q = [int(_) for _ in input().split()]

edges = [[] for _ in range(N + 1)]
for i in range(N - 1):
    a, b = [int(_) for _ in input().split()]
    edges[a].append(b)
    edges[b].append(a)

P = [0] * (N + 1)

for q in range(Q):
    p, x = [int(_) for _ in input().split()]
    P[p] += x


def f(v, parent=0):
    P[v] += P[parent]

    for next_v in edges[v]:
        if next_v == parent: continue
        f(next_v, v)


f(1)
print(*[P[i] for i in range(1, N + 1)])


### FIXED CODE ###

import sys
from collections import deque

sys.setrecursionlimit(10 ** 9)
input = sys.stdin.readline

N, Q = [int(_) for _ in input().split()]

edges = [[] for _ in range(N + 1)]
for i in range(N - 1):
    a, b = [int(_) for _ in input().split()]
    edges[a].append(b)
    edges[b].append(a)

P = [0] * (N + 1)

for q in range(Q):
    p, x = [int(_) for _ in input().split()]
    P[p] += x

que = deque()
que.append((1, 0))

while que:
    v, parent = que.popleft()
    P[v] += P[parent]
    for next_v in edges[v]:
        if next_v == parent: continue
        que.append((next_v, v))

# def f(v, parent=0):
#     P[v] += P[parent]
#
#     for next_v in edges[v]:
#         if next_v == parent: continue
#         f(next_v, v)
#
#
# f(1)
print(*[P[i] for i in range(1, N + 1)])
### BUGGY CODE ###

#

import sys
input=sys.stdin.readline

def main():
    N=int(input())
    B=list(map(int,input().split()))
    cho=set()
    B.sort()
    for i in range(N-1):
        if B[i]==B[i+1]:
            cho.add(B[i])
    A=set(B)
    A=list(A)
    A.sort()
    lenA=len(A)
    for i in range(lenA):
        if A[i]==-1:
            continue
        for j in range(i+1,lenA):
            if A[j]==-1:
                continue
            if A[j]%A[i]==0:
                A[j]=-1
    cnt=set()
    for i in range(len(A)):
        if A[i]!=-1:
            cnt.add(A[i])
    print(len(cnt-cho))
    
    
    
    
if __name__=="__main__":
    main()


### FIXED CODE ###

#

import sys
input=sys.stdin.readline

def main():
    N=int(input())
    A=list(map(int,input().split()))
    A.sort()
    cho=set()
    for i in range(len(A)-1):
        if A[i]==A[i+1]:
            cho.add(A[i])
    A=list(set(A))
    SUGOI=[False]*(10**6+1)
    for a in A:
        for j in range(2*a,10**6+1,a):
            SUGOI[j]=True
    cnt=0
    A=list(set(A)-cho)
    for a in A:
        if SUGOI[a]==False:
            cnt+=1
    print(cnt)
    
    
if __name__=="__main__":
    main()
### BUGGY CODE ###

import numpy as np

d = int(input())
cs = list(map(int, input().split()))
cs = np.array(cs, dtype=np.int64)
sm = [list(map(int, input().split())) for _ in range(d)]

def total_satisfaction(ts, d):
    ls = np.zeros(26, dtype=np.int64)
    s = 0
    print(ts)
    for i in range(d):
        t = ts[i]
        t -= 1
        s += sm[i][t]
        ls[t] = i + 1

        dv = cs * ((i+1) - ls)
        s -= dv.sum()
    return s

ts = []
for i in range(d):
    mx = -1e10
    mxt = None
    for t in range(1, 26+1):
        tt = np.array(ts + [t], dtype=np.int64)
        s = total_satisfaction(tt, i + 1)
        if s > mx:
            mx = s
            mxt = t
    ts.append(mxt)

    print(mxt)


### FIXED CODE ###

d = int(input())
cs = list(map(int, input().split()))
sm = [list(map(int, input().split())) for _ in range(d)]

import random
for _ in range(d):
    t = random.choice(range(26)) + 1
    print(t)
### BUGGY CODE ###

import sys
line = sys.stdin.readline

n = int(line())
a = list(map(int, line().split()))
l = [0 for i in range(max(a)+1)]
for i in a: l[i] += 1
l.reverse()
h = 0
for i in range(len(l)):
    if l[i] > 4:
        print(l[i])
        sys.exit()
    if l[i] >= 2 and h:
        print((len(l) - 1 - i) * h)
        sys.exit()
    if l[i] >= 2:
        h = len(l) - 1 - i
print(0)

### FIXED CODE ###

import sys
line = sys.stdin.readline

n = int(line())
a = list(map(int, line().split()))
a.sort(reverse=True)
summ = 0
h = 0
for i in range(len(a)):
    summ += 1
    if i and a[i] != a[i-1]:
        summ = 1
    if summ == 2:
        if h:
            print(a[i] * h)
            sys.exit()
        else:
            h = a[i]
    if summ == 4:
        print(a[i] * a[i])
        sys.exit()
print(0)
### BUGGY CODE ###

K,S = list(map(int,input().split()))
count = 0

for x in range(K+1):
    for y in range(K+1):
        for z in range(K+1):
            if S == x+y+z:
                count+=1

print(count)           

### FIXED CODE ###

K,S = list(map(int,input().split()))
count = 0
countb=0

for x in range(K+1):
    for y in range(K+1):
        countb+=1
        if 0 <= S - (x+y) <= K:
            count+=1
                
print(count)
### BUGGY CODE ###

import sys
from collections import deque

sys.setrecursionlimit(10**6)
readline = sys.stdin.readline

N, M = map(int, readline().split())
G = [[] for i in range(N)]
for i in range(N-1):
    x, y = map(int, readline().split())
    G[x-1].append((y-1, 2*i))
    G[y-1].append((x-1, 2*i+1))
G0 = [None]*N
used = [0]*N
used[0] = 1
que = deque([0])
while que:
    v = que.popleft()
    g = []
    for e in G[v]:
        w, d = e
        if used[w]:
            continue
        g.append(e)
        used[w] = 1
        que.append(w)
    G0[v] = g


memo = [0]*(2*N+1)
def dfs0(v, p, e):
    r = 1
    for w, d in G0[v]:
        r = r * (1 + dfs0(w, v, d)) % M
    memo[e] = r
    return r


lv = [0]*(2*N); rv = [0]*(2*N)
ans = [None]*N
def dfs1(v, p, par):
    s = 1 + par
    for w, d in G0[v]:
        lv[d] = s
        s = s * (1 + memo[d]) % M
    s = 1
    for w, d in reversed(G0[v]):
        rv[d] = s
        s = s * (1 + memo[d]) % M
    for w, d in G0[v]:
        memo[d ^ 1] = x = lv[d] * rv[d] % M
        dfs1(w, v, x)


dfs0(0, -1, 2*N)
dfs1(0, -1, 0)
ans = []
for v in range(N):
    r = 1
    for w, d in G[v]:
        r = r * (1 + memo[d]) % M
    ans.append("%d\n" % r)
sys.stdout.writelines(ans)

### FIXED CODE ###

import sys
from collections import deque

readline = sys.stdin.readline

N, M = map(int, readline().split())
G = [[] for i in range(N)]
for i in range(N-1):
    x, y = map(int, readline().split())
    G[x-1].append((y-1, 2*i))
    G[y-1].append((x-1, 2*i+1))

G0 = [None]*N
V = [(0, -1)]
used = [0]*N
used[0] = 1
que = deque([0])
while que:
    v = que.popleft()
    g = []
    for e in G[v]:
        w, d = e
        if used[w]:
            continue
        g.append(e)
        V.append(e)
        used[w] = 1
        que.append(w)
    G0[v] = g

memo = [0]*(2*N+1)
for v, e in reversed(V):
    r = 1
    for w, d in G0[v]:
        r = r * (1 + memo[d]) % M
    memo[e] = r

lv = [0]*(2*N); rv = [0]*(2*N)
for v, e in V:
    s = 1 + memo[e ^ 1]
    for w, d in G0[v]:
        lv[d] = s
        s = s * (1 + memo[d]) % M
    s = 1
    for w, d in reversed(G0[v]):
        rv[d] = s
        s = s * (1 + memo[d]) % M
    for w, d in G0[v]:
        memo[d ^ 1] = lv[d] * rv[d] % M

ans = []
for v in range(N):
    r = 1
    for w, d in G[v]:
        r = r * (1 + memo[d]) % M
    ans.append("%d\n" % r)
sys.stdout.writelines(ans)
### BUGGY CODE ###


def calcMax(i):
  now = numbers[i] 

  future_max = max(numbers[i+1:])
  #print(numbers[i+1:])
  t = numbers[i+1:]
  #print((max(t)))
  return future_max - now

n = int(input())

numbers = []
for i in range(n):
  numbers.append(int(input()))

m = -1000000001
for i in range(len(numbers) - 1):
    if i == 0 or i == len(numbers) - 1 or (numbers[i-1] >= numbers[i] and numbers[i] <= numbers[i+1]):
      temp = calcMax(i)
      #print("temp: " + str(temp))
      if temp > m:
          m = temp

print (m)



### FIXED CODE ###

def calcMax(i):
  now = numbers[i]

  future_max = max(numbers[i+1:])
  #print(numbers[i+1:])
  t = numbers[i+1:]
  #print((max(t)))
  return future_max - now

n = int(input())

numbers = []
for i in range(n):
  numbers.append(int(input()))

m = -1000000001
ti = 1000000001
for i in range(len(numbers) - 1):
    if numbers[i] < ti:
      if (i == 0 or i == len(numbers) - 1 or (numbers[i-1] >= numbers[i] and numbers[i] <= numbers[i+1])):
        temp = calcMax(i)
        #print("temp: " + str(temp))
        if temp > m:
            m = temp
            ti = numbers[i]

print (m)
### BUGGY CODE ###

# -*- coding:utf-8 -*-
import sys
N = int(input())
a = [ int(input()) for tmp in range(N) ]
ans = 0
index = 0
while True:
    sav = index #last index
    index = a[sav]-1 #new index
    ans += 1
    if index == 1:
        break
    if a[index] == sav+1: #Loop
        print("-1")
        sys.exit()
print(ans)

### FIXED CODE ###

# -*- coding:utf-8 -*-
import sys
N = int(input())
a = [ int(input()) for tmp in range(N) ]
ans = 0
index = 0
while ans < len(a):
    sav = index #last index
    index = a[sav]-1 #new index
    ans += 1
    if index == 1:
        print(ans)
        sys.exit()
    if a[index] == sav+1: #Loop
        print("-1")
        sys.exit()
print("-1")
### BUGGY CODE ###

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

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

### FIXED CODE ###

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

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

from bisect import bisect_left, bisect_right

N, K = map(int, input().split())
As = sorted(map(int, input().split()))

m_count = 0
p_count = 0
for A in As:
    if A < 0:
        m_count += 1
    if A > 0:
        p_count += 1

if K <= m_count * p_count:
    l = As[0] * As[-1] - 1
    r = 0
elif K > N * (N-1) // 2 - p_count * (p_count-1) // 2 - m_count * (m_count-1) // 2 :
    l = 0
    r = max(As[-1] * As[-2], As[0] * As[1])
else:
    print(0)
    exit()

while r - l > 1:
    mid = (l + r) // 2
    count = 0
    for i, A in enumerate(As):
        if A > 0:
            count += bisect_right(As, mid//A, lo = i+1) - (i+1)
        elif A < 0:
            count += N - bisect_left(As, -((-mid)//A), lo = i+1)
        else:
            if mid >= 0:
                count += N - i - 1
        if count >= K:
            r = mid
            break
    else:
        l = mid

print(r)



### FIXED CODE ###

from bisect import bisect_left, bisect_right

N, K = map(int, input().split())
As = sorted(map(int, input().split()))
        
l = - (10 ** 18 + 10)
r = 10 ** 18 + 10
while True:
    mid = (l + r) // 2
    count = 0
    for i, A in enumerate(As):
        if A > 0:
            count += bisect_right(As, mid//A, lo = i+1) - (i+1)
        elif A < 0:
            count += N - bisect_left(As, -((-mid)//A), lo = i+1)
        else:
            if mid >= 0:
                count += N - i - 1
    if count < K:
        l = mid
    else:
        r = mid
    if r - l == 1:
        break

print(r)
### BUGGY CODE ###

newarr = input()
newarr = newarr.split()
n = int(newarr[0])
m = int(newarr[1])
dicts = {}
ans = [0] * (n + 1)
for line in range(m):
    newarr = input()
    newarr = newarr.split()
    froom = int(newarr[0])
    sroom = int(newarr[1])
    if froom not in dicts:
        dicts[froom] = []
    if sroom not in dicts:
        dicts[sroom] = []
    dicts[froom].append(sroom)
    dicts[sroom].append(froom)
queue = []
if 1 not in dicts:
    print("No")
else:
    ans[1] = 1
    curarr = dicts[1]
    for i in curarr:
        queue.append(i)
        ans[i] = 1 
    while queue:
        curitem = queue.pop(0)
        if curitem not in dicts:
            continue 
        curarr = dicts[curitem]
        for i in curarr:
            if ans[i] == 0:
                ans[i] = curitem 
                queue.append(i)

    finalans = []
    flag = 0 
    for i in range(2, n + 1):
        if i == 0 :
            flag = 1 
            break 
        finalans.append(ans[i])
    if flag == 1:
        print("No")
    else:
        print("Yes")
        for i in finalans:
            print(i)




### FIXED CODE ###

from collections import deque
newarr = input()
newarr = newarr.split()
n = int(newarr[0])
m = int(newarr[1])
dicts = {}
ans = [0] * (n + 1)
for line in range(m):
    newarr = input()
    newarr = newarr.split()
    froom = int(newarr[0])
    sroom = int(newarr[1])
    if froom not in dicts:
        dicts[froom] = []
    if sroom not in dicts:
        dicts[sroom] = []
    dicts[froom].append(sroom)
    dicts[sroom].append(froom)
queue = deque([])
if 1 not in dicts:
    print("No")
else:
    ans[1] = 1
    curarr = dicts[1]
    for i in curarr:
        queue.append(i)
        ans[i] = 1 
    while queue:
        curitem = queue.popleft()
        if curitem not in dicts:
            continue 
        curarr = dicts[curitem]
        for i in curarr:
            if ans[i] == 0:
                ans[i] = curitem 
                queue.append(i)

    finalans = []
    flag = 0 
    for i in range(2, n + 1):
        if i == 0 :
            flag = 1 
            break 
        finalans.append(ans[i])
    if flag == 1:
        print("No")
    else:
        print("Yes")
        for i in finalans:
            print(i)
### BUGGY CODE ###

from collections import Counter

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

N = int(input())
A = [int(hoge) for hoge in input().split()]
C = Counter(A)
A.sort()
yakusu = [[] for i in range(10**6 + 1)] 
for q,a in enumerate(A):
    Y = make_divisors(a)
    for n in range(len(Y)-1):
        yakusu[Y[n]].append(q)

Ans = [True] * N
for n,a in enumerate(A):
    if C[a] >=2:
        Ans[n] =False
    for tf in yakusu[a]:
        Ans[tf] = False
print(sum(Ans))



### FIXED CODE ###

N = int(input())
A = [int(hoge) for hoge in input().split()]
A.sort()
M = max(A)
dp = [False] * (M+ 1)
ans = 0
prev = -1
for a in A:
    if dp[a] == False:
        for j in range(2,1 + (M// a)):
            dp[a*j] = True
        if a != prev:
            ans += 1
        else:
            dp[a] = True
            ans -= 1
    prev = a
print(ans)
### BUGGY CODE ###

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from math import factorial
n,*X=map(int,read().split())
last=X[-1]
X=[last-i for i in X[:-1]]
mod = 10**9+7
f=factorial(n-1)
s = sum(f//i*item for i,item in enumerate(X,1))
print(s%mod)

### FIXED CODE ###

# https://atcoder.jp/contests/dwacon6th-prelims/submissions/9426910


def solve():
    MOD = 10**9 + 7

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

    ds = []
    for i in range(N-1):
        d = xs[i+1] - xs[i]
        ds.append(d)

    nums = [1, 1]
    num = 1
    for i in range(2, N-1):
        num *= i
        num %= MOD
        nums.append(num)

    ms = [N-1]
    m = N-1
    for i in reversed(range(2, N-1)):
        m *= i
        m %= MOD
        ms.append(m)
    ms.reverse()
    ms.append(1)

    ks = []
    k = 0
    for num, m in zip(nums, ms):
        k += num*m % MOD
        k %= MOD
        ks.append(k)

    ans = 0
    for d, k in zip(ds, ks):
        ans += d*k % MOD
        ans %= MOD

    print(ans)

solve()
### BUGGY CODE ###

import numpy as np
H,N=map(int,input().split())
A=np.array([0]*N)
B=np.array([0]*N)
for i in range(N):
  A[i],B[i]=map(int,input().split())
dp = [np.inf]*(H+1)
dp[0]=0
for h in range(H):
  for i in range(N):
    dp[min(H,h+A[i])]=min(dp[h] + B[i], dp[min(H,h+A[i])])
print(dp[-1])

### FIXED CODE ###

H,N=map(int,input().split())
A=[0]*N
B=[0]*N
for i in range(N):
  A[i],B[i]=map(int,input().split())
dp = [99999999999]*(H+1)
dp[0]=0
for h in range(H):
  for i in range(N):
    dp[min(H,h+A[i])]=min(dp[h] + B[i], dp[min(H,h+A[i])])
print(dp[-1])
### BUGGY CODE ###

import numpy as np

n, m = map(int, input().split())
adj = np.zeros((n, n), dtype=np.bool)
for _ in range(m):
  s, t = map(int, input().split())
  adj[s-1, t-1] = True

dp = np.ones((n, n), dtype=np.float) * np.inf
dp[:, n - 1] = 0.
for i in range(n - 2, -1, -1):
  dp[n - 1, i] = dp[n - 1, adj[i]].mean() + 1
  
for i in np.where(adj.sum(axis=1) > 1)[0]:
  dp[i, i + 1:] = dp[n - 1, i + 1:]
  dp[i, i] = (dp[i, adj[i]].sum() - dp[i, adj[i]].max()) / (adj[i].sum() - 1) + 1
  for j in range(i - 1, -1, -1):
    dp[i, j] = dp[i, adj[j]].mean() + 1
    
print(dp[:, 0].min())

### FIXED CODE ###

import numpy as np

n, m = map(int, input().split())
adj = np.zeros((n, n), dtype=np.bool)
for _ in range(m):
  s, t = map(int, input().split())
  adj[s-1, t-1] = True
deg = adj.sum(axis=1)

ev = np.zeros(n, dtype=np.float)
for i in range(n - 2, -1, -1):
  ev[i] = ev[adj[i]].mean() + 1.

prob = np.zeros(n, dtype=np.float)
prob[0] = 1.
for i in range(n - 1):
  prob[adj[i]] += prob[i] / deg[i]

decrease = 0.
for i in np.where(deg > 1)[0]:
  now = ev[adj[i]].mean()
  cut = (ev[adj[i]].sum() - ev[adj[i]].max()) / (deg[i] - 1)
  decrease = np.maximum(decrease, (now - cut) * prob[i])
    
print(ev[0] - decrease)
### BUGGY CODE ###

from collections import Counter
from copy import deepcopy

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

for k in range(1, n + 1):
    cx = deepcopy(c)

    count = 0

    while k <= len(cx):
        # print(cx)
        mc = cx.most_common()
        for key, _ in mc[:k]:
            cx[key] -= 1
            if cx[key] < 1:
                del cx[key]
        count += 1

    print(count)


### FIXED CODE ###

from collections import Counter
from itertools import accumulate

# from copy import deepcopy

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

# for k in range(1, n + 1):
#     cx = deepcopy(c)

#     count = 0

#     while k <= len(cx):
#         # print(cx)
#         mc = cx.most_common()
#         for key, _ in mc[:k]:
#             cx[key] -= 1
#             if cx[key] < 1:
#                 del cx[key]
#         count += 1

#     print(count)

cv = Counter(c.values())
max_take = max(cv.keys())

lx = list(accumulate(cv[i] for i in range(max_take + 1)))
rx = list(accumulate(cv[i] * i for i in range(max_take + 1)))
ax = [rx[i] + (lx[-1] - lx[i]) * i for i in range(max_take + 1)]


def bisec(l0, r0, predicate):
    l, r = l0, r0

    while abs(l - r) > 1:
        mid = (l + r) // 2
        if predicate(mid):
            r = mid
        else:
            l = mid

    return r


for k in range(1, n + 1):
    print(bisec(n + 1, 0, lambda x: x * k <= ax[min(x, max_take)]))
### BUGGY CODE ###


N = int(input())

lst_S = []
for i in range(N):
    lst_S.append(input().split())
    lst_S[i][0] = int(lst_S[i][0])
    lst_S[i][1] = int(lst_S[i][1])


bote_A = lst_S[0][0]
bote_B = lst_S[0][1]

for i in range(1, N):
    A_w = lst_S[i][0]
    B_w = lst_S[i][1]
    while 1:
        if (A_w >= bote_A) and (B_w >= bote_B):
            break
        else:
            A_w += lst_S[i][0]
            B_w += lst_S[i][1]
    bote_A = A_w
    bote_B = B_w

ans = bote_A + bote_B

print(ans)


### FIXED CODE ###

N = int(input())

lst_S = []
for i in range(N):
    lst_S.append(input().split())
    lst_S[i][0] = int(lst_S[i][0])
    lst_S[i][1] = int(lst_S[i][1])

bote_A = lst_S[0][0]
bote_B = lst_S[0][1]

for i in range(1, N):
    bai_A = (bote_A - 1) // lst_S[i][0]
    bai_B = (bote_B - 1) // lst_S[i][1]

    bai = max(bai_A, bai_B) + 1

    bote_A = lst_S[i][0] * bai
    bote_B = lst_S[i][1] * bai

ans = bote_A + bote_B

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

n = int(input())
ans = []
cnt = 0
for i in range(n):
    s = input()
    if not s in ans:
        ans.append(s)
        cnt+=1
print(cnt)

### FIXED CODE ###

n = int(input())
ans = []
cnt = 1
for i in range(n):
    s = input()
    ans.append(s)
ans.sort()
for i in range(n-1):
    if ans[i]!=ans[i+1]:
        cnt+=1
print(cnt)
### BUGGY CODE ###

# -*- coding: utf-8 -*-

N = int(input())
array = [int(input()) for i in range(N)]

for i in range(N):
  backup = array.pop(i)
  print(max(array))
  array.insert(i, backup)


### FIXED CODE ###

# -*- coding: utf-8 -*-

N = int(input())
array = [int(input()) for i in range(N)]

array_sorted = sorted(array, reverse=True)
max_index = array.index(array_sorted[0])
max_value = array_sorted[0]
second_value = array_sorted[1]

for i in range(N):
  if array[i] == max_value:
    print(second_value)
  else:
    print(max_value)
### BUGGY CODE ###

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


n, m = map(int, input().split())

if is_prime(m):
    print(1)
    exit()

ans = 0
for i in range(1, m // n + 1):
    if m % i == 0:
        ans = i

print(ans)

### FIXED CODE ###

n, m = map(int, input().split())
ans = 1
for i in range(1, int(m ** .5) + 1):
    if m % i == 0:
        b = m // i
        if i * n <= m:
            ans = max(ans, i)
        if b * n <= m:
            ans = max(ans, b)
print(ans)