Language: C++

#include "bits/stdc++.h"
#define ll long long
#define rep2(i,a,b) for(int i=(a);i<=(b);++i)
#define rep(i,n) for(int i=0;i<n;i++)
#define pii pair<int,int>
#define ti3 tuple<int,int,int>
ll int MOD=998244353;
double INF=1000000000.0;
 
using namespace std;
string alphabet("abcdefghijklmnopqrstuvwxyz");

main(){
    double xs,ys,xg,yg;
    cin>>xs>>ys>>xg>>yg;

    int n;
    cin>>n;
    long double t[2100][3];
    rep2(i,1,n){
        cin>>t[i][0]>>t[i][1]>>t[i][2];
    }
    t[0][0]=xs;t[0][1]=ys; t[0][2]=0;
    n++;
    t[n][0]=xg;t[n][1]=yg; t[n][2]=0;
    long double d[2100]={};
    d[0]=0.0000000000;
    int visited[1100]={};
    visited[0]=1;

    rep2(i,1,n){d[i]=INF;}
    int pos=0;
    
    while(1){
        long double minimum=INF*3;
        int minimumnum=0;
        rep2(i,0,n){
            d[i]=min(d[i],d[pos]+max(0.0,sqrt((pow(t[pos][0]-t[i][0],2)
            +pow(t[pos][1]-t[i][1],2)))-t[pos][2]-t[i][2]));
        }
        rep2(i,0,n){
            if(d[i]<minimum&&!visited[i]){
                minimum=d[i]; minimumnum=i;
            }
        }
        pos=minimumnum; visited[minimumnum]=1;
        if(minimumnum==n){
            printf("%.15f",d[n]); return 0;
        }
        
    }
}

Compiler output:
a.cc:13:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   13 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:38:37: error: no matching function for call to 'max(double, long double)'
   38 |             d[i]=min(d[i],d[pos]+max(0.0,sqrt((pow(t[pos][0]-t[i][0],2)
      |                                  ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   39 |             +pow(t[pos][1]-t[i][1],2)))-t[pos][2]-t[i][2]));
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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:38:37: note:   deduced conflicting types for parameter 'const _Tp' ('double' and 'long double')
   38 |             d[i]=min(d[i],d[pos]+max(0.0,sqrt((pow(t[pos][0]-t[i][0],2)
      |                                  ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   39 |             +pow(t[pos][1]-t[i][1],2)))-t[pos][2]-t[i][2]));
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:38:37: note:   mismatched types 'std::initializer_list<_Tp>' and 'double'
   38 |             d[i]=min(d[i],d[pos]+max(0.0,sqrt((pow(t[pos][0]-t[i][0],2)
      |                                  ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   39 |             +pow(t[pos][1]-t[i][1],2)))-t[pos][2]-t[i][2]));
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~