Buggy python submission (verdict: Time Limit Exceeded):
# 小さい方からk番目がx
# x以下がk個以上となる最小のx
# 負の数のところでバグってそう
from bisect import bisect_left, bisect_right

import sys

input = sys.stdin.buffer.readline


# a = "741 18295"
# b = "0 -944604971 163850760 -827469336 0 0 -567306763 -539557168 -668117519 -292165078 -473024712 619911708 469512645 -509527159 557226680 343170465 632157591 967554158 504453921 -373413032 -481024329 790180891 -915613113 0 -736270693 -610724937 313212702 -825980196 -511433631 0 -73003526 556921685 -674073325 540326700 226569243 750843585 0 -876569485 194464476 352358500 -924793067 -262188798 737902336 -814375754 -765816988 -751999182 474994777 627485128 538809282 -540999707 835048049 -507238187 -335743110 783445780 0 863185652 961347691 -729691353 -36464643 0 687200797 562804136 512837657 38470649 -396521334 1055537 480925646 -159885657 967284206 567001310 627582457 443859969 -233421845 0 -197566446 -655433696 457745299 -976460305 511266544 -632081106 -633576360 674087426 -692273586 -952015422 672433704 -487881699 -358216620 -929025323 655267646 0 285012259 114525673 140537143 284754636 35666722 -448619054 0 -54681909 -949366577 0 895203953 -885689301 387221463 0 -20040181 0 -293349382 0 -638089978 -72892329 530125410 877165207 67006005 139085790 180550757 856610842 -32703032 807567663 -939969500 -994479848 892140554 -479563688 71423548 -63617349 -161534891 766849703 -528926971 0 -481863095 -589145043 0 876416878 -43951911 -513502389 743571442 879410975 646452261 419813042 517856396 -23117399 -700971910 886969690 823977751 0 -807903085 980900226 0 -892513253 975108732 73963607 -505682572 740578661 -70623025 0 700889390 -640055074 642773682 -131712204 -480212612 -182466624 -725743035 -318626445 0 827268789 -276685512 -119660752 0 100796043 -396484472 0 -846999662 244395677 -813360771 794185827 0 -603624171 -28149489 579573779 838151548 -147625503 -149255441 -462131556 -822520414 0 -430121187 -149906952 0 498452983 301955741 -864882218 0 -4653076 170268522 620905464 597912591 5953098 0 835766287 -624231736 63054509 -441228606 -944089940 955750287 -295465544 846359331 420142518 -665700347 0 -553629559 395484971 0 781527156 -717286491 327052812 472254359 -414846234 262596365 959419364 -913266879 -21048747 0 -976832480 108172954 0 -905847678 -744891786 0 -584849412 969549845 -614049666 -61140287 -190519824 -294254920 261967812 406344153 923535467 346959337 -332655725 889593029 -858799360 457563451 -542211309 -812014769 -233295680 422985391 496621893 -356065450 7695042 -912895181 -10057863 880124709 -658232655 927784204 682042201 4939894 -409980735 0 -944835547 -382450480 797627065 168837269 27057276 -946483531 226722845 -112888586 899614742 -271875315 -468542718 -621425356 141629501 -484296269 22548698 367346609 -442957229 -949986924 -902128982 -539417609 971168746 -821875417 531772085 572540056 -803900351 -5800801 0 0 82621185 -447916433 497150043 -401756678 846979091 0 927601788 153213925 378926831 984099051 -831314734 -941096372 890361249 292570039 689834998 0 -44230769 0 -22397109 -408285606 -495794851 -737232026 0 607191664 0 -376118281 -558330604 -80592679 -94436734 945922704 361660687 0 -818214797 321363646 314235491 0 432889174 892617791 -244204723 -168202141 565982216 -547818442 432531174 461022234 243610027 0 -16576371 -268369543 395683623 -667108611 -174011649 -396639226 0 -962431425 391405155 187807118 101375719 0 730999200 707215086 -908789821 -716462633 -958693752 0 -593684603 394156182 -351128792 730720853 94876138 1815081 359855830 102912726 -819745426 -225305180 285157338 0 -926470985 0 830055498 -435501098 749612894 22645127 953406518 0 584921947 -300310045 -227724990 -84575937 916847586 513364539 576043344 988774131 -485986790 0 -515784818 438562968 740413485 218224389 446603913 25610907 0 -679769281 576472324 -138922882 883548751 -689783820 579068628 494729760 980936358 588070346 -646655994 35237791 0 821835484 783982928 752424725 791473956 -375197855 -726353611 -832614864 100268555 -43763344 -361897521 -782596016 -589663695 -468807230 -167905473 -965112201 370024944 -962801521 867031846 314284540 -941774513 -318774963 798589112 635175698 -781375632 -565586693 -193430841 992884142 486475538 672620109 624227475 584173260 -143526982 472114435 -984334949 0 73957169 635166940 61245559 -49830041 905588071 0 191162857 -823376405 -539634181 -913999368 877689662 -610600114 293510 0 0 0 624383905 719173499 -709316951 92750812 373141226 -667699567 -50666309 119217712 995449598 918696106 0 206341999 334400777 -962089869 857693082 653584457 450520629 294948967 -823813787 -185307531 -704619055 -314883423 -882046674 312027655 -779069276 588555192 0 -866646065 -650153884 447977035 -836127502 0 0 756756109 -757180731 450188479 0 468774036 0 858704256 254876591 641888020 28664564 331434870 -447595997 203993718 476886332 335749513 450968901 362813438 0 380696203 351758262 -669619199 -314118301 445563156 -22648320 -907366660 267172605 0 -462126229 0 -649798250 -290421592 691271508 0 -617507283 444088835 -202589368 0 956892218 0 548691212 478800012 0 -684691812 508252851 -992525165 -175608410 927069397 164000739 172129785 315419070 -756168852 97189416 0 -49021149 220954428 993268503 531147244 411064222 328739625 -745130857 -412683549 -821867104 467751061 306336744 823456327 -128258507 903961864 856193785 943839490 0 65998168 414460670 -534104777 -704745004 -498089192 -453398252 -790319652 151699473 41160544 714164425 971355380 -585224030 -663718660 380185368 -924739649 -750255491 -657212141 -433060872 725797173 -117878479 -563871342 258275442 96041025 0 132634395 898410047 453111755 46978505 -967224209 483288939 833675813 292529832 -968574609 -848845118 854179952 -242844625 0 303999832 860011202 62318789 -470111180 910716653 521304550 959486483 -332194428 600201899 63548755 719966624 -77082567 -556855462 408858101 191120890 739217171 -532601651 978716434 -187832237 0 -87730630 796838136 -826118218 -159297019 0 -30966363 -689195811 -650199018 702008135 -624133748 -795766502 0 0 445340936 -157836564 -555044674 -792793581 -368718137 -731420898 673635029 660729345 71241370 161642360 -420784573 239773067 1923203 -843341566 -724395064 228029545 -440889284 738907608 178046556 -156538177 183199906 34908378 962982022 103763236 362013393 351273920 495917956 -678820463 0 328416395 -430072811 201288277 409996000 952711858 0 190660608 -984913537 -954795430 -249641295 612727537 546403703 -927680719 -542039708 660184484 6973348 -195863546 -455574942 -309429937 -434905940 733083847 321861722 -291889385 0 -913654120 169564367 -708322888 151533835 280484198 23341399 0 -286762271 -329248490 387585092 358239528 -290246246 -180667870 0 -82881504 916016386 -9016315 706907186 -519929490 322108840 -148074634 565300074 -405484196 159232988 -522814351 29823158 0 861305894 -307234892 178044015 17084083 695457272 409943147 -659372091 612664126 -238100341 0 -948691193 725206741 -961090744 233522937 368326432 -506835491 0 641159373 982378286 868978100 -355868558 883247416 0 -521140724 -10020067 -755443674 227112115 -971621319 -61164629 -945833908 -944717768 -507539440 -108790636 -194959882 753585064 -440813178 636561695 917744785 656086515"
# n, k = map(int, a.split())
# A = list(map(int, b.split()))
n, k = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
minusA = bisect_left(A, 0)
mA = A[:minusA]

