






'''simple docstring'''







from __future__ import annotations





def 		_UpperCAmelCase   (							__A							:   int						,		__A							:   int      ):
				if b == 0:
								return (1, 0)
				((a_)				,			(a_))		:  Union[str, Any]											=      extended_euclid(__A						,		a % b      )
				a_		:  Any											=      a // b
				return (y, x - k * y)





def 		_UpperCAmelCase   (							__A							:   int						,		__A							:   int						,		__A							:   int						,		__A							:   int      ):
				((a_)				,			(a_))		:  Tuple											=      extended_euclid(__A						,		__A      )
				a_		:  str											=      na * na
				a_		:  Optional[Any]											=      ra * x * na + ra * y * na
				return (n % m + m) % m





def 		_UpperCAmelCase   (							__A							:   int						,		__A							:   int      ):
				((a_)				,			(a_))		:  Union[str, Any]											=      extended_euclid(__A						,		__A      )
				if b < 0:
								a_		:  Union[str, Any]											=      (b % n + n) % n
				return b





def 		_UpperCAmelCase   (							__A							:   int						,		__A							:   int						,		__A							:   int						,		__A							:   int      ):
				a_				,			a_		:  Tuple											=      invert_modulo(__A						,		__A      ), invert_modulo(__A						,		__A      )
				a_		:  Dict											=      na * na
				a_		:  Dict											=      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)












'''simple docstring'''







import warnings


warnings.warn(
    'memory_utils has been reorganized to utils.memory. Import `find_executable_batchsize` from the main `__init__`: '
    '`from accelerate import find_executable_batch_size` to avoid this warning.',
    FutureWarning,
)




