
import timeit

import numpy as np

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




def       _SCREAMING_SNAKE_CASE   (						_lowerCamelCase					:     Optional[Any])   ->       List[Any]:






							'''simple docstring'''





							def wrapper(*_lowerCamelCase					:     Dict		,    **_lowerCamelCase					:     int):
														__UpperCamelCase      :  Dict       =   timeit.default_timer()
														__UpperCamelCase      :  List[str]       =   func(*_lowerCamelCase		,    **_lowerCamelCase)
														__UpperCamelCase      :  str       =   timeit.default_timer() - starttime
														return delta

							__UpperCamelCase      :  List[str]       =   func.__name__

							return wrapper




def       _SCREAMING_SNAKE_CASE   (						_lowerCamelCase					:     dict		,    _lowerCamelCase					:     Optional[int]=100		,    _lowerCamelCase					:     Any=None)   ->       Optional[int]:






							'''simple docstring'''





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

														dummy_data.append((i, example))

							return dummy_data




def       _SCREAMING_SNAKE_CASE   (						_lowerCamelCase					:     Union[str, Any]		,    _lowerCamelCase					:     int		,    _lowerCamelCase					:     Any=100		,    _lowerCamelCase					:     Optional[Any]=None)   ->       Any:






							'''simple docstring'''





							__UpperCamelCase      :  int       =   generate_examples(_lowerCamelCase		,    num_examples=_lowerCamelCase		,    seq_shapes=_lowerCamelCase)

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

														__UpperCamelCase  ,		__UpperCamelCase      :  List[str]       =   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}.')

							__UpperCamelCase      :  Optional[int]       =   datasets.Dataset.from_file(filename=_lowerCamelCase		,    info=datasets.DatasetInfo(features=_lowerCamelCase))

							return dataset

def       _SCREAMING_SNAKE_CASE   (						_lowerCamelCase					:     int = 10**9)   ->       int:






							'''simple docstring'''





							__UpperCamelCase      :  int       =   1
							__UpperCamelCase      :  Any       =   2

							__UpperCamelCase      :  Dict       =   0
							__UpperCamelCase      :  Any       =   0
							__UpperCamelCase      :  List[Any]       =   0
							while perimeter <= max_perimeter:
														perimeters_sum += perimeter

														prev_value += 2 * value
														value += prev_value

														__UpperCamelCase      :  Optional[int]       =   2 * value + 2 if i % 2 == 0 else 2 * value - 2
														i += 1

							return perimeters_sum


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