




import math



def 					UpperCAmelCase__     (   lowerCamelCase      ):
  lowercase			:List[Any]							=  math.loga(math.sqrt(4 * positive_integer + 1      ) / 2 + 1 / 2      )

  return exponent == int(lowerCamelCase      )



def 					UpperCAmelCase__     (   lowerCamelCase = 1 / 12345      ):
  lowercase			:Tuple							=  0
  lowercase			:List[str]							=  0

  lowercase			:str							=  3
  while True:
    lowercase			:List[Any]							=  (integer**2 - 1) / 4
    # if candidate is an integer, then there is a partition for k
    if partition_candidate == int(lowerCamelCase      ):
      lowercase			:Union[str, Any]							=  int(lowerCamelCase      )
      total_partitions += 1
      if check_partition_perfect(lowerCamelCase      ):
        perfect_partitions += 1
    if perfect_partitions > 0:
      if perfect_partitions / total_partitions < max_proportion:
        return int(lowerCamelCase      )
    integer += 1


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









import itertools
from dataclasses import dataclass
from typing import Optional

import pandas as pd
import pyarrow as pa

import datasets
from datasets.table import table_cast




@dataclass
class       __lowerCAmelCase				(							datasets.BuilderConfig):
       _a           =  None







class       __lowerCAmelCase				(							datasets.ArrowBasedBuilder):
       _a           =  PandasConfig






       def     SCREAMING_SNAKE_CASE			(      self:    Any ):
         return datasets.DatasetInfo(features=self.config.features )






       def     SCREAMING_SNAKE_CASE			(      self:    str				,    _lowerCAmelCase:    List[str] ):
         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}" )
         lowercase			:int							=  dl_manager.download_and_extract(self.config.data_files )
         if isinstance(_lowerCAmelCase				,    (str, list, tuple) ):
           lowercase			:Union[str, Any]							=  data_files
           if isinstance(_lowerCAmelCase				,    _lowerCAmelCase ):
             lowercase			:str							=  [files]
           # Use `dl_manager.iter_files` to skip hidden files in an extracted archive
           lowercase			:Optional[int]							=  [dl_manager.iter_files(_lowerCAmelCase ) for file in files]
           return [datasets.SplitGenerator(name=datasets.Split.TRAIN				,    gen_kwargs={"files": files} )]
         lowercase			:List[Any]							=  []
         for split_name, files in data_files.items():
           if isinstance(_lowerCAmelCase				,    _lowerCAmelCase ):
             lowercase			:Optional[Any]							=  [files]
           # Use `dl_manager.iter_files` to skip hidden files in an extracted archive
           lowercase			:Optional[Any]							=  [dl_manager.iter_files(_lowerCAmelCase ) for file in files]
           splits.append(datasets.SplitGenerator(name=_lowerCAmelCase				,    gen_kwargs={"files": files} ) )
         return splits






       def     SCREAMING_SNAKE_CASE			(      self:    int				,    _lowerCAmelCase:    pa.Table ):
         if self.config.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
           lowercase			:Any							=  table_cast(_lowerCAmelCase				,    self.config.features.arrow_schema )
         return pa_table






       def     SCREAMING_SNAKE_CASE			(      self:    Optional[int]				,    _lowerCAmelCase:    Union[str, Any] ):
         for i, file in enumerate(itertools.chain.from_iterable(_lowerCAmelCase ) ):
           with open(_lowerCAmelCase				,    "rb" ) as f:
             lowercase			:int							=  pa.Table.from_pandas(pd.read_pickle(_lowerCAmelCase ) )
             yield i, self._cast_table(_lowerCAmelCase )



