Browse Source

Reflowed problems and added solutions

master
Brian Buller 4 years ago
parent
commit
2a37946673
  1. 51
      2015/day01/problem
  2. 74
      2015/day02/problem
  3. 69
      2015/day03/problem
  4. 43
      2015/day04/problem
  5. 82
      2015/day05/problem
  6. 74
      2015/day06/problem
  7. 68
      2015/day07/problem
  8. 92
      2015/day08/problem
  9. 43
      2015/day09/problem
  10. 41
      2015/day10/problem
  11. 76
      2015/day11/problem
  12. 48
      2015/day12/problem
  13. 76
      2015/day13/problem
  14. 85
      2015/day14/problem
  15. 81
      2015/day15/problem
  16. 73
      2015/day16/problem
  17. 46
      2015/day17/problem
  18. 79
      2015/day18/problem
  19. 86
      2015/day19/problem
  20. 60
      2015/day20/problem
  21. 63
      2015/day21/problem
  22. 133
      2015/day22/problem
  23. 80
      2015/day23/problem
  24. 95
      2015/day24/problem
  25. 93
      2015/day25/problem
  26. 41
      2016/day01/problem
  27. 51
      2016/day02/problem
  28. 35
      2016/day03/problem
  29. 53
      2016/day04/problem
  30. 68
      2016/day05/problem
  31. 23
      2016/day06/problem
  32. 54
      2016/day07/problem
  33. 60
      2016/day08/problem
  34. 84
      2016/day09/problem
  35. 61
      2016/day10/problem
  36. 222
      2016/day11/problem
  37. 63
      2016/day12/problem
  38. 41
      2016/day13/problem
  39. 88
      2016/day14/problem
  40. 77
      2016/day15/problem
  41. 87
      2016/day16/problem
  42. 78
      2016/day17/problem
  43. 84
      2016/day18/problem
  44. 34
      2016/day19/problem
  45. 27
      2016/day20/problem
  46. 103
      2016/day21/problem
  47. 176
      2016/day22/problem
  48. 93
      2016/day23/problem
  49. 46
      2016/day24/problem
  50. 62
      2016/day25/problem

51
2015/day01/problem

@ -1,34 +1,27 @@
Advent of Code
br0xen 40*
• [About]
• [Stats]
• [Leaderboard]
• [Settings]
• [Log out]
Advent of Code
--- 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.
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!
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!
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.
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.
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.
The apartment building is very tall, and the basement is very deep; he will
never find the top or bottom floors.
For example:
@ -44,16 +37,17 @@
--- 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.
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?
What is the position of the character that causes Santa to first enter the
basement?
Your puzzle answer was 1771.
@ -63,8 +57,6 @@
If you still want to see it, you can get your puzzle input.
You can also [Shareon Twitter Google+ Reddit] this puzzle.
References
Visible links
@ -76,6 +68,3 @@ References
. http://adventofcode.com/auth/logout
. http://adventofcode.com/
. http://adventofcode.com/day/1/input
. https://twitter.com/intent/tweet?text=I%27ve+completed+%22Not+Quite+Lisp%22+%2D+Day+1+%2D+Advent+of+Code&url=http%3A%2F%2Fadventofcode%2Ecom%2Fday%2F1&related=ericwastl&hashtags=AdventOfCode
. https://plus.google.com/share?url=http%3A%2F%2Fadventofcode%2Ecom%2Fday%2F1
. http://www.reddit.com/submit?url=http%3A%2F%2Fadventofcode%2Ecom%2Fday%2F1&title=I%27ve+completed+%22Not+Quite+Lisp%22+%2D+Day+1+%2D+Advent+of+Code

74
2015/day02/problem

