





import timeit

import numpy as np

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




def       __UpperCamelCase  (_SCREAMING_SNAKE_CASE		)    ->       Any:
  def wrapper(*_SCREAMING_SNAKE_CASE		,						**_SCREAMING_SNAKE_CASE		):
    lowercase__           =  timeit.default_timer()
    lowercase__           =  func(*_SCREAMING_SNAKE_CASE		,						**_SCREAMING_SNAKE_CASE		)
    lowercase__           =  timeit.default_timer() - starttime
    return delta

  lowercase__           =  func.__name__

  return wrapper




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

    dummy_data.append((i, example)		)

  return dummy_data




def       __UpperCamelCase  (_SCREAMING_SNAKE_CASE		,						_SCREAMING_SNAKE_CASE		,						_SCREAMING_SNAKE_CASE=100		,						_SCREAMING_SNAKE_CASE=None		)    ->       Any:
  lowercase__           =  generate_examples(_SCREAMING_SNAKE_CASE		,						num_examples=_SCREAMING_SNAKE_CASE		,						seq_shapes=_SCREAMING_SNAKE_CASE		)

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

    lowercase__      ,   lowercase__           =  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}."""		)

  lowercase__           =  datasets.Dataset.from_file(filename=_SCREAMING_SNAKE_CASE		,						info=datasets.DatasetInfo(features=_SCREAMING_SNAKE_CASE		)		)

  return dataset









def       __UpperCamelCase  (_SCREAMING_SNAKE_CASE		,						_SCREAMING_SNAKE_CASE		,						_SCREAMING_SNAKE_CASE		)    ->       int:

  if exponent == 1:
    return base
  if exponent % 2 == 0:
    lowercase__           =  _modexpt(_SCREAMING_SNAKE_CASE		,						exponent // 2		,						_SCREAMING_SNAKE_CASE		) % modulo_value
    return (x * x) % modulo_value
  else:
    return (base * _modexpt(_SCREAMING_SNAKE_CASE		,						exponent - 1		,						_SCREAMING_SNAKE_CASE		)) % modulo_value




def       __UpperCamelCase  (_SCREAMING_SNAKE_CASE = 1777		,						_SCREAMING_SNAKE_CASE = 1855		,						_SCREAMING_SNAKE_CASE = 8		)    ->       int:
  lowercase__           =  base
  for _ in range(1		,						_SCREAMING_SNAKE_CASE		):
    lowercase__           =  _modexpt(_SCREAMING_SNAKE_CASE		,						_SCREAMING_SNAKE_CASE		,						10**digits		)

  return result


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


