
'''simple docstring'''






import heapq
import sys

import numpy as np

A			      =      tuple[int, int]




class     __snake_case		:
					def __init__(     self      ):

									"""simple docstring"""


									lowerCamelCase					:			Dict									= []
									lowerCamelCase					:			Tuple									= set()
					def     UpperCAmelCase_							(     self      ):

									"""simple docstring"""


									if not self.empty():
													return self.elements[0][0]
									else:
													return float('inf'      )
					def     UpperCAmelCase_							(     self      ):

									"""simple docstring"""


									return len(self.elements      ) == 0
					def     UpperCAmelCase_							(     self,    A,    A      ):

									"""simple docstring"""


									if item not in self.set:
													heapq.heappush(self.elements,    (priority, item)      )
													self.set.add(UpperCAmelCase__      )
									else:
													# update
													# print("update", item)
													lowerCamelCase					:			List[Any]									= []
													(lowerCamelCase)					:			str									= heapq.heappop(self.elements      )
													while x != item:
																	temp.append((pri, x)      )
																	(lowerCamelCase)					:			List[Any]									= heapq.heappop(self.elements      )
													temp.append((priority, item)      )
													for pro, xxx in temp:
																	heapq.heappush(self.elements,    (pro, xxx)      )
					def     UpperCAmelCase_							(     self,    A      ):

									"""simple docstring"""


									if item in self.set:
													self.set.remove(UpperCAmelCase__      )
													lowerCamelCase					:			Union[str, Any]									= []
													(lowerCamelCase)					:			List[Any]									= heapq.heappop(self.elements      )
													while x != item:
																	temp.append((pro, x)      )
																	(lowerCamelCase)					:			Union[str, Any]									= heapq.heappop(self.elements      )
													for prito, yyy in temp:
																	heapq.heappush(self.elements,    (prito, yyy)      )
					def     UpperCAmelCase_							(     self      ):

									"""simple docstring"""


									return self.elements[0][1]




					def     UpperCAmelCase_							(     self      ):

									"""simple docstring"""


									(lowerCamelCase)					:			str									= heapq.heappop(self.elements      )
									self.set.remove(UpperCAmelCase__      )
									return (priority, item)





def    UpperCAmelCase							(  UpperCAmelCase__							:							TPos       ,							UpperCAmelCase__							:							TPos):
				# euclidean distance
				lowerCamelCase					:			Tuple									= np.array(UpperCAmelCase__)
				lowerCamelCase					:			Dict									= np.array(UpperCAmelCase__)
				return np.linalg.norm(a - b)





def    UpperCAmelCase							(  UpperCAmelCase__							:							TPos       ,							UpperCAmelCase__							:							TPos):
				# integer division by time variable
				return consistent_heuristic(UpperCAmelCase__       ,							UpperCAmelCase__) // t





def    UpperCAmelCase							(  UpperCAmelCase__							:							TPos       ,							UpperCAmelCase__							:							TPos):
				# manhattan distance
				return abs(p[0] - goal[0]) + abs(p[1] - goal[1])





def    UpperCAmelCase							(  UpperCAmelCase__							:							TPos       ,							UpperCAmelCase__							:							int       ,							UpperCAmelCase__							:							TPos       ,							UpperCAmelCase__							:							dict[TPos, float]):
				lowerCamelCase					:			Tuple									= g_function[start] + Wa * heuristics[i](UpperCAmelCase__       ,							UpperCAmelCase__)
				return ans





def    UpperCAmelCase							(  UpperCAmelCase__							:							Dict       ,							UpperCAmelCase__							:							int       ,							UpperCAmelCase__							:							int):
				lowerCamelCase					:			List[str]									= np.chararray((n, n))
				for i in range(UpperCAmelCase__):
								for j in range(UpperCAmelCase__):
												lowerCamelCase					:			int									= '''*'''

				for i in range(UpperCAmelCase__):
								for j in range(UpperCAmelCase__):
												if (j, (n - 1) - i) in blocks:
																lowerCamelCase					:			Dict									= '''#'''

				lowerCamelCase					:			List[Any]									= '''-'''
				lowerCamelCase					:			Dict									= back_pointer[goal]
				while x != start:
								(lowerCamelCase)					:			str									= x
								# print(x)
								lowerCamelCase					:			List[str]									= '''-'''
								lowerCamelCase					:			int									= back_pointer[x]
				lowerCamelCase					:			Union[str, Any]									= '''-'''

				for i in range(UpperCAmelCase__):
								for j in range(UpperCAmelCase__):
												if (i, j) == (0, n - 1):
																print(grid[i][j]       ,							end=' ')
																print('<-- End position'       ,							end=' ')
												else:
																print(grid[i][j]       ,							end=' ')
								print()
				print('^')
				print('Start position')
				print()
				print('# is an obstacle')
				print('- is the path taken by algorithm')
				print('PATH TAKEN BY THE ALGORITHM IS:-')
				lowerCamelCase					:			List[Any]									= back_pointer[goal]
				while x != start:
								print(UpperCAmelCase__       ,							end=' ')
								lowerCamelCase					:			Dict									= back_pointer[x]
				print(UpperCAmelCase__)
				sys.exit()