@ -1,52 +1,54 @@
Advent of Code
br0xen 40*
• [About]
• [Stats]
• [Leaderboard]
• [Settings]
• [Log out]
Advent of Code
--- 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.
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), 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.
Fortunately, every present is a box (a perfect right rectangular prism),
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.
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.
• 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?
All numbers in the elves' list are in feet. How many total square feet of
wrapping paper should they order?
Your puzzle answer was 1588178.
--- 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 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.
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.
• 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?
@ -54,12 +56,11 @@
Both parts of this puzzle are complete! They provide two gold stars: **
At this point, you should return to your advent calendar and try another puzzle.
At this point, you should return to your advent calendar and try another
puzzle.
If you still want to see it, you can get your puzzle input.
You can also [Shareon Twitter Google+ Reddit] this puzzle.
References
Visible links
@ -72,6 +73,3 @@ References
. https://en.wikipedia.org/wiki/Cuboid#Rectangular_cuboid
. http://adventofcode.com/
. http://adventofcode.com/day/2/input
. https://twitter.com/intent/tweet?text=I%27ve+completed+%22I+Was+Told+There+Would+Be+No+Math%22+%2D+Day+2+%2D+Advent+of+Code&url=http%3A%2F%2Fadventofcode%2Ecom%2Fday%2F2&related=ericwastl&hashtags=AdventOfCode
. https://plus.google.com/share?url=http%3A%2F%2Fadventofcode%2Ecom%2Fday%2F2
. http://www.reddit.com/submit?url=http%3A%2F%2Fadventofcode%2Ecom%2Fday%2F2&title=I%27ve+completed+%22I+Was+Told+There+Would+Be+No+Math%22+%2D+Day+2+%2D+Advent+of+Code

69
2015/day03/problem

@ -1,64 +1,64 @@
Advent of Code
br0xen 40*
• [About]
• [Stats]
• [Leaderboard]
• [Settings]
• [Log out]
Advent of Code
--- 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.
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.
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?
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.
• > 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.
Your puzzle answer was 2572.
--- Part Two ---
The next year, to speed up the process, Santa creates a robot version of himself, Robo-Santa,
to deliver presents with him.
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.
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.
• ^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.
Your puzzle answer was 2631.
Both parts of this puzzle are complete! They provide two gold stars: **
At this point, you should return to your advent calendar and try another puzzle.
At this point, you should return to your advent calendar and try another
puzzle.
If you still want to see it, you can get your puzzle input.
You can also [Shareon Twitter Google+ Reddit] this puzzle.
References
Visible links
@ -70,6 +70,3 @@ References
. http://adventofcode.com/auth/logout
. http://adventofcode.com/
. http://adventofcode.com/day/3/input
. https://twitter.com/intent/tweet?text=I%27ve+completed+%22Perfectly+Spherical+Houses+in+a+Vacuum%22+%2D+Day+3+%2D+Advent+of+Code&url=http%3A%2F%2Fadventofcode%2Ecom%2Fday%2F3&related=ericwastl&hashtags=AdventOfCode
. https://plus.google.com/share?url=http%3A%2F%2Fadventofcode%2Ecom%2Fday%2F3
. http://www.reddit.com/submit?url=http%3A%2F%2Fadventofcode%2Ecom%2Fday%2F3&title=I%27ve+completed+%22Perfectly+Spherical+Houses+in+a+Vacuum%22+%2D+Day+3+%2D+Advent+of+Code

43
2015/day04/problem

