delete useless headers and add <algorithm>