This commit is contained in:
Michael Zhang 2022-05-09 11:58:15 -05:00
parent 934917a7b3
commit 8f265f4169
Signed by: michael
GPG key ID: BDA47A31A3C8EE6B
33 changed files with 10314 additions and 0 deletions

1
aoc2020/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/p15

16
aoc2020/1.py Normal file
View file

@ -0,0 +1,16 @@
#!/bin/bash
data = []
with open("1.txt") as f:
for line in f:
data.append(int(line))
for i in data:
for j in data:
if i != j and i + j == 2020:
print(i * j)
for i in range(len(data)):
for j in range(i, len(data)):
for k in range(j, len(data)):
if data[i] + data[j] + data[k] == 2020:
print(data[i] * data[j] * data[k])

200
aoc2020/1.txt Normal file
View file

@ -0,0 +1,200 @@
1934
1702
1571
1737
1977
1531
1428
1695
1794
1101
13
1164
1235
1289
1736
1814
1363
1147
1111
1431
1765
1515
1184
1036
1803
1791
1638
1809
1283
1980
1854
1878
1574
1352
1151
730
1581
1990
1919
2003
1538
1663
1735
1772
1830
1152
1022
1774
1544
1551
1835
1383
1614
1396
1715
1530
295
1208
1978
1104
1691
1176
1183
1909
1192
1535
1924
1268
1969
1954
1760
1077
1734
1371
1676
1933
1400
1928
1982
1541
1106
1248
1346
1782
1142
1849
1798
1362
1379
1886
1265
1226
1751
1575
1027
1710
1601
1205
1922
1452
1206
1263
2000
1957
1951
1834
1533
1149
1245
1564
1182
1237
1013
1254
1895
1504
1480
1556
1821
1589
1864
1573
1698
1927
1434
516
1722
1360
1940
1212
1329
1675
1812
1917
1302
1604
1336
1233
1405
1179
1169
1081
1941
1553
1236
1824
1923
1938
1475
1446
1545
1853
1664
317
1489
1884
1743
1621
1128
1474
1505
394
1387
1509
1627
1914
1913
1949
1843
1847
1882
1486
1082
1802
1645
1690
1629
1377
2004
1044
1191
1014
1857
1813
1572
1055
1002
1721
1273
1417
1968
1888
1863
1278
1141
1964
1259
1823
1181
1779

46
aoc2020/14.hs Normal file
View file

@ -0,0 +1,46 @@
import Data.Bits
import Data.Int
import Data.List
import Debug.Trace
import Data.List.Split
import Data.Maybe
import qualified Data.Map.Strict as Map
type State = (Int64, [Int], Map.Map Int64 Int64)
parseMask :: (Int64, [Int]) -> (Int, Char) -> (Int64, [Int])
parseMask (oMask, flucBits) (nth, ch) =
let oMask2 = if ch == '1' then oMask .|. (shift 1 nth) else oMask
flucBits2 = if ch == 'X' then nth : flucBits else flucBits in
(oMask2, flucBits2)
applyMask :: Bits a => a -> (Int, Int) -> a
applyMask n (i, c) = if c == 0 then clearBit n i else setBit n i
nextState :: State -> String -> State
nextState (oMask, flucBits, intMap) origLine =
if isPrefixOf "mask" origLine then
let line = fromJust $ stripPrefix "mask = " origLine in
let len = length line - 1 in
let enumLine = zip [len, len-1..0] line in
let (oMask, flucBits) = foldl parseMask (0, []) $ enumLine in
(oMask, flucBits, intMap)
else
let line = fromJust $ stripPrefix "mem[" origLine in
let [addr, value] = map read $ splitOn "] = " line in
let flucIter = sequence $ take (length flucBits) $ repeat [0, 1] in
let enumBits lines = zip flucBits lines in
let f = foldl applyMask (addr .|. oMask) . enumBits in
let addrs = map f flucIter in
let intMap2 = foldl (\acc el -> Map.insert el value acc) intMap addrs in
(oMask, flucBits, intMap2)
solve2 :: [String] -> Int64
solve2 = sumElements . foldl nextState (0, [], Map.empty)
where sumElements (_, _, map) = Map.foldl (+) 0 map
main :: IO ()
main = do
l <- lines <$> readFile "14.txt"
print $ solve2 l

592
aoc2020/14.txt Normal file
View file

@ -0,0 +1,592 @@
mask = 100X100X101011111X100000100X11010011
mem[33323] = 349380
mem[52742] = 116688965
mem[4113] = 11499
mem[15819] = 313303
mem[23239] = 755579063
mask = X00X10X1X010110110111X00010X100X000X
mem[49207] = 466621685
mem[34069] = 6874604
mask = 1001100XX00011110110100XX0110000001X
mem[61278] = 56361674
mem[51360] = 61871432
mem[31903] = 45067
mask = 100X100XX0101X11X1X00X00001001X101X0
mem[22981] = 144008
mem[12013] = 49165315
mem[54643] = 50677
mem[59166] = 678129
mem[64022] = 27522
mask = 100110X0001X11011000101X1000001X00X0
mem[32693] = 425145
mem[11437] = 236593490
mem[16078] = 227582
mem[35266] = 197465438
mem[39279] = 127942
mask = 10101000X0X00001X1001000010100111X00
mem[49794] = 2082
mem[60407] = 2129
mem[33300] = 921
mem[18582] = 62106545
mem[32160] = 843912
mem[36917] = 7740
mem[1836] = 54721591
mask = 100010X1X0X011X1101XX00001X01000X10X
mem[8385] = 1381
mem[38022] = 2501412
mem[34713] = 3648024
mem[33245] = 1178087
mem[22176] = 263
mem[20535] = 1289
mem[2092] = 88590569
mask = X001100X00X0X01X0X100X100010110XX101
mem[65061] = 2768
mem[56375] = 6734
mem[18070] = 20571066
mem[61511] = 403157281
mem[4164] = 179682
mem[11801] = 5501
mem[22339] = 14414879
mask = X0011000001X1001X0100111110X00110111
mem[3844] = 1046
mem[33741] = 109390
mem[54311] = 94183595
mem[48744] = 112575
mem[29663] = 2042
mask = X00X100000101001101001001X00001000X1
mem[25325] = 177269
mem[919] = 50779835
mem[52113] = 2386630
mem[60154] = 29645195
mem[24761] = 8101
mask = X101X000X01011011010X100001101110X01
mem[5169] = 2865
mem[55126] = 50829
mem[60154] = 124556261
mem[48753] = 377574
mem[48662] = 9144531
mask = 10011X00001010011010000101110XX0X00X
mem[41623] = 632353121
mem[10365] = 70888870
mem[59458] = 849
mem[18992] = 486294339
mask = X00X100X011011111100X00001001010100X
mem[42046] = 518245944
mem[4654] = 39071
mem[46109] = 1540
mem[3245] = 822
mem[25937] = 257692
mem[19118] = 6601278
mask = 1001001XXX100XXX101XX0001010001000X0
mem[34356] = 55967
mem[52601] = 522574
mem[31903] = 7669828
mem[36165] = 10552
mask = 110X101X00X0111111XX001X0001000XX10X
mem[42649] = 1534730
mem[8324] = 467628
mem[9447] = 3054
mem[41788] = 28205
mem[9353] = 14315559
mask = 1X01X01100111111X101000000X100100000
mem[270] = 3208
mem[20373] = 186089492
mem[43940] = 449607191
mem[63389] = 674
mem[437] = 6933780
mask = 1001X00001X01X0X101101X0010X00110110
mem[22829] = 3301
mem[59260] = 6763
mem[22305] = 203360
mask = 10011110101010X010XX011X0010001XX000
mem[55041] = 6199
mem[55452] = 151
mem[2746] = 464657
mask = 1001000000X0X10110X01101X00100111000
mem[54354] = 666913
mem[44827] = 214920
mem[44621] = 13259544
mem[29462] = 14725
mem[27633] = 284739975
mem[63195] = 11668372
mask = 10X010X10100X111001X101010101X11100X
mem[21667] = 426958
mem[55530] = 91533
mem[10365] = 493
mem[51246] = 513589450
mem[44622] = 1773
mem[4113] = 401
mask = 100X1000001011XXX0100XXX100010X10X00
mem[60407] = 869913
mem[10365] = 59083
mem[18321] = 3019
mem[65061] = 10794134
mem[62827] = 2777572
mem[20373] = 23798334
mask = 1000X10011X010011X10X0000101X0100001
mem[17936] = 4347
mem[38270] = 611
mem[7408] = 2854792
mem[2612] = 604172
mem[24287] = 418220
mem[27110] = 31440
mem[64742] = 1872667
mask = 10X110000010100110X001X01X1000000111
mem[30518] = 13431
mem[64496] = 204238
mem[62259] = 1191
mem[17457] = 3652
mask = 100X1X0XX1101XX11010X000X01010010011
mem[25325] = 67829
mem[4021] = 8039
mask = 1XXXXX0X0010110X11100111001111101110
mem[34600] = 4128134
mem[47565] = 28022073
mask = X0X110000XX010X10010X0X111X111010101
mem[64746] = 17532220
mem[55786] = 109034
mem[12715] = 185475
mask = 1001110X011010111010X1010010100XX100
mem[28923] = 1444
mem[7508] = 41968
mem[39856] = 447
mem[19698] = 4420683
mem[60924] = 7222
mem[8056] = 225410214
mask = 100X10X1X0X011X10110X01X011000X10X00
mem[58206] = 585282
mem[10984] = 105158307
mem[31562] = 526874
mem[60154] = 107013
mem[4409] = 4126230
mask = 1010100010X0XX0111X00X00011X000X0XX0
mem[7122] = 428629
mem[29394] = 262029322
mem[33832] = 6067254
mask = 0001100XXX0010X001100010X000110001X1
mem[1975] = 32392
mem[14891] = 9350
mem[19905] = 28213400
mem[11981] = 132973999
mem[49582] = 4347
mem[64106] = 235564
mem[9648] = 1440
mask = 000110010011XXXX0X1001010001X00X0100
mem[18992] = 628
mem[37263] = 1031
mem[4387] = 1442306
mem[2471] = 1123350
mem[1493] = 88891215
mem[22500] = 3553
mem[6845] = 26007
mask = 10011X00011011X1101X00X001X1X001X111
mem[49101] = 13289
mem[32] = 391365
mem[31906] = 79
mem[48744] = 71043
mask = 1001X0X00010100110X001011001101X01X0
mem[25999] = 2473051
mem[36408] = 56819077
mem[46656] = 2074748
mem[10871] = 8606
mem[7122] = 2053
mem[59403] = 5442
mask = 1XX0X01X100X11111010X000X00X000101X0
mem[1160] = 280063168
mem[20571] = 19030
mem[23225] = 51089295
mem[40992] = 17475
mem[63413] = 1144
mem[19458] = 284777610
mem[21502] = 10410
mask = 100X100X00101X0100X0X0X11100111XX11X
mem[33860] = 160
mem[37007] = 56420
mem[55140] = 490726
mem[47752] = 521745
mem[55594] = 336661995
mem[44008] = 265991679
mask = 1001100001X010011100100X01X0X011111X
mem[1289] = 55191
mem[53058] = 23079796
mem[25362] = 57315626
mem[8895] = 35287816
mask = 0001100100XX00100X1X0X00XX00XX000110
mem[12568] = 136661
mem[9931] = 303487
mem[38781] = 91532
mem[25506] = 950257996
mem[3694] = 6225663
mem[6631] = 62710499
mem[3205] = 7586715
mask = X0001000001X111110100000X0110001000X
mem[61696] = 34763
mem[42583] = 2987088
mem[8416] = 2293694
mem[21503] = 8071
mem[41788] = 950960
mem[9648] = 23284946
mask = 100010000010XX0XX01000000X011100X1X0
mem[30270] = 421
mem[52379] = 86815089
mem[16627] = 3647190
mem[36794] = 132421727
mem[54580] = 248096
mask = 10X1101000X01001X00111110101110001X0
mem[48399] = 9196559
mem[6869] = 32793911
mem[20422] = 1560
mem[12101] = 15618
mem[25154] = 390003034
mem[23791] = 229770864
mem[49558] = 12206144
mask = 100X10010X101XX1XXX000001X00101X1100
mem[3205] = 110968351
mem[65515] = 7362194
mem[2197] = 52580964
mem[13004] = 3723834
mem[46931] = 24935229
mem[919] = 6284
mask = 10001X11100X1X1X10X111X100X0000010X1
mem[30162] = 1665
mem[35687] = 3554
mem[3735] = 8003
mem[18258] = 44276232
mem[48625] = 401841687
mem[62781] = 2814958
mem[5302] = 175144514
mask = 1001X0XX001X101110101000X11X00010X00
mem[38152] = 42369373
mem[36392] = 13302
mem[13867] = 940605082
mask = 10001100X11010X1101000X0X11100110011
mem[63412] = 5289
mem[788] = 6600
mem[27915] = 254034
mem[24347] = 16264001
mem[52437] = 651358
mask = 10011X0X0110X0X11X101100101100X11100
mem[56524] = 1244173
mem[64911] = 2124386
mem[3815] = 107466
mem[14375] = 6798
mem[16285] = 66968238
mem[7968] = 835823180
mask = 10X110100X101XX110X11110XX0111001010
mem[58730] = 132998954
mem[8056] = 754181
mem[39247] = 126
mask = 1001X000001XX10110101X1110110X10101X
mem[59028] = 10817
mem[17977] = 61299509
mask = 1X001100X1X0100110100000X111XXX001X0
mem[2056] = 32701076
mem[2071] = 2401082
mem[9887] = 998417
mask = 100110X11X101X1110X00100X0101111X0X1
mem[33860] = 388064
mem[59050] = 16623098
mem[5188] = 319
mem[37207] = 2470432
mem[27333] = 2026
mask = 1000X000001X1X0X00XXX00X100011X11010
mem[24029] = 9105
mem[14364] = 243545984
mem[4113] = 3279
mask = 1X0X1001X0101011110XX1000100X000X101
mem[17781] = 509963835
mem[37716] = 62611707
mem[23997] = 1023138975
mem[5927] = 32777
mem[55304] = 264062857
mask = 100110X001X01X01100011100X100110X11X
mem[58338] = 741
mem[34693] = 991498
mem[32339] = 30979944
mem[50216] = 66393532
mem[29090] = 11574321
mem[30824] = 15729
mem[16868] = 23942
mask = 1X0XX0010X0011110X101010111011111010
mem[48969] = 3327849
mem[52521] = 460105388
mem[33860] = 422661865
mem[44621] = 6715
mem[27762] = 11952
mem[34536] = 4064
mask = 1001X001001X0011001000100110010001XX
mem[195] = 487302
mem[17992] = 889
mem[11858] = 958195
mem[11013] = 202443463
mask = 1000101X100X1111011000X100110000X001
mem[13097] = 3534
mem[41292] = 85120
mem[9497] = 154119
mem[19610] = 5709354
mem[34972] = 48311
mem[50753] = 180578
mem[35921] = 667946365
mask = XX1010X00110X00111000XX00001000110X0
mem[3712] = 2843518
mem[34604] = 2965
mem[54311] = 162583
mask = 0001X0X00100100X001000001X1X10X01X10
mem[49406] = 965493
mem[59050] = 392048
mem[3574] = 922708604
mem[7419] = 33525859
mem[1933] = 8
mem[4367] = 11521
mask = 1001X0X00X10X00X101X00001110X0100X00
mem[29215] = 417522
mem[56468] = 34229032
mem[26868] = 552971
mem[36368] = 420213
mask = 100110X0X1101011101X01X01101101X001X
mem[4913] = 455
mem[3815] = 11211510
mem[21545] = 1469
mem[35762] = 1806
mem[58825] = 3743
mem[23225] = 474872535
mem[53173] = 46538
mask = 1XX0X00X0X101001001010100X0X01X00010
mem[64106] = 98247289
mem[13686] = 54961348
mem[38944] = 462290318
mem[53185] = 7075
mem[30162] = 39454
mem[14983] = 1010603
mem[38339] = 970
mask = X001100X010X111110001000001X01100110
mem[12827] = 22328
mem[18628] = 7082210
mem[31013] = 20804915
mem[13966] = 86
mem[518] = 1757
mask = X001100XX001001001110000000000XX1110
mem[14375] = 8414661
mem[1568] = 225486
mem[25775] = 336197
mask = 100110000X00100X100001100X111X100X01
mem[2071] = 51386682
mem[32897] = 162194
mem[11308] = 1799417
mem[20829] = 299249
mask = 1X0010XXX0001111XX1100X001X1X0000101
mem[29189] = 36530
mem[657] = 114543286
mem[9356] = 451
mask = X000100000101X0110X0011XX10000110001
mem[30577] = 117881
mem[60874] = 19567558
mem[10363] = 13493
mem[5690] = 382
mem[61059] = 4757304
mem[36165] = 95983791
mask = 100X00X00010100X1010000X101000X10000
mem[33324] = 39476477
mem[34713] = 7398
mem[46214] = 98709
mem[35856] = 1020446010
mask = 10X01X000010000X11100101011X001X0100
mem[65061] = 61054
mem[54052] = 92826
mem[35603] = 58759
mem[58037] = 40910
mem[62217] = 45701380
mask = 1X011000001011011010XX00X10X0X010001
mem[15920] = 5645
mem[28828] = 265910022
mem[29437] = 5544
mem[56112] = 637
mem[45033] = 36063036
mem[12783] = 13776458
mask = 10011011X010100110XX100100XX11011X00
mem[518] = 25998191
mem[13053] = 7866406
mem[38152] = 3208
mem[18730] = 711
mask = 10X11000001XX1X000100X11101XX1X10111
mem[47121] = 11272115
mem[43618] = 27683
mask = 100X1101X0101001100X010000X11001X100
mem[21702] = 34688805
mem[43624] = 3956780
mem[24476] = 17239393
mem[23321] = 25573609
mem[15163] = 1713
mem[65338] = 27386792
mask = 10011010010X10011X0011110XX100001111
mem[53501] = 16700270
mem[28069] = 20683243
mem[33593] = 114830
mem[9962] = 403282549
mem[54061] = 2336
mem[46656] = 7039
mem[58616] = 181
mask = 10001X11001011XX101X0100010010101100
mem[8738] = 234383093
mem[11512] = 1792627
mem[54326] = 1574223
mask = 10011X101X10100XX000X10010X01X01100X
mem[51382] = 17879
mem[44905] = 783
mem[57514] = 1018128542
mem[18628] = 240492
mem[2108] = 3429
mem[2304] = 3748
mask = 0X011001X0X000X000110100101000000000
mem[4452] = 19437119
mem[64742] = 179090
mem[16430] = 486207
mask = 1001X000111X1X1110110X011111100X0011
mem[52004] = 41486
mem[48779] = 83675
mem[17861] = 48577395
mem[39247] = 16952
mem[8738] = 3981
mem[32923] = 1168904
mask = 10011001XX0011X11X0010X1010X10101000
mem[33319] = 44401
mem[4142] = 517003945
mem[29189] = 415157
mem[33358] = 1395165
mask = 1001100X010010011XX00XXX1100101X0101
mem[13618] = 246280673
mem[58338] = 17884
mem[10885] = 816
mem[11277] = 24331199
mem[17936] = 1616051
mask = 1001100X01X01001X00011000110X0X001XX
mem[58338] = 302363844
mem[53596] = 175604903
mem[56468] = 419729
mem[27915] = 581
mem[41501] = 69718
mask = 100110000X1010110100X1X001X00X01001X
mem[18333] = 15544
mem[3929] = 2622169
mem[37718] = 176413
mem[27333] = 848
mem[17456] = 1097
mask = 100110101010X001X000X0001X00001011X0
mem[53045] = 2356198
mem[49908] = 1086
mem[17019] = 7107107
mem[12013] = 70971
mem[7048] = 1585
mem[3666] = 4937143
mask = 10011XXXX01010011000010X1X11100XXX00
mem[65524] = 4129175
mem[5636] = 315661
mem[39270] = 455882795
mask = X1001100110010011010000001110X0X00XX
mem[50481] = 26734
mem[57708] = 199726127
mem[20422] = 130991
mem[13651] = 1094687
mem[1292] = 60536
mask = 110X1011001XX111110100X0000010X1X101
mem[39644] = 14574
mem[8596] = 30400
mask = 1000101XX0X0X1110110111X110011X00110
mem[919] = 32148
mem[41] = 453324
mem[36794] = 179133
mem[2780] = 958033590
mask = 100010X1X11011110010X01101101110X100
mem[20035] = 1674335
mem[18909] = 33271
mem[21491] = 4013451
mem[21792] = 78760
mem[42156] = 980
mem[3276] = 3971405
mask = 10XX10000X10X00111X0XX00X0010011X100
mem[36368] = 5097527
mem[3099] = 104365
mem[57092] = 74461253
mem[46314] = 30483860
mask = X000101X101011X10110XXX001X00X11X010
mem[9948] = 43011947
mem[53185] = 41588
mem[25699] = 101124
mem[60046] = 123243
mem[23975] = 125991
mask = 1X00100000X01X00101011100X1010000101
mem[65101] = 504575
mem[55313] = 14953613
mem[42156] = 526
mem[55573] = 1303957
mem[53260] = 16252
mem[48073] = 8667
mask = 1001100100101X11110X0X0X0111X00001X0
mem[10402] = 793546
mem[45910] = 18
mem[23627] = 72728
mem[7408] = 16579752
mem[22105] = 10576
mem[61054] = 1160961
mem[2989] = 149675383
mask = 0001X001000000XX0111X110010001010110
mem[15867] = 14
mem[23379] = 10511918
mem[4217] = 4840435
mem[29978] = 11828937
mem[28303] = 2358671
mask = 10010010011X0XX11010X000110000110X00
mem[11923] = 149358903
mem[46246] = 3148
mem[17596] = 9370
mem[1540] = 12848
mem[25775] = 29444
mem[32564] = 64008
mem[16097] = 641
mask = 0X011001X010X010X0100X1X0X0X000111X1
mem[45770] = 1008133
mem[15551] = 3912928
mem[53058] = 188856
mem[44827] = 9036496
mem[59530] = 20033543
mask = 1001100X0XX01X0110X000XX010010XX1101
mem[2056] = 737
mem[34972] = 30655
mem[50728] = 927954
mask = 10001X0000X0X0010010101010X001100110
mem[39247] = 425181
mem[64200] = 13111811
mem[8169] = 1250162
mask = 100110000X10XXX11010X0001110X011XX00
mem[62259] = 4350710
mem[56112] = 42327
mem[53173] = 2221557
mem[36759] = 242686307
mem[29077] = 1179326
mem[2056] = 356
mask = 10000000001XX000101000X0X11000X10110
mem[18542] = 454113
mem[44192] = 501708
mem[54994] = 149470837
mem[54260] = 582959
mem[65424] = 295679271
mem[36368] = 2002
mem[16392] = 99
mask = 10100001XX101001X0101100101101000XX0
mem[17861] = 3340321
mem[24705] = 4143350
mem[38940] = 201585
mem[35632] = 19204465
mem[9443] = 5273035
mask = 10X110010010100101000X00001010X0111X
mem[2991] = 51624
mem[56468] = 1603
mem[35633] = 4068
mask = 10011X01001010X10000X011000111101X11
mem[58842] = 69158
mem[43765] = 1624
mem[24913] = 133864698
mem[15015] = 247
mem[10155] = 1064
mem[33787] = 142284522
mem[17457] = 15488682

