Language: C++

#include <cstdio>
#include <algorithm>
#include <vector>
#include <cstring>
#include <numeric>
#include <cassert>
#include <cmath>
#include <map>
#include <set>

using namespace std;
typedef unsigned int uint;
typedef long long LL;
typedef pair<LL, LL> PLL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int, int> PII;
typedef vector<PII > VPII;
typedef vector<VPII> VVPII;

#define FOR(k,a,b) for(int k(a); k < (b); ++k)
#define REP(k,a) for(int k=0; k < (a); ++k)
#define ABS(a) ((a)>0?(a):-(a))

long double calcDist(LL x, LL y, LL r, LL x2, LL y2, LL r2)
{
	LL d = (x - x2)*(x - x2) + (y - y2)*(y - y2);
	long double res = sqrt((long double) d);
	return max(res - r - r2,0);
}

int main(int argc, char** argv) {
#ifdef HOME
	freopen("in.txt", "rb", stdin);
	freopen("out.txt", "wb", stdout);
#endif
	int x1, x2, y1, y2, N;
	scanf("%d %d %d %d %d", &x1, &y1, &x2, &y2,&N);
	vector<int> x(N+2), y(N+2), r(N+2);
	REP(i, N)
	{
		scanf("%d %d %d", &x[i], &y[i], &r[i]);
	}
	x[N] = x1, y[N] = y1, x[N + 1] = x2, y[N + 1] = y2;
	vector<vector<long double > > dist(N + 2,vector<long double>(N+2) );
	REP(i, N+2) REP(j,N+2)
	{
		dist[i][j] = calcDist(x[i], y[i], r[i], x[j], y[j], r[j]);
	}
	const long double INF = 1e11;
	vector<long double> d(N+2,INF);
	set<pair<long double, int > > Q;
	d[N] = 0;
	Q.insert(make_pair(0, N));
	while(!Q.empty())
	{
		long double actd = Q.begin()->first;
		int act = Q.begin()->second;
		Q.erase(Q.begin());
		REP(i, N + 2)
		{
			long double nd = actd + dist[act][i];
			if (d[i] > nd)
			{
				if (d[i] != INF)
				{
					Q.erase(make_pair(d[i], i));
				}
				d[i] = nd;
				Q.insert(make_pair(nd, i));
			}
			
		}
	}
	printf("%.10f\n", d[N + 1]);
	return 0;
}

Compiler output:
a.cc: In function 'long double calcDist(LL, LL, LL, LL, LL, LL)':
a.cc:31:19: error: no matching function for call to 'max(long double, int)'
   31 |         return max(res - r - r2,0);
      |                ~~~^~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from a.cc:2:
/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:31:19: note:   deduced conflicting types for parameter 'const _Tp' ('long double' and 'int')
   31 |         return max(res - r - r2,0);
      |                ~~~^~~~~~~~~~~~~~~~
/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:31:19: note:   mismatched types 'std::initializer_list<_Tp>' and 'long double'
   31 |         return max(res - r - r2,0);
      |                ~~~^~~~~~~~~~~~~~~~