
'''simple docstring'''



import multiprocessing
import os
from typing import BinaryIO, Optional, Union

import fsspec

from .. import Dataset, Features, NamedSplit, config
from ..formatting import query_table
from ..packaged_modules.json.json import Json
from ..utils import logging
from ..utils.typing import NestedDataStructureLike, PathLike
from .abc import AbstractDatasetReader

class    _a				(_lowerCamelCase):






       def __init__(							self       ,							A__       ,							A__ = None       ,							A__ = None       ,							A__ = None       ,							A__ = False       ,							A__ = False       ,							A__ = None       ,							A__ = None       ,							**A__       ,							)    ->			int:
          super().__init__(
              A__       ,							split=A__       ,							features=A__       ,							cache_dir=A__       ,							keep_in_memory=A__       ,							streaming=A__       ,							num_proc=A__       ,							**A__       ,							)
          _SCREAMING_SNAKE_CASE      =				field
          _SCREAMING_SNAKE_CASE      =				path_or_paths if isinstance(A__       ,							A__      ) else {self.split: path_or_paths}
          _SCREAMING_SNAKE_CASE      =				Json(
              cache_dir=A__       ,							data_files=A__       ,							features=A__       ,							field=A__       ,							**A__       ,							)






       def        UpperCamelCase				(							self      )    ->			int:
          # Build iterable dataset
          if self.streaming:
             _SCREAMING_SNAKE_CASE      =				self.builder.as_streaming_dataset(split=self.split      )
          # Build regular (map-style) dataset
          else:
             _SCREAMING_SNAKE_CASE      =				None
             _SCREAMING_SNAKE_CASE      =				None
             _SCREAMING_SNAKE_CASE      =				None
             _SCREAMING_SNAKE_CASE      =				None

             self.builder.download_and_prepare(
                 download_config=A__       ,							download_mode=A__       ,							verification_mode=A__       ,							base_path=A__       ,							num_proc=self.num_proc       ,							)
             _SCREAMING_SNAKE_CASE      =				self.builder.as_dataset(
                 split=self.split       ,							verification_mode=A__       ,							in_memory=self.keep_in_memory      )
          return dataset






