
"""simple docstring"""




from __future__ import annotations

import random
import string







class 						lowercase:



     def __init__(       self    ,							__SCREAMING_SNAKE_CASE = None      )		->    Tuple:







         """simple docstring"""



         a__    = passcode or self.__passcode_creator()
         a__    = self.__make_key_list()
         a__    = self.__make_shift_key()



     def __str__(       self      )		->    List[str]:







         """simple docstring"""



         return "".join(self.__passcode      )



     def  lowercase__     (       self    ,							__SCREAMING_SNAKE_CASE      )		->    Tuple:







         """simple docstring"""



         for i in range(1    ,							len(__SCREAMING_SNAKE_CASE      )    ,							2      ):
             iterlist[i] *= -1
         return iterlist



     def  lowercase__     (       self      )		->    Union[str, Any]:







         """simple docstring"""



         a__    = string.ascii_letters + string.digits
         a__    = [random.choice(__SCREAMING_SNAKE_CASE      ) for _ in range(random.randint(1_0    ,							2_0      )      )]
         return password



     def  lowercase__     (       self      )		->    List[Any]:







         """simple docstring"""



         a__    = (
             string.ascii_letters + string.digits + string.punctuation + ' \t\n'
         )

         a__    = []

         # creates points known as breakpoints to break the key_list_options at those
         # points and pivot each substring
         a__    = sorted(set(self.__passcode      )      )
         a__    = []

         # algorithm for creating a new shuffled list, keys_l, out of key_list_options
         for i in key_list_options:
             temp_list.extend(__SCREAMING_SNAKE_CASE      )

             # checking breakpoints at which to pivot temporary sublist and add it into
             # keys_l
             if i in breakpoints or i == key_list_options[-1]:
                 keys_l.extend(temp_list[::-1]      )
                 temp_list.clear()

        # returning a shuffled keys_l to prevent brute force guessing of shift key
         return keys_l



     def  lowercase__     (       self      )		->    Optional[int]:







         """simple docstring"""



         a__    = sum(self.__neg_pos([ord(__SCREAMING_SNAKE_CASE      ) for x in self.__passcode]      )      )
         return num if num > 0 else len(self.__passcode      )



     def  lowercase__     (       self    ,							__SCREAMING_SNAKE_CASE      )		->    int:







         """simple docstring"""



         a__    = ''

         # decoding shift like Caesar cipher algorithm implementing negative shift or
         # reverse shift or left shift
         for i in encoded_message:
             a__    = self.__key_list.index(__SCREAMING_SNAKE_CASE      )
             decoded_message += self.__key_list[
                 (position - self.__shift_key) % -len(self.__key_list      )
             ]

         return decoded_message




     def  lowercase__     (       self    ,							__SCREAMING_SNAKE_CASE      )		->    List[Any]:







         """simple docstring"""



         a__    = ''

         # encoding shift like Caesar cipher algorithm implementing positive shift or
         # forward shift or right shift
         for i in plaintext:
             a__    = self.__key_list.index(__SCREAMING_SNAKE_CASE      )
             encoded_message += self.__key_list[
                 (position + self.__shift_key) % len(self.__key_list      )
             ]

         return encoded_message







def 						__magic_name__		(				UpperCamelCase    :		Optional[Any] = "Hello, this is a modified Caesar cipher"    )    ->	Tuple:
    a__    = ShuffledShiftCipher()
    return cipa.decrypt(cipa.encrypt(_A    )    )


if __name__ == "__main__":
    import doctest

    doctest.testmod()




"""simple docstring"""




import math







class 						lowercase:



     def __init__(       self    ,							__SCREAMING_SNAKE_CASE      )		->    Optional[int]:







         """simple docstring"""



         a__    = len(__SCREAMING_SNAKE_CASE      )
         a__    = [0] * (
             4 * self.N
         )  # approximate the overall size of segment tree with array N
         self.build(1    ,							0    ,							self.N - 1      )



     def  lowercase__     (       self    ,							__SCREAMING_SNAKE_CASE      )		->    Optional[Any]:







         """simple docstring"""



         return idx * 2



     def  lowercase__     (       self    ,							__SCREAMING_SNAKE_CASE      )		->    Optional[int]:







         """simple docstring"""



         return idx * 2 + 1



     def  lowercase__     (       self    ,							__SCREAMING_SNAKE_CASE    ,							__SCREAMING_SNAKE_CASE    ,							__SCREAMING_SNAKE_CASE      )		->    List[str]:  # noqa: E741







         """simple docstring"""



         if l == r:
             a__    = A[l]
         else:
             a__    = (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      )
             a__    = max(self.st[self.left(__SCREAMING_SNAKE_CASE      )]    ,							self.st[self.right(__SCREAMING_SNAKE_CASE      )]      )



     def  lowercase__     (       self    ,							__SCREAMING_SNAKE_CASE    ,							__SCREAMING_SNAKE_CASE    ,							__SCREAMING_SNAKE_CASE      )		->    int:







         """simple docstring"""



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



     def  lowercase__     (       self    ,							__SCREAMING_SNAKE_CASE    ,							__SCREAMING_SNAKE_CASE    ,							__SCREAMING_SNAKE_CASE    ,							__SCREAMING_SNAKE_CASE    ,							__SCREAMING_SNAKE_CASE    ,							__SCREAMING_SNAKE_CASE      )		->    Optional[int]:  # noqa: E741







         """simple docstring"""



         if r < a or l > b:
             return True
         if l == r:
             a__    = val
             return True
         a__    = (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      )
         a__    = max(self.st[self.left(__SCREAMING_SNAKE_CASE      )]    ,							self.st[self.right(__SCREAMING_SNAKE_CASE      )]      )
         return True



     def  lowercase__     (       self    ,							__SCREAMING_SNAKE_CASE    ,							__SCREAMING_SNAKE_CASE      )		->    List[str]:







         """simple docstring"""



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



     def  lowercase__     (       self    ,							__SCREAMING_SNAKE_CASE    ,							__SCREAMING_SNAKE_CASE    ,							__SCREAMING_SNAKE_CASE    ,							__SCREAMING_SNAKE_CASE    ,							__SCREAMING_SNAKE_CASE      )		->    Any:  # noqa: E741







         """simple docstring"""



         if r < a or l > b:
             return -math.inf
         if l >= a and r <= b:
             return self.st[idx]
         a__    = (l + r) // 2
         a__    = self.query_recursive(self.left(__SCREAMING_SNAKE_CASE      )    ,							__SCREAMING_SNAKE_CASE    ,							__SCREAMING_SNAKE_CASE    ,							__SCREAMING_SNAKE_CASE    ,							__SCREAMING_SNAKE_CASE      )
         a__    = 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  lowercase__     (       self      )		->    List[Any]:







         """simple docstring"""



         a__    = []
         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		:					Union[str, Any]    	=					[1, 2, -4, 7, 3, -5, 6, 11, -20, 9, 14, 15, 5, 2, -8]
    a		:					Dict    	=					15
    a		:					Tuple    	=					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()


