






"""simple docstring"""



from __future__ import annotations


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






     '''simple docstring'''



     if b == 0:
          return (1, 0)
     ((UpperCAmelCase__)							,				(UpperCAmelCase__))						:    Tuple							=							extended_euclid(snake_case			,					a % b				)
     UpperCAmelCase__						:    str							=							a // b
     return (y, x - k * y)


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






     '''simple docstring'''



     ((UpperCAmelCase__)							,				(UpperCAmelCase__))						:    Union[str, Any]							=							extended_euclid(snake_case			,					snake_case				)
     UpperCAmelCase__						:    str							=							na * na
     UpperCAmelCase__						:    Union[str, Any]							=							ra * x * na + ra * y * na
     return (n % m + m) % m


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






     '''simple docstring'''



     ((UpperCAmelCase__)							,				(UpperCAmelCase__))						:    Union[str, Any]							=							extended_euclid(snake_case			,					snake_case				)
     if b < 0:
          UpperCAmelCase__						:    Optional[int]							=							(b % n + n) % n
     return b


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






     '''simple docstring'''



     UpperCAmelCase__							,				UpperCAmelCase__						:    List[Any]							=							invert_modulo(snake_case			,					snake_case				), invert_modulo(snake_case			,					snake_case				)
     UpperCAmelCase__						:    List[Any]							=							na * na
     UpperCAmelCase__						:    Any							=							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"""



from typing import TYPE_CHECKING

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


_lowerCAmelCase	:	Tuple				=      {
    """configuration_lxmert""": ["""LXMERT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """LxmertConfig"""],
    """tokenization_lxmert""": ["""LxmertTokenizer"""],
}

try:
 if not is_tokenizers_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 _lowerCAmelCase	:	int				=      ["""LxmertTokenizerFast"""]

try:
 if not is_torch_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 _lowerCAmelCase	:	Tuple				=      [
     """LxmertEncoder""",
     """LxmertForPreTraining""",
     """LxmertForQuestionAnswering""",
     """LxmertModel""",
     """LxmertPreTrainedModel""",
     """LxmertVisualFeatureEncoder""",
     """LxmertXLayer""",
 ]

try:
 if not is_tf_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 _lowerCAmelCase	:	Optional[int]				=      [
     """TF_LXMERT_PRETRAINED_MODEL_ARCHIVE_LIST""",
     """TFLxmertForPreTraining""",
     """TFLxmertMainLayer""",
     """TFLxmertModel""",
     """TFLxmertPreTrainedModel""",
     """TFLxmertVisualFeatureEncoder""",
 ]


if TYPE_CHECKING:
 from .configuration_lxmert import LXMERT_PRETRAINED_CONFIG_ARCHIVE_MAP, LxmertConfig
 from .tokenization_lxmert import LxmertTokenizer

 try:
  if not is_tokenizers_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .tokenization_lxmert_fast import LxmertTokenizerFast

 try:
  if not is_torch_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .modeling_lxmert import (
      LxmertEncoder,
      LxmertForPreTraining,
      LxmertForQuestionAnswering,
      LxmertModel,
      LxmertPreTrainedModel,
      LxmertVisualFeatureEncoder,
      LxmertXLayer,
  )

 try:
  if not is_tf_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .modeling_tf_lxmert import (
      TF_LXMERT_PRETRAINED_MODEL_ARCHIVE_LIST,
      TFLxmertForPreTraining,
      TFLxmertMainLayer,
      TFLxmertModel,
      TFLxmertPreTrainedModel,
      TFLxmertVisualFeatureEncoder,
  )

else:
 import sys

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


