

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     lowerCamelCase_   ( unittest.TestCase):




 def 						a					( self       ):
   __UpperCAmelCase  :     Union[str, Any]		=    'runwayml/stable-diffusion-v1-5'
   __UpperCAmelCase  :     int		=    TextToVideoZeroPipeline.from_pretrained(_UpperCAmelCase     ,     torch_dtype=torch.floataa       ).to('cuda'       )
   __UpperCAmelCase  :     str		=    DDIMScheduler.from_config(pipe.scheduler.config       )
   __UpperCAmelCase  :     Any		=    torch.Generator(device='cuda'       ).manual_seed(0       )

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

   __UpperCAmelCase  :     Optional[int]		=    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       )








import math
from itertools import permutations





def    _snake_case		(snake_case_				:    int     )       ->		bool:

  if 1 < number < 4:
    # 2 and 3 are primes
    return True
  elif number < 2 or number % 2 == 0 or number % 3 == 0:
    # Negatives, 0, 1, all even numbers, all multiples of 3 are not primes
    return False

  # All primes number are in format of 6k +/- 1
  for i in range(5						,					int(math.sqrt(snake_case_     ) + 1     )						,					6     ):
    if number % i == 0 or number % (i + 2) == 0:
      return False
  return True





def    _snake_case		(snake_case_				:    int						,					snake_case_				:    list     )       ->		bool:
  __UpperCAmelCase, __UpperCAmelCase  :     Any		=    0, len(snake_case_     ) - 1
  while left <= right:
    __UpperCAmelCase  :     List[str]		=    (left + right) // 2
    if prime_list[middle] == target:
      return True
    elif prime_list[middle] < target:
      __UpperCAmelCase  :     Tuple		=    middle + 1
    else:
      __UpperCAmelCase  :     Tuple		=    middle - 1

  return False





def    _snake_case		()       ->		str:
  __UpperCAmelCase  :     List[Any]		=    [n for n in range(1001						,					1_0000						,					2     ) if is_prime(snake_case_     )]
  __UpperCAmelCase  :     Tuple		=    []

  for number in prime_list:
    __UpperCAmelCase  :     List[str]		=    []

    for prime_member in permutations(list(str(snake_case_     )     )     ):
      __UpperCAmelCase  :     Dict		=    int(''.join(snake_case_     )     )

      if prime % 2 == 0:
        continue

      if search(snake_case_						,					snake_case_     ):
        tmp_numbers.append(snake_case_     )

    tmp_numbers.sort()
    if len(snake_case_     ) >= 3:
      candidates.append(snake_case_     )

  __UpperCAmelCase  :     Optional[int]		=    []
  for candidate in candidates:
    __UpperCAmelCase  :     int		=    len(snake_case_     )
    __UpperCAmelCase  :     List[Any]		=    False

    for i in range(snake_case_     ):
      for j in range(i + 1						,					snake_case_     ):
        for k in range(j + 1						,					snake_case_     ):
          if (
              abs(candidate[i] - candidate[j]     )
              == abs(candidate[j] - candidate[k]     )
              and len({candidate[i], candidate[j], candidate[k]}     ) == 3
          ):
            passed.append(
                sorted([candidate[i], candidate[j], candidate[k]]     )     )
            __UpperCAmelCase  :     Any		=    True

          if found:
            break
        if found:
          break
      if found:
        break

  __UpperCAmelCase  :     Dict		=    set()
  for seq in passed:
    answer.add(''.join([str(snake_case_     ) for i in seq]     )     )

  return max(int(snake_case_     ) for x in answer     )


if __name__ == "__main__":
      print(solution())





