





'''simple docstring'''


from __future__ import annotations


def 						__a(SCREAMING_SNAKE_CASE_	:       list[int | float]		,							SCREAMING_SNAKE_CASE_	:       int		,							SCREAMING_SNAKE_CASE_	:       int     ):



    '''simple docstring'''





    if len(SCREAMING_SNAKE_CASE_     ) == 0:
        raise ValueError("find_max() arg is an empty sequence"     )
    if (
        left >= len(SCREAMING_SNAKE_CASE_     )
        or left < -len(SCREAMING_SNAKE_CASE_     )
        or right >= len(SCREAMING_SNAKE_CASE_     )
        or right < -len(SCREAMING_SNAKE_CASE_     )
    ):
        raise IndexError("list index out of range"     )
    if left == right:
        return nums[left]
    _lowerCAmelCase						      =   (left + right) >> 1  # the middle
    _lowerCAmelCase						      =   find_max(SCREAMING_SNAKE_CASE_		,							SCREAMING_SNAKE_CASE_		,							SCREAMING_SNAKE_CASE_     )  # find max in range[left, mid]
    _lowerCAmelCase						      =   find_max(SCREAMING_SNAKE_CASE_		,							mid + 1		,							SCREAMING_SNAKE_CASE_     )  # find max in range[mid + 1, right]

    return left_max if left_max >= right_max else right_max


if __name__ == "__main__":
       import doctest

       doctest.testmod(verbose=True)






'''simple docstring'''
class        lowerCAmelCase_  :






       def __init__( self			,     _UpperCamelCase   )->      None:
            _A				=							size
            _A				=							[0] * size
            _A				=							[0] * size






       @staticmethod
       def   UpperCamelCase						( _UpperCamelCase   )->      int:
            return index | (index + 1)






       @staticmethod
       def   UpperCamelCase						( _UpperCamelCase   )->      int:
            return (index & (index + 1)) - 1






       def   UpperCamelCase						( self			,     _UpperCamelCase			,     _UpperCamelCase   )->      None:
            _A				=							value
            while index < self.size:
                 _A				=							self.get_prev(_UpperCamelCase   ) + 1
                 if current_left_border == index:
                      _A				=							value
                 else:
                      _A				=							max(_UpperCamelCase			,     _UpperCamelCase			,     _UpperCamelCase   )
                 _A				=							self.get_next(_UpperCamelCase   )






       def   UpperCamelCase						( self			,     _UpperCamelCase			,     _UpperCamelCase   )->      int:
            right -= 1  # Because of right is exclusive
            _A				=							0
            while left <= right:
                 _A				=							self.get_prev(_UpperCamelCase   )
                 if left <= current_left:
                      _A				=							max(_UpperCamelCase			,     self.tree[right]   )
                      _A				=							current_left
                 else:
                      _A				=							max(_UpperCamelCase			,     self.arr[right]   )
                      right -= 1
            return result


if __name__ == "__main__":
    import doctest

    doctest.testmod()