zeroA = bisect_right(A, 0) - bisect_left(A, 0)
plusA = n - minusA - zeroA
pA = A[-plusA:]
minus = minusA * plusA
plus = plusA * (plusA - 1) // 2 + minusA * (minusA - 1) // 2
zero = zeroA * (zeroA - 1) // 2 + (n - zeroA) * zeroA


# x以下の数を数える
def calc(x):
    mmA = mA[::-1]
    res = 0
    if x > 0:
        lim = plusA - 1
        for i in range(plusA):
            while lim >= 0:
                if pA[i] * pA[lim] > x:
                    lim -= 1
                else:
                    break
            res += lim + 1
            if lim >= i:
                res -= 1
        lim = minusA - 1
        mmA = mA[::-1]
        for i in range(minusA):
            while lim >= 0:
                if mmA[i] * mmA[lim] > x:
                    lim -= 1
                else:
                    break
            res += lim + 1
            if lim >= i:
                res -= 1
        res //= 2
        res += minus + zero
    elif x == 0:
        res += minus + zero
    else:
        # 正の数、左絶対値小さい
        # 負の数、左絶対値大きい
        lim = minusA - 1
        for i in range(plusA):
            while lim >= 0:
                if pA[i] * mmA[lim] <= x:
                    lim -= 1
                else:
                    break
            res += minusA - (lim + 1)
    return res


