



"""simple docstring"""
from __future__ import annotations

import math




class 			snake_case_						:






							def __init__(   self			,     a_      ):
									a_     :      int 						=     size
									# approximate the overall size of segment tree with given value
									a_     :      Dict 						=     [0 for i in range(0			,     4 * size      )]
									# create array to store lazy update
									a_     :      Dict 						=     [0 for i in range(0			,     4 * size      )]
									a_     :      int 						=     [0 for i in range(0			,     4 * size      )]  # flag for lazy update






							def snake_case_  (   self			,     a_      ):
									return idx * 2






							def snake_case_  (   self			,     a_      ):
									return idx * 2 + 1






							def snake_case_  (   self			,     a_			,     a_			,     a_			,     a_      ):
									if left_element == right_element:
											a_     :      Any 						=     a[left_element - 1]
									else:
											a_     :      List[Any] 						=     (left_element + right_element) // 2
											self.build(self.left(a_      )			,     a_			,     a_			,     a_      )
											self.build(self.right(a_      )			,     mid + 1			,     a_			,     a_      )
											a_     :      Optional[int] 						=     max(
											    self.segment_tree[self.left(a_      )]			,     self.segment_tree[self.right(a_      )]      )






							def snake_case_  (   self			,     a_			,     a_			,     a_			,     a_			,     a_			,     a_      ):
									if self.flag[idx] is True:
											a_     :      List[str] 						=     self.lazy[idx]
											a_     :      Optional[int] 						=     False
											if left_element != right_element:
													a_     :      List[Any] 						=     self.lazy[idx]
													a_     :      Union[str, Any] 						=     self.lazy[idx]
													a_     :      List[str] 						=     True
													a_     :      int 						=     True

									if right_element < a or left_element > b:
											return True
									if left_element >= a and right_element <= b:
											a_     :      Any 						=     val
											if left_element != right_element:
													a_     :      Union[str, Any] 						=     val
													a_     :      List[str] 						=     val
													a_     :      List[Any] 						=     True
													a_     :      Dict 						=     True
											return True
									a_     :      Optional[Any] 						=     (left_element + right_element) // 2
									self.update(self.left(a_      )			,     a_			,     a_			,     a_			,     a_			,     a_      )
									self.update(self.right(a_      )			,     mid + 1			,     a_			,     a_			,     a_			,     a_      )
									a_     :      Union[str, Any] 						=     max(
									    self.segment_tree[self.left(a_      )]			,     self.segment_tree[self.right(a_      )]      )
									return True






							def snake_case_  (   self			,     a_			,     a_			,     a_			,     a_			,     a_      ):
									if self.flag[idx] is True:
											a_     :      Union[str, Any] 						=     self.lazy[idx]
											a_     :      Dict 						=     False
											if left_element != right_element:
													a_     :      List[Any] 						=     self.lazy[idx]
													a_     :      List[str] 						=     self.lazy[idx]
													a_     :      Optional[int] 						=     True
													a_     :      Optional[int] 						=     True
									if right_element < a or left_element > b:
											return -math.inf
									if left_element >= a and right_element <= b:
											return self.segment_tree[idx]
									a_     :      Any 						=     (left_element + right_element) // 2
									a_     :      str 						=     self.query(self.left(a_      )			,     a_			,     a_			,     a_			,     a_      )
									a_     :      Optional[int] 						=     self.query(self.right(a_      )			,     mid + 1			,     a_			,     a_			,     a_      )
									return max(a_			,     a_      )






							def __str__(   self      ):
									return str([self.query(1			,     1			,     self.size			,     a_			,     a_      ) for i in range(1			,     self.size + 1      )]      )


if __name__ == "__main__":
					SCREAMING_SNAKE_CASE_				= [1, 2, -4, 7, 3, -5, 6, 11, -20, 9, 14, 15, 5, 2, -8]
					SCREAMING_SNAKE_CASE_				= 15
					SCREAMING_SNAKE_CASE_				= SegmentTree(size)
					segt.build(1, 1, size, A)
					print(segt.query(1, 1, size, 4, 6))
					print(segt.query(1, 1, size, 7, 11))
					print(segt.query(1, 1, size, 7, 12))
					segt.update(1, 1, size, 1, 3, 1_11)
					print(segt.query(1, 1, size, 1, 15))
					segt.update(1, 1, size, 7, 8, 2_35)
					print(segt)




"""simple docstring"""
def        lowerCAmelCase_						(							SCREAMING_SNAKE_CASE__, SCREAMING_SNAKE_CASE__	)			->      float:
		_validate_point(SCREAMING_SNAKE_CASE__	)
		_validate_point(SCREAMING_SNAKE_CASE__	)
		if len(SCREAMING_SNAKE_CASE__	) != len(SCREAMING_SNAKE_CASE__	):
				raise ValueError("Both points must be in the same n-dimensional space"	)

		return float(sum(abs(a - b	) for a, b in zip(SCREAMING_SNAKE_CASE__, SCREAMING_SNAKE_CASE__	)	)	)



def        lowerCAmelCase_						(							SCREAMING_SNAKE_CASE__	)			->      None:
		if point:
				if isinstance(SCREAMING_SNAKE_CASE__, SCREAMING_SNAKE_CASE__	):
						for item in point:
								if not isinstance(SCREAMING_SNAKE_CASE__, (int, float)	):
										a_     :      int 						=     (
										    "Expected a list of numbers as input, found "
										    F"""{type(SCREAMING_SNAKE_CASE__	).__name__}"""
										)
										raise TypeError(SCREAMING_SNAKE_CASE__	)
				else:
						a_     :      Dict 						=     F"""Expected a list of numbers as input, found {type(SCREAMING_SNAKE_CASE__	).__name__}"""
						raise TypeError(SCREAMING_SNAKE_CASE__	)
		else:
				raise ValueError("Missing an input"	)



def        lowerCAmelCase_						(							SCREAMING_SNAKE_CASE__, SCREAMING_SNAKE_CASE__	)			->      float:
		_validate_point(SCREAMING_SNAKE_CASE__	)
		_validate_point(SCREAMING_SNAKE_CASE__	)
		if len(SCREAMING_SNAKE_CASE__	) != len(SCREAMING_SNAKE_CASE__	):
				raise ValueError("Both points must be in the same n-dimensional space"	)

		return float(sum(abs(x - y	) for x, y in zip(SCREAMING_SNAKE_CASE__, SCREAMING_SNAKE_CASE__	)	)	)


if __name__ == "__main__":
					import doctest

					doctest.testmod()