



"""simple docstring"""






from collections import deque


def      _lowercase							(    __snake_case      )		->  Any:
			__lowerCAmelCase :    Any				=			len(__snake_case      )
			__lowerCAmelCase :    Tuple				=			deque()
			__lowerCAmelCase :    Dict				=			[False for _ in range(__snake_case      )]
			__lowerCAmelCase :    Optional[int]				=			[-1 for _ in range(__snake_case      )]
			__lowerCAmelCase :    Tuple				=			index_of[:]

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

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

						if lowlink_of[v] == index_of[v]:
									__lowerCAmelCase :    Tuple				=			[]
									__lowerCAmelCase :    Optional[Any]				=			stack.pop()
									__lowerCAmelCase :    str				=			False
									component.append(__snake_case      )
									while w != v:
												__lowerCAmelCase :    str				=			stack.pop()
												__lowerCAmelCase :    List[Any]				=			False
												component.append(__snake_case      )
									components.append(__snake_case      )
						return index

			__lowerCAmelCase :    str				=			[]
			for v in range(__snake_case      ):
						if index_of[v] == -1:
									strong_connect(__snake_case   ,0   ,__snake_case      )

			return components


def      _lowercase							(    __snake_case   ,__snake_case      )		->  str:
			__lowerCAmelCase :    Any				=			[[] for _ in range(__snake_case      )]
			for u, v in edges:
						g[u].append(__snake_case      )
			return g


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

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




"""simple docstring"""






def      _lowercase							(    __snake_case      )		->  float:
			return 10 - x * x


def      _lowercase							(    __snake_case   ,__snake_case      )		->  float:
			# Bolzano theory in order to find if there is a root between a and b
			if equation(__snake_case      ) * equation(__snake_case      ) >= 0:
						raise ValueError("Wrong space!"      )

			__lowerCAmelCase :    List[Any]				=			a
			while (b - a) >= 0.01:
						# Find middle point
						__lowerCAmelCase :    str				=			(a + b) / 2
						# Check if middle point is root
						if equation(__snake_case      ) == 0.0:
									break
						# Decide the side to repeat the steps
						if equation(__snake_case      ) * equation(__snake_case      ) < 0:
									__lowerCAmelCase :    List[Any]				=			c
						else:
									__lowerCAmelCase :    List[str]				=			c
			return c


if __name__ == "__main__":
	import doctest

	doctest.testmod()

	print(bisection(-2, 5))
	print(bisection(0, 6))