




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()










from __future__ import annotations

import sys







def 	A (		A__		,		A__			):
     # base cases
     if abs(A__			) == 1:
          return a, 0
     elif abs(A__			) == 1:
          return 0, b

     UpperCAmelCase	,			UpperCAmelCase    :					Any			=      a, b
     UpperCAmelCase	,			UpperCAmelCase    :					List[Any]			=      1, 0
     UpperCAmelCase	,			UpperCAmelCase    :					Union[str, Any]			=      0, 1

     while remainder != 0:
          UpperCAmelCase    :					Union[str, Any]			=      old_remainder // remainder
          UpperCAmelCase	,			UpperCAmelCase    :					Dict			=      remainder, old_remainder - quotient * remainder
          UpperCAmelCase	,			UpperCAmelCase    :					int			=      coeff_a, old_coeff_a - quotient * coeff_a
          UpperCAmelCase	,			UpperCAmelCase    :					Optional[Any]			=      coeff_b, old_coeff_b - quotient * coeff_b

     # sign correction for negative numbers
     if a < 0:
          UpperCAmelCase    :					Union[str, Any]			=      -old_coeff_a
     if b < 0:
          UpperCAmelCase    :					int			=      -old_coeff_b

     return old_coeff_a, old_coeff_b







def 	A (		):
     if len(sys.argv			) < 3:
          print("2 integer arguments required"			)
          return 1
     UpperCAmelCase    :					Union[str, Any]			=      int(sys.argv[1]			)
     UpperCAmelCase    :					Any			=      int(sys.argv[2]			)
     print(extended_euclidean_algorithm(A__		,		A__			)			)
     return 0


if __name__ == "__main__":
      raise SystemExit(main())



