
'''simple docstring'''





from typing import List

from ...processing_utils import ProcessorMixin
from ...utils import is_torch_available


if is_torch_available():
   import torch






class 						UpperCAmelCase	(		SCREAMING_SNAKE_CASE__				):
   A__      :	Tuple		  =  ['image_processor', 'tokenizer']
   A__      :	Tuple		  =  'OneFormerImageProcessor'
   A__      :	List[Any]		  =  ('CLIPTokenizer', 'CLIPTokenizerFast')



   def __init__(self	:      Any					,		snake_case__	:      Dict=None					,		snake_case__	:      int=None					,		snake_case__	:      int = 77					,		snake_case__	:      int = 77					,		**snake_case__	:      int				)	->			Union[str, Any]:


          '''simple docstring'''


          if image_processor is None:
                 raise ValueError("You need to specify an `image_processor`."				)
          if tokenizer is None:
                 raise ValueError("You need to specify a `tokenizer`."				)

          snake_case :     str           =   max_seq_length
          snake_case :     Optional[int]           =   task_seq_length

          super().__init__(a_					,		a_				)



   def        _SCREAMING_SNAKE_CASE     (self	:      Any					,		snake_case__	:      Optional[Any]=None					,		snake_case__	:      Optional[int]=77				)	->			int:


          '''simple docstring'''


          if text_list is None:
                 raise ValueError("tokens cannot be None."				)

          snake_case :     Union[str, Any]           =   self.tokenizer(a_					,		padding="max_length"					,		max_length=a_					,		truncation=a_				)

          snake_case       ,      snake_case :     Optional[int]           =   tokens["attention_mask"], tokens["input_ids"]

          snake_case :     int           =   []
          for attn_mask, input_id in zip(a_					,		a_				):
                 snake_case :     List[str]           =   torch.tensor(a_				) * torch.tensor(a_				)
                 token_inputs.append(token.unsqueeze(0				)				)

          snake_case :     Any           =   torch.cat(a_					,		dim=0				)
          return token_inputs



   def __call__(self	:      str					,		snake_case__	:      Dict=None					,		snake_case__	:      str=None					,		snake_case__	:      Tuple=None					,		**snake_case__	:      Any				)	->			Optional[Any]:


          '''simple docstring'''


          if task_inputs is None:
                 raise ValueError("You have to specify the task_input. Found None."				)
          elif images is None:
                 raise ValueError("You have to specify the image. Found None."				)

          if not all(task in ["semantic", "instance", "panoptic"] for task in task_inputs				):
                 raise ValueError("task_inputs must be semantic, instance, or panoptic."				)

          snake_case :     Dict           =   self.image_processor(a_					,		a_					,		a_					,		**a_				)

          if isinstance(a_					,		a_				):
                 snake_case :     Dict           =   [task_inputs]

          if isinstance(a_					,		a_				) and all(isinstance(a_					,		a_				) for task_input in task_inputs				):
                 snake_case :     str           =   []
                 for task in task_inputs:
                        snake_case :     Optional[Any]           =   f"""the task is {task}"""
                        task_token_inputs.append(a_				)
                 snake_case :     Tuple           =   self._preprocess_text(a_					,		max_length=self.task_seq_length				)
          else:
                 raise TypeError("Task Inputs should be a string or a list of strings."				)

          if hasattr(a_					,		"text_inputs"				):
                 snake_case :     Tuple           =   encoded_inputs.text_inputs

                 snake_case :     Optional[Any]           =   []
                 for texts in texts_list:
                        snake_case :     Dict           =   self._preprocess_text(a_					,		max_length=self.max_seq_length				)
                        text_inputs.append(text_input_list.unsqueeze(0				)				)

                 snake_case :     int           =   torch.cat(a_					,		dim=0				)

          return encoded_inputs



   def        _SCREAMING_SNAKE_CASE     (self	:      Union[str, Any]					,		snake_case__	:      Tuple=None					,		snake_case__	:      List[str]=None					,		snake_case__	:      Optional[Any]=None					,		**snake_case__	:      Tuple				)	->			str:


          '''simple docstring'''


          if task_inputs is None:
                 raise ValueError("You have to specify the task_input. Found None."				)
          elif images is None:
                 raise ValueError("You have to specify the image. Found None."				)

          if not all(task in ["semantic", "instance", "panoptic"] for task in task_inputs				):
                 raise ValueError("task_inputs must be semantic, instance, or panoptic."				)

          snake_case :     Optional[int]           =   self.image_processor.encode_inputs(a_					,		a_					,		a_					,		**a_				)

          if isinstance(a_					,		a_				):
                 snake_case :     int           =   [task_inputs]

          if isinstance(a_					,		a_				) and all(isinstance(a_					,		a_				) for task_input in task_inputs				):
                 snake_case :     str           =   []
                 for task in task_inputs:
                        snake_case :     Union[str, Any]           =   f"""the task is {task}"""
                        task_token_inputs.append(a_				)
                 snake_case :     List[Any]           =   self._preprocess_text(a_					,		max_length=self.task_seq_length				)
          else:
                 raise TypeError("Task Inputs should be a string or a list of strings."				)

          if hasattr(a_					,		"text_inputs"				):
                 snake_case :     Optional[int]           =   encoded_inputs.text_inputs

                 snake_case :     Optional[int]           =   []
                 for texts in texts_list:
                        snake_case :     int           =   self._preprocess_text(a_					,		max_length=self.max_seq_length				)
                        text_inputs.append(text_input_list.unsqueeze(0				)				)

                 snake_case :     Tuple           =   torch.cat(a_					,		dim=0				)

          return encoded_inputs



   def        _SCREAMING_SNAKE_CASE     (self	:      Any					,		*snake_case__	:      int					,		**snake_case__	:      Optional[int]				)	->			str:


          '''simple docstring'''


          return self.image_processor.post_process_semantic_segmentation(*a_					,		**a_				)



   def        _SCREAMING_SNAKE_CASE     (self	:      str					,		*snake_case__	:      Tuple					,		**snake_case__	:      Optional[int]				)	->			Any:


          '''simple docstring'''


          return self.image_processor.post_process_instance_segmentation(*a_					,		**a_				)



   def        _SCREAMING_SNAKE_CASE     (self	:      Dict					,		*snake_case__	:      str					,		**snake_case__	:      int				)	->			List[str]:


          '''simple docstring'''


          return self.image_processor.post_process_panoptic_segmentation(*a_					,		**a_				)







