






"""simple docstring"""





import pytest

from datasets.utils.sharding import _distribute_shards, _number_of_shards_in_gen_kwargs, _split_gen_kwargs







@pytest.mark.parametrize(
    'kwargs, expected'		,				[
        ({'num_shards': 0, 'max_num_jobs': 1}, []),
        ({'num_shards': 10, 'max_num_jobs': 1}, [range(10 )]),
        ({'num_shards': 10, 'max_num_jobs': 10}, [range(_lowerCamelCase		,				i + 1 ) for i in range(10 )]),
        ({'num_shards': 1, 'max_num_jobs': 10}, [range(1 )]),
        ({'num_shards': 10, 'max_num_jobs': 3}, [range(0		,				4 ), range(4		,				7 ), range(7		,				10 )]),
        ({'num_shards': 3, 'max_num_jobs': 10}, [range(0		,				1 ), range(1		,				2 ), range(2		,				3 )]),
    ]		,				)
def      lowerCamelCase__       (							_lowerCamelCase       :		Tuple		,				_lowerCamelCase       :		List[Any] )      ->				Tuple:
  lowerCamelCase_         =						_distribute_shards(**_lowerCamelCase )
  assert out == expected







@pytest.mark.parametrize(
    'gen_kwargs, max_num_jobs, expected'		,				[
        ({'foo': 0}, 10, [{'foo': 0}]),
        ({'shards': [0, 1, 2, 3]}, 1, [{'shards': [0, 1, 2, 3]}]),
        ({'shards': [0, 1, 2, 3]}, 4, [{'shards': [0]}, {'shards': [1]}, {'shards': [2]}, {'shards': [3]}]),
        ({'shards': [0, 1]}, 4, [{'shards': [0]}, {'shards': [1]}]),
        ({'shards': [0, 1, 2, 3]}, 2, [{'shards': [0, 1]}, {'shards': [2, 3]}]),
    ]		,				)
def      lowerCamelCase__       (							_lowerCamelCase       :		Union[str, Any]		,				_lowerCamelCase       :		Any		,				_lowerCamelCase       :		Union[str, Any] )      ->				Optional[int]:
  lowerCamelCase_         =						_split_gen_kwargs(_lowerCamelCase		,				_lowerCamelCase )
  assert out == expected







@pytest.mark.parametrize(
    'gen_kwargs, expected'		,				[
        ({'foo': 0}, 1),
        ({'shards': [0]}, 1),
        ({'shards': [0, 1, 2, 3]}, 4),
        ({'shards': [0, 1, 2, 3], 'foo': 0}, 4),
        ({'shards': [0, 1, 2, 3], 'other': (0, 1)}, 4),
        ({'shards': [0, 1, 2, 3], 'shards2': [0, 1]}, RuntimeError),
    ]		,				)
def      lowerCamelCase__       (							_lowerCamelCase       :		Tuple		,				_lowerCamelCase       :		List[Any] )      ->				Optional[int]:
  if expected is RuntimeError:
    with pytest.raises(_lowerCamelCase ):
      _number_of_shards_in_gen_kwargs(_lowerCamelCase )
  else:
    lowerCamelCase_         =						_number_of_shards_in_gen_kwargs(_lowerCamelCase )
    assert out == expected












"""simple docstring"""





def      lowerCamelCase__       (							_lowerCamelCase       :		int		,				_lowerCamelCase       :		int )      ->				int:
  lowerCamelCase_         =						1  # To kept the Calculated Value
  # Since C(n, k) = C(n, n-k)
  if k > (n - k):
    lowerCamelCase_         =						n - k
  # Calculate C(n,k)
  for i in range(_lowerCamelCase ):
    result *= n - i
    result //= i + 1
  return result







def      lowerCamelCase__       (							_lowerCamelCase       :		int )      ->				int:
  return binomial_coefficient(2 * node_count		,				_lowerCamelCase ) // (node_count + 1)







def      lowerCamelCase__       (							_lowerCamelCase       :		int )      ->				int:
  if n < 0:
    raise ValueError('factorial() not defined for negative values' )
  lowerCamelCase_         =						1
  for i in range(1		,				n + 1 ):
    result *= i
  return result







def      lowerCamelCase__       (							_lowerCamelCase       :		int )      ->				int:
  return catalan_number(_lowerCamelCase ) * factorial(_lowerCamelCase )


if __name__ == "__main__":
  _SCREAMING_SNAKE_CASE					:				int					    =						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.'''
  )




