diff --git a/Cargo.lock b/Cargo.lock index 7d4d45c..34cb2c1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -89,6 +89,7 @@ name = "y2016" version = "0.1.0" dependencies = [ "md5", + "utils", ] [[package]] @@ -114,6 +115,9 @@ version = "0.1.0" [[package]] name = "y2022" version = "0.1.0" +dependencies = [ + "utils", +] [[package]] name = "y2023" diff --git a/template/bin/d.rs.tmpl b/template/bin/d.rs.tmpl index b907d64..b87359d 100644 --- a/template/bin/d.rs.tmpl +++ b/template/bin/d.rs.tmpl @@ -1,10 +1,17 @@ -use std::fs; +use std::{fs, time::Instant}; +use utils::time::get_elapsed_string; use y{{YEAR}}::days::d{{DAY}}; fn main() { + let now = Instant::now(); + println!("Part 1:"); part1(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); + let now = Instant::now(); + println!("Part 2:"); part2(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); } fn part1() { diff --git a/y2015/src/bin/d1.rs b/y2015/src/bin/d1.rs index 0ef8964..9d8aceb 100644 --- a/y2015/src/bin/d1.rs +++ b/y2015/src/bin/d1.rs @@ -1,20 +1,27 @@ -use std::fs; +use std::{fs, time::Instant}; +use utils::time::get_elapsed_string; use y2015::days::d1; fn main() { + let now = Instant::now(); + println!("Part 1:"); part1(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); + let now = Instant::now(); + println!("Part 2:"); part2(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); } fn part1() { let root = env!("CARGO_MANIFEST_DIR"); let content = fs::read_to_string(format!("{root}/resources/1_input.txt")).unwrap(); - println!("{}", d1::process_part1(&content)); + println!("Answer: {}", d1::process_part1(&content)); } fn part2() { let root = env!("CARGO_MANIFEST_DIR"); let content = fs::read_to_string(format!("{root}/resources/1_input.txt")).unwrap(); - println!("{}", d1::process_part2(&content)); + println!("Answer: {}", d1::process_part2(&content)); } diff --git a/y2015/src/bin/d10.rs b/y2015/src/bin/d10.rs index 9710707..dc183b4 100644 --- a/y2015/src/bin/d10.rs +++ b/y2015/src/bin/d10.rs @@ -1,8 +1,17 @@ +use std::time::Instant; + +use utils::time::get_elapsed_string; use y2015::days::d10; fn main() { + let now = Instant::now(); + println!("Part 1:"); part1(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); + let now = Instant::now(); + println!("Part 2:"); part2(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); } fn part1() { diff --git a/y2015/src/bin/d11.rs b/y2015/src/bin/d11.rs index e431d6b..bd31bcd 100644 --- a/y2015/src/bin/d11.rs +++ b/y2015/src/bin/d11.rs @@ -1,8 +1,17 @@ +use std::time::Instant; + +use utils::time::get_elapsed_string; use y2015::days::d11; fn main() { + let now = Instant::now(); + println!("Part 1:"); part1(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); + let now = Instant::now(); + println!("Part 2:"); part2(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); } fn part1() { diff --git a/y2015/src/bin/d12.rs b/y2015/src/bin/d12.rs index 9e1a23a..8c61fa5 100644 --- a/y2015/src/bin/d12.rs +++ b/y2015/src/bin/d12.rs @@ -1,10 +1,17 @@ -use std::fs; +use std::{fs, time::Instant}; +use utils::time::get_elapsed_string; use y2015::days::d12; fn main() { + let now = Instant::now(); + println!("Part 1:"); part1(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); + let now = Instant::now(); + println!("Part 2:"); part2(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); } fn part1() { diff --git a/y2015/src/bin/d13.rs b/y2015/src/bin/d13.rs index 3c9adc9..0be8ef5 100644 --- a/y2015/src/bin/d13.rs +++ b/y2015/src/bin/d13.rs @@ -1,10 +1,17 @@ -use std::fs; +use std::{fs, time::Instant}; +use utils::time::get_elapsed_string; use y2015::days::d13; fn main() { + let now = Instant::now(); + println!("Part 1:"); part1(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); + let now = Instant::now(); + println!("Part 2:"); part2(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); } fn part1() { diff --git a/y2015/src/bin/d14.rs b/y2015/src/bin/d14.rs index 3c18e51..dff17f8 100644 --- a/y2015/src/bin/d14.rs +++ b/y2015/src/bin/d14.rs @@ -1,10 +1,17 @@ -use std::fs; +use std::{fs, time::Instant}; +use utils::time::get_elapsed_string; use y2015::days::d14; fn main() { + let now = Instant::now(); + println!("Part 1:"); part1(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); + let now = Instant::now(); + println!("Part 2:"); part2(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); } fn part1() { diff --git a/y2015/src/bin/d15.rs b/y2015/src/bin/d15.rs index 6b9c277..64937d3 100644 --- a/y2015/src/bin/d15.rs +++ b/y2015/src/bin/d15.rs @@ -1,10 +1,17 @@ -use std::fs; +use std::{fs, time::Instant}; +use utils::time::get_elapsed_string; use y2015::days::d15; fn main() { + let now = Instant::now(); + println!("Part 1:"); part1(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); + let now = Instant::now(); + println!("Part 2:"); part2(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); } fn part1() { diff --git a/y2015/src/bin/d16.rs b/y2015/src/bin/d16.rs index 68a4586..8d30300 100644 --- a/y2015/src/bin/d16.rs +++ b/y2015/src/bin/d16.rs @@ -1,10 +1,17 @@ -use std::fs; +use std::{fs, time::Instant}; +use utils::time::get_elapsed_string; use y2015::days::d16; fn main() { + let now = Instant::now(); + println!("Part 1:"); part1(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); + let now = Instant::now(); + println!("Part 2:"); part2(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); } fn part1() { diff --git a/y2015/src/bin/d17.rs b/y2015/src/bin/d17.rs index d6bf4ec..bc5a4a6 100644 --- a/y2015/src/bin/d17.rs +++ b/y2015/src/bin/d17.rs @@ -1,10 +1,17 @@ -use std::fs; +use std::{fs, time::Instant}; +use utils::time::get_elapsed_string; use y2015::days::d17; fn main() { + let now = Instant::now(); + println!("Part 1:"); part1(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); + let now = Instant::now(); + println!("Part 2:"); part2(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); } fn part1() { diff --git a/y2015/src/bin/d18.rs b/y2015/src/bin/d18.rs index ad1e0bd..b3be967 100644 --- a/y2015/src/bin/d18.rs +++ b/y2015/src/bin/d18.rs @@ -1,10 +1,17 @@ -use std::fs; +use std::{fs, time::Instant}; +use utils::time::get_elapsed_string; use y2015::days::d18; fn main() { + let now = Instant::now(); + println!("Part 1:"); part1(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); + let now = Instant::now(); + println!("Part 2:"); part2(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); } fn part1() { diff --git a/y2015/src/bin/d19.rs b/y2015/src/bin/d19.rs index b3919f5..7c19af7 100644 --- a/y2015/src/bin/d19.rs +++ b/y2015/src/bin/d19.rs @@ -1,10 +1,17 @@ -use std::fs; +use std::{fs, time::Instant}; +use utils::time::get_elapsed_string; use y2015::days::d19; fn main() { + let now = Instant::now(); + println!("Part 1:"); part1(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); + let now = Instant::now(); + println!("Part 2:"); part2(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); } fn part1() { diff --git a/y2015/src/bin/d2.rs b/y2015/src/bin/d2.rs index 40ee9d0..e6ec22d 100644 --- a/y2015/src/bin/d2.rs +++ b/y2015/src/bin/d2.rs @@ -1,10 +1,17 @@ -use std::fs; +use std::{fs, time::Instant}; +use utils::time::get_elapsed_string; use y2015::days::d2; fn main() { + let now = Instant::now(); + println!("Part 1:"); part1(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); + let now = Instant::now(); + println!("Part 2:"); part2(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); } fn part1() { diff --git a/y2015/src/bin/d20.rs b/y2015/src/bin/d20.rs index 4f28bcb..ee70d51 100644 --- a/y2015/src/bin/d20.rs +++ b/y2015/src/bin/d20.rs @@ -1,8 +1,17 @@ +use std::time::Instant; + +use utils::time::get_elapsed_string; use y2015::days::d20; fn main() { + let now = Instant::now(); + println!("Part 1:"); part1(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); + let now = Instant::now(); + println!("Part 2:"); part2(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); } fn part1() { diff --git a/y2015/src/bin/d21.rs b/y2015/src/bin/d21.rs index 977185c..701ce3e 100644 --- a/y2015/src/bin/d21.rs +++ b/y2015/src/bin/d21.rs @@ -1,10 +1,17 @@ -use std::fs; +use std::{fs, time::Instant}; +use utils::time::get_elapsed_string; use y2015::days::d21; fn main() { + let now = Instant::now(); + println!("Part 1:"); part1(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); + let now = Instant::now(); + println!("Part 2:"); part2(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); } fn part1() { diff --git a/y2015/src/bin/d22.rs b/y2015/src/bin/d22.rs index 7b23363..8b48347 100644 --- a/y2015/src/bin/d22.rs +++ b/y2015/src/bin/d22.rs @@ -1,10 +1,17 @@ -use std::fs; +use std::{fs, time::Instant}; +use utils::time::get_elapsed_string; use y2015::days::d22; fn main() { + let now = Instant::now(); + println!("Part 1:"); part1(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); + let now = Instant::now(); + println!("Part 2:"); part2(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); } fn part1() { diff --git a/y2015/src/bin/d23.rs b/y2015/src/bin/d23.rs index 3e66898..ff819a3 100644 --- a/y2015/src/bin/d23.rs +++ b/y2015/src/bin/d23.rs @@ -1,10 +1,17 @@ -use std::fs; +use std::{fs, time::Instant}; +use utils::time::get_elapsed_string; use y2015::days::d23; fn main() { + let now = Instant::now(); + println!("Part 1:"); part1(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); + let now = Instant::now(); + println!("Part 2:"); part2(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); } fn part1() { diff --git a/y2015/src/bin/d24.rs b/y2015/src/bin/d24.rs index af4878c..2850a96 100644 --- a/y2015/src/bin/d24.rs +++ b/y2015/src/bin/d24.rs @@ -1,10 +1,17 @@ -use std::fs; +use std::{fs, time::Instant}; +use utils::time::get_elapsed_string; use y2015::days::d24; fn main() { + let now = Instant::now(); + println!("Part 1:"); part1(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); + let now = Instant::now(); + println!("Part 2:"); part2(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); } fn part1() { diff --git a/y2015/src/bin/d25.rs b/y2015/src/bin/d25.rs index 1079835..4a525fe 100644 --- a/y2015/src/bin/d25.rs +++ b/y2015/src/bin/d25.rs @@ -1,7 +1,13 @@ +use std::time::Instant; + +use utils::time::get_elapsed_string; use y2015::days::d25; fn main() { + let now = Instant::now(); + println!("Part 1:"); part1(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); } fn part1() { diff --git a/y2015/src/bin/d3.rs b/y2015/src/bin/d3.rs index 5fe04a8..8110da8 100644 --- a/y2015/src/bin/d3.rs +++ b/y2015/src/bin/d3.rs @@ -1,10 +1,17 @@ -use std::fs; +use std::{fs, time::Instant}; +use utils::time::get_elapsed_string; use y2015::days::d3; fn main() { + let now = Instant::now(); + println!("Part 1:"); part1(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); + let now = Instant::now(); + println!("Part 2:"); part2(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); } fn part1() { diff --git a/y2015/src/bin/d4.rs b/y2015/src/bin/d4.rs index dcca0ed..031c7b2 100644 --- a/y2015/src/bin/d4.rs +++ b/y2015/src/bin/d4.rs @@ -1,10 +1,17 @@ use std::time::Instant; +use utils::time::get_elapsed_string; use y2015::days::d4; fn main() { + let now = Instant::now(); + println!("Part 1:"); part1(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); + let now = Instant::now(); + println!("Part 2:"); part2(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); } fn part1() { diff --git a/y2015/src/bin/d5.rs b/y2015/src/bin/d5.rs index 8e0e29c..df16b3c 100644 --- a/y2015/src/bin/d5.rs +++ b/y2015/src/bin/d5.rs @@ -1,10 +1,17 @@ -use std::fs; +use std::{fs, time::Instant}; +use utils::time::get_elapsed_string; use y2015::days::d5; fn main() { + let now = Instant::now(); + println!("Part 1:"); part1(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); + let now = Instant::now(); + println!("Part 2:"); part2(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); } fn part1() { diff --git a/y2015/src/bin/d6.rs b/y2015/src/bin/d6.rs index 89a882a..95c01e1 100644 --- a/y2015/src/bin/d6.rs +++ b/y2015/src/bin/d6.rs @@ -1,10 +1,17 @@ -use std::fs; +use std::{fs, time::Instant}; +use utils::time::get_elapsed_string; use y2015::days::d6; fn main() { + let now = Instant::now(); + println!("Part 1:"); part1(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); + let now = Instant::now(); + println!("Part 2:"); part2(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); } fn part1() { diff --git a/y2015/src/bin/d7.rs b/y2015/src/bin/d7.rs index f35d80b..af34236 100644 --- a/y2015/src/bin/d7.rs +++ b/y2015/src/bin/d7.rs @@ -1,10 +1,17 @@ -use std::fs; +use std::{fs, time::Instant}; +use utils::time::get_elapsed_string; use y2015::days::d7; fn main() { + let now = Instant::now(); + println!("Part 1:"); part1(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); + let now = Instant::now(); + println!("Part 2:"); part2(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); } fn part1() { diff --git a/y2015/src/bin/d8.rs b/y2015/src/bin/d8.rs index e2c9d7b..883f736 100644 --- a/y2015/src/bin/d8.rs +++ b/y2015/src/bin/d8.rs @@ -1,10 +1,17 @@ -use std::fs; +use std::{fs, time::Instant}; +use utils::time::get_elapsed_string; use y2015::days::d8; fn main() { + let now = Instant::now(); + println!("Part 1:"); part1(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); + let now = Instant::now(); + println!("Part 2:"); part2(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); } fn part1() { diff --git a/y2015/src/bin/d9.rs b/y2015/src/bin/d9.rs index 33b2269..b5696e9 100644 --- a/y2015/src/bin/d9.rs +++ b/y2015/src/bin/d9.rs @@ -1,10 +1,17 @@ -use std::fs; +use std::{fs, time::Instant}; +use utils::time::get_elapsed_string; use y2015::days::d9; fn main() { + let now = Instant::now(); + println!("Part 1:"); part1(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); + let now = Instant::now(); + println!("Part 2:"); part2(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); } fn part1() { diff --git a/y2016/Cargo.toml b/y2016/Cargo.toml index 48faf27..0a47a50 100644 --- a/y2016/Cargo.toml +++ b/y2016/Cargo.toml @@ -5,3 +5,4 @@ edition = "2021" [dependencies] md5 = { workspace = true } +utils = { workspace = true } diff --git a/y2016/src/bin/d1.rs b/y2016/src/bin/d1.rs index 30bd4ff..15925fe 100644 --- a/y2016/src/bin/d1.rs +++ b/y2016/src/bin/d1.rs @@ -1,10 +1,17 @@ -use std::fs; +use std::{fs, time::Instant}; +use utils::time::get_elapsed_string; use y2016::days::d1; fn main() { + let now = Instant::now(); + println!("Part 1:"); part1(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); + let now = Instant::now(); + println!("Part 2:"); part2(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); } fn part1() { diff --git a/y2016/src/bin/d2.rs b/y2016/src/bin/d2.rs index 8340949..e6a2a1a 100644 --- a/y2016/src/bin/d2.rs +++ b/y2016/src/bin/d2.rs @@ -1,10 +1,17 @@ -use std::fs; +use std::{fs, time::Instant}; +use utils::time::get_elapsed_string; use y2016::days::d2; fn main() { + let now = Instant::now(); + println!("Part 1:"); part1(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); + let now = Instant::now(); + println!("Part 2:"); part2(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); } fn part1() { diff --git a/y2016/src/bin/d3.rs b/y2016/src/bin/d3.rs index e5b68ca..b59149d 100644 --- a/y2016/src/bin/d3.rs +++ b/y2016/src/bin/d3.rs @@ -1,10 +1,17 @@ -use std::fs; +use std::{fs, time::Instant}; +use utils::time::get_elapsed_string; use y2016::days::d3; fn main() { + let now = Instant::now(); + println!("Part 1:"); part1(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); + let now = Instant::now(); + println!("Part 2:"); part2(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); } fn part1() { diff --git a/y2016/src/bin/d4.rs b/y2016/src/bin/d4.rs index abe2cfe..6a4a423 100644 --- a/y2016/src/bin/d4.rs +++ b/y2016/src/bin/d4.rs @@ -1,10 +1,17 @@ -use std::fs; +use std::{fs, time::Instant}; +use utils::time::get_elapsed_string; use y2016::days::d4; fn main() { + let now = Instant::now(); + println!("Part 1:"); part1(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); + let now = Instant::now(); + println!("Part 2:"); part2(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); } fn part1() { diff --git a/y2016/src/bin/d5.rs b/y2016/src/bin/d5.rs index c6c926c..e0bdca9 100644 --- a/y2016/src/bin/d5.rs +++ b/y2016/src/bin/d5.rs @@ -1,8 +1,17 @@ +use std::time::Instant; + +use utils::time::get_elapsed_string; use y2016::days::d5; fn main() { + let now = Instant::now(); + println!("Part 1:"); part1(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); + let now = Instant::now(); + println!("Part 2:"); part2(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); } fn part1() { diff --git a/y2016/src/bin/d6.rs b/y2016/src/bin/d6.rs index d5e5c02..2b34a51 100644 --- a/y2016/src/bin/d6.rs +++ b/y2016/src/bin/d6.rs @@ -1,10 +1,17 @@ -use std::fs; +use std::{fs, time::Instant}; +use utils::time::get_elapsed_string; use y2016::days::d6; fn main() { + let now = Instant::now(); + println!("Part 1:"); part1(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); + let now = Instant::now(); + println!("Part 2:"); part2(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); } fn part1() { diff --git a/y2022/Cargo.toml b/y2022/Cargo.toml index c79c1a3..1fcbda6 100644 --- a/y2022/Cargo.toml +++ b/y2022/Cargo.toml @@ -4,3 +4,4 @@ version = "0.1.0" edition = "2021" [dependencies] +utils = { workspace = true } diff --git a/y2022/src/bin/d1.rs b/y2022/src/bin/d1.rs index 16728ff..becc569 100644 --- a/y2022/src/bin/d1.rs +++ b/y2022/src/bin/d1.rs @@ -1,10 +1,17 @@ -use std::fs; +use std::{fs, time::Instant}; +use utils::time::get_elapsed_string; use y2022::days::d1; fn main() { + let now = Instant::now(); + println!("Part 1:"); part1(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); + let now = Instant::now(); + println!("Part 2:"); part2(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); } fn part1() { diff --git a/y2022/src/bin/d2.rs b/y2022/src/bin/d2.rs index 08e557a..487bbc1 100644 --- a/y2022/src/bin/d2.rs +++ b/y2022/src/bin/d2.rs @@ -1,10 +1,17 @@ -use std::fs; +use std::{fs, time::Instant}; +use utils::time::get_elapsed_string; use y2022::days::d2::{process_part1, process_part2}; fn main() { + let now = Instant::now(); + println!("Part 1:"); part1(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); + let now = Instant::now(); + println!("Part 2:"); part2(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); } fn part1() { diff --git a/y2022/src/bin/d3.rs b/y2022/src/bin/d3.rs index 128e9ee..545ab45 100644 --- a/y2022/src/bin/d3.rs +++ b/y2022/src/bin/d3.rs @@ -1,10 +1,17 @@ -use std::fs; +use std::{fs, time::Instant}; +use utils::time::get_elapsed_string; use y2022::days::d3; fn main() { + let now = Instant::now(); + println!("Part 1:"); part1(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); + let now = Instant::now(); + println!("Part 2:"); part2(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); } fn part1() { diff --git a/y2022/src/bin/d4.rs b/y2022/src/bin/d4.rs index 429e016..9bf6b4c 100644 --- a/y2022/src/bin/d4.rs +++ b/y2022/src/bin/d4.rs @@ -1,10 +1,17 @@ -use std::fs; +use std::{fs, time::Instant}; +use utils::time::get_elapsed_string; use y2022::days::d4; fn main() { + let now = Instant::now(); + println!("Part 1:"); part1(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); + let now = Instant::now(); + println!("Part 2:"); part2(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); } fn part1() { diff --git a/y2022/src/bin/d5.rs b/y2022/src/bin/d5.rs index 89a512b..58f888c 100644 --- a/y2022/src/bin/d5.rs +++ b/y2022/src/bin/d5.rs @@ -1,10 +1,17 @@ -use std::fs; +use std::{fs, time::Instant}; +use utils::time::get_elapsed_string; use y2022::days::d5; fn main() { + let now = Instant::now(); + println!("Part 1:"); part1(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); + let now = Instant::now(); + println!("Part 2:"); part2(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); } fn part1() { diff --git a/y2022/src/bin/d6.rs b/y2022/src/bin/d6.rs index 744ad14..79be402 100644 --- a/y2022/src/bin/d6.rs +++ b/y2022/src/bin/d6.rs @@ -1,10 +1,17 @@ -use std::fs; +use std::{fs, time::Instant}; +use utils::time::get_elapsed_string; use y2022::days::d6; fn main() { + let now = Instant::now(); + println!("Part 1:"); part1(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); + let now = Instant::now(); + println!("Part 2:"); part2(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); } fn part1() { diff --git a/y2022/src/bin/d7.rs b/y2022/src/bin/d7.rs index 0c44e5a..1c7c502 100644 --- a/y2022/src/bin/d7.rs +++ b/y2022/src/bin/d7.rs @@ -1,10 +1,17 @@ -use std::fs; +use std::{fs, time::Instant}; +use utils::time::get_elapsed_string; use y2022::days::d7; fn main() { + let now = Instant::now(); + println!("Part 1:"); part1(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); + let now = Instant::now(); + println!("Part 2:"); part2(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); } fn part1() { diff --git a/y2022/src/bin/d8.rs b/y2022/src/bin/d8.rs index c93f452..fbe7d7b 100644 --- a/y2022/src/bin/d8.rs +++ b/y2022/src/bin/d8.rs @@ -1,10 +1,17 @@ -use std::fs; +use std::{fs, time::Instant}; +use utils::time::get_elapsed_string; use y2022::days::d8; fn main() { + let now = Instant::now(); + println!("Part 1:"); part1(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); + let now = Instant::now(); + println!("Part 2:"); part2(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); } fn part1() { diff --git a/y2022/src/bin/d9.rs b/y2022/src/bin/d9.rs index b304a60..ba71e4d 100644 --- a/y2022/src/bin/d9.rs +++ b/y2022/src/bin/d9.rs @@ -1,10 +1,17 @@ -use std::fs; +use std::{fs, time::Instant}; +use utils::time::get_elapsed_string; use y2022::days::d9; fn main() { + let now = Instant::now(); + println!("Part 1:"); part1(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); + let now = Instant::now(); + println!("Part 2:"); part2(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); } fn part1() { diff --git a/y2024/src/bin/d1.rs b/y2024/src/bin/d1.rs index 99ffae8..0bf89dd 100644 --- a/y2024/src/bin/d1.rs +++ b/y2024/src/bin/d1.rs @@ -1,10 +1,17 @@ -use std::fs; +use std::{fs, time::Instant}; +use utils::time::get_elapsed_string; use y2024::days::d1; fn main() { + let now = Instant::now(); + println!("Part 1:"); part1(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); + let now = Instant::now(); + println!("Part 2:"); part2(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); } fn part1() { diff --git a/y2024/src/bin/d10.rs b/y2024/src/bin/d10.rs index 3b18417..a376e62 100644 --- a/y2024/src/bin/d10.rs +++ b/y2024/src/bin/d10.rs @@ -1,10 +1,17 @@ -use std::fs; +use std::{fs, time::Instant}; +use utils::time::get_elapsed_string; use y2024::days::d10; fn main() { + let now = Instant::now(); + println!("Part 1:"); part1(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); + let now = Instant::now(); + println!("Part 2:"); part2(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); } fn part1() { diff --git a/y2024/src/bin/d2.rs b/y2024/src/bin/d2.rs index e891b19..6b70ffc 100644 --- a/y2024/src/bin/d2.rs +++ b/y2024/src/bin/d2.rs @@ -1,10 +1,17 @@ -use std::fs; +use std::{fs, time::Instant}; +use utils::time::get_elapsed_string; use y2024::days::d2; fn main() { + let now = Instant::now(); + println!("Part 1:"); part1(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); + let now = Instant::now(); + println!("Part 2:"); part2(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); } fn part1() { diff --git a/y2024/src/bin/d3.rs b/y2024/src/bin/d3.rs index e9d9618..a8bf11e 100644 --- a/y2024/src/bin/d3.rs +++ b/y2024/src/bin/d3.rs @@ -1,10 +1,17 @@ -use std::fs; +use std::{fs, time::Instant}; +use utils::time::get_elapsed_string; use y2024::days::d3; fn main() { + let now = Instant::now(); + println!("Part 1:"); part1(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); + let now = Instant::now(); + println!("Part 2:"); part2(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); } fn part1() { diff --git a/y2024/src/bin/d4.rs b/y2024/src/bin/d4.rs index c6a2a62..69cfcef 100644 --- a/y2024/src/bin/d4.rs +++ b/y2024/src/bin/d4.rs @@ -1,10 +1,17 @@ -use std::fs; +use std::{fs, time::Instant}; +use utils::time::get_elapsed_string; use y2024::days::d4; fn main() { + let now = Instant::now(); + println!("Part 1:"); part1(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); + let now = Instant::now(); + println!("Part 2:"); part2(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); } fn part1() { diff --git a/y2024/src/bin/d5.rs b/y2024/src/bin/d5.rs index abb7eb2..803cd0a 100644 --- a/y2024/src/bin/d5.rs +++ b/y2024/src/bin/d5.rs @@ -1,10 +1,17 @@ -use std::fs; +use std::{fs, time::Instant}; +use utils::time::get_elapsed_string; use y2024::days::d5; fn main() { + let now = Instant::now(); + println!("Part 1:"); part1(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); + let now = Instant::now(); + println!("Part 2:"); part2(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); } fn part1() { diff --git a/y2024/src/bin/d6.rs b/y2024/src/bin/d6.rs index 2c9390d..8480d6b 100644 --- a/y2024/src/bin/d6.rs +++ b/y2024/src/bin/d6.rs @@ -1,10 +1,17 @@ -use std::fs; +use std::{fs, time::Instant}; +use utils::time::get_elapsed_string; use y2024::days::d6; fn main() { + let now = Instant::now(); + println!("Part 1:"); part1(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); + let now = Instant::now(); + println!("Part 2:"); part2(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); } fn part1() { diff --git a/y2024/src/bin/d7.rs b/y2024/src/bin/d7.rs index 078acb9..46bc6a4 100644 --- a/y2024/src/bin/d7.rs +++ b/y2024/src/bin/d7.rs @@ -1,10 +1,17 @@ -use std::fs; +use std::{fs, time::Instant}; +use utils::time::get_elapsed_string; use y2024::days::d7; fn main() { + let now = Instant::now(); + println!("Part 1:"); part1(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); + let now = Instant::now(); + println!("Part 2:"); part2(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); } fn part1() { diff --git a/y2024/src/bin/d8.rs b/y2024/src/bin/d8.rs index 01c8546..821241c 100644 --- a/y2024/src/bin/d8.rs +++ b/y2024/src/bin/d8.rs @@ -1,10 +1,17 @@ -use std::fs; +use std::{fs, time::Instant}; +use utils::time::get_elapsed_string; use y2024::days::d8; fn main() { + let now = Instant::now(); + println!("Part 1:"); part1(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); + let now = Instant::now(); + println!("Part 2:"); part2(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); } fn part1() { diff --git a/y2024/src/bin/d9.rs b/y2024/src/bin/d9.rs index 07158a2..82e0207 100644 --- a/y2024/src/bin/d9.rs +++ b/y2024/src/bin/d9.rs @@ -1,10 +1,17 @@ -use std::fs; +use std::{fs, time::Instant}; +use utils::time::get_elapsed_string; use y2024::days::d9; fn main() { + let now = Instant::now(); + println!("Part 1:"); part1(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); + let now = Instant::now(); + println!("Part 2:"); part2(); + println!("Ran in {}", get_elapsed_string(now.elapsed())); } fn part1() {