



"""simple docstring"""





class  _lowerCAmelCase     :





		"""simple docstring"""






		def __init__(       self )			->    Optional[Any]:







								'''simple docstring'''

								snake_case_ :			int            =      """"""
								snake_case_ :			Optional[int]            =      """"""
								snake_case_ :			Optional[int]            =      []





		def  UpperCAmelCase__				(       self				,     _lowercase				,     _lowercase )			->    int:







								'''simple docstring'''

								if m == -1:
														return n + 1
								elif n == -1:
														return m + 1
								elif self.dp[m][n] > -1:
														return self.dp[m][n]
								else:
														if self.worda[m] == self.worda[n]:
																				snake_case_ :			Dict            =      self.__min_dist_top_down_dp(m - 1				,     n - 1 )
														else:
																				snake_case_ :			List[Any]            =      self.__min_dist_top_down_dp(_lowercase				,     n - 1 )
																				snake_case_ :			Optional[Any]            =      self.__min_dist_top_down_dp(m - 1				,     _lowercase )
																				snake_case_ :			Union[str, Any]            =      self.__min_dist_top_down_dp(m - 1				,     n - 1 )
																				snake_case_ :			List[str]            =      1 + min(_lowercase				,     _lowercase				,     _lowercase )

														return self.dp[m][n]





		def  UpperCAmelCase__				(       self				,     _lowercase				,     _lowercase )			->    int:







								'''simple docstring'''

								snake_case_ :			Optional[Any]            =      worda
								snake_case_ :			int            =      worda
								snake_case_ :			List[str]            =      [[-1 for _ in range(len(_lowercase ) )] for _ in range(len(_lowercase ) )]

								return self.__min_dist_top_down_dp(len(_lowercase ) - 1				,     len(_lowercase ) - 1 )





		def  UpperCAmelCase__				(       self				,     _lowercase				,     _lowercase )			->    int:







								'''simple docstring'''

								snake_case_ :			str            =      worda
								snake_case_ :			List[str]            =      worda
								snake_case_ :			Any            =      len(_lowercase )
								snake_case_ :			str            =      len(_lowercase )
								snake_case_ :			str            =      [[0 for _ in range(n + 1 )] for _ in range(m + 1 )]

								for i in range(m + 1 ):
														for j in range(n + 1 ):
																				if i == 0:  # first string is empty
																										snake_case_ :			List[str]            =      j
																				elif j == 0:  # second string is empty
																										snake_case_ :			Dict            =      i
																				elif worda[i - 1] == worda[j - 1]:  # last characters are equal
																										snake_case_ :			List[str]            =      self.dp[i - 1][j - 1]
																				else:
																										snake_case_ :			Any            =      self.dp[i][j - 1]
																										snake_case_ :			Tuple            =      self.dp[i - 1][j]
																										snake_case_ :			int            =      self.dp[i - 1][j - 1]
																										snake_case_ :			Tuple            =      1 + min(_lowercase				,     _lowercase				,     _lowercase )
								return self.dp[m][n]


if __name__ == "__main__":
					__lowerCAmelCase							:       Tuple          =       EditDistance()

					print('''****************** Testing Edit Distance DP Algorithm ******************''')
					print()

					__lowerCAmelCase							:       str          =       input('''Enter the first string: ''').strip()
					__lowerCAmelCase							:       Optional[int]          =       input('''Enter the second string: ''').strip()

					print()
					print(F'''The minimum edit distance is: {solver.min_dist_top_down(Sa, Sa)}''')
					print(F'''The minimum edit distance is: {solver.min_dist_bottom_up(Sa, Sa)}''')
					print()
					print('''*************** End of Testing Edit Distance DP Algorithm ***************''')








'''simple docstring'''




def 		__A		(  lowerCamelCase_			,			lowerCamelCase_	):


		"""simple docstring"""



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



def 		__A		(  lowerCamelCase_	):


		"""simple docstring"""



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



def 		__A		(  lowerCamelCase_	):


		"""simple docstring"""



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



def 		__A		(  lowerCamelCase_	):


		"""simple docstring"""



		return catalan_number(lowerCamelCase_	) * factorial(lowerCamelCase_	)


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



