diff --git a/2020/Makefile b/2020/Makefile index ede9575..812ac33 100644 --- a/2020/Makefile +++ b/2020/Makefile @@ -1,12 +1,16 @@ -day%.out: out/types.o day%.cpp - g++-10 -std=c++2a $(flags) $(@:out=cpp) out/types.o -o $@ +day%.out: out/types.o misc/main.cpp days/day%.cpp + g++-10 -std=c++2a $(flags) -Dcurrent_day=$(@:.out=) days/$(@:out=cpp) misc/main.cpp out/types.o -o $@ -day%.cpp: - cp template.cpp $@ +day%_test.out: out/types.o misc/main_test.cpp days/day%.cpp + g++-10 -std=c++2a $(flags) -DTEST_BUILD -Dcurrent_day=$(@:_test.out=) days/$(@:_test.out=.cpp) misc/main_test.cpp out/types.o -o $@ -out/types.o: types.hpp types.cpp +days/day%.cpp: + cp 'misc/day.cpp.template' $@ + sed -i -e "s/current_day/$(shell basename $@ | cut -f 1 -d '.')/g" $@ + +out/types.o: misc/types.hpp misc/types.cpp mkdir -p out/ - g++-10 -std=c++2a $(flags) -c types.cpp -o $@ + g++-10 -std=c++2a $(flags) -c misc/types.cpp -o $@ .PHONY: clean clean: diff --git a/2020/day1.cpp b/2020/days/day1.cpp similarity index 87% rename from 2020/day1.cpp rename to 2020/days/day1.cpp index 5eda877..03d3b48 100644 --- a/2020/day1.cpp +++ b/2020/days/day1.cpp @@ -30,7 +30,8 @@ #include #include -#include "types.hpp" +#include "../misc/types.hpp" +#include "../misc/print.hpp" // Find 2 numbers that sum to 2020 auto find_2020_x2(const std::vector & list) -> void { @@ -44,7 +45,7 @@ auto find_2020_x2(const std::vector & list) -> void { --end; } } - std::cout << (list[begin] * list[end]) << std::endl; + print((list[begin] * list[end])); } // Find 3 numbers that sum to 2020 @@ -53,13 +54,13 @@ auto find_2020_x3(const std::vector & list) -> void { for (auto n1 = 1; n1 < list.size() - 1; ++n1) { auto low = n0 + 1; auto high = n1; - auto n2 = (low + high) / 2; - while (low < high - 1) { + while (low < high) { + auto n2 = (low + high) / 2; auto sum = 0; if ((sum = list[n0] + list[n1] + list[n2]) == 2020) { - std::cout << (list[n0] * list[n1] * list[n2]) << std::endl; + print((list[n0] * list[n1] * list[n2])); return; - } else if (sum > 2020) { + } else if (sum < 2020) { low = n2 + 1; } else { high = n2; @@ -69,11 +70,11 @@ auto find_2020_x3(const std::vector & list) -> void { } } -auto main(i32 argc, char * argv[]) -> i32 { +auto day1() -> void { auto list = std::vector(); { auto line = std::string(); - auto file = std::ifstream("day1.input"); + auto file = std::ifstream("inputs/day1.input"); while (getline(file, line)) { list.push_back(std::stoi(line)); } @@ -82,6 +83,4 @@ auto main(i32 argc, char * argv[]) -> i32 { find_2020_x2(list); find_2020_x3(list); - - return 0; } diff --git a/2020/day10.cpp b/2020/days/day10.cpp similarity index 91% rename from 2020/day10.cpp rename to 2020/days/day10.cpp index 9f6fab4..0da5b83 100644 --- a/2020/day10.cpp +++ b/2020/days/day10.cpp @@ -29,7 +29,8 @@ #include #include -#include "types.hpp" +#include "../misc/types.hpp" +#include "../misc/print.hpp" struct Pair { u64 jolt; @@ -40,11 +41,11 @@ auto operator<(const Pair & left, const Pair & right) -> bool { return left.jolt < right.jolt; } -auto main(i32 argc, char * argv[]) -> i32 { +auto day10() -> void { auto jolts = std::vector{{ 0, 1 }}; { auto line = std::string(); - auto file = std::ifstream("day10.input"); + auto file = std::ifstream("inputs/day10.input"); while (getline(file, line)) { jolts.push_back({ (u64) std::stoll(line), 0 }); } @@ -59,7 +60,7 @@ auto main(i32 argc, char * argv[]) -> i32 { else if (jolts[i + 1].jolt - jolts[i].jolt == 3) ++dif3; } - std::cout << (dif1 * dif3) << std::endl; + print((dif1 * dif3)); for (auto i = i32(0); i < jolts.size() - 1; ++i) { for (auto j = i + 1; j < jolts.size(); ++j) { @@ -70,7 +71,5 @@ auto main(i32 argc, char * argv[]) -> i32 { } } } - std::cout << jolts[jolts.size() - 1].count << std::endl; - - return 0; + print(jolts[jolts.size() - 1].count); } diff --git a/2020/day11.cpp b/2020/days/day11.cpp similarity index 94% rename from 2020/day11.cpp rename to 2020/days/day11.cpp index c5aaa78..ecbd826 100644 --- a/2020/day11.cpp +++ b/2020/days/day11.cpp @@ -30,7 +30,8 @@ #include #include -#include "types.hpp" +#include "../misc/types.hpp" +#include "../misc/print.hpp" template auto iterate_seats(const auto & seats, Lambda callback) { @@ -62,12 +63,12 @@ auto count_seats(const auto & seats) -> usize { return occupied; } -auto main(i32 argc, char * argv[]) -> i32 { +auto day11() -> void { auto bit = u8(0b1); auto seats = std::array, 2>(); { auto line = std::string(); - auto file = std::ifstream("day11.input"); + auto file = std::ifstream("inputs/day11.input"); while (getline(file, line)) { seats[bit].push_back(line); } @@ -94,7 +95,7 @@ auto main(i32 argc, char * argv[]) -> i32 { } while (!seats_equal(seats)); - std::cout << count_seats(seats[0]) << std::endl; + print(count_seats(seats[0])); iterate_seats(seats[0], [&seats](i32 i, i32 j) { seats[0][i][j] = seats[1][i][j] = 'L'; @@ -129,7 +130,5 @@ auto main(i32 argc, char * argv[]) -> i32 { }); } while (!seats_equal(seats)); - std::cout << count_seats(seats[0]) << std::endl; - - return 0; + print(count_seats(seats[0])); } diff --git a/2020/day2.cpp b/2020/days/day2.cpp similarity index 91% rename from 2020/day2.cpp rename to 2020/days/day2.cpp index cec8af6..fa57af9 100644 --- a/2020/day2.cpp +++ b/2020/days/day2.cpp @@ -29,7 +29,8 @@ #include #include -#include "types.hpp" +#include "../misc/types.hpp" +#include "../misc/print.hpp" struct Password { u32 min; @@ -72,11 +73,11 @@ auto count_valid_toboggan(const std::vector & passwords) -> u32 { return valid; } -auto main(i32 argc, char * argv[]) -> i32 { +auto day2() -> void { auto passwords = std::vector(); { auto line = std::string(); - auto file = std::ifstream("day2.input"); + auto file = std::ifstream("inputs/day2.input"); while (getline(file, line)) { auto index = usize(0); auto password = Password{}; @@ -88,8 +89,6 @@ auto main(i32 argc, char * argv[]) -> i32 { } } - std::cout << count_valid_sled(passwords) << std::endl; - std::cout << count_valid_toboggan(passwords) << std::endl; - - return 0; + print(count_valid_sled(passwords) ); + print(count_valid_toboggan(passwords)); } diff --git a/2020/day3.cpp b/2020/days/day3.cpp similarity index 60% rename from 2020/day3.cpp rename to 2020/days/day3.cpp index 4c6268b..647d627 100644 --- a/2020/day3.cpp +++ b/2020/days/day3.cpp @@ -29,40 +29,53 @@ #include #include -#include "types.hpp" +#include "../misc/types.hpp" +#include "../misc/print.hpp" -auto read_field_and_count_trees(std::vector & trees, usize horizontal_increment, usize vertical_increment) -> u64 { - auto tree_count = u64(0); +struct TreeVector{ usize horz; usize vert; }; +struct Coordinate{ usize x_index; usize y_index; }; - auto x_index = usize(-horizontal_increment); - auto y_index = usize(-1); - auto line = std::string(); - auto file = std::ifstream("day3.input"); - - while (getline(file, line)) { - auto vertical_check = (++y_index % vertical_increment == 0); - tree_count += vertical_check * (line[(x_index += (vertical_check * horizontal_increment)) % line.size()] == '#'); +auto read_field_and_count_trees(const std::vector & vectors) -> std::vector { + auto tree_counts = std::vector(vectors.size()); + auto coords = std::vector(vectors.size()); + for (auto i = usize(0); i < coords.size(); ++i) { + coords[i] = { usize(-vectors[i].horz), usize(-1) }; } - return tree_count; + auto line = std::string(); + auto file = std::ifstream("inputs/day3.input"); + + while (getline(file, line)) { + for (auto i = usize(0); i < vectors.size(); ++i) { + auto & vector = vectors[i]; + auto & coord = coords[i]; + + auto vertical_check = (++coord.y_index % vector.vert == 0); + tree_counts[i] += vertical_check * (line[(coord.x_index += (vertical_check * vector.horz)) % line.size()] == '#'); + } + } + + return std::move(tree_counts); } -auto main(i32 argc, char ** argv) -> i32 { +auto day3() -> void { auto trees = std::vector(); - auto tree_counts = std::vector(); + auto tree_counts = read_field_and_count_trees( + std::vector{ + { 3, 1 }, + { 1, 1 }, + { 5, 1 }, + { 7, 1 }, + { 1, 2 }, + } + ); - tree_counts.push_back(read_field_and_count_trees(trees, 3, 1)); - std::cout << tree_counts[0] << std::endl; + print(tree_counts[0]); - tree_counts.push_back(read_field_and_count_trees(trees, 1, 1)); - tree_counts.push_back(read_field_and_count_trees(trees, 5, 1)); - tree_counts.push_back(read_field_and_count_trees(trees, 7, 1)); - tree_counts.push_back(read_field_and_count_trees(trees, 1, 2)); auto tree_count_product = u64(1); for (auto tree_count : tree_counts) { tree_count_product *= tree_count; } - std::cout << tree_count_product << std::endl; - return 0; + print(tree_count_product); } diff --git a/2020/day4.cpp b/2020/days/day4.cpp similarity index 95% rename from 2020/day4.cpp rename to 2020/days/day4.cpp index f0c5b78..1ba17f8 100644 --- a/2020/day4.cpp +++ b/2020/days/day4.cpp @@ -29,7 +29,8 @@ #include #include -#include "types.hpp" +#include "../misc/types.hpp" +#include "../misc/print.hpp" struct KeyValue { std::string key; @@ -46,13 +47,13 @@ auto try_num(const std::string & passport, usize index) -> bool { return Min <= num && num <= Max; }; -auto main(i32 argc, char * argv[]) -> i32 { +auto day4() -> void { auto valid_count1 = usize(0); auto valid_count2 = usize(0); auto passport = std::string(); auto line = std::string(); - auto file = std::ifstream("day4.input"); + auto file = std::ifstream("inputs/day4.input"); while (getline(file, line)) { if (line == "") { auto elements = std::vector{ @@ -108,7 +109,6 @@ auto main(i32 argc, char * argv[]) -> i32 { } } - std::cout << valid_count1 << ", " << valid_count2 << std::endl; - - return 0; + print(valid_count1); + print(valid_count2); } diff --git a/2020/day5.cpp b/2020/days/day5.cpp similarity index 90% rename from 2020/day5.cpp rename to 2020/days/day5.cpp index 70d3d35..5a68158 100644 --- a/2020/day5.cpp +++ b/2020/days/day5.cpp @@ -30,12 +30,13 @@ #include #include -#include "types.hpp" +#include "../misc/types.hpp" +#include "../misc/print.hpp" -auto main(i32 argc, char * argv[]) -> i32 { +auto day5() -> void { auto seat = usize(0); auto line = std::string(); - auto file = std::ifstream("day5.input"); + auto file = std::ifstream("inputs/day5.input"); auto seats = std::vector(); @@ -49,16 +50,14 @@ auto main(i32 argc, char * argv[]) -> i32 { } seats.push_back(local_seat); } - std::cout << seat << std::endl; + print(seat); std::sort(seats.begin(), seats.end()); for (auto i = usize(0); i < seats.size() - 1; ++i) { if (seats[i] + 2 == seats[i + 1]) { - std::cout << (seats[i] + 1) << std::endl; + print((seats[i] + 1)); break; } } - - return 0; } diff --git a/2020/day6.cpp b/2020/days/day6.cpp similarity index 91% rename from 2020/day6.cpp rename to 2020/days/day6.cpp index ae1035b..b3a3dbe 100644 --- a/2020/day6.cpp +++ b/2020/days/day6.cpp @@ -29,12 +29,13 @@ #include #include -#include "types.hpp" +#include "../misc/types.hpp" +#include "../misc/print.hpp" -auto main(i32 argc, char * argv[]) -> i32 { +auto day6() -> void { { auto line = std::string(); - auto file = std::ifstream("day6.input"); + auto file = std::ifstream("inputs/day6.input"); auto answers = std::vector(26); @@ -57,8 +58,7 @@ auto main(i32 argc, char * argv[]) -> i32 { } } } - std::cout << sum_1 << ", " << sum_2 << std::endl; + print(sum_1); + print(sum_2); } - - return 0; } diff --git a/2020/day7.cpp b/2020/days/day7.cpp similarity index 93% rename from 2020/day7.cpp rename to 2020/days/day7.cpp index 97991ea..8c2d8cc 100644 --- a/2020/day7.cpp +++ b/2020/days/day7.cpp @@ -32,7 +32,8 @@ #include #include -#include "types.hpp" +#include "../misc/types.hpp" +#include "../misc/print.hpp" struct SubBag { std::string type; u32 count; }; @@ -60,11 +61,11 @@ auto count_to(const std::string & search, std::map & map) -> return counted; } -auto main(i32 argc, char * argv[]) -> i32 { +auto day7() -> void { auto bag_graph = std::map(); { auto line = std::string(); - auto file = std::ifstream("day7.input"); + auto file = std::ifstream("inputs/day7.input"); while (getline(file, line)) { auto find = line.find("bag") - 1; auto bag_type = line.substr(0, line.find("bag") - 1); @@ -96,9 +97,7 @@ auto main(i32 argc, char * argv[]) -> i32 { } } } - std::cout << seen.size() << std::endl; + print(seen.size()); - std::cout << (count_to("shiny gold", bag_graph) - 1) << std::endl; - - return 0; + print((count_to("shiny gold", bag_graph) - 1)); } diff --git a/2020/day8.cpp b/2020/days/day8.cpp similarity index 94% rename from 2020/day8.cpp rename to 2020/days/day8.cpp index 030bceb..0d770cd 100644 --- a/2020/day8.cpp +++ b/2020/days/day8.cpp @@ -29,7 +29,8 @@ #include #include -#include "types.hpp" +#include "../misc/types.hpp" +#include "../misc/print.hpp" enum OpCode { Acc, Jmp, Nop }; struct Op{ OpCode code; i32 num; bool executed; }; @@ -81,11 +82,11 @@ auto attempt_swap(State & state, std::vector & ops) -> bool { return false; } -auto main(i32 argc, char * argv[]) -> i32 { +auto day8() -> void { auto ops = std::vector(); { auto line = std::string(); - auto file = std::ifstream("day8.input"); + auto file = std::ifstream("inputs/day8.input"); while (getline(file, line)) { ops.push_back(extract_op(line)); } @@ -95,18 +96,16 @@ auto main(i32 argc, char * argv[]) -> i32 { while (!ops[state.isp].executed) { execute(state, ops); } - std::cout << state.acc << std::endl; + print(state.acc); for (auto & op : ops) { op.executed = false; } state = State{ 0, 0 }; for (;;) { if (attempt_swap(state, ops)) { - std::cout << state.acc << std::endl; + print(state.acc); break; } execute(state, ops); } - - return 0; } diff --git a/2020/day9.cpp b/2020/days/day9.cpp similarity index 92% rename from 2020/day9.cpp rename to 2020/days/day9.cpp index 1668fd5..987fc9c 100644 --- a/2020/day9.cpp +++ b/2020/days/day9.cpp @@ -29,7 +29,8 @@ #include #include -#include "types.hpp" +#include "../misc/types.hpp" +#include "../misc/print.hpp" auto find_sum(usize index, std::vector xmas) { for (auto i = index - 25; i < index - 1; ++i) { @@ -42,10 +43,10 @@ auto find_sum(usize index, std::vector xmas) { return false; } -auto main(i32 argc, char * argv[]) -> i32 { +auto day9() -> void { auto xmas = std::vector(); auto line = std::string(); - auto file = std::ifstream("day9.input"); + auto file = std::ifstream("inputs/day9.input"); while (getline(file, line)) { xmas.push_back(std::stoll(line)); } @@ -53,7 +54,7 @@ auto main(i32 argc, char * argv[]) -> i32 { auto invalid = u64(0); for (auto i = usize(25); i < xmas.size(); ++i) { if (!find_sum(i, xmas)) { - std::cout << (invalid = xmas[i]) << std::endl; + print((invalid = xmas[i])); break; } } @@ -82,7 +83,5 @@ auto main(i32 argc, char * argv[]) -> i32 { max = xmas[i]; } } - std::cout << (min + max) << std::endl; - - return 0; + print((min + max)); } diff --git a/2020/day1.input b/2020/inputs/day1.input similarity index 100% rename from 2020/day1.input rename to 2020/inputs/day1.input diff --git a/2020/day10.input b/2020/inputs/day10.input similarity index 100% rename from 2020/day10.input rename to 2020/inputs/day10.input diff --git a/2020/day11.input b/2020/inputs/day11.input similarity index 100% rename from 2020/day11.input rename to 2020/inputs/day11.input diff --git a/2020/day2.input b/2020/inputs/day2.input similarity index 100% rename from 2020/day2.input rename to 2020/inputs/day2.input diff --git a/2020/day3.input b/2020/inputs/day3.input similarity index 100% rename from 2020/day3.input rename to 2020/inputs/day3.input diff --git a/2020/day4.input b/2020/inputs/day4.input similarity index 100% rename from 2020/day4.input rename to 2020/inputs/day4.input diff --git a/2020/day5.input b/2020/inputs/day5.input similarity index 100% rename from 2020/day5.input rename to 2020/inputs/day5.input diff --git a/2020/day6.input b/2020/inputs/day6.input similarity index 100% rename from 2020/day6.input rename to 2020/inputs/day6.input diff --git a/2020/day7.input b/2020/inputs/day7.input similarity index 100% rename from 2020/day7.input rename to 2020/inputs/day7.input diff --git a/2020/day8.input b/2020/inputs/day8.input similarity index 100% rename from 2020/day8.input rename to 2020/inputs/day8.input diff --git a/2020/day9.input b/2020/inputs/day9.input similarity index 100% rename from 2020/day9.input rename to 2020/inputs/day9.input diff --git a/2020/template.cpp b/2020/misc/day.cpp.template similarity index 91% rename from 2020/template.cpp rename to 2020/misc/day.cpp.template index 51a940b..52dfe9d 100644 --- a/2020/template.cpp +++ b/2020/misc/day.cpp.template @@ -29,16 +29,15 @@ #include #include -#include "types.hpp" +#include "../misc/types.hpp" +#include "../misc/print.hpp" -auto main(i32 argc, char * argv[]) -> i32 { +auto current_day() -> void { { auto line = std::string(); - auto file = std::ifstream("dayNUM.input"); + auto file = std::ifstream("inputs/current_day.input"); while (getline(file, line)) { } } - - return 0; } diff --git a/2020/misc/main.cpp b/2020/misc/main.cpp new file mode 100644 index 0000000..c4752db --- /dev/null +++ b/2020/misc/main.cpp @@ -0,0 +1,36 @@ +/******************************************************************************* + * + * Copyright (c) 2020 Gnarwhal + * + * ----------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files(the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + *******************************************************************************/ + +#include "types.hpp" + +extern auto current_day() -> void; + +auto main(i32 argc, char * argv[]) -> i32 { + current_day(); + + return 0; +} + diff --git a/2020/misc/main_test.cpp b/2020/misc/main_test.cpp new file mode 100644 index 0000000..0d8954d --- /dev/null +++ b/2020/misc/main_test.cpp @@ -0,0 +1,66 @@ +/******************************************************************************* + * + * Copyright (c) 2020 Gnarwhal + * + * ----------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files(the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + *******************************************************************************/ + +#include +#include +#include + +#include "types.hpp" + +extern auto current_day() -> void; + +auto main(i32 argc, char * argv[]) -> i32 { + auto TEST_CYCLES = 1; + if (argc >= 2) { + TEST_CYCLES = std::stoi(argv[1]); + } + + std::cout << "Starting test with " << TEST_CYCLES << " iterations..." << std::endl; + auto begin1 = std::chrono::high_resolution_clock::now(); + + for (auto i = usize(0); i < TEST_CYCLES; ++i) { + current_day(); + } + + auto end1 = std::chrono::high_resolution_clock::now(); + + if (argc >= 3) { + if (argv[2] == std::string("millis")) { + std::cout << "Tests completed in " << std::chrono::duration_cast(end1 - begin1).count() << " milliseconds"<< std::endl; + } else if (argv[2] == std::string("nanos")) { + std::cout << "Tests completed in " << std::chrono::duration_cast(end1 - begin1).count() << " nanoseconds"<< std::endl; + } else if (argv[2] == std::string("micros")) { + std::cout << "Tests completed in " << std::chrono::duration_cast(end1 - begin1).count() << " microsenconds"<< std::endl; + } else { + std::cout << "Unkown time scale '" << argv[2] << "'" << std::endl; + } + } else { + std::cout << "Tests completed in " << std::chrono::duration_cast(end1 - begin1).count() << " microseconds"<< std::endl; + } + + return 0; +} + diff --git a/2020/misc/print.hpp b/2020/misc/print.hpp new file mode 100644 index 0000000..5960cd8 --- /dev/null +++ b/2020/misc/print.hpp @@ -0,0 +1,31 @@ +/******************************************************************************* + * + * Copyright (c) 2020 Gnarwhal + * + * ----------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files(the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + *******************************************************************************/ + +#ifndef TEST_BUILD +#define print(x) std::cout << (x) << std::endl +#else +#define print(x) +#endif diff --git a/2020/types.cpp b/2020/misc/types.cpp similarity index 100% rename from 2020/types.cpp rename to 2020/misc/types.cpp diff --git a/2020/types.hpp b/2020/misc/types.hpp similarity index 100% rename from 2020/types.hpp rename to 2020/misc/types.hpp