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 = input . Length ; preprocess ( input , n ) ; Console . WriteLine ( " query ( 3 , ▁ 8 ) ▁ : ▁ " + query ( 3 , 8 ) ) ; Console . WriteLine ( " query ( 1 , ▁ 6 ) ▁ : ▁ " + query ( 1 , 6 ) ) ; update ( 8 , 0 ) ; Console . WriteLine ( " query ( 8 , ▁ 8 ) ▁ : ▁ " + query ( 8 , 8 ) ) ; } }