code:
=========================================
|||   RimJobWorld Community Project   |||
=========================================

Special thanks to

Void Main				Original Author

UnlimitedHugs			HugsLib mod library for Rimworld
pardeike				Harmony library
Fluffy					Architecture Sense mod DLL

Loverslab				Housing this mod

Skystreet				Saved A16 version from nexus oblivion
nethrez1m				HugsLib / RimWorldChildren fixes
prkr_jmsn				A17 compatibility, Genital injection, sounds, filth
Goddifist				Ideas
shark510				Textures, testing
Soronarr				Surgery recipes, monstergirls
semigimp				General coding
AngleWyrm				Textures
Alanetsai				Chinese traditional translations
nizhuan-jjr				Chinese simplified translations, general coding, bugsfix,
						whore system, broken body system, balancing, testing, textures,
						previews, etc.
g0ring					Coding idea, bugfix
StarlightG				Coding idea, bugfix
SuperHotSausage			Coding, stuff
Sidfu					Coding, XML modding
NEPH					Graphics & textures, testing, Korean translation
hogehoge1942			Coding, Japanese translation
Ed86					Coding
TheSleeplessSorclock	Coding
asdiky					Russian translation
exoxe					Korean translation
Atrer					Coding
Zaltys					Coding
SlicedBread				Textures

And anyone we might have missed.
add your self

repo_name: Euclidean/rjw

license: mit


code:
-The transgender thoughts sometimes disappear if you perform a chain of sex operations on the same pawn.
Probably some oversight in algorithm that gives thoughts on transition (some underthought chaining of effects).
Fix somewhere in the future.

-Whores with untended diseases (flu, herpes, warts) will try hookup and may succeed but the job will get cancelled shortly afterwards resulting in message spam.
Currently added different message to notify players of problem.

-Genital helper is shit. It does not account for later added animal dicks. has_<x> methods are fucking runtime regex searches


code:
CORE:

add nymph lord ai, so nymphs can behave as visitors
add sex addiction to demonic parts?
add insects dragging pawns to hives
gene inheritance for insect ovis

workgivers(aka manual control):
-workgiver for sex with humpshrooms, increasing their growth by 1 day, causing addiction, temp? humpshroom-penis futa?
-workgiver(auto, cleaning) to collect cum

add recipe to make food from cum?
add female cum?

add some sort of right clicking sub menu:
-designate breeding pair(through relations?)

rework genital system, so it only have vag,penis,breast,anus (with comp?) storing name, severity(size?) of part
probably also rework surgeries to support those
rework sex satisfaction system(based on parts size/difference? traits/quirks etc)

integrate milkable colonists with sizes support and operations? to change milk type(w gitterworld med?)

BDSM:
-make ropes and other generic gear, that is "locked" but not with hololock unique keys - normal keys made of steel, etc
-piercing?
-blindfolds?
-vibrators?

Multiplayer:
-figure out predictable seeds instead of syncmethod's

maybe:
add support for other pregnancy mods
more sex related incidents?
backstories: cowgirl, etc

whoring:
-add whoring zone( esp for prisoners)
-limit whoring to zone
-whore in zone does most checks but instead of going after client- client comes to whore and they do stuff
or merge quickies with whoring
or idk invent something new
and maybe while at it make toggles for whores to service colonists, oh and defying whores will count toward rape and accepted whores - con sex

never?
-make interactive COC like sex/stories
RatherNot (Code)
We need Pawn Sexualization Request: like Pawn Generation Request, but for generating RJW things
Current approach missing any kind of flexibility
In can be useful for race support to: instead placing checks directly in generator you can place limitations on generator in request

