




'''simple docstring'''



from __future__ import annotations

import pandas as pd
def 			SCREAMING_SNAKE_CASE_			(							__A    :			list[int]	,					__A    :			list[int]	,					__A    :			int  )			->			list[int]:
   _SCREAMING_SNAKE_CASE	=				[0] * no_of_processes
   _SCREAMING_SNAKE_CASE	=				[0] * no_of_processes
   # Copy the burst time into remaining_time[]
   for i in range(__A  ):
      _SCREAMING_SNAKE_CASE	=				burst_time[i]

   _SCREAMING_SNAKE_CASE	=				0
   _SCREAMING_SNAKE_CASE	=				0
   _SCREAMING_SNAKE_CASE	=				9_99_99_99_99
   _SCREAMING_SNAKE_CASE	=				0
   _SCREAMING_SNAKE_CASE	=				False

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

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

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

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

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

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

         if waiting_time[short] < 0:
            _SCREAMING_SNAKE_CASE	=				0

        # Increment time
      increment_time += 1
   return waiting_time
def 			SCREAMING_SNAKE_CASE_			(							__A    :			list[int]	,					__A    :			int	,					__A    :			list[int]  )			->			list[int]:
   _SCREAMING_SNAKE_CASE	=				[0] * no_of_processes
   for i in range(__A  ):
      _SCREAMING_SNAKE_CASE	=				burst_time[i] + waiting_time[i]
   return turn_around_time
def 			SCREAMING_SNAKE_CASE_			(							__A    :			list[int]	,					__A    :			list[int]	,					__A    :			int  )			->			None:
   _SCREAMING_SNAKE_CASE	=				0
   _SCREAMING_SNAKE_CASE	=				0
   for i in range(__A  ):
      _SCREAMING_SNAKE_CASE	=				total_waiting_time + waiting_time[i]
      _SCREAMING_SNAKE_CASE	=				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_			=						int(input())
 lowerCamelCase_			=						[0] * no_of_processes
 lowerCamelCase_			=						[0] * no_of_processes
 lowerCamelCase_			=						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_			=						map(int, input().split())

 lowerCamelCase_			=						calculate_waitingtime(arrival_time, burst_time, no_of_processes)

 lowerCamelCase_			=						burst_time
 lowerCamelCase_			=						no_of_processes
 lowerCamelCase_			=						waiting_time
 lowerCamelCase_			=						calculate_turnaroundtime(bt, n, wt)

 calculate_average_times(waiting_time, turn_around_time, no_of_processes)

 lowerCamelCase_			=						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)







'''simple docstring'''



from collections.abc import Sequence
def 			SCREAMING_SNAKE_CASE_			(							__A    :			Sequence[int] | None = None  )			->			int:
   if nums is None or not nums:
      raise ValueError("Input sequence should not be empty"  )

   _SCREAMING_SNAKE_CASE	=				nums[0]
   for i in range(1	,					len(__A  )  ):
      _SCREAMING_SNAKE_CASE	=				nums[i]
      _SCREAMING_SNAKE_CASE	=				max(__A	,					ans + num	,					__A  )

   return ans


if __name__ == "__main__":
 import doctest

 doctest.testmod()

 # Try on a sample input from the user
 lowerCamelCase_			=						int(input('Enter number of elements : ').strip())
 lowerCamelCase_			=						list(map(int, input('\nEnter the numbers : ').strip().split()))[:n]
 print(max_subsequence_sum(array))

