






from __future__ import annotations





def   SCREAMING_SNAKE_CASE__						(   snake_case_,  snake_case_,  snake_case_  )   ->  int:


	"""simple docstring"""



	assert n > 1 and a > 0 and greatest_common_divisor(snake_case_,  snake_case_  ) == 1
	((a)	, (a)	, (a))		=			extended_gcd(snake_case_,  snake_case_  )  # Implemented below
	a		=			(b * s) % n
	return x





def   SCREAMING_SNAKE_CASE__						(   snake_case_,  snake_case_  )   ->  int:


	"""simple docstring"""



	((a)	, (a))		=			extended_euclid(snake_case_,  snake_case_  )  # Implemented below
	if b < 0:
		a		=			(b % n + n) % n
	return b





def   SCREAMING_SNAKE_CASE__						(   snake_case_,  snake_case_,  snake_case_  )   ->  int:


	"""simple docstring"""



	a		=			invert_modulo(snake_case_,  snake_case_  )
	a		=			(b * s) % n
	return x





def   SCREAMING_SNAKE_CASE__						(   snake_case_,  snake_case_  )   ->  tuple[int, int, int]:


	"""simple docstring"""



	assert a >= 0 and b >= 0

	if b == 0:
		a	, a	, a		=			a, 1, 0
	else:
		((a)	, (a)	, (a))		=			extended_gcd(snake_case_,  a % b  )
		a		=			q
		a		=			p - q * (a // b)

	assert a % d == 0 and b % d == 0
	assert d == a * x + b * y

	return (d, x, y)





def   SCREAMING_SNAKE_CASE__						(   snake_case_,  snake_case_  )   ->  tuple[int, int]:


	"""simple docstring"""



	if b == 0:
		return (1, 0)
	((a)	, (a))		=			extended_euclid(snake_case_,  a % b  )
	a		=			a // b
	return (y, x - k * y)





def   SCREAMING_SNAKE_CASE__						(   snake_case_,  snake_case_  )   ->  int:


	"""simple docstring"""



	if a < b:
		a	, a		=			b, a

	while a % b != 0:
		a	, a		=			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)













from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


UpperCamelCase__						:      int								=					{
    """configuration_fsmt""": ["""FSMT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """FSMTConfig"""],
    """tokenization_fsmt""": ["""FSMTTokenizer"""],
}

try:
				if not is_torch_available():
								raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
				pass
else:
				UpperCamelCase__						:      Any								=					["""FSMTForConditionalGeneration""", """FSMTModel""", """PretrainedFSMTModel"""]


if TYPE_CHECKING:
				from .configuration_fsmt import FSMT_PRETRAINED_CONFIG_ARCHIVE_MAP, FSMTConfig
				from .tokenization_fsmt import FSMTTokenizer

				try:
								if not is_torch_available():
												raise OptionalDependencyNotAvailable()
				except OptionalDependencyNotAvailable:
								pass
				else:
								from .modeling_fsmt import FSMTForConditionalGeneration, FSMTModel, PretrainedFSMTModel

else:
				import sys

				UpperCamelCase__						:      List[Any]								=					_LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)