@ -1,30 +1,25 @@
Advent of Code
br0xen 40*
• [About]
• [Stats]
• [Leaderboard]
• [Settings]
• [Log out]
Advent of Code
--- Day 4: The Ideal Stocking Stuffer ---
Santa needs help mining some AdventCoins (very similar to bitcoins) to use as gifts for all the
economically forward-thinking little girls and boys.
Santa needs help mining some AdventCoins (very similar to bitcoins) to use
as gifts for all the economically forward-thinking little girls and boys.
To do this, he needs to find MD5 hashes which, in 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.
To do this, he needs to find MD5 hashes which, in 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.
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....
• 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....
Your puzzle answer was 282749.
@ -36,12 +31,11 @@
Both parts of this puzzle are complete! They provide two gold stars: **
At this point, you should return to your advent calendar and try another puzzle.
At this point, you should return to your advent calendar and try another
puzzle.
Your puzzle input was yzbqklnj.
You can also [Shareon Twitter Google+ Reddit] this puzzle.
References
Visible links
@ -56,6 +50,3 @@ References
. https://en.wikipedia.org/wiki/MD5
. https://en.wikipedia.org/wiki/Hexadecimal
. http://adventofcode.com/
. https://twitter.com/intent/tweet?text=I%27ve+completed+%22The+Ideal+Stocking+Stuffer%22+%2D+Day+4+%2D+Advent+of+Code&url=http%3A%2F%2Fadventofcode%2Ecom%2Fday%2F4&related=ericwastl&hashtags=AdventOfCode
. https://plus.google.com/share?url=http%3A%2F%2Fadventofcode%2Ecom%2Fday%2F4
. http://www.reddit.com/submit?url=http%3A%2F%2Fadventofcode%2Ecom%2Fday%2F4&title=I%27ve+completed+%22The+Ideal+Stocking+Stuffer%22+%2D+Day+4+%2D+Advent+of+Code

82
2015/day05/problem

@ -1,33 +1,34 @@
Advent of Code
br0xen 40*
• [About]
• [Stats]
• [Leaderboard]
• [Settings]
• [Log out]
Advent of Code
--- 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.
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:
• 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.
• 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.
• 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?
@ -36,26 +37,33 @@
--- 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.
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.
• 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.
• 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?
@ -63,12 +71,11 @@
Both parts of this puzzle are complete! They provide two gold stars: **
At this point, you should return to your advent calendar and try another puzzle.
At this point, you should return to your advent calendar and try another
puzzle.
If you still want to see it, you can get your puzzle input.
You can also [Shareon Twitter Google+ Reddit] this puzzle.
References
Visible links
@ -80,6 +87,3 @@ References
. http://adventofcode.com/auth/logout
. http://adventofcode.com/
. http://adventofcode.com/day/5/input
. https://twitter.com/intent/tweet?text=I%27ve+completed+%22Doesn%27t+He+Have+Intern%2DElves+For+This%3F%22+%2D+Day+5+%2D+Advent+of+Code&url=http%3A%2F%2Fadventofcode%2Ecom%2Fday%2F5&related=ericwastl&hashtags=AdventOfCode
. https://plus.google.com/share?url=http%3A%2F%2Fadventofcode%2Ecom%2Fday%2F5
. http://www.reddit.com/submit?url=http%3A%2F%2Fadventofcode%2Ecom%2Fday%2F5&title=I%27ve+completed+%22Doesn%27t+He+Have+Intern%2DElves+For+This%3F%22+%2D+Day+5+%2D+Advent+of+Code

74
2015/day06/problem

@ -1,36 +1,33 @@
Advent of Code
br0xen 40*
• [About]
• [Stats]
• [Leaderboard]
• [Settings]
• [Log out]
Advent of Code
--- 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.
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.
Furthermore, because you've been especially nice this year, Santa has mailed
you instructions on how to display the ideal lighting configuration.
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
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.
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.
• 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?
@ -38,36 +35,40 @@
--- Part Two ---
You just finish implementing your winning light pattern when you realize you mistranslated
Santa's message from Ancient Nordic Elvish.
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 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 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 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.
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?
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.
• toggle 0,0 through 999,999 would increase the total brightness by
2000000.
Your puzzle answer was 14110788.
Both parts of this puzzle are complete! They provide two gold stars: **
At this point, you should return to your advent calendar and try another puzzle.
At this point, you should return to your advent calendar and try another
puzzle.
If you still want to see it, you can get your puzzle input.
You can also [Shareon Twitter Google+ Reddit] this puzzle.
References
Visible links
@ -79,6 +80,3 @@ References
. http://adventofcode.com/auth/logout
. http://adventofcode.com/
. http://adventofcode.com/day/6/input
. https://twitter.com/intent/tweet?text=I%27ve+completed+%22Probably+a+Fire+Hazard%22+%2D+Day+6+%2D+Advent+of+Code&url=http%3A%2F%2Fadventofcode%2Ecom%2Fday%2F6&related=ericwastl&hashtags=AdventOfCode
. https://plus.google.com/share?url=http%3A%2F%2Fadventofcode%2Ecom%2Fday%2F6
. http://www.reddit.com/submit?url=http%3A%2F%2Fadventofcode%2Ecom%2Fday%2F6&title=I%27ve+completed+%22Probably+a+Fire+Hazard%22+%2D+Day+6+%2D+Advent+of+Code

