
"""simple docstring"""



import timeit

import numpy as np

import datasets
from datasets.arrow_writer import ArrowWriter
from datasets.features.features import _ArrayXD
def 					_UpperCAmelCase      ( __lowerCamelCase   :       Optional[int]		)     ->					Union[str, Any]:
  def wrapper(*__lowerCamelCase   :       Optional[Any] ,					**__lowerCamelCase   :       Union[str, Any]		):
    _snake_case					     =       timeit.default_timer()
    _snake_case					     =       func(*__lowerCamelCase ,					**__lowerCamelCase		)
    _snake_case					     =       timeit.default_timer() - starttime
    return delta

  _snake_case					     =       func.__name__

  return wrapper
def 					_UpperCAmelCase      ( __lowerCamelCase   :       dict ,					__lowerCamelCase   :       Tuple=1_00 ,					__lowerCamelCase   :       Dict=None		)     ->					Optional[Any]:
  _snake_case					     =       []
  _snake_case					     =       seq_shapes or {}
  for i in range(__lowerCamelCase		):
    _snake_case					     =       {}
    for col_id, (k, v) in enumerate(features.items()		):
      if isinstance(__lowerCamelCase ,					_ArrayXD		):
        _snake_case					     =       np.random.rand(*v.shape		).astype(v.dtype		)
      elif isinstance(__lowerCamelCase ,					datasets.Value		):
        if v.dtype == "string":
          _snake_case					     =       '''The small grey turtle was surprisingly fast when challenged.'''
        else:
          _snake_case					     =       np.random.randint(10 ,					size=1		).astype(v.dtype		).item()
      elif isinstance(__lowerCamelCase ,					datasets.Sequence		):
        while isinstance(__lowerCamelCase ,					datasets.Sequence		):
          _snake_case					     =       v.feature
        _snake_case					     =       seq_shapes[k]
        _snake_case					     =       np.random.rand(*__lowerCamelCase		).astype(v.dtype		)
      _snake_case					     =       data

    dummy_data.append((i, example)		)

  return dummy_data

def 					_UpperCAmelCase      ( __lowerCamelCase   :       Tuple ,					__lowerCamelCase   :       List[Any] ,					__lowerCamelCase   :       Dict=1_00 ,					__lowerCamelCase   :       Tuple=None		)     ->					str:
  _snake_case					     =       generate_examples(__lowerCamelCase ,					num_examples=__lowerCamelCase ,					seq_shapes=__lowerCamelCase		)

  with ArrowWriter(features=__lowerCamelCase ,					path=__lowerCamelCase		) as writer:
    for key, record in dummy_data:
      _snake_case					     =       features.encode_example(__lowerCamelCase		)
      writer.write(__lowerCamelCase		)

    _snake_case     ,					_snake_case					     =       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}.'''		)

  _snake_case					     =       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() = }")



