Compare commits

...

2 Commits

Author SHA1 Message Date
e1df2a6d5a updated open script 2020-12-18 09:21:16 +01:00
0af6bb9594 days 15-18 (be careful, crap 2020-12-18 09:20:55 +01:00
20 changed files with 1169 additions and 3 deletions

1
day15/data/data.txt Normal file
View File

@@ -0,0 +1 @@
2,0,1,7,4,14,18

1
day15/data/sample.txt Normal file
View File

@@ -0,0 +1 @@
0,3,6

1
day15/index.html Normal file
View File

@@ -0,0 +1 @@
404 Not Found

27
day15/markus.py Normal file
View File

@@ -0,0 +1,27 @@
from timeit import default_timer as timer
start = timer()
lines = [line.strip() for line in open("data/data.txt")]
numbers = [int(x) for x in lines[0].split(",")]
D = {}
for i, num in enumerate(numbers):
D[num] = i
t = len(numbers) - 1
previous = numbers[-1]
end1 = None
while t < 30_000_000 - 1:
if end1 is None and t == 2020 - 1:
print(previous)
end1 = timer()
t += 1
new_previous = 0 if previous not in D else t - 1 - D[previous]
D[previous] = t - 1
previous = new_previous
end2 = timer()
print(previous)
print(f'Time for part 1: {end1 - start} seconds')
print(f'Time for part 2: {end2 - start} seconds')

64
day15/module.py Normal file
View File

@@ -0,0 +1,64 @@
from aoc.input import get_input
import copy
import itertools
import time
import collections
import re
from aoc.partselector import part_one, part_two
import functools
def pw(line):
return line.strip().split(",")
def p1():
inp = get_input(pw)
nmbrs = []
for sample in inp:
print(sample)
for i in inp:
nmbrs.append(int(i))
last = inp[-1]
for i in range(len(inp), 30000000):
if last not in nmbrs or len(list(filter(lambda x: x == last, nmbrs))) == 1:
number = 0
else:
pos = len(nmbrs) - nmbrs[-2::-1].index(last) - 2
opos = len(nmbrs) - 1
number = opos - pos
print(i + 1, ":", number, number - i)
nmbrs.append(number)
last = number
return inp
def p2():
inp = get_input(pw)
nmbrs = {int(x): y + 1 for y, x in enumerate(inp[:-1])}
last = int(inp[-1])
for i in range(len(nmbrs) + 1, 30000000):
if last not in nmbrs:
nmbrs[last] = i
last = 0
else:
prev, nmbrs[last] = nmbrs[last], i
last = i - prev
print(last)
result1 = None
if part_one():
start = time.time()
result1 = p1()
print(round(1000 * (time.time() - start), 2), "ms")
if part_two():
start = time.time()
p2()
print(round(1000 * (time.time() - start), 2), "ms")

28
day15/pypy.py Normal file
View File

@@ -0,0 +1,28 @@
import copy
import itertools
import time
import collections
import re
import functools
def p2():
inp =[2,0,1,7,4,14,18]
nmbrs = {int(x): y + 1 for y, x in enumerate(inp[:-1])}
last = int(inp[-1])
for i in range(len(nmbrs) + 1, 30000000):
if last not in nmbrs:
nmbrs[last] = i
last = 0
else:
prev, nmbrs[last] = nmbrs[last], i
last = i - prev
print(last)
start = time.time()
p2()
print(round(1000 * (time.time() - start), 2), "ms")

270
day16/data/data.txt Normal file
View File

@@ -0,0 +1,270 @@
departure location: 33-430 or 456-967
departure station: 42-864 or 875-957
departure platform: 42-805 or 821-968
departure track: 34-74 or 93-967
departure date: 40-399 or 417-955
departure time: 30-774 or 797-950
arrival location: 50-487 or 507-954
arrival station: 34-693 or 718-956
arrival platform: 42-729 or 751-959
arrival track: 28-340 or 349-968
class: 49-524 or 543-951
duration: 40-372 or 397-951
price: 48-922 or 939-951
route: 33-642 or 666-960
row: 39-238 or 255-973
seat: 48-148 or 161-973
train: 50-604 or 630-971
type: 29-299 or 316-952
wagon: 45-898 or 921-966
zone: 34-188 or 212-959
your ticket:
137,173,167,139,73,67,61,179,103,113,163,71,97,101,109,59,131,127,107,53
nearby tickets:
122,945,480,667,824,475,800,224,297,602,673,513,641,524,835,981,54,184,60,721
692,125,595,331,803,765,721,249,729,162,226,523,821,137,297,588,296,299,720,318
851,112,324,163,805,544,563,372,590,228,264,590,290,491,799,677,881,573,584,476
318,471,224,717,144,113,521,320,280,234,522,833,515,514,543,630,128,221,279,65
466,234,233,845,296,757,675,841,113,135,464,732,220,575,769,693,231,187,548,756
179,471,485,215,287,334,848,153,546,473,238,675,487,56,595,484,279,366,692,858
532,422,215,370,552,577,171,757,58,686,169,830,849,52,422,128,218,630,424,419
113,466,896,241,98,552,339,561,55,564,279,757,514,825,124,842,464,668,222,358
547,888,333,370,221,20,834,100,555,339,721,860,557,477,430,635,230,467,290,840
599,166,826,588,831,129,188,669,74,820,640,876,669,825,231,163,280,282,64,474
514,565,628,543,603,801,231,483,363,371,278,564,398,720,556,473,358,673,148,757
723,881,767,799,351,674,876,695,477,124,677,267,265,565,425,462,272,284,769,266
921,573,359,52,270,641,760,895,839,352,998,293,229,116,579,181,551,567,238,726
986,255,256,123,278,598,804,270,517,774,515,632,232,220,639,329,171,465,517,846
763,596,876,799,214,229,238,96,756,771,516,543,553,354,731,185,295,518,586,135
840,137,108,516,146,523,63,22,481,74,462,472,759,474,123,329,834,825,187,262
107,252,603,161,596,824,168,371,581,674,98,290,722,521,113,456,363,136,317,356
559,68,116,319,666,358,513,70,54,565,61,173,822,838,851,726,213,271,866,161
921,892,120,833,370,216,552,275,317,331,539,231,584,183,593,821,60,161,768,284
666,352,219,890,517,939,423,92,862,179,552,828,163,668,71,463,231,138,476,98
118,642,252,480,719,845,366,106,477,337,144,844,54,511,292,372,636,338,565,474
74,420,487,832,769,922,454,358,670,832,583,349,722,338,113,171,876,148,104,604
126,118,630,119,864,858,260,183,213,762,689,515,334,862,640,3,463,635,940,487
333,233,271,323,371,722,817,234,257,281,422,399,98,821,182,882,161,797,641,327
717,364,887,179,578,325,522,683,580,99,178,134,219,106,724,688,827,892,596,520
486,224,570,876,352,677,677,637,127,63,232,459,359,548,668,996,762,462,516,633
235,105,725,922,571,179,632,176,821,884,597,65,54,693,676,23,524,765,64,683
296,464,398,464,163,577,567,856,840,634,474,519,675,685,255,435,673,277,721,258
318,261,881,99,339,590,594,803,520,764,417,335,797,399,286,716,554,594,515,122
462,565,762,668,284,469,550,723,333,836,422,334,114,690,424,533,230,774,182,571
861,228,321,476,129,332,351,474,996,642,848,551,261,831,126,287,288,323,753,264
131,328,270,164,857,54,543,462,365,237,364,592,755,334,832,861,736,238,295,108
601,275,424,237,188,856,551,216,74,223,572,876,841,572,416,889,597,543,266,892
428,339,679,457,275,471,798,319,335,821,545,72,361,273,854,641,275,535,365,576
519,603,690,54,239,174,722,365,175,826,367,581,474,262,278,99,456,329,729,421
546,942,220,640,570,473,602,261,10,514,586,512,581,569,718,275,472,474,883,850
421,634,561,238,729,487,481,172,238,728,366,465,105,761,586,141,798,719,530,805
729,137,73,295,186,141,119,100,473,407,671,797,878,427,522,184,279,232,940,137
457,215,637,118,187,991,170,275,569,942,291,769,878,761,71,285,575,826,667,763
362,319,706,476,123,474,751,148,457,946,888,65,630,179,568,480,668,585,147,862
849,889,62,366,671,356,985,684,561,939,593,827,95,470,257,798,593,883,93,164
423,457,421,514,805,318,774,111,180,756,841,596,327,572,210,547,864,276,722,487
482,721,730,762,471,546,263,569,774,350,886,763,766,266,127,457,803,255,508,320
728,831,221,464,102,557,134,96,260,845,849,944,769,858,603,480,555,841,356,455
759,363,635,328,691,824,372,766,684,761,278,104,280,17,70,548,858,369,852,831
279,98,479,724,729,474,281,321,734,102,267,860,880,326,766,331,58,843,140,187
353,672,854,358,285,558,841,789,178,264,518,922,137,331,592,639,766,892,93,288
51,213,238,804,352,760,401,100,225,350,894,765,851,165,689,62,636,725,339,269
123,112,977,297,852,823,101,264,143,859,507,169,65,328,133,221,755,270,399,774
338,766,810,359,685,634,687,94,279,584,849,366,231,480,887,365,287,640,757,67
365,19,68,358,949,284,597,461,826,187,51,51,768,586,894,841,136,604,461,52
720,834,558,298,518,474,162,278,845,771,328,212,942,220,297,259,219,645,823,939
765,121,564,852,580,557,666,921,482,175,430,488,511,886,595,761,213,363,554,216
338,681,126,580,821,68,467,401,144,524,892,801,349,128,110,846,426,319,556,550
773,532,604,65,64,271,461,292,562,97,134,173,947,598,545,102,335,233,258,669
757,364,284,57,523,877,62,803,229,318,484,7,106,56,61,518,179,559,186,61
854,469,21,370,226,124,581,889,420,515,298,563,459,522,66,631,599,563,480,508
354,139,130,146,274,94,468,94,847,633,170,895,259,218,571,162,126,717,569,118
889,74,181,860,887,229,127,841,359,724,55,256,328,324,629,553,284,127,631,72
287,74,842,99,798,522,687,205,857,823,847,60,186,425,575,486,475,683,358,166
321,584,458,770,602,851,727,349,234,599,510,234,575,635,761,579,587,280,158,106
689,767,844,113,260,263,467,674,537,64,131,268,263,217,227,139,272,943,637,168
365,279,76,577,825,281,847,258,553,73,145,846,523,176,805,136,124,517,170,895
666,424,255,601,291,719,773,640,479,792,120,586,753,182,802,458,584,291,591,107
882,824,725,135,473,215,399,602,768,322,946,1,583,583,366,338,277,878,575,268
836,63,214,183,349,337,948,510,694,336,176,839,473,275,425,686,519,54,634,590
425,949,797,639,589,218,69,729,940,719,875,102,285,167,995,351,110,398,553,260
864,101,270,256,767,551,667,692,631,473,18,831,561,840,567,173,564,514,418,140
355,753,153,862,457,671,689,756,291,298,116,168,842,297,641,349,137,339,280,264
550,322,365,226,782,721,51,514,855,545,418,143,823,372,71,562,476,232,636,372
317,123,224,299,400,424,895,131,468,276,773,575,765,880,474,467,724,115,421,687
352,879,933,100,848,681,339,292,718,894,104,51,510,67,803,860,462,329,854,596
802,631,485,552,519,115,597,359,195,583,677,220,213,291,600,943,583,128,237,548
568,603,127,727,524,320,840,281,63,104,763,639,590,327,854,51,257,5,102,676
470,635,576,805,921,144,105,545,760,519,884,418,235,226,138,596,883,806,944,426
600,856,129,723,851,773,683,577,287,97,130,419,171,568,797,226,528,844,949,320
800,726,353,213,686,479,480,428,753,243,166,231,58,270,828,883,329,323,892,855
823,176,769,358,258,265,551,469,102,62,61,603,465,477,755,941,939,263,790,167
463,123,478,604,63,889,946,272,592,851,600,58,458,294,789,946,551,464,224,863
368,357,803,282,168,863,267,164,232,358,468,588,121,136,575,57,54,63,697,145
485,134,798,270,826,832,882,109,673,266,321,295,545,564,483,483,290,451,590,944
886,430,258,603,119,419,116,226,881,526,518,137,69,892,590,165,136,181,577,141
249,220,751,551,364,234,112,835,554,949,127,238,752,278,676,59,727,265,233,477
641,554,556,857,67,771,146,120,588,853,947,429,586,517,543,576,119,483,718,496
555,464,839,511,423,325,71,234,227,113,98,601,134,604,692,580,274,11,187,474
485,588,60,172,894,51,55,118,424,65,891,295,74,428,24,336,68,566,766,63
295,136,295,566,763,295,558,458,364,128,480,118,98,826,817,63,366,360,326,578
467,592,692,596,547,635,98,723,126,594,822,584,667,350,349,309,860,763,578,668
365,96,862,896,560,417,361,566,62,64,168,241,588,121,267,335,352,365,260,170
275,803,233,397,501,423,548,676,692,112,94,828,428,364,103,579,834,58,183,799
893,100,859,57,621,222,114,828,685,555,845,720,363,457,238,272,765,98,671,169
213,803,466,863,156,334,804,771,821,568,113,836,360,289,598,172,182,71,565,691
765,595,986,219,727,365,331,424,564,886,105,352,474,726,121,879,852,593,97,875
591,470,102,197,319,62,316,94,417,464,945,229,237,229,138,223,942,568,921,288
334,350,832,830,826,860,545,147,604,326,102,322,146,598,675,929,507,295,518,118
687,74,669,832,847,555,577,491,259,890,854,185,175,186,474,586,340,357,561,898
419,830,677,884,173,358,120,357,757,317,146,681,177,322,110,772,518,56,198,839
221,469,352,771,527,467,420,844,512,566,512,553,226,177,180,887,758,589,73,97
522,201,846,326,371,428,293,850,283,269,148,894,894,220,947,227,921,98,129,512
559,66,529,148,458,478,116,551,804,56,170,768,371,134,883,121,798,672,827,766
520,680,72,60,456,476,822,799,71,161,882,508,636,688,188,71,353,267,244,693
135,168,175,805,751,515,427,802,859,171,277,571,835,742,338,886,97,674,895,512
633,838,360,457,547,761,942,457,67,871,590,117,599,557,798,876,678,673,329,421
462,331,755,898,679,324,171,884,588,290,792,299,188,895,891,256,222,256,887,257
51,182,329,846,758,259,794,577,641,858,630,356,424,636,146,224,262,822,261,851
256,828,108,360,827,361,504,949,257,425,948,770,856,890,111,369,846,850,463,360
690,483,480,797,323,755,278,463,856,203,271,351,285,172,318,862,829,221,71,513
639,802,123,897,762,762,137,799,586,604,839,679,229,174,73,748,188,330,363,338
855,579,232,335,438,884,690,273,799,674,584,470,289,334,690,171,944,640,476,261
669,350,414,418,482,163,287,756,544,559,855,113,835,600,801,236,947,430,463,857
878,262,719,331,361,135,182,61,144,337,881,594,479,255,555,897,488,683,519,668
272,229,464,782,797,468,767,167,864,885,826,462,324,128,317,325,126,230,898,109
512,946,667,417,316,637,73,555,884,172,165,458,771,485,982,216,890,273,575,768
890,137,290,466,865,218,281,292,638,875,949,603,678,225,257,686,352,879,96,834
60,325,860,216,948,276,482,809,120,834,230,223,827,861,57,939,423,361,484,147
274,516,360,599,320,177,764,767,507,885,177,100,514,589,468,662,876,553,365,763
565,680,594,832,463,107,863,170,231,101,71,939,978,67,53,175,682,161,65,861
147,766,941,351,892,842,280,162,555,358,699,851,590,921,687,334,294,297,273,98
296,52,877,294,586,354,60,69,804,319,427,862,510,601,297,846,111,761,848,189
552,555,298,840,324,589,472,805,635,51,759,940,826,329,867,689,68,805,876,283
834,597,852,675,50,825,474,572,473,723,478,594,226,857,236,325,169,495,108,679
66,944,878,146,74,112,761,585,466,589,548,805,515,569,353,462,883,745,765,59
797,894,101,884,296,840,214,172,172,878,51,683,839,466,97,381,69,293,544,281
65,120,559,839,470,175,363,724,283,773,691,898,182,481,707,858,290,554,214,97
756,888,762,897,56,521,172,862,603,487,357,862,274,128,721,774,168,159,724,597
217,463,722,845,462,68,198,510,226,175,581,118,753,103,760,556,351,229,275,456
364,723,766,359,147,287,264,425,358,93,821,578,753,371,667,133,475,486,813,130
428,771,561,845,944,224,323,54,173,507,423,147,163,603,184,793,765,368,564,364
515,948,130,186,727,939,366,174,214,282,726,760,945,99,878,55,553,683,949,982
633,577,827,263,885,100,826,397,483,639,758,728,473,480,587,232,428,204,848,293
64,756,60,738,277,679,862,856,685,133,429,424,858,177,222,229,290,276,667,601
129,515,420,294,853,636,676,236,338,361,727,691,176,583,566,188,692,83,590,558
475,825,421,797,762,669,766,922,461,318,262,631,768,224,123,245,107,290,849,880
877,720,468,480,14,481,290,349,828,219,175,635,675,674,948,672,113,271,55,456
564,601,481,560,361,798,641,236,846,164,943,769,669,143,506,99,634,554,427,844
947,596,825,843,941,422,638,554,222,839,318,59,517,148,398,861,463,362,326,996
288,128,225,829,235,827,672,184,284,824,720,285,890,465,825,726,838,562,399,406
939,726,371,298,897,773,137,73,287,227,147,266,350,770,632,757,583,557,312,720
723,669,257,328,352,471,117,285,369,273,465,884,469,326,93,168,97,408,635,170
633,672,789,760,333,124,669,726,69,399,725,878,554,281,834,275,561,255,944,332
228,271,301,677,946,823,327,577,684,320,547,893,567,834,261,117,333,222,947,333
998,335,165,946,218,122,478,591,279,263,593,678,756,225,857,563,457,565,666,773
884,227,201,894,481,637,633,641,798,463,543,281,641,316,425,922,570,462,471,888
514,579,563,131,680,113,285,268,828,515,56,215,130,666,888,106,216,867,217,483
475,71,510,464,352,858,528,825,349,484,804,727,549,483,106,484,70,334,294,456
17,521,840,458,766,945,232,185,291,298,761,755,267,544,679,521,213,888,803,850
559,65,877,724,357,122,768,855,124,889,720,332,53,860,225,217,135,320,497,228
562,181,270,799,715,896,840,128,120,470,135,370,299,945,589,668,221,233,119,226
582,721,123,603,119,580,280,421,633,228,508,564,675,668,163,70,524,930,125,823
559,603,184,879,421,255,238,574,557,492,461,116,255,117,473,117,944,545,729,369
228,895,691,894,330,637,586,274,231,742,274,508,480,366,886,339,580,851,331,178
766,220,431,69,886,484,691,588,133,355,280,773,561,847,590,281,176,138,363,771
633,281,97,881,740,633,483,554,323,803,507,288,767,143,115,571,186,327,521,224
759,138,212,829,481,129,699,102,237,922,524,357,549,947,840,108,369,797,754,235
427,858,257,811,823,898,73,476,332,888,398,363,290,112,298,476,263,898,685,284
505,803,296,258,889,322,69,337,425,468,418,274,322,486,107,289,545,397,177,132
559,586,560,840,203,281,297,639,544,165,475,949,139,558,63,891,581,52,95,886
851,715,140,220,854,835,482,555,370,726,797,296,62,798,140,422,511,426,338,113
878,592,801,331,573,118,600,585,567,94,13,922,601,97,546,800,285,471,722,558
329,372,826,423,66,117,102,949,241,367,120,636,688,267,277,597,692,169,520,558
233,558,559,364,225,429,105,266,361,773,688,589,147,73,137,856,547,771,467,529
763,361,275,949,592,896,225,743,755,567,139,604,668,184,802,879,107,461,585,683
563,423,595,268,286,173,484,363,169,224,68,570,422,584,718,500,507,558,678,217
895,574,428,424,119,861,360,689,280,670,298,684,875,140,69,806,590,603,583,941
883,850,496,484,122,318,109,136,834,363,101,334,366,226,822,270,218,851,231,292
398,472,549,329,724,887,831,609,801,828,212,516,424,841,221,881,875,319,133,858
573,316,106,685,644,548,633,751,550,507,553,227,139,573,351,147,579,587,145,797
359,279,106,833,296,423,164,562,882,181,246,418,284,850,175,878,213,684,186,236
729,802,426,822,420,600,14,469,142,186,93,321,726,727,182,182,126,64,829,358
290,833,399,540,423,599,513,830,863,829,844,686,278,561,372,859,168,801,50,64
856,636,257,546,560,267,129,981,515,470,887,691,886,358,683,72,837,576,217,898
833,97,594,220,827,477,591,332,762,186,755,356,183,522,581,876,826,61,410,213
418,551,321,1,883,640,570,632,673,481,119,859,364,169,686,485,226,641,55,467
70,721,799,767,564,898,429,802,68,323,196,557,583,353,324,773,894,580,174,50
182,127,71,719,638,885,358,849,725,834,508,586,337,799,984,277,176,881,99,799
185,354,329,66,635,842,568,362,804,234,278,979,886,72,845,591,483,282,226,281
733,128,878,99,821,522,836,284,282,320,758,290,456,485,893,295,690,674,671,277
475,109,212,499,282,896,475,875,285,486,758,356,138,546,939,220,524,842,362,362
589,370,6,119,256,112,579,363,520,117,761,328,164,565,470,121,360,722,99,265
944,339,215,889,893,364,835,100,756,418,234,147,270,600,224,472,522,276,835,241
586,847,463,124,851,363,670,232,357,143,168,337,945,356,424,109,69,147,655,836
823,759,523,981,581,188,830,636,600,480,567,945,173,139,95,475,670,71,458,945
683,105,222,471,757,426,293,334,133,510,753,827,898,693,600,187,598,514,477,708
167,666,514,215,727,214,64,547,891,860,595,420,560,262,247,180,855,146,284,429
864,285,430,291,599,588,291,275,101,449,418,896,885,275,521,476,219,474,50,601
761,576,549,57,576,316,861,226,683,636,402,520,759,100,136,849,830,841,521,146
753,744,138,800,355,143,55,137,212,669,922,947,593,426,318,102,587,95,549,53
471,58,10,318,256,336,460,681,175,755,288,762,148,371,70,587,757,487,212,333
547,281,296,475,834,756,544,718,890,353,68,419,327,564,729,944,584,137,930,53
512,213,840,798,729,557,878,671,856,841,488,549,279,130,464,877,602,349,837,419
726,178,976,327,573,257,103,554,774,671,114,330,323,581,359,372,362,833,365,371
682,232,261,65,763,292,148,107,574,270,638,674,757,719,339,159,109,641,353,173
602,259,420,641,820,762,96,68,475,460,825,679,547,128,420,74,666,835,556,477
351,720,580,333,851,861,108,842,689,601,684,600,234,638,528,922,474,729,213,175
511,69,430,562,686,854,252,128,295,285,424,478,857,798,180,729,329,585,766,772
368,581,726,468,677,482,874,765,218,468,67,637,570,471,284,834,834,862,726,477
487,765,167,60,64,420,356,328,475,336,130,471,842,545,232,341,101,59,889,275
802,363,666,940,799,109,429,226,165,266,370,175,680,826,272,551,690,849,613,852
725,144,662,568,168,557,512,594,340,580,166,171,418,257,841,69,70,107,463,591
53,764,523,478,685,327,264,876,633,79,340,888,109,543,832,162,771,179,368,479
576,172,939,102,268,835,802,355,559,581,339,418,825,236,583,5,949,299,318,55
468,545,519,339,758,577,734,365,563,563,364,637,893,459,282,856,689,164,461,639
947,132,169,855,363,855,105,171,463,689,463,1,842,473,120,428,479,221,830,335
174,558,423,689,633,679,601,431,281,163,271,164,824,399,838,692,362,231,469,65
550,101,125,417,604,328,603,145,883,9,326,278,470,93,324,109,116,678,133,825
798,754,487,757,852,214,578,863,885,562,171,751,117,127,985,690,148,107,289,805
564,427,115,590,349,582,672,844,561,263,264,267,496,889,326,280,521,835,821,184
685,237,397,514,843,285,638,116,553,860,290,892,670,843,264,850,55,471,449,478
173,855,765,221,99,566,839,681,853,562,573,993,425,428,728,259,692,424,283,690
844,461,358,447,557,848,426,171,275,948,146,119,326,183,842,760,680,361,472,554
227,508,554,549,461,129,546,524,320,226,95,552,353,800,511,192,337,258,939,339
676,135,462,259,948,324,673,867,173,286,566,804,773,134,420,61,165,96,462,886
276,640,868,631,171,368,473,719,517,831,681,679,106,518,214,941,277,875,883,758
754,165,982,673,849,61,335,894,680,165,169,139,602,228,185,466,550,428,850,857
125,268,521,265,884,278,115,825,591,50,860,469,509,831,863,132,889,554,345,727
679,725,112,473,479,634,515,127,467,174,740,758,853,73,226,561,283,753,487,851
564,124,684,340,326,880,858,353,692,233,674,674,236,174,435,679,552,117,168,337
522,52,280,552,948,351,269,118,587,636,163,722,353,269,110,79,97,294,329,289
594,500,689,95,862,693,468,121,114,108,100,574,692,826,559,167,831,220,523,589
169,220,181,178,563,847,853,682,276,161,524,65,398,186,895,850,136,757,597,989
63,555,833,411,477,74,481,74,95,846,295,321,755,350,360,571,941,113,107,340
327,876,881,52,672,53,840,419,237,641,631,571,97,940,132,634,265,669,755,738
875,851,642,843,562,765,320,288,754,774,161,641,216,215,288,624,690,805,596,141
765,126,326,572,679,265,772,330,229,666,440,804,105,921,516,169,827,884,939,134
234,858,587,99,549,51,282,847,362,712,101,567,521,882,677,231,591,769,684,630
372,413,365,179,672,570,759,63,545,485,71,860,350,138,638,141,562,892,829,549
354,863,284,174,330,269,829,124,140,111,945,832,522,671,421,134,635,618,107,322
128,805,331,682,349,427,821,634,362,678,592,518,845,805,176,400,850,688,363,324
264,146,60,429,638,888,293,112,487,577,320,339,667,886,83,177,177,140,226,232
857,456,825,116,279,766,693,162,637,69,549,754,165,143,836,591,227,778,519,595
142,520,370,939,225,397,60,515,172,584,188,487,890,799,770,597,678,123,77,238
263,418,513,718,280,996,67,266,418,183,147,145,592,765,753,457,397,362,339,884
946,943,726,187,134,466,578,359,693,185,360,827,589,223,349,523,233,18,685,54
180,832,7,58,637,367,214,475,161,630,850,837,72,261,596,420,840,132,478,294
946,334,366,291,486,832,107,719,506,123,691,110,102,220,550,97,483,356,693,95
821,668,145,728,836,947,515,675,24,550,512,132,259,679,571,232,630,285,103,131
721,939,419,187,766,337,470,530,233,727,62,546,265,726,64,603,104,881,637,480
461,672,297,640,686,549,58,569,142,593,851,487,544,861,426,161,562,243,275,368
756,162,58,220,827,136,123,457,520,675,590,175,217,227,756,257,0,687,760,65
771,515,100,879,584,107,148,765,839,267,293,360,284,465,582,356,340,56,740,862
562,398,557,466,833,688,291,632,354,183,757,476,834,845,583,93,249,521,804,875
277,582,224,563,263,421,129,670,598,945,340,366,675,839,336,873,143,258,892,286
543,399,67,398,636,861,101,547,127,127,994,325,285,257,943,273,270,722,429,581
671,836,668,824,90,171,94,681,485,862,429,215,231,565,462,580,366,881,276,185
753,278,362,231,19,337,881,94,212,563,371,320,853,229,235,686,219,426,802,366

0
day16/data/sample.txt Normal file
View File

1
day16/index.html Normal file
View File

@@ -0,0 +1 @@
404 Not Found

125
day16/module.py Normal file
View File

@@ -0,0 +1,125 @@
from aoc.input import get_input
import copy
import itertools
import time
import collections
import re
from aoc.partselector import part_one, part_two
import functools
def pw(line):
return line.strip()
def p1():
inp = get_input(pw)
rules_tmp = [x.split(': ') for x in inp[0:20]]
my = inp[22].split(',')
nearby = [list(map(int, x.split(','))) for x in inp[25:]]
rules = {}
for r in rules_tmp:
rules[r[0]] = list(map(lambda x: list(map(int, x.split('-'))), r[1].split(' or ')))
print(rules)
count = 0
for n in nearby:
valid = True
for field in n:
fvalid = []
for r in rules.values():
tvalid = []
for rr in r:
tvalid.append(field > rr[0] and field < rr[1])
fvalid.append(any(tvalid))
if not any(fvalid):
count += field
pass
print(count)
return inp
def p2():
inp = get_input(pw)
rules_tmp = [x.split(': ') for x in inp[0:20]]
my = list(map(int, inp[22].split(',')))
nearby = [list(map(int, x.split(','))) for x in inp[25:]]
rules = {}
for r in rules_tmp:
rules[r[0]] = list(map(lambda x: list(map(int, x.split('-'))), r[1].split(' or ')))
print(rules)
count = 0
vtickets = []
print(len(nearby))
for n in nearby:
valid = []
for field in n:
fvalid = []
for r in rules.values():
tvalid = []
for rr in r:
tvalid.append(field >= rr[0] and field <= rr[1])
fvalid.append(any(tvalid))
valid.append(any(fvalid))
if all(valid):
vtickets.append(n)
print(len(vtickets))
print(my)
vtickets.append(my)
fields = collections.defaultdict(list)
for name, r in rules.items():
for i in range(len(my)):
rvalid = []
for n in vtickets:
field = n[i]
tvalid = []
for rr in r:
tvalid.append(field >= rr[0] and field <= rr[1])
rvalid.append(any(tvalid))
if all(rvalid):
fields[i].append(name)
print(i, name)
newfields = copy.copy(fields)
print('------')
realfields = {}
for i in range(len(fields)):
i, f = sorted(newfields.items(), key=lambda x: len(x[1]), reverse=False)[0]
v = f[0]
del newfields[i]
realfields[i] = v
for i2, f2 in fields.items():
if v in f2:
f2.remove(v)
fields[i2] = f2
value = 1
for i, v in realfields.items():
if v.startswith('departure'):
value *= my[i]
print(value)
return 0
if part_one():
start = time.time()
result1 = p1()
print(round(1000*(time.time() - start), 2), 'ms')
if part_two():
start = time.time()
p2()
print(round(1000*(time.time() - start), 2), 'ms')

8
day17/data/data.txt Normal file
View File

@@ -0,0 +1,8 @@
#...#.#.
..#.#.##
..#..#..
.....###
...#.#.#
#.#.##..
#####...
.#.#.##.

3
day17/data/sample.txt Normal file
View File

@@ -0,0 +1,3 @@
.#.
..#
###

1
day17/index.html Normal file
View File

@@ -0,0 +1 @@
404 Not Found

129
day17/module.py Normal file
View File

@@ -0,0 +1,129 @@
from aoc.input import get_input
import copy
import itertools
import time
import collections
import re
from aoc.partselector import part_one, part_two
import functools
def pw(line):
return line.strip()
def p1():
inp = get_input(pw)
cube = {}
print(inp)
ymin = 0
xmin = 0
zmin = 0
ymax = len(inp)-1
xmax = len(inp[0]) - 1
zmax = 0
for y, sample in enumerate(inp):
z = 0
for x, v in enumerate(sample):
if v == '#':
cube[(x, y, z)] = v
arround = [(x,y,z) for x in range(-1, 2) for y in range(-1, 2) for z in range(-1, 2)]
for _ in range(6):
newcube = {}
for zi in range(zmin-1, zmax+2):
for yi in range(ymin-1, ymax+2):
for xi in range(xmin-1, xmax+2):
count = 0
for xo, yo, zo in arround:
if xo == 0 and yo == 0 and zo == 0:
continue
if (xi+xo, yi+yo, zi+zo) in cube:
#print((xi+xo, yi+yo, zi+zo), '#')
count += 1
#print((xi, yi, zi), count)
if (xi, yi, zi) in cube:
if count in [2,3]:
newcube[(xi, yi, zi)] = '#'
else:
if count == 3:
newcube[(xi, yi, zi)] = '#'
zmin -= 1
zmax += 1
ymin -= 1
ymax += 1
xmin -= 1
xmax += 1
cube = copy.copy(newcube)
print(len(cube))
print(len(cube))
return inp
def p2():
inp = get_input(pw)
plane = inp
cube = set()
print(inp)
ymin = 0
xmin = 0
zmin = 0
ymax = len(inp)-1
xmax = len(inp[0]) - 1
zmax = 0
wmax = 0
wmin = 0
for y, sample in enumerate(inp):
z = 0
for x, v in enumerate(sample):
if v == '#':
cube.add((x, y, z, 0))
arround = [(x,y,z, w) for x in range(-1, 2) for y in range(-1, 2) for z in range(-1, 2) for w in range(-1, 2)]
for _ in range(6):
newcube = set()
for wi in range(wmin-1, wmax+2):
for zi in range(zmin-1, zmax+2):
for yi in range(ymin-1, ymax+2):
for xi in range(xmin-1, xmax+2):
count = 0
for xo, yo, zo, wo in arround:
if xo == 0 and yo == 0 and zo == 0 and wo == 0:
continue
if (xi+xo, yi+yo, zi+zo, wi+wo) in cube:
#print((xi+xo, yi+yo, zi+zo), '#')
count += 1
#print((xi, yi, zi), count)
if (xi, yi, zi, wi) in cube:
if count in [2,3]:
newcube.add((xi, yi, zi, wi))
else:
if count == 3:
newcube.add((xi, yi, zi, wi))
wmin -= 1
wmax += 1
zmin -= 1
zmax += 1
ymin -= 1
ymax += 1
xmin -= 1
xmax += 1
cube = copy.copy(newcube)
print(len(cube))
print(len(cube))
return inp
return 0
result1 = None
if part_one():
start = time.time()
result1 = p1()
print(round(1000*(time.time() - start), 2), 'ms')
if part_two():
start = time.time()
p2()
print(round(1000*(time.time() - start), 2), 'ms')

373
day18/data/data.txt Normal file
View File

@@ -0,0 +1,373 @@
3 + 8
7 * (7 * 6 + 7 * 5 + (9 + 2 * 2 * 4)) + 7 * 3 * 5
3 * 4 + 2 + 7 + (4 * (9 + 9 + 2 + 3 * 8) + 9 + (6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 + 7 * 4) * 4 + 2 + 9 + 8 + 6) * 6
(6 * 2 * 5 + 4 + 5) + (8 + (8 * 5 + 7 * 7 + 6 * 2) * 6 + 6) + 4 * 8
(5 + 6 * 2) * 5 * 6 * (5 * 5) + 9
(7 + (9 * 4)) * ((4 + 3 + 5) + 7 * 5)
2 * 5 + ((9 * 6 * 3 * 6 + 4) * 9 * 4) * 2 * 3 * (8 + 6)
3 * 6 * 5 + 9 * (6 + 4 * 2 + 5 * 6)
((7 + 8) + 3 + 7 + (8 * 3 * 6 + 8) * 2) * ((3 * 5 * 9) + 5) * 8 + 8
((3 * 4 + 5 + 2) + 6 * 6) * 9
4 + 6 * (9 * 6 * 7 + (2 * 5 + 5 * 9 + 6)) * 8
4 * (2 + 2 + 9) + 5 + 5 * ((5 + 3) + 4 * 7)
6 + 8 * 3 + 4
2 + 8 + (8 + (7 + 5 * 3 * 8 * 7 + 2) * 6) + 3

5
day18/data/sample.txt Normal file
View File

@@ -0,0 +1,5 @@
1 + (2 * 3) + (4 * (5 + 6))
2 * 3 + (4 * 5)
5 + (8 * 3 + 9 + 3 * 4 * 3)
5 * 9 * (7 * 3 * 3 + 9 * 3 + (8 + 6 * 4))
((2 + 4 * 9) * (6 + 9 * 8 + 6) + 6) + 2 + 4 * 2

1
day18/index.html Normal file
View File

@@ -0,0 +1 @@
404 Not Found

91
day18/module.py Normal file
View File

@@ -0,0 +1,91 @@
from aoc.input import get_input
import copy
import itertools
import time
import collections
import re
from aoc.partselector import part_one, part_two
import functools
def pw(line):
return line.strip()
def p1():
inp = get_input(pw)
rr = []
for sample in inp:
stack = []
operand = ''
operator = ''
print(sample)
for i in sample[0:]:
if i == ' ':
continue
if i in list(map(str, range(10))):
operand = i
if operator == '':
res = int(operand)
elif operator == '+':
res += int(operand)
elif operator == '*':
res *= int(operand)
if i == '(':
stack.append((res, operator, '('))
operator = ''
res = 0
elif i == ')':
brace = ''
while brace != '(':
value, operator, brace = stack.pop()
if operator == '':
if value != 0:
res = value
elif operator == '+':
res += value
elif operator == '*':
res *= value
else:
operator = i
if operator == '*':
stack.append((res, operator, ''))
operator = ''
res = 0
print(i, res, stack)
while(len(stack)>0):
print(res, stack)
value, operator, brace = stack.pop()
if operator == '':
if value != 0:
res = value
elif operator == '+':
res += value
elif operator == '*':
res *= value
print(res)
rr.append(res)
res = 0
print(sum(rr))
return inp
def p2():
inp = get_input(pw)
print(len(inp))
return 0
result1 = None
if part_one():
start = time.time()
result1 = p1()
print(round(1000*(time.time() - start), 2), 'ms')
if part_two():
start = time.time()
p2()
print(round(1000*(time.time() - start), 2), 'ms')

36
module.py Normal file
View File

@@ -0,0 +1,36 @@
from aoc.input import get_input
import copy
import itertools
import time
import collections
import re
from aoc.partselector import part_one, part_two
import functools
def pw(line):
return line.strip()
def p1():
inp = get_input(pw)
for sample in inp:
print(sample)
return inp
def p2(segments):
print(len(segments))
return 0
result1 = None
if part_one():
start = time.time()
result1 = p1()
print(round(1000*(time.time() - start), 2), 'ms')
if part_two():
start = time.time()
p2(result1)
print(round(1000*(time.time() - start), 2), 'ms')

View File

@@ -15,12 +15,13 @@ if [ $time -gt 6 ]; then
fi
target_epoch=$(date -j "12${day0}06002020.00" +%s)
echo "Sleep for $target_epoch - $current_epoch "
sleep_seconds=$(( $target_epoch - $current_epoch ))
sleep_seconds=$(( $target_epoch - $current_epoch +1))
echo "Sleep for $sleep_seconds"
sleep $sleep_seconds
day=$(date +'%-d')
day0=$(date +'%d')
curl -b cookies.txt https://adventofcode.com/2020/day/$day/input -o day$day0/data/data.txt
curl -b cookies.txt https://adventofcode.com/2020/day/$day -o day$day0/index.html
curl -b cookies.txt https://adventofcode.com/2020/day/$day/ -o day$day0/index.html
cat day$day0/data/data.txt