Language: C++

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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}


/*
string s, t;
int main(void){
	cin >> s >> t;
	int32 in = 0, cnt = 0;
	REP(i, s.size()){
		if(s[i] == t[in]){
			in++;
			if(in == t.size()){
				in = 0;
				cnt++;
			}
		}else{
			in = 0;
		}
	}
	int32 num = 1;
	int32 res = 0;
	while(cnt){
		cnt = (cnt-1)/2;
		res++;
	}
	cout << res << endl;
}
*/

vector<PII> G[110][1010];
int main(void){
	int32 W, H, N;
	cin >> W >> H >> N;
	vector<PII> vs(N+1);
	vs[0] = {1, 1};
	REP(i, N){
		cin >> vs[i+1].fs >> vs[i+1].sc;
	}
	vector<vector<int32>> d(110, vector<int32>(1010, INF));
	d[0][0] = 0;
	using tup = tuple<int32, int32, int32>;
	priority_queue<tup, vector<tup>, greater<tup>> pq;
	pq.push(tup(0, 0, 0));
	auto dis = [&](int32 a, int32 b){
		return abs(vs[a].fs-vs[b].fs)+abs(vs[a].sc-vs[b].sc);
	};
	while(pq.size()){
		int32 v, dd, r;
		tie(dd, v, r) = pq.top(); pq.pop();
		if(d[v][r] < dd) continue;
		REP(i, vs.size()){
			if(i == v) continue;
			int32 rr = max((int32)0, dis(i, v)-r);
			if(d[i][rr] > d[v][r]+rr){
				d[i][rr] = d[v][r]+rr;
				pq.push(tup(d[i][rr], i, rr));
			}
		}
	}
	vs.push_back({W, H});
	int32 res = INF;
	FOR(i, 1, vs.size()-1){
		REP(j, 1010){
			res = min((int64)res, d[i][j]+max(0LL, dis(i, vs.size()-1)-j));
		}
	}
	cout << res << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:85:58: error: no matching function for call to 'max(long long int, long int)'
   85 |                         res = min((int64)res, d[i][j]+max(0LL, dis(i, vs.size()-1)-j));
      |                                                       ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
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:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:85:58: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long int')
   85 |                         res = min((int64)res, d[i][j]+max(0LL, dis(i, vs.size()-1)-j));
      |                                                       ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303: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:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:85:58: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   85 |                         res = min((int64)res, d[i][j]+max(0LL, dis(i, vs.size()-1)-j));
      |                                                       ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~