Add missing #include <algorithm>