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

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

s.sort()

num = [0 for i in range(n)]

for i in range(n):
    for j in range(i+1, n):
        if s[i] == s[j]:
            num[i] += 1

for i in range(n):
    if num[i] == max(num):
        print(s[i])


### FIXED CODE ###

n = int(input())

d = {}
for i in range(n):
    s = input()
    if s in d:
        d[s] += 1
    else:
        d[s] = 1

list = []
maxnum = max(d.values())

for i in d:
    if d[i] == maxnum:
        list.append(i)
list.sort()
for i in list:
    print(i)
### BUGGY CODE ###

import math

sets = dict()

def gcd2(a, b):
    if a > b:
        key = (b, a)
    else:
        key = (a, b)
    
    if key in sets.keys():
        # print("cached")
        return sets[key]
    else:
        # print("stored")
        ans = math.gcd(a, b)
        sets[key] = ans
        return ans

def gcd3(a, b, c):
    return gcd2(gcd2(a, b), c)

n = int(input())

ans = 0
for i in range(1, n+1):
    for j in range(1, n+1):
        for k in range(1, n+1):
            ans += gcd3(i, j, k)

print(ans)


### FIXED CODE ###

import math

sets = dict()

def gcd2(a, b):
    if a > b:
        key = (b, a)
    else:
        key = (a, b)
    
    try:
        # print("cached")
        return sets[key]
    except:
        # print("stored")
        ans = math.gcd(a, b)
        sets[key] = ans
        return ans

n = int(input())

ans = 0
for i in range(1, n+1):
    for j in range(1, n+1):
        pre = gcd2(i, j)

        for k in range(1, n+1):
            ans += gcd2(pre, k)

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

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

### FIXED CODE ###

k,s = map(int,input().split())
n = 0
for x in range(k+1):
    for y in range(k+1):
        z = s-(x+y)
        if z <= k and z >= 0 and x+y+z==s:
            n += 1
print(n)
### BUGGY CODE ###


def kakaka():
    a = list(map(int, input().split()))
    b = map(int, input().split())
    c = int(input())

def start_process():
    return
def main():
    all_num, inst_num = map(int, input().split())
    data = list(input())

    # all_num, inst_num = 5, 1
    # data = list('00010')

    max_num = 0
    for i in range(all_num):
        now_kiritsu = 0
        flg = 0
        for j in range(i, all_num):
            if data[j] == '0':
                if flg == 0:
                    now_kiritsu += 1
                    flg = 1
                else:
                    pass
                if now_kiritsu > inst_num:
                    if max_num < j - i:
                        max_num = j - i
                        # print(j, i, max_num)
                    break
            else:
                flg = 0
        else:
            if max_num < j - i + 1:
                max_num = j - i + 1
                # print(j, i, max_num)

        # print(i, j, now_kiritsu)

    print(max_num)






if __name__ == '__main__':
    main()


### FIXED CODE ###


def main():
    all_num, inst_num = map(int, input().split())
    data = list(input())

    data_la = []
    ans_0, ans_1 = 0, 0
    for i in range(all_num):
        if data[i] == '1':
            ans_1 += 1
            if ans_0 > 0:
                data_la.append(ans_0)
                ans_0 = 0
        else:
            ans_0 += 1
            if ans_1 > 0:
                data_la.append(ans_1)
                ans_1 = 0
    if ans_1 > 0:
        data_la.append(ans_1)
    elif ans_0 > 0:
        data_la.append(ans_0)

    ans = 0
    ans_data = 0
    count_0 = 0

    if data[0] == '0':
        data_la.insert(0, 0)

    # print(data_la)

    if len(data_la) <= 2:
        ans_data = sum(data_la)
    else:
        pre_data1_ind, pre_data2_ind = 0, 1
        pre_data1, pre_data2 = data_la[pre_data1_ind], data_la[pre_data2_ind]

        for i in range(len(data_la)):
            if i % 2 == 1:
                count_0 += 1

            if count_0 == inst_num + 1:
                ans = ans - pre_data1 - pre_data2
                pre_data1_ind += 2
                pre_data2_ind += 2
                if pre_data1_ind >= len(data_la):
                    pre_data1 = 0
                else:
                    pre_data1 = data_la[pre_data1_ind]
                if pre_data2_ind >= len(data_la):
                    pre_data2 = 0
                else:
                    pre_data2 = data_la[pre_data2_ind]
                count_0 -= 1

            ans += data_la[i]
            if ans_data < ans:
                ans_data = ans

    print(ans_data)


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

