
from __future__ import annotations

from statistics import mean


def 		UpperCAmelCase    (			a_		)	->			list[int]:







				"""simple docstring"""



				__A         =				2
				__A         =				list(a_		)
				__A         =				[0] * len(a_		)
				__A         =				0
				while True:
								__A         =				True
								for i, burst_time in enumerate(a_		):
												if rem_burst_times[i] > 0:
																__A         =				False
																if rem_burst_times[i] > quantum:
																				t += quantum
																				rem_burst_times[i] -= quantum
																else:
																				t += rem_burst_times[i]
																				__A         =				t - burst_time
																				__A         =				0
								if done is True:
												return waiting_times


def 		UpperCAmelCase    (			a_	,     a_		)	->			list[int]:







				"""simple docstring"""



				return [burst + waiting for burst, waiting in zip(a_	,     a_		)]


if __name__ == "__main__":
					SCREAMING_SNAKE_CASE							:Dict											=       [3, 5, 7]
					SCREAMING_SNAKE_CASE							:Any											=       calculate_waiting_times(burst_times)
					SCREAMING_SNAKE_CASE							:Tuple											=       calculate_turn_around_times(burst_times, waiting_times)
					print('Process ID \tBurst Time \tWaiting Time \tTurnaround Time')
					for i, burst_time in enumerate(burst_times):
										print(
										    f'''  {i + 1}\t\t  {burst_time}\t\t  {waiting_times[i]}\t\t  '''
										    f'''{turn_around_times[i]}'''
										)
					print(f'''\nAverage waiting time = {mean(waiting_times):.5f}''')
					print(f'''Average turn around time = {mean(turn_around_times):.5f}''')


from typing import Any





class 							UpperCAmelCase   :




	'''simple docstring'''





	def __init__( self      :				Union[str, Any]				):
					__A         =				[]
					__A         =				0






	def __str__( self      :				Tuple				):
					__A         =				"<" + str(self.stack				)[1:-1] + ">"
					return printed






	def        UpperCamelCase_						( self      :				Optional[int]							,A      :				Any				):
					self.stack.append(A				)
					__A         =				self.length + 1






	def        UpperCamelCase_						( self      :				Any				):
					self.rotate(1				)
					__A         =				self.stack[self.length - 1]
					__A         =				self.stack[:-1]
					self.rotate(self.length - 1				)
					__A         =				self.length - 1
					return dequeued






	def        UpperCamelCase_						( self      :				Tuple							,A      :				int				):
					for _ in range(A				):
									__A         =				self.stack[0]
									__A         =				self.stack[1:]
									self.put(A				)
									__A         =				self.length - 1






	def        UpperCamelCase_						( self      :				Optional[Any]				):
					__A         =				self.get()
					self.put(A				)
					self.rotate(self.length - 1				)
					return front






	def        UpperCamelCase_						( self      :				Optional[Any]				):
					return self.length
