human
I found an interesting problem on https://leetcode.com/problems/reachable-nodes-in-subdivided-graph/:
Starting with an undirected graph (the "original graph") with nodes from 0 to N-1, subdivisions are made to some of the edges.
The graph is given as follows: edges[k] is a list of integer pairs (i, j, n) such that (i, j) is an edge of the original graph,
and n is the total number of new nodes on that edge. 
Then, the edge (i, j) is deleted from the original graph, n new nodes (x_1, x_2, ..., x_n) are added to the original graph,
and n+1 new edges (i, x_1), (x_1, x_2), (x_2, x_3), ..., (x_{n-1}, x_n), (x_n, j) are added to the original graph.
Now, you start at node 0 from the original graph, and in each move, you travel along one edge. 
Return how many nodes you can reach in at most M moves.
 
Example 1:
Input: edges = [[0,1,10],[0,2,1],[1,2,2]], M = 6, N = 3
Output: 13
Explanation: 
The nodes that are reachable in the final graph after M = 6 moves are indicated below.


Example 2:
Input: edges = [[0,1,4],[1,2,6],[0,2,8],[1,3,1]], M = 10, N = 4
Output: 23
 

Note:

0 <= edges.length <= 10000
0 <= edges[i][0] < edges[i][1] < N
There does not exist any i != j for which edges[i][0] == edges[j][0] and edges[i][1] == edges[j][1].
The original graph has no parallel edges.
0 <= edges[i][2] <= 10000
0 <= M <= 10^9
1 <= N <= 3000
A reachable node is a node that can be travelled to using at most M moves starting from node 0.

I tried it in Python, but could not do it. Can you solve it?

 ... What is a the Python program you requested?
assistant
#Here is the Python program you requested.

import collections
class Solution:
    def reachableNodes(self, edges: List[List[int]], M: int, N: int) -> int:
        graph = collections.defaultdict(dict)
        for i, j, w in edges:
            graph[i][j] = graph[j][i] = w
        # min queue for dijastra (distance from source, vertex)
        pq = [(0,0)]
        # weight used from u to v
        used = {}
        # min distance from source
        dist = {0: 0}
        res = 0
        
        while pq:
            d, v = heapq.heappop(pq)
            # dist in this path greater than previous route, no need to searching
            if d > dist[v]:
                continue
            # count this vertex
            res += 1
            
            for nei, weight in list(graph[v].items()):
                # insert how much weight/nodes can be used in edge v->nei
                use_wei = min(weight, M - d)
                used[v, nei] = use_wei
                
                # get min dis to next node
                d_min = d + weight + 1
                # if next node is not visited and distance smaller than M + 1
                # or has been visited but has greater distance from source
                # we can update distance and push new vertex to heap
                if d_min < dist.get(nei, M + 1):
                    dist[nei] = d_min
                    heapq.heappush(pq,(d_min, nei))
                    
        # insert traveled mid nodes to res
        for i, j, w in edges:
            res += min(w, used.get((i, j), 0) + used.get((j, i), 0))
        return res