




from __future__ import annotations

import pandas as pd

def      _SCREAMING_SNAKE_CASE     (				lowercase      :			list[int]      ,				lowercase      :			list[int]      ,				lowercase      :			int	):


      '''simple docstring'''



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

      lowerCamelCase_							=       0
      lowerCamelCase_							=       0
      lowerCamelCase_							=       9_99_99_99_99
      lowerCamelCase_							=       0
      lowerCamelCase_							=       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:
                              lowerCamelCase_							=       remaining_time[j]
                              lowerCamelCase_							=       j
                              lowerCamelCase_							=       True

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

            lowerCamelCase_							=       remaining_time[short]
            if minm == 0:
                  lowerCamelCase_							=       9_99_99_99_99

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

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

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

                  if waiting_time[short] < 0:
                        lowerCamelCase_							=       0

        # Increment time
            increment_time += 1
      return waiting_time

def      _SCREAMING_SNAKE_CASE     (				lowercase      :			list[int]      ,				lowercase      :			int      ,				lowercase      :			list[int]	):


      '''simple docstring'''



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

def      _SCREAMING_SNAKE_CASE     (				lowercase      :			list[int]      ,				lowercase      :			list[int]      ,				lowercase      :			int	):


      '''simple docstring'''



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

 lowerCamelCase							:						Union[str, Any]					       =  calculate_waitingtime(arrival_time, burst_time, no_of_processes)

 lowerCamelCase							:						Dict					       =  burst_time
 lowerCamelCase							:						Optional[Any]					       =  no_of_processes
 lowerCamelCase							:						Tuple					       =  waiting_time
 lowerCamelCase							:						Union[str, Any]					       =  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)










def  SCREAMING_SNAKE_CASE				(      snake_case						,   snake_case							)		->    bool:
		__lowercase											=     len(snake_case							) + 1
		__lowercase											=     len(snake_case							) + 1

		# dp is a 2d matrix where dp[i][j] denotes whether prefix string of
		# length i of input_string matches with prefix string of length j of
		# given pattern.
		# "dp" stands for dynamic programming.
		__lowercase											=     [[0 for i in range(snake_case							)] for j in range(snake_case							)]

		# since string of zero length match pattern of zero length
		__lowercase											=     1

		# since pattern of zero length will never match with string of non-zero length
		for i in range(1						,   snake_case							):
				__lowercase											=     0

		# since string of zero length will match with pattern where there
		# is at least one * alternatively
		for j in range(1						,   snake_case							):
				__lowercase											=     dp[0][j - 2] if pattern[j - 1] == '*' else 0

		# now using bottom-up approach to find for all remaining lengths
		for i in range(1						,   snake_case							):
				for j in range(1						,   snake_case							):
						if input_string[i - 1] == pattern[j - 1] or pattern[j - 1] == ".":
								__lowercase											=     dp[i - 1][j - 1]

						elif pattern[j - 1] == "*":
								if dp[i][j - 2] == 1:
										__lowercase											=     1
								elif pattern[j - 2] in (input_string[i - 1], "."):
										__lowercase											=     dp[i - 1][j]
								else:
										__lowercase											=     0
						else:
								__lowercase											=     0

		return bool(dp[-1][-1]							)


if __name__ == "__main__":
		import doctest

		doctest.testmod()
		# inputing the strings
		# input_string = input("input a string :")
		# pattern = input("input a pattern :")

		SCREAMING_SNAKE_CASE_   :      Any			=   '''aab'''
		SCREAMING_SNAKE_CASE_   :      str			=   '''c*a*b'''

		# using function to check whether given string matches the given pattern
		if match_pattern(input_string, pattern):
				print(F"""{input_string} matches the given pattern {pattern}""")
		else:
				print(F"""{input_string} does not match with the given pattern {pattern}""")




