Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np


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

left = -10**18
right = 10**18

while left+1 < right:
    num = (left+right)//2
    
    less_count = 0
    for a in A:
        if a < 0:
            limit_pair = -(-num // a)
            limit_idx = np.searchsorted(A, limit_pair, side='left')
            if a ** 2 <= num:
                less_count -= 1
            less_count += n - limit_idx
        
        elif a == 0:
            if num >= 0:
                less_count += n-1
        
        elif a > 0:
            limit_pair = num // a
            limit_idx = np.searchsorted(A, limit_pair, side='right')
            if a ** 2 <= num:
                less_count -= 1
            less_count += limit_idx
    
    less_count //= 2
    if less_count >= k:
        right = num
    else:
        left = num

print(right)

Fixed submission:
import numpy as np

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

A = np.array(input().split(), np.int64)

A.sort()

posA = A[A > 0]
negA = A[A < 0]
zeros = (A==0).sum()

left = -10**18
right = 10**18

while left+1 < right:
    num = (left+right)//2
    
    less_count = 0
    
    if num >= 0:
        less_count += zeros * n
    
    limit_pair_for_pos = num // posA
    limit_idxs = np.searchsorted(A, limit_pair_for_pos, side='right')
    less_count += limit_idxs.sum()

    limit_pair_for_neg = -(num // -negA)
    limit_idxs = n - np.searchsorted(A, limit_pair_for_neg, side='left')
    less_count += limit_idxs.sum()

    duplicate_cases = (A**2 <= num).sum()
    less_count -= duplicate_cases
    less_count //= 2
    
    if less_count >= k:
        right = num
    else:
        left = num

print(right)

Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
A = list(map(int, input().split()))

P = [a for a in A if a > 0]
Z = [a for a in A if a == 0]
M = [a for a in A if a < 0]

P.sort()
Z.sort()
M.sort(reverse=True)

minus_count = len(P) * len(M)
zero_count = len(Z) * (len(P)+len(M))
if len(Z) >= 2:
    zero_count += (len(Z) * (len(Z)-1)) // 2

left = -10**18 - 1
right = 10**18 + 1

while left + 1 < right:
    num = (left + right) // 2
    count = 0

    if num >= 0:
        count += zero_count + minus_count

        limit_idx = len(P)-1
        for idx, p in enumerate(P):
            pair = num / p
            while P[limit_idx] > pair and limit_idx > idx:
                limit_idx -= 1

            pattern = limit_idx - idx
            if pattern == 0:
                break
            count += pattern

        limit_idx = len(M) - 1
        for idx, m in enumerate(M):
            pair = num / m
            while M[limit_idx] < pair and limit_idx > idx:
                limit_idx -= 1

            pattern = limit_idx - idx
            if pattern == 0:
                break
            count += pattern

    elif num < 0:
        for idx, p in enumerate(P):
            pair = num / p

            limit_idx = len(M) - 1
            while M[limit_idx] <= pair and limit_idx >= 0:
                limit_idx -= 1

            pattern = len(M) - limit_idx - 1
            count += pattern

    if count >= k:
        right = num
    else:
        left = num

print(right)




Fixed submission:
import numpy as np

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

A = np.array(input().split(), np.int64)

A.sort()

posA = A[A > 0]
negA = A[A < 0]
zeros = (A==0).sum()

left = -10**18
right = 10**18

while left+1 < right:
    num = (left+right)//2
    
    less_count = 0
    
    if num >= 0:
        less_count += zeros * n
    
    limit_pair_for_pos = num // posA
    limit_idxs = np.searchsorted(A, limit_pair_for_pos, side='right')
    less_count += limit_idxs.sum()

    limit_pair_for_neg = -(num // -negA)
    limit_idxs = n - np.searchsorted(A, limit_pair_for_neg, side='left')
    less_count += limit_idxs.sum()

    duplicate_cases = (A**2 <= num).sum()
    less_count -= duplicate_cases
    less_count //= 2
    
    if less_count >= k:
        right = num
    else:
        left = num

print(right)