



"""simple docstring"""






import re
from pathlib import Path
from unittest import TestCase

import pytest

@pytest.mark.integration
class        __SCREAMING_SNAKE_CASE	(      lowerCAmelCase_   ):


					'''simple docstring'''





					def 		snake_case       (       self							:  Union[str, Any],  lowerCamelCase							:  str     )->					Optional[Any]:

								with open(lowerCamelCase,  encoding='''utf-8'''     ) as input_file:
											lowerCamelCase__		:		Optional[Any]			=re.compile(r'''(?!.*\b(?:encoding|rb|w|wb|w+|wb+|ab|ab+)\b)(?<=\s)(open)\((.*)\)'''     )
											lowerCamelCase__		:		Tuple			=input_file.read()
											lowerCamelCase__		:		Union[str, Any]			=regexp.search(lowerCamelCase     )

								return match



					def 		snake_case       (       self							:  Union[str, Any],  lowerCamelCase							:  str     )->					Union[str, Any]:

								with open(lowerCamelCase,  encoding='''utf-8'''     ) as input_file:
											lowerCamelCase__		:		Optional[int]			=re.compile(r'''#[^\r\n]*print\(|\"[^\r\n]*print\(|\"\"\".*?print\(.*?\"\"\"|(print\()''',  re.DOTALL     )
											lowerCamelCase__		:		str			=input_file.read()
											# use `re.finditer` to handle the case where the ignored groups would be matched first by `re.search`
											lowerCamelCase__		:		Dict			=regexp.finditer(lowerCamelCase     )

								lowerCamelCase__		:		Optional[int]			=[match for match in matches if match is not None and match.group(1     ) is not None]
								return matches[0] if matches else None



					def 		snake_case       (       self							:  Optional[Any]     )->					Tuple:
								lowerCamelCase__		:		Union[str, Any]			=Path('''./datasets'''     )
								lowerCamelCase__		:		List[Any]			=list(dataset_paths.absolute().glob('''**/*.py'''     )     )

								for dataset in dataset_files:
											if self._no_encoding_on_file_open(str(lowerCamelCase     )     ):
														raise AssertionError(F'''open(...) must use utf-8 encoding in {dataset}'''     )




					def 		snake_case       (       self							:  Union[str, Any]     )->					Dict:
								lowerCamelCase__		:		Optional[int]			=Path('''./datasets'''     )
								lowerCamelCase__		:		Optional[Any]			=list(dataset_paths.absolute().glob('''**/*.py'''     )     )

								for dataset in dataset_files:
											if self._no_print_statements(str(lowerCamelCase     )     ):
														raise AssertionError(F'''print statement found in {dataset}. Use datasets.logger/logging instead.'''     )









"""simple docstring"""






from __future__ import annotations






def      snake_case__   (		__lowerCamelCase				:    int							,		__lowerCamelCase				:    int	):
			"""simple docstring"""
			if b == 0:
						return (1, 0)
			((lowerCamelCase__)	,   (lowerCamelCase__))		:		Any			=extended_euclid(__lowerCamelCase							,		a % b	)
			lowerCamelCase__		:		Optional[Any]			=a // b
			return (y, x - k * y)






def      snake_case__   (		__lowerCamelCase				:    int							,		__lowerCamelCase				:    int							,		__lowerCamelCase				:    int							,		__lowerCamelCase				:    int	):
			"""simple docstring"""
			((lowerCamelCase__)	,   (lowerCamelCase__))		:		Any			=extended_euclid(__lowerCamelCase							,		__lowerCamelCase	)
			lowerCamelCase__		:		List[Any]			=na * na
			lowerCamelCase__		:		Union[str, Any]			=ra * x * na + ra * y * na
			return (n % m + m) % m






def      snake_case__   (		__lowerCamelCase				:    int							,		__lowerCamelCase				:    int	):
			"""simple docstring"""
			((lowerCamelCase__)	,   (lowerCamelCase__))		:		int			=extended_euclid(__lowerCamelCase							,		__lowerCamelCase	)
			if b < 0:
						lowerCamelCase__		:		Any			=(b % n + n) % n
			return b






def      snake_case__   (		__lowerCamelCase				:    int							,		__lowerCamelCase				:    int							,		__lowerCamelCase				:    int							,		__lowerCamelCase				:    int	):
			"""simple docstring"""
			lowerCamelCase__	,   lowerCamelCase__		:		Any			=invert_modulo(__lowerCamelCase							,		__lowerCamelCase	), invert_modulo(__lowerCamelCase							,		__lowerCamelCase	)
			lowerCamelCase__		:		Tuple			=na * na
			lowerCamelCase__		:		Optional[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)




