





from __future__ import annotations


def        SCREAMING_SNAKE_CASE      (       _UpperCAmelCase						,	_UpperCAmelCase )			->     tuple[int, int]:
    if b == 0:
        return (1, 0)
    ((lowerCamelCase__) ,							(lowerCamelCase__))    :      Tuple					 =		extended_euclid(_UpperCAmelCase						,	a % b )
    lowerCamelCase__    :      str					 =		a // b
    return (y, x - k * y)


def        SCREAMING_SNAKE_CASE      (       _UpperCAmelCase						,	_UpperCAmelCase						,	_UpperCAmelCase						,	_UpperCAmelCase )			->     int:
    ((lowerCamelCase__) ,							(lowerCamelCase__))    :      List[Any]					 =		extended_euclid(_UpperCAmelCase						,	_UpperCAmelCase )
    lowerCamelCase__    :      Union[str, Any]					 =		na * na
    lowerCamelCase__    :      Optional[Any]					 =		ra * x * na + ra * y * na
    return (n % m + m) % m


def        SCREAMING_SNAKE_CASE      (       _UpperCAmelCase						,	_UpperCAmelCase )			->     int:
    ((lowerCamelCase__) ,							(lowerCamelCase__))    :      List[Any]					 =		extended_euclid(_UpperCAmelCase						,	_UpperCAmelCase )
    if b < 0:
        lowerCamelCase__    :      List[str]					 =		(b % n + n) % n
    return b


def        SCREAMING_SNAKE_CASE      (       _UpperCAmelCase						,	_UpperCAmelCase						,	_UpperCAmelCase						,	_UpperCAmelCase )			->     int:
    lowerCamelCase__ ,							lowerCamelCase__    :      Tuple					 =		invert_modulo(_UpperCAmelCase						,	_UpperCAmelCase ), invert_modulo(_UpperCAmelCase						,	_UpperCAmelCase )
    lowerCamelCase__    :      str					 =		na * na
    lowerCamelCase__    :      str					 =		ra * x * na + ra * y * na
    return (n % m + m) % m


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

    testmod(name="""chinese_remainder_theorem""", verbose=True)
    testmod(name="""chinese_remainder_theorem2""", verbose=True)
    testmod(name="""invert_modulo""", verbose=True)
    testmod(name="""extended_euclid""", verbose=True)











import torch



def 					UpperCAmelCase__     (   ):
  if torch.cuda.is_available():
    lowercase			:Optional[int]							=  torch.cuda.device_count()
  else:
    lowercase			:Dict							=  0
  print(F"Successfully ran on {num_gpus} GPUs"      )


if __name__ == "__main__":
     main()



