
from __future__ import annotations

import pandas as pd

def a__    (       A_,     A_,     A_					):






  '''simple docstring'''





  __magic_name__				     =       [0] * no_of_processes
  __magic_name__				     =       [0] * no_of_processes
  # Copy the burst time into remaining_time[]
  for i in range(A_					):
    __magic_name__				     =       burst_time[i]

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

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

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

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

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

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

      if waiting_time[short] < 0:
        __magic_name__				     =       0

        # Increment time
    increment_time += 1
  return waiting_time

def a__    (       A_,     A_,     A_					):






  '''simple docstring'''





  __magic_name__				     =       [0] * no_of_processes
  for i in range(A_					):
    __magic_name__				     =       burst_time[i] + waiting_time[i]
  return turn_around_time

def a__    (       A_,     A_,     A_					):






  '''simple docstring'''





  __magic_name__				     =       0
  __magic_name__				     =       0
  for i in range(A_					):
    __magic_name__				     =       total_waiting_time + waiting_time[i]
    __magic_name__				     =       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')
    __lowerCAmelCase			:     Union[str, Any]           =   int(input())
    __lowerCAmelCase			:     Tuple           =   [0] * no_of_processes
    __lowerCAmelCase			:     Tuple           =   [0] * no_of_processes
    __lowerCAmelCase			:     List[str]           =   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))
        __lowerCAmelCase       ,      __lowerCAmelCase			:     List[Any]           =   map(int, input().split())

    __lowerCAmelCase			:     Tuple           =   calculate_waitingtime(arrival_time, burst_time, no_of_processes)

    __lowerCAmelCase			:     int           =   burst_time
    __lowerCAmelCase			:     Any           =   no_of_processes
    __lowerCAmelCase			:     Dict           =   waiting_time
    __lowerCAmelCase			:     str           =   calculate_turnaroundtime(bt, n, wt)

    calculate_average_times(waiting_time, turn_around_time, no_of_processes)

    __lowerCAmelCase			:     str           =   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)



from typing import TYPE_CHECKING

from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


__lowerCAmelCase			:     Any           =   {
    'configuration_mctct': ['MCTCT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'MCTCTConfig'],
    'feature_extraction_mctct': ['MCTCTFeatureExtractor'],
    'processing_mctct': ['MCTCTProcessor'],
}


try:
    if not is_torch_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    __lowerCAmelCase			:     int           =   [
        'MCTCT_PRETRAINED_MODEL_ARCHIVE_LIST',
        'MCTCTForCTC',
        'MCTCTModel',
        'MCTCTPreTrainedModel',
    ]


if TYPE_CHECKING:
    from .configuration_mctct import MCTCT_PRETRAINED_CONFIG_ARCHIVE_MAP, MCTCTConfig
    from .feature_extraction_mctct import MCTCTFeatureExtractor
    from .processing_mctct import MCTCTProcessor

    try:
        if not is_torch_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .modeling_mctct import MCTCT_PRETRAINED_MODEL_ARCHIVE_LIST, MCTCTForCTC, MCTCTModel, MCTCTPreTrainedModel

else:
    import sys

    __lowerCAmelCase			:     List[Any]           =   _LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)

