Buggy python submission (verdict: Time Limit Exceeded):
from scipy.sparse.csgraph import csgraph_from_dense,dijkstra
from numpy.linalg import norm
xs, ys, xt, yt = map(int, input().split())
N = int(input())
p=[(xs, ys, 0), (xt, yt, 0)]
edge = [[-1]*(N+2) for _ in range(N+2)]
edge[0][1] = edge[1][0] = norm([xs-xt, ys-yt])
for i in range(N):
    x, y, r = map(int, input().split())
    for j in range(len(p)):
        x1, y1, r1 = p[j]
        edge[i+2][j] = edge[j][i+2] = max(norm([x-x1, y-y1])-r-r1, 0.0)
    p.append((x, y, r))
G = csgraph_from_dense(edge,null_value=-1)  
print(dijkstra(G,indices=0)[1])   


Fixed submission:
from scipy.sparse.csgraph import csgraph_from_dense,dijkstra

xs, ys, xt, yt = map(int, input().split())
n = int(input())

p = [(xs,ys,0),(xt,yt,0)]
for i in range(2,n+2):
    p.append(tuple(map(int,input().split())))
edge = [[-1]*(n+2)for i in range(n+2)]
 
for i in range(n+2):
    for j in range(i+1,n+2):
        edge[i][j] = edge[j][i] =  max(((p[i][0]-p[j][0])**2+(p[i][1]-p[j][1])**2)**0.5 - p[i][2] - p[j][2],0.0)

#ここから
G = csgraph_from_dense(edge,null_value=-1)
print(dijkstra(G,indices=0)[1])

Buggy python submission (verdict: Time Limit Exceeded):
from scipy.sparse.csgraph import csgraph_from_dense,dijkstra
from numpy.linalg import norm
from numpy import array
xs, ys, xt, yt = map(int, input().split())
N = int(input())
p=[(xs, ys, 0), (xt, yt, 0)]
edge = [[-1]*(N+2) for _ in range(N+2)]
edge[0][1] = edge[1][0] = norm(array([xs-xt, ys-yt]))
for i in range(N):
    x, y, r = map(int, input().split())
    for j in range(len(p)):
        x1, y1, r1 = p[j]
        edge[i+2][j] = edge[j][i+2] = max(norm(array([x-x1, y-y1]))-r-r1, 0.0)
    p.append((x, y, r))
G = csgraph_from_dense(edge,null_value=-1)  
print(dijkstra(G,indices=0)[1])   

Fixed submission:
from scipy.sparse.csgraph import csgraph_from_dense,dijkstra

xs, ys, xt, yt = map(int, input().split())
n = int(input())

p = [(xs,ys,0),(xt,yt,0)]
for i in range(2,n+2):
    p.append(tuple(map(int,input().split())))
edge = [[-1]*(n+2)for i in range(n+2)]
 
for i in range(n+2):
    for j in range(i+1,n+2):
        edge[i][j] = edge[j][i] =  max(((p[i][0]-p[j][0])**2+(p[i][1]-p[j][1])**2)**0.5 - p[i][2] - p[j][2],0.0)

#ここから
G = csgraph_from_dense(edge,null_value=-1)
print(dijkstra(G,indices=0)[1])

Buggy python submission (verdict: Runtime Error):
from scipy.sparse.csgraph import csgraph_from_dense,dijkstra
from numpy.linalg import norm
from numpy import array
xs, ys, xt, yt = map(int, input().split())
N = int(input())
p=[(xs, ys, 0), (xt, yt, 0)]
edge = [[-1]*(n+2) for _ in range(n+2)]
edge[0][1] = edge[1][0] = norm(array([xs-xt, ys-yt]))
for i in range(N):
    x, y, r = map(int, input().split())
    for j in range(len(p)):
        x1, y1, r1 = p[j]
        edge[i+2][j] = edge[j][i+2] = max(norm(array([x-x1, y-y1]))-r-r1, 0.0)
    p.append((x, y, r))
G = csgraph_from_dense(edge,null_value=-1)  
print(dijkstra(G,indices=0)[1])   

Fixed submission:
from scipy.sparse.csgraph import csgraph_from_dense,dijkstra

xs, ys, xt, yt = map(int, input().split())
n = int(input())

p = [(xs,ys,0),(xt,yt,0)]
for i in range(2,n+2):
    p.append(tuple(map(int,input().split())))
edge = [[-1]*(n+2)for i in range(n+2)]
 
for i in range(n+2):
    for j in range(i+1,n+2):
        edge[i][j] = edge[j][i] =  max(((p[i][0]-p[j][0])**2+(p[i][1]-p[j][1])**2)**0.5 - p[i][2] - p[j][2],0.0)

#ここから
G = csgraph_from_dense(edge,null_value=-1)
print(dijkstra(G,indices=0)[1])