



"""simple docstring"""






from __future__ import annotations

import pandas as pd






def   snake_case__     (	__lowerCamelCase       :					list[int]							,	__lowerCamelCase       :					list[int]							,	__lowerCamelCase       :					int			):
			"""simple docstring"""
			lowerCamelCase__	:	Optional[Any]				=[0] * no_of_processes
			lowerCamelCase__	:	List[str]				=[0] * no_of_processes
			# Copy the burst time into remaining_time[]
			for i in range(__lowerCamelCase			):
						lowerCamelCase__	:	Optional[int]				=burst_time[i]

			lowerCamelCase__	:	List[Any]				=0
			lowerCamelCase__	:	Any				=0
			lowerCamelCase__	:	List[str]				=999999999
			lowerCamelCase__	:	Dict				=0
			lowerCamelCase__	:	str				=False

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

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

						lowerCamelCase__	:	Optional[Any]				=remaining_time[short]
						if minm == 0:
									lowerCamelCase__	:	Tuple				=999999999

						if remaining_time[short] == 0:
									complete += 1
									lowerCamelCase__	:	Union[str, Any]				=False

									# Find finish time of current process
									lowerCamelCase__	:	Union[str, Any]				=increment_time + 1

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

									if waiting_time[short] < 0:
												lowerCamelCase__	:	Tuple				=0

        # Increment time
						increment_time += 1
			return waiting_time






def   snake_case__     (	__lowerCamelCase       :					list[int]							,	__lowerCamelCase       :					int							,	__lowerCamelCase       :					list[int]			):
			"""simple docstring"""
			lowerCamelCase__	:	Tuple				=[0] * no_of_processes
			for i in range(__lowerCamelCase			):
						lowerCamelCase__	:	Tuple				=burst_time[i] + waiting_time[i]
			return turn_around_time






def   snake_case__     (	__lowerCamelCase       :					list[int]							,	__lowerCamelCase       :					list[int]							,	__lowerCamelCase       :					int			):
			"""simple docstring"""
			lowerCamelCase__	:	str				=0
			lowerCamelCase__	:	List[str]				=0
			for i in range(__lowerCamelCase			):
						lowerCamelCase__	:	int				=total_waiting_time + waiting_time[i]
						lowerCamelCase__	:	int				=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")
		_lowercase				:				Tuple   		=		int(input())
		_lowercase				:				str   		=		[0] * no_of_processes
		_lowercase				:				Dict   		=		[0] * no_of_processes
		_lowercase				:				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))
				_lowercase		,			_lowercase				:				Dict   		=		map(int, input().split())

		_lowercase				:				Optional[Any]   		=		calculate_waitingtime(arrival_time, burst_time, no_of_processes)

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

		calculate_average_times(waiting_time, turn_around_time, no_of_processes)

		_lowercase				:				Union[str, 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)









"""simple docstring"""






def   snake_case__     (	__lowerCamelCase       :					int = 10							,	__lowerCamelCase       :					int = 22			):
			"""simple docstring"""
			lowerCamelCase__	:	Optional[Any]				=range(1							,	__lowerCamelCase			)
			lowerCamelCase__	:	str				=range(1							,	__lowerCamelCase			)
			return sum(
			    1 for power in powers for base in bases if len(str(base**power			)			) == power			)


if __name__ == "__main__":
		print(f'{solution(1_0, 2_2) = }')




