Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())

negative = []
zero = []
positive = []
for i in map(int, input().split()):
    if i < 0:
        negative.append(i)
    elif i > 0:
        positive.append(i)
    else:
        zero.append(i)

count_negative = len(negative) * len(positive)
count_zero = len(negative)*len(zero) + len(zero)*len(positive) + (len(zero)*(len(zero)-1))//2
count_positive = (len(positive)*(len(positive)-1))//2 + (len(negative)*(len(negative)-1))//2

values = []
if K <= count_negative:
    for i in negative:
        for j in positive:
            values.append(i * j)
    values.sort()
    print(values[K-1])
elif count_negative < K <= count_negative + count_zero:
    print(0)
else:
    for i in range(len(negative)):
        for j in range(i+1, len(negative)):
            values.append(negative[i] * negative[j])
    for i in range(len(positive)):
        for j in range(i+1, len(positive)):
            values.append(positive[i] * positive[j])
    values.sort()
    print(values[K-1-count_negative-count_zero])


Fixed submission:
import numpy as np
n, k = map(int,input().split())
a = np.array(list(map(int,input().split())))
a.sort()
posi = a[a>0]
zero = a[a==0]
nega = a[a<0]

# 2分探索, midより小さいものを数える
l = -10**18-1
r = 10**18+1
while r-l > 1:
    mid = (r+l)//2
    cnt = 0
    if mid >= 0:
        cnt += len(zero)*n
    
    # a.searchsorted(v, side="left"): a[i-1] < v <= a[i]であるvのindexを返す  
    # a.searchsorted(v, side="right"): a[i-1] <= v < a[i]であるvのindexを返す  

    cnt += a.searchsorted(mid//posi, side="right").sum()
    cnt += (n - a.searchsorted(-(-mid//nega), side="left")).sum()
    cnt -= np.count_nonzero(a*a <= mid)
    cnt //= 2
    # print("mid:", mid)
    # print("mid//posi:", mid//posi)
    # print("search:", a.searchsorted(mid//posi,side="right"))
    # print("-(-mid//nega):", -(-mid//nega))
    # print("search:", a.searchsorted(-(-mid//nega),side="left"))
    # print("nonzero_count:", np.count_nonzero(a*a<=mid))
    # print("count:", cnt)
    # print('-' * 20)
    if cnt >= k:
        r = mid
    else:
        l = mid
print(r)

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())

negative = []
zero = []
positive = []
for i in map(int, input().split()):
    if i < 0:
        negative.append(i)
    elif i > 0:
        positive.append(i)
    else:
        zero.append(i)

count_negative = len(negative) * len(positive)
count_zero = len(negative)*len(zero) + len(zero)*len(positive) + (len(zero)*(len(zero)-1))//2
count_positive = (len(positive)*(len(positive)-1))//2 + (len(negative)*(len(negative)-1))//2

values = []
if K <= count_negative:
    for i in negative:
        for j in positive:
            values.append(i * j)
    values.sort()
    print(values[K-1])
elif count_negative < K <= count_negative + count_zero:
    print(0)
else:
    for i in range(len(negative)):
        for j in range(i+1, len(negative)):
            values.append(negative[i] * negative[j])
    for i in range(len(positive)):
        for j in range(i+1, len(positive)):
            values.append(positive[i] * positive[j])
    values.sort()
    print(values[K-1-count_negative-count_zero])


Fixed submission:
import numpy as np
n, k = map(int,input().split())
a = np.array(list(map(int,input().split())))
a.sort()
posi = a[a>0]
zero = a[a==0]
nega = a[a<0]

# 2分探索, midより小さいものを数える
l = -10**18-1
r = 10**18+1
while r-l > 1:
    mid = (r+l)//2
    cnt = 0
    if mid >= 0:
        cnt += len(zero)*n
    
    # a.searchsorted(v, side="left"): a[i-1] < v <= a[i]であるvのindexを返す  
    # a.searchsorted(v, side="right"): a[i-1] <= v < a[i]であるvのindexを返す  

    cnt += a.searchsorted(mid//posi, side="right").sum()
    cnt += (n - a.searchsorted(-(-mid//nega), side="left")).sum()
    cnt -= np.count_nonzero(a*a <= mid)
    cnt //= 2
    # print("mid:", mid)
    # print("mid//posi:", mid//posi)
    # print("search:", a.searchsorted(mid//posi,side="right"))
    # print("-(-mid//nega):", -(-mid//nega))
    # print("search:", a.searchsorted(-(-mid//nega),side="left"))
    # print("nonzero_count:", np.count_nonzero(a*a<=mid))
    # print("count:", cnt)
    # print('-' * 20)
    if cnt >= k:
        r = mid
    else:
        l = mid
print(r)

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
A = list(map(int, input().split()))

values = []
for i in range(N):
    for j in range(i+1, N):
        values.append(A[i] * A[j])

values.sort()
print(values[K-1])

Fixed submission:
import numpy as np
n, k = map(int,input().split())
a = np.array(list(map(int,input().split())))
a.sort()
posi = a[a>0]
zero = a[a==0]
nega = a[a<0]

# 2分探索, midより小さいものを数える
l = -10**18-1
r = 10**18+1
while r-l > 1:
    mid = (r+l)//2
    cnt = 0
    if mid >= 0:
        cnt += len(zero)*n
    
    # a.searchsorted(v, side="left"): a[i-1] < v <= a[i]であるvのindexを返す  
    # a.searchsorted(v, side="right"): a[i-1] <= v < a[i]であるvのindexを返す  

    cnt += a.searchsorted(mid//posi, side="right").sum()
    cnt += (n - a.searchsorted(-(-mid//nega), side="left")).sum()
    cnt -= np.count_nonzero(a*a <= mid)
    cnt //= 2
    # print("mid:", mid)
    # print("mid//posi:", mid//posi)
    # print("search:", a.searchsorted(mid//posi,side="right"))
    # print("-(-mid//nega):", -(-mid//nega))
    # print("search:", a.searchsorted(-(-mid//nega),side="left"))
    # print("nonzero_count:", np.count_nonzero(a*a<=mid))
    # print("count:", cnt)
    # print('-' * 20)
    if cnt >= k:
        r = mid
    else:
        l = mid
print(r)