






"""simple docstring"""
import timeit

import numpy as np

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





def 				lowercase__		(					lowerCamelCase       ):
				def wrapper(*lowerCamelCase,						**lowerCamelCase       ):
								_SCREAMING_SNAKE_CASE   :		List[Any]       		=    timeit.default_timer()
								_SCREAMING_SNAKE_CASE   :		Optional[int]       		=    func(*lowerCamelCase,						**lowerCamelCase       )
								_SCREAMING_SNAKE_CASE   :		Optional[int]       		=    timeit.default_timer() - starttime
								return delta

				_SCREAMING_SNAKE_CASE   :		str       		=    func.__name__

				return wrapper





def 				lowercase__		(					lowerCamelCase,						lowerCamelCase=100,						lowerCamelCase=None       ):
				_SCREAMING_SNAKE_CASE   :		Union[str, Any]       		=    []
				_SCREAMING_SNAKE_CASE   :		Any       		=    seq_shapes or {}
				for i in range(lowerCamelCase       ):
								_SCREAMING_SNAKE_CASE   :		int       		=    {}
								for col_id, (k, v) in enumerate(features.items()       ):
												if isinstance(lowerCamelCase,						_ArrayXD       ):
																_SCREAMING_SNAKE_CASE   :		Optional[Any]       		=    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   :		List[Any]       		=    np.random.randint(10,						size=1       ).astype(v.dtype       ).item()
												elif isinstance(lowerCamelCase,						datasets.Sequence       ):
																while isinstance(lowerCamelCase,						datasets.Sequence       ):
																				_SCREAMING_SNAKE_CASE   :		str       		=    v.feature
																_SCREAMING_SNAKE_CASE   :		int       		=    seq_shapes[k]
																_SCREAMING_SNAKE_CASE   :		Optional[Any]       		=    np.random.rand(*lowerCamelCase       ).astype(v.dtype       )
												_SCREAMING_SNAKE_CASE   :		Optional[Any]       		=    data

								dummy_data.append((i, example)       )

				return dummy_data






def 				lowercase__		(					lowerCamelCase,						lowerCamelCase,						lowerCamelCase=100,						lowerCamelCase=None       ):
				_SCREAMING_SNAKE_CASE   :		Optional[Any]       		=    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   :		Any       		=    features.encode_example(lowerCamelCase       )
												writer.write(lowerCamelCase       )

								_SCREAMING_SNAKE_CASE		,						_SCREAMING_SNAKE_CASE   :		Dict       		=    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   :		Union[str, Any]       		=    datasets.Dataset.from_file(filename=lowerCamelCase,						info=datasets.DatasetInfo(features=lowerCamelCase       )       )

				return dataset









"""simple docstring"""
import operator as op





def 				lowercase__		(					lowerCamelCase       ):
				_SCREAMING_SNAKE_CASE   :		int       		=    []
				_SCREAMING_SNAKE_CASE   :		Dict       		=    lambda lowerCamelCase,						lowerCamelCase       : int(x / y       )  # noqa: E731 integer division operation
				_SCREAMING_SNAKE_CASE   :		Tuple       		=    {
				    '^': op.pow,
				    '*': op.mul,
				    '/': div,
				    '+': op.add,
				    '-': op.sub,
				}  # operators & their respective operation

				# print table header
				print('Symbol'.center(8       ),						'Action'.center(12       ),						'Stack',						sep=' | '       )
				print('-' * (30 + len(lowerCamelCase       ))       )

				for x in post_fix:
								if x.isdigit():  # if x in digit
												stack.append(lowerCamelCase       )  # append x to stack
												# output in tabular format
												print(x.rjust(8       ),						('push(' + x + ')').ljust(12       ),						','.join(lowerCamelCase       ),						sep=' | '       )
								else:
												_SCREAMING_SNAKE_CASE   :		int       		=    stack.pop()  # pop stack
												# output in tabular format
												print(''.rjust(8       ),						('pop(' + b + ')').ljust(12       ),						','.join(lowerCamelCase       ),						sep=' | '       )

												_SCREAMING_SNAKE_CASE   :		Tuple       		=    stack.pop()  # pop stack
												# output in tabular format
												print(''.rjust(8       ),						('pop(' + a + ')').ljust(12       ),						','.join(lowerCamelCase       ),						sep=' | '       )

												stack.append(
												    str(opr[x](int(lowerCamelCase       ),						int(lowerCamelCase       )       )       )       )  # evaluate the 2 values popped from stack & push result to stack
												# output in tabular format
												print(
												    x.rjust(8       ),						('push(' + a + x + b + ')').ljust(12       ),						','.join(lowerCamelCase       ),						sep=' | ',						)

				return int(stack[0]       )


if __name__ == "__main__":
			lowerCAmelCase__    						=			input('\n\nEnter a Postfix Equation (space separated) = ').split(' ')
			print('\n\tResult = ', solve(Postfix))