68
2015/day07/problem

@ -1,39 +1,38 @@
Advent of Code
br0xen 40*
• [About]
• [Stats]
• [Leaderboard]
• [Settings]
• [Log out]
Advent of Code
--- Day 7: Some Assembly Required ---
This year, Santa brought little Bobby Tables a set of wires and bitwise logic gates!
Unfortunately, little Bobby is a little under the recommended age range, and he needs help
assembling the circuit.
This year, Santa brought little Bobby Tables a set of wires and bitwise
logic gates! 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 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.
Each wire has an identifier (some lowercase letters) and can carry a 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.
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.
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 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 by 2 and then provided to
wire q.
• NOT e -> f means that the bitwise complement of the value from wire e is provided to wire
f.
Other possible gates include OR (bitwise OR) and RSHIFT (right-shift). If, for some reason,
you'd like to emulate the circuit instead, almost all programming languages (for example, C,
JavaScript, or Python) provide operators for these gates.
• x AND y -> z means that the bitwise 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 by 2
and then provided to wire q.
• NOT e -> f means that the bitwise complement of the value from wire e is
provided to wire f.
Other possible gates include OR (bitwise OR) and RSHIFT (right-shift). If,
for some reason, you'd like to emulate the circuit instead, almost all
programming languages (for example, C, JavaScript, or Python) provide
operators for these gates.
For example, here is a simple circuit:
@ -57,26 +56,26 @@
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?
In little Bobby's kit's instructions booklet (provided as your puzzle
input), what signal is ultimately provided to wire a?
Your puzzle answer was 16076.
--- 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?
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?
Your puzzle answer was 2797.
Both parts of this puzzle are complete! They provide two gold stars: **
At this point, you should return to your advent calendar and try another puzzle.
At this point, you should return to your advent calendar and try another
puzzle.
If you still want to see it, you can get your puzzle input.
You can also [Shareon Twitter Google+ Reddit] this puzzle.
References
Visible links
@ -98,6 +97,3 @@ References
. https://wiki.python.org/moin/BitwiseOperators
. http://adventofcode.com/
. http://adventofcode.com/day/7/input
. https://twitter.com/intent/tweet?text=I%27ve+completed+%22Some+Assembly+Required%22+%2D+Day+7+%2D+Advent+of+Code&url=http%3A%2F%2Fadventofcode%2Ecom%2Fday%2F7&related=ericwastl&hashtags=AdventOfCode
. https://plus.google.com/share?url=http%3A%2F%2Fadventofcode%2Ecom%2Fday%2F7
. http://www.reddit.com/submit?url=http%3A%2F%2Fadventofcode%2Ecom%2Fday%2F7&title=I%27ve+completed+%22Some+Assembly+Required%22+%2D+Day+7+%2D+Advent+of+Code

92
2015/day08/problem

