criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include<bits/stdc++.h>
#define ll long long 
#define clr(c) memset(c,0,sizeof(c))
#define inf 0x7fffffff
const int mod=1e9+7;
const int M=4e5+5;
const int N=2e5+10;
using namespace std;
inline ll read()
{
	ll sum=0,b=1;char c=getchar();
	while(!isdigit(c)){if(c=='-') b=-1; c=getchar();}
	while(isdigit(c)){sum=sum*10+c-'0';c=getchar();}
	return b*sum;
}
ll t,n,m,k;
ll a,b,c;
ll ans;
int main()
{
	int N;
	N=read();
	int K;
	K=read();
	vector<ll> A(N);
	for(int i=0;i<N;i++)
		cin>>A[i];
	
	
	vector<ll> Book(N);
	
	for(int i=0;i<N;i++)
		for(int j=i;j<N;j++)
			Book.push_back(A[i]*A[j]);
		
	sort(Book.start(),Book.end());
	cout<<A[K];
	
	
	

	
	return 0;
}  

Compiler output:
a.cc: In function 'int main()':
a.cc:36:19: error: 'class std::vector<long long int>' has no member named 'start'
   36 |         sort(Book.start(),Book.end());
      |                   ^~~~~
Language: C++

#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using bint = boost::multiprecision::cpp_int;
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;

const ll INF = ll(1e18) + 1;

int main()
{
    int N; ll K;
    cin >> N >> K;
    vector<ll> A(N);
    rep(i,N) cin >> A[i];
    sort(A.begin(), A.end());
    ll L = -INF, R = INF, mid, total;
    while (L < R -1) {
        mid = (L+R)/2;
        total = 0;
        rep(i,N) {
            if (A[i] < 0) {
                int _left = -1, _right = N, _mid;
                while (_left < _right - 1) {
                    _mid = (_left + _right)/2;
                    if (A[_mid]*A[i] < mid) _right = _mid; else _left = _mid;
                }
                total += N - _right;
            } else {
                int _left = -1, _right = N, _mid;
                while (_left < _right - 1) {
                    _mid = (_left + _right)/2;
                    if (A[_mid]*A[i] < mid) _left = _mid; else _right = _mid;
                }
                total += _right;
            }
            if (A[i]*A[i] < mid) total--;
        }
        total /= 2;
        if (total < K) L = mid; else R = mid;
    }
    cout << L << endl;
    return 0;
}


Compiler output:
a.cc:2:10: fatal error: boost/multiprecision/cpp_int.hpp: No such file or directory
    2 | #include <boost/multiprecision/cpp_int.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>
#include<functional>
#include<string>
#include<iomanip>
#include<map>
#include<utility>
#include<string>
#include<unordered_map>
#include<queue>

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

using namespace std;

#define min_3(a, b, c) min(a, min(b, c))
#define max_3(a, b, c) max(a, max(b, c))
typedef long long ll;
typedef pair<int, int> P;
const ll INF = ll(1e17)+1;

int main(){
    int n, k;
    cin >> n >> k;
    vector<ll> a(n);
    for(int i = 0; i < n; i++) cin >> a[i];
    sort(a.begin(), a.end());
    ll l = -INF, r = INF;
    while(l+1 < r){ //隣り合ったら終わり
        ll x = (l+r)/2;
        bool ok = [&]{
            ll tot = 0;　//条件を満たす個数
            for(int i = 0; i < n; i++){ //a*b < xを考える
                if(a[i] < 0){
                    int l = -1, r = n;
                    while (l+1 < r){
                        int c = (l+r)/2;
                        if(a[c]*a[i] < x) r = c;
                        else l = c;
                    }
                    tot += n-r;
                }
                else{
                    int l = -1, r = n;
                    while(l+1 < r){
                        int c = (l+r)/2;
                        if(a[c]*a[i] < x) l = c;
                        else r = c;
                    }
                    tot += r;
                }
                if(a[i]*a[i] < x) tot--;
            }
            tot /= 2; //ひっくり返したのも数えてるので
            return tot < k;
        }();
        if(ok) l = x;
        else r = x;
    }
    cout << l << endl;
    return 0;
}


Compiler output:
a.cc:35:24: error: extended character 　 is not valid in an identifier
   35 |             ll tot = 0;　//条件を満たす個数
      |                        ^
a.cc: In lambda function:
a.cc:35:24: error: '\U00003000' was not declared in this scope
   35 |             ll tot = 0;　//条件を満たす個数
      |                        ^~
a.cc:36:28: error: 'i' was not declared in this scope
   36 |             for(int i = 0; i < n; i++){ //a*b < xを考える
      |                            ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
    int N, K;
    cin >> N >> K;
    vector<long long> A(N);
    long long cm = 0, cz = 0, cp = 0;
    for(int i = 0; i < N; i++){
        cin >> A[i];
        if(A[i] < 0) cm++;
        else if(A[i] > 0) cp++;
        else cz++;
    }
    sort(A.begin(), A.end());
    if(cm*cp >= K){
        long long n = cm*cp;
        vector<long long> v(n);
        int l = 0;
        for(int i = 0; i < cm; i++){
            for(int j = 0; j < cp; j++){
                v[l++] = A[i]*A[cm + cz + j];
            }
        }
        sort(v.begin(), v.end());
        cout << v[K - 1] << endl;
    }
    else if(cz * (cz - 1) / 2 + cz * (cp + cm) + cm * cp >= K) cout << 0 << endl;
    else{
        long long n = cp*(cp - 1) / 2 + cm*(cm - 1) / 2;
        vector<long long> v(n);
        int l = 0;
        for(int i = 0; i < cp; i++){
            for(int j = i + 1; j < cp; j++){
                v[l++] = A[cm + cz + i]*A[cm + cz + j];
            }
        }
        for(int i = 0; i < cm; i++){
            for(int j = i + 1; j < cm; j++) v[l++] = A[i]*A[j];
        }
        sort(v.begin(), v.end());
        cout << v[K - cz * (cz - 1) / 2 - cz * (cp + cm) - cm * cp - 1] << endl;
    }

Compiler output:
a.cc: In function 'int main()':
a.cc:42:6: error: expected '}' at end of input
   42 |     }
      |      ^
