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

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

i = 1
ans = 1
while i * i <= m:
  if m % i == 0:
    if i >= n:
      if i >= n:
        ans = max(ans, m // i)
      elif m // i >= n:
        ans = max(ans(ans, i))
  
  
print(ans)

### FIXED CODE ###

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

ans = 1

for i in range(1, int(m ** 0.5)+1):
  if m % i == 0:
    if i >= n:
      ans = max(ans, m // i)
    elif m // i >= n:
      ans = max(ans, i)
      
      
print(ans)
### BUGGY CODE ###

N = int(input())
S = input()
s = set()
for x in range(N - 2):
    for y in range(x + 1, N  - 1):
        for z in range(y + 1, N):
            s.add(S[x] + S[y] + S[z])
print(len(s))

### FIXED CODE ###

N = int(input())
S = input()

ret = 0
for x in range(10):
    for y in range(10):
        for z in range(10):
            a = S.find(str(x))
            if a != -1:
                b = S.find(str(y), a + 1)
                if b != -1:
                    c = S.find(str(z), b + 1)
                    if c != -1:
                        ret += 1
print(ret)
### BUGGY CODE ###

input()
da = list(map(int,input().split()))
al = 0
ta = [0]*len(da)
for i in range(len(da)):
  if i == 0:
    for j in range(len(da)-i):
     ta[j] = sum(da[i:j+1])
     if ta[j] == 0:
      al  += 1
  else:
    for j in range(len(da)-i):
      ta[j+i] -= da[i -1]
      if ta[j+i] == 0:
        al += 1
print(al)

### FIXED CODE ###

from collections import defaultdict
 
n = int(input())
a = [int(i) for i in input().split()]
 
s = 0
d = defaultdict(int)
ans = 0
d[0] = 1
 
for i in a:
    s += i
    ans += d[s]
    d[s] += 1
 
print(ans)
### BUGGY CODE ###

from collections import deque
import sys

H, W = map(int, input().split())
xs, ys = map(int, input().split())
xt, yt = map(int, input().split())
xs -= 1
ys -= 1
xt -= 1
yt -= 1
G = [input() for _ in range(H)]

D_wk = [[1,0], [0,1], [-1,0], [0,-1]]
D_tl = 2

#cost = [[-1  for _ in range(W)] for _ in range(H)]

possible = set()
for i in range(H):
  for j in range(W):
    if G[i][j] == ".":
      possible.add(i * W + j)

# 01-BFS
def append_walk(c, x, y):
  for dx, dy in D_wk:
    if 0 <= x+dx <= H-1 and 0 <= y+dy <= W-1 and ((x+dx)*W+(y+dy)) in possible and ((x+dx)*W+(y+dy)) not in visited:
      task.appendleft([c, x+dx, y+dy])
def append_tele(c, x, y):
  for dx in range(-D_tl, D_tl+1):
    for dy in range(-D_tl, D_tl+1):
      if 0 <= x+dx <= H-1 and 0 <= y+dy <= W-1 and ((x+dx)*W+(y+dy)) in possible and ((x+dx)*W+(y+dy)) not in visited:
        task.append([c+1, x+dx, y+dy])

task = deque([[0, xs, ys]])
visited = set()
while task:
  while True:
    c, x, y = task.popleft()
    if x*W+y not in visited:
      break
    if not task:
      print(-1)
      sys.exit()    
  if x == xt and y == yt:
    print(c)
    #print(*cost, sep="\n")
    sys.exit()  
  visited.add(x*W+y)
  #cost[x][y] = c
  append_walk(c, x, y)
  append_tele(c, x, y)
  
print(-1)

### FIXED CODE ###

from collections import deque
import sys

def BFS(task, ct):
  D = [(1,0), (0,1), (-1,0), (0,-1)]
  semi_visited = set()
  task_n = deque([])
  for s in task:
    semi_visited.add(s)
  while task:
    s = task.popleft()
    #print(s, ct, 1, task)
    if s == (hg, wg):
      print(ct)
      sys.exit()
    x = s[0]
    y = s[1]
    for d in D:
      s_n = (x+d[0], y+d[1])
      #print(s_n, s_n not in semi_visited)
      if 0 <= s_n[0] <= H-1 and 0 <= s_n[1] <= W-1 and (s_n not in semi_visited) and S[s_n[0]][s_n[1]] == ".":
        task.append(s_n)
        semi_visited.add(s_n) 
        visited.add(s_n)
  #print(semi_visited)   
  for s in semi_visited:
    warp(s, task_n)
  return (ct+1, task_n)

def warp(p, task_n):
  #print(p)
  x = p[0]
  y = p[1]
  for dh in range(-2,3):
    for dw in range(-2,3):
      s_n = (x+dh, y+dw)
      if 0 <= s_n[0] <= H-1 and 0 <= s_n[1] <= W-1:
        #print(s_n, visited)
        if S[s_n[0]][s_n[1]] == "." and s_n not in visited:
          task_n.append(s_n)
          visited.add(s_n)
  return task_n

H, W = map(int, input().split())
hs, ws = map(int, input().split())
hs -= 1
ws -= 1
hg, wg = map(int, input().split())
hg -= 1
wg -= 1

S = [input() for _ in range(H)]

task = deque([(hs, ws)])
visited = {(hs, ws)}
semi_visited = {(hs, ws)}
ct = 0

while task:
  #print(ct)
  ct, task = BFS(task, ct)
  #print(task, ct)
  
print(-1)
### BUGGY CODE ###

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

dp = [0] * (n+1)
for i in range(n+1):
     if i in a:
          dp[i] = 0
     elif i == 0 or i == 1:
          dp[i] = 1
     else:
          dp[i] = dp[i-1] + dp[i-2]
print(dp[n]%1000000007)

### FIXED CODE ###

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

N = int(input())

Dist = [[0 for i in range(N)] for j in range(N)]
Seen = [-1] * N

for i in range(N-1):
    u, v, w = map(int, input().split())
    Dist[u-1][v-1] = w
    Dist[v-1][u-1] = w

que = [0]
Seen[0] = 0
flag = True
while -1 in Seen:
    now = que.pop()
    for next in range(N):
        if Dist[now][next] == 0:
            continue
        elif Seen[next] == -1:
            que.insert(0, next)
            if Dist[now][next] % 2 == 0:
                Seen[next] = Seen[now]
            else:
                Seen[next] = 1 - Seen[now]
for i in range(N):
    print(Seen[i])

### FIXED CODE ###

N = int(input())

Dist = [[] for j in range(N)]
Seen = [-1] * N

for i in range(N-1):
    u, v, w = map(int, input().split())
    Dist[u-1].append([v-1, w])
    Dist[v-1].append([u-1, w])

que = [0]
Seen[0] = 0
flag = True
while -1 in Seen:
    now = que.pop()
    for next, distance in Dist[now]:
        if Seen[next] == -1:
            que.insert(0, next)
            if distance % 2 == 0:
                Seen[next] = Seen[now]
            else:
                Seen[next] = 1 - Seen[now]
for i in range(N):
    print(Seen[i])
### BUGGY CODE ###

def main():
    n = int(input())
    a = list( map( int, input().split()))
    sum = 1
    for i in a:
        sum = sum * i
    if sum >1000000000000000000:
        print(-1)
    else:
       print(sum)
    
if __name__ == '__main__':
    main()

### FIXED CODE ###

import copy

def main():
    n = int(input())
    a = list( map( int, input().split()))
    sum = 1
    if 0 in a:
        print(0)
    else:
        for i in a:
            sum = sum * i
            if sum > 1000000000000000000:
                print(-1)
                exit()
        print(sum)
    
if __name__ == '__main__':
    main()
### BUGGY CODE ###

n,x,y = map(int,input().split())
ans = {}
for i in range(1,n):
    for j in range(i+1,n+1):
        dist = min(abs(i-j),abs(i-x)+abs(j-y)+1,abs(i-y)+abs(j-x)+1)
        if dist in ans.keys():
            ans[dist] += 1
        else:
            ans[dist] = 1
for k in range(1,n):
    if k in ans.keys():
        print(ans[k])
    else:
        print(0)

### FIXED CODE ###

n,x,y = map(int,input().split())
ans = {}
s = (y-x+1)//2
s = x+s
for i in range(1,n):
    for j in range(i+1,n+1):
        if i <= s:
            dist = min(j-i,abs(i-x)+abs(j-y)+1)
        else:
            dist = j-i
        if dist in ans.keys():
            ans[dist] += 1
        else:
            ans[dist] = 1
for k in range(1,n):
    if k in ans.keys():
        print(ans[k])
    else:
        print(0)
### BUGGY CODE ###

from collections import deque
import math
import sys

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

box=[deque([]) for _ in range(w+h-1)]
box[0].append([0,0])
ans = 0
for i in range(w+h-1):
     while box[i]:
          y,x = box[i].popleft()
          if y == h-1 and x == w-1:
               if s[y][x] == '.' and s[0][0] == '.':
                    print(ans//2)
               elif s[y][x] == '.' and s[0][0] == '#' :
                    print((ans+1)//2)
               elif s[y][x] == '#' and s[0][0] == '.':
                    print((ans + 1) // 2)
               else:
                    print(ans//2 + 1)
               sys.exit()
          for k, j in [(1, 0), (0, 1)]:

               nexty, nextx = y + k, x + j
               if nexty < h and nextx < w:
                    if s[nexty][nextx] == s[y][x]:
                         box[i].append([nexty, nextx])

                    elif s[nexty][nextx] != s[y][x]:
                         box[i+1].append([nexty, nextx])


     ans += 1






### FIXED CODE ###

from collections import deque
import math
import sys

h,w = map(int,input().split())
s = [0] * h
for i in range(h):
     s[i] = [i for i in str(input())]
memo = [[300] * w for _ in range(h)]
memo[0][0] = 0
box=[deque([]) for _ in range(w+h-1)]
box[0].append([0,0])
ans = 0
for i in range(w+h-1):
     while box[i]:

          y,x = box[i].popleft()
          if y == h-1 and x == w-1:
               if s[y][x] == '.' and s[0][0] == '.':
                    print(ans//2)
               elif s[y][x] == '.' and s[0][0] == '#' :
                    print((ans+1)//2)
               elif s[y][x] == '#' and s[0][0] == '.':
                    print((ans + 1) // 2)
               else:
                    print(ans//2 + 1)
               sys.exit()
          for k, j in [(1, 0), (0, 1)]:
               nexty, nextx = y + k, x + j
               if nexty < h and nextx < w:
                    if memo[nexty][nextx] > 250:
                         memo[nexty][nextx] = ans
                         if s[nexty][nextx] == s[y][x]:
                              box[i].append([nexty, nextx])

                         elif s[nexty][nextx] != s[y][x]:
                              box[i + 1].append([nexty, nextx])


     ans += 1
### BUGGY CODE ###

N, W = map(int, input().split())
Weighs = []
Values = []
for _ in range(N):
    w, v = map(int, input().split())
    Weighs.append(w)
    Values.append(v)

dp = [[0]*(W+1) for _ in range(N)]

for i in range(0, N):
    for w in range(1, W+1):
        if w >= Weighs[i]:
            dp[i][w] = max(dp[i-1][w - Weighs[i]] + Values[i], dp[i-1][w])
        else:
            dp[i][w] = dp[i-1][w]
print(dp[N-1][W])

### FIXED CODE ###

import sys
import numpy as np
input = sys.stdin.readline

N, W = map(int, input().split())
dp = np.zeros((N, W+1), dtype='int64')

def solve(N, W):
    for i in range(0, N):
        wi, vi = map(int, input().split())
        dp[i][:wi] = dp[i-1][:wi]
        dp[i][wi:] = np.fmax(dp[i-1][wi:],
                            dp[i-1][:W+1-wi] + vi)
    return dp[N-1][W]

print(solve(N, W))
### BUGGY CODE ###

a,b,x=map(int,input().split())
ans=(b-a+1)//x
z=(b-a+1)%x
for i in range(a,a+z):
  if i%x==0:
    ans+=1
    break
print(ans)

### FIXED CODE ###

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

n,k=map(int, input().split())
a= list(map(int, input().split()))
l=[]
for i in range(len(a)):
  l.append((a[i]+1)/2)
maxans=0

for i in range(len(l)):
  ans=sum(l[i:i+k])
  maxans=max(ans,maxans)
print(maxans)

### FIXED CODE ###

n,k=map(int, input().split())
a= list(map(int, input().split()))
l=[]
for i in range(len(a)):
  l.append((a[i]+1)/2)
maxans=sum(l[0:k])
ans=sum(l[0:k])
for i in range(len(l)-k):
  ans=ans+l[i+k]-l[i]
  maxans=max(ans,maxans)
 
print(maxans)
### BUGGY CODE ###

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

H, W, m = map(int, input().split())

hor = defaultdict(int)
ver = defaultdict(int)
f = [[0 for _ in range(W)] for _ in range(H)]
for _ in range(m):
    h, w = map(int, input().split())
    hor[h - 1] += 1
    ver[w - 1] += 1
    f[h - 1][w - 1] = 1

hs = []
hmax = max(hor.values())
for k, v in hor.items():
    if hmax == v:
        hs.append(k)
vs = []
vmax = max(ver.values())
for k, v in ver.items():
    if vmax == v:
        vs.append(k)

ans = hmax + vmax
i = 0
for k1 in hs:
    for k2 in vs:
        if f[k1][k2] == 0:
            print(ans)
            exit()
print(ans - 1)


### FIXED CODE ###

import sys
from collections import defaultdict

input = sys.stdin.readline

H, W, m = map(int, input().split())

hor = [0] * H
ver = [0] * W
f = defaultdict(int)
for _ in range(m):
    h, w = map(int, input().split())
    hor[h - 1] += 1
    ver[w - 1] += 1
    f[str(h - 1) + '|' + str(w - 1)] = 1

hmax = max(hor)
hs = [i for i, v in enumerate(hor) if v == hmax]
vmax = max(ver)
vs = [i for i, v in enumerate(ver) if v == vmax]


ans = hmax + vmax

if len(hs) * len(vs) > m:
    print(ans)
    exit()

for k1 in hs:
    for k2 in vs:
        if f[str(k1) + '|' + str(k2)] == 0:
            print(ans)
            exit()
print(ans - 1)
### BUGGY CODE ###


import itertools

n=int(input())
a=list(map(int,input().split()))
#n=6
#a=[1,2,3,4,5,6]

if n==2:
    print(abs(a[1]-a[0]))
else:
    for i in range(n):
        if a[i]<0:
            a[i]=-a[i]
        else:
            break
    a.sort(reverse=True)
    asum=sum(a)
#    print("asum:",asum)
# itertools 使用 bit全探索
    xmin=asum
    for ip in itertools.product([0,1], repeat=n):
        xsum=sum([a[i] for i in range(len(ip)) if ip[i]==1])
#        xsum=0
#        for i in range(len(ip)):
#            if ip[i]==1:
#                xsum=xsum+a[i]
#        print("xsum:",xsum,ip)
        xmin=min(xmin,abs(asum-2*xsum)) 
    print(xmin)


### FIXED CODE ###

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

if n==2:
    print(abs(a[1]-a[0]))
else:
    asum=sum(a)
    xsum=0
    xmin=n*(10**9)+1
    for i in range(n-1):
        xsum=xsum+a[i]
        xmin=min(xmin,abs(asum-2*xsum))
    print(xmin)
### BUGGY CODE ###

import collections as cl

def get_median(arr) :
	arr.sort(reverse=True)
	
	idx = len(arr) + 1
	idx = int(idx / 2) - 1
	return arr[idx]

N = int(input())
X = [int(i) for i in input().split()]

for i in range(len(X)) :
	l = X[:]
	l.pop(i)
	print(get_median(l))

### FIXED CODE ###

N = int(input())
X = [int(i) for i in input().split()]
X2 = sorted(X)
mapper = {}

for i in range(N//2) :
    if (X2[i] in mapper) :
        continue
    mapper[X2[i]] = X2[len(X2)//2]

for i in range(N//2,N) :
    if (X2[i] in mapper) :
        continue
    mapper[X2[i]] = X2[(len(X2)//2) - 1]

for x in X :
    print(mapper[x])
### BUGGY CODE ###

n=int(input())
v=list(map(int,input().split()))
a=[0]*(10**5)
b=[0]*(10**5)
s,t=0,0
o,e,oi,ei=0,0,0,0
for i in range(1,n+1):
    if i%2==1:
        a[v[i-1]-1]+=1
        s+=1
    else:
        b[v[i-1]-1]+=1
        t+=1
o=max(a)
oi=[i for i, x in enumerate(a) if x == max(a)]
e=max(b)
ei=[i for i, x in enumerate(b) if x == max(b)]
if len(oi)==1 and s-o==t-e and len(ei)==1:
    a.sort(reverse=True)
    b.sort(reverse=True)
    print(min(t-e+s-a[1],t-a[1]+s-o))
else:
    print(s+t-e-o)


### FIXED CODE ###

n=int(input())
v=list(map(int,input().split()))
a=[0]*(10**5)
b=[0]*(10**5)
s,t=0,0
o,e,oi,ei=0,0,0,0
for i in range(1,n+1):
    if i%2==1:
        a[v[i-1]-1]+=1
        s+=1
    else:
        b[v[i-1]-1]+=1
        t+=1
o=max(a)
oi=[]
e=max(b)
ei=[]
for i in range(10**5):
    if a[i]==o:
        oi.append(i)
    if b[i]==e:
        ei.append(i)
if len(oi)==1 and len(ei)==1 and oi[0]==ei[0]:
    a.sort(reverse=True)
    b.sort(reverse=True)
    print(min(t-e+s-a[1],t-b[1]+s-o))
else:
    print(s+t-e-o)
### BUGGY CODE ###

import sys
sys.setrecursionlimit(200000)

N, M = map(int,input().split())
G = [[[],[],[]] for k in range(N)]

for k in range(M):
    u, v = map(int,input().split())
    u -= 1
    v -= 1
    G[u][0] += [v]
    G[u][1] += [v]
    G[u][2] += [v]

S, T = map(int,input().split())
S -= 1
T -= 1
D1 = [[200000,200000,200000] for k in range(N)]
D1[S][0] = 0
def dfs1(now, dist):
    for tsugi in G[now][1]:
        if D1[tsugi][1] > dist + 1:
            D1[tsugi][1] = dist + 1
            dfs2(tsugi, dist+1)
def dfs2(now, dist):
    for tsugi in G[now][2]:
        if D1[tsugi][2] > dist + 1:
            D1[tsugi][2] = dist + 1
            dfs3(tsugi, dist+1)
def dfs3(now, dist):
    for tsugi in G[now][0]:
        if D1[tsugi][0] > dist + 1:
            D1[tsugi][0] = dist + 1
            dfs1(tsugi, dist+1)

dfs1(S,0)

if D1[T][0]%3 == 0:
    print(D1[T][0]//3)
else:
    print(-1)


### FIXED CODE ###

import sys
from collections import deque
def main():
    INF = float("inf")
    input = sys.stdin.readline
    N, M = map(int,input().split())
    G = [[] for k in range(N)]
    for k in range(M):
        u, v = map(int,input().split())
        u -= 1
        v -= 1
        G[u] += [v]
    S, T = map(int,input().split())
    S -= 1
    T -= 1
    D = [[INF,INF,INF] for k in range(N)]
    D[S][0] = 0
    Q = deque([[S,0]])
    while len(Q) > 0:
        t = Q.popleft()
        ima = t[0]
        k = t[1]
        for tsugi in G[ima]:
            if D[tsugi][(k+1)%3] != INF:
                pass
            else:
                D[tsugi][(k+1)%3] = D[ima][k] + 1
                Q.append([tsugi,(k+1)%3])
    if D[T][0] == INF or D[T][0]%3 != 0:
        print(-1)
    else:
        print(D[T][0]//3)

if __name__ == '__main__':
    main()
### 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 ix
            elif self._dict[ix] == "":
                return -1
            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)) != -1 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 ###

n = int(input())

a = [x for x in input().split()]
b = []
for i in range(n):
    b.append(a[i])
    b.reverse()
    
print(*b, sep=' ')


### FIXED CODE ###

n = int(input())
a = [x for x in input().split()]
b = []

if n % 2 == 1:
    for i in reversed(range(1, n+1, 2)):
        b.append(a[i-1])
    for i in range(2, n, 2):
        b.append(a[i-1])
else:
    for i in reversed(range(2, n+1, 2)):
        b.append(a[i-1])
    for i in range(1, n, 2):
        b.append(a[i-1])
    
print(*b, sep=' ')
### BUGGY CODE ###

n=int(input())
x,y,h=[0]*n,[0]*n,[0]*n
for i in range(n):
  x[i],y[i],h[i]=map(int,input().split())

for cx in range(101):
  for cy in range(101):
    for i in range(n):
      b=h[i]+abs(x[i]-cx)+abs(y[i]-cy)
      if i==0:
        if h[i]:
          s=set()
          s.add(b)
        else:
          s={i for i in range(b+1)}
      else:
        if h[i]:
          s&=set([b])
        else:
          s&=set(range(b+1))
    if s:print(cx,cy,s.pop())

### FIXED CODE ###

import sys
n=int(input())

l=[list(map(int,input().split())) for i in range(n)]
l.sort(key=lambda x:-x[2])

for cx in range(101):
  for cy in range(101):
    for i in range(n):
      x,y,h=l[i]
      b=h+abs(x-cx)+abs(y-cy)
      if i==0:
        if h:
          s=set()
          s.add(b)
        else:
          s={i for i in range(b+1)}
      else:
        if not s:break
        if h:
          s&=set([b])
        else:
          s&=set(range(b+1))
    if s:
      print(cx,cy,s.pop())
      sys.exit()
### BUGGY CODE ###

import sys

if sys.platform in ['ios','win32','darwin']:
	sys.stdin=open('Untitled.txt')
input = sys.stdin.readline
def INT(): return int(input())
def MAP(): return [int(s) for s in input().split()]

N, M = MAP()

if N==M:
	print(1)
	sys.exit()

X = M//N+1
for i in range(X, -1, -1):
	if M % i == 0:
		print(i)
		sys.exit()
print(0)

### FIXED CODE ###

import sys

if sys.platform in ['ios','win32','darwin']:
	sys.stdin=open('Untitled.txt')
input = sys.stdin.readline
def INT(): return int(input())
def MAP(): return [int(s) for s in input().split()]

N, M = MAP()

if N==M:
	print(1)
	sys.exit()

X = M//N+1
for i in range(X, -1, -1):
	if M % i == 0:
		print(i)
		sys.exit()
print(0)
### BUGGY CODE ###

n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
ans=[]
ans_2=[]
for i in range(n):
    cnt=0
    for j in range(n):
        if a[j]<b[i]:
            cnt+=1
    ans.append(cnt)
for i in range(n):
    cnt_2=0
    for j in range(n):
        if b[i]<c[j]:
            cnt_2+=1
    ans_2.append(cnt_2)
num=0
for i in range(n):
    num+=ans[i]*ans_2[i]
print(num)


### FIXED CODE ###

import bisect
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
a.sort()
b.sort()
c.sort()
ans=0
for k in b:
    i=bisect.bisect_left(a,k)
    j=bisect.bisect_right(c,k)
    if 0<i and j!=len(c):
        ans+=i*(n-j)
print(ans)
### BUGGY CODE ###

N, K = map(int,input().split())
ball = input().split()
ball_list = sorted(list(set(ball)))
nums = len(ball_list)

if K >= nums:
  print("0")
  exit()

balls = []
for i in range(nums):
  balls.append(ball.count(ball_list[i]))

balls = sorted(balls, reverse=True)
print(N - sum(balls[:K]))

### FIXED CODE ###

N, K = map(int,input().split())
ball = input().split()
d = {}

if K >= len(set(ball)):
  print("0")
  exit()

for i in ball:
  if not i in d:
    d[i] = 1
  else:
    d[i] += 1

d_val = sorted(d.values(),reverse=True)
print(N - sum(d_val[:K]))
### BUGGY CODE ###

n = int(input())
count = [0]*n
for i in range(1,n+1):
    for x in range(1,int(n**0.5)+1):
        for y in range(1,int(n**0.5)+1):
            for z in range(1,int(n**0.5)+1):
                if x**2 + y**2 + z**2 + x*y + y*z + z*x == i:
                    count[i-1] += 1
for i in range(n):
    print(count[i])

### FIXED CODE ###

import math
n = int(input())
count = [0]*(10**7)
for i in range(1,101):
    for j in range(1,101):
        for k in range(1,101):
            count[i*i + j*j + k*k + i*j + j*k + k*i -1] += 1
for i in range(n):
    print(count[i])
### BUGGY CODE ###

k,s = map(int,input().split())
k += 1
ans = 0
for x in range(k):
  for y in range(k):
    for z in range(k):
      if x+y+z == s:
        ans += 1
print(ans)

### FIXED CODE ###

k,s = map(int,input().split())
k += 1
ans = 0
for x in range(k):
  for y in range(k):
      if 0<=s-x-y<k:
        ans += 1
print(ans)