



'''simple docstring'''





from collections import deque

def        a_     (							_lowerCAmelCase       )      ->      Union[str, Any]:
  __lowerCamelCase       :       List[str]           = len(_lowerCAmelCase       )
  __lowerCamelCase       :       List[str]           = deque()
  __lowerCamelCase       :       Union[str, Any]           = [False for _ in range(_lowerCAmelCase       )]
  __lowerCamelCase       :       str           = [-1 for _ in range(_lowerCAmelCase       )]
  __lowerCamelCase       :       Optional[int]           = index_of[:]

  def strong_connect(_lowerCAmelCase       ,_lowerCAmelCase       ,_lowerCAmelCase       ):
    __lowerCamelCase       :       Any           = index  # the number when this node is seen
    __lowerCamelCase       :       str           = index  # lowest rank node reachable from here
    index += 1
    stack.append(_lowerCAmelCase       )
    __lowerCamelCase       :       Any           = True

    for w in g[v]:
      if index_of[w] == -1:
        __lowerCamelCase       :       Dict           = strong_connect(_lowerCAmelCase       ,_lowerCAmelCase       ,_lowerCAmelCase       )
        __lowerCamelCase       :       List[str]           = (
            lowlink_of[w] if lowlink_of[w] < lowlink_of[v] else lowlink_of[v]
        )
      elif on_stack[w]:
        __lowerCamelCase       :       List[Any]           = (
            lowlink_of[w] if lowlink_of[w] < lowlink_of[v] else lowlink_of[v]
        )

    if lowlink_of[v] == index_of[v]:
      __lowerCamelCase       :       List[str]           = []
      __lowerCamelCase       :       str           = stack.pop()
      __lowerCamelCase       :       int           = False
      component.append(_lowerCAmelCase       )
      while w != v:
        __lowerCamelCase       :       Any           = stack.pop()
        __lowerCamelCase       :       List[Any]           = False
        component.append(_lowerCAmelCase       )
      components.append(_lowerCAmelCase       )
    return index

  __lowerCamelCase       :       List[str]           = []
  for v in range(_lowerCAmelCase       ):
    if index_of[v] == -1:
      strong_connect(_lowerCAmelCase       ,0       ,_lowerCAmelCase       )

  return components

def        a_     (							_lowerCAmelCase       ,_lowerCAmelCase       )      ->      List[str]:
  __lowerCamelCase       :       Any           = [[] for _ in range(_lowerCAmelCase       )]
  for u, v in edges:
    g[u].append(_lowerCAmelCase       )
  return g


if __name__ == "__main__":
   # Test
   _UpperCamelCase											=						7
   _UpperCamelCase											=						[0, 0, 1, 2, 3, 3, 4, 4, 6]
   _UpperCamelCase											=						[1, 3, 2, 0, 1, 4, 5, 6, 5]
   _UpperCamelCase											=						[(u, v) for u, v in zip(source, target)]
   _UpperCamelCase											=						create_graph(n_vertices, edges)

   assert [[5], [6], [4], [3, 2, 1, 0]] == tarjan(g)











'''simple docstring'''





from collections.abc import Sequence

def        a_     (							_lowerCAmelCase       ,_lowerCAmelCase       )      ->      float:
  return sum(c * (x**i) for i, c in enumerate(_lowerCAmelCase       )       )

def        a_     (							_lowerCAmelCase       ,_lowerCAmelCase       )      ->      float:
  __lowerCamelCase       :       Any           = 0.0
  for coeff in reversed(_lowerCAmelCase       ):
    __lowerCamelCase       :       Tuple           = result * x + coeff
  return result


if __name__ == "__main__":
   _UpperCamelCase											=						(0.0, 0.0, 5.0, 9.3, 7.0)
   _UpperCamelCase											=						1_0.0
   print(evaluate_poly(poly, x))
   print(horner(poly, x))