38
aoc2020/15.hs Normal file
View file

@ -0,0 +1,38 @@
import qualified Data.Map.Strict as Map
import Data.Map.Strict (Map)
import Debug.Trace
import Control.Monad.State
-- 1st is turn number
-- 2nd is map of spoken
-- 3rd is next number to speak
type S = (Int, Map Int Int, Int)
produceInitial lst =
let len = length lst
f acc (idx, el) = Map.insert el idx acc
initMap = foldl f Map.empty $ zip [0..] lst
in (len, initMap, 0)
speak :: Int -> State S Int
speak n = do
(turn, spoken, nextSpeak) <- get
let lastSpoke = Map.lookup nextSpeak spoken
let spoken2 = Map.insert nextSpeak turn spoken
let nextSpeak2 = case lastSpoke of
Nothing -> 0
Just n -> turn - n
let result = (turn + 1, spoken2, nextSpeak2)
-- modify (\_ -> traceShow result result)
modify (\_ -> result)
return nextSpeak
speakStream lst = (++) lst $ flip evalState initial $ mapM speak [0..]
where initial = produceInitial lst
actualInput = [5,1,9,18,13,8,0]
exInput = [0,3,6]
n = 30000000
-- n = 2020
main = do print (speakStream actualInput !! (n-1))

35
aoc2020/15.py Normal file
View file

@ -0,0 +1,35 @@
ex=[0,3,6]
def iter(start):
spoke=dict()
lastSpokeD=dict()
turn=0
nextSpeak=None
for i in start:
turn+=1
spoke[i]=turn
yield i
nextSpeak=0
while True:
turn+=1
yield nextSpeak
lastSpoke=spoke.get(nextSpeak)
spoke[nextSpeak]=turn
if lastSpoke is None:
nextSpeak=0
else:
nextSpeak=turn-lastSpoke
if turn%3000000==0:
print(f"turn {turn} of 30000000 ({100*turn/30000000.0}%)")
import itertools
print(list(itertools.islice(iter(ex), 10)))
def nth(start, n):
return next(x for i,x in enumerate(start) if i==n-1)
# print(nth(iter([0,3,6]), 30000000))
print(nth(iter([5,1,9,18,13,8,0]), 30000000))

388
aoc2020/16.py Normal file
View file

@ -0,0 +1,388 @@
ex="""
class: 1-3 or 5-7
row: 6-11 or 33-44
seat: 13-40 or 45-50
your ticket:
7,1,14
nearby tickets:
7,3,47
40,4,50
55,2,20
38,6,12
""".strip()
actual="""departure location: 26-404 or 427-951
departure station: 43-307 or 325-967
departure platform: 39-383 or 399-950
departure track: 31-157 or 178-969
departure date: 28-109 or 135-950
departure time: 38-622 or 631-958
arrival location: 35-61 or 69-957
arrival station: 36-216 or 241-951
arrival platform: 41-586 or 606-967
arrival track: 47-573 or 586-951
class: 31-439 or 445-957
duration: 35-925 or 939-965
price: 41-473 or 494-952
route: 45-742 or 754-963
row: 41-338 or 357-952
seat: 45-848 or 873-968
train: 37-183 or 197-952
type: 46-509 or 522-974
wagon: 32-69 or 81-967
zone: 37-759 or 780-967
your ticket:
103,197,83,101,109,181,61,157,199,137,97,179,151,89,211,59,139,149,53,107
nearby tickets:
209,822,916,528,93,531,551,797,387,835,278,464,546,945,732,88,678,145,559,287
361,364,272,676,683,606,911,903,890,600,784,669,894,428,741,92,735,276,142,836
781,526,892,684,272,536,918,9,402,546,925,824,201,502,688,432,613,809,713,374
524,557,363,240,554,371,58,801,96,156,449,454,573,903,365,833,632,258,785,941
924,802,727,547,447,674,251,212,359,180,620,4,257,525,403,94,181,844,547,569
107,673,817,281,543,800,59,557,739,570,891,216,149,105,728,649,86,336,464,933
148,264,782,50,901,752,706,287,61,617,300,100,538,540,563,145,816,180,686,461
781,256,535,203,24,213,804,817,145,304,924,895,890,794,199,739,734,200,400,899
84,501,93,782,494,226,88,902,843,795,674,732,509,890,182,716,358,298,367,925
331,82,617,102,684,545,296,878,409,887,820,181,182,875,242,907,294,428,787,714
899,780,543,561,523,633,284,457,695,528,301,676,799,921,105,865,465,798,759,813
203,614,843,657,791,669,453,541,854,845,209,841,806,292,105,338,694,259,698,248
289,946,635,736,890,494,656,665,813,736,884,341,253,758,437,281,153,104,915,817
662,897,901,104,283,731,56,655,730,204,345,542,381,641,201,297,375,806,524,565
462,380,736,528,90,471,401,676,203,88,766,61,372,264,50,253,428,823,547,793
381,108,787,569,711,737,879,569,803,483,277,684,463,908,526,820,368,282,366,92
899,502,307,906,876,845,205,241,839,686,438,624,616,633,427,738,651,531,295,908
690,638,275,216,94,5,608,141,611,615,808,247,470,292,634,829,503,833,278,505
207,147,608,459,570,698,813,473,290,741,216,716,641,948,759,85,860,401,679,797
241,666,345,243,51,670,83,680,842,152,251,571,279,527,635,833,549,140,906,542
205,809,716,704,556,638,306,56,473,893,631,886,437,649,90,712,710,894,453,627
566,61,545,208,523,550,822,700,204,57,744,947,82,555,91,613,252,377,365,820
296,653,873,433,830,922,288,805,786,714,656,530,364,284,691,978,242,881,404,326
553,643,614,815,448,533,902,507,324,380,879,255,898,682,876,738,713,642,665,447
213,880,934,434,818,522,55,740,210,543,145,427,783,96,454,289,382,245,141,821
810,910,647,935,468,52,721,330,457,509,103,890,293,280,612,642,683,669,787,281
842,793,338,716,59,794,638,512,360,402,802,573,96,740,148,659,372,615,471,708
334,608,522,553,137,138,277,870,305,529,85,383,149,657,95,637,270,431,179,681
838,546,797,535,801,375,697,732,469,370,249,662,509,351,263,366,327,641,890,793
571,651,661,456,697,706,831,464,639,731,363,533,702,498,296,635,379,924,328,110
648,792,765,251,252,572,656,563,873,89,736,731,256,947,885,104,140,755,876,734
546,642,781,697,923,394,711,358,255,246,793,532,566,268,526,783,708,830,819,568
462,781,495,82,473,453,730,388,806,660,258,796,335,780,247,283,653,57,620,890
652,245,136,795,281,464,662,250,730,101,684,2,273,379,96,783,738,543,255,811
434,151,794,468,399,98,284,254,302,909,561,886,135,386,206,431,719,336,833,281
567,276,378,731,726,342,612,908,650,432,501,689,641,274,140,58,470,212,815,250
137,711,337,540,837,647,912,818,371,23,427,946,648,569,250,814,460,146,333,434
727,654,328,148,337,648,659,848,284,378,103,851,568,473,633,784,298,758,819,941
150,810,456,537,877,839,531,916,643,825,784,908,430,987,708,948,210,571,332,298
98,399,106,462,528,554,151,98,439,806,505,874,757,695,333,391,648,700,619,689
525,841,432,535,797,497,208,908,539,427,851,446,729,505,895,839,813,210,538,788
155,149,716,606,82,903,453,274,299,607,795,292,548,533,227,148,527,99,586,713
801,742,879,714,786,464,987,713,360,698,643,53,541,105,260,261,717,728,717,612
105,57,90,815,939,908,92,940,620,62,529,831,261,873,694,719,94,470,50,465
611,836,83,548,469,938,548,680,207,823,498,205,696,701,572,376,944,830,652,95
466,719,335,434,93,883,449,314,739,649,433,290,742,901,735,472,338,337,198,376
977,97,447,360,729,538,307,524,557,282,731,836,800,675,885,549,841,903,632,821
259,699,94,261,667,586,524,180,808,469,576,672,681,947,697,917,804,468,370,435
689,785,180,877,453,150,700,498,249,500,755,845,361,605,274,268,151,200,814,150
823,920,736,64,826,157,636,831,496,297,893,689,278,915,899,837,568,465,404,202
663,722,210,709,289,526,567,216,101,242,917,18,381,333,566,541,573,143,572,54
734,616,621,704,736,583,437,684,501,657,565,643,641,96,200,258,463,561,563,640
499,837,260,96,711,880,882,447,457,228,507,677,284,670,733,823,274,289,286,539
636,571,905,137,452,718,379,811,249,69,411,823,268,401,874,87,69,921,828,271
276,105,285,754,457,635,738,99,439,183,816,253,674,247,944,143,207,54,199,994
709,430,371,901,895,486,896,374,724,703,617,328,559,692,899,379,306,296,242,567
466,215,471,431,844,54,382,87,93,756,655,259,379,872,615,400,264,366,211,85
788,688,148,807,144,374,360,270,460,672,52,391,534,888,437,363,796,197,280,471
717,548,525,622,797,303,247,704,328,606,53,810,381,812,462,671,380,797,983,658
204,725,99,945,912,831,759,812,757,141,159,816,245,57,827,663,472,430,59,798
465,638,264,359,542,93,638,599,151,149,210,732,247,873,891,262,96,431,642,902
89,558,716,291,466,242,507,359,884,16,374,358,813,808,371,818,254,922,722,798
212,505,372,691,455,683,438,886,200,701,554,372,945,537,821,261,725,740,781,395
653,907,672,473,338,362,109,939,254,157,382,365,670,572,706,160,903,656,56,894
894,81,908,651,781,521,837,908,378,244,947,154,675,289,708,925,680,618,637,652
305,657,439,117,678,287,430,632,199,840,297,920,890,829,609,645,291,286,667,922
803,154,52,825,157,945,739,146,921,332,844,109,239,657,821,156,461,669,919,704
211,506,826,282,213,278,795,208,363,258,277,109,531,60,590,822,697,646,359,898
680,707,13,151,366,651,430,709,274,715,891,254,201,445,917,291,179,259,794,454
606,458,104,457,648,281,359,538,136,139,900,369,833,614,272,197,838,567,678,597
708,718,823,282,932,157,241,376,914,265,711,380,105,821,795,665,555,642,663,636
632,909,307,612,463,740,380,700,782,834,296,202,457,778,93,295,672,615,557,683
668,211,664,504,455,533,494,338,943,525,996,670,452,544,701,210,675,298,833,300
280,643,824,549,681,241,526,282,627,566,271,469,155,99,466,460,51,305,434,137
902,546,530,325,109,796,543,209,894,883,227,673,800,335,621,798,557,215,912,536
696,640,712,615,473,412,294,279,268,302,552,635,401,722,55,925,737,84,368,151
571,294,197,921,294,843,359,97,62,691,447,639,706,572,706,539,563,946,941,294
689,374,785,401,496,360,817,698,218,758,924,831,89,562,755,248,564,302,301,732
672,89,502,893,560,183,929,469,553,99,714,305,272,689,701,734,873,502,798,534
102,197,528,332,643,468,635,53,690,287,383,682,591,338,258,891,664,798,741,299
902,470,667,500,806,464,197,51,694,83,673,267,508,181,788,921,148,882,977,739
940,891,818,883,672,855,759,401,828,335,692,651,377,182,828,759,693,215,179,139
610,565,289,687,848,939,810,359,338,910,948,318,494,470,667,786,919,329,215,653
371,949,271,207,294,289,337,329,365,216,688,180,525,243,684,404,102,403,236,60
781,361,649,500,276,672,818,944,553,95,878,803,335,365,250,994,277,883,447,719
502,839,382,374,895,377,910,292,876,701,144,929,198,684,463,827,103,542,93,692
59,256,83,728,567,529,626,882,759,704,106,209,784,556,874,610,94,815,715,780
283,399,359,701,244,735,845,453,557,549,893,758,636,685,657,990,146,842,400,244
617,88,825,249,499,885,547,274,434,332,99,153,880,216,508,472,880,565,12,566
875,737,610,447,917,91,500,561,619,461,301,256,928,718,659,108,910,892,254,614
337,573,942,846,638,530,154,929,833,83,828,526,884,726,825,141,428,837,253,692
54,20,363,216,496,325,306,671,921,525,714,304,87,638,277,663,703,180,530,669
619,742,180,81,674,877,901,463,737,825,641,695,666,794,881,637,55,849,671,452
90,614,277,136,646,375,318,99,145,810,814,817,807,197,802,435,741,679,145,87
328,284,948,18,157,610,499,453,646,92,508,833,279,275,542,884,549,498,803,455
721,651,253,368,387,182,915,404,818,141,659,821,91,654,293,544,739,685,782,428
620,658,51,876,820,698,357,104,796,83,379,775,887,466,285,246,244,879,812,657
949,278,157,156,498,377,908,555,494,374,920,797,95,840,502,127,151,838,381,848
875,445,541,257,914,873,639,846,292,333,565,523,524,737,216,847,824,467,60,343
501,60,616,942,338,783,453,235,242,689,81,91,685,435,918,265,647,757,839,689
146,272,902,716,880,718,486,299,664,250,911,877,326,378,366,147,606,915,560,826
661,882,285,400,448,683,402,834,678,752,718,632,876,802,259,794,705,326,943,647
377,709,550,267,60,553,506,648,469,896,991,670,50,465,551,646,888,829,369,332
989,806,884,373,809,656,298,215,156,522,645,468,55,499,816,881,249,833,756,808
267,652,371,140,810,646,564,677,637,328,733,258,58,818,732,706,459,758,990,715
670,373,880,697,819,74,451,612,837,297,561,887,914,657,844,242,60,541,501,95
642,691,684,392,432,546,402,886,464,682,178,566,729,537,204,641,842,505,723,666
792,542,218,268,247,898,182,428,944,453,796,450,914,552,909,535,97,922,718,698
755,804,908,533,377,531,942,68,465,645,108,303,57,83,247,298,290,661,619,155
346,302,383,828,268,365,378,817,289,299,287,922,373,618,372,257,563,946,586,522
84,608,390,530,55,266,825,635,545,258,335,53,338,568,534,247,365,502,455,274
253,889,246,499,250,459,211,894,683,268,734,526,675,321,257,642,550,692,839,298
153,465,90,83,372,737,717,329,700,98,373,686,103,429,357,272,989,700,874,669
846,683,673,781,692,823,177,273,660,792,563,672,737,675,146,507,198,507,694,562
634,248,890,840,606,714,103,770,655,206,810,668,685,876,656,657,464,639,833,471
791,294,693,81,201,758,386,822,757,565,734,457,741,717,264,733,247,264,243,883
262,399,792,465,153,182,251,348,699,404,647,733,563,908,271,847,848,891,286,265
889,471,500,261,462,659,216,711,347,246,925,913,826,530,608,366,755,651,815,670
329,197,56,437,261,553,466,455,723,246,549,800,213,618,874,556,994,692,679,941
807,54,285,265,904,757,784,787,610,699,258,460,852,874,97,464,532,797,915,500
661,545,887,571,205,212,307,729,104,426,704,544,780,715,359,108,662,243,287,465
916,140,692,532,695,891,369,275,551,500,516,198,684,215,832,713,648,502,876,831
531,103,563,476,257,789,825,276,782,610,54,526,545,550,784,643,654,201,332,304
373,244,333,505,803,456,368,878,98,546,565,2,924,702,278,704,681,916,435,373
936,916,663,288,921,364,251,682,694,293,695,830,270,105,154,791,259,620,501,693
695,940,93,724,82,178,689,106,732,296,381,281,694,367,699,831,788,700,865,252
892,470,246,276,908,64,371,669,284,143,586,907,829,54,907,725,331,209,287,612
280,889,977,505,206,782,887,948,699,88,904,875,465,503,149,500,259,399,569,294
656,682,277,433,542,452,462,211,359,497,278,889,949,156,286,102,938,59,791,798
912,909,294,541,202,335,428,563,55,798,93,197,795,740,636,919,814,364,651,237
525,663,179,613,798,102,727,383,300,468,313,544,461,459,205,679,502,99,912,642
336,643,283,143,636,203,561,289,670,138,429,839,472,672,351,812,107,399,893,400
674,610,539,922,237,572,732,449,924,606,55,759,711,374,438,261,642,473,157,786
718,338,496,247,662,757,337,528,168,399,622,609,208,910,675,949,700,914,729,85
846,846,800,815,949,507,888,13,833,81,833,101,61,53,730,242,102,631,908,55
844,371,81,3,825,844,183,614,742,280,569,848,561,207,535,946,523,399,571,806
793,923,685,637,946,302,646,454,937,781,381,214,695,214,660,884,152,83,654,205
634,895,738,632,522,648,875,713,946,251,180,299,100,784,296,289,11,899,470,182
834,634,692,911,466,15,732,924,522,501,242,451,357,553,944,648,263,889,537,664
718,306,941,878,653,294,894,529,94,510,467,728,98,742,942,693,463,732,139,910
563,724,901,722,543,949,127,791,917,897,697,253,335,640,297,88,920,428,198,454
780,691,458,732,787,684,82,299,564,835,87,407,433,427,468,701,650,792,295,145
294,97,646,447,856,702,706,462,216,364,846,502,525,948,569,380,83,212,435,570
504,703,363,834,135,402,494,625,892,371,569,723,641,154,673,141,801,298,841,569
211,609,790,898,921,436,369,782,898,639,907,733,732,848,860,327,60,437,542,717
838,657,303,246,848,680,615,296,466,263,595,50,726,553,570,338,202,818,451,296
879,834,291,872,544,676,381,564,215,472,697,834,903,721,690,260,209,608,815,647
97,886,496,787,545,666,335,704,457,771,307,845,662,837,723,92,790,560,648,284
458,639,828,413,327,726,902,721,199,216,719,635,432,214,149,754,83,445,272,374
688,563,106,883,712,535,732,113,894,256,450,494,691,205,890,833,803,723,457,328
735,244,255,19,898,376,183,720,434,529,889,607,759,718,156,54,183,796,522,635
698,739,367,177,698,58,688,533,809,889,733,815,781,403,527,450,618,889,60,104
336,810,467,211,893,885,435,281,705,113,249,370,327,462,266,826,703,809,691,784
757,798,216,153,809,149,96,536,450,332,676,261,569,229,501,722,200,634,247,796
739,638,660,748,785,793,84,83,527,910,508,555,306,57,150,693,618,59,843,711
294,787,656,946,691,325,432,333,452,373,901,604,361,439,59,286,813,840,700,244
870,400,208,250,620,466,609,640,713,96,612,690,211,756,380,815,553,453,85,808
60,272,608,846,704,728,839,903,83,361,717,673,797,787,778,790,889,504,614,704
10,674,455,883,205,653,636,740,834,607,651,333,947,445,498,531,792,616,214,368
399,548,157,366,757,731,536,305,199,650,828,303,607,811,4,816,539,940,456,709
137,267,804,560,797,200,302,875,619,629,95,886,568,671,874,448,278,463,539,670
676,798,812,643,208,775,180,294,921,548,949,86,261,641,888,143,702,788,306,899
619,458,900,581,249,334,107,207,681,621,203,380,569,759,652,446,360,297,50,829
528,699,289,690,823,676,674,509,466,730,902,608,305,211,737,638,617,681,700,761
84,651,447,72,381,874,331,296,502,87,257,288,506,108,783,152,329,252,809,737
672,921,155,332,348,533,898,399,616,664,472,293,201,216,61,729,657,722,648,814
839,677,796,203,359,470,449,91,689,869,92,60,838,550,255,713,662,141,180,199
709,274,439,827,785,294,199,495,260,671,198,15,470,379,671,877,713,756,609,303
277,536,312,655,504,634,468,285,734,728,256,899,109,586,433,820,106,782,918,266
100,608,947,780,817,721,209,99,652,60,610,297,203,936,790,568,570,799,918,290
787,889,652,282,618,456,622,732,287,156,385,733,460,279,889,379,897,693,573,784
466,922,683,644,99,121,835,615,97,754,945,494,947,888,156,273,613,909,333,210
233,54,631,836,921,536,886,210,873,733,941,51,332,665,568,292,329,363,383,710
924,262,381,939,458,148,138,57,143,364,888,997,641,820,942,261,940,820,249,733
451,96,613,904,293,554,54,758,692,782,357,560,986,944,946,833,293,706,695,210
471,897,434,85,241,107,918,640,606,199,464,786,740,106,942,907,238,205,813,282
804,373,607,639,845,506,675,946,828,434,669,553,710,420,739,705,696,754,799,299
718,501,259,662,434,107,213,484,546,286,206,617,472,533,470,154,643,921,211,360
280,820,897,654,157,890,105,791,214,657,358,720,60,795,873,889,468,786,265,993
147,719,730,730,466,530,827,826,788,801,446,219,808,707,360,102,464,552,897,812
294,94,241,268,875,266,923,735,379,705,466,687,90,495,879,354,722,692,947,841
180,95,690,461,142,561,379,101,283,676,650,247,471,509,846,931,548,700,538,522
451,466,674,145,434,296,654,551,503,289,372,381,586,917,89,589,734,886,371,246
715,754,758,147,638,299,895,833,833,398,940,54,100,524,546,57,241,373,455,702
572,703,529,280,399,818,255,537,403,806,264,298,759,908,142,423,494,639,915,741
403,82,814,355,183,823,893,364,881,733,368,815,738,614,505,497,550,146,875,896
367,832,911,287,178,573,93,683,924,291,286,558,178,841,333,623,569,670,724,836
810,571,87,917,758,994,51,104,534,337,681,572,559,256,879,917,293,304,917,458
571,815,871,302,831,822,881,791,724,713,568,638,798,333,278,60,246,606,714,104
555,712,567,837,136,553,642,19,208,616,712,893,363,325,303,531,631,789,501,813
150,379,138,381,434,785,823,648,357,912,128,435,573,638,888,360,730,284,636,565
671,198,93,382,527,915,263,712,253,935,267,816,453,682,527,538,399,663,886,151
742,83,329,627,509,631,799,371,893,206,365,455,182,635,534,455,372,465,684,838
643,896,898,873,873,796,438,448,402,540,626,685,939,672,435,209,459,495,282,729
257,563,832,831,552,607,218,148,279,381,555,667,657,369,942,57,558,149,689,897
208,683,569,259,978,674,697,836,215,215,140,361,714,691,940,199,57,445,302,712
208,618,563,616,777,359,671,289,300,672,665,917,619,635,528,898,639,213,895,98
278,781,547,307,371,787,920,215,631,925,880,565,268,361,616,891,881,643,144,321
538,645,728,763,211,677,690,916,373,649,212,436,371,292,268,373,380,438,948,507
257,757,917,656,560,782,664,546,925,265,795,494,647,151,531,101,534,1,613,432
334,669,818,524,887,329,375,792,669,328,784,813,494,697,447,524,890,360,399,418
837,554,677,816,622,534,720,893,883,255,912,712,341,291,687,890,400,921,101,819
740,531,292,271,816,727,371,696,590,272,270,562,544,179,817,498,147,946,881,611
616,647,847,824,845,535,700,281,153,642,478,281,197,468,447,204,908,877,550,664
755,494,271,838,108,591,58,841,245,721,90,463,714,561,875,156,542,541,267,150
366,757,681,946,548,533,135,896,507,359,824,282,15,638,305,780,640,827,781,798
827,686,639,525,672,921,573,275,883,375,733,910,545,101,996,277,827,900,288,901
254,685,548,723,729,507,100,917,763,332,634,89,404,572,690,788,921,559,839,137
662,287,204,311,468,947,919,709,664,357,52,637,690,910,894,633,373,459,457,89
652,434,365,754,757,626,720,642,277,85,289,664,559,213,148,813,826,504,821,157
666,888,545,759,107,883,17,462,58,264,537,877,913,462,887,198,362,58,106,691
101,216,650,250,328,559,854,834,622,655,447,54,946,799,727,660,705,137,95,610
296,453,724,512,296,536,921,399,884,617,821,506,61,830,280,456,536,203,562,727
844,561,634,452,806,607,495,107,813,147,927,848,809,879,247,705,705,707,742,136
839,791,504,528,631,607,633,498,305,834,277,382,724,268,787,816,18,361,918,448
716,375,438,789,250,725,886,543,275,2,523,370,108,848,897,614,60,757,911,666
291,790,472,727,560,313,276,54,93,612,92,915,103,794,676,152,267,915,298,334
692,547,107,188,293,83,215,69,461,939,757,244,723,632,84,754,524,451,535,403
665,644,5,672,719,561,379,54,645,701,430,621,613,675,703,662,916,907,831,805
288,496,724,326,305,460,714,329,839,163,829,728,638,672,450,920,286,783,543,429
726,243,522,144,452,158,295,182,359,368,892,689,362,147,783,943,307,914,288,706
102,434,292,617,876,57,666,524,299,258,151,462,645,919,109,533,197,4,454,542
911,907,564,632,803,211,707,901,708,340,556,255,781,135,404,268,375,671,526,338
802,448,451,735,99,669,349,722,609,783,429,298,692,918,642,274,135,284,428,54
661,427,600,837,273,572,801,790,945,674,832,277,529,759,539,794,361,790,383,835
453,537,875,203,536,246,586,453,484,330,60,642,295,328,207,494,216,668,919,373
680,673,923,785,137,648,590,495,100,105,471,109,914,877,500,557,383,523,522,631
534,819,694,647,691,367,468,545,689,837,64,810,146,613,909,252,756,736,690,251
757,367,662,199,947,109,200,813,428,694,737,692,429,137,689,319,700,844,97,648
662,803,618,178,85,295,711,259,652,717,94,893,616,139,438,779,651,885,264,357
570,264,105,334,450,841,568,643,845,449,883,949,434,682,820,459,672,844,617,864
531,98,150,466,921,812,464,175,260,697,278,643,876,687,914,60,61,439,297,508
876,438,837,681,615,327,409,216,703,206,370,362,680,95,804,894,531,716,302,617
802,366,211,532,556,791,551,999,876,336,543,281,538,181,836,109,208,556,903,270
94,731,528,593,507,919,330,665,543,329,700,705,59,288,654,681,884,59,891,925
531,153,759,828,242,331,835,438,612,539,631,455,616,306,985,800,826,102,725,358
538,214,780,453,692,844,797,921,814,797,638,666,211,506,359,235,907,642,137,687
364,525,458,179,694,568,153,197,181,461,361,293,18,888,942,699,253,290,728,718
718,208,730,721,733,90,445,416,361,85,844,787,463,272,713,714,690,336,198,757
105,704,302,610,947,608,544,731,264,817,719,873,740,559,927,921,277,436,820,689
209,742,656,473,151,430,375,456,731,647,848,673,272,93,824,102,983,504,812,377
498,898,94,707,607,826,756,471,129,466,844,915,251,789,566,506,471,873,285,652
788,281,57,430,822,90,764,523,294,327,882,181,377,819,611,87,282,361,820,498
381,450,892,826,603,710,670,281,399,841,274,284,675,845,805,688,613,263,673,273
671,563,276,372,108,946,263,245,688,313,439,203,699,148,360,454,290,755,687,55
""".strip()
ex2="""class: 0-1 or 4-19
row: 0-5 or 8-19
seat: 0-13 or 16-19
your ticket:
11,12,13
nearby tickets:
3,9,18
15,1,5
5,14,9""".strip()
curr="fields"
fields=[]
your=[]
nearby=[]
for line in actual.splitlines():
line=line.strip()
if curr=="fields":
if line=="": continue
if line.startswith("your ticket:"):
curr="your"
continue
k,v=line.split(": ")
conds=[]
for cond in v.split(" or "):
l,r=list(map(int, cond.split("-")))
conds.append((l, r))
fields.append((k, conds))
elif curr=="your":
if line=="": continue
if line.startswith("nearby tickets:"):
curr="nearby"
continue
your=list(map(int, line.split(",")))
elif curr=="nearby":
nearby.append(list(map(int, line.split(","))))
# print(fields)
# print(your)
# print(nearby)
values=[]
for i in range(len(your)):
values.append(set())
for (idx, ticket) in enumerate([your]+nearby):
ticket_valid=True
for val in ticket:
isvalid=False
for (prop, conds) in fields:
for l, r in conds:
if val>=l and val<=r:
isvalid=True
break
if not isvalid:
ticket_valid = False
break
if ticket_valid:
assert len(ticket)==len(values)
for i, n in enumerate(ticket):
values[i].add(n)
print(len(values))
valid_for=[]
for (prop, conds) in fields:
this_valid_for=set()
for (idx, prop_values) in enumerate(values):
all_valid=True
for val in prop_values:
this_valid=False
for l, r in conds:
if val>=l and val<=r:
this_valid=True
break
if not this_valid: all_valid=False
if all_valid: this_valid_for.add(idx)
valid_for.append((prop, this_valid_for))
valid_for.sort(key=lambda c: len(c[1]))
print(valid_for)
pairings=list()
for i in range(len(your)):
pairings.append("")
used=set()
for k, vs in valid_for:
if len(vs)==0: continue
found=False
for v in vs:
if v in used: continue
pairings[v] = k
used.add(v)
found=True
assert found, f"{k}, {vs}, {pairings}"
ticket=dict(zip(pairings, your))
p=1
for k, v in ticket.items():
if k.startswith("departure"):
p*=v
print(p)

