




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


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







class 				lowerCAmelCase_       (					lowerCamelCase_							):






				def __init__(			self      ,snake_case__      ,snake_case__      ,snake_case__      ,snake_case__      ,snake_case__      ,snake_case__      ,snake_case__      ,snake_case__ = True      ,):
							super()._init_()

							SCREAMING_SNAKE_CASE_   : Optional[Any]					  =      StableDiffusionPipeline.from_pretrained(snake_case__ )
							SCREAMING_SNAKE_CASE_   : str					  =      StableDiffusionPipeline.from_pretrained(snake_case__ )
							SCREAMING_SNAKE_CASE_   : Dict					  =      StableDiffusionPipeline.from_pretrained(snake_case__ )
							SCREAMING_SNAKE_CASE_   : Tuple					  =      StableDiffusionPipeline(
							    vae=snake_case__      ,text_encoder=snake_case__      ,tokenizer=snake_case__      ,unet=snake_case__      ,scheduler=snake_case__      ,safety_checker=snake_case__      ,feature_extractor=snake_case__      ,requires_safety_checker=snake_case__      ,)

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






				@property
				def 		snake_case	(			self ):
							return {k: getattr(self      ,snake_case__ ) for k in self.config.keys() if not k.startswith('_' )}






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






				def 		snake_case	(			self ):
							self.enable_attention_slicing(snake_case__ )






				@torch.no_grad()
				def 		snake_case	(			self      ,snake_case__      ,snake_case__ = 512      ,snake_case__ = 512      ,snake_case__ = 50      ,snake_case__ = 7.5      ,snake_case__ = None      ,snake_case__ = 1      ,snake_case__ = 0.0      ,snake_case__ = None      ,snake_case__ = None      ,snake_case__ = "pil"      ,snake_case__ = True      ,snake_case__ = None      ,snake_case__ = 1      ,**snake_case__      ,):
							return self.pipea(
							    prompt=snake_case__      ,height=snake_case__      ,width=snake_case__      ,num_inference_steps=snake_case__      ,guidance_scale=snake_case__      ,negative_prompt=snake_case__      ,num_images_per_prompt=snake_case__      ,eta=snake_case__      ,generator=snake_case__      ,latents=snake_case__      ,output_type=snake_case__      ,return_dict=snake_case__      ,callback=snake_case__      ,callback_steps=snake_case__      ,**snake_case__      ,)






				@torch.no_grad()
				def 		snake_case	(			self      ,snake_case__      ,snake_case__ = 512      ,snake_case__ = 512      ,snake_case__ = 50      ,snake_case__ = 7.5      ,snake_case__ = None      ,snake_case__ = 1      ,snake_case__ = 0.0      ,snake_case__ = None      ,snake_case__ = None      ,snake_case__ = "pil"      ,snake_case__ = True      ,snake_case__ = None      ,snake_case__ = 1      ,**snake_case__      ,):
							return self.pipea(
							    prompt=snake_case__      ,height=snake_case__      ,width=snake_case__      ,num_inference_steps=snake_case__      ,guidance_scale=snake_case__      ,negative_prompt=snake_case__      ,num_images_per_prompt=snake_case__      ,eta=snake_case__      ,generator=snake_case__      ,latents=snake_case__      ,output_type=snake_case__      ,return_dict=snake_case__      ,callback=snake_case__      ,callback_steps=snake_case__      ,**snake_case__      ,)






				@torch.no_grad()
				def 		snake_case	(			self      ,snake_case__      ,snake_case__ = 512      ,snake_case__ = 512      ,snake_case__ = 50      ,snake_case__ = 7.5      ,snake_case__ = None      ,snake_case__ = 1      ,snake_case__ = 0.0      ,snake_case__ = None      ,snake_case__ = None      ,snake_case__ = "pil"      ,snake_case__ = True      ,snake_case__ = None      ,snake_case__ = 1      ,**snake_case__      ,):
							return self.pipea(
							    prompt=snake_case__      ,height=snake_case__      ,width=snake_case__      ,num_inference_steps=snake_case__      ,guidance_scale=snake_case__      ,negative_prompt=snake_case__      ,num_images_per_prompt=snake_case__      ,eta=snake_case__      ,generator=snake_case__      ,latents=snake_case__      ,output_type=snake_case__      ,return_dict=snake_case__      ,callback=snake_case__      ,callback_steps=snake_case__      ,**snake_case__      ,)






				@torch.no_grad()
				def 		snake_case	(			self      ,snake_case__      ,snake_case__ = 512      ,snake_case__ = 512      ,snake_case__ = 50      ,snake_case__ = 7.5      ,snake_case__ = None      ,snake_case__ = 1      ,snake_case__ = 0.0      ,snake_case__ = None      ,snake_case__ = None      ,snake_case__ = "pil"      ,snake_case__ = True      ,snake_case__ = None      ,snake_case__ = 1      ,**snake_case__      ,):
							return self.pipea(
							    prompt=snake_case__      ,height=snake_case__      ,width=snake_case__      ,num_inference_steps=snake_case__      ,guidance_scale=snake_case__      ,negative_prompt=snake_case__      ,num_images_per_prompt=snake_case__      ,eta=snake_case__      ,generator=snake_case__      ,latents=snake_case__      ,output_type=snake_case__      ,return_dict=snake_case__      ,callback=snake_case__      ,callback_steps=snake_case__      ,**snake_case__      ,)






				@torch.no_grad()
				def 		snake_case	(			self      ,snake_case__      ,snake_case__ = 512      ,snake_case__ = 512      ,snake_case__ = 50      ,snake_case__ = 7.5      ,snake_case__ = None      ,snake_case__ = 1      ,snake_case__ = 0.0      ,snake_case__ = None      ,snake_case__ = None      ,snake_case__ = "pil"      ,snake_case__ = True      ,snake_case__ = None      ,snake_case__ = 1      ,**snake_case__      ,):
							SCREAMING_SNAKE_CASE_   : Optional[int]					  =      'cuda' if torch.cuda.is_available() else 'cpu'
							self.to(snake_case__ )

							# 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_   : Any					  =      self.textaimg_sda_a(
							    prompt=snake_case__      ,height=snake_case__      ,width=snake_case__      ,num_inference_steps=snake_case__      ,guidance_scale=snake_case__      ,negative_prompt=snake_case__      ,num_images_per_prompt=snake_case__      ,eta=snake_case__      ,generator=snake_case__      ,latents=snake_case__      ,output_type=snake_case__      ,return_dict=snake_case__      ,callback=snake_case__      ,callback_steps=snake_case__      ,**snake_case__      ,)

							# Get first result from Stable Diffusion Checkpoint v1.2
							SCREAMING_SNAKE_CASE_   : Tuple					  =      self.textaimg_sda_a(
							    prompt=snake_case__      ,height=snake_case__      ,width=snake_case__      ,num_inference_steps=snake_case__      ,guidance_scale=snake_case__      ,negative_prompt=snake_case__      ,num_images_per_prompt=snake_case__      ,eta=snake_case__      ,generator=snake_case__      ,latents=snake_case__      ,output_type=snake_case__      ,return_dict=snake_case__      ,callback=snake_case__      ,callback_steps=snake_case__      ,**snake_case__      ,)

							# Get first result from Stable Diffusion Checkpoint v1.3
							SCREAMING_SNAKE_CASE_   : str					  =      self.textaimg_sda_a(
							    prompt=snake_case__      ,height=snake_case__      ,width=snake_case__      ,num_inference_steps=snake_case__      ,guidance_scale=snake_case__      ,negative_prompt=snake_case__      ,num_images_per_prompt=snake_case__      ,eta=snake_case__      ,generator=snake_case__      ,latents=snake_case__      ,output_type=snake_case__      ,return_dict=snake_case__      ,callback=snake_case__      ,callback_steps=snake_case__      ,**snake_case__      ,)

							# Get first result from Stable Diffusion Checkpoint v1.4
							SCREAMING_SNAKE_CASE_   : str					  =      self.textaimg_sda_a(
							    prompt=snake_case__      ,height=snake_case__      ,width=snake_case__      ,num_inference_steps=snake_case__      ,guidance_scale=snake_case__      ,negative_prompt=snake_case__      ,num_images_per_prompt=snake_case__      ,eta=snake_case__      ,generator=snake_case__      ,latents=snake_case__      ,output_type=snake_case__      ,return_dict=snake_case__      ,callback=snake_case__      ,callback_steps=snake_case__      ,**snake_case__      ,)

							# 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]] )





def  __snake_case							(	__magic_name__						):







				'''simple docstring'''


				lowercase     ,	lowercase         =      [], []
				while len(__magic_name__						) > 1:
								lowercase     ,	lowercase         =      min(__magic_name__						), max(__magic_name__						)
								start.append(__magic_name__						)
								end.append(__magic_name__						)
								collection.remove(__magic_name__						)
								collection.remove(__magic_name__						)
				end.reverse()
				return start + collection + end


if __name__ == "__main__":
						_snake_case      :							int     	=    input("Enter numbers separated by a comma:\n").strip()
						_snake_case      :							Dict     	=    [int(item) for item in user_input.split(",")]
						print(*merge_sort(unsorted), sep=",")