N, K = list(map(int, input().split()))
P = list(map(int, input().split()))
C = list(map(int, input().split()))
 
has_visited = [False]*N
score_max = -float('inf')
 
for i in range(N):
    if has_visited[i]:
        continue
    
    loop_val = []
 
    j = i
    while True:
        loop_val.append(C[j])
        has_visited[j] = True
        j = P[j] - 1
        if loop_val[0] == C[j]:
            break
    
    # sum_arr = [0]
    # loop_length = len(loop_val)
 
    # for k in range(1, loop_length + K):
    # sum_arr.append(sum_arr[k-1] + loop_val[(k - 1) % loop_length])
 
    # print(loop_val)
 
    sm = 0
    for p in range(len(loop_val)):
        sm += loop_val[p]
    
    # print(sm)
    
    loop_length = len(loop_val)
 
    for l in range(loop_length):
        res = -1
        s = 0
        for k in range(K):
            s = max([s + loop_val[(k+l) % loop_length], loop_val[(k+l) % loop_length]])
            res = max([res, s])
        
        if res == -1:
            res = max(loop_val)
 
        if score_max < res:
            score_max = res
 
print(score_max)

### FIXED CODE ###

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

res = -10**10

for i in range(N):
    j = i
    total = 0
    loop_values = []

    while True:
        j = P[j] - 1
        loop_values.append(C[j])
        total += C[j]
        if j == i:
            break
    
    loop_length = len(loop_values)
    point_sum = 0

    for j in range(loop_length):
        point_sum += loop_values[j]
        result_cand = point_sum

        if j+1 > K:
            break

        if total > 0:
            loop_num = (K - j - 1) // loop_length
            result_cand += total * loop_num
        
        if res < result_cand:
            res = result_cand

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

N,K = map(int, input().split())
L = [0]*N
R = [0]*N
DP = [0]*(N+10)
DP[0] = 1
SDP = [0]*(N+10)
SDP[1] = 1
MOD=998244353
for i in range(K):
    L[i],R[i] = map(int, input().split())

for i in range(1,N):
    for j in range(K):
        l = max(0,i-R[j])
        r = max(0,i-L[j]+1)
        DP[i] += SDP[r] - SDP[l]
    SDP[i+1] = SDP[i] + DP[i]
print(DP[N-1]%MOD)


### FIXED CODE ###

N,K = map(int, input().split())
L = [0]*N
R = [0]*N
DP = [0]*(N+10)
DP[0] = 1
SDP = [0]*(N+10)
SDP[1] = 1
MOD=998244353
for i in range(K):
    L[i],R[i] = map(int, input().split())

for i in range(1,N):
    for j in range(K):
        l = max(0,i-R[j])
        r = max(0,i-L[j]+1)
        DP[i] += SDP[r] - SDP[l]
    SDP[i+1] = (SDP[i] + DP[i])%MOD
print(DP[N-1]%MOD)
### BUGGY CODE ###

a,b,c,k=map(int, input().split())
""" a:1
    b:0
    c:-1
"""
nokori=k
sum_max=0
while nokori>0:
    nokori-=1
    if(a>0):
        sum_max+=1
        a-=1
        continue
    if(b>0):
        b-=1
        continue
    if(c>0):
        sum_max-=1
        c-=1
    

print(sum_max)

### FIXED CODE ###

a,b,c,k=map(int, input().split())
""" a:1
    b:0
    c:-1
"""
sum_max=0
minus=0
if(a+b>=k):
    if(a>=k):
        sum_max=k
    else:
        sum_max=a
else:
    minus=k-(a+b)
    sum_max=a-minus




print(sum_max)
### BUGGY CODE ###

import sys
sys.setrecursionlimit(500000) 
H,W = map(int,input().split())
C = list(map(int,input().split()))
C[0] -= 1; C[1] -= 1
D = list(map(int,input().split()))
D[0] -= 1; D[1] -= 1
S = []; INF = float("inf")
for i in range(H):
  temp = str(input());temp =list(temp)
  S.append(temp)