ng = -(10 ** 20)
ok = 10 ** 20
while ok - ng > 1:
    mid = (ok + ng) // 2
    if calc(mid) >= k:
        ok = mid
    else:
        ng = mid

print(ok)


Fixed submission:
# 小さい方からk番目がx
# x以下がk個以上となる最小のx
# 負の数のところでバグってそう
from bisect import bisect_left, bisect_right

import sys

input = sys.stdin.buffer.readline

n, k = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
minusA = bisect_left(A, 0)
mA = A[:minusA]

zeroA = bisect_right(A, 0) - bisect_left(A, 0)
plusA = n - minusA - zeroA
pA = A[-plusA:]
minus = minusA * plusA
plus = plusA * (plusA - 1) // 2 + minusA * (minusA - 1) // 2
zero = zeroA * (zeroA - 1) // 2 + (n - zeroA) * zeroA


# x以下の数を数える
def calc(x):
    mmA = mA[::-1]
    res = 0
    if x > 0:
        lim = plusA - 1
        for i in range(plusA):
            while lim >= 0:
                if pA[i] * pA[lim] > x:
                    lim -= 1
                else:
                    break
            res += lim + 1
            if lim >= i:
                res -= 1
        lim = minusA - 1
        mmA = mA[::-1]
        for i in range(minusA):
            while lim >= 0:
                if mmA[i] * mmA[lim] > x:
                    lim -= 1
                else:
                    break
            res += lim + 1
            if lim >= i:
                res -= 1
        res //= 2
        res += minus + zero
    elif x == 0:
        res += minus + zero
    else:
        # 正の数、左絶対値小さい
        # 負の数、左絶対値大きい
        lim = minusA - 1
        for i in range(plusA):
            while lim >= 0:
                if pA[i] * mmA[lim] <= x:
                    lim -= 1
                else:
                    break
            res += minusA - (lim + 1)
    return res


ng = -(10 ** 20)
ok = 10 ** 20
while ok - ng > 1:
    mid = (ok + ng) // 2
    if calc(mid) >= k:
        ok = mid
    else:
        ng = mid

print(ok)

Buggy python submission (verdict: Runtime Error):
# 片方、しゃくとりにして高速化
from bisect import bisect_left, bisect_right

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

zero_num = bisect_right(A, 0) - bisect_left(A, 0)
minus_num = bisect_left(A, 0)
plus_num = n - (zero_num + minus_num)
AP = A[zero_num + minus_num :]
AM = A[:minus_num]
RAM = AM[::-1]
plus = plus_num * (plus_num - 1) // 2 + minus_num * (minus_num - 1) // 2
zero = zero_num * (zero_num - 1) // 2 + zero_num * (n - zero_num)
minus = plus_num * minus_num

# ↑ここまでで正負の積の数をそれぞれ求めておく。


