from __future__ import annotations

import pandas as pd







def      _a					(   lowercase__	:      list[int]  ,	lowercase__	:      list[int]  ,	lowercase__	:      int			):







     '''simple docstring'''


     SCREAMING_SNAKE_CASE__					:					Any      =		[0] * no_of_processes
     SCREAMING_SNAKE_CASE__					:					int      =		[0] * no_of_processes
     # Copy the burst time into remaining_time[]
     for i in range(lowercase__			):
          SCREAMING_SNAKE_CASE__					:					Optional[int]      =		burst_time[i]

     SCREAMING_SNAKE_CASE__					:					Optional[int]      =		0
     SCREAMING_SNAKE_CASE__					:					Optional[int]      =		0
     SCREAMING_SNAKE_CASE__					:					Any      =		9_99_99_99_99
     SCREAMING_SNAKE_CASE__					:					List[str]      =		0
     SCREAMING_SNAKE_CASE__					:					Any      =		False

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

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

          SCREAMING_SNAKE_CASE__					:					Any      =		remaining_time[short]
          if minm == 0:
               SCREAMING_SNAKE_CASE__					:					int      =		9_99_99_99_99

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

               # Find finish time of current process
               SCREAMING_SNAKE_CASE__					:					str      =		increment_time + 1

               # Calculate waiting time
               SCREAMING_SNAKE_CASE__					:					int      =		finish_time - arrival_time[short]
               SCREAMING_SNAKE_CASE__					:					int      =		finar - burst_time[short]

               if waiting_time[short] < 0:
                    SCREAMING_SNAKE_CASE__					:					int      =		0

        # Increment time
          increment_time += 1
     return waiting_time







def      _a					(   lowercase__	:      list[int]  ,	lowercase__	:      int  ,	lowercase__	:      list[int]			):







     '''simple docstring'''


     SCREAMING_SNAKE_CASE__					:					List[Any]      =		[0] * no_of_processes
     for i in range(lowercase__			):
          SCREAMING_SNAKE_CASE__					:					Optional[int]      =		burst_time[i] + waiting_time[i]
     return turn_around_time







def      _a					(   lowercase__	:      list[int]  ,	lowercase__	:      list[int]  ,	lowercase__	:      int			):







     '''simple docstring'''


     SCREAMING_SNAKE_CASE__					:					Optional[Any]      =		0
     SCREAMING_SNAKE_CASE__					:					List[str]      =		0
     for i in range(lowercase__			):
          SCREAMING_SNAKE_CASE__					:					List[str]      =		total_waiting_time + waiting_time[i]
          SCREAMING_SNAKE_CASE__					:					List[str]      =		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")
      SCREAMING_SNAKE_CASE__		:       str       						=       int(input())
      SCREAMING_SNAKE_CASE__		:       Optional[int]       						=       [0] * no_of_processes
      SCREAMING_SNAKE_CASE__		:       str       						=       [0] * no_of_processes
      SCREAMING_SNAKE_CASE__		:       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))
            SCREAMING_SNAKE_CASE__						,  SCREAMING_SNAKE_CASE__		:       str       						=       map(int, input().split())

      SCREAMING_SNAKE_CASE__		:       int       						=       calculate_waitingtime(arrival_time, burst_time, no_of_processes)

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

      calculate_average_times(waiting_time, turn_around_time, no_of_processes)

      SCREAMING_SNAKE_CASE__		:       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)




from math import isqrt
def 		snake_case__	(		lowercase					):
   lowerCAmelCase_:							List[str]       =	[True] * max_number
   for i in range(2							,				isqrt(max_number - 1					) + 1					):
      if is_prime[i]:
         for j in range(i**2							,				lowercase							,				lowercase					):
            lowerCAmelCase_:							Dict       =	False

   return [i for i in range(2							,				lowercase					) if is_prime[i]]
def 		snake_case__	(		lowercase = 10**8					):
   lowerCAmelCase_:							Union[str, Any]       =	calculate_prime_numbers(max_number // 2					)

   lowerCAmelCase_:							Tuple       =	0
   lowerCAmelCase_:							List[Any]       =	0
   lowerCAmelCase_:							Dict       =	len(lowercase					) - 1
   while left <= right:
      while prime_numbers[left] * prime_numbers[right] >= max_number:
         right -= 1
      semiprimes_count += right - left + 1
      left += 1

   return semiprimes_count


if __name__ == "__main__":
 print(f'''{solution() = }''')