





'''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    lowerCAmelCase_		:




 def __init__(	self			,     _lowerCAmelCase			,     _lowerCAmelCase			,     _lowerCAmelCase = True			,     _lowerCAmelCase = False		)    ->							Optional[int]:
     _lowerCAmelCase				=      scheduler
     _lowerCAmelCase				=      optimizers if isinstance(_lowerCAmelCase			,     (list, tuple)		) else [optimizers]
     _lowerCAmelCase				=      split_batches
     _lowerCAmelCase				=      step_with_optimizer
     _lowerCAmelCase				=      GradientState()




 def 							_snake_case   (	self			,     *_lowerCAmelCase			,     **_lowerCAmelCase		)    ->							Union[str, Any]:
     if not self.step_with_optimizer:
         # No link between scheduler and optimizer -> just step
         self.scheduler.step(*_lowerCAmelCase			,     **_lowerCAmelCase		)
         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(*_lowerCAmelCase			,     **_lowerCAmelCase		)
     else:
         # Otherwise the training dataloader batch size was multiplied by `num_processes`, so we need to do
         # num_processes steps per training step
         _lowerCAmelCase				=      AcceleratorState().num_processes
         for _ in range(_lowerCAmelCase		):
             # 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(*_lowerCAmelCase			,     **_lowerCAmelCase		)
             else:
                 self.scheduler.step(*_lowerCAmelCase			,     **_lowerCAmelCase		)




 def 							_snake_case   (	self		)    ->							Optional[Any]:
     return self.scheduler.get_last_lr()




 def 							_snake_case   (	self		)    ->							Tuple:
     return self.scheduler.state_dict()




 def 							_snake_case   (	self			,     _lowerCAmelCase		)    ->							Optional[Any]:
     self.scheduler.load_state_dict(_lowerCAmelCase		)




 def 							_snake_case   (	self		)    ->							str:
     return self.scheduler.get_lr()





 def 							_snake_case   (	self			,     *_lowerCAmelCase			,     **_lowerCAmelCase		)    ->							Dict:
     return self.scheduler.print_lr(*_lowerCAmelCase			,     **_lowerCAmelCase		)









'''simple docstring'''


from math import isqrt, loga


def 	__a(SCREAMING_SNAKE_CASE_  :					int    ):



    '''simple docstring'''





    _lowerCAmelCase				=      [True] * max_number
    for i in range(2		,       isqrt(max_number - 1    ) + 1    ):
        if is_prime[i]:
            for j in range(i**2		,       SCREAMING_SNAKE_CASE_		,       SCREAMING_SNAKE_CASE_    ):
                _lowerCAmelCase				=      False

    return [i for i in range(2		,       SCREAMING_SNAKE_CASE_    ) if is_prime[i]]


def 	__a(SCREAMING_SNAKE_CASE_  :					int = 800800		,       SCREAMING_SNAKE_CASE_  :					int = 800800    ):



    '''simple docstring'''





    _lowerCAmelCase				=      degree * loga(SCREAMING_SNAKE_CASE_    )
    _lowerCAmelCase				=      int(SCREAMING_SNAKE_CASE_    )
    _lowerCAmelCase				=      calculate_prime_numbers(SCREAMING_SNAKE_CASE_    )

    _lowerCAmelCase				=      0
    _lowerCAmelCase				=      0
    _lowerCAmelCase				=      len(SCREAMING_SNAKE_CASE_    ) - 1
    while left < right:
        while (
            prime_numbers[right] * loga(prime_numbers[left]    )
            + prime_numbers[left] * loga(prime_numbers[right]    )
            > upper_bound
        ):
            right -= 1
        hybrid_integers_count += right - left
        left += 1

    return hybrid_integers_count


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


