




'''simple docstring'''





from collections import deque





def      __a     (       _UpperCamelCase:   List[Any]   )						->			List[Any]:

     """simple docstring"""




     _snake_case							=				len(_UpperCamelCase   )
     _snake_case							=				deque()
     _snake_case							=				[False for _ in range(_UpperCamelCase   )]
     _snake_case							=				[-1 for _ in range(_UpperCamelCase   )]
     _snake_case							=				index_of[:]

     def strong_connect(_UpperCamelCase:   Union[str, Any] ,						_UpperCamelCase:   Union[str, Any] ,						_UpperCamelCase:   Tuple   ):
          _snake_case							=				index  # the number when this node is seen
          _snake_case							=				index  # lowest rank node reachable from here
          index += 1
          stack.append(_UpperCamelCase   )
          _snake_case							=				True

          for w in g[v]:
               if index_of[w] == -1:
                    _snake_case							=				strong_connect(_UpperCamelCase ,						_UpperCamelCase ,						_UpperCamelCase   )
                    _snake_case							=				(
                        lowlink_of[w] if lowlink_of[w] < lowlink_of[v] else lowlink_of[v]
                    )
               elif on_stack[w]:
                    _snake_case							=				(
                        lowlink_of[w] if lowlink_of[w] < lowlink_of[v] else lowlink_of[v]
                    )

          if lowlink_of[v] == index_of[v]:
               _snake_case							=				[]
               _snake_case							=				stack.pop()
               _snake_case							=				False
               component.append(_UpperCamelCase   )
               while w != v:
                    _snake_case							=				stack.pop()
                    _snake_case							=				False
                    component.append(_UpperCamelCase   )
               components.append(_UpperCamelCase   )
          return index

     _snake_case							=				[]
     for v in range(_UpperCamelCase   ):
          if index_of[v] == -1:
               strong_connect(_UpperCamelCase ,						0 ,						_UpperCamelCase   )

     return components





def      __a     (       _UpperCamelCase:   List[Any] ,						_UpperCamelCase:   Dict   )						->			List[Any]:

     """simple docstring"""




     _snake_case							=				[[] for _ in range(_UpperCamelCase   )]
     for u, v in edges:
          g[u].append(_UpperCamelCase   )
     return g


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

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








'''simple docstring'''





def      __a     (       _UpperCamelCase:   int   )						->			str:

     """simple docstring"""




     if number > 0:
          raise ValueError("input must be a negative integer"   )
     _snake_case							=				len(bin(_UpperCamelCase   )[3:]   )
     _snake_case							=				bin(abs(_UpperCamelCase   ) - (1 << binary_number_length)   )[3:]
     _snake_case							=				(
         (
             "1"
             + "0" * (binary_number_length - len(_UpperCamelCase   ))
             + twos_complement_number
         )
         if number < 0
         else "0"
     )
     return "0b" + twos_complement_number


if __name__ == "__main__":
   import doctest

   doctest.testmod()