@ -1,68 +1,73 @@
Advent of Code
br0xen 40*
• [About]
• [Stats]
• [Leaderboard]
• [Settings]
• [Log out]
Advent of Code
--- 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.
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, JavaScript, Perl, Python, and even PHP handle special characters in
very similar ways.
It is common in many programming languages to provide a way to escape
special characters in strings. For example, C, JavaScript, Perl, Python, and
even PHP handle special characters in very similar ways.
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.
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.
• "" 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).
• "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?
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.
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.
Your puzzle answer was 1350.
--- 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.
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.
• "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.
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.
Your puzzle answer was 2085.
@ -72,8 +77,6 @@
If you still want to see it, you can get your puzzle input.
You can also [Shareon Twitter Google+ Reddit] this puzzle.
References
Visible links
@ -90,6 +93,3 @@ References
. http://php.net/manual/en/language.types.string.php#language.types.string.syntax.double
. http://adventofcode.com/
. http://adventofcode.com/day/8/input
. https://twitter.com/intent/tweet?text=I%27ve+completed+%22Matchsticks%22+%2D+Day+8+%2D+Advent+of+Code&url=http%3A%2F%2Fadventofcode%2Ecom%2Fday%2F8&related=ericwastl&hashtags=AdventOfCode
. https://plus.google.com/share?url=http%3A%2F%2Fadventofcode%2Ecom%2Fday%2F8
. http://www.reddit.com/submit?url=http%3A%2F%2Fadventofcode%2Ecom%2Fday%2F8&title=I%27ve+completed+%22Matchsticks%22+%2D+Day+8+%2D+Advent+of+Code

43
2015/day09/problem

@ -1,21 +1,14 @@
Advent of Code
br0xen 40*
• [About]
• [Stats]
• [Leaderboard]
• [Settings]
• [Log out]
Advent of Code
--- 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?
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?
For example, given the following distances:
@ -32,8 +25,8 @@
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.
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?
@ -41,14 +34,14 @@
--- Part Two ---
The next year, just to show off, Santa decides to take the route with the longest distance
instead.
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.
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.
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?
@ -56,12 +49,11 @@
Both parts of this puzzle are complete! They provide two gold stars: **
At this point, you should return to your advent calendar and try another puzzle.
At this point, you should return to your advent calendar and try another
puzzle.
If you still want to see it, you can get your puzzle input.
You can also [Shareon Twitter Google+ Reddit] this puzzle.
References
Visible links
@ -73,6 +65,3 @@ References
. http://adventofcode.com/auth/logout
. http://adventofcode.com/
. http://adventofcode.com/day/9/input
. https://twitter.com/intent/tweet?text=I%27ve+completed+%22All+in+a+Single+Night%22+%2D+Day+9+%2D+Advent+of+Code&url=http%3A%2F%2Fadventofcode%2Ecom%2Fday%2F9&related=ericwastl&hashtags=AdventOfCode
. https://plus.google.com/share?url=http%3A%2F%2Fadventofcode%2Ecom%2Fday%2F9
. http://www.reddit.com/submit?url=http%3A%2F%2Fadventofcode%2Ecom%2Fday%2F9&title=I%27ve+completed+%22All+in+a+Single+Night%22+%2D+Day+9+%2D+Advent+of+Code

41
2015/day10/problem

