





"""simple docstring"""



import math






class 	__snake_case      :





 """simple docstring"""


 def __init__(					self      ,		__lowerCamelCase						):



     '''simple docstring'''




     __A					:		Dict						=  len(__lowerCamelCase						)
     __A					:		Tuple						=  [0] * (
         4 * self.N
     )  # approximate the overall size of segment tree with array N
     self.build(1      ,		0      ,		self.N - 1						)

 def       UpperCamelCase__(					self      ,		__lowerCamelCase						):



     '''simple docstring'''




     return idx * 2

 def       UpperCamelCase__(					self      ,		__lowerCamelCase						):



     '''simple docstring'''




     return idx * 2 + 1

 def       UpperCamelCase__(					self      ,		__lowerCamelCase      ,		__lowerCamelCase      ,		__lowerCamelCase						):  # noqa: E741



     '''simple docstring'''




     if l == r:
         __A					:		List[Any]						=  A[l]
     else:
         __A					:		int						=  (l + r) // 2
         self.build(self.left(__lowerCamelCase						)      ,		__lowerCamelCase      ,		__lowerCamelCase						)
         self.build(self.right(__lowerCamelCase						)      ,		mid + 1      ,		__lowerCamelCase						)
         __A					:		Optional[Any]						=  max(self.st[self.left(__lowerCamelCase						)]      ,		self.st[self.right(__lowerCamelCase						)]						)

 def       UpperCamelCase__(					self      ,		__lowerCamelCase      ,		__lowerCamelCase      ,		__lowerCamelCase						):



     '''simple docstring'''




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

 def       UpperCamelCase__(					self      ,		__lowerCamelCase      ,		__lowerCamelCase      ,		__lowerCamelCase      ,		__lowerCamelCase      ,		__lowerCamelCase      ,		__lowerCamelCase						):  # noqa: E741



     '''simple docstring'''




     if r < a or l > b:
         return True
     if l == r:
         __A					:		Dict						=  val
         return True
     __A					:		Optional[Any]						=  (l + r) // 2
     self.update_recursive(self.left(__lowerCamelCase						)      ,		__lowerCamelCase      ,		__lowerCamelCase      ,		__lowerCamelCase      ,		__lowerCamelCase      ,		__lowerCamelCase						)
     self.update_recursive(self.right(__lowerCamelCase						)      ,		mid + 1      ,		__lowerCamelCase      ,		__lowerCamelCase      ,		__lowerCamelCase      ,		__lowerCamelCase						)
     __A					:		Optional[int]						=  max(self.st[self.left(__lowerCamelCase						)]      ,		self.st[self.right(__lowerCamelCase						)]						)
     return True

 def       UpperCamelCase__(					self      ,		__lowerCamelCase      ,		__lowerCamelCase						):



     '''simple docstring'''




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

 def       UpperCamelCase__(					self      ,		__lowerCamelCase      ,		__lowerCamelCase      ,		__lowerCamelCase      ,		__lowerCamelCase      ,		__lowerCamelCase						):  # noqa: E741



     '''simple docstring'''




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







 def       UpperCamelCase__(					self						):



     '''simple docstring'''




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


if __name__ == "__main__":
       a_				=    [1, 2, -4, 7, 3, -5, 6, 11, -20, 9, 14, 15, 5, 2, -8]
       a_				=    15
       a_				=    SegmentTree(A)
       print(segt.query(4, 6))
       print(segt.query(7, 11))
       print(segt.query(7, 12))
       segt.update(1, 3, 111)
       print(segt.query(1, 15))
       segt.update(7, 8, 235)
       segt.show_data()











"""simple docstring"""



def 	__lowercase  (     snake_case_						:						list		)     ->list:



    '''simple docstring'''







    for insert_index, insert_value in enumerate(collection[1:]		):
        __A					:		Any						=  insert_index
        while insert_index >= 0 and insert_value < collection[insert_index]:
            __A					:		List[Any]						=  collection[insert_index]
            insert_index -= 1
        if insert_index != temp_index:
            __A					:		str						=  insert_value
    return collection


if __name__ == "__main__":
       from doctest import testmod

       testmod()

       a_				=    input("""Enter numbers separated by a comma:\n""").strip()
       a_				=    [int(item) for item in user_input.split(""",""")]
       print(f'''{insertion_sort(unsorted) = }''')




