class  __lowerCAmelCase	:



 '''simple docstring'''




 class  __lowerCAmelCase	:



  '''simple docstring'''
  _lowerCamelCase    :						Tuple					     =			'_prev', '_data', '_next'

  def __init__(      self							:		int							,      lowerCamelCase							:		List[Any]							,      lowerCamelCase							:		Any							,      lowerCamelCase							:		Union[str, Any]	)			->				List[Any]:
         _UpperCamelCase  :							str	    =	link_p
         _UpperCamelCase  :							Union[str, Any]	    =	element
         _UpperCamelCase  :							Tuple	    =	link_n

  def        __snake_case       (      self							:		Optional[int]	)			->				Optional[int]:
         return (
             f" Prev -> {self._prev is not None}, Next -> {self._next is not None}"
         )







 def __init__(      self							:		Optional[Any]	)			->				Union[str, Any]:
        _UpperCamelCase  :							int	    =	self._Node(lowerCamelCase							,      lowerCamelCase							,      lowerCamelCase	)
        _UpperCamelCase  :							str	    =	self._Node(lowerCamelCase							,      lowerCamelCase							,      lowerCamelCase	)
        _UpperCamelCase  :							List[Any]	    =	self._trailer
        _UpperCamelCase  :							List[Any]	    =	self._header
        _UpperCamelCase  :							Dict	    =	0

 def __len__(      self							:		List[str]	)			->				str:
        return self._size

 def        __snake_case       (      self							:		Dict	)			->				Union[str, Any]:
        return self.__len__() == 0

 def        __snake_case       (      self							:		Any							,      lowerCamelCase							:		str							,      lowerCamelCase							:		Any							,      lowerCamelCase							:		Union[str, Any]	)			->				Optional[Any]:
        # Create new_node by setting it's prev.link -> header
        # setting it's next.link -> trailer
        _UpperCamelCase  :							List[Any]	    =	self._Node(lowerCamelCase							,      lowerCamelCase							,      lowerCamelCase	)
        _UpperCamelCase  :							Tuple	    =	new_node
        _UpperCamelCase  :							Tuple	    =	new_node
        self._size += 1
        return self

 def        __snake_case       (      self							:		int							,      lowerCamelCase							:		Any	)			->				Union[str, Any]:
        _UpperCamelCase  :							int	    =	node._prev
        _UpperCamelCase  :							List[Any]	    =	node._next

        _UpperCamelCase  :							Any	    =	successor
        _UpperCamelCase  :							Dict	    =	predecessor
        self._size -= 1
        _UpperCamelCase  :							int	    =	node._data
        _UpperCamelCase  :							Tuple	    =	None
        del node
        return temp







class  __lowerCAmelCase	(							_DoublyLinkedBase    ):



 '''simple docstring'''

 def        __snake_case       (      self							:		List[str]	)			->				Optional[int]:
        if self.is_empty():
               raise Exception('List is empty'	)
        return self._header._next._data

 def        __snake_case       (      self							:		Optional[int]	)			->				List[str]:
        if self.is_empty():
               raise Exception('List is empty'	)
        return self._trailer._prev._data

 def        __snake_case       (      self							:		List[Any]							,      lowerCamelCase							:		List[Any]	)			->				int:
        return self._insert(self._header							,      lowerCamelCase							,      self._header._next	)

 def        __snake_case       (      self							:		Tuple							,      lowerCamelCase							:		Tuple	)			->				Any:
        return self._insert(self._trailer._prev							,      lowerCamelCase							,      self._trailer	)

 def        __snake_case       (      self							:		int	)			->				Dict:
        if self.is_empty():
               raise IndexError('remove_first from empty list'	)
        return self._delete(self._header._next	)

 def        __snake_case       (      self							:		Any	)			->				str:
        if self.is_empty():
               raise IndexError('remove_first from empty list'	)
        return self._delete(self._trailer._prev	)




from __future__ import annotations

from statistics import mean


def SCREAMING_SNAKE_CASE					(  lowercase_:						list[int]					):
       _UpperCamelCase  :							str	    =	2
       _UpperCamelCase  :							Optional[int]	    =	list(lowercase_					)
       _UpperCamelCase  :							Union[str, Any]	    =	[0] * len(lowercase_					)
       _UpperCamelCase  :							List[str]	    =	0
       while True:
              _UpperCamelCase  :							List[str]	    =	True
              for i, burst_time in enumerate(lowercase_					):
                     if rem_burst_times[i] > 0:
                            _UpperCamelCase  :							List[str]	    =	False
                            if rem_burst_times[i] > quantum:
                                   t += quantum
                                   rem_burst_times[i] -= quantum
                            else:
                                   t += rem_burst_times[i]
                                   _UpperCamelCase  :							str	    =	t - burst_time
                                   _UpperCamelCase  :							Union[str, Any]	    =	0
              if done is True:
                     return waiting_times


def SCREAMING_SNAKE_CASE					(  lowercase_:						list[int]		,    lowercase_:						list[int]					):
       return [burst + waiting for burst, waiting in zip(lowercase_		,    lowercase_					)]


if __name__ == "__main__":
 UpperCAmelCase      		=					[3, 5, 7]
 UpperCAmelCase      		=					calculate_waiting_times(burst_times)
 UpperCAmelCase      		=					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}''')



