






# 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   __SCREAMING_SNAKE_CASE:
							def __init__(     self:      int       ,	UpperCamelCase:      Union[str, Any]       ,	UpperCamelCase:      Union[str, Any]       ,	UpperCamelCase:      bool = True       ,	UpperCamelCase:      bool = False						)		->		Union[str, Any]:
											snake_case__									=     scheduler
											snake_case__									=     optimizers if isinstance(UpperCamelCase       ,	(list, tuple)						) else [optimizers]
											snake_case__									=     split_batches
											snake_case__									=     step_with_optimizer
											snake_case__									=     GradientState()
							def lowerCAmelCase_ (     self:      Dict       ,	*UpperCamelCase:      Tuple       ,	**UpperCamelCase:      List[Any]						)		->		Tuple:
											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
															snake_case__									=     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 lowerCAmelCase_ (     self:      Optional[Any]						)		->		str:
											return self.scheduler.get_last_lr()
							def lowerCAmelCase_ (     self:      Tuple						)		->		str:
											return self.scheduler.state_dict()
							def lowerCAmelCase_ (     self:      Optional[Any]       ,	UpperCamelCase:      Dict						)		->		Optional[int]:
											self.scheduler.load_state_dict(UpperCamelCase						)
							def lowerCAmelCase_ (     self:      Tuple						)		->		Any:
											return self.scheduler.get_lr()


							def lowerCAmelCase_ (     self:      str       ,	*UpperCamelCase:      int       ,	**UpperCamelCase:      int						)		->		Tuple:
											return self.scheduler.print_lr(*UpperCamelCase       ,	**UpperCamelCase						)












from __future__ import annotations
def      a_ (      _A      ,   _A  )			->			str:







				"""simple docstring"""
				# Checks if the entire collection has been sorted
				if len(_A  ) <= 1 or n <= 1:
								return

				insert_next(_A      ,   n - 1  )
				rec_insertion_sort(_A      ,   n - 1  )
def      a_ (      _A      ,   _A  )			->			Tuple:







				"""simple docstring"""
				# Checks order between adjacent elements
				if index >= len(_A  ) or collection[index - 1] <= collection[index]:
								return

				# Swaps adjacent elements since they are not in ascending order
				snake_case__							,						snake_case__									=     (
				    collection[index],
				    collection[index - 1],
				)

				insert_next(_A      ,   index + 1  )


if __name__ == "__main__":
							__UpperCamelCase					:		Optional[int]	  =						input("""Enter integers separated by spaces: """)
							__UpperCamelCase					:		list[int]	  =						[int(num) for num in numbers.split()]
							rec_insertion_sort(number_list, len(number_list))
							print(number_list)




