fix algorithm: copy for InputIterator