




from __future__ import annotations

import pandas as pd







def SCREAMING_SNAKE_CASE				(       lowercase_ ,				lowercase_ ,				lowercase_						)   ->       list[int]:



       """simple docstring"""

       A__       =    [0] * no_of_processes
       A__       =    [0] * no_of_processes
       # Copy the burst time into remaining_time[]
       for i in range(lowercase_						):
              A__       =    burst_time[i]

       A__       =    0
       A__       =    0
       A__       =    999_999_999
       A__       =    0
       A__       =    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:
                                   A__       =    remaining_time[j]
                                   A__       =    j
                                   A__       =    True

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

              A__       =    remaining_time[short]
              if minm == 0:
                     A__       =    999_999_999

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

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

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

                     if waiting_time[short] < 0:
                            A__       =    0

        # Increment time
              increment_time += 1
       return waiting_time







def SCREAMING_SNAKE_CASE				(       lowercase_ ,				lowercase_ ,				lowercase_						)   ->       list[int]:



       """simple docstring"""

       A__       =    [0] * no_of_processes
       for i in range(lowercase_						):
              A__       =    burst_time[i] + waiting_time[i]
       return turn_around_time







def SCREAMING_SNAKE_CASE				(       lowercase_ ,				lowercase_ ,				lowercase_						)   ->       None:



       """simple docstring"""

       A__       =    0
       A__       =    0
       for i in range(lowercase_						):
              A__       =    total_waiting_time + waiting_time[i]
              A__       =    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	:		str							       =   int(input())
  _lowerCamelCase	:		Optional[int]							       =   [0] * no_of_processes
  _lowerCamelCase	:		str							       =   [0] * no_of_processes
  _lowerCamelCase	:		Tuple							       =   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	:		Union[str, Any]							       =   map(int, input().split())

  _lowerCamelCase	:		List[str]							       =   calculate_waitingtime(arrival_time, burst_time, no_of_processes)

  _lowerCamelCase	:		Any							       =   burst_time
  _lowerCamelCase	:		Optional[Any]							       =   no_of_processes
  _lowerCamelCase	:		Any							       =   waiting_time
  _lowerCamelCase	:		Optional[int]							       =   calculate_turnaroundtime(bt, n, wt)

  calculate_average_times(waiting_time, turn_around_time, no_of_processes)

  _lowerCamelCase	:		Optional[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)




import os
from distutils.util import strtobool
def  lowerCAmelCase__			(  SCREAMING_SNAKE_CASE_       ,							SCREAMING_SNAKE_CASE_     )				->		Optional[Any]:
			for e in env_keys:
						lowerCAmelCase__      :      Union[str, Any]         =		int(os.environ.get(SCREAMING_SNAKE_CASE_       ,							-1     )     )
						if val >= 0:
									return val
			return default
def  lowerCAmelCase__			(  SCREAMING_SNAKE_CASE_       ,							SCREAMING_SNAKE_CASE_=False     )				->		List[str]:
			lowerCAmelCase__      :      Optional[int]         =		os.environ.get(SCREAMING_SNAKE_CASE_       ,							str(SCREAMING_SNAKE_CASE_     )     )
			return strtobool(SCREAMING_SNAKE_CASE_     ) == 1  # As its name indicates `strtobool` actually returns an int...







def  lowerCAmelCase__			(  SCREAMING_SNAKE_CASE_       ,							SCREAMING_SNAKE_CASE_="no"     )				->		List[str]:
			lowerCAmelCase__      :      Optional[int]         =		os.environ.get(SCREAMING_SNAKE_CASE_       ,							str(SCREAMING_SNAKE_CASE_     )     )
			return value