

'''simple docstring'''

import timeit

import numpy as np

import datasets
from datasets.arrow_writer import ArrowWriter
from datasets.features.features import _ArrayXD





def       A_     (       snake_case       ):
  def wrapper(*snake_case					,				**snake_case       ):
    SCREAMING_SNAKE_CASE:Tuple  					=    timeit.default_timer()
    SCREAMING_SNAKE_CASE:Optional[int]  					=    func(*__lowerCamelCase					,				**__lowerCamelCase       )
    SCREAMING_SNAKE_CASE:Union[str, Any]  					=    timeit.default_timer() - starttime
    return delta

  SCREAMING_SNAKE_CASE:Optional[int]  					=    func.__name__

  return wrapper





def       A_     (       snake_case					,				snake_case=100					,				snake_case=None       ):
  SCREAMING_SNAKE_CASE:Dict  					=    []
  SCREAMING_SNAKE_CASE:List[str]  					=    seq_shapes or {}
  for i in range(__lowerCamelCase       ):
    SCREAMING_SNAKE_CASE:str  					=    {}
    for col_id, (k, v) in enumerate(features.items()       ):
      if isinstance(__lowerCamelCase					,				_ArrayXD       ):
        SCREAMING_SNAKE_CASE:int  					=    np.random.rand(*v.shape       ).astype(v.dtype       )
      elif isinstance(__lowerCamelCase					,				datasets.Value       ):
        if v.dtype == "string":
          SCREAMING_SNAKE_CASE:Any  					=    "The small grey turtle was surprisingly fast when challenged."
        else:
          SCREAMING_SNAKE_CASE:int  					=    np.random.randint(10					,				size=1       ).astype(v.dtype       ).item()
      elif isinstance(__lowerCamelCase					,				datasets.Sequence       ):
        while isinstance(__lowerCamelCase					,				datasets.Sequence       ):
          SCREAMING_SNAKE_CASE:Union[str, Any]  					=    v.feature
        SCREAMING_SNAKE_CASE:List[Any]  					=    seq_shapes[k]
        SCREAMING_SNAKE_CASE:List[str]  					=    np.random.rand(*__lowerCamelCase       ).astype(v.dtype       )
      SCREAMING_SNAKE_CASE:int  					=    data

    dummy_data.append((i, example)       )

  return dummy_data





def       A_     (       snake_case					,				snake_case					,				snake_case=100					,				snake_case=None       ):
  SCREAMING_SNAKE_CASE:List[str]  					=    generate_examples(__lowerCamelCase					,				num_examples=__lowerCamelCase					,				seq_shapes=__lowerCamelCase       )

  with ArrowWriter(features=__lowerCamelCase					,				path=__lowerCamelCase       ) as writer:
    for key, record in dummy_data:
      SCREAMING_SNAKE_CASE:Optional[int]  					=    features.encode_example(__lowerCamelCase       )
      writer.write(__lowerCamelCase       )

    SCREAMING_SNAKE_CASE					,			SCREAMING_SNAKE_CASE:Any  					=    writer.finalize()

  if not num_final_examples == num_examples:
    raise ValueError(
        F'''Error writing the dataset, wrote {num_final_examples} examples but should have written {num_examples}.'''       )

  SCREAMING_SNAKE_CASE:Optional[Any]  					=    datasets.Dataset.from_file(filename=__lowerCamelCase					,				info=datasets.DatasetInfo(features=__lowerCamelCase       )       )

  return dataset








"""simple docstring"""



from math import sqrt
def 					_UpperCAmelCase      ( __lowerCamelCase   :       int = 1_00_00_00		)     ->					int:
  _snake_case					     =       0
  _snake_case					     =       0
  _snake_case					     =       42

  while num_cuboids <= limit:
    max_cuboid_size += 1
    for sum_shortest_sides in range(2 ,					2 * max_cuboid_size + 1		):
      if sqrt(sum_shortest_sides**2 + max_cuboid_size**2		).is_integer():
        num_cuboids += (
            min(__lowerCamelCase ,					sum_shortest_sides // 2		)
            - max(1 ,					sum_shortest_sides - max_cuboid_size		)
            + 1
        )

  return max_cuboid_size


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



