






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

import torch
from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer

from diffusers import (
    AutoencoderKL,
    DDIMScheduler,
    DiffusionPipeline,
    LMSDiscreteScheduler,
    PNDMScheduler,
    StableDiffusionPipeline,
    UNetaDConditionModel,
)
from diffusers.pipelines.stable_diffusion import StableDiffusionPipelineOutput
from diffusers.pipelines.stable_diffusion.safety_checker import StableDiffusionSafetyChecker


a_		:    Any   							=     'CompVis/stable-diffusion-v1-1'
a_		:    Union[str, Any]   							=     'CompVis/stable-diffusion-v1-2'
a_		:    str   							=     'CompVis/stable-diffusion-v1-3'
a_		:    Any   							=     'CompVis/stable-diffusion-v1-4'

class 		_snake_case	(	A__       ):






			def __init__(							self		,       a		,       a		,       a		,       a		,       a		,       a		,       a		,       a = True		,       )   ->							str:
						super()._init_()

						SCREAMING_SNAKE_CASE							=			StableDiffusionPipeline.from_pretrained(a)
						SCREAMING_SNAKE_CASE							=			StableDiffusionPipeline.from_pretrained(a)
						SCREAMING_SNAKE_CASE							=			StableDiffusionPipeline.from_pretrained(a)
						SCREAMING_SNAKE_CASE							=			StableDiffusionPipeline(
						    vae=a		,       text_encoder=a		,       tokenizer=a		,       unet=a		,       scheduler=a		,       safety_checker=a		,       feature_extractor=a		,       requires_safety_checker=a		,       )

						self.register_modules(pipelinea=self.pipea		,       pipelinea=self.pipea		,       pipelinea=self.pipea		,       pipelinea=self.pipea)






			@property
			def  SCREAMING_SNAKE_CASE__     (							self)   ->							Dict[str, Any]:
						return {k: getattr(self		,       a) for k in self.config.keys() if not k.startswith('_')}






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






			def  SCREAMING_SNAKE_CASE__     (							self)   ->							Dict:
						self.enable_attention_slicing(a)






			@torch.no_grad()
			def  SCREAMING_SNAKE_CASE__     (							self		,       a		,       a = 512		,       a = 512		,       a = 50		,       a = 7.5		,       a = None		,       a = 1		,       a = 0.0		,       a = None		,       a = None		,       a = "pil"		,       a = True		,       a = None		,       a = 1		,       **a		,       )   ->							Tuple:
						return self.pipea(
						    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		,       **a		,       )






			@torch.no_grad()
			def  SCREAMING_SNAKE_CASE__     (							self		,       a		,       a = 512		,       a = 512		,       a = 50		,       a = 7.5		,       a = None		,       a = 1		,       a = 0.0		,       a = None		,       a = None		,       a = "pil"		,       a = True		,       a = None		,       a = 1		,       **a		,       )   ->							Dict:
						return self.pipea(
						    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		,       **a		,       )






			@torch.no_grad()
			def  SCREAMING_SNAKE_CASE__     (							self		,       a		,       a = 512		,       a = 512		,       a = 50		,       a = 7.5		,       a = None		,       a = 1		,       a = 0.0		,       a = None		,       a = None		,       a = "pil"		,       a = True		,       a = None		,       a = 1		,       **a		,       )   ->							List[str]:
						return self.pipea(
						    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		,       **a		,       )






			@torch.no_grad()
			def  SCREAMING_SNAKE_CASE__     (							self		,       a		,       a = 512		,       a = 512		,       a = 50		,       a = 7.5		,       a = None		,       a = 1		,       a = 0.0		,       a = None		,       a = None		,       a = "pil"		,       a = True		,       a = None		,       a = 1		,       **a		,       )   ->							int:
						return self.pipea(
						    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		,       **a		,       )







			@torch.no_grad()
			def  SCREAMING_SNAKE_CASE__     (							self		,       a		,       a = 512		,       a = 512		,       a = 50		,       a = 7.5		,       a = None		,       a = 1		,       a = 0.0		,       a = None		,       a = None		,       a = "pil"		,       a = True		,       a = None		,       a = 1		,       **a		,       )   ->							Dict:
						SCREAMING_SNAKE_CASE							=			'cuda' if torch.cuda.is_available() else 'cpu'
						self.to(a)

						# Checks if the height and width are divisible by 8 or not
						if height % 8 != 0 or width % 8 != 0:
									raise ValueError(f'''`height` and `width` must be divisible by 8 but are {height} and {width}.''')

						# Get first result from Stable Diffusion Checkpoint v1.1
						SCREAMING_SNAKE_CASE							=			self.textaimg_sda_a(
						    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		,       **a		,       )

						# Get first result from Stable Diffusion Checkpoint v1.2
						SCREAMING_SNAKE_CASE							=			self.textaimg_sda_a(
						    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		,       **a		,       )

						# Get first result from Stable Diffusion Checkpoint v1.3
						SCREAMING_SNAKE_CASE							=			self.textaimg_sda_a(
						    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		,       **a		,       )

						# Get first result from Stable Diffusion Checkpoint v1.4
						SCREAMING_SNAKE_CASE							=			self.textaimg_sda_a(
						    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		,       **a		,       )

						# Get all result images into a single list and pass it via StableDiffusionPipelineOutput for final result
						return StableDiffusionPipelineOutput([resa[0], resa[0], resa[0], resa[0]])












"""simple docstring"""
def 							A						(				__snake_case: int = 1_0_0_0_0_0_0  )    ->		int:

       """simple docstring"""





       __magic_name__      				=    limit + 1
       __magic_name__      				=    [0] * limit
       for first_term in range(1 ,     __snake_case  ):
              for n in range(__snake_case ,     __snake_case ,     __snake_case  ):
                     __magic_name__      				=    first_term + n / first_term
                     if common_difference % 4:  # d must be divisble by 4
                            continue
                     else:
                            common_difference /= 4
                            if (
                                first_term > common_difference
                                and first_term < 4 * common_difference
                            ):  # since x,y,z are positive integers
                                   frequency[n] += 1  # so z>0 and a>d ,also 4d<a

       __magic_name__      				=    sum(1 for x in frequency[1:limit] if x == 1_0  )

       return count


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