Harryxun/stf_run huggingface dataset:
def read_pair():
    return map(int, input().strip().split())

# Read graph
N, M = read_pair()
adj = [[] for x in range(N + 1)]
for i in range(M):
    x, y = read_pair()
    adj[x].append(y)

memo = [None] * (N + 1)

def longest_path(x, memo):
    if memo[x] is not None:
        return memo[x]

    result = 0
    for y in adj[x]:
        result = max(result, 1 + longest_path(y, memo))
    memo[x] = result
    return result

result = 0
for x in range(1, N + 1):
    result = max(result, longest_path(x, memo))
print(result)


### FIXED CODE ###

from collections import deque

def read_pair():
    return map(int, input().strip().split())

# Read graph
N, M = read_pair()
adj = [[] for x in range(N)]
rev = [[] for y in range(N)]

outdegree = [0] * N
for i in range(M):
    x, y = read_pair()

    # Use 0-indexed labels
    x -= 1
    y -= 1

    adj[x].append(y)
    rev[y].append(x)
    outdegree[x] += 1

maxpath = [0] * N
q = deque()

for x in range(N):
    if outdegree[x] == 0:
        q.append(x)

while q:
    x = q.popleft()
    for y in adj[x]:
        maxpath[x] = max(maxpath[x], 1 + maxpath[y])
    for z in rev[x]:
        outdegree[z] -= 1
        if outdegree[z] == 0:
            q.append(z)

print(max(maxpath))
# coding: utf-8

import codecs
import sys

sys.stdout = codecs.getwriter("shift_jis")(sys.stdout) # ??????
sys.stdin = codecs.getreader("shift_jis")(sys.stdin) # ??\???

# ??\??¬?????????print??????????????´?????? print(u'?????????') ??¨??????
# ??\??¬?????????input??? input(u'?????????') ??§OK
# ??°?¢???????????????????????????´??????6,7???????????????????????¢??????

DEBUG = 0

if DEBUG==0:
	a = []
	for i in range(200):
		deglist=[int(x) for x in input().split(" ")]
		a.append(int_deglist)
else:
	a = [[5,7],[1,99],[1000,999]]

import math

for i in range(len(a)):
	wa = a[i][0] + a[i][1]
	keta = int(math.log(wa, 10)) + 1
	print keta

### FIXED CODE ###

# coding: utf-8

import codecs
import sys

sys.stdout = codecs.getwriter("shift_jis")(sys.stdout) # ??????
sys.stdin = codecs.getreader("shift_jis")(sys.stdin) # ??\???

# ??\??¬?????????print??????????????´?????? print(u'?????????') ??¨??????
# ??\??¬?????????input??? input(u'?????????') ??§OK
# ??°?¢???????????????????????????´??????6,7???????????????????????¢??????

"""
DEBUG = 0

if DEBUG == 0:
	a = []
	for i in range(200):
		deglist=[int(x) for x in input().split(" ")]
		a.append(deglist)
else:
	a = [[5,7],[1,99],[1000,999]]

for i in range(len(a)):
	wa = a[i][0] + a[i][1]
	print len(str(wa))
"""

while True:
	try:
		a,b = map(int, raw_input().split())
		print len(str(a+b))
	except EOFError:
		break
n=int(input())  
l=0
for i in range(len(str(n))): 
  l=l+int(n[i])
if((l%9)==0): 
  print("Yes") 
else: 
  print("No") 
  


### FIXED CODE ###

n=input() 
l=[] 
for i in range(len(str(n))): 
  l.append(int(n[i])) 
if((sum(l)%9)==0): 
  print("Yes") 
else: 
  print("No")
n,k = [int(x) for x in input().split()]
s = input()

print(s[:k-1] + s[k-1].lower + s[K:])

### FIXED CODE ###

n,k = [int(x) for x in input().split()]
s = input()

print(s[:k-1] + s[k-1].lower() + s[k:])
s = input()
a = int(s[0])
b = int(s[1])
c = int(s[2])
d = int(s[3])
op = ["+","-"]
def pc(x,y,op):
    if op == "+":
        return x + y
    elif op == "-":
        return x - y