#print(S)
reach = [[INF]*W for _ in range(H)]
reach[C[0]][C[1]] = 0
dxdy = [(1,0),(-1,0),(0,1),(0,-1)]
def dfs(v,score):
  #if reach[v[0]][v[1]] < score:
  #  return

  for i in range(4):
    nx = v[0] + dxdy[i][0]
    ny = v[1] + dxdy[i][1]
    if 0<=nx<H and 0<=ny<W and S[nx][ny] == "." and reach[nx][ny] > score:
      reach[nx][ny] = min(score,reach[nx][ny])
      u = [nx,ny]
      dfs(u,score)

  for i in range(5): #0~4
    for j in range(5):
      mx = v[0]-2 + i
      my = v[1]-2 + j
      if i == 2 and j == 2:
        continue
      if mx < 0 or mx >= H or my < 0 or my >= W or S[mx][my] == "#":
        continue
      if reach[mx][my] < score+1: #すでにこのスコア以下でいける。
        continue
      reach[mx][my] = min(score+1,reach[mx][my])
      p = [mx,my]
      dfs(p,score+1)
dfs(C,0)
#print(reach)
#print(reach[D[0]][D[1]])
if reach[D[0]][D[1]] == INF:
  print(-1)
else:
  print(reach[D[0]][D[1]])

### FIXED CODE ###

import sys
sys.setrecursionlimit(500000) 
input = sys.stdin.readline
from collections import deque
H,W = map(int,input().split())
C = list(map(int,input().split()))
C[0] -= 1; C[1] -= 1
D = list(map(int,input().split()))
D[0] -= 1; D[1] -= 1
S = []; INF = float("inf")
for i in range(H):
  temp = str(input());temp =list(temp)
  S.append(temp)
#print(S)
reach = [[INF]*W for _ in range(H)]
reach[C[0]][C[1]] = 0
dxdy = [(1,0),(-1,0),(0,1),(0,-1)]
Q = deque([])
Q.append([C,0])
while Q:
  z, score = Q.popleft()
  x = z[0];y=z[1]
 
  for i in range(4):
    nx = x + dxdy[i][0]
    ny = y + dxdy[i][1]
    #print(nx,ny)
    if 0<=nx<H and 0<=ny<W and S[nx][ny] == "." and reach[nx][ny] > score:
      reach[nx][ny] = min(score,reach[nx][ny])
      u = [nx,ny]
      Q.appendleft([u,score])
  #print(reach)
 
  for i in range(5): #0~4
    for j in range(5):
      mx = x-2 + i
      my = y-2 + j
      if i == 2 and j == 2:
        continue
      if mx < 0 or mx >= H or my < 0 or my >= W or S[mx][my] == "#":
        continue
      if reach[mx][my] <= score+1: #すでにこのスコア以下でいける。
        continue
      reach[mx][my] = min(score+1,reach[mx][my])
      p = [mx,my]
      #print(v,p,"X")
      Q.append([p,score+1])
#dfs(C,0)
#print(reach)
#print(reach[D[0]][D[1]])
if reach[D[0]][D[1]] == INF:
  print(-1)
else:
  print(reach[D[0]][D[1]])
### BUGGY CODE ###

N, K = map(int, input().split())
T = [[] for i in range(N)]
MOD = 10 ** 9 + 7
for i in range(N - 1):
    a,  b = map(int, input().split())
    a, b = a - 1, b - 1
    T[a].append(b)
    T[b].append(a)


# 階乗 & 逆元計算
factorial = [1]
inverse = [1]
for i in range(1, K + 2):
    factorial.append(factorial[-1] * i % MOD)
    inverse.append(pow(factorial[-1], MOD - 2, MOD))


# 組み合わせ計算
def nPr(n, r):
    if n < r or r < 0:
        return 0
    elif r == 0:
        return 1
    return factorial[n] * inverse[r] * inverse[n - r] * factorial[r] % MOD


ans = K
stack = [[0, 0]]  # [頂点番号, 深さ]
visited = [False] * N
while stack:
    n, depth = stack.pop()
    visited[n] = True

    child = 0
    for to in T[n]:
        if visited[to]:
            continue

        child += 1
        stack.append([to, depth + 1])

    if depth == 0:
        ans *= nPr(K - 1, child)
    else:
        ans *= nPr(K - 2, child)

