'''simple docstring'''

import math







class     _lowercase					:


 '''simple docstring'''






 def __init__(				self       :     str				,	SCREAMING_SNAKE_CASE__       :     Optional[Any]							)  ->   Dict:
  __lowerCAmelCase    							=						len(SCREAMING_SNAKE_CASE__							)
  __lowerCAmelCase    							=						[0] * (
      4 * self.N
  )  # approximate the overall size of segment tree with array N
  self.build(1				,	0				,	self.N - 1							)
 def a (				self       :     List[Any]				,	SCREAMING_SNAKE_CASE__       :     Any							)  ->   int:
  return idx * 2
 def a (				self       :     Tuple				,	SCREAMING_SNAKE_CASE__       :     str							)  ->   Optional[Any]:
  return idx * 2 + 1
 def a (				self       :     Tuple				,	SCREAMING_SNAKE_CASE__       :     int				,	SCREAMING_SNAKE_CASE__       :     int				,	SCREAMING_SNAKE_CASE__       :     int							)  ->   Optional[int]:  # noqa: E741
  if l == r:
   __lowerCAmelCase    							=						A[l]
  else:
   __lowerCAmelCase    							=						(l + r) // 2
   self.build(self.left(SCREAMING_SNAKE_CASE__							)				,	SCREAMING_SNAKE_CASE__				,	SCREAMING_SNAKE_CASE__							)
   self.build(self.right(SCREAMING_SNAKE_CASE__							)				,	mid + 1				,	SCREAMING_SNAKE_CASE__							)
   __lowerCAmelCase    							=						max(self.st[self.left(SCREAMING_SNAKE_CASE__							)]				,	self.st[self.right(SCREAMING_SNAKE_CASE__							)]							)
 def a (				self       :     Tuple				,	SCREAMING_SNAKE_CASE__       :     Optional[int]				,	SCREAMING_SNAKE_CASE__       :     int				,	SCREAMING_SNAKE_CASE__       :     Tuple							)  ->   Union[str, Any]:
  return self.update_recursive(1				,	0				,	self.N - 1				,	a - 1				,	b - 1				,	SCREAMING_SNAKE_CASE__							)
 def a (				self       :     Dict				,	SCREAMING_SNAKE_CASE__       :     Dict				,	SCREAMING_SNAKE_CASE__       :     Union[str, Any]				,	SCREAMING_SNAKE_CASE__       :     Optional[Any]				,	SCREAMING_SNAKE_CASE__       :     Any				,	SCREAMING_SNAKE_CASE__       :     List[str]				,	SCREAMING_SNAKE_CASE__       :     Union[str, Any]							)  ->   List[str]:  # noqa: E741
  if r < a or l > b:
   return True
  if l == r:
   __lowerCAmelCase    							=						val
   return True
  __lowerCAmelCase    							=						(l + r) // 2
  self.update_recursive(self.left(SCREAMING_SNAKE_CASE__							)				,	SCREAMING_SNAKE_CASE__				,	SCREAMING_SNAKE_CASE__				,	SCREAMING_SNAKE_CASE__				,	SCREAMING_SNAKE_CASE__				,	SCREAMING_SNAKE_CASE__							)
  self.update_recursive(self.right(SCREAMING_SNAKE_CASE__							)				,	mid + 1				,	SCREAMING_SNAKE_CASE__				,	SCREAMING_SNAKE_CASE__				,	SCREAMING_SNAKE_CASE__				,	SCREAMING_SNAKE_CASE__							)
  __lowerCAmelCase    							=						max(self.st[self.left(SCREAMING_SNAKE_CASE__							)]				,	self.st[self.right(SCREAMING_SNAKE_CASE__							)]							)
  return True
 def a (				self       :     Optional[int]				,	SCREAMING_SNAKE_CASE__       :     Optional[Any]				,	SCREAMING_SNAKE_CASE__       :     Dict							)  ->   Optional[int]:
  return self.query_recursive(1				,	0				,	self.N - 1				,	a - 1				,	b - 1							)
 def a (				self       :     Union[str, Any]				,	SCREAMING_SNAKE_CASE__       :     List[Any]				,	SCREAMING_SNAKE_CASE__       :     Tuple				,	SCREAMING_SNAKE_CASE__       :     Optional[Any]				,	SCREAMING_SNAKE_CASE__       :     Optional[Any]				,	SCREAMING_SNAKE_CASE__       :     Optional[int]							)  ->   List[Any]:  # noqa: E741
  if r < a or l > b:
   return -math.inf
  if l >= a and r <= b:
   return self.st[idx]
  __lowerCAmelCase    							=						(l + r) // 2
  __lowerCAmelCase    							=						self.query_recursive(self.left(SCREAMING_SNAKE_CASE__							)				,	SCREAMING_SNAKE_CASE__				,	SCREAMING_SNAKE_CASE__				,	SCREAMING_SNAKE_CASE__				,	SCREAMING_SNAKE_CASE__							)
  __lowerCAmelCase    							=						self.query_recursive(self.right(SCREAMING_SNAKE_CASE__							)				,	mid + 1				,	SCREAMING_SNAKE_CASE__				,	SCREAMING_SNAKE_CASE__				,	SCREAMING_SNAKE_CASE__							)
  return max(SCREAMING_SNAKE_CASE__				,	SCREAMING_SNAKE_CASE__							)





 def a (				self       :     Tuple							)  ->   Union[str, Any]:
  __lowerCAmelCase    							=						[]
  for i in range(1				,	N + 1							):
   show_list += [self.query(SCREAMING_SNAKE_CASE__				,	SCREAMING_SNAKE_CASE__							)]
  print(SCREAMING_SNAKE_CASE__							)


if __name__ == "__main__":
    _A      :				Optional[Any] 				=    [1, 2, -4, 7, 3, -5, 6, 11, -20, 9, 14, 15, 5, 2, -8]
    _A      :				Any 				=    15
    _A      :				Any 				=    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'''

from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_sentencepiece_available,
    is_speech_available,
    is_torch_available,
)


_A      :				Optional[int] 				=    {
    '''configuration_speech_to_text_2''': ['''SPEECH_TO_TEXT_2_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''Speech2Text2Config'''],
    '''processing_speech_to_text_2''': ['''Speech2Text2Processor'''],
    '''tokenization_speech_to_text_2''': ['''Speech2Text2Tokenizer'''],
}


try:
 if not is_torch_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 _A      :				Any 				=    [
     '''SPEECH_TO_TEXT_2_PRETRAINED_MODEL_ARCHIVE_LIST''',
     '''Speech2Text2ForCausalLM''',
     '''Speech2Text2PreTrainedModel''',
 ]


if TYPE_CHECKING:
 from .configuration_speech_to_text_a import SPEECH_TO_TEXT_2_PRETRAINED_CONFIG_ARCHIVE_MAP, SpeechaTextaConfig
 from .processing_speech_to_text_a import SpeechaTextaProcessor
 from .tokenization_speech_to_text_a import SpeechaTextaTokenizer

 try:
  if not is_torch_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .modeling_speech_to_text_a import (
      SPEECH_TO_TEXT_2_PRETRAINED_MODEL_ARCHIVE_LIST,
      SpeechaTextaForCausalLM,
      SpeechaTextaPreTrainedModel,
  )

else:
 import sys

 _A      :				Tuple 				=    _LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)






