code: 
  
  import math
  class 					A_   :
  
  
      '''simple docstring'''
  
  
  
  
  
  
      def __init__(self     ,      lowercase__  )     ->      Optional[Any]:
          __UpperCAmelCase									=			len(lowercase__  )
          __UpperCAmelCase									=			[0] * (
              4 * self.N
          )  # approximate the overall size of segment tree with array N
          self.build(1     ,      0     ,      self.N - 1  )
  
  
      def      lowerCAmelCase_						(self     ,      lowercase__  )     ->      Optional[Any]:
          return idx * 2
  
  
      def      lowerCAmelCase_						(self     ,      lowercase__  )     ->      int:
          return idx * 2 + 1
  
  
      def      lowerCAmelCase_						(self     ,      lowercase__     ,      lowercase__     ,      lowercase__  )     ->      str:  # noqa: E741
          if l == r:
              __UpperCAmelCase									=			A[l]
          else:
              __UpperCAmelCase									=			(l + r) // 2
              self.build(self.left(lowercase__  )     ,      lowercase__     ,      lowercase__  )
              self.build(self.right(lowercase__  )     ,      mid + 1     ,      lowercase__  )
              __UpperCAmelCase									=			max(self.st[self.left(lowercase__  )]     ,      self.st[self.right(lowercase__  )]  )
  
  
      def      lowerCAmelCase_						(self     ,      lowercase__     ,      lowercase__     ,      lowercase__  )     ->      Union[str, Any]:
          return self.update_recursive(1     ,      0     ,      self.N - 1     ,      a - 1     ,      b - 1     ,      lowercase__  )
  
  
      def      lowerCAmelCase_						(self     ,      lowercase__     ,      lowercase__     ,      lowercase__     ,      lowercase__     ,      lowercase__     ,      lowercase__  )     ->      Optional[Any]:  # noqa: E741
          if r < a or l > b:
              return True
          if l == r:
              __UpperCAmelCase									=			val
              return True
          __UpperCAmelCase									=			(l + r) // 2
          self.update_recursive(self.left(lowercase__  )     ,      lowercase__     ,      lowercase__     ,      lowercase__     ,      lowercase__     ,      lowercase__  )
          self.update_recursive(self.right(lowercase__  )     ,      mid + 1     ,      lowercase__     ,      lowercase__     ,      lowercase__     ,      lowercase__  )
          __UpperCAmelCase									=			max(self.st[self.left(lowercase__  )]     ,      self.st[self.right(lowercase__  )]  )
          return True
  
  
      def      lowerCAmelCase_						(self     ,      lowercase__     ,      lowercase__  )     ->      List[Any]:
          return self.query_recursive(1     ,      0     ,      self.N - 1     ,      a - 1     ,      b - 1  )
  
  
      def      lowerCAmelCase_						(self     ,      lowercase__     ,      lowercase__     ,      lowercase__     ,      lowercase__     ,      lowercase__  )     ->      Dict:  # noqa: E741
          if r < a or l > b:
              return -math.inf
          if l >= a and r <= b:
              return self.st[idx]
          __UpperCAmelCase									=			(l + r) // 2
          __UpperCAmelCase									=			self.query_recursive(self.left(lowercase__  )     ,      lowercase__     ,      lowercase__     ,      lowercase__     ,      lowercase__  )
          __UpperCAmelCase									=			self.query_recursive(self.right(lowercase__  )     ,      mid + 1     ,      lowercase__     ,      lowercase__     ,      lowercase__  )
          return max(lowercase__     ,      lowercase__  )
  
  
  
  
  
  
      def      lowerCAmelCase_						(self  )     ->      Optional[int]:
          __UpperCAmelCase									=			[]
          for i in range(1     ,      N + 1  ):
              show_list += [self.query(lowercase__     ,      lowercase__  )]
          print(lowercase__  )
  
  
  if __name__ == "__main__":
         A_		:			Optional[Any]										=   [1, 2, -4, 7, 3, -5, 6, 11, -20, 9, 14, 15, 5, 2, -8]
         A_		:			Optional[Any]										=   15
         A_		:			int										=   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()
  
  
  
  
style_context: 
  
  import numpy as np
  
  
  def       __a       (   SCREAMING_SNAKE_CASE      )      ->     Tuple:
  
  
  
  
  
  
      '''simple docstring'''
      __UpperCAmelCase					,     __UpperCAmelCase									=			a.shape
      __UpperCAmelCase									=			min(SCREAMING_SNAKE_CASE       ,   SCREAMING_SNAKE_CASE      )
      __UpperCAmelCase									=			np.eye(SCREAMING_SNAKE_CASE      )
      __UpperCAmelCase									=			a.copy()
  
      for k in range(t - 1      ):
          # select a column of modified matrix A':
          __UpperCAmelCase									=			r[k:, [k]]
          # construct first basis vector
          __UpperCAmelCase									=			np.zeros_like(SCREAMING_SNAKE_CASE      )
          __UpperCAmelCase									=			1.0
          # determine scaling factor
          __UpperCAmelCase									=			np.linalg.norm(SCREAMING_SNAKE_CASE      )
          # construct vector v for Householder reflection
          __UpperCAmelCase									=			x + np.sign(x[0]      ) * alpha * ea
          v /= np.linalg.norm(SCREAMING_SNAKE_CASE      )
  
          # construct the Householder matrix
          __UpperCAmelCase									=			np.eye(m - k      ) - 2.0 * v @ v.T
          # pad with ones and zeros as necessary
          __UpperCAmelCase									=			np.block([[np.eye(SCREAMING_SNAKE_CASE      ), np.zeros((k, m - k)      )], [np.zeros((m - k, k)      ), q_k]]      )
  
          __UpperCAmelCase									=			q @ q_k.T
          __UpperCAmelCase									=			q_k @ r
  
      return q, r
  
  
  if __name__ == "__main__":
         import doctest
  
         doctest.testmod()
  
  
  
  
  