from __future__ import annotations

from pathlib import Path






def 					SCREAMING_SNAKE_CASE_			(		lowerCAmelCase_: tuple[int, int] ,	lowerCAmelCase_: tuple[int, int]     ):
      return pointa[0] * pointa[1] - pointa[1] * pointa[0]






def 					SCREAMING_SNAKE_CASE_			(		lowerCAmelCase_: int ,	lowerCAmelCase_: int ,	lowerCAmelCase_: int ,	lowerCAmelCase_: int ,	lowerCAmelCase_: int ,	lowerCAmelCase_: int     ):
      snake_case_     :			tuple[int, int]       =       (xa, ya)
      snake_case_     :			tuple[int, int]       =       (xa - xa, ya - ya)
      snake_case_     :			tuple[int, int]       =       (xa - xa, ya - ya)
      snake_case_     :			float       =       -vector_product(lowerCAmelCase_ ,	lowerCAmelCase_     ) / vector_product(
          lowerCAmelCase_ ,	lowerCAmelCase_     )
      snake_case_     :			float       =       +vector_product(lowerCAmelCase_ ,	lowerCAmelCase_     ) / vector_product(
          lowerCAmelCase_ ,	lowerCAmelCase_     )

      return a > 0 and b > 0 and a + b < 1






def 					SCREAMING_SNAKE_CASE_			(		lowerCAmelCase_: str = "p102_triangles.txt"     ):
      snake_case_     :			str       =       Path(lowerCAmelCase_     ).parent.joinpath(lowerCAmelCase_     ).read_text(encoding="utf-8"     )

      snake_case_     :			list[list[int]]       =       []
      for line in data.strip().split("\n"     ):
            triangles.append([int(lowerCAmelCase_     ) for number in line.split(","     )]     )

      snake_case_     :			int       =       0
      snake_case_     :			list[int]

      for triangle in triangles:
            ret += contains_origin(*lowerCAmelCase_     )

      return ret


if __name__ == "__main__":
     print(F"{solution() = }")




import math



class 					snake_case__       :



   def __init__(				self   :   int			,	A__   :   str   )							->     int:




         '''simple docstring'''




         snake_case_     :			Tuple       =       len(A__   )
         snake_case_     :			Union[str, Any]       =       [0] * (
             4 * self.N
         )  # approximate the overall size of segment tree with array N
         self.build(1			,	0			,	self.N - 1   )



   def 					UpperCAmelCase__       (				self   :   Optional[Any]			,	A__   :   Tuple   )							->     Optional[int]:




         '''simple docstring'''




         return idx * 2



   def 					UpperCAmelCase__       (				self   :   Union[str, Any]			,	A__   :   List[str]   )							->     Dict:




         '''simple docstring'''




         return idx * 2 + 1



   def 					UpperCAmelCase__       (				self   :   str			,	A__   :   Any			,	A__   :   Optional[int]			,	A__   :   Tuple   )							->     List[str]:  # noqa: E741




         '''simple docstring'''




         if l == r:
               snake_case_     :			str       =       A[l]
         else:
               snake_case_     :			List[str]       =       (l + r) // 2
               self.build(self.left(A__   )			,	A__			,	A__   )
               self.build(self.right(A__   )			,	mid + 1			,	A__   )
               snake_case_     :			Union[str, Any]       =       max(self.st[self.left(A__   )]			,	self.st[self.right(A__   )]   )



   def 					UpperCAmelCase__       (				self   :   Optional[Any]			,	A__   :   List[str]			,	A__   :   Union[str, Any]			,	A__   :   str   )							->     int:




         '''simple docstring'''




         return self.update_recursive(1			,	0			,	self.N - 1			,	a - 1			,	b - 1			,	A__   )



   def 					UpperCAmelCase__       (				self   :   Optional[int]			,	A__   :   Optional[Any]			,	A__   :   List[str]			,	A__   :   Optional[Any]			,	A__   :   Union[str, Any]			,	A__   :   List[Any]			,	A__   :   str   )							->     Any:  # noqa: E741




         '''simple docstring'''




         if r < a or l > b:
               return True
         if l == r:
               snake_case_     :			List[str]       =       val
               return True
         snake_case_     :			Dict       =       (l + r) // 2
         self.update_recursive(self.left(A__   )			,	A__			,	A__			,	A__			,	A__			,	A__   )
         self.update_recursive(self.right(A__   )			,	mid + 1			,	A__			,	A__			,	A__			,	A__   )
         snake_case_     :			Tuple       =       max(self.st[self.left(A__   )]			,	self.st[self.right(A__   )]   )
         return True



   def 					UpperCAmelCase__       (				self   :   Optional[int]			,	A__   :   List[Any]			,	A__   :   Optional[Any]   )							->     str:




         '''simple docstring'''




         return self.query_recursive(1			,	0			,	self.N - 1			,	a - 1			,	b - 1   )



   def 					UpperCAmelCase__       (				self   :   Union[str, Any]			,	A__   :   Any			,	A__   :   int			,	A__   :   Tuple			,	A__   :   Tuple			,	A__   :   Dict   )							->     str:  # noqa: E741




         '''simple docstring'''




         if r < a or l > b:
               return -math.inf
         if l >= a and r <= b:
               return self.st[idx]
         snake_case_     :			Dict       =       (l + r) // 2
         snake_case_     :			Optional[Any]       =       self.query_recursive(self.left(A__   )			,	A__			,	A__			,	A__			,	A__   )
         snake_case_     :			Any       =       self.query_recursive(self.right(A__   )			,	mid + 1			,	A__			,	A__			,	A__   )
         return max(A__			,	A__   )



   def 					UpperCAmelCase__       (				self   :   Dict   )							->     Optional[Any]:




         '''simple docstring'''




         snake_case_     :			int       =       []
         for i in range(1			,	N + 1   ):
               show_list += [self.query(A__			,	A__   )]
         print(A__   )


if __name__ == "__main__":
     UpperCAmelCase							=       [1, 2, -4, 7, 3, -5, 6, 1_1, -2_0, 9, 1_4, 1_5, 5, 2, -8]
     UpperCAmelCase							=       1_5
     UpperCAmelCase							=       SegmentTree(A)
     print(segt.query(4, 6))
     print(segt.query(7, 1_1))
     print(segt.query(7, 1_2))
     segt.update(1, 3, 1_1_1)
     print(segt.query(1, 1_5))
     segt.update(7, 8, 2_3_5)
     segt.show_data()



