



from __future__ import annotations


def 						_UpperCAmelCase							( snake_case      ,		snake_case      ,		snake_case     ):





					"""simple docstring"""

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


def 						_UpperCAmelCase							( snake_case      ,		snake_case     ):





					"""simple docstring"""

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


def 						_UpperCAmelCase							( snake_case      ,		snake_case      ,		snake_case     ):





					"""simple docstring"""

					_lowerCAmelCase         =       invert_modulo(snake_case      ,		snake_case     )
					_lowerCAmelCase         =       (b * s) % n
					return x


def 						_UpperCAmelCase							( snake_case      ,		snake_case     ):





					"""simple docstring"""

					assert a >= 0 and b >= 0

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

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

					return (d, x, y)


def 						_UpperCAmelCase							( snake_case      ,		snake_case     ):





					"""simple docstring"""

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


def 						_UpperCAmelCase							( snake_case      ,		snake_case     ):





					"""simple docstring"""

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

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


UpperCAmelCase__    :      int       					={
    '''configuration_flaubert''': ['''FLAUBERT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''FlaubertConfig''', '''FlaubertOnnxConfig'''],
    '''tokenization_flaubert''': ['''FlaubertTokenizer'''],
}

try:
							if not is_torch_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							UpperCAmelCase__    :      int       					=[
							    '''FLAUBERT_PRETRAINED_MODEL_ARCHIVE_LIST''',
							    '''FlaubertForMultipleChoice''',
							    '''FlaubertForQuestionAnswering''',
							    '''FlaubertForQuestionAnsweringSimple''',
							    '''FlaubertForSequenceClassification''',
							    '''FlaubertForTokenClassification''',
							    '''FlaubertModel''',
							    '''FlaubertWithLMHeadModel''',
							    '''FlaubertPreTrainedModel''',
							]

try:
							if not is_tf_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							UpperCAmelCase__    :      List[str]       					=[
							    '''TF_FLAUBERT_PRETRAINED_MODEL_ARCHIVE_LIST''',
							    '''TFFlaubertForMultipleChoice''',
							    '''TFFlaubertForQuestionAnsweringSimple''',
							    '''TFFlaubertForSequenceClassification''',
							    '''TFFlaubertForTokenClassification''',
							    '''TFFlaubertModel''',
							    '''TFFlaubertPreTrainedModel''',
							    '''TFFlaubertWithLMHeadModel''',
							]


if TYPE_CHECKING:
							from .configuration_flaubert import FLAUBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, FlaubertConfig, FlaubertOnnxConfig
							from .tokenization_flaubert import FlaubertTokenizer

							try:
														if not is_torch_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .modeling_flaubert import (
														    FLAUBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
														    FlaubertForMultipleChoice,
														    FlaubertForQuestionAnswering,
														    FlaubertForQuestionAnsweringSimple,
														    FlaubertForSequenceClassification,
														    FlaubertForTokenClassification,
														    FlaubertModel,
														    FlaubertPreTrainedModel,
														    FlaubertWithLMHeadModel,
														)

							try:
														if not is_tf_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .modeling_tf_flaubert import (
														    TF_FLAUBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
														    TFFlaubertForMultipleChoice,
														    TFFlaubertForQuestionAnsweringSimple,
														    TFFlaubertForSequenceClassification,
														    TFFlaubertForTokenClassification,
														    TFFlaubertModel,
														    TFFlaubertPreTrainedModel,
														    TFFlaubertWithLMHeadModel,
														)

else:
							import sys

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





