Harryxun/stf_run huggingface dataset:
def f(x,y,x1,y1,x2,y2):
    if x1 <= x2:
        return (x2-x1)*y-(y2-y1)*x+x1*y2-x2*y1
    else:
        return -((x2-x1)*y-(y2-y1)*x+x1*y2-x2*y1)

def DC(a):
    if len(a) > 3:
        # Divide
        la = a[:len(a)/2]
        ra = a[len(a)/2:]
        la,ra = DC(la),DC(ra)
        # Conquer
        if len(la) == 1 or len(ra) == 1:
            return la+ra
        else:
            while f(ra[1][0],ra[1][1],la[-1][0],la[-1][1],ra[0][0],ra[0][1]) > 0:
                ra.pop(0)
            while f(la[-2][0],la[-2][1],ra[0][0],ra[0][1],la[-1][0],la[-1][1]) > 0:
                la.pop(-1)
            return la+ra
    else:
        return a

while True:
    n = int(raw_input())
    if n == 0:
        break
    p = []
    for i in range(n):
        p.append(map(float, raw_input().split(",")))
    p = sorted(p, key = lambda x: x[0])
    print n - len(DC(p))

### FIXED CODE ###

def a(v1,v2):
	if v1[0] != v2[0]:
		return (v2[1]-v1[1])/(v2[0]-v1[0])
	else:
		return (v2[1]-v1[1])*(10**10)
def dlt(p,v,sign):
	while len(p) > 2:
		if sign*(a(v[p[-3]],v[p[-2]]) - a(v[p[-2]],v[p[-1]])) < 0:
			del p[-2]
		else:
			break
	return p
def convex(v,n):
	d,u = [],[]
	for i in range(n):
		d = dlt(d+[i],v,1)
		u = dlt(u+[i],v,-1)
	return n - len(set(d+u))
while 1:
	n = input()
	if n == 0: break
	v = [map(float,raw_input().split(",")) for i in range(n)]
	v = sorted(sorted(v, key = lambda x:x[1]))
	print convex(v,n)
def input_num(infile):
	num = int(infile.readline())
	return num

def makedict(infile,outfile,n):
	dict = {}
	for i in range(n):
		key,val = infile.readline().split()
		dict[key] = val
	m = input_num(sys.stdin)
	for j in range(m):
		x = infile.readline().sprit()[0]
		outfile.write(dict.get(x,x))
	print >> outfile

if __name__ == "__main__"
	import sys
	while True:
		n = input_num(sys.stdin)
		if n == 0:
			break
		dictionary = makedict(sys.stdin,sys.stdout,n)

### FIXED CODE ###

def convert(infile, outfile, n):
    dictionary = {}
    for i in range(n):
        key, val = infile.readline().split()
        dictionary[key]=val
    m = int(infile.readline())
    for j in range(m):
        x = infile.readline().split()[0]
        outfile.write(dictionary.get(x, x))
    print >> outfile
 
def run(infile, outfile):
    while True:
        n = int(infile.readline())
        if n == 0:
            break
        convert(infile, outfile, n)
 
if __name__ == "__main__":
    import sys
    run(sys.stdin, sys.stdout)
# -*- coding: utf-8 -*-
from sys import stdin
stdin = open("sample.txt")

A = stdin.readline().rstrip()
B = stdin.readline().rstrip()
C = stdin.readline().rstrip()
turn = "a"

for i in range(300):
    if turn == "a":
        if A != "":
            turn = A[0]
            A = A[1:]
        else:
            print("A")
            exit()
    elif turn == "b":
        if B != "":
            turn = B[0]
            B = B[1:]
        else:
            print("B")
            exit()
    elif turn == "c":
        if C != "":
            turn = C[0]
            C = C[1:]
        else:
            print("C")
            exit()

### FIXED CODE ###

# -*- coding: utf-8 -*-
from sys import stdin

A = stdin.readline().rstrip()
B = stdin.readline().rstrip()
C = stdin.readline().rstrip()
turn = "a"