20
aoc2020/2.py Normal file
View file

@ -0,0 +1,20 @@
count1 = 0
count2 = 0
with open("2.txt") as f:
for line in f:
spec, data = line.split(": ")
nums, letter = spec.split(" ")
lo, hi = nums.split("-")
lo = int(lo)
hi = int(hi)
c = data.count(letter)
if c >= lo and c <= hi:
count1 += 1
a = lo - 1 < len(data) and data[lo - 1] == letter
b = hi - 1 < len(data) and data[hi - 1] == letter
if a ^ b:
count2 += 1
print(count1)
print(count2)

1000
aoc2020/2.txt Normal file

File diff suppressed because it is too large Load diff

35
aoc2020/3.py Normal file
View file

@ -0,0 +1,35 @@
def run_by(right, down):
trees = 0
print((right, down))
with open("3.txt") as f:
idx = 0
for i, line in enumerate(f):
line = line.strip()
l = list(line)
c = line[idx % len(line)]
if i % down == 0:
l[idx % len(l)] = "X" if c == "#" else "O"
print(f"{idx}\t{len(line)}\t{''.join(l)}\t{line}")
if i % down == 0:
idx += right
if i == 0: continue
if i % down == 0:
if c == "#":
trees += 1
print()
return trees
s = [
run_by(1, 1),
run_by(3, 1),
run_by(5, 1),
run_by(7, 1),
run_by(1, 2),
]
print(s)
import math
print(math.prod(s))

323
aoc2020/3.txt Normal file
View file

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

11
aoc2020/3_ex.txt Normal file
View file

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

67
aoc2020/4.hs Normal file
View file

@ -0,0 +1,67 @@
import Control.Applicative
import Control.Monad
import Data.Char
import Data.Functor
import Data.List
import Data.List.Extra (stripSuffix)
import Data.List.Split
import Data.Maybe
import Text.Read
import Data.Set (Set, fromList, isSubsetOf)
data Attr = Byr | Iyr | Eyr | Hgt | Hcl | Ecl | Pid | Cid
deriving (Show, Bounded, Enum, Eq, Ord)
intval :: Int -> Int -> Int -> Maybe Int
intval lo hi n = guard (lo <= n && n <= hi) $> n
nDigits :: Int -> String -> Maybe String
nDigits n s = guard (length s == n && all isDigit s) $> s
hexColor :: String -> Maybe String
hexColor s = guard (length s == 7 && s !! 0 == '#' && all (flip elem "0123456789abcdef") (drop 1 s)) $> s
validEcl :: String -> Bool
validEcl = flip elem ["amb", "blu", "brn", "gry", "grn", "hzl", "oth"]
parseAttr :: String -> Maybe Attr
parseAttr s =
case splitOn ":" s of
[key, value] -> case key of
"byr" -> (readMaybe value >>= intval 1920 2002) $> Byr
"iyr" -> (readMaybe value >>= intval 2010 2020) $> Iyr
"eyr" -> (readMaybe value >>= intval 2020 2030) $> Eyr
"hgt" ->
let inch = stripSuffix "cm" value >>= readMaybe >>= intval 150 193 in
let cm = stripSuffix "in" value >>= readMaybe >>= intval 59 76 in
(inch <|> cm) $> Hgt
"hcl" -> hexColor value $> Hcl
"ecl" -> if validEcl value then Just Ecl else Nothing
"pid" -> nDigits 9 value $> Pid
"cid" -> Just Cid
_ -> Nothing
_ -> Nothing
processLine :: String -> Maybe [Attr]
processLine = mapM parseAttr . splitOn " "
requiredAttrs :: Set Attr
requiredAttrs = fromList $ enumFromTo Byr Pid
combineAttrs :: [Attr] -> Maybe [Attr]
combineAttrs attrs = guard (isSubsetOf requiredAttrs $ fromList $ attrs) $> attrs
processPassport :: [String] -> Maybe [Attr]
processPassport = combineAttrs . concat <=< mapM processLine
processLines :: [String] -> [Maybe [Attr]]
processLines = map processPassport . splitWhen (== "")
countValid :: [Maybe [Attr]] -> Int
countValid = length . filter isJust
main :: IO ()
main = do
content <- readFile "4.txt"
let valid = countValid $ processLines $ lines content
print valid

953
aoc2020/4.txt Normal file
View file

