Driver code
int main ( ) { int n = 5 , m = 5 ; int arr [ n ] , record [ m ] ; int block_size = sqrt ( m ) ; int block [ max ] ; int command [ 5 ] [ 3 ] = { { 1 , 1 , 2 } , { 1 , 4 , 5 } , { 2 , 1 , 2 } , { 2 , 1 , 3 } , { 2 , 3 , 4 } } ; memset ( arr , 0 , sizeof arr ) ; memset ( record , 0 , sizeof record ) ; memset ( block , 0 , sizeof block ) ; for ( int i = m - 1 ; i >= 0 ; i -- ) {