

'''simple docstring'''






def 		_A     (    A__ = 3     ,				A__ = 7     ,				A__ = 1000000      ):






 """simple docstring"""



 __lowercase							  = 0
 __lowercase							  = 1

 for current_denominator in range(1     ,				limit + 1      ):
  __lowercase							  = current_denominator * numerator // denominator
  if current_denominator % denominator == 0:
   current_numerator -= 1
  if current_numerator * max_denominator > current_denominator * max_numerator:
   __lowercase							  = current_numerator
   __lowercase							  = current_denominator
 return max_numerator


if __name__ == "__main__":
 print(solution(numerator=3, denominator=7, limit=100_0000))


import pytest

from datasets import Dataset, DatasetDict, Features, NamedSplit, Value
from datasets.io.text import TextDatasetReader

from ..utils import assert_arrow_memory_doesnt_increase, assert_arrow_memory_increases




def       _snake_case	(   lowerCAmelCase							:   str   , lowerCAmelCase							:   Union[str, Any]	):
		"""simple docstring"""







		assert isinstance(lowerCAmelCase   , lowerCAmelCase	)
		assert dataset.num_rows == 4
		assert dataset.num_columns == 1
		assert dataset.column_names == ["text"]
		for feature, expected_dtype in expected_features.items():
				assert dataset.features[feature].dtype == expected_dtype




@pytest.mark.parametrize("keep_in_memory"   , [False, True]	)
def       _snake_case	(   lowerCAmelCase							:   Tuple   , lowerCAmelCase							:   Union[str, Any]   , lowerCAmelCase							:   int	):
		"""simple docstring"""







		SCREAMING_SNAKE_CASE_  :		Union[str, Any]				      =    tmp_path / "cache"
		SCREAMING_SNAKE_CASE_  :		Union[str, Any]				      =    {"text": "string"}
		with assert_arrow_memory_increases() if keep_in_memory else assert_arrow_memory_doesnt_increase():
				SCREAMING_SNAKE_CASE_  :		List[str]				      =    TextDatasetReader(lowerCAmelCase   , cache_dir=lowerCAmelCase   , keep_in_memory=lowerCAmelCase	).read()
		_check_text_dataset(lowerCAmelCase   , lowerCAmelCase	)




@pytest.mark.parametrize(
    "features"   , [
        None,
        {"text": "string"},
        {"text": "int32"},
        {"text": "float32"},
    ]   , )
def       _snake_case	(   lowerCAmelCase							:   Tuple   , lowerCAmelCase							:   Dict   , lowerCAmelCase							:   List[str]	):
		"""simple docstring"""







		SCREAMING_SNAKE_CASE_  :		Any				      =    tmp_path / "cache"
		SCREAMING_SNAKE_CASE_  :		Optional[Any]				      =    {"text": "string"}
		SCREAMING_SNAKE_CASE_  :		Any				      =    features.copy() if features else default_expected_features
		SCREAMING_SNAKE_CASE_  :		List[str]				      =    (
		    Features({feature: Value(lowerCAmelCase	) for feature, dtype in features.items()}	) if features is not None else None
		)
		SCREAMING_SNAKE_CASE_  :		Optional[Any]				      =    TextDatasetReader(lowerCAmelCase   , features=lowerCAmelCase   , cache_dir=lowerCAmelCase	).read()
		_check_text_dataset(lowerCAmelCase   , lowerCAmelCase	)




@pytest.mark.parametrize("split"   , [None, NamedSplit("train"	), "train", "test"]	)
def       _snake_case	(   lowerCAmelCase							:   Union[str, Any]   , lowerCAmelCase							:   Optional[Any]   , lowerCAmelCase							:   List[str]	):
		"""simple docstring"""







		SCREAMING_SNAKE_CASE_  :		Union[str, Any]				      =    tmp_path / "cache"
		SCREAMING_SNAKE_CASE_  :		List[str]				      =    {"text": "string"}
		SCREAMING_SNAKE_CASE_  :		List[str]				      =    TextDatasetReader(lowerCAmelCase   , cache_dir=lowerCAmelCase   , split=lowerCAmelCase	).read()
		_check_text_dataset(lowerCAmelCase   , lowerCAmelCase	)
		assert dataset.split == split if split else "train"




