Buggy python submission (verdict: Time Limit Exceeded):
def main():
  from bisect import bisect
  n,k,*a=map(int,open(0).read().split())
  a.sort()
  i=bisect(a,0)
  a,b=a[i:],a[i-1::-1]
  n,m=len(a),len(b)
  ok=10**18
  ng=-ok
  while ok-ng>1:
    x=(ok+ng)//2
    s=0
    if x>=0:
      i=n
      for y in a:
        while i and a[i-1]*y>x:i-=1   
        s+=i
        if y*y<=x:s-=1
      i=m
      for y in b:
        while i and b[i-1]*y>x:i-=1
        s+=i
        if y*y<=x:s-=1
      s=s//2+n*m
    else:
      i=m
      for y in a:
        while i and b[i-1]*y<=x:i-=1
        s+=m-i
    if s>=k:ok=x
    else:ng=x
  print(ok)
main()

Fixed submission:
from bisect import*
def solve(x):
  s=t=0
  i=n
  j=-1
  for y in a:
    while i and a[i-1]*y>x:i-=1
    while j+1<m and b[j+1]*y<=x:j+=1
    s+=j+1
    t+=i
    if y*y<=x:t-=1
  s+=t//2
  t=0
  i=m
  for y in c:
    while i and c[i-1]*y>x:i-=1
    t+=i
    if y*y<=x:t-=1
  s+=t//2
  return s
n,k,*t=map(int,open(0).read().split())
t.sort()
i=bisect(t,0)
a,b,c=t[i:],t[:i],t[i-1::-1]
n,m=len(a),len(b)
ok=10**18
ng=-ok
while ok-ng>1:
  mid=(ok+ng)//2
  if solve(mid)>=k:ok=mid
  else:ng=mid
print(ok)

Buggy python submission (verdict: Time Limit Exceeded):
def main():
  from bisect import bisect
  n,k,*a=map(int,open(0).read().split())
  a.sort()
  i=bisect(a,0)
  a,b,c=a[i:],a[:i],a[i-1::-1]
  n,m=len(a),len(b)
  ok=10**18
  ng=-ok
  while ok-ng>1:
    x=(ok+ng)//2
    s=t=0
    i=n
    j=-1
    for y in a:
      while i and a[i-1]*y>x:i-=1
      while j+1<m and b[j+1]*y<=x:j+=1
      s+=j+1
      t+=i
      if y*y<=x:t-=1
    s+=t//2
    t=0
    i=m
    for y in c:
      while i and c[i-1]*y>x:i-=1
      t+=i
      if y*y<=x:t-=1
    s+=t//2
    if s>=k:ok=x
    else:ng=x
  print(ok)
main()

Fixed submission:
from bisect import*
def solve(x):
  s=t=0
  i=n
  j=-1
  for y in a:
    while i and a[i-1]*y>x:i-=1
    while j+1<m and b[j+1]*y<=x:j+=1
    s+=j+1
    t+=i
    if y*y<=x:t-=1
  s+=t//2
  t=0
  i=m
  for y in c:
    while i and c[i-1]*y>x:i-=1
    t+=i
    if y*y<=x:t-=1
  s+=t//2
  return s
n,k,*t=map(int,open(0).read().split())
t.sort()
i=bisect(t,0)
a,b,c=t[i:],t[:i],t[i-1::-1]
n,m=len(a),len(b)
ok=10**18
ng=-ok
while ok-ng>1:
  mid=(ok+ng)//2
  if solve(mid)>=k:ok=mid
  else:ng=mid
print(ok)

Buggy python submission (verdict: Time Limit Exceeded):
def bound2(a,y,x):
  ok=-1
  ng=len(a)
  while ng-ok>1:
    mid=(ok+ng)//2
    if a[mid]*y<=x:ok=mid
    else:ng=mid
  return ok
def bound1(x):
  s=t=0
  for y in a:
    s+=bound2(b,y,x)+1
    t+=bound2(a,y,x)
    if y*y>x:t+=1
  s+=t//2
  t=0
  for y in c:
    t+=bound2(c,y,x)
    if y*y>x:t+=1
  return s+t//2
n,k,*t=map(int,open(0).read().split())
t.sort()
i=bound2(t,1,0)+1
a,b,c=t[i:],t[:i],t[i-1::-1]
ok=10**18+1
ng=-ok
while ok-ng>1:
  mid=(ok+ng)//2
  if bound1(mid)>=k:ok=mid
  else:ng=mid
print(ok)

