


'''simple docstring'''







from __future__ import annotations

A      :     Tuple										= [2, 1, 4, 5, 6, 0, 8, 9, 1, 2, 0, 6, 4, 2, 0, 6, 5, 3, 2, 7]


class  __lowerCamelCase :
    """simple docstring"""


    def __init__(  self			:							Dict      ,							SCREAMING_SNAKE_CASE			:							int):
           _A     :	int      =					-1
           _A     :	int      =					-1
           _A     :	list[int]      =					[-1] * length
           _A     :	Node | None      =					None
           _A     :	Node | None      =					None


    def __repr__(  self			:							Tuple):
           return F'Node(min_value={self.minn} max_value={self.maxx})'






def       lowerCAmelCase__       (				lowerCamelCase     :			list[int]   ):
       _A     :	List[str]      =					Node(len(lowerCamelCase   )   )
       _A  , _A     :	Optional[int]      =					min(lowerCamelCase   ), max(lowerCamelCase   )
       # Leaf node case where the node contains only one unique value
       if root.minn == root.maxx:
              return root
       _A     :	int      =					(root.minn + root.maxx) // 2

       _A     :	list[int]      =					[]
       _A     :	list[int]      =					[]

       for index, num in enumerate(lowerCamelCase   ):
              if num <= pivot:
                     left_arr.append(lowerCamelCase   )
              else:
                     right_arr.append(lowerCamelCase   )
              _A     :	Optional[Any]      =					len(lowerCamelCase   )
       _A     :	int      =					build_tree(lowerCamelCase   )
       _A     :	int      =					build_tree(lowerCamelCase   )
       return root






def       lowerCAmelCase__       (				lowerCamelCase     :			Node | None  ,lowerCamelCase     :			int  ,lowerCamelCase     :			int   ):
       if index < 0 or node is None:
              return 0
       # Leaf node cases
       if node.minn == node.maxx:
              return index + 1 if node.minn == num else 0
       _A     :	Tuple      =					(node.minn + node.maxx) // 2
       if num <= pivot:
              # go the left subtree and map index to the left subtree
              return rank_till_index(node.left  ,lowerCamelCase  ,node.map_left[index] - 1   )
       else:
              # go to the right subtree and map index to the right subtree
              return rank_till_index(node.right  ,lowerCamelCase  ,index - node.map_left[index]   )






def       lowerCAmelCase__       (				lowerCamelCase     :			Node | None  ,lowerCamelCase     :			int  ,lowerCamelCase     :			int  ,lowerCamelCase     :			int   ):
       if start > end:
              return 0
       _A     :	Optional[Any]      =					rank_till_index(lowerCamelCase  ,lowerCamelCase  ,lowerCamelCase   )
       _A     :	Optional[Any]      =					rank_till_index(lowerCamelCase  ,lowerCamelCase  ,start - 1   )
       return rank_till_end - rank_before_start






def       lowerCAmelCase__       (				lowerCamelCase     :			Node | None  ,lowerCamelCase     :			int  ,lowerCamelCase     :			int  ,lowerCamelCase     :			int   ):
       if index > (end - start) or start > end or node is None:
              return -1
       # Leaf node case
       if node.minn == node.maxx:
              return node.minn
       # Number of elements in the left subtree in interval [start, end]
       _A     :	Union[str, Any]      =					node.map_left[end] - (
           node.map_left[start - 1] if start else 0
       )
       if num_elements_in_left_tree > index:
              return quantile(
                  node.left  ,lowerCamelCase  ,(node.map_left[start - 1] if start else 0)  ,node.map_left[end] - 1  ,)
       else:
              return quantile(
                  node.right  ,index - num_elements_in_left_tree  ,start - (node.map_left[start - 1] if start else 0)  ,end - node.map_left[end]  ,)






def       lowerCAmelCase__       (				lowerCamelCase     :			Node | None  ,lowerCamelCase     :			int  ,lowerCamelCase     :			int  ,lowerCamelCase     :			int  ,lowerCamelCase     :			int   ):
       if (
           start > end
           or node is None
           or start_num > end_num
           or node.minn > end_num
           or node.maxx < start_num
       ):
              return 0
       if start_num <= node.minn and node.maxx <= end_num:
              return end - start + 1
       _A     :	Union[str, Any]      =					range_counting(
           node.left  ,(node.map_left[start - 1] if start else 0)  ,node.map_left[end] - 1  ,lowerCamelCase  ,lowerCamelCase  ,)
       _A     :	int      =					range_counting(
           node.right  ,start - (node.map_left[start - 1] if start else 0)  ,end - node.map_left[end]  ,lowerCamelCase  ,lowerCamelCase  ,)
       return left + right


if __name__ == "__main__":
   import doctest

   doctest.testmod()










'''simple docstring'''







import sys

sys.set_int_max_str_digits(0)  # type: ignore






def       lowerCAmelCase__       (				lowerCamelCase     :			int   ):
       _A     :	Optional[Any]      =					[0] * 11
       _A     :	str      =					[0] * 11

       # mark last 9 numbers
       for _ in range(9   ):
              _A     :	int      =					1
              _A     :	Optional[int]      =					number // 10
       # flag
       _A     :	List[Any]      =					True

       # check last 9 numbers for pandigitality

       for x in range(9   ):
              if not check_last[x + 1]:
                     _A     :	Optional[int]      =					False
       if not f:
              return f

       # mark first 9 numbers
       _A     :	Optional[int]      =					int(str(lowerCamelCase   )[:9]   )

       for _ in range(9   ):
              _A     :	Optional[Any]      =					1
              _A     :	str      =					number // 10

       # check first 9 numbers for pandigitality

       for x in range(9   ):
              if not check_front[x + 1]:
                     _A     :	Optional[Any]      =					False
       return f






def       lowerCAmelCase__       (				lowerCamelCase     :			int   ):
       _A     :	Dict      =					[0] * 11

       # mark last 9 numbers
       for _ in range(9   ):
              _A     :	List[str]      =					1
              _A     :	Dict      =					number // 10
       # flag
       _A     :	Optional[int]      =					True

       # check last 9 numbers for pandigitality

       for x in range(9   ):
              if not check_last[x + 1]:
                     _A     :	List[str]      =					False
       return f






def       lowerCAmelCase__       (				):
       _A     :	List[Any]      =					1
       _A     :	Dict      =					1
       _A     :	Dict      =					2
       # temporary Fibonacci numbers

       _A     :	List[Any]      =					1
       _A     :	Union[str, Any]      =					1
       _A     :	List[Any]      =					2
       # temporary Fibonacci numbers mod 1e9

       # mod m=1e9, done for fast optimisation
       _A     :	Tuple      =					[0] * 1000000
       _A     :	Any      =					1000000000

       for x in range(1000000   ):
              _A     :	Tuple      =					(aa + ba) % m
              _A     :	Optional[Any]      =					ba % m
              _A     :	str      =					ca % m
              if checka(lowerCamelCase   ):
                     _A     :	Dict      =					1

       for x in range(1000000   ):
              _A     :	List[str]      =					a + b
              _A     :	Optional[int]      =					b
              _A     :	str      =					c
              # perform check only if in tocheck
              if tocheck[x + 3] and check(lowerCamelCase   ):
                     return x + 3  # first 2 already done
       return -1


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






