Buggy python submission (verdict: Time Limit Exceeded):
def main():
  import sys
  input = sys.stdin.readline
  import bisect

  N, K = [int(x) for x in input().split()]
  A = [int(x) for x in input().split()]

  A_m = [abs(int(x)) for x in A if x < 0]
  A_m.sort()
  N_m = len(A_m)

  A_p = [int(x) for x in A if x > 0]
  A_p.sort()
  N_p = len(A_p)

  M = N_m * N_p
  P = (1 / 2) * (N_m) * (N_m - 1) + (1 / 2) * (N_p) * (N_p - 1)
  Z = (1 / 2) * N * (N - 1) - (M + P)

  if M < K <= M + Z:
      print(0)
      sys.exit()

  def cnt_M(x):
      cnt = 0
      for i in A_m:
          cnt += bisect.bisect_right(A_p, x // i)
      return cnt >= (M - K + 1)

  if K <= M:
      left = -1 - 10**18
      right = 1 + 10**18 
      while right - left > 1:
          mid = (left + right) // 2
          if cnt_M(mid):
              right = mid
          else:
              left = mid
      print(-right)
      sys.exit()
  K -= (M + Z)
  def cnt_P(x):
      cnt = 0
      ng = 0
      for i in A_m:
          cnt += bisect.bisect_right(A_m, x // i)
          if i ** 2 <= x:
              ng += 1
      for j in A_p:
          cnt += bisect.bisect_right(A_p, x // j)
          if j ** 2 <= x:
              ng += 1
      return (cnt - ng) // 2 >= K

  left = -1 - 10**18
  right = 1 + 10**18
  while right - left > 1:
      mid = (left + right) // 2
      if cnt_P(mid):
         right = mid
      else:
          left = mid

  print(right)
main()


Fixed submission:
import sys
input = sys.stdin.readline
import numpy as np

N, K = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]

A_m = np.array(sorted([abs(int(x)) for x in A if x < 0]), np.int64)
N_m = len(A_m)

A_p = np.array(sorted([int(x) for x in A if x > 0]), np.int64)
N_p = len(A_p)

M = N_m * N_p
P = (1 / 2) * (N_m) * (N_m - 1) + (1 / 2) * (N_p) * (N_p - 1)
Z = (1 / 2) * N * (N - 1) - (M + P)

if M < K <= M + Z:
    print(0)
    sys.exit()

def cnt_M(x):
    cnt = np.searchsorted(A_m, x // A_p, side="right").sum()
    return cnt >= M - K + 1

if K <= M:
    left = -1 -10 ** 18
    right = 1 + 10 ** 18
    while right - left> 1:
        mid = (left + right) // 2
        if cnt_M(mid):
            right = mid
        else:
            left = mid
 
    print(-right)
    sys.exit()

K -= (M + Z)
def cnt_P(x):
    cnt = 0
    ng = 0
    cnt += np.searchsorted(A_m, x // A_m, side="right").sum()
    cnt += np.searchsorted(A_p, x // A_p, side="right").sum()
    ng = np.count_nonzero(A_m * A_m <= x) + np.count_nonzero(A_p * A_p <= x)
    cnt = (cnt - ng) // 2
    return cnt >= K

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

while right - left > 1:
    mid = (left + right) // 2
    if cnt_P(mid):
        right = mid
    else:
        left = mid
print(right)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
import bisect

N, K = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]

A_m = [abs(int(x)) for x in A if x < 0]
A_m.sort()
N_m = len(A_m)

A_p = [int(x) for x in A if x > 0]
A_p.sort()
N_p = len(A_p)

M = N_m * N_p
P = (1 / 2) * (N_m) * (N_m - 1) + (1 / 2) * (N_p) * (N_p - 1)
Z = (1 / 2) * N * (N - 1) - (M + P)

if M < K <= M + Z:
    print(0)
    sys.exit()

def cnt_M(x):
    cnt = 0
    for i in A_m:
        cnt += bisect.bisect_right(A_p, x // i)
    return cnt >= (M - K + 1)

if K <= M:
    left = -1 - 10**18
    right = 1 + 10**18 
    while right - left > 1:
        mid = (left + right) // 2
        if cnt_M(mid):
            right = mid
        else:
            left = mid
    print(-right)
    sys.exit()
K -= (M + Z)
def cnt_P(x):
    cnt = 0
    ng = 0
    for i in A_m:
        cnt += bisect.bisect_right(A_m, x // i)
        if i ** 2 <= x:
            ng += 1
    for j in A_p:
        cnt += bisect.bisect_right(A_p, x // j)
        if j ** 2 <= x:
            ng += 1
    return (cnt - ng) // 2 >= K

left = -1 - 10**18
right = 1 + 10**18
while right - left > 1:
    mid = (left + right) // 2
    if cnt_P(mid):
       right = mid
    else:
        left = mid

print(right)


Fixed submission:
import sys
input = sys.stdin.readline
import numpy as np

N, K = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]

A_m = np.array(sorted([abs(int(x)) for x in A if x < 0]), np.int64)
N_m = len(A_m)

A_p = np.array(sorted([int(x) for x in A if x > 0]), np.int64)
N_p = len(A_p)

M = N_m * N_p
P = (1 / 2) * (N_m) * (N_m - 1) + (1 / 2) * (N_p) * (N_p - 1)
Z = (1 / 2) * N * (N - 1) - (M + P)

if M < K <= M + Z:
    print(0)
    sys.exit()

def cnt_M(x):
    cnt = np.searchsorted(A_m, x // A_p, side="right").sum()
    return cnt >= M - K + 1

if K <= M:
    left = -1 -10 ** 18
    right = 1 + 10 ** 18
    while right - left> 1:
        mid = (left + right) // 2
        if cnt_M(mid):
            right = mid
        else:
            left = mid
 
    print(-right)
    sys.exit()

K -= (M + Z)
def cnt_P(x):
    cnt = 0
    ng = 0
    cnt += np.searchsorted(A_m, x // A_m, side="right").sum()
    cnt += np.searchsorted(A_p, x // A_p, side="right").sum()
    ng = np.count_nonzero(A_m * A_m <= x) + np.count_nonzero(A_p * A_p <= x)
    cnt = (cnt - ng) // 2
    return cnt >= K

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

while right - left > 1:
    mid = (left + right) // 2
    if cnt_P(mid):
        right = mid
    else:
        left = mid
print(right)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
import bisect

N, K = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]

A_m = [abs(int(x)) for x in A if x < 0]
A_m.sort()
N_m = len(A_m)

A_p = [int(x) for x in A if x > 0]
A_p.sort()
N_p = len(A_p)

M = N_m * N_p
P = (1 / 2) * (N_m) * (N_m - 1) + (1 / 2) * (N_p) * (N_p - 1)
Z = (1 / 2) * N * (N - 1) - (M + P)

if M < K <= M + Z:
    print(0)
    sys.exit()

def cnt_M(x):
    cnt = 0
    for i in A_m:
        cnt += bisect.bisect_right(A_p, x // i)
    return cnt >= (M - K + 1)

if K <= M:
    left = -1 - 10**18
    right = 1 + 10**18 
    while right - left > 1:
        mid = (left + right) // 2
        if cnt_M(mid):
            right = mid
        else:
            left = mid
    print(-right)
    sys.exit()
K -= (M + Z)
def cnt_P(x):
    cnt = 0
    ng = 0
    for i in A_m:
        cnt += bisect.bisect_right(A_m, x // i)
        if i ** 2 <= x:
            ng += 1
    for j in A_p:
        cnt += bisect.bisect_right(A_p, x // j)
        if j ** 2 <= x:
            ng += 1
    return (cnt - ng) // 2 >= K

left = -1 - 10**18
right = 1 + 10**18
while right - left > 1:
    mid = (left + right) // 2
    if cnt_P(mid):
       right = mid
    else:
        left = mid

print(right)


Fixed submission:
import sys
input = sys.stdin.readline
import numpy as np

N, K = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]

A_m = np.array(sorted([abs(int(x)) for x in A if x < 0]), np.int64)
N_m = len(A_m)

A_p = np.array(sorted([int(x) for x in A if x > 0]), np.int64)
N_p = len(A_p)

M = N_m * N_p
P = (1 / 2) * (N_m) * (N_m - 1) + (1 / 2) * (N_p) * (N_p - 1)
Z = (1 / 2) * N * (N - 1) - (M + P)

if M < K <= M + Z:
    print(0)
    sys.exit()

def cnt_M(x):
    cnt = np.searchsorted(A_m, x // A_p, side="right").sum()
    return cnt >= M - K + 1

if K <= M:
    left = -1 -10 ** 18
    right = 1 + 10 ** 18
    while right - left> 1:
        mid = (left + right) // 2
        if cnt_M(mid):
            right = mid
        else:
            left = mid
 
    print(-right)
    sys.exit()

K -= (M + Z)
def cnt_P(x):
    cnt = 0
    ng = 0
    cnt += np.searchsorted(A_m, x // A_m, side="right").sum()
    cnt += np.searchsorted(A_p, x // A_p, side="right").sum()
    ng = np.count_nonzero(A_m * A_m <= x) + np.count_nonzero(A_p * A_p <= x)
    cnt = (cnt - ng) // 2
    return cnt >= K

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

while right - left > 1:
    mid = (left + right) // 2
    if cnt_P(mid):
        right = mid
    else:
        left = mid
print(right)