Language: C++

#include <bits/stdc++.h>


using LL = long long;
  
 
  
  
 int main() {
  
     int N;
     cin >> N;
  
     vector<int> A(N), B(N), C(N);
     for (int i = 0; i < N; i++) cin >> A[i];
     for (int i = 0; i < N; i++) cin >> B[i];
     for (int i = 0; i < N; i++) cin >> C[i];
     sort(A.begin(), A.end());
     sort(B.begin(), B.end());
     sort(C.begin(), C.end());
  
     LL ans = 0;
  
     for (int i = 0; i < N; i++) {
         LL pre = lower_bound(A.begin(), A.end(), B[i]) - A.begin();
         LL over = C.end() - upper_bound(C.begin(), C.end(), B[i]);
         ans += pre * over;
     }
  
  
     cout << ans;
  
     return 0;
 }

Compiler output:
a.cc: In function 'int main()':
a.cc:12:6: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   12 |      cin >> N;
      |      ^~~
      |      std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
                 from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:14:6: error: 'vector' was not declared in this scope
   14 |      vector<int> A(N), B(N), C(N);
      |      ^~~~~~
a.cc:14:6: note: suggested alternatives:
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53:
/usr/include/c++/14/bits/stl_vector.h:428:11: note:   'std::vector'
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
/usr/include/c++/14/vector:93:13: note:   'std::pmr::vector'
   93 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
a.cc:14:13: error: expected primary-expression before 'int'
   14 |      vector<int> A(N), B(N), C(N);
      |             ^~~
a.cc:15:41: error: 'A' was not declared in this scope
   15 |      for (int i = 0; i < N; i++) cin >> A[i];
      |                                         ^
a.cc:16:41: error: 'B' was not declared in this scope
   16 |      for (int i = 0; i < N; i++) cin >> B[i];
      |                                         ^
a.cc:17:41: error: 'C' was not declared in this scope
   17 |      for (int i = 0; i < N; i++) cin >> C[i];
      |                                         ^
a.cc:18:11: error: 'A' was not declared in this scope
   18 |      sort(A.begin(), A.end());
      |           ^
a.cc:18:6: error: 'sort' was not declared in this scope; did you mean 'std::sort'?
   18 |      sort(A.begin(), A.end());
      |      ^~~~
      |      std::sort
In file included from /usr/include/c++/14/algorithm:86,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/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:19:11: error: 'B' was not declared in this scope
   19 |      sort(B.begin(), B.end());
      |           ^
a.cc:20:11: error: 'C' was not declared in this scope
   20 |      sort(C.begin(), C.end());
      |           ^
a.cc:25:19: error: 'lower_bound' was not declared in this scope; did you mean 'std::lower_bound'?
   25 |          LL pre = lower_bound(A.begin(), A.end(), B[i]) - A.begin();
      |                   ^~~~~~~~~~~
      |                   std::lower_bound
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:1963:5: note: 'std::lower_bound' declared here
 1963 |     lower_bound(_ForwardIterator __first, _ForwardIterator __last,
      |     ^~~~~~~~~~~
a.cc:26:30: error: 'upper_bound' was not declared in this scope; did you mean 'std::upper_bound'?
   26 |          LL over = C.end() - upper_bound(C.begin(), C.end(), B[i]);
      |                              ^~~~~~~~~~~
      |                              std::upper_bound
/usr/include/c++/14/bits/stl_algo.h:2050:5: note: 'std::upper_bound' declared here
 2050 |     upper_bound(_ForwardIterator __first, _ForwardIterator __last,
      |     ^~~~~~~~~~~
a.cc:31:6: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   31 |      cout << ans;
      |      ^~~~
      |      std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~