


'''simple docstring'''





from __future__ import annotations

from collections import Counter


def 							SCREAMING_SNAKE_CASE					(  _UpperCAmelCase				)    ->  int:
						_a     =			[True] * n
						_a     =			False
						_a     =			False
						_a     =			True

						for i in range(3							,     int(n**0.5 + 1				)							,     2				):
												_a     =			i * 2
												while index < n:
																		_a     =			False
																		_a     =			index + i

						_a     =			[2]

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

						return primes


def 							SCREAMING_SNAKE_CASE					(  _UpperCAmelCase				)    ->  int:
						_a     =			str(_UpperCAmelCase				)
						_a     =			[]
						_a     =			["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]

						for duplicate in Counter(_UpperCAmelCase				) - Counter(set(_UpperCAmelCase				)				):
												_a     =			[int(number_str.replace(_UpperCAmelCase							,     _UpperCAmelCase				)				) for digit in digits]
												replacements.append(_UpperCAmelCase				)

						return replacements


def 							SCREAMING_SNAKE_CASE					(  _UpperCAmelCase = 8				)    ->  Union[str, Any]:
						_a     =			set()

						# Filter primes with less than 3 replaceable digits
						_a     =			{
						    x for x in set(prime_sieve(1000000				)				) if len(str(_UpperCAmelCase				)				) - len(set(str(_UpperCAmelCase				)				)				) >= 3
						}

						for prime in primes:
												if prime in numbers_checked:
																		continue

												_a     =			digit_replacements(_UpperCAmelCase				)

												for family in replacements:
																		numbers_checked.update(_UpperCAmelCase				)
																		_a     =			primes.intersection(_UpperCAmelCase				)

																		if len(_UpperCAmelCase				) != family_length:
																								continue

																		return min(_UpperCAmelCase				)

						return -1


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






import numpy as np
import PIL
import torch
import torchvision.transforms as T
import torchvision.transforms.functional as TF
from PIL import Image


def 							SCREAMING_SNAKE_CASE					(  _UpperCAmelCase							,     _UpperCAmelCase=256				)    ->  Dict:
						_a     =			min(img.size				)

						if s < target_image_size:
												raise ValueError(f"""min dim for image {s} < {target_image_size}"""				)

						_a     =			target_image_size / s
						_a     =			(round(r * img.size[1]				), round(r * img.size[0]				))
						_a     =			TF.resize(_UpperCAmelCase							,     _UpperCAmelCase							,     interpolation=PIL.Image.LANCZOS				)
						_a     =			TF.center_crop(_UpperCAmelCase							,     output_size=2 * [target_image_size]				)
						_a     =			torch.unsqueeze(T.ToTensor()(_UpperCAmelCase				)							,     0				)
						return img


def 							SCREAMING_SNAKE_CASE					(  _UpperCAmelCase				)    ->  List[Any]:
						_a     =			2.0 * x - 1.0
						return x


def 							SCREAMING_SNAKE_CASE					(  _UpperCAmelCase							,     _UpperCAmelCase=True							,     _UpperCAmelCase="RGB"				)    ->  Optional[Any]:
						_a     =			x.detach().cpu()
						if process:
												_a     =			post_process_tensor(_UpperCAmelCase				)
						_a     =			x.numpy()
						if process:
												_a     =			(255 * x).astype(np.uinta				)
						_a     =			Image.fromarray(_UpperCAmelCase				)
						if not x.mode == mode:
												_a     =			x.convert(_UpperCAmelCase				)
						return x


def 							SCREAMING_SNAKE_CASE					(  _UpperCAmelCase				)    ->  Optional[Any]:
						_a     =			torch.clamp(_UpperCAmelCase							,     -1.0							,     1.0				)
						_a     =			(x + 1.0) / 2.0
						_a     =			x.permute(1							,     2							,     0				)
						return x






def 							SCREAMING_SNAKE_CASE					(  _UpperCAmelCase				)    ->  str:
						_a     =			post_process_tensor(x.squeeze()				)
						return x.permute(2							,     0							,     1				).unsqueeze(0				)


