Language: C++

#include <stdio.h>
#include <iostream>
#include <string.h>
#include <string>
#include <set>
#include <algorithm>
#include <queue>
#include <math.h>
#include <iomanip>
using namespace std;

double max(double a, double b)
{
    if(a<=b)
        return b;
    else
        return a;
}

double dist(pair <int, int> c1, pair <int, int> c2, int r1, int r2)
{
	return max(0, pow(((c1.first-c2.first)*(c1.first-c2.first)+(c1.second-c2.second)*(c1.second-c2.second)),0.5) - r1 - r2);
}


double min(double a, double b)
{
    if(a<=b)
        return a;
    else
        return b;
}

int main()
{
	pair <int, int> s;
	pair <int, int> e;
	cin>>s.first>>s.second;
	cin>>e.first>>e.second;
	int n;
	cin>>n;
	pair < pair<int, int>, int> list[1005];
	for(int i=1;i<=n;i++)
		cin>>list[i].first.first>>list[i].first.second>>list[i].second;
	list[0].first.first=s.first;
	list[0].first.second=s.second;
	list[0].second=0;
	list[n+1].first.first=e.first;
	list[n+1].first.second=e.second;
	list[n+1].second=0;


	vector <pair <int, double> > adj[1005];
	for(int i=0;i<=n+1;i++)
	{
		for(int j=i+1;j<=n+1;j++)
		{
			adj[i].push_back(make_pair(j,dist(list[i].first,list[j].first,list[i].second,list[j].second)));
			adj[j].push_back(make_pair(i,dist(list[i].first,list[j].first,list[i].second,list[j].second)));
		}
	}
	priority_queue <pair <double, int>, vector <pair <double, int> >, greater <pair <double, int> > > q;
	int start=0;
	 bool check[5000]={false};
	double distance[1005];
        for(int i=0;i<1005;i++)
            distance[i]=1e17;
        distance[start]=0;
        q.push(make_pair(0,start));
        while(!q.empty())
        {
            vector < pair<int, double> > ::iterator it;
            int flag=0;
            double temp;
            while(flag==0 and !q.empty())
            {
                temp=q.top().second;
                if(fabs(q.top().first-distance[temp])<=1e-9)
                    flag=1;
                else
                    q.pop();
            }
            if(q.empty())
                break;
            for(it=adj[temp].begin();it!=adj[temp].end();it++)
            {
                if(check[(*it).first]==false)
                {
                    if(distance[(*it).first]>q.top().first+(*it).second)
                    {
                        distance[(*it).first]=min(distance[(*it).first], q.top().first+(*it).second);
                        q.push(make_pair(distance[(*it).first], (*it).first));
                    }
                }
            }
            q.pop();
            check[temp]=true;
        }
        cout<< fixed << setprecision(15)<<distance[n+1];


	
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:78:47: error: invalid types 'double [1005][double]' for array subscript
   78 |                 if(fabs(q.top().first-distance[temp])<=1e-9)
      |                                               ^
a.cc:85:23: error: invalid types 'std::vector<std::pair<int, double> > [1005][double]' for array subscript
   85 |             for(it=adj[temp].begin();it!=adj[temp].end();it++)
      |                       ^
a.cc:85:45: error: invalid types 'std::vector<std::pair<int, double> > [1005][double]' for array subscript
   85 |             for(it=adj[temp].begin();it!=adj[temp].end();it++)
      |                                             ^
a.cc:97:18: error: invalid types 'bool [5000][double]' for array subscript
   97 |             check[temp]=true;
      |                  ^