a.cc:3:11: note: to match this '{'
    3 | int main(){
      |           ^
Language: C++

#include <iostream>
#include <vector>
 
#define rep(i, a, b) for (int i = a; i < (int)(b); ++i)
#define rrep(i, a, b) for (int i = b - 1; i >= (int)(a); --i)
 
using namespace std;
 
using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
 
// O(n)
ll check_over_x(const vll& v1, const vll& v2, ll x) {
    ll sum = 0;
    int n1 = v1.size(), n2 = v2.size();
    int i = 0;
 
    rrep(j, 0, n2) {
        while (i < n1 && v1[i] * v2[j] < x) { ++i; }
        if (i == n1) { break; }
        sum += n1 - i;
    }
    return sum;
}
 
// O(n)
ll check_under_x(const vll& v, ll x) {
    ll sum = 0;
    int n = v.size();
    int i = 0, j = n - 1;
 
    while (i < j) {
        while (j > i && v[i] * v[j] > x) { --j; }
        if (i == j) { break; }
        sum += j - i;
        ++i;
    }
    return sum;
}
 
int main() {
    ll n, k;
    cin >> n >> k;
 
    vll plus, zeros, minus;
    int np = 0, nz = 0, nm = 0;
 
    rep(i, 0, n) {
        ll a;
        cin >> a;
        if (a > 0) {
            plus.push_back(a);
            ++np;
        } else if (a < 0) {
            minus.push_back(-a);
            ++nm;
        } else {
            zeros.push_back(0);
            ++nz;
        }
    }
 
    // O(nlog(n))
    sort(plus.begin(), plus.end());
    sort(minus.begin(), minus.end());
 
    if (np * nm >= k) {
        ll l = 0, r = plus.back() * minus.back();
        ll mid;
 
        while (l != r) {
            mid = (l + r + 1) / 2;
            ll z = check_over_x(plus, minus, mid);
 
            if (z < k) {
                r = mid - 1;
            } else {
                l = mid;
            }
        }
        cout << -r << endl;
        return 0;
    }
 
    k -= np * nm;
 
    if (nz * (2 * n - nz - 1) / 2 >= k) {
        cout << 0 << endl;
        return 0;
    }
 
    k -= nz * (2 * n - nz - 1) / 2;
 
    // O(nlog(n))
    ll l = 0;
    ll r = 0;
    if (np >= 2) { r = max(r, plus[np - 1] * plus[np - 2]); }
    if (nm >= 2) { r = max(r, minus[nm - 1] * minus[nm - 2]); }
    ll mid;
 
    while (l != r) {
        mid = (l + r) / 2;
        ll z = check_under_x(plus, mid) + check_under_x(minus, mid);
 
        if (z < k) {
            l = mid + 1;
        } else {
            r = mid;
        }
    }
    cout << l << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:65:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   65 |     sort(plus.begin(), plus.end());
      |     ^~~~
      |     short
Language: C++

#include <iostream>


using namespace std;

typedef long long ll;
const int MAX = 2e5;
int a[MAX + 1];
int n, k;

bool lessThanK(ll x, ll k) {
    ll skip = 0;
    for (int i = 0; i < n; ++i) {
        if (a[i] < 0) {
            int l = 0, h = n;
            while (l < h) {
                int m = l + (h - l) / 2;
                if (1ll * a[i] * a[m] < x) {
                    h = m;
                } else {
                    l = m + 1;
                }
            }
            skip += n - l;
        } else {
            int l = 0, h = n;
            while (l < h) {
                int m = l + (h - l) / 2;
                if (1ll * a[i] * a[m] < x) {
                    l = m + 1;
                } else {
                    h = m;
                }
            }
            skip += l;
        }

        if (1ll * a[i] * a[i] < x) skip--;
    }

    skip /= 2;
    return skip < k;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    cin >> n >> k;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }

    sort(a, a + n);

    ll lo = -1e18;
    ll hi = 1e18;
    while (lo + 1 < hi) {
        ll x = lo + (hi - lo) / 2;
        printf("[%lld, %lld], M = %lld\n", lo, hi, x);
        if (lessThanK(x, k)) {
            lo = x;
        } else {
            hi = x;
        }
    }

    printf("[%lld, %lld]\n", lo, hi);
    cout << lo;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:54:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   54 |     sort(a, a + n);
      |     ^~~~
      |     short
Language: Java

import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    //X未満の数が何個あるか数える方針でにぶたん
    //数える時もにぶたん
    long N = sc.nextLong();
    long K = sc.nextLong();
    long A[] = new long[N];
    for(int i =0;i<N;i++){
      A[i]=sc.nextLong();
    }
    //昇順に整列
    Arrays.sort(A);
    
  }
  
  //Xに対してX未満の数が何個あるか数えるメソッド
  public static long cnt(long A[],long X){
    return 0;
  }

  
}

Compiler output:
Main.java:9: error: incompatible types: possible lossy conversion from long to int
    long A[] = new long[N];
                        ^
1 error
Language: C++

