





import json
import os
import tempfile

import datasets
from utils import generate_example_dataset, get_duration


__UpperCAmelCase						=      50_00_00

__UpperCAmelCase		,					__UpperCAmelCase						=      os.path.split(__file__)
__UpperCAmelCase						=      os.path.join(RESULTS_BASEPATH, 'results', RESULTS_FILENAME.replace('.py', '.json'))
@get_duration
def 			__UpperCamelCase				(			lowercase__	:       datasets.Dataset		)	->      Union[str, Any]:
    '''simple docstring'''





    lowerCAmelCase_					:	List[str]						=   dataset.select(range(0		,    len(lowercase__		)		,    2		)		)
@get_duration
def 			__UpperCamelCase				(			lowercase__	:       datasets.Dataset		)	->      Dict:
    '''simple docstring'''





    lowerCAmelCase_					:	Tuple						=   dataset.sort("""numbers"""		)
@get_duration
def 			__UpperCamelCase				(			lowercase__	:       datasets.Dataset		)	->      Optional[int]:
    '''simple docstring'''





    lowerCAmelCase_					:	Dict						=   dataset.shuffle()
@get_duration
def 			__UpperCamelCase				(			lowercase__	:       datasets.Dataset		)	->      Union[str, Any]:
    '''simple docstring'''





    lowerCAmelCase_					:	List[Any]						=   dataset.train_test_split(0.1		)
@get_duration
def 			__UpperCamelCase				(			lowercase__	:       datasets.Dataset		,    lowercase__	:       Any=10		)	->      Dict:
    '''simple docstring'''





    for shard_id in range(lowercase__		):
        lowerCAmelCase_					:	str						=   dataset.shard(lowercase__		,    lowercase__		)
def 			__UpperCamelCase				(			)	->      Union[str, Any]:
    '''simple docstring'''





    lowerCAmelCase_					:	int						=   {"""num examples""": SPEED_TEST_N_EXAMPLES}
    lowerCAmelCase_					:	List[Any]						=   (select, sort, shuffle, train_test_split, shard)
    with tempfile.TemporaryDirectory() as tmp_dir:
        print("""generating dataset"""		)
        lowerCAmelCase_					:	Any						=   datasets.Features({"""text""": datasets.Value("""string"""		), """numbers""": datasets.Value("""float32"""		)}		)
        lowerCAmelCase_					:	int						=   generate_example_dataset(
            os.path.join(lowercase__		,    """dataset.arrow"""		)		,    lowercase__		,    num_examples=lowercase__		)
        print("""Functions"""		)
        for func in functions:
            print(func.__name__		)
            lowerCAmelCase_					:	int						=   func(lowercase__		)

    with open(lowercase__		,    """wb"""		) as f:
        f.write(json.dumps(lowercase__		).encode("""utf-8"""		)		)


if __name__ == "__main__":  # useful to run the profiler
  benchmark_indices_mapping()









from __future__ import annotations

import math
from itertools import permutations
def 			__UpperCamelCase				(			lowercase__	:       int		)	->      bool:
    '''simple docstring'''





    if 1 < number < 4:
        # 2 and 3 are primes
        return True
    elif number < 2 or number % 2 == 0 or number % 3 == 0:
        # Negatives, 0, 1, all even numbers, all multiples of 3 are not primes
        return False

    # All primes number are in format of 6k +/- 1
    for i in range(5		,    int(math.sqrt(lowercase__		) + 1		)		,    6		):
        if number % i == 0 or number % (i + 2) == 0:
            return False
    return True
def 			__UpperCamelCase				(			lowercase__	:       int = 7		)	->      int:
    '''simple docstring'''





    lowerCAmelCase_					:	str						=   """""".join(str(lowercase__		) for i in range(1		,    n + 1		)		)
    lowerCAmelCase_					:	Any						=   [int("""""".join(lowercase__		)		) for i in permutations(lowercase__		,    lowercase__		)]
    lowerCAmelCase_					:	List[Any]						=   [num for num in perm_list if is_prime(lowercase__		)]
    return max(lowercase__		) if pandigitals else 0


if __name__ == "__main__":
  print(f"""{solution() = }""")


