diff --git a/.editorconfig b/.editorconfig
deleted file mode 100644
index 72d51b560..000000000
--- a/.editorconfig
+++ /dev/null
@@ -1,126 +0,0 @@
-###############################
-# Core EditorConfig Options #
-###############################
-root = true
-# All files
-[*]
-indent_style = space
-
-# XML project files
-[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}]
-indent_size = 2
-
-# XML config files
-[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}]
-indent_size = 2
-
-# Code files
-[*.{cs,csx,vb,vbx}]
-indent_size = 4
-insert_final_newline = true
-charset = utf-8-bom
-###############################
-# .NET Coding Conventions #
-###############################
-[*.{cs,vb}]
-# Organize usings
-dotnet_sort_system_directives_first = true
-# this. preferences
-dotnet_style_qualification_for_field = false:silent
-dotnet_style_qualification_for_property = false:silent
-dotnet_style_qualification_for_method = false:silent
-dotnet_style_qualification_for_event = false:silent
-# Language keywords vs BCL types preferences
-dotnet_style_predefined_type_for_locals_parameters_members = true:silent
-dotnet_style_predefined_type_for_member_access = true:silent
-# Parentheses preferences
-dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent
-dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent
-dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent
-dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent
-# Modifier preferences
-dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent
-dotnet_style_readonly_field = true:suggestion
-# Expression-level preferences
-dotnet_style_object_initializer = true:suggestion
-dotnet_style_collection_initializer = true:suggestion
-dotnet_style_explicit_tuple_names = true:suggestion
-dotnet_style_null_propagation = true:suggestion
-dotnet_style_coalesce_expression = true:suggestion
-dotnet_style_prefer_is_null_check_over_reference_equality_method = true:silent
-dotnet_style_prefer_inferred_tuple_names = true:suggestion
-dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
-dotnet_style_prefer_auto_properties = true:silent
-dotnet_style_prefer_conditional_expression_over_assignment = true:silent
-dotnet_style_prefer_conditional_expression_over_return = true:silent
-###############################
-# Naming Conventions #
-###############################
-# Style Definitions
-dotnet_naming_style.pascal_case_style.capitalization = pascal_case
-# Use PascalCase for constant fields
-dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion
-dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
-dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style
-dotnet_naming_symbols.constant_fields.applicable_kinds = field
-dotnet_naming_symbols.constant_fields.applicable_accessibilities = *
-dotnet_naming_symbols.constant_fields.required_modifiers = const
-###############################
-# C# Coding Conventions #
-###############################
-[*.cs]
-# var preferences
-csharp_style_var_for_built_in_types = true:silent
-csharp_style_var_when_type_is_apparent = true:silent
-csharp_style_var_elsewhere = true:silent
-# Expression-bodied members
-csharp_style_expression_bodied_methods = false:silent
-csharp_style_expression_bodied_constructors = false:silent
-csharp_style_expression_bodied_operators = false:silent
-csharp_style_expression_bodied_properties = true:silent
-csharp_style_expression_bodied_indexers = true:silent
-csharp_style_expression_bodied_accessors = true:silent
-# Pattern matching preferences
-csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
-csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
-# Null-checking preferences
-csharp_style_throw_expression = true:suggestion
-csharp_style_conditional_delegate_call = true:suggestion
-# Modifier preferences
-csharp_preferred_modifier_order = public,private,protected,internal,file,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,required,volatile,async:suggestion
-# Expression-level preferences
-csharp_prefer_braces = true:silent
-csharp_style_deconstructed_variable_declaration = true:suggestion
-csharp_prefer_simple_default_expression = true:suggestion
-csharp_style_prefer_local_over_anonymous_function = true:suggestion
-csharp_style_inlined_variable_declaration = true:suggestion
-###############################
-# C# Formatting Rules #
-###############################
-# New line preferences
-csharp_new_line_before_open_brace = false
-csharp_new_line_before_else = false
-csharp_new_line_before_catch = false
-csharp_new_line_before_finally = false
-csharp_new_line_before_members_in_object_initializers = false
-csharp_new_line_before_members_in_anonymous_types = false
-csharp_new_line_between_query_expression_clauses = false
-# Indentation preferences
-csharp_indent_case_contents = true
-csharp_indent_switch_labels = true
-csharp_indent_labels = flush_left
-# Space preferences
-csharp_space_after_cast = false
-csharp_space_after_keywords_in_control_flow_statements = true
-csharp_space_between_method_call_parameter_list_parentheses = false
-csharp_space_between_method_declaration_parameter_list_parentheses = false
-csharp_space_between_parentheses = false
-csharp_space_before_colon_in_inheritance_clause = true
-csharp_space_after_colon_in_inheritance_clause = true
-csharp_space_around_binary_operators = before_and_after
-csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
-csharp_space_between_method_call_name_and_opening_parenthesis = false
-csharp_space_between_method_call_empty_parameter_list_parentheses = false
-# Wrapping preferences
-csharp_preserve_single_line_statements = true
-csharp_preserve_single_line_blocks = true
\ No newline at end of file
diff --git a/.gitattributes b/.gitattributes
deleted file mode 100644
index 989d37c12..000000000
--- a/.gitattributes
+++ /dev/null
@@ -1 +0,0 @@
-**/input.in filter=git-crypt diff=git-crypt
diff --git a/.github/workflows/update-docs.yaml b/.github/workflows/update-docs.yaml
deleted file mode 100644
index 62acdb9ae..000000000
--- a/.github/workflows/update-docs.yaml
+++ /dev/null
@@ -1,53 +0,0 @@
-name: Update Docs
-
-on:
- push:
- branches:
- - master
-
-jobs:
- update-docs:
- runs-on: ubuntu-latest
-
- permissions:
- # Give the default GITHUB_TOKEN write permission to commit and push the
- # added or changed files to the repository.
- contents: write
-
- steps:
- - name: Checkout repository
- uses: actions/checkout@v3
-
- - name: Configure Git
- run: |
- # Configure Git
- git config --global user.name "github-actions[bot]"
- git config --global user.email "github-actions[bot]@users.noreply.github.com"
-
- - name: Set up Node.js
- uses: actions/setup-node@v3
- with:
- node-version: '16' # Update based on your project's requirements
-
- - name: Build
- run: |
- cd docs;
- npm install
- cd ..
- ls -la
- node docs/build.js
-
-
- - name: Checkout docs repository
- uses: actions/checkout@v3
- with:
- path: distr
- ref: docs
-
- - name: Deploy docs
- run: |
- rsync -av --exclude='.git/' --del build/ distr/
- cd distr
- git add .
- git commit -m "Update docs on $(date)"
- git push --force origin docs
diff --git a/.gitignore b/.gitignore
index f96db2252..1746e3269 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,2 @@
bin
obj
-aoc-crypt.key
-docs/node_modules
-build
diff --git a/.vscode/launch.json b/.vscode/launch.json
index 86b12f55e..b1d3018a7 100644
--- a/.vscode/launch.json
+++ b/.vscode/launch.json
@@ -11,7 +11,7 @@
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
- "program": "${workspaceFolder}/bin/Debug/net9.0/adventofcode.dll",
+ "program": "${workspaceFolder}/bin/Debug/net7.0/adventofcode.dll",
"args": ["${relativeFileDirname}"],
"cwd": "${workspaceFolder}",
// For more information about the 'console' field, see https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md#console-terminal-window
diff --git a/2015/Day01/README.md b/2015/Day01/README.md
index e6654b029..bfd951a30 100644
--- a/2015/Day01/README.md
+++ b/2015/Day01/README.md
@@ -1,6 +1,38 @@
+original source: [https://adventofcode.com/2015/day/1](https://adventofcode.com/2015/day/1)
## --- Day 1: Not Quite Lisp ---
Santa was hoping for a white Christmas, but his weather machine's "snow" function is powered by stars, and he's fresh out! To save Christmas, he needs you to collect fifty stars by December 25th.
Collect stars by helping Santa solve puzzles. Two puzzles will be made available on each day in the Advent calendar; the second puzzle is unlocked when you complete the first. Each puzzle grants one star. Good luck!
-_Visit the website for the full story and [full puzzle](https://adventofcode.com/2015/day/1) description._
+Here's an easy puzzle to warm you up.
+
+Santa is trying to deliver presents in a large apartment building, but he can't find the right floor - the directions he got are a little confusing. He starts on the ground floor (floor 0) and then follows the instructions one character at a time.
+
+An opening parenthesis, (, means he should go up one floor, and a closing parenthesis, ), means he should go down one floor.
+
+The apartment building is very tall, and the basement is very deep; he will never find the top or bottom floors.
+
+For example:
+
+
+ - (()) and ()() both result in floor 0.
+ - ((( and (()(()( both result in floor 3.
+ - ))((((( also results in floor 3.
+ - ()) and ))( both result in floor -1 (the first basement level).
+ - ))) and )())()) both result in floor -3.
+
+To what floor do the instructions take Santa?
+
+
+## --- Part Two ---
+Now, given the same instructions, find the position of the first character that causes him to enter the basement (floor -1). The first character in the instructions has position 1, the second character has position 2, and so on.
+
+For example:
+
+
+ - ) causes him to enter the basement at character position 1.
+ - ()()) causes him to enter the basement at character position 5.
+
+What is the position of the character that causes Santa to first enter the basement?
+
+
diff --git a/2015/Day01/illustration.jpeg b/2015/Day01/illustration.jpeg
deleted file mode 100644
index 999d41141..000000000
Binary files a/2015/Day01/illustration.jpeg and /dev/null differ
diff --git a/2015/Day01/input.in b/2015/Day01/input.in
index efdae0d4d..1855a96b9 100644
Binary files a/2015/Day01/input.in and b/2015/Day01/input.in differ
diff --git a/2015/Day02/README.md b/2015/Day02/README.md
index 91b468e7c..945f77abf 100644
--- a/2015/Day02/README.md
+++ b/2015/Day02/README.md
@@ -1,6 +1,29 @@
+original source: [https://adventofcode.com/2015/day/2](https://adventofcode.com/2015/day/2)
## --- Day 2: I Was Told There Would Be No Math ---
The elves are running low on wrapping paper, and so they need to submit an order for more. They have a list of the dimensions (length `l`, width `w`, and height `h`) of each present, and only want to order exactly as much as they need.
Fortunately, every present is a box (a perfect [right rectangular prism](https://en.wikipedia.org/wiki/Cuboid#Rectangular_cuboid)), which makes calculating the required wrapping paper for each gift a little easier: find the surface area of the box, which is `2*l*w + 2*w*h + 2*h*l`. The elves also need a little extra paper for each present: the area of the smallest side.
-Read the [full puzzle](https://adventofcode.com/2015/day/2).
\ No newline at end of file
+For example:
+
+
+ - A present with dimensions `2x3x4` requires `2*6 + 2*12 + 2*8 = 52` square feet of wrapping paper plus `6` square feet of slack, for a total of `58` square feet.
+ - A present with dimensions `1x1x10` requires `2*1 + 2*10 + 2*10 = 42` square feet of wrapping paper plus `1` square foot of slack, for a total of `43` square feet.
+
+All numbers in the elves' list are in feet. How many total *square feet of wrapping paper* should they order?
+
+
+## --- Part Two ---
+The elves are also running low on ribbon. Ribbon is all the same width, so they only have to worry about the length they need to order, which they would again like to be exact.
+
+The ribbon required to wrap a present is the shortest distance around its sides, or the smallest perimeter of any one face. Each present also requires a bow made out of ribbon as well; the feet of ribbon required for the perfect bow is equal to the cubic feet of volume of the present. Don't ask how they tie the bow, though; they'll never tell.
+
+For example:
+
+
+ - A present with dimensions `2x3x4` requires `2+2+3+3 = 10` feet of ribbon to wrap the present plus `2*3*4 = 24` feet of ribbon for the bow, for a total of `34` feet.
+ - A present with dimensions `1x1x10` requires `1+1+1+1 = 4` feet of ribbon to wrap the present plus `1*1*10 = 10` feet of ribbon for the bow, for a total of `14` feet.
+
+How many total *feet of ribbon* should they order?
+
+
diff --git a/2015/Day02/illustration.jpeg b/2015/Day02/illustration.jpeg
deleted file mode 100644
index 23432437a..000000000
Binary files a/2015/Day02/illustration.jpeg and /dev/null differ
diff --git a/2015/Day02/input.in b/2015/Day02/input.in
index ee590c717..2f04474ab 100644
Binary files a/2015/Day02/input.in and b/2015/Day02/input.in differ
diff --git a/2015/Day03/README.md b/2015/Day03/README.md
index 06678a506..39d702484 100644
--- a/2015/Day03/README.md
+++ b/2015/Day03/README.md
@@ -1,6 +1,31 @@
+original source: [https://adventofcode.com/2015/day/3](https://adventofcode.com/2015/day/3)
## --- Day 3: Perfectly Spherical Houses in a Vacuum ---
Santa is delivering presents to an infinite two-dimensional grid of houses.
He begins by delivering a present to the house at his starting location, and then an elf at the North Pole calls him via radio and tells him where to move next. Moves are always exactly one house to the north (`^`), south (`v`), east (`>`), or west (`<`). After each move, he delivers another present to the house at his new location.
-Read the [full puzzle](https://adventofcode.com/2015/day/3).
\ No newline at end of file
+However, the elf back at the north pole has had a little too much eggnog, and so his directions are a little off, and Santa ends up visiting some houses more than once. How many houses receive *at least one present*?
+
+For example:
+
+
+ - `>` delivers presents to `2` houses: one at the starting location, and one to the east.
+ - `^>v<` delivers presents to `4` houses in a square, including twice to the house at his starting/ending location.
+ - `^v^v^v^v^v` delivers a bunch of presents to some very lucky children at only `2` houses.
+
+
+## --- Part Two ---
+The next year, to speed up the process, Santa creates a robot version of himself, *Robo-Santa*, to deliver presents with him.
+
+Santa and Robo-Santa start at the same location (delivering two presents to the same starting house), then take turns moving based on instructions from the elf, who is eggnoggedly reading from the same script as the previous year.
+
+This year, how many houses receive *at least one present*?
+
+For example:
+
+
+ - `^v` delivers presents to `3` houses, because Santa goes north, and then Robo-Santa goes south.
+ - `^>v<` now delivers presents to `3` houses, and Santa and Robo-Santa end up back where they started.
+ - `^v^v^v^v^v` now delivers presents to `11` houses, with Santa going one direction and Robo-Santa going the other.
+
+
diff --git a/2015/Day03/illustration.jpeg b/2015/Day03/illustration.jpeg
deleted file mode 100644
index 60cacbd93..000000000
Binary files a/2015/Day03/illustration.jpeg and /dev/null differ
diff --git a/2015/Day03/input.in b/2015/Day03/input.in
index 065d2f825..a5954e780 100644
Binary files a/2015/Day03/input.in and b/2015/Day03/input.in differ
diff --git a/2015/Day04/README.md b/2015/Day04/README.md
index a52193422..839c51a61 100644
--- a/2015/Day04/README.md
+++ b/2015/Day04/README.md
@@ -1,6 +1,17 @@
+original source: [https://adventofcode.com/2015/day/4](https://adventofcode.com/2015/day/4)
## --- Day 4: The Ideal Stocking Stuffer ---
Santa needs help [mining](https://en.wikipedia.org/wiki/Bitcoin#Mining) some AdventCoins (very similar to [bitcoins](https://en.wikipedia.org/wiki/Bitcoin)) to use as gifts for all the economically forward-thinking little girls and boys.
To do this, he needs to find [MD5](https://en.wikipedia.org/wiki/MD5) hashes which, in [hexadecimal](https://en.wikipedia.org/wiki/Hexadecimal), start with at least *five zeroes*. The input to the MD5 hash is some secret key (your puzzle input, given below) followed by a number in decimal. To mine AdventCoins, you must find Santa the lowest positive number (no leading zeroes: `1`, `2`, `3`, ...) that produces such a hash.
-Read the [full puzzle](https://adventofcode.com/2015/day/4).
\ No newline at end of file
+For example:
+
+
+ - If your secret key is `abcdef`, the answer is `609043`, because the MD5 hash of `abcdef609043` starts with five zeroes (`000001dbbfa...`), and it is the lowest such number to do so.
+ - If your secret key is `pqrstuv`, the lowest number it combines with to make an MD5 hash starting with five zeroes is `1048970`; that is, the MD5 hash of `pqrstuv1048970` looks like `000006136ef...`.
+
+
+## --- Part Two ---
+Now find one that starts with *six zeroes*.
+
+
diff --git a/2015/Day04/Solution.cs b/2015/Day04/Solution.cs
index a487524e2..7197c88dd 100644
--- a/2015/Day04/Solution.cs
+++ b/2015/Day04/Solution.cs
@@ -1,6 +1,5 @@
using System.Collections.Concurrent;
using System.Linq;
-using System.Collections.Generic;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
@@ -17,7 +16,7 @@ int ParallelFind(string input, string prefix) {
var q = new ConcurrentQueue();
Parallel.ForEach(
- Numbers(),
+ Enumerable.Range(0, int.MaxValue),
() => MD5.Create(),
(i, state, md5) => {
var hashBytes = md5.ComputeHash(Encoding.ASCII.GetBytes(input + i));
@@ -34,9 +33,4 @@ int ParallelFind(string input, string prefix) {
return q.Min();
}
- IEnumerable Numbers() {
- for (int i=0; ;i++) {
- yield return i;
- }
- }
}
diff --git a/2015/Day04/illustration.jpeg b/2015/Day04/illustration.jpeg
deleted file mode 100644
index 243d89a1b..000000000
Binary files a/2015/Day04/illustration.jpeg and /dev/null differ
diff --git a/2015/Day04/input.in b/2015/Day04/input.in
index 7f2ce7a96..d75e0dcd7 100644
Binary files a/2015/Day04/input.in and b/2015/Day04/input.in differ
diff --git a/2015/Day05/README.md b/2015/Day05/README.md
index 0c3382404..15274b7f4 100644
--- a/2015/Day05/README.md
+++ b/2015/Day05/README.md
@@ -1,6 +1,43 @@
+original source: [https://adventofcode.com/2015/day/5](https://adventofcode.com/2015/day/5)
## --- Day 5: Doesn't He Have Intern-Elves For This? ---
Santa needs help figuring out which strings in his text file are naughty or nice.
A *nice string* is one with all of the following properties:
-Read the [full puzzle](https://adventofcode.com/2015/day/5).
\ No newline at end of file
+
+ - It contains at least three vowels (`aeiou` only), like `aei`, `xazegov`, or `aeiouaeiouaeiou`.
+ - It contains at least one letter that appears twice in a row, like `xx`, `abcdde` (`dd`), or `aabbccdd` (`aa`, `bb`, `cc`, or `dd`).
+ - It does *not* contain the strings `ab`, `cd`, `pq`, or `xy`, even if they are part of one of the other requirements.
+
+For example:
+
+
+ - `ugknbfddgicrmopn` is nice because it has at least three vowels (`u...i...o...`), a double letter (`...dd...`), and none of the disallowed substrings.
+ - `aaa` is nice because it has at least three vowels and a double letter, even though the letters used by different rules overlap.
+ - `jchzalrnumimnmhp` is naughty because it has no double letter.
+ - `haegwjzuvuyypxyu` is naughty because it contains the string `xy`.
+ - `dvszwmarrgswjxmb` is naughty because it contains only one vowel.
+
+How many strings are nice?
+
+
+## --- Part Two ---
+Realizing the error of his ways, Santa has switched to a better model of determining whether a string is naughty or nice. None of the old rules apply, as they are all clearly ridiculous.
+
+Now, a nice string is one with all of the following properties:
+
+
+ - It contains a pair of any two letters that appears at least twice in the string without overlapping, like `xyxy` (`xy`) or `aabcdefgaa` (`aa`), but not like `aaa` (`aa`, but it overlaps).
+ - It contains at least one letter which repeats with exactly one letter between them, like `xyx`, `abcdefeghi` (`efe`), or even `aaa`.
+
+For example:
+
+
+ - `qjhvhtzxzqqjkmpb` is nice because is has a pair that appears twice (`qj`) and a letter that repeats with exactly one letter between them (`zxz`).
+ - `xxyxx` is nice because it has a pair that appears twice and a letter that repeats with one between, even though the letters used by each rule overlap.
+ - `uurcxstgmygtbstg` is naughty because it has a pair (`tg`) but no repeat with a single letter between them.
+ - `ieodomkazucvgmuy` is naughty because it has a repeating letter with one between (`odo`), but no pair that appears twice.
+
+How many strings are nice under these new rules?
+
+
diff --git a/2015/Day05/illustration.jpeg b/2015/Day05/illustration.jpeg
deleted file mode 100644
index 8ba151e3c..000000000
Binary files a/2015/Day05/illustration.jpeg and /dev/null differ
diff --git a/2015/Day05/input.in b/2015/Day05/input.in
index 78609b050..a9b6e779f 100644
Binary files a/2015/Day05/input.in and b/2015/Day05/input.in differ
diff --git a/2015/Day06/README.md b/2015/Day06/README.md
index bc54a864c..9ad79d8bf 100644
--- a/2015/Day06/README.md
+++ b/2015/Day06/README.md
@@ -1,6 +1,40 @@
+original source: [https://adventofcode.com/2015/day/6](https://adventofcode.com/2015/day/6)
## --- Day 6: Probably a Fire Hazard ---
Because your neighbors keep defeating you in the holiday house decorating contest year after year, you've decided to deploy one million lights in a 1000x1000 grid.
Furthermore, because you've been especially nice this year, Santa has mailed you instructions on how to display the ideal lighting configuration.
-Read the [full puzzle](https://adventofcode.com/2015/day/6).
\ No newline at end of file
+
+Lights in your grid are numbered from 0 to 999 in each direction; the lights at each corner are at `0,0`, `0,999`, `999,999`, and `999,0`. The instructions include whether to `turn on`, `turn off`, or `toggle` various inclusive ranges given as coordinate pairs. Each coordinate pair represents opposite corners of a rectangle, inclusive; a coordinate pair like `0,0 through 2,2` therefore refers to 9 lights in a 3x3 square. The lights all start turned off.
+To defeat your neighbors this year, all you have to do is set up your lights by doing the instructions Santa sent you in order.
+
+For example:
+
+
+ - `turn on 0,0 through 999,999` would turn on (or leave on) every light.
+ - `toggle 0,0 through 999,0` would toggle the first line of 1000 lights, turning off the ones that were on, and turning on the ones that were off.
+ - `turn off 499,499 through 500,500` would turn off (or leave off) the middle four lights.
+
+After following the instructions, *how many lights are lit*?
+
+
+## --- Part Two ---
+You just finish implementing your winning light pattern when you realize you mistranslated Santa's message from Ancient Nordic Elvish.
+
+The light grid you bought actually has individual brightness controls; each light can have a brightness of zero or more. The lights all start at zero.
+
+The phrase `turn on` actually means that you should increase the brightness of those lights by `1`.
+
+The phrase `turn off` actually means that you should decrease the brightness of those lights by `1`, to a minimum of zero.
+
+The phrase `toggle` actually means that you should increase the brightness of those lights by `2`.
+
+What is the *total brightness* of all lights combined after following Santa's instructions?
+
+For example:
+
+
+ - `turn on 0,0 through 0,0` would increase the total brightness by `1`.
+ - `toggle 0,0 through 999,999` would increase the total brightness by `2000000`.
+
+
diff --git a/2015/Day06/illustration.jpeg b/2015/Day06/illustration.jpeg
deleted file mode 100644
index 3b62f677b..000000000
Binary files a/2015/Day06/illustration.jpeg and /dev/null differ
diff --git a/2015/Day06/input.in b/2015/Day06/input.in
index be73cadf4..df10465d6 100644
Binary files a/2015/Day06/input.in and b/2015/Day06/input.in differ
diff --git a/2015/Day07/README.md b/2015/Day07/README.md
index 7a4b1c9a3..a4455815d 100644
--- a/2015/Day07/README.md
+++ b/2015/Day07/README.md
@@ -1,6 +1,51 @@
+original source: [https://adventofcode.com/2015/day/7](https://adventofcode.com/2015/day/7)
## --- Day 7: Some Assembly Required ---
This year, Santa brought little Bobby Tables a set of wires and [bitwise logic gates](https://en.wikipedia.org/wiki/Bitwise_operation)! Unfortunately, little Bobby is a little under the recommended age range, and he needs help assembling the circuit.
Each wire has an identifier (some lowercase letters) and can carry a [16-bit](https://en.wikipedia.org/wiki/16-bit) signal (a number from `0` to `65535`). A signal is provided to each wire by a gate, another wire, or some specific value. Each wire can only get a signal from one source, but can provide its signal to multiple destinations. A gate provides no signal until all of its inputs have a signal.
-Read the [full puzzle](https://adventofcode.com/2015/day/7).
\ No newline at end of file
+The included instructions booklet describes how to connect the parts together: `x AND y -> z` means to connect wires `x` and `y` to an AND gate, and then connect its output to wire `z`.
+
+For example:
+
+
+ - `123 -> x` means that the signal `123` is provided to wire `x`.
+ - `x AND y -> z` means that the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of wire `x` and wire `y` is provided to wire `z`.
+ - `p LSHIFT 2 -> q` means that the value from wire `p` is [left-shifted](https://en.wikipedia.org/wiki/Logical_shift) by `2` and then provided to wire `q`.
+ - `NOT e -> f` means that the [bitwise complement](https://en.wikipedia.org/wiki/Bitwise_operation#NOT) of the value from wire `e` is provided to wire `f`.
+
+Other possible gates include `OR` ([bitwise OR](https://en.wikipedia.org/wiki/Bitwise_operation#OR)) and `RSHIFT` ([right-shift](https://en.wikipedia.org/wiki/Logical_shift)). If, for some reason, you'd like to *emulate* the circuit instead, almost all programming languages (for example, [C](https://en.wikipedia.org/wiki/Bitwise_operations_in_C), [JavaScript](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators), or [Python](https://wiki.python.org/moin/BitwiseOperators)) provide operators for these gates.
+
+For example, here is a simple circuit:
+
+```
+123 -> x
+456 -> y
+x AND y -> d
+x OR y -> e
+x LSHIFT 2 -> f
+y RSHIFT 2 -> g
+NOT x -> h
+NOT y -> i
+```
+
+After it is run, these are the signals on the wires:
+
+```
+d: 72
+e: 507
+f: 492
+g: 114
+h: 65412
+i: 65079
+x: 123
+y: 456
+```
+
+In little Bobby's kit's instructions booklet (provided as your puzzle input), what signal is ultimately provided to *wire `a`*?
+
+
+## --- Part Two ---
+Now, take the signal you got on wire `a`, override wire `b` to that signal, and reset the other wires (including wire `a`). What new signal is ultimately provided to wire `a`?
+
+
diff --git a/2015/Day07/input.in b/2015/Day07/input.in
index 21197948f..1b7dfc90f 100644
Binary files a/2015/Day07/input.in and b/2015/Day07/input.in differ
diff --git a/2015/Day08/README.md b/2015/Day08/README.md
index acd31d5fc..96a564da8 100644
--- a/2015/Day08/README.md
+++ b/2015/Day08/README.md
@@ -1,6 +1,37 @@
+original source: [https://adventofcode.com/2015/day/8](https://adventofcode.com/2015/day/8)
## --- Day 8: Matchsticks ---
Space on the sleigh is limited this year, and so Santa will be bringing his list as a digital copy. He needs to know how much space it will take up when stored.
It is common in many programming languages to provide a way to escape special characters in strings. For example, [C](https://en.wikipedia.org/wiki/Escape_sequences_in_C), [JavaScript](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String), [Perl](http://perldoc.perl.org/perlop.html#Quote-and-Quote-like-Operators), [Python](https://docs.python.org/2.0/ref/strings.html), and even [PHP](http://php.net/manual/en/language.types.string.php#language.types.string.syntax.double) handle special characters in very similar ways.
-Read the [full puzzle](https://adventofcode.com/2015/day/8).
\ No newline at end of file
+However, it is important to realize the difference between the number of characters *in the code representation of the string literal* and the number of characters *in the in-memory string itself*.
+
+For example:
+
+
+ - `""` is `2` characters of code (the two double quotes), but the string contains zero characters.
+ - `"abc"` is `5` characters of code, but `3` characters in the string data.
+ - `"aaa\"aaa"` is `10` characters of code, but the string itself contains six "a" characters and a single, escaped quote character, for a total of `7` characters in the string data.
+ - `"\x27"` is `6` characters of code, but the string itself contains just one - an apostrophe (`'`), escaped using hexadecimal notation.
+
+Santa's list is a file that contains many double-quoted string literals, one on each line. The only escape sequences used are `\\` (which represents a single backslash), `\"` (which represents a lone double-quote character), and `\x` plus two hexadecimal characters (which represents a single character with that ASCII code).
+
+Disregarding the whitespace in the file, what is *the number of characters of code for string literals* minus *the number of characters in memory for the values of the strings* in total for the entire file?
+
+For example, given the four strings above, the total number of characters of string code (`2 + 5 + 10 + 6 = 23`) minus the total number of characters in memory for string values (`0 + 3 + 7 + 1 = 11`) is `23 - 11 = 12`.
+
+
+## --- Part Two ---
+Now, let's go the other way. In addition to finding the number of characters of code, you should now *encode each code representation as a new string* and find the number of characters of the new encoded representation, including the surrounding double quotes.
+
+For example:
+
+
+ - `""` encodes to `"\"\""`, an increase from `2` characters to `6`.
+ - `"abc"` encodes to `"\"abc\""`, an increase from `5` characters to `9`.
+ - `"aaa\"aaa"` encodes to `"\"aaa\\\"aaa\""`, an increase from `10` characters to `16`.
+ - `"\x27"` encodes to `"\"\\x27\""`, an increase from `6` characters to `11`.
+
+Your task is to find *the total number of characters to represent the newly encoded strings* minus *the number of characters of code in each original string literal*. For example, for the strings above, the total encoded length (`6 + 9 + 16 + 11 = 42`) minus the characters in the original code representation (`23`, just like in the first part of this puzzle) is `42 - 23 = 19`.
+
+
diff --git a/2015/Day08/input.in b/2015/Day08/input.in
index a37076b5a..3e5be6553 100644
Binary files a/2015/Day08/input.in and b/2015/Day08/input.in differ
diff --git a/2015/Day09/README.md b/2015/Day09/README.md
index 9ea9bfada..a29da3479 100644
--- a/2015/Day09/README.md
+++ b/2015/Day09/README.md
@@ -1,6 +1,40 @@
+original source: [https://adventofcode.com/2015/day/9](https://adventofcode.com/2015/day/9)
## --- Day 9: All in a Single Night ---
Every year, Santa manages to deliver all of his presents in a single night.
This year, however, he has some new locations to visit; his elves have provided him the distances between every pair of locations. He can start and end at any two (different) locations he wants, but he must visit each location exactly once. What is the *shortest distance* he can travel to achieve this?
-Read the [full puzzle](https://adventofcode.com/2015/day/9).
\ No newline at end of file
+For example, given the following distances:
+
+```
+London to Dublin = 464
+London to Belfast = 518
+Dublin to Belfast = 141
+```
+
+The possible routes are therefore:
+
+```
+Dublin -> London -> Belfast = 982
+London -> Dublin -> Belfast = 605
+London -> Belfast -> Dublin = 659
+Dublin -> Belfast -> London = 659
+Belfast -> Dublin -> London = 605
+Belfast -> London -> Dublin = 982
+```
+
+The shortest of these is `London -> Dublin -> Belfast = 605`, and so the answer is `605` in this example.
+
+What is the distance of the shortest route?
+
+
+## --- Part Two ---
+The next year, just to show off, Santa decides to take the route with the *longest distance* instead.
+
+He can still start and end at any two (different) locations he wants, and he still must visit each location exactly once.
+
+For example, given the distances above, the longest route would be `982` via (for example) `Dublin -> London -> Belfast`.
+
+What is the distance of the longest route?
+
+
diff --git a/2015/Day09/input.in b/2015/Day09/input.in
index 9873e3051..a56f5e253 100644
Binary files a/2015/Day09/input.in and b/2015/Day09/input.in differ
diff --git a/2015/Day10/README.md b/2015/Day10/README.md
index e09b557f0..8099a370c 100644
--- a/2015/Day10/README.md
+++ b/2015/Day10/README.md
@@ -1,6 +1,24 @@
+original source: [https://adventofcode.com/2015/day/10](https://adventofcode.com/2015/day/10)
## --- Day 10: Elves Look, Elves Say ---
Today, the Elves are playing a game called [look-and-say](https://en.wikipedia.org/wiki/Look-and-say_sequence). They take turns making sequences by reading aloud the previous sequence and using that reading as the next sequence. For example, `211` is read as "one two, two ones", which becomes `1221` (`1` `2`, `2` `1`s).
Look-and-say sequences are generated iteratively, using the previous value as input for the next step. For each step, take the previous value, and replace each run of digits (like `111`) with the number of digits (`3`) followed by the digit itself (`1`).
-Read the [full puzzle](https://adventofcode.com/2015/day/10).
\ No newline at end of file
+For example:
+
+
+ - `1` becomes `11` (`1` copy of digit `1`).
+ - `11` becomes `21` (`2` copies of digit `1`).
+ - `21` becomes `1211` (one `2` followed by one `1`).
+ - `1211` becomes `111221` (one `1`, one `2`, and two `1`s).
+ - `111221` becomes `312211` (three `1`s, two `2`s, and one `1`).
+
+Starting with the digits in your puzzle input, apply this process 40 times. What is *the length of the result*?
+
+
+## --- Part Two ---
+Neat, right? You might also enjoy hearing [John Conway talking about this sequence](https://www.youtube.com/watch?v=ea7lJkEhytA) (that's Conway of *Conway's Game of Life* fame).
+
+Now, starting again with the digits in your puzzle input, apply this process *50* times. What is *the length of the new result*?
+
+
diff --git a/2015/Day10/input.in b/2015/Day10/input.in
index 33556dd98..067b0ee67 100644
Binary files a/2015/Day10/input.in and b/2015/Day10/input.in differ
diff --git a/2015/Day11/README.md b/2015/Day11/README.md
index f2d68ae2a..2471f1feb 100644
--- a/2015/Day11/README.md
+++ b/2015/Day11/README.md
@@ -1,6 +1,31 @@
+original source: [https://adventofcode.com/2015/day/11](https://adventofcode.com/2015/day/11)
## --- Day 11: Corporate Policy ---
Santa's previous password expired, and he needs help choosing a new one.
To help him remember his new password after the old one expires, Santa has devised a method of coming up with a password based on the previous one. Corporate policy dictates that passwords must be exactly eight lowercase letters (for security reasons), so he finds his new password by *incrementing* his old password string repeatedly until it is valid.
-Read the [full puzzle](https://adventofcode.com/2015/day/11).
\ No newline at end of file
+Incrementing is just like counting with numbers: `xx`, `xy`, `xz`, `ya`, `yb`, and so on. Increase the rightmost letter one step; if it was `z`, it wraps around to `a`, and repeat with the next letter to the left until one doesn't wrap around.
+
+Unfortunately for Santa, a new Security-Elf recently started, and he has imposed some additional password requirements:
+
+
+ - Passwords must include one increasing straight of at least three letters, like `abc`, `bcd`, `cde`, and so on, up to `xyz`. They cannot skip letters; `abd` doesn't count.
+ - Passwords may not contain the letters `i`, `o`, or `l`, as these letters can be mistaken for other characters and are therefore confusing.
+ - Passwords must contain at least two different, non-overlapping pairs of letters, like `aa`, `bb`, or `zz`.
+
+For example:
+
+
+ - `hijklmmn` meets the first requirement (because it contains the straight `hij`) but fails the second requirement requirement (because it contains `i` and `l`).
+ - `abbceffg` meets the third requirement (because it repeats `bb` and `ff`) but fails the first requirement.
+ - `abbcegjk` fails the third requirement, because it only has one double letter (`bb`).
+ - The next password after `abcdefgh` is `abcdffaa`.
+ - The next password after `ghijklmn` is `ghjaabcc`, because you eventually skip all the passwords that start with `ghi...`, since `i` is not allowed.
+
+Given Santa's current password (your puzzle input), what should his *next password* be?
+
+
+## --- Part Two ---
+Santa's password expired again. What's the next one?
+
+
diff --git a/2015/Day11/input.in b/2015/Day11/input.in
index cf3823d95..5915be7bb 100644
Binary files a/2015/Day11/input.in and b/2015/Day11/input.in differ
diff --git a/2015/Day12/README.md b/2015/Day12/README.md
index 45ad4b14e..b0863b30f 100644
--- a/2015/Day12/README.md
+++ b/2015/Day12/README.md
@@ -1,6 +1,31 @@
+original source: [https://adventofcode.com/2015/day/12](https://adventofcode.com/2015/day/12)
## --- Day 12: JSAbacusFramework.io ---
Santa's Accounting-Elves need help balancing the books after a recent order. Unfortunately, their accounting software uses a peculiar storage format. That's where you come in.
They have a [JSON](http://json.org/) document which contains a variety of things: arrays (`[1,2,3]`), objects (`{"a":1, "b":2}`), numbers, and strings. Your first job is to simply find all of the *numbers* throughout the document and add them together.
-Read the [full puzzle](https://adventofcode.com/2015/day/12).
\ No newline at end of file
+For example:
+
+
+ - `[1,2,3]` and `{"a":2,"b":4}` both have a sum of `6`.
+ - `[[[3]]]` and `{"a":{"b":4},"c":-1}` both have a sum of `3`.
+ - `{"a":[-1,1]}` and `[-1,{"a":1}]` both have a sum of `0`.
+ - `[]` and `{}` both have a sum of `0`.
+
+You will not encounter any strings containing numbers.
+
+What is the *sum of all numbers* in the document?
+
+
+## --- Part Two ---
+Uh oh - the Accounting-Elves have realized that they double-counted everything *red*.
+
+Ignore any object (and all of its children) which has any property with the value `"red"`. Do this only for objects (`{...}`), not arrays (`[...]`).
+
+
+ - `[1,2,3]` still has a sum of `6`.
+ - `[1,{"c":"red","b":2},3]` now has a sum of `4`, because the middle object is ignored.
+ - `{"d":"red","e":[1,2,3,4],"f":5}` now has a sum of `0`, because the entire structure is ignored.
+ - `[1,"red",5]` has a sum of `6`, because `"red"` in an array has no effect.
+
+
diff --git a/2015/Day12/input.in b/2015/Day12/input.in
index 6bce44176..d813484c5 100644
Binary files a/2015/Day12/input.in and b/2015/Day12/input.in differ
diff --git a/2015/Day13/README.md b/2015/Day13/README.md
index c126f8ae3..5eeb7bdfa 100644
--- a/2015/Day13/README.md
+++ b/2015/Day13/README.md
@@ -1,6 +1,48 @@
+original source: [https://adventofcode.com/2015/day/13](https://adventofcode.com/2015/day/13)
## --- Day 13: Knights of the Dinner Table ---
In years past, the holiday feast with your family hasn't gone so well. Not everyone gets along! This year, you resolve, will be different. You're going to find the *optimal seating arrangement* and avoid all those awkward conversations.
You start by writing up a list of everyone invited and the amount their happiness would increase or decrease if they were to find themselves sitting next to each other person. You have a circular table that will be just big enough to fit everyone comfortably, and so each person will have exactly two neighbors.
-Read the [full puzzle](https://adventofcode.com/2015/day/13).
\ No newline at end of file
+For example, suppose you have only four attendees planned, and you calculate their potential happiness as follows:
+
+```
+Alice would gain 54 happiness units by sitting next to Bob.
+Alice would lose 79 happiness units by sitting next to Carol.
+Alice would lose 2 happiness units by sitting next to David.
+Bob would gain 83 happiness units by sitting next to Alice.
+Bob would lose 7 happiness units by sitting next to Carol.
+Bob would lose 63 happiness units by sitting next to David.
+Carol would lose 62 happiness units by sitting next to Alice.
+Carol would gain 60 happiness units by sitting next to Bob.
+Carol would gain 55 happiness units by sitting next to David.
+David would gain 46 happiness units by sitting next to Alice.
+David would lose 7 happiness units by sitting next to Bob.
+David would gain 41 happiness units by sitting next to Carol.
+```
+
+Then, if you seat Alice next to David, Alice would lose `2` happiness units (because David talks so much), but David would gain `46` happiness units (because Alice is such a good listener), for a total change of `44`.
+
+If you continue around the table, you could then seat Bob next to Alice (Bob gains `83`, Alice gains `54`). Finally, seat Carol, who sits next to Bob (Carol gains `60`, Bob loses `7`) and David (Carol gains `55`, David gains `41`). The arrangement looks like this:
+
+```
+ +41 +46
++55 David -2
+Carol Alice
++60 Bob +54
+ -7 +83
+```
+
+After trying every other seating arrangement in this hypothetical scenario, you find that this one is the most optimal, with a total change in happiness of `330`.
+
+What is the *total change in happiness* for the optimal seating arrangement of the actual guest list?
+
+
+## --- Part Two ---
+In all the commotion, you realize that you forgot to seat yourself. At this point, you're pretty apathetic toward the whole thing, and your happiness wouldn't really go up or down regardless of who you sit next to. You assume everyone else would be just as ambivalent about sitting next to you, too.
+
+So, add yourself to the list, and give all happiness relationships that involve you a score of `0`.
+
+What is the *total change in happiness* for the optimal seating arrangement that actually includes yourself?
+
+
diff --git a/2015/Day13/input.in b/2015/Day13/input.in
index 67565872d..35be3572e 100644
Binary files a/2015/Day13/input.in and b/2015/Day13/input.in differ
diff --git a/2015/Day14/README.md b/2015/Day14/README.md
index c731da059..28fead086 100644
--- a/2015/Day14/README.md
+++ b/2015/Day14/README.md
@@ -1,6 +1,31 @@
+original source: [https://adventofcode.com/2015/day/14](https://adventofcode.com/2015/day/14)
## --- Day 14: Reindeer Olympics ---
This year is the Reindeer Olympics! Reindeer can fly at high speeds, but must rest occasionally to recover their energy. Santa would like to know which of his reindeer is fastest, and so he has them race.
Reindeer can only either be *flying* (always at their top speed) or *resting* (not moving at all), and always spend whole seconds in either state.
-Read the [full puzzle](https://adventofcode.com/2015/day/14).
\ No newline at end of file
+For example, suppose you have the following Reindeer:
+
+
+ - Comet can fly *14 km/s for 10 seconds*, but then must rest for *127 seconds*.
+ - Dancer can fly *16 km/s for 11 seconds*, but then must rest for *162 seconds*.
+
+After one second, Comet has gone 14 km, while Dancer has gone 16 km. After ten seconds, Comet has gone 140 km, while Dancer has gone 160 km. On the eleventh second, Comet begins resting (staying at 140 km), and Dancer continues on for a total distance of 176 km. On the 12th second, both reindeer are resting. They continue to rest until the 138th second, when Comet flies for another ten seconds. On the 174th second, Dancer flies for another 11 seconds.
+
+In this example, after the 1000th second, both reindeer are resting, and Comet is in the lead at *`1120`* km (poor Dancer has only gotten `1056` km by that point). So, in this situation, Comet would win (if the race ended at 1000 seconds).
+
+Given the descriptions of each reindeer (in your puzzle input), after exactly `2503` seconds, *what distance has the winning reindeer traveled*?
+
+
+## --- Part Two ---
+Seeing how reindeer move in bursts, Santa decides he's not pleased with the old scoring system.
+
+Instead, at the end of each second, he awards one point to the reindeer currently in the lead. (If there are multiple reindeer tied for the lead, they each get one point.) He keeps the traditional 2503 second time limit, of course, as doing otherwise would be entirely ridiculous.
+
+Given the example reindeer from above, after the first second, Dancer is in the lead and gets one point. He stays in the lead until several seconds into Comet's second burst: after the 140th second, Comet pulls into the lead and gets his first point. Of course, since Dancer had been in the lead for the 139 seconds before that, he has accumulated 139 points by the 140th second.
+
+After the 1000th second, Dancer has accumulated *`689`* points, while poor Comet, our old champion, only has `312`. So, with the new scoring system, Dancer would win (if the race ended at 1000 seconds).
+
+Again given the descriptions of each reindeer (in your puzzle input), after exactly `2503` seconds, *how many points does the winning reindeer have*?
+
+
diff --git a/2015/Day14/input.in b/2015/Day14/input.in
index c32701b9d..6cf5489fb 100644
Binary files a/2015/Day14/input.in and b/2015/Day14/input.in differ
diff --git a/2015/Day15/README.md b/2015/Day15/README.md
index b6a9deacf..9c00aa682 100644
--- a/2015/Day15/README.md
+++ b/2015/Day15/README.md
@@ -1,6 +1,44 @@
+original source: [https://adventofcode.com/2015/day/15](https://adventofcode.com/2015/day/15)
## --- Day 15: Science for Hungry People ---
Today, you set out on the task of perfecting your milk-dunking cookie recipe. All you have to do is find the right balance of ingredients.
Your recipe leaves room for exactly 100 teaspoons of ingredients. You make a list of the remaining ingredients you could use to finish the recipe (your puzzle input) and their properties per teaspoon:
-Read the [full puzzle](https://adventofcode.com/2015/day/15).
\ No newline at end of file
+
+ - capacity (how well it helps the cookie absorb milk)
+ - durability (how well it keeps the cookie intact when full of milk)
+ - flavor (how tasty it makes the cookie)
+ - texture (how it improves the feel of the cookie)
+ - calories (how many calories it adds to the cookie)
+
+You can only measure ingredients in whole-teaspoon amounts accurately, and you have to be accurate so you can reproduce your results in the future. The total score of a cookie can be found by adding up each of the properties (negative totals become 0) and then multiplying together everything except calories.
+
+For instance, suppose you have these two ingredients:
+
+
+
+Then, choosing to use 44 teaspoons of butterscotch and 56 teaspoons of cinnamon (because the amounts of each ingredient must add up to 100) would result in a cookie with the following properties:
+
+
+ - A capacity of 44*-1 + 56*2 = 68
+ - A durability of 44*-2 + 56*3 = 80
+ - A flavor of 44*6 + 56*-2 = 152
+ - A texture of 44*3 + 56*-1 = 76
+
+Multiplying these together (68 * 80 * 152 * 76, ignoring calories for now) results in a total score of 62842880, which happens to be the best score possible given these ingredients. If any properties had produced a negative total, it would have instead become zero, causing the whole score to multiply to zero.
+
+Given the ingredients in your kitchen and their properties, what is the total score of the highest-scoring cookie you can make?
+
+
+## --- Part Two ---
+Your cookie recipe becomes wildly popular! Someone asks if you can make another recipe that has exactly 500 calories per cookie (so they can use it as a meal replacement). Keep the rest of your award-winning process the same (100 teaspoons, same ingredients, same scoring system).
+
+For example, given the ingredients above, if you had instead selected 40 teaspoons of butterscotch and 60 teaspoons of cinnamon (which still adds to 100), the total calorie count would be 40*8 + 60*3 = 500. The total score would go down, though: only 57600000, the best you can do in such trying circumstances.
+
+Given the ingredients in your kitchen and their properties, what is the total score of the highest-scoring cookie you can make with a calorie total of 500?
+
+
diff --git a/2015/Day15/input.in b/2015/Day15/input.in
index 2a15a4bdf..6281182fe 100644
Binary files a/2015/Day15/input.in and b/2015/Day15/input.in differ
diff --git a/2015/Day16/README.md b/2015/Day16/README.md
index 2af56e4cf..e5c9c53ed 100644
--- a/2015/Day16/README.md
+++ b/2015/Day16/README.md
@@ -1,6 +1,47 @@
+original source: [https://adventofcode.com/2015/day/16](https://adventofcode.com/2015/day/16)
## --- Day 16: Aunt Sue ---
Your Aunt Sue has given you a wonderful gift, and you'd like to send her a thank you card. However, there's a small problem: she signed it "From, Aunt Sue".
You have 500 Aunts named "Sue".
-Read the [full puzzle](https://adventofcode.com/2015/day/16).
\ No newline at end of file
+So, to avoid sending the card to the wrong person, you need to figure out which Aunt Sue (which you conveniently number 1 to 500, for sanity) gave you the gift. You open the present and, as luck would have it, good ol' Aunt Sue got you a My First Crime Scene Analysis Machine! Just what you wanted. Or needed, as the case may be.
+
+The My First Crime Scene Analysis Machine (MFCSAM for short) can detect a few specific compounds in a given sample, as well as how many distinct kinds of those compounds there are. According to the instructions, these are what the MFCSAM can detect:
+
+
+ - `children`, by human DNA age analysis.
+ - `cats`. It doesn't differentiate individual breeds.
+ - Several seemingly random breeds of dog: `[samoyeds](https://en.wikipedia.org/wiki/Samoyed_%28dog%29)`, `[pomeranians](https://en.wikipedia.org/wiki/Pomeranian_%28dog%29)`, `[akitas](https://en.wikipedia.org/wiki/Akita_%28dog%29)`, and `[vizslas](https://en.wikipedia.org/wiki/Vizsla)`.
+ - `goldfish`. No other kinds of fish.
+ - `trees`, all in one group.
+ - `cars`, presumably by exhaust or gasoline or something.
+ - `perfumes`, which is handy, since many of your Aunts Sue wear a few kinds.
+
+In fact, many of your Aunts Sue have many of these. You put the wrapping from the gift into the MFCSAM. It beeps inquisitively at you a few times and then prints out a message on [ticker tape](https://en.wikipedia.org/wiki/Ticker_tape):
+
+```
+children: 3
+cats: 7
+samoyeds: 2
+pomeranians: 3
+akitas: 0
+vizslas: 0
+goldfish: 5
+trees: 3
+cars: 2
+perfumes: 1
+```
+
+You make a list of the things you can remember about each Aunt Sue. Things missing from your list aren't zero - you simply don't remember the value.
+
+What is the *number* of the Sue that got you the gift?
+
+
+## --- Part Two ---
+As you're about to send the thank you note, something in the MFCSAM's instructions catches your eye. Apparently, it has an outdated [retroencabulator](https://www.youtube.com/watch?v=RXJKdh1KZ0w), and so the output from the machine isn't exact values - some of them indicate ranges.
+
+In particular, the `cats` and `trees` readings indicates that there are *greater than* that many (due to the unpredictable nuclear decay of cat dander and tree pollen), while the `pomeranians` and `goldfish` readings indicate that there are *fewer than* that many (due to the modial interaction of magnetoreluctance).
+
+What is the *number* of the real Aunt Sue?
+
+
diff --git a/2015/Day16/input.in b/2015/Day16/input.in
index 88299f18a..ddaeefc31 100644
Binary files a/2015/Day16/input.in and b/2015/Day16/input.in differ
diff --git a/2015/Day17/README.md b/2015/Day17/README.md
index b38b90141..0b1d1f9be 100644
--- a/2015/Day17/README.md
+++ b/2015/Day17/README.md
@@ -1,6 +1,25 @@
+original source: [https://adventofcode.com/2015/day/17](https://adventofcode.com/2015/day/17)
## --- Day 17: No Such Thing as Too Much ---
The elves bought too much eggnog again - `150` liters this time. To fit it all into your refrigerator, you'll need to move it into smaller containers. You take an inventory of the capacities of the available containers.
For example, suppose you have containers of size `20`, `15`, `10`, `5`, and `5` liters. If you need to store `25` liters, there are four ways to do it:
-Read the [full puzzle](https://adventofcode.com/2015/day/17).
\ No newline at end of file
+
+ - `15` and `10`
+ - `20` and `5` (the first `5`)
+ - `20` and `5` (the second `5`)
+ - `15`, `5`, and `5`
+
+Filling all containers entirely, how many different *combinations of containers* can exactly fit all `150` liters of eggnog?
+
+
+## --- Part Two ---
+While playing with all the containers in the kitchen, another load of eggnog arrives! The shipping and receiving department is requesting as many containers as you can spare.
+
+Find the minimum number of containers that can exactly fit all `150` liters of eggnog. *How many different ways* can you fill that number of containers and still hold exactly `150` litres?
+
+In the example above, the minimum number of containers was two. There were three ways to use that many containers, and so the answer there would be `3`.
+
+
+
+
diff --git a/2015/Day17/input.in b/2015/Day17/input.in
index ebbf7e7ad..09ebd4694 100644
Binary files a/2015/Day17/input.in and b/2015/Day17/input.in differ
diff --git a/2015/Day18/README.md b/2015/Day18/README.md
index 05f646e0c..e18d65281 100644
--- a/2015/Day18/README.md
+++ b/2015/Day18/README.md
@@ -1,6 +1,136 @@
+original source: [https://adventofcode.com/2015/day/18](https://adventofcode.com/2015/day/18)
## --- Day 18: Like a GIF For Your Yard ---
After the [million lights incident](6), the fire code has gotten stricter: now, at most ten thousand lights are allowed. You arrange them in a 100x100 grid.
Never one to let you down, Santa again mails you instructions on the ideal lighting configuration. With so few lights, he says, you'll have to resort to *animation*.
-Read the [full puzzle](https://adventofcode.com/2015/day/18).
\ No newline at end of file
+Start by setting your lights to the included initial configuration (your puzzle input). A `#` means "on", and a `.` means "off".
+
+Then, animate your grid in steps, where each step decides the next configuration based on the current one. Each light's next state (either on or off) depends on its current state and the current states of the eight lights adjacent to it (including diagonals). Lights on the edge of the grid might have fewer than eight neighbors; the missing ones always count as "off".
+
+For example, in a simplified 6x6 grid, the light marked `A` has the neighbors numbered `1` through `8`, and the light marked `B`, which is on an edge, only has the neighbors marked `1` through `5`:
+
+```
+1B5...
+234...
+......
+..123.
+..8A4.
+..765.
+```
+
+The state a light should have next is based on its current state (on or off) plus the *number of neighbors that are on*:
+
+
+ - A light which is *on* stays on when `2` or `3` neighbors are on, and turns off otherwise.
+ - A light which is *off* turns on if exactly `3` neighbors are on, and stays off otherwise.
+
+All of the lights update simultaneously; they all consider the same current state before moving to the next.
+
+Here's a few steps from an example configuration of another 6x6 grid:
+
+```
+Initial state:
+.#.#.#
+...##.
+#....#
+..#...
+#.#..#
+####..
+
+After 1 step:
+..##..
+..##.#
+...##.
+......
+#.....
+#.##..
+
+After 2 steps:
+..###.
+......
+..###.
+......
+.#....
+.#....
+
+After 3 steps:
+...#..
+......
+...#..
+..##..
+......
+......
+
+After 4 steps:
+......
+......
+..##..
+..##..
+......
+......
+```
+
+After `4` steps, this example has four lights on.
+
+In your grid of 100x100 lights, given your initial configuration, *how many lights are on after 100 steps*?
+
+
+## --- Part Two ---
+You flip the instructions over; Santa goes on to point out that this is all just an implementation of [Conway's Game of Life](https://en.wikipedia.org/wiki/Conway's_Game_of_Life). At least, it was, until you notice that something's wrong with the grid of lights you bought: four lights, one in each corner, are *stuck on* and can't be turned off. The example above will actually run like this:
+
+```
+Initial state:
+##.#.#
+...##.
+#....#
+..#...
+#.#..#
+####.#
+
+After 1 step:
+#.##.#
+####.#
+...##.
+......
+#...#.
+#.####
+
+After 2 steps:
+#..#.#
+#....#
+.#.##.
+...##.
+.#..##
+##.###
+
+After 3 steps:
+#...##
+####.#
+..##.#
+......
+##....
+####.#
+
+After 4 steps:
+#.####
+#....#
+...#..
+.##...
+#.....
+#.#..#
+
+After 5 steps:
+##.###
+.##..#
+.##...
+.##...
+#.#...
+##...#
+```
+
+After `5` steps, this example now has `17` lights on.
+
+In your grid of 100x100 lights, given your initial configuration, but with the four corners always in the *on* state, *how many lights are on after 100 steps*?
+
+
diff --git a/2015/Day18/input.in b/2015/Day18/input.in
index 9c8fa75ed..e91a2a7e2 100644
Binary files a/2015/Day18/input.in and b/2015/Day18/input.in differ
diff --git a/2015/Day19/README.md b/2015/Day19/README.md
index 143c9b75b..bb0eae480 100644
--- a/2015/Day19/README.md
+++ b/2015/Day19/README.md
@@ -1,6 +1,61 @@
+original source: [https://adventofcode.com/2015/day/19](https://adventofcode.com/2015/day/19)
## --- Day 19: Medicine for Rudolph ---
Rudolph the Red-Nosed Reindeer is sick! His nose isn't shining very brightly, and he needs medicine.
Red-Nosed Reindeer biology isn't similar to regular reindeer biology; Rudolph is going to need custom-made medicine. Unfortunately, Red-Nosed Reindeer chemistry isn't similar to regular reindeer chemistry, either.
-Read the [full puzzle](https://adventofcode.com/2015/day/19).
\ No newline at end of file
+The North Pole is equipped with a Red-Nosed Reindeer nuclear fusion/fission plant, capable of constructing any Red-Nosed Reindeer molecule you need. It works by starting with some input molecule and then doing a series of *replacements*, one per step, until it has the right molecule.
+
+However, the machine has to be calibrated before it can be used. Calibration involves determining the number of molecules that can be generated in one step from a given starting point.
+
+For example, imagine a simpler machine that supports only the following replacements:
+
+```
+H => HO
+H => OH
+O => HH
+```
+
+Given the replacements above and starting with `HOH`, the following molecules could be generated:
+
+
+ - `HOOH` (via `H => HO` on the first `H`).
+ - `HOHO` (via `H => HO` on the second `H`).
+ - `OHOH` (via `H => OH` on the first `H`).
+ - `HOOH` (via `H => OH` on the second `H`).
+ - `HHHH` (via `O => HH`).
+
+So, in the example above, there are `4` *distinct* molecules (not five, because `HOOH` appears twice) after one replacement from `HOH`. Santa's favorite molecule, `HOHOHO`, can become `7` *distinct* molecules (over nine replacements: six from `H`, and three from `O`).
+
+The machine replaces without regard for the surrounding characters. For example, given the string `H2O`, the transition `H => OO` would result in `OO2O`.
+
+Your puzzle input describes all of the possible replacements and, at the bottom, the medicine molecule for which you need to calibrate the machine. *How many distinct molecules can be created* after all the different ways you can do one replacement on the medicine molecule?
+
+
+## --- Part Two ---
+Now that the machine is calibrated, you're ready to begin molecule fabrication.
+
+Molecule fabrication always begins with just a single electron, `e`, and applying replacements one at a time, just like the ones during calibration.
+
+For example, suppose you have the following replacements:
+
+```
+e => H
+e => O
+H => HO
+H => OH
+O => HH
+```
+
+If you'd like to make `HOH`, you start with `e`, and then make the following replacements:
+
+
+ - `e => O` to get `O`
+ - `O => HH` to get `HH`
+ - `H => OH` (on the second `H`) to get `HOH`
+
+So, you could make `HOH` after *`3` steps*. Santa's favorite molecule, `HOHOHO`, can be made in *`6` steps*.
+
+How long will it take to make the medicine? Given the available *replacements* and the *medicine molecule* in your puzzle input, what is the *fewest number of steps* to go from `e` to the medicine molecule?
+
+
diff --git a/2015/Day19/input.in b/2015/Day19/input.in
index e9fd053f8..b0515c05a 100644
Binary files a/2015/Day19/input.in and b/2015/Day19/input.in differ
diff --git a/2015/Day20/README.md b/2015/Day20/README.md
index 7948d8a4b..f07f7a25b 100644
--- a/2015/Day20/README.md
+++ b/2015/Day20/README.md
@@ -1,6 +1,38 @@
+original source: [https://adventofcode.com/2015/day/20](https://adventofcode.com/2015/day/20)
## --- Day 20: Infinite Elves and Infinite Houses ---
To keep the Elves busy, Santa has them deliver some presents by hand, door-to-door. He sends them down a street with infinite houses numbered sequentially: `1`, `2`, `3`, `4`, `5`, and so on.
Each Elf is assigned a number, too, and delivers presents to houses based on that number:
-Read the [full puzzle](https://adventofcode.com/2015/day/20).
\ No newline at end of file
+
+ - The first Elf (number `1`) delivers presents to every house: `1`, `2`, `3`, `4`, `5`, ....
+ - The second Elf (number `2`) delivers presents to every second house: `2`, `4`, `6`, `8`, `10`, ....
+ - Elf number `3` delivers presents to every third house: `3`, `6`, `9`, `12`, `15`, ....
+
+There are infinitely many Elves, numbered starting with `1`. Each Elf delivers presents equal to *ten times* his or her number at each house.
+
+So, the first nine houses on the street end up like this:
+
+```
+House 1 got 10 presents.
+House 2 got 30 presents.
+House 3 got 40 presents.
+House 4 got 70 presents.
+House 5 got 60 presents.
+House 6 got 120 presents.
+House 7 got 80 presents.
+House 8 got 150 presents.
+House 9 got 130 presents.
+```
+
+The first house gets `10` presents: it is visited only by Elf `1`, which delivers `1 * 10 = 10` presents. The fourth house gets `70` presents, because it is visited by Elves `1`, `2`, and `4`, for a total of `10 + 20 + 40 = 70` presents.
+
+What is the *lowest house number* of the house to get at least as many presents as the number in your puzzle input?
+
+
+## --- Part Two ---
+The Elves decide they don't want to visit an infinite number of houses. Instead, each Elf will stop after delivering presents to `50` houses. To make up for it, they decide to deliver presents equal to *eleven times* their number at each house.
+
+With these changes, what is the new *lowest house number* of the house to get at least as many presents as the number in your puzzle input?
+
+
diff --git a/2015/Day20/input.in b/2015/Day20/input.in
index 70de3846e..f0d833616 100644
Binary files a/2015/Day20/input.in and b/2015/Day20/input.in differ
diff --git a/2015/Day21/README.md b/2015/Day21/README.md
index b35a9cffb..16083551f 100644
--- a/2015/Day21/README.md
+++ b/2015/Day21/README.md
@@ -1,6 +1,60 @@
+original source: [https://adventofcode.com/2015/day/21](https://adventofcode.com/2015/day/21)
## --- Day 21: RPG Simulator 20XX ---
Little Henry Case got a new video game for Christmas. It's an [RPG](https://en.wikipedia.org/wiki/Role-playing_video_game), and he's stuck on a boss. He needs to know what equipment to buy at the shop. He hands you the [controller](https://en.wikipedia.org/wiki/Game_controller).
In this game, the player (you) and the enemy (the boss) take turns attacking. The player always goes first. Each attack reduces the opponent's hit points by at least `1`. The first character at or below `0` hit points loses.
-Read the [full puzzle](https://adventofcode.com/2015/day/21).
\ No newline at end of file
+Damage dealt by an attacker each turn is equal to the attacker's damage score minus the defender's armor score. An attacker always does at least `1` damage. So, if the attacker has a damage score of `8`, and the defender has an armor score of `3`, the defender loses `5` hit points. If the defender had an armor score of `300`, the defender would still lose `1` hit point.
+
+Your damage score and armor score both start at zero. They can be increased by buying items in exchange for gold. You start with no items and have as much gold as you need. Your total damage or armor is equal to the sum of those stats from all of your items. You have *100 hit points*.
+
+Here is what the item shop is selling:
+
+```
+Weapons: Cost Damage Armor
+Dagger 8 4 0
+Shortsword 10 5 0
+Warhammer 25 6 0
+Longsword 40 7 0
+Greataxe 74 8 0
+
+Armor: Cost Damage Armor
+Leather 13 0 1
+Chainmail 31 0 2
+Splintmail 53 0 3
+Bandedmail 75 0 4
+Platemail 102 0 5
+
+Rings: Cost Damage Armor
+Damage +1 25 1 0
+Damage +2 50 2 0
+Damage +3 100 3 0
+Defense +1 20 0 1
+Defense +2 40 0 2
+Defense +3 80 0 3
+```
+
+You must buy exactly one weapon; no dual-wielding. Armor is optional, but you can't use more than one. You can buy 0-2 rings (at most one for each hand). You must use any items you buy. The shop only has one of each item, so you can't buy, for example, two rings of Damage +3.
+
+For example, suppose you have `8` hit points, `5` damage, and `5` armor, and that the boss has `12` hit points, `7` damage, and `2` armor:
+
+
+ - The player deals `5-2 = 3` damage; the boss goes down to 9 hit points.
+ - The boss deals `7-5 = 2` damage; the player goes down to 6 hit points.
+ - The player deals `5-2 = 3` damage; the boss goes down to 6 hit points.
+ - The boss deals `7-5 = 2` damage; the player goes down to 4 hit points.
+ - The player deals `5-2 = 3` damage; the boss goes down to 3 hit points.
+ - The boss deals `7-5 = 2` damage; the player goes down to 2 hit points.
+ - The player deals `5-2 = 3` damage; the boss goes down to 0 hit points.
+
+In this scenario, the player wins! (Barely.)
+
+You have *100 hit points*. The boss's actual stats are in your puzzle input. What is *the least amount of gold you can spend* and still win the fight?
+
+
+## --- Part Two ---
+Turns out the shopkeeper is working with the boss, and can persuade you to buy whatever items he wants. The other rules still apply, and he still only has one of each item.
+
+What is the *most* amount of gold you can spend and still *lose* the fight?
+
+
diff --git a/2015/Day21/input.in b/2015/Day21/input.in
index 86a205cfd..e74905192 100644
Binary files a/2015/Day21/input.in and b/2015/Day21/input.in differ
diff --git a/2015/Day22/README.md b/2015/Day22/README.md
index 26a245daa..a2659cf82 100644
--- a/2015/Day22/README.md
+++ b/2015/Day22/README.md
@@ -1,6 +1,125 @@
+original source: [https://adventofcode.com/2015/day/22](https://adventofcode.com/2015/day/22)
## --- Day 22: Wizard Simulator 20XX ---
Little Henry Case decides that defeating bosses with [swords and stuff](21) is boring. Now he's playing the game with a wizard. Of course, he gets stuck on another boss and needs your help again.
In this version, combat still proceeds with the player and the boss taking alternating turns. The player still goes first. Now, however, you don't get any equipment; instead, you must choose one of your spells to cast. The first character at or below `0` hit points loses.
-Read the [full puzzle](https://adventofcode.com/2015/day/22).
\ No newline at end of file
+Since you're a wizard, you don't get to wear armor, and you can't attack normally. However, since you do *magic damage*, your opponent's armor is ignored, and so the boss effectively has zero armor as well. As before, if armor (from a spell, in this case) would reduce damage below `1`, it becomes `1` instead - that is, the boss' attacks always deal at least `1` damage.
+
+On each of your turns, you must select one of your spells to cast. If you cannot afford to cast any spell, you lose. Spells cost *mana*; you start with *500* mana, but have no maximum limit. You must have enough mana to cast a spell, and its cost is immediately deducted when you cast it. Your spells are Magic Missile, Drain, Shield, Poison, and Recharge.
+
+
+ - *Magic Missile* costs `53` mana. It instantly does `4` damage.
+ - *Drain* costs `73` mana. It instantly does `2` damage and heals you for `2` hit points.
+ - *Shield* costs `113` mana. It starts an *effect* that lasts for `6` turns. While it is active, your armor is increased by `7`.
+ - *Poison* costs `173` mana. It starts an *effect* that lasts for `6` turns. At the start of each turn while it is active, it deals the boss `3` damage.
+ - *Recharge* costs `229` mana. It starts an *effect* that lasts for `5` turns. At the start of each turn while it is active, it gives you `101` new mana.
+
+*Effects* all work the same way. Effects apply at the start of both the player's turns and the boss' turns. Effects are created with a timer (the number of turns they last); at the start of each turn, after they apply any effect they have, their timer is decreased by one. If this decreases the timer to zero, the effect ends. You cannot cast a spell that would start an effect which is already active. However, effects can be started on the same turn they end.
+
+For example, suppose the player has `10` hit points and `250` mana, and that the boss has `13` hit points and `8` damage:
+
+```
+-- Player turn --
+- Player has 10 hit points, 0 armor, 250 mana
+- Boss has 13 hit points
+Player casts Poison.
+
+-- Boss turn --
+- Player has 10 hit points, 0 armor, 77 mana
+- Boss has 13 hit points
+Poison deals 3 damage; its timer is now 5.
+Boss attacks for 8 damage.
+
+-- Player turn --
+- Player has 2 hit points, 0 armor, 77 mana
+- Boss has 10 hit points
+Poison deals 3 damage; its timer is now 4.
+Player casts Magic Missile, dealing 4 damage.
+
+-- Boss turn --
+- Player has 2 hit points, 0 armor, 24 mana
+- Boss has 3 hit points
+Poison deals 3 damage. This kills the boss, and the player wins.
+```
+
+Now, suppose the same initial conditions, except that the boss has `14` hit points instead:
+
+```
+-- Player turn --
+- Player has 10 hit points, 0 armor, 250 mana
+- Boss has 14 hit points
+Player casts Recharge.
+
+-- Boss turn --
+- Player has 10 hit points, 0 armor, 21 mana
+- Boss has 14 hit points
+Recharge provides 101 mana; its timer is now 4.
+Boss attacks for 8 damage!
+
+-- Player turn --
+- Player has 2 hit points, 0 armor, 122 mana
+- Boss has 14 hit points
+Recharge provides 101 mana; its timer is now 3.
+Player casts Shield, increasing armor by 7.
+
+-- Boss turn --
+- Player has 2 hit points, 7 armor, 110 mana
+- Boss has 14 hit points
+Shield's timer is now 5.
+Recharge provides 101 mana; its timer is now 2.
+Boss attacks for 8 - 7 = 1 damage!
+
+-- Player turn --
+- Player has 1 hit point, 7 armor, 211 mana
+- Boss has 14 hit points
+Shield's timer is now 4.
+Recharge provides 101 mana; its timer is now 1.
+Player casts Drain, dealing 2 damage, and healing 2 hit points.
+
+-- Boss turn --
+- Player has 3 hit points, 7 armor, 239 mana
+- Boss has 12 hit points
+Shield's timer is now 3.
+Recharge provides 101 mana; its timer is now 0.
+Recharge wears off.
+Boss attacks for 8 - 7 = 1 damage!
+
+-- Player turn --
+- Player has 2 hit points, 7 armor, 340 mana
+- Boss has 12 hit points
+Shield's timer is now 2.
+Player casts Poison.
+
+-- Boss turn --
+- Player has 2 hit points, 7 armor, 167 mana
+- Boss has 12 hit points
+Shield's timer is now 1.
+Poison deals 3 damage; its timer is now 5.
+Boss attacks for 8 - 7 = 1 damage!
+
+-- Player turn --
+- Player has 1 hit point, 7 armor, 167 mana
+- Boss has 9 hit points
+Shield's timer is now 0.
+Shield wears off, decreasing armor by 7.
+Poison deals 3 damage; its timer is now 4.
+Player casts Magic Missile, dealing 4 damage.
+
+-- Boss turn --
+- Player has 1 hit point, 0 armor, 114 mana
+- Boss has 2 hit points
+Poison deals 3 damage. This kills the boss, and the player wins.
+```
+
+You start with *50 hit points* and *500 mana points*. The boss's actual stats are in your puzzle input. What is the *least amount of mana* you can spend and still win the fight? (Do not include mana recharge effects as "spending" negative mana.)
+
+
+## --- Part Two ---
+On the next run through the game, you increase the difficulty to *hard*.
+
+At the start of each *player turn* (before any other effects apply), you lose `1` hit point. If this brings you to or below `0` hit points, you lose.
+
+With the same starting stats for you and the boss, what is the *least amount of mana* you can spend and still win the fight?
+
+
diff --git a/2015/Day22/input.in b/2015/Day22/input.in
index c3d03ea5f..db93bd09a 100644
Binary files a/2015/Day22/input.in and b/2015/Day22/input.in differ
diff --git a/2015/Day23/README.md b/2015/Day23/README.md
index 03c6983b0..3b3556deb 100644
--- a/2015/Day23/README.md
+++ b/2015/Day23/README.md
@@ -1,6 +1,34 @@
+original source: [https://adventofcode.com/2015/day/23](https://adventofcode.com/2015/day/23)
## --- Day 23: Opening the Turing Lock ---
Little Jane Marie just got her very first computer for Christmas from some unknown benefactor. It comes with instructions and an example program, but the computer itself seems to be malfunctioning. She's curious what the program does, and would like you to help her run it.
The manual explains that the computer supports two [registers](https://en.wikipedia.org/wiki/Processor_register) and six [instructions](https://en.wikipedia.org/wiki/Instruction_set) (truly, it goes on to remind the reader, a state-of-the-art technology). The registers are named `a` and `b`, can hold any [non-negative integer](https://en.wikipedia.org/wiki/Natural_number), and begin with a value of `0`. The instructions are as follows:
-Read the [full puzzle](https://adventofcode.com/2015/day/23).
\ No newline at end of file
+
+ - `hlf r` sets register `r` to *half* its current value, then continues with the next instruction.
+ - `tpl r` sets register `r` to *triple* its current value, then continues with the next instruction.
+ - `inc r` *increments* register `r`, adding `1` to it, then continues with the next instruction.
+ - `jmp offset` is a *jump*; it continues with the instruction `offset` away *relative to itself*.
+ - `jie r, offset` is like `jmp`, but only jumps if register `r` is *even* ("jump if even").
+ - `jio r, offset` is like `jmp`, but only jumps if register `r` is `1` ("jump if *one*", not odd).
+
+All three jump instructions work with an *offset* relative to that instruction. The offset is always written with a prefix `+` or `-` to indicate the direction of the jump (forward or backward, respectively). For example, `jmp +1` would simply continue with the next instruction, while `jmp +0` would continuously jump back to itself forever.
+
+The program exits when it tries to run an instruction beyond the ones defined.
+
+For example, this program sets `a` to `2`, because the `jio` instruction causes it to skip the `tpl` instruction:
+
+```
+inc a
+jio a, +2
+tpl a
+inc a
+```
+
+What is *the value in register `b`* when the program in your puzzle input is finished executing?
+
+
+## --- Part Two ---
+The unknown benefactor is *very* thankful for releasi-- er, helping little Jane Marie with her computer. Definitely not to distract you, what is the value in register `b` after the program is finished executing if register `a` starts as `1` instead?
+
+
diff --git a/2015/Day23/input.in b/2015/Day23/input.in
index a34fa99f1..79d96248e 100644
Binary files a/2015/Day23/input.in and b/2015/Day23/input.in differ
diff --git a/2015/Day24/README.md b/2015/Day24/README.md
index c00ce7cf2..2c1c9f643 100644
--- a/2015/Day24/README.md
+++ b/2015/Day24/README.md
@@ -1,6 +1,60 @@
+original source: [https://adventofcode.com/2015/day/24](https://adventofcode.com/2015/day/24)
## --- Day 24: It Hangs in the Balance ---
It's Christmas Eve, and Santa is loading up the sleigh for this year's deliveries. However, there's one small problem: he can't get the sleigh to balance. If it isn't balanced, he can't defy physics, and nobody gets presents this year.
No pressure.
-Read the [full puzzle](https://adventofcode.com/2015/day/24).
\ No newline at end of file
+Santa has provided you a list of the weights of every package he needs to fit on the sleigh. The packages need to be split into *three groups of exactly the same weight*, and every package has to fit. The first group goes in the passenger compartment of the sleigh, and the second and third go in containers on either side. Only when all three groups weigh exactly the same amount will the sleigh be able to fly. Defying physics has rules, you know!
+
+Of course, that's not the only problem. The first group - the one going in the passenger compartment - needs *as few packages as possible* so that Santa has some legroom left over. It doesn't matter how many packages are in either of the other two groups, so long as all of the groups weigh the same.
+
+Furthermore, Santa tells you, if there are multiple ways to arrange the packages such that the fewest possible are in the first group, you need to choose the way where the first group has *the smallest quantum entanglement* to reduce the chance of any "complications". The quantum entanglement of a group of packages is the [product](https://en.wikipedia.org/wiki/Product_%28mathematics%29) of their weights, that is, the value you get when you multiply their weights together. Only consider quantum entanglement if the first group has the fewest possible number of packages in it and all groups weigh the same amount.
+
+For example, suppose you have ten packages with weights `1` through `5` and `7` through `11`. For this situation, some of the unique first groups, their quantum entanglements, and a way to divide the remaining packages are as follows:
+
+```
+Group 1; Group 2; Group 3
+11 9 (QE= 99); 10 8 2; 7 5 4 3 1
+10 9 1 (QE= 90); 11 7 2; 8 5 4 3
+10 8 2 (QE=160); 11 9; 7 5 4 3 1
+10 7 3 (QE=210); 11 9; 8 5 4 2 1
+10 5 4 1 (QE=200); 11 9; 8 7 3 2
+10 5 3 2 (QE=300); 11 9; 8 7 4 1
+10 4 3 2 1 (QE=240); 11 9; 8 7 5
+9 8 3 (QE=216); 11 7 2; 10 5 4 1
+9 7 4 (QE=252); 11 8 1; 10 5 3 2
+9 5 4 2 (QE=360); 11 8 1; 10 7 3
+8 7 5 (QE=280); 11 9; 10 4 3 2 1
+8 5 4 3 (QE=480); 11 9; 10 7 2 1
+7 5 4 3 1 (QE=420); 11 9; 10 8 2
+```
+
+Of these, although `10 9 1` has the smallest quantum entanglement (`90`), the configuration with only two packages, `11 9`, in the passenger compartment gives Santa the most legroom and wins. In this situation, the quantum entanglement for the ideal configuration is therefore `99`. Had there been two configurations with only two packages in the first group, the one with the smaller quantum entanglement would be chosen.
+
+What is the *quantum entanglement* of the first group of packages in the ideal configuration?
+
+
+## --- Part Two ---
+That's weird... the sleigh still isn't balancing.
+
+"Ho ho ho", Santa muses to himself. "I forgot the trunk".
+
+Balance the sleigh again, but this time, separate the packages into *four groups* instead of three. The other constraints still apply.
+
+Given the example packages above, this would be some of the new unique first groups, their quantum entanglements, and one way to divide the remaining packages:
+
+```
+
+11 4 (QE=44); 10 5; 9 3 2 1; 8 7
+10 5 (QE=50); 11 4; 9 3 2 1; 8 7
+9 5 1 (QE=45); 11 4; 10 3 2; 8 7
+9 4 2 (QE=72); 11 3 1; 10 5; 8 7
+9 3 2 1 (QE=54); 11 4; 10 5; 8 7
+8 7 (QE=56); 11 4; 10 5; 9 3 2 1
+```
+
+Of these, there are three arrangements that put the minimum (two) number of packages in the first group: `11 4`, `10 5`, and `8 7`. Of these, `11 4` has the lowest quantum entanglement, and so it is selected.
+
+Now, what is the *quantum entanglement* of the first group of packages in the ideal configuration?
+
+
diff --git a/2015/Day24/input.in b/2015/Day24/input.in
index 3d36932f3..502fad752 100644
Binary files a/2015/Day24/input.in and b/2015/Day24/input.in differ
diff --git a/2015/Day25/README.md b/2015/Day25/README.md
index 9107dfdd5..cbb486578 100644
--- a/2015/Day25/README.md
+++ b/2015/Day25/README.md
@@ -1,6 +1,57 @@
+original source: [https://adventofcode.com/2015/day/25](https://adventofcode.com/2015/day/25)
## --- Day 25: Let It Snow ---
Merry Christmas! Santa is booting up his weather machine; looks like you might get a [white Christmas](1) after all.
The weather machine beeps! On the console of the machine is a copy protection message asking you to [enter a code from the instruction manual](https://en.wikipedia.org/wiki/Copy_protection#Early_video_games). Apparently, it refuses to run unless you give it that code. No problem; you'll just look up the code in the--
-Read the [full puzzle](https://adventofcode.com/2015/day/25).
\ No newline at end of file
+"Ho ho ho", Santa ponders aloud. "I can't seem to find the manual."
+
+You look up the support number for the manufacturer and give them a call. Good thing, too - that 49th star wasn't going to earn itself.
+
+"Oh, that machine is quite old!", they tell you. "That model went out of support six minutes ago, and we just finished shredding all of the manuals. I bet we can find you the code generation algorithm, though."
+
+After putting you on hold for twenty minutes (your call is *very* important to them, it reminded you repeatedly), they finally find an engineer that remembers how the code system works.
+
+The codes are printed on an infinite sheet of paper, starting in the top-left corner. The codes are filled in by diagonals: starting with the first row with an empty first box, the codes are filled in diagonally up and to the right. This process repeats until the [infinite paper is covered](https://en.wikipedia.org/wiki/Cantor's_diagonal_argument). So, the first few codes are filled in in this order:
+
+```
+ | 1 2 3 4 5 6
+---+---+---+---+---+---+---+
+ 1 | 1 3 6 10 15 21
+ 2 | 2 5 9 14 20
+ 3 | 4 8 13 19
+ 4 | 7 12 18
+ 5 | 11 17
+ 6 | 16
+```
+
+For example, the 12th code would be written to row `4`, column `2`; the 15th code would be written to row `1`, column `5`.
+
+The voice on the other end of the phone continues with how the codes are actually generated. The first code is `20151125`. After that, each code is generated by taking the previous one, multiplying it by `252533`, and then keeping the remainder from dividing that value by `33554393`.
+
+So, to find the second code (which ends up in row `2`, column `1`), start with the previous value, `20151125`. Multiply it by `252533` to get `5088824049625`. Then, divide that by `33554393`, which leaves a remainder of `31916031`. That remainder is the second code.
+
+"Oh!", says the voice. "It looks like we missed a scrap from one of the manuals. Let me read it to you." You write down his numbers:
+
+```
+ | 1 2 3 4 5 6
+---+---------+---------+---------+---------+---------+---------+
+ 1 | 20151125 18749137 17289845 30943339 10071777 33511524
+ 2 | 31916031 21629792 16929656 7726640 15514188 4041754
+ 3 | 16080970 8057251 1601130 7981243 11661866 16474243
+ 4 | 24592653 32451966 21345942 9380097 10600672 31527494
+ 5 | 77061 17552253 28094349 6899651 9250759 31663883
+ 6 | 33071741 6796745 25397450 24659492 1534922 27995004
+```
+
+"Now remember", the voice continues, "that's not even all of the first few numbers; for example, you're missing the one at 7,1 that would come before 6,2. But, it should be enough to let your-- oh, it's time for lunch! Bye!" The call disconnects.
+
+Santa looks nervous. Your puzzle input contains the message on the machine's console. *What code do you give the machine?*
+
+
+## --- Part Two ---
+The machine springs to life, then falls silent again. It beeps. "Insufficient fuel", the console reads. "*Fifty stars* are required before proceeding. *One star* is available."
+
+..."one star is available"? You check the fuel tank; sure enough, a lone star sits at the bottom, awaiting its friends. Looks like you need to provide 49 yourself.
+
+
diff --git a/2015/Day25/input.in b/2015/Day25/input.in
index d4c53d3dd..08d9d8f8b 100644
Binary files a/2015/Day25/input.in and b/2015/Day25/input.in differ
diff --git a/2015/README.md b/2015/README.md
index a98cc6d87..e642371f9 100644
--- a/2015/README.md
+++ b/2015/README.md
@@ -1,4 +1,6 @@
+
# Advent of Code (2015)
Check out https://adventofcode.com/2015.
+
diff --git a/2015/SplashScreen.cs b/2015/SplashScreen.cs
index 64c664e9c..1277b4ae5 100644
--- a/2015/SplashScreen.cs
+++ b/2015/SplashScreen.cs
@@ -1,3 +1,4 @@
+
using System;
namespace AdventOfCode.Y2015;
@@ -8,507 +9,491 @@ public void Show() {
var color = Console.ForegroundColor;
Write(0xcc00, false, " ▄█▄ ▄▄█ ▄ ▄ ▄▄▄ ▄▄ ▄█▄ ▄▄▄ ▄█ ▄▄ ▄▄▄ ▄▄█ ▄▄▄\n █▄█ █ █ █ █ █▄█ █ █ █ █ █ █▄ ");
- Write(0xcc00, false, " █ █ █ █ █ █▄█\n █ █ █▄█ ▀▄▀ █▄▄ █ █ █▄ █▄█ █ █▄ █▄█ █▄█ █▄▄ {:year 2015}\n ");
- Write(0xcc00, false, "\n ");
- Write(0xffff66, true, "| \n \\|/ ");
- Write(0xffff66, true, "\n --*-- ");
- Write(0xcccccc, true, "25 ");
- Write(0xffff66, true, "**\n ");
- Write(0x9900, false, " >");
- Write(0xff9900, true, "o");
- Write(0x9900, false, "< ");
- Write(0xcccccc, false, "24 ");
- Write(0xffff66, false, "**\n ");
- Write(0x9900, false, " >>");
- Write(0x66ff, true, "O");
- Write(0x9900, false, "<< ");
- Write(0xcccccc, false, "23 ");
- Write(0xffff66, false, "**\n ");
- Write(0x9900, false, " >");
- Write(0xff9900, true, "o");
- Write(0x9900, false, ">>>");
- Write(0xff0000, true, "@");
- Write(0x9900, false, "< ");
- Write(0xcccccc, false, "22 ");
- Write(0xffff66, false, "**\n ");
- Write(0x9900, false, " >");
- Write(0xff0000, true, "@");
- Write(0x9900, false, "<<");
- Write(0xffff66, true, "*");
- Write(0x9900, false, "<");
- Write(0x66ff, true, "O");
- Write(0x9900, false, "<< ");
- Write(0xcccccc, false, "21 ");
- Write(0xffff66, false, "**\n ");
- Write(0x9900, false, " >>");
- Write(0xff9900, true, "o");
- Write(0x9900, false, ">>");
- Write(0x66ff, true, "O");
- Write(0x9900, false, ">");
- Write(0xff0000, true, "@");
- Write(0x9900, false, "<<< ");
- Write(0xcccccc, false, "20 ");
- Write(0xffff66, false, "**\n ");
- Write(0x9900, false, " >");
- Write(0xff9900, true, "o");
- Write(0x9900, false, ">");
- Write(0xff9900, true, "o");
- Write(0x9900, false, ">");
- Write(0x66ff, true, "O");
- Write(0x9900, false, ">>");
- Write(0xff0000, true, "@");
- Write(0x9900, false, "<<<< ");
- Write(0xcccccc, false, "19 ");
- Write(0xffff66, false, "**\n ");
- Write(0x9900, false, " >>");
- Write(0xff9900, true, "o");
- Write(0x9900, false, "<<<");
- Write(0x66ff, true, "O");
- Write(0x9900, false, "<");
- Write(0xff9900, true, "o");
- Write(0x9900, false, ">");
- Write(0xffff66, true, "*");
- Write(0x9900, false, "<");
- Write(0xffff66, true, "*");
- Write(0x9900, false, "<< ");
- Write(0xcccccc, false, "18 ");
- Write(0xffff66, false, "**\n ");
- Write(0x9900, false, " >");
- Write(0xff0000, true, "@");
- Write(0x9900, false, ">>>");
- Write(0xff9900, true, "o");
- Write(0x9900, false, ">>>");
- Write(0xff0000, true, "@");
- Write(0x9900, false, ">");
- Write(0xff9900, true, "o");
- Write(0x9900, false, "<<");
- Write(0x66ff, true, "O");
- Write(0x9900, false, "<< ");
- Write(0xcccccc, false, "17 ");
- Write(0xffff66, false, "**\n ");
- Write(0x9900, false, " >>");
- Write(0xffff66, true, "*");
- Write(0x9900, false, ">>");
- Write(0x66ff, true, "O");
- Write(0x9900, false, ">");
- Write(0xff0000, true, "@");
- Write(0x9900, false, ">>>");
- Write(0xffff66, true, "*");
- Write(0x9900, false, "<<<");
- Write(0xff9900, true, "o");
- Write(0x9900, false, ">");
- Write(0x66ff, true, "O");
- Write(0x9900, false, "< ");
- Write(0xcccccc, false, "16 ");
- Write(0xffff66, false, "**\n ");
- Write(0x9900, false, " >>");
- Write(0xff0000, true, "@");
- Write(0x9900, false, ">>");
- Write(0xff9900, true, "o");
- Write(0x9900, false, ">");
- Write(0xffff66, true, "*");
- Write(0x9900, false, ">>>");
- Write(0xff0000, true, "@");
- Write(0x9900, false, "<<<");
- Write(0x66ff, true, "O");
- Write(0x9900, false, "<");
- Write(0x66ff, true, "O");
- Write(0x9900, false, "<<< ");
- Write(0xcccccc, false, "15 ");
- Write(0xffff66, false, "**\n ");
- Write(0x9900, false, " >>");
- Write(0xff0000, true, "@");
- Write(0x9900, false, "<<");
- Write(0xff9900, true, "o");
- Write(0x9900, false, "<<<");
- Write(0xff0000, true, "@");
- Write(0x9900, false, ">>");
- Write(0xffff66, true, "*");
- Write(0x9900, false, "<<");
- Write(0xff0000, true, "@");
- Write(0x9900, false, ">");
- Write(0xff0000, true, "@");
- Write(0x9900, false, ">");
- Write(0xff0000, true, "@");
- Write(0x9900, false, ">");
- Write(0x66ff, true, "O");
- Write(0x9900, false, "< ");
- Write(0xcccccc, false, "14 ");
- Write(0xffff66, false, "**\n ");
- Write(0x9900, false, " >");
- Write(0xffff66, true, "*");
- Write(0x9900, false, "<<");
- Write(0x66ff, true, "O");
- Write(0x9900, false, ">>>");
- Write(0xffff66, true, "*");
- Write(0x9900, false, "<<");
- Write(0xffff66, true, "*");
- Write(0x9900, false, "<");
- Write(0xff0000, true, "@");
- Write(0x9900, false, "<");
- Write(0x66ff, true, "O");
- Write(0x9900, false, "<<<");
- Write(0x66ff, true, "O");
- Write(0x9900, false, "<<");
- Write(0x66ff, true, "O");
- Write(0x9900, false, "<< ");
- Write(0xcccccc, false, "13 ");
- Write(0xffff66, false, "**\n ");
- Write(0x9900, false, " >");
- Write(0xff0000, true, "@");
- Write(0x9900, false, ">>>");
- Write(0xff9900, true, "o");
- Write(0x9900, false, ">>>");
- Write(0xff0000, true, "@");
- Write(0x9900, false, "<");
- Write(0xff9900, true, "o");
- Write(0x9900, false, ">>");
- Write(0xff0000, true, "@");
- Write(0x9900, false, "<<");
- Write(0x66ff, true, "O");
- Write(0x9900, false, ">>>");
- Write(0x66ff, true, "O");
- Write(0x9900, false, "<<<");
- Write(0xff9900, true, "o");
- Write(0x9900, false, "< ");
- Write(0xcccccc, false, "12 ");
- Write(0xffff66, false, "**\n ");
- Write(0x9900, false, " >");
- Write(0xff9900, true, "o");
- Write(0x9900, false, ">");
- Write(0x66ff, true, "O");
- Write(0x9900, false, "<");
- Write(0xff0000, true, "@");
- Write(0x9900, false, "<<<");
- Write(0xff9900, true, "o");
- Write(0x9900, false, "<");
- Write(0xffff66, true, "*");
- Write(0x9900, false, ">");
- Write(0xff0000, true, "@");
- Write(0x9900, false, "<<");
- Write(0x66ff, true, "O");
- Write(0x9900, false, "<<<");
- Write(0x66ff, true, "O");
- Write(0x9900, false, ">>>");
- Write(0xffff66, true, "*");
- Write(0x9900, false, ">");
- Write(0x66ff, true, "O");
- Write(0x9900, false, "<< ");
- Write(0xcccccc, false, "11 ");
- Write(0xffff66, false, "**\n ");
- Write(0x9900, false, " >");
- Write(0xff0000, true, "@");
- Write(0x9900, false, ">");
- Write(0xffff66, true, "*");
- Write(0x9900, false, ">>>");
- Write(0xff9900, true, "o");
- Write(0x9900, false, ">>");
- Write(0xff0000, true, "@");
- Write(0x9900, false, "<");
- Write(0x66ff, true, "O");
- Write(0x9900, false, ">");
- Write(0xff9900, true, "o");
- Write(0x9900, false, ">");
- Write(0xff0000, true, "@");
- Write(0x9900, false, "<");
- Write(0x66ff, true, "O");
- Write(0x9900, false, ">>>");
- Write(0xff0000, true, "@");
- Write(0x9900, false, ">");
- Write(0xffff66, true, "*");
- Write(0x9900, false, ">");
- Write(0xff9900, true, "o");
- Write(0x9900, false, "<<");
- Write(0x66ff, true, "O");
- Write(0x9900, false, "< ");
- Write(0xcccccc, false, "10 ");
- Write(0xffff66, false, "**\n ");
- Write(0x9900, false, " >>");
- Write(0xff0000, true, "@");
- Write(0x9900, false, ">>>");
- Write(0xffff66, true, "*");
- Write(0x9900, false, ">>");
- Write(0xff9900, true, "o");
- Write(0x9900, false, "<");
- Write(0x66ff, true, "O");
- Write(0x9900, false, ">>>");
- Write(0xff9900, true, "o");
- Write(0x9900, false, ">");
- Write(0xff9900, true, "o");
- Write(0x9900, false, ">>");
- Write(0xff9900, true, "o");
- Write(0x9900, false, ">");
- Write(0x66ff, true, "O");
- Write(0x9900, false, "<<<");
- Write(0xffff66, true, "*");
- Write(0x9900, false, "<<<");
- Write(0x66ff, true, "O");
- Write(0x9900, false, "<< ");
- Write(0xcccccc, false, " 9 ");
- Write(0xffff66, false, "**\n ");
- Write(0x9900, false, " >>");
- Write(0xff0000, true, "@");
- Write(0x9900, false, "<");
- Write(0xff9900, true, "o");
- Write(0x9900, false, ">>");
- Write(0x66ff, true, "O");
- Write(0x9900, false, ">");
- Write(0x66ff, true, "O");
- Write(0x9900, false, "<");
- Write(0xffff66, true, "*");
- Write(0x9900, false, "<<");
- Write(0x66ff, true, "O");
- Write(0x9900, false, ">");
- Write(0x66ff, true, "O");
- Write(0x9900, false, ">>");
- Write(0xffff66, true, "*");
- Write(0x9900, false, "<");
- Write(0xffff66, true, "*");
- Write(0x9900, false, "<");
- Write(0xff9900, true, "o");
- Write(0x9900, false, "<<<");
- Write(0xffff66, true, "*");
- Write(0x9900, false, ">");
- Write(0xffff66, true, "*");
- Write(0x9900, false, "<");
- Write(0xff9900, true, "o");
- Write(0x9900, false, ">");
- Write(0xff9900, true, "o");
- Write(0x9900, false, "< ");
- Write(0xcccccc, false, " 8 ");
- Write(0xffff66, false, "**\n ");
- Write(0x9900, false, " >>");
- Write(0x66ff, true, "O");
- Write(0x9900, false, "<");
- Write(0x66ff, true, "O");
- Write(0x9900, false, "<");
- Write(0xff9900, true, "o");
- Write(0x9900, false, "<<");
- Write(0xff9900, true, "o");
- Write(0x9900, false, ">>");
- Write(0xff0000, true, "@");
- Write(0x9900, false, ">>");
- Write(0xff9900, true, "o");
- Write(0x9900, false, "<<");
- Write(0xffff66, true, "*");
- Write(0x9900, false, "<<<");
- Write(0xff9900, true, "o");
- Write(0x9900, false, ">>>");
- Write(0x66ff, true, "O");
- Write(0x9900, false, "<");
- Write(0xff9900, true, "o");
- Write(0x9900, false, "<<");
- Write(0xff9900, true, "o");
- Write(0x9900, false, ">");
- Write(0xffff66, true, "*");
- Write(0x9900, false, "<");
- Write(0xff0000, true, "@");
- Write(0x9900, false, "< ");
- Write(0xcccccc, false, " 7 ");
- Write(0xffff66, false, "**\n ");
- Write(0x9900, false, " >>");
- Write(0xff0000, true, "@");
- Write(0x9900, false, "<");
- Write(0xff9900, true, "o");
- Write(0x9900, false, ">>>");
- Write(0x66ff, true, "O");
- Write(0x9900, false, ">");
- Write(0x66ff, true, "O");
- Write(0x9900, false, "<");
- Write(0xff9900, true, "o");
- Write(0x9900, false, ">>");
- Write(0x66ff, true, "O");
- Write(0x9900, false, "<<<");
- Write(0xffff66, true, "*");
- Write(0x9900, false, "<");
- Write(0xff9900, true, "o");
- Write(0x9900, false, "<<");
- Write(0xff9900, true, "o");
- Write(0x9900, false, "<<");
- Write(0xffff66, true, "*");
- Write(0x9900, false, "<<");
- Write(0x66ff, true, "O");
- Write(0x9900, false, "<<");
- Write(0xff0000, true, "@");
- Write(0x9900, false, ">>>");
- Write(0xff9900, true, "o");
- Write(0x9900, false, "< ");
- Write(0xcccccc, false, " 6 ");
- Write(0xffff66, false, "**\n ");
- Write(0x9900, false, " >>");
- Write(0xff0000, true, "@");
- Write(0x9900, false, ">>>");
- Write(0x66ff, true, "O");
- Write(0x9900, false, ">");
- Write(0xff0000, true, "@");
- Write(0x9900, false, ">");
- Write(0xffff66, true, "*");
- Write(0x9900, false, "<<<");
- Write(0xff9900, true, "o");
- Write(0x9900, false, ">");
- Write(0xffff66, true, "*");
- Write(0x9900, false, ">");
- Write(0xff9900, true, "o");
- Write(0x9900, false, "<");
- Write(0xff9900, true, "o");
- Write(0x9900, false, ">>");
- Write(0xff0000, true, "@");
- Write(0x9900, false, "<<<");
- Write(0xff0000, true, "@");
- Write(0x9900, false, "<<");
- Write(0xffff66, true, "*");
- Write(0x9900, false, ">>");
- Write(0xff0000, true, "@");
- Write(0x9900, false, "<");
- Write(0x66ff, true, "O");
- Write(0x9900, false, "<<");
- Write(0xffff66, true, "*");
- Write(0x9900, false, "<< ");
- Write(0xcccccc, false, " 5 ");
- Write(0xffff66, false, "**\n ");
- Write(0x9900, false, " >>");
- Write(0x66ff, true, "O");
- Write(0x9900, false, "<<");
- Write(0x66ff, true, "O");
- Write(0x9900, false, "<<<");
- Write(0xffff66, true, "*");
- Write(0x9900, false, "<");
- Write(0xffff66, true, "*");
- Write(0x9900, false, "<<<");
- Write(0xffff66, true, "*");
- Write(0x9900, false, "<<");
- Write(0x66ff, true, "O");
- Write(0x9900, false, "<<");
- Write(0xff0000, true, "@");
- Write(0x9900, false, "<<");
- Write(0xff9900, true, "o");
- Write(0x9900, false, ">>");
- Write(0xffff66, true, "*");
- Write(0x9900, false, ">>");
- Write(0xff0000, true, "@");
- Write(0x9900, false, "<");
- Write(0x66ff, true, "O");
- Write(0x9900, false, "<<");
- Write(0xff9900, true, "o");
- Write(0x9900, false, "<<");
- Write(0xff0000, true, "@");
- Write(0x9900, false, "<<<< ");
- Write(0xcccccc, false, " 4 ");
- Write(0xffff66, false, "**\n ");
- Write(0x9900, false, " >");
- Write(0xff0000, true, "@");
- Write(0x9900, false, "<<");
- Write(0x66ff, true, "O");
- Write(0x9900, false, "<");
- Write(0xff0000, true, "@");
- Write(0x9900, false, ">>");
- Write(0x66ff, true, "O");
- Write(0x9900, false, ">>>");
- Write(0xffff66, true, "*");
- Write(0x9900, false, "<<");
- Write(0xff9900, true, "o");
- Write(0x9900, false, ">>>");
- Write(0xffff66, true, "*");
- Write(0x9900, false, ">");
- Write(0xff0000, true, "@");
- Write(0x9900, false, "<<");
- Write(0x66ff, true, "O");
- Write(0x9900, false, ">");
- Write(0x66ff, true, "O");
- Write(0x9900, false, ">");
- Write(0xffff66, true, "*");
- Write(0x9900, false, "<");
- Write(0x66ff, true, "O");
- Write(0x9900, false, ">>>");
- Write(0x66ff, true, "O");
- Write(0x9900, false, ">>");
- Write(0xff9900, true, "o");
- Write(0x9900, false, ">>>");
- Write(0xff0000, true, "@");
- Write(0x9900, false, "<< ");
- Write(0xcccccc, false, " 3 ");
- Write(0xffff66, false, "**\n ");
- Write(0x9900, false, " >>");
- Write(0xff0000, true, "@");
- Write(0x9900, false, "<");
- Write(0xff0000, true, "@");
- Write(0x9900, false, ">");
- Write(0xff9900, true, "o");
- Write(0x9900, false, "<<");
- Write(0xff9900, true, "o");
- Write(0x9900, false, "<<<");
- Write(0xff9900, true, "o");
- Write(0x9900, false, ">>>");
- Write(0x66ff, true, "O");
- Write(0x9900, false, "<");
- Write(0xff0000, true, "@");
- Write(0x9900, false, "<<");
- Write(0xffff66, true, "*");
- Write(0x9900, false, ">");
- Write(0xffff66, true, "*");
- Write(0x9900, false, ">>>");
- Write(0xffff66, true, "*");
- Write(0x9900, false, "<");
- Write(0xff0000, true, "@");
- Write(0x9900, false, "<");
- Write(0xff0000, true, "@");
- Write(0x9900, false, ">>>");
- Write(0xffff66, true, "*");
- Write(0x9900, false, "<");
- Write(0xffff66, true, "*");
- Write(0x9900, false, ">");
- Write(0x66ff, true, "O");
- Write(0x9900, false, "<");
- Write(0xff0000, true, "@");
- Write(0x9900, false, ">>");
- Write(0x66ff, true, "O");
- Write(0x9900, false, "< ");
- Write(0xcccccc, false, " 2 ");
- Write(0xffff66, false, "**\n ");
- Write(0x9900, false, ">>");
- Write(0xffff66, true, "*");
- Write(0x9900, false, ">>");
- Write(0xff0000, true, "@");
- Write(0x9900, false, ">");
- Write(0xffff66, true, "*");
- Write(0x9900, false, "<<<");
- Write(0xffff66, true, "*");
- Write(0x9900, false, "<<");
- Write(0xff0000, true, "@");
- Write(0x9900, false, ">>");
- Write(0x66ff, true, "O");
- Write(0x9900, false, "<");
- Write(0xffff66, true, "*");
- Write(0x9900, false, "<<");
- Write(0xffff66, true, "*");
- Write(0x9900, false, "<<");
- Write(0xffff66, true, "*");
- Write(0x9900, false, ">>>");
- Write(0xff9900, true, "o");
- Write(0x9900, false, ">>>");
- Write(0xff0000, true, "@");
- Write(0x9900, false, "<<");
- Write(0x66ff, true, "O");
- Write(0x9900, false, "<");
- Write(0xffff66, true, "*");
- Write(0x9900, false, "<");
- Write(0xffff66, true, "*");
- Write(0x9900, false, ">>");
- Write(0xffff66, true, "*");
- Write(0x9900, false, "<<");
- Write(0xff9900, true, "o");
- Write(0x9900, false, "<< ");
- Write(0xcccccc, false, " 1 ");
- Write(0xffff66, false, "**\n ");
- Write(0xcccccc, false, " | | \n | | ");
- Write(0xcccccc, false, " \n _ _ __ ___|___|___ __ _ _ \n ");
- Write(0xcccccc, false, " \n");
-
+ Write(0xcc00, false, " █ █ █ █ █ █▄█\n █ █ █▄█ ▀▄▀ █▄▄ █ █ █▄ █▄█ █ █▄ █▄█ █▄█ █▄▄ $year = 2015\n ");
+ Write(0xcc00, false, "\n ");
+ Write(0xffff66, true, "| \n \\|/ ");
+ Write(0xffff66, true, "\n --*-- ");
+ Write(0xcccccc, true, "25 ");
+ Write(0xffff66, true, "**\n ");
+ Write(0x9900, false, " >");
+ Write(0xff9900, true, "o");
+ Write(0x9900, false, "< ");
+ Write(0xcccccc, false, "24 ");
+ Write(0xffff66, false, "**\n ");
+ Write(0x9900, false, " >");
+ Write(0x66ff, true, "O");
+ Write(0x9900, false, "<<< ");
+ Write(0xcccccc, false, "23 ");
+ Write(0xffff66, false, "**\n ");
+ Write(0x9900, false, " >>");
+ Write(0xffff66, true, "*");
+ Write(0x9900, false, "<<");
+ Write(0x66ff, true, "O");
+ Write(0x9900, false, "< ");
+ Write(0xcccccc, false, "22 ");
+ Write(0xffff66, false, "**\n ");
+ Write(0x9900, false, " >>");
+ Write(0xff0000, true, "@");
+ Write(0x9900, false, "<");
+ Write(0xff9900, true, "o");
+ Write(0x9900, false, "<<<< ");
+ Write(0xcccccc, false, "21 ");
+ Write(0xffff66, false, "**\n ");
+ Write(0x9900, false, " >");
+ Write(0xffff66, true, "*");
+ Write(0x9900, false, ">>");
+ Write(0xff9900, true, "o");
+ Write(0x9900, false, ">");
+ Write(0xff0000, true, "@");
+ Write(0x9900, false, ">");
+ Write(0xffff66, true, "*");
+ Write(0x9900, false, "<< ");
+ Write(0xcccccc, false, "20 ");
+ Write(0xffff66, false, "**\n ");
+ Write(0x9900, false, " >>");
+ Write(0xff9900, true, "o");
+ Write(0x9900, false, ">");
+ Write(0xff9900, true, "o");
+ Write(0x9900, false, "<");
+ Write(0x66ff, true, "O");
+ Write(0x9900, false, "<");
+ Write(0xff9900, true, "o");
+ Write(0x9900, false, "<<");
+ Write(0xff0000, true, "@");
+ Write(0x9900, false, "< ");
+ Write(0xcccccc, false, "19 ");
+ Write(0xffff66, false, "**\n ");
+ Write(0x9900, false, " >>");
+ Write(0xff9900, true, "o");
+ Write(0x9900, false, ">");
+ Write(0x66ff, true, "O");
+ Write(0x9900, false, "<");
+ Write(0x66ff, true, "O");
+ Write(0x9900, false, ">");
+ Write(0xff0000, true, "@");
+ Write(0x9900, false, "<<");
+ Write(0xffff66, true, "*");
+ Write(0x9900, false, "<<< ");
+ Write(0xcccccc, false, "18 ");
+ Write(0xffff66, false, "**\n ");
+ Write(0x9900, false, " >");
+ Write(0xff9900, true, "o");
+ Write(0x9900, false, "<");
+ Write(0x66ff, true, "O");
+ Write(0x9900, false, "<");
+ Write(0x66ff, true, "O");
+ Write(0x9900, false, ">>");
+ Write(0xff9900, true, "o");
+ Write(0x9900, false, "<");
+ Write(0xff0000, true, "@");
+ Write(0x9900, false, "<<");
+ Write(0x66ff, true, "O");
+ Write(0x9900, false, "<");
+ Write(0xffff66, true, "*");
+ Write(0x9900, false, "< ");
+ Write(0xcccccc, false, "17 ");
+ Write(0xffff66, false, "**\n ");
+ Write(0x9900, false, " >");
+ Write(0x66ff, true, "O");
+ Write(0x9900, false, ">>");
+ Write(0xffff66, true, "*");
+ Write(0x9900, false, "<");
+ Write(0xff0000, true, "@");
+ Write(0x9900, false, "<");
+ Write(0xff9900, true, "o");
+ Write(0x9900, false, ">");
+ Write(0xff0000, true, "@");
+ Write(0x9900, false, ">>>");
+ Write(0x66ff, true, "O");
+ Write(0x9900, false, "<<");
+ Write(0x66ff, true, "O");
+ Write(0x9900, false, "< ");
+ Write(0xcccccc, false, "16 ");
+ Write(0xffff66, false, "**\n ");
+ Write(0x9900, false, " >>");
+ Write(0x66ff, true, "O");
+ Write(0x9900, false, ">>>");
+ Write(0xff0000, true, "@");
+ Write(0x9900, false, ">>");
+ Write(0xffff66, true, "*");
+ Write(0x9900, false, ">>");
+ Write(0xff9900, true, "o");
+ Write(0x9900, false, ">>>");
+ Write(0xff0000, true, "@");
+ Write(0x9900, false, "<");
+ Write(0x66ff, true, "O");
+ Write(0x9900, false, "<< ");
+ Write(0xcccccc, false, "15 ");
+ Write(0xffff66, false, "**\n ");
+ Write(0x9900, false, " >>");
+ Write(0xff9900, true, "o");
+ Write(0x9900, false, ">>");
+ Write(0xff9900, true, "o");
+ Write(0x9900, false, ">");
+ Write(0xff9900, true, "o");
+ Write(0x9900, false, ">");
+ Write(0xff9900, true, "o");
+ Write(0x9900, false, "<<<");
+ Write(0xff9900, true, "o");
+ Write(0x9900, false, ">");
+ Write(0xffff66, true, "*");
+ Write(0x9900, false, "<<<");
+ Write(0xff0000, true, "@");
+ Write(0x9900, false, ">");
+ Write(0xffff66, true, "*");
+ Write(0x9900, false, "< ");
+ Write(0xcccccc, false, "14 ");
+ Write(0xffff66, false, "**\n ");
+ Write(0x9900, false, " >>");
+ Write(0x66ff, true, "O");
+ Write(0x9900, false, "<<<");
+ Write(0xff9900, true, "o");
+ Write(0x9900, false, "<");
+ Write(0xff9900, true, "o");
+ Write(0x9900, false, ">>");
+ Write(0x66ff, true, "O");
+ Write(0x9900, false, "<");
+ Write(0xff0000, true, "@");
+ Write(0x9900, false, "<<");
+ Write(0xff9900, true, "o");
+ Write(0x9900, false, ">>>");
+ Write(0xffff66, true, "*");
+ Write(0x9900, false, "<<<< ");
+ Write(0xcccccc, false, "13 ");
+ Write(0xffff66, false, "**\n ");
+ Write(0x9900, false, " >>");
+ Write(0xff9900, true, "o");
+ Write(0x9900, false, ">");
+ Write(0xff9900, true, "o");
+ Write(0x9900, false, ">>");
+ Write(0xff0000, true, "@");
+ Write(0x9900, false, "<<");
+ Write(0x66ff, true, "O");
+ Write(0x9900, false, ">>");
+ Write(0xffff66, true, "*");
+ Write(0x9900, false, "<<");
+ Write(0xff0000, true, "@");
+ Write(0x9900, false, "<");
+ Write(0x66ff, true, "O");
+ Write(0x9900, false, ">>>");
+ Write(0xff0000, true, "@");
+ Write(0x9900, false, "<<<< ");
+ Write(0xcccccc, false, "12 ");
+ Write(0xffff66, false, "**\n ");
+ Write(0x9900, false, " >>");
+ Write(0xff9900, true, "o");
+ Write(0x9900, false, ">");
+ Write(0xff0000, true, "@");
+ Write(0x9900, false, ">");
+ Write(0xffff66, true, "*");
+ Write(0x9900, false, ">>");
+ Write(0xffff66, true, "*");
+ Write(0x9900, false, ">>>");
+ Write(0xff9900, true, "o");
+ Write(0x9900, false, "<<<");
+ Write(0x66ff, true, "O");
+ Write(0x9900, false, ">>>");
+ Write(0xff9900, true, "o");
+ Write(0x9900, false, "<");
+ Write(0xff9900, true, "o");
+ Write(0x9900, false, ">>>");
+ Write(0x66ff, true, "O");
+ Write(0x9900, false, "< ");
+ Write(0xcccccc, false, "11 ");
+ Write(0xffff66, false, "**\n ");
+ Write(0x9900, false, " >");
+ Write(0x66ff, true, "O");
+ Write(0x9900, false, "<<");
+ Write(0xffff66, true, "*");
+ Write(0x9900, false, ">");
+ Write(0xffff66, true, "*");
+ Write(0x9900, false, ">>");
+ Write(0xff0000, true, "@");
+ Write(0x9900, false, "<<<");
+ Write(0xffff66, true, "*");
+ Write(0x9900, false, ">>");
+ Write(0xff9900, true, "o");
+ Write(0x9900, false, "<");
+ Write(0xffff66, true, "*");
+ Write(0x9900, false, "<<<");
+ Write(0xffff66, true, "*");
+ Write(0x9900, false, "<");
+ Write(0xff9900, true, "o");
+ Write(0x9900, false, ">>>");
+ Write(0x66ff, true, "O");
+ Write(0x9900, false, "<< ");
+ Write(0xcccccc, false, "10 ");
+ Write(0xffff66, false, "**\n ");
+ Write(0x9900, false, " >>");
+ Write(0x66ff, true, "O");
+ Write(0x9900, false, ">");
+ Write(0xff9900, true, "o");
+ Write(0x9900, false, "<");
+ Write(0xffff66, true, "*");
+ Write(0x9900, false, ">");
+ Write(0x66ff, true, "O");
+ Write(0x9900, false, "<");
+ Write(0xff0000, true, "@");
+ Write(0x9900, false, ">>");
+ Write(0xff9900, true, "o");
+ Write(0x9900, false, "<");
+ Write(0xffff66, true, "*");
+ Write(0x9900, false, ">>>");
+ Write(0xff0000, true, "@");
+ Write(0x9900, false, ">>>");
+ Write(0xff0000, true, "@");
+ Write(0x9900, false, "<<<");
+ Write(0xffff66, true, "*");
+ Write(0x9900, false, ">>");
+ Write(0xff0000, true, "@");
+ Write(0x9900, false, "<< ");
+ Write(0xcccccc, false, " 9 ");
+ Write(0xffff66, false, "**\n ");
+ Write(0x9900, false, " >");
+ Write(0xff0000, true, "@");
+ Write(0x9900, false, ">>");
+ Write(0xff9900, true, "o");
+ Write(0x9900, false, "<<");
+ Write(0xff9900, true, "o");
+ Write(0x9900, false, ">>");
+ Write(0xffff66, true, "*");
+ Write(0x9900, false, ">");
+ Write(0xff9900, true, "o");
+ Write(0x9900, false, "<");
+ Write(0xff9900, true, "o");
+ Write(0x9900, false, "<<");
+ Write(0x66ff, true, "O");
+ Write(0x9900, false, ">>");
+ Write(0xffff66, true, "*");
+ Write(0x9900, false, "<<<");
+ Write(0x66ff, true, "O");
+ Write(0x9900, false, "<");
+ Write(0xff9900, true, "o");
+ Write(0x9900, false, ">>>");
+ Write(0xff9900, true, "o");
+ Write(0x9900, false, "<");
+ Write(0xff9900, true, "o");
+ Write(0x9900, false, "<< ");
+ Write(0xcccccc, false, " 8 ");
+ Write(0xffff66, false, "**\n ");
+ Write(0x9900, false, " >>");
+ Write(0xffff66, true, "*");
+ Write(0x9900, false, ">>");
+ Write(0xffff66, true, "*");
+ Write(0x9900, false, "<<");
+ Write(0x66ff, true, "O");
+ Write(0x9900, false, ">>>");
+ Write(0xff0000, true, "@");
+ Write(0x9900, false, "<");
+ Write(0xff9900, true, "o");
+ Write(0x9900, false, "<");
+ Write(0x66ff, true, "O");
+ Write(0x9900, false, ">>>");
+ Write(0xff0000, true, "@");
+ Write(0x9900, false, "<<<");
+ Write(0x66ff, true, "O");
+ Write(0x9900, false, "<");
+ Write(0xff0000, true, "@");
+ Write(0x9900, false, ">>");
+ Write(0x66ff, true, "O");
+ Write(0x9900, false, ">>");
+ Write(0x66ff, true, "O");
+ Write(0x9900, false, ">>");
+ Write(0xff9900, true, "o");
+ Write(0x9900, false, "< ");
+ Write(0xcccccc, false, " 7 ");
+ Write(0xffff66, false, "**\n ");
+ Write(0x9900, false, " >>");
+ Write(0xff9900, true, "o");
+ Write(0x9900, false, ">");
+ Write(0xffff66, true, "*");
+ Write(0x9900, false, ">>>");
+ Write(0xffff66, true, "*");
+ Write(0x9900, false, "<");
+ Write(0xffff66, true, "*");
+ Write(0x9900, false, ">");
+ Write(0xffff66, true, "*");
+ Write(0x9900, false, "<<<");
+ Write(0xff0000, true, "@");
+ Write(0x9900, false, "<<<");
+ Write(0xffff66, true, "*");
+ Write(0x9900, false, ">>>");
+ Write(0xff9900, true, "o");
+ Write(0x9900, false, "<<");
+ Write(0xffff66, true, "*");
+ Write(0x9900, false, ">>");
+ Write(0xff0000, true, "@");
+ Write(0x9900, false, ">");
+ Write(0xff9900, true, "o");
+ Write(0x9900, false, ">>");
+ Write(0xff0000, true, "@");
+ Write(0x9900, false, "<<< ");
+ Write(0xcccccc, false, " 6 ");
+ Write(0xffff66, false, "**\n ");
+ Write(0x9900, false, " >>");
+ Write(0xff9900, true, "o");
+ Write(0x9900, false, ">>>");
+ Write(0xff0000, true, "@");
+ Write(0x9900, false, "<<<");
+ Write(0xff9900, true, "o");
+ Write(0x9900, false, ">>");
+ Write(0x66ff, true, "O");
+ Write(0x9900, false, "<<<");
+ Write(0xffff66, true, "*");
+ Write(0x9900, false, "<<");
+ Write(0xffff66, true, "*");
+ Write(0x9900, false, ">>");
+ Write(0xff9900, true, "o");
+ Write(0x9900, false, ">");
+ Write(0x66ff, true, "O");
+ Write(0x9900, false, ">>");
+ Write(0xff9900, true, "o");
+ Write(0x9900, false, ">");
+ Write(0xff9900, true, "o");
+ Write(0x9900, false, ">>");
+ Write(0x66ff, true, "O");
+ Write(0x9900, false, "<<<");
+ Write(0x66ff, true, "O");
+ Write(0x9900, false, "<<< ");
+ Write(0xcccccc, false, " 5 ");
+ Write(0xffff66, false, "**\n ");
+ Write(0x9900, false, " >");
+ Write(0xff0000, true, "@");
+ Write(0x9900, false, "<");
+ Write(0xffff66, true, "*");
+ Write(0x9900, false, ">");
+ Write(0xff0000, true, "@");
+ Write(0x9900, false, ">");
+ Write(0xff0000, true, "@");
+ Write(0x9900, false, ">");
+ Write(0xff9900, true, "o");
+ Write(0x9900, false, "<<");
+ Write(0xffff66, true, "*");
+ Write(0x9900, false, ">");
+ Write(0xff0000, true, "@");
+ Write(0x9900, false, "<");
+ Write(0xffff66, true, "*");
+ Write(0x9900, false, "<<");
+ Write(0x66ff, true, "O");
+ Write(0x9900, false, "<<<");
+ Write(0xffff66, true, "*");
+ Write(0x9900, false, "<<");
+ Write(0xff9900, true, "o");
+ Write(0x9900, false, "<<<");
+ Write(0x66ff, true, "O");
+ Write(0x9900, false, ">");
+ Write(0xff9900, true, "o");
+ Write(0x9900, false, "<<<");
+ Write(0xffff66, true, "*");
+ Write(0x9900, false, "<<<");
+ Write(0xff9900, true, "o");
+ Write(0x9900, false, "<< ");
+ Write(0xcccccc, false, " 4 ");
+ Write(0xffff66, false, "**\n ");
+ Write(0x9900, false, " >");
+ Write(0xff0000, true, "@");
+ Write(0x9900, false, "<<<");
+ Write(0xffff66, true, "*");
+ Write(0x9900, false, "<<");
+ Write(0xff9900, true, "o");
+ Write(0x9900, false, ">>>");
+ Write(0xffff66, true, "*");
+ Write(0x9900, false, ">>>");
+ Write(0xffff66, true, "*");
+ Write(0x9900, false, ">>>");
+ Write(0xff9900, true, "o");
+ Write(0x9900, false, "<<<");
+ Write(0xffff66, true, "*");
+ Write(0x9900, false, "<<");
+ Write(0xff9900, true, "o");
+ Write(0x9900, false, ">");
+ Write(0xff9900, true, "o");
+ Write(0x9900, false, ">>");
+ Write(0xffff66, true, "*");
+ Write(0x9900, false, "<<");
+ Write(0xff9900, true, "o");
+ Write(0x9900, false, "<<");
+ Write(0xff0000, true, "@");
+ Write(0x9900, false, ">>");
+ Write(0x66ff, true, "O");
+ Write(0x9900, false, "<<< ");
+ Write(0xcccccc, false, " 3 ");
+ Write(0xffff66, false, "**\n ");
+ Write(0x9900, false, " >>");
+ Write(0xff0000, true, "@");
+ Write(0x9900, false, "<");
+ Write(0xffff66, true, "*");
+ Write(0x9900, false, ">>");
+ Write(0xffff66, true, "*");
+ Write(0x9900, false, ">");
+ Write(0xff0000, true, "@");
+ Write(0x9900, false, "<");
+ Write(0xff9900, true, "o");
+ Write(0x9900, false, ">>>");
+ Write(0xff0000, true, "@");
+ Write(0x9900, false, ">>>");
+ Write(0xffff66, true, "*");
+ Write(0x9900, false, "<");
+ Write(0xff9900, true, "o");
+ Write(0x9900, false, "<<<");
+ Write(0xff9900, true, "o");
+ Write(0x9900, false, "<<");
+ Write(0x66ff, true, "O");
+ Write(0x9900, false, "<<<");
+ Write(0xff0000, true, "@");
+ Write(0x9900, false, ">>");
+ Write(0x66ff, true, "O");
+ Write(0x9900, false, "<<<");
+ Write(0xff0000, true, "@");
+ Write(0x9900, false, ">>");
+ Write(0x66ff, true, "O");
+ Write(0x9900, false, "<");
+ Write(0x66ff, true, "O");
+ Write(0x9900, false, "<< ");
+ Write(0xcccccc, false, " 2 ");
+ Write(0xffff66, false, "**\n ");
+ Write(0x9900, false, ">>");
+ Write(0xff0000, true, "@");
+ Write(0x9900, false, "<");
+ Write(0xff9900, true, "o");
+ Write(0x9900, false, "<<<");
+ Write(0xffff66, true, "*");
+ Write(0x9900, false, "<");
+ Write(0xffff66, true, "*");
+ Write(0x9900, false, ">>");
+ Write(0xff9900, true, "o");
+ Write(0x9900, false, ">");
+ Write(0xff0000, true, "@");
+ Write(0x9900, false, ">");
+ Write(0xff9900, true, "o");
+ Write(0x9900, false, "<<<");
+ Write(0xff9900, true, "o");
+ Write(0x9900, false, ">>>");
+ Write(0xff0000, true, "@");
+ Write(0x9900, false, ">>");
+ Write(0xffff66, true, "*");
+ Write(0x9900, false, "<<");
+ Write(0xff9900, true, "o");
+ Write(0x9900, false, ">>");
+ Write(0xffff66, true, "*");
+ Write(0x9900, false, ">>>");
+ Write(0xffff66, true, "*");
+ Write(0x9900, false, "<");
+ Write(0xff0000, true, "@");
+ Write(0x9900, false, ">>>");
+ Write(0x66ff, true, "O");
+ Write(0x9900, false, "<<<< ");
+ Write(0xcccccc, false, " 1 ");
+ Write(0xffff66, false, "**\n ");
+ Write(0xcccccc, false, " | | \n | | ");
+ Write(0xcccccc, false, " \n _ _ __ ___|___|___ __ _ _ \n ");
+ Write(0xcccccc, false, " \n");
+
Console.ForegroundColor = color;
Console.WriteLine();
}
- private static void Write(int rgb, bool bold, string text){
+ private static void Write(int rgb, bool bold, string text){
Console.Write($"\u001b[38;2;{(rgb>>16)&255};{(rgb>>8)&255};{rgb&255}{(bold ? ";1" : "")}m{text}");
- }
-}
\ No newline at end of file
+ }
+}
diff --git a/2015/calendar.svg b/2015/calendar.svg
index 40356baaa..433f90f6f 100644
--- a/2015/calendar.svg
+++ b/2015/calendar.svg
@@ -1,51 +1,51 @@
\ No newline at end of file
+
\ No newline at end of file
diff --git a/2016/Day01/README.md b/2016/Day01/README.md
index 4c302f2ce..2b6c1e8e6 100644
--- a/2016/Day01/README.md
+++ b/2016/Day01/README.md
@@ -1,6 +1,30 @@
+original source: [https://adventofcode.com/2016/day/1](https://adventofcode.com/2016/day/1)
## --- Day 1: No Time for a Taxicab ---
Santa's sleigh uses a very high-precision clock to guide its movements, and the clock's oscillator is regulated by stars. Unfortunately, the stars have been stolen... by the Easter Bunny. To save Christmas, Santa needs you to retrieve all fifty stars by December 25th.
Collect stars by solving puzzles. Two puzzles will be made available on each day in the Advent calendar; the second puzzle is unlocked when you complete the first. Each puzzle grants one star. Good luck!
-_Visit the website for the full story and [full puzzle](https://adventofcode.com/2016/day/1) description._
+You're airdropped near Easter Bunny Headquarters in a city somewhere. "Near", unfortunately, is as close as you can get - the instructions on the Easter Bunny Recruiting Document the Elves intercepted start here, and nobody had time to work them out further.
+
+The Document indicates that you should start at the given coordinates (where you just landed) and face North. Then, follow the provided sequence: either turn left (L) or right (R) 90 degrees, then walk forward the given number of blocks, ending at a new intersection.
+
+There's no time to follow such ridiculous instructions on foot, though, so you take a moment and work out the destination. Given that you can only walk on the [street grid of the city](https://en.wikipedia.org/wiki/Taxicab_geometry), how far is the shortest path to the destination?
+
+For example:
+
+
+ - Following R2, L3 leaves you 2 blocks East and 3 blocks North, or 5 blocks away.
+ - R2, R2, R2 leaves you 2 blocks due South of your starting position, which is 2 blocks away.
+ - R5, L5, R5, R3 leaves you 12 blocks away.
+
+How many blocks away is Easter Bunny HQ?
+
+
+## --- Part Two ---
+Then, you notice the instructions continue on the back of the Recruiting Document. Easter Bunny HQ is actually at the first location you visit twice.
+
+For example, if your instructions are R8, R4, R4, R8, the first location you visit twice is 4 blocks away, due East.
+
+How many blocks away is the first location you visit twice?
+
+
diff --git a/2016/Day01/input.in b/2016/Day01/input.in
index 687ec0109..94fce73c0 100644
Binary files a/2016/Day01/input.in and b/2016/Day01/input.in differ
diff --git a/2016/Day02/README.md b/2016/Day02/README.md
index 345a8b762..3f7b63bfa 100644
--- a/2016/Day02/README.md
+++ b/2016/Day02/README.md
@@ -1,6 +1,61 @@
+original source: [https://adventofcode.com/2016/day/2](https://adventofcode.com/2016/day/2)
## --- Day 2: Bathroom Security ---
You arrive at *Easter Bunny Headquarters* under cover of darkness. However, you left in such a rush that you forgot to use the bathroom! Fancy office buildings like this one usually have keypad locks on their bathrooms, so you search the front desk for the code.
"In order to improve security," the document you find says, "bathroom codes will no longer be written down. Instead, please memorize and follow the procedure below to access the bathrooms."
-Read the [full puzzle](https://adventofcode.com/2016/day/2).
\ No newline at end of file
+The document goes on to explain that each button to be pressed can be found by starting on the previous button and moving to adjacent buttons on the keypad: `U` moves up, `D` moves down, `L` moves left, and `R` moves right. Each line of instructions corresponds to one button, starting at the previous button (or, for the first line, *the "5" button*); press whatever button you're on at the end of each line. If a move doesn't lead to a button, ignore it.
+
+You can't hold it much longer, so you decide to figure out the code as you walk to the bathroom. You picture a keypad like this:
+
+```
+1 2 3
+4 5 6
+7 8 9
+```
+
+Suppose your instructions are:
+
+```
+ULL
+RRDDD
+LURDL
+UUUUD
+```
+
+
+ - You start at "5" and move up (to "2"), left (to "1"), and left (you can't, and stay on "1"), so the first button is `1`.
+ - Starting from the previous button ("1"), you move right twice (to "3") and then down three times (stopping at "9" after two moves and ignoring the third), ending up with `9`.
+ - Continuing from "9", you move left, up, right, down, and left, ending with `8`.
+ - Finally, you move up four times (stopping at "2"), then down once, ending with `5`.
+
+So, in this example, the bathroom code is `1985`.
+
+Your puzzle input is the instructions from the document you found at the front desk. What is the *bathroom code*?
+
+
+## --- Part Two ---
+
+You finally arrive at the bathroom (it's a several minute walk from the lobby so visitors can behold the many fancy conference rooms and water coolers on this floor) and go to punch in the code. Much to your bladder's dismay, the keypad is not at all like you imagined it. Instead, you are confronted with the result of hundreds of man-hours of bathroom-keypad-design meetings:
+
+```
+ 1
+ 2 3 4
+5 6 7 8 9
+ A B C
+ D
+```
+
+You still start at "5" and stop when you're at an edge, but given the same instructions as above, the outcome is very different:
+
+
+ - You start at "5" and don't move at all (up and left are both edges), ending at `5`.
+ - Continuing from "5", you move right twice and down three times (through "6", "7", "B", "D", "D"), ending at `D`.
+ - Then, from "D", you move five more times (through "D", "B", "C", "C", "B"), ending at `B`.
+ - Finally, after five more moves, you end at `3`.
+
+So, given the actual keypad layout, the code would be `5DB3`.
+
+Using the same instructions in your puzzle input, what is the correct *bathroom code*?
+
+
diff --git a/2016/Day02/input.in b/2016/Day02/input.in
index df0dff54a..e133bb645 100644
Binary files a/2016/Day02/input.in and b/2016/Day02/input.in differ
diff --git a/2016/Day03/README.md b/2016/Day03/README.md
index cd2bf19f7..cd1bf8693 100644
--- a/2016/Day03/README.md
+++ b/2016/Day03/README.md
@@ -1,6 +1,30 @@
+original source: [https://adventofcode.com/2016/day/3](https://adventofcode.com/2016/day/3)
## --- Day 3: Squares With Three Sides ---
Now that you can think clearly, you move deeper into the labyrinth of hallways and office furniture that makes up this part of Easter Bunny HQ. This must be a graphic design department; the walls are covered in specifications for triangles.
Or are they?
-Read the [full puzzle](https://adventofcode.com/2016/day/3).
\ No newline at end of file
+The design document gives the side lengths of each triangle it describes, but... `5 10 25`? Some of these aren't triangles. You can't help but mark the impossible ones.
+
+In a valid triangle, the sum of any two sides must be larger than the remaining side. For example, the "triangle" given above is impossible, because `5 + 10` is not larger than `25`.
+
+In your puzzle input, *how many* of the listed triangles are *possible*?
+
+
+## --- Part Two ---
+Now that you've helpfully marked up their design documents, it occurs to you that triangles are specified in groups of three *vertically*. Each set of three numbers in a column specifies a triangle. Rows are unrelated.
+
+For example, given the following specification, numbers with the same hundreds digit would be part of the same triangle:
+
+```
+101 301 501
+102 302 502
+103 303 503
+201 401 601
+202 402 602
+203 403 603
+```
+
+In your puzzle input, and instead reading by columns, *how many* of the listed triangles are *possible*?
+
+
diff --git a/2016/Day03/input.in b/2016/Day03/input.in
index 84fc5ad53..065758086 100644
Binary files a/2016/Day03/input.in and b/2016/Day03/input.in differ
diff --git a/2016/Day04/README.md b/2016/Day04/README.md
index 39105dd2f..84004a1c0 100644
--- a/2016/Day04/README.md
+++ b/2016/Day04/README.md
@@ -1,6 +1,31 @@
+original source: [https://adventofcode.com/2016/day/4](https://adventofcode.com/2016/day/4)
## --- Day 4: Security Through Obscurity ---
Finally, you come across an information kiosk with a list of rooms. Of course, the list is encrypted and full of decoy data, but the instructions to decode the list are barely hidden nearby. Better remove the decoy data first.
Each room consists of an encrypted name (lowercase letters separated by dashes) followed by a dash, a sector ID, and a checksum in square brackets.
-Read the [full puzzle](https://adventofcode.com/2016/day/4).
\ No newline at end of file
+A room is real (not a decoy) if the checksum is the five most common letters in the encrypted name, in order, with ties broken by alphabetization. For example:
+
+
+ - `aaaaa-bbb-z-y-x-123[abxyz]` is a real room because the most common letters are `a` (5), `b` (3), and then a tie between `x`, `y`, and `z`, which are listed alphabetically.
+ - `a-b-c-d-e-f-g-h-987[abcde]` is a real room because although the letters are all tied (1 of each), the first five are listed alphabetically.
+ - `not-a-real-room-404[oarel]` is a real room.
+ - `totally-real-room-200[decoy]` is not.
+
+Of the real rooms from the list above, the sum of their sector IDs is `1514`.
+
+What is the *sum of the sector IDs of the real rooms*?
+
+
+## --- Part Two ---
+With all the decoy data out of the way, it's time to decrypt this list and get moving.
+
+The room names are encrypted by a state-of-the-art [shift cipher](https://en.wikipedia.org/wiki/Caesar_cipher), which is nearly unbreakable without the right software. However, the information kiosk designers at Easter Bunny HQ were not expecting to deal with a master cryptographer like yourself.
+
+To decrypt a room name, rotate each letter forward through the alphabet a number of times equal to the room's sector ID. `A` becomes `B`, `B` becomes `C`, `Z` becomes `A`, and so on. Dashes become spaces.
+
+For example, the real name for `qzmt-zixmtkozy-ivhz-343` is `very encrypted name`.
+
+*What is the sector ID* of the room where North Pole objects are stored?
+
+
diff --git a/2016/Day04/input.in b/2016/Day04/input.in
index c951db70c..c80cd7b19 100644
Binary files a/2016/Day04/input.in and b/2016/Day04/input.in differ
diff --git a/2016/Day05/README.md b/2016/Day05/README.md
index e510a6e67..51944b377 100644
--- a/2016/Day05/README.md
+++ b/2016/Day05/README.md
@@ -1,6 +1,39 @@
+original source: [https://adventofcode.com/2016/day/5](https://adventofcode.com/2016/day/5)
## --- Day 5: How About a Nice Game of Chess? ---
You are faced with a security door designed by Easter Bunny engineers that seem to have acquired most of their security knowledge by watching [hacking](https://en.wikipedia.org/wiki/Hackers_(film)) [movies](https://en.wikipedia.org/wiki/WarGames).
The *eight-character password* for the door is generated one character at a time by finding the [MD5](https://en.wikipedia.org/wiki/MD5) hash of some Door ID (your puzzle input) and an increasing integer index (starting with `0`).
-Read the [full puzzle](https://adventofcode.com/2016/day/5).
\ No newline at end of file
+A hash indicates the *next character* in the password if its [hexadecimal](https://en.wikipedia.org/wiki/Hexadecimal) representation starts with *five zeroes*. If it does, the sixth character in the hash is the next character of the password.
+
+For example, if the Door ID is `abc`:
+
+
+ - The first index which produces a hash that starts with five zeroes is `3231929`, which we find by hashing `abc3231929`; the sixth character of the hash, and thus the first character of the password, is `1`.
+ - `5017308` produces the next interesting hash, which starts with `000008f82...`, so the second character of the password is `8`.
+ - The third time a hash starts with five zeroes is for `abc5278568`, discovering the character `f`.
+
+In this example, after continuing this search a total of eight times, the password is `18f47a30`.
+
+Given the actual Door ID, *what is the password*?
+
+
+## --- Part Two ---
+As the door slides open, you are presented with a second door that uses a slightly more inspired security mechanism. Clearly unimpressed by the last version (in what movie is the password decrypted *in order*?!), the Easter Bunny engineers have worked out [a better solution](https://www.youtube.com/watch?v=NHWjlCaIrQo&t=25).
+
+Instead of simply filling in the password from left to right, the hash now also indicates the *position* within the password to fill. You still look for hashes that begin with five zeroes; however, now, the *sixth* character represents the *position* (`0`-`7`), and the *seventh* character is the character to put in that position.
+
+A hash result of `000001f` means that `f` is the *second* character in the password. Use only the *first result* for each position, and ignore invalid positions.
+
+For example, if the Door ID is `abc`:
+
+
+ - The first interesting hash is from `abc3231929`, which produces `0000015...`; so, `5` goes in position `1`: `_5______`.
+ - In the previous method, `5017308` produced an interesting hash; however, it is ignored, because it specifies an invalid position (`8`).
+ - The second interesting hash is at index `5357525`, which produces `000004e...`; so, `e` goes in position `4`: `_5__e___`.
+
+You almost choke on your popcorn as the final character falls into place, producing the password `05ace8e3`.
+
+Given the actual Door ID and this new method, *what is the password*? Be extra proud of your solution if it uses a cinematic "decrypting" animation.
+
+
diff --git a/2016/Day05/Solution.cs b/2016/Day05/Solution.cs
index d050541bd..8294a3fcf 100644
--- a/2016/Day05/Solution.cs
+++ b/2016/Day05/Solution.cs
@@ -1,7 +1,5 @@
-using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
-using System.Globalization;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
@@ -10,52 +8,51 @@
namespace AdventOfCode.Y2016.Day05;
[ProblemName("How About a Nice Game of Chess?")]
-class Solution : Solver
-{
+class Solution : Solver {
- public object PartOne(string input)
- {
- return string.Join("", Hashes(input).Select(hash => hash[5]).Take(8));
+ public object PartOne(string input) {
+ var st = "";
+ foreach (var hash in Hashes(input)) {
+ st += hash[2].ToString("x");
+ if (st.Length == 8) {
+ break;
+ }
+ }
+ return st;
}
- public object PartTwo(string input)
- {
- var res = new char[8];
+ public object PartTwo(string input) {
+ var chars = Enumerable.Range(0, 8).Select(_ => (char)255).ToArray();
var found = 0;
- foreach (var hash in Hashes(input))
- {
- var idx = hash[5] - '0';
- if (0 <= idx && idx < 8 && res[idx] == 0)
- {
- res[idx] = hash[6];
- found++;
- if (found == 8) {
- break;
+ foreach (var hash in Hashes(input)) {
+ if (hash[2] < 8) {
+ var i = hash[2];
+ if (chars[i] == 255) {
+ chars[i] = hash[3].ToString("x2")[0];
+ found++;
+ if (found == 8) {
+ break;
+ }
}
+
}
-
}
- return string.Join("", res);
+ return string.Join("", chars);
}
- public IEnumerable Hashes(string input)
- {
+ public IEnumerable Hashes(string input) {
- for (var i = 0; i < int.MaxValue; i++)
- {
- var q = new ConcurrentQueue<(int i, string hash)>();
+ for (var i = 0; i < int.MaxValue; i++) {
+ var q = new ConcurrentQueue<(int i, byte[] hash)>();
Parallel.ForEach(
- NumbersFrom(i),
+ Enumerable.Range(i, int.MaxValue - i),
() => MD5.Create(),
- (i, state, md5) =>
- {
+ (i, state, md5) => {
var hash = md5.ComputeHash(Encoding.ASCII.GetBytes(input + i));
- var hashString = string.Join("", hash.Select(x => x.ToString("x2")));
- if (hashString.StartsWith("00000"))
- {
- q.Enqueue((i, hashString));
+ if (hash[0] == 0 && hash[1] == 0 && hash[2] < 16) {
+ q.Enqueue((i, hash));
state.Stop();
}
return md5;
@@ -67,9 +64,4 @@ public IEnumerable Hashes(string input)
yield return item.hash;
}
}
-
- IEnumerable NumbersFrom(int i)
- {
- for (;;) yield return i++;
- }
}
diff --git a/2016/Day05/input.in b/2016/Day05/input.in
index b5738f5d8..a9c42a42e 100644
Binary files a/2016/Day05/input.in and b/2016/Day05/input.in differ
diff --git a/2016/Day06/README.md b/2016/Day06/README.md
index d93688e72..fea2ad691 100644
--- a/2016/Day06/README.md
+++ b/2016/Day06/README.md
@@ -1,6 +1,42 @@
+original source: [https://adventofcode.com/2016/day/6](https://adventofcode.com/2016/day/6)
## --- Day 6: Signals and Noise ---
Something is jamming your communications with Santa. Fortunately, your signal is only partially jammed, and protocol in situations like this is to switch to a simple [repetition code](https://en.wikipedia.org/wiki/Repetition_code) to get the message through.
In this model, the same message is sent repeatedly. You've recorded the repeating message signal (your puzzle input), but the data seems quite corrupted - almost too badly to recover. *Almost*.
-Read the [full puzzle](https://adventofcode.com/2016/day/6).
\ No newline at end of file
+All you need to do is figure out which character is most frequent for each position. For example, suppose you had recorded the following messages:
+
+```
+eedadn
+drvtee
+eandsr
+raavrd
+atevrs
+tsrnev
+sdttsa
+rasrtv
+nssdts
+ntnada
+svetve
+tesnvt
+vntsnd
+vrdear
+dvrsen
+enarar
+```
+
+The most common character in the first column is `e`; in the second, `a`; in the third, `s`, and so on. Combining these characters returns the error-corrected message, `easter`.
+
+Given the recording in your puzzle input, *what is the error-corrected version* of the message being sent?
+
+
+## --- Part Two ---
+Of course, that *would* be the message - if you hadn't agreed to use a *modified repetition code* instead.
+
+In this modified code, the sender instead transmits what looks like random data, but for each character, the character they actually want to send is *slightly less likely* than the others. Even after signal-jamming noise, you can look at the letter distributions in each column and choose the *least common* letter to reconstruct the original message.
+
+In the above example, the least common character in the first column is `a`; in the second, `d`, and so on. Repeating this process for the remaining characters produces the original message, `advent`.
+
+Given the recording in your puzzle input and this new decoding methodology, *what is the original message* that Santa is trying to send?
+
+
diff --git a/2016/Day06/input.in b/2016/Day06/input.in
index 9873339f3..f2d83a79f 100644
Binary files a/2016/Day06/input.in and b/2016/Day06/input.in differ
diff --git a/2016/Day07/README.md b/2016/Day07/README.md
index 089886307..8dec7d175 100644
--- a/2016/Day07/README.md
+++ b/2016/Day07/README.md
@@ -1,6 +1,33 @@
+original source: [https://adventofcode.com/2016/day/7](https://adventofcode.com/2016/day/7)
## --- Day 7: Internet Protocol Version 7 ---
While snooping around the local network of EBHQ, you compile a list of [IP addresses](https://en.wikipedia.org/wiki/IP_address) (they're IPv7, of course; [IPv6](https://en.wikipedia.org/wiki/IPv6) is much too limited). You'd like to figure out which IPs support *TLS* (transport-layer snooping).
An IP supports TLS if it has an Autonomous Bridge Bypass Annotation, or *ABBA*. An ABBA is any four-character sequence which consists of a pair of two different characters followed by the reverse of that pair, such as `xyyx` or `abba`. However, the IP also must not have an ABBA within any hypernet sequences, which are contained by *square brackets*.
-Read the [full puzzle](https://adventofcode.com/2016/day/7).
\ No newline at end of file
+For example:
+
+
+ - `abba[mnop]qrst` supports TLS (`abba` outside square brackets).
+ - `abcd[bddb]xyyx` does *not* support TLS (`bddb` is within square brackets, even though `xyyx` is outside square brackets).
+ - `aaaa[qwer]tyui` does *not* support TLS (`aaaa` is invalid; the interior characters must be different).
+ - `ioxxoj[asdfgh]zxcvbn` supports TLS (`oxxo` is outside square brackets, even though it's within a larger string).
+
+*How many IPs* in your puzzle input support TLS?
+
+
+## --- Part Two ---
+You would also like to know which IPs support *SSL* (super-secret listening).
+
+An IP supports SSL if it has an Area-Broadcast Accessor, or *ABA*, anywhere in the supernet sequences (outside any square bracketed sections), and a corresponding Byte Allocation Block, or *BAB*, anywhere in the hypernet sequences. An ABA is any three-character sequence which consists of the same character twice with a different character between them, such as `xyx` or `aba`. A corresponding BAB is the same characters but in reversed positions: `yxy` and `bab`, respectively.
+
+For example:
+
+
+ - `aba[bab]xyz` supports SSL (`aba` outside square brackets with corresponding `bab` within square brackets).
+ - `xyx[xyx]xyx` does *not* support SSL (`xyx`, but no corresponding `yxy`).
+ - `aaa[kek]eke` supports SSL (`eke` in supernet with corresponding `kek` in hypernet; the `aaa` sequence is not related, because the interior character must be different).
+ - `zazbz[bzb]cdb` supports SSL (`zaz` has no corresponding `aza`, but `zbz` has a corresponding `bzb`, even though `zaz` and `zbz` overlap).
+
+*How many IPs* in your puzzle input support SSL?
+
+
diff --git a/2016/Day07/input.in b/2016/Day07/input.in
index ec26a4f10..d50f36cdd 100644
Binary files a/2016/Day07/input.in and b/2016/Day07/input.in differ
diff --git a/2016/Day08/README.md b/2016/Day08/README.md
index 6f22b40ab..50c12f772 100644
--- a/2016/Day08/README.md
+++ b/2016/Day08/README.md
@@ -1,6 +1,58 @@
+original source: [https://adventofcode.com/2016/day/8](https://adventofcode.com/2016/day/8)
## --- Day 8: Two-Factor Authentication ---
You come across a door implementing what you can only assume is an implementation of [two-factor authentication](https://en.wikipedia.org/wiki/Multi-factor_authentication) after a long game of [requirements](https://en.wikipedia.org/wiki/Requirement) [telephone](https://en.wikipedia.org/wiki/Chinese_whispers).
To get past the door, you first swipe a keycard (no problem; there was one on a nearby desk). Then, it displays a code on a [little screen](https://www.google.com/search?q=tiny+lcd&tbm=isch), and you type that code on a keypad. Then, presumably, the door unlocks.
-Read the [full puzzle](https://adventofcode.com/2016/day/8).
\ No newline at end of file
+Unfortunately, the screen has been smashed. After a few minutes, you've taken everything apart and figured out how it works. Now you just have to work out what the screen *would* have displayed.
+
+The magnetic strip on the card you swiped encodes a series of instructions for the screen; these instructions are your puzzle input. The screen is *`50` pixels wide and `6` pixels tall*, all of which start *off*, and is capable of three somewhat peculiar operations:
+
+
+ - `rect AxB` turns *on* all of the pixels in a rectangle at the top-left of the screen which is `A` wide and `B` tall.
+ - `rotate row y=A by B` shifts all of the pixels in row `A` (0 is the top row) *right* by `B` pixels. Pixels that would fall off the right end appear at the left end of the row.
+ - `rotate column x=A by B` shifts all of the pixels in column `A` (0 is the left column) *down* by `B` pixels. Pixels that would fall off the bottom appear at the top of the column.
+
+For example, here is a simple sequence on a smaller screen:
+
+
+ - `rect 3x2` creates a small rectangle in the top-left corner:
+```
+###....
+###....
+.......
+```
+
+ - `rotate column x=1 by 1` rotates the second column down by one pixel:
+```
+#.#....
+###....
+.#.....
+```
+
+ - `rotate row y=0 by 4` rotates the top row right by four pixels:
+```
+....#.#
+###....
+.#.....
+```
+
+ - `rotate column x=1 by 1` again rotates the second column down by one pixel, causing the bottom pixel to wrap back to the top:
+```
+.#..#.#
+#.#....
+.#.....
+```
+
+
+As you can see, this display technology is extremely powerful, and will soon dominate the tiny-code-displaying-screen market. That's what the advertisement on the back of the display tries to convince you, anyway.
+
+There seems to be an intermediate check of the voltage used by the display: after you swipe your card, if the screen did work, *how many pixels should be lit?*
+
+
+## --- Part Two ---
+You notice that the screen is only capable of displaying capital letters; in the font it uses, each letter is `5` pixels wide and `6` tall.
+
+After you swipe your card, *what code is the screen trying to display?*
+
+
diff --git a/2016/Day08/input.in b/2016/Day08/input.in
index 09aee8aee..cdc78427c 100644
Binary files a/2016/Day08/input.in and b/2016/Day08/input.in differ
diff --git a/2016/Day09/README.md b/2016/Day09/README.md
index 594534d99..2487c3213 100644
--- a/2016/Day09/README.md
+++ b/2016/Day09/README.md
@@ -1,6 +1,39 @@
+original source: [https://adventofcode.com/2016/day/9](https://adventofcode.com/2016/day/9)
## --- Day 9: Explosives in Cyberspace ---
Wandering around a secure area, you come across a datalink port to a new part of the network. After briefly scanning it for interesting files, you find one file in particular that catches your attention. It's compressed with an experimental format, but fortunately, the documentation for the format is nearby.
The format compresses a sequence of characters. Whitespace is ignored. To indicate that some sequence should be repeated, a marker is added to the file, like `(10x2)`. To decompress this marker, take the subsequent `10` characters and repeat them `2` times. Then, continue reading the file *after* the repeated data. The marker itself is not included in the decompressed output.
-Read the [full puzzle](https://adventofcode.com/2016/day/9).
\ No newline at end of file
+If parentheses or other characters appear within the data referenced by a marker, that's okay - treat it like normal data, not a marker, and then resume looking for markers after the decompressed section.
+
+For example:
+
+
+ - `ADVENT` contains no markers and decompresses to itself with no changes, resulting in a decompressed length of `6`.
+ - `A(1x5)BC` repeats only the `B` a total of `5` times, becoming `ABBBBBC` for a decompressed length of `7`.
+ - `(3x3)XYZ` becomes `XYZXYZXYZ` for a decompressed length of `9`.
+ - `A(2x2)BCD(2x2)EFG` doubles the `BC` and `EF`, becoming `ABCBCDEFEFG` for a decompressed length of `11`.
+ - `(6x1)(1x3)A` simply becomes `(1x3)A` - the `(1x3)` looks like a marker, but because it's within a data section of another marker, it is not treated any differently from the `A` that comes after it. It has a decompressed length of `6`.
+ - `X(8x2)(3x3)ABCY` becomes `X(3x3)ABC(3x3)ABCY` (for a decompressed length of `18`), because the decompressed data from the `(8x2)` marker (the `(3x3)ABC`) is skipped and not processed further.
+
+What is the *decompressed length* of the file (your puzzle input)? Don't count whitespace.
+
+
+## --- Part Two ---
+Apparently, the file actually uses *version two* of the format.
+
+In version two, the only difference is that markers within decompressed data *are* decompressed. This, the documentation explains, provides much more substantial compression capabilities, allowing many-gigabyte files to be stored in only a few kilobytes.
+
+For example:
+
+
+ - `(3x3)XYZ` still becomes `XYZXYZXYZ`, as the decompressed section contains no markers.
+ - `X(8x2)(3x3)ABCY` becomes `XABCABCABCABCABCABCY`, because the decompressed data from the `(8x2)` marker is then further decompressed, thus triggering the `(3x3)` marker twice for a total of six `ABC` sequences.
+ - `(27x12)(20x12)(13x14)(7x10)(1x12)A` decompresses into a string of `A` repeated `241920` times.
+ - `(25x3)(3x3)ABC(2x3)XY(5x2)PQRSTX(18x9)(3x2)TWO(5x7)SEVEN` becomes `445` characters long.
+
+Unfortunately, the computer you brought probably doesn't have enough memory to actually decompress the file; you'll have to *come up with another way* to get its decompressed length.
+
+What is the *decompressed length* of the file using this improved format?
+
+
diff --git a/2016/Day09/input.in b/2016/Day09/input.in
index 84798735c..3ccde7816 100644
Binary files a/2016/Day09/input.in and b/2016/Day09/input.in differ
diff --git a/2016/Day10/README.md b/2016/Day10/README.md
index d03015e16..d0a9854cd 100644
--- a/2016/Day10/README.md
+++ b/2016/Day10/README.md
@@ -1,6 +1,36 @@
+original source: [https://adventofcode.com/2016/day/10](https://adventofcode.com/2016/day/10)
## --- Day 10: Balance Bots ---
You come upon a factory in which many robots are [zooming around](https://www.youtube.com/watch?v=JnkMyfQ5YfY&t=40) handing small microchips to each other.
Upon closer examination, you notice that each bot only proceeds when it has *two* microchips, and once it does, it gives each one to a different bot or puts it in a marked "output" bin. Sometimes, bots take microchips from "input" bins, too.
-Read the [full puzzle](https://adventofcode.com/2016/day/10).
\ No newline at end of file
+Inspecting one of the microchips, it seems like they each contain a single number; the bots must use some logic to decide what to do with each chip. You access the local control computer and download the bots' instructions (your puzzle input).
+
+Some of the instructions specify that a specific-valued microchip should be given to a specific bot; the rest of the instructions indicate what a given bot should do with its *lower-value* or *higher-value* chip.
+
+For example, consider the following instructions:
+
+```
+value 5 goes to bot 2
+bot 2 gives low to bot 1 and high to bot 0
+value 3 goes to bot 1
+bot 1 gives low to output 1 and high to bot 0
+bot 0 gives low to output 2 and high to output 0
+value 2 goes to bot 2
+```
+
+
+ - Initially, bot `1` starts with a value-`3` chip, and bot `2` starts with a value-`2` chip and a value-`5` chip.
+ - Because bot `2` has two microchips, it gives its lower one (`2`) to bot `1` and its higher one (`5`) to bot `0`.
+ - Then, bot `1` has two microchips; it puts the value-`2` chip in output `1` and gives the value-`3` chip to bot `0`.
+ - Finally, bot `0` has two microchips; it puts the `3` in output `2` and the `5` in output `0`.
+
+In the end, output bin `0` contains a value-`5` microchip, output bin `1` contains a value-`2` microchip, and output bin `2` contains a value-`3` microchip. In this configuration, bot number *`2`* is responsible for comparing value-`5` microchips with value-`2` microchips.
+
+Based on your instructions, *what is the number of the bot* that is responsible for comparing value-`61` microchips with value-`17` microchips?
+
+
+## --- Part Two ---
+What do you get if you *multiply together the values* of one chip in each of outputs `0`, `1`, and `2`?
+
+
diff --git a/2016/Day10/input.in b/2016/Day10/input.in
index 4c8c4256a..ca6cead76 100644
Binary files a/2016/Day10/input.in and b/2016/Day10/input.in differ
diff --git a/2016/Day11/README.md b/2016/Day11/README.md
index eaac04c4a..d25f60209 100644
--- a/2016/Day11/README.md
+++ b/2016/Day11/README.md
@@ -1,6 +1,149 @@
+original source: [https://adventofcode.com/2016/day/11](https://adventofcode.com/2016/day/11)
## --- Day 11: Radioisotope Thermoelectric Generators ---
You come upon a column of four floors that have been entirely sealed off from the rest of the building except for a small dedicated lobby. There are some radiation warnings and a big sign which reads "Radioisotope Testing Facility".
According to the project status board, this facility is currently being used to experiment with [Radioisotope Thermoelectric Generators](https://en.wikipedia.org/wiki/Radioisotope_thermoelectric_generator) (RTGs, or simply "generators") that are designed to be paired with specially-constructed microchips. Basically, an RTG is a highly radioactive rock that generates electricity through heat.
-Read the [full puzzle](https://adventofcode.com/2016/day/11).
\ No newline at end of file
+The experimental RTGs have poor radiation containment, so they're dangerously radioactive. The chips are prototypes and don't have normal radiation shielding, but they do have the ability to *generate an electromagnetic radiation shield when powered*. Unfortunately, they can *only* be powered by their corresponding RTG. An RTG powering a microchip is still dangerous to other microchips.
+
+In other words, if a chip is ever left in the same area as another RTG, and it's not connected to its own RTG, the chip will be *fried*. Therefore, it is assumed that you will follow procedure and keep chips connected to their corresponding RTG when they're in the same room, and away from other RTGs otherwise.
+
+These microchips sound very interesting and useful to your current activities, and you'd like to try to retrieve them. The fourth floor of the facility has an assembling machine which can make a self-contained, shielded computer for you to take with you - that is, if you can bring it all of the RTGs and microchips.
+
+Within the radiation-shielded part of the facility (in which it's safe to have these pre-assembly RTGs), there is an elevator that can move between the four floors. Its capacity rating means it can carry at most yourself and two RTGs or microchips in any combination. (They're rigged to some heavy diagnostic equipment - the assembling machine will detach it for you.) As a security measure, the elevator will only function if it contains at least one RTG or microchip. The elevator always stops on each floor to recharge, and this takes long enough that the items within it and the items on that floor can irradiate each other. (You can prevent this if a Microchip and its Generator end up on the same floor in this way, as they can be connected while the elevator is recharging.)
+
+You make some notes of the locations of each component of interest (your puzzle input). Before you don a hazmat suit and start moving things around, you'd like to have an idea of what you need to do.
+
+When you enter the containment area, you and the elevator will start on the first floor.
+
+For example, suppose the isolated area has the following arrangement:
+
+```
+The first floor contains a hydrogen-compatible microchip and a lithium-compatible microchip.
+The second floor contains a hydrogen generator.
+The third floor contains a lithium generator.
+The fourth floor contains nothing relevant.
+```
+
+As a diagram (`F#` for a Floor number, `E` for Elevator, `H` for Hydrogen, `L` for Lithium, `M` for Microchip, and `G` for Generator), the initial state looks like this:
+
+```
+F4 . . . . .
+F3 . . . LG .
+F2 . HG . . .
+F1 E . HM . LM
+```
+
+Then, to get everything up to the assembling machine on the fourth floor, the following steps could be taken:
+
+
+ - Bring the Hydrogen-compatible Microchip to the second floor, which is safe because it can get power from the Hydrogen Generator:
+```
+F4 . . . . .
+F3 . . . LG .
+F2 E HG HM . .
+F1 . . . . LM
+```
+
+ - Bring both Hydrogen-related items to the third floor, which is safe because the Hydrogen-compatible microchip is getting power from its generator:
+```
+F4 . . . . .
+F3 E HG HM LG .
+F2 . . . . .
+F1 . . . . LM
+```
+
+ - Leave the Hydrogen Generator on floor three, but bring the Hydrogen-compatible Microchip back down with you so you can still use the elevator:
+```
+F4 . . . . .
+F3 . HG . LG .
+F2 E . HM . .
+F1 . . . . LM
+```
+
+ - At the first floor, grab the Lithium-compatible Microchip, which is safe because Microchips don't affect each other:
+```
+F4 . . . . .
+F3 . HG . LG .
+F2 . . . . .
+F1 E . HM . LM
+```
+
+ - Bring both Microchips up one floor, where there is nothing to fry them:
+```
+F4 . . . . .
+F3 . HG . LG .
+F2 E . HM . LM
+F1 . . . . .
+```
+
+ - Bring both Microchips up again to floor three, where they can be temporarily connected to their corresponding generators while the elevator recharges, preventing either of them from being fried:
+```
+F4 . . . . .
+F3 E HG HM LG LM
+F2 . . . . .
+F1 . . . . .
+```
+
+ - Bring both Microchips to the fourth floor:
+```
+F4 E . HM . LM
+F3 . HG . LG .
+F2 . . . . .
+F1 . . . . .
+```
+
+ - Leave the Lithium-compatible microchip on the fourth floor, but bring the Hydrogen-compatible one so you can still use the elevator; this is safe because although the Lithium Generator is on the destination floor, you can connect Hydrogen-compatible microchip to the Hydrogen Generator there:
+```
+F4 . . . . LM
+F3 E HG HM LG .
+F2 . . . . .
+F1 . . . . .
+```
+
+ - Bring both Generators up to the fourth floor, which is safe because you can connect the Lithium-compatible Microchip to the Lithium Generator upon arrival:
+```
+F4 E HG . LG LM
+F3 . . HM . .
+F2 . . . . .
+F1 . . . . .
+```
+
+ - Bring the Lithium Microchip with you to the third floor so you can use the elevator:
+```
+F4 . HG . LG .
+F3 E . HM . LM
+F2 . . . . .
+F1 . . . . .
+```
+
+ - Bring both Microchips to the fourth floor:
+```
+F4 E HG HM LG LM
+F3 . . . . .
+F2 . . . . .
+F1 . . . . .
+```
+
+
+In this arrangement, it takes `11` steps to collect all of the objects at the fourth floor for assembly. (Each elevator stop counts as one step, even if nothing is added to or removed from it.)
+
+In your situation, what is the *minimum number of steps* required to bring all of the objects to the fourth floor?
+
+
+## --- Part Two ---
+You step into the cleanroom separating the lobby from the isolated area and put on the hazmat suit.
+
+Upon entering the isolated containment area, however, you notice some extra parts on the first floor that weren't listed on the record outside:
+
+
+ - An elerium generator.
+ - An elerium-compatible microchip.
+ - A dilithium generator.
+ - A dilithium-compatible microchip.
+
+These work just like the other generators and microchips. You'll have to get them up to assembly as well.
+
+What is the *minimum number of steps* required to bring all of the objects, including these four new ones, to the fourth floor?
+
+
diff --git a/2016/Day11/input.in b/2016/Day11/input.in
index 70310eded..2c3c55528 100644
Binary files a/2016/Day11/input.in and b/2016/Day11/input.in differ
diff --git a/2016/Day12/README.md b/2016/Day12/README.md
index 8783e7dc1..9434274f4 100644
--- a/2016/Day12/README.md
+++ b/2016/Day12/README.md
@@ -1,6 +1,42 @@
+original source: [https://adventofcode.com/2016/day/12](https://adventofcode.com/2016/day/12)
## --- Day 12: Leonardo's Monorail ---
You finally reach the top floor of this building: a garden with a slanted glass ceiling. Looks like there are no more stars to be had.
While sitting on a nearby bench amidst some [tiger lilies](https://www.google.com/search?q=tiger+lilies&tbm=isch), you manage to decrypt some of the files you extracted from the servers downstairs.
-Read the [full puzzle](https://adventofcode.com/2016/day/12).
\ No newline at end of file
+According to these documents, Easter Bunny HQ isn't just this building - it's a collection of buildings in the nearby area. They're all connected by a local monorail, and there's another building not far from here! Unfortunately, being night, the monorail is currently not operating.
+
+You remotely connect to the monorail control systems and discover that the boot sequence expects a password. The password-checking logic (your puzzle input) is easy to extract, but the code it uses is strange: it's assembunny code designed for the [new computer](11) you just assembled. You'll have to execute the code and get the password.
+
+The assembunny code you've extracted operates on four [registers](https://en.wikipedia.org/wiki/Processor_register) (`a`, `b`, `c`, and `d`) that start at `0` and can hold any [integer](https://en.wikipedia.org/wiki/Integer). However, it seems to make use of only a few [instructions](https://en.wikipedia.org/wiki/Instruction_set):
+
+
+ - `cpy x y` *copies* `x` (either an integer or the *value* of a register) into register `y`.
+ - `inc x` *increases* the value of register `x` by one.
+ - `dec x` *decreases* the value of register `x` by one.
+ - `jnz x y` *jumps* to an instruction `y` away (positive means forward; negative means backward), but only if `x` is *not zero*.
+
+The `jnz` instruction moves relative to itself: an offset of `-1` would continue at the previous instruction, while an offset of `2` would *skip over* the next instruction.
+
+For example:
+
+```
+cpy 41 a
+inc a
+inc a
+dec a
+jnz a 2
+dec a
+```
+
+The above code would set register `a` to `41`, increase its value by `2`, decrease its value by `1`, and then skip the last `dec a` (because `a` is not zero, so the `jnz a 2` skips it), leaving register `a` at `42`. When you move past the last instruction, the program halts.
+
+After executing the assembunny code in your puzzle input, *what value is left in register `a`?*
+
+
+## --- Part Two ---
+As you head down the fire escape to the monorail, you notice it didn't start; register `c` needs to be initialized to the position of the ignition key.
+
+If you instead *initialize register `c` to be `1`*, what value is now left in register `a`?
+
+
diff --git a/2016/Day12/input.in b/2016/Day12/input.in
index e4a51aade..b74bbbccf 100644
Binary files a/2016/Day12/input.in and b/2016/Day12/input.in differ
diff --git a/2016/Day13/README.md b/2016/Day13/README.md
index 37cfc68bf..0c425b69d 100644
--- a/2016/Day13/README.md
+++ b/2016/Day13/README.md
@@ -1,6 +1,53 @@
+original source: [https://adventofcode.com/2016/day/13](https://adventofcode.com/2016/day/13)
## --- Day 13: A Maze of Twisty Little Cubicles ---
You arrive at the first floor of this new building to discover a much less welcoming environment than the shiny atrium of the last one. Instead, you are in a maze of twisty little cubicles, all alike.
Every location in this area is addressed by a pair of non-negative integers (`x,y`). Each such coordinate is either a wall or an open space. You can't move diagonally. The cube maze starts at `0,0` and seems to extend infinitely toward *positive* `x` and `y`; negative values are *invalid*, as they represent a location outside the building. You are in a small waiting area at `1,1`.
-Read the [full puzzle](https://adventofcode.com/2016/day/13).
\ No newline at end of file
+While it seems chaotic, a nearby morale-boosting poster explains, the layout is actually quite logical. You can determine whether a given `x,y` coordinate will be a wall or an open space using a simple system:
+
+
+ - Find `x*x + 3*x + 2*x*y + y + y*y`.
+ - Add the office designer's favorite number (your puzzle input).
+ - Find the [binary representation](https://en.wikipedia.org/wiki/Binary_number) of that sum; count the *number* of [bits](https://en.wikipedia.org/wiki/Bit) that are `1`.
+
+ - If the number of bits that are `1` is *even*, it's an *open space*.
+ - If the number of bits that are `1` is *odd*, it's a *wall*.
+
+
+
+For example, if the office designer's favorite number were `10`, drawing walls as `#` and open spaces as `.`, the corner of the building containing `0,0` would look like this:
+
+```
+ 0123456789
+0 .#.####.##
+1 ..#..#...#
+2 #....##...
+3 ###.#.###.
+4 .##..#..#.
+5 ..##....#.
+6 #...##.###
+```
+
+Now, suppose you wanted to reach `7,4`. The shortest route you could take is marked as `O`:
+
+```
+ 0123456789
+0 .#.####.##
+1 .O#..#...#
+2 #OOO.##...
+3 ###O#.###.
+4 .##OO#OO#.
+5 ..##OOO.#.
+6 #...##.###
+```
+
+Thus, reaching `7,4` would take a minimum of `11` steps (starting from your current location, `1,1`).
+
+What is the *fewest number of steps required* for you to reach `31,39`?
+
+
+## --- Part Two ---
+*How many locations* (distinct `x,y` coordinates, including your starting location) can you reach in at most `50` steps?
+
+
diff --git a/2016/Day13/input.in b/2016/Day13/input.in
index c12c644c8..dda50873c 100644
Binary files a/2016/Day13/input.in and b/2016/Day13/input.in differ
diff --git a/2016/Day14/README.md b/2016/Day14/README.md
index 5d0c9057c..171a74127 100644
--- a/2016/Day14/README.md
+++ b/2016/Day14/README.md
@@ -1,6 +1,55 @@
+original source: [https://adventofcode.com/2016/day/14](https://adventofcode.com/2016/day/14)
## --- Day 14: One-Time Pad ---
In order to communicate securely with Santa while you're on this mission, you've been using a [one-time pad](https://en.wikipedia.org/wiki/One-time_pad) that you [generate](https://en.wikipedia.org/wiki/Security_through_obscurity) using a pre-agreed algorithm. Unfortunately, you've run out of keys in your one-time pad, and so you need to generate some more.
To generate keys, you first get a stream of random data by taking the [MD5](https://en.wikipedia.org/wiki/MD5) of a pre-arranged [salt](https://en.wikipedia.org/wiki/Salt_(cryptography)) (your puzzle input) and an increasing integer index (starting with `0`, and represented in decimal); the resulting MD5 hash should be represented as a string of *lowercase* hexadecimal digits.
-Read the [full puzzle](https://adventofcode.com/2016/day/14).
\ No newline at end of file
+However, not all of these MD5 hashes are *keys*, and you need `64` new keys for your one-time pad. A hash is a key *only if*:
+
+
+ - It contains *three* of the same character in a row, like `777`. Only consider the first such triplet in a hash.
+ - One of the next `1000` hashes in the stream contains that same character *five* times in a row, like `77777`.
+
+Considering future hashes for five-of-a-kind sequences does not cause those hashes to be skipped; instead, regardless of whether the current hash is a key, always resume testing for keys starting with the very next hash.
+
+For example, if the pre-arranged salt is `abc`:
+
+
+ - The first index which produces a triple is `18`, because the MD5 hash of `abc18` contains `...cc38887a5...`. However, index `18` does not count as a key for your one-time pad, because none of the next thousand hashes (index `19` through index `1018`) contain `88888`.
+ - The next index which produces a triple is `39`; the hash of `abc39` contains `eee`. It is also the first key: one of the next thousand hashes (the one at index 816) contains `eeeee`.
+ - None of the next six triples are keys, but the one after that, at index `92`, is: it contains `999` and index `200` contains `99999`.
+ - Eventually, index `22728` meets all of the criteria to generate the `64`th key.
+
+So, using our example salt of `abc`, index `22728` produces the `64`th key.
+
+Given the actual salt in your puzzle input, *what index* produces your `64`th one-time pad key?
+
+
+## --- Part Two ---
+Of course, in order to make this process [even more secure](https://en.wikipedia.org/wiki/MD5#Security), you've also implemented [key stretching](https://en.wikipedia.org/wiki/Key_stretching).
+
+Key stretching forces attackers to spend more time generating hashes. Unfortunately, it forces everyone else to spend more time, too.
+
+To implement key stretching, whenever you generate a hash, before you use it, you first find the MD5 hash of that hash, then the MD5 hash of *that* hash, and so on, a total of *`2016` additional hashings*. Always use lowercase hexadecimal representations of hashes.
+
+For example, to find the stretched hash for index `0` and salt `abc`:
+
+
+ - Find the MD5 hash of `abc0`: `577571be4de9dcce85a041ba0410f29f`.
+ - Then, find the MD5 hash of that hash: `eec80a0c92dc8a0777c619d9bb51e910`.
+ - Then, find the MD5 hash of that hash: `16062ce768787384c81fe17a7a60c7e3`.
+ - ...repeat many times...
+ - Then, find the MD5 hash of that hash: `a107ff634856bb300138cac6568c0f24`.
+
+So, the stretched hash for index `0` in this situation is `a107ff...`. In the end, you find the original hash (one use of MD5), then find the hash-of-the-previous-hash `2016` times, for a total of `2017` uses of MD5.
+
+The rest of the process remains the same, but now the keys are entirely different. Again for salt `abc`:
+
+
+ - The first triple (`222`, at index `5`) has no matching `22222` in the next thousand hashes.
+ - The second triple (`eee`, at index `10`) hash a matching `eeeee` at index `89`, and so it is the first key.
+ - Eventually, index `22551` produces the `64`th key (triple `fff` with matching `fffff` at index `22859`.
+
+Given the actual salt in your puzzle input and using `2016` extra MD5 calls of key stretching, *what index* now produces your `64`th one-time pad key?
+
+
diff --git a/2016/Day14/input.in b/2016/Day14/input.in
index fa1a5b352..f7f11ad90 100644
Binary files a/2016/Day14/input.in and b/2016/Day14/input.in differ
diff --git a/2016/Day15/README.md b/2016/Day15/README.md
index e0930ef41..7bcd0d064 100644
--- a/2016/Day15/README.md
+++ b/2016/Day15/README.md
@@ -1,6 +1,37 @@
+original source: [https://adventofcode.com/2016/day/15](https://adventofcode.com/2016/day/15)
## --- Day 15: Timing is Everything ---
The halls open into an interior plaza containing a large kinetic sculpture. The sculpture is in a sealed enclosure and seems to involve a set of identical spherical capsules that are carried to the top and allowed to [bounce through the maze](https://youtu.be/IxDoO9oODOk?t=177) of spinning pieces.
Part of the sculpture is even interactive! When a button is pressed, a capsule is dropped and tries to fall through slots in a set of rotating discs to finally go through a little hole at the bottom and come out of the sculpture. If any of the slots aren't aligned with the capsule as it passes, the capsule bounces off the disc and soars away. You feel compelled to get one of those capsules.
-Read the [full puzzle](https://adventofcode.com/2016/day/15).
\ No newline at end of file
+The discs pause their motion each second and come in different sizes; they seem to each have a fixed number of positions at which they stop. You decide to call the position with the slot 0, and count up for each position it reaches next.
+
+Furthermore, the discs are spaced out so that after you push the button, one second elapses before the first disc is reached, and one second elapses as the capsule passes from one disc to the one below it. So, if you push the button at time=100, then the capsule reaches the top disc at time=101, the second disc at time=102, the third disc at time=103, and so on.
+
+The button will only drop a capsule at an integer time - no fractional seconds allowed.
+
+For example, at time=0, suppose you see the following arrangement:
+
+
+Disc #1 has 5 positions; at time=0, it is at position 4.
+Disc #2 has 2 positions; at time=0, it is at position 1.
+
+
+
+If you press the button exactly at time=0, the capsule would start to fall; it would reach the first disc at time=1. Since the first disc was at position 4 at time=0, by time=1 it has ticked one position forward. As a five-position disc, the next position is 0, and the capsule falls through the slot.
+
+Then, at time=2, the capsule reaches the second disc. The second disc has ticked forward two positions at this point: it started at position 1, then continued to position 0, and finally ended up at position 1 again. Because there's only a slot at position 0, the capsule bounces away.
+
+If, however, you wait until time=5 to push the button, then when the capsule reaches each disc, the first disc will have ticked forward 5+1 = 6 times (to position 0), and the second disc will have ticked forward 5+2 = 7 times (also to position 0). In this case, the capsule would fall through the discs and come out of the machine.
+
+However, your situation has more than two discs; you've noted their positions in your puzzle input. What is the first time you can press the button to get a capsule?
+
+
+## --- Part Two ---
+After getting the first capsule (it contained a star! what great fortune!), the machine detects your success and begins to rearrange itself.
+
+When it's done, the discs are back in their original configuration as if it were time=0 again, but a new disc with 11 positions and starting at position 0 has appeared exactly one second below the previously-bottom disc.
+
+With this new disc, and counting again starting from time=0 with the configuration in your puzzle input, what is the first time you can press the button to get another capsule?
+
+
diff --git a/2016/Day15/input.in b/2016/Day15/input.in
index d98a91e50..c5d50198a 100644
Binary files a/2016/Day15/input.in and b/2016/Day15/input.in differ
diff --git a/2016/Day16/README.md b/2016/Day16/README.md
index e5a6546ce..ff8b06be0 100644
--- a/2016/Day16/README.md
+++ b/2016/Day16/README.md
@@ -1,6 +1,59 @@
+original source: [https://adventofcode.com/2016/day/16](https://adventofcode.com/2016/day/16)
## --- Day 16: Dragon Checksum ---
You're done scanning this part of the network, but you've left traces of your presence. You need to overwrite some disks with random-looking data to cover your tracks and update the local security system with a new checksum for those disks.
For the data to not be suspicious, it needs to have certain properties; purely random data will be detected as tampering. To generate appropriate random data, you'll need to use a modified [dragon curve](https://en.wikipedia.org/wiki/Dragon_curve).
-Read the [full puzzle](https://adventofcode.com/2016/day/16).
\ No newline at end of file
+Start with an appropriate initial state (your puzzle input). Then, so long as you don't have enough data yet to fill the disk, repeat the following steps:
+
+
+ - Call the data you have at this point "a".
+ - Make a copy of "a"; call this copy "b".
+ - Reverse the order of the characters in "b".
+ - In "b", replace all instances of `0` with `1` and all `1`s with `0`.
+ - The resulting data is "a", then a single `0`, then "b".
+
+For example, after a single step of this process,
+
+
+ - `1` becomes `100`.
+ - `0` becomes `001`.
+ - `11111` becomes `11111000000`.
+ - `111100001010` becomes `1111000010100101011110000`.
+
+Repeat these steps until you have enough data to fill the desired disk.
+
+Once the data has been generated, you also need to create a checksum of that data. Calculate the checksum *only* for the data that fits on the disk, even if you generated more data than that in the previous step.
+
+The checksum for some given data is created by considering each non-overlapping *pair* of characters in the input data. If the two characters match (`00` or `11`), the next checksum character is a `1`. If the characters do not match (`01` or `10`), the next checksum character is a `0`. This should produce a new string which is exactly half as long as the original. If the length of the checksum is *even*, repeat the process until you end up with a checksum with an *odd* length.
+
+For example, suppose we want to fill a disk of length `12`, and when we finally generate a string of at least length `12`, the first `12` characters are `110010110100`. To generate its checksum:
+
+
+ - Consider each pair: `11`, `00`, `10`, `11`, `01`, `00`.
+ - These are same, same, different, same, different, same, producing `110101`.
+ - The resulting string has length `6`, which is *even*, so we repeat the process.
+ - The pairs are `11` (same), `01` (different), `01` (different).
+ - This produces the checksum `100`, which has an *odd* length, so we stop.
+
+Therefore, the checksum for `110010110100` is `100`.
+
+Combining all of these steps together, suppose you want to fill a disk of length `20` using an initial state of `10000`:
+
+
+ - Because `10000` is too short, we first use the modified dragon curve to make it longer.
+ - After one round, it becomes `10000011110` (`11` characters), still too short.
+ - After two rounds, it becomes `10000011110010000111110` (`23` characters), which is enough.
+ - Since we only need `20`, but we have `23`, we get rid of all but the first `20` characters: `10000011110010000111`.
+ - Next, we start calculating the checksum; after one round, we have `0111110101`, which `10` characters long (*even*), so we continue.
+ - After two rounds, we have `01100`, which is `5` characters long (*odd*), so we are done.
+
+In this example, the correct checksum would therefore be `01100`.
+
+The first disk you have to fill has length `272`. Using the initial state in your puzzle input, *what is the correct checksum*?
+
+
+## --- Part Two ---
+The second disk you have to fill has length `35651584`. Again using the initial state in your puzzle input, *what is the correct checksum* for this disk?
+
+
diff --git a/2016/Day16/input.in b/2016/Day16/input.in
index 6d0d69381..f8e6224bc 100644
Binary files a/2016/Day16/input.in and b/2016/Day16/input.in differ
diff --git a/2016/Day17/README.md b/2016/Day17/README.md
index 7cc530e50..cae6b5e24 100644
--- a/2016/Day17/README.md
+++ b/2016/Day17/README.md
@@ -1,3 +1,4 @@
+original source: [https://adventofcode.com/2016/day/17](https://adventofcode.com/2016/day/17)
## --- Day 17: Two Steps Forward ---
You're trying to access a secure vault protected by a `4x4` grid of small rooms connected by doors. You start in the top-left room (marked `S`), and you can access the vault (marked `V`) once you reach the bottom-right room:
@@ -13,4 +14,42 @@ You're trying to access a secure vault protected by a `4x4` grid of small rooms
####### V
```
-Read the [full puzzle](https://adventofcode.com/2016/day/17).
\ No newline at end of file
+Fixed walls are marked with `#`, and doors are marked with `-` or `|`.
+
+The doors in your *current room* are either open or closed (and locked) based on the hexadecimal [MD5](https://en.wikipedia.org/wiki/MD5) hash of a passcode (your puzzle input) followed by a sequence of uppercase characters representing the *path you have taken so far* (`U` for up, `D` for down, `L` for left, and `R` for right).
+
+Only the first four characters of the hash are used; they represent, respectively, the doors *up, down, left, and right* from your current position. Any `b`, `c`, `d`, `e`, or `f` means that the corresponding door is *open*; any other character (any number or `a`) means that the corresponding door is *closed and locked*.
+
+To access the vault, all you need to do is reach the bottom-right room; reaching this room opens the vault and all doors in the maze.
+
+For example, suppose the passcode is `hijkl`. Initially, you have taken no steps, and so your path is empty: you simply find the MD5 hash of `hijkl` alone. The first four characters of this hash are `ced9`, which indicate that up is open (`c`), down is open (`e`), left is open (`d`), and right is closed and locked (`9`). Because you start in the top-left corner, there are no "up" or "left" doors to be open, so your only choice is *down*.
+
+Next, having gone only one step (down, or `D`), you find the hash of `hijkl*D*`. This produces `f2bc`, which indicates that you can go back up, left (but that's a wall), or right. Going right means hashing `hijkl*DR*` to get `5745` - all doors closed and locked. However, going *up* instead is worthwhile: even though it returns you to the room you started in, your path would then be `DU`, opening a *different set of doors*.
+
+After going `DU` (and then hashing `hijkl*DU*` to get `528e`), only the right door is open; after going `DUR`, all doors lock. (Fortunately, your actual passcode is not `hijkl`).
+
+Passcodes actually used by Easter Bunny Vault Security do allow access to the vault if you know the right path. For example:
+
+
+ - If your passcode were `ihgpwlah`, the shortest path would be `DDRRRD`.
+ - With `kglvqrro`, the shortest path would be `DDUDRLRRUDRD`.
+ - With `ulqzkmiv`, the shortest would be `DRURDRUDDLLDLUURRDULRLDUUDDDRR`.
+
+Given your vault's passcode, *what is the shortest path* (the actual path, not just the length) to reach the vault?
+
+
+## --- Part Two ---
+You're curious how robust this security solution really is, and so you decide to find longer and longer paths which still provide access to the vault. You remember that paths always end the first time they reach the bottom-right room (that is, they can never pass through it, only end in it).
+
+For example:
+
+
+ - If your passcode were `ihgpwlah`, the longest path would take `370` steps.
+ - With `kglvqrro`, the longest path would be `492` steps long.
+ - With `ulqzkmiv`, the longest path would be `830` steps long.
+
+
+
+What is the *length of the longest path* that reaches the vault?
+
+
diff --git a/2016/Day17/input.in b/2016/Day17/input.in
index a868569aa..02562b2a2 100644
Binary files a/2016/Day17/input.in and b/2016/Day17/input.in differ
diff --git a/2016/Day18/README.md b/2016/Day18/README.md
index aa4737079..a9019d4ce 100644
--- a/2016/Day18/README.md
+++ b/2016/Day18/README.md
@@ -1,6 +1,65 @@
+original source: [https://adventofcode.com/2016/day/18](https://adventofcode.com/2016/day/18)
## --- Day 18: Like a Rogue ---
As you enter this room, you hear a loud click! Some of the tiles in the floor here seem to be pressure plates for [traps](https://nethackwiki.com/wiki/Trap), and the trap you just triggered has run out of... whatever it tried to do to you. You doubt you'll be so lucky next time.
Upon closer examination, the traps and safe tiles in this room seem to follow a pattern. The tiles are arranged into rows that are all the same width; you take note of the safe tiles (`.`) and traps (`^`) in the first row (your puzzle input).
-Read the [full puzzle](https://adventofcode.com/2016/day/18).
\ No newline at end of file
+The type of tile (trapped or safe) in each row is based on the types of the tiles in the same position, and to either side of that position, in the previous row. (If either side is off either end of the row, it counts as "safe" because there isn't a trap embedded in the wall.)
+
+For example, suppose you know the first row (with tiles marked by letters) and want to determine the next row (with tiles marked by numbers):
+
+```
+ABCDE
+12345
+```
+
+The type of tile `2` is based on the types of tiles `A`, `B`, and `C`; the type of tile `5` is based on tiles `D`, `E`, and an imaginary "safe" tile. Let's call these three tiles from the previous row the *left*, *center*, and *right* tiles, respectively. Then, a new tile is a *trap* only in one of the following situations:
+
+
+ - Its *left* and *center* tiles are traps, but its *right* tile is not.
+ - Its *center* and *right* tiles are traps, but its *left* tile is not.
+ - Only its *left* tile is a trap.
+ - Only its *right* tile is a trap.
+
+In any other situation, the new tile is safe.
+
+Then, starting with the row `..^^.`, you can determine the next row by applying those rules to each new tile:
+
+
+ - The leftmost character on the next row considers the left (nonexistent, so we assume "safe"), center (the first `.`, which means "safe"), and right (the second `.`, also "safe") tiles on the previous row. Because all of the trap rules require a trap in at least one of the previous three tiles, the first tile on this new row is also safe, `.`.
+ - The second character on the next row considers its left (`.`), center (`.`), and right (`^`) tiles from the previous row. This matches the fourth rule: only the right tile is a trap. Therefore, the next tile in this new row is a trap, `^`.
+ - The third character considers `.^^`, which matches the second trap rule: its center and right tiles are traps, but its left tile is not. Therefore, this tile is also a trap, `^`.
+ - The last two characters in this new row match the first and third rules, respectively, and so they are both also traps, `^`.
+
+After these steps, we now know the next row of tiles in the room: `.^^^^`. Then, we continue on to the next row, using the same rules, and get `^^..^`. After determining two new rows, our map looks like this:
+
+```
+..^^.
+.^^^^
+^^..^
+```
+
+Here's a larger example with ten tiles per row and ten rows:
+
+```
+.^^.^.^^^^
+^^^...^..^
+^.^^.^.^^.
+..^^...^^^
+.^^^^.^^.^
+^^..^.^^..
+^^^^..^^^.
+^..^^^^.^^
+.^^^..^.^^
+^^.^^^..^^
+```
+
+In ten rows, this larger example has `38` safe tiles.
+
+Starting with the map in your puzzle input, in a total of `40` rows (including the starting row), *how many safe tiles* are there?
+
+
+## --- Part Two ---
+*How many safe tiles* are there in a total of `400000` rows?
+
+
diff --git a/2016/Day18/input.in b/2016/Day18/input.in
index ca1d62f7f..2036710b5 100644
Binary files a/2016/Day18/input.in and b/2016/Day18/input.in differ
diff --git a/2016/Day19/README.md b/2016/Day19/README.md
index 5bfdef034..94579f038 100644
--- a/2016/Day19/README.md
+++ b/2016/Day19/README.md
@@ -1,6 +1,75 @@
+original source: [https://adventofcode.com/2016/day/19](https://adventofcode.com/2016/day/19)
## --- Day 19: An Elephant Named Joseph ---
The Elves contact you over a highly secure emergency channel. Back at the North Pole, the Elves are busy misunderstanding [White Elephant parties](https://en.wikipedia.org/wiki/White_elephant_gift_exchange).
Each Elf brings a present. They all sit in a circle, numbered starting with position `1`. Then, starting with the first Elf, they take turns stealing all the presents from the Elf to their left. An Elf with no presents is removed from the circle and does not take turns.
-Read the [full puzzle](https://adventofcode.com/2016/day/19).
\ No newline at end of file
+For example, with five Elves (numbered `1` to `5`):
+
+```
+ 1
+5 2
+ 4 3
+```
+
+
+ - Elf `1` takes Elf `2`'s present.
+ - Elf `2` has no presents and is skipped.
+ - Elf `3` takes Elf `4`'s present.
+ - Elf `4` has no presents and is also skipped.
+ - Elf `5` takes Elf `1`'s two presents.
+ - Neither Elf `1` nor Elf `2` have any presents, so both are skipped.
+ - Elf `3` takes Elf `5`'s three presents.
+
+So, with *five* Elves, the Elf that sits starting in position `3` gets all the presents.
+
+With the number of Elves given in your puzzle input, *which Elf gets all the presents?*
+
+
+## --- Part Two ---
+Realizing the folly of their present-exchange rules, the Elves agree to instead steal presents from the Elf *directly across the circle*. If two Elves are across the circle, the one on the left (from the perspective of the stealer) is stolen from. The other rules remain unchanged: Elves with no presents are removed from the circle entirely, and the other elves move in slightly to keep the circle evenly spaced.
+
+For example, with five Elves (again numbered `1` to `5`):
+
+
+ - The Elves sit in a circle; Elf `1` goes first:
+```
+ *1*
+5 2
+ 4 3
+```
+
+ - Elves `3` and `4` are across the circle; Elf `3`'s present is stolen, being the one to the left. Elf `3` leaves the circle, and the rest of the Elves move in:
+```
+ *1* 1
+5 2 --> 5 2
+ 4 - 4
+```
+
+ - Elf `2` steals from the Elf directly across the circle, Elf `5`:
+```
+ 1 1
+- *2* --> 2
+ 4 4
+```
+
+ - Next is Elf `4` who, choosing between Elves `1` and `2`, steals from Elf `1`:
+```
+ - 2
+ 2 -->
+ *4* 4
+```
+
+ - Finally, Elf `2` steals from Elf `4`:
+```
+ *2*
+ --> 2
+ -
+```
+
+
+So, with *five* Elves, the Elf that sits starting in position `2` gets all the presents.
+
+With the number of Elves given in your puzzle input, *which Elf now gets all the presents?*
+
+
diff --git a/2016/Day19/input.in b/2016/Day19/input.in
index e1bea95a1..a64cd1961 100644
Binary files a/2016/Day19/input.in and b/2016/Day19/input.in differ
diff --git a/2016/Day20/README.md b/2016/Day20/README.md
index f91a56fec..3f573cdc3 100644
--- a/2016/Day20/README.md
+++ b/2016/Day20/README.md
@@ -1,6 +1,23 @@
+original source: [https://adventofcode.com/2016/day/20](https://adventofcode.com/2016/day/20)
## --- Day 20: Firewall Rules ---
You'd like to set up a small hidden computer here so you can use it to get back into the network later. However, the corporate firewall only allows communication with certain external [IP addresses](https://en.wikipedia.org/wiki/IPv4#Addressing).
You've retrieved the list of blocked IPs from the firewall, but the list seems to be messy and poorly maintained, and it's not clear which IPs are allowed. Also, rather than being written in [dot-decimal](https://en.wikipedia.org/wiki/Dot-decimal_notation) notation, they are written as plain [32-bit integers](https://en.wikipedia.org/wiki/32-bit), which can have any value from `0` through `4294967295`, inclusive.
-Read the [full puzzle](https://adventofcode.com/2016/day/20).
\ No newline at end of file
+For example, suppose only the values `0` through `9` were valid, and that you retrieved the following blacklist:
+
+```
+5-8
+0-2
+4-7
+```
+
+The blacklist specifies ranges of IPs (inclusive of both the start and end value) that are *not* allowed. Then, the only IPs that this firewall allows are `3` and `9`, since those are the only numbers not in any range.
+
+Given the list of blocked IPs you retrieved from the firewall (your puzzle input), *what is the lowest-valued IP* that is not blocked?
+
+
+## --- Part Two ---
+*How many IPs* are allowed by the blacklist?
+
+
diff --git a/2016/Day20/input.in b/2016/Day20/input.in
index 06143dbaf..f809e5407 100644
Binary files a/2016/Day20/input.in and b/2016/Day20/input.in differ
diff --git a/2016/Day21/README.md b/2016/Day21/README.md
index a38e2892c..c730dacac 100644
--- a/2016/Day21/README.md
+++ b/2016/Day21/README.md
@@ -1,6 +1,37 @@
+original source: [https://adventofcode.com/2016/day/21](https://adventofcode.com/2016/day/21)
## --- Day 21: Scrambled Letters and Hash ---
The computer system you're breaking into uses a weird scrambling function to store its passwords. It shouldn't be much trouble to create your own scrambled password so you can add it to the system; you just have to implement the scrambler.
The scrambling function is a series of operations (the exact list is provided in your puzzle input). Starting with the password to be scrambled, apply each operation in succession to the string. The individual operations behave as follows:
-Read the [full puzzle](https://adventofcode.com/2016/day/21).
\ No newline at end of file
+
+ - `swap position X with position Y` means that the letters at indexes `X` and `Y` (counting from `0`) should be *swapped*.
+ - `swap letter X with letter Y` means that the letters `X` and `Y` should be *swapped* (regardless of where they appear in the string).
+ - `rotate left/right X steps` means that the whole string should be *rotated*; for example, one right rotation would turn `abcd` into `dabc`.
+ - `rotate based on position of letter X` means that the whole string should be *rotated to the right* based on the *index* of letter `X` (counting from `0`) as determined *before* this instruction does any rotations. Once the index is determined, rotate the string to the right one time, plus a number of times equal to that index, plus one additional time if the index was at least `4`.
+ - `reverse positions X through Y` means that the span of letters at indexes `X` through `Y` (including the letters at `X` and `Y`) should be *reversed in order*.
+ - `move position X to position Y` means that the letter which is at index `X` should be *removed* from the string, then *inserted* such that it ends up at index `Y`.
+
+For example, suppose you start with `abcde` and perform the following operations:
+
+
+ - `swap position 4 with position 0` swaps the first and last letters, producing the input for the next step, `ebcda`.
+ - `swap letter d with letter b` swaps the positions of `d` and `b`: `edcba`.
+ - `reverse positions 0 through 4` causes the entire string to be reversed, producing `abcde`.
+ - `rotate left 1 step` shifts all letters left one position, causing the first letter to wrap to the end of the string: `bcdea`.
+ - `move position 1 to position 4` removes the letter at position `1` (`c`), then inserts it at position `4` (the end of the string): `bdeac`.
+ - `move position 3 to position 0` removes the letter at position `3` (`a`), then inserts it at position `0` (the front of the string): `abdec`.
+ - `rotate based on position of letter b` finds the index of letter `b` (`1`), then rotates the string right once plus a number of times equal to that index (`2`): `ecabd`.
+ - `rotate based on position of letter d` finds the index of letter `d` (`4`), then rotates the string right once, plus a number of times equal to that index, plus an additional time because the index was at least `4`, for a total of `6` right rotations: `decab`.
+
+After these steps, the resulting scrambled password is `decab`.
+
+Now, you just need to generate a new scrambled password and you can access the system. Given the list of scrambling operations in your puzzle input, *what is the result of scrambling `abcdefgh`*?
+
+
+## --- Part Two ---
+You scrambled the password correctly, but you discover that you [can't actually modify](https://en.wikipedia.org/wiki/File_system_permissions) the [password file](https://en.wikipedia.org/wiki/Passwd) on the system. You'll need to un-scramble one of the existing passwords by reversing the scrambling process.
+
+What is the un-scrambled version of the scrambled password `fbgdceah`?
+
+
diff --git a/2016/Day21/input.in b/2016/Day21/input.in
index 859177f85..ebd7d523c 100644
Binary files a/2016/Day21/input.in and b/2016/Day21/input.in differ
diff --git a/2016/Day22/README.md b/2016/Day22/README.md
index 152ace850..dd1c7280b 100644
--- a/2016/Day22/README.md
+++ b/2016/Day22/README.md
@@ -1,6 +1,126 @@
+original source: [https://adventofcode.com/2016/day/22](https://adventofcode.com/2016/day/22)
## --- Day 22: Grid Computing ---
You gain access to a massive storage cluster arranged in a grid; each storage node is only connected to the four nodes directly adjacent to it (three if the node is on an edge, two if it's in a corner).
You can directly access data *only* on node `/dev/grid/node-x0-y0`, but you can perform some limited actions on the other nodes:
-Read the [full puzzle](https://adventofcode.com/2016/day/22).
\ No newline at end of file
+
+ - You can get the disk usage of all nodes (via [`df`](https://en.wikipedia.org/wiki/Df_(Unix)#Example)). The result of doing this is in your puzzle input.
+ - You can instruct a node to *move* (not copy) *all* of its data to an adjacent node (if the destination node has enough space to receive the data). The sending node is left empty after this operation.
+
+Nodes are named by their position: the node named `node-x10-y10` is adjacent to nodes `node-x9-y10`, `node-x11-y10`, `node-x10-y9`, and `node-x10-y11`.
+
+Before you begin, you need to understand the arrangement of data on these nodes. Even though you can only move data between directly connected nodes, you're going to need to rearrange a lot of the data to get access to the data you need. Therefore, you need to work out how you might be able to shift data around.
+
+To do this, you'd like to count the number of *viable pairs* of nodes. A viable pair is any two nodes (A,B), *regardless of whether they are directly connected*, such that:
+
+
+ - Node A is *not* empty (its `Used` is not zero).
+ - Nodes A and B are *not the same* node.
+ - The data on node A (its `Used`) *would fit* on node B (its `Avail`).
+
+*How many viable pairs* of nodes are there?
+
+
+## --- Part Two ---
+Now that you have a better understanding of the grid, it's time to get to work.
+
+Your goal is to gain access to the data which begins in the node with `y=0` and the *highest `x`* (that is, the node in the top-right corner).
+
+For example, suppose you have the following grid:
+
+```
+Filesystem Size Used Avail Use%
+/dev/grid/node-x0-y0 10T 8T 2T 80%
+/dev/grid/node-x0-y1 11T 6T 5T 54%
+/dev/grid/node-x0-y2 32T 28T 4T 87%
+/dev/grid/node-x1-y0 9T 7T 2T 77%
+/dev/grid/node-x1-y1 8T 0T 8T 0%
+/dev/grid/node-x1-y2 11T 7T 4T 63%
+/dev/grid/node-x2-y0 10T 6T 4T 60%
+/dev/grid/node-x2-y1 9T 8T 1T 88%
+/dev/grid/node-x2-y2 9T 6T 3T 66%
+```
+
+In this example, you have a storage grid `3` nodes wide and `3` nodes tall. The node you can access directly, `node-x0-y0`, is almost full. The node containing the data you want to access, `node-x2-y0` (because it has `y=0` and the highest `x` value), contains 6 [terabytes](https://en.wikipedia.org/wiki/Terabyte) of data - enough to fit on your node, if only you could make enough space to move it there.
+
+Fortunately, `node-x1-y1` looks like it has enough free space to enable you to move some of this data around. In fact, it seems like all of the nodes have enough space to hold any node's data (except `node-x0-y2`, which is much larger, very full, and not moving any time soon). So, initially, the grid's capacities and connections look like this:
+
+```
+( 8T/10T) -- 7T/ 9T -- [ 6T/10T]
+ | | |
+ 6T/11T -- 0T/ 8T -- 8T/ 9T
+ | | |
+ 28T/32T -- 7T/11T -- 6T/ 9T
+```
+
+The node you can access directly is in parentheses; the data you want starts in the node marked by square brackets.
+
+In this example, most of the nodes are interchangable: they're full enough that no other node's data would fit, but small enough that their data could be moved around. Let's draw these nodes as `.`. The exceptions are the empty node, which we'll draw as `_`, and the very large, very full node, which we'll draw as `#`. Let's also draw the goal data as `G`. Then, it looks like this:
+
+```
+(.) . G
+ . _ .
+ # . .
+```
+
+The goal is to move the data in the top right, `G`, to the node in parentheses. To do this, we can issue some commands to the grid and rearrange the data:
+
+
+ - Move data from `node-y0-x1` to `node-y1-x1`, leaving node `node-y0-x1` empty:
+```
+(.) _ G
+ . . .
+ # . .
+```
+
+ - Move the goal data from `node-y0-x2` to `node-y0-x1`:
+```
+(.) G _
+ . . .
+ # . .
+```
+
+ - At this point, we're quite close. However, we have no deletion command, so we have to move some more data around. So, next, we move the data from `node-y1-x2` to `node-y0-x2`:
+```
+(.) G .
+ . . _
+ # . .
+```
+
+ - Move the data from `node-y1-x1` to `node-y1-x2`:
+```
+(.) G .
+ . _ .
+ # . .
+```
+
+ - Move the data from `node-y1-x0` to `node-y1-x1`:
+```
+(.) G .
+ _ . .
+ # . .
+```
+
+ - Next, we can free up space on our node by moving the data from `node-y0-x0` to `node-y1-x0`:
+```
+(_) G .
+ . . .
+ # . .
+```
+
+
+ - Finally, we can access the goal data by moving the it from `node-y0-x1` to `node-y0-x0`:
+```
+(G) _ .
+ . . .
+ # . .
+```
+
+
+
+So, after `7` steps, we've accessed the data we want. Unfortunately, each of these moves takes time, and we need to be efficient:
+
+*What is the fewest number of steps* required to move your goal data to `node-x0-y0`?
+
+
diff --git a/2016/Day22/input.in b/2016/Day22/input.in
index 1c0570dda..878a6b267 100644
Binary files a/2016/Day22/input.in and b/2016/Day22/input.in differ
diff --git a/2016/Day23/README.md b/2016/Day23/README.md
index 6312da7fa..7e43ab965 100644
--- a/2016/Day23/README.md
+++ b/2016/Day23/README.md
@@ -1,6 +1,58 @@
+original source: [https://adventofcode.com/2016/day/23](https://adventofcode.com/2016/day/23)
## --- Day 23: Safe Cracking ---
This is one of the top floors of the nicest tower in EBHQ. The Easter Bunny's private office is here, complete with a safe hidden behind a painting, and who *wouldn't* hide a star in a safe behind a painting?
The safe has a digital screen and keypad for code entry. A sticky note attached to the safe has a password hint on it: "eggs". The painting is of a large rabbit coloring some eggs. You see `7`.
-Read the [full puzzle](https://adventofcode.com/2016/day/23).
\ No newline at end of file
+When you go to type the code, though, nothing appears on the display; instead, the keypad comes apart in your hands, apparently having been smashed. Behind it is some kind of socket - one that matches a connector in your [prototype computer](11)! You pull apart the smashed keypad and extract the logic circuit, plug it into your computer, and plug your computer into the safe.
+
+Now, you just need to figure out what output the keypad would have sent to the safe. You extract the [assembunny code](12) from the logic chip (your puzzle input).
+
+The code looks like it uses *almost* the same architecture and instruction set that the [monorail computer](12) used! You should be able to *use the same assembunny interpreter* for this as you did there, but with one new instruction:
+
+`tgl x` *toggles* the instruction `x` away (pointing at instructions like `jnz` does: positive means forward; negative means backward):
+
+
+ - For *one-argument* instructions, `inc` becomes `dec`, and all other one-argument instructions become `inc`.
+ - For *two-argument* instructions, `jnz` becomes `cpy`, and all other two-instructions become `jnz`.
+ - The arguments of a toggled instruction are *not affected*.
+ - If an attempt is made to toggle an instruction outside the program, *nothing happens*.
+ - If toggling produces an *invalid instruction* (like `cpy 1 2`) and an attempt is later made to execute that instruction, *skip it instead*.
+ - If `tgl` toggles *itself* (for example, if `a` is `0`, `tgl a` would target itself and become `inc a`), the resulting instruction is not executed until the next time it is reached.
+
+For example, given this program:
+
+```
+cpy 2 a
+tgl a
+tgl a
+tgl a
+cpy 1 a
+dec a
+dec a
+```
+
+
+ - `cpy 2 a` initializes register `a` to `2`.
+ - The first `tgl a` toggles an instruction `a` (`2`) away from it, which changes the third `tgl a` into `inc a`.
+ - The second `tgl a` also modifies an instruction `2` away from it, which changes the `cpy 1 a` into `jnz 1 a`.
+ - The fourth line, which is now `inc a`, increments `a` to `3`.
+ - Finally, the fifth line, which is now `jnz 1 a`, jumps `a` (`3`) instructions ahead, skipping the `dec a` instructions.
+
+In this example, the final value in register `a` is `3`.
+
+The rest of the electronics seem to place the keypad entry (the number of eggs, `7`) in register `a`, run the code, and then send the value left in register `a` to the safe.
+
+*What value* should be sent to the safe?
+
+
+## --- Part Two ---
+The safe doesn't open, but it *does* make several angry noises to express its frustration.
+
+You're quite sure your logic is working correctly, so the only other thing is... you check the painting again. As it turns out, colored eggs are still eggs. Now you count `12`.
+
+As you run the program with this new input, the prototype computer begins to *overheat*. You wonder what's taking so long, and whether the lack of any instruction more powerful than "add one" has anything to do with it. Don't bunnies usually *multiply*?
+
+Anyway, *what value* should actually be sent to the safe?
+
+
diff --git a/2016/Day23/input.in b/2016/Day23/input.in
index ea5304016..37b4dac6f 100644
Binary files a/2016/Day23/input.in and b/2016/Day23/input.in differ
diff --git a/2016/Day24/README.md b/2016/Day24/README.md
index ca42bf3f9..03ad41f1a 100644
--- a/2016/Day24/README.md
+++ b/2016/Day24/README.md
@@ -1,6 +1,39 @@
+original source: [https://adventofcode.com/2016/day/24](https://adventofcode.com/2016/day/24)
## --- Day 24: Air Duct Spelunking ---
You've finally met your match; the doors that provide access to the roof are locked tight, and all of the controls and related electronics are inaccessible. You simply can't reach them.
The robot that cleans the air ducts, however, *can*.
-Read the [full puzzle](https://adventofcode.com/2016/day/24).
\ No newline at end of file
+It's not a very fast little robot, but you reconfigure it to be able to interface with some of the exposed wires that have been routed through the [HVAC](https://en.wikipedia.org/wiki/HVAC) system. If you can direct it to each of those locations, you should be able to bypass the security controls.
+
+You extract the duct layout for this area from some blueprints you acquired and create a map with the relevant locations marked (your puzzle input). `0` is your current location, from which the cleaning robot embarks; the other numbers are (in *no particular order*) the locations the robot needs to visit at least once each. Walls are marked as `#`, and open passages are marked as `.`. Numbers behave like open passages.
+
+For example, suppose you have a map like the following:
+
+```
+###########
+#0.1.....2#
+#.#######.#
+#4.......3#
+###########
+```
+
+To reach all of the points of interest as quickly as possible, you would have the robot take the following path:
+
+
+ - `0` to `4` (`2` steps)
+ - `4` to `1` (`4` steps; it can't move diagonally)
+ - `1` to `2` (`6` steps)
+ - `2` to `3` (`2` steps)
+
+Since the robot isn't very fast, you need to find it the *shortest route*. This path is the fewest steps (in the above example, a total of `14`) required to start at `0` and then visit every other location at least once.
+
+Given your actual map, and starting from location `0`, what is the *fewest number of steps* required to visit every non-`0` number marked on the map at least once?
+
+
+## --- Part Two ---
+Of course, if you leave the cleaning robot somewhere weird, someone is bound to notice.
+
+What is the fewest number of steps required to start at `0`, visit every non-`0` number marked on the map at least once, and then *return to `0`*?
+
+
diff --git a/2016/Day24/input.in b/2016/Day24/input.in
index 5051464fd..3b3bade27 100644
Binary files a/2016/Day24/input.in and b/2016/Day24/input.in differ
diff --git a/2016/Day25/README.md b/2016/Day25/README.md
index 268d84818..c5e743775 100644
--- a/2016/Day25/README.md
+++ b/2016/Day25/README.md
@@ -1,6 +1,36 @@
+original source: [https://adventofcode.com/2016/day/25](https://adventofcode.com/2016/day/25)
## --- Day 25: Clock Signal ---
You open the door and find yourself on the roof. The city sprawls away from you for miles and miles.
There's not much time now - it's already Christmas, but you're nowhere near the North Pole, much too far to deliver these stars to the sleigh in time.
-Read the [full puzzle](https://adventofcode.com/2016/day/25).
\ No newline at end of file
+However, maybe the *huge antenna* up here can offer a solution. After all, the sleigh doesn't need the stars, exactly; it needs the timing data they provide, and you happen to have a massive signal generator right here.
+
+You connect the stars you have to your prototype computer, connect that to the antenna, and begin the transmission.
+
+Nothing happens.
+
+You call the service number printed on the side of the antenna and quickly explain the situation. "I'm not sure what kind of equipment you have connected over there," he says, "but you need a clock signal." You try to explain that this is a signal for a clock.
+
+"No, no, a [clock signal](https://en.wikipedia.org/wiki/Clock_signal) - timing information so the antenna computer knows how to read the data you're sending it. An endless, alternating pattern of `0`, `1`, `0`, `1`, `0`, `1`, `0`, `1`, `0`, `1`...." He trails off.
+
+You ask if the antenna can handle a clock signal at the frequency you would need to use for the data from the stars. "There's *no way* it can! The only antenna we've installed capable of *that* is on top of a top-secret Easter Bunny installation, and you're *definitely* not-" You hang up the phone.
+
+You've extracted the antenna's clock signal generation [assembunny](12) code (your puzzle input); it looks mostly compatible with code you worked on [just recently](23).
+
+This antenna code, being a signal generator, uses one extra instruction:
+
+
+ - `out x` *transmits* `x` (either an integer or the *value* of a register) as the next value for the clock signal.
+
+The code takes a value (via register `a`) that describes the signal to generate, but you're not sure how it's used. You'll have to find the input to produce the right signal through experimentation.
+
+*What is the lowest positive integer* that can be used to initialize register `a` and cause the code to output a clock signal of `0`, `1`, `0`, `1`... repeating forever?
+
+
+## --- Part Two ---
+The antenna is ready. Now, all you need is the *fifty stars* required to generate the signal for the sleigh, but you don't have enough.
+
+You look toward the sky in desperation... suddenly noticing that a lone star has been installed at the top of the antenna! Only *49 more* to go.
+
+
diff --git a/2016/Day25/input.in b/2016/Day25/input.in
index 98d287199..8038270ba 100644
Binary files a/2016/Day25/input.in and b/2016/Day25/input.in differ
diff --git a/2016/README.md b/2016/README.md
index d3ef6bd90..8212cc07f 100644
--- a/2016/README.md
+++ b/2016/README.md
@@ -1,4 +1,6 @@
+
# Advent of Code (2016)
Check out https://adventofcode.com/2016.
+
diff --git a/2016/SplashScreen.cs b/2016/SplashScreen.cs
index 04fac5852..33cb596bf 100644
--- a/2016/SplashScreen.cs
+++ b/2016/SplashScreen.cs
@@ -1,3 +1,4 @@
+
using System;
namespace AdventOfCode.Y2016;
@@ -8,258 +9,258 @@ public void Show() {
var color = Console.ForegroundColor;
Write(0xcc00, false, " ▄█▄ ▄▄█ ▄ ▄ ▄▄▄ ▄▄ ▄█▄ ▄▄▄ ▄█ ▄▄ ▄▄▄ ▄▄█ ▄▄▄\n █▄█ █ █ █ █ █▄█ █ █ █ █ █ █▄ ");
- Write(0xcc00, false, " █ █ █ █ █ █▄█\n █ █ █▄█ ▀▄▀ █▄▄ █ █ █▄ █▄█ █ █▄ █▄█ █▄█ █▄▄ // 2016\n \n ");
- Write(0xcc00, false, " ");
- Write(0xffff66, true, "( ( ( ( ((*)) ) ) ) ) \n ");
- Write(0x666666, false, " | \n +-|---+ ");
- Write(0x666666, false, " \n / | /| \n ");
- Write(0x666666, false, " +-----+ | \n |");
- Write(0x333333, false, "::");
- Write(0xffff66, true, ":");
- Write(0x333333, false, "::");
- Write(0x666666, false, "| | ");
- Write(0xcccccc, false, "25 ");
- Write(0xffff66, false, "**\n ");
- Write(0x666666, false, " +----+ |");
- Write(0x333333, false, "::");
- Write(0x9900, true, ":");
- Write(0x333333, false, "::");
- Write(0x666666, false, "| |---+ +-----------+ ");
- Write(0xcccccc, false, "24 ");
- Write(0xffff66, false, "**\n ");
- Write(0x666666, false, " / / \\ |");
- Write(0x333333, false, ":");
- Write(0x9900, true, ":::");
- Write(0x333333, false, ":");
- Write(0x666666, false, "| | /| / \\\\\\\\\\\\ [] /| ");
- Write(0xcccccc, false, "23 ");
- Write(0xffff66, false, "**\n ");
- Write(0x666666, false, " / / / \\|");
- Write(0x9900, true, ":::::");
- Write(0x666666, false, "| | / | / \\\\\\\\\\\\ [] / | ");
- Write(0xcccccc, false, "22 ");
- Write(0xffff66, false, "**\n ");
- Write(0x666666, false, " / / / / \\");
- Write(0x333333, false, "::");
- Write(0x553322, true, ":");
- Write(0x333333, false, "::");
- Write(0x666666, false, "|/ / | +-----------+ | ");
- Write(0xcccccc, false, "21 ");
- Write(0xffff66, false, "**\n ");
- Write(0x666666, false, " +----+ / / / \\------+ ------|");
- Write(0x333333, false, "::::");
- Write(0x66ff, true, ":");
- Write(0x333333, false, ":");
- Write(0x66ff, true, ":");
- Write(0x333333, false, "::::");
- Write(0x666666, false, "| | ");
- Write(0xcccccc, false, "20 ");
- Write(0xffff66, false, "**\n ");
- Write(0x666666, false, " |-----\\ / / / \\=====| ------|");
- Write(0x333333, false, ":");
- Write(0x66ff, true, ":");
- Write(0x333333, false, ":::");
- Write(0x66ff, true, ":");
- Write(0x333333, false, ":::");
- Write(0x66ff, true, ":");
- Write(0x333333, false, ":");
- Write(0x666666, false, "| | ");
- Write(0xcccccc, false, "19 ");
- Write(0xffff66, false, "**\n ");
- Write(0x666666, false, " |------\\ / / / \\====| | |");
- Write(0x66ff, true, ":::");
- Write(0x333333, false, ":");
- Write(0x66ff, true, ":::");
- Write(0x333333, false, ":");
- Write(0x66ff, true, ":::");
- Write(0x666666, false, "| | ");
- Write(0xcccccc, false, "18 ");
- Write(0xffff66, false, "**\n ");
- Write(0x666666, false, " |-------\\ / / / +===| | |");
- Write(0x333333, false, ":::");
- Write(0x66ff, true, ":");
- Write(0x333333, false, ":::");
- Write(0x66ff, true, ":");
- Write(0x333333, false, ":::");
- Write(0x666666, false, "| | ");
- Write(0xcccccc, false, "17 ");
- Write(0xffff66, false, "**\n ");
- Write(0x666666, false, " |--------\\ / / /|===| | |");
- Write(0x333333, false, ":::");
- Write(0x66ff, true, ":");
- Write(0x333333, false, ":::");
- Write(0x66ff, true, ":");
- Write(0x333333, false, ":::");
- Write(0x666666, false, "| | ");
- Write(0xcccccc, false, "16 ");
- Write(0xffff66, false, "**\n ");
- Write(0x666666, false, " |---------\\ / / |===| | /|");
- Write(0x66ff, true, ":::");
- Write(0x333333, false, ":");
- Write(0x66ff, true, ":::");
- Write(0x333333, false, ":");
- Write(0x66ff, true, ":::");
- Write(0x666666, false, "| | ");
- Write(0xcccccc, false, "15 ");
- Write(0xffff66, false, "**\n ");
- Write(0x666666, false, " |----------\\ / |===| / //|");
- Write(0x333333, false, ":");
- Write(0x66ff, true, ":");
- Write(0x333333, false, ":::");
- Write(0x66ff, true, ":");
- Write(0x333333, false, ":::");
- Write(0x66ff, true, ":");
- Write(0x333333, false, ":");
- Write(0x666666, false, "| / ");
- Write(0xcccccc, false, "14 ");
- Write(0xffff66, false, "**\n ");
- Write(0x666666, false, " +-----------+ |===| / //||");
- Write(0x333333, false, "::::");
- Write(0x66ff, true, ":");
- Write(0x333333, false, ":");
- Write(0x66ff, true, ":");
- Write(0x333333, false, "::::");
- Write(0x666666, false, "|/ ");
- Write(0xcccccc, false, "13 ");
- Write(0xffff66, false, "**\n ");
- Write(0x666666, false, " |");
- Write(0xff0000, true, ":");
- Write(0x333333, false, ":");
- Write(0xff0000, true, ":");
- Write(0x333333, false, "::::::::");
- Write(0x666666, false, "| |===|/__//___________________ ");
- Write(0xcccccc, false, "12 ");
- Write(0xffff66, false, "**\n ");
- Write(0x666666, false, " |");
- Write(0xff0000, true, ":::");
- Write(0x333333, false, ":");
- Write(0x9900, true, ":::");
- Write(0x333333, false, "::::");
- Write(0x666666, false, "| |______//|_____...._________ ");
- Write(0xcccccc, false, "11 ");
- Write(0xffff66, false, "**\n ");
- Write(0x666666, false, " |");
- Write(0xff0000, true, ":");
- Write(0x333333, false, ":");
- Write(0xff0000, true, ":");
- Write(0x333333, false, ":");
- Write(0x9900, true, ":");
- Write(0x333333, false, ":");
- Write(0x9900, true, ":");
- Write(0x333333, false, "::::");
- Write(0x666666, false, "| | //| ____/ /_/___ ");
- Write(0xcccccc, false, "10 ");
- Write(0xffff66, false, "**\n ");
- Write(0x666666, false, " ---|");
- Write(0x333333, false, "::::");
- Write(0x9900, true, ":::");
- Write(0x333333, false, "::::");
- Write(0x666666, false, "| |--------|[][]|_|[][]_\\------ ");
- Write(0xcccccc, false, " 9 ");
- Write(0xffff66, false, "**\n ");
- Write(0x666666, false, "----|");
- Write(0x333333, false, "::");
- Write(0xff0000, true, ":");
- Write(0x333333, false, ":");
- Write(0xff0000, true, ":");
- Write(0x333333, false, "::::::");
- Write(0x666666, false, "| |--------------------------- ");
- Write(0xcccccc, false, " 8 ");
- Write(0xffff66, false, "**\n ");
- Write(0x666666, false, " || |");
- Write(0x333333, false, "::");
- Write(0xff0000, true, ":::");
- Write(0x333333, false, ":");
- Write(0x9900, true, ":::");
- Write(0x333333, false, "::");
- Write(0x666666, false, "| | //| || / / / || || ");
- Write(0xcccccc, false, " 7 ");
- Write(0xffff66, false, "**\n ");
- Write(0x666666, false, " || |");
- Write(0x333333, false, "::");
- Write(0xff0000, true, ":");
- Write(0x333333, false, ":");
- Write(0xff0000, true, ":");
- Write(0x333333, false, ":");
- Write(0x9900, true, ":");
- Write(0x333333, false, ":");
- Write(0x9900, true, ":");
- Write(0x333333, false, "::");
- Write(0x666666, false, "| | //| || / / || ");
- Write(0xffff66, true, "*");
- Write(0x666666, false, " || ");
- Write(0xcccccc, false, " 6 ");
- Write(0xffff66, false, "**\n ");
- Write(0x666666, false, " |");
- Write(0x333333, false, "::::::");
- Write(0x9900, true, ":::");
- Write(0x333333, false, "::");
- Write(0x666666, false, "| |//| / / / ");
- Write(0x9900, false, ">");
- Write(0xff9900, true, "o");
- Write(0x9900, false, "< ");
- Write(0xcccccc, false, " 5 ");
- Write(0xffff66, false, "**\n ");
- Write(0x666666, false, " |");
- Write(0x333333, false, "::::");
- Write(0xff0000, true, ":");
- Write(0x333333, false, ":");
- Write(0xff0000, true, ":");
- Write(0x333333, false, "::::");
- Write(0x666666, false, "| //| / / ___");
- Write(0x9900, false, ">");
- Write(0xff0000, true, "@");
- Write(0x9900, false, ">");
- Write(0x66ff, true, "O");
- Write(0x9900, false, "<");
- Write(0x666666, false, "____ ");
- Write(0xcccccc, false, " 4 ");
- Write(0xffff66, false, "**\n ");
- Write(0x666666, false, " |");
- Write(0x333333, false, "::::");
- Write(0xff0000, true, ":::");
- Write(0x333333, false, ":");
- Write(0x9900, true, ":::");
- Write(0x666666, false, "| //| / / / / ");
- Write(0x9900, false, ">");
- Write(0x66ff, true, "O");
- Write(0x9900, false, ">");
- Write(0xff9900, true, "o");
- Write(0x9900, false, "<");
- Write(0xff0000, true, "@");
- Write(0x9900, false, "<");
- Write(0x666666, false, " / ");
- Write(0xcccccc, false, " 3 ");
- Write(0xffff66, false, "**\n ");
- Write(0x666666, false, " |");
- Write(0x333333, false, "::::");
- Write(0xff0000, true, ":");
- Write(0x333333, false, ":");
- Write(0xff0000, true, ":");
- Write(0x333333, false, ":");
- Write(0x9900, true, ":");
- Write(0x333333, false, ":");
- Write(0x9900, true, ":");
- Write(0x666666, false, "| //| / / / ");
- Write(0xaaaaaa, false, "_| |_");
- Write(0x666666, false, " / ");
- Write(0xcccccc, false, " 2 ");
- Write(0xffff66, false, "**\n ");
- Write(0x666666, false, " |");
- Write(0x333333, false, "::::::::");
- Write(0x9900, true, ":::");
- Write(0x666666, false, "|//| / / / /___________/ ");
- Write(0xcccccc, false, " 1 ");
- Write(0xffff66, false, "**\n ");
- Write(0x666666, false, " ==============//======+...+==================== \n - - - - - - -// - - -/ / - -");
- Write(0x666666, false, " - - - - - - - - \n ==============//|============================== \n ");
- Write(0x666666, false, " //| \n \n");
-
+ Write(0xcc00, false, " █ █ █ █ █ █▄█\n █ █ █▄█ ▀▄▀ █▄▄ █ █ █▄ █▄█ █ █▄ █▄█ █▄█ █▄▄ // 2016\n \n ");
+ Write(0xcc00, false, " ");
+ Write(0xffff66, true, "( ( ( ( ((*)) ) ) ) ) \n ");
+ Write(0x666666, false, " | \n +-|---+ ");
+ Write(0x666666, false, " \n / | /| \n ");
+ Write(0x666666, false, " +-----+ | \n |");
+ Write(0x333333, false, "::");
+ Write(0xffff66, true, ":");
+ Write(0x333333, false, "::");
+ Write(0x666666, false, "| | ");
+ Write(0xcccccc, false, "25 ");
+ Write(0xffff66, false, "**\n ");
+ Write(0x666666, false, " +----+ |");
+ Write(0x333333, false, "::");
+ Write(0x9900, true, ":");
+ Write(0x333333, false, "::");
+ Write(0x666666, false, "| |---+ +-----------+ ");
+ Write(0xcccccc, false, "24 ");
+ Write(0xffff66, false, "**\n ");
+ Write(0x666666, false, " / / \\ |");
+ Write(0x333333, false, ":");
+ Write(0x9900, true, ":::");
+ Write(0x333333, false, ":");
+ Write(0x666666, false, "| | /| / \\\\\\\\\\\\ [] /| ");
+ Write(0xcccccc, false, "23 ");
+ Write(0xffff66, false, "**\n ");
+ Write(0x666666, false, " / / / \\|");
+ Write(0x9900, true, ":::::");
+ Write(0x666666, false, "| | / | / \\\\\\\\\\\\ [] / | ");
+ Write(0xcccccc, false, "22 ");
+ Write(0xffff66, false, "**\n ");
+ Write(0x666666, false, " / / / / \\");
+ Write(0x333333, false, "::");
+ Write(0x553322, true, ":");
+ Write(0x333333, false, "::");
+ Write(0x666666, false, "|/ / | +-----------+ | ");
+ Write(0xcccccc, false, "21 ");
+ Write(0xffff66, false, "**\n ");
+ Write(0x666666, false, " +----+ / / / \\------+ ------|");
+ Write(0x333333, false, "::::");
+ Write(0x66ff, true, ":");
+ Write(0x333333, false, ":");
+ Write(0x66ff, true, ":");
+ Write(0x333333, false, "::::");
+ Write(0x666666, false, "| | ");
+ Write(0xcccccc, false, "20 ");
+ Write(0xffff66, false, "**\n ");
+ Write(0x666666, false, " |-----\\ / / / \\=====| ------|");
+ Write(0x333333, false, ":");
+ Write(0x66ff, true, ":");
+ Write(0x333333, false, ":::");
+ Write(0x66ff, true, ":");
+ Write(0x333333, false, ":::");
+ Write(0x66ff, true, ":");
+ Write(0x333333, false, ":");
+ Write(0x666666, false, "| | ");
+ Write(0xcccccc, false, "19 ");
+ Write(0xffff66, false, "**\n ");
+ Write(0x666666, false, " |------\\ / / / \\====| | |");
+ Write(0x66ff, true, ":::");
+ Write(0x333333, false, ":");
+ Write(0x66ff, true, ":::");
+ Write(0x333333, false, ":");
+ Write(0x66ff, true, ":::");
+ Write(0x666666, false, "| | ");
+ Write(0xcccccc, false, "18 ");
+ Write(0xffff66, false, "**\n ");
+ Write(0x666666, false, " |-------\\ / / / +===| | |");
+ Write(0x333333, false, ":::");
+ Write(0x66ff, true, ":");
+ Write(0x333333, false, ":::");
+ Write(0x66ff, true, ":");
+ Write(0x333333, false, ":::");
+ Write(0x666666, false, "| | ");
+ Write(0xcccccc, false, "17 ");
+ Write(0xffff66, false, "**\n ");
+ Write(0x666666, false, " |--------\\ / / /|===| | |");
+ Write(0x333333, false, ":::");
+ Write(0x66ff, true, ":");
+ Write(0x333333, false, ":::");
+ Write(0x66ff, true, ":");
+ Write(0x333333, false, ":::");
+ Write(0x666666, false, "| | ");
+ Write(0xcccccc, false, "16 ");
+ Write(0xffff66, false, "**\n ");
+ Write(0x666666, false, " |---------\\ / / |===| | /|");
+ Write(0x66ff, true, ":::");
+ Write(0x333333, false, ":");
+ Write(0x66ff, true, ":::");
+ Write(0x333333, false, ":");
+ Write(0x66ff, true, ":::");
+ Write(0x666666, false, "| | ");
+ Write(0xcccccc, false, "15 ");
+ Write(0xffff66, false, "**\n ");
+ Write(0x666666, false, " |----------\\ / |===| / //|");
+ Write(0x333333, false, ":");
+ Write(0x66ff, true, ":");
+ Write(0x333333, false, ":::");
+ Write(0x66ff, true, ":");
+ Write(0x333333, false, ":::");
+ Write(0x66ff, true, ":");
+ Write(0x333333, false, ":");
+ Write(0x666666, false, "| / ");
+ Write(0xcccccc, false, "14 ");
+ Write(0xffff66, false, "**\n ");
+ Write(0x666666, false, " +-----------+ |===| / //||");
+ Write(0x333333, false, "::::");
+ Write(0x66ff, true, ":");
+ Write(0x333333, false, ":");
+ Write(0x66ff, true, ":");
+ Write(0x333333, false, "::::");
+ Write(0x666666, false, "|/ ");
+ Write(0xcccccc, false, "13 ");
+ Write(0xffff66, false, "**\n ");
+ Write(0x666666, false, " |");
+ Write(0xff0000, true, ":");
+ Write(0x333333, false, ":");
+ Write(0xff0000, true, ":");
+ Write(0x333333, false, "::::::::");
+ Write(0x666666, false, "| |===|/__//___________________ ");
+ Write(0xcccccc, false, "12 ");
+ Write(0xffff66, false, "**\n ");
+ Write(0x666666, false, " |");
+ Write(0xff0000, true, ":::");
+ Write(0x333333, false, ":");
+ Write(0x9900, true, ":::");
+ Write(0x333333, false, "::::");
+ Write(0x666666, false, "| |______//|_____...._________ ");
+ Write(0xcccccc, false, "11 ");
+ Write(0xffff66, false, "**\n ");
+ Write(0x666666, false, " |");
+ Write(0xff0000, true, ":");
+ Write(0x333333, false, ":");
+ Write(0xff0000, true, ":");
+ Write(0x333333, false, ":");
+ Write(0x9900, true, ":");
+ Write(0x333333, false, ":");
+ Write(0x9900, true, ":");
+ Write(0x333333, false, "::::");
+ Write(0x666666, false, "| | //| ____/ /_/___ ");
+ Write(0xcccccc, false, "10 ");
+ Write(0xffff66, false, "**\n ");
+ Write(0x666666, false, " ---|");
+ Write(0x333333, false, "::::");
+ Write(0x9900, true, ":::");
+ Write(0x333333, false, "::::");
+ Write(0x666666, false, "| |--------|[][]|_|[][]_\\------ ");
+ Write(0xcccccc, false, " 9 ");
+ Write(0xffff66, false, "**\n ");
+ Write(0x666666, false, "----|");
+ Write(0x333333, false, "::");
+ Write(0xff0000, true, ":");
+ Write(0x333333, false, ":");
+ Write(0xff0000, true, ":");
+ Write(0x333333, false, "::::::");
+ Write(0x666666, false, "| |--------------------------- ");
+ Write(0xcccccc, false, " 8 ");
+ Write(0xffff66, false, "**\n ");
+ Write(0x666666, false, " || |");
+ Write(0x333333, false, "::");
+ Write(0xff0000, true, ":::");
+ Write(0x333333, false, ":");
+ Write(0x9900, true, ":::");
+ Write(0x333333, false, "::");
+ Write(0x666666, false, "| | //| || / / / || || ");
+ Write(0xcccccc, false, " 7 ");
+ Write(0xffff66, false, "**\n ");
+ Write(0x666666, false, " || |");
+ Write(0x333333, false, "::");
+ Write(0xff0000, true, ":");
+ Write(0x333333, false, ":");
+ Write(0xff0000, true, ":");
+ Write(0x333333, false, ":");
+ Write(0x9900, true, ":");
+ Write(0x333333, false, ":");
+ Write(0x9900, true, ":");
+ Write(0x333333, false, "::");
+ Write(0x666666, false, "| | //| || / / || ");
+ Write(0xffff66, true, "*");
+ Write(0x666666, false, " || ");
+ Write(0xcccccc, false, " 6 ");
+ Write(0xffff66, false, "**\n ");
+ Write(0x666666, false, " |");
+ Write(0x333333, false, "::::::");
+ Write(0x9900, true, ":::");
+ Write(0x333333, false, "::");
+ Write(0x666666, false, "| |//| / / / ");
+ Write(0x9900, false, ">");
+ Write(0xff9900, true, "o");
+ Write(0x9900, false, "< ");
+ Write(0xcccccc, false, " 5 ");
+ Write(0xffff66, false, "**\n ");
+ Write(0x666666, false, " |");
+ Write(0x333333, false, "::::");
+ Write(0xff0000, true, ":");
+ Write(0x333333, false, ":");
+ Write(0xff0000, true, ":");
+ Write(0x333333, false, "::::");
+ Write(0x666666, false, "| //| / / ___");
+ Write(0x9900, false, ">");
+ Write(0xff0000, true, "@");
+ Write(0x9900, false, ">");
+ Write(0x66ff, true, "O");
+ Write(0x9900, false, "<");
+ Write(0x666666, false, "____ ");
+ Write(0xcccccc, false, " 4 ");
+ Write(0xffff66, false, "**\n ");
+ Write(0x666666, false, " |");
+ Write(0x333333, false, "::::");
+ Write(0xff0000, true, ":::");
+ Write(0x333333, false, ":");
+ Write(0x9900, true, ":::");
+ Write(0x666666, false, "| //| / / / / ");
+ Write(0x9900, false, ">");
+ Write(0x66ff, true, "O");
+ Write(0x9900, false, ">");
+ Write(0xff9900, true, "o");
+ Write(0x9900, false, "<");
+ Write(0xff0000, true, "@");
+ Write(0x9900, false, "<");
+ Write(0x666666, false, " / ");
+ Write(0xcccccc, false, " 3 ");
+ Write(0xffff66, false, "**\n ");
+ Write(0x666666, false, " |");
+ Write(0x333333, false, "::::");
+ Write(0xff0000, true, ":");
+ Write(0x333333, false, ":");
+ Write(0xff0000, true, ":");
+ Write(0x333333, false, ":");
+ Write(0x9900, true, ":");
+ Write(0x333333, false, ":");
+ Write(0x9900, true, ":");
+ Write(0x666666, false, "| //| / / / ");
+ Write(0xaaaaaa, false, "_| |_");
+ Write(0x666666, false, " / ");
+ Write(0xcccccc, false, " 2 ");
+ Write(0xffff66, false, "**\n ");
+ Write(0x666666, false, " |");
+ Write(0x333333, false, "::::::::");
+ Write(0x9900, true, ":::");
+ Write(0x666666, false, "|//| / / / /___________/ ");
+ Write(0xcccccc, false, " 1 ");
+ Write(0xffff66, false, "**\n ");
+ Write(0x666666, false, " ==============//======+...+==================== \n - - - - - - -// - - -/ / - -");
+ Write(0x666666, false, " - - - - - - - - \n ==============//|============================== \n ");
+ Write(0x666666, false, " //| \n \n");
+
Console.ForegroundColor = color;
Console.WriteLine();
}
- private static void Write(int rgb, bool bold, string text){
+ private static void Write(int rgb, bool bold, string text){
Console.Write($"\u001b[38;2;{(rgb>>16)&255};{(rgb>>8)&255};{rgb&255}{(bold ? ";1" : "")}m{text}");
- }
-}
\ No newline at end of file
+ }
+}
diff --git a/2016/calendar.svg b/2016/calendar.svg
index 001a5323e..cf103d895 100644
--- a/2016/calendar.svg
+++ b/2016/calendar.svg
@@ -1,15 +1,15 @@
\ No newline at end of file
+
\ No newline at end of file
diff --git a/2017/Day01/README.md b/2017/Day01/README.md
index ceb540a18..b9f981871 100644
--- a/2017/Day01/README.md
+++ b/2017/Day01/README.md
@@ -1,6 +1,42 @@
+original source: [https://adventofcode.com/2017/day/1](https://adventofcode.com/2017/day/1)
## --- Day 1: Inverse Captcha ---
The night before Christmas, one of Santa's Elves calls you in a panic. "The printer's broken! We can't print the Naughty or Nice List!" By the time you make it to sub-basement 17, there are only a few minutes until midnight. "We have a big problem," she says; "there must be almost fifty bugs in this system, but nothing else can print The List. Stand in this square, quick! There's no time to explain; if you can convince them to pay you in stars, you'll be able to--" She pulls a lever and the world goes blurry.
When your eyes can focus again, everything seems a lot more pixelated than before. She must have sent you inside the computer! You check the system clock: 25 milliseconds until midnight. With that much time, you should be able to collect all fifty stars by December 25th.
-_Visit the website for the full story and [full puzzle](https://adventofcode.com/2017/day/1) description._
+Collect stars by solving puzzles. Two puzzles will be made available on each ~~day~~ millisecond in the Advent calendar; the second puzzle is unlocked when you complete the first. Each puzzle grants one star. Good luck!
+
+You're standing in a room with "digitization quarantine" written in LEDs along one wall. The only door is locked, but it includes a small interface. "Restricted Area - Strictly No Digitized Users Allowed."
+
+It goes on to explain that you may only leave by solving a [captcha](https://en.wikipedia.org/wiki/CAPTCHA) to prove you're not a human. Apparently, you only get one millisecond to solve the captcha: too fast for a normal human, but it feels like hours to you.
+
+The captcha requires you to review a sequence of digits (your puzzle input) and find the sum of all digits that match the next digit in the list. The list is circular, so the digit after the last digit is the first digit in the list.
+
+For example:
+
+
+ - 1122 produces a sum of 3 (1 + 2) because the first digit (1) matches the second digit and the third digit (2) matches the fourth digit.
+ - 1111 produces 4 because each digit (all 1) matches the next.
+ - 1234 produces 0 because no digit matches the next.
+ - 91212129 produces 9 because the only digit that matches the next one is the last digit, 9.
+
+What is the solution to your captcha?
+
+
+## --- Part Two ---
+You notice a progress bar that jumps to 50% completion. Apparently, the door isn't yet satisfied, but it did emit a star as encouragement. The instructions change:
+
+Now, instead of considering the next digit, it wants you to consider the digit halfway around the circular list. That is, if your list contains 10 items, only include a digit in your sum if the digit 10/2 = 5 steps forward matches it. Fortunately, your list has an even number of elements.
+
+For example:
+
+
+ - 1212 produces 6: the list contains 4 items, and all four digits match the digit 2 items ahead.
+ - 1221 produces 0, because every comparison is between a 1 and a 2.
+ - 123425 produces 4, because both 2s match each other, but no other digit has a match.
+ - 123123 produces 12.
+ - 12131415 produces 4.
+
+What is the solution to your new captcha?
+
+
diff --git a/2017/Day01/input.in b/2017/Day01/input.in
index a2138c7ab..2b1f7768f 100644
Binary files a/2017/Day01/input.in and b/2017/Day01/input.in differ
diff --git a/2017/Day02/README.md b/2017/Day02/README.md
index f2bb4b766..e007cf40b 100644
--- a/2017/Day02/README.md
+++ b/2017/Day02/README.md
@@ -1,6 +1,49 @@
+original source: [https://adventofcode.com/2017/day/2](https://adventofcode.com/2017/day/2)
## --- Day 2: Corruption Checksum ---
As you walk through the door, a glowing humanoid shape yells in your direction. "You there! Your state appears to be idle. Come help us repair the corruption in this spreadsheet - if we take another millisecond, we'll have to display an hourglass cursor!"
The spreadsheet consists of rows of apparently-random numbers. To make sure the recovery process is on the right track, they need you to calculate the spreadsheet's *checksum*. For each row, determine the difference between the largest value and the smallest value; the checksum is the sum of all of these differences.
-Read the [full puzzle](https://adventofcode.com/2017/day/2).
\ No newline at end of file
+For example, given the following spreadsheet:
+
+```
+5 1 9 5
+7 5 3
+2 4 6 8
+```
+
+
+ - The first row's largest and smallest values are `9` and `1`, and their difference is `8`.
+ - The second row's largest and smallest values are `7` and `3`, and their difference is `4`.
+ - The third row's difference is `6`.
+
+In this example, the spreadsheet's checksum would be `8 + 4 + 6 = 18`.
+
+*What is the checksum* for the spreadsheet in your puzzle input?
+
+
+## --- Part Two ---
+"Great work; looks like we're on the right track after all. Here's a *star* for your effort." However, the program seems a little worried. Can programs *be* worried?
+
+"Based on what we're seeing, it looks like all the User wanted is some information about the *evenly divisible values* in the spreadsheet. Unfortunately, none of us are equipped for that kind of calculation - most of us specialize in bitwise operations."
+
+It sounds like the goal is to find the only two numbers in each row where one evenly divides the other - that is, where the result of the division operation is a whole number. They would like you to find those numbers on each line, divide them, and add up each line's result.
+
+For example, given the following spreadsheet:
+
+```
+5 9 2 8
+9 4 7 3
+3 8 6 5
+```
+
+
+ - In the first row, the only two numbers that evenly divide are `8` and `2`; the result of this division is `4`.
+ - In the second row, the two numbers are `9` and `3`; the result is `3`.
+ - In the third row, the result is `2`.
+
+In this example, the sum of the results would be `4 + 3 + 2 = 9`.
+
+What is the *sum of each row's result* in your puzzle input?
+
+
diff --git a/2017/Day02/input.in b/2017/Day02/input.in
index e09ace427..ff84c807e 100644
Binary files a/2017/Day02/input.in and b/2017/Day02/input.in differ
diff --git a/2017/Day03/README.md b/2017/Day03/README.md
index 8bf5afc07..2040b18ef 100644
--- a/2017/Day03/README.md
+++ b/2017/Day03/README.md
@@ -1,6 +1,52 @@
+original source: [https://adventofcode.com/2017/day/3](https://adventofcode.com/2017/day/3)
## --- Day 3: Spiral Memory ---
You come across an experimental new kind of memory stored on an infinite two-dimensional grid.
Each square on the grid is allocated in a spiral pattern starting at a location marked `1` and then counting up while spiraling outward. For example, the first few squares are allocated like this:
-Read the [full puzzle](https://adventofcode.com/2017/day/3).
\ No newline at end of file
+```
+17 16 15 14 13
+18 5 4 3 12
+19 6 1 2 11
+20 7 8 9 10
+21 22 23---> ...
+```
+
+While this is very space-efficient (no squares are skipped), requested data must be carried back to square `1` (the location of the only access port for this memory system) by programs that can only move up, down, left, or right. They always take the shortest path: the [Manhattan Distance](https://en.wikipedia.org/wiki/Taxicab_geometry) between the location of the data and square `1`.
+
+For example:
+
+
+ - Data from square `1` is carried `0` steps, since it's at the access port.
+ - Data from square `12` is carried `3` steps, such as: down, left, left.
+ - Data from square `23` is carried only `2` steps: up twice.
+ - Data from square `1024` must be carried `31` steps.
+
+*How many steps* are required to carry the data from the square identified in your puzzle input all the way to the access port?
+
+
+## --- Part Two ---
+As a stress test on the system, the programs here clear the grid and then store the value `1` in square `1`. Then, in the same allocation order as shown above, they store the sum of the values in all adjacent squares, including diagonals.
+
+So, the first few squares' values are chosen as follows:
+
+
+ - Square `1` starts with the value `1`.
+ - Square `2` has only one adjacent filled square (with value `1`), so it also stores `1`.
+ - Square `3` has both of the above squares as neighbors and stores the sum of their values, `2`.
+ - Square `4` has all three of the aforementioned squares as neighbors and stores the sum of their values, `4`.
+ - Square `5` only has the first and fourth squares as neighbors, so it gets the value `5`.
+
+Once a square is written, its value does not change. Therefore, the first few squares would receive the following values:
+
+```
+147 142 133 122 59
+304 5 4 2 57
+330 10 1 1 54
+351 11 23 25 26
+362 747 806---> ...
+```
+
+What is the *first value written* that is *larger* than your puzzle input?
+
+
diff --git a/2017/Day03/input.in b/2017/Day03/input.in
index 799a453dc..232509ee5 100644
Binary files a/2017/Day03/input.in and b/2017/Day03/input.in differ
diff --git a/2017/Day04/README.md b/2017/Day04/README.md
index 1c942d90a..95fb9c63f 100644
--- a/2017/Day04/README.md
+++ b/2017/Day04/README.md
@@ -1,6 +1,31 @@
+original source: [https://adventofcode.com/2017/day/4](https://adventofcode.com/2017/day/4)
## --- Day 4: High-Entropy Passphrases ---
A new system policy has been put in place that requires all accounts to use a *passphrase* instead of simply a pass*word*. A passphrase consists of a series of words (lowercase letters) separated by spaces.
To ensure security, a valid passphrase must contain no duplicate words.
-Read the [full puzzle](https://adventofcode.com/2017/day/4).
\ No newline at end of file
+For example:
+
+
+ - `aa bb cc dd ee` is valid.
+ - `aa bb cc dd aa` is not valid - the word `aa` appears more than once.
+ - `aa bb cc dd aaa` is valid - `aa` and `aaa` count as different words.
+
+The system's full passphrase list is available as your puzzle input. *How many passphrases are valid?*
+
+
+## --- Part Two ---
+For added security, yet another system policy has been put in place. Now, a valid passphrase must contain no two words that are anagrams of each other - that is, a passphrase is invalid if any word's letters can be rearranged to form any other word in the passphrase.
+
+For example:
+
+
+ - `abcde fghij` is a valid passphrase.
+ - `abcde xyz ecdab` is not valid - the letters from the third word can be rearranged to form the first word.
+ - `a ab abc abd abf abj` is a valid passphrase, because *all* letters need to be used when forming another word.
+ - `iiii oiii ooii oooi oooo` is valid.
+ - `oiii ioii iioi iiio` is not valid - any of these words can be rearranged to form any other word.
+
+Under this new system policy, *how many passphrases are valid?*
+
+
diff --git a/2017/Day04/input.in b/2017/Day04/input.in
index a2a581f41..dc46914f7 100644
Binary files a/2017/Day04/input.in and b/2017/Day04/input.in differ
diff --git a/2017/Day05/README.md b/2017/Day05/README.md
index 838976f6a..58e0a5de5 100644
--- a/2017/Day05/README.md
+++ b/2017/Day05/README.md
@@ -1,6 +1,41 @@
+original source: [https://adventofcode.com/2017/day/5](https://adventofcode.com/2017/day/5)
## --- Day 5: A Maze of Twisty Trampolines, All Alike ---
An urgent interrupt arrives from the CPU: it's trapped in a maze of jump instructions, and it would like assistance from any programs with spare cycles to help find the exit.
The message includes a list of the offsets for each jump. Jumps are relative: `-1` moves to the previous instruction, and `2` skips the next one. Start at the first instruction in the list. The goal is to follow the jumps until one leads *outside* the list.
-Read the [full puzzle](https://adventofcode.com/2017/day/5).
\ No newline at end of file
+In addition, these instructions are a little strange; after each jump, the offset of that instruction increases by `1`. So, if you come across an offset of `3`, you would move three instructions forward, but change it to a `4` for the next time it is encountered.
+
+For example, consider the following list of jump offsets:
+
+```
+0
+3
+0
+1
+-3
+```
+
+Positive jumps ("forward") move downward; negative jumps move upward. For legibility in this example, these offset values will be written all on one line, with the current instruction marked in parentheses. The following steps would be taken before an exit is found:
+
+
+ - `(0) 3 0 1 -3 ` - *before* we have taken any steps.
+ - `(1) 3 0 1 -3 ` - jump with offset `0` (that is, don't jump at all). Fortunately, the instruction is then incremented to `1`.
+ - ` 2 (3) 0 1 -3 ` - step forward because of the instruction we just modified. The first instruction is incremented again, now to `2`.
+ - ` 2 4 0 1 (-3)` - jump all the way to the end; leave a `4` behind.
+ - ` 2 (4) 0 1 -2 ` - go back to where we just were; increment `-3` to `-2`.
+ - ` 2 5 0 1 -2 ` - jump `4` steps forward, escaping the maze.
+
+In this example, the exit is reached in `5` steps.
+
+*How many steps* does it take to reach the exit?
+
+
+## --- Part Two ---
+Now, the jumps are even stranger: after each jump, if the offset was *three or more*, instead *decrease* it by `1`. Otherwise, increase it by `1` as before.
+
+Using this rule with the above example, the process now takes `10` steps, and the offset values after finding the exit are left as `2 3 2 3 -1`.
+
+*How many steps* does it now take to reach the exit?
+
+
diff --git a/2017/Day05/input.in b/2017/Day05/input.in
index a6f2d41e0..9a15026f9 100644
Binary files a/2017/Day05/input.in and b/2017/Day05/input.in differ
diff --git a/2017/Day06/README.md b/2017/Day06/README.md
index a3a4fd7ba..96f8c8808 100644
--- a/2017/Day06/README.md
+++ b/2017/Day06/README.md
@@ -1,6 +1,33 @@
+original source: [https://adventofcode.com/2017/day/6](https://adventofcode.com/2017/day/6)
## --- Day 6: Memory Reallocation ---
A debugger program here is having an issue: it is trying to repair a memory reallocation routine, but it keeps getting stuck in an infinite loop.
In this area, there are sixteen memory banks; each memory bank can hold any number of *blocks*. The goal of the reallocation routine is to balance the blocks between the memory banks.
-Read the [full puzzle](https://adventofcode.com/2017/day/6).
\ No newline at end of file
+The reallocation routine operates in cycles. In each cycle, it finds the memory bank with the most blocks (ties won by the lowest-numbered memory bank) and redistributes those blocks among the banks. To do this, it removes all of the blocks from the selected bank, then moves to the next (by index) memory bank and inserts one of the blocks. It continues doing this until it runs out of blocks; if it reaches the last memory bank, it wraps around to the first one.
+
+The debugger would like to know how many redistributions can be done before a blocks-in-banks configuration is produced that *has been seen before*.
+
+For example, imagine a scenario with only four memory banks:
+
+
+ - The banks start with `0`, `2`, `7`, and `0` blocks. The third bank has the most blocks, so it is chosen for redistribution.
+ - Starting with the next bank (the fourth bank) and then continuing to the first bank, the second bank, and so on, the `7` blocks are spread out over the memory banks. The fourth, first, and second banks get two blocks each, and the third bank gets one back. The final result looks like this: `2 4 1 2`.
+ - Next, the second bank is chosen because it contains the most blocks (four). Because there are four memory banks, each gets one block. The result is: `3 1 2 3`.
+ - Now, there is a tie between the first and fourth memory banks, both of which have three blocks. The first bank wins the tie, and its three blocks are distributed evenly over the other three banks, leaving it with none: `0 2 3 4`.
+ - The fourth bank is chosen, and its four blocks are distributed such that each of the four banks receives one: `1 3 4 1`.
+ - The third bank is chosen, and the same thing happens: `2 4 1 2`.
+
+At this point, we've reached a state we've seen before: `2 4 1 2` was already seen. The infinite loop is detected after the fifth block redistribution cycle, and so the answer in this example is `5`.
+
+Given the initial block counts in your puzzle input, *how many redistribution cycles* must be completed before a configuration is produced that has been seen before?
+
+
+## --- Part Two ---
+Out of curiosity, the debugger would also like to know the size of the loop: starting from a state that has already been seen, how many block redistribution cycles must be performed before that same state is seen again?
+
+In the example above, `2 4 1 2` is seen again after four cycles, and so the answer in that example would be `4`.
+
+*How many cycles* are in the infinite loop that arises from the configuration in your puzzle input?
+
+
diff --git a/2017/Day06/input.in b/2017/Day06/input.in
index 90d310c5a..517243634 100644
Binary files a/2017/Day06/input.in and b/2017/Day06/input.in differ
diff --git a/2017/Day07/README.md b/2017/Day07/README.md
index 5d8adfa75..8ea8c8000 100644
--- a/2017/Day07/README.md
+++ b/2017/Day07/README.md
@@ -1,6 +1,72 @@
+original source: [https://adventofcode.com/2017/day/7](https://adventofcode.com/2017/day/7)
## --- Day 7: Recursive Circus ---
Wandering further through the circuits of the computer, you come upon a tower of programs that have gotten themselves into a bit of trouble. A recursive algorithm has gotten out of hand, and now they're balanced precariously in a large tower.
One program at the bottom supports the entire tower. It's holding a large disc, and on the disc are balanced several more sub-towers. At the bottom of these sub-towers, standing on the bottom disc, are other programs, each holding *their* own disc, and so on. At the very tops of these sub-sub-sub-...-towers, many programs stand simply keeping the disc below them balanced but with no disc of their own.
-Read the [full puzzle](https://adventofcode.com/2017/day/7).
\ No newline at end of file
+You offer to help, but first you need to understand the structure of these towers. You ask each program to yell out their *name*, their *weight*, and (if they're holding a disc) the *names of the programs immediately above them* balancing on that disc. You write this information down (your puzzle input). Unfortunately, in their panic, they don't do this in an orderly fashion; by the time you're done, you're not sure which program gave which information.
+
+For example, if your list is the following:
+
+```
+pbga (66)
+xhth (57)
+ebii (61)
+havc (66)
+ktlj (57)
+fwft (72) -> ktlj, cntj, xhth
+qoyq (66)
+padx (45) -> pbga, havc, qoyq
+tknk (41) -> ugml, padx, fwft
+jptl (61)
+ugml (68) -> gyxo, ebii, jptl
+gyxo (61)
+cntj (57)
+```
+
+...then you would be able to recreate the structure of the towers that looks like this:
+
+```
+ gyxo
+ /
+ ugml - ebii
+ / \
+ | jptl
+ |
+ | pbga
+ / /
+tknk --- padx - havc
+ \ \
+ | qoyq
+ |
+ | ktlj
+ \ /
+ fwft - cntj
+ \
+ xhth
+```
+
+In this example, `tknk` is at the bottom of the tower (the *bottom program*), and is holding up `ugml`, `padx`, and `fwft`. Those programs are, in turn, holding up other programs; in this example, none of those programs are holding up any other programs, and are all the tops of their own towers. (The actual tower balancing in front of you is much larger.)
+
+Before you're ready to help them, you need to make sure your information is correct. *What is the name of the bottom program?*
+
+
+## --- Part Two ---
+The programs explain the situation: they can't get down. Rather, they *could* get down, if they weren't expending all of their energy trying to keep the tower balanced. Apparently, one program has the *wrong weight*, and until it's fixed, they're stuck here.
+
+For any program holding a disc, each program standing on that disc forms a sub-tower. Each of those sub-towers are supposed to be the same weight, or the disc itself isn't balanced. The weight of a tower is the sum of the weights of the programs in that tower.
+
+In the example above, this means that for `ugml`'s disc to be balanced, `gyxo`, `ebii`, and `jptl` must all have the same weight, and they do: `61`.
+
+However, for `tknk` to be balanced, each of the programs standing on its disc *and all programs above it* must each match. This means that the following sums must all be the same:
+
+
+ - `ugml` + (`gyxo` + `ebii` + `jptl`) = 68 + (61 + 61 + 61) = 251
+ - `padx` + (`pbga` + `havc` + `qoyq`) = 45 + (66 + 66 + 66) = 243
+ - `fwft` + (`ktlj` + `cntj` + `xhth`) = 72 + (57 + 57 + 57) = 243
+
+As you can see, `tknk`'s disc is unbalanced: `ugml`'s stack is heavier than the other two. Even though the nodes above `ugml` are balanced, `ugml` itself is too heavy: it needs to be `8` units lighter for its stack to weigh `243` and keep the towers balanced. If this change were made, its weight would be `60`.
+
+Given that exactly one program is the wrong weight, *what would its weight need to be* to balance the entire tower?
+
+
diff --git a/2017/Day07/input.in b/2017/Day07/input.in
index 0f1f687ea..b74e00e71 100644
Binary files a/2017/Day07/input.in and b/2017/Day07/input.in differ
diff --git a/2017/Day08/README.md b/2017/Day08/README.md
index b8a09384d..0873dd695 100644
--- a/2017/Day08/README.md
+++ b/2017/Day08/README.md
@@ -1,6 +1,32 @@
+original source: [https://adventofcode.com/2017/day/8](https://adventofcode.com/2017/day/8)
## --- Day 8: I Heard You Like Registers ---
You receive a signal directly from the CPU. Because of your recent assistance with [jump instructions](5), it would like you to compute the result of a series of unusual register instructions.
Each instruction consists of several parts: the register to modify, whether to increase or decrease that register's value, the amount by which to increase or decrease it, and a condition. If the condition fails, skip the instruction without modifying the register. The registers all start at `0`. The instructions look like this:
-Read the [full puzzle](https://adventofcode.com/2017/day/8).
\ No newline at end of file
+```
+b inc 5 if a > 1
+a inc 1 if b < 5
+c dec -10 if a >= 1
+c inc -20 if c == 10
+```
+
+These instructions would be processed as follows:
+
+
+ - Because `a` starts at `0`, it is not greater than `1`, and so `b` is not modified.
+ - `a` is increased by `1` (to `1`) because `b` is less than `5` (it is `0`).
+ - `c` is decreased by `-10` (to `10`) because `a` is now greater than or equal to `1` (it is `1`).
+ - `c` is increased by `-20` (to `-10`) because `c` is equal to `10`.
+
+After this process, the largest value in any register is `1`.
+
+You might also encounter `<=` (less than or equal to) or `!=` (not equal to). However, the CPU doesn't have the bandwidth to tell you what all the registers are named, and leaves that to you to determine.
+
+*What is the largest value in any register* after completing the instructions in your puzzle input?
+
+
+## --- Part Two ---
+To be safe, the CPU also needs to know *the highest value held in any register during this process* so that it can decide how much memory to allocate to these operations. For example, in the above instructions, the highest value ever held was `10` (in register `c` after the third instruction was evaluated).
+
+
diff --git a/2017/Day08/input.in b/2017/Day08/input.in
index 94afcf93d..6f2de6441 100644
Binary files a/2017/Day08/input.in and b/2017/Day08/input.in differ
diff --git a/2017/Day09/README.md b/2017/Day09/README.md
index 03e6ad6b8..585c7addd 100644
--- a/2017/Day09/README.md
+++ b/2017/Day09/README.md
@@ -1,6 +1,67 @@
+original source: [https://adventofcode.com/2017/day/9](https://adventofcode.com/2017/day/9)
## --- Day 9: Stream Processing ---
A large stream blocks your path. According to the locals, it's not safe to cross the stream at the moment because it's full of *garbage*. You look down at the stream; rather than water, you discover that it's a *stream of characters*.
You sit for a while and record part of the stream (your puzzle input). The characters represent *groups* - sequences that begin with `{` and end with `}`. Within a group, there are zero or more other things, separated by commas: either another *group* or *garbage*. Since groups can contain other groups, a `}` only closes the *most-recently-opened unclosed group* - that is, they are nestable. Your puzzle input represents a single, large group which itself contains many smaller ones.
-Read the [full puzzle](https://adventofcode.com/2017/day/9).
\ No newline at end of file
+Sometimes, instead of a group, you will find *garbage*. Garbage begins with `<` and ends with `>`. Between those angle brackets, almost any character can appear, including `{` and `}`. *Within* garbage, `<` has no special meaning.
+
+In a futile attempt to clean up the garbage, some program has *canceled* some of the characters within it using `!`: inside garbage, *any* character that comes after `!` should be *ignored*, including `<`, `>`, and even another `!`.
+
+You don't see any characters that deviate from these rules. Outside garbage, you only find well-formed groups, and garbage always terminates according to the rules above.
+
+Here are some self-contained pieces of garbage:
+
+
+ - `<>`, empty garbage.
+ - ``, garbage containing random characters.
+ - `<<<<>`, because the extra `<` are ignored.
+ - `<{!>}>`, because the first `>` is canceled.
+ - ``, because the second `!` is canceled, allowing the `>` to terminate the garbage.
+ - `>`, because the second `!` and the first `>` are canceled.
+ - `<{o"i!a,<{i`, which ends at the first `>`.
+
+Here are some examples of whole streams and the number of groups they contain:
+
+
+ - `{}`, `1` group.
+ - `{{{}}}`, `3` groups.
+ - `{{},{}}`, also `3` groups.
+ - `{{{},{},{{}}}}`, `6` groups.
+ - `{<{},{},{{}}>}`, `1` group (which itself contains garbage).
+ - `{,,,}`, `1` group.
+ - `{{},{},{},{}}`, `5` groups.
+ - `{{},{},{},{}}`, `2` groups (since all but the last `>` are canceled).
+
+Your goal is to find the total score for all groups in your input. Each group is assigned a *score* which is one more than the score of the group that immediately contains it. (The outermost group gets a score of `1`.)
+
+
+ - `{}`, score of `1`.
+ - `{{{}}}`, score of `1 + 2 + 3 = 6`.
+ - `{{},{}}`, score of `1 + 2 + 2 = 5`.
+ - `{{{},{},{{}}}}`, score of `1 + 2 + 3 + 3 + 3 + 4 = 16`.
+ - `{,,,}`, score of `1`.
+ - `{{},{},{},{}}`, score of `1 + 2 + 2 + 2 + 2 = 9`.
+ - `{{},{},{},{}}`, score of `1 + 2 + 2 + 2 + 2 = 9`.
+ - `{{},{},{},{}}`, score of `1 + 2 = 3`.
+
+*What is the total score* for all groups in your input?
+
+
+## --- Part Two ---
+Now, you're ready to remove the garbage.
+
+To prove you've removed it, you need to count all of the characters within the garbage. The leading and trailing `<` and `>` don't count, nor do any canceled characters or the `!` doing the canceling.
+
+
+ - `<>`, `0` characters.
+ - ``, `17` characters.
+ - `<<<<>`, `3` characters.
+ - `<{!>}>`, `2` characters.
+ - ``, `0` characters.
+ - `>`, `0` characters.
+ - `<{o"i!a,<{i`, `10` characters.
+
+*How many non-canceled characters are within the garbage* in your puzzle input?
+
+
diff --git a/2017/Day09/input.in b/2017/Day09/input.in
index 2de7e7361..2e84e1b3d 100644
Binary files a/2017/Day09/input.in and b/2017/Day09/input.in differ
diff --git a/2017/Day10/README.md b/2017/Day10/README.md
index 525202279..a2ff9a964 100644
--- a/2017/Day10/README.md
+++ b/2017/Day10/README.md
@@ -1,6 +1,83 @@
+original source: [https://adventofcode.com/2017/day/10](https://adventofcode.com/2017/day/10)
## --- Day 10: Knot Hash ---
You come across some programs that are trying to implement a software emulation of a hash based on knot-tying. The hash these programs are implementing isn't very strong, but you decide to help them anyway. You make a mental note to remind the Elves later not to invent their own cryptographic functions.
This hash function simulates tying a knot in a circle of string with 256 marks on it. Based on the input to be hashed, the function repeatedly selects a span of string, brings the ends together, and gives the span a half-twist to reverse the order of the marks within it. After doing this many times, the order of the marks is used to build the resulting hash.
-Read the [full puzzle](https://adventofcode.com/2017/day/10).
\ No newline at end of file
+```
+ 4--5 pinch 4 5 4 1
+ / \ 5,0,1 / \/ \ twist / \ / \
+3 0 --> 3 0 --> 3 X 0
+ \ / \ /\ / \ / \ /
+ 2--1 2 1 2 5
+```
+
+To achieve this, begin with a *list* of numbers from `0` to `255`, a *current position* which begins at `0` (the first element in the list), a *skip size* (which starts at `0`), and a sequence of *lengths* (your puzzle input). Then, for each length:
+
+
+ - *Reverse* the order of that *length* of elements in the *list*, starting with the element at the *current position*.
+ - *Move* the *current position* forward by that *length* plus the *skip size*.
+ - *Increase* the *skip size* by one.
+
+The *list* is circular; if the *current position* and the *length* try to reverse elements beyond the end of the list, the operation reverses using as many extra elements as it needs from the front of the list. If the *current position* moves past the end of the list, it wraps around to the front. *Lengths* larger than the size of the *list* are invalid.
+
+Here's an example using a smaller list:
+
+Suppose we instead only had a circular list containing five elements, `0, 1, 2, 3, 4`, and were given input lengths of `3, 4, 1, 5`.
+
+
+ - The list begins as `[0] 1 2 3 4` (where square brackets indicate the *current position*).
+ - The first length, `3`, selects `([0] 1 2) 3 4` (where parentheses indicate the sublist to be reversed).
+ - After reversing that section (`0 1 2` into `2 1 0`), we get `([2] 1 0) 3 4`.
+ - Then, the *current position* moves forward by the *length*, `3`, plus the *skip size*, 0: `2 1 0 [3] 4`. Finally, the *skip size* increases to `1`.
+
+
+ - The second length, `4`, selects a section which wraps: `2 1) 0 ([3] 4`.
+ - The sublist `3 4 2 1` is reversed to form `1 2 4 3`: `4 3) 0 ([1] 2`.
+ - The *current position* moves forward by the *length* plus the *skip size*, a total of `5`, causing it not to move because it wraps around: `4 3 0 [1] 2`. The *skip size* increases to `2`.
+
+
+ - The third length, `1`, selects a sublist of a single element, and so reversing it has no effect.
+ - The *current position* moves forward by the *length* (`1`) plus the *skip size* (`2`): `4 [3] 0 1 2`. The *skip size* increases to `3`.
+
+
+ - The fourth length, `5`, selects every element starting with the second: `4) ([3] 0 1 2`. Reversing this sublist (`3 0 1 2 4` into `4 2 1 0 3`) produces: `3) ([4] 2 1 0`.
+ - Finally, the *current position* moves forward by `8`: `3 4 2 1 [0]`. The *skip size* increases to `4`.
+
+In this example, the first two numbers in the list end up being `3` and `4`; to check the process, you can multiply them together to produce `12`.
+
+However, you should instead use the standard list size of `256` (with values `0` to `255`) and the sequence of *lengths* in your puzzle input. Once this process is complete, *what is the result of multiplying the first two numbers in the list*?
+
+
+## --- Part Two ---
+The logic you've constructed forms a single *round* of the *Knot Hash* algorithm; running the full thing requires many of these rounds. Some input and output processing is also required.
+
+First, from now on, your input should be taken not as a list of numbers, but as a string of bytes instead. Unless otherwise specified, convert characters to bytes using their [ASCII codes](https://en.wikipedia.org/wiki/ASCII#Printable_characters). This will allow you to handle arbitrary ASCII strings, and it also ensures that your input lengths are never larger than `255`. For example, if you are given `1,2,3`, you should convert it to the ASCII codes for each character: `49,44,50,44,51`.
+
+Once you have determined the sequence of lengths to use, add the following lengths to the end of the sequence: `17, 31, 73, 47, 23`. For example, if you are given `1,2,3`, your final sequence of lengths should be `49,44,50,44,51,17,31,73,47,23` (the ASCII codes from the input string combined with the standard length suffix values).
+
+Second, instead of merely running one *round* like you did above, run a total of `64` rounds, using the same *length* sequence in each round. The *current position* and *skip size* should be preserved between rounds. For example, if the previous example was your first round, you would start your second round with the same *length* sequence (`3, 4, 1, 5, 17, 31, 73, 47, 23`, now assuming they came from ASCII codes and include the suffix), but start with the previous round's *current position* (`4`) and *skip size* (`4`).
+
+Once the rounds are complete, you will be left with the numbers from `0` to `255` in some order, called the *sparse hash*. Your next task is to reduce these to a list of only `16` numbers called the *dense hash*. To do this, use numeric bitwise [XOR](https://en.wikipedia.org/wiki/Bitwise_operation#XOR) to combine each consecutive block of `16` numbers in the sparse hash (there are `16` such blocks in a list of `256` numbers). So, the first element in the dense hash is the first sixteen elements of the sparse hash XOR'd together, the second element in the dense hash is the second sixteen elements of the sparse hash XOR'd together, etc.
+
+For example, if the first sixteen elements of your sparse hash are as shown below, and the XOR operator is `^`, you would calculate the first output number like this:
+
+```
+65 ^ 27 ^ 9 ^ 1 ^ 4 ^ 3 ^ 40 ^ 50 ^ 91 ^ 7 ^ 6 ^ 0 ^ 2 ^ 5 ^ 68 ^ 22 = 64
+```
+
+Perform this operation on each of the sixteen blocks of sixteen numbers in your sparse hash to determine the sixteen numbers in your dense hash.
+
+Finally, the standard way to represent a Knot Hash is as a single [hexadecimal](https://en.wikipedia.org/wiki/Hexadecimal) string; the final output is the dense hash in hexadecimal notation. Because each number in your dense hash will be between `0` and `255` (inclusive), always represent each number as two hexadecimal digits (including a leading zero as necessary). So, if your first three numbers are `64, 7, 255`, they correspond to the hexadecimal numbers `40, 07, ff`, and so the first six characters of the hash would be `4007ff`. Because every Knot Hash is sixteen such numbers, the hexadecimal representation is always `32` hexadecimal digits (`0`-`f`) long.
+Here are some example hashes:
+
+
+ - The empty string becomes `a2582a3a0e66e6e86e3812dcb672a272`.
+ - `AoC 2017` becomes `33efeb34ea91902bb2f59c9920caa6cd`.
+ - `1,2,3` becomes `3efbe78a8d82f29979031a4aa0b16a9d`.
+ - `1,2,4` becomes `63960835bcdc130f0b66d7ff4f6a5a8e`.
+
+Treating your puzzle input as a string of ASCII characters, *what is the Knot Hash of your puzzle input?* Ignore any leading or trailing whitespace you might encounter.
+
+
+
diff --git a/2017/Day10/input.in b/2017/Day10/input.in
index 960b72aab..8493759d3 100644
Binary files a/2017/Day10/input.in and b/2017/Day10/input.in differ
diff --git a/2017/Day11/README.md b/2017/Day11/README.md
index 5e1c4b600..43681250f 100644
--- a/2017/Day11/README.md
+++ b/2017/Day11/README.md
@@ -1,6 +1,35 @@
+original source: [https://adventofcode.com/2017/day/11](https://adventofcode.com/2017/day/11)
## --- Day 11: Hex Ed ---
Crossing the bridge, you've barely reached the other side of the stream when a program comes up to you, clearly in distress. "It's my child process," she says, "he's gotten lost in an infinite grid!"
Fortunately for her, you have plenty of experience with infinite grids.
-Read the [full puzzle](https://adventofcode.com/2017/day/11).
\ No newline at end of file
+Unfortunately for you, it's a [hex grid](https://en.wikipedia.org/wiki/Hexagonal_tiling).
+
+The hexagons ("hexes") in this grid are aligned such that adjacent hexes can be found to the north, northeast, southeast, south, southwest, and northwest:
+
+```
+ \ n /
+nw +--+ ne
+ / \
+-+ +-
+ \ /
+sw +--+ se
+ / s \
+```
+
+You have the path the child process took. Starting where he started, you need to determine the fewest number of steps required to reach him. (A "step" means to move from the hex you are in to any adjacent hex.)
+
+For example:
+
+
+ - `ne,ne,ne` is `3` steps away.
+ - `ne,ne,sw,sw` is `0` steps away (back where you started).
+ - `ne,ne,s,s` is `2` steps away (`se,se`).
+ - `se,sw,se,sw,sw` is `3` steps away (`s,s,sw`).
+
+
+## --- Part Two ---
+*How many steps away* is the *furthest* he ever got from his starting position?
+
+
diff --git a/2017/Day11/input.in b/2017/Day11/input.in
index b630af35f..33bba05b8 100644
Binary files a/2017/Day11/input.in and b/2017/Day11/input.in differ
diff --git a/2017/Day12/README.md b/2017/Day12/README.md
index ac03ac73b..797022158 100644
--- a/2017/Day12/README.md
+++ b/2017/Day12/README.md
@@ -1,6 +1,49 @@
+original source: [https://adventofcode.com/2017/day/12](https://adventofcode.com/2017/day/12)
## --- Day 12: Digital Plumber ---
Walking along the memory banks of the stream, you find a small village that is experiencing a little confusion: some programs can't communicate with each other.
Programs in this village communicate using a fixed system of *pipes*. Messages are passed between programs using these pipes, but most programs aren't connected to each other directly. Instead, programs pass messages between each other until the message reaches the intended recipient.
-Read the [full puzzle](https://adventofcode.com/2017/day/12).
\ No newline at end of file
+For some reason, though, some of these messages aren't ever reaching their intended recipient, and the programs suspect that some pipes are missing. They would like you to investigate.
+
+You walk through the village and record the ID of each program and the IDs with which it can communicate directly (your puzzle input). Each program has one or more programs with which it can communicate, and these pipes are bidirectional; if `8` says it can communicate with `11`, then `11` will say it can communicate with `8`.
+
+You need to figure out how many programs are in the group that contains program ID `0`.
+
+For example, suppose you go door-to-door like a travelling salesman and record the following list:
+
+```
+0 <-> 2
+1 <-> 1
+2 <-> 0, 3, 4
+3 <-> 2, 4
+4 <-> 2, 3, 6
+5 <-> 6
+6 <-> 4, 5
+```
+
+In this example, the following programs are in the group that contains program ID `0`:
+
+
+ - Program `0` by definition.
+ - Program `2`, directly connected to program `0`.
+ - Program `3` via program `2`.
+ - Program `4` via program `2`.
+ - Program `5` via programs `6`, then `4`, then `2`.
+ - Program `6` via programs `4`, then `2`.
+
+Therefore, a total of `6` programs are in this group; all but program `1`, which has a pipe that connects it to itself.
+
+*How many programs* are in the group that contains program ID `0`?
+
+
+## --- Part Two ---
+There are more programs than just the ones in the group containing program ID `0`. The rest of them have no way of reaching that group, and still might have no way of reaching each other.
+
+A *group* is a collection of programs that can all communicate via pipes either directly or indirectly. The programs you identified just a moment ago are all part of the same group. Now, they would like you to determine the total number of groups.
+
+In the example above, there were `2` groups: one consisting of programs `0,2,3,4,5,6`, and the other consisting solely of program `1`.
+
+*How many groups are there* in total?
+
+
diff --git a/2017/Day12/input.in b/2017/Day12/input.in
index 0e252b630..cf5f503fb 100644
Binary files a/2017/Day12/input.in and b/2017/Day12/input.in differ
diff --git a/2017/Day13/README.md b/2017/Day13/README.md
index f3f247c6d..393d377ae 100644
--- a/2017/Day13/README.md
+++ b/2017/Day13/README.md
@@ -1,6 +1,291 @@
+original source: [https://adventofcode.com/2017/day/13](https://adventofcode.com/2017/day/13)
## --- Day 13: Packet Scanners ---
You need to cross a vast *firewall*. The firewall consists of several layers, each with a *security scanner* that moves back and forth across the layer. To succeed, you must not be detected by a scanner.
By studying the firewall briefly, you are able to record (in your puzzle input) the *depth* of each layer and the *range* of the scanning area for the scanner within it, written as `depth: range`. Each layer has a thickness of exactly `1`. A layer at depth `0` begins immediately inside the firewall; a layer at depth `1` would start immediately after that.
-Read the [full puzzle](https://adventofcode.com/2017/day/13).
\ No newline at end of file
+For example, suppose you've recorded the following:
+
+```
+0: 3
+1: 2
+4: 4
+6: 4
+```
+
+This means that there is a layer immediately inside the firewall (with range `3`), a second layer immediately after that (with range `2`), a third layer which begins at depth `4` (with range `4`), and a fourth layer which begins at depth 6 (also with range `4`). Visually, it might look like this:
+
+```
+ 0 1 2 3 4 5 6
+[ ] [ ] ... ... [ ] ... [ ]
+[ ] [ ] [ ] [ ]
+[ ] [ ] [ ]
+ [ ] [ ]
+```
+
+Within each layer, a security scanner moves back and forth within its range. Each security scanner starts at the top and moves down until it reaches the bottom, then moves up until it reaches the top, and repeats. A security scanner takes *one picosecond* to move one step. Drawing scanners as `S`, the first few picoseconds look like this:
+
+```
+
+Picosecond 0:
+ 0 1 2 3 4 5 6
+[S] [S] ... ... [S] ... [S]
+[ ] [ ] [ ] [ ]
+[ ] [ ] [ ]
+ [ ] [ ]
+
+Picosecond 1:
+ 0 1 2 3 4 5 6
+[ ] [ ] ... ... [ ] ... [ ]
+[S] [S] [S] [S]
+[ ] [ ] [ ]
+ [ ] [ ]
+
+Picosecond 2:
+ 0 1 2 3 4 5 6
+[ ] [S] ... ... [ ] ... [ ]
+[ ] [ ] [ ] [ ]
+[S] [S] [S]
+ [ ] [ ]
+
+Picosecond 3:
+ 0 1 2 3 4 5 6
+[ ] [ ] ... ... [ ] ... [ ]
+[S] [S] [ ] [ ]
+[ ] [ ] [ ]
+ [S] [S]
+```
+
+Your plan is to hitch a ride on a packet about to move through the firewall. The packet will travel along the top of each layer, and it moves at *one layer per picosecond*. Each picosecond, the packet moves one layer forward (its first move takes it into layer 0), and then the scanners move one step. If there is a scanner at the top of the layer *as your packet enters it*, you are *caught*. (If a scanner moves into the top of its layer while you are there, you are *not* caught: it doesn't have time to notice you before you leave.) If you were to do this in the configuration above, marking your current position with parentheses, your passage through the firewall would look like this:
+
+```
+Initial state:
+ 0 1 2 3 4 5 6
+[S] [S] ... ... [S] ... [S]
+[ ] [ ] [ ] [ ]
+[ ] [ ] [ ]
+ [ ] [ ]
+
+Picosecond 0:
+ 0 1 2 3 4 5 6
+(S) [S] ... ... [S] ... [S]
+[ ] [ ] [ ] [ ]
+[ ] [ ] [ ]
+ [ ] [ ]
+
+ 0 1 2 3 4 5 6
+( ) [ ] ... ... [ ] ... [ ]
+[S] [S] [S] [S]
+[ ] [ ] [ ]
+ [ ] [ ]
+
+
+Picosecond 1:
+ 0 1 2 3 4 5 6
+[ ] ( ) ... ... [ ] ... [ ]
+[S] [S] [S] [S]
+[ ] [ ] [ ]
+ [ ] [ ]
+
+ 0 1 2 3 4 5 6
+[ ] (S) ... ... [ ] ... [ ]
+[ ] [ ] [ ] [ ]
+[S] [S] [S]
+ [ ] [ ]
+
+
+Picosecond 2:
+ 0 1 2 3 4 5 6
+[ ] [S] (.) ... [ ] ... [ ]
+[ ] [ ] [ ] [ ]
+[S] [S] [S]
+ [ ] [ ]
+
+ 0 1 2 3 4 5 6
+[ ] [ ] (.) ... [ ] ... [ ]
+[S] [S] [ ] [ ]
+[ ] [ ] [ ]
+ [S] [S]
+
+
+Picosecond 3:
+ 0 1 2 3 4 5 6
+[ ] [ ] ... (.) [ ] ... [ ]
+[S] [S] [ ] [ ]
+[ ] [ ] [ ]
+ [S] [S]
+
+ 0 1 2 3 4 5 6
+[S] [S] ... (.) [ ] ... [ ]
+[ ] [ ] [ ] [ ]
+[ ] [S] [S]
+ [ ] [ ]
+
+
+Picosecond 4:
+ 0 1 2 3 4 5 6
+[S] [S] ... ... ( ) ... [ ]
+[ ] [ ] [ ] [ ]
+[ ] [S] [S]
+ [ ] [ ]
+
+ 0 1 2 3 4 5 6
+[ ] [ ] ... ... ( ) ... [ ]
+[S] [S] [S] [S]
+[ ] [ ] [ ]
+ [ ] [ ]
+
+
+Picosecond 5:
+ 0 1 2 3 4 5 6
+[ ] [ ] ... ... [ ] (.) [ ]
+[S] [S] [S] [S]
+[ ] [ ] [ ]
+ [ ] [ ]
+
+ 0 1 2 3 4 5 6
+[ ] [S] ... ... [S] (.) [S]
+[ ] [ ] [ ] [ ]
+[S] [ ] [ ]
+ [ ] [ ]
+
+
+Picosecond 6:
+ 0 1 2 3 4 5 6
+[ ] [S] ... ... [S] ... (S)
+[ ] [ ] [ ] [ ]
+[S] [ ] [ ]
+ [ ] [ ]
+
+ 0 1 2 3 4 5 6
+[ ] [ ] ... ... [ ] ... ( )
+[S] [S] [S] [S]
+[ ] [ ] [ ]
+ [ ] [ ]
+```
+
+In this situation, you are *caught* in layers `0` and `6`, because your packet entered the layer when its scanner was at the top when you entered it. You are *not* caught in layer `1`, since the scanner moved into the top of the layer once you were already there.
+
+The *severity* of getting caught on a layer is equal to its *depth* multiplied by its *range*. (Ignore layers in which you do not get caught.) The severity of the whole trip is the sum of these values. In the example above, the trip severity is `0*3 + 6*4 = *24*`.
+
+Given the details of the firewall you've recorded, if you leave immediately, *what is the severity of your whole trip*?
+
+
+## --- Part Two ---
+Now, you need to pass through the firewall without being caught - easier said than done.
+
+You can't control the speed of the packet, but you can *delay* it any number of picoseconds. For each picosecond you delay the packet before beginning your trip, all security scanners move one step. You're not in the firewall during this time; you don't enter layer `0` until you stop delaying the packet.
+
+In the example above, if you delay `10` picoseconds (picoseconds `0` - `9`), you won't get caught:
+
+```
+State after delaying:
+ 0 1 2 3 4 5 6
+[ ] [S] ... ... [ ] ... [ ]
+[ ] [ ] [ ] [ ]
+[S] [S] [S]
+ [ ] [ ]
+
+Picosecond 10:
+ 0 1 2 3 4 5 6
+( ) [S] ... ... [ ] ... [ ]
+[ ] [ ] [ ] [ ]
+[S] [S] [S]
+ [ ] [ ]
+
+ 0 1 2 3 4 5 6
+( ) [ ] ... ... [ ] ... [ ]
+[S] [S] [S] [S]
+[ ] [ ] [ ]
+ [ ] [ ]
+
+
+Picosecond 11:
+ 0 1 2 3 4 5 6
+[ ] ( ) ... ... [ ] ... [ ]
+[S] [S] [S] [S]
+[ ] [ ] [ ]
+ [ ] [ ]
+
+ 0 1 2 3 4 5 6
+[S] (S) ... ... [S] ... [S]
+[ ] [ ] [ ] [ ]
+[ ] [ ] [ ]
+ [ ] [ ]
+
+
+Picosecond 12:
+ 0 1 2 3 4 5 6
+[S] [S] (.) ... [S] ... [S]
+[ ] [ ] [ ] [ ]
+[ ] [ ] [ ]
+ [ ] [ ]
+
+ 0 1 2 3 4 5 6
+[ ] [ ] (.) ... [ ] ... [ ]
+[S] [S] [S] [S]
+[ ] [ ] [ ]
+ [ ] [ ]
+
+
+Picosecond 13:
+ 0 1 2 3 4 5 6
+[ ] [ ] ... (.) [ ] ... [ ]
+[S] [S] [S] [S]
+[ ] [ ] [ ]
+ [ ] [ ]
+
+ 0 1 2 3 4 5 6
+[ ] [S] ... (.) [ ] ... [ ]
+[ ] [ ] [ ] [ ]
+[S] [S] [S]
+ [ ] [ ]
+
+
+Picosecond 14:
+ 0 1 2 3 4 5 6
+[ ] [S] ... ... ( ) ... [ ]
+[ ] [ ] [ ] [ ]
+[S] [S] [S]
+ [ ] [ ]
+
+ 0 1 2 3 4 5 6
+[ ] [ ] ... ... ( ) ... [ ]
+[S] [S] [ ] [ ]
+[ ] [ ] [ ]
+ [S] [S]
+
+
+Picosecond 15:
+ 0 1 2 3 4 5 6
+[ ] [ ] ... ... [ ] (.) [ ]
+[S] [S] [ ] [ ]
+[ ] [ ] [ ]
+ [S] [S]
+
+ 0 1 2 3 4 5 6
+[S] [S] ... ... [ ] (.) [ ]
+[ ] [ ] [ ] [ ]
+[ ] [S] [S]
+ [ ] [ ]
+
+
+Picosecond 16:
+ 0 1 2 3 4 5 6
+[S] [S] ... ... [ ] ... ( )
+[ ] [ ] [ ] [ ]
+[ ] [S] [S]
+ [ ] [ ]
+
+ 0 1 2 3 4 5 6
+[ ] [ ] ... ... [ ] ... ( )
+[S] [S] [S] [S]
+[ ] [ ] [ ]
+ [ ] [ ]
+```
+
+Because all smaller delays would get you caught, the fewest number of picoseconds you would need to delay to get through safely is `10`.
+
+*What is the fewest number of picoseconds* that you need to delay the packet to pass through the firewall without being caught?
+
+
diff --git a/2017/Day13/input.in b/2017/Day13/input.in
index 04007867a..6e11fd677 100644
Binary files a/2017/Day13/input.in and b/2017/Day13/input.in differ
diff --git a/2017/Day14/README.md b/2017/Day14/README.md
index e57cab07d..279842ef7 100644
--- a/2017/Day14/README.md
+++ b/2017/Day14/README.md
@@ -1,6 +1,55 @@
+original source: [https://adventofcode.com/2017/day/14](https://adventofcode.com/2017/day/14)
## --- Day 14: Disk Defragmentation ---
Suddenly, a scheduled job activates the system's [disk defragmenter](https://en.wikipedia.org/wiki/Defragmentation). Were the situation different, you might [sit and watch it for a while](https://www.youtube.com/watch?v=kPv1gQ5Rs8A&t=37), but today, you just don't have that kind of time. It's soaking up valuable system resources that are needed elsewhere, and so the only option is to help it finish its task as soon as possible.
The disk in question consists of a 128x128 grid; each square of the grid is either *free* or *used*. On this disk, the state of the grid is tracked by the bits in a sequence of [knot hashes](10).
-Read the [full puzzle](https://adventofcode.com/2017/day/14).
\ No newline at end of file
+A total of 128 knot hashes are calculated, each corresponding to a single row in the grid; each hash contains 128 bits which correspond to individual grid squares. Each bit of a hash indicates whether that square is *free* (`0`) or *used* (`1`).
+
+The hash inputs are a key string (your puzzle input), a dash, and a number from `0` to `127` corresponding to the row. For example, if your key string were `flqrgnkx`, then the first row would be given by the bits of the knot hash of `flqrgnkx-0`, the second row from the bits of the knot hash of `flqrgnkx-1`, and so on until the last row, `flqrgnkx-127`.
+
+The output of a knot hash is traditionally represented by 32 hexadecimal digits; each of these digits correspond to 4 bits, for a total of `4 * 32 = 128` bits. To convert to bits, turn each hexadecimal digit to its equivalent binary value, high-bit first: `0` becomes `0000`, `1` becomes `0001`, `e` becomes `1110`, `f` becomes `1111`, and so on; a hash that begins with `a0c2017...` in hexadecimal would begin with `10100000110000100000000101110000...` in binary.
+
+Continuing this process, the *first 8 rows and columns* for key `flqrgnkx` appear as follows, using `#` to denote used squares, and `.` to denote free ones:
+
+```
+##.#.#..-->
+.#.#.#.#
+....#.#.
+#.#.##.#
+.##.#...
+##..#..#
+.#...#..
+##.#.##.-->
+| |
+V V
+```
+
+In this example, `8108` squares are used across the entire 128x128 grid.
+
+Given your actual key string, *how many squares are used*?
+
+
+## --- Part Two ---
+Now, all the defragmenter needs to know is the number of *regions*. A region is a group of *used* squares that are all *adjacent*, not including diagonals. Every used square is in exactly one region: lone used squares form their own isolated regions, while several adjacent squares all count as a single region.
+
+In the example above, the following nine regions are visible, each marked with a distinct digit:
+
+```
+11.2.3..-->
+.1.2.3.4
+....5.6.
+7.8.55.9
+.88.5...
+88..5..8
+.8...8..
+88.8.88.-->
+| |
+V V
+```
+
+Of particular interest is the region marked `8`; while it does not appear contiguous in this small view, all of the squares marked `8` are connected when considering the whole 128x128 grid. In total, in this example, `1242` regions are present.
+
+*How many regions* are present given your key string?
+
+
diff --git a/2017/Day14/input.in b/2017/Day14/input.in
index eb4843fa4..81b6a1082 100644
Binary files a/2017/Day14/input.in and b/2017/Day14/input.in differ
diff --git a/2017/Day15/README.md b/2017/Day15/README.md
index caa4832bf..986c27b6d 100644
--- a/2017/Day15/README.md
+++ b/2017/Day15/README.md
@@ -1,6 +1,110 @@
+original source: [https://adventofcode.com/2017/day/15](https://adventofcode.com/2017/day/15)
## --- Day 15: Dueling Generators ---
Here, you encounter a pair of dueling generators. The generators, called generator A and generator B, are trying to agree on a sequence of numbers. However, one of them is malfunctioning, and so the sequences don't always match.
As they do this, a judge waits for each of them to generate its next value, compares the lowest 16 bits of both values, and keeps track of the number of times those parts of the values match.
-Read the [full puzzle](https://adventofcode.com/2017/day/15).
\ No newline at end of file
+The generators both work on the same principle. To create its next value, a generator will take the previous value it produced, multiply it by a factor (generator A uses 16807; generator B uses 48271), and then keep the remainder of dividing that resulting product by 2147483647. That final remainder is the value it produces next.
+
+To calculate each generator's first value, it instead uses a specific starting value as its "previous value" (as listed in your puzzle input).
+
+For example, suppose that for starting values, generator A uses 65, while generator B uses 8921. Then, the first five pairs of generated values are:
+
+
+ would take their
+These units: turns in this order:
+ ####### #######
+ #.G.E.# #.1.2.#
+ #E.G.E# #3.4.5#
+ #.G.E.# #.6.7.#
+ ####### #######
+
+
+
+Each unit begins its turn by identifying all possible targets (enemy units). If no targets remain, combat ends.
+
+Then, the unit identifies all of the open squares (.) that are in range of each target; these are the squares which are adjacent (immediately up, down, left, or right) to any target and which aren't already occupied by a wall or another unit. Alternatively, the unit might already be in range of a target. If the unit is not already in range of a target, and there are no open squares which are in range of a target, the unit ends its turn.
+
+If the unit is already in range of a target, it does not move, but continues its turn with an attack. Otherwise, since it is not in range of a target, it moves.
+
+To move, the unit first considers the squares that are in range and determines which of those squares it could reach in the fewest steps. A step is a single movement to any adjacent (immediately up, down, left, or right) open (.) square. Units cannot move into walls or other units. The unit does this while considering the current positions of units and does not do any prediction about where units will be later. If the unit cannot reach (find an open path to) any of the squares that are in range, it ends its turn. If multiple squares are in range and tied for being reachable in the fewest steps, the square which is first in reading order is chosen. For example:
+
+
+
+In the above scenario, the Elf has three targets (the three Goblins):
+
+
+ - Each of the Goblins has open, adjacent squares which are in range (marked with a ? on the map).
+ - Of those squares, four are reachable (marked @); the other two (on the right) would require moving through a wall or unit to reach.
+ - Three of these reachable squares are nearest, requiring the fewest steps (only 2) to reach (marked !).
+ - Of those, the square which is first in reading order is chosen (+).
+
+The unit then takes a single step toward the chosen square along the shortest path to that square. If multiple steps would put the unit equally closer to its destination, the unit chooses the step which is first in reading order. (This requires knowing when there is more than one shortest path so that you can consider the first step of each such path.) For example:
+
+
+
+The Elf sees three squares in range of a target (?), two of which are nearest (!), and so the first in reading order is chosen (+). Under "Distance", each open square is marked with its distance from the destination square; the two squares to which the Elf could move on this turn (down and to the right) are both equally good moves and would leave the Elf 2 steps from being in range of the Goblin. Because the step which is first in reading order is chosen, the Elf moves right one square.
+
+Here's a larger example of movement:
+
+
+
+Once the Goblins and Elf reach the positions above, they all are either in range of a target or cannot find any square in range of a target, and so none of the units can move until a unit dies.
+
+After moving (or if the unit began its turn in range of a target), the unit attacks.
+
+To attack, the unit first determines all of the targets that are in range of it by being immediately adjacent to it. If there are no such targets, the unit ends its turn. Otherwise, the adjacent target with the fewest hit points is selected; in a tie, the adjacent target with the fewest hit points which is first in reading order is selected.
+
+The unit deals damage equal to its attack power to the selected target, reducing its hit points by that amount. If this reduces its hit points to 0 or fewer, the selected target dies: its square becomes . and it takes no further turns.
+
+Each unit, either Goblin or Elf, has 3attack power and starts with 200hit points.
+
+For example, suppose the only Elf is about to attack:
+
+
+
+The "HP" column shows the hit points of the Goblin to the left in the corresponding row. The Elf is in range of three targets: the Goblin above it (with 4 hit points), the Goblin to its right (with 2 hit points), and the Goblin below it (also with 2 hit points). Because three targets are in range, the ones with the lowest hit points are selected: the two Goblins with 2 hit points each (one to the right of the Elf and one below the Elf). Of those, the Goblin first in reading order (the one to the right of the Elf) is selected. The selected Goblin's hit points (2) are reduced by the Elf's attack power (3), reducing its hit points to -1, killing it.
+
+After attacking, the unit's turn ends. Regardless of how the unit's turn ends, the next unit in the round takes its turn. If all units have taken turns in this round, the round ends, and a new round begins.
+
+The Elves look quite outnumbered. You need to determine the outcome of the battle: the number of full rounds that were completed (not counting the round in which combat ends) multiplied by the sum of the hit points of all remaining units at the moment combat ends. (Combat only ends when a unit finds no targets during its turn.)
+
+Below is an entire sample combat. Next to each map, each row's units' hit points are listed from left to right.
+
+
+
+Before the 48th round can finish, the top-left Goblin finds that there are no targets remaining, and so combat ends. So, the number of full rounds that were completed is 47, and the sum of the hit points of all remaining units is 200+131+59+200 = 590. From these, the outcome of the battle is 47 * 590 = 27730.
+
+Here are a few example summarized combats:
+
+
+####### #######
+#G..#E# #...#E# E(200)
+#E#E.E# #E#...# E(197)
+#G.##.# --> #.E##.# E(185)
+#...#E# #E..#E# E(200), E(200)
+#...E.# #.....#
+####### #######
+
+Combat ends after 37 full rounds
+Elves win with 982 total hit points left
+Outcome: 37 * 982 = 36334
+
+
+
+
+####### #######
+#E..EG# #.E.E.# E(164), E(197)
+#.#G.E# #.#E..# E(200)
+#E.##E# --> #E.##.# E(98)
+#G..#.# #.E.#.# E(200)
+#..E#.# #...#.#
+####### #######
+
+Combat ends after 46 full rounds
+Elves win with 859 total hit points left
+Outcome: 46 * 859 = 39514
+
+
+
+
+####### #######
+#E.G#.# #G.G#.# G(200), G(98)
+#.#G..# #.#G..# G(200)
+#G.#.G# --> #..#..#
+#G..#.# #...#G# G(95)
+#...E.# #...G.# G(200)
+####### #######
+
+Combat ends after 35 full rounds
+Goblins win with 793 total hit points left
+Outcome: 35 * 793 = 27755
+
+
+
+
+####### #######
+#.E...# #.....#
+#.#..G# #.#G..# G(200)
+#.###.# --> #.###.#
+#E#G#G# #.#.#.#
+#...#G# #G.G#G# G(98), G(38), G(200)
+####### #######
+
+Combat ends after 54 full rounds
+Goblins win with 536 total hit points left
+Outcome: 54 * 536 = 28944
+
+
+
+
+######### #########
+#G......# #.G.....# G(137)
+#.E.#...# #G.G#...# G(200), G(200)
+#..##..G# #.G##...# G(200)
+#...##..# --> #...##..#
+#...#...# #.G.#...# G(200)
+#.G...G.# #.......#
+#.....G.# #.......#
+######### #########
+
+Combat ends after 20 full rounds
+Goblins win with 937 total hit points left
+Outcome: 20 * 937 = 18740
+
+
+
+What is the outcome of the combat described in your puzzle input?
+
+
+## --- Part Two ---
+According to your calculations, the Elves are going to lose badly. Surely, you won't mess up the timeline too much if you give them just a little advanced technology, right?
+
+You need to make sure the Elves not only win, but also suffer no losses: even the death of a single Elf is unacceptable.
+
+However, you can't go too far: larger changes will be more likely to permanently alter spacetime.
+
+So, you need to find the outcome of the battle in which the Elves have the lowest integer attack power (at least 4) that allows them to win without a single death. The Goblins always have an attack power of 3.
+
+In the first summarized example above, the lowest attack power the Elves need to win without losses is 15:
+
+
+####### #######
+#.G...# #..E..# E(158)
+#...EG# #...E.# E(14)
+#.#.#G# --> #.#.#.#
+#..G#E# #...#.#
+#.....# #.....#
+####### #######
+
+Combat ends after 29 full rounds
+Elves win with 172 total hit points left
+Outcome: 29 * 172 = 4988
+
+
+
+In the second example above, the Elves need only 4 attack power:
+
+
+####### #######
+#E..EG# #.E.E.# E(200), E(23)
+#.#G.E# #.#E..# E(200)
+#E.##E# --> #E.##E# E(125), E(200)
+#G..#.# #.E.#.# E(200)
+#..E#.# #...#.#
+####### #######
+
+Combat ends after 33 full rounds
+Elves win with 948 total hit points left
+Outcome: 33 * 948 = 31284
+
+
+
+In the third example above, the Elves need 15 attack power:
+
+
+####### #######
+#E.G#.# #.E.#.# E(8)
+#.#G..# #.#E..# E(86)
+#G.#.G# --> #..#..#
+#G..#.# #...#.#
+#...E.# #.....#
+####### #######
+
+Combat ends after 37 full rounds
+Elves win with 94 total hit points left
+Outcome: 37 * 94 = 3478
+
+
+
+In the fourth example above, the Elves need 12 attack power:
+
+
+####### #######
+#.E...# #...E.# E(14)
+#.#..G# #.#..E# E(152)
+#.###.# --> #.###.#
+#E#G#G# #.#.#.#
+#...#G# #...#.#
+####### #######
+
+Combat ends after 39 full rounds
+Elves win with 166 total hit points left
+Outcome: 39 * 166 = 6474
+
+
+
+In the last example above, the lone Elf needs 34 attack power:
+
+
+######### #########
+#G......# #.......#
+#.E.#...# #.E.#...# E(38)
+#..##..G# #..##...#
+#...##..# --> #...##..#
+#...#...# #...#...#
+#.G...G.# #.......#
+#.....G.# #.......#
+######### #########
+
+Combat ends after 30 full rounds
+Elves win with 38 total hit points left
+Outcome: 30 * 38 = 1140
+
+
+
+To make the droid go north, send it 1. If it replies with 0, you know that location is a wall and that the droid didn't move:
+
+
+
+ #
+ D
+
+
+
+
+
+To move east, send 4; a reply of 1 means the movement was successful:
+
+
+
+ #
+ .D
+
+
+
+
+
+Then, perhaps attempts to move north (1), south (2), and east (4) are all met with replies of 0:
+
+
+
+ ##
+ .D#
+ #
+
+
+
+
+Now, you know the repair droid is in a dead end. Backtrack with 3 (which you already know will get a reply of 1 because you already know that location is open):
+
+
+
+ ##
+ D.#
+ #
+
+
+
+
+Then, perhaps west (3) gets a reply of 0, south (2) gets a reply of 1, south again (2) gets a reply of 0, and then west (3) gets a reply of 2:
+
+
+
+ ##
+ #..#
+ D.#
+ #
+
+
+
+Now, because of the reply of 2, you know you've found the oxygen system! In this example, it was only 2 moves away from the repair droid's starting position.
+
+What is the fewest number of movement commands required to move the repair droid from its starting position to the location of the oxygen system?
+
+
+## --- Part Two ---
+You quickly repair the oxygen system; oxygen gradually fills the area.
+
+Oxygen starts in the location containing the repaired oxygen system. It takes one minute for oxygen to spread to all open locations that are adjacent to a location that already contains oxygen. Diagonal locations are not adjacent.
+
+In the example above, suppose you've used the droid to explore the area fully and have the following map (where locations that currently contain oxygen are marked O):
+
+
+ ##
+#..##
+#.#..#
+#.O.#
+ ###
+
+
+
+Initially, the only location which contains oxygen is the location of the repaired oxygen system. However, after one minute, the oxygen spreads to all open (.) locations that are adjacent to a location containing oxygen:
+
+
+ ##
+#..##
+#.#..#
+#OOO#
+ ###
+
+
+
+After a total of two minutes, the map looks like this:
+
+
+ ##
+#..##
+#O#O.#
+#OOO#
+ ###
+
+
+
+After a total of three minutes:
+
+
+ ##
+#O.##
+#O#OO#
+#OOO#
+ ###
+
+
+
+And finally, the whole region is full of oxygen after a total of four minutes:
+
+
+ ##
+#OO##
+#O#OO#
+#OOO#
+ ###
+
+
+
+So, in this example, all locations contain oxygen after 4 minutes.
+
+Use the repair droid to get a complete map of the area. How many minutes will it take to fill with oxygen?
+
+
diff --git a/2019/Day15/input.in b/2019/Day15/input.in
index 62aa67426..3a7a90f94 100644
Binary files a/2019/Day15/input.in and b/2019/Day15/input.in differ
diff --git a/2019/Day16/README.md b/2019/Day16/README.md
index 719505721..696a371f8 100644
--- a/2019/Day16/README.md
+++ b/2019/Day16/README.md
@@ -1,6 +1,93 @@
+original source: [https://adventofcode.com/2019/day/16](https://adventofcode.com/2019/day/16)
## --- Day 16: Flawed Frequency Transmission ---
You're 3/4ths of the way through the [gas giants](https://en.wikipedia.org/wiki/Gas_giant). Not only do roundtrip signals to Earth take five hours, but the signal quality is quite bad as well. You can clean up the signal with the Flawed Frequency Transmission algorithm, or *FFT*.
As input, FFT takes a list of numbers. In the signal you received (your puzzle input), each number is a single digit: data like `15243` represents the sequence `1`, `5`, `2`, `4`, `3`.
-Read the [full puzzle](https://adventofcode.com/2019/day/16).
\ No newline at end of file
+FFT operates in repeated *phases*. In each phase, a new list is constructed with the same length as the input list. This new list is also used as the input for the next phase.
+
+Each element in the new list is built by multiplying every value in the input list by a value in a repeating *pattern* and then adding up the results. So, if the input list were `9, 8, 7, 6, 5` and the pattern for a given element were `1, 2, 3`, the result would be `9*1 + 8*2 + 7*3 + 6*1 + 5*2` (with each input element on the left and each value in the repeating pattern on the right of each multiplication). Then, only the ones digit is kept: `38` becomes `8`, `-17` becomes `7`, and so on.
+
+While each element in the output array uses all of the same input array elements, the actual repeating pattern to use depends on *which output element* is being calculated. The base pattern is `0, 1, 0, -1`. Then, repeat each value in the pattern a number of times equal to the *position in the output list* being considered. Repeat once for the first element, twice for the second element, three times for the third element, and so on. So, if the third element of the output list is being calculated, repeating the values would produce: `0, 0, 0, 1, 1, 1, 0, 0, 0, -1, -1, -1`.
+
+When applying the pattern, skip the very first value exactly once. (In other words, offset the whole pattern left by one.) So, for the second element of the output list, the actual pattern used would be: `0, 1, 1, 0, 0, -1, -1, 0, 0, 1, 1, 0, 0, -1, -1, ...`.
+
+After using this process to calculate each element of the output list, the phase is complete, and the output list of this phase is used as the new input list for the next phase, if any.
+
+Given the input signal `12345678`, below are four phases of FFT. Within each phase, each output digit is calculated on a single line with the result at the far right; each multiplication operation shows the input digit on the left and the pattern value on the right:
+
+```
+Input signal: 12345678
+
+1*1 + 2*0 + 3*-1 + 4*0 + 5*1 + 6*0 + 7*-1 + 8*0 = 4
+1*0 + 2*1 + 3*1 + 4*0 + 5*0 + 6*-1 + 7*-1 + 8*0 = 8
+1*0 + 2*0 + 3*1 + 4*1 + 5*1 + 6*0 + 7*0 + 8*0 = 2
+1*0 + 2*0 + 3*0 + 4*1 + 5*1 + 6*1 + 7*1 + 8*0 = 2
+1*0 + 2*0 + 3*0 + 4*0 + 5*1 + 6*1 + 7*1 + 8*1 = 6
+1*0 + 2*0 + 3*0 + 4*0 + 5*0 + 6*1 + 7*1 + 8*1 = 1
+1*0 + 2*0 + 3*0 + 4*0 + 5*0 + 6*0 + 7*1 + 8*1 = 5
+1*0 + 2*0 + 3*0 + 4*0 + 5*0 + 6*0 + 7*0 + 8*1 = 8
+
+After 1 phase: 48226158
+
+4*1 + 8*0 + 2*-1 + 2*0 + 6*1 + 1*0 + 5*-1 + 8*0 = 3
+4*0 + 8*1 + 2*1 + 2*0 + 6*0 + 1*-1 + 5*-1 + 8*0 = 4
+4*0 + 8*0 + 2*1 + 2*1 + 6*1 + 1*0 + 5*0 + 8*0 = 0
+4*0 + 8*0 + 2*0 + 2*1 + 6*1 + 1*1 + 5*1 + 8*0 = 4
+4*0 + 8*0 + 2*0 + 2*0 + 6*1 + 1*1 + 5*1 + 8*1 = 0
+4*0 + 8*0 + 2*0 + 2*0 + 6*0 + 1*1 + 5*1 + 8*1 = 4
+4*0 + 8*0 + 2*0 + 2*0 + 6*0 + 1*0 + 5*1 + 8*1 = 3
+4*0 + 8*0 + 2*0 + 2*0 + 6*0 + 1*0 + 5*0 + 8*1 = 8
+
+After 2 phases: 34040438
+
+3*1 + 4*0 + 0*-1 + 4*0 + 0*1 + 4*0 + 3*-1 + 8*0 = 0
+3*0 + 4*1 + 0*1 + 4*0 + 0*0 + 4*-1 + 3*-1 + 8*0 = 3
+3*0 + 4*0 + 0*1 + 4*1 + 0*1 + 4*0 + 3*0 + 8*0 = 4
+3*0 + 4*0 + 0*0 + 4*1 + 0*1 + 4*1 + 3*1 + 8*0 = 1
+3*0 + 4*0 + 0*0 + 4*0 + 0*1 + 4*1 + 3*1 + 8*1 = 5
+3*0 + 4*0 + 0*0 + 4*0 + 0*0 + 4*1 + 3*1 + 8*1 = 5
+3*0 + 4*0 + 0*0 + 4*0 + 0*0 + 4*0 + 3*1 + 8*1 = 1
+3*0 + 4*0 + 0*0 + 4*0 + 0*0 + 4*0 + 3*0 + 8*1 = 8
+
+After 3 phases: 03415518
+
+0*1 + 3*0 + 4*-1 + 1*0 + 5*1 + 5*0 + 1*-1 + 8*0 = 0
+0*0 + 3*1 + 4*1 + 1*0 + 5*0 + 5*-1 + 1*-1 + 8*0 = 1
+0*0 + 3*0 + 4*1 + 1*1 + 5*1 + 5*0 + 1*0 + 8*0 = 0
+0*0 + 3*0 + 4*0 + 1*1 + 5*1 + 5*1 + 1*1 + 8*0 = 2
+0*0 + 3*0 + 4*0 + 1*0 + 5*1 + 5*1 + 1*1 + 8*1 = 9
+0*0 + 3*0 + 4*0 + 1*0 + 5*0 + 5*1 + 1*1 + 8*1 = 4
+0*0 + 3*0 + 4*0 + 1*0 + 5*0 + 5*0 + 1*1 + 8*1 = 9
+0*0 + 3*0 + 4*0 + 1*0 + 5*0 + 5*0 + 1*0 + 8*1 = 8
+
+After 4 phases: 01029498
+```
+
+Here are the first eight digits of the final output list after 100 phases for some larger inputs:
+
+
+ - `80871224585914546619083218645595` becomes `24176176`.
+ - `19617804207202209144916044189917` becomes `73745418`.
+ - `69317163492948606335995924319873` becomes `52432133`.
+
+After *100* phases of FFT, *what are the first eight digits in the final output list?*
+
+
+## --- Part Two ---
+Now that your FFT is working, you can decode the *real signal*.
+
+The real signal is your puzzle input *repeated 10000 times*. Treat this new signal as a single input list. Patterns are still calculated as before, and 100 phases of FFT are still applied.
+
+The *first seven digits* of your initial input signal also represent the *message offset*. The message offset is the location of the eight-digit message in the final output list. Specifically, the message offset indicates *the number of digits to skip* before reading the eight-digit message. For example, if the first seven digits of your initial input signal were `1234567`, the eight-digit message would be the eight digits after skipping 1,234,567 digits of the final output list. Or, if the message offset were `7` and your final output list were `98765432109876543210`, the eight-digit message would be `21098765`. (Of course, your real message offset will be a seven-digit number, not a one-digit number like `7`.)
+
+Here is the eight-digit message in the final output list after 100 phases. The message offset given in each input has been highlighted. (Note that the inputs given below are repeated 10000 times to find the actual starting input lists.)
+
+
+ - `*0303673*2577212944063491565474664` becomes `84462026`.
+ - `*0293510*9699940807407585447034323` becomes `78725270`.
+ - `*0308177*0884921959731165446850517` becomes `53553731`.
+
+After repeating your input signal 10000 times and running 100 phases of FFT, *what is the eight-digit message embedded in the final output list?*
+
+
diff --git a/2019/Day16/input.in b/2019/Day16/input.in
index 745b563e4..68cecfd2d 100644
Binary files a/2019/Day16/input.in and b/2019/Day16/input.in differ
diff --git a/2019/Day17/README.md b/2019/Day17/README.md
index 4bd898a5d..1077776c4 100644
--- a/2019/Day17/README.md
+++ b/2019/Day17/README.md
@@ -1,6 +1,135 @@
+original source: [https://adventofcode.com/2019/day/17](https://adventofcode.com/2019/day/17)
## --- Day 17: Set and Forget ---
An early warning system detects an incoming [solar flare](https://en.wikipedia.org/wiki/Solar_flare) and automatically activates the ship's electromagnetic shield. Unfortunately, this has cut off the Wi-Fi for many small robots that, unaware of the impending danger, are now trapped on exterior scaffolding on the unsafe side of the shield. To rescue them, you'll have to act quickly!
The only tools at your disposal are some wired cameras and a small vacuum robot currently asleep at its charging station. The video quality is poor, but the vacuum robot has a needlessly bright LED that makes it easy to spot no matter where it is.
-Read the [full puzzle](https://adventofcode.com/2019/day/17).
\ No newline at end of file
+An [Intcode](9) program, the *Aft Scaffolding Control and Information Interface* (ASCII, your puzzle input), provides access to the cameras and the vacuum robot. Currently, because the vacuum robot is asleep, you can only access the cameras.
+
+Running the ASCII program on your Intcode computer will provide the current view of the scaffolds. This is output, purely coincidentally, as [ASCII code](https://simple.wikipedia.org/wiki/ASCII): `35` means `#`, `46` means `.`, `10` starts a [new line](https://en.wikipedia.org/wiki/Newline#In_programming_languages) of output below the current one, and so on. (Within a line, characters are drawn left-to-right.)
+
+In the camera output, `#` represents a scaffold and `.` represents open space. The vacuum robot is visible as `^`, `v`, `<`, or `>` depending on whether it is facing up, down, left, or right respectively. When drawn like this, the vacuum robot is *always on a scaffold*; if the vacuum robot ever walks off of a scaffold and begins *tumbling through space uncontrollably*, it will instead be visible as `X`.
+
+In general, the scaffold forms a path, but it sometimes loops back onto itself. For example, suppose you can see the following view from the cameras:
+
+```
+..#..........
+..#..........
+#######...###
+#.#...#...#.#
+#############
+..#...#...#..
+..#####...^..
+```
+
+Here, the vacuum robot, `^` is facing up and sitting at one end of the scaffold near the bottom-right of the image. The scaffold continues up, loops across itself several times, and ends at the top-left of the image.
+
+The first step is to calibrate the cameras by getting the *alignment parameters* of some well-defined points. Locate all *scaffold intersections*; for each, its alignment parameter is the distance between its left edge and the left edge of the view multiplied by the distance between its top edge and the top edge of the view. Here, the intersections from the above image are marked `O`:
+
+```
+..#..........
+..#..........
+##O####...###
+#.#...#...#.#
+##O###O###O##
+..#...#...#..
+..#####...^..
+```
+
+For these intersections:
+
+
+ - The top-left intersection is `2` units from the left of the image and `2` units from the top of the image, so its alignment parameter is `2 * 2 = *4*`.
+ - The bottom-left intersection is `2` units from the left and `4` units from the top, so its alignment parameter is `2 * 4 = *8*`.
+ - The bottom-middle intersection is `6` from the left and `4` from the top, so its alignment parameter is `*24*`.
+ - The bottom-right intersection's alignment parameter is `*40*`.
+
+To calibrate the cameras, you need the *sum of the alignment parameters*. In the above example, this is `*76*`.
+
+Run your ASCII program. *What is the sum of the alignment parameters* for the scaffold intersections?
+
+
+## --- Part Two ---
+Now for the tricky part: notifying all the other robots about the solar flare. The vacuum robot can do this automatically if it gets into range of a robot. However, you can't see the other robots on the camera, so you need to be thorough instead: you need to make the vacuum robot *visit every part of the scaffold at least once*.
+
+The vacuum robot normally wanders randomly, but there isn't time for that today. Instead, you can *override its movement logic* with new rules.
+
+Force the vacuum robot to wake up by changing the value in your ASCII program at address `0` from `1` to `*2*`. When you do this, you will be automatically prompted for the new movement rules that the vacuum robot should use. The ASCII program will use input instructions to receive them, but they need to be provided as ASCII code; end each line of logic with a single newline, ASCII code `10`.
+
+First, you will be prompted for the *main movement routine*. The main routine may only call the *movement functions*: `A`, `B`, or `C`. Supply the movement functions to use as ASCII text, separating them with commas (`,`, ASCII code `44`), and ending the list with a newline (ASCII code `10`). For example, to call `A` twice, then alternate between `B` and `C` three times, provide the string `A,A,B,C,B,C,B,C` and then a newline.
+
+Then, you will be prompted for each *movement function*. Movement functions may use `L` to *turn left*, `R` to *turn right*, or a number to *move forward* that many units. Movement functions may not call other movement functions. Again, separate the actions with commas and end the list with a newline. For example, to move forward `10` units, turn left, move forward `8` units, turn right, and finally move forward `6` units, provide the string `10,L,8,R,6` and then a newline.
+
+Finally, you will be asked whether you want to see a *continuous video feed*; provide either `y` or `n` and a newline. Enabling the continuous video feed can help you see what's going on, but it also requires a significant amount of processing power, and may even cause your Intcode computer to overheat.
+
+Due to the limited amount of memory in the vacuum robot, the ASCII definitions of the main routine and the movement functions may each contain *at most 20 characters*, not counting the newline.
+
+For example, consider the following camera feed:
+
+```
+#######...#####
+#.....#...#...#
+#.....#...#...#
+......#...#...#
+......#...###.#
+......#.....#.#
+^########...#.#
+......#.#...#.#
+......#########
+........#...#..
+....#########..
+....#...#......
+....#...#......
+....#...#......
+....#####......
+```
+
+In order for the vacuum robot to *visit every part of the scaffold at least once*, one path it could take is:
+
+```
+R,8,R,8,R,4,R,4,R,8,L,6,L,2,R,4,R,4,R,8,R,8,R,8,L,6,L,2```
+
+Without the memory limit, you could just supply this whole string to function `A` and have the main routine call `A` once. However, you'll need to split it into smaller parts.
+
+One approach is:
+
+
+ - *Main routine: `A,B,C,B,A,C`*
+(ASCII input: `65`, `44`, `66`, `44`, `67`, `44`, `66`, `44`, `65`, `44`, `67`, `10`)
+ - *Function `A`: `R,8,R,8`*
+(ASCII input: `82`, `44`, `56`, `44`, `82`, `44`, `56`, `10`)
+ - *Function `B`: `R,4,R,4,R,8`*
+(ASCII input: `82`, `44`, `52`, `44`, `82`, `44`, `52`, `44`, `82`, `44`, `56`, `10`)
+ - *Function `C`: `L,6,L,2`*
+(ASCII input: `76`, `44`, `54`, `44`, `76`, `44`, `50`, `10`)
+
+Visually, this would break the desired path into the following parts:
+
+```
+A, B, C, B, A, C
+R,8,R,8, R,4,R,4,R,8, L,6,L,2, R,4,R,4,R,8, R,8,R,8, L,6,L,2
+
+CCCCCCA...BBBBB
+C.....A...B...B
+C.....A...B...B
+......A...B...B
+......A...CCC.B
+......A.....C.B
+^AAAAAAAA...C.B
+......A.A...C.B
+......AAAAAA#AB
+........A...C..
+....BBBB#BBBB..
+....B...A......
+....B...A......
+....B...A......
+....BBBBA......
+```
+
+Of course, the scaffolding outside your ship is much more complex.
+
+As the vacuum robot finds other robots and notifies them of the impending solar flare, it also can't help but leave them squeaky clean, collecting any space dust it finds. Once it finishes the programmed set of movements, assuming it hasn't drifted off into space, the cleaning robot will return to its docking station and report the amount of space dust it collected as a large, non-ASCII value in a single output instruction.
+
+After visiting every part of the scaffold at least once, *how much dust does the vacuum robot report it has collected?*
+
+
diff --git a/2019/Day17/input.in b/2019/Day17/input.in
index b98176f73..a2fbf0dce 100644
Binary files a/2019/Day17/input.in and b/2019/Day17/input.in differ
diff --git a/2019/Day18/README.md b/2019/Day18/README.md
index 21878042c..d28897b42 100644
--- a/2019/Day18/README.md
+++ b/2019/Day18/README.md
@@ -1,6 +1,294 @@
+original source: [https://adventofcode.com/2019/day/18](https://adventofcode.com/2019/day/18)
## --- Day 18: Many-Worlds Interpretation ---
As you approach Neptune, a planetary security system detects you and activates a giant [tractor beam](https://en.wikipedia.org/wiki/Tractor_beam) on [Triton](https://en.wikipedia.org/wiki/Triton_(moon))! You have no choice but to land.
A scan of the local area reveals only one interesting feature: a massive underground vault. You generate a map of the tunnels (your puzzle input). The tunnels are too narrow to move diagonally.
-Read the [full puzzle](https://adventofcode.com/2019/day/18).
\ No newline at end of file
+Only one *entrance* (marked `@`) is present among the *open passages* (marked `.`) and *stone walls* (`#`), but you also detect an assortment of *keys* (shown as lowercase letters) and *doors* (shown as uppercase letters). Keys of a given letter open the door of the same letter: `a` opens `A`, `b` opens `B`, and so on. You aren't sure which key you need to disable the tractor beam, so you'll need to *collect all of them*.
+
+For example, suppose you have the following map:
+
+```
+#########
+#b.A.@.a#
+#########
+```
+
+Starting from the entrance (`@`), you can only access a large door (`A`) and a key (`a`). Moving toward the door doesn't help you, but you can move `2` steps to collect the key, unlocking `A` in the process:
+
+```
+#########
+#b.....@#
+#########
+```
+
+Then, you can move `6` steps to collect the only other key, `b`:
+
+```
+#########
+#@......#
+#########
+```
+
+So, collecting every key took a total of `*8*` steps.
+
+Here is a larger example:
+
+```
+########################
+#f.D.E.e.C.b.A.@.a.B.c.#
+######################.#
+#d.....................#
+########################
+```
+
+The only reasonable move is to take key `a` and unlock door `A`:
+
+```
+########################
+#f.D.E.e.C.b.....@.B.c.#
+######################.#
+#d.....................#
+########################
+```
+
+Then, do the same with key `b`:
+
+```
+########################
+#f.D.E.e.C.@.........c.#
+######################.#
+#d.....................#
+########################
+```
+
+...and the same with key `c`:
+
+```
+########################
+#f.D.E.e.............@.#
+######################.#
+#d.....................#
+########################
+```
+
+Now, you have a choice between keys `d` and `e`. While key `e` is closer, collecting it now would be slower in the long run than collecting key `d` first, so that's the best choice:
+
+```
+########################
+#f...E.e...............#
+######################.#
+#@.....................#
+########################
+```
+
+Finally, collect key `e` to unlock door `E`, then collect key `f`, taking a grand total of `*86*` steps.
+
+Here are a few more examples:
+
+
+ - ```
+########################
+#...............b.C.D.f#
+#.######################
+#.....@.a.B.c.d.A.e.F.g#
+########################
+```
+
+Shortest path is `132` steps: `b`, `a`, `c`, `d`, `f`, `e`, `g`
+
+ - ```
+#################
+#i.G..c...e..H.p#
+########.########
+#j.A..b...f..D.o#
+########@########
+#k.E..a...g..B.n#
+########.########
+#l.F..d...h..C.m#
+#################
+```
+
+Shortest paths are `136` steps;
+one is: `a`, `f`, `b`, `j`, `g`, `n`, `h`, `d`, `l`, `o`, `e`, `p`, `c`, `i`, `k`, `m`
+
+ - ```
+########################
+#@..............ac.GI.b#
+###d#e#f################
+###A#B#C################
+###g#h#i################
+########################
+```
+
+Shortest paths are `81` steps; one is: `a`, `c`, `f`, `i`, `d`, `g`, `b`, `e`, `h`
+
+
+*How many steps is the shortest path that collects all of the keys?*
+
+
+## --- Part Two ---
+You arrive at the vault only to discover that there is not one vault, but *four* - each with its own entrance.
+
+On your map, find the area in the middle that looks like this:
+
+```
+...
+.@.
+...
+```
+
+Update your map to instead use the correct data:
+
+```
+@#@
+###
+@#@
+```
+
+This change will split your map into four separate sections, each with its own entrance:
+
+```
+####### #######
+#a.#Cd# #a.#Cd#
+##...## ##*@#@*##
+##.@.## --> ##*###*##
+##...## ##*@#@*##
+#cB#Ab# #cB#Ab#
+####### #######
+```
+
+Because some of the keys are for doors in other vaults, it would take much too long to collect all of the keys by yourself. Instead, you deploy four remote-controlled robots. Each starts at one of the entrances (`@`).
+
+Your goal is still to *collect all of the keys in the fewest steps*, but now, each robot has its own position and can move independently. You can only remotely control a single robot at a time. Collecting a key instantly unlocks any corresponding doors, regardless of the vault in which the key or door is found.
+
+For example, in the map above, the top-left robot first collects key `a`, unlocking door `A` in the bottom-right vault:
+
+```
+#######
+#@.#Cd#
+##.#@##
+#######
+##@#@##
+#cB#.b#
+#######
+```
+
+Then, the bottom-right robot collects key `b`, unlocking door `B` in the bottom-left vault:
+
+```
+#######
+#@.#Cd#
+##.#@##
+#######
+##@#.##
+#c.#.@#
+#######
+```
+
+Then, the bottom-left robot collects key `c`:
+
+```
+#######
+#@.#.d#
+##.#@##
+#######
+##.#.##
+#@.#.@#
+#######
+```
+
+Finally, the top-right robot collects key `d`:
+
+```
+#######
+#@.#.@#
+##.#.##
+#######
+##.#.##
+#@.#.@#
+#######
+```
+
+In this example, it only took `*8*` steps to collect all of the keys.
+
+Sometimes, multiple robots might have keys available, or a robot might have to wait for multiple keys to be collected:
+
+```
+###############
+#d.ABC.#.....a#
+######@#@######
+###############
+######@#@######
+#b.....#.....c#
+###############
+```
+
+First, the top-right, bottom-left, and bottom-right robots take turns collecting keys `a`, `b`, and `c`, a total of `6 + 6 + 6 = 18` steps. Then, the top-left robot can access key `d`, spending another `6` steps; collecting all of the keys here takes a minimum of `*24*` steps.
+
+Here's a more complex example:
+
+```
+#############
+#DcBa.#.GhKl#
+#.###@#@#I###
+#e#d#####j#k#
+###C#@#@###J#
+#fEbA.#.FgHi#
+#############
+```
+
+
+ - Top-left robot collects key `a`.
+ - Bottom-left robot collects key `b`.
+ - Top-left robot collects key `c`.
+ - Bottom-left robot collects key `d`.
+ - Top-left robot collects key `e`.
+ - Bottom-left robot collects key `f`.
+ - Bottom-right robot collects key `g`.
+ - Top-right robot collects key `h`.
+ - Bottom-right robot collects key `i`.
+ - Top-right robot collects key `j`.
+ - Bottom-right robot collects key `k`.
+ - Top-right robot collects key `l`.
+
+In the above example, the fewest steps to collect all of the keys is `*32*`.
+
+Here's an example with more choices:
+
+```
+#############
+#g#f.D#..h#l#
+#F###e#E###.#
+#dCba@#@BcIJ#
+#############
+#nK.L@#@G...#
+#M###N#H###.#
+#o#m..#i#jk.#
+#############
+```
+
+One solution with the fewest steps is:
+
+
+ - Top-left robot collects key `e`.
+ - Top-right robot collects key `h`.
+ - Bottom-right robot collects key `i`.
+ - Top-left robot collects key `a`.
+ - Top-left robot collects key `b`.
+ - Top-right robot collects key `c`.
+ - Top-left robot collects key `d`.
+ - Top-left robot collects key `f`.
+ - Top-left robot collects key `g`.
+ - Bottom-right robot collects key `k`.
+ - Bottom-right robot collects key `j`.
+ - Top-right robot collects key `l`.
+ - Bottom-left robot collects key `n`.
+ - Bottom-left robot collects key `m`.
+ - Bottom-left robot collects key `o`.
+
+This example requires at least `*72*` steps to collect all keys.
+
+After updating your map and using the remote-controlled robots, *what is the fewest steps necessary to collect all of the keys?*
+
+
diff --git a/2019/Day18/input.in b/2019/Day18/input.in
index d736bce82..123b7c740 100644
Binary files a/2019/Day18/input.in and b/2019/Day18/input.in differ
diff --git a/2019/Day19/README.md b/2019/Day19/README.md
index a0a240e7a..113218a28 100644
--- a/2019/Day19/README.md
+++ b/2019/Day19/README.md
@@ -1,6 +1,82 @@
+original source: [https://adventofcode.com/2019/day/19](https://adventofcode.com/2019/day/19)
## --- Day 19: Tractor Beam ---
Unsure of the state of Santa's ship, you borrowed the tractor beam technology from Triton. Time to test it out.
When you're safely away from anything else, you activate the tractor beam, but nothing happens. It's hard to tell whether it's working if there's nothing to use it on. Fortunately, your ship's drone system can be configured to deploy a drone to specific coordinates and then check whether it's being pulled. There's even an [Intcode](9) program (your puzzle input) that gives you access to the drone system.
-Read the [full puzzle](https://adventofcode.com/2019/day/19).
\ No newline at end of file
+The program uses two input instructions to request the *X and Y position* to which the drone should be deployed. Negative numbers are invalid and will confuse the drone; all numbers should be *zero or positive*.
+
+Then, the program will output whether the drone is *stationary* (`0`) or *being pulled by something* (`1`). For example, the coordinate X=`0`, Y=`0` is directly in front of the tractor beam emitter, so the drone control program will always report `1` at that location.
+
+To better understand the tractor beam, it is important to *get a good picture* of the beam itself. For example, suppose you scan the 10x10 grid of points closest to the emitter:
+
+```
+ X
+ 0-> 9
+ 0#.........
+ |.#........
+ v..##......
+ ...###....
+ ....###...
+Y .....####.
+ ......####
+ ......####
+ .......###
+ 9........##
+```
+
+In this example, the *number of points affected by the tractor beam* in the 10x10 area closest to the emitter is `*27*`.
+
+However, you'll need to scan a larger area to *understand the shape* of the beam. *How many points are affected by the tractor beam in the 50x50 area closest to the emitter?* (For each of X and Y, this will be `0` through `49`.)
+
+
+## --- Part Two ---
+You aren't sure how large Santa's ship is. You aren't even sure if you'll need to use this thing on Santa's ship, but it doesn't hurt to be prepared. You figure Santa's ship might fit in a *100x100* square.
+
+The beam gets wider as it travels away from the emitter; you'll need to be a minimum distance away to fit a square of that size into the beam fully. (Don't rotate the square; it should be aligned to the same axes as the drone grid.)
+
+For example, suppose you have the following tractor beam readings:
+
+```
+#.......................................
+.#......................................
+..##....................................
+...###..................................
+....###.................................
+.....####...............................
+......#####.............................
+......######............................
+.......#######..........................
+........########........................
+.........#########......................
+..........#########.....................
+...........##########...................
+...........############.................
+............############................
+.............#############..............
+..............##############............
+...............###############..........
+................###############.........
+................#################.......
+.................########*O*OOOOOOOOO.....
+..................#######OOOOOOOOOO#....
+...................######OOOOOOOOOO###..
+....................#####OOOOOOOOOO#####
+.....................####OOOOOOOOOO#####
+.....................####OOOOOOOOOO#####
+......................###OOOOOOOOOO#####
+.......................##OOOOOOOOOO#####
+........................#OOOOOOOOOO#####
+.........................OOOOOOOOOO#####
+..........................##############
+..........................##############
+...........................#############
+............................############
+.............................###########
+```
+
+In this example, the *10x10* square closest to the emitter that fits entirely within the tractor beam has been marked `O`. Within it, the point closest to the emitter (the only highlighted `*O*`) is at X=`25`, Y=`20`.
+
+Find the *100x100* square closest to the emitter that fits entirely within the tractor beam; within that square, find the point closest to the emitter. *What value do you get if you take that point's X coordinate, multiply it by `10000`, then add the point's Y coordinate?* (In the example above, this would be `250020`.)
+
+
diff --git a/2019/Day19/input.in b/2019/Day19/input.in
index bca68256b..b50dd1d64 100644
Binary files a/2019/Day19/input.in and b/2019/Day19/input.in differ
diff --git a/2019/Day20/README.md b/2019/Day20/README.md
index 3fe880d51..7991b7245 100644
--- a/2019/Day20/README.md
+++ b/2019/Day20/README.md
@@ -1,6 +1,212 @@
+original source: [https://adventofcode.com/2019/day/20](https://adventofcode.com/2019/day/20)
## --- Day 20: Donut Maze ---
You notice a strange pattern on the surface of Pluto and land nearby to get a closer look. Upon closer inspection, you realize you've come across one of the famous space-warping mazes of the long-lost Pluto civilization!
Because there isn't much space on Pluto, the civilization that used to live here thrived by inventing a method for folding spacetime. Although the technology is no longer understood, mazes like this one provide a small glimpse into the daily life of an ancient Pluto citizen.
-Read the [full puzzle](https://adventofcode.com/2019/day/20).
\ No newline at end of file
+This maze is shaped like a [donut](https://en.wikipedia.org/wiki/Torus). Portals along the inner and outer edge of the donut can instantly teleport you from one side to the other. For example:
+
+```
+ A
+ A
+ #######.#########
+ #######.........#
+ #######.#######.#
+ #######.#######.#
+ #######.#######.#
+ ##### B ###.#
+BC...## C ###.#
+ ##.## ###.#
+ ##...DE F ###.#
+ ##### G ###.#
+ #########.#####.#
+DE..#######...###.#
+ #.#########.###.#
+FG..#########.....#
+ ###########.#####
+ Z
+ Z
+```
+
+This map of the maze shows solid walls (`#`) and open passages (`.`). Every maze on Pluto has a start (the open tile next to `AA`) and an end (the open tile next to `ZZ`). Mazes on Pluto also have portals; this maze has three pairs of portals: `BC`, `DE`, and `FG`. When on an open tile next to one of these labels, a single step can take you to the other tile with the same label. (You can only walk on `.` tiles; labels and empty space are not traversable.)
+
+One path through the maze doesn't require any portals. Starting at `AA`, you could go down 1, right 8, down 12, left 4, and down 1 to reach `ZZ`, a total of 26 steps.
+
+However, there is a shorter path: You could walk from `AA` to the inner `BC` portal (4 steps), warp to the outer `BC` portal (1 step), walk to the inner `DE` (6 steps), warp to the outer `DE` (1 step), walk to the outer `FG` (4 steps), warp to the inner `FG` (1 step), and finally walk to `ZZ` (6 steps). In total, this is only *23* steps.
+
+Here is a larger example:
+
+```
+ A
+ A
+ #################.#############
+ #.#...#...................#.#.#
+ #.#.#.###.###.###.#########.#.#
+ #.#.#.......#...#.....#.#.#...#
+ #.#########.###.#####.#.#.###.#
+ #.............#.#.....#.......#
+ ###.###########.###.#####.#.#.#
+ #.....# A C #.#.#.#
+ ####### S P #####.#
+ #.#...# #......VT
+ #.#.#.# #.#####
+ #...#.# YN....#.#
+ #.###.# #####.#
+DI....#.# #.....#
+ #####.# #.###.#
+ZZ......# QG....#..AS
+ ###.### #######
+JO..#.#.# #.....#
+ #.#.#.# ###.#.#
+ #...#..DI BU....#..LF
+ #####.# #.#####
+YN......# VT..#....QG
+ #.###.# #.###.#
+ #.#...# #.....#
+ ###.### J L J #.#.###
+ #.....# O F P #.#...#
+ #.###.#####.#.#####.#####.###.#
+ #...#.#.#...#.....#.....#.#...#
+ #.#####.###.###.#.#.#########.#
+ #...#.#.....#...#.#.#.#.....#.#
+ #.###.#####.###.###.#.#.#######
+ #.#.........#...#.............#
+ #########.###.###.#############
+ B J C
+ U P P
+```
+
+Here, `AA` has no direct path to `ZZ`, but it does connect to `AS` and `CP`. By passing through `AS`, `QG`, `BU`, and `JO`, you can reach `ZZ` in *58* steps.
+
+In your maze, *how many steps does it take to get from the open tile marked `AA` to the open tile marked `ZZ`?*
+
+
+## --- Part Two ---
+Strangely, the exit isn't open when you reach it. Then, you remember: the ancient Plutonians were famous for building *recursive spaces*.
+
+The marked connections in the maze aren't portals: they *physically connect* to a larger or smaller copy of the maze. Specifically, the labeled tiles around the inside edge actually connect to a smaller copy of the same maze, and the smaller copy's inner labeled tiles connect to yet a *smaller* copy, and so on.
+
+When you enter the maze, you are at the outermost level; when at the outermost level, only the outer labels `AA` and `ZZ` function (as the start and end, respectively); all other outer labeled tiles are effectively walls. At any other level, `AA` and `ZZ` count as walls, but the other outer labeled tiles bring you one level outward.
+
+Your goal is to find a path through the maze that brings you back to `ZZ` at the outermost level of the maze.
+
+In the first example above, the shortest path is now the loop around the right side. If the starting level is `0`, then taking the previously-shortest path would pass through `BC` (to level `1`), `DE` (to level `2`), and `FG` (back to level `1`). Because this is not the outermost level, `ZZ` is a wall, and the only option is to go back around to `BC`, which would only send you even deeper into the recursive maze.
+
+In the second example above, there is no path that brings you to `ZZ` at the outermost level.
+
+Here is a more interesting example:
+
+```
+ Z L X W C
+ Z P Q B K
+ ###########.#.#.#.#######.###############
+ #...#.......#.#.......#.#.......#.#.#...#
+ ###.#.#.#.#.#.#.#.###.#.#.#######.#.#.###
+ #.#...#.#.#...#.#.#...#...#...#.#.......#
+ #.###.#######.###.###.#.###.###.#.#######
+ #...#.......#.#...#...#.............#...#
+ #.#########.#######.#.#######.#######.###
+ #...#.# F R I Z #.#.#.#
+ #.###.# D E C H #.#.#.#
+ #.#...# #...#.#
+ #.###.# #.###.#
+ #.#....OA WB..#.#..ZH
+ #.###.# #.#.#.#
+CJ......# #.....#
+ ####### #######
+ #.#....CK #......IC
+ #.###.# #.###.#
+ #.....# #...#.#
+ ###.### #.#.#.#
+XF....#.# RF..#.#.#
+ #####.# #######
+ #......CJ NM..#...#
+ ###.#.# #.###.#
+RE....#.# #......RF
+ ###.### X X L #.#.#.#
+ #.....# F Q P #.#.#.#
+ ###.###########.###.#######.#########.###
+ #.....#...#.....#.......#...#.....#.#...#
+ #####.#.###.#######.#######.###.###.#.#.#
+ #.......#.......#.#.#.#.#...#...#...#.#.#
+ #####.###.#####.#.#.#.#.###.###.#.###.###
+ #.......#.....#.#...#...............#...#
+ #############.#.#.###.###################
+ A O F N
+ A A D M
+```
+
+One shortest path through the maze is the following:
+
+
+ - Walk from `AA` to `XF` (16 steps)
+ - Recurse into level 1 through `XF` (1 step)
+ - Walk from `XF` to `CK` (10 steps)
+ - Recurse into level 2 through `CK` (1 step)
+ - Walk from `CK` to `ZH` (14 steps)
+ - Recurse into level 3 through `ZH` (1 step)
+ - Walk from `ZH` to `WB` (10 steps)
+ - Recurse into level 4 through `WB` (1 step)
+ - Walk from `WB` to `IC` (10 steps)
+ - Recurse into level 5 through `IC` (1 step)
+ - Walk from `IC` to `RF` (10 steps)
+ - Recurse into level 6 through `RF` (1 step)
+ - Walk from `RF` to `NM` (8 steps)
+ - Recurse into level 7 through `NM` (1 step)
+ - Walk from `NM` to `LP` (12 steps)
+ - Recurse into level 8 through `LP` (1 step)
+ - Walk from `LP` to `FD` (24 steps)
+ - Recurse into level 9 through `FD` (1 step)
+ - Walk from `FD` to `XQ` (8 steps)
+ - Recurse into level 10 through `XQ` (1 step)
+ - Walk from `XQ` to `WB` (4 steps)
+ - Return to level 9 through `WB` (1 step)
+ - Walk from `WB` to `ZH` (10 steps)
+ - Return to level 8 through `ZH` (1 step)
+ - Walk from `ZH` to `CK` (14 steps)
+ - Return to level 7 through `CK` (1 step)
+ - Walk from `CK` to `XF` (10 steps)
+ - Return to level 6 through `XF` (1 step)
+ - Walk from `XF` to `OA` (14 steps)
+ - Return to level 5 through `OA` (1 step)
+ - Walk from `OA` to `CJ` (8 steps)
+ - Return to level 4 through `CJ` (1 step)
+ - Walk from `CJ` to `RE` (8 steps)
+ - Return to level 3 through `RE` (1 step)
+ - Walk from `RE` to `IC` (4 steps)
+ - Recurse into level 4 through `IC` (1 step)
+ - Walk from `IC` to `RF` (10 steps)
+ - Recurse into level 5 through `RF` (1 step)
+ - Walk from `RF` to `NM` (8 steps)
+ - Recurse into level 6 through `NM` (1 step)
+ - Walk from `NM` to `LP` (12 steps)
+ - Recurse into level 7 through `LP` (1 step)
+ - Walk from `LP` to `FD` (24 steps)
+ - Recurse into level 8 through `FD` (1 step)
+ - Walk from `FD` to `XQ` (8 steps)
+ - Recurse into level 9 through `XQ` (1 step)
+ - Walk from `XQ` to `WB` (4 steps)
+ - Return to level 8 through `WB` (1 step)
+ - Walk from `WB` to `ZH` (10 steps)
+ - Return to level 7 through `ZH` (1 step)
+ - Walk from `ZH` to `CK` (14 steps)
+ - Return to level 6 through `CK` (1 step)
+ - Walk from `CK` to `XF` (10 steps)
+ - Return to level 5 through `XF` (1 step)
+ - Walk from `XF` to `OA` (14 steps)
+ - Return to level 4 through `OA` (1 step)
+ - Walk from `OA` to `CJ` (8 steps)
+ - Return to level 3 through `CJ` (1 step)
+ - Walk from `CJ` to `RE` (8 steps)
+ - Return to level 2 through `RE` (1 step)
+ - Walk from `RE` to `XQ` (14 steps)
+ - Return to level 1 through `XQ` (1 step)
+ - Walk from `XQ` to `FD` (8 steps)
+ - Return to level 0 through `FD` (1 step)
+ - Walk from `FD` to `ZZ` (18 steps)
+
+This path takes a total of *396* steps to move from `AA` at the outermost layer to `ZZ` at the outermost layer.
+
+In your maze, when accounting for recursion, *how many steps does it take to get from the open tile marked `AA` to the open tile marked `ZZ`, both at the outermost layer?*
+
+
diff --git a/2019/Day20/input.in b/2019/Day20/input.in
index 3ad350028..40ce47f83 100644
Binary files a/2019/Day20/input.in and b/2019/Day20/input.in differ
diff --git a/2019/Day21/README.md b/2019/Day21/README.md
index 48998e112..a4cbe59a0 100644
--- a/2019/Day21/README.md
+++ b/2019/Day21/README.md
@@ -1,6 +1,112 @@
+original source: [https://adventofcode.com/2019/day/21](https://adventofcode.com/2019/day/21)
## --- Day 21: Springdroid Adventure ---
You lift off from Pluto and start flying in the direction of Santa.
While experimenting further with the tractor beam, you accidentally pull an asteroid directly into your ship! It deals significant damage to your hull and causes your ship to begin tumbling violently.
-Read the [full puzzle](https://adventofcode.com/2019/day/21).
\ No newline at end of file
+You can send a droid out to investigate, but the tumbling is causing enough [artificial gravity](https://en.wikipedia.org/wiki/Artificial_gravity) that one wrong step could send the droid through a hole in the hull and flying out into space.
+
+The clear choice for this mission is a droid that can *jump* over the holes in the hull - a *springdroid*.
+
+You can use an [Intcode](9) program (your puzzle input) running on an [ASCII-capable](17) computer to [program](https://en.wikipedia.org/wiki/Programmable_read-only_memory) the springdroid. However, springdroids don't run Intcode; instead, they run a simplified assembly language called *springscript*.
+
+While a springdroid is certainly capable of navigating the artificial gravity and giant holes, it has one downside: it can only remember at most *15* springscript instructions.
+
+The springdroid will move forward automatically, constantly thinking about *whether to jump*. The springscript program defines the logic for this decision.
+
+Springscript programs only use [Boolean values](https://en.wikipedia.org/wiki/Boolean_data_type), not numbers or strings. Two registers are available: `T`, the *temporary value* register, and `J`, the *jump* register. If the jump register is *true* at the end of the springscript program, the springdroid will try to jump. Both of these registers start with the value *false*.
+
+Springdroids have a sensor that can detect *whether there is ground* at various distances in the direction it is facing; these values are provided in *read-only registers*. Your springdroid can detect ground at four distances: one tile away (`A`), two tiles away (`B`), three tiles away (`C`), and four tiles away (`D`). If there is ground at the given distance, the register will be *true*; if there is a hole, the register will be *false*.
+
+There are only *three instructions* available in springscript:
+
+
+ - `AND X Y` sets `Y` to *true* if both `X` and `Y` are *true*; otherwise, it sets `Y` to *false*.
+ - `OR X Y` sets `Y` to *true* if at least one of `X` or `Y` is *true*; otherwise, it sets `Y` to *false*.
+ - `NOT X Y` sets `Y` to *true* if `X` is *false*; otherwise, it sets `Y` to *false*.
+
+In all three instructions, the second argument (`Y`) needs to be a *writable register* (either `T` or `J`). The first argument (`X`) can be *any register* (including `A`, `B`, `C`, or `D`).
+
+For example, the one-instruction program `NOT A J` means "if the tile immediately in front of me is not ground, jump".
+
+Or, here is a program that jumps if a three-tile-wide hole (with ground on the other side of the hole) is detected:
+
+```
+NOT A J
+NOT B T
+AND T J
+NOT C T
+AND T J
+AND D J
+```
+
+The Intcode program expects ASCII inputs and outputs. It will begin by displaying a prompt; then, input the desired instructions one per line. End each line with a newline (ASCII code `10`). *When you have finished entering your program*, provide the command `WALK` followed by a newline to instruct the springdroid to begin surveying the hull.
+
+If the springdroid *falls into space*, an ASCII rendering of the last moments of its life will be produced. In these, `@` is the springdroid, `#` is hull, and `.` is empty space. For example, suppose you program the springdroid like this:
+
+```
+NOT D J
+WALK
+```
+
+This one-instruction program sets `J` to *true* if and only if there is no ground four tiles away. In other words, it attempts to jump into any hole it finds:
+
+```
+.................
+.................
+*@*................
+#####.###########
+
+.................
+.................
+.*@*...............
+#####.###########
+
+.................
+..*@*..............
+.................
+#####.###########
+
+...*@*.............
+.................
+.................
+#####.###########
+
+.................
+....*@*............
+.................
+#####.###########
+
+.................
+.................
+.....*@*...........
+#####.###########
+
+.................
+.................
+.................
+#####*@*###########
+```
+
+However, if the springdroid successfully makes it across, it will use an output instruction to indicate the *amount of damage to the hull* as a single giant integer outside the normal ASCII range.
+
+Program the springdroid with logic that allows it to survey the hull without falling into space. *What amount of hull damage does it report?*
+
+
+## --- Part Two ---
+There are many areas the springdroid can't reach. You flip through the manual and discover a way to *increase its sensor range*.
+
+Instead of ending your springcode program with `WALK`, use `RUN`. Doing this will enable *extended sensor mode*, capable of sensing ground up to *nine tiles away*. This data is available in *five new read-only registers*:
+
+
+ - Register `E` indicates whether there is ground *five* tiles away.
+ - Register `F` indicates whether there is ground *six* tiles away.
+ - Register `G` indicates whether there is ground *seven* tiles away.
+ - Register `H` indicates whether there is ground *eight* tiles away.
+ - Register `I` indicates whether there is ground *nine* tiles away.
+
+All other functions remain the same.
+
+Successfully survey the rest of the hull by ending your program with `RUN`. *What amount of hull damage does the springdroid now report?*
+
+
diff --git a/2019/Day21/input.in b/2019/Day21/input.in
index e71d327cc..3ced3cd82 100644
Binary files a/2019/Day21/input.in and b/2019/Day21/input.in differ
diff --git a/2019/Day22/README.md b/2019/Day22/README.md
index f72411e68..bdad2cd74 100644
--- a/2019/Day22/README.md
+++ b/2019/Day22/README.md
@@ -1,6 +1,176 @@
+original source: [https://adventofcode.com/2019/day/22](https://adventofcode.com/2019/day/22)
## --- Day 22: Slam Shuffle ---
There isn't much to do while you wait for the droids to repair your ship. At least you're drifting in the right direction. You decide to practice a new [card shuffle](https://en.wikipedia.org/wiki/Shuffling) you've been working on.
Digging through the ship's storage, you find a deck of *space cards*! Just like any deck of space cards, there are 10007 cards in the deck numbered `0` through `10006`. The deck must be new - they're still in *factory order*, with `0` on the top, then `1`, then `2`, and so on, all the way through to `10006` on the bottom.
-Read the [full puzzle](https://adventofcode.com/2019/day/22).
\ No newline at end of file
+You've been practicing three different *techniques* that you use while shuffling. Suppose you have a deck of only 10 cards (numbered `0` through `9`):
+
+*To `deal into new stack`*, create a new stack of cards by dealing the top card of the deck onto the top of the new stack repeatedly until you run out of cards:
+
+```
+Top Bottom
+0 1 2 3 4 5 6 7 8 9 Your deck
+ New stack
+
+ 1 2 3 4 5 6 7 8 9 Your deck
+ 0 New stack
+
+ 2 3 4 5 6 7 8 9 Your deck
+ 1 0 New stack
+
+ 3 4 5 6 7 8 9 Your deck
+ 2 1 0 New stack
+
+Several steps later...
+
+ 9 Your deck
+ 8 7 6 5 4 3 2 1 0 New stack
+
+ Your deck
+9 8 7 6 5 4 3 2 1 0 New stack
+```
+
+Finally, pick up the new stack you've just created and use it as the deck for the next technique.
+
+*To `cut N` cards*, take the top `N` cards off the top of the deck and move them as a single unit to the bottom of the deck, retaining their order. For example, to `cut 3`:
+
+```
+Top Bottom
+0 1 2 3 4 5 6 7 8 9 Your deck
+
+ 3 4 5 6 7 8 9 Your deck
+0 1 2 Cut cards
+
+3 4 5 6 7 8 9 Your deck
+ 0 1 2 Cut cards
+
+3 4 5 6 7 8 9 0 1 2 Your deck
+```
+
+You've also been getting pretty good at a version of this technique where `N` is negative! In that case, cut (the absolute value of) `N` cards from the bottom of the deck onto the top. For example, to `cut -4`:
+
+```
+Top Bottom
+0 1 2 3 4 5 6 7 8 9 Your deck
+
+0 1 2 3 4 5 Your deck
+ 6 7 8 9 Cut cards
+
+ 0 1 2 3 4 5 Your deck
+6 7 8 9 Cut cards
+
+6 7 8 9 0 1 2 3 4 5 Your deck
+```
+
+*To `deal with increment N`*, start by clearing enough space on your table to lay out all of the cards individually in a long line. Deal the top card into the leftmost position. Then, move `N` positions to the right and deal the next card there. If you would move into a position past the end of the space on your table, wrap around and keep counting from the leftmost card again. Continue this process until you run out of cards.
+
+For example, to `deal with increment 3`:
+
+```
+
+0 1 2 3 4 5 6 7 8 9 Your deck
+. . . . . . . . . . Space on table
+^ Current position
+
+Deal the top card to the current position:
+
+ 1 2 3 4 5 6 7 8 9 Your deck
+0 . . . . . . . . . Space on table
+^ Current position
+
+Move the current position right 3:
+
+ 1 2 3 4 5 6 7 8 9 Your deck
+0 . . . . . . . . . Space on table
+ ^ Current position
+
+Deal the top card:
+
+ 2 3 4 5 6 7 8 9 Your deck
+0 . . 1 . . . . . . Space on table
+ ^ Current position
+
+Move right 3 and deal:
+
+ 3 4 5 6 7 8 9 Your deck
+0 . . 1 . . 2 . . . Space on table
+ ^ Current position
+
+Move right 3 and deal:
+
+ 4 5 6 7 8 9 Your deck
+0 . . 1 . . 2 . . 3 Space on table
+ ^ Current position
+
+Move right 3, wrapping around, and deal:
+
+ 5 6 7 8 9 Your deck
+0 . 4 1 . . 2 . . 3 Space on table
+ ^ Current position
+
+And so on:
+
+0 7 4 1 8 5 2 9 6 3 Space on table
+```
+
+Positions on the table which already contain cards are still counted; they're not skipped. Of course, this technique is carefully designed so it will never put two cards in the same position or leave a position empty.
+
+Finally, collect the cards on the table so that the leftmost card ends up at the top of your deck, the card to its right ends up just below the top card, and so on, until the rightmost card ends up at the bottom of the deck.
+
+The complete shuffle process (your puzzle input) consists of applying many of these techniques. Here are some examples that combine techniques; they all start with a *factory order* deck of 10 cards:
+
+```
+deal with increment 7
+deal into new stack
+deal into new stack
+Result: 0 3 6 9 2 5 8 1 4 7
+```
+
+```
+cut 6
+deal with increment 7
+deal into new stack
+Result: 3 0 7 4 1 8 5 2 9 6
+```
+
+```
+deal with increment 7
+deal with increment 9
+cut -2
+Result: 6 3 0 7 4 1 8 5 2 9
+```
+
+```
+deal into new stack
+cut -2
+deal with increment 7
+cut 8
+cut -4
+deal with increment 7
+cut 3
+deal with increment 9
+deal with increment 3
+cut -1
+Result: 9 2 5 8 1 4 7 0 3 6
+```
+
+Positions within the deck count from `0` at the top, then `1` for the card immediately below the top card, and so on to the bottom. (That is, cards start in the position matching their number.)
+
+After shuffling your *factory order* deck of 10007 cards, *what is the position of card `2019`?*
+
+
+## --- Part Two ---
+After a while, you realize your shuffling skill won't improve much more with merely a single deck of cards. You ask every 3D printer on the ship to make you some more cards while you check on the ship repairs. While reviewing the work the droids have finished so far, you think you see [Halley's Comet](https://en.wikipedia.org/wiki/Halley%27s_Comet) fly past!
+
+When you get back, you discover that the 3D printers have combined their power to create for you a single, giant, brand new, *factory order* deck of *`119315717514047` space cards*.
+
+Finally, a deck of cards worthy of shuffling!
+
+You decide to apply your complete shuffle process (your puzzle input) to the deck *`101741582076661` times in a row*.
+
+You'll need to be careful, though - one wrong move with this many cards and you might *overflow* your entire ship!
+
+After shuffling your new, giant, *factory order* deck that many times, *what number is on the card that ends up in position `2020`?*
+
+
diff --git a/2019/Day22/input.in b/2019/Day22/input.in
index 0eab6218e..0f3313602 100644
Binary files a/2019/Day22/input.in and b/2019/Day22/input.in differ
diff --git a/2019/Day23/README.md b/2019/Day23/README.md
index eeb65d376..e9b127fcb 100644
--- a/2019/Day23/README.md
+++ b/2019/Day23/README.md
@@ -1,6 +1,31 @@
+original source: [https://adventofcode.com/2019/day/23](https://adventofcode.com/2019/day/23)
## --- Day 23: Category Six ---
The droids have finished repairing as much of the ship as they can. Their report indicates that this was a *Category 6* disaster - not because it was that bad, but because it destroyed the stockpile of [Category 6](https://en.wikipedia.org/wiki/Category_6_cable) network cables as well as most of the ship's network infrastructure.
You'll need to *rebuild the network from scratch*.
-Read the [full puzzle](https://adventofcode.com/2019/day/23).
\ No newline at end of file
+The computers on the network are standard [Intcode](9) computers that communicate by sending *packets* to each other. There are `50` of them in total, each running a copy of the same *Network Interface Controller* (NIC) software (your puzzle input). The computers have *network addresses* `0` through `49`; when each computer boots up, it will request its network address via a single input instruction. Be sure to give each computer a unique network address.
+
+Once a computer has received its network address, it will begin doing work and communicating over the network by sending and receiving *packets*. All packets contain *two values* named `X` and `Y`. Packets sent to a computer are queued by the recipient and read in the order they are received.
+
+To *send* a packet to another computer, the NIC will use *three output instructions* that provide the *destination address* of the packet followed by its `X` and `Y` values. For example, three output instructions that provide the values `10`, `20`, `30` would send a packet with `X=20` and `Y=30` to the computer with address `10`.
+
+To *receive* a packet from another computer, the NIC will use an *input instruction*. If the incoming packet queue is *empty*, provide `-1`. Otherwise, provide the `X` value of the next packet; the computer will then use a second input instruction to receive the `Y` value for the same packet. Once both values of the packet are read in this way, the packet is removed from the queue.
+
+Note that these input and output instructions never [block](https://en.wikipedia.org/wiki/Blocking_(computing)). Specifically, output instructions do not wait for the sent packet to be received - the computer might send multiple packets before receiving any. Similarly, input instructions do not wait for a packet to arrive - if no packet is waiting, input instructions should receive `-1`.
+
+Boot up all `50` computers and attach them to your network. *What is the `Y` value of the first packet sent to address `255`?*
+
+
+## --- Part Two ---
+Packets sent to address `255` are handled by a device called a NAT (Not Always Transmitting). The NAT is responsible for managing power consumption of the network by blocking certain packets and watching for idle periods in the computers.
+
+If a packet would be sent to address `255`, the NAT receives it instead. The NAT remembers only the *last* packet it receives; that is, the data in each packet it receives overwrites the NAT's packet memory with the new packet's `X` and `Y` values.
+
+The NAT also monitors all computers on the network. If all computers have *empty incoming packet queues* and are *continuously trying to receive packets* without sending packets, the network is considered *idle*.
+
+Once the network is idle, the NAT sends *only the last packet it received* to address `0`; this will cause the computers on the network to resume activity. In this way, the NAT can throttle power consumption of the network when the ship needs power in other areas.
+
+Monitor packets released to the computer at address `0` by the NAT. *What is the first `Y` value delivered by the NAT to the computer at address `0` twice in a row?*
+
+
diff --git a/2019/Day23/input.in b/2019/Day23/input.in
index 088494653..4c1bd5493 100644
Binary files a/2019/Day23/input.in and b/2019/Day23/input.in differ
diff --git a/2019/Day24/README.md b/2019/Day24/README.md
index 0571ab9cb..198fd9e40 100644
--- a/2019/Day24/README.md
+++ b/2019/Day24/README.md
@@ -1,6 +1,243 @@
+original source: [https://adventofcode.com/2019/day/24](https://adventofcode.com/2019/day/24)
## --- Day 24: Planet of Discord ---
You land on [Eris](https://en.wikipedia.org/wiki/Eris_(dwarf_planet)), your last stop before reaching Santa. As soon as you do, your sensors start picking up strange life forms moving around: Eris is infested with [bugs](https://www.nationalgeographic.org/thisday/sep9/worlds-first-computer-bug/)! With an over 24-hour roundtrip for messages between you and Earth, you'll have to deal with this problem on your own.
Eris isn't a very large place; a scan of the entire area fits into a 5x5 grid (your puzzle input). The scan shows *bugs* (`#`) and *empty spaces* (`.`).
-Read the [full puzzle](https://adventofcode.com/2019/day/24).
\ No newline at end of file
+Each *minute*, The bugs live and die based on the number of bugs in the *four adjacent tiles*:
+
+
+ - A bug *dies* (becoming an empty space) unless there is *exactly one* bug adjacent to it.
+ - An empty space *becomes infested* with a bug if *exactly one or two* bugs are adjacent to it.
+
+Otherwise, a bug or empty space remains the same. (Tiles on the edges of the grid have fewer than four adjacent tiles; the missing tiles count as empty space.) This process happens in every location *simultaneously*; that is, within the same minute, the number of adjacent bugs is counted for every tile first, and then the tiles are updated.
+
+Here are the first few minutes of an example scenario:
+
+```
+Initial state:
+....#
+#..#.
+#..##
+..#..
+#....
+
+After 1 minute:
+#..#.
+####.
+###.#
+##.##
+.##..
+
+After 2 minutes:
+#####
+....#
+....#
+...#.
+#.###
+
+After 3 minutes:
+#....
+####.
+...##
+#.##.
+.##.#
+
+After 4 minutes:
+####.
+....#
+##..#
+.....
+##...
+```
+
+To understand the nature of the bugs, watch for the first time a layout of bugs and empty spaces *matches any previous layout*. In the example above, the first layout to appear twice is:
+
+```
+.....
+.....
+.....
+#....
+.#...
+```
+
+To calculate the *biodiversity rating* for this layout, consider each tile left-to-right in the top row, then left-to-right in the second row, and so on. Each of these tiles is worth biodiversity points equal to *increasing powers of two*: 1, 2, 4, 8, 16, 32, and so on. Add up the biodiversity points for tiles with bugs; in this example, the 16th tile (`32768` points) and 22nd tile (`2097152` points) have bugs, a total biodiversity rating of `*2129920*`.
+
+*What is the biodiversity rating for the first layout that appears twice?*
+
+
+## --- Part Two ---
+After careful analysis, one thing is certain: *you have no idea where all these bugs are coming from*.
+
+Then, you remember: Eris is an old [Plutonian](20) settlement! Clearly, the bugs are coming from recursively-folded space.
+
+This 5x5 grid is *only one* level in an *infinite* number of recursion levels. The tile in the middle of the grid is actually another 5x5 grid, the grid in your scan is contained as the middle tile of a larger 5x5 grid, and so on. Two levels of grids look like this:
+
+```
+ | | | |
+ | | | |
+ | | | |
+-----+-----+---------+-----+-----
+ | | | |
+ | | | |
+ | | | |
+-----+-----+---------+-----+-----
+ | | | | | | | |
+ | |-+-+-+-+-| |
+ | | | | | | | |
+ | |-+-+-+-+-| |
+ | | | |?| | | |
+ | |-+-+-+-+-| |
+ | | | | | | | |
+ | |-+-+-+-+-| |
+ | | | | | | | |
+-----+-----+---------+-----+-----
+ | | | |
+ | | | |
+ | | | |
+-----+-----+---------+-----+-----
+ | | | |
+ | | | |
+ | | | |
+```
+
+(To save space, some of the tiles are not drawn to scale.) Remember, this is only a small part of the infinitely recursive grid; there is a 5x5 grid that contains this diagram, and a 5x5 grid that contains that one, and so on. Also, the `?` in the diagram contains another 5x5 grid, which itself contains another 5x5 grid, and so on.
+
+The scan you took (your puzzle input) shows where the bugs are *on a single level* of this structure. The middle tile of your scan is empty to accommodate the recursive grids within it. Initially, no other levels contain bugs.
+
+Tiles still count as *adjacent* if they are directly *up, down, left, or right* of a given tile. Some tiles have adjacent tiles at a recursion level above or below its own level. For example:
+
+```
+ | | | |
+ 1 | 2 | 3 | 4 | 5
+ | | | |
+-----+-----+---------+-----+-----
+ | | | |
+ 6 | 7 | 8 | 9 | 10
+ | | | |
+-----+-----+---------+-----+-----
+ | |A|B|C|D|E| |
+ | |-+-+-+-+-| |
+ | |F|G|H|I|J| |
+ | |-+-+-+-+-| |
+ 11 | 12 |K|L|?|N|O| 14 | 15
+ | |-+-+-+-+-| |
+ | |P|Q|R|S|T| |
+ | |-+-+-+-+-| |
+ | |U|V|W|X|Y| |
+-----+-----+---------+-----+-----
+ | | | |
+ 16 | 17 | 18 | 19 | 20
+ | | | |
+-----+-----+---------+-----+-----
+ | | | |
+ 21 | 22 | 23 | 24 | 25
+ | | | |
+```
+
+
+ - Tile 19 has four adjacent tiles: 14, 18, 20, and 24.
+ - Tile G has four adjacent tiles: B, F, H, and L.
+ - Tile D has four adjacent tiles: 8, C, E, and I.
+ - Tile E has four adjacent tiles: 8, D, 14, and J.
+ - Tile 14 has *eight* adjacent tiles: 9, E, J, O, T, Y, 15, and 19.
+ - Tile N has *eight* adjacent tiles: I, O, S, and five tiles within the sub-grid marked `?`.
+
+The rules about bugs living and dying are the same as before.
+
+For example, consider the same initial state as above:
+
+```
+....#
+#..#.
+#.?##
+..#..
+#....
+```
+
+The center tile is drawn as `?` to indicate the next recursive grid. Call this level 0; the grid within this one is level 1, and the grid that contains this one is level -1. Then, after *ten* minutes, the grid at each level would look like this:
+
+```
+Depth -5:
+..#..
+.#.#.
+..?.#
+.#.#.
+..#..
+
+Depth -4:
+...#.
+...##
+..?..
+...##
+...#.
+
+Depth -3:
+#.#..
+.#...
+..?..
+.#...
+#.#..
+
+Depth -2:
+.#.##
+....#
+..?.#
+...##
+.###.
+
+Depth -1:
+#..##
+...##
+..?..
+...#.
+.####
+
+Depth 0:
+.#...
+.#.##
+.#?..
+.....
+.....
+
+Depth 1:
+.##..
+#..##
+..?.#
+##.##
+#####
+
+Depth 2:
+###..
+##.#.
+#.?..
+.#.##
+#.#..
+
+Depth 3:
+..###
+.....
+#.?..
+#....
+#...#
+
+Depth 4:
+.###.
+#..#.
+#.?..
+##.#.
+.....
+
+Depth 5:
+####.
+#..#.
+#.?#.
+####.
+.....
+```
+
+In this example, after 10 minutes, a total of `*99*` bugs are present.
+
+Starting with your scan, *how many bugs are present after 200 minutes?*
+
+
diff --git a/2019/Day24/input.in b/2019/Day24/input.in
index ce82b25d5..2207476f0 100644
Binary files a/2019/Day24/input.in and b/2019/Day24/input.in differ
diff --git a/2019/Day25/README.md b/2019/Day25/README.md
index 09c087c2b..964e202b5 100644
--- a/2019/Day25/README.md
+++ b/2019/Day25/README.md
@@ -1,6 +1,39 @@
+original source: [https://adventofcode.com/2019/day/25](https://adventofcode.com/2019/day/25)
## --- Day 25: Cryostasis ---
As you approach Santa's ship, your sensors report two important details:
First, that you might be too late: the internal temperature is `-40` degrees.
-Read the [full puzzle](https://adventofcode.com/2019/day/25).
\ No newline at end of file
+Second, that one faint life signature is somewhere on the ship.
+
+The airlock door is locked with a code; your best option is to send in a small droid to investigate the situation. You attach your ship to Santa's, break a small hole in the hull, and let the droid run in before you seal it up again. Before your ship starts freezing, you detach your ship and set it to automatically stay within range of Santa's ship.
+
+This droid can follow basic instructions and report on its surroundings; you can communicate with it through an [Intcode](9) program (your puzzle input) running on an [ASCII-capable](17) computer.
+
+As the droid moves through its environment, it will describe what it encounters. When it says `Command?`, you can give it a single instruction terminated with a newline (ASCII code `10`). Possible instructions are:
+
+
+ - *Movement* via `north`, `south`, `east`, or `west`.
+ - To *take* an item the droid sees in the environment, use the command `take `. For example, if the droid reports seeing a `red ball`, you can pick it up with `take red ball`.
+ - To *drop* an item the droid is carrying, use the command `drop `. For example, if the droid is carrying a `green ball`, you can drop it with `drop green ball`.
+ - To get a *list of all of the items* the droid is currently carrying, use the command `inv` (for "inventory").
+
+Extra spaces or other characters aren't allowed - instructions must be provided precisely.
+
+Santa's ship is a *Reindeer-class starship*; these ships use pressure-sensitive floors to determine the identity of droids and crew members. The standard configuration for these starships is for all droids to weigh exactly the same amount to make them easier to detect. If you need to get past such a sensor, you might be able to reach the correct weight by carrying items from the environment.
+
+Look around the ship and see if you can find the *password for the main airlock*.
+
+
+## --- Part Two ---
+As you move through the main airlock, the air inside the ship is already heating up to reasonable levels. Santa explains that he didn't notice you coming because he was just taking a quick nap. The ship wasn't frozen; he just had the thermostat set to "North Pole".
+
+You make your way over to the navigation console. It beeps. "Status: Stranded. Please supply measurements from *49 stars* to recalibrate."
+
+"49 stars? But the Elves told me you needed fifty--"
+
+Santa just smiles and nods his head toward the window. There, in the distance, you can see the center of the Solar System: the Sun!
+
+The navigation console beeps again.
+
+
diff --git a/2019/Day25/input.in b/2019/Day25/input.in
index 379c826d2..6e431d6c9 100644
Binary files a/2019/Day25/input.in and b/2019/Day25/input.in differ
diff --git a/2019/README.md b/2019/README.md
index 27bdfaccb..4bd1241ac 100644
--- a/2019/README.md
+++ b/2019/README.md
@@ -1,4 +1,6 @@
+
# Advent of Code (2019)
Check out https://adventofcode.com/2019.
+
diff --git a/2019/SplashScreen.cs b/2019/SplashScreen.cs
index 9025b076f..9e68101b8 100644
--- a/2019/SplashScreen.cs
+++ b/2019/SplashScreen.cs
@@ -1,3 +1,4 @@
+
using System;
namespace AdventOfCode.Y2019;
@@ -8,178 +9,185 @@ public void Show() {
var color = Console.ForegroundColor;
Write(0xcc00, false, " ▄█▄ ▄▄█ ▄ ▄ ▄▄▄ ▄▄ ▄█▄ ▄▄▄ ▄█ ▄▄ ▄▄▄ ▄▄█ ▄▄▄\n █▄█ █ █ █ █ █▄█ █ █ █ █ █ █▄ ");
- Write(0xcc00, false, " █ █ █ █ █ █▄█\n █ █ █▄█ ▀▄▀ █▄▄ █ █ █▄ █▄█ █ █▄ █▄█ █▄█ █▄▄ sub y{2019}\n \n");
- Write(0xcc00, false, " ");
- Write(0x666666, false, " ''.. ':. '. ");
- Write(0xcccccc, false, "25 ");
- Write(0xffff66, false, "**\n ");
- Write(0x666666, false, "....... ");
- Write(0x333333, false, ".");
- Write(0x666666, false, " ''. '. ");
- Write(0xbebcbc, true, ". ");
- Write(0xcccccc, false, "24 ");
- Write(0xffff66, false, "**\n ");
- Write(0x333333, false, ".");
- Write(0x666666, false, " '''''... ''. '. ");
- Write(0x333333, false, ".");
- Write(0x666666, false, " ' ");
- Write(0xcccccc, false, "23 ");
- Write(0xffff66, false, "**\n ");
- Write(0x666666, false, " ''.. '. '. ");
- Write(0xffffff, true, ". ");
- Write(0xcccccc, false, "22 ");
- Write(0xffff66, false, "**\n ");
- Write(0x666666, false, "...... ");
- Write(0x333333, false, ".");
- Write(0x666666, false, " ''.");
- Write(0x333333, false, ". .");
- Write(0x666666, false, " '. ");
- Write(0x333333, false, ".");
- Write(0x666666, false, " '. ");
- Write(0xcccccc, false, "21 ");
- Write(0xffff66, false, "**\n ");
- Write(0x666666, false, " ''''... ");
- Write(0x333333, false, ".");
- Write(0x666666, false, "'. ");
- Write(0x333333, false, ".");
- Write(0x666666, false, " '. : ");
- Write(0xcdc1b2, true, ". ");
- Write(0x333333, false, ". ");
- Write(0xcccccc, false, "20 ");
- Write(0xffff66, false, "**\n ");
- Write(0x666666, false, " ''.. '. ");
- Write(0x333333, false, ".");
- Write(0x666666, false, " '.");
- Write(0x333333, false, ".");
- Write(0x666666, false, " '. ");
- Write(0xcccccc, false, "19 ");
- Write(0xffff66, false, "**\n ");
- Write(0x666666, false, "..... ''. '. '. '");
- Write(0x456efe, true, "o ");
- Write(0x333333, false, ". ");
- Write(0xcccccc, false, "18 ");
- Write(0xffff66, false, "**\n ");
- Write(0x666666, false, " ''''... '. '. ': '.");
- Write(0x333333, false, ". ");
- Write(0xcccccc, false, "17 ");
- Write(0xffff66, false, "**\n ");
- Write(0x333333, false, ".");
- Write(0x666666, false, " '.. '. '. ");
- Write(0xbee4e7, true, "o");
- Write(0x333333, false, ".");
- Write(0x666666, false, " : ");
- Write(0xcccccc, false, "16 ");
- Write(0xffff66, false, "**\n ");
- Write(0x333333, false, ". .");
- Write(0x666666, false, " '. '. ");
- Write(0x333333, false, ".");
- Write(0x666666, false, " '. ");
- Write(0x333333, false, ".");
- Write(0x666666, false, " : : ");
- Write(0xcccccc, false, "15 ");
- Write(0xffff66, false, "**\n ");
- Write(0x666666, false, "'''''... '. ");
- Write(0x333333, false, ". .");
- Write(0x666666, false, " '. ");
- Write(0xebc982, true, "(O)");
- Write(0x666666, false, " : '. ");
- Write(0xcccccc, false, "14 ");
- Write(0xffff66, false, "**\n ");
- Write(0x333333, false, ".");
- Write(0x666666, false, " ''.. '. '. ");
- Write(0x333333, false, "..");
- Write(0x666666, false, " '. '. : ");
- Write(0xcccccc, false, "13 ");
- Write(0xffff66, false, "**\n ");
- Write(0x666666, false, "''''... '. '. '");
- Write(0xd2beab, true, "O");
- Write(0x666666, false, " '. : :");
- Write(0x333333, false, ". ");
- Write(0xcccccc, false, "12 ");
- Write(0xffff66, false, "**\n ");
- Write(0x666666, false, " ''. '.");
- Write(0x333333, false, ". .");
- Write(0x666666, false, " : '. : '. : ");
- Write(0xcccccc, false, "11 ");
- Write(0xffff66, false, "**\n ");
- Write(0x666666, false, "'''''.. '. '. ");
- Write(0x333333, false, ". . ");
- Write(0xbabdb6, true, ".");
- Write(0x666666, false, " : ");
- Write(0x333333, false, ".");
- Write(0x666666, false, " '. : '. ");
- Write(0xcccccc, false, "10 ");
- Write(0xffff66, false, "**\n ");
- Write(0x666666, false, " '. '. '. '. ");
- Write(0x333333, false, ".");
- Write(0x666666, false, " : : : : ");
- Write(0xcccccc, false, " 9 ");
- Write(0xffff66, false, "**\n ");
- Write(0x666666, false, " : '.");
- Write(0x333333, false, ". ");
- Write(0xf7a859, true, ". ");
- Write(0x333333, false, ".");
- Write(0x666666, false, " : :");
- Write(0x333333, false, ".");
- Write(0x666666, false, " : : : ");
- Write(0xcccccc, false, " 8 ");
- Write(0xffff66, false, "**\n ");
- Write(0x666666, false, "'''. ");
- Write(0x333333, false, ".");
- Write(0x666666, false, ":");
- Write(0x333333, false, ".");
- Write(0x666666, false, " : :");
- Write(0x333333, false, ".");
- Write(0x666666, false, " : : : : : ");
- Write(0xcccccc, false, " 7 ");
- Write(0xffff66, false, "**\n ");
- Write(0xffff66, true, "* ");
- Write(0xbebcbe, true, ".");
- Write(0x666666, false, " : : : : : : ");
- Write(0x333333, false, ".");
- Write(0x666666, false, " : : ");
- Write(0xcccccc, false, " 6 ");
- Write(0xffff66, false, "**\n ");
- Write(0x666666, false, "...' ");
- Write(0x333333, false, ".");
- Write(0x666666, false, ": : : : ");
- Write(0x333333, false, ".");
- Write(0x666666, false, ": : ");
- Write(0x333333, false, ".");
- Write(0x666666, false, ": : ");
- Write(0xcccccc, false, " 5 ");
- Write(0xffff66, false, "**\n ");
- Write(0x333333, false, ". ");
- Write(0xe3e2e0, true, ".");
- Write(0x333333, false, ".");
- Write(0x666666, false, " .' : : : : : : ");
- Write(0xcccccc, false, " 4 ");
- Write(0xffff66, false, "**\n ");
- Write(0x666666, false, " .' .' .' ");
- Write(0x333333, false, ".");
- Write(0x666666, false, " .' : : : : ");
- Write(0xcccccc, false, " 3 ");
- Write(0xffff66, false, "**\n ");
- Write(0x666666, false, ".....'' ");
- Write(0x91a5bd, true, ".");
- Write(0x666666, false, "' .' : : .' ");
- Write(0x333333, false, ".");
- Write(0x666666, false, " : .' ");
- Write(0xcccccc, false, " 2 ");
- Write(0xffff66, false, "**\n ");
- Write(0x666666, false, " ..' .' : ");
- Write(0x333333, false, ".");
- Write(0x666666, false, " .' : .'");
- Write(0x333333, false, ".");
- Write(0x666666, false, " : ");
- Write(0xcccccc, false, " 1 ");
- Write(0xffff66, false, "**\n \n");
-
+ Write(0xcc00, false, " █ █ █ █ █ █▄█\n █ █ █▄█ ▀▄▀ █▄▄ █ █ █▄ █▄█ █ █▄ █▄█ █▄█ █▄▄ $year = 2019\n ");
+ Write(0xcc00, false, "\n ");
+ Write(0x666666, false, " ''.. ':. '. ");
+ Write(0x333333, false, ". ");
+ Write(0xcccccc, false, "25 ");
+ Write(0xffff66, false, "**\n ");
+ Write(0x666666, false, "....... ");
+ Write(0x333333, false, "..");
+ Write(0x666666, false, " ''. '. ");
+ Write(0x333333, false, ". ");
+ Write(0xbebcbc, true, ". ");
+ Write(0xcccccc, false, "24 ");
+ Write(0xffff66, false, "**\n ");
+ Write(0x666666, false, " '''''... ");
+ Write(0x333333, false, ".");
+ Write(0x666666, false, " ''. '. ");
+ Write(0x333333, false, ".");
+ Write(0x666666, false, " ' ");
+ Write(0xcccccc, false, "23 ");
+ Write(0xffff66, false, "**\n ");
+ Write(0x333333, false, ".");
+ Write(0x666666, false, " ''.. '. '. ");
+ Write(0xffffff, true, ". ");
+ Write(0xcccccc, false, "22 ");
+ Write(0xffff66, false, "**\n ");
+ Write(0x666666, false, "...... ''. '. ");
+ Write(0x333333, false, ".");
+ Write(0x666666, false, " '. ");
+ Write(0xcccccc, false, "21 ");
+ Write(0xffff66, false, "**\n ");
+ Write(0x333333, false, "..");
+ Write(0x666666, false, " ''''... '. '.");
+ Write(0x333333, false, ".");
+ Write(0x666666, false, " : ");
+ Write(0xcdc1b2, true, ". ");
+ Write(0xcccccc, false, "20 ");
+ Write(0xffff66, false, "**\n ");
+ Write(0x666666, false, " ''.. ");
+ Write(0x333333, false, ". .");
+ Write(0x666666, false, "'. ");
+ Write(0x333333, false, ".");
+ Write(0x666666, false, " '. ");
+ Write(0x333333, false, ".");
+ Write(0x666666, false, "'. ");
+ Write(0xcccccc, false, "19 ");
+ Write(0xffff66, false, "**\n ");
+ Write(0x666666, false, "..... ''. ");
+ Write(0x333333, false, ".");
+ Write(0x666666, false, " '. ");
+ Write(0x333333, false, ".");
+ Write(0x666666, false, "'. '");
+ Write(0x456efe, true, "o ");
+ Write(0xcccccc, false, "18 ");
+ Write(0xffff66, false, "**\n ");
+ Write(0x333333, false, ".");
+ Write(0x666666, false, " ''''... '. '. ': '. ");
+ Write(0xcccccc, false, "17 ");
+ Write(0xffff66, false, "**\n ");
+ Write(0x333333, false, ".");
+ Write(0x666666, false, " '.. ");
+ Write(0x333333, false, ".");
+ Write(0x666666, false, " '. '. ");
+ Write(0xbee4e7, true, "o");
+ Write(0x666666, false, " : ");
+ Write(0xcccccc, false, "16 ");
+ Write(0xffff66, false, "**\n ");
+ Write(0x666666, false, " '. '. '. : : ");
+ Write(0xcccccc, false, "15 ");
+ Write(0xffff66, false, "**\n ");
+ Write(0x666666, false, "'''''... '. ");
+ Write(0x333333, false, ".");
+ Write(0x666666, false, " '. ");
+ Write(0xebc982, true, "(O)");
+ Write(0x666666, false, " : '. ");
+ Write(0xcccccc, false, "14 ");
+ Write(0xffff66, false, "**\n ");
+ Write(0x666666, false, " ''.. '. '. '. ");
+ Write(0x333333, false, ".");
+ Write(0x666666, false, " '. :");
+ Write(0x333333, false, ". ");
+ Write(0xcccccc, false, "13 ");
+ Write(0xffff66, false, "**\n ");
+ Write(0x666666, false, "''''...");
+ Write(0x333333, false, ".");
+ Write(0x666666, false, " '. ");
+ Write(0x333333, false, ".");
+ Write(0x666666, false, " '. '");
+ Write(0xd2beab, true, "O");
+ Write(0x666666, false, " '. : : ");
+ Write(0xcccccc, false, "12 ");
+ Write(0xffff66, false, "**\n ");
+ Write(0x666666, false, " ''. '. : '. : '. : ");
+ Write(0xcccccc, false, "11 ");
+ Write(0xffff66, false, "**\n ");
+ Write(0x666666, false, "'''''.. '. '. ");
+ Write(0x333333, false, ". ");
+ Write(0xbabdb6, true, ".");
+ Write(0x333333, false, ". .");
+ Write(0x666666, false, " : '. : '. ");
+ Write(0xcccccc, false, "10 ");
+ Write(0xffff66, false, "**\n ");
+ Write(0x333333, false, "..");
+ Write(0x666666, false, " '. '. '. '. : : : : ");
+ Write(0xcccccc, false, " 9 ");
+ Write(0xffff66, false, "**\n ");
+ Write(0x333333, false, ". .");
+ Write(0x666666, false, " : '. ");
+ Write(0x333333, false, ". ");
+ Write(0xf7a859, true, ". ");
+ Write(0x333333, false, ".");
+ Write(0x666666, false, " : : ");
+ Write(0x333333, false, ".");
+ Write(0x666666, false, " : ");
+ Write(0x333333, false, ".");
+ Write(0x666666, false, " : : ");
+ Write(0xcccccc, false, " 8 ");
+ Write(0xffff66, false, "**\n ");
+ Write(0x666666, false, "'''. ");
+ Write(0x333333, false, "..");
+ Write(0x666666, false, " : : : : : : ");
+ Write(0x333333, false, ". .");
+ Write(0x666666, false, ": : ");
+ Write(0xcccccc, false, " 7 ");
+ Write(0xffff66, false, "**\n ");
+ Write(0xffff66, true, "* ");
+ Write(0xbebcbe, true, ". ");
+ Write(0x333333, false, ".");
+ Write(0x666666, false, ": : : ");
+ Write(0x333333, false, ".");
+ Write(0x666666, false, ": : : ");
+ Write(0x333333, false, ".");
+ Write(0x666666, false, ": : ");
+ Write(0xcccccc, false, " 6 ");
+ Write(0xffff66, false, "**\n ");
+ Write(0x666666, false, "...' : : : : : ");
+ Write(0x333333, false, ".");
+ Write(0x666666, false, " : : ");
+ Write(0x333333, false, ".");
+ Write(0x666666, false, " : ");
+ Write(0xcccccc, false, " 5 ");
+ Write(0xffff66, false, "**\n ");
+ Write(0xe3e2e0, true, ".");
+ Write(0x666666, false, " .' : ");
+ Write(0x333333, false, ".");
+ Write(0x666666, false, " : : ");
+ Write(0x333333, false, ".");
+ Write(0x666666, false, " : : : ");
+ Write(0xcccccc, false, " 4 ");
+ Write(0xffff66, false, "**\n ");
+ Write(0x666666, false, " .' .' ");
+ Write(0x333333, false, ".");
+ Write(0x666666, false, ".' .' : : : : ");
+ Write(0xcccccc, false, " 3 ");
+ Write(0xffff66, false, "**\n ");
+ Write(0x666666, false, ".....'' ");
+ Write(0x333333, false, ".");
+ Write(0x91a5bd, true, ".");
+ Write(0x666666, false, "' ");
+ Write(0x333333, false, ".");
+ Write(0x666666, false, " .' : :");
+ Write(0x333333, false, ".");
+ Write(0x666666, false, " .' : ");
+ Write(0x333333, false, ".");
+ Write(0x666666, false, " .' ");
+ Write(0xcccccc, false, " 2 ");
+ Write(0xffff66, false, "**\n ");
+ Write(0x666666, false, " ..' .' :");
+ Write(0x333333, false, ".");
+ Write(0x666666, false, " .' ");
+ Write(0x333333, false, ".");
+ Write(0x666666, false, " : .' : ");
+ Write(0xcccccc, false, " 1 ");
+ Write(0xffff66, false, "**\n \n");
+
Console.ForegroundColor = color;
Console.WriteLine();
}
- private static void Write(int rgb, bool bold, string text){
+ private static void Write(int rgb, bool bold, string text){
Console.Write($"\u001b[38;2;{(rgb>>16)&255};{(rgb>>8)&255};{rgb&255}{(bold ? ";1" : "")}m{text}");
- }
-}
\ No newline at end of file
+ }
+}
diff --git a/2019/calendar.svg b/2019/calendar.svg
index 171bad8d6..80ce35dab 100644
--- a/2019/calendar.svg
+++ b/2019/calendar.svg
@@ -1,46 +1,46 @@
-
-
-
+
+
+