@pytest.mark.parametrize("path_type"   , [str, list]	)
def       _snake_case	(   lowerCAmelCase							:   int   , lowerCAmelCase							:   int   , lowerCAmelCase							:   Optional[int]	):
		"""simple docstring"""







		if issubclass(lowerCAmelCase   , lowerCAmelCase	):
				SCREAMING_SNAKE_CASE_  :		Union[str, Any]				      =    text_path
		elif issubclass(lowerCAmelCase   , lowerCAmelCase	):
				SCREAMING_SNAKE_CASE_  :		Union[str, Any]				      =    [text_path]
		SCREAMING_SNAKE_CASE_  :		int				      =    tmp_path / "cache"
		SCREAMING_SNAKE_CASE_  :		Optional[int]				      =    {"text": "string"}
		SCREAMING_SNAKE_CASE_  :		List[str]				      =    TextDatasetReader(lowerCAmelCase   , cache_dir=lowerCAmelCase	).read()
		_check_text_dataset(lowerCAmelCase   , lowerCAmelCase	)




def       _snake_case	(   lowerCAmelCase							:   Dict   , lowerCAmelCase							:   Dict   , lowerCAmelCase							:   List[str]=("train",)	):
		"""simple docstring"""







		assert isinstance(lowerCAmelCase   , lowerCAmelCase	)
		for split in splits:
				SCREAMING_SNAKE_CASE_  :		int				      =    dataset_dict[split]
				assert dataset.num_rows == 4
				assert dataset.num_columns == 1
				assert dataset.column_names == ["text"]
				for feature, expected_dtype in expected_features.items():
						assert dataset.features[feature].dtype == expected_dtype




@pytest.mark.parametrize("keep_in_memory"   , [False, True]	)
def       _snake_case	(   lowerCAmelCase							:   List[str]   , lowerCAmelCase							:   str   , lowerCAmelCase							:   Dict	):
		"""simple docstring"""







		SCREAMING_SNAKE_CASE_  :		List[str]				      =    tmp_path / "cache"
		SCREAMING_SNAKE_CASE_  :		Union[str, Any]				      =    {"text": "string"}
		with assert_arrow_memory_increases() if keep_in_memory else assert_arrow_memory_doesnt_increase():
				SCREAMING_SNAKE_CASE_  :		List[Any]				      =    TextDatasetReader({"train": text_path}   , cache_dir=lowerCAmelCase   , keep_in_memory=lowerCAmelCase	).read()
		_check_text_datasetdict(lowerCAmelCase   , lowerCAmelCase	)




@pytest.mark.parametrize(
    "features"   , [
        None,
        {"text": "string"},
        {"text": "int32"},
        {"text": "float32"},
    ]   , )
def       _snake_case	(   lowerCAmelCase							:   Union[str, Any]   , lowerCAmelCase							:   List[Any]   , lowerCAmelCase							:   Tuple	):
		"""simple docstring"""







		SCREAMING_SNAKE_CASE_  :		List[Any]				      =    tmp_path / "cache"
		# CSV file loses col_1 string dtype information: default now is "int64" instead of "string"
		SCREAMING_SNAKE_CASE_  :		Tuple				      =    {"text": "string"}
		SCREAMING_SNAKE_CASE_  :		Any				      =    features.copy() if features else default_expected_features
		SCREAMING_SNAKE_CASE_  :		Dict				      =    (
		    Features({feature: Value(lowerCAmelCase	) for feature, dtype in features.items()}	) if features is not None else None
		)
		SCREAMING_SNAKE_CASE_  :		str				      =    TextDatasetReader({"train": text_path}   , features=lowerCAmelCase   , cache_dir=lowerCAmelCase	).read()
		_check_text_datasetdict(lowerCAmelCase   , lowerCAmelCase	)







@pytest.mark.parametrize("split"   , [None, NamedSplit("train"	), "train", "test"]	)
def       _snake_case	(   lowerCAmelCase							:   Optional[Any]   , lowerCAmelCase							:   Any   , lowerCAmelCase							:   Dict	):
		"""simple docstring"""







		if split:
				SCREAMING_SNAKE_CASE_  :		Optional[int]				      =    {split: text_path}
		else:
				SCREAMING_SNAKE_CASE_  :		List[Any]				      =    "train"
				SCREAMING_SNAKE_CASE_  :		Tuple				      =    {"train": text_path, "test": text_path}
		SCREAMING_SNAKE_CASE_  :		Any				      =    tmp_path / "cache"
		SCREAMING_SNAKE_CASE_  :		List[str]				      =    {"text": "string"}
		SCREAMING_SNAKE_CASE_  :		str				      =    TextDatasetReader(lowerCAmelCase   , cache_dir=lowerCAmelCase	).read()
		_check_text_datasetdict(lowerCAmelCase   , lowerCAmelCase   , splits=list(path.keys()	)	)
		assert all(dataset[split].split == split for split in path.keys()	)
