Language: C++

#include <iostream>
#include <string>
#include <algorithm>
#include <cassert>
#include <limits>
#include <numeric>
#include <type_traits>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <functional>
#include <utility>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <complex>
#include <climits>
#include <time.h>

using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<string> vs;
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,0,n)

ll gcd(ll a, ll b) {
 	while (a && b) {
 		if (a >= b) a %= b;
 		else b %= a;
  	}
  	return a + b;
}
ll ketasum(ll n) { //桁の数字全ての和を返す 例: 112 -> 4
	ll sum=0;
	if (n<0) return 0;
	while (n>0) {
		sum += n%10;
		n /= 10;
	}
	return sum;
}

typedef pair<ll, ll> pair_t;

bool comp(const pair_t &a, const pair_t &b) {
        return a.first < b.first;
}

void sort2vectors(vector<ll> &av, vector<ll> &bv)
{ // ふたつの配列をまとめてそーと A[2,1] B[3,4] -> 1,4 2,3
        ll n = av.size();
        vector<pair_t> p(n);
        vector<ll> av2(n), bv2(n);
        for (ll i = 0; i < n; i++)
                p[i] = make_pair(av[i], bv[i]);
        sort(p.begin(), p.end(), comp);
        for (ll i = 0; i < n; i++) {
                av2[i] = p[i].first;
                bv2[i] = p[i].second;
        }
        av = av2;
        bv = bv2;
}
ll facctorialMethod(ll k){ //階乗
	ll s;
	if(k > 1){
		s = k*facctorialMethod(k-1);
	} else {
		s = 1;
	}
	return s;
}

map< int64_t, ll > prime_factor(int64_t n) {
	map< int64_t, ll > ret;
 	for(int64_t i = 2; i * i <= n; i++) {
    	while(n % i == 0) {
      		ret[i]++;
      		n /= i;
    	}
  	}
  	if(n != 1) ret[n] = 1;
  	return ret;
}
const ll mod = 1000000007;
const ll INF = 1e9;

// 変数定義start(vectorはresizeしようね)
ll N;
vl L;
// 変数定義end

void solve(){
	cin >> N;
	L.resize(N);
	REP(i, N){
		cin >> L[i];
	}
	sort(L.begin(), L.end());
	ll ans = 0;
	for(;;){
		REP(i, L.size()-1){
			if(L[i] == L[i+1]){
				L.erase(i,1);
				flag = true;
			}
		}
		if(!flag){
			break;
		}
	}

	sort(L.begin(), L.end());
	REP(i, N-2){
		for(ll j = i+1; j < N-1; j++){
			ll kagen = L[j];
			ll jogen = L[j] + L[i];
			auto c_kagentmp = upper_bound(L.begin(), L.end(), kagen);
			ll c_kagen = c_kagentmp - L.begin();
			auto c_jogentmp = lower_bound(L.begin(), L.end(), jogen);
			ll c_jogen = c_jogentmp - L.begin();
			if(c_kagen > c_jogen){
				continue;
			}
			ans += c_jogen - c_kagen;
		}
	}
	cout << ans << endl;
}

int main(){

	//clock_t start = clock();

	cout << std::fixed << std::setprecision(10);
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	solve();
	//clock_t end = clock();

	//const double time = static_cast<double>(end - start) / CLOCKS_PER_SEC * 1000.0;
	//printf("time %lf[ms]\n", time);
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:115:40: error: no matching function for call to 'std::vector<long long int>::erase(ll&, int)'
  115 |                                 L.erase(i,1);
      |                                 ~~~~~~~^~~~~
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:8:
/usr/include/c++/14/bits/stl_vector.h:1536:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(const_iterator) [with _Tp = long long int; _Alloc = std::allocator<long long int>; iterator = std::vector<long long int>::iterator; const_iterator = std::vector<long long int>::const_iterator]'
 1536 |       erase(const_iterator __position)
      |       ^~~~~
/usr/include/c++/14/bits/stl_vector.h:1536:7: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_vector.h:1564:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(const_iterator, const_iterator) [with _Tp = long long int; _Alloc = std::allocator<long long int>; iterator = std::vector<long long int>::iterator; const_iterator = std::vector<long long int>::const_iterator]'
 1564 |       erase(const_iterator __first, const_iterator __last)
      |       ^~~~~
/usr/include/c++/14/bits/stl_vector.h:1564:28: note:   no known conversion for argument 1 from 'll' {aka 'long long int'} to 'std::vector<long long int>::const_iterator'
 1564 |       erase(const_iterator __first, const_iterator __last)
      |             ~~~~~~~~~~~~~~~^~~~~~~
a.cc:116:33: error: 'flag' was not declared in this scope
  116 |                                 flag = true;
      |                                 ^~~~
a.cc:119:21: error: 'flag' was not declared in this scope
  119 |                 if(!flag){
      |                     ^~~~