Language: C++

#include <bits/stdc++.h>

using namespace std;

#define f0r(a, b) for (long long a = 0; a < b; a++)
#define f1r(a, b, c) for (long long a = b; a < c; a++)
#define f0rd(a, b) for (long long a = b; a >= 0; a--)
#define f1rd(a, b, c) for (long long a = b; a >= c; a--)
#define ms(arr, v) memset(arr, v, sizeof(arr))
#define mp(a, b) make_pair(a, b)
#define pb push_back
#define f first
#define s second

#define ao(a, n) {for (int ele = 0; ele < n; ele++) { if (ele) cout << " "; cout << a[ele]; } cout << endl;}

typedef long long ll;
typedef double ld;
typedef long double lld;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpi;
typedef vector<pll> vpl;

const ll inf = 1e12;
const ll mod = 1e9 + 7;

double graph[1005][1005];

int main() {
    ios_base::sync_with_stdio(false);

    ll xs, ys, xt, yt;

    cin >> xs >> ys >> xt >> yt;

    ll n; cin >> n;

    pair<ll, pair<ll, ll> > pos[n + 2];

    pos[0] = mp(0, mp(xs, ys));

    for (int i = 0; i < n; i++) {
        ll x, y, r;

        cin >> x >> y >> r;

        pos[i + 1] = mp(r, mp(x, y));
    }

    pos[n + 1] = mp(0, mp(xt, yt));


    for (int i = 0; i <= n + 1; i++) {
        for (int j = i+1; j <= n + 1; j++) {
            graph[i][j] = max((sqrt((pos[i].s.f - pos[j].s.f) * (pos[i].s.f - pos[j].s.f)  + (pos[i].s.s - pos[j].s.s) * (pos[i].s.s - pos[j].s.s)) - pos[i].f - pos[j].f), 0.0);
            graph[j][i] = graph[i][j];

            //cout << graph[i][j] << endl;
        }
    }

    //do dijkstras

    bool mark[n+1];


    double dists[n+1];

    dists[0] = 0;
    mark[0] = 0;

    for (int i = 1; i <= n + 1; i++) {
        dists[i] = 1e18;
        mark[i] = 0;
    }

    priority_queue<pair<double, ll>, vector<pair<double, int> >, greater<pair<double, ll> > > pq;

    pq.push(mp(dists[0], 0));

    while (!pq.empty()) {
        ll u = pq.top().s;

//        cout << u << endl;

        pq.pop();
        if (mark[u]) continue;

        mark[u] = true;

        for (int i = 0; i <= n + 1; i++) {
            if (i == u) continue;

            if (dists[i] > dists[u] + graph[i][u]) {
                dists[i] = dists[u] + graph[i][u];
                pq.push(mp(dists[i], i));
            }
        }

    }

    std::cout << std::setprecision(10) << endl;
    cout << fixed;



    cout << dists[n + 1] << endl;



}


Compiler output:
In file included from /usr/include/c++/14/queue:66,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:157,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_queue.h: In instantiation of 'class std::priority_queue<std::pair<double, long long int>, std::vector<std::pair<double, int> >, std::greater<std::pair<double, long long int> > >':
a.cc:81:95:   required from here
   81 |     priority_queue<pair<double, ll>, vector<pair<double, int> >, greater<pair<double, ll> > > pq;
      |                                                                                               ^~
/usr/include/c++/14/bits/stl_queue.h:520:67: error: static assertion failed: value_type must be the same as the underlying container
  520 |       static_assert(is_same<_Tp, typename _Sequence::value_type>::value,
      |                                                                   ^~~~~
/usr/include/c++/14/bits/stl_queue.h:520:67: note: 'std::integral_constant<bool, false>::value' evaluates to false