




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





def 						UpperCAmelCase				(			A__:    float							,				A__:    str							,				A__:    str     )  ->     float:
			__lowerCamelCase					:	List[Any]	       =				from_type.lower().strip('s'     )
			__lowerCamelCase					:	Optional[int]	       =				to_type.lower().strip('s'     )

			__lowerCamelCase					:	int	       =				UNIT_SYMBOL.get(A__							,				A__     )
			__lowerCamelCase					:	Dict	       =				UNIT_SYMBOL.get(A__							,				A__     )

			if from_sanitized not in METRIC_CONVERSION:
						__lowerCamelCase					:	Dict	       =				(
						    f'''Invalid \'from_type\' value: {from_type!r}.\n'''
						    f'''Conversion abbreviations are: {", ".join(A__     )}'''
						)
						raise ValueError(A__     )
			if to_sanitized not in METRIC_CONVERSION:
						__lowerCamelCase					:	Any	       =				(
						    f'''Invalid \'to_type\' value: {to_type!r}.\n'''
						    f'''Conversion abbreviations are: {", ".join(A__     )}'''
						)
						raise ValueError(A__     )
			__lowerCamelCase					:	Any	       =				METRIC_CONVERSION[from_sanitized]
			__lowerCamelCase					:	Tuple	       =				METRIC_CONVERSION[to_sanitized]
			__lowerCamelCase					:	Any	       =				1

			if from_exponent > to_exponent:
						__lowerCamelCase					:	Union[str, Any]	       =				from_exponent - to_exponent
			else:
						__lowerCamelCase					:	List[Any]	       =				-(to_exponent - from_exponent)

			return value * pow(10							,				A__     )


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

					testmod()









"""simple docstring"""
from __future__ import annotations

import pandas as pd





def 						UpperCAmelCase				(			A__:    list[int]							,				A__:    list[int]							,				A__:    int     )  ->     list[int]:
			__lowerCamelCase					:	List[Any]	       =				[0] * no_of_processes
			__lowerCamelCase					:	Any	       =				[0] * no_of_processes
			# Copy the burst time into remaining_time[]
			for i in range(A__     ):
						__lowerCamelCase					:	Dict	       =				burst_time[i]

			__lowerCamelCase					:	Any	       =				0
			__lowerCamelCase					:	Tuple	       =				0
			__lowerCamelCase					:	Union[str, Any]	       =				999999999
			__lowerCamelCase					:	str	       =				0
			__lowerCamelCase					:	Optional[int]	       =				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:
															__lowerCamelCase					:	List[Any]	       =				remaining_time[j]
															__lowerCamelCase					:	List[str]	       =				j
															__lowerCamelCase					:	Optional[int]	       =				True

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

						__lowerCamelCase					:	Optional[Any]	       =				remaining_time[short]
						if minm == 0:
									__lowerCamelCase					:	Optional[int]	       =				999999999

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

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

									# Calculate waiting time
									__lowerCamelCase					:	Any	       =				finish_time - arrival_time[short]
									__lowerCamelCase					:	Dict	       =				finar - burst_time[short]

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

        # Increment time
						increment_time += 1
			return waiting_time





def 						UpperCAmelCase				(			A__:    list[int]							,				A__:    int							,				A__:    list[int]     )  ->     list[int]:
			__lowerCamelCase					:	List[Any]	       =				[0] * no_of_processes
			for i in range(A__     ):
						__lowerCamelCase					:	Tuple	       =				burst_time[i] + waiting_time[i]
			return turn_around_time





def 						UpperCAmelCase				(			A__:    list[int]							,				A__:    list[int]							,				A__:    int     )  ->     None:
			__lowerCamelCase					:	int	       =				0
			__lowerCamelCase					:	Dict	       =				0
			for i in range(A__     ):
						__lowerCamelCase					:	str	       =				total_waiting_time + waiting_time[i]
						__lowerCamelCase					:	Union[str, Any]	       =				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''')
					a_				:    int										=     int(input())
					a_				:    List[str]										=     [0] * no_of_processes
					a_				:    int										=     [0] * no_of_processes
					a_				:    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))
										a_						,							a_				:    Union[str, Any]										=     map(int, input().split())

					a_				:    Any										=     calculate_waitingtime(arrival_time, burst_time, no_of_processes)

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

					calculate_average_times(waiting_time, turn_around_time, no_of_processes)

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



