inserting indexes of those numbers which are lesser than 40
if arr [ i ] < 40 : NEW_LINE INDENT s . add ( i ) NEW_LINE update ( i , fact [ arr [ i ] ] , n ) NEW_LINE DEDENT else : NEW_LINE INDENT update ( i , 0 , n ) NEW_LINE DEDENT for i in range ( q ) : NEW_LINE