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

x,y,z,k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort(reverse = True)
b.sort(reverse = True)
c.sort(reverse = True)

li = []

for i in range(x):
    for j in range(y):
        li.append(a[i] + b[j])
        
li.sort(reverse = True)
li = li[:min(k,x*y)]

box = []

for i in range(len(li)):
    for j in range(z):
        box.append(li[i] + c[j])

box.sort(reverse = True)
box = box[:k]

for i in range(k):
    print(box[i])

### FIXED CODE ###

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

aI, aO, _, aJ, aL, _, _ = map(int,input().split())

"""
aO -> +1
aI, aJ, aL -> +3
aI * 2 -> +2
aJ * 2 -> +2
aL * 2 -> +2
"""

ansK = aO
for IJL in range(min(aI,aJ,aL) + 1):
    K = aO
    K += IJL * 3
    K += ((aI - IJL) // 2) * 2
    K += ((aJ - IJL) // 2) * 2
    K += ((aL - IJL) // 2) * 2
    ansK = max(ansK, K)

print(ansK)

### FIXED CODE ###

aI, aO, _, aJ, aL, _, _ = map(int,input().split())

"""
aO -> +1
aI, aJ, aL -> +3
aI * 2 -> +2
aJ * 2 -> +2
aL * 2 -> +2

aI, aJ, aLを2個作ると、
aI * 2, aJ * 2, aL * 2に分解できる
"""

# aI, aJ, aLを0個作る
ans0 = aO + (aI // 2 + aJ // 2 + aL // 2) * 2
# aI, aJ, aLを1個作る
if min(aI, aJ, aL) > 0:
    ans1 = aO + 3 + ((aI-1) // 2 + (aJ-1) // 2 + (aL-1) // 2) * 2
else:
    ans1 = 0
print(max(ans0, ans1))
### BUGGY CODE ###

def f(a, b):
    return max(len(str(int(x))) for x in (a, b)) 

n = int(input())

min_num = len(str(n))
for a in range(1, n//2):
    b = (n/a)
    if b % 1 == 0:
        min_num = min(min_num, f(a, b))
print(min_num)

### FIXED CODE ###

n = int(input())

center = int(n**(1/2))

for i in range(center+1):
    if n % (center - i) == 0:
        print(len(str(n // (center - i))))
        exit()
### BUGGY CODE ###

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

ans = B
for i in range(A,B):
    ans = ans ^ i

print(ans)



### FIXED CODE ###

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

ans = A

for i in range(A + 1, 4 * (1 + A // 4)):
    ans = ans ^ i

for i in range(4 * (B // 4), B + 1):
    ans = ans ^ i

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

# -*- coding: utf-8 -*-
"""
Created on Sun Apr 19 21:27:49 2020

@author: arute
"""


from sys import stdin

import time
import numpy as np
import math



def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

############################################

# read data for n sequences.
temp = stdin.readline().split()
N = int(temp[0])
M = int(temp[1])

# すべての場合の数を計算。
probs = 0

for m in range(M,N+2):
    # 作れる最小は？
    small = sum(range(m))
    #
    large = sum(range(N+1-m,N+1))
    
    probs += large - small + 1
# 重複を計算し除去

print(probs)

### FIXED CODE ###

# -*- coding: utf-8 -*-
"""
Created on Sun Apr 19 21:27:49 2020

@author: arute
"""


from sys import stdin

import time
import numpy as np
import math



def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

############################################

# read data for n sequences.
temp = stdin.readline().split()
N = int(temp[0])
M = int(temp[1])

# すべての場合の数を計算。
probs = np.zeros(1).astype("int64")

for i,m in enumerate(range(M,N+2)):
    # 作れる最小は？
    if i == 0:
        small = np.sum(np.arange(m))
        #
        large = np.sum(np.arange(N+1-m,N+1))
    else:
        small = (small+m-1).astype("int64")
        large = (large + (N+1-m)).astype("int64")
    probs = probs + (large - small + 1)

print(int(probs%(1e9+7)))
### BUGGY CODE ###

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import dijkstra

n, m = map(int, readline().split())
graph = [[0] * n for _ in range(n)]
ab = [list(map(int, readline().split())) for _ in range(m)]
for a, b in ab:
    graph[a - 1][b - 1] = 1
    graph[b - 1][a - 1] = 1
ans = dijkstra(csr_matrix(graph), return_predecessors=True)
if any(int(v) == -9999 for v in ans[1][0][1:]):
    print('No')
else:
    print('Yes')
    print('\n'.join(map(str, ans[1][0][1:] + 1)))


### FIXED CODE ###

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)


def bfs(s):
    from collections import deque
    check = [-1] * (n + 1)
    check[s] = 0
    q = deque([s])
    while q:
        now = q.popleft()
        for next in graph[now]:
            if check[next] == -1:
                check[next] = now
                q.append(next)
    return check


n, m = map(int, readline().split())
graph = [[] for _ in range(n + 1)]
for i in range(m):
    a, b = map(int, readline().split())
    graph[a].append(b)
    graph[b].append(a)
print('Yes')
for v in bfs(1)[2:]:
    print(v)
### BUGGY CODE ###

s = input()
l = len(s)
r = 0
m = []
for i in range(3,l):
    num = int(s[i])
    m = [(x*10+num) % 2019 for x in m]
    m.append(int(s[i-3:i+1])%2019)
    r += m.count(0)
print(r)

### FIXED CODE ###

s = input()
s_r = s[::-1]
lmod = [0]
cmod = 0
for n,i in enumerate(s_r):
    cmod += int(i)*pow(10,n,2019) % 2019
    cmod = cmod % 2019
    lmod.append(cmod)

from collections import Counter
r = 0
for _,i in Counter(lmod).items():
    r += i*(i-1)/2

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

N = int(input())

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

def check_triangle(a, b, c):
    if a < b + c and b < c + a and c < a + b:
        return True
    return False

sum = 0 
L.sort()
for i, l_1 in enumerate(L[:-2]):
    for j, l_2 in enumerate(L[i+1:-1]):
        for l_3 in L[i + j + 2:]:
            if check_triangle(l_1, l_2, l_3):
                sum += 1
            else:
                break

print(sum)


### FIXED CODE ###

N = int(input())

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

count = 0 
L.sort()

for i in range(N-2):
    k = i + 2
    for j in range(i+1,N):
        while (k<N and L[i] + L[j] > L[k]):
            k += 1

        if k > j:
            count += k - j - 1


print(count)
### BUGGY CODE ###

def main():
    n = int(input())
    a = [input() for _ in range(n)]
    ans = 0
    for i in range(n):
        a[i] += a[i][:-1]
    for j in range(n):
        f = True
        for i in range(n):
            for k in range(n):
                if a[0+i][j+k] != a[0+k][j+i]:
                    f = False
                    break
            if not f:
                break
        if f:
            ans += n
    print(ans)

if __name__ == "__main__":
    main()

### FIXED CODE ###

def main():
    n = int(input())
    a = [input() for _ in range(n)]
    ans = 0
    for j in range(n):
        f = True
        for i in range(n-1):
            for k in range(i+1, n):
                if a[(0+i)%n][(j+k)%n] != a[(0+k)%n][(j+i)%n]:
                    f = False
                    break
            if not f:
                break
        if f:
            ans += n
    print(ans)

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

N, M = map(int, input().split())
A = list(map(int, input().split()))
B_C = [list(map(int, input().split())) for j in range(M)]

B_C = sorted(B_C, key=lambda x:x[1], reverse=True)

B = [B_C[j][0] for j in range(M)]
C = [B_C[j][1] for j in range(M)]

D = []
for j in range(M):
    D += [C[j] for k in range(B[j])]

A.sort()

for i in range(N):
    if A[i] < D[i]:
        A[i] = D[i]
    else:
        break
    if i == len(D) - 1:
        break

print(sum(A))

### FIXED CODE ###

N, M = map(int, input().split())
A = list(map(int, input().split()))
B_C = [list(map(int, input().split())) for j in range(M)]

B_C = sorted(B_C, key=lambda x:x[1], reverse=True)

B = [B_C[j][0] for j in range(M)]
C = [B_C[j][1] for j in range(M)]

D = []
for j in range(M):
    D += [C[j]] * B[j]
    if len(D) >= N:
        break

A.sort()

for i in range(N):
    if A[i] < D[i]:
        A[i] = D[i]
    else:
        break
    if i == len(D) - 1:
        break

print(sum(A))
### BUGGY CODE ###

S = input()
T = input()

for i in range(len(S)):
    if S[i] != T[i]:
        S = S.translate(str.maketrans(S[i] + T[i], T[i] + S[i], ''))

if S == T:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

import collections

S = input()
T = input()

cs = collections.Counter(S)
ct = collections.Counter(T)

if sorted(ct.values()) == sorted(cs.values()):
  print('Yes')
else:
  print('No')
### BUGGY CODE ###

def main():
    from sys import stdin
    input = stdin.readline
    k, q = map(int, input().split())
    d = list(map(int, input().split()))
    nxm = [list(map(int, input().split())) for _ in [0]*q]
    for n, x, m in nxm:
        d2 = sum([(i-1) % m+1 for i in d[:(n-2) % k+1]])
        d3 = sum([(i-1) % m+1 for i in d[(n-2) % k+1:]])
        print(n-1-(x % m+(d2+d3)*((n-2)//k)+d2)//m)


main()


### FIXED CODE ###

def main():
    k, q = map(int, input().split())
    d = list(map(int, input().split()))
    nxm = [list(map(int, input().split())) for _ in [0]*q]
    for n, x, m in nxm:
        d2 = sum([(i-1) % m+1 for i in d[:(n-2) % k+1]])
        d3 = sum([(i-1) % m+1 for i in d[(n-2) % k+1:]])
        print(n-1-(x % m+(d2+d3)*((n-2)//k)+d2)//m)


main()
### BUGGY CODE ###

n = int(input())
a = map(int,input().split())
ans = 1
for i in a:
    ans = ans*i
if ans <= 10 ** 18:
    print(ans)
else:
    print(-1)

### FIXED CODE ###

n = int(input())
a = map(int,input().split())
ans = 1
for i in sorted(a):
    ans = ans*i
    if ans == 0:
        print(0)
        exit()
    elif ans > 10 ** 18:
        print(-1)
        exit()
print(ans)
### BUGGY CODE ###

n = int(input())
s = [input() for i in range(n)]

a = set(s)
b = list(a)
c = sorted(b)
d = 0
e = []

for j in range(len(c)):
    f = 0
    for k in range(n):
        if c[j]==s[k]:
            f += 1
    if f > d:
        d = f 
        e = [c[j]]
    elif f == d:
        e.append(c[j])

for l in range(len(e)):
    print(e[l])

            
    

### FIXED CODE ###

n = int(input())
s = [input() for i in range(n)]

a = {}

for j in range(n):
    if not(s[j] in a):
        a[s[j]] = 1
    else:
        a[s[j]] += 1

b = 0
for num in a.values():
  if num > b:
    b = num

c = []
for name,num in a.items():
  if num==b:
    c.append(name)

d=sorted(c)

for k in d:
    print(k)
### BUGGY CODE ###

# -*- coding: utf-8 -*-
n, q = map(int,input().split())
s = list(str(input()))
lr = []
for i in range(q):
    lr.append([int(i) for i in input().split()])

for i in range(q):
    ans = 0
    for j in range(lr[i][0], lr[i][1]):
        #print(lr[i][0], lr[i][1])
        #print(j)
        #print(s[j - 1], s[j])
        if s[j - 1] == 'A' and s[j] == 'C':
            ans += 1
    print(ans)
    ans = 0


### FIXED CODE ###

# -*- coding: utf-8 -*-
n, q = map(int,input().split())
s = input()

tmp = [0 for _ in range(n)]
for i in range(1, n):
    if s[i-1] == 'A' and s[i] == 'C':
        tmp[i] = 1 + tmp[i-1]
    else:
        tmp[i] = tmp[i-1]
#print(tmp)

for i in range(q):
    l, r = map(int,input().split())
    print(tmp[r-1] - tmp[l-1])
### BUGGY CODE ###

INF = 10 ** 12

N = int(input())
a = [list(map(int, input().split())) for _ in range(N)]

for i in range(N):
    for j in range(N):
        for k in range(N):
            if a[i][j] > a[i][k] + a[k][j]:
                print(-1)
                exit()

res = 0
for i in range(N):
    for j in range(i + 1, N):
        for k in range(N):
            if i != k and j != k and a[i][j] == a[i][k] + a[k][j]:
                break
        else:
            res += a[i][j]

print(res)


### FIXED CODE ###

INF = 10 ** 12

N = int(input())
a = [list(map(int, input().split())) for _ in range(N)]

for i in range(N):
    for j in range(N):
        for k in range(N):
            if a[i][j] > a[i][k] + a[k][j]:
                print(-1)
                exit()

res = 0
for i in range(N):
    for j in range(i + 1, N):
        for k in range(N):
            if i != k and j != k and a[i][j] == a[i][k] + a[k][j]:
                break
        else:
            res += a[i][j]

print(res)
### BUGGY CODE ###

# https://atcoder.jp/contests/abc115/tasks/abc115_c
# C - Christmas Eve
import itertools

n, k = list(map(int, input().split()))
h_list = []

for _ in range(n):
    h_list.append(int(input().split()[0]))

# 全探索で頑張る方法
# 多分時間が足りない
p_list = itertools.combinations(h_list, k)
min_value = float('inf')

for p in p_list:
    p = list(p)
    v = max(p) - min(p)
    if v < min_value:
        min_value = v

print(min_value)


### FIXED CODE ###

# https://atcoder.jp/contests/abc115/tasks/abc115_c
# C - Christmas Eve
import itertools

n, k = list(map(int, input().split()))
h_list = []

for _ in range(n):
    h_list.append(int(input().split()[0]))

h_list = sorted(h_list)

min_value = float('inf')

for i, v in enumerate(h_list[:-k+1]):
    diff_h = h_list[i+k-1] - v
    if diff_h < min_value:
        min_value = diff_h

print(min_value)
### BUGGY CODE ###

import sys
sys.setrecursionlimit(100000)

n = int(input())
a = [[] for i in range(n)]

a = [int(i) for i in input().split()]
b = [0]*(n+1)

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

nCr = {}
def cmb(n, r):
    if r == 0 or r == n: return 1
    if r == 1: return n
    if (n,r) in nCr: return nCr[(n,r)]
    nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
    return nCr[(n,r)]

def ans(N):
    if N >= 2:
        return(cmb(N,2))
    else: return(0)

cnt=0
for j in b: cnt += ans(j)
for i in a:
    temp = cnt
    temp = temp - (ans(b[i])- ans(b[i]-1))
    print(temp)


### FIXED CODE ###

from operator import mul
from functools import reduce

n = int(input())
a = [[] for i in range(n)]

a = [int(i) for i in input().split()]
b = [0]*(n+1)

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

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

def ans(N):
    if N >= 2:
        return(cmb(N,2))
    else: return(0)

cnt=0
for j in b: cnt += ans(j)
for i in a:
    temp = cnt
    temp = temp - (ans(b[i])- ans(b[i]-1))
    print(temp)
### BUGGY CODE ###

N, *A = map(int, open(0).read().split())
A = [0] + A + [0]
diff = [abs(A[i + 1] - A[i]) for i in range(N + 1)]
for i in range(N):
  print(sum(diff) + abs(A[i + 2] - A[i + 0]) -  (diff[i] + diff[i + 1]))

### FIXED CODE ###

N, *A = map(int, open(0).read().split())
A = [0] + A + [0]
diff = [abs(A[i + 1] - A[i]) for i in range(N + 1)]
diff_i = [abs(A[i + 2] - A[i]) for i in range(N)]
a = sum(diff)
for i in range(N):
  print(a + diff_i[i] -  (diff[i] + diff[i + 1]))
### BUGGY CODE ###

N = int(input())
A = [int(i) for i in input().split()]
AS = sorted(list(set(A)))

def f(x):
    B = [((x<=a)<<1)-1 for a in A]
    C = [N]
    [C.append(C[-1]+b) for b in B]

    r = 0
    Bit = [0] * (2*N+1)

    for i,c in enumerate(C):
        t=c-1
        while(t>0):
            r += Bit[t]
            t -= t&-t
        t=c-1
        while(t<=2*N+1):
            Bit[t] += 1
            t += t&-t
    return(r>=N*(N+1)//4)

l = 0
r = len(AS)-1
while l != r:
    if f(AS[(l+r+1)//2]):
        l = (l+r+1)//2
    else:
        r = (((l+r+1)//2)-1)
print(AS[r])


### FIXED CODE ###

N = int(input())
A = [int(i) for i in input().split()]
AS = sorted(list(set(A)))

def f(x):
    B = [((x<=a)<<1)-1 for a in A]
    C = [N]
    [C.append(C[-1]+b) for b in B]

    r = 0
    Bit = [0] * (2*N+1)

    for i,c in enumerate(C):
        t=c-1
        while(t>0):
            r += Bit[t]
            t -= t&-t
        t=c-1
        while(t<=2*N+1):
            Bit[t] += 1
            t += t&-t
    return(r>=N*(N+1)//4)

l = 0
r = len(AS)-1
while l != r:
    if f(AS[(l+r+1)//2]):
        l = (l+r+1)//2
    else:
        r = (((l+r+1)//2)-1)
print(AS[r])
### BUGGY CODE ###

N, M ,Q = map(int, input().split())
train = [list(map(int, input().split())) for i in range(M)]
qs = [list(map(int, input().split())) for i in range(Q)]
ns = []
for i in range(N+1):
    ns.append([0]*(N+1))
for l, r in train:
    for i in range(r, N+1):
        ns[l][i] += 1
for p, q in qs:
    ans = 0
    for i in range(p, q+1):
        ans += ns[i][q]
    print(ans)



### FIXED CODE ###

N, M ,Q = map(int, input().split())
train = [list(map(int, input().split())) for i in range(M)]
qs = [list(map(int, input().split())) for i in range(Q)]
ns = []
for i in range(N+1):
    ns.append([0]*(N+1))
for l, r in train:
    for i in range(r, N+1):
        ns[l][i] += 1
for p, q in qs:
    ans = 0
    for i in range(p, q+1):
        ans += ns[i][q]
    print(ans)
### BUGGY CODE ###

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

n = int(input())
s = input()
c = Counter(s)
cnt = c['R'] * c['G'] * c['B']

for i in range(n-2):
    for j in range(i+1, n-1):
        if s[i] == s[j]:
            continue
        w = j - i
        if j+w < n and (s[j+w] != s[j] and s[j+w] != s[i]):
            cnt -= 1

print(cnt)


### FIXED CODE ###

from collections import Counter

n = int(input())
s = input()
c = Counter(s)
cnt = c['R'] * c['G'] * c['B']

for i in range(n-2):
    for j in range(i+1, n-1):
        w = j - i
        if j+w >= n:
            continue
        if s[i] != s[j] and s[j+w] != s[j] and s[j+w] != s[i]:
            cnt -= 1

print(cnt)
### BUGGY CODE ###

from collections import deque

# 入力
N, M = map(int, input().split())
A, B = zip(*(map(int, input().split()) for _ in range(N - 1 + M)))

# 各頂点の深さを求め、深さを利用して元の木を復元する
G = [set() for _ in range(N + 1)]
for a, b in zip(A, B):
    G[a].add(b)
G_inv = [set() for _ in range(N + 1)]
for a, b in zip(A, B):
    G_inv[b].add(a)

r = next(i for i in range(1, N + 1) if not G_inv[i])

dp = [0 for _ in range(N + 1)]
q = deque([r])
while q:
    i = q.popleft()
    for j in G[i]:
        dp[j] = dp[i] + 1
        q.append(j)

ans = '\n'.join(
    str(max(G_inv[i], key=lambda j: dp[j], default=0))
    for i in range(1, N + 1)
)

# 出力
print(ans)


### FIXED CODE ###

from collections import deque

# 入力
N, M = map(int, input().split())
A, B = zip(*(map(int, input().split()) for _ in range(N - 1 + M)))

# 各頂点の深さを求め、深さを利用して元の木を復元する
G = [set() for _ in range(N + 1)]
G_inv = [set() for _ in range(N + 1)]
for a, b in zip(A, B):
    G[a].add(b)
    G_inv[b].add(a)
deg = [len(G_inv[i]) for i in range(N + 1)]
V = [i for i in range(1, N + 1) if not G_inv[i]]
deq = deque(V)
while deq:
    i = deq.popleft()
    for j in G[i]:
        deg[j] -= 1
        if deg[j] == 0:
            deq.append(j)
            V.append(j)

R = {i: r for r, i in enumerate(V)}
ans = '\n'.join(
    str(max(G_inv[i], key=lambda j: R[j], default=0))
    for i in range(1, N + 1)
)

# 出力
print(ans)
### BUGGY CODE ###

S = str(input())
T = str(input())
A = ''

for i in range(len(S)+1):
	s = str(S[i:i+1])
	t = str(T[i:i+1])
	if s != t:
		S = S.replace(s,'A')
		S = S.replace(t,s)
		S = S.replace('A',t)

answer = 'No'


if S == T:
	answer = 'Yes'
	
print(answer)

### FIXED CODE ###

#coding:utf-8

"""
自分の解答。これだとTLEになってしまったので、復習をします
from collections import Counter
S = str(input())
T = str(input())

for i in range(len(S)+1):
	s = str(S[i:i+1])
	t = str(T[i:i+1])
	S = S.replace(s,'A').replace(t,s).replace('A',t)

answer = 'No'

if S == T:
	answer = 'Yes'
	
print(answer)
"""

"""
対応表を作るイメージ。
azzel→appleにするのには
a a
z p
e i
l e
という変化を回せればおっけー

#初期値-1で、要素26コの対応表をつくる
start = [-1]*26
goal = [-1]*26
print(start)

"""


S = str(input())
T = str(input())

#辞書型を使ってみる。defaultdictは便利らしい。どこがかはちょっとよく分からなかった。
from collections import defaultdict
s = defaultdict(int)
t = defaultdict(int)


for i in S:
	s[i] += 1

for j in T:
	t[j] += 1

#辞書型をソートできるsoted()を使う。
#values()で辞書型のkey valueのvalueだけを取り出している。

ss = sorted(s.values())
tt = sorted(t.values())

if ss == tt:
	print('Yes')
else:
	print('No')
### BUGGY CODE ###

N,K,*A = map(int, open(0).read().split())
Ap = []
An = []
Az = []
for c in A:
  if c>0:
    Ap.append(c)
  elif c<0:
    An.append(c)
  else:
    Az.append(c)
l = -10**20
r = 10**20
Ap.sort(reverse=True)
An.sort()
while l+1<r:
  s = (l+r)//2
  cnt = 0
  j = len(Ap)-1
  for i in range(len(Ap)):
    while j>-1 and Ap[i]*Ap[j]<s:
      j -= 1
    cnt += len(Ap)-1-j
  for i in range(len(Ap)):
    if Ap[i]*Ap[i]<s:
      cnt -= 1
  j = len(An)-1
  for i in range(len(An)):
    while j>-1 and An[i]*An[j]<s:
      j -= 1
    cnt += len(An)-1-j
  for i in range(len(An)):
    if An[i]*An[i]<s:
      cnt -= 1
  cnt //= 2
  if s>0:
    cnt += len(Az)*(len(Az)-1)//2 + len(Az)*(len(Ap)+len(An)) + len(Ap)*len(An)
  else:
    j = 0
    for i in range(len(Ap)-1,-1,-1):
      while j<len(An) and Ap[i]*An[j]<s:
        j += 1
      cnt += j
  if cnt>=K:
    r = s
  else:
    l = s
print(l)

### FIXED CODE ###

N, K = map(int, input().split())
A = [int(c) for c in input().split()]
Ap = []
An = []
Az = []
for i in range(N):
  if A[i]>0:
    Ap += [A[i]]
  elif A[i]<0:
    An += [A[i]]
  else:
    Az += [A[i]]
lp = len(Ap)
ln = len(An)
lz = len(Az)
Ap.sort(reverse=True)
An.sort(reverse=True)
def f(m, B, C):
  cnt = 0
  j  = 0
  lb = len(B)
  lc = len(C)
  for i in range(lc):
    while j<lb:
      if B[j]*C[i]>=m:
        cnt += j
        break
      j += 1
    else:
      cnt += j
  return cnt
if K<=lp*ln:
  r = 1
  l = -10**18+10
  while l+1<r:
    n = (l+r)//2
    if f(n,Ap,An)>=K:
      r = n
    else:
      l = n
  print(l)
  import sys
  sys.exit()
K -= lp*ln
if K<=lz*(lp+ln) + lz*(lz-1)//2:
  print(0)
  import sys
  sys.exit()
K -= lz*(lp+ln) + lz*(lz-1)//2
r = 10**18+10
l = -1
while l+1<r:
  n = (l+r)//2
  P = f(n,Ap[::-1],Ap)
  for i in range(lp):
    if Ap[lp-1-i]*Ap[lp-1-i]<n:
      P -= 1
    else:
      break
  P //= 2
  N = f(n,An,An[::-1])
  for i in range(ln):
    if An[i]*An[i]<n:
      N -= 1
    else:
      break
  N //= 2
  if P+N>=K:
    r = n
  else:
    l = n
print(l)
### BUGGY CODE ###

from fractions import Fraction
from math import ceil
from heapq import heappush, heappop

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

A_queue = []
for a in input().split():
	a = Fraction(int(a), 1)
	heappush(A_queue, (-a, a, 1))

# search smallest i such that f(i) == True
def auto_bisearch_smallest(f, s = None):
	if s == None:
		s = 0
		w = -1
		while f(s) == True:
			s = w
			w *= 2
	e = s
	w = 1
	while f(e) == False:
		e = s + w
		w *= 2
	
	return bisearch_smallest(f, s, e + 1)

# search smallest i ( s <= i < e ) such that f(i) == True
def bisearch_smallest(f, s, e = None):
	if e == None:
		e = s - 1
		s = 0
	else:
		e -= 1
	
	while s < e:
		m = (s + e) // 2
		if f(m):
			e = m
		else:
			s = m + 1
	
	if s == e and f(s):
		return s
	else:
		return -1

def calc(K):
	while K > 0:
		length, a, div = heappop(A_queue)
		if len(A_queue) > 0:
			ref = A_queue[0][0]
			new_div = auto_bisearch_smallest(lambda div: -a / div > ref, div)
			K -= (new_div - div)
			heappush(A_queue, (-a / new_div, a, new_div))
		else:
			div += K
			K = 0
			heappush(A_queue, (-a / div, a, div))
	return -A_queue[0][0]

print(ceil(calc(K)))


### FIXED CODE ###

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

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

# search smallest i such that f(i) == True
def auto_bisearch_smallest(f, s = None):
	if s == None:
		s = 0
		w = -1
		while f(s) == True:
			s = w
			w *= 2
	e = s
	w = 1
	while f(e) == False:
		e = s + w
		w *= 2
	
	return bisearch_smallest(f, s, e + 1)

# search smallest i ( s <= i < e ) such that f(i) == True
def bisearch_smallest(f, s, e = None):
	if e == None:
		e = s - 1
		s = 0
	else:
		e -= 1
	
	while s < e:
		m = (s + e) // 2
		if f(m):
			e = m
		else:
			s = m + 1
	
	if s == e and f(s):
		return s
	else:
		return -1

def calc(length):
	count = 0
	for a in A_list:
		if a > length:
			if a % length == 0:
				count += (a // length) - 1
			else:
				count += a // length
	return count

print(auto_bisearch_smallest(lambda length: calc(length) <= K, 1))