


def 						_lowerCAmelCase							(     _lowerCAmelCase			)    ->						Optional[int]:


						'''simple docstring'''






						__snake_case				=		0
						__snake_case				=		len(_lowerCAmelCase			)

						for i in range(n - 1			):
												for j in range(i + 1   ,						_lowerCAmelCase			):
																		if arr[i] > arr[j]:
																								num_inversions += 1

						return num_inversions





def 						_lowerCAmelCase							(     _lowerCAmelCase			)    ->						Dict:


						'''simple docstring'''






						if len(_lowerCAmelCase			) <= 1:
												return arr, 0
						__snake_case				=		len(_lowerCAmelCase			) // 2
						__snake_case				=		arr[0:mid]
						__snake_case				=		arr[mid:]

						__snake_case		,       __snake_case				=		count_inversions_recursive(_lowerCAmelCase			)
						__snake_case		,       __snake_case				=		count_inversions_recursive(_lowerCAmelCase			)
						__snake_case		,       __snake_case				=		_count_cross_inversions(_lowerCAmelCase   ,						_lowerCAmelCase			)

						__snake_case				=		inversion_p + inversions_q + cross_inversions
						return c, num_inversions





def 						_lowerCAmelCase							(     _lowerCAmelCase   ,						_lowerCAmelCase			)    ->						Union[str, Any]:


						'''simple docstring'''






						__snake_case				=		[]
						__snake_case				=		__snake_case				=		__snake_case				=		0
						while i < len(_lowerCAmelCase			) and j < len(_lowerCAmelCase			):
												if p[i] > q[j]:
																		# if P[1] > Q[j], then P[k] > Q[k] for all  i < k <= len(P)
																		# These are all inversions. The claim emerges from the
																		# property that P is sorted.
																		num_inversion += len(_lowerCAmelCase			) - i
																		r.append(q[j]			)
																		j += 1
												else:
																		r.append(p[i]			)
																		i += 1

						if i < len(_lowerCAmelCase			):
												r.extend(p[i:]			)
						else:
												r.extend(q[j:]			)

						return r, num_inversion





def 						_lowerCAmelCase							(     )    ->						Tuple:


						'''simple docstring'''






						__snake_case				=		[10, 2, 1, 5, 5, 2, 11]

						# this arr has 8 inversions:
						# (10, 2), (10, 1), (10, 5), (10, 5), (10, 2), (2, 1), (5, 2), (5, 2)

						__snake_case				=		count_inversions_bf(_lowerCAmelCase			)
						__snake_case		,       __snake_case				=		count_inversions_recursive(_lowerCAmelCase			)

						assert num_inversions_bf == num_inversions_recursive == 8

						print("number of inversions = "   ,						_lowerCAmelCase			)

						# testing an array with zero inversion (a sorted arr_1)

						arr_a.sort()
						__snake_case				=		count_inversions_bf(_lowerCAmelCase			)
						__snake_case		,       __snake_case				=		count_inversions_recursive(_lowerCAmelCase			)

						assert num_inversions_bf == num_inversions_recursive == 0
						print("number of inversions = "   ,						_lowerCAmelCase			)

						# an empty list should also have zero inversions
						__snake_case				=		[]
						__snake_case				=		count_inversions_bf(_lowerCAmelCase			)
						__snake_case		,       __snake_case				=		count_inversions_recursive(_lowerCAmelCase			)

						assert num_inversions_bf == num_inversions_recursive == 0
						print("number of inversions = "   ,						_lowerCAmelCase			)


if __name__ == "__main__":
	main()









import requests
from bsa import BeautifulSoup





def 						_lowerCAmelCase							(     _lowerCAmelCase = "AAPL"			)    ->						str:


						'''simple docstring'''






						__snake_case				=		F'''https://in.finance.yahoo.com/quote/{symbol}?s={symbol}'''
						__snake_case				=		BeautifulSoup(requests.get(_lowerCAmelCase			).text   ,						"html.parser"			)
						__snake_case				=		"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}''')





