

from __future__ import annotations

from statistics import mean





def a(lowercase__			, lowercase__			, lowercase__	):





	'''simple docstring'''
	snake_case_      		= [0] * no_of_processes
	snake_case_      		= [0] * no_of_processes

	# Initialize remaining_time to waiting_time.

	for i in range(_snake_case	):
		snake_case_      		= burst_time[i]
	snake_case_      		= []

	snake_case_      		= 0
	snake_case_      		= 0

	# When processes are not completed,
	# A process whose arrival time has passed \
	# and has remaining execution time is put into the ready_process.
	# The shortest process in the ready_process, target_process is executed.

	while completed != no_of_processes:
		snake_case_      		= []
		snake_case_      		= -1

		for i in range(_snake_case	):
			if (arrival_time[i] <= total_time) and (remaining_time[i] > 0):
				ready_process.append(_snake_case	)

		if len(_snake_case	) > 0:
			snake_case_      		= ready_process[0]
			for i in ready_process:
				if remaining_time[i] < remaining_time[target_process]:
					snake_case_      		= i
			total_time += burst_time[target_process]
			completed += 1
			snake_case_      		= 0
			snake_case_      		= (
			    total_time - arrival_time[target_process] - burst_time[target_process]
			)
		else:
			total_time += 1

	return waiting_time





def a(lowercase__			, lowercase__			, lowercase__	):





	'''simple docstring'''
	snake_case_      		= [0] * no_of_processes
	for i in range(_snake_case	):
		snake_case_      		= burst_time[i] + waiting_time[i]
	return turn_around_time


if __name__ == "__main__":
		print('[TEST CASE 01]')

		A											=     4
		A											=     [2, 5, 3, 7]
		A											=     [0, 0, 0, 0]
		A											=     calculate_waitingtime(arrival_time, burst_time, no_of_processes)
		A											=     calculate_turnaroundtime(
		    burst_time, no_of_processes, waiting_time
		)

		# Printing the Result
		print('PID\tBurst Time\tArrival Time\tWaiting Time\tTurnaround Time')
		for i, process_id in enumerate(list(range(1, 5))):
				print(
				    f"""{process_id}\t{burst_time[i]}\t\t\t{arrival_time[i]}\t\t\t\t"""
				    f"""{waiting_time[i]}\t\t\t\t{turn_around_time[i]}"""
				)
		print(f"""\nAverage waiting time = {mean(waiting_time):.5f}""")
		print(f"""Average turnaround time = {mean(turn_around_time):.5f}""")



import operator as op





def a(lowercase__	):





	'''simple docstring'''
	snake_case_      		= []
	snake_case_      		= lambda lowercase__			, lowercase__	: int(x / y	)  # noqa: E731 integer division operation
	snake_case_      		= {
	    '^': 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(lowercase__	))	)

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

			snake_case_      		= stack.pop()  # pop stack
			# output in tabular format
			print(''.rjust(8	)			, ('pop(' + a + ')').ljust(12	)			, ','.join(lowercase__	)			, sep=' | '	)

			stack.append(
			    str(opr[x](int(lowercase__	)			, int(lowercase__	)	)	)	)  # 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(lowercase__	)			, sep=' | '			, )

	return int(stack[0]	)


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