@ -0,0 +1,953 @@
ecl:amb
pid:690616023
byr:1994 iyr:2014 hgt:172cm hcl:#c0946f eyr:2022
eyr:1980 cid:97
hcl:z ecl:#102145 iyr:2011 byr:1945
pid:187cm hgt:179in
ecl:amb
iyr:2011
cid:113
eyr:2021 hcl:#b6652a pid:004682943 byr:1940
hgt:173cm
iyr:2023
cid:146 byr:2022 ecl:dne hgt:76in eyr:2040 hcl:z
hcl:#f97e30
cid:73 iyr:2013 byr:1929 hgt:157cm
eyr:2024 ecl:blu pid:673398662
hcl:5343fe
hgt:152 byr:2018
eyr:1992 pid:85999926 iyr:1938 ecl:#15bd97
byr:1975 hcl:z eyr:1988 pid:#c36f52
iyr:2018
hgt:184cm
byr:1954 eyr:2023 hgt:170cm iyr:2012 ecl:blu pid:299556897 hcl:#b6652a
hgt:191cm ecl:oth hcl:#7d3b0c
iyr:2016 pid:187567535
byr:1999 eyr:2023
pid:814358147 eyr:2022 iyr:2000 byr:2001 hcl:#18171d
ecl:blu
hgt:76in
ecl:hzl
hgt:163cm byr:1955 iyr:2018 eyr:2024 hcl:#6b5442 pid:343362099
eyr:2020 pid:185090160 ecl:#21a5e6
iyr:1928 byr:2006 hcl:a2ebbf hgt:104
hgt:153cm
hcl:#a97842 ecl:blu eyr:2028 byr:1969 iyr:2019
pid:729700590
iyr:2019 byr:1981 hgt:150cm pid:606092356 hcl:#18171d eyr:2026
ecl:grn
pid:760899887
eyr:2023 hcl:#866857 hgt:185cm iyr:2017
byr:1976 ecl:gry
byr:1965 eyr:2026
hcl:#623a2f
ecl:blu pid:483363116 iyr:2010 hgt:178cm cid:204
ecl:oth eyr:2022
pid:268557763 byr:1965 iyr:2015 hcl:#c0946f hgt:164cm
ecl:gry hgt:168cm hcl:#623a2f eyr:2020 cid:163 pid:124082663 iyr:2016 byr:1996
hcl:4c44fb iyr:1957 eyr:2039 ecl:grt hgt:63cm byr:2012 cid:104
byr:2024 iyr:2023
ecl:gry
eyr:2007 pid:170cm hgt:68 hcl:d57b67 cid:333
byr:1956
hgt:169cm iyr:2013 pid:370491367
ecl:gry hcl:#5bc41d
eyr:2023 iyr:2028 byr:1969 ecl:lzr hcl:1989b1 hgt:71cm pid:#12c226
cid:304 pid:866132461
byr:2022
hcl:z hgt:191in ecl:lzr iyr:2029 eyr:1989
ecl:brn hcl:#9a45a7
hgt:176cm
byr:1974 pid:758747330 iyr:2014 eyr:2020
cid:190 ecl:hzl iyr:2014 byr:1990 hgt:69in eyr:2037 pid:384015829 hcl:#ceb3a1
byr:1998 eyr:2022 iyr:2018 hgt:153cm
hcl:#733820 pid:424512443
ecl:blu
hcl:27c41f byr:1972 eyr:1994 pid:777840405
ecl:gry
hgt:179cm
iyr:2021
hgt:166cm eyr:2032 ecl:gry byr:1936
pid:41703652
hcl:#efcc98 iyr:2019 byr:1936 pid:985830958 eyr:2021
hgt:175cm ecl:brn
eyr:2025 pid:972163513 hgt:155cm ecl:brn cid:169 iyr:2015
hcl:#6b5442
eyr:2026
hgt:173cm
byr:1984
cid:191
pid:791209101 hcl:#341e13 iyr:2020 ecl:hzl
hgt:64cm
iyr:2010 byr:1978
pid:618891746 hcl:#d6ac23 eyr:2023 ecl:brn
eyr:2021 hcl:#341e13 iyr:2018 pid:502081929
ecl:blu
ecl:amb
iyr:2018 pid:8933462515
hgt:160cm hcl:e330f0 eyr:2030 byr:2007
ecl:gry byr:1980 hcl:#341e13 iyr:2015 pid:830724822 hgt:167cm cid:156
eyr:2023
ecl:gry hcl:#c39b75 byr:1995 hgt:153cm
eyr:2029 pid:83056475 iyr:2013
byr:1965 cid:250
ecl:oth iyr:2016
pid:242792947 eyr:2025 hcl:#efcc98
byr:2011 ecl:#62fe2d hcl:#2b434a hgt:190cm
eyr:2031 iyr:1964 pid:7096872943
cid:258 hcl:#c0946f pid:698224453 eyr:2029 hgt:189cm iyr:2012 ecl:blu byr:1963
eyr:2028 byr:1942 hgt:156cm pid:836243052 iyr:2016
hcl:#888785 cid:310 ecl:brn
hcl:#a97842 pid:740164307 ecl:oth byr:1997
hgt:166cm
iyr:2015 eyr:2026
hcl:4ee9da iyr:2020
eyr:1933 hgt:136 ecl:#8dee29 pid:44266010 byr:1966 cid:82
ecl:amb byr:1921 hgt:182cm eyr:2026
hcl:#c0946f iyr:2010
hgt:178cm cid:343 eyr:2023 pid:197119382 hcl:#623a2f iyr:2017
ecl:brn byr:2002
eyr:2030 byr:1967 ecl:blu hgt:166cm iyr:2017
pid:655602762 hcl:#6b5442
cid:143 hgt:152cm eyr:2026 iyr:2018 byr:1950 ecl:grn hcl:#866857 pid:067535973
byr:2019 ecl:#e3c288 iyr:1948 hgt:72cm hcl:7da71b eyr:1956
hcl:#cfa07d
pid:688405238 cid:200 byr:1950
iyr:2020 ecl:hzl hgt:170cm
eyr:2026 hgt:164cm iyr:2010 hcl:#b6652a pid:404835595 byr:1924 ecl:blu
iyr:2016 hcl:#866857
ecl:gry
eyr:2023 pid:986813245 cid:247 byr:1977
hgt:173cm
ecl:#a59335 eyr:2023
hcl:033f22 byr:1947 hgt:152
iyr:2029 pid:#1e686a cid:305
byr:2005
ecl:amb hcl:#a97842
iyr:1972
eyr:1967 pid:274884869
eyr:2038 iyr:2018
pid:181cm ecl:xry hgt:185in
hcl:109b28 cid:287
ecl:amb byr:1943 pid:002483342 hgt:178cm
hcl:#c0946f eyr:2030
iyr:2014
iyr:2020 byr:1963 cid:131 hcl:#18171d hgt:181cm pid:146726616 eyr:2021
pid:062629370 byr:1931 hgt:188cm eyr:2021 ecl:gry
hcl:#166b3d
pid:007028786 ecl:blu hgt:156cm byr:1981 hcl:#888785 cid:53 iyr:2019
iyr:2014 hcl:#623a2f
ecl:hzl eyr:2029 byr:1988
pid:849096536 hgt:167cm cid:322
pid:160824363
hcl:#19bed3
eyr:2024 hgt:171cm
byr:1968 iyr:2019
eyr:2024 hcl:#dd66d0
byr:1986
cid:105 pid:816153574 ecl:hzl iyr:2013
hgt:173cm
hcl:#ceb3a1 hgt:62in ecl:gry
iyr:2017 cid:234 byr:1963
eyr:2029
pid:514406488
hcl:#fffffd ecl:blu
eyr:2020 iyr:2010
pid:544347103 hgt:164cm byr:1939
eyr:2021
pid:999479324 hgt:164in ecl:brn iyr:2016
hcl:#a97842 byr:2020
pid:053149570 byr:1920 eyr:2027 hgt:190cm iyr:2011 hcl:#fffffd ecl:oth
hgt:165cm
hcl:#cfa07d
ecl:oth
eyr:2023
pid:186cm
byr:1937 iyr:2012
eyr:2026 hgt:64cm hcl:#ac426a byr:1969
cid:345 iyr:1960
pid:#df648a ecl:blu
byr:1923 iyr:2017
eyr:2027 pid:798497862 hgt:182cm
hcl:#ceb3a1 ecl:oth
hgt:182cm eyr:1990 ecl:grn hcl:#efcc98 byr:1968
pid:005962011
iyr:2010
cid:74 eyr:2020 hgt:71in
iyr:2015 pid:487940408 byr:1952
hcl:#733820
hgt:75cm cid:249
ecl:hzl
hcl:#6b5442 pid:4860441 eyr:2020
ecl:hzl eyr:2025 hgt:183cm
iyr:2020 byr:1993 pid:572766871 hcl:#866857
hcl:#888785 pid:200125941 hgt:155cm byr:1923
eyr:2021 iyr:2010 ecl:gry
pid:502547835 iyr:2014 hcl:#b6652a
byr:1985 hgt:189cm eyr:2024
eyr:2024 hcl:#fffffd ecl:amb byr:1952
pid:724639818
iyr:2013 hgt:183cm
byr:2023
iyr:2026 ecl:gry eyr:2032 hcl:3e0fc4 pid:5620497552
hgt:84
cid:79
hgt:68cm
iyr:2021
pid:#365b83 byr:1928
ecl:#79a6b3 eyr:2027 hcl:54130e
hgt:74cm byr:1953
cid:263 iyr:2018
ecl:zzz
hcl:#efcc98
pid:154cm eyr:1951
cid:272 pid:0638528559 hcl:z hgt:63cm byr:2029 ecl:zzz
eyr:2033
iyr:2016
hgt:193cm hcl:#6b5442 pid:715518898 ecl:brn cid:195
eyr:2025
ecl:oth
eyr:2025 hgt:166cm byr:1944
iyr:2017 pid:814141652
eyr:2025 cid:140 ecl:hzl hcl:#c0946f pid:824866056 iyr:2011 hgt:65in byr:1947
iyr:2016
ecl:brn eyr:2021
hgt:161cm
byr:1984 hcl:#602927 pid:821539320
hgt:175cm cid:190 hcl:#ceb3a1 ecl:brn byr:1927 iyr:2017 eyr:2029 pid:836598854
eyr:2026 ecl:brn hgt:157cm pid:038645205 byr:1995
iyr:2019 cid:339
ecl:brn hgt:70in hcl:#c0946f
pid:535498918 cid:153
iyr:2012 eyr:2030
byr:1995
hcl:#efcc98 hgt:174cm eyr:2030 pid:180839761
ecl:grn iyr:2010
hgt:59cm eyr:2035 byr:2021 iyr:2012 ecl:hzl pid:219328725 hcl:#888785
ecl:oth hgt:184cm byr:1984 iyr:2016
hcl:#cfa07d
iyr:1998 byr:2024 ecl:lzr hgt:187 hcl:z eyr:1935 pid:#789b56
iyr:1967 hcl:z pid:828930046 hgt:59in
cid:153
byr:2021
ecl:grn
eyr:1935
byr:1991
hcl:#341e13 ecl:gry iyr:2018
hgt:67in pid:157970631 eyr:2021
byr:1941 hgt:169cm pid:322510952 hcl:#cfa07d cid:75 ecl:oth
eyr:2021 iyr:2020
hcl:#7d3b0c iyr:2013 cid:78 hgt:167cm ecl:brn byr:1974 pid:237404828
pid:1567157833
hcl:#7d3b0c iyr:2025 eyr:2023
byr:2002 ecl:oth hgt:191cm
ecl:amb iyr:2014 hgt:182cm pid:526612838
cid:287 eyr:2025 byr:1988
hcl:#866857
hcl:#866857 hgt:174cm byr:1992 eyr:2028 iyr:2015
eyr:2029
hgt:190cm
hcl:#18171d
cid:245
ecl:oth pid:3636033742 byr:2024
iyr:2019
byr:1972 hgt:163cm eyr:2020 hcl:#b6652a
pid:360516396 iyr:2019 ecl:grn
iyr:1997 ecl:#be02d2
eyr:2020 cid:259 byr:1953
hcl:#6b5442
hgt:177cm pid:978155362
pid:377596476 cid:153
eyr:2025 byr:2000 hgt:181cm iyr:2014 hcl:#abc5cb ecl:hzl
cid:171 ecl:lzr iyr:2013 eyr:1973 byr:2004
pid:#267099 hgt:101
hcl:#623a2f
pid:029193661
hgt:183cm
ecl:hzl eyr:2029 iyr:2013
byr:1977
ecl:amb eyr:2021 hgt:159cm byr:1970 cid:152
hcl:#b6652a iyr:2020 pid:180512119
eyr:2025
ecl:grn
hgt:60in iyr:2013 pid:697352361
hcl:#18171d byr:1989
byr:1934 hgt:165cm pid:703537570 ecl:hzl iyr:2015
hcl:#888785
ecl:gmt
hcl:6dd6a5
byr:1951
pid:#7ab761 cid:304 iyr:1924 eyr:1953 hgt:71in
ecl:amb hcl:#733820 eyr:2030 hgt:178cm
pid:692422832 iyr:2019
cid:276
iyr:2012 ecl:oth
pid:674969358
eyr:2027 hgt:157cm cid:247 hcl:#a97842
byr:2017 eyr:2031 hgt:180cm hcl:#ceb3a1 pid:372071110
iyr:2015 ecl:amb
hgt:165cm iyr:2015
eyr:2021 ecl:amb byr:2000 cid:235
eyr:2027 hcl:#623a2f pid:595874068
ecl:amb
hgt:177cm iyr:2019 byr:1929
pid:8150929412 hgt:191in eyr:2031 cid:233 byr:2027
iyr:2026 ecl:#e94348 hcl:z
hgt:65 byr:2009 iyr:2029 hcl:#fffffd eyr:1950 pid:950012410 cid:212 ecl:#5a6042
ecl:#44c561 hgt:178cm eyr:2021 pid:753771724
iyr:2014
hcl:#70adb2 byr:1989
iyr:2018 pid:809109448 ecl:amb hcl:#b6652a hgt:63in byr:1976 cid:96
byr:2021 ecl:grn pid:9284377919 iyr:2011 hgt:75cm hcl:#18171d eyr:2026
ecl:oth
byr:1926
hgt:63 iyr:1948 cid:61 hcl:a528d1 eyr:2034
byr:1978 pid:150503169 iyr:2015 ecl:grn hgt:172cm cid:70 eyr:2022 hcl:#7d3b0c
byr:1957 hcl:#cfa07d iyr:2010 ecl:amb eyr:2025 pid:921901279
ecl:utc pid:154cm
byr:1964 eyr:1978 hgt:114 hcl:z
byr:1929 ecl:amb eyr:2028 iyr:2013
hcl:#fffffd pid:479814281
cid:105 hgt:64in
pid:949640425
cid:205 hcl:#341e13 ecl:amb
hgt:171cm byr:1998
hgt:190cm cid:113 ecl:grn eyr:2037
hcl:#ceb3a1 pid:7994792779 iyr:2011
hgt:152cm iyr:2010
byr:1992 eyr:2020
hcl:#602927
cid:66
pid:604149642
eyr:2028
byr:1961 hgt:71in
iyr:2013 cid:135
pid:534090716 hcl:#ceb3a1 ecl:oth
iyr:1937 byr:1995 cid:200
eyr:2037 pid:#daf9af
hcl:052017 ecl:zzz hgt:73cm
ecl:amb
hcl:#a97842
iyr:2018
hgt:153cm
cid:149 eyr:2023 pid:533403632
cid:275 ecl:brn iyr:2017 pid:087665205 byr:1945 hcl:#7d3b0c
eyr:2025
eyr:2030 hgt:177cm hcl:#cfa07d iyr:2018 pid:734113761
byr:1965
hgt:163cm byr:1924 ecl:blu cid:125
eyr:2027 hcl:#fffffd pid:137238888
hgt:174cm hcl:#623a2f eyr:2023 ecl:gry pid:585758460
iyr:2011
cid:183
byr:1928 pid:471385060
hgt:192cm
ecl:oth iyr:2010 hcl:#623a2f eyr:2020
hgt:177cm
cid:273 ecl:oth eyr:2020
hcl:#efcc98
iyr:2012 pid:246299733
byr:1954
pid:052203766 cid:146 ecl:hzl byr:1974 hcl:#6b5442
eyr:2030 hgt:173cm
iyr:2011
hgt:167cm
byr:1972 iyr:2010
pid:783359411 ecl:hzl hcl:#9f8cc9 eyr:2028
iyr:2020 hcl:#18171d ecl:grn
byr:1992
hgt:189cm
eyr:2023 pid:736882272
cid:230 ecl:utc iyr:2022
pid:170cm
byr:2015 hcl:#c0946f
eyr:2031
cid:261
byr:1922 hgt:170cm ecl:brn eyr:2021
pid:593276915 hcl:#18171d
iyr:2017
hcl:#341e13 pid:038417039 hgt:61in eyr:2025 iyr:2017
cid:117
iyr:2017 eyr:2026 pid:441484223
hgt:155cm byr:1968 hcl:#ceb3a1 ecl:hzl
eyr:2021
hgt:64in
ecl:oth hcl:#b6652a byr:1954 pid:204959612 iyr:2016
hcl:z eyr:1969
pid:162cm ecl:#944b0f
iyr:2030 byr:2029
hgt:114 eyr:2034 byr:2026 hcl:84fa1a
pid:47909473
iyr:2028
ecl:utc
eyr:2025 ecl:blu hgt:157cm iyr:2014 hcl:#a97842 byr:1974 pid:702610675 cid:241
pid:732388109
hcl:#6b5442 cid:272 eyr:2026 hgt:193cm
ecl:amb byr:1982
eyr:2030 byr:1994
hgt:177in ecl:amb pid:1589147420 iyr:2011 hcl:#4bf920
cid:252
ecl:oth eyr:2022
byr:1948
pid:177cm cid:90 hgt:102 hcl:z iyr:2028
hgt:157cm pid:233347213
hcl:z
byr:2009 eyr:2027 cid:235 ecl:blu
iyr:1965
ecl:blu iyr:2030 eyr:2028 hcl:#18171d pid:322593908 byr:1954
cid:215 hgt:63in
hgt:72cm
cid:345 pid:911728732 eyr:2025
byr:2004 ecl:#0c4af7 hcl:3bb675
pid:171714794 byr:2019
hcl:#866857
cid:290 hgt:183in ecl:#d0c30f eyr:2032
iyr:2016 pid:905945155 hcl:#ceb3a1 byr:1958 hgt:159cm eyr:2028 cid:180 ecl:oth
hcl:efb614
eyr:2022 hgt:177cm pid:46962273
byr:1974
ecl:#089bdd iyr:1988
pid:662993164 iyr:2011 eyr:2025 ecl:hzl
byr:1942 hcl:#fffffd
hgt:175cm
hcl:#7d3b0c iyr:2016 hgt:175cm eyr:2022 pid:953132241
byr:1963 cid:261 ecl:grn
iyr:2013 hgt:180cm cid:318
ecl:amb
byr:1985 pid:439097817 eyr:2029 hcl:#602927
hgt:162cm ecl:blu
pid:675749832 cid:73
byr:1940 hcl:#888785
eyr:2026
pid:275352007 iyr:2012 eyr:2020
ecl:amb hcl:#623a2f hgt:175cm cid:317 byr:1988
hcl:z hgt:164in
iyr:2026 eyr:1961 ecl:#2df35e pid:#5c9ed5 cid:341
pid:848086119 ecl:oth eyr:2021 iyr:2011 hgt:180cm byr:1923 hcl:#93461b
eyr:2028
iyr:2014
byr:1978
hgt:184cm
pid:966277564 ecl:hzl
cid:176
hcl:#888785 ecl:amb cid:329 pid:835961958 byr:1927 eyr:2028 iyr:2016
pid:160cm eyr:2026 hcl:#08714b
ecl:hzl iyr:1961
hgt:156cm byr:1984
ecl:gry cid:302
byr:1965
iyr:2019 hcl:#ceb3a1 eyr:2027 pid:458192010 hgt:156cm
pid:058273969 byr:1942 eyr:2027
hcl:#c0946f iyr:2013 hgt:179cm
iyr:2019 hgt:193in pid:52144528 eyr:2036
cid:169 ecl:grt hcl:7e7039
hgt:192cm ecl:blu iyr:2015 pid:544936486 eyr:2024
byr:1972 hcl:#c0946f
eyr:2000
hcl:78de23 byr:2020
hgt:171in pid:160cm cid:68
iyr:1956 ecl:gmt
hcl:#733820 ecl:grn iyr:2018
byr:2001 pid:770957230
cid:103 ecl:grn iyr:2018
pid:068344094
eyr:2023 hgt:69in byr:1984 hcl:#6b5442
hgt:193cm eyr:2021 ecl:grn hcl:#602927 byr:1938 iyr:2011
iyr:1931
hcl:c0a318
pid:99195939
byr:2028 ecl:grt hgt:164 eyr:2017
eyr:1980
ecl:zzz
hgt:98 cid:161
pid:#96fe01 hcl:z
iyr:1974
byr:1936 hgt:176cm pid:56797167 iyr:2015
ecl:#07ad47
hcl:z
pid:48720181 hcl:270e76
byr:2022
hgt:180cm ecl:#dde399
eyr:2035 iyr:2023
eyr:2030 byr:2022 iyr:2018 hgt:162in ecl:gry
hcl:#63e2ec pid:615812600
ecl:grn
cid:56 hcl:#623a2f eyr:2020 hgt:167cm byr:1971 iyr:2012
pid:262692066
hgt:61 hcl:#efcc98 iyr:2011 eyr:2026
byr:1938
ecl:amb pid:385025739
pid:972423724 hcl:#602927 eyr:2027 ecl:oth iyr:2015
hgt:158cm byr:1956
pid:530035096
ecl:hzl
iyr:2017
eyr:2024 hcl:#888785 byr:1962 hgt:64in
byr:1935 eyr:2022 ecl:grn hcl:#7d3b0c pid:294714199
eyr:2029
iyr:2013
byr:1927 hgt:175cm pid:058261075 hcl:#cfa07d ecl:amb
ecl:blu pid:188764763 hgt:155cm byr:1921
iyr:2018 eyr:2029 hcl:#b6652a
byr:1975 hcl:930e76 iyr:2019
pid:169cm eyr:2009 hgt:191
ecl:#d28c56
hcl:z
pid:3190617557
hgt:160cm cid:80 ecl:oth iyr:2022 eyr:2008
byr:2016
hcl:#888785 byr:1999 ecl:blu cid:238 iyr:2018 hgt:160cm
eyr:2028 pid:174517111
eyr:2035
hcl:z byr:2020
pid:262135957 cid:324 iyr:2016 hgt:161cm ecl:grn
byr:1936
ecl:grn
iyr:2013 hcl:#623a2f eyr:2029 hgt:166cm
hcl:#cfa07d hgt:159cm eyr:2021
ecl:hzl
iyr:2014 pid:816039817 byr:1935
pid:596634790 hgt:161cm
eyr:2036 iyr:2016
hcl:#7d3b0c byr:2015 ecl:brn
byr:1952
hgt:157cm eyr:2024 cid:60 pid:876160626
ecl:blu iyr:2011 hcl:z
hgt:193cm iyr:2020 eyr:2026
pid:0136642346 ecl:hzl hcl:#efcc98 byr:1995
byr:1934 hgt:177cm
pid:445993865
ecl:brn iyr:2018
eyr:2030
hcl:#733820
eyr:2021 hgt:71in
pid:918630878
hcl:#602927 iyr:2017 byr:1943
ecl:gry
ecl:#81de2c iyr:2021 hgt:176cm eyr:1947 hcl:#888785 pid:1370052400
ecl:amb
byr:1922 iyr:2012 eyr:2022 pid:098866466 hcl:#18171d hgt:63in
eyr:2028 iyr:2010 hcl:184355
byr:1968 pid:337089458 ecl:brn hgt:181cm
hcl:#733820 pid:225958483 ecl:gry eyr:2030 hgt:62in iyr:2012 byr:1987
eyr:1955
hcl:03199c
pid:#3e832e
byr:2014 ecl:#453931 hgt:70cm
byr:1975
ecl:blu hcl:#7d3b0c
cid:169 pid:582470437 hgt:151cm
iyr:2019 eyr:2027
iyr:2017 byr:1971 pid:343492418 hgt:150cm hcl:#fffffd eyr:2024
byr:1997
eyr:2026
cid:257 hcl:#7d3b0c ecl:blu hgt:166cm iyr:2016 pid:117625518
iyr:2014 cid:248 hgt:165cm hcl:#18171d pid:294270262
byr:1925 ecl:amb
eyr:2028
hgt:167in ecl:dne pid:174cm iyr:2019 byr:2005 hcl:b29331 cid:86
hcl:#733820 pid:259969636 eyr:2023
ecl:hzl cid:317
hgt:185cm byr:2025
iyr:2012
hcl:#cfa07d hgt:152cm pid:807755992 iyr:2020
byr:1922 ecl:grn eyr:2025 cid:241
pid:997807107 byr:1958 ecl:dne iyr:2013 eyr:2023 hcl:#18171d
hgt:152cm
ecl:blu hgt:170cm
byr:1932
pid:775223495 eyr:2024 iyr:2015
iyr:2011
ecl:grn hcl:#ceb3a1 pid:190577415
hgt:63in
eyr:2021
byr:1986
ecl:oth eyr:2025 hgt:180cm
pid:258195402 iyr:2017
byr:1961
cid:109 hcl:#888785
hgt:178cm byr:1952 eyr:2023 hcl:#733820
pid:106939563 ecl:brn iyr:2012
hgt:188cm iyr:2012 hcl:#fffffd byr:1942
ecl:brn pid:804371742
byr:1978 cid:120
eyr:2026 pid:405714523 hgt:60in
hcl:#a97842 ecl:blu
iyr:2017
iyr:2015 byr:1958 ecl:grn
hcl:#b6652a pid:#9e8af3
eyr:2026 hgt:167cm
hgt:171cm hcl:#888785
cid:274
ecl:grn pid:919263460 eyr:2023 iyr:2020
pid:606726472 eyr:2022
byr:2008
ecl:zzz cid:72 hgt:173in
eyr:2032 byr:2004
hcl:z iyr:2011 ecl:hzl
pid:523494728
hgt:70cm
hgt:169cm pid:755822781 byr:1984 ecl:hzl hcl:#6b5442 iyr:2014
eyr:2020
byr:1942 cid:85
hgt:157cm pid:558287447 hcl:#efcc98
ecl:hzl
byr:1980 cid:225 pid:367501996 iyr:2016 ecl:grn hcl:#efcc98
hgt:175cm eyr:2029
pid:264780775 hgt:182cm ecl:grn
hcl:#18171d
eyr:2024
byr:1926 iyr:2013
byr:1969 iyr:2015
eyr:2026 ecl:blu
hcl:#fffffd
pid:005695878 cid:273
ecl:brn byr:2006 hgt:152cm
hcl:#888785
pid:171cm cid:249 iyr:2026
eyr:2022
byr:2011 iyr:2020 ecl:zzz hcl:z pid:412624100
eyr:2031
cid:111 hcl:df9bd0
iyr:2022 ecl:#32fdf9
byr:2017 eyr:2000
hgt:166in pid:0654651026
eyr:2021
ecl:gry pid:587324819 hgt:187cm byr:1951 hcl:#6b5442
iyr:2011
pid:180780096 hcl:#623a2f ecl:amb hgt:160cm byr:1991 eyr:2026
byr:2022 hgt:152cm eyr:2023 cid:70 ecl:grn
hcl:e0a24e
iyr:1959 pid:77110462
pid:251982311 byr:1994 ecl:gry hgt:165cm eyr:2021
hcl:#623a2f
iyr:2019
ecl:blu byr:1945
cid:241
pid:732768808 hcl:#efcc98
hgt:171cm eyr:2020 iyr:2012
cid:243 eyr:2001
hcl:01a022
hgt:162 pid:507703455
byr:2003 ecl:#c6a07b
iyr:1941
hcl:#733820 cid:150
ecl:hzl pid:843607639 hgt:190cm
byr:1958
eyr:2025
eyr:2030
pid:489370607 iyr:2014 ecl:oth hcl:#cfa07d byr:1995 hgt:193cm
hgt:68in
byr:1933
iyr:2010 ecl:brn
pid:380075958
hcl:#623a2f cid:279
eyr:2025
iyr:2019
byr:2001
hcl:#cfa07d ecl:brn pid:349877352
hgt:161cm eyr:2029
hgt:171cm
eyr:2040 ecl:dne hcl:#6b5442 iyr:2020 byr:1990
hcl:#fffffd
hgt:154cm
byr:1979 eyr:2020 iyr:2018
pid:118713281 cid:174
hcl:#7d3b0c eyr:2030 ecl:brn iyr:2017
cid:184 hgt:180cm pid:504181498 byr:1925
hgt:150cm
eyr:2020 byr:1999 hcl:#a97842 iyr:2011 ecl:grn pid:620166468
hcl:#602927
iyr:2015
byr:1928
pid:083747352
eyr:2027 hgt:193cm
ecl:hzl
byr:1938 ecl:gry
pid:511669464 eyr:1973 hgt:70cm
cid:262 iyr:2015 hcl:#c0946f
eyr:2029
byr:1923 hgt:160cm hcl:#7d3b0c iyr:2013 pid:525837692 ecl:gry
hcl:#602927 eyr:2025
pid:232338168 hgt:174cm cid:322 iyr:2010 ecl:oth
hgt:192in cid:126 hcl:#6b5442
pid:101406211 byr:1922 ecl:hzl eyr:2022 iyr:2013
eyr:2026 ecl:amb
byr:1921
cid:336
iyr:2020 hgt:182cm pid:533626984
pid:411943955 ecl:amb eyr:2025 hgt:166cm byr:1964 hcl:#341e13 cid:285
iyr:2010
ecl:grn byr:1933 eyr:2024
hgt:153cm
hcl:#5cfb31 iyr:2019 pid:773885967
ecl:hzl pid:426060511
hgt:159cm
byr:1922 hcl:#6ffd04 iyr:2017
byr:2025 pid:#097d1b iyr:2020 eyr:2029 hcl:73d113 hgt:69cm ecl:utc
ecl:amb hgt:170cm eyr:2025 byr:1930 iyr:2018 hcl:#733820
cid:262
iyr:2019
eyr:2021
cid:65 pid:258615618
ecl:oth byr:1987
hcl:#efcc98
hgt:178cm
hcl:z eyr:1980 ecl:#1c5fd1 hgt:65cm byr:2014
cid:222 pid:#c69fd5 iyr:2020
cid:271 pid:#4b8380 hcl:80fab0
byr:2024 ecl:#20e25f
iyr:1945
eyr:1935 hgt:159cm

13
aoc2020/4_ex.txt Normal file
View file

@ -0,0 +1,13 @@
ecl:gry pid:860033327 eyr:2020 hcl:#fffffd
byr:1937 iyr:2017 cid:147 hgt:183cm
iyr:2013 ecl:amb cid:350 eyr:2023 pid:028048884
hcl:#cfa07d byr:1929
hcl:#ae17e1 iyr:2013
eyr:2024
ecl:brn pid:760753108 byr:1931
hgt:179cm
hcl:#cfa07d eyr:2025 pid:166559648
iyr:2011 ecl:brn hgt:59in

26
aoc2020/4_ex2.txt Normal file
View file

@ -0,0 +1,26 @@
eyr:1972 cid:100
hcl:#18171d ecl:amb hgt:170 pid:186cm iyr:2018 byr:1926
iyr:2019
hcl:#602927 eyr:1967 hgt:170cm
ecl:grn pid:012533040 byr:1946
hcl:dab227 iyr:2012
ecl:brn hgt:182cm pid:021572410 eyr:2020 byr:1992 cid:277
hgt:59cm ecl:zzz
eyr:2038 hcl:74454a iyr:2023
pid:3556412378 byr:2007
pid:087499704 hgt:74in ecl:grn iyr:2012 eyr:2030 byr:1980
hcl:#623a2f
eyr:2029 ecl:blu cid:129 byr:1989
iyr:2014 pid:896056539 hcl:#a97842 hgt:165cm
hcl:#888785
hgt:164cm byr:2001 iyr:2015 cid:88
pid:545766238 ecl:hzl
eyr:2022
iyr:2010 hgt:158cm hcl:#b6652a ecl:blu byr:1944 eyr:2021 pid:093154719