class    _a				:






       def __init__(							self       ,							A__       ,							A__       ,							A__ = None       ,							A__ = None       ,							**A__       ,							)    ->			List[str]:
          if num_proc is not None and num_proc <= 0:
             raise ValueError(F"num_proc {num_proc} must be an integer > 0."      )

          _SCREAMING_SNAKE_CASE      =				dataset
          _SCREAMING_SNAKE_CASE      =				path_or_buf
          _SCREAMING_SNAKE_CASE      =				batch_size if batch_size else config.DEFAULT_MAX_BATCH_SIZE
          _SCREAMING_SNAKE_CASE      =				num_proc
          _SCREAMING_SNAKE_CASE      =				"""utf-8"""
          _SCREAMING_SNAKE_CASE      =				to_json_kwargs






       def        UpperCamelCase				(							self      )    ->			int:
          _SCREAMING_SNAKE_CASE      =				self.to_json_kwargs.pop("""path_or_buf"""       ,							A__      )
          _SCREAMING_SNAKE_CASE      =				self.to_json_kwargs.pop("""orient"""       ,							"""records"""      )
          _SCREAMING_SNAKE_CASE      =				self.to_json_kwargs.pop("""lines"""       ,							True if orient == """records""" else False      )
          _SCREAMING_SNAKE_CASE      =				self.to_json_kwargs.pop("""index"""       ,							False if orient in ["""split""", """table"""] else True      )
          _SCREAMING_SNAKE_CASE      =				self.to_json_kwargs.pop("""compression"""       ,							A__      )

          if compression not in [None, "infer", "gzip", "bz2", "xz"]:
             raise NotImplementedError(F"`datasets` currently does not support {compression} compression"      )

          if isinstance(self.path_or_buf       ,							(str, bytes, os.PathLike)      ):
             with fsspec.open(self.path_or_buf       ,							"""wb"""       ,							compression=A__      ) as buffer:
                _SCREAMING_SNAKE_CASE      =				self._write(file_obj=A__       ,							orient=A__       ,							lines=A__       ,							index=A__       ,							**self.to_json_kwargs      )
          else:
             if compression:
                raise NotImplementedError(
                    F"The compression parameter is not supported when writing to a buffer, but compression={compression}"
                    """ was passed. Please provide a local path instead."""      )
             _SCREAMING_SNAKE_CASE      =				self._write(
                 file_obj=self.path_or_buf       ,							orient=A__       ,							lines=A__       ,							index=A__       ,							**self.to_json_kwargs      )
          return written






       def        UpperCamelCase				(							self       ,							A__      )    ->			List[Any]:
          _SCREAMING_SNAKE_CASE ,							_SCREAMING_SNAKE_CASE ,							_SCREAMING_SNAKE_CASE ,							_SCREAMING_SNAKE_CASE ,							_SCREAMING_SNAKE_CASE      =				args

          _SCREAMING_SNAKE_CASE      =				query_table(
              table=self.dataset.data       ,							key=slice(A__       ,							offset + self.batch_size      )       ,							indices=self.dataset._indices       ,							)
          _SCREAMING_SNAKE_CASE      =				batch.to_pandas().to_json(
              path_or_buf=A__       ,							orient=A__       ,							lines=A__       ,							index=A__       ,							**A__      )
          if not json_str.endswith("""\n"""      ):
             json_str += "\n"
          return json_str.encode(self.encoding      )






       def        UpperCamelCase				(							self       ,							A__       ,							A__       ,							A__       ,							A__       ,							**A__       ,							)    ->			int:
          _SCREAMING_SNAKE_CASE      =				0

          if self.num_proc is None or self.num_proc == 1:
             for offset in logging.tqdm(
                 range(0       ,							len(self.dataset      )       ,							self.batch_size      )       ,							unit="""ba"""       ,							disable=not logging.is_progress_bar_enabled()       ,							desc="""Creating json from Arrow format"""       ,							):
                _SCREAMING_SNAKE_CASE      =				self._batch_json((offset, orient, lines, index, to_json_kwargs)      )
                written += file_obj.write(A__      )
          else:
             _SCREAMING_SNAKE_CASE ,							_SCREAMING_SNAKE_CASE      =				len(self.dataset      ), self.batch_size
             with multiprocessing.Pool(self.num_proc      ) as pool:
                for json_str in logging.tqdm(
                    pool.imap(
                        self._batch_json       ,							[(offset, orient, lines, index, to_json_kwargs) for offset in range(0       ,							A__       ,							A__      )]       ,							)       ,							total=(num_rows // batch_size) + 1 if num_rows % batch_size else num_rows // batch_size       ,							unit="""ba"""       ,							disable=not logging.is_progress_bar_enabled()       ,							desc="""Creating json from Arrow format"""       ,							):
                   written += file_obj.write(A__      )

          return written








'''simple docstring'''



import sys

UpperCamelCase__      :		int       							=  (
    "73167176531330624919225119674426574742355349194934"
    "96983520312774506326239578318016984801869478851843"
    "85861560789112949495459501737958331952853208805511"
    "12540698747158523863050715693290963295227443043557"
    "66896648950445244523161731856403098711121722383113"
    "62229893423380308135336276614282806444486645238749"
    "30358907296290491560440772390713810515859307960866"
    "70172427121883998797908792274921901699720888093776"
    "65727333001053367881220235421809751254540594752243"
    "52584907711670556013604839586446706324415722155397"
    "53697817977846174064955149290862569321978468622482"
    "83972241375657056057490261407972968652414535100474"
    "82166370484403199890008895243450658541227588666881"
    "16427171479924442928230863465674813919123162824586"
    "17866458359124566529476545682848912883142607690042"
    "24219022671055626321111109370544217506941658960408"
    "07198403850962455444362981230987879927244284909188"
    "84580156166097919133875499200524063689912560717606"
    "05886116467109405077541002256983155200055935729725"
    "71636269561882670428252483600823257530420752963450"
)
def    lowerCAmelCase_	(				SCREAMING_SNAKE_CASE_ = N						)     ->     int:




   """simple docstring"""
   _SCREAMING_SNAKE_CASE      =				-sys.maxsize - 1
   for i in range(len(SCREAMING_SNAKE_CASE_						) - 12						):
      _SCREAMING_SNAKE_CASE      =				1
      for j in range(13						):
         product *= int(n[i + j]						)
      if product > largest_product:
         _SCREAMING_SNAKE_CASE      =				product
   return largest_product


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






