




from __future__ import annotations

from statistics import mean




def    lowerCamelCase__			(		A__			:   list[int]      ):





       '''simple docstring'''



       __lowerCamelCase  =		2
       __lowerCamelCase  =		list(__SCREAMING_SNAKE_CASE      )
       __lowerCamelCase  =		[0] * len(__SCREAMING_SNAKE_CASE      )
       __lowerCamelCase  =		0
       while True:
              __lowerCamelCase  =		True
              for i, burst_time in enumerate(__SCREAMING_SNAKE_CASE      ):
                     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__			(		A__			:   list[int]    ,     A__			:   list[int]      ):





       '''simple docstring'''



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


if __name__ == "__main__":
       UpperCAmelCase_   							=      [3, 5, 7]
       UpperCAmelCase_   							=      calculate_waiting_times(burst_times)
       UpperCAmelCase_   							=      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}""")


import math
from timeit import timeit







def 					__lowerCAmelCase				(		__SCREAMING_SNAKE_CASE       :					int   ):







    '''simple docstring'''
    __snake_case       :				Optional[Any] 			=    0
    __snake_case       :				Union[str, Any] 			=    abs(__SCREAMING_SNAKE_CASE   )
    while True:
        __snake_case       :				List[str] 			=    n // 1_0
        digits += 1
        if n == 0:
            break
    return digits







def 					__lowerCAmelCase				(		__SCREAMING_SNAKE_CASE       :					int   ):







    '''simple docstring'''
    return 1 if n == 0 else math.floor(math.log(abs(__SCREAMING_SNAKE_CASE   )		,							1_0   ) + 1   )







def 					__lowerCAmelCase				(		__SCREAMING_SNAKE_CASE       :					int   ):







    '''simple docstring'''
    return len(str(abs(__SCREAMING_SNAKE_CASE   )   )   )







def 					__lowerCAmelCase				(		):







    '''simple docstring'''
    from collections.abc import Callable

    def benchmark_a_function(__SCREAMING_SNAKE_CASE       :					Callable		,							__SCREAMING_SNAKE_CASE       :					int   ) -> None:
        __snake_case       :				Tuple 			=    F'''{func.__name__}({value})'''
        __snake_case       :				Union[str, Any] 			=    timeit(F'''__main__.{call}'''		,							setup="""import __main__"""   )
        print(F'''{call}: {func(__SCREAMING_SNAKE_CASE   )} -- {timing} seconds'''   )

    for value in (2_6_2_1_4_4, 1_1_2_5_8_9_9_9_0_6_8_4_2_6_2_4, 1_2_6_7_6_5_0_6_0_0_2_2_8_2_2_9_4_0_1_4_9_6_7_0_3_2_0_5_3_7_6):
        for func in (num_digits, num_digits_fast, num_digits_faster):
            benchmark_a_function(__SCREAMING_SNAKE_CASE		,							__SCREAMING_SNAKE_CASE   )
        print()


if __name__ == "__main__":
     import doctest

     doctest.testmod()
     benchmark()



