




import json
import os
import tempfile

import datasets
from utils import generate_example_dataset, get_duration


a_ 		=  50_0000

a_		,     a_ 		=  os.path.split(__file__)
a_ 		=  os.path.join(RESULTS_BASEPATH, "results", RESULTS_FILENAME.replace(".py", ".json"))




@get_duration
def        __SCREAMING_SNAKE_CASE (	lowercase_   )							->						List[str]:

    """simple docstring"""


    __UpperCamelCase			=    dataset.select(range(0       ,  len(lowercase_   )       ,  2   )   )




@get_duration
def        __SCREAMING_SNAKE_CASE (	lowercase_   )							->						Optional[Any]:

    """simple docstring"""


    __UpperCamelCase			=    dataset.sort('''numbers'''   )




@get_duration
def        __SCREAMING_SNAKE_CASE (	lowercase_   )							->						Optional[Any]:

    """simple docstring"""


    __UpperCamelCase			=    dataset.shuffle()




@get_duration
def        __SCREAMING_SNAKE_CASE (	lowercase_   )							->						str:

    """simple docstring"""


    __UpperCamelCase			=    dataset.train_test_split(0.1   )




@get_duration
def        __SCREAMING_SNAKE_CASE (	lowercase_       ,  lowercase_=10   )							->						Any:

    """simple docstring"""


    for shard_id in range(lowercase_   ):
        __UpperCamelCase			=    dataset.shard(lowercase_       ,  lowercase_   )




def        __SCREAMING_SNAKE_CASE (	)							->						Union[str, Any]:

    """simple docstring"""


    __UpperCamelCase			=    {'''num examples''': SPEED_TEST_N_EXAMPLES}
    __UpperCamelCase			=    (select, sort, shuffle, train_test_split, shard)
    with tempfile.TemporaryDirectory() as tmp_dir:
        print('''generating dataset'''   )
        __UpperCamelCase			=    datasets.Features({'''text''': datasets.Value('''string'''   ), '''numbers''': datasets.Value('''float32'''   )}   )
        __UpperCamelCase			=    generate_example_dataset(
            os.path.join(lowercase_       ,  '''dataset.arrow'''   )       ,  lowercase_       ,  num_examples=lowercase_   )
        print('''Functions'''   )
        for func in functions:
            print(func.__name__   )
            __UpperCamelCase			=    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()














"""simple docstring"""
from itertools import combinations, product






def 			lowerCamelCase_    (		_lowerCamelCase     ,  _lowerCamelCase     ,  _lowerCamelCase     ,  _lowerCamelCase							):
 if xa == ya == 0 or xa == ya == 0:
  return False
 lowerCamelCase__	:     Tuple								=		xa * xa + ya * ya
 lowerCamelCase__	:     Union[str, Any]								=		xa * xa + ya * ya
 lowerCamelCase__	:     Optional[Any]								=		(xa - xa) * (xa - xa) + (ya - ya) * (ya - ya)
 return (
     a_square + b_square == c_square
     or a_square + c_square == b_square
     or b_square + c_square == a_square
 )






def 			lowerCamelCase_    (		_lowerCamelCase = 50							):
 return sum(
     1
     for pta, pta in combinations(product(range(limit + 1							)     ,  repeat=2							)     ,  2							)
     if is_right(*_lowerCamelCase     ,  *_lowerCamelCase							)							)


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

