

from __future__ import annotations







def 						_snake_case		(     SCREAMING_SNAKE_CASE		,				SCREAMING_SNAKE_CASE		,				SCREAMING_SNAKE_CASE					)							->   int:

     """simple docstring"""







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







def 						_snake_case		(     SCREAMING_SNAKE_CASE		,				SCREAMING_SNAKE_CASE					)							->   int:

     """simple docstring"""







     (_lowerCAmelCase) :       List[Any]	   =     extended_euclid(_SCREAMING_SNAKE_CASE		,				_SCREAMING_SNAKE_CASE					)  # Implemented below
     if b < 0:
          _lowerCAmelCase :       int	   =     (b % n + n) % n
     return b







def 						_snake_case		(     SCREAMING_SNAKE_CASE		,				SCREAMING_SNAKE_CASE		,				SCREAMING_SNAKE_CASE					)							->   int:

     """simple docstring"""







     _lowerCAmelCase :       str	   =     invert_modulo(_SCREAMING_SNAKE_CASE		,				_SCREAMING_SNAKE_CASE					)
     _lowerCAmelCase :       List[Any]	   =     (b * s) % n
     return x







def 						_snake_case		(     SCREAMING_SNAKE_CASE		,				SCREAMING_SNAKE_CASE					)							->   tuple[int, int, int]:

     """simple docstring"""







     assert a >= 0 and b >= 0

     if b == 0:
          _lowerCAmelCase :       Optional[int]	   =     a, 1, 0
     else:
          (_lowerCAmelCase) :       str	   =     extended_gcd(_SCREAMING_SNAKE_CASE		,				a % b					)
          _lowerCAmelCase :       Any	   =     q
          _lowerCAmelCase :       List[str]	   =     p - q * (a // b)

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

     return (d, x, y)







def 						_snake_case		(     SCREAMING_SNAKE_CASE		,				SCREAMING_SNAKE_CASE					)							->   tuple[int, int]:

     """simple docstring"""







     if b == 0:
          return (1, 0)
     (_lowerCAmelCase) :       List[Any]	   =     extended_euclid(_SCREAMING_SNAKE_CASE		,				a % b					)
     _lowerCAmelCase :       Optional[int]	   =     a // b
     return (y, x - k * y)







def 						_snake_case		(     SCREAMING_SNAKE_CASE		,				SCREAMING_SNAKE_CASE					)							->   int:

     """simple docstring"""







     if a < b:
          _lowerCAmelCase :       int	   =     b, a

     while a % b != 0:
          _lowerCAmelCase :       Optional[Any]	   =     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)







"""simple docstring"""
from typing import TYPE_CHECKING

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


lowercase__   			=      {
    'configuration_mpnet': ['MPNET_PRETRAINED_CONFIG_ARCHIVE_MAP', 'MPNetConfig'],
    'tokenization_mpnet': ['MPNetTokenizer'],
}

try:
 if not is_tokenizers_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 lowercase__   			=      ['MPNetTokenizerFast']

try:
 if not is_torch_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 lowercase__   			=      [
     'MPNET_PRETRAINED_MODEL_ARCHIVE_LIST',
     'MPNetForMaskedLM',
     'MPNetForMultipleChoice',
     'MPNetForQuestionAnswering',
     'MPNetForSequenceClassification',
     'MPNetForTokenClassification',
     'MPNetLayer',
     'MPNetModel',
     'MPNetPreTrainedModel',
 ]

try:
 if not is_tf_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 lowercase__   			=      [
     'TF_MPNET_PRETRAINED_MODEL_ARCHIVE_LIST',
     'TFMPNetEmbeddings',
     'TFMPNetForMaskedLM',
     'TFMPNetForMultipleChoice',
     'TFMPNetForQuestionAnswering',
     'TFMPNetForSequenceClassification',
     'TFMPNetForTokenClassification',
     'TFMPNetMainLayer',
     'TFMPNetModel',
     'TFMPNetPreTrainedModel',
 ]


if TYPE_CHECKING:
 from .configuration_mpnet import MPNET_PRETRAINED_CONFIG_ARCHIVE_MAP, MPNetConfig
 from .tokenization_mpnet import MPNetTokenizer

 try:
  if not is_tokenizers_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .tokenization_mpnet_fast import MPNetTokenizerFast

 try:
  if not is_torch_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .modeling_mpnet import (
      MPNET_PRETRAINED_MODEL_ARCHIVE_LIST,
      MPNetForMaskedLM,
      MPNetForMultipleChoice,
      MPNetForQuestionAnswering,
      MPNetForSequenceClassification,
      MPNetForTokenClassification,
      MPNetLayer,
      MPNetModel,
      MPNetPreTrainedModel,
  )

 try:
  if not is_tf_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .modeling_tf_mpnet import (
      TF_MPNET_PRETRAINED_MODEL_ARCHIVE_LIST,
      TFMPNetEmbeddings,
      TFMPNetForMaskedLM,
      TFMPNetForMultipleChoice,
      TFMPNetForQuestionAnswering,
      TFMPNetForSequenceClassification,
      TFMPNetForTokenClassification,
      TFMPNetMainLayer,
      TFMPNetModel,
      TFMPNetPreTrainedModel,
  )

else:
 import sys

 lowercase__   			=      _LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)


