




import textwrap

import pyarrow as pa
import pytest

from datasets import Features, Value
from datasets.packaged_modules.json.json import Json



@pytest.fixture
def  _A  (			SCREAMING_SNAKE_CASE			):
	UpperCAmelCase__:  List[str]		       =   tmp_path / '''file.jsonl'''
	UpperCAmelCase__:  Union[str, Any]		       =   textwrap.dedent(
	    "\\n        {\"col_1\": -1}\n        {\"col_1\": 1, \"col_2\": 2}\n        {\"col_1\": 10, \"col_2\": 20}\n        "			)
	with open(UpperCamelCase__  ,"w"			) as f:
		f.write(UpperCamelCase__			)
	return str(UpperCamelCase__			)



@pytest.fixture
def  _A  (			SCREAMING_SNAKE_CASE			):
	UpperCAmelCase__:  int		       =   tmp_path / '''file_utf16_encoded.jsonl'''
	UpperCAmelCase__:  Tuple		       =   textwrap.dedent(
	    "\\n        {\"col_1\": -1}\n        {\"col_1\": 1, \"col_2\": 2}\n        {\"col_1\": 10, \"col_2\": 20}\n        "			)
	with open(UpperCamelCase__  ,"w"  ,encoding="utf-16"			) as f:
		f.write(UpperCamelCase__			)
	return str(UpperCamelCase__			)



@pytest.fixture
def  _A  (			SCREAMING_SNAKE_CASE			):
	UpperCAmelCase__:  Tuple		       =   tmp_path / '''file_with_list_of_dicts.json'''
	UpperCAmelCase__:  Optional[Any]		       =   textwrap.dedent(
	    "\\n        [\n            {\"col_1\": -1},\n            {\"col_1\": 1, \"col_2\": 2},\n            {\"col_1\": 10, \"col_2\": 20}\n        ]\n        "			)
	with open(UpperCamelCase__  ,"w"			) as f:
		f.write(UpperCamelCase__			)
	return str(UpperCamelCase__			)



@pytest.fixture
def  _A  (			SCREAMING_SNAKE_CASE			):
	UpperCAmelCase__:  Optional[int]		       =   tmp_path / '''file_with_list_of_dicts_field.json'''
	UpperCAmelCase__:  Union[str, Any]		       =   textwrap.dedent(
	    "\\n        {\n            \"field1\": 1,\n            \"field2\": \"aabb\",\n            \"field3\": [\n                {\"col_1\": -1},\n                {\"col_1\": 1, \"col_2\": 2},\n                {\"col_1\": 10, \"col_2\": 20}\n            ]\n        }\n        "			)
	with open(UpperCamelCase__  ,"w"			) as f:
		f.write(UpperCamelCase__			)
	return str(UpperCamelCase__			)



@pytest.mark.parametrize(
    "file_fixture, config_kwargs"  ,[
        ("jsonl_file", {}),
        ("jsonl_file_utf16_encoded", {"encoding": "utf-16"}),
        ("json_file_with_list_of_dicts", {}),
        ("json_file_with_list_of_dicts_field", {"field": "field3"}),
    ]  ,)
def  _A  (			SCREAMING_SNAKE_CASE  ,SCREAMING_SNAKE_CASE  ,SCREAMING_SNAKE_CASE			):
	UpperCAmelCase__:  Any		       =   Json(**UpperCamelCase__			)
	UpperCAmelCase__:  str		       =   json._generate_tables([[request.getfixturevalue(UpperCamelCase__			)]]			)
	UpperCAmelCase__:  Optional[Any]		       =   pa.concat_tables([table for _, table in generator]			)
	assert pa_table.to_pydict() == {"col_1": [-1, 1, 1_0], "col_2": [None, 2, 2_0]}



@pytest.mark.parametrize(
    "file_fixture, config_kwargs"  ,[
        (
            "jsonl_file",
            {"features": Features({"col_1": Value("int64"			), "col_2": Value("int64"			), "missing_col": Value("string"			)}			)},
        ),
        (
            "json_file_with_list_of_dicts",
            {"features": Features({"col_1": Value("int64"			), "col_2": Value("int64"			), "missing_col": Value("string"			)}			)},
        ),
        (
            "json_file_with_list_of_dicts_field",
            {
                "field": "field3",
                "features": Features(
                    {"col_1": Value("int64"			), "col_2": Value("int64"			), "missing_col": Value("string"			)}			),
            },
        ),
    ]  ,)
def  _A  (			SCREAMING_SNAKE_CASE  ,SCREAMING_SNAKE_CASE  ,SCREAMING_SNAKE_CASE			):
	UpperCAmelCase__:  List[Any]		       =   Json(**UpperCamelCase__			)
	UpperCAmelCase__:  Any		       =   json._generate_tables([[request.getfixturevalue(UpperCamelCase__			)]]			)
	UpperCAmelCase__:  List[Any]		       =   pa.concat_tables([table for _, table in generator]			)
	assert pa_table.to_pydict() == {"col_1": [-1, 1, 1_0], "col_2": [None, 2, 2_0], "missing_col": [None, None, None]}


from __future__ import annotations

from collections import Counter



def  _A  (			SCREAMING_SNAKE_CASE			):
	UpperCAmelCase__:  Optional[Any]		       =   [True] * n
	UpperCAmelCase__:  Any		       =   False
	UpperCAmelCase__:  Tuple		       =   False
	UpperCAmelCase__:  Optional[Any]		       =   True

	for i in range(3  ,int(n**0.5 + 1			)  ,2			):
		UpperCAmelCase__:  Any		       =   i * 2
		while index < n:
			UpperCAmelCase__:  Optional[int]		       =   False
			UpperCAmelCase__:  Tuple		       =   index + i

	UpperCAmelCase__:  int		       =   [2]

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

	return primes



def  _A  (			SCREAMING_SNAKE_CASE			):
	UpperCAmelCase__:  List[Any]		       =   str(SCREAMING_SNAKE_CASE			)
	UpperCAmelCase__:  Tuple		       =   []
	UpperCAmelCase__:  Optional[int]		       =   ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]

	for duplicate in Counter(SCREAMING_SNAKE_CASE			) - Counter(set(SCREAMING_SNAKE_CASE			)			):
		UpperCAmelCase__:  Optional[Any]		       =   [int(number_str.replace(SCREAMING_SNAKE_CASE  ,SCREAMING_SNAKE_CASE			)			) for digit in digits]
		replacements.append(SCREAMING_SNAKE_CASE			)

	return replacements



def  _A  (			SCREAMING_SNAKE_CASE = 8			):
	UpperCAmelCase__:  Union[str, Any]		       =   set()

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

	for prime in primes:
		if prime in numbers_checked:
			continue

		UpperCAmelCase__:  Optional[int]		       =   digit_replacements(SCREAMING_SNAKE_CASE			)

		for family in replacements:
			numbers_checked.update(SCREAMING_SNAKE_CASE			)
			UpperCAmelCase__:  Dict		       =   primes.intersection(SCREAMING_SNAKE_CASE			)

			if len(SCREAMING_SNAKE_CASE			) != family_length:
				continue

			return min(SCREAMING_SNAKE_CASE			)

	return -1


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