




'''simple docstring'''






from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_flax_available,
    is_sentencepiece_available,
    is_tf_available,
    is_tokenizers_available,
    is_torch_available,
)


lowercase						:   str      						=							{
    'configuration_big_bird': ['BIG_BIRD_PRETRAINED_CONFIG_ARCHIVE_MAP', 'BigBirdConfig', 'BigBirdOnnxConfig'],
}

try:
      if not is_sentencepiece_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      lowercase						:   str      						=							['BigBirdTokenizer']

try:
      if not is_tokenizers_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      lowercase						:   Optional[int]      						=							['BigBirdTokenizerFast']

try:
      if not is_torch_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      lowercase						:   Dict      						=							[
          'BIG_BIRD_PRETRAINED_MODEL_ARCHIVE_LIST',
          'BigBirdForCausalLM',
          'BigBirdForMaskedLM',
          'BigBirdForMultipleChoice',
          'BigBirdForPreTraining',
          'BigBirdForQuestionAnswering',
          'BigBirdForSequenceClassification',
          'BigBirdForTokenClassification',
          'BigBirdLayer',
          'BigBirdModel',
          'BigBirdPreTrainedModel',
          'load_tf_weights_in_big_bird',
      ]

try:
      if not is_flax_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      lowercase						:   Optional[Any]      						=							[
          'FlaxBigBirdForCausalLM',
          'FlaxBigBirdForMaskedLM',
          'FlaxBigBirdForMultipleChoice',
          'FlaxBigBirdForPreTraining',
          'FlaxBigBirdForQuestionAnswering',
          'FlaxBigBirdForSequenceClassification',
          'FlaxBigBirdForTokenClassification',
          'FlaxBigBirdModel',
          'FlaxBigBirdPreTrainedModel',
      ]

if TYPE_CHECKING:
      from .configuration_big_bird import BIG_BIRD_PRETRAINED_CONFIG_ARCHIVE_MAP, BigBirdConfig, BigBirdOnnxConfig

      try:
            if not is_sentencepiece_available():
                  raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
            pass
      else:
            from .tokenization_big_bird import BigBirdTokenizer

      try:
            if not is_tokenizers_available():
                  raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
            pass
      else:
            from .tokenization_big_bird_fast import BigBirdTokenizerFast

      try:
            if not is_torch_available():
                  raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
            pass
      else:
            from .modeling_big_bird import (
                BIG_BIRD_PRETRAINED_MODEL_ARCHIVE_LIST,
                BigBirdForCausalLM,
                BigBirdForMaskedLM,
                BigBirdForMultipleChoice,
                BigBirdForPreTraining,
                BigBirdForQuestionAnswering,
                BigBirdForSequenceClassification,
                BigBirdForTokenClassification,
                BigBirdLayer,
                BigBirdModel,
                BigBirdPreTrainedModel,
                load_tf_weights_in_big_bird,
            )

      try:
            if not is_flax_available():
                  raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
            pass
      else:
            from .modeling_flax_big_bird import (
                FlaxBigBirdForCausalLM,
                FlaxBigBirdForMaskedLM,
                FlaxBigBirdForMultipleChoice,
                FlaxBigBirdForPreTraining,
                FlaxBigBirdForQuestionAnswering,
                FlaxBigBirdForSequenceClassification,
                FlaxBigBirdForTokenClassification,
                FlaxBigBirdModel,
                FlaxBigBirdPreTrainedModel,
            )

else:
      import sys

      lowercase						:   Any      						=							_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}""")


