
'''simple docstring'''





from typing import TYPE_CHECKING

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


A							     = {
    "configuration_swin2sr": ["SWIN2SR_PRETRAINED_CONFIG_ARCHIVE_MAP", "Swin2SRConfig"],
}


try:
     if not is_torch_available():
          raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
     pass
else:
     A							     = [
         "SWIN2SR_PRETRAINED_MODEL_ARCHIVE_LIST",
         "Swin2SRForImageSuperResolution",
         "Swin2SRModel",
         "Swin2SRPreTrainedModel",
     ]


try:
     if not is_vision_available():
          raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
     pass
else:
     A							     = ["Swin2SRImageProcessor"]


if TYPE_CHECKING:
     from .configuration_swinasr import SWIN2SR_PRETRAINED_CONFIG_ARCHIVE_MAP, SwinaSRConfig

     try:
          if not is_torch_available():
               raise OptionalDependencyNotAvailable()
     except OptionalDependencyNotAvailable:
          pass
     else:
          from .modeling_swinasr import (
              SWIN2SR_PRETRAINED_MODEL_ARCHIVE_LIST,
              SwinaSRForImageSuperResolution,
              SwinaSRModel,
              SwinaSRPreTrainedModel,
          )

     try:
          if not is_vision_available():
               raise OptionalDependencyNotAvailable()
     except OptionalDependencyNotAvailable:
          pass
     else:
          from .image_processing_swinasr import SwinaSRImageProcessor


else:
     import sys

     A							     = _LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)


from __future__ import annotations

from statistics import mean

def   a_					(_lowerCAmelCase  :   list[int]       )->				list[int]:
    snake_case:						Tuple         =   2
    snake_case:						str         =   list(_lowerCAmelCase       )
    snake_case:						Union[str, Any]         =   [0] * len(_lowerCAmelCase       )
    snake_case:						List[Any]         =   0
    while True:
        snake_case:						Optional[int]         =   True
        for i, burst_time in enumerate(_lowerCAmelCase       ):
            if rem_burst_times[i] > 0:
                snake_case:						Dict         =   False
                if rem_burst_times[i] > quantum:
                    t += quantum
                    rem_burst_times[i] -= quantum
                else:
                    t += rem_burst_times[i]
                    snake_case:						Optional[Any]         =   t - burst_time
                    snake_case:						Tuple         =   0
        if done is True:
            return waiting_times

def   a_					(_lowerCAmelCase  :   list[int]			,	_lowerCAmelCase  :   list[int]       )->				list[int]:
    return [burst + waiting for burst, waiting in zip(_lowerCAmelCase			,	_lowerCAmelCase       )]


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


