





'''simple docstring'''







import math



class 							__SCREAMING_SNAKE_CASE			:
      '''simple docstring'''



      def __init__(							self    : Optional[int]   ,UpperCamelCase    : Tuple  )		->  Dict:
           _lowercase							:      Optional[int]  						=							len(UpperCamelCase  )
           _lowercase							:      int  						=							[0] * (
               4 * self.N
           )  # approximate the overall size of segment tree with array N
           self.build(1   ,0   ,self.N - 1  )

      def   _lowerCamelCase		(							self    : Dict   ,UpperCamelCase    : int  )		->  Optional[Any]:
           return idx * 2

      def   _lowerCamelCase		(							self    : str   ,UpperCamelCase    : Optional[Any]  )		->  Tuple:
           return idx * 2 + 1

      def   _lowerCamelCase		(							self    : int   ,UpperCamelCase    : Any   ,UpperCamelCase    : List[Any]   ,UpperCamelCase    : int  )		->  Union[str, Any]:  # noqa: E741
           if l == r:
                _lowercase							:      List[str]  						=							A[l]
           else:
                _lowercase							:      List[Any]  						=							(l + r) // 2
                self.build(self.left(UpperCamelCase  )   ,UpperCamelCase   ,UpperCamelCase  )
                self.build(self.right(UpperCamelCase  )   ,mid + 1   ,UpperCamelCase  )
                _lowercase							:      Union[str, Any]  						=							max(self.st[self.left(UpperCamelCase  )]   ,self.st[self.right(UpperCamelCase  )]  )

      def   _lowerCamelCase		(							self    : Optional[Any]   ,UpperCamelCase    : Tuple   ,UpperCamelCase    : Union[str, Any]   ,UpperCamelCase    : Tuple  )		->  int:
           return self.update_recursive(1   ,0   ,self.N - 1   ,a - 1   ,b - 1   ,UpperCamelCase  )

      def   _lowerCamelCase		(							self    : Tuple   ,UpperCamelCase    : List[Any]   ,UpperCamelCase    : str   ,UpperCamelCase    : Any   ,UpperCamelCase    : List[Any]   ,UpperCamelCase    : Any   ,UpperCamelCase    : List[str]  )		->  Optional[Any]:  # noqa: E741
           if r < a or l > b:
                return True
           if l == r:
                _lowercase							:      Union[str, Any]  						=							val
                return True
           _lowercase							:      Tuple  						=							(l + r) // 2
           self.update_recursive(self.left(UpperCamelCase  )   ,UpperCamelCase   ,UpperCamelCase   ,UpperCamelCase   ,UpperCamelCase   ,UpperCamelCase  )
           self.update_recursive(self.right(UpperCamelCase  )   ,mid + 1   ,UpperCamelCase   ,UpperCamelCase   ,UpperCamelCase   ,UpperCamelCase  )
           _lowercase							:      Union[str, Any]  						=							max(self.st[self.left(UpperCamelCase  )]   ,self.st[self.right(UpperCamelCase  )]  )
           return True

      def   _lowerCamelCase		(							self    : Tuple   ,UpperCamelCase    : List[str]   ,UpperCamelCase    : int  )		->  Dict:
           return self.query_recursive(1   ,0   ,self.N - 1   ,a - 1   ,b - 1  )

      def   _lowerCamelCase		(							self    : str   ,UpperCamelCase    : Any   ,UpperCamelCase    : int   ,UpperCamelCase    : Union[str, Any]   ,UpperCamelCase    : Optional[int]   ,UpperCamelCase    : Tuple  )		->  int:  # noqa: E741
           if r < a or l > b:
                return -math.inf
           if l >= a and r <= b:
                return self.st[idx]
           _lowercase							:      str  						=							(l + r) // 2
           _lowercase							:      Optional[int]  						=							self.query_recursive(self.left(UpperCamelCase  )   ,UpperCamelCase   ,UpperCamelCase   ,UpperCamelCase   ,UpperCamelCase  )
           _lowercase							:      Union[str, Any]  						=							self.query_recursive(self.right(UpperCamelCase  )   ,mid + 1   ,UpperCamelCase   ,UpperCamelCase   ,UpperCamelCase  )
           return max(UpperCamelCase   ,UpperCamelCase  )



      def   _lowerCamelCase		(							self    : str  )		->  List[Any]:
           _lowercase							:      List[str]  						=							[]
           for i in range(1   ,N + 1  ):
                show_list += [self.query(UpperCamelCase   ,UpperCamelCase  )]
           print(UpperCamelCase  )


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, 1_11)
    print(segt.query(1, 15))
    segt.update(7, 8, 2_35)
    segt.show_data()






'''simple docstring'''







from __future__ import annotations

import math
import random

def 		SCREAMING_SNAKE_CASE      (					lowerCAmelCase__     :	int       ,  lowerCAmelCase__     :	int       ,  lowerCAmelCase__     :	int)			->						list[int]:

     '''simple docstring'''




     _lowercase							:      Optional[Any]  						=							d * e - 1
     _lowercase							:      Optional[Any]  						=							0
     _lowercase							:      Dict  						=							0
     while p == 0:
          _lowercase							:      Optional[Any]  						=							random.randint(2       ,  n - 1)
          _lowercase							:      int  						=							k
          while True:
               if t % 2 == 0:
                    _lowercase							:      int  						=							t // 2
                    _lowercase							:      Any  						=							(g**t) % n
                    _lowercase							:      Tuple  						=							math.gcd(x - 1       ,  lowerCAmelCase__)
                    if x > 1 and y > 1:
                         _lowercase							:      Union[str, Any]  						=							y
                         _lowercase							:      Dict  						=							n // y
                         break  # find the correct factors
               else:
                    break  # t is not divisible by 2, break and choose another g
     return sorted([p, q])


if __name__ == "__main__":
    import doctest

    doctest.testmod()