import math
from itertools import permutations


def     UpperCamelCase      (					__lowerCamelCase  :				int					):

       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(__lowerCamelCase					) + 1					)       ,      6					):
              if number % i == 0 or number % (i + 2) == 0:
                     return False
       return True


def     UpperCamelCase      (					__lowerCamelCase  :				int       ,      __lowerCamelCase  :				list					):
       snake_case       ,      snake_case :     List[str]           =   0, len(__lowerCamelCase					) - 1
       while left <= right:
              snake_case :     int           =   (left + right) // 2
              if prime_list[middle] == target:
                     return True
              elif prime_list[middle] < target:
                     snake_case :     Dict           =   middle + 1
              else:
                     snake_case :     Optional[int]           =   middle - 1

       return False


def     UpperCamelCase      (					):
       snake_case :     List[Any]           =   [n for n in range(1001       ,      10000       ,      2					) if is_prime(__lowerCamelCase					)]
       snake_case :     Dict           =   []

       for number in prime_list:
              snake_case :     Dict           =   []

              for prime_member in permutations(list(str(__lowerCamelCase					)					)					):
                     snake_case :     Dict           =   int("".join(__lowerCamelCase					)					)

                     if prime % 2 == 0:
                            continue

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

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

       snake_case :     Union[str, Any]           =   []
       for candidate in candidates:
              snake_case :     Dict           =   len(__lowerCamelCase					)
              snake_case :     Any           =   False

              for i in range(__lowerCamelCase					):
                     for j in range(i + 1       ,      __lowerCamelCase					):
                            for k in range(j + 1       ,      __lowerCamelCase					):
                                   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]]					)					)
                                          snake_case :     Optional[Any]           =   True

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

       snake_case :     Tuple           =   set()
       for seq in passed:
              answer.add("".join([str(__lowerCamelCase					) for i in seq]					)					)

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


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





