Buggy python submission (verdict: Runtime Error):
import numpy as np

N,K = map(int,input().split())
a = list(map(int, input().split()))

b = np.tile(a,N).reshape(N,-1).astype('float128')
c = np.tril(b * b.T, k=-1)
d = c + np.tri(N).T * np.max(c)

print(int(sorted(d.flatten())[K-1]))

Fixed submission:
import numpy as np
N,K = map(int,input().split())
a = np.array(input().split(),np.int64)
a = np.sort(a)
zero = a[a==0]
pos = a[a>0]
neg = a[a<0]

def f(x):
    count = 0
    c = x // pos
    count += np.searchsorted(a, c, side='right').sum()
    count += N*len(zero) if x >= 0 else 0
    c = -(-x // neg)
    count += (N - np.searchsorted(a, c, side='left')).sum()
    count -= a[a*a <= x].size
    count //= 2
    return count

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

Buggy python submission (verdict: Runtime Error):
import numpy as np

N,K = map(int,input().split())
a = list(map(int, input().split()))

b = np.tile(a,N).reshape(N,-1).astype('float128')
c = np.tril(b * b.T, k=-1)
d = c + np.tri(N).T * np.max(c)

print(d)
print(int(sorted(d.flatten())[K-1]))

Fixed submission:
import numpy as np
N,K = map(int,input().split())
a = np.array(input().split(),np.int64)
a = np.sort(a)
zero = a[a==0]
pos = a[a>0]
neg = a[a<0]

def f(x):
    count = 0
    c = x // pos
    count += np.searchsorted(a, c, side='right').sum()
    count += N*len(zero) if x >= 0 else 0
    c = -(-x // neg)
    count += (N - np.searchsorted(a, c, side='left')).sum()
    count -= a[a*a <= x].size
    count //= 2
    return count

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

Buggy python submission (verdict: Runtime Error):
import numpy as np

N,K = map(int,input().split())
a = list(map(int,input().split()))

b = np.tile(a,N).reshape(N,-1)
c = b * b.T * np.tri(N, k=-1)
d = c + np.tri(N).T * np.max(c)

print(int(sorted(d.flatten())[K-1]))

Fixed submission:
import numpy as np
N,K = map(int,input().split())
a = np.array(input().split(),np.int64)
a = np.sort(a)
zero = a[a==0]
pos = a[a>0]
neg = a[a<0]

def f(x):
    count = 0
    c = x // pos
    count += np.searchsorted(a, c, side='right').sum()
    count += N*len(zero) if x >= 0 else 0
    c = -(-x // neg)
    count += (N - np.searchsorted(a, c, side='left')).sum()
    count -= a[a*a <= x].size
    count //= 2
    return count

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

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

d_plus = sorted([i for i in a if i>=0])
d_minus = sorted([i for i in a if i<0])

d = []
if len(d_plus)*len(d_minus) > K:
  for i in d_plus:
    for j in d_minus:
      d.append(i*j)
  print(sorted(d)[K-1])
else:
  for i in range(len(d_plus)):
    for j in range(i,len(d_plus)):
      if i==j:
        continue
      else:
        d.append(d_plus[i]*d_plus[j])
  for i in range(len(d_minus)):
    for j in range(i,len(d_minus)):
      if i==j:
        continue
      else:
        d.append(d_minus[i]*d_minus[j])
  print(sorted(d)[K-1-len(d_plus)*len(d_minus)])
      

Fixed submission:
import numpy as np
N,K = map(int,input().split())
a = np.array(input().split(),np.int64)
a = np.sort(a)
zero = a[a==0]
pos = a[a>0]
neg = a[a<0]

def f(x):
    count = 0
    c = x // pos
    count += np.searchsorted(a, c, side='right').sum()
    count += N*len(zero) if x >= 0 else 0
    c = -(-x // neg)
    count += (N - np.searchsorted(a, c, side='left')).sum()
    count -= a[a*a <= x].size
    count //= 2
    return count

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

Buggy python submission (verdict: Runtime Error):
N,K = map(int,input().split())
a = list(map(int,input().split()))

d_plus = sorted([i for i in a if i>=0])
d_minus = sorted([i for i in a if i<0])

d = []
if len(d_plus)*len(d_minus) <= K:
  for i in d_plus:
    for j in d_minus:
      d.append(i*j)
  print(sorted(d)[K-1])
else:
  for i in range(len(d_plus)):
    for j in range(len(d_plus)):
      if i==j:
        continue
      else:
        d.append(d_plus[i]*d_plus[j])
  for i in range(len(d_minus)):
    for j in range(len(d_minus)):
      if i==j:
        continue
      else:
        d.append(d_minus[i]*d_minus[j])
  print(sorted(d)[K-1-len(d_plus)*len(d_minus)])
      

Fixed submission:
import numpy as np
N,K = map(int,input().split())
a = np.array(input().split(),np.int64)
a = np.sort(a)
zero = a[a==0]
pos = a[a>0]
neg = a[a<0]

def f(x):
    count = 0
    c = x // pos
    count += np.searchsorted(a, c, side='right').sum()
    count += N*len(zero) if x >= 0 else 0
    c = -(-x // neg)
    count += (N - np.searchsorted(a, c, side='left')).sum()
    count -= a[a*a <= x].size
    count //= 2
    return count

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

Buggy python submission (verdict: Runtime Error):
N,K = map(int,input().split())
a = list(map(int,input().split())

d = []
for i in range(N):
  for j in range(N):
    if j == i:
      continue
    else:
      d.append(a[i]*a[j])
      
print(sorted(d)[K-1])

Fixed submission:
import numpy as np
N,K = map(int,input().split())
a = np.array(input().split(),np.int64)
a = np.sort(a)
zero = a[a==0]
pos = a[a>0]
neg = a[a<0]

def f(x):
    count = 0
    c = x // pos
    count += np.searchsorted(a, c, side='right').sum()
    count += N*len(zero) if x >= 0 else 0
    c = -(-x // neg)
    count += (N - np.searchsorted(a, c, side='left')).sum()
    count -= a[a*a <= x].size
    count //= 2
    return count

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

Buggy python submission (verdict: Runtime Error):
N,K = map(int,input().split())
a = list(map(int),input().split())

d = []
for i in range(N):
  for j in range(N):
    if j == i:
      continue
    else:
      d.append(a[i]*a[j])
      
print(sorted(d)[K-1])

Fixed submission:
import numpy as np
N,K = map(int,input().split())
a = np.array(input().split(),np.int64)
a = np.sort(a)
zero = a[a==0]
pos = a[a>0]
neg = a[a<0]

def f(x):
    count = 0
    c = x // pos
    count += np.searchsorted(a, c, side='right').sum()
    count += N*len(zero) if x >= 0 else 0
    c = -(-x // neg)
    count += (N - np.searchsorted(a, c, side='left')).sum()
    count -= a[a*a <= x].size
    count //= 2
    return count

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