
from ...configuration_utils import PretrainedConfig
from ...utils import is_detectrona_available, logging


__lowerCamelCase								=					logging.get_logger(__name__)

__lowerCamelCase								=					{
    'layoutlmv2-base-uncased': 'https://huggingface.co/microsoft/layoutlmv2-base-uncased/resolve/main/config.json',
    'layoutlmv2-large-uncased': 'https://huggingface.co/microsoft/layoutlmv2-large-uncased/resolve/main/config.json',
    # See all LayoutLMv2 models at https://huggingface.co/models?filter=layoutlmv2
}

# soft dependency
if is_detectrona_available():
				import detectrona
class    _UpperCamelCase(   __lowercase				):
						__A:						Optional[Any]				   =      "layoutlmv2"

						def __init__(					self		:			int	,						_lowerCamelCase		:			Tuple=3_05_22	,						_lowerCamelCase		:			Dict=7_68	,						_lowerCamelCase		:			Optional[Any]=12	,						_lowerCamelCase		:			List[Any]=12	,						_lowerCamelCase		:			List[str]=30_72	,						_lowerCamelCase		:			int="gelu"	,						_lowerCamelCase		:			int=0.1	,						_lowerCamelCase		:			int=0.1	,						_lowerCamelCase		:			Any=5_12	,						_lowerCamelCase		:			Optional[int]=2	,						_lowerCamelCase		:			Tuple=0.02	,						_lowerCamelCase		:			Optional[Any]=1E-12	,						_lowerCamelCase		:			str=0	,						_lowerCamelCase		:			int=10_24	,						_lowerCamelCase		:			Dict=1_28	,						_lowerCamelCase		:			List[Any]=32	,						_lowerCamelCase		:			Optional[int]=True	,						_lowerCamelCase		:			Tuple=2_56	,						_lowerCamelCase		:			List[Any]=64	,						_lowerCamelCase		:			List[Any]=True	,						_lowerCamelCase		:			Union[str, Any]=[7, 7, 2_56]	,						_lowerCamelCase		:			Optional[int]=1_28	,						_lowerCamelCase		:			int=1_28	,						_lowerCamelCase		:			Optional[Any]=True	,						_lowerCamelCase		:			Optional[int]=True	,						_lowerCamelCase		:			Dict=False	,						_lowerCamelCase		:			Any=None	,						**_lowerCamelCase		:			Dict	,						):
													super().__init__(
													    vocab_size=A__	,						hidden_size=A__	,						num_hidden_layers=A__	,						num_attention_heads=A__	,						intermediate_size=A__	,						hidden_act=A__	,						hidden_dropout_prob=A__	,						attention_probs_dropout_prob=A__	,						max_position_embeddings=A__	,						type_vocab_size=A__	,						initializer_range=A__	,						layer_norm_eps=A__	,						pad_token_id=A__	,						**A__	,						)
													_UpperCAmelCase  :			Any	       =		max_ad_position_embeddings
													_UpperCAmelCase  :			str	       =		max_rel_pos
													_UpperCAmelCase  :			Tuple	       =		rel_pos_bins
													_UpperCAmelCase  :			Dict	       =		fast_qkv
													_UpperCAmelCase  :			List[str]	       =		max_rel_ad_pos
													_UpperCAmelCase  :			Dict	       =		rel_ad_pos_bins
													_UpperCAmelCase  :			Union[str, Any]	       =		convert_sync_batchnorm
													_UpperCAmelCase  :			Any	       =		image_feature_pool_shape
													_UpperCAmelCase  :			Union[str, Any]	       =		coordinate_size
													_UpperCAmelCase  :			Any	       =		shape_size
													_UpperCAmelCase  :			Union[str, Any]	       =		has_relative_attention_bias
													_UpperCAmelCase  :			List[Any]	       =		has_spatial_attention_bias
													_UpperCAmelCase  :			Optional[int]	       =		has_visual_segment_embedding
													_UpperCAmelCase  :			Union[str, Any]	       =		(
													    detectrona_config_args if detectrona_config_args is not None else self.get_default_detectrona_config()
													)

						@classmethod
						def 						a__ (					self		:			Optional[Any]			):
													return {
													    "MODEL.MASK_ON": True,
													    "MODEL.PIXEL_STD": [57.3_75, 57.1_20, 58.3_95],
													    "MODEL.BACKBONE.NAME": "build_resnet_fpn_backbone",
													    "MODEL.FPN.IN_FEATURES": ["res2", "res3", "res4", "res5"],
													    "MODEL.ANCHOR_GENERATOR.SIZES": [[32], [64], [1_28], [2_56], [5_12]],
													    "MODEL.RPN.IN_FEATURES": ["p2", "p3", "p4", "p5", "p6"],
													    "MODEL.RPN.PRE_NMS_TOPK_TRAIN": 20_00,
													    "MODEL.RPN.PRE_NMS_TOPK_TEST": 10_00,
													    "MODEL.RPN.POST_NMS_TOPK_TRAIN": 10_00,
													    "MODEL.POST_NMS_TOPK_TEST": 10_00,
													    "MODEL.ROI_HEADS.NAME": "StandardROIHeads",
													    "MODEL.ROI_HEADS.NUM_CLASSES": 5,
													    "MODEL.ROI_HEADS.IN_FEATURES": ["p2", "p3", "p4", "p5"],
													    "MODEL.ROI_BOX_HEAD.NAME": "FastRCNNConvFCHead",
													    "MODEL.ROI_BOX_HEAD.NUM_FC": 2,
													    "MODEL.ROI_BOX_HEAD.POOLER_RESOLUTION": 14,
													    "MODEL.ROI_MASK_HEAD.NAME": "MaskRCNNConvUpsampleHead",
													    "MODEL.ROI_MASK_HEAD.NUM_CONV": 4,
													    "MODEL.ROI_MASK_HEAD.POOLER_RESOLUTION": 7,
													    "MODEL.RESNETS.DEPTH": 1_01,
													    "MODEL.RESNETS.SIZES": [[32], [64], [1_28], [2_56], [5_12]],
													    "MODEL.RESNETS.ASPECT_RATIOS": [[0.5, 1.0, 2.0]],
													    "MODEL.RESNETS.OUT_FEATURES": ["res2", "res3", "res4", "res5"],
													    "MODEL.RESNETS.NUM_GROUPS": 32,
													    "MODEL.RESNETS.WIDTH_PER_GROUP": 8,
													    "MODEL.RESNETS.STRIDE_IN_1X1": False,
													}






						def 						a__ (					self		:			List[str]			):
													_UpperCAmelCase  :			List[Any]	       =		detectrona.config.get_cfg()
													for k, v in self.detectrona_config_args.items():
																				_UpperCAmelCase  :			Union[str, Any]	       =		k.split("."			)
																				_UpperCAmelCase  :			List[Any]	       =		detectrona_config
																				for attribute in attributes[:-1]:
																											_UpperCAmelCase  :			str	       =		getattr(A__	,						A__			)
																				setattr(A__	,						attributes[-1]	,						A__			)

													return detectrona_config