Fixed submission:
from bisect import*
def solve(x):
  s=t=0
  i=n
  j=-1
  for y in a:
    while i and a[i-1]*y>x:i-=1
    while j+1<m and b[j+1]*y<=x:j+=1
    s+=j+1
    t+=i
    if y*y<=x:t-=1
  s+=t//2
  t=0
  i=m
  for y in c:
    while i and c[i-1]*y>x:i-=1
    t+=i
    if y*y<=x:t-=1
  s+=t//2
  return s
n,k,*t=map(int,open(0).read().split())
t.sort()
i=bisect(t,0)
a,b,c=t[i:],t[:i],t[i-1::-1]
n,m=len(a),len(b)
ok=10**18
ng=-ok
while ok-ng>1:
  mid=(ok+ng)//2
  if solve(mid)>=k:ok=mid
  else:ng=mid
print(ok)

Buggy python submission (verdict: Time Limit Exceeded):
def bound2(a,y,x):
  ok=-1
  ng=len(a)
  while ng-ok>1:
    mid=(ok+ng)//2
    if a[mid]*y<=x:ok=mid
    else:ng=mid
  return ok
def bound1(x):
  s=t=0
  for y in a:
    s+=bound2(b,y,x)+1
    t+=bound2(a,y,x)
    if y*y>x:t+=1
  s+=t//2
  t=0
  for y in c:
    t+=bound2(c,y,x)
    if y*y>x:t+=1
  return s+t//2
n,k,*t=map(int,open(0).read().split())
t.sort()
i=bound2(t,1,0)+1
a,b,c=t[i:],t[:i],t[i-1::-1]
ok=10**19
ng=-ok
while ok-ng>1:
  mid=(ok+ng)//2
  if bound1(mid)>=k:ok=mid
  else:ng=mid
print(ok)

Fixed submission:
from bisect import*
def solve(x):
  s=t=0
  i=n
  j=-1
  for y in a:
    while i and a[i-1]*y>x:i-=1
    while j+1<m and b[j+1]*y<=x:j+=1
    s+=j+1
    t+=i
    if y*y<=x:t-=1
  s+=t//2
  t=0
  i=m
  for y in c:
    while i and c[i-1]*y>x:i-=1
    t+=i
    if y*y<=x:t-=1
  s+=t//2
  return s
n,k,*t=map(int,open(0).read().split())
t.sort()
i=bisect(t,0)
a,b,c=t[i:],t[:i],t[i-1::-1]
n,m=len(a),len(b)
ok=10**18
ng=-ok
while ok-ng>1:
  mid=(ok+ng)//2
  if solve(mid)>=k:ok=mid
  else:ng=mid
print(ok)

Buggy python submission (verdict: Time Limit Exceeded):
def bound2(a,y,x):
  ok=-1
  ng=len(a)
  while ng-ok>1:
    mid=(ok+ng)//2
    if a[mid]*y<=x:ok=mid
    else:ng=mid
  return ok
def bound1(x):
  s=t=0
  for y in a:
    s+=bound2(b,y,x)+1
    t+=bound2(a,y,x)
    if y*y>x:t+=1
  s+=t//2
  t=0
  for y in c:
    t+=bound2(c,y,x)
    if y*y>x:t+=1
  return s+t//2
n,k,*t=map(int,open(0).read().split())
t.sort()
i=bound2(t,1,0)+1
a,b,c=t[i:],t[:i],t[i-1::-1]
ok=10**19
ng=-ok
while ok-ng>1:
  mid=(ok+ng)//2
  if bound1(mid)>=k:ok=mid
  else:ng=mid
print(ok)

Fixed submission:
from bisect import*
def solve(x):
  s=t=0
  i=n
  j=-1
  for y in a:
    while i and a[i-1]*y>x:i-=1
    while j+1<m and b[j+1]*y<=x:j+=1
    s+=j+1
    t+=i
    if y*y<=x:t-=1
  s+=t//2
  t=0
  i=m
  for y in c:
    while i and c[i-1]*y>x:i-=1
    t+=i
    if y*y<=x:t-=1
  s+=t//2
  return s
n,k,*t=map(int,open(0).read().split())
t.sort()
i=bisect(t,0)
a,b,c=t[i:],t[:i],t[i-1::-1]
n,m=len(a),len(b)
ok=10**18
ng=-ok
while ok-ng>1:
  mid=(ok+ng)//2
  if solve(mid)>=k:ok=mid
  else:ng=mid
print(ok)