We have used separate array for input because the purpose of this code is to explain SQRT decomposition in competitive programming where we have multiple inputs .
input = [ 1 , 5 , 2 , 4 , 6 , 1 , 3 , 5 , 7 , 10 ] NEW_LINE n = len ( input ) NEW_LINE preprocess ( input , n ) NEW_LINE print ( " query ( 3,8 ) ▁ : ▁ " , query ( 3 , 8 ) ) NEW_LINE print ( " query ( 1,6 ) ▁ : ▁ " , query ( 1 , 6 ) ) NEW_LINE update ( 8 , 0 ) NEW_LINE print ( " query ( 8,8 ) ▁ : ▁ " , query ( 8 , 8 ) ) NEW_LINE