Conditions to reduce the the time iteratively
for it in arr : NEW_LINE INDENT if ( it in mp1 and mp1 . get ( it ) > 0 ) : NEW_LINE INDENT mp1 [ it ] = mp1 . get ( it ) - 1 NEW_LINE DEDENT else : NEW_LINE INDENT p = 1 NEW_LINE DEDENT DEDENT