Main should have cmath included for std::min.