
'''simple docstring'''

def 	_snake_case						(      A_       :    Any     ,		A_       :    Any   ):
  """simple docstring"""







  a_      :	Optional[Any]      =							1  # To kept the Calculated Value
  # Since C(n, k) = C(n, n-k)
  if k > (n - k):
    a_      :	str      =							n - k
  # Calculate C(n,k)
  for i in range(lowerCamelCase__   ):
    result *= n - i
    result //= i + 1
  return result






def 	_snake_case						(      A_       :    List[Any]   ):
  """simple docstring"""







  return binomial_coefficient(2 * node_count     ,		lowerCamelCase__   ) // (node_count + 1)






def 	_snake_case						(      A_       :    Tuple   ):
  """simple docstring"""







  if n < 0:
    raise ValueError("""factorial() not defined for negative values"""   )
  a_      :	str      =							1
  for i in range(1     ,		n + 1   ):
    result *= i
  return result






def 	_snake_case						(      A_       :    Optional[int]   ):
  """simple docstring"""







  return catalan_number(lowerCamelCase__   ) * factorial(lowerCamelCase__   )


if __name__ == "__main__":
    __snake_case:  List[str]								=			int(input("Enter the number of nodes: ").strip() or 0)
    if node_count <= 0:
        raise ValueError("We need some nodes to work with.")
    print(
        F"""Given {node_count} nodes, there are {binary_tree_count(node_count)} """
        F"""binary trees and {catalan_number(node_count)} binary search trees."""
    )

'''simple docstring'''

from typing import List, Optional, TypeVar

from .arrow_dataset import Dataset, _concatenate_map_style_datasets, _interleave_map_style_datasets
from .dataset_dict import DatasetDict, IterableDatasetDict
from .info import DatasetInfo
from .iterable_dataset import IterableDataset, _concatenate_iterable_datasets, _interleave_iterable_datasets
from .splits import NamedSplit
from .utils import logging
from .utils.py_utils import Literal


__snake_case:  Optional[Any]								=			logging.get_logger(__name__)


__snake_case:  Tuple								=			TypeVar("DatasetType", Dataset, IterableDataset)






def 	_snake_case						(      A_       :    List[DatasetType]     ,		A_       :    Optional[List[float]] = None     ,		A_       :    Optional[int] = None     ,		A_       :    Optional[DatasetInfo] = None     ,		A_       :    Optional[NamedSplit] = None     ,		A_       :    Literal["first_exhausted", "all_exhausted"] = "first_exhausted"     ,		):
  """simple docstring"""







  from .arrow_dataset import Dataset
  from .iterable_dataset import IterableDataset

  if not datasets:
    raise ValueError("""Unable to interleave an empty list of datasets."""   )
  for i, dataset in enumerate(A_   ):
    if not isinstance(A_     ,		(Dataset, IterableDataset)   ):
      if isinstance(A_     ,		(DatasetDict, IterableDatasetDict)   ):
        if not dataset:
          raise ValueError(
              f'''Expected a list of Dataset objects or a list of IterableDataset objects, but element at position {i} '''
              """is an empty dataset dictionary."""   )
        raise ValueError(
            f'''Dataset at position {i} has at least one split: {list(A_   )}\n'''
            f'''Please pick one to interleave with the other datasets, for example: dataset[\'{next(iter(A_   )   )}\']'''   )
      raise ValueError(
          f'''Expected a list of Dataset objects or a list of IterableDataset objects, but element at position {i} is a {type(A_   ).__name__}.'''   )
    if i == 0:
      a_      , a_      :	Union[str, Any]      =							(
          (Dataset, IterableDataset) if isinstance(A_     ,		A_   ) else (IterableDataset, Dataset)
      )
    elif not isinstance(A_     ,		A_   ):
      raise ValueError(
          f'''Unable to interleave a {dataset_type.__name__} (at position 0) with a {other_type.__name__} (at position {i}). Expected a list of Dataset objects or a list of IterableDataset objects.'''   )
  if stopping_strategy not in ["first_exhausted", "all_exhausted"]:
    raise ValueError(f'''{stopping_strategy} is not supported. Please enter a valid stopping_strategy.'''   )
  if dataset_type is Dataset:
    return _interleave_map_style_datasets(
        A_     ,		A_     ,		A_     ,		info=A_     ,		split=A_     ,		stopping_strategy=A_   )
  else:
    return _interleave_iterable_datasets(
        A_     ,		A_     ,		A_     ,		info=A_     ,		split=A_     ,		stopping_strategy=A_   )






def 	_snake_case						(      A_       :    List[DatasetType]     ,		A_       :    Optional[DatasetInfo] = None     ,		A_       :    Optional[NamedSplit] = None     ,		A_       :    int = 0     ,		):
  """simple docstring"""







  if not dsets:
    raise ValueError("""Unable to concatenate an empty list of datasets."""   )
  for i, dataset in enumerate(A_   ):
    if not isinstance(A_     ,		(Dataset, IterableDataset)   ):
      if isinstance(A_     ,		(DatasetDict, IterableDatasetDict)   ):
        if not dataset:
          raise ValueError(
              f'''Expected a list of Dataset objects or a list of IterableDataset objects, but element at position {i} '''
              """is an empty dataset dictionary."""   )
        raise ValueError(
            f'''Dataset at position {i} has at least one split: {list(A_   )}\n'''
            f'''Please pick one to interleave with the other datasets, for example: dataset[\'{next(iter(A_   )   )}\']'''   )
      raise ValueError(
          f'''Expected a list of Dataset objects or a list of IterableDataset objects, but element at position {i} is a {type(A_   ).__name__}.'''   )
    if i == 0:
      a_      , a_      :	str      =							(
          (Dataset, IterableDataset) if isinstance(A_     ,		A_   ) else (IterableDataset, Dataset)
      )
    elif not isinstance(A_     ,		A_   ):
      raise ValueError(
          f'''Unable to interleave a {dataset_type.__name__} (at position 0) with a {other_type.__name__} (at position {i}). Expected a list of Dataset objects or a list of IterableDataset objects.'''   )
  if dataset_type is Dataset:
    return _concatenate_map_style_datasets(A_     ,		info=A_     ,		split=A_     ,		axis=A_   )
  else:
    return _concatenate_iterable_datasets(A_     ,		info=A_     ,		split=A_     ,		axis=A_   )


