Driver code
if __name__ == " _ _ main _ _ " : NEW_LINE INDENT n = 5 NEW_LINE m = 5 NEW_LINE arr = [ 0 ] * n NEW_LINE record = [ 0 ] * m NEW_LINE block_size = ( int ) ( math . sqrt ( m ) ) NEW_LINE block = [ 0 ] * max NEW_LINE command = [ [ 1 , 1 , 2 ] , [ 1 , 4 , 5 ] , [ 2 , 1 , 2 ] , [ 2 , 1 , 3 ] , [ 2 , 3 , 4 ] ] NEW_LINE for i in range ( m - 1 , - 1 , - 1 ) : NEW_LINE DEDENT