print(ans % MOD)


### FIXED CODE ###

N, K = map(int, input().split())
T = [[] for i in range(N)]
MOD = 10 ** 9 + 7
for i in range(N - 1):
    a, b = map(int, input().split())
    a, b = a - 1, b - 1
    T[a].append(b)
    T[b].append(a)


stack = [0]
visited = [0] * N
child_num = [0] * N
while stack:
    n = stack.pop()
    visited[n] = 1
    for to in T[n]:
        if visited[to]:
            continue
        child_num[n] += 1
        stack.append(to)


# 階乗 & 逆元計算
factorial = [1]
inverse = [1]
for i in range(1, 10 ** 5 + 1):
    factorial.append(factorial[-1] * i % MOD)
    inverse.append(pow(factorial[-1], MOD - 2, MOD))


# 組み合わせ計算
def nCr(n, r):
    if n < r or r < 0:
        return 0
    elif r == 0:
        return 1
    return factorial[n] * inverse[r] * inverse[n - r] % MOD


ans = K
stack = [0]
visited = [0] * N
while stack:
    n = stack.pop()
    visited[n] = 1

    if n == 0:
        ans = ans * nCr(K - 1, child_num[n]) * factorial[child_num[n]] % MOD
    else:
        ans = ans * nCr(K - 2, child_num[n]) * factorial[child_num[n]] % MOD
    for to in T[n]:
        if visited[to]:
            continue
        stack.append(to)

print(ans % MOD)
### BUGGY CODE ###

num = int(input())

from collections import defaultdict
from collections import OrderedDict
dic = defaultdict(int)
import operator

for i in range(num):
  s = input()
  if s in dic:
      dic[s] += 1
  else:
      dic[s] = 1

d = OrderedDict(sorted(dic.items()))

k = {}
k = [key for m in [max(d.values())] for key,val in d.items() if val == m]

for i in k:
  print(i)

### FIXED CODE ###

num = int(input())

from collections import defaultdict
dic = defaultdict(int)

for i in range(num):
  s = input()
  if s in dic:
      dic[s] += 1
  else:
      dic[s] = 1

k = {}
k = [key for m in [max(dic.values())] for key,val in dic.items() if val == m]
k.sort()
for i in k:
  print(i)
### BUGGY CODE ###

N, M, K = map(int, input().split())
A = input().split()
B = input().split()
for n in range(N):
    A[n] = int(A[n])
for m in range(M):
    B[m] = int(B[m])
Ka = 0
ca = 0
for a in range (N):
    if Ka + A[a] <= K:
        Ka += A[a]
        ca += 1
    else:
        break
Kb = 0
cb= 0
for b in range (M):
    if Kb + B[b] <= K:
        Kb += B[b]
        cb += 1
    else:
        break
list_c = [ca, cb]
for i in range (1, ca+1):
    for j in range (1, cb+1):
        c = i + j
        s = 0
        for a in range (i):
            s += A[a]
        for b in range (j):
            s += B[b]
        if s <= K:
            list_c.append(c)
list_c.sort()
print(list_c[len(list_c) - 1])

### FIXED CODE ###

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

sum_A = [0]
for  i in range(N):
    sum_A.append(sum_A[i] + A[i])

sum_B = [0]
for  i in range(M):
    sum_B.append(sum_B[i] + B[i])

ans = 0
j = M

for i in range (N+1):
    if sum_A[i] > K:
        break
    while sum_B[j] > K - sum_A[i]:
        j -= 1
    ans = max(ans, i+j)

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