older stuff
TO DO:
Add new body part groups for the bondage gear (specifically a genitals group for the CB and a jaw or mouth group for the gag, the mouth group that's already in the game won't work I'm pretty sure)
Once that (^^^) is done make it so that the groups are automatically blocked by the gear, like a more robust version of the blocks_genitals flag
Add more thoughts after sex about e.g. partner's dick size and sex skill
Add chance for sex/fap with a peg dick to produce splinters

TO DO EVENTUALLY (AKA NEVER):
Improve detection of genital harvest vs amputation
  - (Maybe) Make it so that downgrading a pawn is considered harvesting

OTHER RANDOM/HALF-BAKED IDEAS:
Add some random dialogues for rapes, lovins, etc.
Strap prisoners to their beds
Sex addiction
  - Reduces satisfaction from sex
  - Should only affect nymphomaniacs?

Traits?:
Low Self Esteem (just another pessimist trait)

Dom/Sub

Mindbroken (raped so much that they are at a permanent max happiness, but are worth nothing more than just hauling and cleaning)

Branded, this pawn is branded a cow/animal fucker/prostitute/rapist, whatever his/her extra curricular is comes with a negative opinions so they are pretty much never liked?

path: todo or not todo.txt


code:
/target
.session
.vscode
UUUU

repo_name: nixx/advent

path: .gitignore

license: unknown


code:
image: "rust:latest"

test:cargo:
  script:
    - rustc --version && cargo --version  # Print version info for debugging
    - cargo test --workspace --verbose


code:
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3

[[package]]
name = "aho-corasick"
version = "0.7.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f"
dependencies = [
 "memchr",
]

[[package]]
name = "ansi_term"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2"
dependencies = [
 "winapi 0.3.9",
]

[[package]]
name = "aoc-2021"
version = "0.1.0"
dependencies = [
 "ansi_term",
 "indoc",
 "petgraph",
 "rayon",
 "regex",
 "reqwest",
]

[[package]]
name = "autocfg"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"

[[package]]
name = "base64"
version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd"

[[package]]
name = "bitflags"
version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"

[[package]]
name = "bumpalo"
version = "3.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f1e260c3a9040a7c19a12468758f4c16f31a81a1fe087482be9570ec864bb6c"

[[package]]
name = "bytes"
version = "0.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0e4cec68f03f32e44924783795810fa50a7035d8c8ebe78580ad7e6c703fba38"

[[package]]
name = "bytes"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8"

[[package]]
name = "cc"
version = "1.0.72"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "22a9137b95ea06864e018375b72adfb7db6e6f68cfc8df5a04d00288050485ee"

[[package]]
name = "cfg-if"
version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"

[[package]]
name = "cfg-if"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"

[[package]]
name = "core-foundation"
version = "0.9.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6888e10551bb93e424d8df1d07f1a8b4fceb0001a3a4b048bfc47554946f47b3"
dependencies = [
 "core-foundation-sys",
 "libc",
]

[[package]]
name = "core-foundation-sys"
version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc"

[[package]]
name = "crossbeam-channel"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "06ed27e177f16d65f0f0c22a213e17c696ace5dd64b14258b52f9417ccb52db4"
dependencies = [
 "cfg-if 1.0.0",
 "crossbeam-utils",
]

[[package]]
name = "crossbeam-deque"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6455c0ca19f0d2fbf751b908d5c55c1f5cbc65e03c4225427254b46890bdde1e"
dependencies = [
 "cfg-if 1.0.0",
 "crossbeam-epoch",
 "crossbeam-utils",
]

[[package]]
name = "crossbeam-epoch"
version = "0.9.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ec02e091aa634e2c3ada4a392989e7c3116673ef0ac5b72232439094d73b7fd"
dependencies = [
 "cfg-if 1.0.0",
 "crossbeam-utils",
 "lazy_static",
 "memoffset",
 "scopeguard",
]

[[package]]
name = "crossbeam-utils"
version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d82cfc11ce7f2c3faef78d8a684447b40d503d9681acebed6cb728d45940c4db"
dependencies = [
 "cfg-if 1.0.0",
 "lazy_static",
]

[[package]]
name = "either"
version = "1.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457"

[[package]]
name = "encoding_rs"
version = "0.8.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a74ea89a0a1b98f6332de42c95baff457ada66d1cb4030f9ff151b2041a1c746"
dependencies = [
 "cfg-if 1.0.0",
]

[[package]]
name = "fixedbitset"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "398ea4fabe40b9b0d885340a2a991a44c8a645624075ad966d21f88688e2b69e"

[[package]]
name = "fnv"
version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"

[[package]]
name = "foreign-types"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1"
dependencies = [
 "foreign-types-shared",
]

[[package]]
name = "foreign-types-shared"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b"

[[package]]
name = "form_urlencoded"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191"
dependencies = [
 "matches",
 "percent-encoding",
]

[[package]]
name = "fuchsia-zircon"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82"
dependencies = [
 "bitflags",
 "fuchsia-zircon-sys",
]

[[package]]
name = "fuchsia-zircon-sys"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7"

[[package]]
name = "futures-channel"
version = "0.3.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7fc8cd39e3dbf865f7340dce6a2d401d24fd37c6fe6c4f0ee0de8bfca2252d27"
dependencies = [
 "futures-core",
]

[[package]]
name = "futures-core"
version = "0.3.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "629316e42fe7c2a0b9a65b47d159ceaa5453ab14e8f0a3c5eedbb8cd55b4a445"

[[package]]
name = "futures-io"
version = "0.3.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e481354db6b5c353246ccf6a728b0c5511d752c08da7260546fc0933869daa11"

[[package]]
name = "futures-sink"
version = "0.3.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "996c6442437b62d21a32cd9906f9c41e7dc1e19a9579843fad948696769305af"

[[package]]
name = "futures-task"
version = "0.3.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dabf1872aaab32c886832f2276d2f5399887e2bd613698a02359e4ea83f8de12"

[[package]]
name = "futures-util"
version = "0.3.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41d22213122356472061ac0f1ab2cee28d2bac8491410fd68c2af53d1cedb83e"
dependencies = [
 "futures-core",
 "futures-io",
 "futures-task",
 "memchr",
 "pin-project-lite 0.2.7",
 "pin-utils",
 "slab",
]

[[package]]
name = "getrandom"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7fcd999463524c52659517fe2cea98493cfe485d10565e7b0fb07dbba7ad2753"
dependencies = [
 "cfg-if 1.0.0",
 "libc",
 "wasi",
]

[[package]]
name = "h2"
version = "0.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5e4728fd124914ad25e99e3d15a9361a879f6620f63cb56bbb08f95abb97a535"
dependencies = [
 "bytes 0.5.6",
 "fnv",
 "futures-core",
 "futures-sink",
 "futures-util",
 "http",
 "indexmap",
 "slab",
 "tokio",
 "tokio-util",
 "tracing",
 "tracing-futures",
]

[[package]]
name = "hashbrown"
version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e"

[[package]]
name = "hermit-abi"
version = "0.1.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"
dependencies = [
 "libc",
]

[[package]]
name = "http"
version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1323096b05d41827dadeaee54c9981958c0f94e670bc94ed80037d1a7b8b186b"
dependencies = [
 "bytes 1.1.0",
 "fnv",
 "itoa",
]

[[package]]
name = "http-body"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "13d5ff830006f7646652e057693569bfe0d51760c0085a071769d142a205111b"
dependencies = [
 "bytes 0.5.6",
 "http",
]

[[package]]
name = "httparse"
version = "1.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "acd94fdbe1d4ff688b67b04eee2e17bd50995534a61539e45adfefb45e5e5503"

[[package]]
name = "httpdate"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "494b4d60369511e7dea41cf646832512a94e542f68bb9c49e54518e0f468eb47"

[[package]]
name = "hyper"
version = "0.13.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a6f157065790a3ed2f88679250419b5cdd96e714a0d65f7797fd337186e96bb"
dependencies = [
 "bytes 0.5.6",
 "futures-channel",
 "futures-core",
 "futures-util",
 "h2",
 "http",
 "http-body",
 "httparse",
 "httpdate",
 "itoa",
 "pin-project",
 "socket2",
 "tokio",
 "tower-service",
 "tracing",
 "want",
]

[[package]]
name = "hyper-tls"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d979acc56dcb5b8dddba3917601745e877576475aa046df3226eabdecef78eed"
dependencies = [
 "bytes 0.5.6",
 "hyper",
 "native-tls",
 "tokio",
 "tokio-tls",
]

[[package]]
name = "idna"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8"
dependencies = [
 "matches",
 "unicode-bidi",
 "unicode-normalization",
]

[[package]]
name = "indexmap"
version = "1.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bc633605454125dec4b66843673f01c7df2b89479b32e0ed634e43a91cff62a5"
dependencies = [
 "autocfg",
 "hashbrown",
]

[[package]]
name = "indoc"
version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e5a75aeaaef0ce18b58056d306c27b07436fbb34b8816c53094b76dd81803136"
dependencies = [
 "unindent",
]

[[package]]
name = "iovec"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e"
dependencies = [
 "libc",
]

[[package]]
name = "ipnet"
version = "2.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "68f2d64f2edebec4ce84ad108148e67e1064789bee435edc5b60ad398714a3a9"

[[package]]
name = "itoa"
version = "0.4.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4"

[[package]]
name = "js-sys"
version = "0.3.55"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7cc9ffccd38c451a86bf13657df244e9c3f37493cce8e5e21e940963777acc84"
dependencies = [
 "wasm-bindgen",
]

[[package]]
name = "kernel32-sys"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
dependencies = [
 "winapi 0.2.8",
 "winapi-build",
]

[[package]]
name = "lazy_static"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"

[[package]]
name = "libc"
version = "0.2.108"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8521a1b57e76b1ec69af7599e75e38e7b7fad6610f037db8c79b127201b5d119"

[[package]]
name = "log"
version = "0.4.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710"
dependencies = [
 "cfg-if 1.0.0",
]

[[package]]
name = "matches"
version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f"

[[package]]
name = "memchr"
version = "2.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a"

[[package]]
name = "memoffset"
version = "0.6.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce"
dependencies = [
 "autocfg",
]

[[package]]
name = "mime"
version = "0.3.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d"

[[package]]
name = "mime_guess"
version = "2.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2684d4c2e97d99848d30b324b00c8fcc7e5c897b7cbb5819b09e7c90e8baf212"
dependencies = [
 "mime",
 "unicase",
]

[[package]]
name = "mio"
version = "0.6.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4afd66f5b91bf2a3bc13fad0e21caedac168ca4c707504e75585648ae80e4cc4"
dependencies = [
 "cfg-if 0.1.10",
 "fuchsia-zircon",
 "fuchsia-zircon-sys",
 "iovec",
 "kernel32-sys",
 "libc",
 "log",
 "miow",
 "net2",
 "slab",
 "winapi 0.2.8",
]

[[package]]
name = "miow"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ebd808424166322d4a38da87083bfddd3ac4c131334ed55856112eb06d46944d"
dependencies = [
 "kernel32-sys",
 "net2",
 "winapi 0.2.8",
 "ws2_32-sys",
]

[[package]]
name = "native-tls"
version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "48ba9f7719b5a0f42f338907614285fb5fd70e53858141f69898a1fb7203b24d"
dependencies = [
 "lazy_static",
 "libc",
 "log",
 "openssl",
 "openssl-probe",
 "openssl-sys",
 "schannel",
 "security-framework",
 "security-framework-sys",
 "tempfile",
]

[[package]]
name = "net2"
version = "0.2.37"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "391630d12b68002ae1e25e8f974306474966550ad82dac6886fb8910c19568ae"
dependencies = [
 "cfg-if 0.1.10",
 "libc",
 "winapi 0.3.9",
]

[[package]]
name = "num_cpus"
version = "1.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3"
dependencies = [
 "hermit-abi",
 "libc",
]

[[package]]
name = "once_cell"
version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56"

[[package]]
name = "openssl"
version = "0.10.38"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c7ae222234c30df141154f159066c5093ff73b63204dcda7121eb082fc56a95"
dependencies = [
 "bitflags",
 "cfg-if 1.0.0",
 "foreign-types",
 "libc",
 "once_cell",
 "openssl-sys",
]

[[package]]
name = "openssl-probe"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "28988d872ab76095a6e6ac88d99b54fd267702734fd7ffe610ca27f533ddb95a"

[[package]]
name = "openssl-sys"
version = "0.9.71"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7df13d165e607909b363a4757a6f133f8a818a74e9d3a98d09c6128e15fa4c73"
dependencies = [
 "autocfg",
 "cc",
 "libc",
 "pkg-config",
 "vcpkg",
]

[[package]]
name = "percent-encoding"
version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e"

[[package]]
name = "petgraph"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4a13a2fa9d0b63e5f22328828741e523766fff0ee9e779316902290dff3f824f"
dependencies = [
 "fixedbitset",
 "indexmap",
]

[[package]]
name = "pin-project"
version = "1.0.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "576bc800220cc65dac09e99e97b08b358cfab6e17078de8dc5fee223bd2d0c08"
dependencies = [
 "pin-project-internal",
]

[[package]]
name = "pin-project-internal"
version = "1.0.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6e8fe8163d14ce7f0cdac2e040116f22eac817edabff0be91e8aff7e9accf389"
dependencies = [
 "proc-macro2",
 "quote",
 "syn",
]

[[package]]
name = "pin-project-lite"
version = "0.1.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "257b64915a082f7811703966789728173279bdebb956b143dbcd23f6f970a777"

[[package]]
name = "pin-project-lite"
version = "0.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8d31d11c69a6b52a174b42bdc0c30e5e11670f90788b2c471c31c1d17d449443"

[[package]]
name = "pin-utils"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"

[[package]]
name = "pkg-config"
version = "0.3.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "12295df4f294471248581bc09bef3c38a5e46f1e36d6a37353621a0c6c357e1f"

[[package]]
name = "ppv-lite86"
version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed0cfbc8191465bed66e1718596ee0b0b35d5ee1f41c5df2189d0fe8bde535ba"

[[package]]
name = "proc-macro2"
version = "1.0.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ba508cc11742c0dc5c1659771673afbab7a0efab23aa17e854cbab0837ed0b43"
dependencies = [
 "unicode-xid",
]

[[package]]
name = "quote"
version = "1.0.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "38bc8cc6a5f2e3655e0899c1b848643b2562f853f114bfec7be120678e3ace05"
dependencies = [
 "proc-macro2",
]

[[package]]
name = "rand"
version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2e7573632e6454cf6b99d7aac4ccca54be06da05aca2ef7423d22d27d4d4bcd8"
dependencies = [
 "libc",
 "rand_chacha",
 "rand_core",
 "rand_hc",
]

[[package]]
name = "rand_chacha"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
dependencies = [
 "ppv-lite86",
 "rand_core",
]

[[package]]
name = "rand_core"
version = "0.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7"
dependencies = [
 "getrandom",
]

[[package]]
name = "rand_hc"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d51e9f596de227fda2ea6c84607f5558e196eeaf43c986b724ba4fb8fdf497e7"
dependencies = [
 "rand_core",
]

[[package]]
name = "rayon"
version = "1.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c06aca804d41dbc8ba42dfd964f0d01334eceb64314b9ecf7c5fad5188a06d90"
dependencies = [
 "autocfg",
 "crossbeam-deque",
 "either",
 "rayon-core",
]

[[package]]
name = "rayon-core"
version = "1.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d78120e2c850279833f1dd3582f730c4ab53ed95aeaaaa862a2a5c71b1656d8e"
dependencies = [
 "crossbeam-channel",
 "crossbeam-deque",
 "crossbeam-utils",
 "lazy_static",
 "num_cpus",
]

[[package]]
name = "redox_syscall"
version = "0.2.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8383f39639269cde97d255a32bdb68c047337295414940c68bdd30c2e13203ff"
dependencies = [
 "bitflags",
]

[[package]]
name = "regex"
version = "1.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461"
dependencies = [
 "aho-corasick",
 "memchr",
 "regex-syntax",
]

[[package]]
name = "regex-syntax"
version = "0.6.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b"

[[package]]
name = "remove_dir_all"
version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7"
dependencies = [
 "winapi 0.3.9",
]

[[package]]
name = "reqwest"
version = "0.10.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0718f81a8e14c4dbb3b34cf23dc6aaf9ab8a0dfec160c534b3dbca1aaa21f47c"
dependencies = [
 "base64",
 "bytes 0.5.6",
 "encoding_rs",
 "futures-core",
 "futures-util",
 "http",
 "http-body",
 "hyper",
 "hyper-tls",
 "ipnet",
 "js-sys",
 "lazy_static",
 "log",
 "mime",
 "mime_guess",
 "native-tls",
 "percent-encoding",
 "pin-project-lite 0.2.7",
 "serde",
 "serde_urlencoded",
 "tokio",
 "tokio-tls",
 "url",
 "wasm-bindgen",
 "wasm-bindgen-futures",
 "web-sys",
 "winreg",
]

[[package]]
name = "ryu"
version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3c9613b5a66ab9ba26415184cfc41156594925a9cf3a2057e57f31ff145f6568"

[[package]]
name = "schannel"
version = "0.1.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f05ba609c234e60bee0d547fe94a4c7e9da733d1c962cf6e59efa4cd9c8bc75"
dependencies = [
 "lazy_static",
 "winapi 0.3.9",
]

[[package]]
name = "scopeguard"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"

[[package]]
name = "security-framework"
version = "2.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "525bc1abfda2e1998d152c45cf13e696f76d0a4972310b22fac1658b05df7c87"
dependencies = [
 "bitflags",
 "core-foundation",
 "core-foundation-sys",
 "libc",
 "security-framework-sys",
]

[[package]]
name = "security-framework-sys"
version = "2.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a9dd14d83160b528b7bfd66439110573efcfbe281b17fc2ca9f39f550d619c7e"
dependencies = [
 "core-foundation-sys",
 "libc",
]

[[package]]
name = "serde"
version = "1.0.130"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f12d06de37cf59146fbdecab66aa99f9fe4f78722e3607577a5375d66bd0c913"

[[package]]
name = "serde_json"
version = "1.0.72"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d0ffa0837f2dfa6fb90868c2b5468cad482e175f7dad97e7421951e663f2b527"
dependencies = [
 "itoa",
 "ryu",
 "serde",
]

[[package]]
name = "serde_urlencoded"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "edfa57a7f8d9c1d260a549e7224100f6c43d43f9103e06dd8b4095a9b2b43ce9"
dependencies = [
 "form_urlencoded",
 "itoa",
 "ryu",
 "serde",
]

[[package]]
name = "slab"
version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9def91fd1e018fe007022791f865d0ccc9b3a0d5001e01aabb8b40e46000afb5"

[[package]]
name = "socket2"
version = "0.3.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "122e570113d28d773067fab24266b66753f6ea915758651696b6e35e49f88d6e"
dependencies = [
 "cfg-if 1.0.0",
 "libc",
 "winapi 0.3.9",
]

[[package]]
name = "syn"
version = "1.0.82"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8daf5dd0bb60cbd4137b1b587d2fc0ae729bc07cf01cd70b36a1ed5ade3b9d59"
dependencies = [
 "proc-macro2",
 "quote",
 "unicode-xid",
]

[[package]]
name = "tempfile"
version = "3.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22"
dependencies = [
 "cfg-if 1.0.0",
 "libc",
 "rand",
 "redox_syscall",
 "remove_dir_all",
 "winapi 0.3.9",
]

[[package]]
name = "tinyvec"
version = "1.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c1c1d5a42b6245520c249549ec267180beaffcc0615401ac8e31853d4b6d8d2"
dependencies = [
 "tinyvec_macros",
]

[[package]]
name = "tinyvec_macros"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"

[[package]]
name = "tokio"
version = "0.2.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6703a273949a90131b290be1fe7b039d0fc884aa1935860dfcbe056f28cd8092"
dependencies = [
 "bytes 0.5.6",
 "fnv",
 "futures-core",
 "iovec",
 "lazy_static",
 "memchr",
 "mio",
 "num_cpus",
 "pin-project-lite 0.1.12",
 "slab",
]

[[package]]
name = "tokio-tls"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a70f4fcd7b3b24fb194f837560168208f669ca8cb70d0c4b862944452396343"
dependencies = [
 "native-tls",
 "tokio",
]

[[package]]
name = "tokio-util"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "be8242891f2b6cbef26a2d7e8605133c2c554cd35b3e4948ea892d6d68436499"
dependencies = [
 "bytes 0.5.6",
 "futures-core",
 "futures-sink",
 "log",
 "pin-project-lite 0.1.12",
 "tokio",
]

[[package]]
name = "tower-service"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "360dfd1d6d30e05fda32ace2c8c70e9c0a9da713275777f5a4dbb8a1893930c6"

[[package]]
name = "tracing"
version = "0.1.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "375a639232caf30edfc78e8d89b2d4c375515393e7af7e16f01cd96917fb2105"
dependencies = [
 "cfg-if 1.0.0",
 "log",
 "pin-project-lite 0.2.7",
 "tracing-core",
]

[[package]]
name = "tracing-core"
version = "0.1.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1f4ed65637b8390770814083d20756f87bfa2c21bf2f110babdc5438351746e4"
dependencies = [
 "lazy_static",
]

[[package]]
name = "tracing-futures"
version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2"
dependencies = [
 "pin-project",
 "tracing",
]

[[package]]
name = "try-lock"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642"

[[package]]
name = "unicase"
version = "2.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6"
dependencies = [
 "version_check",
]

[[package]]
name = "unicode-bidi"
version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a01404663e3db436ed2746d9fefef640d868edae3cceb81c3b8d5732fda678f"

[[package]]
name = "unicode-normalization"
version = "0.1.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d54590932941a9e9266f0832deed84ebe1bf2e4c9e4a3554d393d18f5e854bf9"
dependencies = [
 "tinyvec",
]

[[package]]
name = "unicode-xid"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3"

[[package]]
name = "unindent"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f14ee04d9415b52b3aeab06258a3f07093182b88ba0f9b8d203f211a7a7d41c7"

[[package]]
name = "url"
version = "2.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c"
dependencies = [
 "form_urlencoded",
 "idna",
 "matches",
 "percent-encoding",
]

[[package]]
name = "vcpkg"
version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"

[[package]]
name = "version_check"
version = "0.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe"

[[package]]
name = "want"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0"
dependencies = [
 "log",
 "try-lock",
]

[[package]]
name = "wasi"
version = "0.10.2+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6"

[[package]]
name = "wasm-bindgen"
version = "0.2.78"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "632f73e236b219150ea279196e54e610f5dbafa5d61786303d4da54f84e47fce"
dependencies = [
 "cfg-if 1.0.0",
 "serde",
 "serde_json",
 "wasm-bindgen-macro",
]

[[package]]
name = "wasm-bindgen-backend"
version = "0.2.78"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a317bf8f9fba2476b4b2c85ef4c4af8ff39c3c7f0cdfeed4f82c34a880aa837b"
dependencies = [
 "bumpalo",
 "lazy_static",
 "log",
 "proc-macro2",
 "quote",
 "syn",
 "wasm-bindgen-shared",
]

[[package]]
name = "wasm-bindgen-futures"
version = "0.4.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e8d7523cb1f2a4c96c1317ca690031b714a51cc14e05f712446691f413f5d39"
dependencies = [
 "cfg-if 1.0.0",
 "js-sys",
 "wasm-bindgen",
 "web-sys",
]

[[package]]
name = "wasm-bindgen-macro"
version = "0.2.78"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d56146e7c495528bf6587663bea13a8eb588d39b36b679d83972e1a2dbbdacf9"
dependencies = [
 "quote",
 "wasm-bindgen-macro-support",
]

[[package]]
name = "wasm-bindgen-macro-support"
version = "0.2.78"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7803e0eea25835f8abdc585cd3021b3deb11543c6fe226dcd30b228857c5c5ab"
dependencies = [
 "proc-macro2",
 "quote",
 "syn",
 "wasm-bindgen-backend",
 "wasm-bindgen-shared",
]

[[package]]
name = "wasm-bindgen-shared"
version = "0.2.78"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0237232789cf037d5480773fe568aac745bfe2afbc11a863e97901780a6b47cc"

[[package]]
name = "web-sys"
version = "0.3.55"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "38eb105f1c59d9eaa6b5cdc92b859d85b926e82cb2e0945cd0c9259faa6fe9fb"
dependencies = [
 "js-sys",
 "wasm-bindgen",
]

[[package]]
name = "winapi"
version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"

[[package]]
name = "winapi"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
dependencies = [
 "winapi-i686-pc-windows-gnu",
 "winapi-x86_64-pc-windows-gnu",
]

[[package]]
name = "winapi-build"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc"

[[package]]
name = "winapi-i686-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"

[[package]]
name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"

[[package]]
name = "winreg"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0120db82e8a1e0b9fb3345a539c478767c0048d842860994d96113d5b667bd69"
dependencies = [
 "winapi 0.3.9",
]

[[package]]
name = "ws2_32-sys"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e"
dependencies = [
 "winapi 0.2.8",
 "winapi-build",
]


code:
[package]
name = "aoc-2021"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
reqwest = { version = "0.10.9", features = ["blocking"] }
indoc = "1.0.3"
rayon = "1.5.1"
ansi_term = "0.12"
petgraph = "0.6.0"
regex = "1"


code:
forward 8
down 9
up 1
forward 2
down 6
forward 6
down 5
down 4
down 2
forward 3
forward 8
down 6
up 3
up 3
down 5
up 8
forward 8
up 6
forward 4
down 8
up 2
up 6
forward 7
up 6
down 6
down 1
forward 8
up 7
forward 9
forward 5
forward 8
forward 5
down 3
forward 5
up 1
forward 6
forward 3
forward 3
down 2
forward 4
down 3
forward 6
forward 2
forward 1
down 2
forward 1
down 1
up 8
down 4
forward 3
up 3
down 5
down 2
forward 7
forward 1
down 9
up 1
down 1
forward 2
forward 1
forward 1
forward 7
up 5
forward 2
down 6
down 7
down 3
down 1
forward 4
forward 5
down 3
forward 4
down 5
forward 3
forward 4
forward 2
up 8
down 7
up 3
forward 2
down 5
forward 9
forward 5
up 1
down 5
down 6
forward 2
forward 5
down 6
down 1
up 8
up 9
down 7
down 5
forward 2
forward 7
forward 7
up 6
down 4
up 6
forward 2
down 4
down 3
down 4
forward 2
down 2
down 1
down 4
up 4
forward 7
forward 6
forward 2
forward 5
forward 1
forward 7
forward 2
down 3
forward 7
forward 2
up 4
up 5
down 1
down 2
down 3
down 7
up 8
forward 4
down 5
down 4
forward 3
down 6
forward 5
up 5
forward 6
down 1
down 7
forward 1
forward 6
up 9
forward 2
down 1
forward 5
forward 2
forward 6
forward 8
forward 6
down 8
forward 3
down 9
up 8
forward 9
down 7
down 6
down 1
up 5
down 6
forward 7
up 9
forward 8
forward 3
forward 3
forward 2
down 6
up 1
up 5
forward 7
down 2
down 5
down 1
down 4
forward 8
forward 2
forward 8
up 5
forward 7
up 7
forward 6
forward 9
up 1
down 4
forward 8
forward 4
down 9
up 6
down 8
up 9
down 2
down 2
down 9
up 3
down 7
down 2
up 9
forward 9
down 5
forward 2
forward 1
forward 2
down 4
forward 4
down 2
forward 8
up 3
forward 6
up 7
up 9
forward 4
up 9
down 5
forward 5
up 6
down 2
down 4
forward 1
down 2
forward 3
down 7
down 1
down 5
forward 5
up 5
forward 3
down 5
forward 7
down 3
down 2
up 9
down 4
forward 4
down 4
forward 1
up 9
down 8
forward 2
down 7
forward 8
down 5
up 2
down 9
down 2
up 4
up 2
forward 8
forward 3
forward 4
down 1
down 3
forward 3
down 8
forward 7
down 7
forward 5
forward 5
up 3
down 6
forward 1
down 4
forward 2
down 4
up 2
down 3
forward 4
forward 6
up 7
down 3
forward 7
forward 1
down 1
up 3
down 7
up 3
up 8
up 7
up 7
forward 7
down 2
forward 6
forward 7
up 3
down 3
up 9
down 6
down 7
down 7
up 5
forward 6
forward 2
up 9
forward 2
down 3
down 3
forward 5
forward 3
forward 6
forward 6
down 7
forward 2
down 3
up 4
forward 1
forward 5
down 5
up 1
down 9
forward 3
up 6
forward 5
down 4
forward 9
up 5
forward 7
up 7
forward 9
forward 2
forward 6
forward 3
forward 3
up 7
down 1
down 1
forward 1
down 8
down 2
forward 4
up 7
forward 7
down 5
down 7
up 6
down 4
forward 4
forward 4
up 7
down 9
forward 6
forward 1
down 7
forward 5
forward 2
forward 1
up 7
down 9
forward 2
down 7
up 8
forward 1
forward 4
up 4
forward 1
down 9
down 5
down 8
forward 8
forward 8
down 8
down 3
down 5
down 6
up 9
forward 1
down 1
forward 1
forward 1
down 6
forward 3
down 1
forward 9
forward 3
up 7
down 9
forward 5
down 4
up 9
down 2
down 5
down 6
forward 1
up 2
forward 9
up 7
forward 2
forward 8
down 5
down 6
down 8
forward 4
down 4
forward 9
forward 3
forward 6
forward 9
up 2
down 8
up 2
up 6
up 5
down 5
down 7
forward 1
up 6
forward 9
up 4
forward 4
up 2
forward 3
down 8
down 1
up 5
forward 5
down 3
down 4
down 1
forward 3
up 2
forward 3
down 1
forward 8
up 3
forward 4
down 3
forward 6
down 9
down 7
forward 3
forward 5
forward 1
forward 3
up 8
forward 2
forward 2
forward 7
up 9
forward 4
down 1
down 6
forward 8
forward 5
up 4
up 5
up 9
forward 9
up 8
down 3
up 5
forward 1
forward 5
up 9
forward 8
forward 4
forward 3
forward 1
forward 6
down 2
up 8
down 7
down 1
down 5
up 1
forward 9
down 2
down 4
forward 3
forward 1
down 7
up 9
up 7
down 2
down 4
down 1
forward 9
up 4
down 9
down 9
down 4
down 9
forward 1
down 2
forward 8
up 4
up 3
forward 4
down 5
forward 8
forward 2
forward 4
up 3
up 2
up 3
forward 4
forward 4
forward 6
down 7
down 8
up 3
down 9
down 5
up 7
up 1
down 3
down 4
up 5
up 9
down 2
up 8
forward 9
down 3
forward 4
down 5
down 1
forward 9
forward 2
up 3
down 9
down 8
up 7
forward 2
down 9
up 8
up 2
down 3
forward 3
forward 3
forward 3
forward 4
down 7
up 2
forward 3
forward 7
forward 5
forward 7
down 6
down 9
down 6
down 8
up 4
down 4
down 2
up 1
down 3
forward 7
forward 5
down 7
forward 1
up 7
forward 9
down 8
down 1
down 3
down 1
up 8
forward 7
up 5
forward 6
down 1
down 8
up 1
up 9
forward 7
down 9
forward 3
forward 8
forward 7
down 3
down 5
up 3
up 7
up 3
up 6
up 8
down 3
forward 7
down 7
forward 9
up 9
down 1
down 3
down 8
down 6
forward 1
up 6
down 1
up 4
down 2
forward 9
up 8
up 2
down 6
down 1
forward 2
forward 6
forward 1
forward 2
up 6
down 7
down 8
forward 9
up 2
down 6
down 8
down 5
up 6
forward 6
down 5
forward 4
forward 2
down 1
down 4
up 5
down 5
down 1
down 9
down 1
down 1
forward 1
forward 5
up 4
down 5
down 3
down 2
down 7
forward 5
forward 6
forward 2
up 9
up 3
forward 6
down 4
forward 8
forward 4
forward 9
down 6
down 9
down 1
forward 6
down 8
down 7
forward 5
down 4
forward 5
forward 5
up 3
down 1
down 4
forward 1
forward 7
down 5
down 4
forward 7
forward 3
forward 4
down 4
forward 8
up 2
up 6
down 9
up 1
down 8
up 2
up 6
forward 5
forward 7
up 4
down 4
down 8
forward 5
up 4
down 6
forward 9
up 4
forward 7
up 7
down 3
down 2
down 2
down 6
down 4
forward 4
down 3
down 4
down 4
down 8
up 2
down 3
forward 5
forward 5
up 5
forward 1
down 7
forward 5
forward 7
forward 9
forward 4
down 1
down 1
up 5
down 6
down 8
down 9
down 9
forward 7
down 6
forward 3
down 7
up 3
forward 5
forward 5
up 6
down 5
down 8
down 5
down 1
down 7
forward 8
up 9
forward 2
up 1
down 9
down 2
forward 7
up 1
down 5
forward 3
up 6
forward 9
up 9
down 3
forward 2
up 6
down 6
up 8
down 3
up 5
forward 9
up 3
forward 4
forward 6
down 3
forward 4
down 5
down 7
down 7
forward 9
forward 6
down 9
up 1
forward 2
down 8
down 7
up 7
forward 6
up 5
down 6
forward 6
down 3
forward 2
down 7
forward 2
down 3
down 8
forward 4
up 8
forward 7
down 4
forward 3
down 3
forward 6
down 7
down 7
forward 8
forward 9
down 8
down 4
forward 5
down 1
forward 9
down 7
up 3
down 6
down 4
down 9
forward 3
down 1
forward 1
down 5
forward 1
forward 9
down 9
forward 5
down 1
up 9
down 3
down 2
up 6
forward 4
down 6
down 2
forward 5
up 8
down 7
up 6
down 1
forward 3
forward 4
down 9
down 2
forward 5
forward 8
up 2
forward 9
up 5
down 1
forward 1
forward 6
forward 9
forward 2
down 8
forward 1
up 8
forward 1
forward 8
up 5
forward 3
down 4
up 8
down 6
up 1
forward 2
forward 4
up 6
forward 1
forward 4
up 6
down 8
up 7
forward 5
up 7
down 9
down 2
up 5
forward 2
down 7
forward 1
forward 1
forward 3
down 6
forward 7
up 2
up 1
forward 1
up 5
down 1
forward 7
up 9
forward 7
down 6
up 4
down 5
up 2
down 4
up 3
down 6
down 7
down 7
up 1
forward 4
forward 1
up 2
down 7
down 5
forward 7
forward 5
forward 2
down 4
down 6
down 8
forward 9
forward 8
up 9
forward 6
down 6
down 6
down 8
up 5
forward 6
down 6
forward 5
down 4
down 6
down 2
up 3
forward 1
forward 8
down 2
forward 9
forward 7
forward 8
forward 1
down 8
forward 1
down 1
forward 6
forward 4
forward 5
up 9
up 1
down 7
up 8
down 5
down 2
forward 9
up 2
forward 6
down 7
down 7
down 2
down 6
down 7
forward 9
up 2
down 6
forward 8
forward 1
down 3
down 2
forward 3
forward 7
down 3
down 1
down 4
down 9
forward 1
down 6
down 8
down 4
down 5
down 5
up 9
forward 7
down 9
up 3
up 5
up 1
forward 2
forward 9
down 3
forward 1
up 3
forward 6
up 2
forward 7
forward 5
forward 8
forward 7
forward 8
down 5
up 3
forward 5
forward 8
forward 1
forward 5
forward 7
forward 2
down 6
down 6
down 6
down 2
down 2
up 1
down 1
forward 5
forward 7
down 4
forward 4
up 1
forward 7
forward 8
down 5
down 2
down 2
down 5
forward 3
forward 7
down 5
forward 2
forward 8
down 3
forward 6
up 1
forward 7
forward 4
forward 1
forward 9
forward 2
down 1
down 1
down 8
forward 4
down 6
forward 7
forward 2


code:
bcedagf ebadf gcdfe gfcead bcedgf dfeca ac dgca ace cafbge | ecfdbag gecfd feadb degacbf
gab cebfag bdfg gaefd bg debga gadbef dbafgce gdafec cadbe | befdga fgdaec gdaecf bdecgaf
feabcg eacd cdbeg cfgbda dgefb cbgefad ceb dbagc ce gadbec | ec ceb aecd daec
acdbf ebfa fagdec ef bcged edcfba gcedafb facgdb ebcfd ecf | fe fce gfcdab fe
bcg eacfbg daebgfc cfabd gbfaed degfcb gc cdeg cbdfg egfdb | fbgcaed edbfg aedgbcf cg
gdbaf cefgd egdaf deab afe egcbaf afgcbd efbdga ae ecbdagf | ea deab baed ebcgfa
ecadfgb dacbfe bgedfc afebc abf dbcef ecgab adef cfgbda fa | efad baf fab af
gaefcd dgbcef fdbeac cgfab ad dca ebcdf fbdecga dbcfa beda | ad dbefc fgecad edba
egfa dcgbfe ag gac fcdbage cebag gebafc gfebc gdabfc caebd | ag bgace gefa bgfced
dfbage fedcba ga gae bcegda fagb gcedf edfag adfeb geabdfc | ga gcfde ag facdebg
ebcfad agcfbe de cfbae degcaf ebdc bcadfeg fdabe gbfad ead | decfga dbgacef daecfbg dae
cdaegb ced gdfbe bdecfa caefbdg bcdeg gabcd gaec ec bacfdg | agec degafcb cde acbdg
bcadgf bgecfd abcgfe cd acgbd fedbagc gdeba afcd abfcg cdg | dc dbacefg befcadg dgfaecb
afcbed gdfaecb bfdec dbafe fc fcda fgabce gdefba bdecg cfe | fcda fagedb fc egdcb
bdecf dgcbe befcdg bef fgbc gcaebfd bgaecd caedf fb dfabeg | dbfceg fb bfe efb
bge gedabc fdeacbg dagfec feacg gcdbf eb aebf fcaegb fgceb | gbe beg gafce be
efdbcga egfba dafcge eacb acbfg ae edbgf bgfcea dcfgba gae | agbef fcagb bafge fabcg
fcbdg fdgcea dfcgaeb dfgac fdcgab ecbgad gb edcbf afgb gbc | cafbged ebfcdga bdcfg gcb
ceb cdefag be ebfcg agecf degfbca egbfca gaeb abecdf fcgdb | gebfc acgbefd aedfbc dfcbae
bfegd bdgea fd bfcge gfabcd fdg dcgeafb ebgdcf gebfac ecdf | degfb fedbg efgcb fced
dcfabe bcga fgbed ag aecfgb cdegfa baefg aeg eabfc agedbfc | ega aeg ag cebdgfa
fgade eaf abfgd fe abcfeg cfde efcdga dbeafgc daegc acdegb | gadbfec aef fae cdgea
abe debc cdagb agedb gebcfa eadbfgc bacegd gdefa be fcabgd | gdbacfe fagde dgbace acfgdb
fea gabdf ea beacfg cgdfae cabe cgebadf cdefbg ebgaf gefcb | edfacg fae ceba efa
ed fecba bfcdae aefcd ecabdg fcagd begdafc bedf ced gafcbe | dbceaf ced ced ced
abfgc gfbcae fbace gdeabf fae bdgcfa edcab acebfdg gcfe ef | aef fe fbdcga dfaebcg
ac eac dgebcf bcaef begcf cgab cdbgeaf agdcef ebfgac bedaf | dfcaeg bgeadfc bgcafe fgbce
afdbc bgecadf gfecad dca ac aebc dfceba ebfdgc gfdab cdfbe | acbe dac cedafg ca
fadcb efc baedcf fdbge aedc ce dgaefcb cgfbda dbcfe geacfb | ce ce gbcdefa dace
fcbea ebd cbdg ceafdg cdgabe dbeagf bd ecdba fcgedba egdca | ecadbgf gdeac bd acdfge
fbd gcdafb fb bcdea aefgd fcgedab gecdab febad becf fcdeab | badef ceadb bdgacfe afdcebg
dcgfbe cgdefa fc adcf bdeagc gcead cabefdg ecf fegac egfab | gecfadb afecg dcaf bfcgade
fbgdce acge fbegc ecfbadg cfa cdbfea bgfad bafcg cgafeb ac | ac efdcba agdfb fecbad
edg efdgca edba bdegf cafgedb faebdg ed fgecab fgbea bdfgc | eagdfbc cgdbf geafcb gefdcba
gcaedb fgedcba cfbgae fgc gcfde gefdb cfaged cf dafc dgcae | gcf fgeabc bdcgea acfd
bgecdfa bgedaf dbfa cgefda db efgad gdb agbde egbcdf aegbc | dbegfc dgb bdg cgdebf
egacbfd gecfba ecd acfgd degb fbadec de efgcd cfdbeg fbgec | egbcfa cfabdge ebgd ed
ecgdb ebdfc fagdbe fe afce afgdbc bdcaef cbegdfa abfcd dfe | caefbd ef fe bfdce
egadf cd gfdace acebf ecd cefbgd fdeca gfbdae gadc dbegcaf | fdagbe adgc gdeaf dafcegb
cgdfb eabfg abd deafbg dbcega afde bfgda fdeacbg ad fbeagc | fdgeabc feagcdb gafedbc da
bdega dbace fbecd bdfgaec feadbc bfca cda ac edgfac becdgf | ac ca cad bfca
gacef bgcae fgdceab gef fgbade abdecg fgabce cdaef bgfc gf | bfagedc cbfg adbgec bgfc
agcbd eagd abgdefc gec bceaf cbdgfe gfdacb baegdc acbge ge | egc ge gade ecg
cbgda egcad acbged gb bfcad acgfedb ebcfag gdeb cbg fdacge | gadfce edgb cgfabe adbecg
fgcaeb gcbdf dbfagec fgcae da gacdef aedc adf gadfc fegabd | fagdc afbecg deca edac
abedfcg ca bedcf abefc eabfdc aegbf dfbegc dgabcf bac aecd | ecfabd ecbfa acde abc
dag fedag cdeabg dg fdeca fgbae fdgc gadfce cdaebf eagbdfc | gd dcgaebf dgfc adg
aegbf cdga fcebad ecbag ac bca cbedga cfbgade gdbce fbdgec | geabc gadc ebgfacd gadc
aeg abde ea becdfg eadcg adcfg gaefcdb ebgfca acgdbe dcbge | ebad abde cedag ae
cfa eabfd eadfcb bface gdfbca gefbda ca eacd faebdgc cgbfe | efcgb cabdgf eagcfdb cfa
gfdeca fcabe agdbfec cde efdcb dfbaeg debgf cgebfd dc bdcg | ced bcfegd egbafd gcbd
db gfdbae gbfce fbdeg degfa fadecg abed gcfdba aegfdbc dgb | dgfbae db ecbgf daeb
fcdab gcfdab ebafgdc dg fgdc deafbc gbd aebcg dacgb gdfeba | adbcg gd ebgdfac gd
afg eagdcf bagfc fg gdbefca afcdb bcage dbcage ecafgb bgfe | gf aegcb gf gaf
fgc ecfb cbgeaf cf fgabe gdbecfa gedac bfgcda fcaeg debgaf | bfeag cbgefda gbaef abfeg
adcgfe gbfaed dcfbg fdeab fgdeb ebag ge fdgecba fadbec dge | gfcdb ge ged efadcb
cebgd bdfag bcgfd agfc dgfacb fecdab cf dafegb fdgeabc fcd | bacefd acgf cdf cfd
geabfd adf dfecbag agdefc ecdga acgfd fgcbd fa cedagb ecfa | bdgcfae fbgeda gdaec af
cdgabef gfeda dacegf agfdbe dafce aec bdfac efcgba ec cedg | eabdgf egbfad gdeacf ce
febd dab fbdca acdef db cafgb cebafdg bcfdea cagdbe fgacde | dbfe aedfc afcgb efdb
caebfg caegdb efbad da dgaf beafgd edfcb dgabcfe bad ebafg | dba dgfa ad efdbc
dbcef dgfab bcag cgd dcfbag gcdfb gedfba cg degfac dbgeafc | gcd cfebd fedcb cbag
cfbag cefagb dfaceb gb febca bdaefg cgeb fbg efcagdb gcfda | cgeb fbg abefdgc bg
cebgd geacb dbcgea dc dgc gfeacb bedgf cead cgadfb debfagc | ecad eacd dc eacbg
cbdgf fdacg fdbceg dafgcb acd gadb eacgf ad gaefbdc cedafb | dac dca cfage dgab
cgebfa bfedg fb bdgfec gafed bdcf bgedc feb aecgfbd bdcega | bdgcae bfdceg efb gebdc
cadg ac cfa acegfd efdac edgcf bafde afdcgbe egdcfb eagbfc | cfdegab dbcefg cbfgdea acdgef
baecdgf dacbfe ecf gbecad dbfcg cdgea gfae ef afdgce egfdc | aegf ef fe eafg
gc baefcd gfade agc ecgb cdgfab cegaf ebgfdca ecabf agefbc | gc bgfcea afcbe ecgb
ecfad efdab ba dgcafbe adgefb agdb fba egfbcd gecabf fgedb | bcgfed dfgbe dbag fba
bdgea ce ebdfcg fdgbc defcba abdcgf dbcgefa ecd gcbed cegf | ecd egcf efcdba agfbdc
fgcade bfgade bgfcea bfaegcd cfa fgcba fgabe gcbfd abec ca | ca cabe cdbgf dcegfba
aefgbc cedaf agbdcfe agecd fecba gdcfab fd ebcfda fbde cdf | cfagbed df aecfb fbcade
cgbfae fcdbga cgdfe abde gfdea deafgb afdgb ae cbgfead fae | afe afe becfagd ea
ec gfabed aceg dafgceb dec ebcgdf dabfc eagdfc dfcae gdfae | febcgad cgae caeg gabedfc
degacfb fcdgb befc fge edgca cbdfge aedgfb fegdc ef dgbcaf | egf gfe gecdabf gef
abfcg fgeab edfbca bfgadec eaf dbeag bdgaec ef efdg edafbg | aef ecdgba aef abefg
ecdfb cgedb ge adfbeg deg geca cdeabg abdcg afcbdg fgbdeca | ge fdebc deg bedfag
fbgdac dc adgc dcb caebdf cfgbd fbagc fgcaeb bgfde fbcaegd | cgda cbd dbc cd
fgecad dabfg def bcefg cabdgef daeb dbfega ed dbagcf ebfdg | dfe edcagfb bdae agbdfce
acbdfge gb cbdfea fecagb bfg bagdfe abedf agdb gbefd fdceg | febgd bg bg acefdbg
fbcgde efbg efdbc gec dafgc cgdfe agcebd fbceda ge gfadebc | fdebc egcfdab cbdeag ebfg
eadfgc cb dabfg adcegb gecfa bcgeaf acbfg fbec dcabgfe bcg | bgceda bc aecfbg gadecfb
fbade gbedfca fceadg cafed ebfcgd cgda cfa ac dfcge ebgfca | gdfceba feabd ca ac
adefgc fdgca abfdc dgc dabgcfe cg bgedaf geabdc fcge gfead | cadgf egcf cgef gc
dgcae da efcag dgaf gedafc dfabce gbefca ecgbd egdacbf ade | eda dfag aed agfd
gdcbf feac cbgeda gca faegdcb aegdf agbfed ca dcfag edgfca | aecf acedbfg aegbcdf bcgdf
bfdagc eb adgfceb edb dcbag eabg dgfbce dcefa abcged caebd | dbe bde dfacbg begfcad
ged dfecg dfgb gebcf fdbgec dg dcaef bfdgcae eagfbc gedbca | deg degcf fgbd acgbdef
bfgda acgefb cb decafg gcdae aebdgc acb ecdb cabgd bedgafc | dbce aefgcb edbc dfbcaeg
dabfge abdfg egbdac dfabc dcbfe ac daebfcg acb acgf afcgbd | cfag ac cagf cab
fbcea fdb edgcb afcebd cdfa fdebc gfeacb df aefbdg bdfgcae | bdf bdf df afegdbc
fdea gcadeb ef efcgab cfebd adbfce dgfcb feb decba adfgbec | gaebcdf dfecba dcbfg cbdfg
dgf gfadeb dabcgf bgcd fegca bcdaf cfeadb gd fdacg gdeacbf | gfd dbgc dg dg
fgace fbcge ac geadf acde fgdbea dfaebcg acdgbf cfgeda gca | ceafg bdfeagc ca agdfe
cdgbea fc efbdg bcedfga cfba dfc dagcfb fcdgb bagcd gdcefa | cf bgefd cf fegdb
efg afbdeg cbgdae ecgadfb cedagf abedg fagbe bacfe fg gbdf | egf fgbd gf egbaf
fgebca eafcb gdefb efbdc afgdbec cd dcb efacdb dcae bdfgac | cd eadc defgbca fcbadg
fg gbdec gdaebf cfadgb dcfab bfcdage bfg gfcdb fbcdea agcf | edgcfba fgca fcgbd aegbfd
fad bfecagd aecgd dabgcf adfeg feabg bdfaeg df dbfe fcagbe | edfb febacg dfbega fad
gfedacb gcabef bgcdfe fgabe dbgfae bgc gcae cbdaf cg gbcaf | gbc eagfbcd dfgeab gace
fbac fa defba efbcad dceab afe gbdeafc afcdeg dabecg gdbfe | eaf dgfbe dfegbca efbgd
fadgbc bcef afdce egbda adcgef bca dfcaeb eacdb cb cfdaegb | cdfbag becf bc fecb
fc cdgfeb cadeg efcbga aecfg bgfae fegbad dcgebfa fce afcb | fec adfcgbe efc fc
bgcf edbcg cdbfe acfdeb egdcbf dbgae efdbgca dcg gc efgcad | dgeacfb bedcg fgcb gc
fcb acdgf eadfcg abfgc ecgba cbagdf gdebfc fbda fb ebcfgad | cfgda cfagb bf dafcg
dabgfc bcagf gfdcea fegcb fa gdbca abdf dbcaeg bdgeafc fag | ecdfag adbf cafbdg cbadfge
gfacde bc gabdce cbdagef ceb acbf cfbeag cgfeb cgeaf gfbed | gbfce cb fcab gbecf
gcefd gf gfca gcdafe adebfg fdeac fecadb ecdbg fegdcba gfd | cfga gf acfgdbe fgd
cg bcdafg dgac cdgfb gefbd aecbdf cagfeb afedbcg bafcd cbg | bfadcge dfacebg dacg gc
fe abfe gcdbfea fgcdb fce bdceag cfgeb abcge egcbaf egfcda | agfebc bgace aefb abceg
dc cdg bedga bfacg gbcad gbecda dbfecga ecbd fdbgea dfaceg | gdbacfe fbgcaed cdafeg dc
abce ead aedgb dabgf ae cedbg cedgab bdfcage edbcgf fgedca | ae bace dea ae
bceg cfeag egdfca bcfage gb feabd dabgfc fedcgba ebfga gba | agb abedfgc gceb gceb
ac gbca cdabf fca agdbcfe fcadbg efgbad edcbf fdagb cafedg | cfa bacfd fgbad ca
ebcag degfba edcgbfa ecdab ceadbf dc dcef baefd agcfbd dcb | edfab bfeadgc acedb bdc
afgdcbe afdecb cafgdb abgfec afgcd ga gac cafdb abdg dcfeg | abdg bgcfae acg afebdcg
acdfb ed befdc adfcbg fdea ecd fgbdcea bagcde cegfb cfabed | de dce dcefab bcfge
ca dgac debacg fgcbea agedb fcdgeba bca ecfbd abcde feagdb | cgedab fbaecg faegdcb ac
ebdcfag bgcdea bface beadc edcgb da badg efdcgb cefadg ead | ead ad cebdag aedbc
fdeacgb bcgfda fbeag gebcaf adfeb cage fbcge agf ag bdgecf | ag adebf abecfdg ag
bgdca fgacbed cdfeb ecfg cfebda ebgdfc fgb gf fbgead gfdbc | gbf fdbce ebcafgd cedagfb
cgefad edbf fdc dgbec fabgc bfgcd bgfcade fd gbecad egcbfd | bgcfa febd dfc edcbg
efb edfba bcade cdbgae bcfa fcegbd agdfe bf afecdb agebfcd | fb abcf beagfdc ebf
egcd gbecad ed afdcb cbefag becag cdbae gacefbd beafgd ebd | bacdf dceg ed debgfa
gfbacde bfcd cd cebad ecdafb fecba gfcabe dce degcaf egadb | bgdcefa abcfge bfcd gbaecf
cdeaf cebafg afedg fcebdag gea dgabf ge aedcgf cdge fdecba | ge eg cegd degc
faedcg dfbc acegbfd eagbcd db eabcfd fbega cfaed adb edbfa | aedfc dfbc bd gacdfe
cbeadf gebfc age ag acedbg bgaec fgcadeb afdcge adgb ecbad | dcbfeag abdg dbga efbcg
gabd fdaecb gacbf dbcfg gfcae ba cba ecfgabd gdbcaf dfcbge | acb agdcfeb ecfga eagfc
gbcfd edbfc dgacbf cgb fgaedc gadcfbe bgaf ecagbd gb gdcfa | gbadce gcb gfdacbe cdgbeaf
fgeadc bedg bfcag cbdef fge eg edfcgba fdcbae ecdfgb bgfce | gfe eg fcbead eg
acegf gecfdab dacbfg afb ab fbaec aedb gcefbd ebcdfa bcfde | dgfbaec beafdc ba fgecbd
geabcdf egdb gb cfegab febgdc abfcd bgfcd gbf fcedg dcegaf | gafecbd gfb ebdg bg
cgefb fbagc ca abdc bgfcad bcefdga gdbaf edbafg cag feagcd | cgdafb badc adfbg acg
dbeg gd efcdag gabecdf cgd cdafb badcg edcbag gcabe agcbef | gcd dgc gcdba dgc
acgdf bcgeaf fd eagdfc dgcab dcafbeg fced gfd cegfa bdegaf | fd cedfag bcdga fgd
ef cbdae dgafce afe ebgf bafedg bacgdef agbfdc abdfe dgfab | bdefa fbge dabcgf fea
aefbdg cegadfb gcd dc dfaegc dcbaeg aegfd gecfd gcefb cafd | fegadc dgbcae cd cdg
bgdefc fabgec degbac aegdf abcge cdg adcb dagbefc eadgc dc | gdc cabd acebg cd
aebgc dbc dc acde agcdb fbcgeda cgbeda edfbcg ebfcga agfbd | gabce dbcga aecd ecda
deg eacgd ebdc bcdgae fdbgac afgbedc ed bcagd bdefga gfeac | badcg gbacd egbafcd bfdagc
fdega dca gfcba adgfc bcgd bgdcfa dc befcda gbafce bfgcead | agefdcb cabefgd dbaecf bdgc
abdc afecgb gbacfde dcfeg da agdce gbace fgadeb decbga dag | bcad cbda agbec adbc
beagfd cadef bfcae fcd fbgadc gdec gdcafeb gecdaf dc efagd | defac adgfeb agdcfbe bgcafed
eg bcfag gdecabf aecbfd gce dafecg gcbea dcebag gdeb bdace | badce ge eg cbdaegf
cfdgb dgbacef fa agf ceadbg efcbga efcgda afde adceg cagdf | agf gfa edfa agf
gbfcde edcfag dfg bdcgea cfedbag fcgba fd gafcd eadf cadge | bedagcf df dcafg eadgc
edfcab bdfca gfebdc acegdb dba dfae ad bcadgef bcfde fabgc | egbacdf ad dcebfag bdafc
acbfe afgd bgcaed acg bdeafcg ag dcbfge egfdca gefcd feagc | afgd dbgcef edgcf efcgd
dacgbe bgdc abdef bgead dag dg cebagf cgedaf aegcb fdegcab | cdbg adg gd dg
fg fcdgab abdfc deacgf fdabgec dgf dageb becdfa gbcf dgfab | dafcb agecdf adegbfc adbfc
cd ecgbf cgdf efbad bcadge gecdafb abcefg ecgbfd fedbc cbd | cgefb cdb fbecd cbd
afegdb gbafc bcafed dcbaeg efgd fe ecgbfda abgfe baegd eaf | egbad gfeab ebagf gbfae
bde fdebgac febgda cbea be adcefb fecdb dcgefa bfcgd caefd | fedbacg daefbg bed fbdce
eb ecb edacg acebfg cebagdf acdgfb cbega gefb agbfc eadcfb | fcagdb cbega be bcdafe
cefbgd gdaf dea ceagd cgedaf bgcfdea ad acbeg dbeacf ecgfd | dfecg agced dfag gceafd
da gedfc cafde bcagdef fad abde fbgaec badfgc daefcb aebcf | da bcfea ad dgeabcf
gdbeca gcadb facde afbdecg fg bagf cgdaf fgd cfebgd dagcfb | decabg gecdabf dagbc afbg
fbcdega febgcd df efcdg gbced dbefag aegfc cbgead fgd dbfc | dgabef cdfb dgf cgbefda
fbgaec acfgd gcdea cbedga acdfb dfeg gf aecfdg cbgfade cgf | gdfe gcf bcadeg fcg
fgced agfb faebcd gecabf eacgf ag ecfab aebdcg dfceagb cga | agc decgabf abegdfc agbdec
aecdbg cfeab cga fadceg adbeg cgbd ecabg gc dagfbec bdfaeg | beagd cag cfabe gca
afb gaefbc egbdf aedcb bdfae gbdace cbeadfg feacbd cafd fa | bcfaed gbadecf fa gbacfe
cbedg bgadef bag fadecbg ga fbcae fbdecg egcba dgac bdcage | ag febca cdebagf ebdgcfa
bcdaf adebgc ceb ebgdcf cfeagd agedc adecb eb gfdebca agbe | bcadf bdaecg facegd abcegd
afgbdce cagdfe dfb fdecb fb dabfge cbaf dcbfea gebcd fcdea | eafdcgb dbefc afebgd defca
dbfec abfecg fgced ceb dacfb dabe agefcbd gdacfb cfebad be | be cegdf gbcefad bdae
dbg bdagfc dgbfe cgebfd dbcaef ecbdf gfeab decg gcdebaf gd | cbeadf bdg aedfbc gdefbac
fcadgb bcf bgfcae cbfdeag face gfaebd cgbfe bcegd cf befag | abcgef bcf fbc cfebg
gefab db bda eafcd fcedbag cbedaf adfcgb ecdb acefgd fedba | db bfade ebdacf afebcd
dfbeacg cedagf dgfbc bgfda gdfea fab egbfad bage efcabd ab | agbfd bfa adfbgce fab
agfcd ecgabd bdgf egadfcb agf gf dfaec dgabc bfceag bacfgd | agf fag cfdea fdcgba
gebfdc fdae gbafc fdg dfagb aefdbg df baged ebfcdag acbedg | cfegbda bgfade daefbg abdecfg
gcdba gdefba ad dga deca cedgb cgbaf gdcbae gedfcba becgfd | gfabc ad fbcag dag
gefbd eagbdcf bfg bg aegb fbcde efdgac fgadcb efgad ebafdg | gbdfe bfedc cefagbd bdfce
gfedb cbegadf bcga fdcgea aecgbd bdcfea dgc bgcde abecd cg | befcad gedcfab bcedfa agbc
cedgfa efbdagc efdabc be baedgc bdfec fdgbc ceb dfcea afbe | eb afeb ebfa cbe
fedc fgbead dacgfe ec cagebf geacd dabcg ceg fgdea gdcbefa | ceagfb ecg dcef dcagfeb
aed agfbde bgfcda deafb fgae gcebdfa gdafb bfdec ae egabdc | ea dae agfe bcgadf
bdc cb gcbdf cgdebf adecgf gdefc dfcgaeb gadbf ebgadc cebf | fbce bfec dgcfe cfbe
fdecbg fdgac df fcgae dcf gcefdab aebcgf cdabg daef gefdac | fd ecbdfg edaf fade
cagebd bacfg egbdaf gc cgdf cbafe cbfdag cgb adbfg gecbfda | gbc adbgf gc bdecag
afed eag ecgbaf egdba egafbcd dbagc aebfdg dgebf gbfced ae | aedfgbc ea ea ega
eagfc gdbefc gf cgefda gfad adgbce dcgae aefcb egf fedabgc | adfcbge cdfega gaedbcf egcaf
bcage gbfadc dgfa abdcf cbafde bgfedc fbcga fbg fedbagc gf | fg fecdabg gf adfg
dcfge edfcbga defac febdag fdaecg ceag egd cfdgb eafbdc eg | cfdae fdceg efabdc egdafb
de bcdaf feagc fdeac gead aefcdgb afecgd cagbfe dce gbedcf | ed ed de deafc
cdaeg cb bafge fbcdea afbegc gbfc bca dgfebca gbadfe gebca | bfgae fcbg fbage cbfg
agf gdab bgcfe gfecda bafecgd dcefab afbeg baefdg febad ag | fbade eabcdf ga gadb
gcaf gfbec cbdega ebdacf cadgefb cf bgcaef edbfg fcb gcbae | bdfcega gdbfe fdbge fcb
afc gbace cbfd badfe fc faebc edabcf bafcdge eadgbf gdcaef | fc cf gbaefd fcbd
cdfage cdfebag eb cgaef cbgae ebgacf acgdb aeb ebcf agfdbe | cdbfega cebf ecfagd bcfe
afbdec dfegc dfga cedfga fgcebda edfca gf cdebg bcaegf gfe | efg cfgde dgaf fdga
ecfab eda da gefcad gcad aegcfdb dgbafe fegdc ebcfgd afecd | cegfad cefda ad caedf
gbedc gbadf bgafdce faed acdbgf agbedf fgecba ef egf efbdg | fbecga fe bgcdfea aegdbf
bagcdf dacbg fdbgcae dgbfa fa afd cfba gdcefa gabced fgedb | afd af fa bfca
fbgaed fbedg baed dcfgbe bga cfgda ebgcfa ba dbgeafc dafgb | aebgcf daeb ba ab
cdga feadgcb fbdeac ad dfbcge gcdef fda gedafc adegf eagbf | efagb fdcge faged fagebdc
ceafdb ga acfde acg egcafd cebfg febcgda dcgbaf egad fcega | ecagdbf gebcf cgfeadb cgbfda


code:
mx-IQ
mx-HO
xq-start
start-HO
IE-qc
HO-end
oz-xq
HO-ni
ni-oz
ni-MU
sa-IE
IE-ni
end-sa
oz-sa
MU-start
MU-sa
oz-IE
HO-xq
MU-xq
IE-end
MU-mx


code:
COPBCNPOBKCCFFBSVHKO

NS -> H
FS -> O
PO -> C
NV -> N
CK -> B
FK -> N
PS -> C
OF -> F
KK -> F
PP -> S
VS -> K
VB -> V
BP -> P
BB -> K
BF -> C
NN -> V
NO -> F
SV -> C
OK -> N
PH -> P
KV -> B
PN -> O
FN -> V
SK -> V
VC -> K
BH -> P
BO -> S
HS -> H
HK -> S
HC -> S
HF -> B
PC -> C
CF -> B
KN -> H
CS -> N
SP -> O
VH -> N
CC -> K
KP -> N
NP -> C
FO -> H
FV -> N
NC -> F
KB -> N
VP -> O
KO -> F
CP -> F
OH -> F
KC -> H
NB -> F
HO -> P
SC -> N
FF -> B
PB -> H
FB -> K
SN -> B
VO -> K
OO -> N
NF -> B
ON -> P
SF -> H
FP -> H
HV -> B
NH -> B
CO -> C
PV -> P
VV -> K
KS -> P
OS -> S
SB -> P
OC -> N
SO -> K
BS -> B
CH -> V
PK -> F
OB -> P
CN -> N
CB -> N
VF -> O
VN -> K
PF -> P
SH -> H
FH -> N
HP -> P
KF -> V
BK -> H
OP -> C
HH -> F
SS -> V
BN -> C
OV -> F
HB -> P
FC -> C
BV -> H
VK -> S
NK -> K
CV -> K
HN -> K
BC -> K
KH -> P


code:
use std::fs;
use reqwest::blocking::Client;
use std::fs::File;
use std::io::copy;

pub fn download(day: i32) -> Result<(), Box<dyn std::error::Error>> {
    eprint!("downloading... ");
    let client = Client::new();
    let sess = fs::read_to_string(".session")?;
    let sess = String::from("session=") + &sess;

    let url = format!("https://adventofcode.com/2021/day/{}/input", day);
    let res = client.get(&url)
        .header("Cookie", sess)
        .send()?;

    let mut dest = File::create(format!("input/day{:02}.txt", day))?;

    let contents = res.text()?;
    copy(&mut contents.as_bytes(), &mut dest)?;

    eprintln!("done!");
    Ok(())
}


code:
use std::fs::File;
use std::env;
use std::io::BufReader;
use std::fs;

mod solutions;
mod solution;
mod download;

fn main() {
    let mut args = env::args();
    args.next(); // skip arg 0 (executable name)

    let day = args.next()
        .unwrap_or_else(|| String::from("1"))
        .parse()
        .unwrap_or(1);

    let file = args.next()
        .unwrap_or(format!("input/day{:02}.txt", day));

    if fs::metadata(&file).is_err() {
        eprint!("Input for day {} not found... ", day);
        if let Err(error) = download::download(day) {
            eprintln!("failed! {:?}", error);
            return;
        }
    }

    let file = File::open(&file).unwrap();
    let input = BufReader::new(file);

    match day {
        1 => solutions::day01::solve(input).print(),
        2 => solutions::day02::solve(input).print(),
        3 => solutions::day03::solve(input).print(),
        4 => solutions::day04::solve(input).print(),
        5 => solutions::day05::solve(input).print(),
        6 => solutions::day06::solve(input).print(),
        7 => solutions::day07::solve(input).print(),
        8 => solutions::day08::solve(input).print(),
        9 => solutions::day09::solve(input).print(),
        10 => solutions::day10::solve(input).print(),
        11 => solutions::day11::solve(input).print(),
        12 => solutions::day12::solve(input).print(),
        13 => solutions::day13::solve(input).print(),
        14 => solutions::day14::solve(input).print(),
        15 => solutions::day15::solve(input).print(),
        16 => solutions::day16::solve(input).print(),
        17 => solutions::day17::solve(input).print(),
        _ => eprintln!("That day hasn't been solved yet.")
    }
}


code:
pub struct Solution<T> {
    pub r1: Option<T>,
    pub r2: Option<T>,
}

impl<T> Solution<T>
where T: std::fmt::Display
{
    pub fn new() -> Solution<T> {
        Solution { r1: None, r2: None }
    }

    //  sol
    pub fn ve_1(&mut self, r: T) {
        self.r1 = Some(r)
    }
    //  sol
    pub fn ve_2(&mut self, r: T) {
        self.r2 = Some(r)
    }

    pub fn print(&self) {
        if let Some(r1) = &self.r1 {
            println!("Part 1: {}", r1);
        }
        if let Some(r2) = &self.r2 {
            println!("Part 2: {}", r2);
        }
    }
}


code:
pub mod day01;
pub mod day02;
pub mod day03;
pub mod day04;
pub mod day05;
pub mod day06;
pub mod day07;
pub mod day08;
pub mod day09;
pub mod day10;
pub mod day11;
pub mod day12;
pub mod day13;
pub mod day14;
pub mod day15;
pub mod day16;
pub mod day17;


code:
use std::io::BufRead;
use crate::solution::Solution;

pub fn solve(input: impl BufRead) -> Solution<usize> {
    let input_values: Vec<usize> = input.lines()
        .map(|l| l.unwrap())
        .map(|l| l.parse().unwrap())
        .collect();
    let mut sol = Solution::new();

    let increases = input_values.windows(2)
        .map(|window| window[0] < window[1])
        .filter(|increased| *increased)
        .count();

    sol.ve_1(increases);

    let noiseless_increases = input_values.windows(3)
        .map(|window| window.iter().sum::<usize>())
        .fold((0, None as Option<usize>), |acc, sum| {
            match acc.1 {
                None => (acc.0, Some(sum)),
                Some(prev) => {
                    let add = match prev < sum { true => 1, false => 0 };
                    (acc.0 + add, Some(sum))
                }
            }
        }).0;

    sol.ve_2(noiseless_increases);
    sol
}

#[cfg(test)]
mod tests {
    use super::*;
    use std::io::Cursor;
    use indoc::indoc;

    #[test]
    fn both() {
        let example = indoc! { "
            199
            200
            208
            210
            200
            207
            240
            269
            260
            263
        " };
        let sol = solve(Cursor::new(example));

        assert_eq!(sol.r1, Some(7));
        assert_eq!(sol.r2, Some(5));
    }
}


code:
use std::io::BufRead;
use crate::solution::Solution;

enum Command {
    Forward(i64),
    Down(i64),
    Up(i64)
}
use Command::*;

pub fn solve(input: impl BufRead) -> Solution<i64> {
    let mut sol = Solution::new();

    let parsed_commands: Vec<Command> = input.lines()
        .map(|l| l.unwrap())
        .map(|l| {
            let (direction, steps) = l.split_once(' ').unwrap();
            let steps: i64 = steps.parse().unwrap();
            match direction {
                "forward" => Forward(steps),
                "down" => Down(steps),
                "up" => Up(steps),
                _ => unreachable!()
            }
        })
        .collect();

    let (hor, dep) = parsed_commands.iter()
        .fold((0, 0), |(hor, dep), cmd| match cmd {
            Forward(steps) => (hor + steps, dep),
            Down(steps) => (hor, dep + steps),
            Up(steps) => (hor, dep - steps)
        });

    sol.ve_1(hor * dep);

    let (hor, dep, _) = parsed_commands.iter()
        .fold((0, 0, 0), |(hor, dep, aim), cmd| match cmd {
            Forward(steps) => (hor + steps, dep + aim * steps, aim),
            Down(steps) => (hor, dep, aim + steps),
            Up(steps) => (hor, dep, aim - steps)
        });

    sol.ve_2(hor * dep);

    sol
}

#[cfg(test)]
mod tests {
    use super::*;
    use std::io::Cursor;
    use indoc::indoc;

    #[test]
    fn both() {
        let example = indoc! { "
            forward 5
            down 5
            forward 8
            up 3
            down 8
            forward 2
        " };

        let sol = solve(Cursor::new(example));

        assert_eq!(sol.r1, Some(150));
        assert_eq!(sol.r2, Some(900));
    }
}


code:
use std::io::BufRead;
use crate::solution::Solution;

fn find_rating(mut input: Vec<String>, most: bool) -> String {
    let len = input[0].len();

    for idx in 0..len {
        let score = input.iter()
            .fold((0, 0), |tup, num| {
                let ch = num.chars().nth(idx).unwrap();

                match ch {
                    '0' => (tup.0 + 1, tup.1),
                    '1' => (tup.0, tup.1 + 1),
                    _ => unreachable!()
                }
            });
        let desired = if most {
            match score.0 > score.1 { true => '0', false => '1' }
        } else {
            match score.0 > score.1 { true => '1', false => '0' }
        };

        input.retain(|num| num.chars().nth(idx).unwrap() == desired);

        if input.len() == 1 {
            return input.pop().unwrap();
        }
    }

    unreachable!();
}

pub fn solve(input: impl BufRead) -> Solution<u32> {
    let mut sol = Solution::new();

    let numbers: Vec<String> = input.lines()
        .map(|l| l.unwrap())
        .collect();
    let length = numbers[0].len();
    let mut scores = vec![(0, 0); length];
    let orig_numbers = numbers.clone();

    for number in numbers {
        for (idx, ch) in number.chars().enumerate() {
            let mut tup = scores.get_mut(idx).unwrap();
            match ch {
                '0' => tup.0 += 1,
                '1' => tup.1 += 1,
                _ => unreachable!()
            }
        }
    }

    let gamma = scores.iter()
        .rev()
        .enumerate()
        .fold(0, |acc, (pos, (zero, one))| {
            let put = match zero > one { true => 0, false => 1 };

            acc | (put << pos)
        });

    let epsilon = (!(gamma as u32)) & (2u32.pow(length.try_into().unwrap()) - 1);

    sol.ve_1(gamma * epsilon);

    let oxygen = find_rating(orig_numbers.clone(), true);
    let co2 = find_rating(orig_numbers, false);

    let oxygen = u32::from_str_radix(&oxygen, 2).unwrap();
    let co2 = u32::from_str_radix(&co2, 2).unwrap();

    sol.ve_2(oxygen * co2);

    sol
}

#[cfg(test)]
mod tests {
    use super::*;
    use std::io::Cursor;
    use indoc::indoc;

    #[test]
    fn both() {
        let example = indoc! { "
            00100
            11110
            10110
            10111
            10101
            01111
            00111
            11100
            10000
            11001
            00010
            01010
        " };

        let sol = solve(Cursor::new(example));

        assert_eq!(sol.r1, Some(198));
        assert_eq!(sol.r2, Some(230));
    }
}


code:
use std::io::BufRead;
use crate::solution::Solution;

#[derive(Debug, Clone)]
struct Bingo {
    numbers: Vec<i32>,
    stamps: Vec<bool>,
    size: usize
}

impl Bingo {
    fn new(input: &[String]) -> Bingo {
        let mut bingo = Bingo {
            numbers: vec![],
            stamps: vec![],
            size: input.len()
        };

        bingo.numbers.reserve(bingo.size * bingo.size);
        for row in input.iter() {
            for num in row.split_whitespace() {
                bingo.numbers.push(num.parse().unwrap());
            }
        }
        bingo.stamps.resize(bingo.size * bingo.size, false);

        bingo
    }

    fn stamp(&mut self, to_stamp: i32) -> bool {
        let pos = self.numbers.iter().position(|&num| num == to_stamp);

        if let Some(idx) = pos {
            self.stamps[idx] = true;

            let start_of_row = idx - (idx % self.size);
            let row_full = (start_of_row..(start_of_row+self.size))
                .all(|idx| self.stamps[idx]);

            let start_of_column = idx % self.size;
            let column_full = (start_of_column..(self.size*self.size)).step_by(self.size)
                .all(|idx| self.stamps[idx]);

            return row_full || column_full;
        }

        false
    }

    fn unmarked_numbers(&self) -> i32 {
        self.numbers.iter()
            .zip(self.stamps.iter())
            .filter(|(_, &stamped)| !stamped)
            .map(|(num, _)| num)
            .sum()
    }
}

fn play_bingo(numbers: Vec<i32>, mut boards: Vec<Bingo>) -> (i32, i32) {
    for number in numbers {
        for board in &mut boards {
            if board.stamp(number) {
                return (number, board.unmarked_numbers())
            }
        }
    }

    unreachable!("state of boards = {:?}", boards);
}

fn lose_bingo(numbers: Vec<i32>, mut boards: Vec<Bingo>) -> (i32, i32) {
    for number in numbers {
        let won: Vec<bool> = boards.iter_mut()
            .map(|board| board.stamp(number))
            .collect();
        if won.len() == 1 && won[0] {
            return (number, boards[0].unmarked_numbers());
        }
        let mut iter = won.iter();
        boards.retain(|_| !*iter.next().unwrap());
    }

    unreachable!("state of boards = {:?}", boards);
}

pub fn solve(input: impl BufRead) -> Solution<i32> {
    let mut sol = Solution::new();

    let input: Vec<String> = input.lines()
        .map(|l| l.unwrap())
        .collect();

    let numbers: Vec<i32> = input[0].split(',')
        .map(|spl| spl.parse().unwrap())
        .collect();

    let size = input.iter().skip(2).position(|l| l.is_empty()).unwrap();
    let boards: Vec<Bingo> = input.rchunks_exact(1 + size)
        .map(|chunk| Bingo::new(&chunk[1..]))
        .collect();

    let (winning_number, winning_board) = play_bingo(numbers.clone(), boards.clone());
    sol.ve_1(winning_number * winning_board);

    let (losing_number, losing_board) = lose_bingo(numbers, boards);
    sol.ve_2(losing_number * losing_board);

    sol
}

#[cfg(test)]
mod tests {
    use super::*;
    use std::io::Cursor;
    use indoc::indoc;

    #[test]
    fn both() {
        let example = indoc! { "
            7,4,9,5,11,17,23,2,0,14,21,24,10,16,13,6,15,25,12,22,18,20,8,19,3,26,1

            22 13 17 11  0
            8  2 23  4 24
            21  9 14 16  7
            6 10  3 18  5
            1 12 20 15 19

            3 15  0  2 22
            9 18 13 17  5
            19  8  7 25 23
            20 11 10 24  4
            14 21 16 12  6

            14 21 17 24  4
            10 16 15  9 19
            18  8 23 26 20
            22 11 13  6  5
            2  0 12  3  7
        " };

        let sol = solve(Cursor::new(example));

        assert_eq!(sol.r1, Some(4512));
        assert_eq!(sol.r2, Some(1924));
    }
}


code:
use std::collections::HashMap;
use std::io::BufRead;
use crate::solution::Solution;

#[derive(Debug)]
struct Line {
    x1: i32,
    y1: i32,
    x2: i32,
    y2: i32
}

impl Line {
    fn new(text: &str) -> Line {
        let (from, to) = text.split_once(" -> ").unwrap();
        let (x1, y1) = from.split_once(',').unwrap();
        let (x2, y2) = to.split_once(',').unwrap();

        let x1 = x1.parse().unwrap();
        let y1 = y1.parse().unwrap();
        let x2 = x2.parse().unwrap();
        let y2 = y2.parse().unwrap();

        Line { x1, y1, x2, y2 }
    }

    fn is_straight(&self) -> bool {
        self.x1 == self.x2 || self.y1 == self.y2
    }
}

impl IntoIterator for &Line {
    type Item = (i32, i32);
    type IntoIter = LineIterator;

    fn into_iter(self) -> LineIterator {
        let x_distance = self.x2 - self.x1;
        let y_distance = self.y2 - self.y1;
        let length = x_distance.abs().max(y_distance.abs()) + 1;

        let x_direction = x_distance.signum();
        let y_direction = y_distance.signum();

        LineIterator {
            x: self.x1,
            y: self.y1,
            x_direction,
            y_direction,
            length,
        }
    }
}

struct LineIterator {
    x: i32,
    y: i32,
    x_direction: i32,
    y_direction: i32,
    length: i32,
}

impl Iterator for LineIterator {
    type Item = (i32, i32);

    fn next(&mut self) -> Option<(i32, i32)> {
        if self.length == 0 { return None }

        let result = (self.x, self.y);

        self.x += self.x_direction;
        self.y += self.y_direction;
        self.length -= 1;

        Some(result)
    }
}

pub fn solve(input: impl BufRead) -> Solution<usize> {
    let mut sol = Solution::new();

    let lines: Vec<Line> = input.lines()
        .map(|l| l.unwrap())
        .map(|l| Line::new(&l))
        .collect();

    let mut map: HashMap<(i32, i32), i32> = HashMap::new();

    for line in lines.iter().filter(|&l| l.is_straight()) {
        for pos in line {
            *map.entry(pos).or_insert(0) += 1;
        }
    }

    let straight_intersects = map.values()
        .filter(|&&n| n >= 2)
        .count();
    sol.ve_1(straight_intersects);

    for line in lines.iter().filter(|&l| !l.is_straight()) {
        for pos in line {
            *map.entry(pos).or_insert(0) += 1;
        }
    }

    let all_intersects = map.values()
        .filter(|&&n| n >= 2)
        .count();
    sol.ve_2(all_intersects);

    sol
}

#[cfg(test)]
mod tests {
    use super::*;
    use std::io::Cursor;
    use indoc::indoc;

    #[test]
    fn both() {
        let example = indoc! { "
            0,9 -> 5,9
            8,0 -> 0,8
            9,4 -> 3,4
            2,2 -> 2,1
            7,0 -> 7,4
            6,4 -> 2,0
            0,9 -> 2,9
            3,4 -> 1,4
            0,0 -> 8,8
            5,5 -> 8,2
        " };

        let sol = solve(Cursor::new(example));

        assert_eq!(sol.r1, Some(5));
        assert_eq!(sol.r2, Some(12));
    }
}


code:
use std::io::BufRead;
use crate::solution::Solution;

fn tick(fish: &mut [u64; 9]) {
    let new = fish[0];
    for n in 1..=8 {
        fish[n-1] = fish[n];
    }
    fish[6] += new;
    fish[8] = new;
}

pub fn solve(input: impl BufRead) -> Solution<usize> {
    let mut sol = Solution::new();
    let initial = input.lines().next().unwrap().unwrap();

    let mut fish = [0; 9];
    initial.split(',')
        .for_each(|n| fish[n.parse::<usize>().unwrap()] += 1);

    for _ in 1..=80 {
        tick(&mut fish);
    }
    sol.ve_1(fish.iter().map(|&n| n as usize).sum());

    for _ in 81..=256 {
        tick(&mut fish);
    }
    sol.ve_2(fish.iter().map(|&n| n as usize).sum());

    sol
}

#[cfg(test)]
mod tests {
    use super::*;
    use std::io::Cursor;
    use indoc::indoc;

    #[test]
    fn both() {
        let example = indoc! { "3,4,3,1,2" };

        let sol = solve(Cursor::new(example));

        assert_eq!(sol.r1, Some(5934));
        assert_eq!(sol.r2, Some(26984457539));
    }
}


code:
use std::io::BufRead;
use crate::solution::Solution;

fn bsearch(min: i32, max: i32, crabs: &Vec<i32>, score: impl Fn(i32, i32) -> i32) -> i32 {
    let mid = (max + min) / 2;
    let mid_score: i32 = crabs.iter().map(|&crab| score(mid, crab)).sum();
    let left_score: i32 = crabs.iter().map(|&crab| score(mid-1, crab)).sum();
    let right_score: i32 = crabs.iter().map(|&crab| score(mid+1, crab)).sum();

    if left_score < mid_score {
        bsearch(min, mid, crabs, score)
    } else if right_score < mid_score {
        bsearch(mid, max, crabs, score)
    } else { mid_score }
}

pub fn solve(input: impl BufRead) -> Solution<i32> {
    let mut sol = Solution::new();

    let crabs = input.lines()
        .next()
        .unwrap()
        .unwrap()
        .split(',')
        .map(|s| s.parse().unwrap())
        .collect::<Vec<i32>>();

    let max = *crabs.iter().max().unwrap();

    let best = bsearch(0, max, &crabs, |i, crab| (i - crab).abs());
    sol.ve_1(best);

    let best = bsearch(0, max, &crabs, |i, crab| {
        let n = (i - crab).abs();
        (n * (1 + n))/2
    });
    sol.ve_2(best);

    sol
}

#[cfg(test)]
mod tests {
    use super::*;
    use std::io::Cursor;
    use indoc::indoc;

    #[test]
    fn both() {
        let example = indoc! { "16,1,2,0,4,2,7,1,2,14" };

        let sol = solve(Cursor::new(example));

        assert_eq!(sol.r1, Some(37));
        assert_eq!(sol.r2, Some(168));
    }
}


code:
use std::io::BufRead;
use crate::solution::Solution;

fn parse_value(value: &str) -> u8 {
    value.bytes()
        .fold(0, |acc, cur| {
            acc | 1 << (cur - b'a')
        })
}

fn parse_line(line: &str) -> (Vec<u8>, Vec<u8>) {
    let (signal_patterns, output_value) = line.split_once('|').unwrap();

    let signal_patterns = signal_patterns.split_whitespace()
        .map(|part| parse_value(part))
        .collect();
    let output_value = output_value.split_whitespace()
        .map(|part| parse_value(part))
        .collect();

    (signal_patterns, output_value)
}

const SEGMENT_DATA: [(bool, bool, bool, usize); 7] = [
    // lights up with 1, lights up with 4, lights up with 7, count in unknowns
    (false, false, true, 6),
    (false, true, false, 4),
    (true, true, true, 4),
    (false, true, false, 5),
    (false, false, false, 3),
    (true, true, true, 5),
    (false, false, false, 6)
];

const DIGIT_DATA: [u8; 10] = [
    //gfedcba
    0b1110111,
    0b0100100,
    0b1011101,
    0b1101101,
    0b0101110,
    0b1101011,
    0b1111011,
    0b0100101,
    0b1111111,
    0b1101111,
];

fn do_logic(signal_patterns: Vec<u8>) -> [u8; 10] {
    let mut digits = [0; 10];
    let mut segments = [0; 7];

    let mut unknown_patterns = vec![];

    for pattern in signal_patterns {
        match pattern.count_ones() {
            2 => { digits[1] = pattern },
            4 => { digits[4] = pattern },
            3 => { digits[7] = pattern },
            7 => { digits[8] = pattern },
            _ => { unknown_patterns.push(pattern) }
        }
    }

    segments[0] = digits[1] ^ digits[7];

    for segment in 1..7 {
        for wire in (0..7).map(|step| 1 << step) {

            if (digits[1] & wire == 0) == SEGMENT_DATA[segment].0 { continue }
            if (digits[4] & wire == 0) == SEGMENT_DATA[segment].1 { continue }
            if (digits[7] & wire == 0) == SEGMENT_DATA[segment].2 { continue }

            let count = unknown_patterns.iter()
                .filter(|&pattern| pattern & wire != 0)
                .count();

            if count != SEGMENT_DATA[segment].3 { continue }

            assert!(segments[segment] == 0, "found twice");
            segments[segment] = wire;
        }
    }

    for (i, digit) in digits.iter_mut().enumerate() {
        if *digit != 0 { continue }

        for n in 0..=7 {
            if DIGIT_DATA[i] & 1 << n != 0 {
                *digit |= segments[n];
            }
        }
    }

    digits
}

pub fn solve(input: impl BufRead) -> Solution<usize> {
    let mut sol = Solution::new();

    let changing_signals = input.lines()
        .map(|l| l.unwrap())
        .map(|l| parse_line(&l))
        .collect::<Vec<_>>();

    let easy_digit_count = changing_signals.iter()
        .map(|(_, output_value)| {
            output_value.iter()
                .map(|val| val.count_ones())
                .filter(|ones| match ones {
                    2 | 4 | 3 | 7 => true,
                    _ => false
                })
                .count()
        })
        .sum();
    sol.ve_1(easy_digit_count);

    let summed_output_values = changing_signals.into_iter()
        .map(|(signal_patterns, output_value)| {
            let digits = do_logic(signal_patterns);

            output_value.iter()
                .map(|val| digits.iter().position(|digit| digit == val).unwrap())
                .reduce(|acc, item| acc * 10 + item)
                .unwrap()
        })
        .sum();
    sol.ve_2(summed_output_values);

    sol
}

#[cfg(test)]
mod tests {
    use super::*;
    use std::io::Cursor;
    use indoc::indoc;

    #[test]
    fn both() {
        let example = indoc! { "
            be cfbegad cbdgef fgaecd cgeb fdcge agebfd fecdb fabcd edb | fdgacbe cefdb cefbgd gcbe
            edbfga begcd cbg gc gcadebf fbgde acbgfd abcde gfcbed gfec | fcgedb cgb dgebacf gc
            fgaebd cg bdaec gdafb agbcfd gdcbef bgcad gfac gcb cdgabef | cg cg fdcagb cbg
            fbegcd cbd adcefb dageb afcb bc aefdc ecdab fgdeca fcdbega | efabcd cedba gadfec cb
            aecbfdg fbg gf bafeg dbefa fcge gcbea fcaegb dgceab fcbdga | gecf egdcabf bgf bfgea
            fgeab ca afcebg bdacfeg cfaedg gcfdb baec bfadeg bafgc acf | gebdcfa ecba ca fadegcb
            dbcfg fgd bdegcaf fgec aegbdf ecdfab fbedc dacgb gdcebf gf | cefg dcbef fcge gbcadfe
            bdfegc cbegaf gecbf dfcage bdacg ed bedf ced adcbefg gebcd | ed bcgafe cdgba cbgef
            egadfb cdbfeg cegd fecab cgb gbdefca cg fgcdab egfdb bfceg | gbdfcae bgc cg cgb
            gcafb gcf dcaebfg ecagb gf abcdeg gaef cafbge fdbac fegbdc | fgae cfgab fg bagce
        " };

        let sol = solve(Cursor::new(example));

        assert_eq!(sol.r1, Some(26));
        assert_eq!(sol.r2, Some(61229));
    }
}


code:
use std::collections::VecDeque;
use std::collections::HashMap;
use std::io::BufRead;
use crate::solution::Solution;

#[derive(PartialEq, Debug)]
enum Basin {
    Uncharted,
    Wall,
    Charted(usize)
}
use Basin::*;

const ADJACENT: [(i32, i32); 4] = [(-1, 0), (0, -1), (1, 0), (0, 1)];

pub fn solve(input: impl BufRead) -> Solution<i32> {
    let mut sol = Solution::new();

    let height_map = input.lines()
        .map(|l| l.unwrap())
        .enumerate()
        .flat_map(|(y, line)| {
            line.bytes()
                .enumerate()
                .map(|(x, b)| ((x, y), b - b'0'))
                .map(|((x, y), height)| ((x as i32, y as i32), height as i32))
                .collect::<Vec<_>>()
        })
        .collect::<HashMap<_, _>>();

    let low_points = height_map.iter()
        .filter(|(&(x, y), height)| {
            ADJACENT.iter()
                .filter_map(|(adj_x, adj_y)| height_map.get(&(x+adj_x, y+adj_y)))
                .find(|adj_height| height >= adj_height)
                .is_none()
        })
        .collect::<Vec<_>>();
    let low_point_risk_levels = low_points.iter()
        .map(|(_, &height)| 1 + height)
        .sum();
    sol.ve_1(low_point_risk_levels);

    let mut basin_map = height_map.iter()
        .map(|(pos, height)| {
            (pos, match height { 9 => Wall, _ => Uncharted })
        })
        .collect::<HashMap<_, _>>();

    let mut basin_number = 0;
    let mut basin_sizes = vec![];
    for low_point in low_points {
        let mut visited_points = vec![];
        let mut points_to_visit = VecDeque::from([*low_point.0]);
        basin_sizes.push(0);

        while let Some((x, y)) = points_to_visit.pop_front() {
            visited_points.push((x, y));

            if let Some(state) = basin_map.get_mut(&(x, y)) {
                if *state == Wall { continue }

                *state = Charted(basin_number);
                basin_sizes[basin_number] += 1;

                for (adj_x, adj_y) in ADJACENT {
                    let adj = (x+adj_x, y+adj_y);
                    if visited_points.contains(&adj) { continue }
                    if points_to_visit.contains(&adj) { continue }
                    points_to_visit.push_back(adj);
                }
            }
        }

        basin_number += 1;
    }

    basin_sizes.sort_by(|a, b| b.cmp(a));
    sol.ve_2(basin_sizes.iter().take(3).product());

    sol
}

#[cfg(test)]
mod tests {
    use super::*;
    use std::io::Cursor;
    use indoc::indoc;

    #[test]
    fn both() {
        let example = indoc! { "
            2199943210
            3987894921
            9856789892
            8767896789
            9899965678
        " };

        let sol = solve(Cursor::new(example));

        assert_eq!(sol.r1, Some(15));
        assert_eq!(sol.r2, Some(1134));
    }
}


code:
use std::io::BufRead;
use crate::solution::Solution;

fn is_opening_char(open: char) -> bool {
    match open {
        '(' => true,
        '[' => true,
        '{' => true,
        '<' => true,
        _ => false
    }
}

fn closing_char(open: char) -> char {
    match open {
        '(' => ')',
        '[' => ']',
        '{' => '}',
        '<' => '>',
        _ => unreachable!("not an opening char: {}", open)
    }
}

fn find_illegal(line: &str) -> (Option<char>, Option<Vec<char>>) {
    let mut stack = vec![];

    for c in line.chars() {
        if is_opening_char(c) {
            stack.push(c);
        } else {
            let open = stack.pop().unwrap();
            if c != closing_char(open) {
                return (Some(c), None)
            }
        }
    }

    (None, Some(stack))
}

pub fn solve(input: impl BufRead) -> Solution<i64> {
    let mut sol = Solution::new();

    let mut syntax_error_high_score = 0;
    let mut autocomplete_high_scores = vec![];
    for line in input.lines() {
        let line = line.unwrap();

        let (illegal, stack) = find_illegal(&line);

        if let Some(illegal) = illegal {
            syntax_error_high_score += match illegal {
                ')' => 3,
                ']' => 57,
                '}' => 1197,
                '>' => 25137,
                _ => unreachable!("impossible illegal char: {}", illegal)
            }
        } else {
            let stack = stack.unwrap();
            let score = stack.iter()
                .rev()
                .map(|&open| closing_char(open))
                .map(|close| match close {
                    ')' => 1,
                    ']' => 2,
                    '}' => 3,
                    '>' => 4,
                    _ => unreachable!()
                })
                .fold(0, |acc, cur| {
                    acc * 5 + cur
                });
            autocomplete_high_scores.push(score);
        }
    }
    sol.ve_1(syntax_error_high_score);
    autocomplete_high_scores.sort();
    sol.ve_2(autocomplete_high_scores[(autocomplete_high_scores.len() / 2)]);

    sol
}

#[cfg(test)]
mod tests {
    use super::*;
    use std::io::Cursor;
    use indoc::indoc;

    #[test]
    fn find_illegal_test() {
        assert_eq!(None, find_illegal("[({(<(())[]>[[{[]{<()<>>").0);
        assert_eq!(None, find_illegal("[<>({}){}[([])<>]]").0);
        assert_eq!(Some('}'), find_illegal("{([(<{}[<>[]}>{[]{[(<()>").0);
    }

    #[test]
    fn both() {
        let example = indoc! { "
            [({(<(())[]>[[{[]{<()<>>
            [(()[<>])]({[<{<<[]>>(
            {([(<{}[<>[]}>{[]{[(<()>
            (((({<>}<{<{<>}{[]{[]{}
            [[<[([]))<([[{}[[()]]]
            [{[{({}]{}}([{[{{{}}([]
            {<[[]]>}<{[{[{[]{()[[[]
            [<(<(<(<{}))><([]([]()
            <{([([[(<>()){}]>(<<{{
            <{([{{}}[<[[[<>{}]]]>[]]
        " };

        let sol = solve(Cursor::new(example));

        assert_eq!(sol.r1, Some(26397));
        assert_eq!(sol.r2, Some(288957));
    }
}


code:
use std::collections::HashMap;
use std::io::BufRead;
use crate::solution::Solution;
use ansi_term::Style;

type Map = HashMap<(i32, i32), u8>;

const ADJACENT: [(i32, i32); 8] = [
    (-1, -1),
    (-1,  0),
    (-1,  1),
    ( 0, -1),
    ( 0,  1),
    ( 1, -1),
    ( 1,  0),
    ( 1,  1)
];

fn step(map: &mut Map) -> usize {
    for energy in map.values_mut() {
        *energy += 1
    }

    let mut last_flashed = 0;
    let mut flashed = vec![];
    loop {
        let should_flash = map.iter()
            .filter(|(pos, _)| !flashed.contains(*pos))
            .filter(|(_, &energy)| energy > 9)
            .map(|(pos, _)| pos)
            .copied()
            .collect::<Vec<_>>();

        let adjacent = should_flash.iter()
            .flat_map(|(x, y)| {
                ADJACENT.iter().map(|(adj_x, adj_y)| (x+adj_x, y+adj_y)).collect::<Vec<_>>()
            })
            .filter(|pos| !flashed.contains(pos))
            .collect::<Vec<_>>();

        for octopus in adjacent.into_iter() {
            if let Some(energy) = map.get_mut(&octopus) {
                *energy += 1;
            }
        }

        flashed.extend(should_flash);
        if flashed.len() == last_flashed {
            for octopus in flashed.into_iter() {
                *map.get_mut(&octopus).unwrap() = 0
            }
            return last_flashed
        }
        last_flashed = flashed.len();
    }
}

fn print_map(map: &Map) {
    for y in 0..=9 {
        for x in 0..=9 {
            let energy = map[&(x, y)];
            if energy == 0 {
                print!("{}", Style::new().bold().paint(format!("{}", energy)));
            } else {
                print!("{}", energy);
            }
        }
        println!("");
    }
}

pub fn solve(input: impl BufRead) -> Solution<usize> {
    let mut sol = Solution::new();

    let mut octopuses = input.lines()
        .map(|l| l.unwrap())
        .enumerate()
        .flat_map(|(y, line)| {
            line.bytes()
                .enumerate()
                .map(|(x, b)| ((x, y), b - b'0'))
                .map(|((x, y), energy)| ((x as i32, y as i32), energy as u8))
                .collect::<Vec<_>>()
        })
        .collect::<HashMap<_, _>>();

    let total_flashes = (1..=100)
        .map(|stepn| {
            println!("After step {}:", stepn);
            let flashes = step(&mut octopuses);
            print_map(&octopuses);
            println!("");
            flashes
        })
        .sum();
    sol.ve_1(total_flashes);

    let mut stepn = 100;
    loop {
        stepn += 1;
        println!("After step {}:", stepn);
        let flashes = step(&mut octopuses);
        print_map(&octopuses);
        println!("");

        if flashes == 100 { break }
    }
    sol.ve_2(stepn);

    sol
}

#[cfg(test)]
mod tests {
    use super::*;
    use std::io::Cursor;
    use indoc::indoc;

    #[test]
    fn both() {
        let example = indoc! { "
            5483143223
            2745854711
            5264556173
            6141336146
            6357385478
            4167524645
            2176841721
            6882881134
            4846848554
            5283751526
        " };

        let sol = solve(Cursor::new(example));

        assert_eq!(sol.r1, Some(1656));
        assert_eq!(sol.r2, Some(195));
    }
}


code:
use std::collections::VecDeque;
use std::io::BufRead;
use crate::solution::Solution;
use petgraph::Graph;

pub fn solve(input: impl BufRead) -> Solution<usize> {
    let mut sol = Solution::new();

    let mut caves = Graph::new_undirected();

    for line in input.lines() {
        let line = line.unwrap();
        let (from, to) = line.split_once('-').unwrap();

        let from = caves.node_indices()
            .find(|i| caves[*i] == from)
            .unwrap_or_else(|| caves.add_node(from.to_owned()));
        let to = caves.node_indices()
            .find(|i| caves[*i] == to)
            .unwrap_or_else(|| caves.add_node(to.to_owned()));

        caves.add_edge(from, to, ());
    }

    let start = caves.node_indices().find(|i| caves[*i] == "start").unwrap();
    let end = caves.node_indices().find(|i| caves[*i] == "end").unwrap();

    let mut work = VecDeque::new();
    let mut paths = vec![];
    work.push_back(vec![start]);

    while let Some(to_check) = work.pop_front() {
        let top = to_check.last().unwrap();

        for neighbor in caves.neighbors(*top) {
            if neighbor == end {
                let mut new_path = to_check.clone();
                new_path.push(neighbor);
                paths.push(new_path);
                continue;
            }
            let is_small_cave = caves[neighbor].chars().next().unwrap().is_lowercase();
            if !is_small_cave || !to_check.contains(&neighbor) {
                let mut new_path = to_check.clone();
                new_path.push(neighbor);
                work.push_back(new_path);
            }
        }
    }

    sol.ve_1(paths.len());

    let mut work = VecDeque::new();
    let mut paths = vec![];
    work.push_back((vec![start], false));

    while let Some((to_check, visited_twice)) = work.pop_front() {
        let top = to_check.last().unwrap();

        for neighbor in caves.neighbors(*top) {
            if neighbor == end {
                let mut new_path = to_check.clone();
                new_path.push(neighbor);
                paths.push(new_path);
                continue;
            }
            let is_small_cave = caves[neighbor].chars().next().unwrap().is_lowercase();
            if !is_small_cave || !to_check.contains(&neighbor) {
                let mut new_path = to_check.clone();
                new_path.push(neighbor);
                work.push_back((new_path, visited_twice));
            }
            if !visited_twice && is_small_cave && to_check.contains(&neighbor) && neighbor != start {
                let mut new_path = to_check.clone();
                new_path.push(neighbor);
                work.push_back((new_path, true));
            }
        }
    }

    sol.ve_2(paths.len());

    sol
}

#[cfg(test)]
mod tests {
    use super::*;
    use std::io::Cursor;
    use indoc::indoc;

    #[test]
    fn both() {
        let example = indoc! { "
            start-A
            start-b
            A-c
            A-b
            b-d
            A-end
            b-end
        " };

        let sol = solve(Cursor::new(example));

        assert_eq!(sol.r1, Some(10));
        assert_eq!(sol.r2, Some(36));
    }

    #[test]
    fn example2() {
        let example = indoc! { "
            dc-end
            HN-start
            start-kj
            dc-start
            dc-HN
            LN-dc
            HN-end
            kj-sa
            kj-HN
            kj-dc
        " };

        let sol = solve(Cursor::new(example));

        assert_eq!(sol.r1, Some(19));
        assert_eq!(sol.r2, Some(103));
    }

    #[test]
    fn example3() {
        let example = indoc! { "
            fs-end
            he-DX
            fs-he
            start-DX
            pj-DX
            end-zg
            zg-sl
            zg-pj
            pj-he
            RW-he
            fs-DX
            pj-RW
            zg-RW
            start-pj
            he-WI
            zg-he
            pj-fs
            start-RW
        " };

        let sol = solve(Cursor::new(example));

        assert_eq!(sol.r1, Some(226));
        assert_eq!(sol.r2, Some(3509));
    }
}