#include #include #include #include bool substring_unique_copyless(std::vector *s, size_t right, size_t length) { for (size_t i = (right-length); i *s, size_t num, size_t skip) { for (size_t right = skip; rightsize(); right++) { if (substring_unique_copyless(s, right, num)) { return right; } } return 0; } void run_once(std::vector *s) { size_t four = find_first_unique_run(s, 4, 4); size_t fourteen = find_first_unique_run(s, 14, four); std::cout << "Part 1: " << four << '\n'; std::cout << "Part 2: " << fourteen << '\n'; } void run_many(std::vector *s, size_t iterations) { size_t four = 0; size_t fourteen = 0; for (size_t i = 0; i(input_file.tellg()); std::vector input = std::vector(eof_position); input_file.seekg(0, std::ios::beg); input_file.read(reinterpret_cast(input.data()), eof_position); // run_once(&input); run_many(&input, 1000000); }