input: from typing import List
  from heapq import heappop, heappush
  
  def find_minimum_travel_time(n: int, edges: List[List[int]], disappear_times: List[int]) -> List[int]:
      """
      You have an undirected graph containing n nodes. Given a 2D array edges where edges[i] = [ui, vi, lengthi], this describes a connection between nodes ui and vi with a travel time of lengthi units.
  
      You are also provided an array disappear_times, which specifies the time at which each node vanishes from the graph and becomes inaccessible.
  
      Note that the graph could be disconnected or have multiple edges.
  
      The function should return an array result, where result[i] is the minimum travel time required to reach node i from node 0. If node i cannot be reached from node 0, then result[i] should be -1.
  
      Examples:
      >>> find_minimum_travel_time(3, [[0,1,2],[1,2,1],[0,2,4]], [1,1,5])
      [0,-1,4]
      >>> find_minimum_travel_time(3, [[0,1,2],[1,2,1],[0,2,4]], [1,3,5])
      [0,2,3]
      >>> find_minimum_travel_time(2, [[0,1,1]], [1,1])
      [0,-1]
  
      Constraints:
      1 <= n <= 50,000
      0 <= edges.length <= 100,000
      edges[i] == [ui, vi, lengthi]
      0 <= ui, vi <= n - 1
      1 <= lengthi <= 100,000
      disappear_times.length == n
      1 <= disappear_times[i] <= 100,000
      """
output:     import heapq
      from collections import defaultdict
      import sys
      
      graph = defaultdict(list)
      for u, v, length in edges:
          graph[u].append((v, length))
          graph[v].append((u, length))
          
      pq = [(0, 0)]  # (time, node)
      min_time = [sys.maxsize] * n
      min_time[0] = 0
      
      while pq:
          curr_time, node = heapq.heappop(pq)
          
          if curr_time >= disappear_times[node]:
              continue
          
          for neighbor, length in graph[node]:
              new_time = curr_time + length
              if new_time < min_time[neighbor] and new_time < disappear_times[neighbor]:
                  min_time[neighbor] = new_time
                  heapq.heappush(pq, (new_time, neighbor))
      
      result = []
      for i in range(n):
          if min_time[i] == sys.maxsize:
              result.append(-1)
          else:
              result.append(min_time[i])
      
      return result