Language: C++

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

using V = std::vector<uint64_t>;

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

  int N;
  std::cin >> N;

  V a(N, 0), b(N, 0), c(N, 0);
  for (int i = 0; i < N; i++) {
    std::cin >> a[i];
  }
  for (int i = 0; i < N; i++) {
    std::cin >> b[i];
  }
  for (int i = 0; i < N; i++) {
    std::cin >> c[i];
  }
  std::sort(a.begin(), a.end());
  std::sort(b.begin(), b.end());
  std::sort(c.begin(), c.end());

  V bs(N);
  for (int i = 0; i < N; i++) {
    bs[i] = c.end() - std::upper_bound(c.begin(), c.end(), b[i]);
  }

  V sum(N);
  sum[N - 1] = bs[N - 1];
  for (int i = N - 2; i >= 0; i--) {
    sum[i] = sum[i + 1] + bs[i];
  }

  uin64_t ans
  for (int i = 0; i < N; i++) {
    ans += sum[std::upper_bound(b.begin(), b.end(), a[i]) - b.begin()];
  }
  std::cout << ans << std::endl;
  return 0;
}


Compiler output:
a.cc:5:23: error: 'uint64_t' was not declared in this scope
    5 | using V = std::vector<uint64_t>;
      |                       ^~~~~~~~
a.cc:4:1: note: 'uint64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
    3 | #include <algorithm>
  +++ |+#include <cstdint>
    4 | 
a.cc:5:31: error: template argument 1 is invalid
    5 | using V = std::vector<uint64_t>;
      |                               ^
a.cc:5:31: error: template argument 2 is invalid
a.cc: In function 'int main()':
a.cc:14:3: error: 'V' was not declared in this scope
   14 |   V a(N, 0), b(N, 0), c(N, 0);
      |   ^
a.cc:16:17: error: 'a' was not declared in this scope
   16 |     std::cin >> a[i];
      |                 ^
a.cc:19:17: error: 'b' was not declared in this scope
   19 |     std::cin >> b[i];
      |                 ^
a.cc:22:17: error: 'c' was not declared in this scope
   22 |     std::cin >> c[i];
      |                 ^
a.cc:24:13: error: 'a' was not declared in this scope
   24 |   std::sort(a.begin(), a.end());
      |             ^
a.cc:25:13: error: 'b' was not declared in this scope
   25 |   std::sort(b.begin(), b.end());
      |             ^
a.cc:26:13: error: 'c' was not declared in this scope
   26 |   std::sort(c.begin(), c.end());
      |             ^
a.cc:28:4: error: expected ';' before 'bs'
   28 |   V bs(N);
      |    ^~~
      |    ;
a.cc:30:5: error: 'bs' was not declared in this scope; did you mean 'abs'?
   30 |     bs[i] = c.end() - std::upper_bound(c.begin(), c.end(), b[i]);
      |     ^~
      |     abs
a.cc:33:4: error: expected ';' before 'sum'
   33 |   V sum(N);
      |    ^~~~
      |    ;
a.cc:34:3: error: 'sum' was not declared in this scope
   34 |   sum[N - 1] = bs[N - 1];
      |   ^~~
a.cc:34:16: error: 'bs' was not declared in this scope; did you mean 'abs'?
   34 |   sum[N - 1] = bs[N - 1];
      |                ^~
      |                abs
a.cc:39:3: error: 'uin64_t' was not declared in this scope; did you mean 'u_int64_t'?
   39 |   uin64_t ans
      |   ^~~~~~~
      |   u_int64_t
a.cc:40:19: error: 'i' was not declared in this scope
   40 |   for (int i = 0; i < N; i++) {
      |                   ^
a.cc:43:16: error: 'ans' was not declared in this scope; did you mean 'abs'?
   43 |   std::cout << ans << std::endl;
      |                ^~~
      |                abs