






from __future__ import annotations
def      a_ (      _A      ,   _A  )			->			int:







				"""simple docstring"""
				if b == 0:
								return (1, 0)
				(snake_case__)									=     extended_euclid(_A      ,   a % b  )
				snake_case__									=     a // b
				return (y, x - k * y)
def      a_ (      _A      ,   _A      ,   _A      ,   _A  )			->			List[Any]:







				"""simple docstring"""
				(snake_case__)									=     extended_euclid(_A      ,   _A  )
				snake_case__									=     na * na
				snake_case__									=     ra * x * na + ra * y * na
				return (n % m + m) % m
def      a_ (      _A      ,   _A  )			->			Optional[Any]:







				"""simple docstring"""
				(snake_case__)									=     extended_euclid(_A      ,   _A  )
				if b < 0:
								snake_case__									=     (b % n + n) % n
				return b
def      a_ (      _A      ,   _A      ,   _A      ,   _A  )			->			Union[str, Any]:







				"""simple docstring"""
				snake_case__									=     invert_modulo(_A      ,   _A  ), invert_modulo(_A      ,   _A  )
				snake_case__									=     na * na
				snake_case__									=     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)












from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_flax_available,
    is_sentencepiece_available,
    is_tf_available,
    is_tokenizers_available,
    is_torch_available,
)


__UpperCamelCase					:		int	  =						{"""configuration_xglm""": ["""XGLM_PRETRAINED_CONFIG_ARCHIVE_MAP""", """XGLMConfig"""]}

try:
							if not is_sentencepiece_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							__UpperCamelCase					:		Dict	  =						["""XGLMTokenizer"""]

try:
							if not is_tokenizers_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							__UpperCamelCase					:		Optional[int]	  =						["""XGLMTokenizerFast"""]

try:
							if not is_torch_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							__UpperCamelCase					:		List[str]	  =						[
							    """XGLM_PRETRAINED_MODEL_ARCHIVE_LIST""",
							    """XGLMForCausalLM""",
							    """XGLMModel""",
							    """XGLMPreTrainedModel""",
							]


try:
							if not is_flax_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							__UpperCamelCase					:		Any	  =						[
							    """FlaxXGLMForCausalLM""",
							    """FlaxXGLMModel""",
							    """FlaxXGLMPreTrainedModel""",
							]


try:
							if not is_tf_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							__UpperCamelCase					:		str	  =						[
							    """TF_XGLM_PRETRAINED_MODEL_ARCHIVE_LIST""",
							    """TFXGLMForCausalLM""",
							    """TFXGLMModel""",
							    """TFXGLMPreTrainedModel""",
							]


if TYPE_CHECKING:
							from .configuration_xglm import XGLM_PRETRAINED_CONFIG_ARCHIVE_MAP, XGLMConfig

							try:
														if not is_sentencepiece_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .tokenization_xglm import XGLMTokenizer

							try:
														if not is_tokenizers_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .tokenization_xglm_fast import XGLMTokenizerFast

							try:
														if not is_torch_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .modeling_xglm import XGLM_PRETRAINED_MODEL_ARCHIVE_LIST, XGLMForCausalLM, XGLMModel, XGLMPreTrainedModel

							try:
														if not is_flax_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .modeling_flax_xglm import FlaxXGLMForCausalLM, FlaxXGLMModel, FlaxXGLMPreTrainedModel

							try:
														if not is_tf_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .modeling_tf_xglm import (
														    TF_XGLM_PRETRAINED_MODEL_ARCHIVE_LIST,
														    TFXGLMForCausalLM,
														    TFXGLMModel,
														    TFXGLMPreTrainedModel,
														)


else:
							import sys

							__UpperCamelCase					:		Union[str, Any]	  =						_LazyModule(__name__, globals()["""__file__"""], _import_structure)




