Language: C++

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define P pair<double,int>
#define PP pair<P,int>
#define fi first
#define se second
#define INF 1e9
#define MOD 1000000007
#define REP(i,n) for(int i=0;i<n;i++)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define all(x) (x).begin(),(x).end()
struct edge{
    int to;
    double cost;
};
const int MAX_V=1002;
int V;
vector<edge> G[MAX_V];
double d[MAX_V];
void dijkstra(int s){
    fill(d,d+V,INF);
    priority_queue<P,vector<P>,greater<P> > que;
    d[s]=0.0;
    que.push(P(0,s));
    while(que.size()){
        P p=que.top();que.pop();
        if(p.fi>d[p.se])continue;
        REP(i,G[p.se].size()){
            edge e=G[p.se][i];
            if(d[e.to]>p.fi+e.cost){
                d[e.to]=p.fi+e.cost;
                que.push(P(d[e.to],e.to));
            }
        }
    }
}
struct T{
    double x,y,r;
};
signed main(){
    vector<T> vec;
    REP(i,2){
        T t;
        cin>>t.x>>t.y;
        t.r=0;
        vec.pb(t);
    }
    cin>>V;
    REP(i,V){
        T t;
        cin>>t.x>>t.y>>t.r;
        vec.pb(t);
    }
    V+=2;
    REP(i,V){
        REP(j,V){
            edge t;
            t.to=j;
            t.cost=max(0.0,sqrt(pow(vec[i].x-vec[j].x,2)+pow(vec[i].y-vec[j].y,2))-vec[i].r-vec[j].r);
            G[i].pb(t);
        }
    }
    dijkstra(0);
    printf("%.10f\n",d[1]);
    return 0;
}


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