li = []
ope = []
ans = 0
for i in op:
    ans = pc(a,b,i)
    for j in op:
        ans = pc(ans,c,j)
        for k in op:
            ans = pc(ans,d,k)
            li.append(ans)
            ope.append(str(a)+i+str(b)+j+str(c)+k+str(d)+"=7")
print(ope[li.index(7)])

### FIXED CODE ###

s = input()
a = int(s[0])
b = int(s[1])
c = int(s[2])
d = int(s[3])
if a + b + c + d == 7:
    print(str(a)+"+"+str(b)+"+"+str(c)+"+"+str(d)+"=7")
elif a + b + c - d == 7:
    print(str(a)+"+"+str(b)+"+"+str(c)+"-"+str(d)+"=7")
elif a + b - c - d == 7:
    print(str(a)+"+"+str(b)+"-"+str(c)+"-"+str(d)+"=7")
elif a - b - c - d == 7:
    print(str(a)+"-"+str(b)+"-"+str(c)+"-"+str(d)+"=7")
elif a - b - c + d == 7:
    print(str(a)+"-"+str(b)+"-"+str(c)+"+"+str(d)+"=7")
elif a - b + c + d == 7:
    print(str(a)+"-"+str(b)+"+"+str(c)+"+"+str(d)+"=7")
elif a - b + c - d == 7:
    print(str(a)+"-"+str(b)+"+"+str(c)+"-"+str(d)+"=7")
else:
    print(str(a)+"+"+str(b)+"-"+str(c)+"+"+str(d)+"=7")
N, P = map(int, input().split())
S = input()

l = len(S)
if P == 2:
    ans = 0
    for i in range(l):
        if int(S[i])%2 == 0:
            ans += i+1
elif P == 5:
    ans = 0
    for i in range(l):
        if int(S[i])%5 == 0:
            ans += i+1
else:
    data = [0]*P
    temp = 0
    for i in range(l-1, -1, -1):
        temp += int(S[i])*10**i
        temp %= P
        data[temp] += 1
    ans = data[0]
    for item in data:
        if item > 1:
            ans += item*(item-1)//2

print(ans)

### FIXED CODE ###

S = input()
if S[0] != S[1] or S[1] != S[2]:
    print("Yes")
else:
    print("No")
N,K=input().split()
D=list(map(int,input().split()))
for i in N:
    if int(i) in D:
        N[i]+=1
    else:
        pass
print(''.join(N))

### FIXED CODE ###

N,K=map(int,input().split())
D=list(map(int,input().split()))
for i in range(N,10*N+1):
    I=list(map(int,str(i)))
    match=list(set(I)&set(D))
    if len(match)==0:
        print(i)
        break
    else:
        pass
x, y = map(int,input().split())
print([x, -1][x%y])

### FIXED CODE ###

l, r = map(int,input().split())
s = range(l, r+1)[:673]
print(min(i*j % 2019 for i in s for j in s if i<j))
N = int(input())
xyh=[]
for _ in range(N):
    xyh.append(tuple(map(int, input().split())))

def func():
    for Cx in range(0, 101):
        for Cy in range(0, 101):
            H=[el[2]+abs(el[0]-Cx)+abs(el[1]-Cy) for el in xyh if el[2]!=0]
            if H>=1 and len(set(H))==1:
                temp=[H[0]-abs(el[0]-Cx)-abs(el[0]-Cy) for el in xyh if el[2]==0]
                for el in temp:
                    if el>0:
                        break
                else:
                    print(Cx, Cy, H[0])
                    return None
func()


### FIXED CODE ###

N = int(input())
xyh=[]
for _ in range(N):
    xyh.append(tuple(map(int, input().split())))

def func():
    for Cx in range(0, 101):
        for Cy in range(0, 101):
            H=[el[2]+abs(el[0]-Cx)+abs(el[1]-Cy) for el in xyh if el[2]!=0]
            if H[0]>=1 and len(set(H))==1:
                temp=[H[0]-abs(el[0]-Cx)-abs(el[1]-Cy) for el in xyh if el[2]==0]
                for el in temp:
                    if el>0:
                        break
                else:
                    print(Cx, Cy, H[0])
                    return None
