Language: C++

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int N = 2000;

long double x[N], y[N], r[N];
long double a[N][N];

long double dist(long double x1, long double y1, long double x2, long double y2) {
    return sqrt(pow(x1 - x2, 2.0) + pow(y1 - y2, 2.0));
}

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> x[0] >> y[0] >> x[1] >> y[1];
    int n;
    cin >> n;
    for (int i = 2; i < n + 2; ++i) {
        cin >> x[i] >> y[i] >> r[i];
    }
    for (int i = 0; i < n + 2; ++i) {
        for (int j = 0; j < n + 2; ++j) {
            a[i][j] = max(0.0, dist(x[i], y[i], x[j], y[j]) - r[i] - r[j]);
        }
    }
    vector<long double> d(n + 2, 1e10);
    d[0] = 0;
    set<pair<long double, int>> q;
    q.insert({ 0, 0 });
    while (!q.empty()) {
        int v = q.begin()->second;
        q.erase(q.begin());
        for (int j = 0; j < n + 2; ++j) {
            if (d[v] + a[v][j] < d[j]) {
                q.erase({ d[j], j });
                d[j] = d[v] + a[v][j];
                q.insert({ d[j], j });
            }
        }
    }
    cout << fixed << setprecision(30) << d[1];
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:26: error: no matching function for call to 'max(double, long double)'
   30 |             a[i][j] = max(0.0, dist(x[i], y[i], x[j], y[j]) - r[i] - r[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:30:26: note:   deduced conflicting types for parameter 'const _Tp' ('double' and 'long double')
   30 |             a[i][j] = max(0.0, dist(x[i], y[i], x[j], y[j]) - r[i] - r[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:30:26: note:   mismatched types 'std::initializer_list<_Tp>' and 'double'
   30 |             a[i][j] = max(0.0, dist(x[i], y[i], x[j], y[j]) - r[i] - r[j]);
      |                       ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~