Language: C++

#include <iostream>
#include <vector>
using namespace std;

int main(){
  int N;
  cin >> N;
  vector<long> L(N);
  for(int i=0; i<N; ++i){
  	int x;
    cin >> x;
    L.insert(i,x);
  }
  sort(L.begin(),L.end());
  int triangles = 0;
  if(N>=3){
  for(int i=0; i<N-2; ++i){
    for(int j=i+1; j<N-1; ++j){
      for(int k=j+1; k<N; k++){
      	if(L[i]+L[j]<=L[k]){++triangles;}
        else{break;}
      }
    }
  }
  }
  cout << triangles << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:13: error: no matching function for call to 'std::vector<long int>::insert(int&, int&)'
   12 |     L.insert(i,x);
      |     ~~~~~~~~^~~~~
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_vector.h:1484:9: note: candidate: 'template<class _InputIterator, class> std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(const_iterator, _InputIterator, _InputIterator) [with <template-parameter-2-2> = _InputIterator; _Tp = long int; _Alloc = std::allocator<long int>]'
 1484 |         insert(const_iterator __position, _InputIterator __first,
      |         ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:1484:9: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/vector:72:
/usr/include/c++/14/bits/vector.tcc:133:5: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(const_iterator, const value_type&) [with _Tp = long int; _Alloc = std::allocator<long int>; iterator = std::vector<long int>::iterator; const_iterator = std::vector<long int>::const_iterator; value_type = long int]'
  133 |     vector<_Tp, _Alloc>::
      |     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/vector.tcc:135:27: note:   no known conversion for argument 1 from 'int' to 'std::vector<long int>::const_iterator'
  135 |     insert(const_iterator __position, const value_type& __x)
      |            ~~~~~~~~~~~~~~~^~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1395:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(const_iterator, value_type&&) [with _Tp = long int; _Alloc = std::allocator<long int>; iterator = std::vector<long int>::iterator; const_iterator = std::vector<long int>::const_iterator; value_type = long int]'
 1395 |       insert(const_iterator __position, value_type&& __x)
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:1395:29: note:   no known conversion for argument 1 from 'int' to 'std::vector<long int>::const_iterator'
 1395 |       insert(const_iterator __position, value_type&& __x)
      |              ~~~~~~~~~~~~~~~^~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1413:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(const_iterator, std::initializer_list<_Tp>) [with _Tp = long int; _Alloc = std::allocator<long int>; iterator = std::vector<long int>::iterator; const_iterator = std::vector<long int>::const_iterator]'
 1413 |       insert(const_iterator __position, initializer_list<value_type> __l)
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:1413:29: note:   no known conversion for argument 1 from 'int' to 'std::vector<long int>::const_iterator'
 1413 |       insert(const_iterator __position, initializer_list<value_type> __l)
      |              ~~~~~~~~~~~~~~~^~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1439:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(const_iterator, size_type, const value_type&) [with _Tp = long int; _Alloc = std::allocator<long int>; iterator = std::vector<long int>::iterator; const_iterator = std::vector<long int>::const_iterator; size_type = long unsigned int; value_type = long int]'
 1439 |       insert(const_iterator __position, size_type __n, const value_type& __x)
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:1439:7: note:   candidate expects 3 arguments, 2 provided
a.cc:14:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   14 |   sort(L.begin(),L.end());
      |   ^~~~
      |   short