Language: C++

#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FFOR(i,a,b) for(int i=(a);i<=(b);i++)
#define REP(i,b) FOR(i,0,b)
#define RREP(i,b) FFOR(i,1,b)
#define PB push_back
#define F first
#define S second
#define BE(c) c.begin(),c.end()
using namespace std;
typedef long long LL;
typedef LL ut;
typedef long double ld;
typedef pair<ut,ut> pr;
typedef vector<pr> Vpr;
typedef vector<ut> VI;
typedef pair<ut,pr> ppr;
typedef vector<ppr> Vppr;
typedef priority_queue<pr,Vpr,greater<pr> > PQ;
typedef priority_queue<ppr,Vppr,greater<ppr> > PpprQ;
const int SIZE=5+3*1e+5;
const LL INF=1LL<<30;
const ld eps=1e-6;
const LL p=7+1e+9;
PpprQ qu;
PQ legi;
LL least[SIZE];
LL N,M,K,D,SS,a,b,c;
int main(){
	cin >> N >> M >> K >> D >> SS;
	REP(i,M){
		scanf("%lld %lld %lld",&a,&b,&c);
		qu.push(ppr(a,pr(b,c)));
	}
	FOR(i,1,N+1) legi.push(pr(0,i));
	if(N>M){
		cout << D*K << endl;
		return 0;
	}
	LL legid=0,score=0;
	LL loops=0;
	qu.push(ppr(SS+D,pr(INF,INF)));
	while(!qu.empty() && legid<K){
		LL target=qu.top().S.S;
		LL times=qu.top().S.F;
		LL start=qu.top().F;
		qu.pop();
		if(50000<loops++) return 0;
		if(target==INF){
			while(!legi.empty() && legi.top().F!=least[legi.top().S]){

			 if(50000<loops++) return 0;
			 legi.pop();
			}
			if(!legi.empty()) start=max(start,legi.top().F);
			else start=start;
			score=start;
			qu.push(ppr(start+D,pr(INF,INF)));
			legid++;
		}
		else{
			target=min(target,SIZE-1);
			least[target]=max(least[target],start)+times;
			legi.push(pr(least[target],target));
			}
	}
	cout << score-SS << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:62:35: error: no matching function for call to 'min(LL&, int)'
   62 |                         target=min(target,SIZE-1);
      |                                ~~~^~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:62:35: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   62 |                         target=min(target,SIZE-1);
      |                                ~~~^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:62:35: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   62 |                         target=min(target,SIZE-1);
      |                                ~~~^~~~~~~~~~~~~~~