




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




def 		lowerCAmelCase_ (						lowerCamelCase ):
				return binomial_coefficient(2 * node_count						,  lowerCamelCase ) // (node_count + 1)




def 		lowerCAmelCase_ (						lowerCamelCase ):
				if n < 0:
								raise ValueError("""factorial() not defined for negative values""" )
				__magic_name__						:						List[str]										=1
				for i in range(1						,  n + 1 ):
								result *= i
				return result




def 		lowerCAmelCase_ (						lowerCamelCase ):
				return catalan_number(lowerCamelCase ) * factorial(lowerCamelCase )


if __name__ == "__main__":
							UpperCAmelCase_		:					Union[str, Any]          =  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."""
							)








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 SCREAMING_SNAKE_CASE	(			__lowerCAmelCase							,   __lowerCAmelCase				)    ->				Optional[int]:
  snake_case__						= _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 SCREAMING_SNAKE_CASE	(			__lowerCAmelCase							,   __lowerCAmelCase							,   __lowerCAmelCase				)    ->				Dict:
  snake_case__						= _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 SCREAMING_SNAKE_CASE	(			__lowerCAmelCase							,   __lowerCAmelCase				)    ->				List[Any]:
  if expected is RuntimeError:
    with pytest.raises(__lowerCAmelCase				):
      _number_of_shards_in_gen_kwargs(__lowerCAmelCase				)
  else:
    snake_case__						= _number_of_shards_in_gen_kwargs(__lowerCAmelCase				)
    assert out == expected

