
'''simple docstring'''





def 	A_ (							snake_case							:   int = 1000 )      ->    List[Any]:



						'''simple docstring'''

						__UpperCamelCase       =			3
						__UpperCamelCase       =			0
						while a < n:
												if a % 3 == 0 or a % 5 == 0:
																		result += a
												elif a % 15 == 0:
																		result -= a
												a += 1
						return result


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






import math
from typing import List, Optional, Tuple, Union

import numpy as np
import torch

from ..configuration_utils import ConfigMixin, register_to_config
from .scheduling_utils import SchedulerMixin, SchedulerOutput






class        SCREAMING_SNAKE_CASE__    (							SCREAMING_SNAKE_CASE_   ,		SCREAMING_SNAKE_CASE_    ):

							"""simple docstring"""






							_snake_case     		=  1



							@register_to_config
							def __init__(  self     ,	SCREAMING_SNAKE_CASE_ = 1000     ,	SCREAMING_SNAKE_CASE_ = None			)->   Tuple:





													'''simple docstring'''






													self.set_timesteps(SCREAMING_SNAKE_CASE_			)

													# standard deviation of the initial noise distribution
													__UpperCamelCase       =			1.0

													# For now we only support F-PNDM, i.e. the runge-kutta method
													# For more information on the algorithm please take a look at the paper: https://arxiv.org/pdf/2202.09778.pdf
													# mainly at formula (9), (12), (13) and the Algorithm 2.
													__UpperCamelCase       =			4

													# running values
													__UpperCamelCase       =			[]



							def     A__		(  self     ,	SCREAMING_SNAKE_CASE_     ,	SCREAMING_SNAKE_CASE_ = None			)->   Optional[int]:





													'''simple docstring'''






													__UpperCamelCase       =			num_inference_steps
													__UpperCamelCase       =			torch.linspace(1     ,	0     ,	num_inference_steps + 1			)[:-1]
													__UpperCamelCase       =			torch.cat([steps, torch.tensor([0.0]			)]			)

													if self.config.trained_betas is not None:
																			__UpperCamelCase       =			torch.tensor(self.config.trained_betas     ,	dtype=torch.floataa			)
													else:
																			__UpperCamelCase       =			torch.sin(steps * math.pi / 2			) ** 2

													__UpperCamelCase       =			(1.0 - self.betas**2) ** 0.5

													__UpperCamelCase       =			(torch.atana(self.betas     ,	self.alphas			) / math.pi * 2)[:-1]
													__UpperCamelCase       =			timesteps.to(SCREAMING_SNAKE_CASE_			)

													__UpperCamelCase       =			[]



							def     A__		(  self     ,	SCREAMING_SNAKE_CASE_     ,	SCREAMING_SNAKE_CASE_     ,	SCREAMING_SNAKE_CASE_     ,	SCREAMING_SNAKE_CASE_ = True     ,	)->   Union[SchedulerOutput, Tuple]:





													'''simple docstring'''






													if self.num_inference_steps is None:
																			raise ValueError(
																			    '''Number of inference steps is \'None\', you need to run \'set_timesteps\' after creating the scheduler'''			)

													__UpperCamelCase       =			(self.timesteps == timestep).nonzero().item()
													__UpperCamelCase       =			timestep_index + 1

													__UpperCamelCase       =			sample * self.betas[timestep_index] + model_output * self.alphas[timestep_index]
													self.ets.append(SCREAMING_SNAKE_CASE_			)

													if len(self.ets			) == 1:
																			__UpperCamelCase       =			self.ets[-1]
													elif len(self.ets			) == 2:
																			__UpperCamelCase       =			(3 * self.ets[-1] - self.ets[-2]) / 2
													elif len(self.ets			) == 3:
																			__UpperCamelCase       =			(23 * self.ets[-1] - 16 * self.ets[-2] + 5 * self.ets[-3]) / 12
													else:
																			__UpperCamelCase       =			(1 / 24) * (55 * self.ets[-1] - 59 * self.ets[-2] + 37 * self.ets[-3] - 9 * self.ets[-4])

													__UpperCamelCase       =			self._get_prev_sample(SCREAMING_SNAKE_CASE_     ,	SCREAMING_SNAKE_CASE_     ,	SCREAMING_SNAKE_CASE_     ,	SCREAMING_SNAKE_CASE_			)

													if not return_dict:
																			return (prev_sample,)

													return SchedulerOutput(prev_sample=SCREAMING_SNAKE_CASE_			)



							def     A__		(  self     ,	SCREAMING_SNAKE_CASE_     ,	*SCREAMING_SNAKE_CASE_     ,	**SCREAMING_SNAKE_CASE_			)->   torch.FloatTensor:





													'''simple docstring'''






													return sample



							def     A__		(  self     ,	SCREAMING_SNAKE_CASE_     ,	SCREAMING_SNAKE_CASE_     ,	SCREAMING_SNAKE_CASE_     ,	SCREAMING_SNAKE_CASE_			)->   Optional[int]:





													'''simple docstring'''






													__UpperCamelCase       =			self.alphas[timestep_index]
													__UpperCamelCase       =			self.betas[timestep_index]

													__UpperCamelCase       =			self.alphas[prev_timestep_index]
													__UpperCamelCase       =			self.betas[prev_timestep_index]

													__UpperCamelCase       =			(sample - sigma * ets) / max(SCREAMING_SNAKE_CASE_     ,	1E-8			)
													__UpperCamelCase       =			next_alpha * pred + ets * next_sigma

													return prev_sample



							def __len__(  self			)->   Optional[int]:





													'''simple docstring'''






													return self.config.num_train_timesteps




