input: Write a Python function called minimum_time_to_nodes, which calculates the minimum time required to reach each node from node 0. The function should take the number of nodes 'n', a list of edges where each edge is defined by [ui, vi, lengthi], and a list 'disappear' denoting when each node disappears. Return an array representing the minimum units of time to reach each node from node 0, with -1 for unreachable nodes.
  
  
  from typing import List
  from heapq import heappop, heappush
  
  def minimum_time_to_nodes(n: int, edges: List[List[int]], disappear: List[int]) -> List[int]:
      """
      Given an undirected graph, find the shortest path from node 0 to all other nodes,
      considering some nodes disappear over time specified by the 'disappear' list.
  
      Args:
      n (int): Number of nodes in the graph.
      edges (List[List[int]]): List of edges where each edge is represented as [ui, vi, lengthi].
      disappear (List[int]): List indicating the time when each node will disappear.
  
      Returns:
      List[int]: List of minimum time to reach each node from node 0, where -1 denotes unreachable nodes.
      
      Examples:
      >>> minimum_time_to_nodes(3, [[0,1,2],[1,2,1],[0,2,4]], [1,1,5])
      [0,-1,4]
      >>> minimum_time_to_nodes(3, [[0,1,2],[1,2,1],[0,2,4]], [1,3,5])
      [0,2,3]
      >>> minimum_time_to_nodes(2, [[0,1,1]], [1,1])
      [0,-1]
      
      Constraints:
      - 1 <= n <= 50,000
      - 0 <= edges.length <= 100,000
      - edges[i] = [ui, vi, lengthi], where 0 <= ui, vi <= n - 1 and 1 <= lengthi <= 100,000
      - disappear.length == n
      - 1 <= disappear[i] <= 100,000
      """
  
output: def minimum_time_to_nodes(n: int, edges: List[List[int]], disappear: List[int]) -> List[int]:
      from heapq import heappop, heappush
      import sys
  
      graph = [[] for _ in range(n)]
      for u, v, length in edges:
          graph[u].append((v, length))
          graph[v].append((u, length))
  
      min_time = [sys.maxsize] * n
      min_time[0] = 0
      pq = [(0, 0)]  # (time, node)
  
      while pq:
          curr_time, u = heappop(pq)
          if curr_time > min_time[u] or curr_time >= disappear[u]:
              continue
  
          for v, length in graph[u]:
              if curr_time + length < min_time[v] and curr_time + length < disappear[v]:
                  min_time[v] = curr_time + length
                  heappush(pq, (curr_time + length, v))
  
      return [t if t != sys.maxsize else -1 for t in min_time]