inserting indexes of those numbers which are lesser than 40
if ( arr [ i ] < 40 ) { s . insert ( i ) ; update ( i , fact [ arr [ i ] ] , n ) ; } else update ( i , 0 , n ) ; } for ( int i = 0 ; i < q ; i ++ ) {