Language: C++

#include <iostream>
#include <cstdio>
#include<algorithm>
 
using namespace std;
 
const int maxx = 100050*3;
//int a[maxx];
int n;
long long b[3][maxx];
struct p
{
    long long val,id;
}a[maxx];
int cmp(p a, p b)
{
    return a.val < b.val;
}
int main()
{
    scanf("%d",&n);
    for(int i = 0; i < 3*n; i++)
    {
        scanf("%lld",&a[i].val);
        if(i < n) a[i].id = 1;
        else if(i >= 2*n) a[i].id = 3;
        else a[i].id = 2;
    }
    sort(a,a+3*n,cmp);
    for(int i = 0; i < 3 * n; i++)
    {
    }
    int cnt1 = 0,cnt2 = 0,cnt3 = 0;
    for(int i = 0; i < 3*n; i++)
    {
        if(a[i].id == 1) {
            ++cnt1;
            b[2][i] = b[2][i-1];
        }
        if(a[i].id == 2) {
            if(a[i].val == a[i-1].val)
            {
                b[1][i] = cnt1;
                int t = i;
                int q = 0;
                while(a[t].val == a[i].val) {
                        if(a[t].id == 1) q++;
                        t--;
                }
                cnt2 += b[1][i]-q;
                b[2][i] += cnt2;
            }
            else {
                b[1][i] = cnt1;
                cnt2 += b[1][i];
                b[2][i] += cnt2;
            }
        }
        else if(i != 0) b[2][i] = b[2][i-1];
    }
    long long ans = 0;
    for(int i = 0; i < 3 * n ; i++)
    {
  //      printf("%d %d --- %d %d %d\n",a[i].val,a[i].id,b[1][i],b[2][i],ans);
        if(a[i].id == 3){
            if(a[i].val == a[i-1].val && a[i-1].id == 2)
            {
                ans += b[2][i]-b[1][i-1];
            }
            else ans += b[2][i];
        }
    }
    printf("%lld\n",ans);
    return 0;
}

Compiler output:
a.cc:4:1: error: extended character   is not valid in an identifier
    4 |  
      | ^
a.cc:6:1: error: extended character   is not valid in an identifier
    6 |  
      | ^
a.cc:4:1: error: '\U000000a0' does not name a type
    4 |  
      | ^
a.cc:6:1: error: '\U000000a0' does not name a type
    6 |  
      | ^
a.cc:10:16: error: 'maxx' was not declared in this scope
   10 | long long b[3][maxx];
      |                ^~~~
a.cc:14:4: error: 'maxx' was not declared in this scope
   14 | }a[maxx];
      |    ^~~~
a.cc: In function 'int main()':
a.cc:24:23: error: 'a' was not declared in this scope
   24 |         scanf("%lld",&a[i].val);
      |                       ^
a.cc:29:10: error: 'a' was not declared in this scope
   29 |     sort(a,a+3*n,cmp);
      |          ^
a.cc:29:5: error: 'sort' was not declared in this scope; did you mean 'std::sort'?
   29 |     sort(a,a+3*n,cmp);
      |     ^~~~
      |     std::sort
In file included from /usr/include/c++/14/algorithm:86,
                 from a.cc:3:
/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:38:13: error: 'b' was not declared in this scope
   38 |             b[2][i] = b[2][i-1];
      |             ^
a.cc:43:17: error: 'b' was not declared in this scope
   43 |                 b[1][i] = cnt1;
      |                 ^
a.cc:54:17: error: 'b' was not declared in this scope
   54 |                 b[1][i] = cnt1;
      |                 ^
a.cc:59:25: error: 'b' was not declared in this scope
   59 |         else if(i != 0) b[2][i] = b[2][i-1];
      |                         ^
a.cc:68:24: error: 'b' was not declared in this scope
   68 |                 ans += b[2][i]-b[1][i-1];
      |                        ^
a.cc:70:25: error: 'b' was not declared in this scope
   70 |             else ans += b[2][i];
      |                         ^