



"""simple docstring"""






lowerCAmelCase__        =				[0, 2, 4, 6, 8]
lowerCAmelCase__        =				[1, 3, 5, 7, 9]






def        snake_case_  (      A_					:		int,				A_					:		int,				A_					:		list[int],				A_					:		int						):


       '''simple docstring'''





       if remaining_length == 0:
              if digits[0] == 0 or digits[-1] == 0:
                     return 0

              for i in range(length // 2 - 1,				-1,				-1						):
                     remainder += digits[i] + digits[length - i - 1]

                     if remainder % 2 == 0:
                            return 0

                     remainder //= 10

              return 1

       if remaining_length == 1:
              if remainder % 2 == 0:
                     return 0

              _lowerCamelCase						:				int    			= 0
              for digit in range(10						):
                     _lowerCamelCase						:				List[str]    			= digit
                     result += reversible_numbers(
                         0,				(remainder + 2 * digit) // 10,				A_,				A_						)
              return result

       _lowerCamelCase						:				List[Any]    			= 0
       for digita in range(10						):
              _lowerCamelCase						:				List[str]    			= digita

              if (remainder + digita) % 2 == 0:
                     _lowerCamelCase						:				Tuple    			= ODD_DIGITS
              else:
                     _lowerCamelCase						:				List[str]    			= EVEN_DIGITS

              for digita in other_parity_digits:
                     _lowerCamelCase						:				int    			= digita
                     result += reversible_numbers(
                         remaining_length - 2,				(remainder + digita + digita) // 10,				A_,				A_,				)
       return result






def        snake_case_  (      A_					:		int = 9						):


       '''simple docstring'''





       _lowerCamelCase						:				Optional[Any]    			= 0
       for length in range(1,				max_power + 1						):
              result += reversible_numbers(A_,				0,				[0] * length,				A_						)
       return result


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




'''simple docstring'''







import gc
import tempfile
import unittest

import numpy as np
import torch

from diffusers import VersatileDiffusionTextToImagePipeline
from diffusers.utils.testing_utils import nightly, require_torch_gpu, torch_device


lowercase    :							Optional[Any]      =					False


class 						__UpperCAmelCase      (					unittest.TestCase						):
							pass


@nightly
@require_torch_gpu
class 						__UpperCAmelCase      (					unittest.TestCase						):


							def  lowerCamelCase				(       self  ):





								"""simple docstring"""






								super().tearDown()
								gc.collect()
								torch.cuda.empty_cache()


							def  lowerCamelCase				(       self  ):





								"""simple docstring"""






								_snake_case   						=		VersatileDiffusionTextToImagePipeline.from_pretrained('shi-labs/versatile-diffusion'  )
								# remove text_unet
								pipe.remove_unused_weights()
								pipe.to(lowerCAmelCase_  )
								pipe.set_progress_bar_config(disable=lowerCAmelCase_  )

								_snake_case   						=		'A painting of a squirrel eating a burger '
								_snake_case   						=		torch.manual_seed(0  )
								_snake_case   						=		pipe(
								    prompt=lowerCAmelCase_    ,   generator=lowerCAmelCase_    ,   guidance_scale=7.5    ,   num_inference_steps=2    ,   output_type='numpy'  ).images

								with tempfile.TemporaryDirectory() as tmpdirname:
									pipe.save_pretrained(lowerCAmelCase_  )
									_snake_case   						=		VersatileDiffusionTextToImagePipeline.from_pretrained(lowerCAmelCase_  )
								pipe.to(lowerCAmelCase_  )
								pipe.set_progress_bar_config(disable=lowerCAmelCase_  )

								_snake_case   						=		generator.manual_seed(0  )
								_snake_case   						=		pipe(
								    prompt=lowerCAmelCase_    ,   generator=lowerCAmelCase_    ,   guidance_scale=7.5    ,   num_inference_steps=2    ,   output_type='numpy'  ).images

								assert np.abs(image - new_image  ).sum() < 1E-5, "Models don't have the same forward pass"




							def  lowerCamelCase				(       self  ):





								"""simple docstring"""






								_snake_case   						=		VersatileDiffusionTextToImagePipeline.from_pretrained(
								    'shi-labs/versatile-diffusion'    ,   torch_dtype=torch.floataa  )
								pipe.to(lowerCAmelCase_  )
								pipe.set_progress_bar_config(disable=lowerCAmelCase_  )

								_snake_case   						=		'A painting of a squirrel eating a burger '
								_snake_case   						=		torch.manual_seed(0  )
								_snake_case   						=		pipe(
								    prompt=lowerCAmelCase_    ,   generator=lowerCAmelCase_    ,   guidance_scale=7.5    ,   num_inference_steps=50    ,   output_type='numpy'  ).images

								_snake_case   						=		image[0, 2_53:2_56, 2_53:2_56, -1]

								assert image.shape == (1, 5_12, 5_12, 3)
								_snake_case   						=		np.array([0.3367, 0.3169, 0.2656, 0.3870, 0.4790, 0.3796, 0.4009, 0.4878, 0.4778]  )

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