for i in range(300):
    if turn == "a":
        if A != "":
            turn = A[0]
            A = A[1:]
        else:
            print("A")
            exit()
    elif turn == "b":
        if B != "":
            turn = B[0]
            B = B[1:]
        else:
            print("B")
            exit()
    elif turn == "c":
        if C != "":
            turn = C[0]
            C = C[1:]
        else:
            print("C")
            exit()
(a, b) = [int(i) for i in input()]
d = a // b
r = a % b
f = a / b
print('%s %s %.5f' % (d, r, f)

### FIXED CODE ###

(a, b) = [int(i) for i in input().split()]
  
while True:
    d = a // b
    r = a % b
    f = a / b
    print( '{0:d} {1:d} {2:.5f}'.format( d, r, f))
    break
s = input()
N = len(s)
s_trim = ''.join([c for c in s if c != 'x'])
N_trim = len(s_trim)

def check_anagram():
    for i in range(N_trim):
        j = N_trim - 1 - i
        if s_trim[i] != s_trim[j]:
            return False
    return True

def solve():
    if not check_anagram():
        return -1

    # Center of anagram
    pr = N_trim // 2
    pl = pr
    if N_trim % 2 == 0:
        pl -= 1

    xl = 0
    tl = 0
    while xl < N:
        if s[xl] != 'x':
            # assert s[xl] == s_trim[tl]
            if s[xl] != s_trim[tl]:
                while True: pass
            if tl == pl:
                break
            tl += 1
        xl += 1

    if N_trim % 2 == 1:
        xr = xl
    else:
        xr = xl + 1
        while s[xr] == 'x':
            xr += 1

    cost = 0
    while True:
        assert s[xl] == s_trim[pl]
        assert s[xr] == s_trim[pr]
        assert s[xl] == s[xr]
        assert s_trim[pl] == s_trim[pr]
        pl -= 1; pr += 1
        while True:
            xl -= 1; xr += 1
            if not (xl >= 0 and xr < N and s[xl] == 'x' and s[xr] == 'x'):
                break
        while xl >= 0 and s[xl] == 'x':
            cost += 1
            xl -= 1
        while xr < N and s[xr] == 'x':
            cost += 1
            xr += 1
        if pl < 0 and pr >= N_trim and xl < 0 and xr >= N:
            return cost

print(solve())


### FIXED CODE ###

s = input()
N = len(s)
s_trim = ''.join([c for c in s if c != 'x'])
N_trim = len(s_trim)

def check_anagram():
    for i in range(N_trim):
        j = N_trim - 1 - i
        if s_trim[i] != s_trim[j]:
            return False
    return True

def solve():
    if not check_anagram():
        return -1
    if N_trim == 0:
        return 0
    # Center of anagram
    pr = N_trim // 2
    pl = pr
    if N_trim % 2 == 0:
        pl -= 1

    xl = 0
    tl = 0
    while xl < N:
        if s[xl] != 'x':
            # assert s[xl] == s_trim[tl]
            if tl == pl:
                break
            tl += 1
        xl += 1

    if N_trim % 2 == 1:
        xr = xl
    else:
        xr = xl + 1
        while s[xr] == 'x':
            xr += 1

    cost = 0
    while True:
        # assert s[xl] == s_trim[pl]
        # assert s[xr] == s_trim[pr]
        # assert s[xl] == s[xr]
        # assert s_trim[pl] == s_trim[pr]
        pl -= 1; pr += 1
        while True:
            xl -= 1; xr += 1
            if not (xl >= 0 and xr < N and s[xl] == 'x' and s[xr] == 'x'):
                break
        while xl >= 0 and s[xl] == 'x':
            cost += 1
            xl -= 1
        while xr < N and s[xr] == 'x':
            cost += 1
            xr += 1
        if pl < 0 and pr >= N_trim and xl < 0 and xr >= N:
            return cost

print(solve())
from collections import defaultdict


def main():
    h, w = map(int, input().split())
    s = []
    for _ in range(h):
        col = []
        s.append(col)
        for c in input().strip():
            col.append(ord(c))
    c_row = defaultdict(int)
    for col in s:
        c_row[tuple(sorted(col))] += 1
    if sum(c % 2 for c in c_row.values()) > h % 2:
        print('NO')
        return
    for row, c in c_row.items():
        if c % 2:
            count = defaultdict(int)
            for ch in row:
                count[ch] += 1
            if sum(cc % 2 for cc in count.values()) > w % 2:
                print('NO')
                return

    c_col = defaultdict(int)
    for col in zip(*s):
        c_col[tuple(sorted(col))] += 1
    if sum(c % 2 for c in c_col.values()) > w % 2:
        print('NO')
        return

    for col, c in c_col.items():
        if c % 2:
            count = defaultdict(int)
            for ch in col:
                count[ch] += 1
            if sum(cc % 2 for cc in count.values()) > h % 2:
                print('NO')
                return

    if s[0][0] == ord('b'):
        print('NO')
    else:
        print('YES')


main()


### FIXED CODE ###

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

n = int(input())
xx = list([i, x] for i, x in enumerate(map(int, input().split())))
xx.sort(key=lambda x: x[1])

mid1 = xx[n // 2][1]
mid2 = xx[n // 2 - 1][1]
for i in range(n // 2):
    xx[i][1] = mid1
for i in range(n // 2, n):
    xx[i][1] = mid2

xx.sort()
print('\n'.join(str(x[1]) for x in xx))
s=input()
s+="Z"
S=""
F=0
for i in range(len(s)):
    if F==0:
        if s[i]=="B":
            F=1
        else:
            S+=s[i]
    else:
        if s[i]=="C":
            S+="D"
            F=0
        elif s[i]=="B":
            S+="B"
        else:
            S+=s[i]
            F=0
if S[len(S)-1]=="Z":
    S=S[:len(S)-1]
#print(S)
S=S[::-1]
L=[]
if S[0]=="D":
    L.append(1)
else:
    L.append(0)
for i in range(1,len(S)):
    if S[i]=="D":
        L.append(L[i-1]+1)
    elif S[i]=="A":
        L.append(L[i-1])
    else:
        L.append(0)
L=L[::-1]
S=S[::-1]
#print(S)
#print(L)
ANS=0
for i in range(len(S)):
    if S[i]=="A":
        ANS+=L[i]
print(ANS)
        

### FIXED CODE ###

s=input()

S=[s[0]]

for i in range(1,len(s)):
    if S[len(S)-1]=="B" and s[i]=="C":
        S[len(S)-1]="D"
    else:
        S.append(s[i])
#print(S)

L=[]
if S[len(S)-1]=="D":
    L.append(1)
else:
    L.append(0)
    
for i in range(1,len(S)):
    if S[len(S)-1-i]=="D":
        L.append(L[len(L)-1]+1)
    elif S[len(S)-1-i]=="A":
        L.append(L[len(L)-1])
    else:
        L.append(0)
L=L[::-1]
#print(L)
ANS=0
for i in range(len(S)):
    if S[i]=="A":
        ANS+=L[i]
print(ANS)
k,x=map(int,input().split())
lst=[]
for i in range(1,2*k):
  lst.append(x-k+i)
lst_2=''.join(lst)
print(lst_2)


### FIXED CODE ###

k,x=map(int,input().split())
lst=[]
for i in range(1,2*k):
  lst.append(x-k+i)
for j in range(len(lst)):
  print(lst[j])
import numpy as np 
from itertools import combinations

n,m,x = map(int, input().split())
n_num = [_ for _ in range(n)]

l = np.array([list(map(int, input().split())) for _ in range(n)])

ptns = []
for i in range(n):
    ptns += list(combinations(n_num, i+1))

ans = float('inf')
for j in range(len(ptns)):
    tmp = np.array([0]*(m+1))
    for k in range(len(ptns[j])):
        tmp += l[ptns[j][k]]
    if min(tmp[1:-1]) >= x:
        ans = min(ans, tmp[0])
    
print(-1 if ans == float('inf') else ans)

### FIXED CODE ###

import numpy as np 
from itertools import combinations

n,m,x = map(int, input().split())
n_num = [_ for _ in range(n)]

l = np.array([list(map(int, input().split())) for _ in range(n)])

ptns = []
for i in range(n):
    ptns += list(combinations(n_num, i+1))

ans = float('inf')
for j in range(len(ptns)):
    tmp = np.array([0]*(m+1))
    for k in range(len(ptns[j])):
        tmp += l[ptns[j][k]]
    if min(tmp[1:]) >= x:
        ans = min(ans, tmp[0])
    
print(-1 if ans == float('inf') else ans)
S=[for i in input()]
print('yes' if len(S)==len(set(S)) else 'no')


### FIXED CODE ###

S = [i for i in input()]
print('yes' if len(S) == len(set(S)) else 'no')
A,B=map(int,input.split())
if 1<=A<=9 and 1<=B<=9:
  print(A*B)
else:
  print"-1"

### FIXED CODE ###

A,B=map(int,input().split())
if 1<=A<=9 and 1<=B<=9:
  print(A*B)
else:
  print("-1")
from collections import Counter
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

MOD = 10**9+7


def comb2(N):
    return int(N*(N-1)/2)


N = int(input())
prev = -1
Col = []
for _ in range(N):
    c = int(input())
    if c == prev:
        continue
    else:
        prev = c
        Col.append(c)


cntF = [0]*(N+1)
forward = [0]*len(Col+1)
for i, c in enumerate(Col):
    forward[i] = cntF[c]
    cntF[c] += 1

cntB = [0]*(N+1)
back = [0]*(len(Col)+1)
for i in reversed(range(len(Col))):
    c = Col[i]
    back[i] = cntB[c]
    cntB[c] += 1

ans = 1+sum(forward)
for i in range(1, len(Col)-1):
    ans = ans + forward[i]*back[i+1]
    ans %= MOD
print(ans)


### FIXED CODE ###

N = int(input())
C = [-1]

for _ in range(N):
    c = int(input())
    if c == C[-1]:
        continue
    else:
        C.append(c)

MOD = 10**9+7
dp = 1
prev = [0]*(max(C)+1)

for c in C[1:]:
    dp = (dp+prev[c]) % MOD
    prev[c] = dp
print(dp)
n, m = map(int, input().split())
mod = 10 ** 9 + 7
pat = [0] * (n + 1)
pat[0] = 1
pat[1] = 1
for i in range(m):
    pat[i] = -1

pat = [1]
for i in range(2, n + 1):
    if pat[i] < 0:
        continue
    if pat[i - 1] > 0:
        pat[i] = (pat[i] + pat[i - 1]) % mod
    if pat[i - 2] > 0:
        pat[i] = (pat[i] + pat[i - 2]) % mod

print(pat[n])


### FIXED CODE ###

n, m = map(int, input().split())
mod = 10 ** 9 + 7
pat = [0] * (n + 2)
pat[0] = 1
pat[1] = 1

for i in range(m):
    a = int(input())
    pat[a] = -1

for i in range(2, n + 1):
    if pat[i] < 0:
        continue
    if pat[i - 1] > 0:
        pat[i] = (pat[i] + pat[i - 1]) % mod
    if pat[i - 2] > 0:
        pat[i] = (pat[i] + pat[i - 2]) % mod

print(pat[n])
N, M = map(int, input().split())

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

# 辞書データで管理
dict_cards = {}
for card in g_cards:
	if(card in dict_cards):
		dict_cards[card] += 1
	else:
		dict_cards[card] = 1
# 操作
for i in range(M):
	# sizeと同じ枚数のカードが増えたと考える
	size, val = map(int, input().split())
	if(val in dict_cards):
		dict_cards[val] += size
	else:
		dict_cards[val] = size

# 昇順にする
s_dict_cards = sorted(dict_cards.items(), key=lambda x: -x[0])

# 取り出す
s_cards = []
for val, cnt in s_dict_cards:
	s_cards += [val] * cnt
	# # 始めの個数を超えたら抜ける
	# if(len(s_cards) >= N):
	# 	break
# 出力
sum_val = sum(s_cards[:N])
print(sum_val)

### FIXED CODE ###

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

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

# key-valueデータで管理
dict_cards = []
for card in g_cards:
	dict_cards.append([card, 1])

# 操作
for i in range(M):
	# sizeと同じ枚数のカードが増えたと考える
	size, val = map(int, input().split())
	dict_cards.append([val, size])

# 降順にする
s_dict_cards = sorted(dict_cards, key=lambda x: -x[0])

s_cards = []
for data in s_dict_cards:
	s_cards += [data[0]] * data[1]
	if(len(s_cards) >= N):
		break
# 出力
sum_val = sum(s_cards[:N])
print(sum_val)
a =str(input()).split(" ")
h = int(a[0])
w = int(a[1])
maps= []

for i in range(h):
    maps.append(list(input()))
   
for i in range(h - 1 ):
    for j in range(w:
        if maps[i][j] == "#":
            if j - 1 > 0 and maps[i][j - 1] == "#":
                continue
            elif j + 1 < w and maps[i][j + 1] == "#" :
                continue
            elif i + 1 < h and maps[i + 1][j] == "#" :
                continue
            elif i - 1 > 0 and maps[i - 1][j] == "#":
                continue
            else:
                print("No")
                exit()
        else:
            pass
print("Yes")

### FIXED CODE ###

a =str(input()).split(" ")
h = int(a[0])
w = int(a[1])
maps= []

for i in range(h):
    maps.append(list(input()))

for i in range(h):
    for j in range(w):
        if maps[i][j] == "#":
            if j - 1 >= 0 and maps[i][j - 1] == "#":
                continue
            elif j + 1 < w and maps[i][j + 1] == "#" :
                continue
            elif i + 1 < h and maps[i + 1][j] == "#" :
                continue
            elif i - 1 >= 0 and maps[i - 1][j] == "#":
                continue
            else:
                print("No")
                exit()
        else:
            pass
print("Yes")
X = input()
Y = input()

alphabet_list = sorted([X, Y])
if alphabet_list[0] == alphabet_list[1]:
    print("=")
    #pass
elif X == alphabet_list[0]:
    print("<")
else:
    print(">")

### FIXED CODE ###

a, b =  list(input().split())

alphabet_list = sorted([a, b])
if alphabet_list[0] == alphabet_list[1]:
    print("=")
    #pass
elif a == alphabet_list[0]:
    print("<")
else:
    print(">")
def slove():
    import sys
    import fractions
    input = sys.stdin.readline
    a, b = list(map(int, input().rstrip('\n').split()))
    gcd = fractions.gcd(a, b)
    if gcd == 1:
        print(1)
    else:
        ls = [True] * (gcd + 1)
        ls[0] = False
        ls[1] = False
        c = [1]
        for i in range(int(len(ls) ** 0.5) + 2):
            if ls[i]:
                if a % i == 0 and b % i == 0:
                    c.append(i)
                for j in range(i, len(ls), i):
                    ls[j] = False
        print(len(c))


if __name__ == '__main__':
    slove()


### FIXED CODE ###

def slove():
    import sys
    import fractions
    input = sys.stdin.readline
    a, b = list(map(int, input().rstrip('\n').split()))
    gcd = fractions.gcd(a, b)
    cnt = 1
    for i in range(2, int(gcd ** 0.5) + 1):
        if gcd % i == 0:
            cnt += 1
            while True:
                if gcd % i == 0:
                    gcd //= i
                else:
                    break
    if gcd != 1:
        cnt += 1
    print(cnt)


if __name__ == '__main__':
    slove()
import sys
n=int(input())
sys.setrecursionlimit(n)
T=[[]for _ in"_"*(n+1)]
for _ in range(n-1):a,b=map(int,input().split());T[a]+=b,;T[b]+=a,
def d(v,p):
 r=0
 for s in T[v]:
  if s!=p:r^=d(s,v)+1
 return r
print("ABloibc e"[d(1,1)<1::2])

### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)

n = int(input())
T = [[] for _ in range(n)]
for _ in range(n-1):
  a, b = map(int, input().split())
  a -= 1
  b -= 1
  T[a].append(b)
  T[b].append(a)
def dfs(v, par=-1):
  res = 0
  for nv in T[v]:
    if nv == par:
      continue
    res ^= dfs(nv, v)+1
  return res
if dfs(0) == 0:
  print("Bob")
else:
  print("Alice")
n = int(input())
t = []
i = 0
for _ in range(n):
    x, y = map(int, input().split())
    if x == y:
        i += 1
    else:
        i = 0
    t.append(i)
if(len(filter(lambda x: x >= 3, t)) == 0):
    print("No")
else:
    print("Yes")


### FIXED CODE ###

n = int(input())
t = []
i = 0
for _ in range(n):
    x, y = map(int, input().split())
    if x == y:
        i += 1
    else:
        i = 0
    t.append(i)
if(len(list(filter(lambda x: x >= 3, t))) == 0):
    print("No")
else:
    print("Yes")
n, m = map(int, input().split())
stack = [1]*n
p = [1]

for i in range(m):
    x, y = map(int, input().split())
    stack[x-1] -= 1
    stack[y-1] += 1
    if x in p:
        p.append(y)
    if p[0] == 1:
        p.remove(1)

ps = list(set(p))
ans = 0
for i in ps:
    if stack[i-1] != 0:
        ans += 1
print(ans)

### FIXED CODE ###

n, m = map(int, input().split())
stack = [1]*n
p = [False]*n
p[0] = True

for i in range(m):
    x, y = map(int, input().split())
    stack[x-1] -= 1
    stack[y-1] += 1
    p[y-1] = p[x-1] or p[y-1]
    if stack[x-1] == 0:
        p[x-1] = False

ans = 0
for i in p:
    if i:
        ans += 1
print(ans)
import sys

read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    A, B, C == map(int, readline().split())
    if A == B:
        print(C)
    elif B == C:
        print(A)
    else:
        print(B)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys

read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    A, B, C = map(int, input().split())
    if A == B:
        print(C)
    elif B == C:
        print(A)
    else:
        print(B)


if __name__ == '__main__':
    main()
W,H,x,y = input().split()
W,H,x,y = int(W),int(H),int(x),int(y)

cw = W/2
cH = H/2

if(cw==x):
    print(W*H/2)
    if(cH==y):
        print(1)
    else:
        print(0)

else:
    y0 = y-((y-cJ)/(x-cW))*x
    y1 = y-((y-cJ)/(x-cW))*(x-W)
    print((y0+y1)*W/2)
    print(0)

### FIXED CODE ###

W,H,x,y = input().split()
W,H,x,y = int(W),int(H),int(x),int(y)

cw = W/2
cH = H/2

if(cw==x):
    print(W*H/2)
    if(cH==y):
        print(1)
    else:
        print(0)

else:
    y0 = y-((y-cH)/(x-cw))*x
    y1 = y-((y-cH)/(x-cw))*(x-W)
    print((y0+y1)*W/2)
    print(0)
S,T=map(iter,input().split())
cnt=0
for s,t in zip(S,T):
  if s==t:
    cnt+=1
print(cnt)


### FIXED CODE ###

import sys
read=sys.stdin.buffer.read
S,T=map(iter,read().split())
cnt=0
for s,t in zip(S,T):
  if s==t:
    cnt+=1
print(cnt)
while 1:
 x, y = map(int, raw_input().split())
 if x <= y:
    print "%d %d" %(x,y)
 if y < x:
    print "%d %d" %(y,x)
 if x == 0 and y == 0:
    break

### FIXED CODE ###

while 1:
   x, y = map(int, raw_input().split())
   if x == 0 and y == 0:
      break
   elif x > y:
      print '%s %s' % (y,x)
   else:
      print '%s %s' % (x,y)
import sys
from bisect import bisect_left
import numpy as np


def main():
    read = sys.stdin.read

    N, K, *A = map(int, read().split())

    A.sort()
    m = bisect_left(A, 0)
    z = bisect_left(A, 1) - m
    p = N - m - z

    M = m * p
    Z = z * (N - z) + z * (z - 1) // 2
    minuses = np.array(A[:m], np.int64)
    pluses = np.array(A[-p:], np.int64)

    if K <= M:
        left = A[0] * A[-1] - 1
        right = -1
        while left + 1 < right:
            mid = (left + right) // 2
            cnt = (p - np.searchsorted(pluses, np.ceil(mid / minuses), side='left')).sum()
            if cnt < K:
                left = mid
            else:
                right = mid

        print(right)
    elif K <= M + Z:
        print(0)
    else:
        print(n)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
import numpy as np


def test(a, K):
    from itertools import combinations
    answer = []
    for i, j in combinations(a, 2):
        answer.append(i * j)
    answer.sort()
    print(answer[K - 1])


def main():
    read = sys.stdin.read

    N, K, *A = map(int, read().split())

    if N <= 10:
        test(A, K)
        exit()
    A.sort()
    A = np.array(A, np.int64)
    negative = A[A < 0]
    positive = A[A > 0]
    m = len(negative)
    p = len(positive)
    z = N - m - p

    M = m * p
    Z = z * (N - z) + z * (z - 1) // 2
    negative = -negative[::-1]
    # 負の数の操作(pythonの挙動)は頭がこんがらがるので正の数にして考える

    if K <= M:
        left = 1
        right = -A[0] * A[-1] + 1
        while left + 1 < right:
            mid = (left + right) // 2
            cnt = (p - np.searchsorted(positive, (mid + negative - 1) // negative, side='left')).sum()
            if cnt < K:
                right = mid
            else:
                left = mid
        print(-left)
    elif K <= M + Z:
        print(0)
    else:
        K -= M + Z
        left = 0
        right = max(A[0] * A[1], A[-1] * A[-2])
        positive2 = positive ** 2
        negative2 = negative ** 2
        while left + 1 < right:
            mid = (left + right) // 2
            a = np.searchsorted(negative, mid // negative, side='right').sum() - (mid >= negative2).sum()
            b = np.searchsorted(positive, mid // positive, side='right').sum() - (mid >= positive2).sum()

            if (a + b) // 2 < K:
                left = mid
            else:
                right = mid

        print(right)


if __name__ == '__main__':
    main()
from fractions import gcd

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

def gcd_calc(a):
  ans = a[0]
  for i in range(1, len(a)):
    ans = gcd(ans, a[i])
  return ans

x.sort()
for i,_x in enumerate(x):
  if (_x-X)>0:
    x.insert(i, X)
    break
list=[]
for i in range(len(x)-1):
  list.append(x[i+1]-x[i])

print(gcd_calc(list))
    

### FIXED CODE ###

from fractions import gcd

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

def gcd_calc(a):
  ans = a[0]
  for i in range(1, len(a)):
    ans = gcd(ans, a[i])
  return ans

x.sort()
cnt=0
for i,_x in enumerate(x):
  if (_x-X)>0:
    x.insert(i, X)
    cnt=1
    break
if cnt!=1:
  x.append(X)
list=[]
for i in range(len(x)-1):
  list.append(x[i+1]-x[i])

print(gcd_calc(list))
h,w=map(int,input().split())
a=0
if h=1 or w=1:
	a=1
else:
	if h%2==1 and w%2==1:
		a=(h*w+1)/2
	else:
		a=h*w/2
print(a)


### FIXED CODE ###

h,w=map(int,input().split())
a=0
if h==1 or w==1:
	a=1
else:
	if h%2==1 and w%2==1:
		a=(h*w+1)//2
	else:
		a=h*w//2
print(a)