"""simple docstring"""


from collections import deque






def     __UpperCAmelCase					(			lowercase		):







  """simple docstring"""
  _UpperCAmelCase						 =      len(lowercase		)
  _UpperCAmelCase						 =      deque()
  _UpperCAmelCase						 =      [False for _ in range(lowercase		)]
  _UpperCAmelCase						 =      [-1 for _ in range(lowercase		)]
  _UpperCAmelCase						 =      index_of[:]

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

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

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

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

  return components






def     __UpperCAmelCase					(			lowercase   ,lowercase		):







  """simple docstring"""
  _UpperCAmelCase						 =      [[] for _ in range(lowercase		)]
  for u, v in edges:
    g[u].append(lowercase		)
  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"""


def     __UpperCAmelCase					(			lowercase		):







  """simple docstring"""
  _UpperCAmelCase						 =      abs(lowercase		)
  _UpperCAmelCase						 =      0
  while n > 0:
    res += n % 10
    n //= 10
  return res






def     __UpperCAmelCase					(			lowercase		):







  """simple docstring"""
  _UpperCAmelCase						 =      abs(lowercase		)
  return n if n < 10 else n % 10 + sum_of_digits(n // 10		)






def     __UpperCAmelCase					(			lowercase		):







  """simple docstring"""
  return sum(int(lowercase		) for c in str(abs(lowercase		)		)		)






def     __UpperCAmelCase					(			):







  """simple docstring"""
  from collections.abc import Callable
  from timeit import timeit

  def benchmark_a_function(lowercase   ,lowercase		) -> None:
    _UpperCAmelCase						 =      f'''{func.__name__}({value})'''
    _UpperCAmelCase						 =      timeit(f'''__main__.{call}'''   ,setup="""import __main__"""		)
    print(f'''{call:56} = {func(lowercase		)} -- {timing:.4f} seconds'''		)

  for value in (26_21_44, 11_25_89_99_06_84_26_24, 1_26_76_50_60_02_28_22_94_01_49_67_03_20_53_76):
    for func in (sum_of_digits, sum_of_digits_recursion, sum_of_digits_compact):
      benchmark_a_function(lowercase   ,lowercase		)
    print()


if __name__ == "__main__":
    import doctest

    doctest.testmod()
    benchmark()