func()
def dfs(v, p, c):
    res[v] = c
    for next in link[v]:
        if next[0] == p:
            continue
        if c == next[1]:
            dfs(next[0], v, c)
        else:
            dfs(next[0], v, 1-c)


N = int(input())
link = [[] * N for _ in range(N)]
res = [0] * N
for i in range(N-1):
    u, v, w = map(int, input().split())
    link[u-1].append([v-1, w % 2])
    link[v-1].append([u-1, w % 2])
print(link)
dfs(0, -1, 1)

for i in range(N):
    print(res[i])

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)

def dfs(v, p, c):
    res[v] = c
    for next in link[v]:
        if next[0] == p:
            continue
        if next[1] % 2:
            dfs(next[0], v, 1-c)
        else:
            dfs(next[0], v, c)


N = int(input())
link = [[] * N for _ in range(N)]
res = [0] * N
for i in range(N-1):
    u, v, w = map(int, input().split())
    link[u-1].append([v-1, w])
    link[v-1].append([u-1, w])

dfs(0, -1, 1)

for i in range(N):
    print(res[i])
a,b,c,d = map(int,input().split())

while a =< 0:
  c = c - b
  if c <= 0:
    print('Yes')
    exit()
  a = a - d

print("no")

### FIXED CODE ###

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

while a > 0:
  c = c - b
  if c <= 0:
    print('Yes')
    exit()
  a = a - d

print("No")
a,b,c = map(int,input().split())

if a==b b!=c:
  print("Yes")
elif c==b b!=a:
  print("Yes")
elif a!=b b=c:
  print("Yes"):
else:
  print("No")

### FIXED CODE ###

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

if a==b and b==c:
  print("No")
elif a==b or b==c or c==a :
  print("Yes")
  
else:
  print("No")
n =int(input())
a=list(map(int, input().split()))
m=0
s=[]
for i in range(len(a)):
    m+=a[i]
    s.append(abs(sum(a)-m*2))
    if min(s)<s[i+1]:
        break
print(min(s))

### FIXED CODE ###

n =int(input())
a=list(map(int, input().split()))
m=0
s=[]
suma=sum(a)
for i in range(len(a)):
    m+=a[i]
    s.append(abs(suma-m*2))
print(min(s))
def gcd(a, b):
    if a == 0:
        return b
    return gcd(b%a, a)

def lcm(a,b):
    return a*b/gcd(a,b)

if __name__ == '__main__':
    n = int(input())
    a = list(map(int, input().split()))
    l = int(1)
    for e in a:
        l = lcm(l,e)
    s = int(0)
    for e in a:
        s += l/e
    mod = int(1000000007)
    print(int(s % mod))


### FIXED CODE ###

def gcd(a, b):
    if a == 0:
        return b
    return gcd(b%a, a)

def lcm(a,b):
    return a*b//gcd(a,b)

if __name__ == '__main__':
    n = int(input())
    a = list(map(int, input().split()))
    l = int(1)
    for e in a:
        l = lcm(l,e)
    s = int(0)
    for e in a:
        s += l//e
    mod = int(1000000007)
    print(int(s % mod))
# n <= 10**5
n = int(input())
# vi <= 10**5
v = list(map(int, input().split()))
a = [[0, 0] for _ in range(100010)]
for i in range(n):
    a[i % 2][v[i]] += 1

od, ev = [], []
for i in range(100010):
    od.append([a[1][i], i])
    ev.append([a[0][i], i])