def count(x):
    cnt = 0
    if x > 0:
        right = plus_num
        for left in range(plus_num):
            seki = AP[left] * AP[right - 1]
            while seki > x and right > 0:
                right -= 1
                seki = AP[left] * AP[right - 1]
            cnt += right
        for i in range(plus_num):
            if AP[i] ** 2 <= x:
                cnt -= 1
        right = minus_num
        for left in range(minus_num):
            seki = RAM[left] * RAM[right - 1]
            while seki > x and right > 0:
                right -= 1
                seki = RAM[left] * RAM[right - 1]
            cnt += right
        for i in range(minus_num):
            if RAM[i] ** 2 <= x:
                cnt -= 1
        cnt //= 2
        cnt += minus + zero
    elif x < 0:
        right = minus_num
        for left in range(plus_num):
            seki = AP[left] * AM[right - 1]
            while seki > x and right > 0:
                right -= 1
                seki = AP[left] * RAM[right - 1]
            cnt += right
    else:
        cnt = minus + zero
    return cnt


ok = 10 ** 20
ng = -(10 ** 20)
while ok - ng > 1:
    mid = (ok + ng) // 2
    if count(mid) >= k:
        ok = mid
    else:
        ng = mid
print(ok)


Fixed submission:
# 小さい方からk番目がx
# x以下がk個以上となる最小のx
# 負の数のところでバグってそう
from bisect import bisect_left, bisect_right

import sys

input = sys.stdin.buffer.readline

n, k = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
minusA = bisect_left(A, 0)
mA = A[:minusA]

zeroA = bisect_right(A, 0) - bisect_left(A, 0)
plusA = n - minusA - zeroA
pA = A[-plusA:]
minus = minusA * plusA
plus = plusA * (plusA - 1) // 2 + minusA * (minusA - 1) // 2
zero = zeroA * (zeroA - 1) // 2 + (n - zeroA) * zeroA


# x以下の数を数える
def calc(x):
    mmA = mA[::-1]
    res = 0
    if x > 0:
        lim = plusA - 1
        for i in range(plusA):
            while lim >= 0:
                if pA[i] * pA[lim] > x:
                    lim -= 1
                else:
                    break
            res += lim + 1
            if lim >= i:
                res -= 1
        lim = minusA - 1
        mmA = mA[::-1]
        for i in range(minusA):
            while lim >= 0:
                if mmA[i] * mmA[lim] > x:
                    lim -= 1
                else:
                    break
            res += lim + 1
            if lim >= i:
                res -= 1
        res //= 2
        res += minus + zero
    elif x == 0:
        res += minus + zero
    else:
        # 正の数、左絶対値小さい
        # 負の数、左絶対値大きい
        lim = minusA - 1
        for i in range(plusA):
            while lim >= 0:
                if pA[i] * mmA[lim] <= x:
                    lim -= 1
                else:
                    break
            res += minusA - (lim + 1)
    return res


ng = -(10 ** 20)
ok = 10 ** 20
while ok - ng > 1:
    mid = (ok + ng) // 2
    if calc(mid) >= k:
        ok = mid
    else:
        ng = mid

print(ok)

Buggy python submission (verdict: Runtime Error):
# 片方、しゃくとりにして高速化
from bisect import bisect_left, bisect_right

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

zero_num = bisect_right(A, 0) - bisect_left(A, 0)
minus_num = bisect_left(A, 0)
plus_num = n - (zero_num + minus_num)
AP = A[zero_num + minus_num :]
AM = A[:minus_num]
RAM = AM[::-1]
plus = plus_num * (plus_num - 1) // 2 + minus_num * (minus_num - 1) // 2
zero = zero_num * (zero_num - 1) // 2 + zero_num * (n - zero_num)
minus = plus_num * minus_num

# ↑ここまでで正負の積の数をそれぞれ求めておく。


def count(x):
    cnt = 0
    if x > 0:
        right = plus_num  # 半開区間で考えるので[0,1)から始める
        for left in range(plus_num):
            seki = AP[left] * AP[right - 1]
            while seki > x and right > 0:
                right -= 1
                seki = AP[left] * AP[right - 1]
            cnt += right
        for i in range(plus_num):
            if AP[i] ** 2 <= x:
                cnt -= 1
        right = minus_num
        for left in range(minus_num):
            seki = RAM[left] * RAM[right - 1]
            while seki > x and right > 0:
                right -= 1
                seki = RAM[left] * RAM[right - 1]
            cnt += right
        for i in range(minus_num):
            if RAM[i] ** 2 <= x:
                cnt -= 1
        cnt //= 2
        cnt += minus + zero
    elif x < 0:
        right = 1  # 半開区間で考えるので[0,1)から始める
        for left in range(plus_num):
            seki = AP[left] * RAM[right - 1]
            while seki > x and right < minus_num:
                right += 1
                seki = AP[left] * RAM[right - 1]
            cnt += minus_num - right + 1
    else:
        cnt = minus + zero
    return cnt


