Language: C++

#include<iostream>
#include<vector>
#include<sstream>
#include<string>
#include<numeric>
#include <algorithm>
#include<math.h>
#include<cstdio>
#include<string.h>
#include<unistd.h>
#include <array>
#include <map> 




using namespace std;
typedef long long ll;
struct point{
  int x;
  int y;

};
int gcd(int m, int n )
{
	// 引数に０がある場合は０を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	// ユークリッドの方法
	while( m != n )
	{
		if ( m > n ) m = m - n;
		else         n = n - m;
	}
	return m;
}//gcd
int lcm( int m, int n )
{
	// 引数に０がある場合は０を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}//lcm
int input(){
  int x;
  cin>>x;
  return x;
}

int moji(char in)
{
    int ans = (int)in-(int)'a';
    if((ans < 0) || (ans > 25)){
        ans = 26;
    }
    return ans;
}
const int VV=10;//場合に応じてVVの値のみ変更する必要あり
//dijkstra(s)sがスタート地点でそこからの最短距離を配列dで表す。正の重みのみ使用可能
int cost[VV][VV];
int d[VV];
bool used[VV];
void dijkstra(int s){
  fill(d,d+VV,100000);
  fill(used,used+VV,false);
  d[s]=0;
  while(true){
    int v=-1;
    for(int u=0;u<VV;u++){
      if(!used[u]&&(v==-1||d[u]<d[v]))v=u;
    }
    if(v==-1)break;
    used[v]=true;
    for(int u=0;u<VV;u++){
      d[u]=min(d[u],d[v]+cost[v][u]);
    }
  }

}

int compare_int(const void *a, const void *b)//qsort(quick sort利用時に使用)
{
    return *(int*)a - *(int*)b;
}

int binary_searchh(long long x,long long k[],int n){
  int l=0;
  int r=n;
  while(r-l>=1){
    int i=(l+r)/2;
    if(k[i]==x)return i;
    else if(k[i]<x)l=i+1;
    else r=i;
  }
  return -1;
}

struct File {
    int aa;
    int bb;

    File(const int& aa, const int& bb)
        : aa(aa), bb(bb) {}
};

bool operator<(const File& a, const File& b)
{
    // ファイル種別、ファイル名の順番で優先順位を付けて比較
    return std::tie(a.aa, a.bb) < std::tie(b.aa, b.bb);
}




int main(){
  int N;
  cin>>N;
  vector<int>A;
  vector<int>B;
  vector<int>C;
  for(int i=0;i<N;i++){
    int x,y,z;
    cin>>x>>y>>z;
    A.push_back(x);
    B.push_back(y);
    C.push_back(z);
  }
  sort(A.begin(),A.end());
  sort(B.begin(),B.end());
  sort(C.begin(),C.end());
  long long sum=0;
  for(int i=0;i<N;i++){
    long long it=upper_bound(C.begin(),C.end(),B[i]);
    long long index=it-C.end();
    long long itt=lower_bound(A.begin(),A.end(),B[i]);
    long long indexx=-itt+A.begin();
    sum+=index*indexx;


  }
  cout<<sum<<endl;


}



Compiler output:
a.cc: In function 'int main()':
a.cc:135:29: error: cannot convert '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' to 'long long int' in initialization
  135 |     long long it=upper_bound(C.begin(),C.end(),B[i]);
      |                  ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
      |                             |
      |                             __gnu_cxx::__normal_iterator<int*, std::vector<int> >
a.cc:136:23: error: no match for 'operator-' (operand types are 'long long int' and 'std::vector<int>::iterator')
  136 |     long long index=it-C.end();
      |                     ~~^~~~~~~~
      |                     |       |
      |                     |       std::vector<int>::iterator
      |                     long long int
In file included from /usr/include/c++/14/string:48,
                 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.h:618:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__y.base() - __x.base())) std::operator-(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
  618 |     operator-(const reverse_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:618:5: note:   template argument deduction/substitution failed:
a.cc:136:30: note:   mismatched types 'const std::reverse_iterator<_Iterator>' and 'long long int'
  136 |     long long index=it-C.end();
      |                              ^
/usr/include/c++/14/bits/stl_iterator.h:1790:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__x.base() - __y.base())) std::operator-(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
 1790 |     operator-(const move_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1790:5: note:   template argument deduction/substitution failed:
a.cc:136:30: note:   mismatched types 'const std::move_iterator<_IteratorL>' and 'long long int'
  136 |     long long index=it-C.end();
      |                              ^
/usr/include/c++/14/bits/stl_iterator.h:1312:5: note: candidate: 'template<class _IteratorL, class _IteratorR, class _Container> decltype ((__lhs.base() - __rhs.base())) __gnu_cxx::operator-(const __normal_iterator<_IteratorL, _Container>&, const __normal_iterator<_IteratorR, _Container>&)'
 1312 |     operator-(const __normal_iterator<_IteratorL, _Container>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1312:5: note:   template argument deduction/substitution failed:
a.cc:136:30: note:   mismatched types 'const __gnu_cxx::__normal_iterator<_IteratorL, _Container>' and 'long long int'
  136 |     long long index=it-C.end();
      |                              ^
/usr/include/c++/14/bits/stl_iterator.h:1325:5: note: candidate: 'template<class _Iterator, class _Container> typename __gnu_cxx::__normal_iterator<_Iterator, _Container>::difference_type __gnu_cxx::operator-(const __normal_iterator<_Iterator, _Container>&, const __normal_iterator<_Iterator, _Container>&)'
 1325 |     operator-(const __normal_iterator<_Iterator, _Container>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1325:5: note:   template argument deduction/substitution failed:
a.cc:136:30: note:   mismatched types 'const __gnu_cxx::__normal_iterator<_Iterator, _Container>' and 'long long int'
  136 |     long long index=it-C.end();
      |                              ^
a.cc:137:30: error: cannot convert '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' to 'long long int' in initialization
  137 |     long long itt=lower_bound(A.begin(),A.end(),B[i]);
      |                   ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
      |                              |
      |                              __gnu_cxx::__normal_iterator<int*, std::vector<int> >
a.cc:138:26: error: cannot convert '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' to 'long long int' in initialization
  138 |     long long indexx=-itt+A.begin();
      |                      ~~~~^~~~~~~~~~
      |                          |
      |                          __gnu_cxx::__normal_iterator<int*, std::vector<int> >