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

#!/usr/bin/env python3
import sys
INF = float("inf")


def solve(N: int, T: "List[int]", A: "List[int]"):

    a0, a1 = T[0], A[0]
    for t, a in zip(T, A):
        while a0*a != a1*t:
            if a0/a1 - t/a > 0:
                a1 += 1
            else:
                a0 += 1
        # print(a0, a1)
    print(a0+a1)
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    T = [int()] * (N)  # type: "List[int]"
    A = [int()] * (N)  # type: "List[int]"
    for i in range(N):
        T[i] = int(next(tokens))
        A[i] = int(next(tokens))
    solve(N, T, A)


if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys
INF = float("inf")


def main():
    # i回目 Ti : Ai
    N = int(input())
    T, A = [], []
    for i in range(N):
        t, a = map(int, input().split())
        T.append(t)
        A.append(a)

    num = [0, 0]
    for i, (t, a) in enumerate(zip(T, A)):
        # print(i, t, a, num)
        while True:
            if num[0] <= t and num[1] <= a:
                break
            if num[0] <= t:
                # print("B", t, a, num)
                c = -(-num[1]//a)
                a *= c
                t *= c
                continue
            if num[1] <= a:
                # print("C", t, a, num)
                c = -(-num[0]//t)
                199, 17
                a *= c
                t *= c
                continue
            c = max(-(-num[0]//t), -(-num[1]//a))
            # print("D", t, a, num, c)
            a *= c
            t *= c
            continue
        num[0] = t
        num[1] = a
        # print(a, t)
    print(num[0]+num[1])


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

import numpy as np
import re
prog = re.compile('AC')
N, Q = [int(x) for x in input().split()]
S = input()
result = prog.finditer(S)
#pos = np.array([res.start()+1 for res in result])
pos = [res.start()+1 for res in result]

for _ in range(Q):
  l, r = [int(x) for x in input().split()]
  ans = 0
  for p in pos:
    if p>=l and p<=r-1:
      ans += 1
  print(ans)


### FIXED CODE ###

import numpy as np
def find_AC(S):
  ret = [0]*len(S)
  for i in range(len(S)-1):
    if S[i] == 'A' and S[i+1] == 'C':
      ret[i+1] = 1
  return ret

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

cum = np.cumsum(find_AC(S))

for _ in range(Q):
  l, r = [int(x) for x in input().split()]
  ans = cum[r-1] - cum[l-1]
  print(ans)
### BUGGY CODE ###

n = int(input())
l = list(map(int,input().split()))
ans = 0
for i in range(n):
    ans += ((l[i]*sum(l[i+1:n]))%1000000007)
print(ans%1000000007)

### FIXED CODE ###

n = int(input())
l = list(map(int,input().split()))
ans = 0
sum_n = [0]*n
sum_n[0] = l[0]
sumall = sum(l)
for i in range(1,n):
    sum_n[i] = sum_n[i-1] + l[i]
for i in range(n):
    ans += ((l[i]*(sumall-sum_n[i]))%1000000007)
print(ans%1000000007)
### BUGGY CODE ###

def gcdf(a,n):
#    print("a:",a)
    a0=a[0]
    ramin=10**9
    ramin0=20**9
    while ramin0!=ramin:
        ramin0=ramin
        for i in range(n):
            a[i]=a[i]%a0
            if a[i]==0:
                a[i]=a0
#            ra=a[i]%a0
#            print(i,a[i],a0,ramin)
            if ramin>a[i] and a[i]!=0:
                ramin=a[i]
        a0=min(a)
#        print("a:",a,ramin)
    return ramin


#n=2
#a=[1000000000, 1000000000]
#n=4
#a=[15, 18, 24, 36]
n=int(input())

a=[]
for i in map(int,input().split()):
    a.append(i)

#print(a)
if n==2:
    print(max(a))
else:
    gcdv=0
    a.sort()
    for i in range(n):
        acpy=list(a)
        del acpy[i]
        gcdx=gcdf(acpy,n-1)
#        gcdx=gcd(acpy)
#        gcdx=functools.reduce(gcd,acpy)
#        gcdx=functools.reduce(math.gcd,acpy)
        if gcdx>gcdv:
            gcdv=gcdx
    print(gcdv)


### FIXED CODE ###

def gcdf(a):
    a.sort()
#    print("a2:",a)
    a0=a[0]
    a=[int(x%a0) for x in a if x%a0 != 0]
#    print("a2:",a)
    if len(a)==0:
        return a0
    else:
        a.append(a0)
        a0=min(a)
        return gcdf(a) 

#n=8
#a=[746130, 1385670, 4849845, 881790, 3233230, 1939938, 570570, 510510]
#ans=[19]
#n=2
#a=[1000000000, 1000000000]
#n=5
#a=[15, 18, 24, 36, 81]
#n=3
#a=[7, 6, 8]
n=int(input())
a=[]
for i in map(int,input().split()):
    a.append(i)
if n==2:
    print(max(a))
elif n<2**10:
    gcdv=0
    for i in range(n):
        acpy=list(a)
        del acpy[i]
        gcdx=gcdf(acpy)
        if gcdx>gcdv:
            gcdv=gcdx
    print(gcdv)
else:
    m=int(n**(1/2))
    ns=int(n/m)
    rgcd=[]
    for mi in range(m):
        ms=ns*mi
        if mi==m-1:
            am=a[ms:n]
        else:
            am=a[ms:ms+ns]
        gcdm=gcdf(am)
        rgcd.append(gcdm)
    gcdv=0

    for mi in range(m):
        rgcd1=list(rgcd)
        del rgcd1[mi]
        gcdrg1=gcdf(rgcd1)
        ms=ns*mi
        if mi==m-1:
            am=a[ms:n]
        else:
            am=a[ms:ms+ns]
#        print(mi,gcdf(am),len(am),gcdf(rgcd1))
        for i in range(len(am)):
            acpy=list(am)
#            del acpy[i]
#            acpy.append(gcdrg1)
            acpy[i]=gcdrg1
            gcdx=gcdf(acpy)
            if gcdx>gcdv:
                gcdv=gcdx
    print(gcdv)
### BUGGY CODE ###

x=int(input())
flag=True
l=[]
for i in range(2,int(x**0.5)+1):
  if x%i==0:
    l.append(i)
    #print(q)
while flag:
  for i in range(-100,100):
    for j in l:
      if (i+j)**5-i**5==x:
        flag=False
        a=i+j
        b=i
print(a,b)

### FIXED CODE ###

x=int(input())
for i in range(-200,200):
  for j in range(-200,200):
    if i**5-j**5==x:
      a=i
      b=j
print(a,b)
### BUGGY CODE ###

R,G,B,N = map(int,input().split())
RGB = list(reversed(sorted([R,G,B])))
MAXES = [N//i for i in RGB]
answer = 0
for i in range(MAXES[0]+1):
    for j in range(MAXES[1]+1):
            if (N - (RGB[0]*i + RGB[1]*j)) % RGB[2] == 0 and N >= (RGB[0]*i + RGB[1]*j):
                # print(i,j)
                answer += 1
print(answer)

### FIXED CODE ###

R,G,B,N = map(int, input().split())
answer = 0
for i in range(N+1):
    for j in range(N+1):
        if N>=(i*R+j*G) and  (N-(i*R+j*G))%B==0:
            answer += 1
print(answer)
### BUGGY CODE ###

import numpy as np
a, b = map(int, input().split())
A = [0] * a
A = np.array(A)

for i in range(b):
    c, d = map(int , input().split())
    A[c-1 : d]  += 1

print(np.sum(A == b))



### FIXED CODE ###

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

maxf = 1
minf = a

for i in range(b):
    c, d = map(int, input().split())
    if(maxf < c):
        maxf = c
    if(minf > d):
        minf = d

if(minf-maxf < 0):
    print(0)
else:
    print(minf -maxf + 1)
### BUGGY CODE ###

import numpy as np

N = int(input())

dicdata = {}
for i in range(N):
	data = input()
	if data in dicdata:
		dicdata[data] += 1
	else:
		dicdata[data] = 1

newdata = [k for k, v in dicdata.items() if v == max(dicdata.values())]

newdata = sorted(newdata)

for i in range(len(newdata)):
	print(newdata[i])

### FIXED CODE ###

import collections

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

dicdata = collections.Counter(data)

m = max(dicdata.values())

newdata = [k for k, v in dicdata.items() if v == m]

newdata.sort()

[print(i) for i in newdata]
### BUGGY CODE ###

s = input()
k = int(input())
import math

if len(s) == 1:
    print(math.floor(k/2))
    exit()
if len(s) == 2:
    if s[0] == s[1]:
        print(k)
        exit()
    else:
        print(0)
        exit()

ans=0
last=s[0]
length=1
change=0
for i in range(1,len(s)):
    if s[i] == last:
        length+=1
    else:
        change += math.floor(length/2)
        length=1
    last=s[i]

change += math.floor(length/2)

ans=change*k
if s[0] != s[-1]:
    print(ans)
    exit()

for i in range(10**10):
    3*4

if s[0] != s[1] and s[-1] != s[-2]:
    print(ans+k-1)
    exit()

print(ans)

### FIXED CODE ###

s = input()
k = int(input())
import math

if len(s) == 1:
    print(math.floor(k/2))
    exit()
if len(s) == 2:
    if s[0] == s[1]:
        print(k)
        exit()
    else:
        print(0)
        exit()
if len(set(list(s))) == 1:
    print(len(s) * k // 2)
    exit()

ans=0
last=s[0]
length=1
change=0
for i in range(1,len(s)):
    if s[i] == last:
        length+=1
    else:
        change += math.floor(length/2)
        length=1
    last=s[i]

change += math.floor(length/2)
ans=change*k
if s[0] != s[-1]:
    print(ans)
    exit()

l_length=1
last=s[0]
for i in range(1,len(s)):
    if s[i] == last:
        l_length+=1
    else:
        break
r_length=1
last=s[-1]
for i in range(len(s)-2,-1,-1):
    if s[i] == last:
        r_length+=1
    else:
        break

if l_length%2==1 and r_length%2==1:
    print(ans+k-1)
    exit()

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

N = int(input())
s_list = []
for i in range(N):
    s_list.append(input())

def strcount(string):
    dic = {}
    for s in string:
        if s not in dic:
            dic[s] = 1
        else:
            dic[s] += 1
    return dic

dic_list = []
for i in range(N):
    dic_list.append(strcount(s_list[i]))

cnt = 0
for i in range(N):
    #dic = strcount(s_list[i])
    dic_i = dic_list[i]
    for j in range(i + 1, N):
        #dic = strcount(s_list[i])
        dic_j = dic_list[j]
        if dic_i == dic_j:
            cnt += 1
print(cnt)

### FIXED CODE ###

N = int(input())
anagram = {}

ans = 0
for i in range(N):
    tmp = str(sorted(input()))
    if tmp in anagram:
        ans += anagram[tmp]
        anagram[tmp] += 1
    else:
        anagram[tmp] = 1

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

class Dict(object):

    m1 = 1046527
    m2 = m1 - 1

    def __init__(self):
        self._dict = ["" for _ in range(self.m1)]

    def insert(self, k):
        i = 0

        while True:
            ix = self._h(k, i)
            if self._dict[ix] == "":
                self._dict[ix] = k
                return
            else:
                i += 1

    def find(self, k):
        i = 0

        while True:
            ix = self._h(k, i)
            if self._dict[ix] == k:
                return True
            elif self._dict[ix] == "":
                return False
            else:
                i += 1

    def _h(self, k, i):
        return (self._h1(k) + i * self._h2(k)) % self.m1

    def _h1(self, k):
        return k % self.m1

    def _h2(self, k):
        return k % self.m2 + 1


def to_int(s):
    ret = 0
    i = 1
    for j in range(len(s)):
        e = s[len(s) - j - 1]

        if e == 'A':
            ret += 1 * i
        elif e == 'C':
            ret += 2 * i
        elif e == 'G':
            ret += 3 * i
        elif e == 'T':
            ret += 4 * i
        i *= 4

    return ret


if __name__ == '__main__':
    n = int(input())

    d = Dict()

    for _ in range(n):
        cmd, val = input().split()

        if cmd == "insert":
            d.insert(to_int(val))
        else:
            ans = "yes" if d.find(to_int(val)) else "no"
            print(ans)

### FIXED CODE ###

M = 1046527
L = 14
H = [""] * M
 
def getChar(ch):
    if ch == 'A':
        return 1
    elif ch == 'C':
        return 2
    elif ch == 'G':
        return 3
    elif ch == 'T':
        return 4
    else:
        return 0
 
def getKey(strings):
    Sum = 0
    p = 1
    for i in xrange(len(strings)):
        Sum += p * getChar(strings[i])
        p *= 5
 
    return Sum
 
def h1(key):
    return key % M
 
def h2(key):
    return 1 + (key % (M-1))
 
def find(strings):
    key = getKey(strings)
    i = 0
    while True:
        h = (h1(key) + i * h2(key)) % M
        if H[h] == strings:
            return 1
        elif len(H[h]) == 0:
            return 0
        else:
            i += 1
    return 0
 
def insert(strings):
    key = getKey(strings)
    i = 0
    while True:
        h = (h1(key) + i * h2(key)) % M
        if H[h] == strings:
            return 1
        elif len(H[h]) == 0:
            H[h] = strings
            return 0
        else:
            i += 1
    return 0
 
def main():
    n = input()
    for i in xrange(n):
        com = raw_input().split()
        if com[0][0] == 'i':
            insert(com[1])
        else:
            if find(com[1]):
                print 'yes'
            else:
                print 'no'
    return 0
 
main()
### BUGGY CODE ###

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

def main(N,M,islands):
    queue = []
    flag = False
    islands_s = sorted(islands, key=lambda x: x[0])
    for a,b in islands:
        if(a==1):
            queue.append(b)
    for a,b in islands:
        if(a in queue and b==N):
            flag = True
    print("POSSIBLE") if flag else print("IMPOSSIBLE")

if __name__ == '__main__':
    N, M = map(int, input().split())
    islands = []
    for i in range(M):
        a, b = map(int, input().split())
        islands.append([a,b])
    main(N,M,islands)

### FIXED CODE ###

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

def main(N,M,visited,queue):
    ans = "IMPOSSIBLE"

    for i in queue:
        if visited[i-1] == True:
            ans = "POSSIBLE"
            break
            
    print(ans)

if __name__ == '__main__':
    N, M = map(int, input().split())
    visited,queue = [False]*N, []
    for i in range(M):
        a, b = map(int, input().split())
        if(a==1):
            visited[b-1] = True
        elif(b==N):
            queue.append(a)
    main(N,M,visited,queue)
### BUGGY CODE ###

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

ans = 0
for i in range(10 ** 7):
  print(A * i // B - A * (i // B))
  ans = max(ans, A * i // B - A * (i // B))

for i in range(10 ** 7):
  i = N - i
  if i < 0:
    break
  ans = max(ans, A * i // B - A * (i // B))

print(ans)

### FIXED CODE ###

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

def solve(i):
  return A * i // B - A * (i // B)

print(solve(min(B-1, N)))
### BUGGY CODE ###

sx,sy,tx,ty=map(int,input().split())
n=int(input())
p=[(sx,sy,0)]
for _ in range(n):
  x,y,r=map(int,input().split())
  p.append((x,y,r))
p.append((tx,ty,0))
n+=2
edge=[[]for _ in range(n)]
for i in range(n-1):
  for j in range(i+1,n):
    sx,sy,sr=p[i]
    tx,ty,tr=p[j]
    t=(abs(sx-tx)**2+abs(sy-ty)**2)**0.5
    c=max(0,t-(sr+tr))
    edge[i].append((j,c))
    edge[j].append((i,c))
from heapq import heappop,heappush
def dijkstra(s,n,edge):
  inf=10**20
  ans=[inf]*n
  ans[s]=0
  root=[-1]*n
  h=[[0,s]]
  while h:
    c,v=heappop(h)
    if ans[v]<c:continue
    for u,t in edge[v]:
      if c+t<ans[u]:
        ans[u]=c+t
        root[u]=v
        heappush(h,[c+t,u])
  return ans
d=dijkstra(0,n,edge)
print(d[n-1])

### FIXED CODE ###

import sys
input=sys.stdin.readline
sx,sy,tx,ty=map(int,input().split())
n=int(input())
p=[(sx,sy,0)]
for _ in range(n):
  x,y,r=map(int,input().split())
  p.append((x,y,r))
p.append((tx,ty,0))
n+=2
edge=[[]for _ in range(n)]
for i in range(n-1):
  for j in range(i+1,n):
    sx,sy,sr=p[i]
    tx,ty,tr=p[j]
    t=(abs(sx-tx)**2+abs(sy-ty)**2)**0.5
    c=max(0,t-(sr+tr))
    edge[i].append((j,c))
    edge[j].append((i,c))
from heapq import heappop,heappush
inf=10**20
ans=[inf]*n
ans[0]=0
root=[-1]*n
h=[(0,0)]
while h:
  c,v=heappop(h)
  if ans[v]<c:continue
  for u,t in edge[v]:
    if c+t<ans[u]:
      ans[u]=c+t
      root[u]=v
      heappush(h,(c+t,u))
print(ans[n-1])
### BUGGY CODE ###

N = int(input())

S = [str(input()) for _ in range(N)]

answer = []

for i in range(N):
    if(S[i] not in answer):
        answer.append(S[i])
        
        
print(len(answer))

### FIXED CODE ###

N = int(input())

S = [str(input()) for _ in range(N)]

answer = []
answer = list(set(S))

#for i in range(N):
    #if(S[i] not in answer):
        #answer.append(S[i])


print(len(answer))
### BUGGY CODE ###

from collections import defaultdict
from copy import deepcopy
import sys
sys.setrecursionlimit(1000000)
input = sys.stdin.readline
n, m = list(map(int, input().split()))

if m%2==1:
  print(-1)
  exit()

graph = defaultdict(set)
grapht = defaultdict(set)
for i in range(m):
  a, b = list(map(int, input().split()))
  a -= 1
  b -= 1
  graph[a].add(b)
  graph[b].add(a)
  grapht[a].add(b)
  grapht[b].add(a)

graph2 = defaultdict(set)
visited = [0 for i in range(n)]
num = [1 for i in range(n)]

def dfs(x):
  visited[x] = 1

  for nx in graph[x]:
    if not visited[nx]:
      dfs(nx)

  t = set()
  if num[x]==1 and len(grapht[x])%2==0:
    for e in grapht[x]:
      graph2[x].add(e)
      t.add(e)
  elif num[x]==-1 and len(grapht[x])%2==0:
    for j, e in enumerate(grapht[x]):
      if j==len(grapht[x])-1:
        graph2[e].add(x)
        num[e] *= -1
      else:
        graph2[x].add(e)
      t.add(e)
  elif num[x]==1 and len(grapht[x])%2==1:
    for j, e in enumerate(grapht[x]):
      if j==len(grapht[x])-1:
        graph2[e].add(x)
        num[e] *= -1
      else:
        graph2[x].add(e)
      t.add(e)
  elif num[x]==-1 and len(grapht[x])%2==1:
    for e in grapht[x]:
      graph2[x].add(e)
      t.add(e)
  for e in t:
    grapht[x].remove(e)
    grapht[e].remove(x)

dfs(0)

for i in range(n):
  if len(graph2[i])%2==1:
    print(-1)
    exit()

for i in range(n):
  for e in graph2[i]:
    print(i+1, e+1)

### FIXED CODE ###

from collections import defaultdict
import sys

def dfs(visited, graph, grapht, graph2, num, x):
  visited[x] = 1

  for nx in graph[x]:
    if not visited[nx]:
      dfs(visited, graph, grapht, graph2, num, nx)

  t = set()
  if num[x]==1 and len(grapht[x])%2==0:
    for e in grapht[x]:
      graph2[x].add(e)
      t.add(e)
  elif num[x]==-1 and len(grapht[x]) and len(grapht[x])%2==0:
    for e in grapht[x]:
      graph2[x].add(e)
      t.add(e)
    tt = grapht[x].pop()
    graph2[tt].add(x)
    graph2[x].remove(tt)
    num[tt] *= -1
  elif num[x]==1 and len(grapht[x])%2==1:
    for e in grapht[x]:
      graph2[x].add(e)
      t.add(e)
    tt = grapht[x].pop()
    graph2[tt].add(x)
    graph2[x].remove(tt)
    num[tt] *= -1
  else:
    for e in grapht[x]:
      graph2[x].add(e)
      t.add(e)
  for e in t:
    if e in grapht[x]:
      grapht[x].remove(e)
    if x in grapht[e]:
      grapht[e].remove(x)

if __name__ == "__main__":
  sys.setrecursionlimit(1000000)
  input = sys.stdin.readline
  n, m = map(int, input().split())

  if m%2==1:
    print(-1)
    exit()

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

  graph2 = defaultdict(set)
  visited = [0]*n
  num = [1]*n

  dfs(visited, graph, grapht, graph2, num, 0)

  for i in range(n):
    if len(graph2[i])%2==1:
      print(-1)
      exit()

  for i in range(n):
    for e in graph2[i]:
      print(i+1, e+1)
### BUGGY CODE ###

def DE(n):
    return float((float(n)+1)/2)

def main():
    N,K = map(int,input().split())
    p = list(map(DE,input().split()))
    ans = 0
    for i in range(N-K+1):
        ans = max(ans,sum(p[i:i+K]))
    print(ans)

if __name__ == '__main__':
    main()

### FIXED CODE ###

def DE(n):
    return float((float(n)+1)/2)

def main():
    N,K = map(int,input().split())
    p = list(map(DE,input().split()))
    ans = 0
    tmp = [sum(p[:K])]
    for i in range(K,N):
        tmp.append(tmp[i-K]+p[i]-p[i-K])
    print(max(tmp))

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

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

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


def dfs(total, cnt, idx):
  
  #末尾まで確認した
  if idx == len(x):
    if cnt != 0:
      return 1 if total / cnt == A else 0
    else:
      return 0
  
  ret = 0
  
  ret += dfs(total + x[idx], cnt+1, idx+1)
  ret += dfs(total, cnt, idx+1)
  
  return ret
      
  
ans = dfs(0, 0, 0)
print(ans)

### FIXED CODE ###

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

max_num = max(x)
max_num = max(A, max_num)
# x_jまでからk枚選んで合計がｓになる選び方の総数。ｓはk*Aにすれば平均がAになる
dp = [[[0 for _ in range(max_num * N + 1)] for _ in range(N + 1)] for _ in range(N + 1)]
#何も選ばないで平均が０
dp[0][0][0] = 1

for j in range(N+1):
  for k in range(j+1):
    for s in range(max_num * k + 1):
      if j >= 1 and s < x[j - 1]:
        # j番目を選んでk+1個を選んだ際に平均がAにならない場合
        dp[j][k][s] = dp[j - 1][k][s]
      elif j >= 1 and k >= 1 and s >= x[j - 1]:
        # j番目をえらんでk+1個選んで平均がAになるものがあるなら、j-1番までの合計はs-x_j-1なので、その数を足している
        dp[j][k][s] = dp[j - 1][k][s] + dp[j - 1][k - 1][s - x[j - 1]]
 

ans = 0
# 合計がkAになるものを加算
for k in range(1, N + 1):
  ans += dp[N][k][k*A]
print(ans)
### BUGGY CODE ###

import copy
# input
n = int(input())
a = []
for i in range(n):
  a.append(int(input()))
  
# main / output
for i in range(n):
  tmp = copy.deepcopy(a)
  del tmp[i]
  print(max(tmp))

### FIXED CODE ###

import copy
# input
n = int(input())
a = []
for i in range(n):
  a.append(int(input()))
  
# main / output
top = max(a)
if a.count(top) != 1:
  for i in range(n):
    print(top)
else:
  topind = a.index(top)

  tmp = copy.deepcopy(a)
  tmp[topind] = 0
  sub = max(tmp)
  
  for i in range(n):
    if i == topind:
      print(sub)
    else:
      print(top)
### BUGGY CODE ###

def main():
    n, *a, = map(int, open(0).read().split())
    m = max(a)

    def minimum_prime(x):
        if x == 1:
            return 1
        for i in range(2, x + 1):
            if x % i == 0:
                return i

    d = [minimum_prime(i) for i in range(m + 1)]

    def primes(x):
        ps = set()
        while x != 1:
            p = d[x]
            ps.add(p)
            x = x // d[x]
        return ps

    b = set()
    c = primes(a[0])
    f = 0
    for i in a:
        primes = set()
        while i != 1:
            p = d[i]
            primes.add(p)
            i = i // d[i]
        if b & primes:
            f = 1
        b |= primes
        c &= primes

    if f == 0:
        ans = "pairwise coprime"
    elif len(c) == 0:
        ans = "setwise coprime"
    else:
        ans = "not coprime"

    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    n, *a, = map(int, open(0).read().split())
    m = max(a)

    d = [0] * (m+1)
    d[1] = 1
    for i in range(2, m+1):
        for j in range(i, m+1, i):
            if d[j] == 0:
                d[j] = i

    def primes(x):
        ps = set()
        while x != 1:
            p = d[x]
            ps.add(p)
            x = x // d[x]
        return ps

    b = set()
    c = primes(a[0])
    f = 1
    for i in a:
        ps = set()
        while i != 1:
            p = d[i]
            ps.add(p)
            i = i // d[i]
        if f:
            if b & ps:
                f = 0
            b |= ps
        c &= ps

    if f:
        ans = "pairwise coprime"
    elif len(c) == 0:
        ans = "setwise coprime"
    else:
        ans = "not coprime"

    print(ans)


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

import math
import itertools
import sys
input = sys.stdin.readline


def f(x, y, z):
    return x**2+y**2+z**2+x*y+y*z+z*x


N = int(input())
NL = []

for n in range(1, N+1):
    lim = int(math.sqrt(n))
    ans = 0
    for x in range(1, lim):
        for y in range(x, lim):
            for z in range(y, lim):
                if f(x, y, z) == n:
                    if len(set([x, y, z])) == 1:
                        ans += 1
                    elif len(set([x, y, z])) == 2:
                        ans += 3
                    else:
                        ans += 6
    print(ans)
# for i in range(1, N):
#     print(NL.count(i))


### FIXED CODE ###

import math
import itertools
import sys
input = sys.stdin.readline


def f(x, y, z):
    return x**2+y**2+z**2+x*y+y*z+z*x


N = int(input())

ans = [0 for _ in range(N)]
lim = 101
for x in range(1, lim):
    for y in range(1, lim):
        for z in range(1, lim):
            A = f(x, y, z)
            if A <= N:
                ans[A-1] += 1
for i in range(N):
    print(ans[i])
### BUGGY CODE ###

[n,m] = [int(i) for i in input().split()]
a=[]


for i in range(1,m//n+1):
    if m % i == 0:
        a.append(i)
#print(a)
a.sort(reverse=True)
#print(a)
for i in a:
    if i <= m//n:
        print(i)
        break


### FIXED CODE ###

[n,m] = [int(i) for i in input().split()]
if n == 1:
    print(m)
else:
    ans = -1
    #a1は高々この値
    a1_max = m // n
    for i in range(a1_max,0,-1):
        if (m - i) % i == 0 and (m - i)//i >= (n-1):
            ans = max(ans,i)
    print(ans)