od.sort()
od.reverse()
ev.sort()
ev.reverse()
if od[0][1] != ev[0][1]: print(n - od[0][0] - ev[0][0])
else: print(n - max(od[0][0] + ev[[0][1], od[1][0] + ev[0][0]))

### FIXED CODE ###

import itertools
"""
n = int(input())
m, a, r, c, h = [0] * 5
for i in range(n):
    s = input()
    if s[0] == "M": m += 1
    if s[0] == "A": a += 1
    if s[0] == "R": r += 1
    if s[0] == "C": c += 1
    if s[0] == "H": h += 1
x = [m, a, r, c, h]
y = ["M", "A", "R", "C", "H"]
ans = 0
for i in itertools.combinations(x, 3):
    ans += i[0] * i[1] * i[2]
print(ans)
"""

# n <= 10**5
n = int(input())
# vi <= 10**5
v = list(map(int, input().split()))
a = [[0] * 100010 for _ in range(2)]
for i in range(n):
    a[i % 2][v[i]] += 1

od, ev = [], []
for i in range(100010):
    od.append([a[1][i], i])
    ev.append([a[0][i], i])
od.sort()
od.reverse()
ev.sort()
ev.reverse()
if od[0][1] != ev[0][1]: print(n - od[0][0] - ev[0][0])
else: print(n - max(od[0][0] + ev[1][0], od[1][0] + ev[0][0]))
A,B=map(int,input().split())
 
if A>B or A==1 not B==1:
  print("Alice")
elif A==B:
  print("Draw")
else:    
  print("Bob")

### FIXED CODE ###

A,B=map(int,input().split())
 
if A==B:
  print("Draw")
elif B==1:
  print("Bob")
elif B>1 and A==1 or A>B:
  print("Alice")
else:
  print("Bob")
N = int(input())

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

ans = [0]*N
[ans[i-1]=i+1 for i, j in range(N)]
print(*ans)

### FIXED CODE ###

N = int(input())

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

ans = [0]*N
for i,j in enumerate(A):
    ans[j-1]=i+1
print(*ans)
N, K = map(int, input().split())
H = sorted([int(input()) for _ in range(N)])

ans = 10**9
for i in range(N-2):
    diff = H[i+K-1] - H[i]
    if diff < ans:
        ans = diff
print(ans)

### FIXED CODE ###

N, K = map(int, input().split())
h = [int(input()) for _ in range(N)]
h = sorted(h)

m = []
for i in range(N-K+1):
    m.append(h[i+K-1] - h[i])
print(min(m))
s = list(input())
s.sort()

if s[0]==s[1] and s[2]==s[3] ans s[0]!=s[2]:
    ans = "Yes"
else:
    ans = "No"

print(ans)

### FIXED CODE ###

s = list(input())
s.sort()

if s[0]==s[1] and s[2]==s[3] and s[0]!=s[2]:
    ans = "Yes"
else:
    ans = "No"

print(ans)
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
def main():
    N, W = map(int, readline().split())
    INF = int(1e5)+100
    weight = [0 for _ in range(110)]
    value = [0 for _ in range(110)] 
    for i in range(N):
        w, v = map(int, readline().split())
        weight[i] = w
        value[i] = v
    dp = [[0 for _ in range(INF)] for _ in range(110)]
    for i in range(N):
        for sum_w in range(W+1):
            if sum_w - weight[i] >= 0:
                dp[i+1][sum_w] = max(dp[i+1][sum_w], dp[i][sum_w-weight[i]] + value[i]) 
            dp[i+1][sum_w] = max(dp[i+1][sum_w], dp[i][sum_w])
    print(dp[N][W])
if __name__ == '__main__':
    main()


### FIXED CODE ###

#python3

def main():
    n = int(input())
    a = []
    for _ in range(n):
        x, y, z = map(int, input().split())
        a.append((x, y, z))

    dp = [[0 for _ in range(3)] for _ in range(10*n)]

    for i in range(n):
        for j in range(3):
            for k in range(3):
                if j == k:
                    continue
                dp[i+1][j] = max(dp[i+1][j], dp[i][k] + a[i][j])

    ans = max(dp[n])
    print(ans)
main()
N,K=map(int,input().split())
A=list(map(int,input().split()))
L=[]
A.sort()
A.append(200001)
for i in range(N):
  if A[i]==A[i+1]:
    continue
  else:
    x=A.count(A[i])
    L.append(x)
L.sort(reverse=True)
S=0
for i in range(K):
  S+=L[i]
print(N-S)

### FIXED CODE ###

S1,S2,S3=map(int,input())
print(S1+S2+S3)
N = int(input())
A = [input().split() for l in range(N)]
B = [input().split() for l in range(N)]
C = [input().split() for l in range(N-1)]
ans = 0

for i in range(N):
  ans = ans + B[A[i]]
  if i == 0:
    ans = ans
  else if A[i] == A[i-1] + 1:
    ans + C[i]
print(ans)

### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
 
point = sum(B)
for i in range(N-1):
  if A[i]==A[i+1]-1:
    point +=C[A[i]-1]
print(point)
def main():
    s = input()
    if s[0] == 'S':
        print('Cloudy')
    elif s[0] == 'C':
        print('Rainy')
    else:
        print('Sunny)

if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    s = input()
    if s[0] == 'S':
        print('Cloudy')
    elif s[0] == 'C':
        print('Rainy')
    else:
        print('Sunny')

if __name__ == '__main__':
    main()
import math
for i in range(1, k):
    for j in range(1, k):
        temp = math.gcd(i, j)
        for x in range(1,k):
            sum += math.gcd(temp,x)


print(sum)

### FIXED CODE ###

import math
sum = 0
k = int(input())+1
for i in range(1, k):
    for j in range(1, k):
        temp = math.gcd(i, j)
        for x in range(1, k):
            sum += math.gcd(temp, x)
print(sum)
from itertools import accumulate

def main():
    def int n, k, i, j, ans, num, cnt, b
    def list a, btfl
    n, k = map(int, input().split())
    a = [0] + list(accumulate(map(int, input().split())))

    btfl = []
    for i in range(0, n):
        for j in range(i + 1, n + 1):
            btfl.append(a[j] - a[i])

    # 解説AC
    ans = 0
    for i in range(50)[::-1]:
        num, cnt = ans + pow(2, i), 0
        for b in btfl:
            if num == num & b:
                cnt += 1
        if cnt >= k:
            ans = num
    print(ans)

if __name__ == '__main__':
    main()


### FIXED CODE ###

from itertools import accumulate
n, k = map(int, input().split())
a = [0] + list(accumulate(map(int, input().split())))

btfl = []
for i in range(0, n):
    for j in range(i + 1, n + 1):
        btfl.append(a[j] - a[i])

# 解説AC
ans = 0
for i in range(50)[::-1]:
    num, cnt = ans + pow(2, i), 0
    for b in btfl:
        if num == num & b:
            cnt += 1
    if cnt >= k:
        ans = num
print(ans)
k,s=map(int, input().split())

for i in range(k+1):
  for j in range(k+1):
    x = s-i-j
    if x>=0 and x<=k:
      ans += 1

print(ans)

### FIXED CODE ###

k,s=map(int, input().split())
ans = 0
for i in range(k+1):
  for j in range(k+1):
    x = s-i-j
    if x>=0 and x<=k:
      ans += 1

print(ans)
a, b = input().split()
if a == b: print 'H'
else: print 'D'

### FIXED CODE ###

a, b = input().split()
if a == b: print('H')
else: print('D')
N, M = map(int, input().split())
graph = {i+1:[] for i in range(N)}

for _ in range(M):
    x, y = map(int, input().split())
    graph[x].append(y)

"""
dp[v]: ノードv(1~N)を始点とした時の、最大長
"""
dp = [0] * (1+N)

def max_length_from(v):
    if dp[v] != 0:
        return dp[v]
    max_length = 0
    for vv in graph[v]:
        tmp = max_length_from(vv) + 1
        if tmp > max_length:
            max_length = tmp
    dp[v] = max_length
    return max_length

for v in range(1, N+1):
    max_length_from(v)

print(max(dp))


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**5+1)

N, M = map(int, input().split())
graph = {i+1:[] for i in range(N)}

for _ in range(M):
    x, y = map(int, input().split())
    graph[x].append(y)

"""
dp[v]: ノードv(1~N)を始点とした最大長
"""
dp = [0] * (1+N)

def max_length_from(v):
    if dp[v] != 0:
        return dp[v]
    max_length = 0
    for vv in graph[v]:
        tmp = max_length_from(vv) + 1
        if tmp > max_length:
            max_length = tmp
    dp[v] = max_length
    return max_length

for v in range(1, N+1):
    max_length_from(v)

print(max(dp))
num = lambda c: chr(c+64)
s = str(input())

for i in range(1,26):
	if s == num(i).lower:
      print(num(i+1))



### FIXED CODE ###

s = str(input())

print(chr(ord(s) + 1))
n,k,q = (int(i) for i in input().split())
a = [k]*n
d = [0] + [a[i]-a[i-1] for i in range(1,n)]
for i in range(q):
	x = int(input())-1
	d[0]-=1
	d[x]+=1
	d[x+1]-=1
a[0]+=d[0]
for i in range(1,n): a[i] = a[i-1]+d[i]
for i in range(n):print("Yes" if a[i]>0 else "No")


### FIXED CODE ###

n,k,q = (int(i) for i in input().split())
a = [k]*n
d = [0]*(n+1)
for i in range(q):
	x = int(input())-1
	d[0]-=1
	d[x]+=1
	d[x+1]-=1
a[0] += d[0]
for i in range(1,n):
	a[i] = a[i-1] + d[i]
for i in range(n):
	print("Yes" if a[i]>0 else "No")
a,b,c = map(int,input().split())
if a+b <= c:
  print("Yes)
else:
  print("No")

### FIXED CODE ###

a,b,c = map(int,input().split())
if a+b >= c:
	print("Yes")
else:
	print("No")
dy = [0, 0, 1, -1]
dx = [1, -1, 0, 0]


def bfs(start, goal):
    q = [[start]]
    while len(q) > 0:
        path = q.pop(0)
        n = path[len(path) - 1]
        if n == goal:
            return path
        else:
            for sy, sx in zip(dy, dx):
                py = n[0] + sy
                px = n[1] + sx
                if py < 0 or H <= py:
                    continue
                if px < 0 or W <= px:
                    continue
                if S[py][px] == "#":
                    continue
                if visited[py][px]:
                    continue
                visited[py][px] = True
                x = (py, px)
                if x not in path:
                    new_path = path[:]
                    new_path.append(x)
                    q.append(new_path)

H, W = map(int, input().split())
S = []
for i in range(H):
    S.append([c for c in input()])
# print(S)
visited = [[False for _ in range(W)] for _ in range(H)]
start = (0, 0)
goal = (H-1, W-1)
ans = bfs(start, goal)
# print(ans)
counter = 0
for i in range(H):
    for j in range(W):
        if (i, j) in ans:
            continue
        if S[i][j] == ".":
            counter += 1
print(counter)


### FIXED CODE ###

dy = [0, 0, 1, -1]
dx = [1, -1, 0, 0]


def bfs(start, goal):
    q = [[start]]
    while len(q) > 0:
        path = q.pop(0)
        n = path[len(path) - 1]
        if n == goal:
            return path
        else:
            for sy, sx in zip(dy, dx):
                py = n[0] + sy
                px = n[1] + sx
                if py < 0 or H <= py:
                    continue
                if px < 0 or W <= px:
                    continue
                if S[py][px] == "#":
                    continue
                if visited[py][px]:
                    continue
                visited[py][px] = True
                x = (py, px)
                if x not in path:
                    new_path = path[:]
                    new_path.append(x)
                    q.append(new_path)
    return None


H, W = map(int, input().split())
S = []
for i in range(H):
    S.append([c for c in input()])
# print(S)
visited = [[False for _ in range(W)] for _ in range(H)]
start = (0, 0)
goal = (H-1, W-1)
ans = bfs(start, goal)
if ans is None:
    print(-1)
    exit()
# print(ans)
counter = 0
for i in range(H):
    for j in range(W):
        if (i, j) in ans:
            continue
        if S[i][j] == ".":
            counter += 1
print(counter)
import sys
readline = sys.stdin.readline

def count(A, B, x):
    N = len(A)
    M = len(B)
    res = 0
    r = -1
    for l in range(N):
        a = A[l]
        while r < M-1 and B[r+1]*a <= x:
            r += 1
        res += r+1
    return res

def count2(A, x):
    res = 0
    for a in A:
        if a*a <= x:
            res += 1
    return res
        

N, K = map(int, readline().split())
A = list(map(int, readline().split()))
Am = []
Ap = []

minus = 0
zero = 0
plus = 0
for a in A:
    if a < 0:
        minus += 1
        Am.append(-a)
    elif a == 0:
        zero += 1
    else:
        plus += 1
        Ap.append(a)

ms = minus*plus
zs = ms + zero*(minus+plus) + zero*(zero-1)//2

Am.sort()
Ap.sort()
Amr = Am[::-1]
Apr = Ap[::-1]

if K <= ms:
    K = ms+1-K
    ok = max(max(Am), max(Ap))**2
    ng = 0
    while abs(ok-ng)>1:
        med = (ok+ng)//2
        if count(Amr, Ap, med) >= K:
            ok = med
        else:
            ng = med
    ans = -ok
elif K <= zs:
    ans = 0
else:
    K -= zs
    ok = max(max(Am), max(Ap))**2
    ng = 0
    while abs(ok-ng)>1:
        med = (ok+ng)//2
        if (count(Amr, Am, med) + count(Apr, Ap, med) - count2(Am, med) - count2(Ap, med))//2 >= K:
            ok = med
        else:
            ng = med
    ans = ok

print(ans)
    
    



### FIXED CODE ###

import sys
readline = sys.stdin.readline

def count(A, B, x):
    N = len(A)
    M = len(B)
    res = 0
    r = -1
    for l in range(N):
        a = A[l]
        while r < M-1 and B[r+1]*a <= x:
            r += 1
        res += r+1
    return res

def count2(A, x):
    res = 0
    for a in A:
        if a*a <= x:
            res += 1
    return res
        

N, K = map(int, readline().split())
A = list(map(int, readline().split()))
Am = []
Ap = []

minus = 0
zero = 0
plus = 0
for a in A:
    if a < 0:
        minus += 1
        Am.append(-a)
    elif a == 0:
        zero += 1
    else:
        plus += 1
        Ap.append(a)

ms = minus*plus
zs = ms + zero*(minus+plus) + zero*(zero-1)//2

Am.sort()
Ap.sort()
Amr = Am[::-1]
Apr = Ap[::-1]

if K <= ms:
    K = ms+1-K
    ok = max(max(Am+[0]), max(Ap+[0]))**2
    ng = 0
    while abs(ok-ng)>1:
        med = (ok+ng)//2
        if count(Amr, Ap, med) >= K:
            ok = med
        else:
            ng = med
    ans = -ok
elif K <= zs:
    ans = 0
else:
    K -= zs
    ok = max(max(Am+[0]), max(Ap+[0]))**2
    ng = 0
    while abs(ok-ng)>1:
        med = (ok+ng)//2
        if (count(Amr, Am, med) + count(Apr, Ap, med) - count2(Am, med) - count2(Ap, med))//2 >= K:
            ok = med
        else:
            ng = med
    ans = ok

print(ans)
a = int(input())
b = int(input())

print(a * b)

### FIXED CODE ###

a,b = input().split()
print(int(a) * int(b))
n,*t=map(int,open(0).read().split())
print(sum([i*(-1)**i for i in t])

### FIXED CODE ###

n,*x=map(int,open(0).read().split());a=0;t=1;x.sort()
while x:a+=t*x.pop();t*=-1
print(a)
n = int(input())
lis = list(map(int,input().split()))
ans = 0
for i in range(n):
  if lis[lis[i]] == i+1:
    ans += 1
print(ans//2)

### FIXED CODE ###

n = int(input())
cou = 0
ans = 1
lis = list(map(int,input().split()))
for i in range(n):
    a = lis[i]
    if lis[a-1] == i + 1:
        ans += 1
print(ans//2)
from collections import Counter
n = int(input())
a = [int(input()) for _ in range(n)]

cnt = Counter(a).value()


flg = 0
for i in cnt:
    if i%2 == 1:
        flg += 1

print(flg)

### FIXED CODE ###

from collections import Counter
n = int(input())
a = [int(input()) for _ in range(n)]

cnt = Counter(a).values()


flg = 0
for i in cnt:
    if i%2 == 1:
        flg += 1

print(flg)
n=int(input())
a=[int(i) for i in input().split()]
count=0
for ai in a:
    if ai%2==0:
        while ai!=1:
            ai=ai/=2
            count+=1
print(count)

### FIXED CODE ###

n=int(input())
a=[int(i) for i in input().split()]
count=0
for ai in a:
        while ai%2==0:
            ai=ai/2
            count+=1
print(count)