37
aoc2020/5.py Normal file
View file

@ -0,0 +1,37 @@
def search(n):
first7 = n[:7]
lo = 0
hi = 128
for c in first7:
mid = (lo + hi) // 2
if c == "F":
hi = mid
elif c == "B":
lo = mid
x = lo
last3 = n[-3:]
lo = 0
hi = 8
for c in last3:
mid = (lo + hi) // 2
if c == "L":
hi = mid
elif c == "R":
lo = mid
y = lo
id = 8 * x + y
return id
ids = []
with open("5.txt") as f:
for line in f:
line = line.strip()
id = search(line)
ids.append(id)
ids.sort()
print(ids)
print("ajsdoifapjds")
for i in range(len(ids) - 3):

782
aoc2020/5.txt Normal file
View file

@ -0,0 +1,782 @@
FBBBFBBLRR
BFFFBBFLRR
BFBFBBFLLR
BBFFFFBLLR
FBBFBBFRLL
BBFFFFBRLL
FBBFBFFLLR
BFFBBBFRRL
FFBFBFFRLR
FBFFFFBLLL
FBFFFFFLRL
FFFBFBBRLR
FFBFFFFLLL
BFBBBFFLLL
FFBBBFBRLR
BFFBFBFLLL
FBFBFFFLLL
BBFFBBBRRL
FBFFBFBLLL
BFFBFBFRRL
FBFBFFFRLR
BFBBBFBRLL
FFBBFBFLRL
FBBFFBFRRR
BFBBBBBLRL
FFBFBFBLRL
FFBFFFFLRL
BFBFBFBRRR
FBBBBBBRRR
BFBFFBBRLL
BBFFBFBLLL
BFBFBBFRLL
FBFBBBBRLR
BFFBBFBRRL
BFBBBFBRRR
FBBBFBBLRL
BBFFBBBLRL
FFBBFFFRRR
FBFFBFFLLL
FBFFBBFRLL
FBBBFBFRLL
BFFBBFFLRL
FFFBFBBRRR
BFBBBBFRLR
FBFBFBBRRL
BFFFFFFRRL
BFBBBBFRRL
FBFBBFFRRL
FBFFBFFRLR
FBBFFBBRRR
FBFBBFFRRR
FFFBBFFRLR
BBFFBFBRRL
FBBBBBFRRR
BFBBBBBRLL
BFFBFFBLRL
FBBBFFBRRR
BFFFBBFRLR
FFBFBBBRLL
BFBBBFFRLL
BFBBFBFRRR
FBFBFBBLLL
BBFBFBBRLL
FBBFFBBRLR
FFBBFBFLRR
FBFFFFFRLL
BFBFBBBRLR
FBFFFFBLRR
FBFFFFBRLL
BFFFFFFRLL
BBFBFFFRRL
BFBFBBBRRR
FFBFFFBLRL
BFFFBBBLLR
FBFFBFFRLL
FFFBFBBLRL
BFBFBBFRRL
FFBFFBBRLL
FBBFBFFLRR
FBFFFFFLLR
FFBFFBFRLL
FFBFFBFLRR
FBFBBBFRLR
FFBFBBFLLR
BBFFBFBLLR
FFBBBBBRRL
BFFBBBBRLL
FFBFBFFLLL
BBFFFBBRRL
FFBFFBFRRL
BBFFBFFRLR
FBFBBFFRLR
FBBFFBFRRL
FBBBFBBRRR
FFBBBBBRRR
BFFBBFBRLL
BFBFBBFLLL
FFBFBBBRRR
BBFFFBBRRR
BFFBFFBLRR
FFFBBFFLRL
BFFBBBFRLR
BFBBFBBRLL
BFBBFBBLLL
FFBFBFBRRL
BFFBBFFRRR
FBFBBBBLLL
FBFFFBFRRR
BFFBFFFLRL
FFFBFBBRRL
FBFBFBBRRR
FBBFBFBLLR
FBBBFFBRLR
FBFBFFBLLR
FBFFBBBRLL
FBFFFBBLRR
BFFFBFFLLL
BFBBBBBLLR
FFBBFFBRLR
BFBFBBFLRL
BBFFBBBRRR
FFBBFFFLRR
BFBFFFFRLR
BFBBBFBRRL
BFFBBBBRLR
BFFBFBBLLR
BFFBBFFLLR
FBFFBBBRLR
FBFFBBBLLR
BBFFBFFLLL
BFFBFBFRRR
BFBFFBFRLR
FBFFFBBLRL
FBBBFBFRRL
BBFFFFBLLL
FFBBBFFLRL
BFFBFFFRLR
FBBFBBFLLL
FBFFBFFRRL
FFBFFBBRLR
BBFFBFFLRR
FBFBBBBLLR
FFBBBFFLRR
BFBBFBFLLR
FBBFBBFLLR
FFBFFBBRRL
BBFFFFBRRL
FBBBBFBRRL
FBFBFFFLLR
BFBFBFBLLR
FFBFBFBRRR
BFFFBFFLLR
BBFFBFFRLL
FBBBFFBRLL
FBBFFFFRRL
FBBBFFFRRR
BBFFFBBRLL
BFFBBFFLRR
BFFBFBBRLR
BFFBFBBLLL
BBFBFFBLLR
FBBBBFFLLL
BFFBBFBLRL
FBBBBFBRRR
FBBFBBBRRL
BFFBBFFRLL
BFFFFFBLLR
BFFBBFBLRR
FFBBFBFRRR
BFBFFBFRRL
BFFFFBBLRR
FFFBBFBLRR
BFFFBBBLRR
FFBFBBFLRL
FBBBFFFLLL
FBFBFBFLRR
FFFBBFBLLL
FFBBFBBLLR
FBBFBBFLRL
FFBFFBBRRR
FBBBBFFRRL
FFFBBBFRLR
FBBFFFBLRL
BFFBFBBLRL
BFFBFBFLRR
BFFBFFBRRR
FFBFBBBRRL
BFFBFFFLLR
BFFBBFBRLR
FBBBFFFRRL
BBFBFFBLRL
BBFFFBBLLR
FBFBFFFRRR
BFFFBBBLRL
FBFFBFFLLR
BBFFFFFRLL
FFBFFFBLLL
BFBBFBBRLR
BFFFFFBLLL
BFBBFFFLLL
FFBBBBFRLR
BBFFFFFLLR
BFFFFBFLRL
FFBFFBBLLR
BBFFBFFLLR
BFBFFBFRRR
FBFFBFFRRR
BBFFFBFLLL
FFBFFFFRRL
FBBFBFFRRR
FFBBFBBRRL
FFBBBFFLLR
BFFFFBBLLR
FFBFBFBLLR
BFFBBBBLLR
FBBBBFBLLL
BFBFBBBRLL
FFBFBBFRRR
FFFBFBBLLR
FFFBBFBRRR
FFFBBBBLRR
FBBFFFFLRL
FFFBBFFLRR
FFBFBFFRLL
FBBFBBBRLR
FFBFBFBRLR
FBBBFFBLRL
BFFFFFFLRL
BFFBBBBLRR
FBBFFBBLRR
BBFFBBFRRL
FFBFBBBLLR
FFBFFFFRRR
FBFFFBBRRL
BFBFFFBLLR
FBBFBFBRRL
BBFBFFBRLR
FBBBBBFRLR
BFFBBBFLRR
BFFFFFBLRR
BBFFBBFRLL
FFFBBFFRRR
FBBBBFFRLL
FFBFFFFRLR
BFFFBFFRRL
FBBBBFFLRL
BBFBFFFRLL
BBFFFBBLRR
FBBBFFFLLR
BFFBFBFLRL
FFBBBBFLLL
BFFFBFFRLL
FBBFFBFLLR
BBFBFBBRRR
FFBFFFBRLL
FBFBBBFRLL
BFBBFBBLRR
FBBBBFFRLR
BFFBBBBLLL
FFFBBBBRLR
FBBFBBBRLL
FFBBBFBLRL
BBFBFFBLRR
FFBBFFFLLR
FFBBFBFRLR
BFBBBFBRLR
FBBFFFFLLL
BBFFFBFRRR
FFBFBBFLLL
FBBFBBBRRR
BFBBFFBRRR
FBBFFBFLLL
FFBFBBBLRL
FBFBBFBRRR
FBFBFFFRLL
BFFFFFFLLR
FBFBBBFLLR
BFBFFBFRLL
BFBFFBBRLR
BFFBBFBLLR
BFFBFBBLRR
BFBBBFFLRL
BFBBFBFLRR
BFBBBFFRLR
FFFBBFFRRL
BFFFBBFRRL
BFFBFBFLLR
BFBFFBBLRR
BFBBBBBRRR
FFBBFBBLRR
BFFBBFFRLR
FFBFBFBRLL
BFBBBBFLRL
FBBFBBFLRR
FBFBBBFLRL
FBFFFBBRRR
BBFBFFFRRR
FBFFBFBRLL
FBBBBBBRLL
FFBBBFFRRL
FFBBFFFRLL
FBFBBFBRLL
FFFBBBBLLL
BFBFBBBLLL
FFFBBBFLLR
FFBFBBFRLL
BBFFBBBLLR
FFFBBFBLRL
FFBBFBBLLL
FBFFFBFRLR
BFBBFBBLRL
FFFBFBFRLR
BFBFFFBRLR
FFBBBBBLLL
FBFBFFBRRR
BFFBBBBRRL
FBBBBFBLLR
BFBBFBFRRL
BBFBFBFLLR
BFFFBFBRRR
FFFBBFBRRL
BFBBBBFLLR
FBBBFBFLLR
FFBFFBFLRL
BFFFBFBLLL
BFBBBBBLRR
BFBFBBBLRR
BFFBFBBRLL
FFBFBFFLRL
FBBBFBBRRL
BFFBBFFLLL
FBFBFFBRLR
FBBFFFFLRR
FBBFBFBLRL
BBFFBBBLRR
BBFFBBFLLL
FBBBBBBRRL
BFFFFBFRRL
BFFFFBBLRL
BBFFFBFRLL
BFFBBFFRRL
FBBBFBFRLR
FBFFBFBLLR
FFBFFFFLRR
FBBBBBBLRL
FFBBFBBRLL
FFBBFBBLRL
FBFFFBBRLR
FFBBFFFLLL
BFFFFBFRRR
BFBFBFBLLL
FFFBBFFLLR
FBBBFBBRLL
BFFFFBBRLL
FBFBFFBRRL
BFBBBFBLLR
BFFBBBBRRR
BBFFFFFRLR
BFFFBBBRRL
BBFFFFFRRL
BFFBFBFRLL
BBFFFFFLRR
FBFBBBBLRR
FBFFBBBLRL
BFBFBFFRLL
FFFBBBBLLR
FBFBBBBRRR
FBBBBBFRRL
BFBFFFBRRL
BFBFFFBRRR
BBFBFBBLRR
FFBBBFBLLR
FFBBBFBRLL
BFBFFFFLLR
BFBFBFFLRL
FBFFFBBLLR
BFFFFFBRLL
BBFBFBBRRL
BFBBFFFRLL
BFFFFFFRLR
FBFFBFBRRR
BBFFBBFRRR
FFBBBFFRRR
FFBBBFFLLL
BFBBFFFLRR
FBBFFBFLRL
FBFFFFBLLR
BFBBBFBLRL
BFFBBBFRRR
BFBBBFFLLR
BFFFBBBRRR
BBFBFBFRRR
FFBFFBFRLR
FBBFFFFRLR
BFBFBBFRRR
BBFFBBFLRR
FBBBFFBLRR
BFBBFFBLRL
FBFBBBBRRL
FFFBBBFLRL
FBBFFFBRLR
FFFBBFFLLL
BFFBFBBRRL
BFFFBFBLRR
FBBFFFBRRR
FBBFFFBRRL
FBBBBBBRLR
FBFFFBFLRL
BBFFBFBLRL
FBBFFFBLLR
BFBFFBBRRR
FBFBBFFLRR
FBBFFBBLLR
FFBBBFFRLR
BFFBFFFLLL
FBBFFFFRLL
BFBFFBBLRL
BFBFFBFLLR
BFBBFFFRRR
BBFFFBFRLR
FBFBBBFRRL
FFBBFBBRLR
BFFFFFFRRR
BBFBBFFLLL
BBFBFFBRRR
FBBFFBBLLL
FFBFBFBLRR
BFBBFFFRRL
BBFBFFFLRR
FBBBBFBLRL
FBBFBFBRRR
FBFBFBBLRR
FBFFBBBLLL
FFBFBFFLRR
BFBFBFFRRR
BFBFBFFLRR
BFFFFFFLRR
FBFBFBBRLR
FFBFFFFRLL
FBBBFBFLRL
BFBFBBFLRR
FFBBFBBRRR
FBFBFFFLRR
BBFBFFBRRL
BFBFBFFLLL
FBFFBFBRLR
FBBBBBBLLR
FFBBBBFRLL
BFBFBBBLLR
FBFBBBBRLL
BFBBBBFLLL
FBFBFFBLRL
FFFBBBBRRR
BFFFFBFLLR
BBFFFFBLRR
BBFFFBFRRL
FBBFBFFLLL
BFFFBFBRLL
FBBBFFBRRL
FFFBFBBLRR
BBFFBBFLRL
BBFFBFFRRR
BFFFFBFRLR
FBFBBFBLRL
FBFFBBFLLL
FBFFFBBLLL
FFBBFFBLRL
FBBFBBFRLR
FBBFBBBLRL
FBFFFBBRLL
BFBFBBBRRL
BFBFBFBRLR
FBFFBFFLRR
BFFFBFFLRR
BFBBBFFLRR
FBBBBBFLLL
FFBFBFFRRR
BBFFBFFRRL
BFBBBFBLLL
FFBBFBFRLL
FBBBFBFRRR
FBFFBBBLRR
BBFFFFBRRR
FBFBFFFRRL
BFFFBBFLRL
FBBFFFBLLL
BFBBFFBLLR
BFBBFFBLLL
FBFFBBFRRR
BFFBBFBRRR
BFFFFFBRLR
FBBBBBBLLL
FFBFBBFLRR
FBFBFBBRLL
BBFBFFFLLR
BFFFFBBRRL
BFFBFFBLLR
BFFFBBFRLL
BBFFFFFLRL
FBFFFFFLLL
BBFFBBBRLL
BFBBFFBRRL
BFFFBBBRLL
FBFFBBFLRL
BBFBFFBLLL
FBFBBFBLRR
FFFBBBFLRR
BBFBFBFLRR
BFBBBBFRRR
BFFFBFFLRL
FBFFFFBRRL
BBFBFBFLLL
BFFFBBBRLR
FBFFBBFRRL
FBBFFBBRRL
FBFBFBFRLR
BFFBFFFRRL
FFFBFBBLLL
BFBBFBFRLL
BFFFBFBLLR
FBBFBBFRRL
FBBBBBFLRR
FBFFBFBLRR
FBBBFFBLLL
BFBBBFFRRR
BFBFFFFLRL
FFBBFFBRRL
BFFFFFFLLL
FFBFFBBLRL
FFFBBBFRLL
BFFFBBFLLL
FBBBFBBRLR
BBFBFFFRLR
BFFBFFBLLL
FFBBFBFLLR
FBFFBBBRRR
BFBFFBFLRR
FBFBFBBLRL
FFBFFFBRRR
FBBFFFFLLR
BFBBBFFRRL
FFBBBFFRLL
FFFBFBFRRR
FFBBBBFLRL
BFBFBFBRLL
FFFBBBFLLL
BFBFFFFLRR
BFFBFFBRRL
BFBFFBBLLL
FBBBBFBLRR
FFBFFBFRRR
FFBFFFBLLR
FFBBFFFRRL
BFBFFFFRLL
BBFFFBBRLR
FBFBBFBRRL
BFFFFFBLRL
FFBFFFFLLR
FBFFFBFLLR
FFFBBFBRLR
BBFBBFFLRL
FFBBBBBLLR
BFBBFBFLLL
BFBFFFFRRL
BFBBFFBRLR
FBBBFFFRLR
FBBFFBFRLR
BBFBFBBRLR
FBBBFFBLLR
FBBBFFFRLL
FBFBFBFRRR
BBFFBFBRRR
FFBBBBBRLL
FBFFBFBRRL
FBFFBBFLRR
FFFBBBFRRL
FFBBFFBRLL
BFBFFFBRLL
FBFFFBFLLL
FBBBBFFRRR
FBBFBFBRLL
BFFBFBFRLR
FFBFBFBLLL
FFBBFFBRRR
FBFFFFBLRL
FBBBFFFLRR
FFBBBBFRRL
FFBFBBBRLR
FBBBBFFLRR
BFBFBFBLRR
BBFBFFFLRL
FFFBBFBRLL
FBBBBBFLRL
FBBFBBBLLR
BFBBFFFLLR
FBFFFFFRLR
BBFFFFBRLR
FBFFFFFRRL
FFBBFFFLRL
FFBBBFBRRR
BBFFFBBLRL
FBBBBFBRLR
FBFBBFFLRL
FBFFBFFLRL
FFBFFFBRRL
FFBBBBFLLR
FBBFBFBLRR
FBFBBFBLLL
FFBBBFBLLL
BFFFFBBRRR
BBFFFBFLRL
FFFBBBBRLL
FFBFFBBLLL
FBFFFBFLRR
FBFBFFBLLL
BFFFBFFRRR
FFBBFFBLRR
BFBBFBFRLR
FFBFBFFRRL
BBFFFFBLRL
FFBBFFFRLR
BFBBFFBLRR
BBFBFBFRLL
FBFFFFBRLR
BBFFBBFLLR
FBBFFBBLRL
BFFFFFBRRL
BFBBFBFLRL
BBFFBFBRLR
BFFFFBFLRR
BFBFBFBLRL
FBFBFFFLRL
BFFFBBFLLR
BBFBFBBLRL
BFFFFBBLLL
BBFBFBBLLL
BFBBBBBRRL
FBFFBBFLLR
FFBFFBBLRR
FFBBFBFRRL
FBFBBBFLRR
FBFBBFFLLR
FFBBBBBRLR
FBFBBBFLLL
FBBFBBFRRR
FBBFBBBLLL
BFBFFBFLRL
FBFBFFBRLL
BFBFBFFLLR
FBBFFBFRLL
BFFBBBFLLR
BFFFFBBRLR
BFFBBFBLLL
BFFFFBFRLL
FFBFBBFRLR
BFFFBBBLLL
FBFBFBFLLL
BFBBBBBRLR
BFBBBFBLRR
FBBBFBFLLL
FBFFBBFRLR
BBFFBBBRLR
FFBFBBFRRL
BFBFBBFRLR
FBFFFFFLRR
BBFFFBFLRR
FBBFBFFRLR
BFBBFFFLRL
FBFBBFBLLR
BFFBBBFLRL
BFFBBBFLLL
BFBBFFFRLR
FBFFBBBRRL
BFFFBFBLRL
FBBBBBFRLL
BFFBBBBLRL
FBBFFFBRLL
FBBFBFFRLL
FBBFFBFLRR
FFBFBBBLLL
FFBFBBBLRR
BFBFFFBLLL
FFBFFFBLRR
FBFBBFBRLR
FBFBBBFRRR
FFFBFBFRLL
FBFFFBFRLL
BBFFBFBRLL
FFFBBBBRRL
FBFBFBBLLR
BBFFBBBLLL
FBBBBBFLLR
BFBFFFFRRR
FBBBBFFLLR
BFBBBBFLRR
BFBFFFBLRR
BFFFBBFRRR
FFFBBFBLLR
BFBBBBFRLL
BBFBFBFRRL
BBFBFFFLLL
FBFBFBFRLL
FBFBFFBLRR
BFBFBFBRRL
BFBBFFBRLL
BBFBFFBRLL
BFBBFBBRRR
FFBBBBFLRR
BBFFFBBLLL
FBBBFBBLLL
FFBBBFBLRR
BFBFBFFRLR
BBFBFBBLLR
BFBFFBFLLL
FBFBBFFRLL
FBFBFBFLRL
FBBFFFBLRR
BFBFFBBRRL
FFBFBFFLLR
FFBBFFBLLR
FFFBBBFRRR
BFFBFBBRRR
FFFBBBBLRL
FBBBBBBLRR
FBBBFBFLRR
FFBBBBFRRR
FFBFFBFLLL
BBFFBBFRLR
FBFFFFFRRR
FBBBFFFLRL
BFFBFFBRLR
FBFFFBFRRL
BBFFFFFLLL
FFBBFBFLLL
BFFBFFBRLL
FFBBFFBLLL
BBFFFBFLLR
FBBFBFBLLL
BFFFFFBRRR
BFBFBBBLRL
FBBFFBBRLL
BFFBFFFRLL
BFFBFFFLRR
BFFBBBFRLL
FBFBBFFLLL
FBFBFBFRRL
BFBBFBBLLR
FBFBBBBLRL
BFFFBFBRLR
FFFBFBFRRL
BBFBBFFLLR
FBBFBFFLRL
FFBBBBBLRR
FBBBBFBRLL
BBFBFBFRLR
BFBBBBBLLL
FBBBFBBLLR
FFFBBFFRLL
FFFBFBBRLL
FFBFFBFLLR
BBFFFFFRRR
BBFFBFFLRL
FBFFFFBRRR
BFBFFFBLRL
BBFFBFBLRR
FFBBBFBRRL
FBFFBFBLRL
FBBFBFBRLR
BFBFBFFRRL
BFFFBFBRRL
BFFFBFFRLR
BBFBFBFLRL
FBBFBFFRRL
BFBBFBBRRL
BFFFFBFLLL
FBBFBBBLRR
BFBFFFFLLL
FFBBBBBLRL
BFBFFBBLLR
FBFBFBFLLR
FFBFFFBRLR
FBBFFFFRRR

12
aoc2020/6.hs Normal file
View file

@ -0,0 +1,12 @@
import Data.List
import Data.List.Split
readlines :: FilePath -> IO [String]
readlines = fmap (splitOn "\n\n" . init) . readFile
solution2 :: [[String]] -> Int
solution2 = sum . (map $ length . foldr1 intersect)
main = do
input <- readlines "6.txt"
print (solution2 $ map (splitOn "\n") input)

15
aoc2020/6.py Normal file
View file

