Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef ll  long long;
int main()
{
    int n;
    cin>>n;
    vector <int> a(n),b(n),c(n);
    rep(i,n)
    {
        cin>>a[i];
    }
    rep(i,n)
    {
        cin>>b[i];
    }
    rep(i,n)
    {
        cin>>c[i];
    }

    sort(a.begin(),a.end());
    sort(b.begin(),b.end());
    sort(c.begin(),c.end());

    ll now_B, num_A, num_C, res = 0;
    ll idx_bound_A, idx_bound_C;

    for (ll i = 0; i < N; ++i) {
        now_B = B[i];
        num_A = 0;
        num_C = 0;

        // 1 段目: now_B 未満の数を求める
        auto iter_A = lower_bound(A.begin(), A.end(), now_B);
        idx_bound_A = distance(A.begin(), iter_A);
        num_A = (iter_A == A.end())? N: (idx_bound_A + 1) - 1;

        // 3 段目: now_B より大きい数
        auto iter_C = upper_bound(C.begin(), C.end(), now_B);
        idx_bound_C = distance(C.begin(), iter_C);
        num_C = (iter_C == C.end())? 0: N - idx_bound_C;

        res += num_A*num_C;
    }

    cout << res << "\n";

    return 0;
}

Compiler output:
a.cc:4:9: error: 'll' does not name a type
    4 | typedef ll  long long;
      |         ^~
a.cc: In function 'int main()':
a.cc:27:5: error: 'll' was not declared in this scope
   27 |     ll now_B, num_A, num_C, res = 0;
      |     ^~
a.cc:28:7: error: expected ';' before 'idx_bound_A'
   28 |     ll idx_bound_A, idx_bound_C;
      |       ^~~~~~~~~~~~
      |       ;
a.cc:30:12: error: expected ';' before 'i'
   30 |     for (ll i = 0; i < N; ++i) {
      |            ^~
      |            ;
a.cc:30:20: error: 'i' was not declared in this scope
   30 |     for (ll i = 0; i < N; ++i) {
      |                    ^
a.cc:30:24: error: 'N' was not declared in this scope
   30 |     for (ll i = 0; i < N; ++i) {
      |                        ^
a.cc:31:9: error: 'now_B' was not declared in this scope
   31 |         now_B = B[i];
      |         ^~~~~
a.cc:31:17: error: 'B' was not declared in this scope
   31 |         now_B = B[i];
      |                 ^
a.cc:32:9: error: 'num_A' was not declared in this scope
   32 |         num_A = 0;
      |         ^~~~~
a.cc:33:9: error: 'num_C' was not declared in this scope
   33 |         num_C = 0;
      |         ^~~~~
a.cc:36:35: error: 'A' was not declared in this scope
   36 |         auto iter_A = lower_bound(A.begin(), A.end(), now_B);
      |                                   ^
a.cc:37:9: error: 'idx_bound_A' was not declared in this scope
   37 |         idx_bound_A = distance(A.begin(), iter_A);
      |         ^~~~~~~~~~~
a.cc:41:35: error: 'C' was not declared in this scope
   41 |         auto iter_C = upper_bound(C.begin(), C.end(), now_B);
      |                                   ^
a.cc:42:9: error: 'idx_bound_C' was not declared in this scope
   42 |         idx_bound_C = distance(C.begin(), iter_C);
      |         ^~~~~~~~~~~
a.cc:45:9: error: 'res' was not declared in this scope; did you mean 'rep'?
   45 |         res += num_A*num_C;
      |         ^~~
      |         rep
a.cc:48:13: error: 'res' was not declared in this scope; did you mean 'rep'?
   48 |     cout << res << "\n";
      |             ^~~
      |             rep