Language: C++

#include <bits/stdc++.h>
#include <algorithm>
#include <cmath>
#include <set>
#include <cstdio>
#include <vector>
#include <iostream>
#include <utility>
#include <queue>
#include <map>

#define fir first
#define sec second
#define sz(s) (s).size()
#define pb push_back
#define get(n) scanf("%d",&n);
#define gets(s) string s;cin >> (s);
#define prfi(n) printf("%d", &n);
#define prfd(n) printf("%lf", &n);
#define All(s) (s).begin(), (s).end()
#define rep(i,j) for(int (i)=0;(i)<(j);(i)++)
#define For(i,j,k) for(int (i)=(j);(i)<(k);(i)++)
#define repd(i,j) for(int (i)=(j);(i)>=0;(i)--)
#define Ford(i,j,k) for(int (i)=(j);i>=(k);i--)
#define vfor(c,v) for(auto (c): v)
#define dump(x)  std::cout << #x << " = " << (x) << std::endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

using ll = long long;
using pii = std::pair<int,int>;
using vi = std::vector<int> ;
using vvi = std::vector<vi> ;
using vll = std::vector<ll>;
using vvll = std::vector<vll>;
using vd = std::vector<double> ;
using vvd = std::vector<vd> ;
using qi = std::queue<int> ;
using vpii = std::vector<std::pair<int, int> >;
using namespace std;

const int Mod = (1e9) + 7;
const int max_n = 3 * (1e5) + 1;
const int max_m = 83 * (1e5) + 1;
const int INF = 10241024;
const ll INFL = (1ll << 62) - 1;
const int dx[] = {-1, 0, 0, 1};
const int dy[] = {0, -1, 1, 0};
//_____________________________________Templates_________________________________________//

template<class T1, class T2> inline void chmin(T1 &a, T2 b){if(a > b) a = b;}
template<class T1, class T2> inline void chmax(T1 &a, T2 b){if(a < b) a = b;}

//mainly use for dynamic prog
template<class T1, class T2>
void update(T1 &a, T2 b){
  a += b;
  if(a > Mod) a %= Mod;
}

inline void IN(void){
  return;
}

template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){
  cin >> first;
  IN(rest...);
  return;
}

inline void OUT(void){
  cout << "\n";
  return;
}

template <typename First, typename... Rest>
void OUT(First first, Rest... rest){
  cout << first << " ";
  OUT(rest...);
  return;
}
//_____________________　following sorce code_________________________//
int n,m,k;
//vvll dp(400, vll(400));
string S;
vll cost(1 << 16);
int a,b,c;
int h,w;
vvi v;
vll pu;
vll mu;

ll CEIL(ll x, ll a){
  if(x % a == 0)return x/a;
  else return (x+a)/a;
}

bool check(int x){
  ll res = 0;
  if(x == 0){
    res += sz(mu)*sz(pu);
    return res >= k;
  }

  if(x < 0){
    x *= -1;
    rep(i,sz(pu)){
      ll k = CEIL(x,pu[i]);
      res +=  sz(mu) - ( lower_bound(All(mu),k) - mu.begin());
      //dump(res);
    }
    return res >= k;
  }
  else {
    rep(i,sz(pu)){
      ll k = CEIL(x,pu[i]);
      res += er_bound(All(pu), k) - pu.begin() - i;
    }
    rep(i,sz(mu)){
      res += lower_bound(All(mu), x / mu[i]) - mu.begin();
    }
    return res >= k;
  }
}

int main () {
  cin.tie(0);
  ios::sync_with_stdio(false);
  IN(n,k);
  vll A,B;
  rep(i,n){
    ll a;IN(a);
    if(a < 0)B.pb(a);
    else A.pb(a);
  }
  pu = A;sort(All(pu));
  mu = B;sort(All(mu));
  //reverse(All(mu));
  for(auto &c : mu){
    c *= -1;
    //OUT(c);
  }
  ll l =  -1e9, r = 1e9;
  while(l+1<r){
    ll c = (l+r)/2;
    if(check(c))r = c;
    else l = c;
  }
  OUT(r);
  //cout << fixed << setprecision(15) << ans << endl;
  return 0;
}

Compiler output:
a.cc: In function 'bool check(int)':
a.cc:117:14: error: 'er_bound' was not declared in this scope; did you mean 'round'?
  117 |       res += er_bound(All(pu), k) - pu.begin() - i;
      |              ^~~~~~~~
      |              round