


import itertools
from dataclasses import dataclass
from typing import List, Optional

import pyarrow as pa
import pyarrow.parquet as pq

import datasets
from datasets.table import table_cast


_snake_case					:		Tuple      =    datasets.utils.logging.get_logger(__name__)

@dataclass
class     a		(datasets.BuilderConfig				):




							"""simple docstring"""


							__UpperCAmelCase   :							int					  =  1_0000
							__UpperCAmelCase   :							Optional[List[str]]					  =  None
							__UpperCAmelCase   :							Optional[datasets.Features]					  =  None

class     a		(datasets.ArrowBasedBuilder				):




							"""simple docstring"""


							__UpperCAmelCase   :							Tuple					  =  ParquetConfig

							def    __snake_case (							self	:  Union[str, Any]    )     ->   Optional[Any]:
														return datasets.DatasetInfo(features=self.config.features    )

							def    __snake_case (							self	:  int   ,     lowerCamelCase	:  Tuple    )     ->   Dict:
														if not self.config.data_files:
																					raise ValueError(F'At least one data file must be specified, but got data_files={self.config.data_files}'    )
														__snake_case		:      Any										=       dl_manager.download_and_extract(self.config.data_files    )
														if isinstance(lowerCamelCase   ,     (str, list, tuple)    ):
																					__snake_case		:      Dict										=       data_files
																					if isinstance(lowerCamelCase   ,     lowerCamelCase    ):
																												__snake_case		:      Union[str, Any]										=       [files]
																					# Use `dl_manager.iter_files` to skip hidden files in an extracted archive
																					__snake_case		:      str										=       [dl_manager.iter_files(lowerCamelCase    ) for file in files]
																					return [datasets.SplitGenerator(name=datasets.Split.TRAIN   ,     gen_kwargs={"files": files}    )]
														__snake_case		:      Union[str, Any]										=       []
														for split_name, files in data_files.items():
																					if isinstance(lowerCamelCase   ,     lowerCamelCase    ):
																												__snake_case		:      List[str]										=       [files]
																					# Use `dl_manager.iter_files` to skip hidden files in an extracted archive
																					__snake_case		:      Any										=       [dl_manager.iter_files(lowerCamelCase    ) for file in files]
																					# Infer features is they are stoed in the arrow schema
																					if self.info.features is None:
																												for file in itertools.chain.from_iterable(lowerCamelCase    ):
																																			with open(lowerCamelCase   ,     "rb"    ) as f:
																																										__snake_case		:      Dict										=       datasets.Features.from_arrow_schema(pq.read_schema(lowerCamelCase    )    )
																																			break
																					splits.append(datasets.SplitGenerator(name=lowerCamelCase   ,     gen_kwargs={"files": files}    )    )
														return splits

							def    __snake_case (							self	:  List[Any]   ,     lowerCamelCase	:  pa.Table    )     ->   pa.Table:
														if self.info.features is not None:
																					# more expensive cast to support nested features with keys in a different order
																					# allows str <-> int/float or str to Audio for example
																					__snake_case		:      Optional[int]										=       table_cast(lowerCamelCase   ,     self.info.features.arrow_schema    )
														return pa_table






							def    __snake_case (							self	:  Optional[int]   ,     lowerCamelCase	:  Dict    )     ->   List[str]:
														__snake_case		:      List[str]										=       self.info.features.arrow_schema if self.info.features is not None else None
														if self.info.features is not None and self.config.columns is not None:
																					if sorted(field.name for field in schema    ) != sorted(self.config.columns    ):
																												raise ValueError(
																												    F'Tried to load parquet data with columns \'{self.config.columns}\' with mismatching features \'{self.info.features}\''    )
														for file_idx, file in enumerate(itertools.chain.from_iterable(lowerCamelCase    )    ):
																					with open(lowerCamelCase   ,     "rb"    ) as f:
																												__snake_case		:      int										=       pq.ParquetFile(lowerCamelCase    )
																												try:
																																			for batch_idx, record_batch in enumerate(
																																			    parquet_file.iter_batches(batch_size=self.config.batch_size   ,     columns=self.config.columns    )    ):
																																										__snake_case		:      int										=       pa.Table.from_batches([record_batch]    )
																																										# Uncomment for debugging (will print the Arrow table size and elements)
																																										# logger.warning(f"pa_table: {pa_table} num rows: {pa_table.num_rows}")
																																										# logger.warning('\n'.join(str(pa_table.slice(i, 1).to_pydict()) for i in range(pa_table.num_rows)))
																																										yield F'{file_idx}_{batch_idx}', self._cast_table(lowerCamelCase    )
																												except ValueError as e:
																																			logger.error(F'Failed to read file \'{file}\' with error {type(lowerCamelCase    )}: {e}'    )
																																			raise





from __future__ import annotations

from functools import lru_cache
from math import ceil

_snake_case					:		Tuple      =    100

_snake_case					:		int      =    set(range(3, NUM_PRIMES, 2))
primes.add(2)
_snake_case					:		int

for prime in range(3, ceil(NUM_PRIMES**0.5), 2):
			if prime not in primes:
						continue
			primes.difference_update(set(range(prime * prime, NUM_PRIMES, prime)))







@lru_cache(maxsize=1_0_0     )
def     lowerCAmelCase_					( __lowerCamelCase     ):
							if number_to_partition < 0:
														return set()
							elif number_to_partition == 0:
														return {1}

							__snake_case		:      set[int]										=       set()
							__snake_case		:      int
							__snake_case		:      int

							for prime in primes:
														if prime > number_to_partition:
																					continue
														for sub in partition(number_to_partition - prime     ):
																					ret.add(sub * prime     )

							return ret







def     lowerCAmelCase_					( __lowerCamelCase = 5_0_0_0     ):
							for number_to_partition in range(1							,     __lowerCamelCase     ):
														if len(partition(__lowerCamelCase     )     ) > number_unique_partitions:
																					return number_to_partition
							return None


if __name__ == "__main__":
			print(f'''{solution() = }''')

