





from collections.abc import Sequence
from queue import Queue
class   a_ :

			def __init__(   self   :  Union[str, Any]     , UpperCAmelCase__   :  Any     , UpperCAmelCase__   :  List[Any]     , UpperCAmelCase__   :  Optional[int]     , UpperCAmelCase__   :  List[str]=None     , UpperCAmelCase__   :  Optional[Any]=None						):






							"""simple docstring"""
							snake_case   :					Dict    						=				start
							snake_case   :					Tuple    						=				end
							snake_case   :					Optional[Any]    						=				val
							snake_case   :					Optional[Any]    						=				(start + end) // 2
							snake_case   :					Union[str, Any]    						=				left
							snake_case   :					List[str]    						=				right



			def __repr__(   self   :  Dict						):






							"""simple docstring"""
							return F"SegmentTreeNode(start={self.start}, end={self.end}, val={self.val})"
class   a_ :

			def __init__(   self   :  int     , UpperCAmelCase__   :  Optional[Any]     , UpperCAmelCase__   :  List[Any]						):






							"""simple docstring"""
							snake_case   :					Optional[Any]    						=				collection
							snake_case   :					int    						=				function
							if self.collection:
											snake_case   :					str    						=				self._build_tree(0     , len(a_						) - 1						)

			def      lowerCAmelCase(   self   :  Optional[int]     , UpperCAmelCase__   :  Optional[int]     , UpperCAmelCase__   :  List[Any]						):






							"""simple docstring"""
							self._update_tree(self.root     , a_     , a_						)

			def      lowerCAmelCase(   self   :  Tuple     , UpperCAmelCase__   :  int     , UpperCAmelCase__   :  Union[str, Any]						):






							"""simple docstring"""
							return self._query_range(self.root     , a_     , a_						)

			def      lowerCAmelCase(   self   :  List[Any]     , UpperCAmelCase__   :  str     , UpperCAmelCase__   :  Optional[Any]						):






							"""simple docstring"""
							if start == end:
											return SegmentTreeNode(a_     , a_     , self.collection[start]						)
							snake_case   :					Optional[int]    						=				(start + end) // 2
							snake_case   :					Tuple    						=				self._build_tree(a_     , a_						)
							snake_case   :					Any    						=				self._build_tree(mid + 1     , a_						)
							return SegmentTreeNode(a_     , a_     , self.fn(left.val     , right.val						)     , a_     , a_						)

			def      lowerCAmelCase(   self   :  Tuple     , UpperCAmelCase__   :  Union[str, Any]     , UpperCAmelCase__   :  Any     , UpperCAmelCase__   :  Optional[int]						):






							"""simple docstring"""
							if node.start == i and node.end == i:
											snake_case   :					List[Any]    						=				val
											return
							if i <= node.mid:
											self._update_tree(node.left     , a_     , a_						)
							else:
											self._update_tree(node.right     , a_     , a_						)
							snake_case   :					List[Any]    						=				self.fn(node.left.val     , node.right.val						)

			def      lowerCAmelCase(   self   :  Dict     , UpperCAmelCase__   :  str     , UpperCAmelCase__   :  Tuple     , UpperCAmelCase__   :  int						):






							"""simple docstring"""
							if node.start == i and node.end == j:
											return node.val

							if i <= node.mid:
											if j <= node.mid:
															# range in left child tree
															return self._query_range(node.left     , a_     , a_						)
											else:
															# range in left child tree and right child tree
															return self.fn(
															    self._query_range(node.left     , a_     , node.mid						)     , self._query_range(node.right     , node.mid + 1     , a_						)     , )
							else:
											# range in right child tree
											return self._query_range(node.right     , a_     , a_						)



			def      lowerCAmelCase(   self   :  Any						):






							"""simple docstring"""
							if self.root is not None:
											snake_case   :					Tuple    						=				Queue()
											queue.put(self.root						)
											while not queue.empty():
															snake_case   :					Tuple    						=				queue.get()
															yield node

															if node.left is not None:
																			queue.put(node.left						)

															if node.right is not None:
																			queue.put(node.right						)


if __name__ == "__main__":
			import operator

			for fn in [operator.add, max, min]:
						print('*' * 50)
						_a     :    Optional[Any]         =						SegmentTree([2, 1, 5, 3, 4], fn)
						for node in arr.traverse():
									print(node)
						print()

						arr.update(1, 5)
						for node in arr.traverse():
									print(node)
						print()

						print(arr.query_range(3, 4))  # 7
						print(arr.query_range(2, 2))  # 5
						print(arr.query_range(1, 3))  # 13
						print()



'''simple docstring'''




import sys
import webbrowser

import requests
from bsa import BeautifulSoup
from fake_useragent import UserAgent

if __name__ == "__main__":
  print('Googling.....')
  _a					:			List[Any]							=    'https://www.google.com/search?q=' + ' '.join(sys.argv[1:])
  _a					:			Dict							=    requests.get(url, headers={'UserAgent': UserAgent().random})
  # res.raise_for_status()
  with open('project1a.html', 'wb') as out_file:  # only for knowing the class
    for data in res.iter_content(10_000):
      out_file.write(data)
  _a					:			Any							=    BeautifulSoup(res.text, 'html.parser')
  _a					:			Optional[Any]							=    list(soup.select('.eZt8xd'))[:5]

  print(len(links))
  for link in links:
    if link.text == "Maps":
      webbrowser.open(link.get('href'))
    else:
      webbrowser.open(F'''https://google.com{link.get('href')}''')