@ -1,22 +1,16 @@
Advent of Code
br0xen 40*
• [About]
• [Stats]
• [Leaderboard]
• [Settings]
• [Log out]
Advent of Code
--- Day 10: Elves Look, Elves Say ---
Today, the Elves are playing a game called look-and-say. 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 1s).
Today, the Elves are playing a game called look-and-say. 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 1s).
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).
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).
For example:
@ -26,18 +20,18 @@
• 1211 becomes 111221 (one 1, one 2, and two 1s).
• 111221 becomes 312211 (three 1s, two 2s, and one 1).
Starting with the digits in your puzzle input, apply this process 40 times. What is the length
of the result?
Starting with the digits in your puzzle input, apply this process 40 times.
What is the length of the result?
Your puzzle answer was 360154.
--- Part Two ---
Neat, right? You might also enjoy hearing John Conway talking about this sequence (that's
Conway of Conway's Game of Life fame).
Neat, right? You might also enjoy hearing John Conway talking about this
sequence (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?
Now, starting again with the digits in your puzzle input, apply this process
50 times. What is the length of the new result?
Your puzzle answer was 5103798.
@ -47,8 +41,6 @@
Your puzzle input was 1113122113.
You can also [Shareon Twitter Google+ Reddit] this puzzle.
References
Visible links
@ -61,6 +53,3 @@ References
. https://en.wikipedia.org/wiki/Look-and-say_sequence
. https://www.youtube.com/watch?v=ea7lJkEhytA
. http://adventofcode.com/
. https://twitter.com/intent/tweet?text=I%27ve+completed+%22Elves+Look%2C+Elves+Say%22+%2D+Day+10+%2D+Advent+of+Code&url=http%3A%2F%2Fadventofcode%2Ecom%2Fday%2F10&related=ericwastl&hashtags=AdventOfCode
. https://plus.google.com/share?url=http%3A%2F%2Fadventofcode%2Ecom%2Fday%2F10
. http://www.reddit.com/submit?url=http%3A%2F%2Fadventofcode%2Ecom%2Fday%2F10&title=I%27ve+completed+%22Elves+Look%2C+Elves+Say%22+%2D+Day+10+%2D+Advent+of+Code

76
2015/day11/problem

@ -1,48 +1,52 @@
Advent of Code
br0xen 40*
• [About]
• [Stats]
• [Leaderboard]
• [Settings]
• [Log out]
Advent of Code
--- 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.
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.
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.
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:
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 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.
• 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).
• 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?
• 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?
Your puzzle answer was hepxxyzz.
@ -54,12 +58,11 @@
Both parts of this puzzle are complete! They provide two gold stars: **
At this point, you should return to your advent calendar and try another puzzle.
At this point, you should return to your advent calendar and try another
puzzle.
Your puzzle input was hepxcrrq.
You can also [Shareon Twitter Google+ Reddit] this puzzle.
References
Visible links
@ -70,6 +73,3 @@ References
. http://adventofcode.com/settings
. http://adventofcode.com/auth/logout
. http://adventofcode.com/
. https://twitter.com/intent/tweet?text=I%27ve+completed+%22Corporate+Policy%22+%2D+Day+11+%2D+Advent+of+Code&url=http%3A%2F%2Fadventofcode%2Ecom%2Fday%2F11&related=ericwastl&hashtags=AdventOfCode
. https://plus.google.com/share?url=http%3A%2F%2Fadventofcode%2Ecom%2Fday%2F11
. http://www.reddit.com/submit?url=http%3A%2F%2Fadventofcode%2Ecom%2Fday%2F11&title=I%27ve+completed+%22Corporate+Policy%22+%2D+Day+11+%2D+Advent+of+Code

48
2015/day12/problem

@ -1,27 +1,24 @@
Advent of Code
br0xen 40*
• [About]
• [Stats]
• [Leaderboard]
• [Settings]
• [Log out]
Advent of Code
--- 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.
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 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.
They have a JSON 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.
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.
@ -32,27 +29,31 @@
--- Part Two ---
Uh oh - the Accounting-Elves have realized that they double-counted everything red.
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 ([...]).
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
• [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.
Your puzzle answer was 87842.
Both parts of this puzzle are complete! They provide two gold stars: **
At this point, you should return to your advent calendar and try another puzzle.
At this point, you should return to your advent calendar and try another
puzzle.
If you still want to see it, you can get your puzzle input.
You can also [Shareon Twitter Google+ Reddit] this puzzle.
References
Visible links
@ -65,6 +66,3 @@ References
. http://json.org/
. http://adventofcode.com/
. http://adventofcode.com/day/12/input
. https://twitter.com/intent/tweet?text=I%27ve+completed+%22JSAbacusFramework%2Eio%22+%2D+Day+12+%2D+Advent+of+Code&url=http%3A%2F%2Fadventofcode%2Ecom%2Fday%2F12&related=ericwastl&hashtags=AdventOfCode
. https://plus.google.com/share?url=http%3A%2F%2Fadventofcode%2Ecom%2Fday%2F12
. http://www.reddit.com/submit?url=http%3A%2F%2Fadventofcode%2Ecom%2Fday%2F12&title=I%27ve+completed+%22JSAbacusFramework%2Eio%22+%2D+Day+12+%2D+Advent+of+Code

76
2015/day13/problem

@ -1,26 +1,20 @@
Advent of Code
br0xen 40*
• [About]
• [Stats]
• [Leaderboard]
• [Settings]
• [Log out]
Advent of Code
--- 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.
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.
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.
For example, suppose you have only four attendees planned, and you calculate their potential
happiness as follows:
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.
@ -35,13 +29,14 @@
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.
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:
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
@ -49,37 +44,37 @@
+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.
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?
What is the total change in happiness for the optimal seating arrangement of
the actual guest list?
Your puzzle answer was 733.
--- 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.
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.
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?
What is the total change in happiness for the optimal seating arrangement
that actually includes yourself?
Your puzzle answer was 725.
Both parts of this puzzle are complete! They provide two gold stars: **
At this point, you should return to your advent calendar and try another puzzle.
At this point, you should return to your advent calendar and try another
puzzle.
If you still want to see it, you can get your puzzle input.
You can also [Shareon Twitter Google+ Reddit] this puzzle.
References
Visible links
@ -91,6 +86,3 @@ References
. http://adventofcode.com/auth/logout
. http://adventofcode.com/
. http://adventofcode.com/day/13/input
. https://twitter.com/intent/tweet?text=I%27ve+completed+%22Knights+of+the+Dinner+Table%22+%2D+Day+13+%2D+Advent+of+Code&url=http%3A%2F%2Fadventofcode%2Ecom%2Fday%2F13&related=ericwastl&hashtags=AdventOfCode
. https://plus.google.com/share?url=http%3A%2F%2Fadventofcode%2Ecom%2Fday%2F13
. http://www.reddit.com/submit?url=http%3A%2F%2Fadventofcode%2Ecom%2Fday%2F13&title=I%27ve+completed+%22Knights+of+the+Dinner+Table%22+%2D+Day+13+%2D+Advent+of+Code

85
2015/day14/problem

@ -1,62 +1,62 @@
Advent of Code
br0xen 40*
• [About]
• [Stats]
• [Leaderboard]
• [Settings]
• [Log out]
Advent of Code
--- 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.
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.
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.
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.
• 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.
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).
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?
Given the descriptions of each reindeer (in your puzzle input), after
exactly 2503 seconds, what distance has the winning reindeer traveled?
Your puzzle answer was 2660.
--- Part Two ---
Seeing how reindeer move in bursts, Santa decides he's not pleased with the old scoring system.
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.
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.
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).
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?
Again given the descriptions of each reindeer (in your puzzle input), after
exactly 2503 seconds, how many points does the winning reindeer have?
Your puzzle answer was 1256.
@ -66,8 +66,6 @@
If you still want to see it, you can get your puzzle input.
You can also [Shareon Twitter Google+ Reddit] this puzzle.
References
Visible links
@ -79,6 +77,3 @@ References
. http://adventofcode.com/auth/logout
. http://adventofcode.com/
. http://adventofcode.com/day/14/input
. https://twitter.com/intent/tweet?text=I%27ve+completed+%22Reindeer+Olympics%22+%2D+Day+14+%2D+Advent+of+Code&url=http%3A%2F%2Fadventofcode%2Ecom%2Fday%2F14&related=ericwastl&hashtags=AdventOfCode
. https://plus.google.com/share?url=http%3A%2F%2Fadventofcode%2Ecom%2Fday%2F14
. http://www.reddit.com/submit?url=http%3A%2F%2Fadventofcode%2Ecom%2Fday%2F14&title=I%27ve+completed+%22Reindeer+Olympics%22+%2D+Day+14+%2D+Advent+of+Code

