'''simple docstring'''




from __future__ import annotations

from collections.abc import Callable
from typing import Any, Generic, TypeVar

_a   :	List[str] 							=					TypeVar("T")






class 		__A       (Generic[T]   ):






       def __init__(      self				,     UpperCamelCase_				,     UpperCamelCase_      ):
              __UpperCAmelCase  :				Any | T       				=		None

              __UpperCAmelCase  :				int       				=		len(lowercase__      )
              __UpperCAmelCase  :				list[T]       				=		[any_type for _ in range(self.N      )] + arr
              __UpperCAmelCase  :				Optional[Any]       				=		fnc
              self.build()






       def 			_snake_case						(      self      ):





              for p in range(self.N - 1				,     0				,     -1      ):
                     __UpperCAmelCase  :				Optional[int]       				=		self.fn(self.st[p * 2]				,     self.st[p * 2 + 1]      )






       def 			_snake_case						(      self				,     UpperCamelCase_				,     UpperCamelCase_      ):
              p += self.N
              __UpperCAmelCase  :				int       				=		v
              while p > 1:
                     __UpperCAmelCase  :				str       				=		p // 2
                     __UpperCAmelCase  :				str       				=		self.fn(self.st[p * 2]				,     self.st[p * 2 + 1]      )







       def 			_snake_case						(      self				,     UpperCamelCase_				,     UpperCamelCase_      ):  # noqa: E741
              __UpperCAmelCase  :				Optional[Any]       				=		l + self.N, r + self.N

              __UpperCAmelCase  :				T | None       				=		None
              while l <= r:
                     if l % 2 == 1:
                            __UpperCAmelCase  :				Any       				=		self.st[l] if res is None else self.fn(lowercase__				,     self.st[l]      )
                     if r % 2 == 0:
                            __UpperCAmelCase  :				List[str]       				=		self.st[r] if res is None else self.fn(lowercase__				,     self.st[r]      )
                     __UpperCAmelCase  :				Any       				=		(l + 1) // 2, (r - 1) // 2
              return res


if __name__ == "__main__":
   from functools import reduce

   _a   :	Any 							=					[1, 10, -2, 9, -3, 8, 4, -7, 5, 6, 11, -12]

   _a   :	Union[str, Any] 							=					{
       0: 7,
       1: 2,
       2: 6,
       3: -14,
       4: 5,
       5: 4,
       6: 7,
       7: -10,
       8: 9,
       9: 10,
       10: 12,
       11: 1,
   }

   _a   :	Optional[int] 							=					SegmentTree(test_array, min)
   _a   :	Dict 							=					SegmentTree(test_array, max)
   _a   :	Tuple 							=					SegmentTree(test_array, lambda a, b: a + b)

   def _lowercase	(      )					->       Optional[int]:





          """simple docstring"""


          for i in range(len(lowerCAmelCase_						)						):
                 for j in range(lowerCAmelCase_							,    len(lowerCAmelCase_						)						):
                        __UpperCAmelCase  :				List[str]       				=		reduce(lowerCAmelCase_							,    test_array[i : j + 1]						)
                        __UpperCAmelCase  :				Optional[int]       				=		reduce(lowerCAmelCase_							,    test_array[i : j + 1]						)
                        __UpperCAmelCase  :				Dict       				=		reduce(lambda lowerCamelCase__							,    lowerCamelCase__						: a + b							,    test_array[i : j + 1]						)
                        assert min_range == min_segment_tree.query(lowerCAmelCase_							,    lowerCAmelCase_						)
                        assert max_range == max_segment_tree.query(lowerCAmelCase_							,    lowerCAmelCase_						)
                        assert sum_range == sum_segment_tree.query(lowerCAmelCase_							,    lowerCAmelCase_						)

   test_all_segments()

   for index, value in test_updates.items():
      _a   :	Tuple 							=					value
      min_segment_tree.update(index, value)
      max_segment_tree.update(index, value)
      sum_segment_tree.update(index, value)
      test_all_segments()







'''simple docstring'''




def _lowercase	(      lowerCamelCase__							,    lowerCamelCase__						)					->       List[str]:





       """simple docstring"""


       __UpperCAmelCase  :				Dict       				=		(boundary[1] - boundary[0]) / steps
       __UpperCAmelCase  :				Tuple       				=		boundary[0]
       __UpperCAmelCase  :				List[str]       				=		boundary[1]
       __UpperCAmelCase  :				List[Any]       				=		make_points(lowerCamelCase__							,    lowerCamelCase__							,    lowerCamelCase__						)
       __UpperCAmelCase  :				int       				=		0.0
       y += (h / 2.0) * f(lowerCamelCase__						)
       for i in x_i:
              # print(i)
              y += h * f(lowerCamelCase__						)
       y += (h / 2.0) * f(lowerCamelCase__						)
       return y

def _lowercase	(      lowerCamelCase__							,    lowerCamelCase__							,    lowerCamelCase__						)					->       List[Any]:





       """simple docstring"""


       __UpperCAmelCase  :				Optional[Any]       				=		a + h
       while x < (b - h):
              yield x
              __UpperCAmelCase  :				List[str]       				=		x + h

def _lowercase	(      lowerCamelCase__						)					->       Optional[Any]:  # enter your function here





       """simple docstring"""


       __UpperCAmelCase  :				str       				=		(x - 0) * (x - 0)
       return y

def _lowercase	(      )					->       int:





       """simple docstring"""


       __UpperCAmelCase  :				Tuple       				=		0.0  # Lower bound of integration
       __UpperCAmelCase  :				Union[str, Any]       				=		1.0  # Upper bound of integration
       __UpperCAmelCase  :				Union[str, Any]       				=		10.0  # define number of steps or resolution
       __UpperCAmelCase  :				Dict       				=		[a, b]  # define boundary of integration
       __UpperCAmelCase  :				Optional[int]       				=		method_a(lowerCamelCase__							,    lowerCamelCase__						)
       print(f"""y = {y}"""						)


if __name__ == "__main__":
   main()






