

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    __lowerCamelCase      (					UpperCamelCase__  ,				UpperCamelCase__ ):







							'''simple docstring'''






							assert isinstance(UpperCamelCase__  ,				UpperCamelCase__ )
							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    __lowerCamelCase      (					UpperCamelCase__  ,				UpperCamelCase__  ,				UpperCamelCase__ ):







							'''simple docstring'''






							snake_case_     							=       tmp_path / 'cache'
							snake_case_     							=       {'text': 'string'}
							with assert_arrow_memory_increases() if keep_in_memory else assert_arrow_memory_doesnt_increase():
														snake_case_     							=       TextDatasetReader(UpperCamelCase__  ,				cache_dir=UpperCamelCase__  ,				keep_in_memory=UpperCamelCase__ ).read()
							_check_text_dataset(UpperCamelCase__  ,				UpperCamelCase__ )





@pytest.mark.parametrize(
    'features'  ,				[
        None,
        {'text': 'string'},
        {'text': 'int32'},
        {'text': 'float32'},
    ]  ,				)
def    __lowerCamelCase      (					UpperCamelCase__  ,				UpperCamelCase__  ,				UpperCamelCase__ ):







							'''simple docstring'''






							snake_case_     							=       tmp_path / 'cache'
							snake_case_     							=       {'text': 'string'}
							snake_case_     							=       features.copy() if features else default_expected_features
							snake_case_     							=       (
							    Features({feature: Value(UpperCamelCase__ ) for feature, dtype in features.items()} ) if features is not None else None
							)
							snake_case_     							=       TextDatasetReader(UpperCamelCase__  ,				features=UpperCamelCase__  ,				cache_dir=UpperCamelCase__ ).read()
							_check_text_dataset(UpperCamelCase__  ,				UpperCamelCase__ )





@pytest.mark.parametrize('split'  ,				[None, NamedSplit('train' ), 'train', 'test'] )
def    __lowerCamelCase      (					UpperCamelCase__  ,				UpperCamelCase__  ,				UpperCamelCase__ ):







							'''simple docstring'''






							snake_case_     							=       tmp_path / 'cache'
							snake_case_     							=       {'text': 'string'}
							snake_case_     							=       TextDatasetReader(UpperCamelCase__  ,				cache_dir=UpperCamelCase__  ,				split=UpperCamelCase__ ).read()
							_check_text_dataset(UpperCamelCase__  ,				UpperCamelCase__ )
							assert dataset.split == split if split else "train"





@pytest.mark.parametrize('path_type'  ,				[str, list] )
def    __lowerCamelCase      (					UpperCamelCase__  ,				UpperCamelCase__  ,				UpperCamelCase__ ):







							'''simple docstring'''






							if issubclass(UpperCamelCase__  ,				UpperCamelCase__ ):
														snake_case_     							=       text_path
							elif issubclass(UpperCamelCase__  ,				UpperCamelCase__ ):
														snake_case_     							=       [text_path]
							snake_case_     							=       tmp_path / 'cache'
							snake_case_     							=       {'text': 'string'}
							snake_case_     							=       TextDatasetReader(UpperCamelCase__  ,				cache_dir=UpperCamelCase__ ).read()
							_check_text_dataset(UpperCamelCase__  ,				UpperCamelCase__ )





def    __lowerCamelCase      (					UpperCamelCase__  ,				UpperCamelCase__  ,				UpperCamelCase__=("train",) ):







							'''simple docstring'''






							assert isinstance(UpperCamelCase__  ,				UpperCamelCase__ )
							for split in splits:
														snake_case_     							=       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    __lowerCamelCase      (					UpperCamelCase__  ,				UpperCamelCase__  ,				UpperCamelCase__ ):







							'''simple docstring'''






							snake_case_     							=       tmp_path / 'cache'
							snake_case_     							=       {'text': 'string'}
							with assert_arrow_memory_increases() if keep_in_memory else assert_arrow_memory_doesnt_increase():
														snake_case_     							=       TextDatasetReader({'train': text_path}  ,				cache_dir=UpperCamelCase__  ,				keep_in_memory=UpperCamelCase__ ).read()
							_check_text_datasetdict(UpperCamelCase__  ,				UpperCamelCase__ )





@pytest.mark.parametrize(
    'features'  ,				[
        None,
        {'text': 'string'},
        {'text': 'int32'},
        {'text': 'float32'},
    ]  ,				)
def    __lowerCamelCase      (					UpperCamelCase__  ,				UpperCamelCase__  ,				UpperCamelCase__ ):







							'''simple docstring'''






							snake_case_     							=       tmp_path / 'cache'
							# CSV file loses col_1 string dtype information: default now is "int64" instead of "string"
							snake_case_     							=       {'text': 'string'}
							snake_case_     							=       features.copy() if features else default_expected_features
							snake_case_     							=       (
							    Features({feature: Value(UpperCamelCase__ ) for feature, dtype in features.items()} ) if features is not None else None
							)
							snake_case_     							=       TextDatasetReader({'train': text_path}  ,				features=UpperCamelCase__  ,				cache_dir=UpperCamelCase__ ).read()
							_check_text_datasetdict(UpperCamelCase__  ,				UpperCamelCase__ )





@pytest.mark.parametrize('split'  ,				[None, NamedSplit('train' ), 'train', 'test'] )
def    __lowerCamelCase      (					UpperCamelCase__  ,				UpperCamelCase__  ,				UpperCamelCase__ ):







							'''simple docstring'''






							if split:
														snake_case_     							=       {split: text_path}
							else:
														snake_case_     							=       'train'
														snake_case_     							=       {'train': text_path, 'test': text_path}
							snake_case_     							=       tmp_path / 'cache'
							snake_case_     							=       {'text': 'string'}
							snake_case_     							=       TextDatasetReader(UpperCamelCase__  ,				cache_dir=UpperCamelCase__ ).read()
							_check_text_datasetdict(UpperCamelCase__  ,				UpperCamelCase__  ,				splits=list(path.keys() ) )
							assert all(dataset[split].split == split for split in path.keys() )







def    __lowerCamelCase      (					UpperCamelCase__ = 1000 ):







							'''simple docstring'''






							snake_case_     							=       2**power
							snake_case_     							=       0
							while n:
														snake_case_							,       snake_case_     							=       r + n % 10, n // 10
							return r


if __name__ == "__main__":
					print(solution(int(str(input()).strip())))