81
2015/day15/problem

@ -1,81 +1,81 @@
Advent of Code
br0xen 40*
• [About]
• [Stats]
• [Leaderboard]
• [Settings]
• [Log out]
Advent of Code
--- 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.
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:
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:
• 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.
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:
Butterscotch: capacity -1, durability -2, flavor 6, texture 3, calories 8
Cinnamon: capacity 2, durability 3, flavor -2, texture -1, calories 3
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:
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.
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?
Given the ingredients in your kitchen and their properties, what is the
total score of the highest-scoring cookie you can make?
Your puzzle answer was 18965440.
--- 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).
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.
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?
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?
Your puzzle answer was 15862900.
Both parts of this puzzle are complete! They provide two gold stars: **
At this point, you should return to your advent calendar and try another puzzle.
At this point, you should return to your advent calendar and try another
puzzle.
If you still want to see it, you can get your puzzle input.
You can also [Shareon Twitter Google+ Reddit] this puzzle.
References
Visible links
@ -87,6 +87,3 @@ References
. http://adventofcode.com/auth/logout
. http://adventofcode.com/
. http://adventofcode.com/day/15/input
. https://twitter.com/intent/tweet?text=I%27ve+completed+%22Science+for+Hungry+People%22+%2D+Day+15+%2D+Advent+of+Code&url=http%3A%2F%2Fadventofcode%2Ecom%2Fday%2F15&related=ericwastl&hashtags=AdventOfCode
. https://plus.google.com/share?url=http%3A%2F%2Fadventofcode%2Ecom%2Fday%2F15
. http://www.reddit.com/submit?url=http%3A%2F%2Fadventofcode%2Ecom%2Fday%2F15&title=I%27ve+completed+%22Science+for+Hungry+People%22+%2D+Day+15+%2D+Advent+of+Code

