
"""simple docstring"""

from copy import deepcopy

class __lowerCAmelCase	:

     '''simple docstring'''





     def __init__(			self			,  __UpperCAmelCase = None			,  __UpperCAmelCase = None   ):

      '''simple docstring'''




      if arr is None and size is not None:
       __UpperCamelCase       						= size
       __UpperCamelCase       						= [0] * size
      elif arr is not None:
       self.init(__UpperCAmelCase   )
      else:
       raise ValueError('Either arr or size must be specified'   )





     def 		UpperCAmelCase      (			self			,  __UpperCAmelCase   ):

      '''simple docstring'''




      __UpperCamelCase       						= len(__UpperCAmelCase   )
      __UpperCamelCase       						= deepcopy(__UpperCAmelCase   )
      for i in range(1			,  self.size   ):
       __UpperCamelCase       						= self.next_(__UpperCAmelCase   )
       if j < self.size:
        self.tree[j] += self.tree[i]





     def 		UpperCAmelCase      (			self   ):

      '''simple docstring'''




      __UpperCamelCase       						= self.tree[:]
      for i in range(self.size - 1			,  0			,  -1   ):
       __UpperCamelCase       						= self.next_(__UpperCAmelCase   )
       if j < self.size:
        arr[j] -= arr[i]
      return arr





     @staticmethod
     def 		UpperCAmelCase      (			__UpperCAmelCase   ):

      '''simple docstring'''




      return index + (index & (-index))





     @staticmethod
     def 		UpperCAmelCase      (			__UpperCAmelCase   ):

      '''simple docstring'''




      return index - (index & (-index))





     def 		UpperCAmelCase      (			self			,  __UpperCAmelCase			,  __UpperCAmelCase   ):

      '''simple docstring'''




      if index == 0:
       self.tree[0] += value
       return
      while index < self.size:
       self.tree[index] += value
       __UpperCamelCase       						= self.next_(__UpperCAmelCase   )





     def 		UpperCAmelCase      (			self			,  __UpperCAmelCase			,  __UpperCAmelCase   ):

      '''simple docstring'''




      self.add(__UpperCAmelCase			,  value - self.get(__UpperCAmelCase   )   )





     def 		UpperCAmelCase      (			self			,  __UpperCAmelCase   ):

      '''simple docstring'''




      if right == 0:
       return 0
      __UpperCamelCase       						= self.tree[0]
      right -= 1  # make right inclusive
      while right > 0:
       result += self.tree[right]
       __UpperCamelCase       						= self.prev(__UpperCAmelCase   )
      return result





     def 		UpperCAmelCase      (			self			,  __UpperCAmelCase			,  __UpperCAmelCase   ):

      '''simple docstring'''




      return self.prefix(__UpperCAmelCase   ) - self.prefix(__UpperCAmelCase   )





     def 		UpperCAmelCase      (			self			,  __UpperCAmelCase   ):

      '''simple docstring'''




      return self.query(__UpperCAmelCase			,  index + 1   )







     def 		UpperCAmelCase      (			self			,  __UpperCAmelCase   ):

      '''simple docstring'''




      value -= self.tree[0]
      if value < 0:
       return -1

      __UpperCamelCase       						= 1  # Largest power of 2 <= size
      while j * 2 < self.size:
       j *= 2

      __UpperCamelCase       						= 0

      while j > 0:
       if i + j < self.size and self.tree[i + j] <= value:
        value -= self.tree[i + j]
        i += j
       j //= 2
      return i


if __name__ == "__main__":
      import doctest

      doctest.testmod()





"""simple docstring"""

def 							A		(       snake_case   :int	)   ->			bool:
 return str(snake_case	) == str(snake_case	)[::-1]






def 							A		(       snake_case   :int	)   ->			int:
 return int(snake_case	) + int(str(snake_case	)[::-1]	)






def 							A		(       snake_case   :int = 1_0_0_0_0	)   ->			int:
 __UpperCamelCase       						= []
 for num in range(1       ,      snake_case	):
  __UpperCamelCase       						= 0
  __UpperCamelCase       						= num
  while iterations < 5_0:
   __UpperCamelCase       						= sum_reverse(snake_case	)
   iterations += 1
   if is_palindrome(snake_case	):
    break
  else:
   lychrel_nums.append(snake_case	)
 return len(snake_case	)


if __name__ == "__main__":
      print(f'''{solution() = }''')



