Language: C++

const ll N = 2e5 + 10;
const ll mod = 1e9;
const ll Max_n = 1e6 + 10;
using namespace std;
vector<ll> q,p;
bool ok(ll x,ll n,ll k){
    ll ans = 0;
    sort(q.begin(),q.end(),greater<ll>());
    sort(p.begin(),p.end());
    int s1 = q.size(),s2 = p.size();
    for(int i = 0;i < s1;++i){
        int l = i,r = s1-1;
        while(l < r){
            int mid = l + r +1 >>1;
            if(q[i]*q[mid] <= x) l = mid;
            else r = mid - 1;
        }
        if(l > i) ans += l -i ;
    }
    for(int i = 0;i < s2;++i){
        int l = i,r = s2 - 1;
        while(l < r){
            int mid = l + r + 1 >> 1;
            if(p[i]*p[mid] <= x) l = mid;
            else r = mid - 1;
        }
        if(l > i) ans += l - i ;
    }
    if(ans >= k) return 1;
    reverse(q.begin(),q.end());
    reverse(p.begin(),p.end());
    for(int i = 0;i < s1;++i){
        int l = -1,r = s2-1;
        while(l < r){
            int mid = l + r + 1>>1;
            if(q[i] * p[mid] <=  x) l = mid;
            else r = mid - 1;
        }
        if(l != -1) ans += l + 1;
    }
    return ans >= k;

    
}
int main(){
    ll n,k;
    scanf("%lld%lld",&n,&k);
    for(int i = 1;i <= n;++i){
        ll a;
        scanf("%lld",&a);
        if(a<0) q.push_back(a);
        else  p.push_back(a);
    }
    ll l = - mod * mod ,r = mod *mod;
    while(l < r){
        ll mid = l + r >>1;
        if(ok(mid,n,k)) r = mid;
        else l = mid + 1;
    }
    cout << r;
}


Compiler output:
a.cc:1:7: error: 'll' does not name a type
    1 | const ll N = 2e5 + 10;
      |       ^~
a.cc:2:7: error: 'll' does not name a type
    2 | const ll mod = 1e9;
      |       ^~
a.cc:3:7: error: 'll' does not name a type
    3 | const ll Max_n = 1e6 + 10;
      |       ^~
a.cc:5:1: error: 'vector' does not name a type
    5 | vector<ll> q,p;
      | ^~~~~~
a.cc:6:9: error: 'll' was not declared in this scope
    6 | bool ok(ll x,ll n,ll k){
      |         ^~
a.cc:6:14: error: 'll' was not declared in this scope
    6 | bool ok(ll x,ll n,ll k){
      |              ^~
a.cc:6:19: error: 'll' was not declared in this scope
    6 | bool ok(ll x,ll n,ll k){
      |                   ^~
a.cc:6:23: error: expression list treated as compound expression in initializer [-fpermissive]
    6 | bool ok(ll x,ll n,ll k){
      |                       ^
a.cc: In function 'int main()':
a.cc:46:5: error: 'll' was not declared in this scope
   46 |     ll n,k;
      |     ^~
a.cc:47:23: error: 'n' was not declared in this scope
   47 |     scanf("%lld%lld",&n,&k);
      |                       ^
a.cc:47:26: error: 'k' was not declared in this scope; did you mean 'ok'?
   47 |     scanf("%lld%lld",&n,&k);
      |                          ^
      |                          ok
a.cc:47:5: error: 'scanf' was not declared in this scope
   47 |     scanf("%lld%lld",&n,&k);
      |     ^~~~~
a.cc:49:11: error: expected ';' before 'a'
   49 |         ll a;
      |           ^~
      |           ;
a.cc:50:23: error: 'a' was not declared in this scope
   50 |         scanf("%lld",&a);
      |                       ^
a.cc:51:17: error: 'q' was not declared in this scope
   51 |         if(a<0) q.push_back(a);
      |                 ^
a.cc:52:15: error: 'p' was not declared in this scope
   52 |         else  p.push_back(a);
      |               ^
a.cc:54:7: error: expected ';' before 'l'
   54 |     ll l = - mod * mod ,r = mod *mod;
      |       ^~
      |       ;
a.cc:55:11: error: 'l' was not declared in this scope
   55 |     while(l < r){
      |           ^
a.cc:55:15: error: 'r' was not declared in this scope
   55 |     while(l < r){
      |               ^
a.cc:56:11: error: expected ';' before 'mid'
   56 |         ll mid = l + r >>1;
      |           ^~~~
      |           ;
a.cc:57:15: error: 'mid' was not declared in this scope
   57 |         if(ok(mid,n,k)) r = mid;
      |               ^~~
a.cc:57:14: error: 'ok' cannot be used as a function
   57 |         if(ok(mid,n,k)) r = mid;
      |            ~~^~~~~~~~~
a.cc:60:5: error: 'cout' was not declared in this scope
   60 |     cout << r;
      |     ^~~~
a.cc:1:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | const ll N = 2e5 + 10;
a.cc:60:13: error: 'r' was not declared in this scope
   60 |     cout << r;
      |             ^