'''simple docstring'''

from collections.abc import Sequence
from queue import Queue







class __a :





   def __init__(					self				:			str				,lowerCamelCase				:			Tuple				,lowerCamelCase				:			Optional[int]				,lowerCamelCase				:			List[str]				,lowerCamelCase				:			Optional[int]=None				,lowerCamelCase				:			List[str]=None    ):

      '''simple docstring'''

      __SCREAMING_SNAKE_CASE      							=       start
      __SCREAMING_SNAKE_CASE      							=       end
      __SCREAMING_SNAKE_CASE      							=       val
      __SCREAMING_SNAKE_CASE      							=       (start + end) // 2
      __SCREAMING_SNAKE_CASE      							=       left
      __SCREAMING_SNAKE_CASE      							=       right





   def __repr__(					self				:			List[str]    ):

      '''simple docstring'''

      return f"""SegmentTreeNode(start={self.start}, end={self.end}, val={self.val})"""







class __a :





   def __init__(					self				:			int				,lowerCamelCase				:			Sequence				,lowerCamelCase				:			int    ):

      '''simple docstring'''

      __SCREAMING_SNAKE_CASE      							=       collection
      __SCREAMING_SNAKE_CASE      							=       function
      if self.collection:
         __SCREAMING_SNAKE_CASE      							=       self._build_tree(0				,len(lowerCamelCase    ) - 1    )





   def      UpperCAmelCase__     (					self				:			Optional[Any]				,lowerCamelCase				:			Tuple				,lowerCamelCase				:			int    ):

      '''simple docstring'''

      self._update_tree(self.root				,lowerCamelCase				,lowerCamelCase    )





   def      UpperCAmelCase__     (					self				:			Dict				,lowerCamelCase				:			List[Any]				,lowerCamelCase				:			List[Any]    ):

      '''simple docstring'''

      return self._query_range(self.root				,lowerCamelCase				,lowerCamelCase    )





   def      UpperCAmelCase__     (					self				:			str				,lowerCamelCase				:			Dict				,lowerCamelCase				:			Optional[Any]    ):

      '''simple docstring'''

      if start == end:
         return SegmentTreeNode(lowerCamelCase				,lowerCamelCase				,self.collection[start]    )
      __SCREAMING_SNAKE_CASE      							=       (start + end) // 2
      __SCREAMING_SNAKE_CASE      							=       self._build_tree(lowerCamelCase				,lowerCamelCase    )
      __SCREAMING_SNAKE_CASE      							=       self._build_tree(mid + 1				,lowerCamelCase    )
      return SegmentTreeNode(lowerCamelCase				,lowerCamelCase				,self.fn(left.val				,right.val    )				,lowerCamelCase				,lowerCamelCase    )





   def      UpperCAmelCase__     (					self				:			Dict				,lowerCamelCase				:			Optional[Any]				,lowerCamelCase				:			str				,lowerCamelCase				:			str    ):

      '''simple docstring'''

      if node.start == i and node.end == i:
         __SCREAMING_SNAKE_CASE      							=       val
         return
      if i <= node.mid:
         self._update_tree(node.left				,lowerCamelCase				,lowerCamelCase    )
      else:
         self._update_tree(node.right				,lowerCamelCase				,lowerCamelCase    )
      __SCREAMING_SNAKE_CASE      							=       self.fn(node.left.val				,node.right.val    )





   def      UpperCAmelCase__     (					self				:			int				,lowerCamelCase				:			List[Any]				,lowerCamelCase				:			List[str]				,lowerCamelCase				:			str    ):

      '''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				,lowerCamelCase				,lowerCamelCase    )
         else:
            # range in left child tree and right child tree
            return self.fn(
                self._query_range(node.left				,lowerCamelCase				,node.mid    )				,self._query_range(node.right				,node.mid + 1				,lowerCamelCase    )				,)
      else:
         # range in right child tree
         return self._query_range(node.right				,lowerCamelCase				,lowerCamelCase    )





   def      UpperCAmelCase__     (					self				:			Optional[int]    ):

      '''simple docstring'''

      if self.root is not None:
         __SCREAMING_SNAKE_CASE      							=       Queue()
         queue.put(self.root    )
         while not queue.empty():
            __SCREAMING_SNAKE_CASE      							=       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        =						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 requests
from bsa import BeautifulSoup

def 						__magic_name__       (							__UpperCAmelCase							,	__UpperCAmelCase      )						->					str:

   '''simple docstring'''







   __SCREAMING_SNAKE_CASE      							=       BeautifulSoup(requests.get(__UpperCAmelCase							,	params=__UpperCAmelCase      ).content							,	"""html.parser"""      )
   __SCREAMING_SNAKE_CASE      							=       soup.find("""div"""							,	attrs={"""class""": """gs_ri"""}      )
   __SCREAMING_SNAKE_CASE      							=       div.find("""div"""							,	attrs={"""class""": """gs_fl"""}      ).find_all("""a"""      )
   return anchors[2].get_text()


if __name__ == "__main__":
    a        =						{
        "title": (
            "Precisely geometry controlled microsupercapacitors for ultrahigh areal "
            "capacitance, volumetric capacitance, and energy density"
        ),
        "journal": "Chem. Mater.",
        "volume": 30,
        "pages": "3979-3990",
        "year": 2018,
        "hl": "en",
    }
    print(get_citation("https://scholar.google.com/scholar_lookup", params=params))





