2015 day 4, 5, 6, 7.
This commit is contained in:
parent
685f1e56d7
commit
f94e2bd831
@ -4,12 +4,17 @@ import numpy as np
|
|||||||
|
|
||||||
lines = sys.stdin.read().splitlines()
|
lines = sys.stdin.read().splitlines()
|
||||||
|
|
||||||
l, w, h = np.array([[int(c) for c in line.split("x")] for line in lines]).T
|
length, width, height = np.array(
|
||||||
|
[[int(c) for c in line.split("x")] for line in lines]
|
||||||
|
).T
|
||||||
|
|
||||||
lw, wh, hl = (l * w, w * h, h * l)
|
lw, wh, hl = (length * width, width * height, height * length)
|
||||||
|
|
||||||
answer_1 = np.sum(2 * (lw + wh + hl) + np.min(np.stack([lw, wh, hl]), axis=0))
|
answer_1 = np.sum(2 * (lw + wh + hl) + np.min(np.stack([lw, wh, hl]), axis=0))
|
||||||
print(f"answer 1 is {answer_1}")
|
print(f"answer 1 is {answer_1}")
|
||||||
|
|
||||||
answer_2 = np.sum(l * w * h + 2 * np.min(np.stack([l + w, l + h, h + w]), axis=0))
|
answer_2 = np.sum(
|
||||||
|
length * width * height
|
||||||
|
+ 2 * np.min(np.stack([length + width, length + height, height + width]), axis=0)
|
||||||
|
)
|
||||||
print(f"answer 2 is {answer_2}")
|
print(f"answer 2 is {answer_2}")
|
||||||
|
16
src/holt59/aoc/2015/day4.py
Normal file
16
src/holt59/aoc/2015/day4.py
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
import hashlib
|
||||||
|
import itertools
|
||||||
|
import sys
|
||||||
|
|
||||||
|
line = sys.stdin.read().strip()
|
||||||
|
|
||||||
|
it = iter(itertools.count(1))
|
||||||
|
answer_1 = next(
|
||||||
|
i for i in it if hashlib.md5(f"{line}{i}".encode()).hexdigest().startswith("00000")
|
||||||
|
)
|
||||||
|
print(f"answer 1 is {answer_1}")
|
||||||
|
|
||||||
|
answer_2 = next(
|
||||||
|
i for i in it if hashlib.md5(f"{line}{i}".encode()).hexdigest().startswith("000000")
|
||||||
|
)
|
||||||
|
print(f"answer 2 is {answer_2}")
|
36
src/holt59/aoc/2015/day5.py
Normal file
36
src/holt59/aoc/2015/day5.py
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
import sys
|
||||||
|
|
||||||
|
VOWELS = "aeiou"
|
||||||
|
FORBIDDEN = {"ab", "cd", "pq", "xy"}
|
||||||
|
|
||||||
|
|
||||||
|
def is_nice_1(s: str) -> bool:
|
||||||
|
if sum(c in VOWELS for c in s) < 3:
|
||||||
|
return False
|
||||||
|
|
||||||
|
if not any(a == b for a, b in zip(s[:-1:], s[1::])):
|
||||||
|
return False
|
||||||
|
|
||||||
|
if any(s.find(f) >= 0 for f in FORBIDDEN):
|
||||||
|
return False
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
def is_nice_2(s: str) -> bool:
|
||||||
|
if not any(s.find(s[i : i + 2], i + 2) >= 0 for i in range(len(s))):
|
||||||
|
return False
|
||||||
|
|
||||||
|
if not any(a == b for a, b in zip(s[:-1:], s[2::])):
|
||||||
|
return False
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
lines = sys.stdin.read().splitlines()
|
||||||
|
|
||||||
|
answer_1 = sum(map(is_nice_1, lines))
|
||||||
|
print(f"answer 1 is {answer_1}")
|
||||||
|
|
||||||
|
answer_2 = sum(map(is_nice_2, lines))
|
||||||
|
print(f"answer 2 is {answer_2}")
|
33
src/holt59/aoc/2015/day6.py
Normal file
33
src/holt59/aoc/2015/day6.py
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
import sys
|
||||||
|
from typing import Literal, cast
|
||||||
|
|
||||||
|
import numpy as np
|
||||||
|
import parse # type: ignore
|
||||||
|
|
||||||
|
lines = sys.stdin.read().splitlines()
|
||||||
|
|
||||||
|
lights_1 = np.zeros((1000, 1000), dtype=bool)
|
||||||
|
lights_2 = np.zeros((1000, 1000), dtype=int)
|
||||||
|
for line in lines:
|
||||||
|
action, sx, sy, ex, ey = cast(
|
||||||
|
tuple[Literal["turn on", "turn off", "toggle"], int, int, int, int],
|
||||||
|
parse.parse("{} {:d},{:d} through {:d},{:d}", line), # type: ignore
|
||||||
|
)
|
||||||
|
ex, ey = ex + 1, ey + 1
|
||||||
|
|
||||||
|
match action:
|
||||||
|
case "turn on":
|
||||||
|
lights_1[sx:ex, sy:ey] = True
|
||||||
|
lights_2[sx:ex, sy:ey] += 1
|
||||||
|
case "turn off":
|
||||||
|
lights_1[sx:ex, sy:ey] = False
|
||||||
|
lights_2[sx:ex, sy:ey] = np.maximum(lights_2[sx:ex, sy:ey] - 1, 0)
|
||||||
|
case "toggle":
|
||||||
|
lights_1[sx:ex, sy:ey] = ~lights_1[sx:ex, sy:ey]
|
||||||
|
lights_2[sx:ex, sy:ey] += 2
|
||||||
|
|
||||||
|
answer_1 = lights_1.sum()
|
||||||
|
print(f"answer 1 is {answer_1}")
|
||||||
|
|
||||||
|
answer_2 = lights_2.sum()
|
||||||
|
print(f"answer 2 is {answer_2}")
|
101
src/holt59/aoc/2015/day7.py
Normal file
101
src/holt59/aoc/2015/day7.py
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
import logging
|
||||||
|
import operator
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
from typing import Callable, Literal, TypeAlias, cast
|
||||||
|
|
||||||
|
VERBOSE = os.getenv("AOC_VERBOSE") == "True"
|
||||||
|
logging.basicConfig(level=logging.INFO if VERBOSE else logging.WARNING)
|
||||||
|
|
||||||
|
OPERATORS = {
|
||||||
|
"AND": operator.and_,
|
||||||
|
"OR": operator.or_,
|
||||||
|
"LSHIFT": operator.lshift,
|
||||||
|
"RSHIFT": operator.rshift,
|
||||||
|
}
|
||||||
|
|
||||||
|
ValueGetter = Callable[[dict[str, int]], int]
|
||||||
|
Signals = dict[
|
||||||
|
str,
|
||||||
|
tuple[
|
||||||
|
tuple[str, str],
|
||||||
|
tuple[ValueGetter, ValueGetter],
|
||||||
|
Callable[[int, int], int],
|
||||||
|
],
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
def zero_op(_a: int, _b: int) -> int:
|
||||||
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
def value_of(key: str) -> tuple[str, Callable[[dict[str, int]], int]]:
|
||||||
|
try:
|
||||||
|
return "", lambda _p, _v=int(key): _v
|
||||||
|
except ValueError:
|
||||||
|
return key, lambda values: values[key]
|
||||||
|
|
||||||
|
|
||||||
|
lines = sys.stdin.read().splitlines()
|
||||||
|
|
||||||
|
signals: Signals = {}
|
||||||
|
values: dict[str, int] = {"": 0}
|
||||||
|
|
||||||
|
for line in lines:
|
||||||
|
command, signal = line.split(" -> ")
|
||||||
|
|
||||||
|
if command.startswith("NOT"):
|
||||||
|
name = command.split(" ")[1]
|
||||||
|
signals[signal] = (
|
||||||
|
(name, ""),
|
||||||
|
(lambda values, _n=name: values[_n], lambda _v: 0),
|
||||||
|
lambda a, _b: ~a,
|
||||||
|
)
|
||||||
|
|
||||||
|
elif not any(command.find(name) >= 0 for name in OPERATORS):
|
||||||
|
try:
|
||||||
|
values[signal] = int(command)
|
||||||
|
except ValueError:
|
||||||
|
signals[signal] = (
|
||||||
|
(command, ""),
|
||||||
|
(lambda values, _c=command: values[_c], lambda _v: 0),
|
||||||
|
lambda a, _b: a,
|
||||||
|
)
|
||||||
|
|
||||||
|
else:
|
||||||
|
op: Callable[[int, int], int] = zero_op
|
||||||
|
lhs_s, rhs_s = "", ""
|
||||||
|
|
||||||
|
for name in OPERATORS:
|
||||||
|
if command.find(name) >= 0:
|
||||||
|
op = OPERATORS[name]
|
||||||
|
lhs_s, rhs_s = command.split(f" {name} ")
|
||||||
|
break
|
||||||
|
|
||||||
|
lhs_s, lhs_fn = value_of(lhs_s)
|
||||||
|
rhs_s, rhs_fn = value_of(rhs_s)
|
||||||
|
|
||||||
|
signals[signal] = ((lhs_s, rhs_s), (lhs_fn, rhs_fn), op)
|
||||||
|
|
||||||
|
|
||||||
|
def process(
|
||||||
|
signals: Signals,
|
||||||
|
values: dict[str, int],
|
||||||
|
) -> dict[str, int]:
|
||||||
|
while signals:
|
||||||
|
signal = next(s for s in signals if all(p in values for p in signals[s][0]))
|
||||||
|
_, deps, command = signals[signal]
|
||||||
|
values[signal] = command(deps[0](values), deps[1](values)) % 65536
|
||||||
|
del signals[signal]
|
||||||
|
|
||||||
|
return values
|
||||||
|
|
||||||
|
|
||||||
|
values_1 = process(signals.copy(), values.copy())
|
||||||
|
logging.info("\n" + "\n".join(f"{k}: {values_1[k]}" for k in sorted(values_1)))
|
||||||
|
answer_1 = values_1["a"]
|
||||||
|
print(f"answer 1 is {answer_1}")
|
||||||
|
|
||||||
|
values_2 = process(signals.copy(), values | {"b": values_1["a"]})
|
||||||
|
answer_2 = values_2["a"]
|
||||||
|
print(f"answer 2 is {answer_2}")
|
1
src/holt59/aoc/inputs/holt59/2015/day4.txt
Normal file
1
src/holt59/aoc/inputs/holt59/2015/day4.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
ckczppom
|
1000
src/holt59/aoc/inputs/holt59/2015/day5.txt
Normal file
1000
src/holt59/aoc/inputs/holt59/2015/day5.txt
Normal file
File diff suppressed because it is too large
Load Diff
300
src/holt59/aoc/inputs/holt59/2015/day6.txt
Normal file
300
src/holt59/aoc/inputs/holt59/2015/day6.txt
Normal file
@ -0,0 +1,300 @@
|
|||||||
|
turn on 489,959 through 759,964
|
||||||
|
turn off 820,516 through 871,914
|
||||||
|
turn off 427,423 through 929,502
|
||||||
|
turn on 774,14 through 977,877
|
||||||
|
turn on 410,146 through 864,337
|
||||||
|
turn on 931,331 through 939,812
|
||||||
|
turn off 756,53 through 923,339
|
||||||
|
turn off 313,787 through 545,979
|
||||||
|
turn off 12,823 through 102,934
|
||||||
|
toggle 756,965 through 812,992
|
||||||
|
turn off 743,684 through 789,958
|
||||||
|
toggle 120,314 through 745,489
|
||||||
|
toggle 692,845 through 866,994
|
||||||
|
turn off 587,176 through 850,273
|
||||||
|
turn off 674,321 through 793,388
|
||||||
|
toggle 749,672 through 973,965
|
||||||
|
turn on 943,30 through 990,907
|
||||||
|
turn on 296,50 through 729,664
|
||||||
|
turn on 212,957 through 490,987
|
||||||
|
toggle 171,31 through 688,88
|
||||||
|
turn off 991,989 through 994,998
|
||||||
|
turn off 913,943 through 958,953
|
||||||
|
turn off 278,258 through 367,386
|
||||||
|
toggle 275,796 through 493,971
|
||||||
|
turn off 70,873 through 798,923
|
||||||
|
toggle 258,985 through 663,998
|
||||||
|
turn on 601,259 through 831,486
|
||||||
|
turn off 914,94 through 941,102
|
||||||
|
turn off 558,161 through 994,647
|
||||||
|
turn on 119,662 through 760,838
|
||||||
|
toggle 378,775 through 526,852
|
||||||
|
turn off 384,670 through 674,972
|
||||||
|
turn off 249,41 through 270,936
|
||||||
|
turn on 614,742 through 769,780
|
||||||
|
turn on 427,70 through 575,441
|
||||||
|
turn on 410,478 through 985,753
|
||||||
|
turn off 619,46 through 931,342
|
||||||
|
turn on 284,55 through 768,922
|
||||||
|
turn off 40,592 through 728,685
|
||||||
|
turn on 825,291 through 956,950
|
||||||
|
turn on 147,843 through 592,909
|
||||||
|
turn off 218,675 through 972,911
|
||||||
|
toggle 249,291 through 350,960
|
||||||
|
turn off 556,80 through 967,675
|
||||||
|
toggle 609,148 through 968,279
|
||||||
|
toggle 217,605 through 961,862
|
||||||
|
toggle 407,177 through 548,910
|
||||||
|
toggle 400,936 through 599,938
|
||||||
|
turn off 721,101 through 925,455
|
||||||
|
turn on 268,631 through 735,814
|
||||||
|
toggle 549,969 through 612,991
|
||||||
|
toggle 553,268 through 689,432
|
||||||
|
turn off 817,668 through 889,897
|
||||||
|
toggle 801,544 through 858,556
|
||||||
|
toggle 615,729 through 832,951
|
||||||
|
turn off 427,477 through 958,948
|
||||||
|
turn on 164,49 through 852,946
|
||||||
|
turn on 542,449 through 774,776
|
||||||
|
turn off 923,196 through 980,446
|
||||||
|
toggle 90,310 through 718,846
|
||||||
|
turn off 657,215 through 744,252
|
||||||
|
turn off 800,239 through 811,712
|
||||||
|
turn on 502,90 through 619,760
|
||||||
|
toggle 649,512 through 862,844
|
||||||
|
turn off 334,903 through 823,935
|
||||||
|
turn off 630,233 through 839,445
|
||||||
|
turn on 713,67 through 839,865
|
||||||
|
turn on 932,50 through 982,411
|
||||||
|
turn off 480,729 through 984,910
|
||||||
|
turn on 100,219 through 796,395
|
||||||
|
turn on 758,108 through 850,950
|
||||||
|
turn off 427,276 through 439,938
|
||||||
|
turn on 178,284 through 670,536
|
||||||
|
toggle 540,27 through 625,102
|
||||||
|
turn off 906,722 through 936,948
|
||||||
|
toggle 345,418 through 859,627
|
||||||
|
toggle 175,775 through 580,781
|
||||||
|
toggle 863,28 through 929,735
|
||||||
|
turn off 824,858 through 905,973
|
||||||
|
toggle 752,312 through 863,425
|
||||||
|
turn on 985,716 through 988,852
|
||||||
|
turn off 68,504 through 763,745
|
||||||
|
toggle 76,209 through 810,720
|
||||||
|
turn off 657,607 through 676,664
|
||||||
|
toggle 596,869 through 896,921
|
||||||
|
turn off 915,411 through 968,945
|
||||||
|
turn off 368,39 through 902,986
|
||||||
|
turn on 11,549 through 393,597
|
||||||
|
turn off 842,893 through 976,911
|
||||||
|
toggle 274,106 through 581,329
|
||||||
|
toggle 406,403 through 780,950
|
||||||
|
toggle 408,988 through 500,994
|
||||||
|
toggle 217,73 through 826,951
|
||||||
|
turn on 917,872 through 961,911
|
||||||
|
toggle 394,34 through 510,572
|
||||||
|
toggle 424,603 through 583,626
|
||||||
|
toggle 106,159 through 755,738
|
||||||
|
turn off 244,610 through 472,709
|
||||||
|
turn on 350,265 through 884,690
|
||||||
|
turn on 688,184 through 928,280
|
||||||
|
toggle 279,443 through 720,797
|
||||||
|
turn off 615,493 through 888,610
|
||||||
|
toggle 118,413 through 736,632
|
||||||
|
turn on 798,782 through 829,813
|
||||||
|
turn off 250,934 through 442,972
|
||||||
|
turn on 68,503 through 400,949
|
||||||
|
toggle 297,482 through 313,871
|
||||||
|
toggle 710,3 through 839,859
|
||||||
|
turn on 125,300 through 546,888
|
||||||
|
toggle 482,39 through 584,159
|
||||||
|
turn off 536,89 through 765,962
|
||||||
|
turn on 530,518 through 843,676
|
||||||
|
turn on 994,467 through 994,676
|
||||||
|
turn on 623,628 through 744,927
|
||||||
|
toggle 704,912 through 837,983
|
||||||
|
turn on 154,364 through 517,412
|
||||||
|
toggle 344,409 through 780,524
|
||||||
|
turn off 578,740 through 725,879
|
||||||
|
turn on 251,933 through 632,957
|
||||||
|
turn on 827,705 through 971,789
|
||||||
|
toggle 191,282 through 470,929
|
||||||
|
toggle 324,525 through 446,867
|
||||||
|
toggle 534,343 through 874,971
|
||||||
|
toggle 550,650 through 633,980
|
||||||
|
toggle 837,404 through 881,915
|
||||||
|
toggle 338,881 through 845,905
|
||||||
|
turn on 469,462 through 750,696
|
||||||
|
turn on 741,703 through 892,870
|
||||||
|
turn off 570,215 through 733,562
|
||||||
|
turn on 445,576 through 870,775
|
||||||
|
turn on 466,747 through 554,878
|
||||||
|
turn off 820,453 through 868,712
|
||||||
|
turn off 892,706 through 938,792
|
||||||
|
turn off 300,238 through 894,746
|
||||||
|
turn off 306,44 through 457,444
|
||||||
|
turn off 912,569 through 967,963
|
||||||
|
toggle 109,756 through 297,867
|
||||||
|
turn on 37,546 through 41,951
|
||||||
|
turn on 321,637 through 790,910
|
||||||
|
toggle 66,50 through 579,301
|
||||||
|
toggle 933,221 through 933,791
|
||||||
|
turn on 486,676 through 878,797
|
||||||
|
turn on 417,231 through 556,317
|
||||||
|
toggle 904,468 through 981,873
|
||||||
|
turn on 417,675 through 749,712
|
||||||
|
turn on 692,371 through 821,842
|
||||||
|
toggle 324,73 through 830,543
|
||||||
|
turn on 912,490 through 977,757
|
||||||
|
turn off 634,872 through 902,949
|
||||||
|
toggle 266,779 through 870,798
|
||||||
|
turn on 772,982 through 990,996
|
||||||
|
turn off 607,46 through 798,559
|
||||||
|
turn on 295,602 through 963,987
|
||||||
|
turn on 657,86 through 944,742
|
||||||
|
turn off 334,639 through 456,821
|
||||||
|
turn off 997,667 through 997,670
|
||||||
|
turn off 725,832 through 951,945
|
||||||
|
turn off 30,120 through 952,984
|
||||||
|
turn on 860,965 through 917,976
|
||||||
|
toggle 471,997 through 840,998
|
||||||
|
turn off 319,307 through 928,504
|
||||||
|
toggle 823,631 through 940,908
|
||||||
|
toggle 969,984 through 981,993
|
||||||
|
turn off 691,319 through 865,954
|
||||||
|
toggle 911,926 through 938,929
|
||||||
|
turn on 953,937 through 968,991
|
||||||
|
toggle 914,643 through 975,840
|
||||||
|
turn on 266,982 through 436,996
|
||||||
|
turn off 101,896 through 321,932
|
||||||
|
turn off 193,852 through 751,885
|
||||||
|
turn off 576,532 through 863,684
|
||||||
|
turn on 761,456 through 940,783
|
||||||
|
turn on 20,290 through 398,933
|
||||||
|
turn off 435,335 through 644,652
|
||||||
|
turn on 830,569 through 905,770
|
||||||
|
turn off 630,517 through 905,654
|
||||||
|
turn on 664,53 through 886,976
|
||||||
|
toggle 275,416 through 408,719
|
||||||
|
turn on 370,621 through 515,793
|
||||||
|
turn on 483,373 through 654,749
|
||||||
|
turn on 656,786 through 847,928
|
||||||
|
turn off 532,752 through 945,974
|
||||||
|
toggle 301,150 through 880,792
|
||||||
|
turn off 951,488 through 958,952
|
||||||
|
turn on 207,729 through 882,828
|
||||||
|
toggle 694,532 through 973,961
|
||||||
|
toggle 676,639 through 891,802
|
||||||
|
turn off 653,6 through 905,519
|
||||||
|
toggle 391,109 through 418,312
|
||||||
|
turn on 877,423 through 957,932
|
||||||
|
turn on 340,145 through 563,522
|
||||||
|
turn off 978,467 through 988,895
|
||||||
|
turn off 396,418 through 420,885
|
||||||
|
turn off 31,308 through 816,316
|
||||||
|
turn on 107,675 through 758,824
|
||||||
|
turn on 61,82 through 789,876
|
||||||
|
turn on 750,743 through 754,760
|
||||||
|
toggle 88,733 through 736,968
|
||||||
|
turn off 754,349 through 849,897
|
||||||
|
toggle 157,50 through 975,781
|
||||||
|
turn off 230,231 through 865,842
|
||||||
|
turn off 516,317 through 630,329
|
||||||
|
turn off 697,820 through 829,903
|
||||||
|
turn on 218,250 through 271,732
|
||||||
|
toggle 56,167 through 404,431
|
||||||
|
toggle 626,891 through 680,927
|
||||||
|
toggle 370,207 through 791,514
|
||||||
|
toggle 860,74 through 949,888
|
||||||
|
turn on 416,527 through 616,541
|
||||||
|
turn off 745,449 through 786,908
|
||||||
|
turn on 485,554 through 689,689
|
||||||
|
turn on 586,62 through 693,141
|
||||||
|
toggle 506,759 through 768,829
|
||||||
|
turn on 473,109 through 929,166
|
||||||
|
turn on 760,617 through 773,789
|
||||||
|
toggle 595,683 through 618,789
|
||||||
|
turn off 210,775 through 825,972
|
||||||
|
toggle 12,426 through 179,982
|
||||||
|
turn on 774,539 through 778,786
|
||||||
|
turn on 102,498 through 121,807
|
||||||
|
turn off 706,897 through 834,965
|
||||||
|
turn off 678,529 through 824,627
|
||||||
|
turn on 7,765 through 615,870
|
||||||
|
turn off 730,872 through 974,943
|
||||||
|
turn off 595,626 through 836,711
|
||||||
|
turn off 215,424 through 841,959
|
||||||
|
toggle 341,780 through 861,813
|
||||||
|
toggle 507,503 through 568,822
|
||||||
|
turn on 252,603 through 349,655
|
||||||
|
toggle 93,521 through 154,834
|
||||||
|
turn on 565,682 through 951,954
|
||||||
|
turn on 544,318 through 703,418
|
||||||
|
toggle 756,953 through 891,964
|
||||||
|
turn on 531,123 through 856,991
|
||||||
|
turn on 148,315 through 776,559
|
||||||
|
turn off 925,835 through 963,971
|
||||||
|
turn on 895,944 through 967,964
|
||||||
|
turn off 102,527 through 650,747
|
||||||
|
toggle 626,105 through 738,720
|
||||||
|
turn off 160,75 through 384,922
|
||||||
|
toggle 813,724 through 903,941
|
||||||
|
turn on 207,107 through 982,849
|
||||||
|
toggle 750,505 through 961,697
|
||||||
|
toggle 105,410 through 885,819
|
||||||
|
turn on 226,104 through 298,283
|
||||||
|
turn off 224,604 through 508,762
|
||||||
|
turn on 477,368 through 523,506
|
||||||
|
turn off 477,901 through 627,936
|
||||||
|
turn off 887,131 through 889,670
|
||||||
|
turn on 896,994 through 938,999
|
||||||
|
toggle 401,580 through 493,728
|
||||||
|
toggle 987,184 through 991,205
|
||||||
|
turn on 821,643 through 882,674
|
||||||
|
toggle 784,940 through 968,959
|
||||||
|
turn off 251,293 through 274,632
|
||||||
|
turn off 339,840 through 341,844
|
||||||
|
turn off 675,351 through 675,836
|
||||||
|
toggle 918,857 through 944,886
|
||||||
|
toggle 70,253 through 918,736
|
||||||
|
turn off 612,604 through 772,680
|
||||||
|
turn off 277,40 through 828,348
|
||||||
|
toggle 692,139 through 698,880
|
||||||
|
toggle 124,446 through 883,453
|
||||||
|
toggle 969,932 through 990,945
|
||||||
|
toggle 855,692 through 993,693
|
||||||
|
toggle 722,472 through 887,899
|
||||||
|
toggle 978,149 through 985,442
|
||||||
|
toggle 837,540 through 916,889
|
||||||
|
turn off 612,2 through 835,82
|
||||||
|
toggle 560,767 through 878,856
|
||||||
|
turn on 461,734 through 524,991
|
||||||
|
toggle 206,824 through 976,912
|
||||||
|
turn on 826,610 through 879,892
|
||||||
|
turn on 577,699 through 956,933
|
||||||
|
turn off 9,250 through 50,529
|
||||||
|
turn off 77,657 through 817,677
|
||||||
|
turn on 68,419 through 86,426
|
||||||
|
turn on 991,720 through 992,784
|
||||||
|
turn on 668,20 through 935,470
|
||||||
|
turn off 133,418 through 613,458
|
||||||
|
turn off 487,286 through 540,328
|
||||||
|
toggle 247,874 through 840,955
|
||||||
|
toggle 301,808 through 754,970
|
||||||
|
turn off 34,194 through 578,203
|
||||||
|
turn off 451,49 through 492,921
|
||||||
|
turn on 907,256 through 912,737
|
||||||
|
turn off 479,305 through 702,587
|
||||||
|
turn on 545,583 through 732,749
|
||||||
|
toggle 11,16 through 725,868
|
||||||
|
turn on 965,343 through 986,908
|
||||||
|
turn on 674,953 through 820,965
|
||||||
|
toggle 398,147 through 504,583
|
||||||
|
turn off 778,194 through 898,298
|
||||||
|
turn on 179,140 through 350,852
|
||||||
|
turn off 241,118 through 530,832
|
||||||
|
turn off 41,447 through 932,737
|
||||||
|
turn off 820,663 through 832,982
|
||||||
|
turn on 550,460 through 964,782
|
||||||
|
turn on 31,760 through 655,892
|
||||||
|
toggle 628,958 through 811,992
|
339
src/holt59/aoc/inputs/holt59/2015/day7.txt
Normal file
339
src/holt59/aoc/inputs/holt59/2015/day7.txt
Normal file
@ -0,0 +1,339 @@
|
|||||||
|
bn RSHIFT 2 -> bo
|
||||||
|
lf RSHIFT 1 -> ly
|
||||||
|
fo RSHIFT 3 -> fq
|
||||||
|
cj OR cp -> cq
|
||||||
|
fo OR fz -> ga
|
||||||
|
t OR s -> u
|
||||||
|
lx -> a
|
||||||
|
NOT ax -> ay
|
||||||
|
he RSHIFT 2 -> hf
|
||||||
|
lf OR lq -> lr
|
||||||
|
lr AND lt -> lu
|
||||||
|
dy OR ej -> ek
|
||||||
|
1 AND cx -> cy
|
||||||
|
hb LSHIFT 1 -> hv
|
||||||
|
1 AND bh -> bi
|
||||||
|
ih AND ij -> ik
|
||||||
|
c LSHIFT 1 -> t
|
||||||
|
ea AND eb -> ed
|
||||||
|
km OR kn -> ko
|
||||||
|
NOT bw -> bx
|
||||||
|
ci OR ct -> cu
|
||||||
|
NOT p -> q
|
||||||
|
lw OR lv -> lx
|
||||||
|
NOT lo -> lp
|
||||||
|
fp OR fv -> fw
|
||||||
|
o AND q -> r
|
||||||
|
dh AND dj -> dk
|
||||||
|
ap LSHIFT 1 -> bj
|
||||||
|
bk LSHIFT 1 -> ce
|
||||||
|
NOT ii -> ij
|
||||||
|
gh OR gi -> gj
|
||||||
|
kk RSHIFT 1 -> ld
|
||||||
|
lc LSHIFT 1 -> lw
|
||||||
|
lb OR la -> lc
|
||||||
|
1 AND am -> an
|
||||||
|
gn AND gp -> gq
|
||||||
|
lf RSHIFT 3 -> lh
|
||||||
|
e OR f -> g
|
||||||
|
lg AND lm -> lo
|
||||||
|
ci RSHIFT 1 -> db
|
||||||
|
cf LSHIFT 1 -> cz
|
||||||
|
bn RSHIFT 1 -> cg
|
||||||
|
et AND fe -> fg
|
||||||
|
is OR it -> iu
|
||||||
|
kw AND ky -> kz
|
||||||
|
ck AND cl -> cn
|
||||||
|
bj OR bi -> bk
|
||||||
|
gj RSHIFT 1 -> hc
|
||||||
|
iu AND jf -> jh
|
||||||
|
NOT bs -> bt
|
||||||
|
kk OR kv -> kw
|
||||||
|
ks AND ku -> kv
|
||||||
|
hz OR ik -> il
|
||||||
|
b RSHIFT 1 -> v
|
||||||
|
iu RSHIFT 1 -> jn
|
||||||
|
fo RSHIFT 5 -> fr
|
||||||
|
be AND bg -> bh
|
||||||
|
ga AND gc -> gd
|
||||||
|
hf OR hl -> hm
|
||||||
|
ld OR le -> lf
|
||||||
|
as RSHIFT 5 -> av
|
||||||
|
fm OR fn -> fo
|
||||||
|
hm AND ho -> hp
|
||||||
|
lg OR lm -> ln
|
||||||
|
NOT kx -> ky
|
||||||
|
kk RSHIFT 3 -> km
|
||||||
|
ek AND em -> en
|
||||||
|
NOT ft -> fu
|
||||||
|
NOT jh -> ji
|
||||||
|
jn OR jo -> jp
|
||||||
|
gj AND gu -> gw
|
||||||
|
d AND j -> l
|
||||||
|
et RSHIFT 1 -> fm
|
||||||
|
jq OR jw -> jx
|
||||||
|
ep OR eo -> eq
|
||||||
|
lv LSHIFT 15 -> lz
|
||||||
|
NOT ey -> ez
|
||||||
|
jp RSHIFT 2 -> jq
|
||||||
|
eg AND ei -> ej
|
||||||
|
NOT dm -> dn
|
||||||
|
jp AND ka -> kc
|
||||||
|
as AND bd -> bf
|
||||||
|
fk OR fj -> fl
|
||||||
|
dw OR dx -> dy
|
||||||
|
lj AND ll -> lm
|
||||||
|
ec AND ee -> ef
|
||||||
|
fq AND fr -> ft
|
||||||
|
NOT kp -> kq
|
||||||
|
ki OR kj -> kk
|
||||||
|
cz OR cy -> da
|
||||||
|
as RSHIFT 3 -> au
|
||||||
|
an LSHIFT 15 -> ar
|
||||||
|
fj LSHIFT 15 -> fn
|
||||||
|
1 AND fi -> fj
|
||||||
|
he RSHIFT 1 -> hx
|
||||||
|
lf RSHIFT 2 -> lg
|
||||||
|
kf LSHIFT 15 -> kj
|
||||||
|
dz AND ef -> eh
|
||||||
|
ib OR ic -> id
|
||||||
|
lf RSHIFT 5 -> li
|
||||||
|
bp OR bq -> br
|
||||||
|
NOT gs -> gt
|
||||||
|
fo RSHIFT 1 -> gh
|
||||||
|
bz AND cb -> cc
|
||||||
|
ea OR eb -> ec
|
||||||
|
lf AND lq -> ls
|
||||||
|
NOT l -> m
|
||||||
|
hz RSHIFT 3 -> ib
|
||||||
|
NOT di -> dj
|
||||||
|
NOT lk -> ll
|
||||||
|
jp RSHIFT 3 -> jr
|
||||||
|
jp RSHIFT 5 -> js
|
||||||
|
NOT bf -> bg
|
||||||
|
s LSHIFT 15 -> w
|
||||||
|
eq LSHIFT 1 -> fk
|
||||||
|
jl OR jk -> jm
|
||||||
|
hz AND ik -> im
|
||||||
|
dz OR ef -> eg
|
||||||
|
1 AND gy -> gz
|
||||||
|
la LSHIFT 15 -> le
|
||||||
|
br AND bt -> bu
|
||||||
|
NOT cn -> co
|
||||||
|
v OR w -> x
|
||||||
|
d OR j -> k
|
||||||
|
1 AND gd -> ge
|
||||||
|
ia OR ig -> ih
|
||||||
|
NOT go -> gp
|
||||||
|
NOT ed -> ee
|
||||||
|
jq AND jw -> jy
|
||||||
|
et OR fe -> ff
|
||||||
|
aw AND ay -> az
|
||||||
|
ff AND fh -> fi
|
||||||
|
ir LSHIFT 1 -> jl
|
||||||
|
gg LSHIFT 1 -> ha
|
||||||
|
x RSHIFT 2 -> y
|
||||||
|
db OR dc -> dd
|
||||||
|
bl OR bm -> bn
|
||||||
|
ib AND ic -> ie
|
||||||
|
x RSHIFT 3 -> z
|
||||||
|
lh AND li -> lk
|
||||||
|
ce OR cd -> cf
|
||||||
|
NOT bb -> bc
|
||||||
|
hi AND hk -> hl
|
||||||
|
NOT gb -> gc
|
||||||
|
1 AND r -> s
|
||||||
|
fw AND fy -> fz
|
||||||
|
fb AND fd -> fe
|
||||||
|
1 AND en -> eo
|
||||||
|
z OR aa -> ab
|
||||||
|
bi LSHIFT 15 -> bm
|
||||||
|
hg OR hh -> hi
|
||||||
|
kh LSHIFT 1 -> lb
|
||||||
|
cg OR ch -> ci
|
||||||
|
1 AND kz -> la
|
||||||
|
gf OR ge -> gg
|
||||||
|
gj RSHIFT 2 -> gk
|
||||||
|
dd RSHIFT 2 -> de
|
||||||
|
NOT ls -> lt
|
||||||
|
lh OR li -> lj
|
||||||
|
jr OR js -> jt
|
||||||
|
au AND av -> ax
|
||||||
|
0 -> c
|
||||||
|
he AND hp -> hr
|
||||||
|
id AND if -> ig
|
||||||
|
et RSHIFT 5 -> ew
|
||||||
|
bp AND bq -> bs
|
||||||
|
e AND f -> h
|
||||||
|
ly OR lz -> ma
|
||||||
|
1 AND lu -> lv
|
||||||
|
NOT jd -> je
|
||||||
|
ha OR gz -> hb
|
||||||
|
dy RSHIFT 1 -> er
|
||||||
|
iu RSHIFT 2 -> iv
|
||||||
|
NOT hr -> hs
|
||||||
|
as RSHIFT 1 -> bl
|
||||||
|
kk RSHIFT 2 -> kl
|
||||||
|
b AND n -> p
|
||||||
|
ln AND lp -> lq
|
||||||
|
cj AND cp -> cr
|
||||||
|
dl AND dn -> do
|
||||||
|
ci RSHIFT 2 -> cj
|
||||||
|
as OR bd -> be
|
||||||
|
ge LSHIFT 15 -> gi
|
||||||
|
hz RSHIFT 5 -> ic
|
||||||
|
dv LSHIFT 1 -> ep
|
||||||
|
kl OR kr -> ks
|
||||||
|
gj OR gu -> gv
|
||||||
|
he RSHIFT 5 -> hh
|
||||||
|
NOT fg -> fh
|
||||||
|
hg AND hh -> hj
|
||||||
|
b OR n -> o
|
||||||
|
jk LSHIFT 15 -> jo
|
||||||
|
gz LSHIFT 15 -> hd
|
||||||
|
cy LSHIFT 15 -> dc
|
||||||
|
kk RSHIFT 5 -> kn
|
||||||
|
ci RSHIFT 3 -> ck
|
||||||
|
at OR az -> ba
|
||||||
|
iu RSHIFT 3 -> iw
|
||||||
|
ko AND kq -> kr
|
||||||
|
NOT eh -> ei
|
||||||
|
aq OR ar -> as
|
||||||
|
iy AND ja -> jb
|
||||||
|
dd RSHIFT 3 -> df
|
||||||
|
bn RSHIFT 3 -> bp
|
||||||
|
1 AND cc -> cd
|
||||||
|
at AND az -> bb
|
||||||
|
x OR ai -> aj
|
||||||
|
kk AND kv -> kx
|
||||||
|
ao OR an -> ap
|
||||||
|
dy RSHIFT 3 -> ea
|
||||||
|
x RSHIFT 1 -> aq
|
||||||
|
eu AND fa -> fc
|
||||||
|
kl AND kr -> kt
|
||||||
|
ia AND ig -> ii
|
||||||
|
df AND dg -> di
|
||||||
|
NOT fx -> fy
|
||||||
|
k AND m -> n
|
||||||
|
bn RSHIFT 5 -> bq
|
||||||
|
km AND kn -> kp
|
||||||
|
dt LSHIFT 15 -> dx
|
||||||
|
hz RSHIFT 2 -> ia
|
||||||
|
aj AND al -> am
|
||||||
|
cd LSHIFT 15 -> ch
|
||||||
|
hc OR hd -> he
|
||||||
|
he RSHIFT 3 -> hg
|
||||||
|
bn OR by -> bz
|
||||||
|
NOT kt -> ku
|
||||||
|
z AND aa -> ac
|
||||||
|
NOT ak -> al
|
||||||
|
cu AND cw -> cx
|
||||||
|
NOT ie -> if
|
||||||
|
dy RSHIFT 2 -> dz
|
||||||
|
ip LSHIFT 15 -> it
|
||||||
|
de OR dk -> dl
|
||||||
|
au OR av -> aw
|
||||||
|
jg AND ji -> jj
|
||||||
|
ci AND ct -> cv
|
||||||
|
dy RSHIFT 5 -> eb
|
||||||
|
hx OR hy -> hz
|
||||||
|
eu OR fa -> fb
|
||||||
|
gj RSHIFT 3 -> gl
|
||||||
|
fo AND fz -> gb
|
||||||
|
1 AND jj -> jk
|
||||||
|
jp OR ka -> kb
|
||||||
|
de AND dk -> dm
|
||||||
|
ex AND ez -> fa
|
||||||
|
df OR dg -> dh
|
||||||
|
iv OR jb -> jc
|
||||||
|
x RSHIFT 5 -> aa
|
||||||
|
NOT hj -> hk
|
||||||
|
NOT im -> in
|
||||||
|
fl LSHIFT 1 -> gf
|
||||||
|
hu LSHIFT 15 -> hy
|
||||||
|
iq OR ip -> ir
|
||||||
|
iu RSHIFT 5 -> ix
|
||||||
|
NOT fc -> fd
|
||||||
|
NOT el -> em
|
||||||
|
ck OR cl -> cm
|
||||||
|
et RSHIFT 3 -> ev
|
||||||
|
hw LSHIFT 1 -> iq
|
||||||
|
ci RSHIFT 5 -> cl
|
||||||
|
iv AND jb -> jd
|
||||||
|
dd RSHIFT 5 -> dg
|
||||||
|
as RSHIFT 2 -> at
|
||||||
|
NOT jy -> jz
|
||||||
|
af AND ah -> ai
|
||||||
|
1 AND ds -> dt
|
||||||
|
jx AND jz -> ka
|
||||||
|
da LSHIFT 1 -> du
|
||||||
|
fs AND fu -> fv
|
||||||
|
jp RSHIFT 1 -> ki
|
||||||
|
iw AND ix -> iz
|
||||||
|
iw OR ix -> iy
|
||||||
|
eo LSHIFT 15 -> es
|
||||||
|
ev AND ew -> ey
|
||||||
|
ba AND bc -> bd
|
||||||
|
fp AND fv -> fx
|
||||||
|
jc AND je -> jf
|
||||||
|
et RSHIFT 2 -> eu
|
||||||
|
kg OR kf -> kh
|
||||||
|
iu OR jf -> jg
|
||||||
|
er OR es -> et
|
||||||
|
fo RSHIFT 2 -> fp
|
||||||
|
NOT ca -> cb
|
||||||
|
bv AND bx -> by
|
||||||
|
u LSHIFT 1 -> ao
|
||||||
|
cm AND co -> cp
|
||||||
|
y OR ae -> af
|
||||||
|
bn AND by -> ca
|
||||||
|
1 AND ke -> kf
|
||||||
|
jt AND jv -> jw
|
||||||
|
fq OR fr -> fs
|
||||||
|
dy AND ej -> el
|
||||||
|
NOT kc -> kd
|
||||||
|
ev OR ew -> ex
|
||||||
|
dd OR do -> dp
|
||||||
|
NOT cv -> cw
|
||||||
|
gr AND gt -> gu
|
||||||
|
dd RSHIFT 1 -> dw
|
||||||
|
NOT gw -> gx
|
||||||
|
NOT iz -> ja
|
||||||
|
1 AND io -> ip
|
||||||
|
NOT ag -> ah
|
||||||
|
b RSHIFT 5 -> f
|
||||||
|
NOT cr -> cs
|
||||||
|
kb AND kd -> ke
|
||||||
|
jr AND js -> ju
|
||||||
|
cq AND cs -> ct
|
||||||
|
il AND in -> io
|
||||||
|
NOT ju -> jv
|
||||||
|
du OR dt -> dv
|
||||||
|
dd AND do -> dq
|
||||||
|
b RSHIFT 2 -> d
|
||||||
|
jm LSHIFT 1 -> kg
|
||||||
|
NOT dq -> dr
|
||||||
|
bo OR bu -> bv
|
||||||
|
gk OR gq -> gr
|
||||||
|
he OR hp -> hq
|
||||||
|
NOT h -> i
|
||||||
|
hf AND hl -> hn
|
||||||
|
gv AND gx -> gy
|
||||||
|
x AND ai -> ak
|
||||||
|
bo AND bu -> bw
|
||||||
|
hq AND hs -> ht
|
||||||
|
hz RSHIFT 1 -> is
|
||||||
|
gj RSHIFT 5 -> gm
|
||||||
|
g AND i -> j
|
||||||
|
gk AND gq -> gs
|
||||||
|
dp AND dr -> ds
|
||||||
|
b RSHIFT 3 -> e
|
||||||
|
gl AND gm -> go
|
||||||
|
gl OR gm -> gn
|
||||||
|
y AND ae -> ag
|
||||||
|
hv OR hu -> hw
|
||||||
|
1674 -> b
|
||||||
|
ab AND ad -> ae
|
||||||
|
NOT ac -> ad
|
||||||
|
1 AND ht -> hu
|
||||||
|
NOT hn -> ho
|
5
src/holt59/aoc/inputs/tests/2015/day5.txt
Normal file
5
src/holt59/aoc/inputs/tests/2015/day5.txt
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
ugknbfddgicrmopn
|
||||||
|
aaa
|
||||||
|
jchzalrnumimnmhp
|
||||||
|
haegwjzuvuyypxyu
|
||||||
|
dvszwmarrgswjxmb
|
3
src/holt59/aoc/inputs/tests/2015/day6.txt
Normal file
3
src/holt59/aoc/inputs/tests/2015/day6.txt
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
turn on 0,0 through 999,999
|
||||||
|
toggle 0,0 through 999,0
|
||||||
|
turn off 499,499 through 500,500
|
8
src/holt59/aoc/inputs/tests/2015/day7.txt
Normal file
8
src/holt59/aoc/inputs/tests/2015/day7.txt
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
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
|
Loading…
Reference in New Issue
Block a user