






def   snake_case (UpperCAmelCase__  )	->    "list[int]":






  """simple docstring"""




  if upper_limit < 0:
    raise ValueError('Limit for the Catalan sequence must be ≥ 0'  )

  UpperCamelCase_: Optional[int]   				=    [0] * (upper_limit + 1)

  # Base case: C(0) = C(1) = 1
  UpperCamelCase_: List[str]   				=    1
  if upper_limit > 0:
    UpperCamelCase_: Dict   				=    1

  # Recurrence relation: C(i) = sum(C(j).C(i-j-1)), from j = 0 to i
  for i in range(2     ,   upper_limit + 1  ):
    for j in range(UpperCAmelCase__  ):
      catalan_list[i] += catalan_list[j] * catalan_list[i - j - 1]

  return catalan_list


if __name__ == "__main__":
   print('\n********* Catalan Numbers Using Dynamic Programming ************\n')
   print('\n*** Enter -1 at any time to quit ***')
   print('\nEnter the upper limit (≥ 0) for the Catalan number sequence: ', end='')
   try:
      while True:
         A_		:		Dict		     =			int(input().strip())
         if N < 0:
            print('\n********* Goodbye!! ************')
            break
         else:
            print(F'''The Catalan numbers from 0 through {N} are:''')
            print(catalan_numbers(N))
            print('Try another upper limit for the sequence: ', end='')
   except (NameError, ValueError):
      print('\n********* Invalid input, goodbye! ************\n')

   import doctest

   doctest.testmod()







import numpy as np
from sklearn.datasets import fetch_california_housing
from sklearn.metrics import mean_absolute_error, mean_squared_error
from sklearn.model_selection import train_test_split
from xgboost import XGBRegressor

def   snake_case (UpperCAmelCase__  )	->    tuple:
  return (data["data"], data["target"])

def   snake_case (UpperCAmelCase__     ,   UpperCAmelCase__     ,   UpperCAmelCase__  )	->    np.ndarray:
  UpperCamelCase_: Dict   				=    XGBRegressor(verbosity=0     ,   random_state=4_2  )
  xgb.fit(UpperCAmelCase__     ,   UpperCAmelCase__  )
  # Predict target for test data
  UpperCamelCase_: int   				=    xgb.predict(UpperCAmelCase__  )
  UpperCamelCase_: Any   				=    predictions.reshape(len(UpperCAmelCase__  )     ,   1  )
  return predictions

def   snake_case ()	->    None:
  UpperCamelCase_: Union[str, Any]   				=    fetch_california_housing()
  UpperCamelCase_				,UpperCamelCase_: Tuple   				=    data_handling(UpperCAmelCase__  )
  UpperCamelCase_				,UpperCamelCase_				,UpperCamelCase_				,UpperCamelCase_: Optional[Any]   				=    train_test_split(
      UpperCAmelCase__     ,   UpperCAmelCase__     ,   test_size=0.25     ,   random_state=1  )
  UpperCamelCase_: Union[str, Any]   				=    xgboost(UpperCAmelCase__     ,   UpperCAmelCase__     ,   UpperCAmelCase__  )
  # Error printing
  print(F'''Mean Absolute Error : {mean_absolute_error(UpperCAmelCase__     ,   UpperCAmelCase__  )}'''  )
  print(F'''Mean Square Error  : {mean_squared_error(UpperCAmelCase__     ,   UpperCAmelCase__  )}'''  )


if __name__ == "__main__":
   import doctest

   doctest.testmod(verbose=True)
   main()