






"""simple docstring"""







from ...configuration_utils import PretrainedConfig
from ...utils import logging


lowerCAmelCase_	:    str					     =      logging.get_logger(__name__)

lowerCAmelCase_	:    Optional[int]					     =      {
    "google/pegasus-large": "https://huggingface.co/google/pegasus-large/resolve/main/config.json",
    # See all PEGASUS models at https://huggingface.co/models?filter=pegasus
}





class   UpperCamelCase_ (       UpperCAmelCase_  ):
  _A       :					Dict				=	'pegasus'
  _A       :					str				=	['past_key_values']
  _A       :					Any				=	{'num_attention_heads': 'encoder_attention_heads', 'hidden_size': 'd_model'}



  def __init__(      self ,		snake_case__=5_02_65 ,		snake_case__=10_24 ,		snake_case__=12 ,		snake_case__=40_96 ,		snake_case__=16 ,		snake_case__=12 ,		snake_case__=40_96 ,		snake_case__=16 ,		snake_case__=0.0 ,		snake_case__=0.0 ,		snake_case__=True ,		snake_case__=True ,		snake_case__="gelu" ,		snake_case__=10_24 ,		snake_case__=0.1 ,		snake_case__=0.0 ,		snake_case__=0.0 ,		snake_case__=0.02 ,		snake_case__=0 ,		snake_case__=False ,		snake_case__=0 ,		snake_case__=1 ,		snake_case__=1 ,		**snake_case__ ,		)			->			Tuple:



         """simple docstring"""





         UpperCAmelCase	    =			vocab_size
         UpperCAmelCase	    =			max_position_embeddings
         UpperCAmelCase	    =			d_model
         UpperCAmelCase	    =			encoder_ffn_dim
         UpperCAmelCase	    =			encoder_layers
         UpperCAmelCase	    =			encoder_attention_heads
         UpperCAmelCase	    =			decoder_ffn_dim
         UpperCAmelCase	    =			decoder_layers
         UpperCAmelCase	    =			decoder_attention_heads
         UpperCAmelCase	    =			dropout
         UpperCAmelCase	    =			attention_dropout
         UpperCAmelCase	    =			activation_dropout
         UpperCAmelCase	    =			activation_function
         UpperCAmelCase	    =			init_std
         UpperCAmelCase	    =			encoder_layerdrop
         UpperCAmelCase	    =			decoder_layerdrop
         UpperCAmelCase	    =			use_cache
         UpperCAmelCase	    =			encoder_layers
         UpperCAmelCase	    =			scale_embedding  # scale factor will be sqrt(d_model) if True
         super().__init__(
             pad_token_id=_lowercase ,		eos_token_id=_lowercase ,		is_encoder_decoder=_lowercase ,		decoder_start_token_id=_lowercase ,		forced_eos_token_id=_lowercase ,		**_lowercase ,		)



  @property
  def 		UpperCamelCase_				(      self				)			->			int:



         """simple docstring"""





         return self.encoder_attention_heads



  @property
  def 		UpperCamelCase_				(      self				)			->			int:



         """simple docstring"""





         return self.d_model








"""simple docstring"""







from __future__ import annotations

import pandas as pd






def       _lowerCAmelCase       (      lowerCAmelCase	,      lowerCAmelCase	,      lowerCAmelCase		):







       '''simple docstring'''
       UpperCAmelCase	    =			[0] * no_of_processes
       UpperCAmelCase	    =			[0] * no_of_processes
       # Copy the burst time into remaining_time[]
       for i in range(lowerCAmelCase		):
              UpperCAmelCase	    =			burst_time[i]

       UpperCAmelCase	    =			0
       UpperCAmelCase	    =			0
       UpperCAmelCase	    =			999999999
       UpperCAmelCase	    =			0
       UpperCAmelCase	    =			False

       # Process until all processes are completed
       while complete != no_of_processes:
              for j in range(lowerCAmelCase		):
                     if arrival_time[j] <= increment_time and remaining_time[j] > 0:
                            if remaining_time[j] < minm:
                                   UpperCAmelCase	    =			remaining_time[j]
                                   UpperCAmelCase	    =			j
                                   UpperCAmelCase	    =			True

              if not check:
                     increment_time += 1
                     continue
              remaining_time[short] -= 1

              UpperCAmelCase	    =			remaining_time[short]
              if minm == 0:
                     UpperCAmelCase	    =			999999999

              if remaining_time[short] == 0:
                     complete += 1
                     UpperCAmelCase	    =			False

                     # Find finish time of current process
                     UpperCAmelCase	    =			increment_time + 1

                     # Calculate waiting time
                     UpperCAmelCase	    =			finish_time - arrival_time[short]
                     UpperCAmelCase	    =			finar - burst_time[short]

                     if waiting_time[short] < 0:
                            UpperCAmelCase	    =			0

        # Increment time
              increment_time += 1
       return waiting_time






def       _lowerCAmelCase       (      lowerCAmelCase	,      lowerCAmelCase	,      lowerCAmelCase		):







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






def       _lowerCAmelCase       (      lowerCAmelCase	,      lowerCAmelCase	,      lowerCAmelCase		):







       '''simple docstring'''
       UpperCAmelCase	    =			0
       UpperCAmelCase	    =			0
       for i in range(lowerCAmelCase		):
              UpperCAmelCase	    =			total_waiting_time + waiting_time[i]
              UpperCAmelCase	    =			total_turn_around_time + turn_around_time[i]
       print(F'''Average waiting time = {total_waiting_time / no_of_processes:.5f}'''		)
       print("""Average turn around time ="""	,      total_turn_around_time / no_of_processes		)


if __name__ == "__main__":
 print('''Enter how many process you want to analyze''')
 lowerCAmelCase_	:    Optional[Any]            =      int(input())
 lowerCAmelCase_	:    List[Any]            =      [0] * no_of_processes
 lowerCAmelCase_	:    Optional[Any]            =      [0] * no_of_processes
 lowerCAmelCase_	:    int            =      list(range(1, no_of_processes + 1))

 for i in range(no_of_processes):
  print('''Enter the arrival time and burst time for process:--''' + str(i + 1))
  lowerCAmelCase_     ,					lowerCAmelCase_	:    Optional[Any]            =      map(int, input().split())

 lowerCAmelCase_	:    str            =      calculate_waitingtime(arrival_time, burst_time, no_of_processes)

 lowerCAmelCase_	:    str            =      burst_time
 lowerCAmelCase_	:    List[Any]            =      no_of_processes
 lowerCAmelCase_	:    int            =      waiting_time
 lowerCAmelCase_	:    int            =      calculate_turnaroundtime(bt, n, wt)

 calculate_average_times(waiting_time, turn_around_time, no_of_processes)

 lowerCAmelCase_	:    List[Any]            =      pd.DataFrame(
     list(zip(processes, burst_time, arrival_time, waiting_time, turn_around_time)),
     columns=[
         '''Process''',
         '''BurstTime''',
         '''ArrivalTime''',
         '''WaitingTime''',
         '''TurnAroundTime''',
     ],
 )

 # Printing the dataFrame
 pd.set_option('''display.max_rows''', fcfs.shape[0] + 1)
 print(fcfs)
