

import math

def 			lowerCamelCase__			(       _a				,      _a = 0				,      _a = 0):
	SCREAMING_SNAKE_CASE :   List[str]					  =							end or len(_a)
	for i in range(_a				,      _a):
		SCREAMING_SNAKE_CASE :   List[Any]					  =							i
		SCREAMING_SNAKE_CASE :   Any					  =							array[i]
		while temp_index != start and temp_index_value < array[temp_index - 1]:
			SCREAMING_SNAKE_CASE :   Tuple					  =							array[temp_index - 1]
			temp_index -= 1
		SCREAMING_SNAKE_CASE :   Optional[int]					  =							temp_index_value
	return array

def 			lowerCamelCase__			(       _a				,      _a				,      _a):  # Max Heap
	SCREAMING_SNAKE_CASE :   Union[str, Any]					  =							index
	SCREAMING_SNAKE_CASE :   str					  =							2 * index + 1  # Left Node
	SCREAMING_SNAKE_CASE :   List[Any]					  =							2 * index + 2  # Right Node

	if left_index < heap_size and array[largest] < array[left_index]:
		SCREAMING_SNAKE_CASE :   Tuple					  =							left_index

	if right_index < heap_size and array[largest] < array[right_index]:
		SCREAMING_SNAKE_CASE :   Optional[int]					  =							right_index

	if largest != index:
		SCREAMING_SNAKE_CASE  ,SCREAMING_SNAKE_CASE :   Union[str, Any]					  =							array[largest], array[index]
		heapify(_a				,      _a				,      _a)