ok = 10 ** 20
ng = -(10 ** 20)
while ok - ng > 1:
    mid = (ok + ng) // 2
    if count(mid) >= k:
        ok = mid
    else:
        ng = mid
print(ok)


Fixed submission:
# 小さい方からk番目がx
# x以下がk個以上となる最小のx
# 負の数のところでバグってそう
from bisect import bisect_left, bisect_right

import sys

input = sys.stdin.buffer.readline

n, k = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
minusA = bisect_left(A, 0)
mA = A[:minusA]

zeroA = bisect_right(A, 0) - bisect_left(A, 0)
plusA = n - minusA - zeroA
pA = A[-plusA:]
minus = minusA * plusA
plus = plusA * (plusA - 1) // 2 + minusA * (minusA - 1) // 2
zero = zeroA * (zeroA - 1) // 2 + (n - zeroA) * zeroA


# x以下の数を数える
def calc(x):
    mmA = mA[::-1]
    res = 0
    if x > 0:
        lim = plusA - 1
        for i in range(plusA):
            while lim >= 0:
                if pA[i] * pA[lim] > x:
                    lim -= 1
                else:
                    break
            res += lim + 1
            if lim >= i:
                res -= 1
        lim = minusA - 1
        mmA = mA[::-1]
        for i in range(minusA):
            while lim >= 0:
                if mmA[i] * mmA[lim] > x:
                    lim -= 1
                else:
                    break
            res += lim + 1
            if lim >= i:
                res -= 1
        res //= 2
        res += minus + zero
    elif x == 0:
        res += minus + zero
    else:
        # 正の数、左絶対値小さい
        # 負の数、左絶対値大きい
        lim = minusA - 1
        for i in range(plusA):
            while lim >= 0:
                if pA[i] * mmA[lim] <= x:
                    lim -= 1
                else:
                    break
            res += minusA - (lim + 1)
    return res


ng = -(10 ** 20)
ok = 10 ** 20
while ok - ng > 1:
    mid = (ok + ng) // 2
    if calc(mid) >= k:
        ok = mid
    else:
        ng = mid

print(ok)

Buggy python submission (verdict: Time Limit Exceeded):
# 上からk番目の数がxである。
# xとなる数はk個以上　かつ　x＋1となる数はk-1個以下
# xとなる数がk個以上となるxの最大値
from bisect import bisect_left, bisect_right
import sys

input = sys.stdin.buffer.readline


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

ng = -(10 ** 18) - 1
ok = (10 ** 18) + 1


def count(x):
    cnt = 0
    for i in range(n):
        a = A[i]
        if a > 0:
            gendo = x // a
            pos = bisect_right(A, gendo)
            cnt += pos
            if pos >= i + 1:
                cnt -= 1
        elif a < 0:
            gendo = (-x + (-a - 1)) // (-a)
            pos = bisect_left(A, gendo)
            cnt += n - pos
            if pos <= i:
                cnt -= 1
        else:
            if x < 0:
                cnt += 0
            else:
                cnt += n - 1
    return cnt // 2


# x = mid 以上のものをカウントしたい
while ok - ng > 1:
    mid = (ok + ng) // 2
    cnt = count(mid)
    if cnt >= k:
        ok = mid
    else:
        ng = mid

print(ok)


Fixed submission:
# 小さい方からk番目がx
# x以下がk個以上となる最小のx
# 負の数のところでバグってそう
from bisect import bisect_left, bisect_right

import sys

input = sys.stdin.buffer.readline

n, k = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
minusA = bisect_left(A, 0)
mA = A[:minusA]

zeroA = bisect_right(A, 0) - bisect_left(A, 0)
plusA = n - minusA - zeroA
pA = A[-plusA:]
minus = minusA * plusA
plus = plusA * (plusA - 1) // 2 + minusA * (minusA - 1) // 2
zero = zeroA * (zeroA - 1) // 2 + (n - zeroA) * zeroA