n,k = list(map(int, input().split()))
arr = list(map(int, input().split()))
lis=[];
for i in range(n):
  for j in range(i+1,n):
   lis.append(arr[i]*arr[j]);
print(lis)
lis.sort()
print(lis[k-1])

Compiler output:
a.cc:1:1: error: 'n' does not name a type
    1 | n,k = list(map(int, input().split()))
      | ^
a.cc:4:1: error: expected unqualified-id before 'for'
    4 | for i in range(n):
      | ^~~
a.cc:7:6: error: expected constructor, destructor, or type conversion before '(' token
    7 | print(lis)
      |      ^
Language: C++

#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <regex>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;
using ll = long long;
using VL=vector<ll>;

#define rep(i, n) for(int i = 0;i < n;i++)
#define repr(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
const long long INF =  ll(1e18)+1;
ll a[200020];

int main(){
  ll N,K;
  rep(i,N)cin>>a[i];
  sort(a,a+N);
  ll l=-INF,r=INF;
  while(l+1<r){
    ll x=(l+r)/2;
    bool ok =[&]{
      ll tot=0;
      rep(i,N){
        if(a[i]<0){
          int l=-1,r=n;
          while(l+1<r){
            int m=(l+r)/2;
            if(a[m]*a[i]<x)r=m;
            else l=m;
          }
          tot+=n-r;
        }
        else{
          int l=-1,r=n;
          while(l+1<r){
            int m=(l+r)/2;
            if(a[m]*a[i]<x)l=m;
            else r=m;
          }
          tot+=r;
        }
        if(a[i]*a[i]<x)tot--;
      }
      tot=tot/2;
      //条件を満たす数のペアがk未満ならok//
      return tot<k;
    }();
    if(ok)l=x;
    else r=x;
  }
  cout<<l<<endl;
}

Compiler output:
a.cc: In lambda function:
a.cc:47:22: error: 'n' was not declared in this scope
   47 |           int l=-1,r=n;
      |                      ^
a.cc:56:22: error: 'n' was not declared in this scope
   56 |           int l=-1,r=n;
      |                      ^
a.cc:68:18: error: 'k' was not declared in this scope
   68 |       return tot<k;
      |                  ^
Language: C++

#include "bits/stdc++.h"
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;

using ll = long long;
const ll MOD = 1e9 + 7;

