From 14e52b234f6cbc61a015c28550a366b676b8209d Mon Sep 17 00:00:00 2001 From: Adam Wick Date: Sun, 1 Dec 2024 21:41:28 -0800 Subject: [PATCH] day1 and day2 --- .gitignore | 1 + Cargo.lock | 290 +++++++++++++ Cargo.toml | 9 + src/day1.rs | 83 ++++ src/day2.rs | 106 +++++ src/main.rs | 81 ++++ tests/01_example | 6 + tests/01_input1.txt | 1000 +++++++++++++++++++++++++++++++++++++++++++ tests/02_example | 6 + tests/02_input.txt | 1000 +++++++++++++++++++++++++++++++++++++++++++ 10 files changed, 2582 insertions(+) create mode 100644 .gitignore create mode 100644 Cargo.lock create mode 100644 Cargo.toml create mode 100644 src/day1.rs create mode 100644 src/day2.rs create mode 100644 src/main.rs create mode 100644 tests/01_example create mode 100644 tests/01_input1.txt create mode 100644 tests/02_example create mode 100644 tests/02_input.txt diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ea8c4bf --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/target diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..a1fc43e --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,290 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "advent2024" +version = "0.1.0" +dependencies = [ + "clap", + "error-stack", + "thiserror", +] + +[[package]] +name = "anstream" +version = "0.6.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8acc5369981196006228e28809f761875c0327210a891e941f4c683b3a99529b" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55cc3b69f167a1ef2e161439aa98aed94e6028e5f9a59be9a6ffb47aef1651f9" + +[[package]] +name = "anstyle-parse" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b2d16507662817a6a20a9ea92df6652ee4f94f914589377d69f3b21bc5798a9" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79947af37f4177cfead1110013d678905c37501914fba0efea834c3fe9a8d60c" +dependencies = [ + "windows-sys", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2109dbce0e72be3ec00bed26e6a7479ca384ad226efdd66db8fa2e3a38c83125" +dependencies = [ + "anstyle", + "windows-sys", +] + +[[package]] +name = "anyhow" +version = "1.0.93" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c95c10ba0b00a02636238b814946408b1322d5ac4760326e6fb8ec956d85775" + +[[package]] +name = "clap" +version = "4.5.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb3b4b9e5a7c7514dfa52869339ee98b3156b0bfb4e8a77c4ff4babb64b1604f" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.5.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b17a95aa67cc7b5ebd32aa5370189aa0d79069ef1c64ce893bd30fb24bff20ec" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim", +] + +[[package]] +name = "clap_derive" +version = "4.5.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ac6a0c7b1a9e9a5186361f67dfa1b88213572f427fb9ab038efb2bd8c582dab" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "clap_lex" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afb84c814227b90d6895e01398aee0d8033c00e7466aca416fb6a8e0eb19d8a7" + +[[package]] +name = "colorchoice" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" + +[[package]] +name = "error-stack" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe413319145d1063f080f27556fd30b1d70b01e2ba10c2a6e40d4be982ffc5d1" +dependencies = [ + "anyhow", + "rustc_version", +] + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" + +[[package]] +name = "proc-macro2" +version = "1.0.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver", +] + +[[package]] +name = "semver" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "syn" +version = "2.0.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44d46482f1c1c87acd84dea20c1bf5ebff4c757009ed6bf19cfd36fb10e92c4e" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "thiserror" +version = "2.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c006c85c7651b3cf2ada4584faa36773bd07bac24acfb39f3c431b36d7e667aa" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f077553d607adc1caf65430528a576c757a71ed73944b66ebb58ef2bbd243568" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "unicode-ident" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83" + +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..cb739ef --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,9 @@ +[package] +name = "advent2024" +version = "0.1.0" +edition = "2021" + +[dependencies] +clap = { version = "4.5.21", features = ["derive"] } +error-stack = "0.5.0" +thiserror = "2.0.3" diff --git a/src/day1.rs b/src/day1.rs new file mode 100644 index 0000000..eb98d05 --- /dev/null +++ b/src/day1.rs @@ -0,0 +1,83 @@ +use error_stack::ResultExt; +use std::num::ParseIntError; +use std::str::FromStr; +use thiserror::Error; + +#[derive(Debug, Error)] +pub enum Error { + #[error("Parsing error")] + ParseError, +} + +pub fn run(buffer: String) -> error_stack::Result<(), Error> { + let (mut lefts, mut rights) = parse_input(buffer).change_context(Error::ParseError)?; + + lefts.sort(); + rights.sort(); + + let mut total_difference = 0; + + for (left, right) in lefts.iter().zip(rights.iter()) { + let delta = std::cmp::max(left, right) - std::cmp::min(left, right); + total_difference += delta; + } + + println!( + "The total difference of the sorted sets is {}", + total_difference + ); + + let mut similarity_score = 0; + + for left in lefts.iter() { + let mut count = 0; + + for right in rights.iter() { + if left == right { + count += 1; + } + } + + similarity_score += left * count; + } + + println!("The similarity score is {}", similarity_score); + + Ok(()) +} + +#[derive(Debug, Error)] +enum ParseError { + #[error("Invalid left value: {0}")] + InvalidLeftValue(ParseIntError), + #[error("Invalid right value: {0}")] + InvalidRightValue(ParseIntError), +} + +fn parse_input(buffer: String) -> error_stack::Result<(Vec, Vec), ParseError> { + let mut lefts = vec![]; + let mut rights = vec![]; + + for (line_no, line) in buffer.lines().enumerate() { + let Some((left, rest)) = line.split_once(" ") else { + continue; + }; + + let right = rest.trim(); + + let left_val = u64::from_str(left) + .map_err(ParseError::InvalidLeftValue) + .attach_printable(format!("on line {line_no}")) + .attach_printable(format!("input value '{left}'"))?; + + let right_val = u64::from_str(right) + .map_err(ParseError::InvalidRightValue) + .attach_printable(format!("on line {line_no}")) + .attach_printable(format!("input value '{right}'"))?; + + lefts.push(left_val); + rights.push(right_val); + } + + Ok((lefts, rights)) +} diff --git a/src/day2.rs b/src/day2.rs new file mode 100644 index 0000000..a72f676 --- /dev/null +++ b/src/day2.rs @@ -0,0 +1,106 @@ +use error_stack::ResultExt; +use std::num::ParseIntError; +use std::str::FromStr; +use thiserror::Error; + +#[derive(Debug, Error)] +pub enum Error { + #[error("Parsing error")] + ParseError, +} + +pub fn run(buffer: String) -> error_stack::Result<(), Error> { + let readings = parse_input(buffer).change_context(Error::ParseError)?; + + let mut safe_reports = 0; + let mut dampened_reports = 0; + + 'outer: for reading in readings.iter() { + if is_good_report(reading.iter().copied()) { + safe_reports += 1; + } else { + for i in 0..reading.len() { + let new_iter = reading + .iter() + .take(i) + .chain(reading.iter().skip(i + 1)) + .copied(); + + if is_good_report(new_iter) { + dampened_reports += 1; + continue 'outer; + } + } + } + } + + println!("{} of {} reports are safe.", safe_reports, readings.len()); + println!( + "{} of {} reports are safe or have one bad item.", + safe_reports + dampened_reports, + readings.len() + ); + + Ok(()) +} + +fn is_good_report>(mut reading: I) -> bool { + let Some(mut last) = reading.next() else { + return true; + }; + + let mut is_ascending = None; + + for subsequent in reading { + if std::cmp::max(subsequent, last) - std::cmp::min(subsequent, last) > 3 { + return false; + } + + match is_ascending { + None if subsequent > last => { + is_ascending = Some(true); + } + + None if subsequent < last => { + is_ascending = Some(false); + } + + None => return false, + + Some(true) if subsequent <= last => return false, + Some(false) if subsequent >= last => return false, + Some(_) => {} + } + + last = subsequent; + } + + true +} + +#[derive(Debug, Error)] +enum ParseError { + #[error("Invalid numeric value: {0}")] + InvalidNumericValue(ParseIntError), +} + +fn parse_input(buffer: String) -> error_stack::Result>, ParseError> { + let mut result = vec![]; + + for (line_no, line) in buffer.lines().enumerate() { + let mut items = vec![]; + + for item in line.split(" ") { + let item_val = u64::from_str(item) + .map_err(ParseError::InvalidNumericValue) + .attach_printable(format!("on line {line_no}")) + .attach_printable(format!("input value: '{item}'"))?; + + items.push(item_val); + } + + result.push(items); + } + + Ok(result) +} diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..5573d45 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,81 @@ +mod day1; +mod day2; + +use clap::{Parser, Subcommand}; +use error_stack::{report, ResultExt}; +use std::path::PathBuf; +use thiserror::Error; + +#[derive(Debug, Parser)] +struct Argument { + #[command(subcommand)] + day: Day, + #[arg(short, long)] + input: Option, +} + +#[derive(Debug, Subcommand)] +enum Day { + /// Read in a data stream containing space-separated numbers, and compute + /// the total difference between them once sorted, along with a similarity + /// score + Day1, + /// Count how many readings from the RNR are safe + Day2, +} + +#[derive(Debug, Error)] +enum TopLevelError { + #[error("Input file is not actually a file.")] + NotActualFile, + #[error("Failed to read input file")] + InputReadError, + #[error("Failed to read input from stdin (not input file given)")] + StdinReadError, + #[error("Failed to run day 1 code")] + Day1, + #[error("Failed to run day 2 code")] + Day2, +} + +fn real_main(argument: Argument) -> error_stack::Result<(), TopLevelError> { + let (input_buffer, input_attachment) = match argument.input { + None => { + let buffer = std::io::read_to_string(std::io::stdin()) + .map_err(|x| report!(TopLevelError::StdinReadError).attach_printable(x))?; + + (buffer, "from standard input".to_string()) + } + + Some(path) => { + if !path.is_file() { + return Err(report!(TopLevelError::NotActualFile)) + .attach_printable(format!("file path: {}", path.display())); + } + + let buffer = std::fs::read_to_string(&path).map_err(|x| { + report!(TopLevelError::InputReadError) + .attach_printable(format!("file path: {}", path.display())) + .attach_printable(x) + })?; + + (buffer, format!("from input file {}", path.display())) + } + }; + + match argument.day { + Day::Day1 => day1::run(input_buffer) + .change_context(TopLevelError::Day1) + .attach_printable(input_attachment), + Day::Day2 => day2::run(input_buffer) + .change_context(TopLevelError::Day2) + .attach_printable(input_attachment), + } +} + +fn main() { + let argument = Argument::parse(); + if let Err(e) = real_main(argument) { + eprintln!("ERROR: {}", e); + } +} diff --git a/tests/01_example b/tests/01_example new file mode 100644 index 0000000..b8af9ad --- /dev/null +++ b/tests/01_example @@ -0,0 +1,6 @@ +3 4 +4 3 +2 5 +1 3 +3 9 +3 3 diff --git a/tests/01_input1.txt b/tests/01_input1.txt new file mode 100644 index 0000000..86c469c --- /dev/null +++ b/tests/01_input1.txt @@ -0,0 +1,1000 @@ +53906 14872 +35867 86182 +61313 43656 +23620 85315 +96434 90834 +70853 80045 +81024 46279 +74096 30947 +95143 21374 +58372 72621 +31935 12389 +49854 67579 +86609 43656 +89364 63407 +74266 14457 +52098 88395 +96964 96234 +49393 18203 +50534 68865 +15769 46056 +80451 31396 +74551 38740 +91700 86211 +93090 21692 +17501 34796 +16736 15045 +46056 37224 +75968 93912 +97701 75324 +28685 71207 +51195 28531 +74109 81902 +61906 30947 +61901 26456 +27949 31935 +80781 31935 +45869 63848 +76250 91948 +92161 88896 +92901 95050 +84135 56554 +36445 85108 +91602 50652 +14229 42099 +26675 53544 +31839 80370 +79535 80370 +36655 21828 +68093 10740 +49052 30403 +38777 87413 +10824 94461 +38968 80370 +63083 81902 +95411 55634 +69727 81902 +93596 70536 +52663 31396 +65999 68564 +59890 40680 +66226 43656 +94707 13595 +13899 79022 +25283 66901 +79946 33564 +80152 25915 +78359 38273 +28675 78207 +51401 24017 +21022 36263 +96272 97201 +22693 27307 +21648 97487 +46178 97979 +17466 60051 +82661 25915 +39775 93045 +48681 60562 +47199 86686 +30660 85874 +18285 69937 +55428 50228 +98906 13151 +86638 57318 +48728 66727 +78268 80222 +32191 18625 +75544 96995 +38692 27814 +51182 72597 +24564 14872 +78193 43656 +14830 98087 +51013 91047 +40389 62018 +80648 34735 +25915 48415 +75278 30947 +73740 76891 +47851 63741 +30743 93960 +30074 81716 +47127 31935 +66658 14609 +81404 13612 +78838 34796 +98988 56858 +61023 95843 +44069 79751 +58419 22373 +88253 33943 +10357 68564 +65647 75968 +56636 49814 +96378 30947 +61167 62569 +34557 37250 +64400 55670 +51614 31935 +12364 73721 +71834 63350 +11214 15293 +84197 67580 +46279 19369 +85435 25099 +87320 40454 +28341 16142 +65983 71345 +94333 79356 +66873 33981 +50771 31396 +91221 54646 +63742 34796 +99770 46279 +37731 80045 +20432 21157 +39263 76136 +99080 56687 +29242 32173 +93843 46279 +53850 18085 +68835 75005 +43354 40124 +48317 29974 +89326 97201 +75434 22373 +70473 25915 +63394 48255 +38016 68564 +78812 80045 +93261 58244 +20014 64971 +11924 11780 +21157 53840 +24802 89474 +55997 38754 +87219 25915 +20988 14872 +39639 28428 +29464 51586 +61672 78802 +96734 65594 +55764 14925 +52658 49815 +66306 81902 +19417 81326 +20305 17693 +33337 15419 +58435 11780 +88271 55426 +72760 70448 +62171 41784 +35420 75968 +85791 80045 +86874 28578 +47942 65464 +65982 43656 +54647 80045 +76794 72117 +71733 56858 +99560 97201 +57741 48255 +19684 38234 +82201 34796 +56598 81902 +78671 30403 +57520 81902 +28794 80045 +70718 36673 +12894 89585 +80420 88896 +75179 80045 +37527 94333 +68865 89708 +54484 70184 +22482 90992 +28787 99580 +23380 50228 +24819 34018 +23039 26417 +34777 30403 +38089 98258 +40091 90301 +65391 81902 +64984 88288 +47803 19170 +54239 23050 +89439 35940 +64104 15601 +42956 50228 +60123 42357 +62887 87025 +50719 56858 +60551 40959 +32730 73652 +80253 80045 +31948 19369 +33170 19369 +43380 88896 +66465 54668 +68963 25915 +74433 40124 +42272 11349 +45882 51505 +62636 26196 +97266 11220 +23083 96587 +27358 76569 +44481 81623 +11314 30728 +64712 57329 +95360 81902 +43100 83387 +22699 72297 +95680 57279 +12170 30947 +51297 59853 +48255 49975 +23355 34796 +55264 96834 +43234 95736 +58663 66937 +24467 93318 +31569 39898 +91720 37056 +17395 97253 +87456 68460 +61344 13591 +50316 50228 +50313 82900 +33328 41831 +70391 98955 +40124 13612 +80337 21838 +66151 17628 +14932 57871 +34464 48255 +18164 70338 +84969 14872 +30898 68564 +76526 11873 +41007 43656 +46997 52069 +74614 79205 +97267 80045 +13525 56858 +83587 23900 +70678 51307 +96613 20308 +39592 31396 +44365 91747 +44840 87970 +99891 90134 +58567 33972 +58851 43402 +87728 30403 +84786 37227 +13329 32507 +93229 90123 +43915 54511 +83982 27814 +19567 88896 +33979 87294 +40170 43656 +97852 48739 +45928 94736 +74935 28466 +97730 84011 +74826 95244 +68208 24359 +53130 92198 +41725 78978 +57089 11780 +98073 35872 +23652 11780 +97201 41849 +87155 71818 +88640 79810 +37745 21157 +14056 18175 +95658 56858 +48755 94333 +13619 45286 +81792 43656 +78244 31396 +30595 45955 +84035 95996 +60013 20192 +30544 13612 +94649 59748 +12343 75968 +37130 68564 +89486 25915 +30879 45350 +82252 76332 +72035 81326 +96757 39307 +12935 22093 +76836 96648 +13035 65492 +64394 56858 +68916 43656 +81474 31396 +90650 28126 +56290 94702 +35758 56672 +58825 41199 +55904 89015 +39969 10888 +45804 80699 +39063 33732 +71312 14949 +98164 36727 +83970 87031 +63860 15740 +19008 80045 +36342 59349 +75519 71974 +70509 49833 +15393 80714 +98995 85760 +80265 80370 +95001 42793 +28863 71880 +65186 59896 +91417 37319 +18213 74991 +46598 73652 +17350 56836 +77732 24742 +43239 96665 +91884 73652 +98023 17915 +30603 81326 +50132 72240 +14657 26301 +89888 46056 +29239 11140 +33269 80370 +86498 43609 +32323 18944 +87234 14483 +91312 84354 +55972 28052 +95671 44209 +47556 94712 +64231 92523 +40010 52869 +78889 65874 +65672 11780 +66829 27274 +58976 23077 +52684 99212 +12106 78809 +40894 79813 +73516 30403 +98758 90245 +78558 81135 +91842 43656 +36111 56858 +81902 57457 +57016 15315 +62322 31642 +12386 91620 +46583 57818 +16653 33234 +90664 13612 +99386 20422 +53504 20328 +88729 68564 +33262 89807 +22996 31396 +49944 21157 +71217 57474 +89409 93464 +81592 54135 +98029 75431 +54437 89337 +73652 85178 +44888 25915 +16495 94354 +20340 30974 +69933 86157 +23100 19122 +27337 71603 +81726 94579 +36381 80370 +13641 39385 +93685 32550 +73502 76018 +95815 49303 +26455 31396 +89509 94333 +43369 60492 +78840 66925 +84665 19369 +27145 30682 +20548 34796 +51087 84227 +24544 89081 +72048 57058 +70432 19369 +66825 40124 +30189 35430 +87176 89952 +69550 68440 +52304 27404 +22031 76800 +41939 80370 +30725 67957 +71537 22373 +53526 66477 +65213 20836 +51028 68564 +87427 46945 +18856 88896 +12027 68564 +28641 39589 +49464 72751 +15977 74910 +58898 75990 +39039 62184 +67691 57314 +60850 49736 +13012 48255 +84069 97201 +32568 68865 +96125 34796 +25181 74948 +73744 43656 +56977 21157 +80745 22716 +68012 34796 +47755 48255 +78533 29915 +23621 68865 +11353 43088 +84311 18978 +88935 20794 +54337 87927 +62396 46248 +83685 15158 +13519 40474 +89345 94333 +91712 56672 +54787 22373 +41442 19369 +57095 49689 +73305 68074 +40222 34796 +18020 22841 +62794 75878 +26368 14901 +11475 40124 +75682 74145 +75582 80370 +97642 80045 +43518 31396 +61262 14872 +65073 35575 +64250 41578 +41393 43656 +43735 59876 +52143 68865 +20553 52835 +88338 81503 +92669 68564 +97752 18898 +30830 94320 +13583 13612 +34097 54600 +95952 66295 +20902 68564 +35750 86876 +79359 57300 +19583 43538 +77422 21157 +63966 88896 +25403 57385 +71523 94333 +93579 11780 +35074 68865 +75840 48255 +44626 47096 +72438 60433 +54577 68564 +66690 56858 +41197 40124 +13612 30497 +25465 86662 +55920 78165 +89969 67123 +58286 70389 +43656 97260 +82249 43755 +30657 96171 +39157 31396 +18894 32478 +11955 10307 +43927 43656 +16920 50228 +29478 94333 +77022 17632 +33574 30653 +52142 59421 +43400 58568 +20918 21157 +59754 48255 +54975 74539 +45684 99214 +70895 33500 +68461 80541 +96575 26109 +39266 97201 +85211 31396 +62831 13612 +58008 89741 +52256 30403 +67407 31396 +11485 36725 +73476 43656 +28411 20566 +58997 24742 +50228 94333 +22731 49787 +60317 31396 +50387 56858 +47125 76520 +32596 40699 +86041 60374 +17153 93396 +47001 97796 +95064 33317 +60020 31715 +97079 13537 +95911 97201 +42771 30403 +31218 94333 +58019 68797 +27090 34796 +42716 89943 +13624 67333 +14872 41803 +15763 99088 +59386 71716 +29342 81287 +85955 37265 +92842 20523 +84757 75968 +76051 41922 +27595 46689 +74249 81347 +76224 97201 +46211 43561 +16434 31396 +95096 74640 +65042 56672 +89918 56858 +57601 94333 +45468 11780 +38812 25915 +51266 55991 +90185 75968 +75344 13612 +68758 50890 +54439 97201 +49138 21157 +72447 14872 +24656 40124 +94875 22613 +22373 43361 +44518 10761 +43686 60879 +32501 92097 +42849 13612 +96366 97201 +97664 18585 +75951 45638 +87742 55727 +26127 90094 +49148 29249 +44880 27199 +48351 34429 +49769 19369 +53310 31313 +97615 97700 +44217 70925 +35613 84873 +37774 33414 +37902 67163 +20513 31396 +22058 11456 +69695 43656 +12676 43656 +78546 44430 +93366 88781 +43779 79593 +42156 94062 +26825 30947 +61551 58309 +79992 80045 +70690 92191 +60303 33345 +47232 40844 +27958 75524 +65137 43403 +81422 88896 +90350 36543 +82498 21157 +34184 84567 +49629 78699 +52046 74192 +68564 51586 +74624 88896 +84055 35652 +78176 24112 +19369 81326 +29606 25074 +56381 25915 +41549 94333 +98646 77958 +10620 49796 +71804 80045 +70094 21157 +22047 43771 +26955 75968 +20916 46087 +70578 37746 +31396 85745 +38677 76047 +51586 80370 +33206 98673 +40909 76255 +86670 80370 +71335 29711 +90443 51586 +76017 23086 +64608 80370 +46749 24742 +89544 43543 +41857 46279 +42787 58205 +73907 67100 +62371 14872 +24918 98011 +51056 79598 +39721 34796 +67175 25915 +30403 36271 +64135 11780 +76994 78902 +66535 15092 +59032 94333 +75831 31184 +30096 11447 +23350 36783 +59712 31994 +38953 28778 +60226 50228 +82255 72338 +36348 68865 +76999 31396 +10164 31710 +15946 18029 +77511 30248 +95601 35450 +18152 49627 +32771 25915 +20404 31396 +61545 46279 +34285 87463 +84576 40124 +51878 51586 +88769 21515 +63200 81326 +68855 28497 +65595 53032 +48751 33285 +60205 88896 +96460 11367 +89979 80045 +11820 22373 +83877 11780 +20276 40124 +19438 81902 +94604 22373 +14247 67536 +89516 18681 +44165 80045 +58766 24742 +11456 26306 +11021 89613 +55218 59490 +74173 22743 +46876 80459 +63558 31935 +64004 24611 +72949 68564 +57103 62092 +95565 68564 +16875 38769 +81532 62587 +15150 22210 +74559 88896 +62813 61861 +29326 13612 +81512 68564 +49315 98827 +76486 25915 +42556 26135 +72818 52964 +24550 43656 +64689 70406 +73254 19265 +93699 68564 +53060 87046 +93009 81902 +39670 67615 +61036 67631 +45671 40413 +41312 80045 +49132 81902 +38018 91922 +71072 75073 +22869 27664 +55057 27814 +24941 27959 +84686 71679 +28947 74369 +25665 57496 +78778 23305 +14626 64462 +37342 43855 +59900 22416 +43285 98392 +92065 90613 +20557 68564 +45377 56858 +14449 55097 +97504 57790 +53508 80370 +39463 40124 +40767 68564 +64115 84078 +57015 38612 +10790 11780 +39059 48255 +97687 23054 +80185 40124 +42697 21344 +84512 30568 +88890 60974 +26625 25773 +23057 60654 +86691 40392 +19977 27723 +20885 35230 +82396 92827 +95747 20497 +70767 19369 +36646 58544 +55189 97285 +88283 66161 +61823 88896 +81975 98911 +96120 58310 +27584 13612 +29777 93381 +83851 81326 +68499 14896 +71570 80045 +83910 33934 +72510 19369 +29704 53243 +58042 94333 +10666 66744 +25477 38332 +46516 71338 +11780 81760 +60016 44454 +76061 88896 +45171 42137 +16022 31396 +43064 80370 +74174 94333 +75767 10987 +94834 41861 +43884 25498 +73079 82486 +49817 93178 +84945 88121 +37442 68004 +75204 52912 +88344 57580 +78701 55148 +79748 40124 +74272 34796 +32505 73879 +74004 40075 +97970 88796 +43969 81902 +34338 27951 +56706 51586 +70683 13612 +51351 41678 +15913 56236 +34587 11780 +27138 92114 +81477 85239 +37366 34453 +15828 68865 +29715 56858 +97538 80370 +16406 55594 +68956 18077 +21846 88896 +76758 36425 +59057 25915 +43840 82650 +67201 41066 +49427 70257 +41187 14872 +36754 24495 +23374 47449 +39822 68865 +66021 70536 +42652 43243 +24842 88896 +24280 24742 +88867 28631 +89241 86694 +23591 62627 +59260 48813 +50605 28489 +24330 84536 +25882 80024 +35776 62926 +54141 50228 +75680 40124 +84399 31530 +78265 80370 +87750 13922 +36091 75968 +27814 53359 +63430 34796 +63140 85215 +81319 68564 +89693 56300 +44939 86165 +78937 88896 +34287 57052 +60288 22373 +39738 97201 +66981 15143 +93466 85978 +43980 23335 +50378 24498 +65798 80045 +33048 70536 +74858 51594 +41614 26882 +78108 87082 +95851 39538 +55294 27347 +91809 51930 +18352 94333 +92466 41921 +20367 84778 +94765 21872 +70536 59326 +83561 73432 +80370 31935 +70474 44396 +96303 44391 +12398 89041 +23108 25947 +53083 21157 +99161 24742 +85566 15007 +32257 68564 +46065 50230 +63630 14872 +42636 97201 +94467 24904 +62773 20111 +56672 21157 +25886 30403 +13184 92058 +24742 94333 +69268 31396 +22434 77346 +12984 76178 +27117 43656 +10754 57124 +24873 75979 +39306 25915 +68234 84487 +17427 40124 +97952 20994 +33373 94333 +76327 14493 +45608 30947 +48367 22373 +54606 71965 +24726 25915 +10736 35060 +13367 53242 +95178 56815 +27296 56858 +68391 64705 +98563 38903 +20841 80370 +20931 11515 +60534 73652 +44041 90593 +39264 69166 +12510 77382 +65091 14872 +73605 78383 +43630 50005 +80045 78823 +17857 66318 +71065 13612 +67686 73652 +40016 11780 +96408 29692 +34507 81902 +10576 22373 +62967 92940 +68474 80370 +67663 49384 +27217 70536 +45444 94221 +16316 80370 +53563 68564 +76310 56858 +56858 69426 +96287 30104 +80543 29117 +82061 84323 +44833 20029 +58023 41150 +93209 56858 +19697 60022 +53393 23230 +97156 56858 +13069 63002 +72142 31122 +57137 49844 +48483 38592 +72970 69357 +93043 25915 +56792 15463 +73491 80370 +95205 30947 +84502 92854 +50655 31935 +81326 86245 +30947 21547 +81476 73108 +54995 86542 +88684 80659 +16695 77477 +67522 17661 +14444 24717 +48169 93182 +77304 62773 +10022 22838 +85352 68865 +88896 34807 +80571 21157 +75090 87473 +45429 57148 +38945 91244 +70349 21157 +13113 56858 +34796 40124 +32195 49176 +28292 57181 +14969 84572 diff --git a/tests/02_example b/tests/02_example new file mode 100644 index 0000000..b49c10d --- /dev/null +++ b/tests/02_example @@ -0,0 +1,6 @@ +7 6 4 2 1 +1 2 7 8 9 +9 7 6 2 1 +1 3 2 4 5 +8 6 4 4 1 +1 3 6 7 9 diff --git a/tests/02_input.txt b/tests/02_input.txt new file mode 100644 index 0000000..295874d --- /dev/null +++ b/tests/02_input.txt @@ -0,0 +1,1000 @@ +25 26 29 30 32 35 37 35 +15 16 17 20 22 24 26 26 +80 81 83 85 89 +76 77 79 82 84 87 89 95 +73 75 78 81 83 84 81 84 +9 10 11 12 11 8 +27 28 30 33 35 34 37 37 +67 70 69 72 74 78 +65 66 69 72 75 72 74 79 +22 25 25 26 27 28 +47 50 53 53 51 +67 70 70 71 74 75 77 77 +68 69 71 74 74 78 +54 56 58 58 65 +19 21 24 28 30 32 34 36 +75 78 79 80 84 81 +13 16 19 20 23 25 29 29 +66 67 69 73 75 78 79 83 +41 42 46 49 56 +86 87 90 96 97 98 99 +67 68 74 76 78 76 +64 65 66 67 69 74 75 75 +55 58 61 68 72 +44 45 48 50 53 54 60 65 +41 38 40 42 44 47 +50 48 49 52 54 56 54 +62 59 61 64 65 66 66 +29 27 29 30 31 35 +32 29 31 34 40 +27 25 27 29 28 31 33 34 +68 66 67 65 66 68 70 67 +41 38 39 40 43 42 44 44 +82 79 81 84 82 86 +78 75 74 77 78 85 +89 88 91 93 94 97 97 99 +63 61 61 62 64 63 +44 43 43 45 46 46 +86 84 85 85 89 +19 18 21 24 24 29 +18 17 20 24 25 27 28 +15 14 15 17 21 24 22 +85 83 86 90 90 +28 26 30 32 34 37 41 +78 77 78 82 85 92 +73 71 77 80 83 +12 11 12 14 20 22 24 22 +48 47 54 56 56 +37 36 41 43 47 +83 80 81 83 90 95 +53 53 55 57 60 +31 31 32 33 36 35 +86 86 87 88 91 94 94 +82 82 84 86 88 92 +17 17 18 19 21 27 +29 29 31 28 30 33 36 +70 70 71 68 65 +1 1 2 1 1 +27 27 29 27 31 +38 38 41 43 45 48 45 52 +40 40 41 43 43 46 49 +7 7 7 9 11 14 13 +3 3 6 9 10 10 10 +20 20 21 21 25 +51 51 51 53 60 +40 40 41 45 48 49 52 +73 73 74 76 79 81 85 83 +8 8 12 13 13 +40 40 41 43 45 46 50 54 +72 72 73 74 78 85 +42 42 43 50 51 53 +62 62 63 66 69 75 73 +28 28 31 32 38 40 40 +48 48 51 56 58 59 63 +39 39 41 47 50 56 +29 33 35 37 38 +20 24 27 29 31 32 35 33 +55 59 60 62 62 +38 42 43 45 47 48 50 54 +9 13 15 18 20 23 24 29 +72 76 77 80 78 80 83 +57 61 64 65 68 67 68 67 +72 76 78 79 81 82 79 79 +12 16 19 22 25 28 25 29 +33 37 38 41 42 39 45 +36 40 41 44 44 46 +65 69 70 72 75 75 72 +9 13 13 15 15 +33 37 39 42 45 45 46 50 +69 73 76 77 80 80 86 +7 11 12 16 18 19 +30 34 35 36 40 38 +34 38 39 43 45 47 47 +2 6 8 12 13 16 20 +36 40 43 46 50 55 +76 80 85 86 88 91 92 +46 50 51 52 59 60 61 60 +1 5 7 12 12 +61 65 70 71 74 75 79 +28 32 35 36 37 44 46 52 +24 30 33 35 37 +75 82 83 84 87 90 91 88 +52 59 60 61 63 65 65 +54 59 62 63 65 66 70 +17 24 25 27 29 34 +57 64 67 70 67 68 70 73 +69 76 78 81 83 82 80 +13 19 20 18 20 20 +20 27 29 28 29 33 +10 16 18 15 16 21 +66 72 74 77 77 80 +62 68 70 73 75 75 72 +84 89 89 91 92 95 96 96 +21 27 28 28 32 +32 37 39 40 43 43 50 +18 25 26 29 33 36 37 +9 15 16 20 23 25 26 25 +49 54 58 61 61 +46 52 54 55 57 61 65 +21 27 29 30 34 35 36 42 +78 83 84 90 92 95 +54 61 63 65 66 67 74 72 +1 7 9 10 11 17 20 20 +39 46 52 55 56 60 +7 12 14 16 18 20 26 32 +89 87 84 83 84 +37 36 35 32 31 29 27 27 +48 45 42 41 40 37 34 30 +23 21 20 18 17 14 12 7 +69 67 65 63 60 63 62 +93 91 88 86 89 92 +10 8 6 7 7 +28 26 24 27 26 24 23 19 +54 51 52 51 50 44 +65 64 61 60 60 59 +18 16 13 10 8 5 5 8 +80 78 76 76 76 +89 87 84 82 82 79 77 73 +27 24 24 21 19 18 11 +44 43 39 38 36 +15 14 13 10 6 3 2 3 +76 73 69 67 64 64 +53 51 50 48 44 43 39 +20 19 17 15 11 6 +50 47 40 37 36 +98 96 93 87 84 82 84 +43 42 37 34 33 31 28 28 +32 30 29 27 20 17 14 10 +66 64 62 61 59 53 52 46 +17 19 17 14 11 10 7 5 +73 76 73 72 71 73 +78 80 79 76 75 72 72 +16 18 15 13 10 6 +93 96 93 91 89 87 84 79 +53 55 52 50 48 46 47 44 +57 60 57 56 53 52 54 57 +59 60 57 58 56 56 +61 64 62 59 62 58 +36 39 38 41 39 38 33 +13 14 14 13 12 11 +76 77 74 74 77 +8 10 10 9 6 6 +55 57 57 55 53 49 +51 53 52 52 50 47 40 +18 21 19 15 12 +83 84 82 78 76 75 73 76 +35 38 34 31 31 +57 60 58 54 51 48 44 +27 30 29 25 23 21 16 +12 15 9 7 6 5 +20 23 20 15 13 10 9 11 +21 22 20 17 12 10 8 8 +59 60 57 51 49 46 42 +22 24 22 16 14 12 5 +71 71 69 68 67 66 64 +90 90 88 86 85 87 +77 77 76 73 71 71 +9 9 7 6 2 +91 91 90 88 86 84 83 77 +27 27 24 26 25 24 22 +55 55 56 54 53 54 +84 84 81 83 81 78 75 75 +60 60 58 55 56 53 50 46 +61 61 63 60 57 56 51 +59 59 58 57 57 54 +34 34 32 31 31 29 30 +33 33 30 30 30 +62 62 59 56 56 52 +24 24 24 23 16 +14 14 13 9 8 6 +20 20 19 16 15 11 10 11 +96 96 92 91 90 89 89 +93 93 89 87 84 82 81 77 +62 62 60 56 50 +72 72 69 62 60 +76 76 69 66 65 68 +96 96 89 87 87 +65 65 63 56 55 51 +76 76 75 68 61 +63 59 56 53 52 +75 71 70 68 66 67 +79 75 72 70 70 +99 95 93 90 86 +70 66 65 63 60 54 +6 2 1 4 1 +30 26 28 27 28 +64 60 57 55 57 56 56 +65 61 60 59 58 57 58 54 +67 63 62 61 59 56 57 52 +93 89 88 85 85 82 +39 35 32 29 27 27 28 +96 92 92 89 88 85 85 +71 67 67 65 63 61 58 54 +46 42 41 40 37 37 32 +68 64 63 59 58 55 +41 37 34 30 33 +71 67 63 62 60 58 58 +45 41 39 35 34 31 27 +78 74 72 69 66 62 56 +62 58 57 55 52 47 45 42 +89 85 82 76 75 72 71 74 +69 65 64 61 56 53 51 51 +73 69 64 62 58 +32 28 21 20 19 18 16 9 +94 89 87 85 83 82 79 78 +91 84 82 81 84 +41 36 33 31 30 27 27 +56 51 48 46 44 41 38 34 +85 78 77 75 72 70 68 62 +85 80 79 80 78 76 75 +30 25 27 26 29 +37 32 35 33 33 +79 74 72 73 69 +80 75 72 71 72 70 69 64 +62 57 55 55 53 51 48 45 +53 47 45 44 44 41 40 42 +40 33 31 28 28 28 +90 85 84 83 82 82 78 +95 88 85 85 84 83 82 76 +37 30 28 24 23 20 19 17 +24 19 15 14 16 +24 19 16 14 11 7 7 +62 55 52 51 49 45 44 40 +49 43 39 38 33 +88 81 78 73 71 +64 59 56 51 49 51 +19 14 11 6 6 +41 34 29 28 24 +44 39 36 33 30 23 17 +40 41 44 47 48 50 51 48 +57 59 61 64 64 +58 60 61 62 66 +79 82 84 86 92 +7 9 7 8 9 10 11 +30 32 35 38 41 38 40 38 +39 40 41 43 42 42 +76 77 79 77 79 83 +16 19 17 19 25 +79 82 83 83 84 86 87 90 +21 24 24 26 29 31 32 30 +28 31 32 35 37 37 39 39 +58 61 61 63 66 67 71 +9 10 13 13 19 +51 53 57 59 60 61 64 +80 82 84 88 90 88 +86 89 93 95 96 98 98 +72 74 76 80 81 85 +76 79 83 85 88 90 96 +76 79 85 88 91 94 97 +79 80 87 89 91 92 89 +86 87 90 95 95 +37 39 41 47 51 +29 30 32 37 40 46 +57 54 57 58 59 61 63 66 +63 60 61 64 63 +62 59 60 61 64 64 +47 45 46 49 53 +6 4 6 7 8 9 14 +35 32 33 36 38 35 38 +7 4 5 7 8 9 7 5 +51 49 52 54 55 52 53 53 +48 47 49 50 49 52 56 +17 16 19 17 18 21 26 +93 92 92 93 95 96 97 +14 12 15 15 18 16 +11 10 10 13 13 +91 90 90 93 94 95 99 +72 71 72 72 73 78 +35 34 37 40 44 47 48 +26 24 27 28 31 32 36 33 +31 29 33 34 34 +79 76 80 82 86 +54 53 57 60 63 66 69 76 +76 74 79 82 83 86 88 89 +42 41 46 47 50 49 +20 18 21 23 24 27 33 33 +51 50 52 54 59 63 +11 9 12 15 20 23 24 29 +57 57 58 61 62 63 +53 53 56 58 60 61 58 +25 25 27 29 31 33 34 34 +70 70 71 72 74 76 79 83 +70 70 73 76 79 82 83 90 +6 6 8 7 8 +24 24 26 29 28 30 33 31 +66 66 67 66 67 67 +91 91 92 90 94 +92 92 95 92 94 99 +58 58 60 62 64 67 67 68 +86 86 89 89 86 +16 16 17 17 18 21 22 22 +46 46 47 48 48 52 +87 87 89 92 92 99 +1 1 4 7 10 11 15 17 +73 73 74 75 79 81 80 +84 84 87 91 91 +74 74 76 80 84 +50 50 53 57 59 65 +74 74 80 81 84 +11 11 13 15 21 20 +47 47 54 55 55 +57 57 58 60 62 68 69 73 +41 41 48 51 56 +16 20 21 24 27 +14 18 19 22 25 23 +84 88 89 90 93 93 +59 63 65 68 69 72 75 79 +19 23 26 29 32 37 +24 28 31 30 33 35 +70 74 76 79 77 75 +66 70 73 74 72 75 75 +56 60 61 59 62 63 67 +21 25 26 24 31 +27 31 33 33 34 +2 6 6 7 6 +83 87 88 88 90 93 93 +75 79 82 82 83 84 88 +34 38 40 40 43 46 52 +64 68 72 75 76 +72 76 80 81 78 +79 83 87 89 89 +12 16 20 22 23 24 26 30 +36 40 42 46 53 +24 28 35 38 40 +7 11 13 19 21 22 21 +35 39 41 43 50 50 +63 67 70 77 81 +66 70 71 77 79 85 +61 66 69 72 75 +71 77 78 81 80 +70 76 77 78 80 81 81 +25 32 33 35 36 40 +32 39 41 44 45 50 +36 41 42 39 42 43 44 46 +8 14 17 14 12 +79 85 86 84 85 85 +20 27 29 27 31 +60 66 64 67 73 +31 37 37 38 40 43 +27 33 34 36 36 37 36 +17 22 24 24 24 +76 83 84 84 88 +72 78 79 81 82 82 87 +10 16 18 22 24 27 +77 82 84 88 90 91 93 90 +33 39 41 45 47 49 52 52 +67 74 78 81 85 +25 32 36 38 41 43 49 +44 50 52 54 59 61 +13 20 23 26 29 31 37 35 +45 50 57 60 60 +66 72 73 80 84 +18 24 27 30 32 37 42 +81 79 76 75 78 +7 5 3 2 1 1 +55 54 51 50 49 45 +45 44 41 38 35 30 +79 76 73 72 74 71 +94 92 94 91 90 93 +30 28 27 26 29 26 26 +97 94 95 92 89 86 83 79 +21 20 22 19 13 +96 94 94 91 90 +81 78 76 76 74 76 +38 35 33 33 33 +58 56 56 53 52 48 +57 55 53 51 51 49 48 43 +76 74 73 70 68 64 61 +25 22 18 16 19 +17 14 10 7 5 3 3 +41 40 38 34 33 30 26 +99 97 96 95 94 91 87 82 +95 92 85 82 81 78 77 76 +69 67 61 58 56 59 +57 54 53 48 45 44 43 43 +86 85 82 79 73 72 68 +88 85 78 76 74 67 +69 71 68 66 65 62 60 58 +48 50 49 47 44 41 42 +17 20 17 14 11 10 9 9 +79 80 77 75 72 70 66 +16 18 17 15 13 12 10 3 +67 69 67 66 68 65 62 60 +69 71 68 67 68 70 +20 22 23 20 19 19 +32 34 33 35 31 +85 88 87 86 85 86 85 80 +14 15 15 13 12 +29 31 30 30 27 24 27 +68 69 69 67 64 64 +92 93 93 90 86 +56 57 54 54 51 46 +21 22 18 15 14 +30 31 30 27 25 21 22 +60 61 58 56 55 51 51 +27 28 24 23 20 18 14 +95 97 95 92 90 86 83 77 +67 70 63 62 60 57 55 52 +32 34 28 25 28 +31 32 26 25 25 +28 31 29 22 20 16 +13 15 14 9 3 +68 68 65 64 61 59 56 +39 39 36 33 35 +29 29 26 23 23 +72 72 70 69 65 +15 15 12 11 8 7 6 1 +43 43 41 42 39 38 35 34 +52 52 49 46 47 45 47 +39 39 41 40 40 +28 28 26 27 23 +36 36 35 33 32 35 28 +19 19 19 16 15 +20 20 19 17 15 15 16 +51 51 49 49 49 +65 65 63 60 60 56 +90 90 88 86 86 81 +68 68 65 61 58 55 +34 34 32 28 25 22 25 +88 88 85 81 79 78 78 +26 26 24 23 20 16 13 9 +98 98 95 91 88 85 82 77 +29 29 26 19 16 15 14 +96 96 94 93 87 88 +62 62 57 54 54 +72 72 66 63 59 +45 45 44 41 36 35 32 25 +38 34 33 30 27 25 22 21 +74 70 67 64 62 61 60 62 +51 47 46 43 43 +62 58 55 52 48 +20 16 13 10 5 +57 53 51 53 52 51 +99 95 93 90 92 91 94 +23 19 18 15 14 15 15 +62 58 59 58 55 51 +59 55 54 55 54 51 44 +95 91 89 87 87 86 85 +31 27 26 24 24 22 25 +27 23 22 19 19 18 16 16 +96 92 92 89 85 +26 22 22 20 18 13 +27 23 19 17 16 14 +90 86 83 82 80 76 77 +86 82 80 79 77 74 70 70 +20 16 12 11 10 6 +97 93 92 88 82 +75 71 68 66 65 64 57 54 +88 84 77 76 73 72 75 +37 33 32 30 25 25 +61 57 54 47 43 +65 61 59 54 53 46 +54 47 44 42 40 38 +88 81 79 78 81 +60 55 52 50 49 48 48 +86 81 79 76 73 71 68 64 +38 32 31 29 27 25 18 +80 75 73 76 75 73 71 +34 27 29 28 27 24 23 25 +97 92 89 92 92 +57 51 52 50 49 48 44 +27 22 20 18 21 18 12 +85 80 77 77 74 71 69 66 +26 20 18 16 16 19 +82 76 74 73 71 70 70 70 +93 87 85 84 82 81 81 77 +96 89 87 85 85 84 79 +34 27 23 21 19 17 +30 25 23 19 18 20 +57 51 50 46 43 42 42 +31 26 25 21 18 17 14 10 +51 45 41 40 39 36 30 +45 39 37 35 29 28 27 +78 72 70 67 65 60 61 +78 73 68 67 65 62 62 +95 89 86 84 78 74 +75 68 65 60 58 52 +71 71 74 72 74 77 79 84 +22 19 21 22 22 24 25 30 +10 7 8 8 7 +78 76 77 76 78 81 +44 42 44 46 49 47 +2 2 3 6 8 12 14 14 +12 12 14 16 22 25 28 25 +29 34 35 38 40 41 41 44 +28 25 23 21 18 17 19 +66 60 59 56 55 57 57 +55 55 52 51 51 49 +32 28 27 26 22 +81 79 76 73 71 71 67 +94 92 91 88 84 83 80 83 +86 84 82 81 80 79 76 76 +66 60 58 55 51 49 49 +91 95 96 96 97 96 +37 33 28 26 22 +26 25 24 23 20 16 15 15 +41 41 43 45 47 49 49 +55 57 56 54 50 47 44 40 +34 32 31 29 26 20 18 12 +39 38 41 44 46 +51 47 46 44 43 43 +64 70 73 77 80 83 +46 48 54 56 59 61 64 67 +20 23 20 22 25 29 +46 52 53 54 58 59 62 68 +14 21 21 23 25 25 +57 57 57 56 53 53 +34 27 25 22 17 15 12 15 +22 26 28 29 30 31 36 +76 80 82 84 88 92 +49 50 54 57 56 +27 28 35 37 41 +70 72 71 64 63 +13 13 12 11 11 10 5 +91 87 83 81 82 +21 19 20 21 24 26 26 +78 73 76 73 70 +33 29 25 22 21 17 +1 5 7 10 12 13 10 +2 5 6 5 5 +16 18 17 16 13 13 +62 66 69 71 69 69 +43 36 34 31 29 26 20 20 +83 79 77 74 71 71 67 +58 62 66 69 72 74 +64 60 58 56 49 +56 57 54 55 55 +31 31 35 36 38 41 44 +42 36 35 33 30 30 26 +44 45 42 40 34 30 +99 96 93 90 88 86 81 83 +18 22 25 27 29 30 32 36 +79 79 78 75 71 70 67 62 +36 39 36 38 40 47 +92 89 91 94 91 92 95 92 +16 21 23 30 28 +85 86 83 80 79 76 75 70 +84 83 85 86 87 91 90 +7 9 11 14 16 20 24 +40 44 47 51 56 +60 63 66 68 71 71 75 +31 35 38 36 33 +24 24 27 31 33 31 +16 12 11 9 9 9 +24 24 23 21 18 13 +64 58 56 55 52 48 44 +50 48 51 53 55 55 57 61 +34 37 35 33 33 30 +97 97 98 98 98 +48 48 44 43 42 40 39 36 +96 95 95 96 96 +7 11 14 15 15 16 16 +82 88 91 92 92 +31 32 35 34 36 37 +33 33 31 30 27 26 19 13 +13 15 17 18 25 30 +86 88 86 83 82 78 76 76 +49 49 48 46 40 38 39 +89 82 81 78 77 70 +58 61 59 56 54 56 53 56 +38 35 42 43 44 +22 27 28 34 37 37 +47 44 44 43 41 38 39 +45 43 46 52 50 +44 40 38 36 32 25 +99 99 96 94 91 90 87 83 +61 54 51 54 51 50 46 +75 82 83 84 85 88 90 97 +20 26 28 28 32 +6 6 11 12 15 21 +88 82 82 81 78 +69 66 64 64 63 60 +2 5 7 6 4 +69 64 62 60 60 62 +19 23 23 25 30 +12 18 19 21 23 27 +67 63 65 64 66 +45 52 55 58 60 65 68 71 +54 49 48 45 41 +80 80 83 82 84 88 +91 90 90 89 86 86 +54 57 61 64 67 74 +50 53 54 56 59 60 66 +16 20 22 28 35 +82 84 84 87 88 +19 15 12 9 12 +3 9 11 12 13 15 +55 53 57 60 60 +55 52 55 52 54 55 56 62 +66 63 66 69 72 74 76 83 +68 70 73 76 79 79 +74 76 77 78 80 82 79 +93 89 86 84 81 81 80 83 +18 18 17 15 8 6 2 +42 49 50 51 51 53 50 +1 5 6 3 5 8 +46 46 45 41 37 +54 54 55 56 61 65 +57 57 55 56 53 +28 28 26 24 26 23 25 +87 87 90 89 89 +67 71 71 73 74 78 +37 33 30 29 26 23 20 +69 65 63 58 57 54 52 +28 25 24 22 24 21 20 17 +72 75 73 72 72 72 +66 66 64 66 64 63 59 +94 95 93 91 93 +42 40 42 43 44 41 44 48 +38 44 47 48 51 55 55 +50 47 46 39 36 35 32 31 +70 72 70 69 66 64 62 +12 10 7 8 4 +73 68 65 64 58 56 55 53 +10 7 4 5 5 +58 56 55 52 49 45 43 36 +37 39 41 44 46 46 44 +11 10 11 13 14 18 21 25 +88 84 81 74 68 +81 74 73 73 72 71 64 +28 28 29 30 30 31 30 +77 78 75 72 70 70 71 +37 34 35 37 41 43 49 +43 44 47 51 52 52 +71 64 61 60 57 59 +22 23 25 27 29 +64 67 69 72 75 77 80 82 +85 87 90 91 93 94 +28 26 23 22 21 18 16 +68 71 73 74 76 79 81 83 +24 25 26 28 29 +22 23 25 28 29 +29 30 31 32 35 36 39 +3 5 6 8 9 +39 36 34 33 30 28 25 +54 52 49 47 44 43 41 +82 85 87 89 90 93 96 97 +18 21 24 27 28 30 32 +8 9 10 12 14 +54 53 52 51 49 46 +67 66 65 64 61 58 +58 57 54 51 49 47 44 +25 28 29 31 33 +7 8 9 10 11 14 15 +88 87 86 85 84 +51 52 53 55 58 60 63 +38 35 32 29 27 24 22 +81 82 83 84 85 87 90 +78 77 75 72 69 +81 83 84 87 88 90 91 +31 34 35 38 39 +52 51 50 47 44 41 +79 76 73 70 69 66 64 +94 93 90 89 88 85 82 81 +34 36 38 40 43 45 +58 57 55 52 49 47 45 +24 23 21 20 19 +89 90 91 93 94 +58 59 61 64 67 69 70 71 +50 52 55 56 58 60 +63 61 59 56 53 50 +43 46 49 52 54 55 +42 40 37 36 33 30 27 24 +26 27 28 31 32 33 +66 63 62 60 58 55 +11 14 15 18 19 22 24 27 +50 49 48 46 45 +80 83 84 87 88 91 +74 75 77 79 80 82 +66 67 70 72 74 +68 69 72 75 78 81 83 84 +63 61 60 59 57 54 51 +37 38 40 41 43 +44 43 40 39 36 34 33 +84 85 87 90 92 94 95 +78 80 81 82 85 88 90 91 +38 37 35 33 30 29 27 +61 63 65 68 70 +47 49 50 52 53 +39 36 34 32 31 +70 71 72 73 74 77 80 +41 39 37 34 33 31 28 25 +30 31 33 36 37 40 42 +18 21 24 26 27 30 33 +37 38 41 44 45 +10 13 14 15 18 20 22 +96 95 94 91 90 89 +46 47 48 50 53 +83 82 79 76 75 +38 39 41 44 47 48 51 53 +73 75 76 79 80 +81 84 87 88 89 +28 27 26 25 22 19 17 15 +54 55 57 59 60 62 65 66 +69 71 73 75 76 78 +43 45 46 49 51 54 57 +56 55 52 50 47 44 41 40 +36 37 40 41 42 44 +63 66 69 71 73 74 +40 43 44 47 48 50 53 +76 77 78 81 84 85 +68 65 63 60 58 56 +59 62 64 66 67 68 +24 23 20 19 16 14 11 +27 25 23 20 18 17 14 11 +11 13 15 18 21 24 25 +17 18 19 20 22 +52 55 58 60 63 66 +55 57 59 62 63 65 68 +7 8 11 14 17 20 21 22 +84 83 81 78 77 +24 21 19 17 16 14 11 +41 38 37 35 33 30 27 +74 77 78 79 82 85 +63 61 60 57 56 55 53 +27 30 33 34 36 39 41 43 +62 65 67 69 70 73 74 77 +51 49 48 47 44 42 41 38 +22 23 24 27 28 +49 50 53 56 59 62 65 +36 33 32 31 30 +5 8 10 13 14 17 19 +38 37 36 33 31 30 27 24 +55 56 57 59 62 +43 46 48 51 53 55 57 +37 39 42 43 46 49 +45 47 50 53 56 +6 7 9 11 13 16 18 19 +57 58 61 62 63 64 67 69 +13 12 11 10 7 6 +82 79 78 76 74 71 70 67 +16 14 11 8 5 3 +13 16 19 22 25 27 29 31 +35 32 31 28 27 25 +22 25 27 29 31 33 35 +67 70 73 76 78 80 82 +20 21 22 25 27 30 31 32 +66 63 62 60 57 56 55 54 +32 31 28 27 24 21 20 18 +13 15 16 17 18 +80 81 82 84 85 86 88 89 +49 47 46 45 43 41 +69 66 65 63 60 59 56 +76 74 71 68 66 65 64 +25 22 21 19 16 13 11 8 +44 46 49 51 52 53 +33 36 37 38 40 +65 62 59 57 54 +87 84 83 82 81 +58 59 60 63 65 68 +55 58 60 62 63 64 65 67 +77 79 80 82 85 86 88 90 +26 29 30 33 35 36 +83 84 87 90 92 +42 44 47 50 52 55 +76 73 72 71 70 +38 36 34 33 30 27 25 24 +72 73 76 79 80 +83 80 79 77 74 73 +2 5 7 9 11 12 15 +33 31 28 25 24 23 21 +81 82 84 87 88 91 93 94 +80 77 74 72 71 69 66 +68 66 64 63 60 57 55 +31 30 28 26 23 +35 34 31 28 27 26 25 +76 78 80 82 84 +85 84 83 81 80 79 78 +78 80 81 82 84 +17 16 13 11 10 8 +84 85 88 91 92 93 +83 86 89 91 93 96 98 +46 43 41 40 39 37 +77 78 80 83 85 +46 47 48 51 52 55 +88 86 84 81 80 77 75 +12 13 15 18 21 22 25 +29 28 27 24 23 20 17 14 +8 7 6 5 2 +88 87 85 82 79 77 75 +47 50 52 54 57 +78 80 83 84 85 88 90 +67 70 72 74 75 78 +10 11 14 16 19 21 22 25 +41 44 46 47 48 +37 35 33 30 27 24 23 +29 28 26 23 22 21 +24 27 30 31 33 +16 18 19 21 22 25 26 27 +97 94 92 91 88 87 +4 7 10 12 14 15 18 21 +1 4 7 9 11 13 16 +80 78 76 73 70 69 +59 57 56 54 52 +53 56 57 59 62 65 +47 44 43 41 38 36 33 +10 11 12 14 16 17 18 +94 91 90 87 86 83 +96 95 94 93 90 87 86 +27 30 32 35 38 41 +35 37 38 39 40 41 +88 89 92 94 96 +59 61 64 67 68 71 72 73 +2 5 6 8 9 12 15 17 +71 74 75 76 79 81 82 +40 41 44 47 48 51 53 +60 63 64 66 67 +21 24 27 29 31 33 36 39 +11 13 14 16 18 +74 75 76 79 82 +24 26 28 31 33 +59 56 53 51 50 49 +60 61 63 65 67 70 72 73 +94 92 90 87 84 82 80 79 +67 66 63 60 58 +25 22 21 20 18 16 15 13 +1 3 4 6 9 12 13 16 +38 37 35 34 32 +30 31 32 34 35 38 40 +64 65 66 68 70 +3 4 5 6 7 9 +85 84 81 79 78 76 74 71 +39 36 34 33 31 30 29 27 +70 67 65 64 61 58 56 +81 78 76 73 71 68 67 +13 15 18 21 22 25 27 28 +82 81 79 76 75 74 72 +42 44 47 49 52 +40 41 44 47 49 52 53 +73 76 79 80 82 +83 84 86 89 91 +45 42 41 38 37 +62 60 57 56 53 52 +25 27 29 31 34 +32 34 36 39 40 42 43 +41 38 36 35 32 29 26 23 +28 30 33 35 36 38 41 42 +37 38 41 42 44 45 46 +28 25 22 19 17 14 11 +74 72 69 67 66 +65 66 67 69 70 +21 22 24 27 28 29 31 34 +51 50 47 46 43 40 39 +27 28 30 33 34 37 38 39 +82 83 86 89 92 94 97 99 +98 97 94 92 91 90 89 +85 83 82 81 80 78 +87 85 84 82 81 +70 72 74 75 78 80 83 85 +18 19 22 23 24 27 +11 13 15 16 19 22 24 25 +55 58 59 61 64 66 68 70 +29 26 24 23 21 18 17 15 +50 51 52 53 56 57 +88 87 86 83 81 79 +35 38 39 42 45 47 48 +67 70 71 74 75 +91 90 89 88 86 +21 18 17 15 13 +37 36 34 31 30 27 25 +67 66 65 63 61 60 58 +76 73 70 68 67 65 64 63 +37 39 42 44 45 +6 7 10 11 13 14 16 18 +25 24 21 20 18 15 14 11 +84 83 80 79 77 76 74 72 +19 17 15 12 10 +83 85 86 89 91 92 93 94 +13 14 15 16 17 19 +97 95 92 91 90 88 87 +62 65 67 70 71 74 75 78 +19 17 14 11 9 +2 5 6 7 9 11 12 15 +30 32 34 35 38 40 +30 33 34 37 40 +76 77 80 83 86 87 +15 12 10 8 7 +22 20 18 15 13 +16 15 13 12 10 8 5 4 +36 38 41 43 44 46 +55 52 49 46 45 43 +15 12 9 7 5 4 3 2 +54 55 57 60 63 66 +64 61 59 56 54 53 50 +37 40 43 46 47 48 51 +70 69 66 64 61 60 59 57 +21 18 15 14 13 12 10 +49 47 46 43 41 39 36 33 +33 36 37 39 41 44 +87 89 90 93 95 +99 96 94 92 90 +59 56 54 53 50 48 46 +92 90 89 87 84 83 80 +2 4 7 9 11 +28 25 24 22 19 17 +99 96 95 92 89 +76 73 71 69 67 64 +88 90 92 95 97 +25 26 27 28 29 30 33 +37 34 33 31 30 29 27 +1 2 5 6 7 9 11 13 +26 24 22 21 20 18 +33 31 30 27 25 24 22 20 +68 69 71 73 76 77 80 +42 40 39 37 34 32 29 27 +67 66 63 62 61 +24 21 18 15 14 +67 64 61 59 57 +80 83 85 87 88 89 91 92 +29 32 35 38 40 43 46 +42 41 40 37 36 +68 69 71 74 75 +45 44 41 38 37 34 31 30 +59 58 56 54 51 48 47 46 +39 41 42 44 46 49 52 +67 65 63 61 58 57 +71 73 75 76 79 82 85 +93 92 91 88 86 84 81 79 +32 29 28 26 25 23 +52 55 57 58 60 62 64 66 +51 53 55 57 58 59 60 +35 32 30 29 27 24 21 +69 71 73 75 76 +26 28 30 33 34 36 +26 24 21 18 17 16 14 12 +57 59 62 64 66 67 69 +23 20 18 17 15 +33 34 37 38 39 40 42 +85 86 87 88 90 93 96 97 +43 41 40 37 36 34 32 29 +23 26 27 28 29 31 34 35 +26 23 20 18 17 16 15 12 +54 57 59 62 64 65 67 68 +88 85 84 82 81 79 77 76 +88 86 84 83 81 80 78 +94 91 88 85 84 81 78 77 +62 61 58 57 55 53 50 +47 45 43 42 40 +23 22 21 19 17 16 15 +34 36 38 41 42 45 +15 13 11 9 7 +41 44 45 47 48 50 52 53 +82 79 77 76 75 72 70 67 +71 72 74 77 79 80 81 +56 53 50 47 44 +33 34 37 39 40 42 +60 58 55 52 51 48 +67 64 62 60 57 55 53 50 +27 26 23 21 18 16 13 11 +72 69 68 66 63 62 +61 64 66 69 70 72 74 +9 12 14 16 18 21 22 +42 39 38 36 34 31 29 +77 76 73 71 68 66 +10 7 6 4 2 +39 37 35 32 29 28 27 26 +68 71 74 76 79 80 81 +45 47 48 51 54 56 59 +91 90 89 87 86 85 83 82 +42 44 47 49 51 52 53 +24 23 22 20 18 16 13 +14 12 11 8 6 3 2 +45 42 40 39 36 +32 34 36 39 42 43 44 +89 87 86 85 82 81 80 +10 12 15 16 19 +62 59 57 55 53 51 48 +99 98 96 93 90 87 86 +56 58 59 60 61 64 66 69 +49 50 53 56 59 62 64 +79 76 74 71 70 67 +66 63 61 59 57 55 54 52 +32 31 30 29 28 25 23 +88 91 94 96 97 99 +72 74 76 79 82 +14 16 18 19 22 23 26 29 +51 49 48 46 45 43 41 +58 59 61 63 66 68 70 +13 10 9 6 3 2 +77 75 73 70 68 67 +62 60 59 57 54 53 50