# x以下の数を数える
def calc(x):
    mmA = mA[::-1]
    res = 0
    if x > 0:
        lim = plusA - 1
        for i in range(plusA):
            while lim >= 0:
                if pA[i] * pA[lim] > x:
                    lim -= 1
                else:
                    break
            res += lim + 1
            if lim >= i:
                res -= 1
        lim = minusA - 1
        mmA = mA[::-1]
        for i in range(minusA):
            while lim >= 0:
                if mmA[i] * mmA[lim] > x:
                    lim -= 1
                else:
                    break
            res += lim + 1
            if lim >= i:
                res -= 1
        res //= 2
        res += minus + zero
    elif x == 0:
        res += minus + zero
    else:
        # 正の数、左絶対値小さい
        # 負の数、左絶対値大きい
        lim = minusA - 1
        for i in range(plusA):
            while lim >= 0:
                if pA[i] * mmA[lim] <= x:
                    lim -= 1
                else:
                    break
            res += minusA - (lim + 1)
    return res


ng = -(10 ** 20)
ok = 10 ** 20
while ok - ng > 1:
    mid = (ok + ng) // 2
    if calc(mid) >= k:
        ok = mid
    else:
        ng = mid

print(ok)

Buggy python submission (verdict: Time Limit Exceeded):
# 上からk番目の数がxである。
# xとなる数はk個以上　かつ　x＋1となる数はk-1個以下
# xとなる数がk個以上となるxの最大値
from bisect import bisect_left, bisect_right
import sys

input = sys.stdin.buffer.readline


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

ng = -(10 ** 20)
ok = 10 ** 20


def count(x):
    cnt = 0
    for i in range(n):
        a = A[i]
        if a > 0:
            gendo = x // a
            pos = bisect_right(A, gendo)
            cnt += pos
            if pos >= i + 1:
                cnt -= 1
        elif a < 0:
            gendo = (-x + (-a - 1)) // (-a)
            pos = bisect_left(A, gendo)
            cnt += n - pos
            if pos <= i:
                cnt -= 1
        else:
            if x < 0:
                cnt += 0
            else:
                cnt += n - 1
    return cnt // 2


# x = mid 以上のものをカウントしたい
kouho = -(10 ** 10)
while ok - ng > 1:
    mid = (ok + ng) // 2
    cnt = count(mid)
    if cnt >= k:
        ok = mid
    else:
        ng = mid

print(ok)


Fixed submission:
# 小さい方からk番目がx
# x以下がk個以上となる最小のx
# 負の数のところでバグってそう
from bisect import bisect_left, bisect_right

import sys

input = sys.stdin.buffer.readline

n, k = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
minusA = bisect_left(A, 0)
mA = A[:minusA]

zeroA = bisect_right(A, 0) - bisect_left(A, 0)
plusA = n - minusA - zeroA
pA = A[-plusA:]
minus = minusA * plusA
plus = plusA * (plusA - 1) // 2 + minusA * (minusA - 1) // 2
zero = zeroA * (zeroA - 1) // 2 + (n - zeroA) * zeroA


# x以下の数を数える
def calc(x):
    mmA = mA[::-1]
    res = 0
    if x > 0:
        lim = plusA - 1
        for i in range(plusA):
            while lim >= 0:
                if pA[i] * pA[lim] > x:
                    lim -= 1
                else:
                    break
            res += lim + 1
            if lim >= i:
                res -= 1
        lim = minusA - 1
        mmA = mA[::-1]
        for i in range(minusA):
            while lim >= 0:
                if mmA[i] * mmA[lim] > x:
                    lim -= 1
                else:
                    break
            res += lim + 1
            if lim >= i:
                res -= 1
        res //= 2
        res += minus + zero
    elif x == 0:
        res += minus + zero
    else:
        # 正の数、左絶対値小さい
        # 負の数、左絶対値大きい
        lim = minusA - 1
        for i in range(plusA):
            while lim >= 0:
                if pA[i] * mmA[lim] <= x:
                    lim -= 1
                else:
                    break
            res += minusA - (lim + 1)
    return res


ng = -(10 ** 20)
ok = 10 ** 20
while ok - ng > 1:
    mid = (ok + ng) // 2
    if calc(mid) >= k:
        ok = mid
    else:
        ng = mid

print(ok)