
"""simple docstring"""




A__      :	Dict          =    {0: [2, 3], 1: [0], 2: [1], 3: [4], 4: []}

A__      :	Optional[int]          =    {0: [1, 2, 3], 1: [2], 2: [0], 3: [4], 4: [5], 5: [3]}



def 							a__ (				lowerCAmelCase	:       dict[int, list[int]]       ,    lowerCAmelCase	:       int       ,    lowerCAmelCase	:       list[bool]		):






     '''simple docstring'''
     UpperCAmelCase__							: Any 							=						True
     UpperCAmelCase__							: Union[str, Any] 							=						[]

     for neighbour in graph[vert]:
          if not visited[neighbour]:
               order += topology_sort(lowerCAmelCase       ,    lowerCAmelCase       ,    lowerCAmelCase		)

     order.append(lowerCAmelCase		)

     return order



def 							a__ (				lowerCAmelCase	:       dict[int, list[int]]       ,    lowerCAmelCase	:       int       ,    lowerCAmelCase	:       list[bool]		):






     '''simple docstring'''
     UpperCAmelCase__							: str 							=						True
     UpperCAmelCase__							: List[Any] 							=						[vert]

     for neighbour in reversed_graph[vert]:
          if not visited[neighbour]:
               component += find_components(lowerCAmelCase       ,    lowerCAmelCase       ,    lowerCAmelCase		)

     return component



def 							a__ (				lowerCAmelCase	:       dict[int, list[int]]		):






     '''simple docstring'''
     UpperCAmelCase__							: Tuple 							=						len(lowerCAmelCase		) * [False]
     UpperCAmelCase__							: Tuple 							=						{vert: [] for vert in range(len(lowerCAmelCase		)		)}

     for vert, neighbours in graph.items():
          for neighbour in neighbours:
               reversed_graph[neighbour].append(lowerCAmelCase		)

     UpperCAmelCase__							: List[str] 							=						[]
     for i, was_visited in enumerate(lowerCAmelCase		):
          if not was_visited:
               order += topology_sort(lowerCAmelCase       ,    lowerCAmelCase       ,    lowerCAmelCase		)

     UpperCAmelCase__							: int 							=						[]
     UpperCAmelCase__							: str 							=						len(lowerCAmelCase		) * [False]

     for i in range(len(lowerCAmelCase		)		):
          UpperCAmelCase__							: int 							=						order[len(lowerCAmelCase		) - i - 1]
          if not visited[vert]:
               UpperCAmelCase__							: Union[str, Any] 							=						find_components(lowerCAmelCase       ,    lowerCAmelCase       ,    lowerCAmelCase		)
               components_list.append(lowerCAmelCase		)

     return components_list





"""simple docstring"""




def 							a__ (				lowerCAmelCase	:       list       ,    lowerCAmelCase	:       list		):






     '''simple docstring'''
     _validate_point(lowerCAmelCase		)
     _validate_point(lowerCAmelCase		)
     if len(lowerCAmelCase		) != len(lowerCAmelCase		):
          raise ValueError("Both points must be in the same n-dimensional space"		)

     return float(sum(abs(a - b		) for a, b in zip(lowerCAmelCase       ,    lowerCAmelCase		)		)		)



def 							a__ (				lowerCAmelCase	:       list[float]		):






     '''simple docstring'''
     if point:
          if isinstance(lowerCAmelCase       ,    lowerCAmelCase		):
               for item in point:
                    if not isinstance(lowerCAmelCase       ,    (int, float)		):
                         UpperCAmelCase__							: Tuple 							=						(
                             "Expected a list of numbers as input, found "
                             F"{type(lowerCAmelCase		).__name__}"
                         )
                         raise TypeError(lowerCAmelCase		)
          else:
               UpperCAmelCase__							: Dict 							=						F"Expected a list of numbers as input, found {type(lowerCAmelCase		).__name__}"
               raise TypeError(lowerCAmelCase		)
     else:
          raise ValueError("Missing an input"		)



def 							a__ (				lowerCAmelCase	:       list       ,    lowerCAmelCase	:       list		):






     '''simple docstring'''
     _validate_point(lowerCAmelCase		)
     _validate_point(lowerCAmelCase		)
     if len(lowerCAmelCase		) != len(lowerCAmelCase		):
          raise ValueError("Both points must be in the same n-dimensional space"		)

     return float(sum(abs(x - y		) for x, y in zip(lowerCAmelCase       ,    lowerCAmelCase		)		)		)


if __name__ == "__main__":
    import doctest

    doctest.testmod()



