

'''simple docstring'''



from __future__ import annotations

from collections import Counter

def   lowerCamelCase__       (      a__)		->    list[int]:



    """simple docstring"""







    _snake_case : Optional[int]												=		[True] * n
    _snake_case : List[str]												=		False
    _snake_case : int												=		False
    _snake_case : Tuple												=		True

    for i in range(3			,      int(n**0.5 + 1)			,      2):
        _snake_case : int												=		i * 2
        while index < n:
            _snake_case : List[str]												=		False
            _snake_case : Union[str, Any]												=		index + i

    _snake_case : List[str]												=		[2]

    for i in range(3			,      a__			,      2):
        if is_prime[i]:
            primes.append(a__)

    return primes

def   lowerCamelCase__       (      a__)		->    list[list[int]]:



    """simple docstring"""







    _snake_case : Tuple												=		str(a__)
    _snake_case : str												=		[]
    _snake_case : Union[str, Any]												=		['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']

    for duplicate in Counter(a__) - Counter(set(a__)):
        _snake_case : List[Any]												=		[int(number_str.replace(a__			,      a__)) for digit in digits]
        replacements.append(a__)

    return replacements

def   lowerCamelCase__       (      a__ = 8)		->    int:



    """simple docstring"""







    _snake_case : Any												=		set()

    # Filter primes with less than 3 replaceable digits
    _snake_case : List[Any]												=		{
        x for x in set(prime_sieve(1_0_0_0_0_0_0)) if len(str(a__)) - len(set(str(a__))) >= 3
    }

    for prime in primes:
        if prime in numbers_checked:
            continue

        _snake_case : int												=		digit_replacements(a__)

        for family in replacements:
            numbers_checked.update(a__)
            _snake_case : Union[str, Any]												=		primes.intersection(a__)

            if len(a__) != family_length:
                continue

            return min(a__)

    return -1


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






'''simple docstring'''



from typing import List, Optional, Tuple, Union

from . import logging
from .import_utils import is_torch_available, is_torch_version


if is_torch_available():
   import torch

SCREAMING_SNAKE_CASE_    =   logging.get_logger(__name__)  # pylint: disable=invalid-name

try:
   from torch._dynamo import allow_in_graph as maybe_allow_in_graph
except (ImportError, ModuleNotFoundError):

   def   lowerCamelCase__       (      cls)		->    Optional[Any]:



       """simple docstring"""







       return cls

def   lowerCamelCase__       (      a__			,      a__ = None			,      a__ = None			,      a__ = None			,      a__ = None			,      )		->    Dict:



    """simple docstring"""







    _snake_case : Optional[Any]												=		device
    _snake_case : Any												=		shape[0]

    _snake_case : str												=		layout or torch.strided
    _snake_case : str												=		device or torch.device('cpu')

    if generator is not None:
        _snake_case : Any												=		generator.device.type if not isinstance(a__			,      a__) else generator[0].device.type
        if gen_device_type != device.type and gen_device_type == "cpu":
            _snake_case : Optional[Any]												=		'cpu'
            if device != "mps":
                logger.info(
                    F"""The passed generator was created on 'cpu' even though a tensor on {device} was expected."""
                    F""" Tensors will be created on 'cpu' and then moved to {device}. Note that one can probably"""
                    F""" slighly speed up this function by passing a generator that was created on the {device} device.""")
        elif gen_device_type != device.type and gen_device_type == "cuda":
            raise ValueError(F"""Cannot generate a {device} tensor from a generator of type {gen_device_type}.""")

    if isinstance(a__			,      a__):
        _snake_case : Any												=		(1,) + shape[1:]
        _snake_case : int												=		[
            torch.randn(a__			,      generator=generator[i]			,      device=a__			,      dtype=a__			,      layout=a__)
            for i in range(a__)
        ]
        _snake_case : Optional[int]												=		torch.cat(a__			,      dim=0).to(a__)
    else:
        _snake_case : Optional[Any]												=		torch.randn(a__			,      generator=a__			,      device=a__			,      dtype=a__			,      layout=a__).to(a__)

    return latents




def   lowerCamelCase__       (      a__)		->    Optional[Any]:



    """simple docstring"""







    if is_torch_version('<'			,      '2.0.0') or not hasattr(a__			,      '_dynamo'):
        return False
    return isinstance(a__			,      torch._dynamo.eval_frame.OptimizedModule)



