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

x, y, z, o = [int(_) for _ in input().split()]
a = sorted([int(_) for _ in input().split()])[::-1]
b = sorted([int(_) for _ in input().split()])[::-1]
c = sorted([int(_) for _ in input().split()])[::-1]

def isBorder(p):
    l = []
    for i in range(x):
        for j in range(y):
            for k in range(z):
                if a[i]+b[j]+c[k] < p : break
                l.append(a[i]+b[j]+c[k])
    return l if len(l) >= o else []

l, r = 0, a[0]+b[0]+c[0]
while True:
    if r==l : break
    p = (l+r)//2
    q = isBorder(p)
    if q == []:
        r = p-1
    else:
        l = p+1
q.sort(reverse=True)
for i in range(o):
    print(q[i])


### FIXED CODE ###

x, y, z, k = [int(_) for _ in input().split()]
a = [int(_) for _ in input().split()]
b = [int(_) for _ in input().split()]
c = [int(_) for _ in input().split()]
ab = []
for i in range(x):
    for j in range(y):
        ab.append(a[i] + b[j])
ab.sort(reverse=True)
abc = []
for i in range(min(k, x*y)):
    for j in range(z):
        abc.append(ab[i] + c[j])
abc.sort(reverse=True)
for i in range(k):
    print(abc[i])
### BUGGY CODE ###

n,k=map(int,input().split())
*h,=map(int,input().split())

dp=[0]*n
for i in range(1,n):
      dpmin=[]
      for j in range(max(0,i-k),i):
            dpmin.append(dp[j]+abs(h[i]-h[j]))
      dp[i]=min(dpmin)
print(dp[-1])

### FIXED CODE ###

n, k = map(int, input().split())
h = list(map(int, input().split()))
a = [0] * n
a[0] = 0
for i in range(1, n):
      hi = h[i]
      a[i] = min(a[j] + abs(hi - h[j]) for j in range(max(0, i - k), i))
print(a[-1])
### BUGGY CODE ###

def countDigs(n):
	digs = 0
	while n > 0:
		digs += 1
		n = n // 10
	return digs