def    UpperCAmelCase							(  UpperCAmelCase__							:							TPos):
				if p[0] < 0 or p[0] > n - 1:
								return False
				if p[1] < 0 or p[1] > n - 1:
								return False
				return True





def    UpperCAmelCase							(  UpperCAmelCase__							:							List[str]       ,							UpperCAmelCase__							:							List[str]       ,							UpperCAmelCase__							:							Optional[int]       ,							UpperCAmelCase__							:							List[Any]       ,							UpperCAmelCase__							:							Optional[Any]       ,							UpperCAmelCase__							:							Any       ,							UpperCAmelCase__							:							Tuple       ,							UpperCAmelCase__							:							Optional[int]       ,							):
				for itera in range(UpperCAmelCase__):
								open_list[itera].remove_element(UpperCAmelCase__)
				# print("s", s)
				# print("j", j)
				(lowerCamelCase)					:			str									= s
				lowerCamelCase					:			Union[str, Any]									= (x - 1, y)
				lowerCamelCase					:			Dict									= (x + 1, y)
				lowerCamelCase					:			int									= (x, y + 1)
				lowerCamelCase					:			str									= (x, y - 1)

				for neighbours in [left, right, up, down]:
								if neighbours not in blocks:
												if valid(UpperCAmelCase__) and neighbours not in visited:
																# print("neighbour", neighbours)
																visited.add(UpperCAmelCase__)
																lowerCamelCase					:			Optional[int]									= -1
																lowerCamelCase					:			Optional[Any]									= float('inf')

												if valid(UpperCAmelCase__) and g_function[neighbours] > g_function[s] + 1:
																lowerCamelCase					:			Optional[int]									= g_function[s] + 1
																lowerCamelCase					:			List[Any]									= s
																if neighbours not in close_list_anchor:
																				open_list[0].put(UpperCAmelCase__       ,							key(UpperCAmelCase__       ,							0       ,							UpperCAmelCase__       ,							UpperCAmelCase__))
																				if neighbours not in close_list_inad:
																								for var in range(1       ,							UpperCAmelCase__):
																												if key(UpperCAmelCase__       ,							UpperCAmelCase__       ,							UpperCAmelCase__       ,							UpperCAmelCase__) <= Wa * key(
																												    UpperCAmelCase__       ,							0       ,							UpperCAmelCase__       ,							UpperCAmelCase__):
																																open_list[j].put(
																																    UpperCAmelCase__       ,							key(UpperCAmelCase__       ,							UpperCAmelCase__       ,							UpperCAmelCase__       ,							UpperCAmelCase__))





def    UpperCAmelCase							(  ):
				lowerCamelCase					:			str									= []
				for x in range(1       ,							5):
								for y in range(1       ,							6):
												some_list.append((x, y))

				for x in range(15       ,							20):
								some_list.append((x, 17))

				for x in range(10       ,							19):
								for y in range(1       ,							15):
												some_list.append((x, y))

    # L block
				for x in range(1       ,							4):
								for y in range(12       ,							19):
												some_list.append((x, y))
				for x in range(3       ,							13):
								for y in range(16       ,							19):
												some_list.append((x, y))
				return some_list


A			      =      {0: consistent_heuristic, 1: heuristic_a, 2: heuristic_a}

A			      =      [
    (0, 1),
    (1, 1),
    (2, 1),
    (3, 1),
    (4, 1),
    (5, 1),
    (6, 1),
    (7, 1),
    (8, 1),
    (9, 1),
    (10, 1),
    (11, 1),
    (12, 1),
    (13, 1),
    (14, 1),
    (15, 1),
    (16, 1),
    (17, 1),
    (18, 1),
    (19, 1),
]
A			      =      make_common_ground()


