



'''simple docstring'''



from __future__ import annotations

import math





class _UpperCamelCase		:





    '''simple docstring'''





    def __init__(							self  :  Any  ,       _lowerCAmelCase  :  List[Any]):







           '''simple docstring'''

           __lowercase       	=size
           # approximate the overall size of segment tree with given value
           __lowercase       	=[0 for i in range(0  ,       4 * size)]
           # create array to store lazy update
           __lowercase       	=[0 for i in range(0  ,       4 * size)]
           __lowercase       	=[0 for i in range(0  ,       4 * size)]  # flag for lazy update

    def 				__lowerCamelCase     (							self  :  Tuple  ,       _lowerCAmelCase  :  Any):







           '''simple docstring'''

           return idx * 2

    def 				__lowerCamelCase     (							self  :  str  ,       _lowerCAmelCase  :  Tuple):







           '''simple docstring'''

           return idx * 2 + 1

    def 				__lowerCamelCase     (							self  :  Any  ,       _lowerCAmelCase  :  Any  ,       _lowerCAmelCase  :  List[Any]  ,       _lowerCAmelCase  :  Optional[Any]  ,       _lowerCAmelCase  :  Optional[Any]):







           '''simple docstring'''

           if left_element == right_element:
                  __lowercase       	=a[left_element - 1]
           else:
                  __lowercase       	=(left_element + right_element) // 2
                  self.build(self.left(_a)  ,       _a  ,       _a  ,       _a)
                  self.build(self.right(_a)  ,       mid + 1  ,       _a  ,       _a)
                  __lowercase       	=max(
                      self.segment_tree[self.left(_a)]  ,       self.segment_tree[self.right(_a)])

    def 				__lowerCamelCase     (							self  :  Any  ,       _lowerCAmelCase  :  List[str]  ,       _lowerCAmelCase  :  Optional[int]  ,       _lowerCAmelCase  :  Optional[int]  ,       _lowerCAmelCase  :  List[str]  ,       _lowerCAmelCase  :  str  ,       _lowerCAmelCase  :  Union[str, Any]):







           '''simple docstring'''

           if self.flag[idx] is True:
                  __lowercase       	=self.lazy[idx]
                  __lowercase       	=False
                  if left_element != right_element:
                         __lowercase       	=self.lazy[idx]
                         __lowercase       	=self.lazy[idx]
                         __lowercase       	=True
                         __lowercase       	=True

           if right_element < a or left_element > b:
                  return True
           if left_element >= a and right_element <= b:
                  __lowercase       	=val
                  if left_element != right_element:
                         __lowercase       	=val
                         __lowercase       	=val
                         __lowercase       	=True
                         __lowercase       	=True
                  return True
           __lowercase       	=(left_element + right_element) // 2
           self.update(self.left(_a)  ,       _a  ,       _a  ,       _a  ,       _a  ,       _a)
           self.update(self.right(_a)  ,       mid + 1  ,       _a  ,       _a  ,       _a  ,       _a)
           __lowercase       	=max(
               self.segment_tree[self.left(_a)]  ,       self.segment_tree[self.right(_a)])
           return True

    def 				__lowerCamelCase     (							self  :  Optional[int]  ,       _lowerCAmelCase  :  Dict  ,       _lowerCAmelCase  :  List[str]  ,       _lowerCAmelCase  :  Optional[Any]  ,       _lowerCAmelCase  :  Optional[Any]  ,       _lowerCAmelCase  :  Tuple):







           '''simple docstring'''

           if self.flag[idx] is True:
                  __lowercase       	=self.lazy[idx]
                  __lowercase       	=False
                  if left_element != right_element:
                         __lowercase       	=self.lazy[idx]
                         __lowercase       	=self.lazy[idx]
                         __lowercase       	=True
                         __lowercase       	=True
           if right_element < a or left_element > b:
                  return -math.inf
           if left_element >= a and right_element <= b:
                  return self.segment_tree[idx]
           __lowercase       	=(left_element + right_element) // 2
           __lowercase       	=self.query(self.left(_a)  ,       _a  ,       _a  ,       _a  ,       _a)
           __lowercase       	=self.query(self.right(_a)  ,       mid + 1  ,       _a  ,       _a  ,       _a)
           return max(_a  ,       _a)

    def __str__(							self  :  int):







           '''simple docstring'''

           return str([self.query(1  ,       1  ,       self.size  ,       _a  ,       _a) for i in range(1  ,       self.size + 1)])


if __name__ == "__main__":
  lowerCamelCase	 =       [1, 2, -4, 7, 3, -5, 6, 11, -20, 9, 14, 15, 5, 2, -8]
  lowerCamelCase	 =       15
  lowerCamelCase	 =       SegmentTree(size)
  segt.build(1, 1, size, A)
  print(segt.query(1, 1, size, 4, 6))
  print(segt.query(1, 1, size, 7, 11))
  print(segt.query(1, 1, size, 7, 12))
  segt.update(1, 1, size, 1, 3, 111)
  print(segt.query(1, 1, size, 1, 15))
  segt.update(1, 1, size, 7, 8, 235)
  print(segt)








'''simple docstring'''



import string



def   _A       (   _lowerCAmelCase					):



							"""simple docstring"""



							__lowercase       	=''
							for i in sequence:
														__lowercase       	=ord(_lowerCAmelCase					)
														if 65 <= extract <= 90:
																					output += chr(155 - extract					)
														elif 97 <= extract <= 122:
																					output += chr(219 - extract					)
														else:
																					output += i
							return output



def   _A       (   _lowerCAmelCase					):



							"""simple docstring"""



							__lowercase       	=string.ascii_letters
							__lowercase       	=string.ascii_lowercase[::-1] + string.ascii_uppercase[::-1]
							return "".join(
							    letters_reversed[letters.index(_lowerCAmelCase					)] if c in letters else c for c in sequence					)



def   _A       (   ):



							"""simple docstring"""



							from timeit import timeit

							print('Running performance benchmarks...'					)
							__lowercase       	='from string import printable ; from __main__ import atbash, atbash_slow'
							print(f"""> atbash_slow(): {timeit('atbash_slow(printable)'  ,   setup=_lowerCAmelCase					)} seconds"""					)
							print(f""">      atbash(): {timeit('atbash(printable)'  ,   setup=_lowerCAmelCase					)} seconds"""					)


if __name__ == "__main__":
		for example in ("ABCDEFGH", "123GGjj", "testStringtest", "with space"):
				print(f"{example} encrypted in atbash: {atbash(example)}")
		benchmark()