def 			lowerCamelCase__			(       _a):
	SCREAMING_SNAKE_CASE :   Union[str, Any]					  =							len(_a)

	for i in range(n // 2				,      -1				,      -1):
		heapify(_a				,      _a				,      _a)

	for i in range(n - 1				,      0				,      -1):
		SCREAMING_SNAKE_CASE  ,SCREAMING_SNAKE_CASE :   int					  =							array[0], array[i]
		heapify(_a				,      0				,      _a)

	return array

def 			lowerCamelCase__			(       _a				,      _a				,      _a				,      _a):
	if (array[first_index] > array[middle_index]) != (
	    array[first_index] > array[last_index]
	):
		return array[first_index]
	elif (array[middle_index] > array[first_index]) != (
	    array[middle_index] > array[last_index]
	):
		return array[middle_index]
	else:
		return array[last_index]

def 			lowerCamelCase__			(       _a				,      _a				,      _a				,      _a):
	SCREAMING_SNAKE_CASE :   Optional[int]					  =							low
	SCREAMING_SNAKE_CASE :   List[Any]					  =							high
	while True:
		while array[i] < pivot:
			i += 1
		j -= 1
		while pivot < array[j]:
			j -= 1
		if i >= j:
			return i
		SCREAMING_SNAKE_CASE  ,SCREAMING_SNAKE_CASE :   List[Any]					  =							array[j], array[i]
		i += 1

def 			lowerCamelCase__			(       _a):
	if len(_a) == 0:
		return array
	SCREAMING_SNAKE_CASE :   int					  =							2 * math.ceil(math.loga(len(_a)))
	SCREAMING_SNAKE_CASE :   Optional[int]					  =							16
	return intro_sort(_a				,      0				,      len(_a)				,      _a				,      _a)

def 			lowerCamelCase__			(       _a				,      _a				,      _a				,      _a				,      _a):
	while end - start > size_threshold:
		if max_depth == 0:
			return heap_sort(_a)
		max_depth -= 1
		SCREAMING_SNAKE_CASE :   Optional[int]					  =							median_of_a(_a				,      _a				,      start + ((end - start) // 2) + 1				,      end - 1)
		SCREAMING_SNAKE_CASE :   List[str]					  =							partition(_a				,      _a				,      _a				,      _a)
		intro_sort(_a				,      _a				,      _a				,      _a				,      _a)
		SCREAMING_SNAKE_CASE :   int					  =							p
	return insertion_sort(_a				,      _a				,      _a)


if __name__ == "__main__":
			import doctest

			doctest.testmod()

			a_      =     input('Enter numbers separated by a comma : ').strip()
			a_      =     [float(item) for item in user_input.split(',')]
			print(sort(unsorted))


import gc
import unittest

import numpy as np
import torch

from diffusers import StableDiffusionKDiffusionPipeline
from diffusers.utils import slow, torch_device
from diffusers.utils.testing_utils import enable_full_determinism, require_torch_gpu


enable_full_determinism()






@slow
@require_torch_gpu
class _UpperCamelCase				(				unittest.TestCase ):
			'''simple docstring'''







			def 				__UpperCamelCase			(      self				:			Dict						)				->							Tuple:

				"""simple docstring"""

				super().tearDown()
				gc.collect()
				torch.cuda.empty_cache()
			def 				__UpperCamelCase			(      self				:			Optional[int]						)				->							int:

				"""simple docstring"""

				SCREAMING_SNAKE_CASE :   Optional[Any]					  =							StableDiffusionKDiffusionPipeline.from_pretrained("CompVis/stable-diffusion-v1-4"						)
				SCREAMING_SNAKE_CASE :   str					  =							sd_pipe.to(a						)
				sd_pipe.set_progress_bar_config(disable=a						)

				sd_pipe.set_scheduler("sample_euler"						)

				SCREAMING_SNAKE_CASE :   Optional[int]					  =							"A painting of a squirrel eating a burger"
				SCREAMING_SNAKE_CASE :   Any					  =							torch.manual_seed(0						)
				SCREAMING_SNAKE_CASE :   List[Any]					  =							sd_pipe([prompt]   ,   generator=a   ,   guidance_scale=9.0   ,   num_inference_steps=20   ,   output_type="np"						)

				SCREAMING_SNAKE_CASE :   Tuple					  =							output.images

				SCREAMING_SNAKE_CASE :   Any					  =							image[0, -3:, -3:, -1]

				assert image.shape == (1, 512, 512, 3)
				SCREAMING_SNAKE_CASE :   Union[str, Any]					  =							np.array([0.0447, 0.0492, 0.0468, 0.0408, 0.0383, 0.0408, 0.0354, 0.0380, 0.0339]						)

				assert np.abs(image_slice.flatten() - expected_slice						).max() < 1e-2
			def 				__UpperCamelCase			(      self				:			List[Any]						)				->							Optional[int]:

				"""simple docstring"""

				SCREAMING_SNAKE_CASE :   int					  =							StableDiffusionKDiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-2-1-base"						)
				SCREAMING_SNAKE_CASE :   Tuple					  =							sd_pipe.to(a						)
				sd_pipe.set_progress_bar_config(disable=a						)

				sd_pipe.set_scheduler("sample_euler"						)

				SCREAMING_SNAKE_CASE :   List[str]					  =							"A painting of a squirrel eating a burger"
				SCREAMING_SNAKE_CASE :   List[str]					  =							torch.manual_seed(0						)
				SCREAMING_SNAKE_CASE :   Union[str, Any]					  =							sd_pipe([prompt]   ,   generator=a   ,   guidance_scale=9.0   ,   num_inference_steps=20   ,   output_type="np"						)

				SCREAMING_SNAKE_CASE :   List[Any]					  =							output.images

				SCREAMING_SNAKE_CASE :   Tuple					  =							image[0, -3:, -3:, -1]

				assert image.shape == (1, 512, 512, 3)
				SCREAMING_SNAKE_CASE :   int					  =							np.array([0.1237, 0.1320, 0.1438, 0.1359, 0.1390, 0.1132, 0.1277, 0.1175, 0.1112]						)

				assert np.abs(image_slice.flatten() - expected_slice						).max() < 5e-1






			def 				__UpperCamelCase			(      self				:			Tuple						)				->							List[Any]:

				"""simple docstring"""

				SCREAMING_SNAKE_CASE :   Dict					  =							StableDiffusionKDiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-2-1-base"						)
				SCREAMING_SNAKE_CASE :   Union[str, Any]					  =							sd_pipe.to(a						)
				sd_pipe.set_progress_bar_config(disable=a						)

				sd_pipe.set_scheduler("sample_dpmpp_2m"						)

				SCREAMING_SNAKE_CASE :   str					  =							"A painting of a squirrel eating a burger"
				SCREAMING_SNAKE_CASE :   Any					  =							torch.manual_seed(0						)
				SCREAMING_SNAKE_CASE :   str					  =							sd_pipe(
				    [prompt]   ,   generator=a   ,   guidance_scale=7.5   ,   num_inference_steps=15   ,   output_type="np"   ,   use_karras_sigmas=a   ,   )

				SCREAMING_SNAKE_CASE :   str					  =							output.images

				SCREAMING_SNAKE_CASE :   Optional[int]					  =							image[0, -3:, -3:, -1]

				assert image.shape == (1, 512, 512, 3)
				SCREAMING_SNAKE_CASE :   int					  =							np.array(
				    [0.1138_1689, 0.1211_2921, 0.138_9457, 0.1254_9606, 0.124_4964, 0.1083_1517, 0.1156_2866, 0.1086_7816, 0.1049_9048]						)

				assert np.abs(image_slice.flatten() - expected_slice						).max() < 1e-2