Language: C++

#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<cstring>
#include<math.h>
#include<bitset>
#include<queue>
#include<set>
#include<iomanip>
#include<math.h>
// #include<bits/stdc++.h>
using namespace std;
#define ll long long
constexpr long long int INFLL = 1001001001001001LL;
constexpr int INFI = 1e8;


int main(){
  int N;
  cin >> N;
  ll A[N+1],B[N+1],C[N+1];
  for(int i=0; i<N; i++){
    cin >> A[i];
  }
  A[N] = INFLL;
  for(int i=0; i<N; i++){
    cin >> B[i];
  }
  for(int i=0; i<N; i++){
    cin >> C[i];
  }
  C[N] = INFLL;
  sort(A,A+N);
  sort(C,C+N);
  ll sum=0;
  for(ll i=0; i<N; i++){
    int *a;
    a = lower_bound(A,A+N,B[i]);
    int ai;
    if(*lower_bound(A,A+N,B[i]) == B[i]){
      ai--;
    }
    ai = distance(A,a);
    int *c;
    c = lower_bound(C,C+N,B[i]+1);
    int ci;
    ci = distance(C,c);
    sum += ai*(N-ci);
  }
  cout << sum << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:39:20: error: cannot convert 'long long int*' to 'int*' in assignment
   39 |     a = lower_bound(A,A+N,B[i]);
      |         ~~~~~~~~~~~^~~~~~~~~~~~
      |                    |
      |                    long long int*
a.cc:44:18: error: no matching function for call to 'distance(long long int [(N + 1)], int*&)'
   44 |     ai = distance(A,a);
      |          ~~~~~~~~^~~~~
In file included from /usr/include/c++/14/string:47,
                 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_base_funcs.h:148:5: note: candidate: 'template<class _InputIterator> constexpr typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::distance(_InputIterator, _InputIterator)'
  148 |     distance(_InputIterator __first, _InputIterator __last)
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:148:5: note:   template argument deduction/substitution failed:
a.cc:44:18: note:   deduced conflicting types for parameter '_InputIterator' ('long long int*' and 'int*')
   44 |     ai = distance(A,a);
      |          ~~~~~~~~^~~~~
a.cc:46:20: error: cannot convert 'long long int*' to 'int*' in assignment
   46 |     c = lower_bound(C,C+N,B[i]+1);
      |         ~~~~~~~~~~~^~~~~~~~~~~~~~
      |                    |
      |                    long long int*
a.cc:48:18: error: no matching function for call to 'distance(long long int [(N + 1)], int*&)'
   48 |     ci = distance(C,c);
      |          ~~~~~~~~^~~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:148:5: note: candidate: 'template<class _InputIterator> constexpr typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::distance(_InputIterator, _InputIterator)'
  148 |     distance(_InputIterator __first, _InputIterator __last)
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:148:5: note:   template argument deduction/substitution failed:
a.cc:48:18: note:   deduced conflicting types for parameter '_InputIterator' ('long long int*' and 'int*')
   48 |     ci = distance(C,c);
      |          ~~~~~~~~^~~~~