code: 
  """simple docstring"""
  
  
  
  
  
  import numpy as np
  
  
  
  
  
  
  
  def 			__a  (	__lowerCamelCase,	__lowerCamelCase,	__lowerCamelCase						):
     UpperCAmelCase_      :      Any      =					n_draws * class_counts / class_counts.sum()
     # floored means we don't overshoot n_samples, but probably undershoot
     UpperCAmelCase_      :      Optional[int]      =					np.floor(__lowerCamelCase						)
     # we add samples according to how much "left over" probability
     # they had, until we arrive at n_samples
     UpperCAmelCase_      :      Any      =					int(n_draws - floored.sum()						)
     if need_to_add > 0:
        UpperCAmelCase_      :      str      =					continuous - floored
        UpperCAmelCase_      :      List[str]      =					np.sort(np.unique(__lowerCamelCase						)						)[::-1]
        # add according to remainder, but break ties
        # randomly to avoid biases
        for value in values:
           ((UpperCAmelCase_)  ,     )      :      Optional[int]      =					np.where(remainder == value						)
           # if we need_to_add less than what's in inds
           # we draw randomly from them.
           # if we need to add more, we add them all and
           # go to the next value
           UpperCAmelCase_      :      Tuple      =					min(len(__lowerCamelCase						),	__lowerCamelCase						)
           UpperCAmelCase_      :      Any      =					rng.choice(__lowerCamelCase,	size=__lowerCamelCase,	replace=__lowerCamelCase						)
           floored[inds] += 1
           need_to_add -= add_now
           if need_to_add == 0:
              break
     return floored.astype(np.intaa						)
  
  
  
  
  
  
  
  def 			__a  (	__lowerCamelCase,	__lowerCamelCase,	__lowerCamelCase,	__lowerCamelCase,	__lowerCamelCase=10						):
     UpperCAmelCase_  ,     UpperCAmelCase_      :      Optional[int]      =					np.unique(__lowerCamelCase,	return_inverse=__lowerCamelCase						)
     UpperCAmelCase_      :      int      =					classes.shape[0]
     UpperCAmelCase_      :      Union[str, Any]      =					np.bincount(__lowerCamelCase						)
     if np.min(__lowerCamelCase						) < 2:
        raise ValueError("Minimum class count error"						)
     if n_train < n_classes:
        raise ValueError(
            "The train_size = %d should be greater or " "equal to the number of classes = %d" % (n_train, n_classes)						)
     if n_test < n_classes:
        raise ValueError(
            "The test_size = %d should be greater or " "equal to the number of classes = %d" % (n_test, n_classes)						)
     UpperCAmelCase_      :      Any      =					np.split(np.argsort(__lowerCamelCase,	kind="mergesort"						),	np.cumsum(__lowerCamelCase						)[:-1]						)
     for _ in range(__lowerCamelCase						):
        UpperCAmelCase_      :      Tuple      =					approximate_mode(__lowerCamelCase,	__lowerCamelCase,	__lowerCamelCase						)
        UpperCAmelCase_      :      List[str]      =					class_counts - n_i
        UpperCAmelCase_      :      Dict      =					approximate_mode(__lowerCamelCase,	__lowerCamelCase,	__lowerCamelCase						)
  
        UpperCAmelCase_      :      Any      =					[]
        UpperCAmelCase_      :      int      =					[]
  
        for i in range(__lowerCamelCase						):
           UpperCAmelCase_      :      Optional[int]      =					rng.permutation(class_counts[i]						)
           UpperCAmelCase_      :      Tuple      =					class_indices[i].take(__lowerCamelCase,	mode="clip"						)
           train.extend(perm_indices_class_i[: n_i[i]]						)
           test.extend(perm_indices_class_i[n_i[i] : n_i[i] + t_i[i]]						)
        UpperCAmelCase_      :      Tuple      =					rng.permutation(__lowerCamelCase						)
        UpperCAmelCase_      :      int      =					rng.permutation(__lowerCamelCase						)
  
        yield train, test
  
  
  
style_context: 
  """simple docstring"""
  
  
  
  
  
  from __future__ import annotations
  
  from statistics import mean
  
  
  
  
  
  
  
  def 			__a  (	__lowerCamelCase						):
     UpperCAmelCase_      :      Dict      =					2
     UpperCAmelCase_      :      Any      =					list(__lowerCamelCase						)
     UpperCAmelCase_      :      List[Any]      =					[0] * len(__lowerCamelCase						)
     UpperCAmelCase_      :      str      =					0
     while True:
        UpperCAmelCase_      :      int      =					True
        for i, burst_time in enumerate(__lowerCamelCase						):
           if rem_burst_times[i] > 0:
              UpperCAmelCase_      :      List[Any]      =					False
              if rem_burst_times[i] > quantum:
                 t += quantum
                 rem_burst_times[i] -= quantum
              else:
                 t += rem_burst_times[i]
                 UpperCAmelCase_      :      Optional[int]      =					t - burst_time
                 UpperCAmelCase_      :      Union[str, Any]      =					0
        if done is True:
           return waiting_times
  
  
  
  
  
  
  
  def 			__a  (	__lowerCamelCase,	__lowerCamelCase						):
     return [burst + waiting for burst, waiting in zip(__lowerCamelCase,	__lowerCamelCase						)]
  
  
  if __name__ == "__main__":
      _a	 =							[3, 5, 7]
      _a	 =							calculate_waiting_times(burst_times)
      _a	 =							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}""")
  
  
  