






"""simple docstring"""


import math
from decimal import Decimal, getcontext


def 					UpperCAmelCase			(				a__ = 4_00_00_00   ):





						'''simple docstring'''






						try:
												lowerCAmelCase      :Optional[int]				  = int(a__   )
						except (TypeError, ValueError):
												raise TypeError('Parameter n must be int or castable to int.'   )
						if n <= 0:
												raise ValueError('Parameter n must be greater than or equal to one.'   )
						lowerCAmelCase      :Tuple				  = 1_00
						lowerCAmelCase      :List[str]				  = (Decimal(5   ) ** Decimal(0.5   ) + 1) / Decimal(2   )

						lowerCAmelCase      :int				  = (math.floor(math.log(n * (phi + 2)    ,			a__   ) - 1   ) // 3) * 3 + 2
						lowerCAmelCase      :List[str]				  = Decimal(round(phi ** Decimal(index + 1   )   )   ) / (phi + 2)
						lowerCAmelCase      :Tuple				  = num // 2
						return int(a__   )


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







"""simple docstring"""


import unittest

import torch

from diffusers import DDIMScheduler, TextToVideoZeroPipeline
from diffusers.utils import load_pt, require_torch_gpu, slow

from ..test_pipelines_common import assert_mean_pixel_difference




@slow
@require_torch_gpu
class 	__UpperCamelCase    (    unittest.TestCase	):
					def 					UpperCAmelCase__   (       self       :  Union[str, Any]      )  ->					Optional[Any]:
											lowerCAmelCase      :Union[str, Any]				  = 'runwayml/stable-diffusion-v1-5'
											lowerCAmelCase      :Tuple				  = TextToVideoZeroPipeline.from_pretrained(UpperCAmelCase    ,   torch_dtype=torch.floataa      ).to('cuda'      )
											lowerCAmelCase      :Union[str, Any]				  = DDIMScheduler.from_config(pipe.scheduler.config      )
											lowerCAmelCase      :str				  = torch.Generator(device='cuda'      ).manual_seed(0      )

											lowerCAmelCase      :Any				  = 'A bear is playing a guitar on Times Square'
											lowerCAmelCase      :Optional[Any]				  = pipe(prompt=UpperCAmelCase    ,   generator=UpperCAmelCase      ).images

											lowerCAmelCase      :List[str]				  = load_pt(
											    'https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/text-to-video/A bear is playing a guitar on Times Square.pt'      )

											assert_mean_pixel_difference(UpperCAmelCase    ,   UpperCAmelCase      )