def digs(n):
	for i in range(int((n + 0.1) ** 0.5), int(n // 2) + 1):
		if (n % i == 0):
			print(countDigs(i))
			return
	print(countDigs(n))

digs(int(input()))

### FIXED CODE ###


def countDigs(n):
	digs = 0
	while n > 0:
		digs += 1
		n = n // 10
	return digs

# def calcUpperLimit(n):
# 	x = 1
# 	if (n <= x**2):
# 		return int(n // 2) + 1
# 	for i in range(x, 0, -1):
# 		if (n % x == 0):
# 			return n // x + 1
# 	return int(n // 2) + 1

# def digs(n):
# 	for i in range(int((n + 0.1) ** 0.5), calcUpperLimit(n)):
# 		if (n % i == 0):
# 			print(countDigs(i))
# 			return
# 	print(countDigs(n))

def digs(n):
	for i in range(int((n + 0.1) ** 0.5), 0, -1):
		if n % i == 0:
			print(countDigs(n // i))
			return

digs(int(input()))
### BUGGY CODE ###

import sys
input = sys.stdin.readline
from fractions import gcd
import math
n = int(input())
a = list(map(int, input().split()))
def lcm(a, b):
    return (a * b) // gcd(a, b)
m = 1
for x in a:
    m = lcm(m, x)
# print(m)
MOD = 1000000007
ans = 0
for x in a:
    b = m // x
    ans = (ans + b) % MOD
print(math.floor(ans))


### FIXED CODE ###

import sys
input = sys.stdin.readline
from fractions import gcd
import math
n = int(input())
a = list(map(int, input().split()))
def lcm(a, b):
    return (a * b) // gcd(a, b)
m = 1
for x in a:
    m = (m * x) // gcd(m, x)
# print(m)
MOD = 1000000007
ans = 0
for x in a:
    b = m // x
    ans = ans + b
ans = ans % MOD
print(math.floor(ans))
### BUGGY CODE ###

N, K = map(int, input().split(' '))

def absdiff(x, K):
    return abs(x - K)

def culc(N, K):
    if K == 1:
        print(0)
        return

    if N*2 == K:
        print(N)
        return

    if N%K == 0:
        print(0)
        return

    x = N
    min = x
    while min >= x:
        #print(min, x)
        min = x
        x = absdiff(x, K)

    print(min)
    return


culc(N, K)


### FIXED CODE ###

N, K = map(int, input().split(' '))

def absdiff(x, K):
    return abs(x - K)

def culc(N, K):
    if K == 1:
        print(0)
        return

    if N*2 == K:
        print(N)
        return

    if N%K == 0:
        print(0)
        return

    x = N % K
    min = x
    while min >= x:
        #print(min, x)
        min = x
        x = absdiff(x, K)
        if min == 1:
            break

    print(min)
    return


culc(N, K)
### BUGGY CODE ###

import bisect

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

a.sort()

for i in range(m):
    saidai = a.pop()
    sounyu = saidai // 2
    bisect.insort(a, sounyu)

print(sum(a))

### FIXED CODE ###

import heapq
import numpy as np

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

a.sort()
a = np.array(a)
a = -1 * a
a = list(a)
heapq.heapify(a)

for i in range(m):
    temp = heapq.heappop(a)
    temp = int(temp/2)
    heapq.heappush(a, temp)

print(-1 * sum(a))
### BUGGY CODE ###

from collections import deque

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

if N%2 == 1:
    ans_right = A.pop()
else:
    ans_right = 1

ans_left = 1

for i in range(N//2):
    right = A.pop()
    left = A.popleft()
    if right==0 or left==0:
        print(0)
        exit();
    
    ans_right = ans_right * right
    ans_left = ans_left * left


if ans_left*ans_right > 10**18:
        print(-1)
        exit();
else:
    print(ans_right*ans_left)


### FIXED CODE ###

from collections import deque

N = int(input())
A = list(map(int,input().split()))
if 0 in A:
    print(0)
    exit();

A = deque(A)

if N%2 == 1:
    ans_right = A.pop()
else:
    ans_right = 1

ans_left = 1

for i in range(N//2):
    right = A.pop()
    left = A.popleft()
    
    ans_right = ans_right * right
    ans_left = ans_left * left

    if ans_right > 10**18 or ans_left> 10**18 or ans_left*ans_right> 10**18:
        print(-1)
        exit()


else:
    print(ans_right*ans_left)
### BUGGY CODE ###

s = input()
invs = s[::-1]

MOD = 10 ** 9 + 7
 
dp = [[0]*13 for _ in range(len(s))]

if invs[0]=='?':
    for i in range(10): # 0~9までは1 10~12は0のまま
        dp[0][i] = 1
else:
    dp[0][int(invs[0])] = 1

for order in range(1,len(s)):
    for j in range(13):
        if invs[order] == '?':
            for number in range(10):
                dp[order][ (j+number * (10**order)%13 )%13  ]  += dp[order-1][j]%MOD
        else:
            number = int(invs[order])
            dp[order][(j+number * (10**order)%13 )%13 ]  += dp[order-1][j]%MOD
        dp[order][(j+number * (10**order)%13 )%13 ] %= MOD
 
print(dp[-1][5]%MOD)

### FIXED CODE ###

s = input()
invs = s[::-1]

MOD = 10 ** 9 + 7
 
dp = [[0]*13 for _ in range(len(s))]

if invs[0]=='?':
    for i in range(10): # 0~9までは1 10~12は0のまま
        dp[0][i] = 1
else:
    dp[0][int(invs[0])] = 1

mul = 10
for order in range(1,len(s)):
    for j in range(13):
        if invs[order] == '?':
            for number in range(10):
                dp[order][ (j+number * mul )%13  ]  += dp[order-1][j]%MOD
        else:
            number = int(invs[order])
            dp[order][(j+number * mul )%13 ]  += dp[order-1][j]%MOD
        dp[order][(j+number * mul )%13 ] %= MOD
    mul *= 10
    mul %= 13
print(dp[-1][5]%MOD)
### BUGGY CODE ###

n = int(input())
l = list(map(int ,input().split(" ")))
count = 0
while True:
	for i in range(n):
		if l[i]%2 == 0:
			l[i] = l[i]//2
		else:
			print(count)
			break
	count += 1

### FIXED CODE ###

n = int(input())
l=list(map(int,input().split()))
count=0
while True:
    for i in range(n):
        if l[i]%2==0:
            l[i]=l[i]//2
        else:
            print(count)
            exit()
    count+=1
### BUGGY CODE ###

h, n = map(int, input().split())
inf = 10**11

# dp[i]: 体力iを減らす魔力の最小値
dp = [inf] * 20000
dp[0] = 0

for _ in range(n):
    a, b = map(int, input().split())
    for j in range(h):
        dp[j+a] = min(dp[j] + b, dp[j+a])

print(min(dp[h:]))

### FIXED CODE ###

h, n = map(int, input().split())
inf = 10**11

# dp[i]: 体力iを減らす魔力の最小値
dp = [inf] * 20000
dp[0] = 0

for _ in range(n):
    a, b = map(int, input().split())
    for j in range(h):
        dp[j+a] = min(dp[j] + b, dp[j+a])

print(min(dp[h:]))
### BUGGY CODE ###

N, K = list(map(int, input().split()))
p_list = list(map(int, input().split()))

number_list = []

for p in p_list:
    number_list.append((p * (p + 1)) / 2 / p)

sum_max = 0
for i in range(0, len(number_list)):
    sum_total = sum(number_list[i:i+K])
    if sum_max < sum_total:
        sum_max = sum_total

print('{:.12f}'.format(float(sum_max)))

### FIXED CODE ###

N, K = list(map(int, input().split()))
p_list = list(map(int, input().split()))

number_list = []

sum_max = 0
tmp_max = 0
past_max = 0
tmp_max_list = []
for index, p in enumerate(p_list):
    if index >= K:
        tmp_max += (p * (p + 1)) / 2 / p
        tmp_max -= tmp_max_list[index - K]
        if sum_max < tmp_max:
            sum_max = tmp_max
        tmp_max_list.append((p * (p + 1)) / 2 / p)
    else:
        tmp_max += (p * (p + 1)) / 2 / p
        tmp_max_list.append((p * (p + 1)) / 2 / p)

if N == 1:
    print('{:.12f}'.format(float(p_list[0] * (p_list[0] + 1) / 2 / p_list[0])))
elif N == K:
    print('{:.12f}'.format(float(sum(tmp_max_list))))
else:
    print('{:.12f}'.format(float(sum_max)))
### BUGGY CODE ###

N = int(input())
A = [int(x) for x in input().split()]
count = [0]*(N+1)
for i in range(N):
    count[A[i]] += 1

for k in range(N):
    count[A[k]] -= 1
    print(int(sum([x*(x-1)/2 for x in count])))
    count[A[k]] += 1

### FIXED CODE ###

N = int(input())
A = [int(x) for x in input().split()]
count = [0]*(N+1)
for i in range(N):
    count[A[i]] += 1

s = sum([x*(x-1)/2 for x in count])

for k in range(N):
    print(int(s-count[A[k]]+1))
### BUGGY CODE ###

import numpy as np

def main():
    n = int(input())
    a = np.array(list(map(int,input().split())))

    [print(np.count_nonzero(a==i)) for i in range(1,n+1)]

main()

### FIXED CODE ###

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

for i in a:
    al[i-1] += 1
for i in range(n):
    print(al[i])
### BUGGY CODE ###

from collections import deque

def isPa(w,k,p):
    counter = 0
    s = 0
    n = 1
    wlen = len(w)
    while(True):
        if( sum(w[s:s+n]) >= p):
            s = s+n-1
            n = 1
            counter += 1
        else:
            n += 1
            if( s+n == wlen):
                counter += 1
                break
    if(counter > k):
        return False
    else:
        return True
    
def MaxInP(w,k,p):
    maxinp = 0
    s = 0
    n = 1
    xxx = 0
    wlen = len(w)
    while(True):
        if( sum(w[s:s+n]) >= p):
            if( sum(w[s:s+n-1]) > maxinp):
                maxinp = sum(w[s:s+n-1])
            s = s+n-1
            n = 1
        else:
            n += 1
            if( s+n == wlen):
                if( sum(w[s:s+n]) > maxinp):
                    maxinp = sum(w[s:s+n])
                break
    return maxinp

n,k = [int(x) for x in input().split()]
w = []
for i in range(n):
    w.append(int(input()))
    
mean = int(sum(w)/k)
maxinp = MaxInP(w,k,mean)
l = range(mean,maxinp)

if k == 1:
    print(mean)
else:
    minP = mean
    maxP = maxinp
    while(True):
        m = int ((minP + maxP)/2)
        if ( isPa(w,k,m) ):
            maxP = m
        else:
            minP = m
        if (minP+1 == maxP):
            print(maxP)
            break

### FIXED CODE ###

from collections import deque

def isPa(w,k,p):
    tr = 0
    c = 0
    d = deque(w)
    while(d):
        tmp = d.popleft()
        if(tmp > p):
            return False
        
        if( tr + tmp > p):
            tr = tmp
            c += 1
        else:
            tr += tmp
        if c+1>k:
            return False
    return True

def MaxInP(w,k,p):
    maxinp = 0
    tmp = 0
    d = deque(w)
    while(d):
        tmp += d.popleft();
        if(tmp > p):
            if(tmp > maxinp):
                maxinp = tmp
            tmp = 0
    return maxinp

n,k = [int(x) for x in input().split()]
w = deque()
for i in range(n):
    w.append(int(input()))
    
mean = int(sum(w)/k)
maxinp = MaxInP(w,k,mean)

if k == 1:
    print(mean)
else:
    minP = mean
    maxP = maxinp
    while(True):
        m = int ((minP + maxP)/2)
        if ( isPa(w,k,m) ):
            maxP = m
        else:
            minP = m
        if (minP+1 == maxP or minP == maxP):
            print(maxP)
            break
### BUGGY CODE ###

import sys,collections

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  h,w=LI()
  field=[list(S()) for _ in range(h)]

  ans=0
  visited=[[-1 for __ in range(w)] for _ in range(h)]
  q=collections.deque()
  for i in range(h):
    for j in range(w):
      if field[i][j]=='#':
        continue
      q.append((i,j,0))
      for _i in range(h):
        for _j in range(w):
          visited[_i][_j]=-1
      while len(q)>0:
        y,x,c=q.popleft()
        visited[y][x]=c

        for dy,dx in ((-1,0),(0,1),(1,0),(0,-1)):
          ny=y+dy
          nx=x+dx
          if 0<=ny<h and 0<=nx<w:
            if field[ny][nx]=='#':
              continue
            if visited[ny][nx]!=-1:
              continue
            q.append((ny,nx,c+1))
      ans=max(ans,c)
  return ans

# main()
print(main())


### FIXED CODE ###

import sys,collections

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  h,w=LI()
  field=[S() for _ in range(h)]

  ans=0
  visited=[[-1 for __ in range(w)] for _ in range(h)]
  q=collections.deque()
  for i in range(h):
    for j in range(w):
      if field[i][j]=='#':
        continue
      q.append((i,j))
      for _i in range(h):
        for _j in range(w):
          visited[_i][_j]=-1
      visited[i][j]=0
      _ans=0
      while q:
        y,x=q.popleft()

        for dy,dx in ((-1,0),(0,1),(1,0),(0,-1)):
          ny=y+dy
          nx=x+dx
          if not 0<=ny<h:
            continue
          if not 0<=nx<w:
            continue
          if field[ny][nx]=='#':
            continue
          if visited[ny][nx]!=-1:
            continue
          _ans=visited[y][x]+1
          visited[ny][nx]=_ans
          q.append((ny,nx))
      ans=max(ans,_ans)
  return ans

# main()
print(main())
### BUGGY CODE ###

n, k = map(int , input().split())
hn = [int(num) for num in input().split()]

hn.sort(reverse = True)
for i in range(k):
  if len(hn) > 0:
    hn = hn[1:]
    
print(sum(hn))

### FIXED CODE ###

n, k = map(int , input().split())
hn = [int(num) for num in input().split()]

hn.sort(reverse = True)
if len(hn) > k:
  print(sum(hn[k:]))
else :
  print(0)
### BUGGY CODE ###

import copy

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

c=0
a_uniq=list(set(a))

for i in a_uniq:
  c+=sum(range(1, a.count(i)))

for i in range(0,n):
  print('{:.0f}'.format(c-a.count(a[i])+1))


### FIXED CODE ###

import copy

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

c=0

a_uniq=[0]*(n+1)

for i in a:
  a_uniq[i]+=1

for i in a_uniq:
  c+=sum(range(1,i))
#a_uniq=list(set(a))
#for i in a_uniq:
#  c+=sum(range(1, a.count(i)))

for i in a:
  print('{:.0f}'.format(c-a_uniq[i]+1))
### BUGGY CODE ###

n = int(input())
a = []
for _ in range(n):
    a.append(int(input()))

for i in range(n):
    if i !=  n - 1:
        print(max(a[:i] + a[i + 1:]))
    else:
        print(max(a[:i]))

### FIXED CODE ###

n = int(input())
a = []
for _ in range(n):
    a.append(int(input()))

b = sorted(a)
max_ind = a.index(b[n - 1])

for i in range(n):
    if i == max_ind:
        print(b[n - 2])
    else:
        print(b[n - 1])
### BUGGY CODE ###

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines



def main():
    H, W = map(int, readline().split())
    g = []
    for _ in range(H):
        s = readline().rstrip().decode()
        g.append(s)

    def rowBeam(si, sj):
        cnt1 = 0
        cnt2 = 0
        for dj in range(W):
            x = sj+dj
            if x>=W:
                break
            if g[si][x] == '#':
                break
            cnt1 += 1
        for dj in range(W):
            x = sj-dj
            if x<0:
                break
            if g[si][x] == '#':
                break
            cnt2 += 1
        return cnt1+cnt2-1


    def clumnBeam(si, sj):
        cnt1 = 0
        cnt2 = 0
        for di in range(H):
            x = si+di
            if x>=H:
                break
            if g[x][sj] == '#':
                break
            cnt1 += 1
        for di in range(H):
            x = si-di
            if x<0:
                break
            if g[x][sj] == '#':
                break
            cnt2 += 1
        return cnt1+cnt2-1

    ans = 0
    for si in range(H):
        for sj in range(W):
            if g[si][sj] == '#':
                continue
            tmp = rowBeam(si, sj) + clumnBeam(si, sj)
            ans = max(ans, tmp)
    print(ans-1)
if __name__ == '__main__':
    main()

### FIXED CODE ###

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np 
import itertools as it
def main():
    H, W = map(int, readline().split())
    G = np.zeros((H+2, W+2), np.int16)
    G[1:-1, 1:] = (np.frombuffer(read(H*(W+1)), dtype='B') == ord('.')).reshape((H, W+1))
    def solve(G):
        left = np.zeros(G.shape, np.int16)
        for i in range(G.shape[0]):
            left[i, ] = np.arange(G.shape[1])
        left[G>0] = 0
        np.maximum.accumulate(left, out=left, axis=1)

        rG = G[..., ::-1]
        right = np.zeros(G.shape, np.int16)
        for i in range(G.shape[0]): 
            right[i, ] = np.arange(G.shape[1])
        right[rG>0] = 0
        np.maximum.accumulate(right, out=right, axis=1)

        right = G.shape[1] - right[..., ::-1]-1
        scoreres = (right-left-1) 
        scoreres[G==0] = 0
        return scoreres

    print((solve(G)+solve(G.T).T-1).max())
if __name__ == '__main__':
    main()
### BUGGY CODE ###

import sys
sys.setrecursionlimit(1000000)
def input():
    return sys.stdin.readline()
n = int(input())
e = [[] for _ in range(n)]
for _ in range(n-1):
    a, b = [int(i) - 1 for i in input().split()]
    e[a].append(b)
    e[b].append(a)

mod = 10**9+7

kkai = [1]
for i in range(1, 2*10 ** 5):
    kkai.append(kkai[-1] * i % mod)


def kai(x, p=mod):
    return kkai[x]


def comb(a, b, p=mod):
    if a < 0 or b < 0:
        return 0
    elif a < b:
        return 0
    if b == 0:
        return 1
    c = 1
    c *= kai(a, p)
    c *= pow(kai(b, p), p - 2, p)
    c *= pow(kai(a - b, p), p - 2, p)
    return c % p


child = [0] * n


def dfs1(i=0, r=-1):
    s = 1
    for j in e[i]:
        if j == r:
            continue
        s += dfs1(j, i)
    child[i] = s
    return s


dfs1()

a = [0] * n


def dfs2(i=0, r=-1):
    s = 1
    t = 0
    for j in e[i]:
        if j == r:
            continue
        t += child[j]
        s *= dfs2(j, i)
        s %= mod
        s *= comb(t, child[j])
        s %= mod
    a[i] = s
    return s


dfs2()

b = [0] * n


def dfs3(i=0, r=-1):
    if r == -1:
        b[i] = a[i]
    else:
        s = b[r] * comb(n-1, child[i]-1) % mod
        re = comb(n-1, child[i])
        s *= pow(re, mod - 2, mod)
        s %= mod
        b[i] = s

    for j in e[i]:
        if j == r:
            continue
        dfs3(j, i)


dfs3()

print("\n".join(map(str, b)))


### FIXED CODE ###

import sys
sys.setrecursionlimit(1000000)


def input():
    return sys.stdin.readline()


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

mod = 10**9+7

kkai = [1]
for i in range(1, 2*10 ** 5):
    kkai.append(kkai[-1] * i % mod)


def kai(x, p=mod):
    return kkai[x]


def comb(a, b, p=mod):
    if a < 0 or b < 0:
        return 0
    elif a < b:
        return 0
    if b == 0:
        return 1
    c = 1
    c *= kai(a, p)
    c *= pow(kai(b, p), p - 2, p)
    c *= pow(kai(a - b, p), p - 2, p)
    return c % p


child = [0] * n


def dfs1(i=0, r=-1):
    s = 1
    for j in e[i]:
        if j == r:
            continue
        s += dfs1(j, i)
    child[i] = s
    return s


dfs1()
a = [0] * n


def dfs2(i=0, r=-1):
    s = kai(child[i]-1)
    t = 1
    for j in e[i]:
        if j == r:
            continue
        s *= dfs2(j, i)
        s %= mod
        t *= kai(child[j])
        t %= mod
    s *= pow(t, mod - 2, mod)
    s %= mod
    a[i] = s
    return s


dfs2()
b = [0] * n


def dfs3(i=0, r=-1):
    if r == -1:
        b[i] = a[i]
    else:
        s = b[r] * child[i] % mod
        s *= pow(n-child[i], mod - 2, mod)
        s %= mod
        b[i] = s

    for j in e[i]:
        if j == r:
            continue
        dfs3(j, i)


dfs3()
print("\n".join(map(str, b)))
### BUGGY CODE ###

# coding: utf-8

n, k = map(int, input().split())
min = n

while(1):
    n = abs(n-k)
    if n >= min:
        break
    else:
        min = n

print(min)

### FIXED CODE ###

# coding: utf-8

n, k = map(int, input().split())
t = n % k
if t > k-t:
    print(k-t)
else:
    print(t)
### BUGGY CODE ###

n,m = map(int,input().split())
if m%n==0:
    print(int(m//n))
    exit()
else:
  a = m//n
  l = []
  for i in range(1,a+1):
    if m%i==0:
      l.append(i)
  l = sorted(l)[::-1]
  for i in l:
    s = m-n*i
    if s%i==0:
      print(i)
      exit()
print(1)

### FIXED CODE ###

n,m = map(int,input().split())
if m%n==0:
    print(int(m//n))
    exit()
else:
  a = m/n
  l = []
  for i in range(int(m**0.5),0,-1):
    if m%i==0:
      l.append(i)
      l.append(m//i)
  l = sorted(l)[::-1]
  for j  in l:
    if j<=a:
      print(j)
      exit()
  else:
    print(1)
### BUGGY CODE ###

n,a,b = (int(x) for x in input().split())
mod = 10**9+7

def minus(n,k):
    x,y =1,1
    for i in range(k):
        x*=(n-i)%mod
        y*=(k-i)%mod
    return x*pow(y, mod-2, mod)%mod

ans = pow(2,n,mod)-1-minus(n,a)-minus(n,b)
while ans<0:
    ans+=mod
print(ans)


### FIXED CODE ###

n,a,b = map(int, input().split())
mod = 10**9+7

def minus(n,k):
    x,y =1,1
    for i in range(k):
        x=x*(n-i)%mod
        y=y*(k-i)%mod
    return x*pow(y, mod-2, mod)%mod

ans = pow(2,n,mod)-1-minus(n,a)-minus(n,b)
while ans<0:
    ans+=mod
print(ans)
### BUGGY CODE ###

import numpy as np
N=int(input())
A=list(map(int,input().split()))
# cnt=[0]*(10**6+1)
cnt=np.zeros(10**6+1, dtype=np.int32)
for a in A:cnt[a]+=1
 
if np.gcd.reduce(A)!=1:
  print("not coprime")
elif np.all([sum(cnt[i::i])<=1 for i in range(2,10**6+1)]):
  print("pairwise coprime")
else:
  print("setwise coprime")

### FIXED CODE ###

from math import gcd
def prime_table(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]

N = int(input())
A = list(map(int,input().split()))
g = A[0]
for i in range(1,N):
    g = gcd(g,A[i])
    if g == 1:
        break
if g != 1:
    print('not coprime')
else:
    PT = prime_table(10**6+1)
    l = len(PT)
    flag = set()
    for j in range(N):
        n = A[j]
        for i in range(l):
            p = PT[i]
            if n % p == 0:
                while n % p == 0:
                    n //= p
                if p in flag:
                    print('setwise coprime')
                    exit()
                else:
                    flag.add(p)
            if p*p > n:
                if n in flag and n != 1:
                    print('setwise coprime')
                    exit()
                else:
                    if n != 1:
                        flag.add(n)
                break
    print('pairwise coprime')