class Kenken():
	def __init__(self,n,a,b,c,d,s):
		self.n = n
		self.a = a-1
		self.b = b-1
		self.c = c-1
		self.d = d-1
		self.s = s
		self.s = self.s[:a-1] + "A" + self.s[a:]
		self.s = self.s[:b-1] + "B" + self.s[b:]

	def str_replace(self,i,k,S):
		if k == 1:
			self.s = self.s[:i] + "." + S + self.s[i+2:]
		else:
			self.s = self.s[:i] + "." + self.s[i+1] + S + self.s[i+3:]

	def check_stone(self,i):
		if i < self.n:
			if self.s[i] == ".":
				return True
		return False

	def check_goal(self):
		if self.a == self.c and self.b == self.d:
			return False
		else:
			return True

	def left(self,target,i):
		if target == "a":
			self.str_replace(self.a,i,"A")
			self.a += i
		else:
			self.str_replace(self.b,i,"B")
			self.b += i
	
	def get_space(self,S):
		if S == "a":
			return self.a
		elif S == "b":
			return self.b
		elif S == "c":
			return self.c
		elif S == "d":
			return self.d

	def print_all(self):
		print(self.s)

n,a,b,c,d = map(int, input().split())
s = input()

if c > d:
	if s.find("...") == -1:
		print("No")
		exit()
ken = Kenken(n,a,b,c,d,s)
flag=0
while ken.check_goal():
	if (ken.check_stone(ken.get_space("b")+1) and ken.check_stone(ken.get_space("b")-1)) or (ken.get_space("a")+1 == ken.get_space("b") and ken.check_stone(ken.get_space("b")+1)): 
		if ken.check_stone(ken.get_space("a")+1) and ken.get_space("a") != ken.get_space("c"):
			ken.left("a",1)
		elif ken.check_stone(ken.get_space("a")+2) and ken.get_space("a") != ken.get_space("c"):
			ken.left("a",2)
		elif ken.check_stone(ken.get_space("b")+1) and ken.get_space("b") != ken.get_space("d"):
			ken.left("b",1)
		elif ken.check_stone(ken.get_space("b")+2) and ken.get_space("b") != ken.get_space("d"):
			ken.left("b",2)
		else:
			flag=1
			break
	else:
		if ken.check_stone(ken.get_space("b")+1) and ken.get_space("b") != ken.get_space("d"):
			ken.left("b",1)
		elif ken.check_stone(ken.get_space("b")+2) and ken.get_space("b") != ken.get_space("d"):
			ken.left("b",2)
		elif ken.check_stone(ken.get_space("a")+1) and ken.get_space("a") != ken.get_space("c"):
			ken.left("a",1)
		elif ken.check_stone(ken.get_space("a")+2) and ken.get_space("a") != ken.get_space("c"):
			ken.left("a",2)
		else:
			flag=1
			break

if flag == 0:
	print("Yes")
else:
	print("No")

### FIXED CODE ###

n,a,b,c,d = map(int, input().split())
s = input()
if s[a:c-1].count("##")!=0 or s[b:d-1].count("##")!=0:
	print("No")
	exit()

if c > d:
	if s[b-2:d+1].count("...") == 0:
		print("No")
		exit()
print("Yes")
### BUGGY CODE ###

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

count = 1

for i in range(N):
    if A[i] == 0:
        print(0)
        exit()

    count *= A[i]

if count > 10**18:
    print(-1)
    exit()

print(count)

### FIXED CODE ###

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

count = 1

if 0 in A:
    print(0)
    exit()

for i in A:
    count *= i
    if count > 10**18:
        print(-1)
        exit()

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

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

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    #divisors.sort(reverse=True)
    return divisors

X = []
for i in range(n):
    d = make_divisors(A[i])
    X.append(d)

l = [0]*n
r = [0]*n
S = set()
for i in range(n):
    for x in X[i]:
        if x in S:
            break
    else:
        l[i] = 1
    S.add(A[i])

S = set()
for i in reversed(range(n)):
    for x in X[i]:
        if x in S:
            break
    else:
        r[i] = 1
    S.add(A[i])

#print(l)
#print(r)
ans = 0
for i in range(n):
    if l[i] == 1 and r[i] == 1:
        ans += 1
print(ans)


### FIXED CODE ###

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

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    #divisors.sort(reverse=True)
    return divisors

def main():
    A.sort()
    S = set(A)
    m = max(A)
    X = [0]*(m+1)
    for i in range(1, m+1):
        j = i
        if j not in S:
            continue
        while j <= m:
            X[j] += 1
            j += i
    #print(X)

    D = {}
    for i in range(n):
        if A[i] not in D:
            D[A[i]] = 1
        else:
            D[A[i]] += 1

    ans = 0
    for a in A:
        if X[a] == 1 and D[a] == 1:
            ans += 1
    print(ans)

    #for i in range(m+1):
    #    if X[i] == 1:
            #print(i)

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