73
2015/day16/problem

@ -1,39 +1,42 @@
Advent of Code
br0xen 40*
• [About]
• [Stats]
• [Leaderboard]
• [Settings]
• [Log out]
Advent of Code
--- 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".
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".
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.
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:
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, pomeranians, akitas, and vizslas.
• Several seemingly random breeds of dog: samoyeds, pomeranians, akitas,
and vizslas.
• 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:
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:
children: 3
cats: 7
@ -46,8 +49,8 @@
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.
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?
@ -55,14 +58,16 @@
--- 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, and so the output from the machine isn't
exact values - some of them indicate ranges.
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, 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).
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?
@ -70,12 +75,11 @@
Both parts of this puzzle are complete! They provide two gold stars: **
At this point, you should return to your advent calendar and try another puzzle.
At this point, you should return to your advent calendar and try another
puzzle.
If you still want to see it, you can get your puzzle input.
You can also [Shareon Twitter Google+ Reddit] this puzzle.
References
Visible links
@ -93,6 +97,3 @@ References
. https://www.youtube.com/watch?v=RXJKdh1KZ0w
. http://adventofcode.com/
. http://adventofcode.com/day/16/input
. https://twitter.com/intent/tweet?text=I%27ve+completed+%22Aunt+Sue%22+%2D+Day+16+%2D+Advent+of+Code&url=http%3A%2F%2Fadventofcode%2Ecom%2Fday%2F16&related=ericwastl&hashtags=AdventOfCode
. https://plus.google.com/share?url=http%3A%2F%2Fadventofcode%2Ecom%2Fday%2F16
. http://www.reddit.com/submit?url=http%3A%2F%2Fadventofcode%2Ecom%2Fday%2F16&title=I%27ve+completed+%22Aunt+Sue%22+%2D+Day+16+%2D+Advent+of+Code

46
2015/day17/problem

@ -1,53 +1,46 @@
Advent of Code
br0xen 40*
• [About]
• [Stats]
• [Leaderboard]
• [Settings]
• [Log out]
Advent of Code
--- 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.
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:
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:
• 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?
Filling all containers entirely, how many different combinations of
containers can exactly fit all 150 liters of eggnog?
Your puzzle answer was 1304.
--- 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.
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.