@ -0,0 +1,15 @@
with open("6.txt") as f:
data = f.read().split("\n\n")
def process(lines):
return len(set("".join(lines.split("\n"))))
print(sum(map(process, data)))
from functools import reduce
with open("6.txt") as f:
data = f.read().split("\n\n")
def process(lines):
lines = lines.strip()
letters = reduce(set.intersection, map(set, map(list, lines.split("\n"))))
print(repr(lines), letters)
return len(letters)
print(sum(map(process, data)))

2239
aoc2020/6.txt Normal file

File diff suppressed because it is too large Load diff

53
aoc2020/7.py Normal file
View file

@ -0,0 +1,53 @@
import queue
with open("7.txt") as f:
edges = dict()
edges2 = dict()
import re
pat = re.compile("""
^(.*)\ bags?\ contain\
(?:
(?:no\ other\ bags)
| (?: (\d+)\ (.*)\ bags? (,\ (\d+)\ (.*)\ bags?)* )
)
.$
""", flags=re.VERBOSE)
for line in f:
a, b = line.split("contain")
outer = a.strip().rstrip("bags").strip()
if outer not in edges2:
edges2[outer] = dict()
inner = b.strip().rstrip(".").split(", ")
# print(inner)
if inner == ["no other bags"]: continue
for n in inner:
num = int(re.match("^(\d+)\s.*", n).groups()[0])
color = re.sub("^(\d+)\s", "", n)
color = re.sub("\sbags?$", "", color)
# print(color)
edges2[outer][color] = num
if color not in edges:
edges[color] = set()
edges[color].add(outer)
# print(edges)
found = set()
q = queue.Queue()
q.put("shiny gold")
while not q.empty():
c = q.get()
r = edges.get(c, set())
# print(c, r)
for c1 in r:
if c1 not in found:
q.put(c1)
found.add(c1)
print(len(found))
print(edges2)
def visit(color):
r = edges2.get(color, set())
c = 1
for col, n in r.items():
c += n * visit(col)
# print(f"{color} contains {c} other bags")
return c
print(visit("shiny gold") - 1)

594
aoc2020/7.txt Normal file
View file

