Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {
  ll N;
  cin >> N;
  vector<ll> L(N);
  for (ll &e : L) {
    cin >> e;
  }
  sort(L.begin(),L.end());
  
  ll tri = 0;
  for (ll i = 0; i < N-2; i++) {
    for (ll j = i+1; j < N-1; j++) {
      auto itr1 = find(L.begin(), L.end, L[j]);
      auto itr2 = lower_bound(L.begin(), L.end(), L[i]+L[j]);
      itr2--;
      tri += distance(itr1, itr2);
    }
  }
  cout << tri << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:23: error: no matching function for call to 'find(std::vector<long long int>::iterator, <unresolved overloaded function type>, __gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type&)'
   17 |       auto itr1 = find(L.begin(), L.end, L[j]);
      |                   ~~~~^~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:3842:5: note: candidate: '_IIter std::find(_IIter, _IIter, const _Tp&) [with _IIter = __gnu_cxx::__normal_iterator<long long int*, vector<long long int> >; _Tp = long long int]'
 3842 |     find(_InputIterator __first, _InputIterator __last,
      |     ^~~~
/usr/include/c++/14/bits/stl_algo.h:3842:49: note:   no known conversion for argument 2 from '<unresolved overloaded function type>' to '__gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >'
 3842 |     find(_InputIterator __first, _InputIterator __last,
      |                                  ~~~~~~~~~~~~~~~^~~~~~
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:60:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator> std::find(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
   60 | find(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
      | ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:60:1: note:   candidate expects 4 arguments, 3 provided
In file included from /usr/include/c++/14/iterator:66,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:54:
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT, std::char_traits<_CharT> > >::__type std::find(istreambuf_iterator<_CharT, char_traits<_CharT> >, istreambuf_iterator<_CharT, char_traits<_CharT> >, const _CharT2&)'
  435 |     find(istreambuf_iterator<_CharT> __first,
      |     ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note:   template argument deduction/substitution failed:
a.cc:17:23: note:   '__gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >' is not derived from 'std::istreambuf_iterator<_CharT, std::char_traits<_CharT> >'
   17 |       auto itr1 = find(L.begin(), L.end, L[j]);
      |                   ~~~~^~~~~~~~~~~~~~~~~~~~~~~~