A			      =      blocks_blk
# hyper parameters
A			      =      1
A			      =      1
A			      =      20
A			      =      3  # one consistent and two other inconsistent

# start and end destination
A			      =      (0, 0)
A			      =      (n - 1, n - 1)

A			      =      1





def    UpperCAmelCase							(  UpperCAmelCase__							:							TPos       ,							UpperCAmelCase__							:							TPos       ,							UpperCAmelCase__							:							int):
				lowerCamelCase					:			Any									= {start: 0, goal: float('inf')}
				lowerCamelCase					:			Optional[int]									= {start: -1, goal: -1}
				lowerCamelCase					:			Any									= []
				lowerCamelCase					:			Union[str, Any]									= set()

				for i in range(UpperCAmelCase__):
								open_list.append(PriorityQueue())
								open_list[i].put(UpperCAmelCase__       ,							key(UpperCAmelCase__       ,							UpperCAmelCase__       ,							UpperCAmelCase__       ,							UpperCAmelCase__))

				lowerCamelCase					:			list[int]									= []
				lowerCamelCase					:			list[int]									= []
				while open_list[0].minkey() < float('inf'):
								for i in range(1       ,							UpperCAmelCase__):
												# print(open_list[0].minkey(), open_list[i].minkey())
												if open_list[i].minkey() <= Wa * open_list[0].minkey():
																global t
																t += 1
																if g_function[goal] <= open_list[i].minkey():
																				if g_function[goal] < float('inf'):
																								do_something(UpperCAmelCase__       ,							UpperCAmelCase__       ,							UpperCAmelCase__)
																else:
																				lowerCamelCase					:			Tuple									= open_list[i].top_show()
																				visited.add(UpperCAmelCase__)
																				expand_state(
																				    UpperCAmelCase__       ,							UpperCAmelCase__       ,							UpperCAmelCase__       ,							UpperCAmelCase__       ,							UpperCAmelCase__       ,							UpperCAmelCase__       ,							UpperCAmelCase__       ,							UpperCAmelCase__       ,							)
																				close_list_inad.append(UpperCAmelCase__)
												else:
																if g_function[goal] <= open_list[0].minkey():
																				if g_function[goal] < float('inf'):
																								do_something(UpperCAmelCase__       ,							UpperCAmelCase__       ,							UpperCAmelCase__)
																else:
																				lowerCamelCase					:			Union[str, Any]									= open_list[0].top_show()
																				visited.add(UpperCAmelCase__)
																				expand_state(
																				    UpperCAmelCase__       ,							0       ,							UpperCAmelCase__       ,							UpperCAmelCase__       ,							UpperCAmelCase__       ,							UpperCAmelCase__       ,							UpperCAmelCase__       ,							UpperCAmelCase__       ,							)
																				close_list_anchor.append(UpperCAmelCase__)
				print('No path found to goal')
				print()
				for i in range(n - 1       ,							-1       ,							-1):
								for j in range(UpperCAmelCase__):
												if (j, i) in blocks:
																print('#'       ,							end=' ')
												elif (j, i) in back_pointer:
																if (j, i) == (n - 1, n - 1):
																				print('*'       ,							end=' ')
																else:
																				print('-'       ,							end=' ')
												else:
																print('*'       ,							end=' ')
												if (j, i) == (n - 1, n - 1):
																print('<-- End position'       ,							end=' ')
								print()
				print('^')
				print('Start position')
				print()
				print('# is an obstacle')
				print('- is the path taken by algorithm')


if __name__ == "__main__":
					multi_a_star(start, goal, n_heuristic)


'''simple docstring'''






import requests
from bsa import BeautifulSoup





def    UpperCAmelCase							(  UpperCAmelCase__							:							str = "AAPL"):
				lowerCamelCase					:			List[Any]									= F'''https://in.finance.yahoo.com/quote/{symbol}?s={symbol}'''
				lowerCamelCase					:			Dict									= BeautifulSoup(requests.get(UpperCAmelCase__).text       ,							'html.parser')
				lowerCamelCase					:			Dict									= 'My(6px) Pos(r) smartphone_Mt(6px)'
				return soup.find('div'       ,							class_=class_).find('span').text


if __name__ == "__main__":
					for symbol in "AAPL AMZN IBM GOOG MSFT ORCL".split():
										print(f"""Current {symbol:<4} stock price is {stock_price(symbol):>8}""")
