




'''simple docstring'''

import torch

from diffusers import EulerDiscreteScheduler
from diffusers.utils import torch_device

from .test_schedulers import SchedulerCommonTest



class 		SCREAMING_SNAKE_CASE__  (			_UpperCamelCase	):
			__SCREAMING_SNAKE_CASE    =			(EulerDiscreteScheduler,)
			__SCREAMING_SNAKE_CASE    =			10





			def 							A (      self						:    int      ,		**a_						:    int							):



						"""simple docstring"""




						__snake_case			=		{
						    "num_train_timesteps": 1_100,
						    "beta_start": 0.0001,
						    "beta_end": 0.02,
						    "beta_schedule": "linear",
						}

						config.update(**a_							)
						return config





			def 							A (      self						:    Tuple							):



						"""simple docstring"""




						for timesteps in [10, 50, 100, 1_000]:
									self.check_over_configs(num_train_timesteps=a_							)





			def 							A (      self						:    Optional[Any]							):



						"""simple docstring"""




						for beta_start, beta_end in zip([0.00001, 0.0001, 0.001]      ,		[0.0002, 0.002, 0.02]							):
									self.check_over_configs(beta_start=a_      ,		beta_end=a_							)





			def 							A (      self						:    Optional[Any]							):



						"""simple docstring"""




						for schedule in ["linear", "scaled_linear"]:
									self.check_over_configs(beta_schedule=a_							)





			def 							A (      self						:    List[Any]							):



						"""simple docstring"""




						for prediction_type in ["epsilon", "v_prediction"]:
									self.check_over_configs(prediction_type=a_							)





			def 							A (      self						:    Optional[Any]							):



						"""simple docstring"""




						__snake_case			=		self.scheduler_classes[0]
						__snake_case			=		self.get_scheduler_config()
						__snake_case			=		scheduler_class(**a_							)

						scheduler.set_timesteps(self.num_inference_steps							)

						__snake_case			=		torch.manual_seed(0							)

						__snake_case			=		self.dummy_model()
						__snake_case			=		self.dummy_sample_deter * scheduler.init_noise_sigma
						__snake_case			=		sample.to(a_							)

						for i, t in enumerate(scheduler.timesteps							):
									__snake_case			=		scheduler.scale_model_input(a_      ,		a_							)

									__snake_case			=		model(a_      ,		a_							)

									__snake_case			=		scheduler.step(a_      ,		a_      ,		a_      ,		generator=a_							)
									__snake_case			=		output.prev_sample

						__snake_case			=		torch.sum(torch.abs(a_							)							)
						__snake_case			=		torch.mean(torch.abs(a_							)							)

						assert abs(result_sum.item() - 10.0807							) < 1e-2
						assert abs(result_mean.item() - 0.0131							) < 1e-3





			def 							A (      self						:    Tuple							):



						"""simple docstring"""




						__snake_case			=		self.scheduler_classes[0]
						__snake_case			=		self.get_scheduler_config(prediction_type="v_prediction"							)
						__snake_case			=		scheduler_class(**a_							)

						scheduler.set_timesteps(self.num_inference_steps							)

						__snake_case			=		torch.manual_seed(0							)

						__snake_case			=		self.dummy_model()
						__snake_case			=		self.dummy_sample_deter * scheduler.init_noise_sigma
						__snake_case			=		sample.to(a_							)

						for i, t in enumerate(scheduler.timesteps							):
									__snake_case			=		scheduler.scale_model_input(a_      ,		a_							)

									__snake_case			=		model(a_      ,		a_							)

									__snake_case			=		scheduler.step(a_      ,		a_      ,		a_      ,		generator=a_							)
									__snake_case			=		output.prev_sample

						__snake_case			=		torch.sum(torch.abs(a_							)							)
						__snake_case			=		torch.mean(torch.abs(a_							)							)

						assert abs(result_sum.item() - 0.0002							) < 1e-2
						assert abs(result_mean.item() - 2.2_676e-06							) < 1e-3





			def 							A (      self						:    Optional[Any]							):



						"""simple docstring"""




						__snake_case			=		self.scheduler_classes[0]
						__snake_case			=		self.get_scheduler_config()
						__snake_case			=		scheduler_class(**a_							)

						scheduler.set_timesteps(self.num_inference_steps      ,		device=a_							)

						__snake_case			=		torch.manual_seed(0							)

						__snake_case			=		self.dummy_model()
						__snake_case			=		self.dummy_sample_deter * scheduler.init_noise_sigma.cpu()
						__snake_case			=		sample.to(a_							)

						for t in scheduler.timesteps:
									__snake_case			=		scheduler.scale_model_input(a_      ,		a_							)

									__snake_case			=		model(a_      ,		a_							)

									__snake_case			=		scheduler.step(a_      ,		a_      ,		a_      ,		generator=a_							)
									__snake_case			=		output.prev_sample

						__snake_case			=		torch.sum(torch.abs(a_							)							)
						__snake_case			=		torch.mean(torch.abs(a_							)							)

						assert abs(result_sum.item() - 10.0807							) < 1e-2
						assert abs(result_mean.item() - 0.0131							) < 1e-3






			def 							A (      self						:    List[Any]							):



						"""simple docstring"""




						__snake_case			=		self.scheduler_classes[0]
						__snake_case			=		self.get_scheduler_config()
						__snake_case			=		scheduler_class(**a_      ,		use_karras_sigmas=a_							)

						scheduler.set_timesteps(self.num_inference_steps      ,		device=a_							)

						__snake_case			=		torch.manual_seed(0							)

						__snake_case			=		self.dummy_model()
						__snake_case			=		self.dummy_sample_deter * scheduler.init_noise_sigma.cpu()
						__snake_case			=		sample.to(a_							)

						for t in scheduler.timesteps:
									__snake_case			=		scheduler.scale_model_input(a_      ,		a_							)

									__snake_case			=		model(a_      ,		a_							)

									__snake_case			=		scheduler.step(a_      ,		a_      ,		a_      ,		generator=a_							)
									__snake_case			=		output.prev_sample

						__snake_case			=		torch.sum(torch.abs(a_							)							)
						__snake_case			=		torch.mean(torch.abs(a_							)							)

						assert abs(result_sum.item() - 124.52299499511719							) < 1e-2
						assert abs(result_mean.item() - 0.16213932633399963							) < 1e-3









'''simple docstring'''

from math import sqrt

def _SCREAMING_SNAKE_CASE (A = 1_000_000			)			->			int:






       """simple docstring"""







       lowercase__      =					0
       lowercase__      =					0
       lowercase__      =					42

       while num_cuboids <= limit:
              max_cuboid_size += 1
              for sum_shortest_sides in range(2    ,					2 * max_cuboid_size + 1			):
                     if sqrt(sum_shortest_sides**2 + max_cuboid_size**2			).is_integer():
                            num_cuboids += (
                                min(A    ,					sum_shortest_sides // 2			)
                                - max(1    ,					sum_shortest_sides - max_cuboid_size			)
                                + 1
                            )

       return max_cuboid_size


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




