






import sys
from dataclasses import dataclass
from typing import TYPE_CHECKING, Dict, List, Optional, Tuple, Union

import pandas as pd
import pyarrow as pa

import datasets
import datasets.config
from datasets.features.features import require_storage_cast
from datasets.table import table_cast


if TYPE_CHECKING:
   import sqlitea

   import sqlalchemy


A_	:	str				=				datasets.utils.logging.get_logger(__name__)




@dataclass
class        _lowerCAmelCase( datasets.BuilderConfig      ):





       """simple docstring"""







       a       :	Union[str, "sqlalchemy.sql.Selectable"]								=None
       a       :	Union[str, "sqlalchemy.engine.Connection", "sqlalchemy.engine.Engine", "sqlite3.Connection"]								=None
       a       :	Optional[Union[str, List[str]]]								=None
       a       :	bool								=True
       a       :	Optional[Union[List, Tuple, Dict]]								=None
       a       :	Optional[Union[List, Dict]]								=None
       a       :	Optional[List[str]]								=None
       a       :	Optional[int]								=10000
       a       :	Optional[datasets.Features]								=None





       def     _a					(      self							):
         if self.sql is None:
           raise ValueError('sql must be specified'							)
         if self.con is None:
           raise ValueError('con must be specified'							)





       def     _a					(      self						,    _lowerCamelCase						,    _lowerCamelCase = None						,    ):
         UpperCamelCase_:      List[str]					   =       config_kwargs.copy()
         # We need to stringify the Selectable object to make its hash deterministic

         # The process of stringifying is explained here: http://docs.sqlalchemy.org/en/latest/faq/sqlexpressions.html
         UpperCamelCase_:      int					   =       config_kwargs['sql']
         if not isinstance(_lowerCamelCase						,    _lowerCamelCase							):
           if datasets.config.SQLALCHEMY_AVAILABLE and "sqlalchemy" in sys.modules:
             import sqlalchemy

             if isinstance(_lowerCamelCase						,    sqlalchemy.sql.Selectable							):
               UpperCamelCase_:      Optional[int]					   =       sqlalchemy.create_engine(config_kwargs['con'].split('://'							)[0] + '://'							)
               UpperCamelCase_:      Any					   =       str(sql.compile(dialect=engine.dialect							)							)
               UpperCamelCase_:      str					   =       sql_str
             else:
               raise TypeError(
                   f'''Supported types for \'sql\' are string and sqlalchemy.sql.Selectable but got {type(_lowerCamelCase							)}: {sql}'''							)
           else:
             raise TypeError(
                 f'''Supported types for \'sql\' are string and sqlalchemy.sql.Selectable but got {type(_lowerCamelCase							)}: {sql}'''							)
         UpperCamelCase_:      Union[str, Any]					   =       config_kwargs['con']
         if not isinstance(_lowerCamelCase						,    _lowerCamelCase							):
           UpperCamelCase_:      int					   =       id(_lowerCamelCase							)
           logger.info(
               f'''SQL connection \'con\' of type {type(_lowerCamelCase							)} couldn\'t be hashed properly. To enable hashing, specify \'con\' as URI string instead.'''							)

         return super().create_config_id(_lowerCamelCase						,    custom_features=_lowerCamelCase							)





       @property
       def     _a					(      self							):
         UpperCamelCase_:      Dict					   =       {
             'index_col': self.index_col,
             'columns': self.columns,
             'params': self.params,
             'coerce_float': self.coerce_float,
             'parse_dates': self.parse_dates,
         }
         return pd_read_sql_kwargs







class        _lowerCAmelCase( datasets.ArrowBasedBuilder      ):





       """simple docstring"""







       a       :	Dict								=SqlConfig





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





       def     _a					(      self						,    _lowerCamelCase							):
         return [datasets.SplitGenerator(name=datasets.Split.TRAIN						,    gen_kwargs={}							)]





       def     _a					(      self						,    _lowerCamelCase							):
         if self.config.features is not None:
           UpperCamelCase_:      str					   =       self.config.features.arrow_schema
           if all(not require_storage_cast(_lowerCamelCase							) for feature in self.config.features.values()							):
             # cheaper cast
             UpperCamelCase_:      int					   =       pa.Table.from_arrays([pa_table[field.name] for field in schema]						,    schema=_lowerCamelCase							)
           else:
             # more expensive cast; allows str <-> int/float or str to Audio for example
             UpperCamelCase_:      Tuple					   =       table_cast(_lowerCamelCase						,    _lowerCamelCase							)
         return pa_table





       def     _a					(      self							):
         UpperCamelCase_:      str					   =       self.config.chunksize
         UpperCamelCase_:      Dict					   =       pd.read_sql(
             self.config.sql						,    self.config.con						,    chunksize=_lowerCamelCase						,    **self.config.pd_read_sql_kwargs							)
         UpperCamelCase_:      List[Any]					   =       [sql_reader] if chunksize is None else sql_reader
         for chunk_idx, df in enumerate(_lowerCamelCase							):
           UpperCamelCase_:      List[Any]					   =       pa.Table.from_pandas(_lowerCamelCase							)
           yield chunk_idx, self._cast_table(_lowerCamelCase							)







from math import factorial

def 						snake_case      (UpperCAmelCase__			,					UpperCAmelCase__						) ->       Dict:
  return factorial(UpperCAmelCase__						) / (factorial(UpperCAmelCase__						) * factorial(n - r						))

def 						snake_case      () ->       Optional[Any]:
  UpperCamelCase_:      int					   =       0

  for i in range(1			,					1_0_1						):
    for j in range(1			,					i + 1						):
      if combinations(UpperCAmelCase__			,					UpperCAmelCase__						) > 1E6:
        total += 1
  return total


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