"""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__ 	=     False




class        __snake_case	(					unittest.TestCase    ):
						pass







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



						def   lowerCamelCase_       (						self)     ->      Tuple:





								'''simple docstring'''





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



						def   lowerCamelCase_       (						self)     ->      Dict:





								'''simple docstring'''





								a__:					Dict      							=     VersatileDiffusionTextToImagePipeline.from_pretrained('shi-labs/versatile-diffusion')
								# remove text_unet
								pipe.remove_unused_weights()
								pipe.to(lowercase)
								pipe.set_progress_bar_config(disable=lowercase)

								a__:					List[str]      							=     'A painting of a squirrel eating a burger '
								a__:					int      							=     torch.manual_seed(0)
								a__:					int      							=     pipe(
								    prompt=lowercase   ,      generator=lowercase   ,      guidance_scale=7.5   ,      num_inference_steps=2   ,      output_type='numpy').images

								with tempfile.TemporaryDirectory() as tmpdirname:
										pipe.save_pretrained(lowercase)
										a__:					str      							=     VersatileDiffusionTextToImagePipeline.from_pretrained(lowercase)
								pipe.to(lowercase)
								pipe.set_progress_bar_config(disable=lowercase)

								a__:					Union[str, Any]      							=     generator.manual_seed(0)
								a__:					List[Any]      							=     pipe(
								    prompt=lowercase   ,      generator=lowercase   ,      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)     ->      Optional[int]:





								'''simple docstring'''





								a__:					List[str]      							=     VersatileDiffusionTextToImagePipeline.from_pretrained(
								    'shi-labs/versatile-diffusion'   ,      torch_dtype=torch.floataa)
								pipe.to(lowercase)
								pipe.set_progress_bar_config(disable=lowercase)

								a__:					Optional[Any]      							=     'A painting of a squirrel eating a burger '
								a__:					Union[str, Any]      							=     torch.manual_seed(0)
								a__:					int      							=     pipe(
								    prompt=lowercase   ,      generator=lowercase   ,      guidance_scale=7.5   ,      num_inference_steps=50   ,      output_type='numpy').images

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

								assert image.shape == (1, 5_12, 5_12, 3)
								a__:					List[Any]      							=     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



"""simple docstring"""
def 						__a       (     _SCREAMING_SNAKE_CASE = 1000000       )     ->int:
  a__:					Any      							=     limit + 1
  a__:					List[str]      							=     [0] * limit
  for first_term in range(1		,					_SCREAMING_SNAKE_CASE       ):
    for n in range(_SCREAMING_SNAKE_CASE		,					_SCREAMING_SNAKE_CASE		,					_SCREAMING_SNAKE_CASE       ):
      a__:					Any      							=     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

  a__:					Optional[int]      							=     sum(1 for x in frequency[1:limit] if x == 10       )

  return count


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