int main() {
    int N, K;
    cin >> N >> K;
    vector<ll> A(N);
    rep(i, N) cin >> A[i];
    sort(A.begin(), A.end());
    ll lo = -1e18 - 1, hi = 1e18 + 1;
    while (lo + 1 < hi) {
        ll mi = (lo + hi) / 2;
        ll l = 0;
        rep(i, N - 1) {
            if (A[i] < 0) {
                ll x = (-mi) / (-A[i]);
                int y = lower_bound(A.begin, A.end(), x) - A.begin();
                l += min(N - y, N - i - 1);
            }
            if (A[i] > 0) {
                ll x = mi / A[i];
                int y = upper_bound(A.begin(), A.end(), x) - A.begin();
                l += max(0, y - i);
            }
        }
        if (l < K) lo = mi;
        else hi = mi;
    }
    cout << hi << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:36: error: no matching function for call to 'lower_bound(<unresolved overloaded function type>, std::vector<long long int>::iterator, ll&)'
   21 |                 int y = lower_bound(A.begin, A.end(), x) - A.begin();
      |                         ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:1530:5: note: candidate: '_ForwardIterator std::lower_bound(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = __gnu_cxx::__normal_iterator<long long int*, vector<long long int> >; _Tp = long long int]'
 1530 |     lower_bound(_ForwardIterator __first, _ForwardIterator __last,
      |     ^~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:1530:34: note:   no known conversion for argument 1 from '<unresolved overloaded function type>' to '__gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >'
 1530 |     lower_bound(_ForwardIterator __first, _ForwardIterator __last,
      |                 ~~~~~~~~~~~~~~~~~^~~~~~~
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:1963:5: note: candidate: 'template<class _FIter, class _Tp, class _Compare> _FIter std::lower_bound(_FIter, _FIter, const _Tp&, _Compare)'
 1963 |     lower_bound(_ForwardIterator __first, _ForwardIterator __last,
      |     ^~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1963:5: note:   candidate expects 4 arguments, 3 provided
Language: C++

#include<stdio.h>
#include<stdlib.h>
int n;
int k;
long long a[1000005];
long long cmp(const void* a, const void* b)
{
    return *(long long*)a - *(long long*)b;
}
int getLeft(long long x)
{
    int i;
    int index = 0;
    int left, right, mid;
    for (i = 1; i < n; i++)
    {
        left = i + 1;
        right = n;
        if (a[i] >= 0)
        {
            if (a[i] * a[left] < x)
            {
                while (left < right) {
                    mid = (left + right + 1) / 2;
                    if (a[i] * a[mid] < x) left = mid;
                    else right = mid - 1;
                }
                index += left - i;
            }
        }
        else
        {
            if (a[i] * a[right] < x)
            {
                if (a[i] * a[left] < x)
                {
                    index += right - left + 1;
                    continue;
                }
                while (left < right)
                {
                    mid = (left + right + 1) / 2;
                    if (a[i] * a[mid] >= x) left = mid;
                    else right = mid - 1;
                }
                index += n - left;
            }
        }
    }
    return index < k;
}
int main() 
{
    int i;
    long long left = -1000000000000000005;
    long long right = 1000000000000000005;
    long long mid;
    scanf("%d %d", &n, &k);
    for (i = 1; i <= n; i++)
    {
        scanf("%lld", &a[i]);
    }
    qsort(a + 1, n, sizeof(long long), cmp); 
    while (left < right)
    {
        mid = (left + right + 1) / 2;
        if (getLeft(mid))
        {
            left = mid;
        }
        else
        {
            right = mid - 1;
        }
    }
    printf("%lld", left);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:63:40: error: invalid conversion from 'long long int (*)(const void*, const void*)' to '__compar_fn_t' {aka 'int (*)(const void*, const void*)'} [-fpermissive]
   63 |     qsort(a + 1, n, sizeof(long long), cmp);
      |                                        ^~~
      |                                        |
      |                                        long long int (*)(const void*, const void*)
In file included from /usr/include/c++/14/cstdlib:79,
                 from /usr/include/c++/14/stdlib.h:36,
                 from a.cc:2:
/usr/include/stdlib.h:971:34: note:   initializing argument 4 of 'void qsort(void*, size_t, size_t, __compar_fn_t)'
  971 |                    __compar_fn_t __compar) __nonnull ((1, 4));
      |                    ~~~~~~~~~~~~~~^~~~~~~~
Language: C++

//
//  main.cpp
//  ABC155D
//
#include <iostream>
#include <vector>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
using ll=long long;

int main(int argc, const char * argv[]) {
    const ll INF=ll(1e18)+1; // 無限大の定義
    int N,K;
    cin>>N>>K;
    vector<ll>A(N);
    rep(i,N){
        cin>>A.at(i);
    }
    sort(A.begin(),A.end());
    ll left=-INF;
    ll right=INF;
    while(left+1<right){
        ll mid=(left+right)/2;
        ll counter=0;
        for (int i=0; i<A.size(); i++) {
            for (int j=0; j<A.size(); j++) {
                if(i==j){
                    continue;
                }else{
                    if (A.at(i)*A.at(j)<mid) {
                    counter++;
                    }
                }
            }
        }
        if (counter/2<K) {
            left=mid;
        }else{
            right=mid;
        }
    }
    cout<<left<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:19:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   19 |     sort(A.begin(),A.end());
      |     ^~~~
      |     short
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main() {
  int N, K;
  cin >> N >> K;
  vector<int64_t> numbers(N);
  vector<int64_t> answers;
  for (int i = 0; i < N; i++){
    cin >> numbers.at(i)LL;
  }
  for(int i = 0; i < N - 1; i++){
    for (int j = i + 1; j < N; j++){
      answers.push_back(numbers.at(i)LL * numbers.at(j)LL);
    }
  }
  sort(answers.begin(), answers.end());
  
  cout << answers.at(K -1) << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:25: error: expected ';' before 'LL'
   10 |     cin >> numbers.at(i)LL;
      |                         ^~
      |                         ;
a.cc:14:38: error: expected ')' before 'LL'
   14 |       answers.push_back(numbers.at(i)LL * numbers.at(j)LL);
      |                        ~             ^~
      |                                      )
Language: C++

#include <iostream>
using namespace std;

#define pb push_back
#define F first
#define S second
#define fo(i,a,b)  for(int i = a; i < b; i++)

using ll = long long;
using ld = long double;
using ul = unsigned long long;
using ii = pair<int, int>;
ll power(ll x, ll y, ll p)
{
    ll res = 1;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}
ll nCr (ll n,ll m)
{
    return(m == 0)?1:n*nCr(n-1,m-1)/m;
}
/*****************************************************/

const int N = 2e5 + 3;
int n, a[N];
int cntPos(int i, ll val) {
	int lo = i + 1, hi = n - 1, ret = i;
  	while (lo <= hi) {
    	int mid = (lo + hi) / 2;
      	if ((ll) a[i] * a[mid] <= val) {
			ret = mid;
          	lo = mid + 1;
        } else{
        	hi = mid - 1;
        }
    }
	return ret - i;
}
int cntNeg(int i, ll val) {
	int lo = i + 1, hi = n - 1, ret = n;
  	while (lo <= hi) {
    	int mid = (lo + hi) / 2;
      	if ((ll) a[i] * a[mid] <= val) {
			ret = mid;
        	hi = mid - 1;
        } else{
          	lo = mid + 1;
        }
    }
	return n - ret;
}
int main() {
	ll k;
  	cin >> n >> k;
  	for (int i = 0; i < n; ++i)
      	cin >> a[i];
  	sort(a, a + n);
	ll lo = -1e18, hi = 1e18, res = -1;
	while (lo <= hi) {
		ll mid = (lo + hi) / 2, counter = 0;
		for (int i = 0; i < n; ++i) {
          	if (a[i] > 0)
              counter += cntPos(i, mid);
          	else
            	counter += cntNeg(i, mid);
        }
		if (counter < k) {
			lo = mid + 1;
		} else {
			res = mid;
			hi = mid - 1;
		}
	}
	cout << res << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:64:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   64 |         sort(a, a + n);
      |         ^~~~
      |         short
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define INF = 0x3f3f3f3f
#define mod  1e9 +7
#define maxn  1e6 + 5
ll n,k;
ll a[maxn];
ll check(ll x){
	ll res=0;
	for(int i=0;i<n;i++){
		if(a[i]<0){
			ll l=i,r=n;
			while(r-l>1){
				ll mid=(l+r)>>1;
				if(a[i]*a[mid]<=x){
					r=mid;
				}else{
					l=mid;
				}
			}
			res+=n-r;
		}else{
			ll l=i,r=n;
			while(r-l>1){
				ll mid=(l+r)>>1;
				if(a[i]*a[mid]<=x){
					l=mid;
				}else{
					r=mid;
				}
			}
			res+=l-i;
		}
	}
	return res;
}


int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin>>n>>k;
	for(int i=0;i<n;i++) cin>>a[i];
	sort(a,a+n);
	ll l=-1e18,r=1e18;
	while(r-l>1){
		ll mid=(l+r)>>1;
		if(check(mid)<k){
			l=mid;
		}else{
			r=mid;
		}
	}
	cout<<r;
	return 0;
}


Compiler output:
a.cc:6:19: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
    6 | #define maxn  1e6 + 5
      |               ~~~~^~~
a.cc:8:6: note: in expansion of macro 'maxn'
    8 | ll a[maxn];
      |      ^~~~
a.cc:6:19: error: could not convert '(1.0e+6 + (double)5)' from 'double' to 'long unsigned int'
    6 | #define maxn  1e6 + 5
      |               ~~~~^~~
      |                   |
      |                   double
a.cc:8:6: note: in expansion of macro 'maxn'
    8 | ll a[maxn];
      |      ^~~~
a.cc:6:19: error: size of array 'a' has non-integral type 'double'
    6 | #define maxn  1e6 + 5
      |               ~~~~^~~
a.cc:8:6: note: in expansion of macro 'maxn'
    8 | ll a[maxn];
      |      ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define INF = 0x3f3f3f3f
#define mod  1e9 +7
#define maxn  1e6 + 5
ll n,k;
ll a[maxn];
ll check(ll x){
	ll res=0;
	for(int i=0;i<n;i++){
		if(a[i]<0){
			ll l=i,r=n;
			while(r-l>1){
				ll mid=(l+r)>>1;
				if(a[i]*a[mid]<=x){
					r=mid;
				}else{
					l=mid;
				}
			}
			res+=n-r;
		}else{
			ll l=i,r=n;
			while(r-l>1){
				ll mid=(l+r)>>1;
				if(a[i]*a[mid]<=x){
					l=mid;
				}else{
					r=mid;
				}
			}
			res+=l-i;
		}
	}
	return res;
}


int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin>>n>>k;
	for(int i=0;i<n;i++) cin>>a[i];
	sort(a,a+n);
	ll l=-1e18,r=1e18;
	while(r-l>1){
		ll mid=(l+r)>>1;
		if(check(mid)<k){
			l=mid;
		}else{
			r=mid;
		}
	}
	cout<<r;
	return 0;
}



Compiler output:
a.cc:6:19: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
    6 | #define maxn  1e6 + 5
      |               ~~~~^~~
a.cc:8:6: note: in expansion of macro 'maxn'
    8 | ll a[maxn];
      |      ^~~~
a.cc:6:19: error: could not convert '(1.0e+6 + (double)5)' from 'double' to 'long unsigned int'
    6 | #define maxn  1e6 + 5
      |               ~~~~^~~
      |                   |
      |                   double
a.cc:8:6: note: in expansion of macro 'maxn'
    8 | ll a[maxn];
      |      ^~~~
a.cc:6:19: error: size of array 'a' has non-integral type 'double'
    6 | #define maxn  1e6 + 5
      |               ~~~~^~~
a.cc:8:6: note: in expansion of macro 'maxn'
    8 | ll a[maxn];
      |      ^~~~
Language: C++


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
int n;
ll k,a[202020];
ll st=-2e18,en=2e18;

int main() {
	cin>>n>>k;
	for(int i=0;i<n;i++) cin>>a[i];
	sort(a,a+n);
	while(st+1!=en) {
		ll mid=(st+en)/2,cnt=0;
		for(int i=0;i<n;i++) {
			int l=i,r=n;
			while(l+1!=r) {
				int m=(l+r)/2;
				if(a[i]*a[m]<=mid) 
					(a[i]<0)?r=m:l=m
				else (a[i]<0)?l=m:r=m
			}
			if(a[i]<0) cnt+=n-r;
			else cnt+=l-i;
		}
		if(cnt<k) st=mid;
		else en=mid;
	}
	cout<<en<<endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:57: error: expected ';' before 'else'
   21 |                                         (a[i]<0)?r=m:l=m
      |                                                         ^
      |                                                         ;
   22 |                                 else (a[i]<0)?l=m:r=m
      |                                 ~~~~
Language: C++


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
int n;
ll k,a[202020];
ll st=-2e18,en=2e18;

int main() {
	cin>>n>>k;
	for(int i=0;i<n;i++) cin>>a[i];
	sort(a,a+n);
	while(st+1!=en) {
		ll mid=(st+en)/2,cnt=0;
		for(int i=0;i<n;i++) {
			while(l+1!=r) {
				int m=(l+r)/2;
				if(a[i]*a[m]<=mid) 
					(a[i]<0)?r=m:l=m
				else (a[i]<0)?l=m:r=m
			}
			if(a[i]<0) cnt+=n-r;
			else cnt+=l-i;
		}
		if(cnt<k) st=mid;
		else en=mid;
	}
	cout<<en<<endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:31: error: 'l' was not declared in this scope
   17 |                         while(l+1!=r) {
      |                               ^
a.cc:17:36: error: 'r' was not declared in this scope
   17 |                         while(l+1!=r) {
      |                                    ^
a.cc:23:43: error: 'r' was not declared in this scope
   23 |                         if(a[i]<0) cnt+=n-r;
      |                                           ^
a.cc:24:35: error: 'l' was not declared in this scope
   24 |                         else cnt+=l-i;
      |                                   ^
Language: C++

#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <set>
#include <vector>
using namespace std;
int main() {
    long long left = -2e18, right = 2e18;
    long long N, K;
    cin >> N >> K;
    long long A[N];
    for (int i; i < N; i++) {
        cin >> A[i];
    }
    sort(A, A + N);
    while (left < right) {
        long long mid = (left + right) / 2, count = 0;
        for (int i = 0; i < N; i++) {
            int l = i, r = N;
            while (l < r) {
                int m = (l + r) / 2;
                if (A[i] * A[m] <= mid) {
                    if (A[i] < 0) {
                        r = m;
                    } else {
                        l = m;
                    }
                } else {
                    if (A[i] < 0) {
                        l = m;
                    } else {
                        r = m;
                    }
                }
            }
            count += (A[i] < 0) ? N - r : r;
        }
        (count < K) ? left = mid : right = mid;
    }
    cout << right << "\n";
    return 0;


Compiler output:
a.cc: In function 'int main()':
a.cc:42:14: error: expected '}' at end of input
   42 |     return 0;
      |              ^
a.cc:8:12: note: to match this '{'
    8 | int main() {
      |            ^
Language: Java

import java.util.*;
import java.io.*;


public class D {
    static int mod = (int) 1e9 + 7;
    static int DX[] = { -1, 0, 1, 0 }, DY[] = { 0, -1, 0, 1 };

    static int n;
    static long k;
    static long a[];
    public static void main(String[] args) {
        FastScanner fs = new FastScanner(System.in);
        n = fs.nextInt();
        k = fs.nextLong();
        a = fs.nextLongArray(n);
        Arrays.sort(a);
        long INF = (long)(1e18)+1;
        long l = -INF;
        long r = INF;
        while(l<r) {
            long c = (l+r)/2;
            if(check(c))l=c+1;
            else r = c;
        }
        System.out.println(l-1);
    }
    //x未満の組合せがk個未満ならtrue
    static boolean check(long x) {
        long tot = 0;
        for(int i=0;i<n;i++) {
            long now = a[i];
            int l = -1, r = n;
            if(now >= 0) {
                while(l+1<r) {
                    int c = (l+r)/2;
                    if(now * a[c] < x) l = c;
                    else r = c;
                }
                tot += (l+1);
            }
            else {
                while(l+1<r) {
                    int c = (l+r)/2;
                    if(now * a[c] < x) r = c;
                    else l = c;
                }
                tot += (n - r);
            }
            if((long)a[i] * a[i]<x)tot--;
        }
        if(tot/2 < k) return true;
        else return false;
    }
}

//高速なScanner
class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;

    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

    public String next() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken("\n");
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }

    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = nextInt();
        return a;
    }

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = nextLong();
        return a;
    }
}

Compiler output:
Main.java:5: error: class D is public, should be declared in a file named D.java
public class D {
       ^
1 error
Language: Java

import java.util.*;
import java.io.*;


public class D {
    static int mod = (int) 1e9 + 7;
    static int DX[] = { -1, 0, 1, 0 }, DY[] = { 0, -1, 0, 1 };

    static int n;
    static long k;
    static long a[];
    public static void main(String[] args) {
        FastScanner fs = new FastScanner(System.in);
        n = fs.nextInt();
        k = fs.nextLong();
        a = fs.nextLongArray(n);
        Arrays.sort(a);
        long INF = (long)(1e18)+1;
        long l = -INF;
        long r = INF;
        while(l<r) {
            long c = (l+r)/2;
            if(check(c))l=c+1;
            else r = c;
        }
        System.out.println(l);
    }
    //x未満の組合せがk個未満ならtrue
    static boolean check(long x) {
        long tot = 0;
        for(int i=0;i<n;i++) {
            long now = a[i];
            int l = -1, r = n;
            if(now >= 0) {
                while(l+1<r) {
                    int c = (l+r)/2;
                    if(now * a[c] < x) l = c;
                    else r = c;
                }
                tot += (l+1);
            }
            else {
                while(l+1<r) {
                    int c = (l+r)/2;
                    if(now * a[c] < x) r = c;
                    else l = c;
                }
                tot += (n - r);
            }
            if((long)a[i] * a[i]<x)tot--;
        }
        if(tot/2 < k) return true;
        else return false;
    }
}

//高速なScanner
class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;

    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

    public String next() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken("\n");
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }

    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = nextInt();
        return a;
    }

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = nextLong();
        return a;
    }
}


Compiler output:
Main.java:5: error: class D is public, should be declared in a file named D.java
public class D {
       ^
1 error
Language: C++

#include <iostream>
#include <vector>
using namespace std;

int main()
{

	int N , K ;
	cin>>N>>K;
	vector<int>V(N);

	for(int j=0 ; j<N ; j++)
	{
		cin>>V[j];
	}

	for(int j=0 , int Index=0 ; j<N ; j++)
	{
		for(int i=j+1 ; i<N ; i++)
		{
			if(Index = K )
			{
				cout<<V[j]*V[i];
			}
			Index++;
		}
	}

	return 0 ;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:23: error: expected unqualified-id before 'int'
   17 |         for(int j=0 , int Index=0 ; j<N ; j++)
      |                       ^~~
a.cc:17:22: error: expected ';' before 'int'
   17 |         for(int j=0 , int Index=0 ; j<N ; j++)
      |                      ^~~~
      |                      ;
a.cc:17:40: error: expected ')' before ';' token
   17 |         for(int j=0 , int Index=0 ; j<N ; j++)
      |            ~                           ^~
      |                                        )
a.cc:17:43: error: 'j' was not declared in this scope
   17 |         for(int j=0 , int Index=0 ; j<N ; j++)
      |                                           ^
Language: C++

fun main(args: Array<String>) = abc155d()

fun abc155d() {
    val (n, k) = readLine()!!.split(' ').map { it.toLong() }
    val aList = readLine()!!.split(' ').map { it.toLong() }.sorted().toLongArray()
    val aListNegative = aList.map { it * -1 }.reversed().toLongArray()

    var left = Long.MIN_VALUE / 2
    var right = Long.MAX_VALUE / 2

    while (right - left > 1) {
        val x = (left + right) / 2
        var lessThanKCount = 0L
        for (a in aList) {
            lessThanKCount += when {
                a > 0 -> {
                    var l = -1
                    var r = n.toInt()
                    while (r - l > 1) {
                        val mid = (l + r) / 2
                        if (aList[mid] * a < x) l = mid else r = mid
                    }
                    r.toLong()
                }
                else -> {
                    var l = -1
                    var r = n.toInt()
                    while (r - l > 1) {
                        val mid = (l + r) / 2
                        if (aList[mid] * a < x) r = mid else l = mid
                    }
                    n - r
                }
            }
            if (a * a < x) lessThanKCount--
            if (lessThanKCount>=k) break
        }
        lessThanKCount /= 2
        if (lessThanKCount < k) left = x else right = x
    }

    val answer = left

    println(answer)
}


Compiler output:
a.cc:1:1: error: 'fun' does not name a type
    1 | fun main(args: Array<String>) = abc155d()
      | ^~~
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
  int n,k;
  cin >> n >> k;
  
  vector<long int> a(n,0);
  vector<long int> b(m,0);
  
  for(int i = 0; i < n; i++)
  {
    cin >> a[i];
  }
  
  int w = 0;
  
  for(int i = 0; i < n - 1; i++)
  {
    for(int j = i + 1; j < n; j++)
    {
      b[w] = a[i] * a[j];
      w++;
    }
  }
  
  sort(b.begin(), b.end());
  
  cout << b[k-1];
  
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:22: error: 'm' was not declared in this scope
   11 |   vector<long int> b(m,0);
      |                      ^
Language: C++

#!/usr/bin/ruby

require 'pp'

N,K  = gets.chomp.split(" ").map(&:to_i)
A = gets.chomp.split(" ").map(&:to_i)

A.sort!

# Index of starting of positive values
neg = -1
A.each{|e|
  if e < 0
    neg += 1
  end
}

$posi = neg+1

def f(a, x)  # number of values less or equal than x
  total = 0
  a.each{|v|
    if v >= 0
      if x < 0
        l = -1
        r = $posi
      else
        l = $posi-1
        r = a.size
      end

      while l+1<r do
        m = l+(r-l)/2
        if v * a[m] <= x
          l = m
        else
          r = m
        end
      end
      total+= (l+1)
      total -= 1 if v*v <= x
    else
      if x < 0
        l = $posi
        r = a.size
      else
        l = -1
        r = $posi-1
      end
      while l+1<r do
        m = l+(r-l)/2
        if v * a[m] <= x
          r = m
        else
          l = m
        end
      end
      total+= (a.size-r)
      total -= 1 if v*v <= x
    end
  }
  return total/2
end

INF= 10**18+1

l = -INF
r = INF

while l+1 < r do
  m = l + (r-l)/2
  if f(A, m) < K
    l = m
  else
    r = m
  end
end

puts r


Compiler output:
a.cc:1:2: error: invalid preprocessing directive #!
    1 | #!/usr/bin/ruby
      |  ^
a.cc:3:9: warning: multi-character character constant [-Wmultichar]
    3 | require 'pp'
      |         ^~~~
a.cc:10:3: error: invalid preprocessing directive #Index
   10 | # Index of starting of positive values
      |   ^~~~~
a.cc:20:14: error: stray '#' in program
   20 | def f(a, x)  # number of values less or equal than x
      |              ^
a.cc:3:1: error: 'require' does not name a type
    3 | require 'pp'
      | ^~~~~~~
a.cc:18:1: error: '$posi' does not name a type
   18 | $posi = neg+1
      | ^~~~~
a.cc:62:3: error: expected unqualified-id before 'return'
   62 |   return total/2
      |   ^~~~~~
Language: C++

#include <iostream>
#include <vector>
using namespace std;

typedef long long int ll;

const ll inf = ll(1e18) + 1;

int main() {
  ll n, k;

  cin >> n >> k;
  vector<ll> a(n);
  for(int i = 0; i < n; i++) {
    cin >> a[i];
  }

  sort(a.begin(), a.end());
  ll l = -inf;
  ll r = inf;

  while(l + 1 < r) {
    ll x = (l + r) / 2;
    ll t = 0;
    for(ll i = 0; i < n; i++) {
      if (a[i] < 0) {
        ll l2 = -1;
        ll r2 = n;
        while (l2 + 1 < r2) {
          ll x2 = (l2 + r2) / 2;
          if (a[i] * a[x2] < x) {
            r2 = x2;
          } else {
            l2 = x2;
          }
        }
        t += n - r2;
      } else {
        ll l2 = -1;
        ll r2 = n;
        while (l2 + 1 < r2) {
          ll x2 = (l2 + r2) / 2;
          if (a[i] * a[x2] < x) {
            l2 = x2;
          } else {
            r2 = x2;
          }
        }
        t += r2;
      }
      if (a[i] * a[i] < x) t -= 1;
    }

    if (t / 2 < k) {
      l = x;
    } else {
      r = x;
    }
  }
  cout << l << endl;

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   18 |   sort(a.begin(), a.end());
      |   ^~~~
      |   short
Language: C++

#include <algorithm>
#include <iostream>
#include <vector>

#ifdef DBG
    #define D(y) y
#else
    #define D(y)
#endif

using namespace std;

const long long inf = 1023456789;
const long long INF = inf * inf;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int N;
    long long K;
    cin >> N >> K;

    vector<long long> positives, negatives;
    for (int i = 0; i < N; ++i) {
        int x;
        cin >> x;
        if (x < 0) {
            negatives.push_back(-x);
        } else {
            positives.push_back(x);
        }
    }
    sort(negatives.begin(), negatives.end());
    sort(positives.begin(), positives.end());

    long long non_positive_products = positives.size() * (long long) negatives.size();

    auto count_less_or_eq_helper = [](long long threshold, const vector<long long> v1, const vector<long long> v2, bool subtract_dups) {
        long long count = 0;
        D(cout << "less or eq" << endl;);

        int v2_idx = v2.size() - 1;
        for (int v1_idx = 0; v1_idx < v1.size(); ++v1_idx) {
            while (v2_idx >= 0 && v1[v1_idx] * v2[v2_idx] > threshold) {
                v2_idx--;
            }

            count += v2_idx + 1;

            D(cout << v1_idx << " " << v2_idx << endl;);
        }

        if (subtract_dups) {
            for (int v1_idx = 0; v1_idx < v1.size(); ++v1_idx) {
                if (subtract_dups && v1[v1_idx] * v1[v1_idx] <= threshold) {
                    count--;
                }
            }

            count /= 2;
        }

        return count;
    };

    auto count_greater_or_eq_helper = [&](long long threshold, const vector<long long> v1, const vector<long long> v2) {
        long long less_or_eq_count = count_less_or_eq_helper(threshold - 1, v1, v2, false);
        long long overall_count = v1.size() * (long long) v2.size() - less_or_eq_count;
        return overall_count;
    };

    auto count_less_or_eq = [&](long long threshold) {
        D(cout << "threshold = " << threshold << endl;);
        if (threshold >= 0) {
            long long count = 0;
            count += non_positive;
            count += count_less_or_eq_helper(threshold, negatives, negatives, true);
            count += count_less_or_eq_helper(threshold, positives, positives, true);
            D(cout << "count = " << count << endl;);
            return count;
        } else {
            long long count = count_greater_or_eq_helper(-threshold, positives, negatives);
            D(cout << "count = " << count << endl;);
            return count;
        }
    };

    // find first number such that # products <= is >= K
    long long low = -INF, high = INF;
    while (low < high) {
        long long mid = low + (high - low) / 2;

        if (count_less_or_eq(mid) < K) {
            low = mid + 1;
        } else {
            high = mid;
        }
    }

    cout << high << endl;

    return 0;
}


Compiler output:
a.cc: In lambda function:
a.cc:77:22: error: 'non_positive' was not declared in this scope
   77 |             count += non_positive;
      |                      ^~~~~~~~~~~~
Language: C++

#include <algorithm>
const int maxn=1e7;
int n;
long long k,tot;
std::vector<int> v;
bool check(int x){
	tot=0;
    for(int i=0;i<n;++i){
    	if(v[i]<0){
        	int l = -1,r = n;
        	while(r-l>1){
          		int c = (l+r)/2;
          		if(v[c]*v[i]<x) 
		    		r=c; 
		  		else 
					l=c;
            }
            tot += n-r;
        }
	    else
	    {
    		int l = -1, r = n;
        	while (r-l>1)
			{
          		int c = (r+l)/2;
          		if (v[c]*v[i]<x) 
					l = c; 
		  		else 
		    		r = c;
        	}
        	tot+=r;
      	}
	    if (v[i]*v[i]<x) --tot;
    }
	tot/=2;
    return tot<k;
}
int main()
{
    scanf("%d%d",&n,&k);
    for(int i=0;i<n;++i){
    	int x;
    	scanf("%d",&x);
    	v.push_back(x);
	}
	sort(v.begin(),v.end());
	long long left=-maxn*2,right=maxn*2;
    
	while (right-left>1){
        long long y=(left+right)/2;
        if(check(y))
		   left=y; 
		else 
		   right=y;
    }
    printf("%d",left);
    return 0;
}      

Compiler output:
a.cc:5:6: error: 'vector' in namespace 'std' does not name a template type
    5 | std::vector<int> v;
      |      ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include <algorithm>
  +++ |+#include <vector>
    2 | const int maxn=1e7;
a.cc: In function 'bool check(int)':
a.cc:9:12: error: 'v' was not declared in this scope
    9 |         if(v[i]<0){
      |            ^
a.cc:33:17: error: 'v' was not declared in this scope
   33 |             if (v[i]*v[i]<x) --tot;
      |                 ^
a.cc: In function 'int main()':
a.cc:40:5: error: 'scanf' was not declared in this scope
   40 |     scanf("%d%d",&n,&k);
      |     ^~~~~
a.cc:44:9: error: 'v' was not declared in this scope
   44 |         v.push_back(x);
      |         ^
a.cc:46:14: error: 'v' was not declared in this scope
   46 |         sort(v.begin(),v.end());
      |              ^
a.cc:46:9: error: 'sort' was not declared in this scope; did you mean 'std::sort'?
   46 |         sort(v.begin(),v.end());
      |         ^~~~
      |         std::sort
In file included from /usr/include/c++/14/algorithm:86,
                 from a.cc:1:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: 'std::sort' declared here
  296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
      | ^~~~
a.cc:56:5: error: 'printf' was not declared in this scope
   56 |     printf("%d",left);
      |     ^~~~~~
a.cc:2:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
    1 | #include <algorithm>
  +++ |+#include <cstdio>
    2 | const int maxn=1e7;