




"""simple docstring"""




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


lowerCAmelCase							:    Optional[int]  							=							datasets.utils.logging.get_logger(__name__)






@dataclass
class 					__magic_name__							( datasets.BuilderConfig       ):






				'''simple docstring'''
				__UpperCamelCase    						=		1_00_00
				__UpperCamelCase    						=		None
				__UpperCamelCase    						=		None






class 					__magic_name__							( datasets.ArrowBasedBuilder       ):






				'''simple docstring'''
				__UpperCamelCase    						=		ParquetConfig





				def      _lowerCAmelCase       ( self				):





							"""simple docstring"""
							return datasets.DatasetInfo(features=self.config.features				)





				def      _lowerCAmelCase       ( self	,				_a				):





							"""simple docstring"""
							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}'				)
							lowerCamelCase       =      dl_manager.download_and_extract(self.config.data_files				)
							if isinstance(_a	,				(str, list, tuple)				):
										lowerCamelCase       =      data_files
										if isinstance(_a	,				_a				):
													lowerCamelCase       =      [files]
										# Use `dl_manager.iter_files` to skip hidden files in an extracted archive
										lowerCamelCase       =      [dl_manager.iter_files(_a				) for file in files]
										return [datasets.SplitGenerator(name=datasets.Split.TRAIN	,				gen_kwargs={"""files""": files}				)]
							lowerCamelCase       =      []
							for split_name, files in data_files.items():
										if isinstance(_a	,				_a				):
													lowerCamelCase       =      [files]
										# Use `dl_manager.iter_files` to skip hidden files in an extracted archive
										lowerCamelCase       =      [dl_manager.iter_files(_a				) 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(_a				):
																with open(_a	,				"""rb"""				) as f:
																			lowerCamelCase       =      datasets.Features.from_arrow_schema(pq.read_schema(_a				)				)
																break
										splits.append(datasets.SplitGenerator(name=_a	,				gen_kwargs={"""files""": files}				)				)
							return splits





				def      _lowerCAmelCase       ( self	,				_a				):





							"""simple docstring"""
							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
										lowerCamelCase       =      table_cast(_a	,				self.info.features.arrow_schema				)
							return pa_table





				def      _lowerCAmelCase       ( self	,				_a				):





							"""simple docstring"""
							lowerCamelCase       =      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(_a				)				):
										with open(_a	,				"""rb"""				) as f:
													lowerCamelCase       =      pq.ParquetFile(_a				)
													try:
																for batch_idx, record_batch in enumerate(
																    parquet_file.iter_batches(batch_size=self.config.batch_size	,				columns=self.config.columns				)				):
																			lowerCamelCase       =      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(_a				)
													except ValueError as e:
																logger.error(f'Failed to read file \'{file}\' with error {type(_a				)}: {e}'				)
																raise









"""simple docstring"""




from functools import lru_cache



def 					a__				(       snake_case__       )		->      set:
			lowerCamelCase       =      2
			lowerCamelCase       =      set()
			while i * i <= n:
						if n % i:
									i += 1
						else:
									n //= i
									factors.add(snake_case__       )
			if n > 1:
						factors.add(snake_case__       )
			return factors



@lru_cache
def 					a__				(       snake_case__       )		->      int:
			return len(unique_prime_factors(snake_case__       )       )



def 					a__				(       snake_case__       )		->      bool:
			return len(set(snake_case__       )       ) in (0, 1)



def 					a__				(       snake_case__       )		->      list:
			lowerCamelCase       =      2

			while True:
						# Increment each value of a generated range
						lowerCamelCase       =      [base + i for i in range(snake_case__       )]

						# Run elements through out unique_prime_factors function
						# Append our target number to the end.
						lowerCamelCase       =      [upf_len(snake_case__       ) for x in group]
						checker.append(snake_case__       )

						# If all numbers in the list are equal, return the group variable.
						if equality(snake_case__       ):
									return group

						# Increment our base variable by 1
						base += 1



def 					a__				(       snake_case__ = 4       )		->      int:
			lowerCamelCase       =      run(snake_case__       )
			return results[0] if len(snake_case__       ) else None


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



