Buggy python submission (verdict: Runtime Error):
from sys import stdin
#f_i = stdin
f_i = open('test_in_3')#

import numpy as np

N, K = map(int, f_i.readline().split())
A = np.array(f_i.read().split(), dtype=int)

A = np.sort(A)
zero_left = A.searchsorted(0, side='left')
zero_right = A.searchsorted(0, side='right')
zero_cnt = zero_right - zero_left
pos = A[zero_right:]
neg = A[:zero_left]

def f(x):
    cnt = 0
    
    if x >= 0:
        cnt += zero_cnt * N
    
    cnt += np.searchsorted(A, x // pos, side='right').sum()
    cnt += (N - np.searchsorted(A, (-x - 1) // (-neg), side='right')).sum()
    
    cnt -= np.count_nonzero(A ** 2 <= x)
    return cnt // 2


left = -10 ** 18
right = 10 ** 18
while left + 1 < right:
    x = (left + right) // 2
    if f(x) >= K:
        right = x
    else:
        left = x

print(right)

Fixed submission:
from sys import stdin
f_i = stdin

import numpy as np

N, K = map(int, f_i.readline().split())
A = np.array(f_i.read().split(), dtype=int)

A = np.sort(A)
zero_left = A.searchsorted(0, side='left')
zero_right = A.searchsorted(0, side='right')
zero_cnt = zero_right - zero_left
pos = A[zero_right:]
neg = A[:zero_left]

def f(x):
    cnt = 0
    
    if x >= 0:
        cnt += zero_cnt * N
    
    cnt += np.searchsorted(A, x // pos, side='right').sum()
    cnt += (N - np.searchsorted(A, (-x - 1) // (-neg), side='right')).sum()
    
    cnt -= np.count_nonzero(A ** 2 <= x)
    return cnt // 2


left = -10 ** 18
right = 10 ** 18
while left + 1 < right:
    x = (left + right) // 2
    if f(x) >= K:
        right = x
    else:
        left = x

print(right)

Buggy python submission (verdict: Time Limit Exceeded):
def solve():
    from sys import stdin
    f_i = stdin
    
    N, K = map(int, f_i.readline().split())
    
    import numpy as np
    A = np.array(f_i.readline().split(), dtype=int)
    A.sort()
    
    INF = 10 ** 18 + 1
    l = -INF
    r = INF
    
    zero_num = len(A[A==0])
    tot_init = zero_num * (N - 1)
    
    mA = A[A<0]
    pA = A[A>0]
    
    while l + 1 < r:
        x = (l + r) // 2
        if x > 0:
            tot = tot_init
        else:
            tot = 0
        
        for a in mA:
            left = -1
            right = N
            while left + 1 < right:
                mid = (left + right) // 2
                if A[mid] * a < x:
                    right = mid
                else:
                    left = mid
            tot += (N - right)
            if a ** 2 < x:
                tot -= 1
        
        for a in pA:
            left = -1
            right = N
            while left + 1 < right:
                mid = (left + right) // 2
                if A[mid] * a < x:
                    left = mid
                else:
                    right = mid
            tot += right
            if a ** 2 < x:
                tot -= 1
        
        tot //= 2
        if tot < K:
            l = x
        else:
            r = x
    
    print(l)

solve()

Fixed submission:
from sys import stdin
f_i = stdin

import numpy as np

N, K = map(int, f_i.readline().split())
A = np.array(f_i.read().split(), dtype=int)

A = np.sort(A)
zero_left = A.searchsorted(0, side='left')
zero_right = A.searchsorted(0, side='right')
zero_cnt = zero_right - zero_left
pos = A[zero_right:]
neg = A[:zero_left]

def f(x):
    cnt = 0
    
    if x >= 0:
        cnt += zero_cnt * N
    
    cnt += np.searchsorted(A, x // pos, side='right').sum()
    cnt += (N - np.searchsorted(A, (-x - 1) // (-neg), side='right')).sum()
    
    cnt -= np.count_nonzero(A ** 2 <= x)
    return cnt // 2


left = -10 ** 18
right = 10 ** 18
while left + 1 < right:
    x = (left + right) // 2
    if f(x) >= K:
        right = x
    else:
        left = x

print(right)

Buggy python submission (verdict: Time Limit Exceeded):
def solve():
    from sys import stdin
    f_i = stdin
    
    N, K = map(int, f_i.readline().split())
    A = sorted(map(int, f_i.readline().split()))
    
    INF = 10 ** 18 + 1
    l = -INF
    r = INF
    
    from bisect import bisect_left, bisect_right
    
    zero_num = bisect_right(A, 0) - bisect_left(A, 0)
    tot_init = zero_num * (N - 1)
    
    mA = A[:bisect_left(A, 0)]
    pA = A[bisect_right(A, 0):]
    
    while l + 1 < r:
        x = (l + r) // 2
        if x > 0:
            tot = tot_init
        else:
            tot = 0
        
        for a in mA:
            left = -1
            right = N
            while left + 1 < right:
                mid = (left + right) // 2
                if A[mid] * a < x:
                    right = mid
                else:
                    left = mid
            tot += (N - right)
            if a ** 2 < x:
                tot -= 1
        
        for a in pA:
            left = -1
            right = N
            while left + 1 < right:
                mid = (left + right) // 2
                if A[mid] * a < x:
                    left = mid
                else:
                    right = mid
            tot += right
            if a ** 2 < x:
                tot -= 1
        
        tot //= 2
        if tot < K:
            l = x
        else:
            r = x
    
    print(l)

solve()

Fixed submission:
from sys import stdin
f_i = stdin

import numpy as np

N, K = map(int, f_i.readline().split())
A = np.array(f_i.read().split(), dtype=int)

A = np.sort(A)
zero_left = A.searchsorted(0, side='left')
zero_right = A.searchsorted(0, side='right')
zero_cnt = zero_right - zero_left
pos = A[zero_right:]
neg = A[:zero_left]

def f(x):
    cnt = 0
    
    if x >= 0:
        cnt += zero_cnt * N
    
    cnt += np.searchsorted(A, x // pos, side='right').sum()
    cnt += (N - np.searchsorted(A, (-x - 1) // (-neg), side='right')).sum()
    
    cnt -= np.count_nonzero(A ** 2 <= x)
    return cnt // 2


left = -10 ** 18
right = 10 ** 18
while left + 1 < right:
    x = (left + right) // 2
    if f(x) >= K:
        right = x
    else:
        left = x

print(right)

Buggy python submission (verdict: Time Limit Exceeded):
def solve():
    from sys import stdin
    f_i = stdin
    
    N, K = map(int, f_i.readline().split())
    A = map(int, f_i.readline().split())
    
    from itertools import combinations
    ans = sorted(x * y for x, y in combinations(A, 2))[K-1]
    
    print(ans)

solve()

Fixed submission:
from sys import stdin
f_i = stdin

import numpy as np

N, K = map(int, f_i.readline().split())
A = np.array(f_i.read().split(), dtype=int)

A = np.sort(A)
zero_left = A.searchsorted(0, side='left')
zero_right = A.searchsorted(0, side='right')
zero_cnt = zero_right - zero_left
pos = A[zero_right:]
neg = A[:zero_left]

def f(x):
    cnt = 0
    
    if x >= 0:
        cnt += zero_cnt * N
    
    cnt += np.searchsorted(A, x // pos, side='right').sum()
    cnt += (N - np.searchsorted(A, (-x - 1) // (-neg), side='right')).sum()
    
    cnt -= np.count_nonzero(A ** 2 <= x)
    return cnt // 2


left = -10 ** 18
right = 10 ** 18
while left + 1 < right:
    x = (left + right) // 2
    if f(x) >= K:
        right = x
    else:
        left = x

print(right)