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 .
int input [ ] = { 1 , 5 , 2 , 4 , 6 , 1 , 3 , 5 , 7 , 10 } ; int n = sizeof ( input ) / sizeof ( input [ 0 ] ) ; preprocess ( input , n ) ; cout << " query ( 3,8 ) ▁ : ▁ " << query ( 3 , 8 ) << endl ; cout << " query ( 1,6 ) ▁ : ▁ " << query ( 1 , 6 ) << endl ; update ( 8 , 0 ) ; cout << " query ( 8,8 ) ▁ : ▁ " << query ( 8 , 8 ) << endl ; return 0 ; }