



"""simple docstring"""





# We ignore warnings about stepping the scheduler since we step it ourselves during gradient accumulation

import warnings

from .state import AcceleratorState, GradientState


warnings.filterwarnings("""ignore""", category=UserWarning, module="""torch.optim.lr_scheduler""")
class    lowercase__     :







       '''simple docstring'''


       def __init__(							self    :						Union[str, Any]	,       _UpperCAmelCase    :						Union[str, Any]	,       _UpperCAmelCase    :						Tuple	,       _UpperCAmelCase    :						bool = True	,       _UpperCAmelCase    :						bool = False					)				->		List[Any]:


             '''simple docstring'''




             UpperCAmelCase_    				=							scheduler
             UpperCAmelCase_    				=							optimizers if isinstance(_UpperCAmelCase	,       (list, tuple)					) else [optimizers]
             UpperCAmelCase_    				=							split_batches
             UpperCAmelCase_    				=							step_with_optimizer
             UpperCAmelCase_    				=							GradientState()



       def   lowercase__       (							self    :						int	,       *_UpperCAmelCase    :						str	,       **_UpperCAmelCase    :						int					)				->		Optional[int]:


             '''simple docstring'''




             if not self.step_with_optimizer:
                   # No link between scheduler and optimizer -> just step
                   self.scheduler.step(*_UpperCAmelCase	,       **_UpperCAmelCase					)
                   return

             # Otherwise, first make sure the optimizer was stepped.
             if not self.gradient_state.sync_gradients:
                   if self.gradient_state.adjust_scheduler:
                         self.scheduler._step_count += 1
                   return

             for opt in self.optimizers:
                   if opt.step_was_skipped:
                         return
             if self.split_batches:
                   # Split batches -> the training dataloader batch size is not changed so one step per training step
                   self.scheduler.step(*_UpperCAmelCase	,       **_UpperCAmelCase					)
             else:
                   # Otherwise the training dataloader batch size was multiplied by `num_processes`, so we need to do
                   # num_processes steps per training step
                   UpperCAmelCase_    				=							AcceleratorState().num_processes
                   for _ in range(_UpperCAmelCase					):
                         # Special case when using OneCycle and `drop_last` was not used
                         if hasattr(self.scheduler	,       "total_steps"					):
                               if self.scheduler._step_count <= self.scheduler.total_steps:
                                     self.scheduler.step(*_UpperCAmelCase	,       **_UpperCAmelCase					)
                         else:
                               self.scheduler.step(*_UpperCAmelCase	,       **_UpperCAmelCase					)



       def   lowercase__       (							self    :						Union[str, Any]					)				->		Any:


             '''simple docstring'''




             return self.scheduler.get_last_lr()



       def   lowercase__       (							self    :						Optional[int]					)				->		Any:


             '''simple docstring'''




             return self.scheduler.state_dict()



       def   lowercase__       (							self    :						str	,       _UpperCAmelCase    :						str					)				->		Optional[Any]:


             '''simple docstring'''




             self.scheduler.load_state_dict(_UpperCAmelCase					)



       def   lowercase__       (							self    :						Tuple					)				->		Optional[int]:


             '''simple docstring'''




             return self.scheduler.get_lr()







       def   lowercase__       (							self    :						Optional[Any]	,       *_UpperCAmelCase    :						Any	,       **_UpperCAmelCase    :						Any					)				->		Optional[int]:


             '''simple docstring'''




             return self.scheduler.print_lr(*_UpperCAmelCase	,       **_UpperCAmelCase					)









"""simple docstring"""





from __future__ import annotations

import math
def      a__			(   lowerCAmelCase__   ):

      if 1 < number < 4:
            # 2 and 3 are primes
            return True
      elif number < 2 or number % 2 == 0 or number % 3 == 0:
            # Negatives, 0, 1, all even numbers, all multiples of 3 are not primes
            return False

      # All primes number are in format of 6k +/- 1
      for i in range(5			,    int(math.sqrt(lowerCAmelCase__   ) + 1   )			,    6   ):
            if number % i == 0 or number % (i + 2) == 0:
                  return False
      return True


lowerCamelCase      =		[num for num in range(3, 100_001, 2) if not is_prime(num)]
def      a__			(   lowerCAmelCase__   ):
      if not isinstance(lowerCAmelCase__			,    lowerCAmelCase__   ):
            raise ValueError("n must be an integer"   )
      if n <= 0:
            raise ValueError("n must be >= 0"   )

      UpperCAmelCase_    				=							[]
      for num in range(len(lowerCAmelCase__   )   ):
            UpperCAmelCase_    				=							0
            while 2 * i * i <= odd_composites[num]:
                  UpperCAmelCase_    				=							odd_composites[num] - 2 * i * i
                  if is_prime(lowerCAmelCase__   ):
                        break
                  i += 1
            else:
                  list_nums.append(odd_composites[num]   )
                  if len(lowerCAmelCase__   ) == n:
                        return list_nums

      return []
def      a__			(   ):
      return compute_nums(1   )[0]


if __name__ == "__main__":
  print(F"{solution() = }")




