Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <time.h>
#define ll long long
#define double long double
#define itn int
#define endl '\n'
#define co(ans) cout<<ans<<endl;
#define COYE cout<<"YES"<<endl;
#define COYe cout<<"Yes"<<endl;
#define COye cout<<"yes"<<endl;
#define CONO cout<<"NO"<<endl;
#define CONo cout<<"No"<<endl;
#define COno cout<<"no"<<endl;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define INF ((1LL<<62)-(1LL<<31))
#define EPS 1e-10
#define PI 3.141592653589793238
#define MOD 1000000007
#define MAX 5100000
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
const int vx[4]={0,1,0,-1},vy[4]={1,0,-1,0};
using namespace std;

int main(){
  ll N,ans=0;
  cin>>N;
  
  vector<ll> A,B,C;
  REP(i,N){
    ll a;
    cin>>a;
    A.push_back(a);
  }
  REP(i,N){
    ll a;
    cin>>a;
    B.push_back(a);
  }
  REP(i,N){
    ll a;
    cin>>a;
    C.push_back(a);
  }
  
  SORT(A);
  SORT(B);
  SORT(C);
  
  REP(i,N){
    ans+=lower_vound(ALL(A),B[i])*(N-upper_bound(ALL(C),B[i]));
  }
  
  cout<<ans<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:72:10: error: 'lower_vound' was not declared in this scope
   72 |     ans+=lower_vound(ALL(A),B[i])*(N-upper_bound(ALL(C),B[i]));
      |          ^~~~~~~~~~~
a.cc:72:37: error: no match for 'operator-' (operand types are 'long long int' and '__gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >')
   72 |     ans+=lower_vound(ALL(A),B[i])*(N-upper_bound(ALL(C),B[i]));
      |                                    ~^~~~~~~~~~~~~~~~~~~~~~~~~
      |                                    |            |
      |                                    |            __gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >
      |                                    long long int
In file included from /usr/include/c++/14/string:48,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_iterator.h:618:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__y.base() - __x.base())) std::operator-(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
  618 |     operator-(const reverse_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:618:5: note:   template argument deduction/substitution failed:
a.cc:72:61: note:   mismatched types 'const std::reverse_iterator<_Iterator>' and 'long long int'
   72 |     ans+=lower_vound(ALL(A),B[i])*(N-upper_bound(ALL(C),B[i]));
      |                                                             ^
/usr/include/c++/14/bits/stl_iterator.h:1790:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__x.base() - __y.base())) std::operator-(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
 1790 |     operator-(const move_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1790:5: note:   template argument deduction/substitution failed:
a.cc:72:61: note:   mismatched types 'const std::move_iterator<_IteratorL>' and 'long long int'
   72 |     ans+=lower_vound(ALL(A),B[i])*(N-upper_bound(ALL(C),B[i]));
      |                                                             ^
In file included from a.cc:16:
/usr/include/c++/14/complex:370:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const complex<_Tp>&, const complex<_Tp>&)'
  370 |     operator-(const complex<_Tp>& __x, const complex<_Tp>& __y)
      |     ^~~~~~~~
/usr/include/c++/14/complex:370:5: note:   template argument deduction/substitution failed:
a.cc:72:61: note:   mismatched types 'const std::complex<_Tp>' and 'long long int'
   72 |     ans+=lower_vound(ALL(A),B[i])*(N-upper_bound(ALL(C),B[i]));
      |                                                             ^
/usr/include/c++/14/complex:379:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const complex<_Tp>&, const _Tp&)'
  379 |     operator-(const complex<_Tp>& __x, const _Tp& __y)
      |     ^~~~~~~~
/usr/include/c++/14/complex:379:5: note:   template argument deduction/substitution failed:
a.cc:72:61: note:   mismatched types 'const std::complex<_Tp>' and 'long long int'
   72 |     ans+=lower_vound(ALL(A),B[i])*(N-upper_bound(ALL(C),B[i]));
      |                                                             ^
/usr/include/c++/14/complex:388:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const _Tp&, const complex<_Tp>&)'
  388 |     operator-(const _Tp& __x, const complex<_Tp>& __y)
      |     ^~~~~~~~
/usr/include/c++/14/complex:388:5: note:   template argument deduction/substitution failed:
a.cc:72:61: note:   '__gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >' is not derived from 'const std::complex<_Tp>'
   72 |     ans+=lower_vound(ALL(A),B[i])*(N-upper_bound(ALL(C),B[i]));
      |                                                             ^
/usr/include/c++/14/complex:465:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const complex<_Tp>&)'
  465 |     operator-(const complex<_Tp>& __x)
      |     ^~~~~~~~
/usr/include/c++/14/complex:465:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_iterator.h:1312:5: note: candidate: 'template<class _IteratorL, class _IteratorR, class _Container> decltype ((__lhs.base() - __rhs.base())) __gnu_cxx::operator-(const __normal_iterator<_IteratorL, _Container>&, const __normal_iterator<_IteratorR, _Container>&)'
 1312 |     operator-(const __normal_iterator<_IteratorL, _Container>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1312:5: note:   template argument deduction/substitution failed:
a.cc:72:61: note:   mismatched types 'const __gnu_cxx::__normal_iterator<_IteratorL, _Container>' and 'long long int'
   72 |     ans+=lower_vound(ALL(A),B[i])*(N-upper_bound(ALL(C),B[i]));
      |                                                             ^
/usr/include/c++/14/bits/stl_iterator.h:1325:5: note: candidate: 'template<class _Iterator, class _Container> typename __gnu_cxx::__normal_iterator<_Iterator, _Container>::difference_type __gnu_cxx::operator-(const __normal_iterator<_Iterator, _Container>&, const __normal_iterator<_Iterator, _Container>&)'
 1325 |     operator-(const __normal_iterator<_Iterator, _Container>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1325:5: note:   template argument deduction/substitution failed:
a.cc:72:61: note:   mismatched types 'const __gnu_cxx::__normal_iterator<_Iterator, _Container>' and 'long long int'
   72 |     ans+=lower_vound(ALL(A),B[i])*(N-upper_bound(ALL(C),B[i]));
      |                                                             ^