@ -0,0 +1,594 @@
dull silver bags contain 2 striped magenta bags, 2 dark coral bags, 1 bright orange bag, 4 plaid blue bags.
dark plum bags contain 3 wavy teal bags.
wavy turquoise bags contain 3 bright salmon bags.
mirrored gold bags contain 3 wavy brown bags, 5 posh beige bags, 3 light crimson bags, 3 vibrant salmon bags.
drab green bags contain 4 dull white bags, 1 posh indigo bag.
faded lime bags contain 1 dim magenta bag, 1 wavy salmon bag, 4 dull purple bags.
mirrored blue bags contain 5 bright orange bags, 1 muted black bag, 2 muted brown bags, 2 vibrant gold bags.
faded crimson bags contain 4 wavy teal bags, 4 mirrored fuchsia bags, 3 plaid white bags.
faded magenta bags contain 2 clear orange bags, 5 dull green bags, 2 pale white bags.
pale red bags contain 5 shiny gold bags, 4 dull gold bags, 2 drab black bags.
dark coral bags contain 1 light turquoise bag.
faded chartreuse bags contain 4 shiny brown bags, 4 mirrored beige bags, 4 clear purple bags.
muted coral bags contain 4 pale coral bags, 4 plaid brown bags.
bright teal bags contain 5 striped blue bags, 4 faded orange bags, 2 faded crimson bags.
wavy green bags contain 5 dim chartreuse bags.
clear white bags contain 2 mirrored fuchsia bags.
clear aqua bags contain 1 faded beige bag.
vibrant yellow bags contain 5 posh brown bags.
pale lavender bags contain 1 striped beige bag, 2 striped cyan bags.
mirrored lime bags contain 3 bright orange bags.
faded tan bags contain 2 drab beige bags.
dark indigo bags contain 1 dark brown bag, 5 shiny beige bags, 1 vibrant indigo bag.
drab teal bags contain 2 vibrant fuchsia bags, 3 muted green bags, 5 dotted magenta bags, 2 shiny lavender bags.
shiny aqua bags contain 1 shiny gold bag, 4 clear white bags, 4 faded gold bags.
dull bronze bags contain 4 vibrant teal bags, 1 vibrant violet bag.
dark aqua bags contain 4 posh white bags.
dim coral bags contain 2 light yellow bags.
faded salmon bags contain 5 muted brown bags, 2 dotted red bags, 3 drab yellow bags, 4 dark red bags.
bright lavender bags contain 5 wavy maroon bags, 5 light brown bags, 5 bright silver bags, 1 dark gray bag.
mirrored cyan bags contain 4 dotted cyan bags, 5 striped orange bags, 1 vibrant gold bag.
drab aqua bags contain 3 striped black bags, 4 dark salmon bags, 1 drab white bag, 4 faded crimson bags.
striped purple bags contain 5 faded yellow bags, 2 faded brown bags.
drab fuchsia bags contain 4 vibrant violet bags, 5 mirrored yellow bags.
shiny red bags contain 3 faded cyan bags, 1 dull beige bag, 1 shiny blue bag, 5 dull cyan bags.
mirrored teal bags contain 4 clear brown bags, 5 light bronze bags, 3 light teal bags, 2 pale tomato bags.
dotted orange bags contain 3 dull white bags, 2 wavy blue bags.
dotted lavender bags contain 1 vibrant aqua bag, 4 shiny magenta bags, 3 dull plum bags.
pale crimson bags contain 4 muted cyan bags, 1 posh brown bag, 3 light magenta bags.
shiny black bags contain 4 vibrant chartreuse bags, 1 mirrored yellow bag, 3 posh brown bags, 5 vibrant violet bags.
clear bronze bags contain 5 dull violet bags, 3 pale plum bags.
striped lavender bags contain 1 dark plum bag, 2 striped yellow bags.
plaid indigo bags contain 2 plaid chartreuse bags.
shiny teal bags contain 4 wavy gray bags, 4 drab teal bags, 1 dark silver bag.
dull turquoise bags contain 1 wavy gray bag.
striped brown bags contain 1 striped olive bag, 1 wavy olive bag, 5 posh brown bags.
dotted magenta bags contain 4 drab silver bags, 3 light olive bags, 1 bright tan bag, 4 dull gold bags.
plaid yellow bags contain 5 drab black bags, 1 wavy lavender bag, 1 drab silver bag.
muted blue bags contain 5 posh aqua bags.
shiny olive bags contain 4 dark salmon bags, 1 faded gold bag, 3 drab chartreuse bags, 4 dotted yellow bags.
vibrant lime bags contain 4 shiny aqua bags, 1 bright maroon bag, 4 striped orange bags.
dim crimson bags contain 5 faded crimson bags.
vibrant gray bags contain 1 mirrored coral bag, 5 wavy beige bags, 3 drab turquoise bags.
posh chartreuse bags contain 3 light plum bags, 2 pale green bags, 5 drab white bags.
striped beige bags contain 5 dull red bags, 5 drab salmon bags, 3 vibrant salmon bags.
dotted tan bags contain 4 wavy crimson bags, 4 shiny orange bags, 1 drab turquoise bag.
vibrant aqua bags contain 1 vibrant gray bag, 5 light violet bags, 3 dim yellow bags.
faded turquoise bags contain 2 faded yellow bags, 4 mirrored coral bags.
mirrored purple bags contain 3 pale orange bags.
dim white bags contain 1 drab turquoise bag.
bright purple bags contain 5 muted chartreuse bags, 1 dotted yellow bag, 3 bright salmon bags.
drab red bags contain 1 mirrored magenta bag.
clear coral bags contain 4 drab black bags, 3 dark black bags.
mirrored orange bags contain 1 muted chartreuse bag.
wavy cyan bags contain 3 posh lime bags, 4 dark magenta bags, 4 vibrant turquoise bags.
pale magenta bags contain 4 vibrant turquoise bags, 3 clear gold bags.
posh gold bags contain 5 dotted lime bags, 5 wavy silver bags, 4 muted crimson bags, 1 dull yellow bag.
clear silver bags contain 1 drab indigo bag.
faded violet bags contain 2 mirrored bronze bags.
muted turquoise bags contain 2 plaid green bags, 2 light yellow bags, 4 dark violet bags.
striped bronze bags contain 4 striped white bags, 1 dim yellow bag, 5 clear aqua bags.
muted aqua bags contain 5 plaid green bags.
wavy teal bags contain no other bags.
pale black bags contain 5 dark salmon bags.
clear gold bags contain 2 plaid white bags, 5 drab coral bags, 5 pale coral bags.
muted chartreuse bags contain 5 faded crimson bags.
dotted fuchsia bags contain 1 plaid brown bag, 1 dark violet bag.
bright tomato bags contain 1 bright blue bag.
dim bronze bags contain 1 dotted green bag, 5 pale violet bags, 4 vibrant chartreuse bags, 3 striped yellow bags.
bright beige bags contain 1 drab blue bag.
vibrant olive bags contain 3 dotted olive bags.
clear tomato bags contain 1 light gray bag, 2 light turquoise bags, 2 striped yellow bags.
mirrored beige bags contain 3 light coral bags, 2 bright teal bags, 1 wavy magenta bag.
shiny gold bags contain 3 pale silver bags, 3 mirrored yellow bags, 2 shiny black bags, 2 light magenta bags.
plaid aqua bags contain 4 plaid crimson bags, 4 dim gray bags, 3 plaid orange bags, 2 dotted blue bags.
light green bags contain 2 light violet bags, 5 striped violet bags, 5 drab brown bags, 4 dull white bags.
vibrant beige bags contain 3 posh violet bags, 2 plaid blue bags, 4 shiny lavender bags, 5 wavy orange bags.
drab orange bags contain 3 striped beige bags, 3 posh teal bags, 5 drab silver bags, 1 dark indigo bag.
shiny orange bags contain 3 dark aqua bags, 4 clear beige bags, 2 mirrored lime bags, 3 dark violet bags.
wavy maroon bags contain 3 vibrant chartreuse bags.
wavy olive bags contain 5 dark aqua bags, 1 light yellow bag, 1 shiny crimson bag.
dotted cyan bags contain 2 drab gold bags.
muted cyan bags contain 1 clear gold bag, 4 dark plum bags, 2 wavy lavender bags, 5 vibrant indigo bags.
posh cyan bags contain 1 light fuchsia bag, 1 dark maroon bag.
faded bronze bags contain 2 muted salmon bags, 4 dim violet bags, 5 dark tan bags, 3 vibrant white bags.
pale green bags contain 4 muted turquoise bags, 1 vibrant green bag, 1 drab white bag.
clear brown bags contain 4 wavy teal bags, 4 drab violet bags.
striped salmon bags contain 5 mirrored orange bags, 1 shiny yellow bag, 1 muted beige bag, 1 clear purple bag.
posh brown bags contain 3 posh white bags, 4 drab chartreuse bags, 5 dark violet bags, 4 wavy teal bags.
mirrored green bags contain 1 dim tan bag.
bright yellow bags contain 2 striped indigo bags, 2 dark silver bags.
wavy yellow bags contain 3 dotted gold bags, 3 posh green bags.
light chartreuse bags contain 3 faded blue bags, 3 mirrored yellow bags, 3 shiny plum bags, 4 light red bags.
dark lime bags contain 5 vibrant chartreuse bags, 2 clear brown bags, 1 posh brown bag.
muted magenta bags contain 4 shiny silver bags, 2 dotted yellow bags, 4 pale fuchsia bags, 5 muted tan bags.
light plum bags contain 4 drab gold bags.
dim tomato bags contain 1 light silver bag.
pale lime bags contain 4 dull blue bags.
dim black bags contain 1 dark plum bag, 1 dull crimson bag, 5 wavy white bags, 2 plaid chartreuse bags.
muted teal bags contain 3 dim black bags, 4 mirrored lavender bags, 5 dull indigo bags, 3 clear red bags.
muted purple bags contain 1 mirrored red bag.
dull coral bags contain 5 pale teal bags, 2 faded cyan bags, 4 pale black bags, 2 muted olive bags.
vibrant red bags contain 4 light teal bags, 5 shiny fuchsia bags, 1 drab purple bag, 2 muted olive bags.
mirrored tomato bags contain 4 posh brown bags.
shiny coral bags contain 5 clear turquoise bags, 2 wavy salmon bags, 1 drab brown bag.
wavy indigo bags contain 1 vibrant brown bag, 2 dim turquoise bags, 1 posh violet bag, 1 plaid green bag.
dotted gold bags contain 5 pale aqua bags, 1 bright olive bag.
dotted violet bags contain 2 drab olive bags, 1 plaid cyan bag, 2 posh beige bags.
pale fuchsia bags contain 5 faded beige bags, 5 dark purple bags.
shiny chartreuse bags contain 1 striped tan bag, 5 pale tomato bags.
clear gray bags contain 1 bright fuchsia bag, 4 dotted olive bags, 2 light teal bags, 4 shiny magenta bags.
vibrant tomato bags contain 1 clear crimson bag, 3 pale purple bags, 3 faded gray bags.
light orange bags contain 5 plaid brown bags.
shiny tomato bags contain 3 light olive bags, 5 dim silver bags, 3 posh violet bags, 2 striped lavender bags.
faded green bags contain 2 dotted gold bags, 1 dark plum bag, 1 dull gray bag, 5 dark brown bags.
dim gray bags contain 5 muted white bags, 2 mirrored yellow bags, 1 muted tomato bag.
faded black bags contain 3 faded teal bags, 3 striped lavender bags, 2 striped blue bags, 4 muted lavender bags.
clear lime bags contain 3 mirrored yellow bags, 1 light yellow bag.
dark silver bags contain 4 wavy orange bags, 2 muted green bags.
plaid black bags contain 3 wavy indigo bags, 1 pale red bag.
mirrored black bags contain 5 dull black bags, 4 clear coral bags, 1 wavy olive bag, 4 dull silver bags.
light coral bags contain 5 drab black bags, 1 dark magenta bag, 1 drab teal bag, 1 mirrored crimson bag.
shiny yellow bags contain 5 faded indigo bags.
posh plum bags contain 3 faded maroon bags, 2 vibrant indigo bags, 1 bright turquoise bag.
faded olive bags contain 1 vibrant gray bag, 4 drab teal bags, 5 wavy teal bags.
dim plum bags contain 1 plaid white bag, 4 wavy beige bags, 3 wavy green bags.
muted tomato bags contain 5 dotted red bags, 1 drab purple bag, 1 light orange bag.
clear fuchsia bags contain 1 mirrored olive bag, 2 faded salmon bags.
striped violet bags contain 2 light olive bags, 1 plaid olive bag, 5 light white bags.
dim aqua bags contain 2 vibrant purple bags, 5 drab silver bags.
striped crimson bags contain 5 muted coral bags.
bright indigo bags contain 3 muted gold bags.
dotted black bags contain 4 shiny crimson bags, 5 dark salmon bags, 5 faded crimson bags, 2 vibrant magenta bags.
faded indigo bags contain 1 drab tomato bag.
bright bronze bags contain 1 wavy lime bag, 4 pale violet bags.
drab turquoise bags contain 2 drab gold bags, 2 vibrant gold bags, 4 pale tomato bags.
wavy black bags contain 2 dotted brown bags, 1 light salmon bag.
posh green bags contain 1 striped olive bag, 5 vibrant turquoise bags, 4 pale coral bags.
clear green bags contain 4 dull bronze bags, 4 shiny crimson bags, 1 light white bag.
dull chartreuse bags contain 2 dim aqua bags, 3 shiny black bags.
drab lime bags contain 1 wavy chartreuse bag, 4 mirrored chartreuse bags, 1 posh olive bag, 5 mirrored lavender bags.
bright tan bags contain 4 muted tan bags, 5 shiny gold bags, 1 mirrored red bag, 3 dull crimson bags.
dim maroon bags contain 3 clear red bags, 5 dark brown bags, 2 bright maroon bags, 1 muted teal bag.
drab tomato bags contain 4 dim orange bags, 2 mirrored violet bags, 3 faded purple bags.
muted gold bags contain 1 dim cyan bag.
striped white bags contain 1 plaid white bag, 1 posh purple bag, 3 muted cyan bags, 2 pale crimson bags.
wavy beige bags contain 2 plaid white bags, 3 dark brown bags.
vibrant turquoise bags contain 2 muted turquoise bags, 3 plaid green bags, 1 shiny crimson bag.
dark fuchsia bags contain 1 pale purple bag, 1 dim fuchsia bag, 3 light teal bags, 3 vibrant magenta bags.
dotted aqua bags contain 1 bright white bag, 5 clear gold bags, 5 clear tomato bags.
faded silver bags contain 1 light lime bag, 4 wavy gold bags.
faded brown bags contain 4 light aqua bags.
bright gray bags contain 3 faded red bags, 2 muted plum bags, 1 wavy brown bag.
wavy tan bags contain 1 pale maroon bag, 5 posh black bags.
bright blue bags contain 5 posh purple bags.
striped gold bags contain 4 dull tan bags, 1 shiny crimson bag, 2 clear blue bags.
bright magenta bags contain 4 shiny orange bags.
dotted brown bags contain 4 faded teal bags, 5 mirrored coral bags.
muted silver bags contain 5 striped black bags, 3 faded beige bags, 4 plaid crimson bags, 2 wavy brown bags.
wavy purple bags contain 1 dim brown bag, 1 bright yellow bag, 5 shiny lime bags.
dull plum bags contain 1 posh black bag, 4 vibrant fuchsia bags, 5 dull bronze bags.
dotted red bags contain 5 striped tomato bags, 4 shiny orange bags, 4 clear magenta bags, 5 pale coral bags.
light violet bags contain 2 bright beige bags, 5 mirrored plum bags, 3 wavy fuchsia bags, 1 clear tan bag.
dark teal bags contain 3 dull gray bags, 2 dark aqua bags, 1 clear beige bag.
light fuchsia bags contain 2 muted silver bags, 2 striped beige bags.
posh blue bags contain 5 striped olive bags, 5 dim coral bags.
light black bags contain 2 drab coral bags, 2 shiny indigo bags.
pale chartreuse bags contain 5 pale tomato bags.
drab gold bags contain 1 faded gold bag, 5 shiny gold bags.
posh bronze bags contain 2 drab aqua bags, 5 pale gray bags.
light tomato bags contain 5 wavy lime bags.
dull tan bags contain 3 drab blue bags, 4 dull green bags, 4 clear violet bags.
muted beige bags contain 5 clear white bags, 5 faded crimson bags.
faded fuchsia bags contain 5 plaid purple bags, 1 shiny silver bag, 4 muted violet bags.
bright green bags contain 5 dim teal bags, 5 shiny crimson bags, 5 clear crimson bags.
mirrored fuchsia bags contain 4 posh white bags, 5 wavy teal bags, 2 dark violet bags.
vibrant plum bags contain 2 posh yellow bags.
plaid bronze bags contain 4 dotted coral bags, 4 dull green bags, 2 plaid chartreuse bags.
plaid fuchsia bags contain 5 bright white bags.
dull red bags contain 2 mirrored fuchsia bags, 3 vibrant violet bags, 2 bright olive bags, 1 dim orange bag.
faded gray bags contain 1 dull purple bag, 2 posh salmon bags.
wavy plum bags contain 4 pale violet bags, 3 striped magenta bags, 4 pale red bags.
dark crimson bags contain 4 dim yellow bags, 1 dotted purple bag, 2 wavy indigo bags, 4 clear black bags.
pale cyan bags contain 5 shiny coral bags, 4 shiny beige bags, 2 plaid olive bags.
dull violet bags contain 3 wavy olive bags, 1 dull gray bag, 5 vibrant turquoise bags, 1 plaid purple bag.
wavy chartreuse bags contain 1 dotted magenta bag, 3 bright orange bags, 1 mirrored red bag.
dark cyan bags contain 5 dotted turquoise bags, 1 clear purple bag, 1 dim teal bag.
posh coral bags contain 3 muted bronze bags.
pale yellow bags contain 1 drab tomato bag.
plaid turquoise bags contain 1 muted gray bag.
dotted purple bags contain 5 posh silver bags, 4 dark salmon bags.
light indigo bags contain 4 mirrored red bags, 4 light olive bags.
faded plum bags contain 3 mirrored gold bags.
faded coral bags contain 5 dull tan bags.
clear indigo bags contain 5 mirrored magenta bags, 1 clear maroon bag, 1 bright blue bag, 5 light aqua bags.
dim cyan bags contain 5 plaid green bags.
dotted maroon bags contain 5 pale maroon bags, 2 dark indigo bags.
faded beige bags contain 1 plaid chartreuse bag.
striped indigo bags contain 1 dark gray bag, 3 drab olive bags.
clear yellow bags contain 4 dull gray bags, 1 muted green bag.
light lavender bags contain 4 pale coral bags, 2 light yellow bags, 2 light indigo bags.
light turquoise bags contain 5 pale fuchsia bags, 5 vibrant fuchsia bags, 5 vibrant magenta bags, 3 pale indigo bags.
light purple bags contain 2 light cyan bags.
bright gold bags contain 1 dark aqua bag.
muted bronze bags contain 2 light teal bags.
striped gray bags contain 2 light cyan bags, 1 pale black bag, 5 plaid plum bags.
wavy orange bags contain 2 pale coral bags, 2 dim coral bags.
wavy silver bags contain 2 posh white bags, 1 faded beige bag.
clear chartreuse bags contain 1 vibrant lime bag, 2 faded plum bags, 1 striped chartreuse bag, 5 clear maroon bags.
vibrant tan bags contain 3 striped lime bags, 4 pale maroon bags, 2 muted turquoise bags, 4 dark lime bags.
posh aqua bags contain 2 muted tan bags, 2 shiny blue bags, 2 posh purple bags.
bright orange bags contain no other bags.
drab coral bags contain no other bags.
light white bags contain 5 striped yellow bags.
wavy violet bags contain 1 pale silver bag, 2 shiny fuchsia bags, 1 vibrant violet bag, 1 shiny plum bag.
dark white bags contain 4 shiny maroon bags, 2 dim brown bags, 2 dark beige bags, 1 pale blue bag.
vibrant violet bags contain 4 striped blue bags, 1 mirrored lime bag, 1 posh white bag.
vibrant lavender bags contain 4 dotted magenta bags, 1 wavy red bag, 3 pale coral bags, 3 clear indigo bags.
dark purple bags contain 4 posh white bags.
mirrored lavender bags contain 5 clear brown bags, 2 faded gold bags.
striped silver bags contain 3 light yellow bags, 1 drab violet bag.
faded blue bags contain 3 muted violet bags, 4 wavy plum bags, 2 pale indigo bags, 1 wavy bronze bag.
drab cyan bags contain 4 dim tomato bags, 1 plaid lavender bag, 4 pale red bags, 2 drab olive bags.
clear lavender bags contain 3 wavy olive bags, 5 bright gray bags, 3 wavy beige bags, 2 dim violet bags.
striped aqua bags contain 3 mirrored lavender bags.
plaid tomato bags contain 2 posh cyan bags, 3 pale silver bags.
plaid salmon bags contain 1 muted lavender bag, 5 muted green bags, 3 bright aqua bags.
light blue bags contain 1 light white bag, 4 clear violet bags, 3 dark brown bags.
dark blue bags contain 5 posh aqua bags.
faded teal bags contain 3 light beige bags.
plaid chartreuse bags contain 4 wavy teal bags.
wavy gray bags contain 3 drab white bags, 2 muted lavender bags.
pale maroon bags contain 4 faded crimson bags, 4 vibrant chartreuse bags, 1 plaid green bag, 1 vibrant turquoise bag.
dark bronze bags contain 4 faded turquoise bags, 2 faded silver bags, 5 faded salmon bags.
pale coral bags contain 3 mirrored yellow bags, 4 dark plum bags, 2 dark aqua bags, 4 plaid white bags.
mirrored magenta bags contain 5 vibrant lime bags, 4 vibrant chartreuse bags, 3 striped aqua bags.
mirrored salmon bags contain 4 striped salmon bags, 1 posh tan bag, 3 faded bronze bags.
drab tan bags contain 5 vibrant violet bags.
vibrant indigo bags contain 1 pale coral bag, 1 light teal bag, 2 light magenta bags.
plaid lavender bags contain 1 striped silver bag, 1 clear lime bag.
muted plum bags contain 2 plaid crimson bags.
posh gray bags contain 5 mirrored lime bags.
clear maroon bags contain 5 wavy bronze bags, 3 dim gold bags, 2 muted beige bags, 5 posh coral bags.
striped maroon bags contain 2 dotted violet bags, 4 bright fuchsia bags, 4 striped aqua bags.
faded yellow bags contain 2 wavy teal bags, 3 wavy lavender bags.
posh black bags contain 1 drab silver bag, 2 clear white bags, 5 muted silver bags.
muted indigo bags contain 1 dark green bag, 1 plaid chartreuse bag, 3 bright indigo bags, 5 wavy silver bags.
wavy brown bags contain 5 faded red bags, 4 bright orange bags, 3 dim black bags.
vibrant coral bags contain 5 plaid white bags, 5 vibrant indigo bags.
wavy white bags contain 1 plaid green bag, 3 drab chartreuse bags, 1 posh white bag.
pale violet bags contain 2 shiny orange bags, 4 plaid crimson bags.
clear black bags contain 4 wavy blue bags, 5 plaid tan bags, 4 clear magenta bags.
faded aqua bags contain 2 wavy teal bags.
dotted green bags contain 5 shiny orange bags, 1 light magenta bag.
bright coral bags contain 2 shiny fuchsia bags, 4 light lime bags, 1 shiny gold bag.
vibrant fuchsia bags contain 1 vibrant chartreuse bag, 1 striped black bag.
dark turquoise bags contain 5 shiny salmon bags, 2 light lavender bags.
shiny green bags contain 1 pale silver bag, 4 dim red bags, 3 dark lime bags, 4 drab coral bags.
clear red bags contain 5 light teal bags, 5 posh brown bags.
dull gold bags contain 1 drab tan bag, 4 striped tomato bags, 5 pale maroon bags, 2 dim crimson bags.
mirrored red bags contain 3 shiny crimson bags, 4 plaid brown bags, 2 shiny black bags.
pale blue bags contain 1 wavy crimson bag, 4 faded beige bags, 4 shiny chartreuse bags.
clear beige bags contain 4 plaid crimson bags, 5 shiny crimson bags.
drab salmon bags contain 4 dim crimson bags, 3 light magenta bags, 1 clear violet bag.
vibrant magenta bags contain 4 dim black bags.
dark salmon bags contain 3 dull green bags, 4 faded red bags.
posh white bags contain no other bags.
light lime bags contain 5 dark aqua bags.
vibrant salmon bags contain 4 striped tomato bags, 4 clear aqua bags.
clear teal bags contain 3 striped gray bags.
plaid silver bags contain 3 vibrant violet bags, 2 muted magenta bags, 3 dark olive bags, 4 mirrored gold bags.
striped cyan bags contain 4 light gold bags, 2 dotted magenta bags.
wavy bronze bags contain 1 plaid crimson bag, 1 dull gray bag, 5 dull tan bags, 1 mirrored teal bag.
dim olive bags contain 4 vibrant lime bags, 2 shiny crimson bags, 2 muted turquoise bags.
dotted blue bags contain 4 vibrant gray bags, 2 shiny beige bags.
plaid blue bags contain 5 drab silver bags.
dark olive bags contain 1 pale coral bag, 4 vibrant indigo bags.
pale gray bags contain 3 dotted crimson bags, 1 striped magenta bag, 5 wavy white bags, 2 vibrant blue bags.
mirrored brown bags contain 2 bright cyan bags, 4 plaid brown bags, 5 faded turquoise bags.
wavy gold bags contain 1 wavy coral bag.
pale teal bags contain 3 vibrant magenta bags.
mirrored turquoise bags contain 4 mirrored olive bags, 5 bright yellow bags.
dark chartreuse bags contain 4 dotted cyan bags, 5 shiny turquoise bags, 5 vibrant salmon bags, 4 wavy yellow bags.
muted gray bags contain 3 dim orange bags.
posh turquoise bags contain 4 clear lavender bags, 5 dim coral bags, 2 striped salmon bags.
shiny cyan bags contain 4 striped gold bags.
drab olive bags contain 2 plaid cyan bags, 1 mirrored lime bag.
posh tomato bags contain 2 drab tan bags, 3 shiny orange bags.
muted fuchsia bags contain 1 pale salmon bag, 3 wavy violet bags, 3 mirrored maroon bags.
pale bronze bags contain 3 drab yellow bags, 3 muted chartreuse bags.
striped green bags contain 3 striped orange bags, 2 dull green bags, 3 vibrant tan bags.
faded orange bags contain 3 mirrored plum bags, 5 mirrored lime bags, 5 faded red bags.
dull aqua bags contain 2 striped coral bags.
dotted olive bags contain 4 faded salmon bags, 1 wavy green bag.
vibrant silver bags contain 4 mirrored yellow bags, 2 dotted salmon bags, 3 drab silver bags.
striped olive bags contain 1 mirrored fuchsia bag, 1 faded gold bag, 1 mirrored lavender bag.
dark violet bags contain no other bags.
mirrored olive bags contain 5 dull teal bags, 1 dim white bag.
plaid tan bags contain 4 pale gray bags, 2 dim crimson bags, 1 clear violet bag, 1 wavy lime bag.
pale tomato bags contain 5 posh green bags, 4 faded red bags.
dim turquoise bags contain 1 shiny gold bag, 5 drab blue bags.
muted lime bags contain 3 vibrant lime bags, 1 pale plum bag, 1 dark indigo bag.
drab beige bags contain 3 vibrant magenta bags.
posh beige bags contain 2 dark violet bags.
muted olive bags contain 2 pale brown bags, 5 light gray bags, 3 wavy green bags, 2 drab tan bags.
dim orange bags contain 1 clear lime bag, 4 faded beige bags, 2 mirrored fuchsia bags.
dull salmon bags contain 4 striped coral bags, 3 striped aqua bags.
dull maroon bags contain 3 clear brown bags, 5 dull magenta bags, 1 dim red bag.
mirrored coral bags contain 5 muted tan bags, 4 dotted magenta bags, 5 dim olive bags.
posh olive bags contain 4 dull magenta bags, 4 wavy blue bags, 2 drab yellow bags, 5 dotted gold bags.
mirrored violet bags contain 2 pale fuchsia bags.
drab bronze bags contain 4 drab chartreuse bags.
wavy fuchsia bags contain 2 dark gray bags, 5 muted silver bags.
pale plum bags contain 3 vibrant salmon bags, 5 drab chartreuse bags, 2 posh violet bags.
mirrored aqua bags contain 2 pale aqua bags.
bright silver bags contain 3 drab black bags, 5 dark salmon bags, 2 shiny beige bags, 2 posh lavender bags.
plaid lime bags contain 4 faded teal bags, 5 pale brown bags, 5 dim red bags.
dotted turquoise bags contain 3 dim olive bags, 2 mirrored blue bags, 3 dull lime bags, 4 vibrant lavender bags.
drab maroon bags contain 5 bright red bags.
wavy lavender bags contain 1 striped lime bag, 1 posh brown bag.
shiny beige bags contain 5 shiny aqua bags, 3 muted teal bags, 5 clear gold bags.
dark gold bags contain 4 clear maroon bags, 2 dotted maroon bags, 3 light red bags.
light aqua bags contain 2 dim red bags, 3 pale red bags.
posh teal bags contain 3 muted brown bags, 5 shiny gold bags, 5 dotted purple bags.
dull lavender bags contain 5 shiny blue bags.
dark tan bags contain 1 muted tan bag, 5 vibrant turquoise bags, 4 dark violet bags, 4 muted plum bags.
light beige bags contain 2 mirrored fuchsia bags, 1 drab chartreuse bag, 1 muted tan bag.
pale olive bags contain 3 clear brown bags.
dark maroon bags contain 5 dull plum bags, 3 muted green bags.
muted red bags contain 4 pale tan bags, 1 bright white bag.
light tan bags contain 3 light purple bags, 2 pale aqua bags, 3 wavy bronze bags.
clear magenta bags contain 3 vibrant chartreuse bags, 1 dim crimson bag.
dark orange bags contain 2 posh cyan bags, 1 wavy brown bag, 5 dull black bags.
dim lavender bags contain 5 drab fuchsia bags.
dotted beige bags contain 5 light blue bags, 4 plaid tan bags, 2 wavy maroon bags, 5 dim crimson bags.
dim green bags contain 3 plaid tan bags, 1 drab blue bag, 1 clear aqua bag.
plaid brown bags contain 3 muted turquoise bags, 4 drab chartreuse bags.
bright black bags contain 5 striped white bags.
plaid gold bags contain 3 shiny lime bags, 1 plaid maroon bag, 4 bright blue bags.
pale white bags contain 4 drab chartreuse bags, 3 pale tan bags, 5 pale aqua bags.
drab violet bags contain no other bags.
light magenta bags contain 3 faded crimson bags.
light gold bags contain 1 dim lavender bag, 3 light magenta bags, 5 drab gold bags.
plaid coral bags contain 1 vibrant salmon bag, 3 striped tomato bags, 3 posh blue bags.
dotted white bags contain 1 wavy lavender bag.
striped yellow bags contain 4 drab black bags, 2 faded red bags, 2 shiny gold bags, 4 dark aqua bags.
dark yellow bags contain 5 wavy bronze bags, 5 bright purple bags.
faded white bags contain 3 light tomato bags.
muted white bags contain 5 faded gold bags, 1 plaid magenta bag, 3 drab white bags, 5 dim brown bags.
faded red bags contain 1 posh brown bag, 2 muted turquoise bags, 3 plaid crimson bags, 4 shiny orange bags.
dark red bags contain 5 shiny salmon bags.
dull gray bags contain 2 posh white bags.
bright salmon bags contain 2 shiny aqua bags, 3 dotted crimson bags, 1 drab violet bag, 4 pale chartreuse bags.
mirrored chartreuse bags contain 1 vibrant magenta bag, 3 plaid salmon bags, 1 plaid chartreuse bag, 3 muted violet bags.
vibrant orange bags contain 5 posh yellow bags.
dark gray bags contain 1 plaid chartreuse bag, 2 drab violet bags, 1 bright chartreuse bag, 1 muted purple bag.
mirrored crimson bags contain 3 drab coral bags, 5 dull lime bags.
muted violet bags contain 3 dotted crimson bags, 3 light olive bags.
shiny brown bags contain 2 dark lavender bags, 2 vibrant yellow bags, 1 dark black bag, 2 drab olive bags.
muted green bags contain 1 dull cyan bag, 5 dull red bags, 4 pale chartreuse bags.
drab yellow bags contain 3 pale tomato bags.
dotted tomato bags contain 2 shiny magenta bags, 3 mirrored tomato bags, 5 plaid chartreuse bags.
plaid red bags contain 3 pale cyan bags.
bright red bags contain 1 shiny beige bag.
plaid purple bags contain 5 dull gold bags.
dark green bags contain 3 pale salmon bags, 3 dim brown bags, 2 wavy violet bags, 2 pale chartreuse bags.
plaid orange bags contain 1 vibrant chartreuse bag, 2 dotted coral bags, 1 posh teal bag.
plaid violet bags contain 1 shiny maroon bag.
posh tan bags contain 1 shiny beige bag, 2 dim magenta bags, 1 dark violet bag.
bright aqua bags contain 1 drab brown bag, 4 dotted purple bags.
vibrant white bags contain 4 light gray bags, 2 dark fuchsia bags, 1 pale cyan bag.
striped red bags contain 5 faded gold bags, 5 drab crimson bags, 3 faded turquoise bags.
dull purple bags contain 1 pale crimson bag.
shiny blue bags contain 1 pale violet bag, 5 mirrored plum bags, 3 posh white bags, 1 light yellow bag.
clear salmon bags contain 2 striped lime bags, 1 dull violet bag.
faded gold bags contain 3 light teal bags, 3 wavy teal bags.
mirrored yellow bags contain 2 muted turquoise bags, 4 drab chartreuse bags.
plaid gray bags contain 4 plaid plum bags.
plaid white bags contain no other bags.
drab black bags contain 2 mirrored yellow bags, 2 drab chartreuse bags, 1 shiny orange bag.
dotted chartreuse bags contain 2 vibrant cyan bags, 2 light salmon bags, 3 vibrant red bags, 5 light turquoise bags.
faded lavender bags contain 3 dark tomato bags, 5 muted lime bags, 4 light fuchsia bags, 4 dull lavender bags.
vibrant cyan bags contain 2 clear crimson bags, 3 pale orange bags, 4 dull indigo bags, 3 light red bags.
bright maroon bags contain 2 muted tan bags, 2 light teal bags.
drab silver bags contain 3 bright chartreuse bags, 4 pale crimson bags, 5 dotted crimson bags, 5 faded yellow bags.
drab purple bags contain 5 drab blue bags.
dim gold bags contain 1 bright cyan bag, 5 dull white bags, 3 vibrant blue bags.
dark beige bags contain 4 pale coral bags, 1 pale indigo bag.
dotted salmon bags contain 2 drab violet bags, 5 posh white bags.
vibrant crimson bags contain 5 faded teal bags, 3 dotted green bags, 1 clear maroon bag.
dim chartreuse bags contain 3 clear white bags.
bright violet bags contain 1 dim yellow bag, 1 muted purple bag, 4 muted teal bags, 5 striped cyan bags.
dim magenta bags contain 1 pale aqua bag, 4 pale maroon bags, 5 mirrored red bags, 4 drab yellow bags.
dim brown bags contain 5 faded salmon bags, 4 dotted magenta bags, 5 drab tomato bags, 2 faded teal bags.
shiny lime bags contain 5 dotted black bags, 4 plaid turquoise bags, 2 dim tomato bags, 2 clear magenta bags.
drab magenta bags contain 3 dark beige bags.
faded cyan bags contain 2 striped lime bags, 4 bright red bags.
dark brown bags contain 4 mirrored lime bags, 1 bright orange bag.
posh fuchsia bags contain 5 shiny gold bags, 5 pale salmon bags, 1 light coral bag, 1 mirrored plum bag.
shiny magenta bags contain 4 dark aqua bags.
dark lavender bags contain 1 pale purple bag, 3 vibrant yellow bags.
vibrant brown bags contain 2 posh teal bags, 1 wavy silver bag, 2 pale plum bags.
muted black bags contain 5 faded crimson bags, 3 dim crimson bags, 4 vibrant magenta bags.
muted brown bags contain 5 striped olive bags, 5 dark brown bags, 2 clear brown bags, 4 plaid white bags.
pale orange bags contain 4 bright blue bags, 3 dark aqua bags, 1 clear gold bag.
light cyan bags contain 3 muted silver bags.
drab white bags contain 2 drab tan bags, 2 striped tomato bags, 4 dull gray bags, 5 drab blue bags.
dim tan bags contain 3 mirrored bronze bags, 3 faded salmon bags, 4 drab purple bags.
dull tomato bags contain 3 clear lime bags.
wavy aqua bags contain 3 dotted orange bags, 5 shiny crimson bags.
shiny lavender bags contain 5 vibrant blue bags, 4 pale purple bags, 1 wavy bronze bag, 2 posh violet bags.
shiny white bags contain 5 faded blue bags, 5 pale cyan bags.
wavy blue bags contain 4 vibrant chartreuse bags, 4 plaid brown bags, 3 plaid white bags, 2 faded gold bags.
striped magenta bags contain 2 dark olive bags, 5 bright chartreuse bags.
vibrant black bags contain 4 plaid white bags, 2 dull silver bags, 5 striped purple bags, 1 dark plum bag.
dull green bags contain 2 dull crimson bags.
vibrant chartreuse bags contain 2 bright orange bags, 4 dark aqua bags.
dim violet bags contain 2 dark teal bags, 4 plaid brown bags, 4 mirrored yellow bags.
clear blue bags contain 5 posh maroon bags.
faded tomato bags contain 5 clear beige bags, 4 bright orange bags.
posh violet bags contain 3 clear gold bags.
striped tomato bags contain 2 shiny black bags.
muted crimson bags contain 4 light aqua bags, 3 dim gold bags.
clear tan bags contain 4 drab tomato bags, 4 mirrored bronze bags, 1 shiny chartreuse bag.
posh magenta bags contain 4 posh red bags, 3 light bronze bags.
dim blue bags contain 5 dim gray bags, 1 light turquoise bag, 5 muted bronze bags.
drab plum bags contain 1 vibrant plum bag, 4 striped coral bags.
pale silver bags contain 5 drab black bags.
posh purple bags contain 2 dark brown bags.
drab indigo bags contain 1 muted lavender bag, 2 posh salmon bags, 1 pale brown bag.
striped blue bags contain 4 wavy teal bags.
wavy magenta bags contain 1 dotted salmon bag, 1 drab black bag, 2 dull tan bags, 1 drab silver bag.
pale turquoise bags contain 4 dark lime bags, 4 drab maroon bags.
shiny tan bags contain 4 plaid coral bags, 3 dim black bags, 1 dull plum bag.
light teal bags contain 3 dark violet bags.
mirrored silver bags contain 1 striped salmon bag, 1 clear chartreuse bag, 2 clear orange bags, 2 posh aqua bags.
wavy coral bags contain 2 muted teal bags, 1 wavy white bag.
wavy crimson bags contain 1 shiny aqua bag, 3 muted beige bags.
shiny bronze bags contain 1 posh indigo bag, 5 wavy blue bags, 1 faded gold bag, 3 striped tomato bags.
shiny maroon bags contain 1 clear tomato bag, 1 wavy crimson bag.
bright turquoise bags contain 3 dull tan bags, 3 vibrant teal bags.
faded purple bags contain 1 plaid chartreuse bag.
bright white bags contain 2 faded gold bags.
clear orange bags contain 4 striped blue bags, 2 mirrored lime bags, 5 muted turquoise bags.
clear cyan bags contain 1 dim plum bag, 3 shiny brown bags, 1 muted purple bag, 2 plaid lime bags.
plaid teal bags contain 2 faded aqua bags, 4 wavy olive bags.
dotted lime bags contain 5 posh olive bags, 2 pale orange bags.
muted tan bags contain 1 dull gray bag, 2 dark aqua bags, 1 pale violet bag.
striped orange bags contain 3 mirrored lime bags, 2 dull crimson bags, 4 faded gold bags, 3 pale silver bags.
light olive bags contain 2 dark tan bags, 3 dim orange bags, 5 mirrored yellow bags.
plaid magenta bags contain 2 wavy orange bags, 1 wavy chartreuse bag, 5 striped coral bags.
dark magenta bags contain 3 bright white bags, 3 plaid purple bags, 3 striped black bags, 4 light beige bags.
dark black bags contain 3 pale tan bags, 4 mirrored orange bags, 3 dull teal bags.
posh orange bags contain 4 bright aqua bags, 1 dim crimson bag, 4 dim turquoise bags, 1 dotted bronze bag.
dull crimson bags contain 4 vibrant violet bags.
clear turquoise bags contain 1 muted brown bag, 2 dull yellow bags, 3 pale black bags, 1 plaid crimson bag.
vibrant blue bags contain 2 clear beige bags.
dull lime bags contain 4 shiny plum bags, 3 vibrant magenta bags, 3 dark olive bags.
drab brown bags contain 4 clear green bags.
mirrored plum bags contain 2 faded red bags.
shiny fuchsia bags contain 2 muted cyan bags, 4 dark aqua bags, 3 light olive bags, 2 clear gold bags.
vibrant purple bags contain 3 pale aqua bags, 3 dark lime bags, 1 bright chartreuse bag.
bright crimson bags contain 1 vibrant gold bag.
shiny plum bags contain 2 clear olive bags, 4 dark plum bags.
shiny crimson bags contain no other bags.
dull beige bags contain 1 mirrored coral bag.
dim salmon bags contain 1 clear tomato bag, 2 shiny teal bags, 4 plaid olive bags, 3 plaid purple bags.
muted maroon bags contain 2 muted violet bags, 4 dark white bags.
pale aqua bags contain 4 dark beige bags, 1 muted brown bag.
bright plum bags contain 4 dim black bags.
striped tan bags contain 3 bright orange bags, 3 dark violet bags, 4 drab blue bags, 2 vibrant lime bags.
clear crimson bags contain 3 wavy brown bags, 1 faded blue bag, 2 striped cyan bags.
dim indigo bags contain 3 dotted lime bags, 1 dotted purple bag.
pale tan bags contain 2 drab blue bags, 5 dim orange bags, 5 wavy olive bags, 3 striped tomato bags.
vibrant bronze bags contain 5 clear red bags, 5 posh red bags.
dotted bronze bags contain 1 light yellow bag.
wavy salmon bags contain 2 striped olive bags, 4 muted teal bags.
shiny turquoise bags contain 3 dark teal bags, 1 plaid yellow bag.
faded maroon bags contain 1 vibrant salmon bag, 5 dotted magenta bags, 1 faded tan bag, 5 striped tomato bags.
vibrant teal bags contain 4 light teal bags, 3 pale orange bags, 5 drab white bags.
vibrant gold bags contain 1 muted cyan bag, 2 mirrored plum bags, 1 drab coral bag, 4 dark lime bags.
bright cyan bags contain 2 muted silver bags, 5 plaid bronze bags, 3 light beige bags, 2 faded crimson bags.
shiny silver bags contain 4 mirrored fuchsia bags, 2 clear violet bags, 3 faded beige bags.
dark tomato bags contain 4 clear lime bags, 2 light beige bags, 3 bright turquoise bags.
mirrored indigo bags contain 5 posh chartreuse bags, 5 clear tomato bags.
dotted indigo bags contain 2 drab olive bags, 2 dim indigo bags, 5 dotted magenta bags.
shiny gray bags contain 4 muted chartreuse bags, 4 plaid gray bags, 3 dull red bags, 5 striped orange bags.
dim yellow bags contain 1 muted cyan bag, 4 mirrored fuchsia bags, 1 faded gold bag, 1 drab turquoise bag.
bright lime bags contain 5 shiny bronze bags, 3 wavy aqua bags, 4 plaid turquoise bags.
dotted gray bags contain 2 shiny gold bags.
striped black bags contain 1 wavy teal bag, 5 dim chartreuse bags, 4 mirrored lavender bags.
pale beige bags contain 2 posh black bags, 4 clear white bags.
posh indigo bags contain 5 plaid white bags.
dull blue bags contain 4 dark violet bags, 2 clear magenta bags, 4 dotted crimson bags.
mirrored white bags contain 5 faded yellow bags.
bright brown bags contain 3 pale gray bags.
light gray bags contain 3 clear magenta bags, 5 wavy brown bags, 3 dotted salmon bags.
muted orange bags contain 1 bright magenta bag, 1 bright plum bag.
clear purple bags contain 1 shiny gold bag, 1 dark white bag.
striped coral bags contain 5 pale gray bags, 3 wavy chartreuse bags.
plaid green bags contain no other bags.
plaid maroon bags contain 5 posh brown bags, 3 striped crimson bags, 4 plaid green bags.
light maroon bags contain 3 muted gray bags, 5 dull crimson bags, 2 shiny maroon bags.
pale purple bags contain 2 striped white bags, 3 plaid chartreuse bags, 1 mirrored lime bag.
muted yellow bags contain 5 vibrant purple bags, 1 dark teal bag.
plaid olive bags contain 1 light crimson bag, 1 faded gold bag, 1 vibrant blue bag.
dim beige bags contain 4 muted silver bags, 3 mirrored beige bags, 4 striped violet bags.
striped chartreuse bags contain 3 dull teal bags.
muted salmon bags contain 2 posh salmon bags, 2 posh silver bags.
dim red bags contain 2 drab blue bags, 4 plaid crimson bags, 3 vibrant gold bags.
dull magenta bags contain 5 faded crimson bags, 1 shiny orange bag, 1 dark tan bag.
plaid beige bags contain 1 vibrant turquoise bag.
striped teal bags contain 2 dim chartreuse bags, 4 dark green bags.
dotted plum bags contain 2 light cyan bags.
dotted yellow bags contain 5 posh black bags, 5 dull tan bags, 2 dull violet bags, 5 muted plum bags.
dotted coral bags contain 1 striped tomato bag, 2 light crimson bags, 3 clear violet bags.
dull fuchsia bags contain 3 plaid purple bags, 4 mirrored red bags.
dull yellow bags contain 5 vibrant violet bags, 2 dark olive bags.
dull white bags contain 5 posh olive bags, 5 pale tomato bags, 2 bright teal bags.
pale brown bags contain 3 dim crimson bags, 3 pale indigo bags, 1 dim chartreuse bag, 4 muted teal bags.
shiny violet bags contain 1 muted tomato bag, 2 dull yellow bags, 1 drab teal bag.
drab blue bags contain 3 vibrant gold bags, 4 drab black bags.
posh lavender bags contain 5 shiny plum bags, 3 drab salmon bags, 4 dim brown bags, 4 plaid blue bags.
dull teal bags contain 2 drab turquoise bags, 1 shiny crimson bag, 5 shiny aqua bags.
shiny purple bags contain 3 drab orange bags, 4 dark red bags, 4 vibrant fuchsia bags, 2 light fuchsia bags.
pale salmon bags contain 2 plaid chartreuse bags, 3 striped white bags.
posh silver bags contain 4 clear magenta bags, 5 light magenta bags.
light salmon bags contain 4 vibrant olive bags.
striped turquoise bags contain 1 faded magenta bag, 3 shiny indigo bags, 4 striped lavender bags.
dotted crimson bags contain 2 pale silver bags, 2 striped magenta bags, 1 striped white bag.
dull brown bags contain 5 clear crimson bags, 1 dotted green bag, 4 dull magenta bags, 3 dim tan bags.
plaid cyan bags contain 1 striped orange bag, 2 muted cyan bags.
muted lavender bags contain 5 mirrored fuchsia bags.
dim lime bags contain 1 muted black bag.
light bronze bags contain 1 dull crimson bag, 5 dim chartreuse bags.
dull olive bags contain 2 vibrant coral bags, 3 shiny teal bags, 4 plaid purple bags.
posh yellow bags contain 5 dark lime bags, 3 mirrored plum bags.
bright fuchsia bags contain 1 striped silver bag.
posh maroon bags contain 4 dotted magenta bags, 4 posh yellow bags, 2 drab beige bags.
posh salmon bags contain 2 muted green bags.
mirrored gray bags contain 4 striped silver bags.
dull cyan bags contain 2 bright orange bags, 4 dark plum bags.
light crimson bags contain 3 drab fuchsia bags, 3 bright blue bags, 1 dark purple bag.
light red bags contain 3 dim maroon bags, 4 muted green bags, 3 dotted olive bags.
dull indigo bags contain 2 plaid brown bags, 1 wavy white bag, 2 vibrant turquoise bags, 5 drab chartreuse bags.
drab crimson bags contain 2 vibrant salmon bags.
posh red bags contain 3 mirrored violet bags, 1 striped tomato bag, 2 striped olive bags.
drab chartreuse bags contain no other bags.
posh lime bags contain 3 drab violet bags, 1 bright coral bag.
wavy red bags contain 4 striped gray bags, 3 posh salmon bags, 1 dotted violet bag, 3 striped aqua bags.
striped fuchsia bags contain 3 bright crimson bags, 3 dark silver bags, 1 clear magenta bag, 3 drab salmon bags.
striped plum bags contain 2 drab tan bags, 5 pale gold bags, 1 dull white bag, 1 clear coral bag.
mirrored maroon bags contain 1 dark magenta bag, 1 plaid purple bag, 2 light gray bags.
shiny indigo bags contain 2 drab teal bags.
dim silver bags contain 1 striped aqua bag, 3 dull tan bags, 3 striped tan bags, 2 wavy maroon bags.
shiny salmon bags contain 5 faded beige bags.
dull black bags contain 3 vibrant plum bags, 2 plaid chartreuse bags, 1 muted brown bag, 2 clear tomato bags.
clear plum bags contain 3 striped maroon bags, 2 dark white bags.
vibrant green bags contain 5 light orange bags, 5 mirrored magenta bags, 3 bright teal bags, 2 striped brown bags.
drab gray bags contain 1 plaid maroon bag, 2 pale tan bags, 1 plaid white bag.
wavy lime bags contain 2 clear gold bags, 2 bright chartreuse bags, 1 faded crimson bag.
light silver bags contain 4 dim maroon bags, 1 mirrored teal bag.
light brown bags contain 5 muted magenta bags.
dim fuchsia bags contain 5 pale purple bags, 5 wavy orange bags, 5 clear lime bags.
vibrant maroon bags contain 4 light gray bags.
dim purple bags contain 2 muted white bags, 2 shiny aqua bags.
clear olive bags contain 3 bright olive bags.
drab lavender bags contain 4 mirrored crimson bags, 3 bright violet bags, 5 posh gold bags, 2 bright olive bags.
light yellow bags contain 1 posh brown bag, 2 pale violet bags.
plaid crimson bags contain 1 plaid green bag, 3 shiny crimson bags.
pale indigo bags contain 3 clear aqua bags, 2 pale silver bags.
mirrored bronze bags contain 4 muted tomato bags, 4 bright white bags, 1 faded crimson bag.
dim teal bags contain 1 muted salmon bag.
clear violet bags contain 2 dim coral bags, 2 faded beige bags.
dotted silver bags contain 2 posh plum bags, 4 pale chartreuse bags.
pale gold bags contain 2 vibrant gold bags, 1 dotted magenta bag.
posh crimson bags contain 4 dull yellow bags, 3 clear fuchsia bags.
dull orange bags contain 3 dull silver bags, 3 clear violet bags, 4 clear chartreuse bags, 3 faded salmon bags.
striped lime bags contain 5 mirrored plum bags, 4 faded gold bags, 3 wavy white bags, 3 light teal bags.
mirrored tan bags contain 4 dull silver bags, 4 light coral bags, 2 plaid lavender bags.
wavy tomato bags contain 4 clear orange bags, 5 shiny fuchsia bags, 3 light red bags.
dotted teal bags contain 5 dark salmon bags, 1 light indigo bag, 4 pale white bags, 5 clear olive bags.
bright olive bags contain 1 dark tan bag, 4 striped orange bags, 3 bright orange bags.
plaid plum bags contain 1 shiny maroon bag, 1 dotted coral bag.
bright chartreuse bags contain 2 wavy blue bags.

