



'''simple docstring'''



from __future__ import annotations

from statistics import mean



def 	__lowerCAmelCase       (				lowerCamelCase :    list[int]       ):






	'''simple docstring'''




	__lowerCAmelCase       				=	2
	__lowerCAmelCase       				=	list(lowerCamelCase       )
	__lowerCAmelCase       				=	[0] * len(lowerCamelCase       )
	__lowerCAmelCase       				=	0
	while True:
		__lowerCAmelCase       				=	True
		for i, burst_time in enumerate(lowerCamelCase       ):
			if rem_burst_times[i] > 0:
				__lowerCAmelCase       				=	False
				if rem_burst_times[i] > quantum:
					t += quantum
					rem_burst_times[i] -= quantum
				else:
					t += rem_burst_times[i]
					__lowerCAmelCase       				=	t - burst_time
					__lowerCAmelCase       				=	0
		if done is True:
			return waiting_times



def 	__lowerCAmelCase       (				lowerCamelCase :    list[int]					,		lowerCamelCase :    list[int]       ):






	'''simple docstring'''




	return [burst + waiting for burst, waiting in zip(lowerCamelCase					,		lowerCamelCase       )]


if __name__ == "__main__":
	lowerCAmelCase						:		Optional[Any]						      = [3, 5, 7]
	lowerCAmelCase						:		Dict						      = calculate_waiting_times(burst_times)
	lowerCAmelCase						:		List[str]						      = calculate_turn_around_times(burst_times, waiting_times)
	print('''Process ID \tBurst Time \tWaiting Time \tTurnaround Time''')
	for i, burst_time in enumerate(burst_times):
		print(
		    f'  {i + 1}\t\t  {burst_time}\t\t  {waiting_times[i]}\t\t  '
		    f'{turn_around_times[i]}'
		)
	print(f'\nAverage waiting time = {mean(waiting_times):.5f}')
	print(f'Average turn around time = {mean(turn_around_times):.5f}')




'''simple docstring'''



from __future__ import annotations

from random import randrange



def 	__lowerCAmelCase       (				lowerCamelCase :    list       ):






	'''simple docstring'''




	if len(lowerCamelCase       ) < 2:
		return collection
	__lowerCAmelCase       				=	randrange(len(lowerCamelCase       )       )  # Use random element as pivot
	__lowerCAmelCase       				=	collection[pivot_index]
	__lowerCAmelCase       				=	[]  # All elements greater than pivot
	__lowerCAmelCase       				=	[]  # All elements less than or equal to pivot

	for element in collection[:pivot_index]:
		(greater if element > pivot else lesser).append(lowerCamelCase       )

	for element in collection[pivot_index + 1 :]:
		(greater if element > pivot else lesser).append(lowerCamelCase       )

	return [*quick_sort(lowerCamelCase       ), pivot, *quick_sort(lowerCamelCase       )]


if __name__ == "__main__":
	lowerCAmelCase						:		List[Any]						      = input('''Enter numbers separated by a comma:\n''').strip()
	lowerCAmelCase						:		Any						      = [int(item) for item in user_input.split(''',''')]
	print(quick_sort(unsorted))