

def 			UpperCAmelCase__				(			_A      : Union[str, Any]	,      _A      : Optional[Any]							):





  '''simple docstring'''







  a__  =0
  while b > 0:
    if b & 1:
      res += a

    a += a
    b >>= 1

  return res




def 			UpperCAmelCase__				(			_A      : List[str]	,      _A      : Any	,      _A      : Optional[Any]							):





  '''simple docstring'''







  a__  =0
  while b > 0:
    if b & 1:
      a__  =((res % c) + (a % c)) % c

    a += a
    b >>= 1

  return res



def 			UpperCAmelCase__				(			_A      : dict							):





  '''simple docstring'''







  a__  =set()
  # To detect a back edge, keep track of vertices currently in the recursion stack
  a__  =set()
  return any(
      node not in visited and depth_first_search(_A	,      _A	,      _A	,      _A							)
      for node in graph							)




def 			UpperCAmelCase__				(			_A      : dict	,      _A      : int	,      _A      : set	,      _A      : set							):





  '''simple docstring'''







  visited.add(_A							)
  rec_stk.add(_A							)

  for node in graph[vertex]:
    if node not in visited:
      if depth_first_search(_A	,      _A	,      _A	,      _A							):
        return True
    elif node in rec_stk:
      return True

    # The node needs to be removed from recursion stack before function ends
  rec_stk.remove(_A							)
  return False


if __name__ == "__main__":
       from doctest import testmod

       testmod()