9
aoc2020/7ex.txt Normal file
View file

@ -0,0 +1,9 @@
light red bags contain 1 bright white bag, 2 muted yellow bags.
dark orange bags contain 3 bright white bags, 4 muted yellow bags.
bright white bags contain 1 shiny gold bag.
muted yellow bags contain 2 shiny gold bags, 9 faded blue bags.
shiny gold bags contain 1 dark olive bag, 2 vibrant plum bags.
dark olive bags contain 3 faded blue bags, 4 dotted black bags.
vibrant plum bags contain 5 faded blue bags, 6 dotted black bags.
faded blue bags contain no other bags.
dotted black bags contain no other bags.

44
aoc2020/8.py Normal file
View file

@ -0,0 +1,44 @@
with open("8.txt") as f:
ins = []
for line in f:
ins.append(line.strip())
def term(ins):
f = set()
f2 = set()
acc = 0
ip = 0
while True:
if ip >= len(ins):
break
i = ins[ip]
if ip in f:
if ip in f2:
return None
f2.add(ip)
f.add(ip)
# print(ip, i)
c, v = i.split(" ")
v = int(v)
if c == "acc":
acc += v
elif c == "jmp":
ip = ip + v - 1
ip += 1
return acc
for i in range(len(ins)):
l = ins[i]
if not (l.startswith("jmp") or l.startswith("nop")): continue
orig = l
if l.startswith("jmp"):
new = l.replace("jmp", "nop")
elif l.startswith("nop"):
new = l.replace("nop", "jmp")
ins[i] = new
r = term(ins)
if r is None:
ins[i] = orig
else:
print(r)
break

634
aoc2020/8.txt Normal file
View file

@ -0,0 +1,634 @@
acc +15
acc +2
acc -14
jmp +362
acc +22
nop +236
jmp +474
acc +10
jmp +1
acc +0
jmp +236
acc +10
acc +14
jmp +334
acc +12
acc -1
jmp +478
jmp +90
jmp +208
acc +49
jmp +94
acc +2
acc -8
jmp +375
nop +21
acc +0
acc +10
nop +25
jmp +492
nop +182
acc +49
acc -12
jmp -14
acc -16
jmp +140
acc -3
acc -18
acc +28
acc -6
jmp +558
acc +2
acc +27
nop +438
acc +41
jmp +508
acc +13
jmp +117
acc +21
acc -13
acc +34
jmp +1
jmp +1
nop +451
acc +28
acc +31
acc +31
jmp +280
acc +32
acc +35
acc -18
jmp +509
acc -15
acc -8
nop +288
acc -16
jmp +376
acc -19
acc -8
acc +11
acc +10
jmp +50
acc +19
nop -58
acc -9
jmp +43
acc +10
acc +2
nop -63
jmp +280
acc -7
jmp +175
jmp +69
acc +16
acc +9
acc -2
acc -5
jmp +276
nop +195
acc +50
acc -8
jmp -55
nop +1
nop -78
acc +31
jmp +535
acc +9
acc +33
acc +4
acc +48
jmp +8
acc +30
acc +42
acc +18
acc +37
jmp -69
nop +121
jmp +44
acc +3
acc +33
acc -6
acc +37
jmp +403
acc -6
jmp +245
jmp -93
acc +5
jmp +406
jmp -26
nop -47
jmp +239
acc +7
acc +31
acc +14
acc +0
jmp +291
acc +46
jmp +394
acc +44
acc +36
nop +45
jmp +137
acc -16
acc +10
acc -4
acc +7
jmp +76
acc +24
jmp +93
acc +17
acc +0
acc +6
acc +4
jmp +385
acc -8
acc +49
acc +28
jmp +95
nop +12
acc +33
jmp +153
nop +254
acc +18
acc -16
acc +50
jmp +299
acc +27
acc +47
acc -17
jmp -15
acc +35
acc +14
jmp +204
jmp +93
acc +46
nop -5
nop -158
jmp +221
jmp +321
acc -2
acc +49
acc +3
acc -17
jmp -52
jmp +7
nop +52
acc +25
jmp +376
acc -3
nop -133
jmp +32
jmp +328
nop +374
acc +37
acc +6
jmp +92
acc +47
nop +394
jmp -13
jmp -170
acc +9
jmp -47
acc -18
acc +27
jmp +1
acc +3
acc -5
jmp +337
acc +21
jmp +364
acc +24
acc +43
acc +50
jmp +58
jmp -18
acc +30
jmp +144
nop +5
acc +50
nop +245
nop +133
jmp +270
jmp -22
nop -76
jmp +398
acc +40
acc +30
jmp +361
acc +36
acc +30
jmp +392
acc -17
nop +71
acc -12
jmp +102
acc +17
jmp +283
acc -16
jmp +65
nop -2
jmp +149
jmp -103
jmp -179
acc +46
jmp +289
acc +48
jmp +114
acc +13
jmp +114
nop +215
nop -89
jmp +337
acc -2
acc +2
acc -7
jmp -18
jmp -51
acc +30
acc +43
acc +28
jmp -188
acc +36
acc +7
acc -5
acc +38
jmp +88
jmp +225
acc -14
acc -3
acc -15
jmp +66
acc +7
acc +43
nop -210
acc -9
jmp +109
acc -10
jmp +242
acc -5
acc +15
acc +8
jmp +310
acc +31
acc -2
acc +11
acc -15
jmp +103
acc +32
jmp -92
acc -10
acc +6
acc -1
jmp -131
acc +43
acc +30
acc +13
acc +33
jmp +25
acc +9
acc -14
acc +19
acc +44
jmp -50
acc -8
acc +9
jmp +312
jmp -96
acc -3
acc -3
acc +24
jmp +94
acc -15
jmp +61
acc +19
nop -89
acc +24
nop -94
jmp +5
acc -13
acc +25
acc +42
jmp +1
jmp +137
acc +44
acc +44
acc +41
jmp +152
jmp +144
acc -1
nop +293
jmp -120
acc -17
nop -171
acc +27
jmp -173
jmp +231
acc +3
jmp +109
acc +18
acc +32
acc -14
acc -8
jmp +177
acc +28
jmp -134
nop +277
jmp -124
jmp +167
nop +274
acc +6
acc +43
acc +10
jmp -320
acc +28
acc -9
acc +22
jmp -90
jmp -203
jmp -133
jmp -6
jmp -181
jmp +170
acc +40
acc +5
jmp -274
acc +36
acc +24
nop +6
jmp -339
jmp -251
acc +10
acc +10
jmp -347
jmp +263
acc +37
jmp -201
acc -11
acc +42
jmp +153
nop -179
acc -9
jmp +8
jmp -289
jmp -25
acc +45
jmp -142
acc +42
acc -10
jmp +83
acc +43
acc +3
acc -6
jmp -222
acc +41
acc +14
acc +7
acc +2
jmp -35
jmp +168
acc +11
acc +18
acc +8
acc -4
jmp -203
acc +44
jmp +10
nop -184
acc +0
jmp +91
acc -5
nop +226
acc +46
acc -10
jmp -15
jmp -321
acc +0
acc +33
jmp +82
jmp +1
acc -12
acc +30
jmp +152
acc +6
jmp -208
acc +43
jmp +39
acc +23
acc +23
acc +24
acc +26
jmp -390
acc +15
acc +3
acc +14
acc +46
jmp -239
acc -10
acc +19
jmp +167
acc +46
acc +0
jmp -280
acc -7
jmp -107
acc +13
jmp -76
acc +48
jmp -65
nop +23
nop -89
acc +47
jmp -304
acc -5
jmp +1
acc +50
acc +37
jmp -129
acc +27
jmp +1
jmp -212
acc +18
acc +29
acc +1
jmp -74
acc +24
acc -12
jmp -173
acc -18
acc -6
nop -156
jmp -309
acc +46
acc -13
acc +41
acc +11
jmp -188
acc +32
jmp -190
acc +31
acc +30
jmp -122
acc -7
jmp +37
acc +2
acc +16
acc +45
acc +44
jmp -376
acc +47
jmp +1
jmp -147
acc +47
acc -18
acc -1
acc +2
jmp -152
acc +12
acc -8
jmp +90
nop +67
acc +9
jmp +1
jmp -377
jmp +1
jmp -238
jmp +1
acc +47
acc +7
acc +31
jmp -427
acc +10
acc +13
nop +13
jmp -8
nop -292
acc +11
nop -203
jmp -164
jmp -19
acc +31
jmp -289
acc -7
acc -16
acc +35
jmp -333
jmp -500
acc +32
acc +29
acc +18
acc +14
jmp -161
jmp -60
jmp +6
acc +4
nop -108
acc +27
jmp +2
jmp -133
acc +2
jmp -103
acc +40
nop -512
acc +48
jmp -196
acc +47
acc +40
nop -346
acc -2
jmp -530
acc +17
nop -31
acc +1
jmp -74
acc -15
acc +4
nop -330
acc +32
jmp -115
acc -3
jmp +1
acc +14
acc +31
jmp -352
jmp -10
acc +18
jmp -322
acc +41
jmp +59
acc -16
nop -359
acc +29
acc +26
jmp -418
acc +10
acc +47
jmp -519
acc -5
nop +40
acc +30
jmp -195
acc +31
acc +3
acc +8
jmp -10
acc -12
acc +21
acc -1
jmp +30
jmp -341
acc -5
jmp -405
acc -13
jmp -170
acc +24
acc -16
acc +20
acc +17
jmp -145
acc +42
acc +33
jmp -395
nop -142
acc +45
acc +15
jmp -399
nop -223
jmp -299
jmp -453
acc -6
nop -498
acc +42
jmp -112
acc +39
acc +46
acc +4
acc +27
jmp -234
jmp +1
acc +45
acc +47
jmp -307
jmp -378
jmp -431
acc +13
acc +29
jmp -282
acc +4
acc -3
acc +37
acc +40
jmp -32
nop -148
acc +38
acc +40
acc +18
jmp -171
nop -546
jmp -490
acc +36
jmp -514
acc +27
acc -10
nop -560
acc +44
jmp +1

9
aoc2020/8ex.txt Normal file
View file

@ -0,0 +1,9 @@
nop +0
acc +1
jmp +4
acc +3
jmp -3
acc -99
acc +1
jmp -4
acc +6

53
aoc2020/9.py Normal file
View file

@ -0,0 +1,53 @@
import itertools
prev=None
sums = dict()
ns = []
with open("9.txt") as f:
for i in range(25):
ns.append(int(f.readline().strip()))
for a in ns:
for b in ns:
if a == b: continue
if a not in sums: sums[a] = set()
sums[a].add(a + b)
for line in f:
n = int(line.strip())
for v in sums.values():
if n in v:
break
else:
print("NOT", n)
bad = n
break
fi = ns[0]
del sums[fi]
ns.pop(0)
sums[n] = set()
for a in ns:
sums[n].add(a + n)
ns.append(n)
with open("9.txt") as f:
ns = []
for line in f:
n = int(line.strip())
ns.append(n)
for a in range(len(ns)-1):
running = ns[a]
found = False
for b in range(a+1, len(ns)):
running+=ns[b]
if running==bad:
r = ns[a:b+1]
print(bad, sum(r), min(r)+max(r), r)
found = True
elif running > bad:
break
#print(a, running, ns[a:b])
if found: break

1000
aoc2020/9.txt Normal file

File diff suppressed because it is too large Load diff

33
aoc2020/p15.nim Normal file
View file

@ -0,0 +1,33 @@
import tables
iterator play(start: seq[int]): int =
var spoke = initTable[int, int]()
var turn = 0
var nextSpeak = 0
for i in start:
turn += 1
spoke[i] = turn
yield i
nextSpeak = 0
while true:
turn += 1
yield nextSpeak
var lastSpoke = spoke.getOrDefault(nextSpeak, -1)
spoke[nextSpeak] = turn
if lastSpoke == -1:
nextSpeak = 0
else:
nextSpeak = turn - lastSpoke
proc solve(s: seq[int], n: int): int =
var i = 0
for x in play(s):
inc i
if i == n:
echo x
break
echo solve(@[5,1,9,18,13,8,0], 30000000)

35
aoc2021/2.py Normal file
View file

@ -0,0 +1,35 @@
with open("2.txt") as f:
data = f.read()
with open("2.txt") as f:
lines = list(map(lambda s: s.rstrip(), f.readlines()))
x = 0
y = 0
for line in lines:
if not line: continue
p = line.split(" ")
n = int(p[1])
if p[0] == "forward":
x += n
elif p[0] == "down":
y += n
elif p[0] == "up":
y -= n
print(x * y)
x = 0
y = 0
aim = 0
for line in lines:
if not line: continue
p = line.split(" ")
n = int(p[1])
if p[0] == "forward":
x += n
y += aim * n
elif p[0] == "down":
aim += n
elif p[0] == "up":
aim -= n
print(x * y)

1001
aoc2021/2.txt Normal file

File diff suppressed because it is too large Load diff