from __future__ import annotations

from collections import Counter



def  snake_case_(_UpperCamelCase	)				->      list[int]:



  """simple docstring"""






  _snake_case		=				[True] * n
  _snake_case		=				False
  _snake_case		=				False
  _snake_case		=				True

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

  _snake_case		=				[2]

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

  return primes



def  snake_case_(_UpperCamelCase	)				->      list[list[int]]:



  """simple docstring"""






  _snake_case		=				str(_UpperCamelCase	)
  _snake_case		=				[]
  _snake_case		=				['''0''', '''1''', '''2''', '''3''', '''4''', '''5''', '''6''', '''7''', '''8''', '''9''']

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

  return replacements



def  snake_case_(_UpperCamelCase = 8	)				->      int:



  """simple docstring"""






  _snake_case		=				set()

  # Filter primes with less than 3 replaceable digits
  _snake_case		=				{
      x for x in set(prime_sieve(1_000_000	)	) if len(str(_UpperCamelCase	)	) - len(set(str(_UpperCamelCase	)	)	) >= 3
  }

  for prime in primes:
    if prime in numbers_checked:
      continue

    _snake_case		=				digit_replacements(_UpperCamelCase	)

    for family in replacements:
      numbers_checked.update(_UpperCamelCase	)
      _snake_case		=				primes.intersection(_UpperCamelCase	)

      if len(_UpperCamelCase	) != family_length:
        continue

      return min(_UpperCamelCase	)

  return -1


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

