





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

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







class 						_lowerCAmelCase(						SCREAMING_SNAKE_CASE__):

  """simple docstring"""







  def __init__( self  ,    UpperCAmelCase  ,    UpperCAmelCase = None  ,    UpperCAmelCase = None  ,    UpperCAmelCase = None  ,    UpperCAmelCase = False  ,    UpperCAmelCase = False  ,    UpperCAmelCase = None  ,    **UpperCAmelCase  ,    )-> str:
     super().__init__(
         _UpperCAmelCase  ,    split=_UpperCAmelCase  ,    features=_UpperCAmelCase  ,    cache_dir=_UpperCAmelCase  ,    keep_in_memory=_UpperCAmelCase  ,    streaming=_UpperCAmelCase  ,    num_proc=_UpperCAmelCase  ,    **_UpperCAmelCase  ,    )
     __A				 =       path_or_paths if isinstance(_UpperCAmelCase  ,    _UpperCAmelCase     ) else {self.split: path_or_paths}
     __A				 =       Csv(
         cache_dir=_UpperCAmelCase  ,    data_files=_UpperCAmelCase  ,    features=_UpperCAmelCase  ,    **_UpperCAmelCase  ,    )





  def 		SCREAMING_SNAKE_CASE__	( self     )-> Optional[int]:
     # Build iterable dataset
     if self.streaming:
        __A				 =       self.builder.as_streaming_dataset(split=self.split     )
     # Build regular (map-style) dataset
     else:
        __A				 =       None
        __A				 =       None
        __A				 =       None
        __A				 =       None

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







class 						_lowerCAmelCase:

  """simple docstring"""







  def __init__( self  ,    UpperCAmelCase  ,    UpperCAmelCase  ,    UpperCAmelCase = None  ,    UpperCAmelCase = None  ,    **UpperCAmelCase  ,    )-> Dict:
     if num_proc is not None and num_proc <= 0:
        raise ValueError(f"num_proc {num_proc} must be an integer > 0."     )

     __A				 =       dataset
     __A				 =       path_or_buf
     __A				 =       batch_size if batch_size else config.DEFAULT_MAX_BATCH_SIZE
     __A				 =       num_proc
     __A				 =       "utf-8"
     __A				 =       to_csv_kwargs

  def 		SCREAMING_SNAKE_CASE__	( self     )-> int:
     __A				 =       self.to_csv_kwargs.pop('''path_or_buf'''  ,    _UpperCAmelCase     )
     __A				 =       self.to_csv_kwargs.pop('''header'''  ,    _UpperCAmelCase     )
     __A				 =       self.to_csv_kwargs.pop('''index'''  ,    _UpperCAmelCase     )

     if isinstance(self.path_or_buf  ,    (str, bytes, os.PathLike)     ):
        with open(self.path_or_buf  ,    '''wb+'''     ) as buffer:
           __A				 =       self._write(file_obj=_UpperCAmelCase  ,    header=_UpperCAmelCase  ,    index=_UpperCAmelCase  ,    **self.to_csv_kwargs     )
     else:
        __A				 =       self._write(file_obj=self.path_or_buf  ,    header=_UpperCAmelCase  ,    index=_UpperCAmelCase  ,    **self.to_csv_kwargs     )
     return written

  def 		SCREAMING_SNAKE_CASE__	( self  ,    UpperCAmelCase     )-> List[Any]:
     __A				 =       args

     __A				 =       query_table(
         table=self.dataset.data  ,    key=slice(_UpperCAmelCase  ,    offset + self.batch_size     )  ,    indices=self.dataset._indices  ,    )
     __A				 =       batch.to_pandas().to_csv(
         path_or_buf=_UpperCAmelCase  ,    header=header if (offset == 0) else False  ,    index=_UpperCAmelCase  ,    **_UpperCAmelCase     )
     return csv_str.encode(self.encoding     )





  def 		SCREAMING_SNAKE_CASE__	( self  ,    UpperCAmelCase  ,    UpperCAmelCase  ,    UpperCAmelCase  ,    **UpperCAmelCase     )-> int:
     __A				 =       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 CSV from Arrow format'''  ,    ):
           __A				 =       self._batch_csv((offset, header, index, to_csv_kwargs)     )
           written += file_obj.write(_UpperCAmelCase     )

     else:
        __A				 =       len(self.dataset     ), self.batch_size
        with multiprocessing.Pool(self.num_proc     ) as pool:
           for csv_str in logging.tqdm(
               pool.imap(
                   self._batch_csv  ,    [(offset, header, index, to_csv_kwargs) for offset in range(0  ,    _UpperCAmelCase  ,    _UpperCAmelCase     )]  ,    )  ,    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 CSV from Arrow format'''  ,    ):
              written += file_obj.write(_UpperCAmelCase     )

     return written








def 				__UpperCamelCase  (		snake_case = 1_0_0     )  ->						int:


   '''simple docstring'''







   __A				 =       [[0 for _ in range(snake_case     )] for _ in range(m + 1     )]
   for i in range(m + 1     ):
      __A				 =       1

   for n in range(m + 1     ):
      for k in range(1    ,	snake_case     ):
         memo[n][k] += memo[n][k - 1]
         if n > k:
            memo[n][k] += memo[n - k - 1][k]

   return memo[m][m - 1] - 1


if __name__ == "__main__":
    print(solution(int(input("""Enter a number: """).strip())))

