

"""simple docstring"""




import json
import os
import tempfile

import datasets
from utils import generate_example_dataset, get_duration


lowerCAmelCase       :				int         =					50_00_00

lowerCAmelCase       :				Optional[int]         =					os.path.split(__file__)
lowerCAmelCase       :				Optional[Any]         =					os.path.join(RESULTS_BASEPATH, 'results', RESULTS_FILENAME.replace('.py', '.json'))

@get_duration
def 				A_					(							a					):

      """simple docstring"""



      SCREAMING_SNAKE_CASE_			:					Optional[int]          =       dataset.select(range(0   ,				len(a					)   ,				2					)					)

@get_duration
def 				A_					(							a					):

      """simple docstring"""



      SCREAMING_SNAKE_CASE_			:					Optional[Any]          =       dataset.sort('numbers'					)

@get_duration
def 				A_					(							a					):

      """simple docstring"""



      SCREAMING_SNAKE_CASE_			:					Optional[int]          =       dataset.shuffle()

@get_duration
def 				A_					(							a					):

      """simple docstring"""



      SCREAMING_SNAKE_CASE_			:					Optional[Any]          =       dataset.train_test_split(0.1					)

@get_duration
def 				A_					(							a   ,				a=1_0					):

      """simple docstring"""



      for shard_id in range(a					):
            SCREAMING_SNAKE_CASE_			:					List[Any]          =       dataset.shard(a   ,				a					)

def 				A_					(							):

      """simple docstring"""



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

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


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









from math import sqrt

def 				A_					(							a					):

      """simple docstring"""



      SCREAMING_SNAKE_CASE_			:					List[str]          =       [1]
      for i in range(2   ,				int(sqrt(a					)					) + 1   ,				1					):
            if number % i == 0:
                  values.append(a					)
                  if int(number // i					) != i:
                        values.append(int(number // i					)					)
      return sorted(a					)

def 				A_					(							a					):

      """simple docstring"""



      return sum(factors(a					)					) > n

def 				A_					(							a					):

      """simple docstring"""



      SCREAMING_SNAKE_CASE_			:					Union[str, Any]          =       factors(a					)
      SCREAMING_SNAKE_CASE_			:					Optional[int]          =       len(a					)
      SCREAMING_SNAKE_CASE_			:					Optional[int]          =       [[0 for i in range(number + 1					)] for j in range(r + 1					)]
      for i in range(r + 1					):
            SCREAMING_SNAKE_CASE_			:					Optional[int]          =       True

      for i in range(1   ,				number + 1					):
            SCREAMING_SNAKE_CASE_			:					Optional[Any]          =       False

      for i in range(1   ,				r + 1					):
            for j in range(1   ,				number + 1					):
                  if j < values[i - 1]:
                        SCREAMING_SNAKE_CASE_			:					Dict          =       subset[i - 1][j]
                  else:
                        SCREAMING_SNAKE_CASE_			:					List[str]          =       subset[i - 1][j] or subset[i - 1][j - values[i - 1]]

      return subset[r][number] != 0

def 				A_					(							a					):

      """simple docstring"""



      return abundant(a					) and not semi_perfect(a					)


if __name__ == "__main__":
    import doctest

    doctest.testmod(verbose=True)
    for number in (69, 70, 71):
        print(F'{number} is {"" if weird(number) else "not "}weird.')






