__magic_name__								='''ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'''







def  __UpperCamelCase    (						A							):
					# Make sure the supplied data is a bytes-like object
					if not isinstance(A ,							A							):
										UpperCamelCase__										=      f"a bytes-like object is required, not '{data.__class__.__name__}'"
										raise TypeError(A							)

					UpperCamelCase__										=      ''''''.join(bin(A							)[2:].zfill(8							) for byte in data							)

					UpperCamelCase__										=      len(A							) % 6 != 0

					if padding_needed:
										# The padding that will be added later
										UpperCamelCase__										=      B'''=''' * ((6 - len(A							) % 6) // 2)

										# Append binary_stream with arbitrary binary digits (0's by default) to make its
										# length a multiple of 6.
										binary_stream += "0" * (6 - len(A							) % 6)
					else:
										UpperCamelCase__										=      B''''''

					# Encode every 6 binary digits to their corresponding Base64 character
					return (
					    "".join(
					        B64_CHARSET[int(binary_stream[index : index + 6] ,							2							)]
					        for index in range(0 ,							len(A							) ,							6							)							).encode()
					    + padding
					)







def  __UpperCamelCase    (						A							):
					# Make sure encoded_data is either a string or a bytes-like object
					if not isinstance(A ,							A							) and not isinstance(A ,							A							):
										UpperCamelCase__										=      (
										    '''argument should be a bytes-like object or ASCII string, '''
										    f"not '{encoded_data.__class__.__name__}'"
										)
										raise TypeError(A							)

					# In case encoded_data is a bytes-like object, make sure it contains only
					# ASCII characters so we convert it to a string object
					if isinstance(A ,							A							):
										try:
															UpperCamelCase__										=      encoded_data.decode('''utf-8'''							)
										except UnicodeDecodeError:
															raise ValueError('''base64 encoded data should only contain ASCII characters'''							)

					UpperCamelCase__										=      encoded_data.count('''='''							)

					# Check if the encoded string contains non base64 characters
					if padding:
										assert all(
										    char in B64_CHARSET for char in encoded_data[:-padding]							), "Invalid base64 character(s) found."
					else:
										assert all(
										    char in B64_CHARSET for char in encoded_data							), "Invalid base64 character(s) found."

					# Check the padding
					assert len(A							) % 4 == 0 and padding < 3, "Incorrect padding"

					if padding:
										# Remove padding if there is one
										UpperCamelCase__										=      encoded_data[:-padding]

										UpperCamelCase__										=      ''''''.join(
										    bin(B64_CHARSET.index(A							)							)[2:].zfill(6							) for char in encoded_data							)[: -padding * 2]
					else:
										UpperCamelCase__										=      ''''''.join(
										    bin(B64_CHARSET.index(A							)							)[2:].zfill(6							) for char in encoded_data							)

					UpperCamelCase__										=      [
					    int(binary_stream[index : index + 8] ,							2							)
					    for index in range(0 ,							len(A							) ,							8							)
					]

					return bytes(A							)


if __name__ == "__main__":
					import doctest

					doctest.testmod()




from __future__ import annotations

import pandas as pd







def  __UpperCamelCase    (						A ,							A ,							A							):
     UpperCamelCase__										=      [0] * no_of_processes
     UpperCamelCase__										=      [0] * no_of_processes
     # Copy the burst time into remaining_time[]
     for i in range(A							):
          UpperCamelCase__										=      burst_time[i]

     UpperCamelCase__										=      0
     UpperCamelCase__										=      0
     UpperCamelCase__										=      999999999
     UpperCamelCase__										=      0
     UpperCamelCase__										=      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:
                         UpperCamelCase__										=      remaining_time[j]
                         UpperCamelCase__										=      j
                         UpperCamelCase__										=      True

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

          UpperCamelCase__										=      remaining_time[short]
          if minm == 0:
               UpperCamelCase__										=      999999999

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

               # Find finish time of current process
               UpperCamelCase__										=      increment_time + 1

               # Calculate waiting time
               UpperCamelCase__										=      finish_time - arrival_time[short]
               UpperCamelCase__										=      finar - burst_time[short]

               if waiting_time[short] < 0:
                    UpperCamelCase__										=      0

        # Increment time
          increment_time += 1
     return waiting_time







def  __UpperCamelCase    (						A ,							A ,							A							):
     UpperCamelCase__										=      [0] * no_of_processes
     for i in range(A							):
          UpperCamelCase__										=      burst_time[i] + waiting_time[i]
     return turn_around_time







def  __UpperCamelCase    (						A ,							A ,							A							):
     UpperCamelCase__										=      0
     UpperCamelCase__										=      0
     for i in range(A							):
          UpperCamelCase__										=      total_waiting_time + waiting_time[i]
          UpperCamelCase__										=      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''')
     __magic_name__								=int(input())
     __magic_name__								=[0] * no_of_processes
     __magic_name__								=[0] * no_of_processes
     __magic_name__								=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))
          __magic_name__		,  __magic_name__								=map(int, input().split())

     __magic_name__								=calculate_waitingtime(arrival_time, burst_time, no_of_processes)

     __magic_name__								=burst_time
     __magic_name__								=no_of_processes
     __magic_name__								=waiting_time
     __magic_name__								=calculate_turnaroundtime(bt, n, wt)

     calculate_average_times(waiting_time, turn_around_time, no_of_processes)

     __magic_name__								=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)



