code: 
  
  
  
  
  
  from __future__ import annotations
  def   _A (	SCREAMING_SNAKE_CASE  :     int , SCREAMING_SNAKE_CASE  :     int , SCREAMING_SNAKE_CASE  :     int		):
  
  
  
  
  
    """simple docstring"""
  
  
  
    assert n > 1 and a > 0 and greatest_common_divisor(SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE		) == 1
    ((a__)      ,							(a__)      ,							(a__))			:      List[Any]            =extended_gcd(SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE		)  # Implemented below
    a__			:      Dict            =(b * s) % n
    return x
  def   _A (	SCREAMING_SNAKE_CASE  :     int , SCREAMING_SNAKE_CASE  :     int		):
  
  
  
  
  
    """simple docstring"""
  
  
  
    ((a__)      ,							(a__))			:      int            =extended_euclid(SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE		)  # Implemented below
    if b < 0:
      a__			:      Dict            =(b % n + n) % n
    return b
  def   _A (	SCREAMING_SNAKE_CASE  :     int , SCREAMING_SNAKE_CASE  :     int , SCREAMING_SNAKE_CASE  :     int		):
  
  
  
  
  
    """simple docstring"""
  
  
  
    a__			:      Dict            =invert_modulo(SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE		)
    a__			:      str            =(b * s) % n
    return x
  def   _A (	SCREAMING_SNAKE_CASE  :     int , SCREAMING_SNAKE_CASE  :     int		):
  
  
  
  
  
    """simple docstring"""
  
  
  
    assert a >= 0 and b >= 0
  
    if b == 0:
      a__      ,							a__      ,							a__			:      Optional[int]            =a, 1, 0
    else:
      ((a__)      ,							(a__)      ,							(a__))			:      str            =extended_gcd(SCREAMING_SNAKE_CASE , a % b		)
      a__			:      List[Any]            =q
      a__			:      List[str]            =p - q * (a // b)
  
    assert a % d == 0 and b % d == 0
    assert d == a * x + b * y
  
    return (d, x, y)
  def   _A (	SCREAMING_SNAKE_CASE  :     int , SCREAMING_SNAKE_CASE  :     int		):
  
  
  
  
  
    """simple docstring"""
  
  
  
    if b == 0:
      return (1, 0)
    ((a__)      ,							(a__))			:      str            =extended_euclid(SCREAMING_SNAKE_CASE , a % b		)
    a__			:      Union[str, Any]            =a // b
    return (y, x - k * y)
  def   _A (	SCREAMING_SNAKE_CASE  :     int , SCREAMING_SNAKE_CASE  :     int		):
  
  
  
  
  
    """simple docstring"""
  
  
  
    if a < b:
      a__      ,							a__			:      Any            =b, a
  
    while a % b != 0:
      a__      ,							a__			:      List[str]            =b, a % b
  
    return b
  
  
  if __name__ == "__main__":
       from doctest import testmod
  
       testmod(name="""modular_division""", verbose=True)
       testmod(name="""modular_division2""", verbose=True)
       testmod(name="""invert_modulo""", verbose=True)
       testmod(name="""extended_gcd""", verbose=True)
       testmod(name="""extended_euclid""", verbose=True)
       testmod(name="""greatest_common_divisor""", verbose=True)
  
  
  
  
  
  
  
style_context: 
  
  
  
  
  
  def   _A (	SCREAMING_SNAKE_CASE  :     int		):
  
  
  
  
  
    """simple docstring"""
  
  
  
    if not isinstance(SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE		) or number < 0:
      raise ValueError("Input must be a non-negative integer"		)
  
    a__			:      List[str]            =number & ~(number - 1)
    a__			:      Optional[int]            =0
    while intermediate:
      intermediate >>= 1
      index += 1
    return index - 1
  
  
  if __name__ == "__main__":
       import doctest
  
       doctest.testmod(verbose=True)
  
  
  
  
  
  
  