Driver code
public static void Main ( ) { int n = 5 , m = 5 ; int [ ] arr = new int [ n ] ; int [ ] record = new int [ m ] ; int block_size = ( int ) Math . Sqrt ( m ) ; int [ ] block = new int [ max ] ; int [ , ] command = { { 1 , 1 , 2 } , { 1 , 4 , 5 } , { 2 , 1 , 2 } , { 2 , 1 , 3 } , { 2 , 3 , 4 } } ; for ( int i = m - 1 ; i >= 0 ; i -- ) {