n = int(input())
a = list(map(int, input().split()))
b = [0] * (n + 1)
for i in range(1, n):
    b[i] += a.count(i)
for i in range(1, n + 1):
    print(b[i])


### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
b = [0] * n
for i in range(n - 1):
    b[a[i] - 1] += 1
for i in range(n):
    print(b[i])
### BUGGY CODE ###

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

n, k = map(int, input().split())
p = list(map(int, input().split()))

def main():
    keep_val = 0
    check = 0
    for i in range(n-k+1):
        ss = sum(p[i:i+k])
        if keep_val < ss:
            check = i
            keep_val = ss

    #print(p[check:check+k])

    ans = 0
    for i in p[check:check+k]:
        ans += (i+1)/2
    print(ans)

main()


### FIXED CODE ###

# -*- coding: utf-8 -*-
 
n, k = map(int, input().split())
p = list(map(int, input().split()))

summation = 0
exp_val = []
for i in range(n):
    summation += (p[i]+1)/2
    exp_val.append(summation)
exp_val.insert(0, 0)
#print(exp_val)

ans = 0
for i in range(n-k+1):
    m = exp_val[k+i] - exp_val[i]
    ans = max(ans, m)

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

A, B, K = list(map(int, input().split()))

L = []

for i in range(A, B + 1):
  if i < A + K or i > B - K:
    L.append(i)

for i in L:
  print(i)



### FIXED CODE ###

A, B, K = list(map(int, input().split()))

L = []

for i in range(A, min(A + K, B + 1)):
  L.append(i)

for i in range(max(B - K + 1, A + K), B + 1):
  L.append(i)

for i in L:
  print(i)
### BUGGY CODE ###

N, K = map(int,input().split())
h = list(map(int,input().split()))
dp = [float('inf')] * (N+1)
dp[0:2] = [0,0]
for i in range(2, N+1):
    for j in range(1,K+1):
        if i-j <= 0:
            break
        dp[i] = min(dp[i], dp[i-j]+abs(h[i-1]-h[i-j-1]))
print(dp[N])


### FIXED CODE ###

N, K = map(int,input().split())
h = list(map(int,input().split()))
dp = [float('inf')] * (N+1)
dp[0:2] = [0,0]
for i in range(2, N+1):
    for j in range(1,K+1):
        if i-j <= 0:
            break
        dp[i] = min(dp[i], dp[i-j]+abs(h[i-1]-h[i-j-1]))
print(dp[N])
### BUGGY CODE ###

# coding: utf-8
# Your code here!

import heapq
a = []
heapq.heapify(a)  # リストを優先度付きキューへ
N,K = map(int,input().split())
A_s = list(map(int,input().split()))

for i in range(N-1):
    for j in range(i+1,N):
        heapq.heappush(a, A_s[i]*A_s[j])
        
for i in range(K-1):
    heapq.heappop(a)

print(heapq.heappop(a))

### FIXED CODE ###

N,K = map(int,input().split())
A_s = list(map(int,input().split()))
minus = [-x for x in A_s if x < 0]
plus = [x for x in A_s if x >= 0]
minus.sort()
plus.sort()

def cnt(x):
    ans = 0
    if x < 0:
        r = 0
        x = -x
        for num in minus[::-1]:
            while r < len(plus) and plus[r] * num < x:
                r += 1
            ans += len(plus) - r
        return ans
        
    r = 0
    for num in minus[::-1]:
        if num * num <= x: ans -= 1
        while r < len(minus) and minus[r] * num <= x:
            r += 1
        ans += r
    r = 0
    for num in plus[::-1]:
        if num * num <= x: ans -= 1
        while r < len(plus) and plus[r] * num <= x:
            r += 1
        ans += r
    ans //= 2
    ans += len(minus) * len(plus)
    return ans


top = 2 * (10**18) + 2
bottom = 0

while top - bottom > 1:
    mid = (top + bottom) // 2
    if cnt(mid-10**18-1) < K:
        bottom = mid
    else:
        top = mid
print(int(top-10**18-1))