

'''simple docstring'''

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_					(	snake_case	):
  SCREAMING_SNAKE_CASE:Tuple   =   tmp_path / "file.jsonl"
  SCREAMING_SNAKE_CASE:int   =   textwrap.dedent(
      "\\n        {\"col_1\": -1}\n        {\"col_1\": 1, \"col_2\": 2}\n        {\"col_1\": 10, \"col_2\": 20}\n        "	)
  with open(snake_case ,    "w"	) as f:
    f.write(snake_case	)
  return str(snake_case	)





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





@pytest.fixture
def 				A_					(	snake_case	):
  SCREAMING_SNAKE_CASE:str   =   tmp_path / "file_with_list_of_dicts.json"
  SCREAMING_SNAKE_CASE:Dict   =   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(snake_case ,    "w"	) as f:
    f.write(snake_case	)
  return str(snake_case	)





@pytest.fixture
def 				A_					(	snake_case	):
  SCREAMING_SNAKE_CASE:int   =   tmp_path / "file_with_list_of_dicts_field.json"
  SCREAMING_SNAKE_CASE:int   =   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(snake_case ,    "w"	) as f:
    f.write(snake_case	)
  return str(snake_case	)





@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_					(	snake_case ,    snake_case ,    snake_case	):
  SCREAMING_SNAKE_CASE:Any   =   Json(**snake_case	)
  SCREAMING_SNAKE_CASE:str   =   json._generate_tables([[request.getfixturevalue(snake_case	)]]	)
  SCREAMING_SNAKE_CASE:Dict   =   pa.concat_tables([table for _, table in generator]	)
  assert pa_table.to_pydict() == {"col_1": [-1, 1, 10], "col_2": [None, 2, 20]}





@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_					(	snake_case ,    snake_case ,    snake_case	):
  SCREAMING_SNAKE_CASE:List[str]   =   Json(**snake_case	)
  SCREAMING_SNAKE_CASE:str   =   json._generate_tables([[request.getfixturevalue(snake_case	)]]	)
  SCREAMING_SNAKE_CASE:List[str]   =   pa.concat_tables([table for _, table in generator]	)
  assert pa_table.to_pydict() == {"col_1": [-1, 1, 10], "col_2": [None, 2, 20], "missing_col": [None, None, None]}









'''simple docstring'''

from __future__ import annotations

from collections import Counter





def 				A_					(	snake_case	):
  SCREAMING_SNAKE_CASE:int   =   [True] * n
  SCREAMING_SNAKE_CASE:List[str]   =   False
  SCREAMING_SNAKE_CASE:Tuple   =   False
  SCREAMING_SNAKE_CASE:int   =   True

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

  SCREAMING_SNAKE_CASE:Union[str, Any]   =   [2]

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

  return primes





def 				A_					(	snake_case	):
  SCREAMING_SNAKE_CASE:List[str]   =   str(snake_case	)
  SCREAMING_SNAKE_CASE:Union[str, Any]   =   []
  SCREAMING_SNAKE_CASE:List[str]   =   ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]

  for duplicate in Counter(snake_case	) - Counter(set(snake_case	)	):
    SCREAMING_SNAKE_CASE:List[str]   =   [int(number_str.replace(snake_case ,    snake_case	)	) for digit in digits]
    replacements.append(snake_case	)

  return replacements





def 				A_					(	snake_case = 8	):
  SCREAMING_SNAKE_CASE:str   =   set()

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

  for prime in primes:
    if prime in numbers_checked:
      continue

    SCREAMING_SNAKE_CASE:List[Any]   =   digit_replacements(snake_case	)

    for family in replacements:
      numbers_checked.update(snake_case	)
      SCREAMING_SNAKE_CASE:Optional[Any]   =   primes.intersection(snake_case	)

      if len(snake_case	) != family_length:
        continue

      return min(snake_case	)

  return -1


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






