Language: C++

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

bool is_ok(int key, int val) {
    if (val >= key) return true;
    
    return false;
}

int binary_search(int key, vector<int> &tgt) {
    int ng = -1, ok = (int)tgt.size();
    int tmp;
    do {
        tmp = (ng + ok) / 2;
        if (is_ok(key, tgt.at(tmp))) ok = tmp;
        else ng = tmp;
    } while (abs(ok - ng) != 1);
    
    return ok; 
}

int main (void) {
    int N;
    cin >> N;
    vector<vector<ll>> abc(3, vector<ll>(N));
    rep(i, 3) rep(j, N) cin >> abc.at(i).at(j);
    rep(i, 3) sort(abc.at(i).begin(), abc.at(i).end());
    
    ll ans = 0;
    rep(i, N)  {
        ll key = abc.at(1).at(i);
        ll x = binary_search(key, abc.at(0));
        ll y = binary_search(key+1, abc.at(2));
        if (x > N || y > N) continue;
        ans += (x) * (N - y);

    }
    cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:35:29: error: no matching function for call to 'binary_search(ll&, __gnu_cxx::__alloc_traits<std::allocator<std::vector<long long int> >, std::vector<long long int> >::value_type&)'
   35 |         ll x = binary_search(key, abc.at(0));
      |                ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
a.cc:13:5: note: candidate: 'int binary_search(int, std::vector<int>&)'
   13 | int binary_search(int key, vector<int> &tgt) {
      |     ^~~~~~~~~~~~~
a.cc:13:41: note:   no known conversion for argument 2 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<long long int> >, std::vector<long long int> >::value_type' {aka 'std::vector<long long int>'} to 'std::vector<int>&'
   13 | int binary_search(int key, vector<int> &tgt) {
      |                            ~~~~~~~~~~~~~^~~
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:2194:5: note: candidate: 'template<class _FIter, class _Tp> bool std::binary_search(_FIter, _FIter, const _Tp&)'
 2194 |     binary_search(_ForwardIterator __first, _ForwardIterator __last,
      |     ^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:2194:5: note:   candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_algo.h:2228:5: note: candidate: 'template<class _FIter, class _Tp, class _Compare> bool std::binary_search(_FIter, _FIter, const _Tp&, _Compare)'
 2228 |     binary_search(_ForwardIterator __first, _ForwardIterator __last,
      |     ^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:2228:5: note:   candidate expects 4 arguments, 2 provided
a.cc:36:29: error: no matching function for call to 'binary_search(ll, __gnu_cxx::__alloc_traits<std::allocator<std::vector<long long int> >, std::vector<long long int> >::value_type&)'
   36 |         ll y = binary_search(key+1, abc.at(2));
      |                ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
a.cc:13:5: note: candidate: 'int binary_search(int, std::vector<int>&)'
   13 | int binary_search(int key, vector<int> &tgt) {
      |     ^~~~~~~~~~~~~
a.cc:13:41: note:   no known conversion for argument 2 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<long long int> >, std::vector<long long int> >::value_type' {aka 'std::vector<long long int>'} to 'std::vector<int>&'
   13 | int binary_search(int key, vector<int> &tgt) {
      |                            ~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_algo.h:2194:5: note: candidate: 'template<class _FIter, class _Tp> bool std::binary_search(_FIter, _FIter, const _Tp&)'
 2194 |     binary_search(_ForwardIterator __first, _ForwardIterator __last,
      |     ^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:2194:5: note:   candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_algo.h:2228:5: note: candidate: 'template<class _FIter, class _Tp, class _Compare> bool std::binary_search(_FIter, _FIter, const _Tp&, _Compare)'
 2228 |     binary_search(_ForwardIterator __first, _ForwardIterator __last,
      |     ^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:2228:5: note:   candidate expects 4 arguments, 2 provided