


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




									"""simple docstring"""





									_UpperCAmelCase					=      ''
									_UpperCAmelCase					=      ''
									_UpperCAmelCase					=      []
		def      UpperCAmelCase__    (      self      ,   _SCREAMING_SNAKE_CASE      ,   _SCREAMING_SNAKE_CASE						)			->	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]:
																							_UpperCAmelCase					=      self.__min_dist_top_down_dp(m - 1      ,   n - 1						)
																else:
																							_UpperCAmelCase					=      self.__min_dist_top_down_dp(_SCREAMING_SNAKE_CASE      ,   n - 1						)
																							_UpperCAmelCase					=      self.__min_dist_top_down_dp(m - 1      ,   _SCREAMING_SNAKE_CASE						)
																							_UpperCAmelCase					=      self.__min_dist_top_down_dp(m - 1      ,   n - 1						)
																							_UpperCAmelCase					=      1 + min(_SCREAMING_SNAKE_CASE      ,   _SCREAMING_SNAKE_CASE      ,   _SCREAMING_SNAKE_CASE						)

																return self.dp[m][n]
		def      UpperCAmelCase__    (      self      ,   _SCREAMING_SNAKE_CASE      ,   _SCREAMING_SNAKE_CASE						)			->	int:




									"""simple docstring"""





									_UpperCAmelCase					=      worda
									_UpperCAmelCase					=      worda
									_UpperCAmelCase					=      [[-1 for _ in range(len(_SCREAMING_SNAKE_CASE						)						)] for _ in range(len(_SCREAMING_SNAKE_CASE						)						)]

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






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




									"""simple docstring"""





									_UpperCAmelCase					=      worda
									_UpperCAmelCase					=      worda
									_UpperCAmelCase					=      len(_SCREAMING_SNAKE_CASE						)
									_UpperCAmelCase					=      len(_SCREAMING_SNAKE_CASE						)
									_UpperCAmelCase					=      [[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
																														_UpperCAmelCase					=      j
																							elif j == 0:  # second string is empty
																														_UpperCAmelCase					=      i
																							elif worda[i - 1] == worda[j - 1]:  # last characters are equal
																														_UpperCAmelCase					=      self.dp[i - 1][j - 1]
																							else:
																														_UpperCAmelCase					=      self.dp[i][j - 1]
																														_UpperCAmelCase					=      self.dp[i - 1][j]
																														_UpperCAmelCase					=      self.dp[i - 1][j - 1]
																														_UpperCAmelCase					=      1 + min(_SCREAMING_SNAKE_CASE      ,   _SCREAMING_SNAKE_CASE      ,   _SCREAMING_SNAKE_CASE						)
									return self.dp[m][n]


if __name__ == "__main__":
						lowerCAmelCase__  :Optional[Any]             =							EditDistance()

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

						lowerCAmelCase__  :List[Any]             =							input('''Enter the first string: ''').strip()
						lowerCAmelCase__  :Dict             =							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 ***************''')




import math
import random

def 	lowerCAmelCase__			(      a__:		float      ,  a__:		bool = False	)  ->		float:


							'''simple docstring'''





							if deriv:
														return value * (1 - value)
							return 1 / (1 + math.exp(-value	))


# Initial Value
lowerCAmelCase__  :Optional[Any]             =							0.02

def 	lowerCAmelCase__			(      a__:		int      ,  a__:		int	)  ->		float:


							'''simple docstring'''





							_UpperCAmelCase					=      float(2 * (random.randint(1      ,  1_0_0	)) - 1	)

							for _ in range(a__	):
														# Forward propagation
														_UpperCAmelCase					=      sigmoid_function(INITIAL_VALUE * weight	)
														# How much did we miss?
														_UpperCAmelCase					=      (expected / 1_0_0) - layer_a
														# Error delta
														_UpperCAmelCase					=      layer_1_error * sigmoid_function(a__      ,  a__	)
														# Update weight
														weight += INITIAL_VALUE * layer_1_delta

							return layer_a * 1_0_0


if __name__ == "__main__":
		import doctest

		doctest.testmod()

		lowerCAmelCase__  :List[Any]             =							int(input('''Expected value: '''))
		lowerCAmelCase__  :Any             =							int(input('''Number of propagations: '''))
		print(forward_propagation(expected, number_propagations))
