Language: C++

#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <algorithm>

#define rep(i,n) for(int i=0; i<(n); i++)
#define rrep(i,n) for(int i=(n)-1; i>=0; i--)
#define all(X) (X).begin(),(X).end()

using namespace std;
typedef long long int ll;
typedef pair<int,int> pii;

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

template<class A, size_t N, class T> void Fill(A (&a)[N], const T &v){ fill( (T*)a, (T*)(a+N), v ); }

const ll INF = 1e15;


int main(){
	ll N, E, T;
	ll x[100005]={};

	cin >> N >> E >> T;
	rep(i,N) cin >> x[i];
	x[N] = E;

	N = min(N, 2000);

	ll dp[2][100005]={};
	rep(i,N){
		Fill( dp[(i+1)%2], INF );
		ll dist = x[i+1] - x[i];
		rep(j,i+1){
			chmin( dp[(i+1)%2][j], dp[i%2][j] + dist );

			ll back = (x[i] - x[j]) * 2;
			ll t = max( back, T );
			chmin( dp[(i+1)%2][i+1], dp[i%2][j] + t + dist );
		}
		//rep(j,N+1) cout << dp[(i+1)%2][j] << " "; cout << endl;
	}

	ll ans = dp[N%2][N] + x[0];// + E-x[N-1];
	cout << ans << endl;

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:31:16: error: no matching function for call to 'min(ll&, int)'
   31 |         N = min(N, 2000);
      |             ~~~^~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 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_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:31:16: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   31 |         N = min(N, 2000);
      |             ~~~^~~~~~~~~
/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,
                 from a.cc:5:
/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:31:16: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   31 |         N = min(N, 2000);
      |             ~~~^~~~~~~~~