



'''simple docstring'''






import timeit

import numpy as np

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


def  snake_case_     (					_lowerCAmelCase  :						List[str]  )      ->   str:
							def wrapper(*_lowerCAmelCase  :						str   ,      **_lowerCAmelCase  :						Tuple  ):
														UpperCAmelCase :       int 							=		timeit.default_timer()
														UpperCAmelCase :       int 							=		func(*_lowerCAmelCase   ,      **_lowerCAmelCase  )
														UpperCAmelCase :       Dict 							=		timeit.default_timer() - starttime
														return delta

							UpperCAmelCase :       List[str] 							=		func.__name__

							return wrapper


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

														dummy_data.append((i, example)  )

							return dummy_data




def  snake_case_     (					_lowerCAmelCase  :						Optional[Any]   ,      _lowerCAmelCase  :						Union[str, Any]   ,      _lowerCAmelCase  :						List[Any]=100   ,      _lowerCAmelCase  :						Dict=None  )      ->   Union[str, Any]:
							UpperCAmelCase :       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:
																					UpperCAmelCase :       Union[str, Any] 							=		features.encode_example(_lowerCAmelCase  )
																					writer.write(_lowerCAmelCase  )

														UpperCAmelCase							,		UpperCAmelCase :       int 							=		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 :       List[str] 							=		datasets.Dataset.from_file(filename=_lowerCAmelCase   ,      info=datasets.DatasetInfo(features=_lowerCAmelCase  )  )

							return dataset






'''simple docstring'''





def 	lowerCAmelCase_				(					snake_case_       : int					,    snake_case_       : int			)    ->      int:


     '''simple docstring'''




     return x if y == 0 else greatest_common_divisor(snake_case_					,    x % y			)





def 	lowerCAmelCase_				(					snake_case_       : int					,    snake_case_       : int			)    ->      int:


     '''simple docstring'''




     return (x * y) // greatest_common_divisor(snake_case_					,    snake_case_			)





def 	lowerCAmelCase_				(					snake_case_       : int = 20			)    ->      int:


     '''simple docstring'''




     UpperCAmelCase_           =   1
     for i in range(1					,    n + 1			):
          UpperCAmelCase_           =   lcm(snake_case_					,    snake_case_			)
     return g


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




