
'''simple docstring'''





from typing import Any, Callable, Dict, List, Optional, Union

import PIL.Image
import torch
from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer

from diffusers import (
    AutoencoderKL,
    DDIMScheduler,
    DiffusionPipeline,
    LMSDiscreteScheduler,
    PNDMScheduler,
    StableDiffusionImgaImgPipeline,
    StableDiffusionInpaintPipelineLegacy,
    StableDiffusionPipeline,
    UNetaDConditionModel,
)
from diffusers.configuration_utils import FrozenDict
from diffusers.pipelines.stable_diffusion.safety_checker import StableDiffusionSafetyChecker
from diffusers.utils import deprecate, logging


a__		: Optional[Any]  							=							logging.get_logger(__name__)  # pylint: disable=invalid-name


class 			UpperCamelCase__	(     snake_case__):
 UpperCAmelCase__     :     Tuple    					=       ["""safety_checker""", """feature_extractor"""]






 def __init__(      self	:int						,					_A	:List[Any]						,					_A	:Dict						,					_A	:Union[str, Any]						,					_A	:Optional[int]						,					_A	:Any						,					_A	:int						,					_A	:List[Any]						,					_A	:str = True						,					)					->      List[Any]:







       '''simple docstring'''



       super().__init__()
       if hasattr(scheduler.config						,					'steps_offset'      ) and scheduler.config.steps_offset != 1:
             __A													=      (
                 F'The configuration file of this scheduler: {scheduler} is outdated. `steps_offset`'
                 F' should be set to 1 instead of {scheduler.config.steps_offset}. Please make sure '
                 'to update the config accordingly as leaving `steps_offset` might led to incorrect results'
                 ' in future versions. If you have downloaded this checkpoint from the Hugging Face Hub,'
                 ' it would be very nice if you could open a Pull request for the `scheduler/scheduler_config.json`'
                 ' file'
             )
             deprecate('steps_offset!=1'						,					'1.0.0'						,					_A						,					standard_warn=_A      )
             __A													=      dict(scheduler.config      )
             __A													=      1
             __A													=      FrozenDict(_A      )

       self.register_modules(
           vae=_A						,					text_encoder=_A						,					tokenizer=_A						,					unet=_A						,					scheduler=_A						,					safety_checker=_A						,					feature_extractor=_A						,					)
       self.register_to_config(requires_safety_checker=_A      )






 @property
 def 						lowercase_    (      self	:Union[str, Any]      )					->      str:







       '''simple docstring'''



       return {k: getattr(self						,					_A      ) for k in self.config.keys() if not k.startswith('_'      )}






 def 						lowercase_    (      self	:Union[str, Any]						,					_A	:List[Any] = "auto"      )					->      str:







       '''simple docstring'''



       if slice_size == "auto":
             # half the attention head size is usually a good trade-off between
             # speed and memory
             __A													=      self.unet.config.attention_head_dim // 2
       self.unet.set_attention_slice(_A      )






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







       '''simple docstring'''



       self.enable_attention_slicing(_A      )






 @torch.no_grad()
 def 						lowercase_    (      self	:str						,					_A	:List[Any]						,					_A	:Tuple						,					_A	:int						,					_A	:Union[str, Any] = 0.8						,					_A	:List[str] = 50						,					_A	:Any = 7.5						,					_A	:Dict = None						,					_A	:List[str] = 1						,					_A	:List[str] = 0.0						,					_A	:List[Any] = None						,					_A	:str = "pil"						,					_A	:Optional[int] = True						,					_A	:Union[str, Any] = None						,					_A	:Dict = 1						,					)					->      str:







       '''simple docstring'''



       return StableDiffusionInpaintPipelineLegacy(**self.components      )(
           prompt=_A						,					image=_A						,					mask_image=_A						,					strength=_A						,					num_inference_steps=_A						,					guidance_scale=_A						,					negative_prompt=_A						,					num_images_per_prompt=_A						,					eta=_A						,					generator=_A						,					output_type=_A						,					return_dict=_A						,					callback=_A						,					)






 @torch.no_grad()
 def 						lowercase_    (      self	:Dict						,					_A	:Dict						,					_A	:Tuple						,					_A	:str = 0.8						,					_A	:Any = 50						,					_A	:Optional[int] = 7.5						,					_A	:Tuple = None						,					_A	:Optional[int] = 1						,					_A	:Tuple = 0.0						,					_A	:int = None						,					_A	:Dict = "pil"						,					_A	:Union[str, Any] = True						,					_A	:Tuple = None						,					_A	:str = 1						,					**_A	:Optional[int]						,					)					->      Union[str, Any]:







       '''simple docstring'''



       return StableDiffusionImgaImgPipeline(**self.components      )(
           prompt=_A						,					image=_A						,					strength=_A						,					num_inference_steps=_A						,					guidance_scale=_A						,					negative_prompt=_A						,					num_images_per_prompt=_A						,					eta=_A						,					generator=_A						,					output_type=_A						,					return_dict=_A						,					callback=_A						,					callback_steps=_A						,					)






 @torch.no_grad()
 def 						lowercase_    (      self	:List[str]						,					_A	:str						,					_A	:Tuple = 512						,					_A	:List[str] = 512						,					_A	:Optional[int] = 50						,					_A	:int = 7.5						,					_A	:Optional[Any] = None						,					_A	:Optional[int] = 1						,					_A	:Union[str, Any] = 0.0						,					_A	:Tuple = None						,					_A	:Optional[Any] = None						,					_A	:str = "pil"						,					_A	:Tuple = True						,					_A	:List[Any] = None						,					_A	:Dict = 1						,					)					->      Tuple:







       '''simple docstring'''



       return StableDiffusionPipeline(**self.components      )(
           prompt=_A						,					height=_A						,					width=_A						,					num_inference_steps=_A						,					guidance_scale=_A						,					negative_prompt=_A						,					num_images_per_prompt=_A						,					eta=_A						,					generator=_A						,					latents=_A						,					output_type=_A						,					return_dict=_A						,					callback=_A						,					callback_steps=_A						,					)












import decimal







def       _a (		):
					__lowerCAmelCase							  =			0
					__lowerCAmelCase							  =			decimal.Context(prec=1_05	)
					for i in range(2 , 1_00	):
										__lowerCAmelCase							  =			decimal.Decimal(SCREAMING_SNAKE_CASE_	)
										__lowerCAmelCase							  =			number.sqrt(SCREAMING_SNAKE_CASE_	)
										if len(str(SCREAMING_SNAKE_CASE_	)	) > 1:
															answer += int(str(SCREAMING_SNAKE_CASE_	)[0]	)
															__lowerCAmelCase							  =			str(SCREAMING_SNAKE_CASE_	)[2:1_01]
															answer += sum(int(SCREAMING_SNAKE_CASE_	) for x in sqrt_number_str	)
					return answer


if __name__ == "__main__":
					import doctest

					doctest.testmod()
					print(f'''{solution() = }''')




