






from __future__ import annotations

import pandas as pd

def    SCREAMING_SNAKE_CASE_							(							__magic_name__					:  list[int]	,			__magic_name__					:  list[int]	,			__magic_name__					:  int					)		->			list[int]:






	"""simple docstring"""



	UpperCamelCase     :List[str]          =	[0] * no_of_processes
	UpperCamelCase     :str          =	[0] * no_of_processes
	# Copy the burst time into remaining_time[]
	for i in range(__magic_name__					):
		UpperCamelCase     :Optional[int]          =	burst_time[i]

	UpperCamelCase     :str          =	0
	UpperCamelCase     :Tuple          =	0
	UpperCamelCase     :Union[str, Any]          =	9_9999_9999
	UpperCamelCase     :Optional[Any]          =	0
	UpperCamelCase     :Optional[int]          =	False

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

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

		UpperCamelCase     :List[str]          =	remaining_time[short]
		if minm == 0:
			UpperCamelCase     :Any          =	9_9999_9999

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

			# Find finish time of current process
			UpperCamelCase     :Dict          =	increment_time + 1

			# Calculate waiting time
			UpperCamelCase     :Union[str, Any]          =	finish_time - arrival_time[short]
			UpperCamelCase     :Optional[Any]          =	finar - burst_time[short]

			if waiting_time[short] < 0:
				UpperCamelCase     :Optional[Any]          =	0

        # Increment time
		increment_time += 1
	return waiting_time

def    SCREAMING_SNAKE_CASE_							(							__magic_name__					:  list[int]	,			__magic_name__					:  int	,			__magic_name__					:  list[int]					)		->			list[int]:






	"""simple docstring"""



	UpperCamelCase     :Optional[Any]          =	[0] * no_of_processes
	for i in range(__magic_name__					):
		UpperCamelCase     :List[str]          =	burst_time[i] + waiting_time[i]
	return turn_around_time

def    SCREAMING_SNAKE_CASE_							(							__magic_name__					:  list[int]	,			__magic_name__					:  list[int]	,			__magic_name__					:  int					)		->			None:






	"""simple docstring"""



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

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

	UpperCAmelCase_ :						Tuple      =      burst_time
	UpperCAmelCase_ :						List[str]      =      no_of_processes
	UpperCAmelCase_ :						Union[str, Any]      =      waiting_time
	UpperCAmelCase_ :						Union[str, Any]      =      calculate_turnaroundtime(bt, n, wt)

	calculate_average_times(waiting_time, turn_around_time, no_of_processes)

	UpperCAmelCase_ :						Tuple      =      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"""






lowercase__     						=						{
    """meter""": """m""",
    """kilometer""": """km""",
    """megametre""": """Mm""",
    """gigametre""": """Gm""",
    """terametre""": """Tm""",
    """petametre""": """Pm""",
    """exametre""": """Em""",
    """zettametre""": """Zm""",
    """yottametre""": """Ym""",
}
# Exponent of the factor(meter)
lowercase__     						=						{
    """m""": 0,
    """km""": 3,
    """Mm""": 6,
    """Gm""": 9,
    """Tm""": 12,
    """Pm""": 15,
    """Em""": 18,
    """Zm""": 21,
    """Ym""": 24,
}







def      _snake_case			(				lowercase__							,    lowercase__							,    lowercase__		):
				_lowerCamelCase     :			List[Any]    =    from_type.lower().strip('s'		)
				_lowerCamelCase     :			List[Any]    =    to_type.lower().strip('s'		)

				_lowerCamelCase     :			Optional[int]    =    UNIT_SYMBOL.get(lowercase__							,    lowercase__		)
				_lowerCamelCase     :			Any    =    UNIT_SYMBOL.get(lowercase__							,    lowercase__		)

				if from_sanitized not in METRIC_CONVERSION:
								_lowerCamelCase     :			Tuple    =    (
								    f'''Invalid \'from_type\' value: {from_type!r}.\n'''
								    f'''Conversion abbreviations are: {', '.join(lowercase__		)}'''
								)
								raise ValueError(lowercase__		)
				if to_sanitized not in METRIC_CONVERSION:
								_lowerCamelCase     :			Any    =    (
								    f'''Invalid \'to_type\' value: {to_type!r}.\n'''
								    f'''Conversion abbreviations are: {', '.join(lowercase__		)}'''
								)
								raise ValueError(lowercase__		)
				_lowerCamelCase     :			List[Any]    =    METRIC_CONVERSION[from_sanitized]
				_lowerCamelCase     :			int    =    METRIC_CONVERSION[to_sanitized]
				_lowerCamelCase     :			List[str]    =    1

				if from_exponent > to_exponent:
								_lowerCamelCase     :			List[str]    =    from_exponent - to_exponent
				else:
								_lowerCamelCase     :			List[Any]    =    -(to_exponent - from_exponent)

				return value * pow(10							,    lowercase__		)


if __name__ == "__main__":
			from doctest import testmod

			testmod()