diff --git a/2020/day1/day1.py b/2020/day1/day1.py new file mode 100644 index 0000000..2123615 --- /dev/null +++ b/2020/day1/day1.py @@ -0,0 +1,21 @@ +#! /usr/bin/env python3 +from itertools import product + + +def part1(inp): + inp = [int(x) for x in inp] + result_pairs = [x for x in list(product(inp, inp)) if sum(x) == 2020] + print(result_pairs) + print(result_pairs[0][0] * result_pairs[0][1]) + + +def part2(inp): + inp = [int(x) for x in inp] + result_pairs = [x for x in list(product(inp, repeat=3)) if sum(x) == 2020] + print(result_pairs) + print(result_pairs[0][0] * result_pairs[0][1] * result_pairs[0][2]) + + +if __name__ == "__main__": + with open("input.txt") as f: + part2(f.readlines()) diff --git a/2020/day1/input.txt b/2020/day1/input.txt new file mode 100644 index 0000000..5e3f00a --- /dev/null +++ b/2020/day1/input.txt @@ -0,0 +1,200 @@ +1975 +1446 +1902 +1261 +1783 +1535 +1807 +1606 +1685 +1933 +1930 +1813 +1331 +1986 +1379 +1649 +1342 +1206 +1832 +1464 +1840 +1139 +1316 +1366 +593 +1932 +1553 +1065 +2004 +1151 +1345 +1026 +1958 +1778 +1987 +1425 +1170 +1927 +1487 +1116 +1612 +2005 +1977 +1691 +1964 +398 +1621 +1542 +1929 +1102 +1993 +1426 +1349 +1280 +1775 +849 +1344 +1940 +1707 +1562 +1979 +1325 +1610 +559 +1812 +1938 +1572 +1949 +1136 +161 +1893 +1207 +1363 +1551 +1333 +1904 +1332 +1450 +1773 +1216 +1185 +1881 +1835 +1460 +1277 +1374 +1568 +1731 +1365 +1719 +1749 +1371 +1602 +1108 +1030 +1859 +1875 +1976 +1837 +1768 +1873 +1226 +1533 +1601 +1394 +1422 +1219 +1269 +1793 +1195 +1234 +1575 +1882 +1223 +1826 +521 +1161 +1738 +1506 +1574 +1337 +1509 +1430 +1496 +1318 +1400 +1852 +1670 +1898 +1858 +1950 +1870 +1920 +868 +1814 +1853 +1911 +1907 +1713 +1281 +1759 +1210 +1350 +1035 +1585 +1765 +1220 +1125 +1714 +1810 +1002 +1356 +1192 +1452 +1236 +1482 +1716 +1681 +1323 +1923 +1876 +1792 +1346 +1891 +1721 +1056 +1675 +1518 +1540 +1068 +1563 +1942 +1668 +1653 +1357 +1632 +1128 +1726 +1586 +1998 +1138 +1510 +1022 +1480 +1434 +1305 +1861 +1623 +1009 +1339 +1159 +1085 +1578 +1689 +1091 +1874 +1043 +1737 +1704 +1515 diff --git a/2020/day10/day10.py b/2020/day10/day10.py new file mode 100644 index 0000000..d667976 --- /dev/null +++ b/2020/day10/day10.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python3 +from collections import Counter + + +def part1(adapters): + counts = Counter() + # 1 for the socket, of 3 for the device + for current, next in zip([0] + adapters, adapters + [3]): + counts[next - current] += 1 + return counts[1] * counts[3] + + +def part2(adapters): + counts = Counter({0: 1}) + for jolt in adapters: + s = counts[jolt - 1] + counts[jolt - 2] + counts[jolt - 3] + counts[jolt] = s + return max(counts.values()) + + +if __name__ == "__main__": + adapters = sorted(int(l.rstrip()) for l in open("input.txt")) + print(part1(adapters)) + print(part2(adapters)) diff --git a/2020/day10/input.txt b/2020/day10/input.txt new file mode 100644 index 0000000..b8be7cc --- /dev/null +++ b/2020/day10/input.txt @@ -0,0 +1,99 @@ +151 +94 +14 +118 +25 +143 +33 +23 +80 +95 +87 +44 +150 +39 +148 +51 +138 +121 +70 +69 +90 +155 +144 +40 +77 +8 +97 +45 +152 +58 +65 +63 +128 +101 +31 +112 +140 +86 +30 +55 +104 +135 +115 +16 +26 +60 +96 +85 +84 +48 +4 +131 +54 +52 +139 +76 +91 +46 +15 +17 +37 +156 +134 +98 +83 +111 +72 +34 +7 +108 +149 +116 +32 +110 +47 +157 +75 +13 +10 +145 +1 +127 +41 +53 +2 +3 +117 +71 +109 +105 +64 +27 +38 +59 +24 +20 +124 +9 +66 diff --git a/2020/day11/day11.py b/2020/day11/day11.py new file mode 100644 index 0000000..0ed735c --- /dev/null +++ b/2020/day11/day11.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python3 +from rules import part1_rules + + +def main(grid, rules): + generation = 0 + while True: + changes, next_grid = step(grid, rules) + generation += 1 + grid = next_grid + assert generation < 1000 + if changes == 0: + return next_grid.count("#") + + +def step(grid, rules): + changes = 0 + next_grid = grid[:] + for index, cell in enumerate(grid): + try: + changes += rules[cell](index, grid, next_grid) + except KeyError: + pass + return changes, next_grid + + +if __name__ == "__main__": + with open("input.txt") as infile: + grid = list("".join(infile.read().splitlines())) + print("Part 1 ", main(grid, rules=part1_rules)) + + # print("Part 2 ", main(grid, rules={"L": handle_empty_2, "#": handle_occupied_2})) diff --git a/2020/day11/grid.py b/2020/day11/grid.py new file mode 100644 index 0000000..ad73118 --- /dev/null +++ b/2020/day11/grid.py @@ -0,0 +1,28 @@ +#!/usr/bin/env python3 + + +class Grid: + def __init__(self, inp): + lines = inp.read().splitlines() + self.cells = list("".join(lines)) + self.height = len(lines) + self.width = len(lines[0]) + + def __getitem__(self, key): + x, y = key + return cells[y * self.width + x] + + def __setitem__(self, key, value): + x, y = key + cells[y * self.width + x] = value + + def __iter__(self): + return self.cells.__iter__() + + def __str__(self): + "\n".join( + "".join( + grid[pos : pos + grid_width] + for pos in range(0, self.width, self.height) + ) + ) diff --git a/2020/day11/input.txt b/2020/day11/input.txt new file mode 100644 index 0000000..514df25 --- /dev/null +++ b/2020/day11/input.txt @@ -0,0 +1,97 @@ +LLLLLLLLLLLLLLLLLLLLLLLLL.LLLLL..LLLLLLLLLLLL.LLL..LLLLLLLLLLLLLL.LL.LLLLL.LLLLLLLLL.LLLLLLLLLLLLL +LLLLLLL.LLLLLLL.LLLLLLLLL.LLLLL.LLLL.LLLLLLLL.LLLLLLLLL.LLLL.LLLLLLLLLLLLLLLLLLLLLL..LLLLLLL..LLLL +LLLLLL.LLLLLLLLLLLLLLLLLL.LLLLL.LLLLLLLLL.LLL.LLLLLLLLLLLLLL.LLLLLLL..LLLLLLLLLLLLLLLLLLLLLL.LLLLL +LLLLLLL.LLLLLLLLLLLLLLLLLLLLLL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.LLL.LLLLL.LLLLLLLLLLLLLLLLLLLLLLL +LLLLLLL.LLLLLLL.LLLLLLLLL.L.LLL.LL.LLLLLLLL.L.LLLL.LLLLLLLLL.LLLLLLLLLLLLLLLLLLLLLLL.LLLLLLLLLLLLL +.LL.LLL.LLLLLLL.LLLLLLLLL.LLLLL.LLLLLLLLLLLLL.LLLL.LLLLLLLLL.LLLLLLLLLLL.L.LLLLLLLLLLLLLLLLL.LLLLL +LLLLLLL.LLLLLLLLLLLLLLLLL.LLLLLLLLLL.LLLLLLLL.LL.LLLL.LLLLLL.LLLLLLLLLLLLLLLLLLLLLLL.LLLLLLLLLLLLL +LLLL.LL.LLLLLLL.LLLLLLLLL.LLLLL.LLLLLLLLLLLLLLLLLL.LLLLLLLLLLLLLLLLL.LLLLLLLLLLLLLLL.LLLLLLL.LLLLL +LLLLLLLLLLLLLLLLLLLLLLLLL.LLLLL.LL.LLLLLLLLLL.LLLL.LLLLLLLLL.LLLLLLL.LLLLL.LLLLLLL.LLLLLLLLL.LLLLL +LLLLLLL.LLLLLLL..LLLLLLLLLLLLLLLLLLL.LLLLLLLLLLLLL.LLLLLLLLL.LL.LLLL.LLLLL.LLLLLLLLL.LLLLLLL.LLLLL \ No newline at end of file diff --git a/2020/day11/rules.py b/2020/day11/rules.py new file mode 100644 index 0000000..7fb1e49 --- /dev/null +++ b/2020/day11/rules.py @@ -0,0 +1,115 @@ +#!/usr/bin/env python3 +from itertools import count, takewhile + +directions = ( + (-1, -1), + (-1, 0), + (-1, 1), + (0, -1), + (0, 1), + (1, -1), + (1, 0), + (1, 1), +) + +grid_width = 98 +grid_height = 97 + + +def handle_empty(index, grid, next_grid): + """ + If a seat is empty (L) and there are no occupied seats adjacent to it, the seat becomes occupied. + """ + neighbors = count_neighbors(index, grid) + if neighbors == 0: + next_grid[index] = "#" + return 1 + return 0 + + +def handle_occupied(index, grid, next_grid): + """ + If a seat is occupied (#) and four or more seats adjacent to it are also occupied, the seat becomes empty. + """ + neighbors = count_neighbors(index, grid) + if neighbors >= 4: + next_grid[index] = "L" + return 1 + return 0 + + +def count_neighbors(pos, grid): + neighbors = 0 + x = pos % grid_width + y = pos // grid_width + for (dx, dy) in directions: + xx = x + dx + yy = y + dy + if not in_bounds((xx, yy)): + continue + + if grid[yy * grid_width + xx] == "#": + neighbors += 1 + return neighbors + + +def handle_empty_2(index, grid, next_grid): + """ + If a seat is empty and there are no occupied seat visible in neither direction, + the seat becomes occupied + """ + neighbors = 0 + x = index % grid_width + y = index // grid_width + for direction in directions: + # keep moving in the specified direction, while checking + # that we are in bounds of the grid + for xx, yy in takewhile(in_bounds, move(x, y, direction)): + cell = grid[yy * grid_width + xx] + if cell == "#": + neighbors += 1 + elif cell == "L": + break # No occupied seat in that direction, we can break + + if neighbors == 0: + next_grid[index] = "#" + return 1 + return 0 + + +def handle_occupied_2(index, grid, next_grid): + """ + An occupied seat becomes empty if there are five or more visible occupied + seats in either direction. + """ + occupied = 0 + x = index % grid_width + y = index // grid_width + for direction in directions: + for xx, yy in takewhile(in_bounds, move(x, y, direction)): + print(xx, yy) + cell = grid[yy * grid_width + xx] + + if cell == "#": + occupied += 1 + + if occupied >= 5: + next_grid[index] = "L" + return 1 + return 0 + + +def in_bounds(pos): + x, y = pos + return 0 <= x < grid_width and 0 <= y < grid_height + + +def move(x, y, direction): + pos = x, y + while True: + yield pos + pos = x + direction[0], y + direction[1] + + +part1_rules = {"L": handle_empty, "#": handle_occupied} +part2_rules = {"L": handle_empty_2, "#": handle_occupied_2} diff --git a/2020/day14/day14.py b/2020/day14/day14.py new file mode 100644 index 0000000..d8fa532 --- /dev/null +++ b/2020/day14/day14.py @@ -0,0 +1,58 @@ +#!/usr/bin/env python3 +from collections import defaultdict + + +def part1(infile): + memory = defaultdict(int) + for line in infile: + left, right = line.split("=") + if left.startswith("mask"): + one_mask = right.translate(right.maketrans("X", "0")) + zero_mask = right.translate(right.maketrans("X10", "001")) + else: + address = int(left.split("[")[1].rstrip("] ")) # mem[42] -> 42 + value = int(right.rstrip()) + memory[address] = value & ~int(zero_mask, 2) | int(one_mask, 2) + + return sum(memory.values()) + + +def part2(infile): + memory = defaultdict(int) + for line in infile: + left, right = line.split(" = ") + if left.startswith("mask"): + mask = right.rstrip() + else: + value = right.rstrip() + address = apply_mask(left.split("[")[1].rstrip("] "), mask) + for addr in generate_floating_addresses(address): + memory[int(addr, 2)] = int(value) + return sum(memory.values()) + + +def apply_mask(address, mask): + address = bin(int(address)).lstrip("0b") + address = address.zfill(36) + for index, bit in enumerate(mask): + if bit == "1": + address = address[:index] + "1" + address[index + 1 :] + elif bit == "X": + address = address[:index] + "X" + address[index + 1 :] + return address + + +def generate_floating_addresses(address): + index = address.find("X") + if index == -1: + return [address] + a1 = generate_floating_addresses(address[:index] + "0" + address[index + 1 :]) + a2 = generate_floating_addresses(address[:index] + "1" + address[index + 1 :]) + return a1 + a2 + + +if __name__ == "__main__": + with open("input.txt") as infile: + print(part1(infile)) + infile.seek(0) + print(part2(infile)) diff --git a/2020/day14/input.txt b/2020/day14/input.txt new file mode 100644 index 0000000..2cb4dc2 --- /dev/null +++ b/2020/day14/input.txt @@ -0,0 +1,564 @@ +mask = 1000XX0X0X0X0011XX11110110X101101X01 +mem[17353] = 91550 +mem[3346] = 113780395 +mem[25928] = 15887 +mask = 1100X110000111X1X010X101X01110110X01 +mem[22673] = 365674634 +mem[56387] = 707 +mem[59272] = 66101 +mask = 00110000X1011011111X1X100X1001111000 +mem[26721] = 1906961 +mem[6434] = 1547 +mem[38772] = 3670902 +mask = 1X0110X001101011X011000011000010X100 +mem[14129] = 9885418 +mem[16579] = 19578559 +mem[17948] = 222711 +mem[39312] = 3696 +mem[28037] = 4392 +mask = 1XX01010010100101010X10X0X100X110X0X +mem[27174] = 34330 +mem[38975] = 1673 +mem[53860] = 43706522 +mem[24314] = 129 +mem[46690] = 2122756 +mem[51409] = 300 +mask = X0X00100X110101XX1110000001000X01101 +mem[16769] = 6839 +mem[4773] = 197670 +mem[16306] = 9387 +mem[23109] = 18936748 +mask = X001X00001111X11X11XX1000001001X1111 +mem[9277] = 2126 +mem[19599] = 2620 +mem[35796] = 1119795 +mem[43013] = 7907629 +mem[34780] = 73089 +mem[43625] = 1251 +mem[45268] = 35981183 +mask = 11X0XX100X01001010101000X000X00X0001 +mem[28057] = 87060 +mem[57943] = 156869 +mem[34328] = 441008 +mem[19172] = 974642 +mem[13455] = 140868162 +mem[10479] = 1478 +mem[3348] = 610 +mask = 1X0011X0000X00X111111X0011001100XX00 +mem[20706] = 371595403 +mem[32191] = 61238 +mem[32541] = 121 +mask = 000101X1X110X01X1010X1XX011XX0110110 +mem[2502] = 3004 +mem[42813] = 50475 +mem[6736] = 218863 +mem[57229] = 542 +mask = X00011110X101011X01100X11011010X100X +mem[29838] = 6609 +mem[63501] = 76 +mem[35757] = 447 +mem[19646] = 1841 +mem[50155] = 10989663 +mask = 10011000X01110XX1111X10XX00000101001 +mem[16439] = 1250783 +mem[50267] = 12877 +mask = 000X0X011110101X101X010X1X1100X0X1X1 +mem[55873] = 29485206 +mem[3857] = 932873 +mem[53144] = 49937201 +mem[45634] = 3973 +mem[62141] = 84958 +mask = 10001X110XX01011X1100X011010110110XX +mem[27094] = 64589302 +mem[20130] = 1670 +mem[42036] = 39179827 +mem[31787] = 25295623 +mem[39027] = 1380 +mem[53488] = 593805 +mem[27469] = 6270971 +mask = 0101000001111011101110XXX010X0100010 +mem[34667] = 1338 +mem[2529] = 49045 +mem[40550] = 149 +mem[56292] = 14155 +mask = 1100111X0X0110X11111111010X001001111 +mem[6465] = 8116 +mem[45171] = 158525709 +mem[10613] = 1661122 +mem[37037] = 19153 +mask = 1X0000X1111X1010X1110101100001X10101 +mem[3530] = 361 +mem[15560] = 140278839 +mem[62028] = 12515878 +mem[20628] = 11032 +mem[48912] = 111176 +mem[47515] = 605 +mask = X00111001XX11011X1111X000100X0X0X010 +mem[4615] = 738 +mem[672] = 1477 +mem[16686] = 24069368 +mask = 110011100XX10000X0X00XX0X11100X10111 +mem[12619] = 1252770 +mem[954] = 590503 +mem[16403] = 1087106 +mem[11529] = 24258 +mem[11701] = 160993242 +mem[42676] = 64764346 +mem[7626] = 316 +mask = X001100XXX111X111X1111X000X0X0011100 +mem[42659] = 2822 +mem[40278] = 2173727 +mem[32236] = 13461 +mem[8739] = 49532769 +mem[23981] = 6272019 +mem[26083] = 7424 +mask = 1X001110010X101110111001100X0101XX01 +mem[5207] = 285084 +mem[46863] = 202944 +mem[29623] = 74688785 +mem[39251] = 2480123 +mem[21934] = 128729 +mem[17298] = 74932253 +mem[3243] = 2421447 +mask = 100001000X11100X1X110010XX1010XX010X +mem[45668] = 70363 +mem[5250] = 19909279 +mem[20889] = 8027 +mem[61368] = 422881 +mask = 1010110X0X111X1111110000X01100XX010X +mem[7264] = 4257 +mem[62228] = 4486 +mem[11135] = 31885819 +mem[50978] = 523114 +mem[12827] = 9872 +mask = 10X011010110X011001X11001X1100X11101 +mem[15425] = 38832030 +mem[7190] = 3685311 +mem[4442] = 111088 +mem[46774] = 679 +mem[48679] = 30399 +mask = 101100X111011111X1111100X1X100001001 +mem[21055] = 143042 +mem[44782] = 112377326 +mem[62184] = 8230 +mem[49662] = 512539 +mem[26324] = 73321 +mem[17454] = 107773 +mem[63437] = 73219244 +mask = 10000111011110111X1000XX1010X1X0X111 +mem[36342] = 1818 +mem[18094] = 47648232 +mem[52003] = 776369 +mask = 11001X100XX0X01111111XX0110111X00110 +mem[29103] = 5339928 +mem[36458] = 988421275 +mem[749] = 185734229 +mem[33969] = 29427002 +mask = 10X1X0X111X11XX11X11110011XX00011100 +mem[18473] = 197816 +mem[140] = 1537228 +mem[5706] = 1016744730 +mem[21968] = 425238881 +mem[2299] = 7217883 +mem[36197] = 66 +mask = 100110X10X11X011111111X100110X110X00 +mem[5148] = 3669 +mem[50092] = 313576115 +mem[1719] = 23750788 +mem[62734] = 2882 +mem[49010] = 14217157 +mask = 1X0XXX00011X10111X1110000011101X0X1X +mem[24047] = 11171624 +mem[34404] = 251169353 +mem[23056] = 3568348 +mem[2599] = 9449217 +mask = 0X0X11X1011010111X101X00X111X0001100 +mem[49530] = 1917 +mem[23017] = 4137 +mem[42892] = 209824 +mem[44196] = 2282 +mem[340] = 416390430 +mem[40836] = 4717162 +mask = 1101X000XX1010111011XX1X0000100X0000 +mem[20534] = 116 +mem[51190] = 846413 +mem[43522] = 88862477 +mem[56757] = 7097 +mask = 00000101111XX01110X0X00000111000110X +mem[20975] = 25703 +mem[11316] = 7721 +mem[56239] = 29785 +mem[51862] = 145224773 +mem[3358] = 10907 +mem[13070] = 77929 +mask = 0X0011110110X0111X1XX11001100X0X11XX +mem[22991] = 231 +mem[33217] = 2826 +mem[34404] = 509 +mask = 100X11X00000X0X11111000XX000X01010X0 +mem[18012] = 4386 +mem[56514] = 16103818 +mem[46863] = 7016934 +mem[53389] = 2025015 +mem[5646] = 77832170 +mask = 110011X00001X0X11111X100X0000100X01X +mem[38058] = 327471 +mem[7489] = 247743521 +mem[41341] = 980157 +mask = 10X01XX000X1001X1111X000X101000111X1 +mem[2278] = 1003775 +mem[4957] = 695497071 +mem[27026] = 83380 +mem[58747] = 3055795 +mem[35663] = 424302 +mem[55675] = 1400 +mem[59995] = 15450 +mask = 0X011001001X1X1X10110100011011001011 +mem[18012] = 105413272 +mem[18353] = 2478 +mem[10658] = 33943560 +mem[64129] = 97108 +mem[16290] = 585316720 +mem[38816] = 26080808 +mask = 100X1X10XXX0101X101X000X00111011011X +mem[37923] = 340333740 +mem[34920] = 429908705 +mem[955] = 1727757 +mem[65269] = 221055157 +mem[10891] = 523742 +mem[7264] = 21158973 +mask = 10XX1100011X10111X1100X00000X0111111 +mem[61904] = 63495 +mem[57943] = 33076 +mem[20097] = 836033572 +mem[12549] = 55029 +mem[3024] = 3602462 +mask = 110X0000011010X11011X0X0101X10XX000X +mem[14134] = 1542 +mem[802] = 10323 +mem[51543] = 171365721 +mem[12827] = 3980 +mask = 1000X100011110X1111100X100XXX0X001X1 +mem[8136] = 449831 +mem[1281] = 999072275 +mem[20796] = 332579 +mem[443] = 131455 +mem[12894] = 18123 +mem[50922] = 5177801 +mask = 100XXX0001101011X1110X000001101011XX +mem[18244] = 930 +mem[672] = 89370 +mem[42478] = 50196 +mem[35527] = 16 +mem[61716] = 105683782 +mask = 1000XX00011010111X110X0X1011101XX110 +mem[6775] = 3861120 +mem[843] = 312 +mem[2688] = 196099 +mem[37141] = 377569 +mem[33497] = 825 +mem[32589] = 1629649 +mask = 10X100011X1X1011X01110XX11X01100X100 +mem[20624] = 315487 +mem[31408] = 72488 +mem[63467] = 13483 +mem[2471] = 177211433 +mem[45598] = 62138 +mem[25301] = 6365509 +mask = 110011X0000111001X110110X00XX00001X0 +mem[42036] = 7869 +mem[55966] = 14443044 +mem[27440] = 100934729 +mem[19003] = 2085 +mem[15653] = 2142716 +mem[23117] = 1021 +mem[45011] = 5295150 +mask = X100101X0000X01111111001110X010X111X +mem[57308] = 11803 +mem[2240] = 961172 +mask = 100011X0011010111X1XX100101010XXX1X0 +mem[2444] = 243334769 +mem[12549] = 40175975 +mask = X0011001X011111110110XX00X0X00X11011 +mem[24834] = 363054 +mem[32941] = 83666205 +mem[16403] = 444996 +mask = 1100X1100001XXXX101X01001X101000010X +mem[56757] = 6879 +mem[4442] = 2107238 +mem[25399] = 14684 +mem[38582] = 330023 +mem[59557] = 299 +mem[34404] = 357591660 +mask = 0100X11101100011111XX1X000100011111X +mem[19990] = 405059382 +mem[50770] = 21723749 +mem[47204] = 310 +mem[55142] = 353841 +mem[31516] = 46662 +mem[59748] = 154981 +mask = 100X111001X010111X110X1X101110X01111 +mem[25989] = 412990662 +mem[44019] = 11063 +mem[5207] = 25633 +mem[23445] = 2402831 +mem[30252] = 60933 +mask = 100X111001001X10X0100XXX0011011X10X0 +mem[45485] = 5697187 +mem[39779] = 21767171 +mem[34966] = 498 +mem[13640] = 123685 +mask = X001X00X0XX11X1111111001X111X11111X0 +mem[30646] = 77071 +mem[40278] = 15164 +mem[48949] = 2547 +mem[49010] = 168697055 +mem[52212] = 836232 +mask = X00011000111101111X100X100100X00XX1X +mem[13958] = 872 +mem[28057] = 130528 +mem[9891] = 1464 +mask = 00X10000000X11111111X0100X1X0X111111 +mem[29510] = 29331 +mem[16403] = 265384902 +mem[46270] = 55500 +mem[35558] = 149875 +mem[42316] = 8508705 +mem[12894] = 281336 +mask = 10X011XX01X00011001110X11111X00X1XX0 +mem[15463] = 114059 +mem[64253] = 5760 +mem[34294] = 38569 +mem[1677] = 5097 +mem[22991] = 502 +mem[44522] = 326097 +mem[8172] = 37 +mask = 00010000X0001X1111111011011101X1X110 +mem[39779] = 1142 +mem[29838] = 85552455 +mem[42813] = 5712091 +mem[45115] = 58778 +mem[13319] = 855 +mem[2440] = 410159 +mask = X101101101X01111101010X110X110000010 +mem[41886] = 1753 +mem[57501] = 961519277 +mem[48943] = 1352369 +mask = 1000011X01111X1111101XX0000X101XX110 +mem[840] = 954719 +mem[53875] = 11370 +mem[45011] = 5033013 +mem[45230] = 850083 +mem[20455] = 862 +mask = 1X00010XX111101X111110000X111011X1X0 +mem[34148] = 99301330 +mem[26648] = 7719906 +mem[18244] = 110630512 +mask = 1100X11000X11X0X1111100X0X00X010XX11 +mem[50401] = 1733252 +mem[26875] = 37568501 +mem[35663] = 508001 +mem[14749] = 1838 +mask = X1010XX001111011101X0000X001XX100010 +mem[63359] = 5414799 +mem[35329] = 251023948 +mem[26907] = 876247525 +mask = X000X0X1111XX0100111XX10101X011X1100 +mem[23165] = 20505666 +mem[7340] = 1068126 +mem[5630] = 2429 +mem[55672] = 30150 +mask = 1000X11X011X101111101X0XX0101X1010X0 +mem[19212] = 6837122 +mem[14758] = 38425 +mem[19003] = 119768 +mask = 10000X01111110X0X1111110XXX110011X10 +mem[33194] = 61265858 +mem[13147] = 3274970 +mem[41650] = 4162 +mem[42478] = 1225726 +mem[63031] = 112464577 +mask = X0X10000X101101111110011X11101111100 +mem[35647] = 5788908 +mem[42040] = 48997 +mem[62673] = 1901 +mem[39850] = 1010636 +mask = 11X010X0010100101X1XXX0001001111010X +mem[20116] = 50 +mem[57943] = 17495168 +mem[28763] = 19897421 +mem[21657] = 923815 +mem[4802] = 86976237 +mask = 1X0011X001100011XX1X100X101110100110 +mem[13898] = 4734170 +mem[1595] = 82201 +mask = 1001X0010011X111111X1X0X1X1100011000 +mem[44782] = 14922 +mem[54309] = 1336 +mem[23027] = 194803 +mem[24035] = 29316023 +mask = 1100111000010101X011X00011100X00010X +mem[50916] = 1751 +mem[47305] = 2707 +mem[14464] = 13519228 +mem[33044] = 10744 +mem[53730] = 4920479 +mem[37037] = 859 +mask = X100111X0X10001111111100X11110001110 +mem[58049] = 939221 +mem[1924] = 17 +mem[61135] = 358315072 +mem[21809] = 5281 +mem[39141] = 1817 +mem[51543] = 136115569 +mem[50155] = 300797 +mask = 110010X000X1110010X100X0111X001X00XX +mem[50279] = 14014916 +mem[12124] = 68328623 +mem[44199] = 313076 +mem[64321] = 4725 +mem[20842] = 108600115 +mem[37411] = 4492927 +mask = X1001X11000010111111XX0X100X11000011 +mem[28505] = 8712 +mem[37967] = 35824634 +mem[23027] = 241 +mem[17252] = 20614619 +mem[24389] = 10076 +mask = X101000001X01011X011X0X10X1100101X10 +mem[61716] = 8801 +mem[34944] = 1881 +mem[4710] = 8504 +mem[56313] = 14501 +mem[5654] = 14055781 +mem[22490] = 90967 +mask = X0X1110X01101011111101001100001X1101 +mem[21158] = 463323 +mem[18946] = 15357 +mem[57000] = 2534149 +mem[15029] = 194259123 +mem[38305] = 441356 +mask = 11001110010X000X101000XX010000111111 +mem[53389] = 1383160 +mem[938] = 1952336 +mem[64009] = 15833 +mask = 00X11X0011X11011111111000X10001X11X1 +mem[6272] = 13767595 +mem[54734] = 510 +mem[33438] = 1925 +mem[36878] = 260095 +mask = 110X11100111X0001X000001011001X01011 +mem[47847] = 2621 +mem[49530] = 526 +mem[17284] = 1326861 +mem[17082] = 5186894 +mem[18302] = 13617528 +mem[7269] = 1111687 +mask = 110011100001X11X101X1X101010X01X0100 +mem[60461] = 2942 +mem[35460] = 327 +mem[28055] = 375226 +mask = 0011111X01101111111010XXX101X101100X +mem[41886] = 113214 +mem[17284] = 85512736 +mask = 0X01X111X1101X1110100101011110011XX1 +mem[40617] = 603263 +mem[10573] = 33216107 +mem[22356] = 26505 +mem[6272] = 45384662 +mask = 10101X0001111011X11X000111X1X1100X0X +mem[7936] = 47932 +mem[16185] = 5024 +mem[52003] = 1045816 +mask = 0XXX1X1101101X111X1001X000110001110X +mem[32145] = 91132 +mem[55966] = 3856425 +mem[42185] = 24094 +mem[36708] = 277 +mask = 1101100XX11X1011111110X0100X10X0000X +mem[31516] = 5220059 +mem[35747] = 2317 +mem[7864] = 3365 +mem[55570] = 45702 +mask = 110110010X1110X1X111000X0000101X1X00 +mem[44696] = 47285061 +mem[28866] = 23561 +mem[56107] = 8116244 +mem[41437] = 2106148 +mask = 110011X00011001111XX100X11001010010X +mem[45954] = 58871 +mem[61135] = 3411 +mem[17541] = 3200218 +mem[38985] = 233678515 +mem[41259] = 166543015 +mem[2350] = 34876506 +mask = 11X01X00X0X00001111XX00101X0X0100010 +mem[23027] = 474324 +mem[6434] = 53973 +mem[40128] = 16133 +mem[36404] = 5183 +mask = 1100111000XX00111X11110X11X00X10000X +mem[10063] = 9539320 +mem[843] = 671 +mem[4773] = 140929 +mem[19139] = 133212046 +mem[20975] = 795877 +mask = 100X0X00011X101111X101000010X0001000 +mem[932] = 2504742 +mem[25530] = 1425628 +mask = 10X001X00X1X1X011X1100110X1X1011X000 +mem[8358] = 313827173 +mem[7256] = 1152512 +mem[6697] = 60311 +mem[15728] = 6743 +mem[64009] = 43785 +mem[43325] = 2846 +mask = 100X1X00011X1011111X000000X0X01X1X00 +mem[46292] = 1644 +mem[1988] = 1949 +mem[40476] = 111556 +mask = 100011X0X11XX01110111X001001X010111X +mem[43625] = 120590 +mem[63878] = 417 +mem[1924] = 4511945 +mem[36404] = 2609999 +mem[8758] = 30953 +mem[896] = 56891660 +mem[37141] = 770 +mask = 100011X001X0X0111X11100000XXX0010X10 +mem[19084] = 9020 +mem[39875] = 31650099 +mask = 10101110011000110011XX11X110011X1010 +mem[13319] = 1038 +mem[46337] = 51363384 +mem[61871] = 3928 +mem[15595] = 224135 +mem[56790] = 39964747 +mem[54731] = 1878594 +mem[53872] = 4678318 +mask = 00X11001001110111011X0X001X111110X11 +mem[39549] = 14142886 +mem[26096] = 7903442 +mem[43322] = 8676 +mem[17353] = 509961 +mem[49320] = 11303 +mask = 1X0100000X00X011X01X011000X0X0111000 +mem[48878] = 209296 +mem[29990] = 394600 +mask = 100000000X10101X11110XX0101011000011 +mem[843] = 542527866 +mem[63601] = 10350671 +mem[9659] = 3514 +mem[33969] = 266 +mem[2863] = 15309 +mask = 10X0X000011X10XX01100101100XX01X0010 +mem[56350] = 2980026 +mem[45422] = 7205 +mem[26310] = 10221 +mem[40386] = 358165 +mem[55012] = 32294336 +mask = X1001X10000111001011X1001011X0010110 +mem[25508] = 86175837 +mem[26087] = 58400593 +mem[48996] = 27712 +mem[3272] = 2146 diff --git a/2020/day15/day15.py b/2020/day15/day15.py new file mode 100644 index 0000000..69e4fcf --- /dev/null +++ b/2020/day15/day15.py @@ -0,0 +1,58 @@ +#!/usr/bin/env python3 +from collections import defaultdict +from array import array + + +def main(initial_suite, max_iteration): + iteration = 1 + seen = defaultdict(int) + + # init + for number in initial_suite: + seen[number] = iteration + iteration += 1 + + current = 0 + while iteration < max_iteration: + last_seen = seen[current] + if last_seen == 0: + seen[current] = iteration + current = 0 # next + else: + seen[current] = iteration + current = iteration - last_seen # next + iteration += 1 + return current + + +def main_array(initial_suite, max_iteration): + iteration = 1 + seen = array('I', [0] * max_iteration) + + # init + for number in initial_suite: + seen[number] = iteration + iteration += 1 + + current = 0 + while iteration < max_iteration: + last_seen = seen[current] + if last_seen == 0: + seen[current] = iteration + current = 0 # next + else: + seen[current] = iteration + current = iteration - last_seen # next + iteration += 1 + return current + + + + +if __name__ == "__main__": + inp = [6, 3, 15, 13, 1, 0] + # 423 µs ± 53.9 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each) + print(main(inp, 2020)) + # 13.6 s ± 2.89 s per loop (mean ± std. dev. of 7 runs, 1 loop each) + #print(main(inp, 30000000)) + print(main_array(inp, 30000000)) diff --git a/2020/day16/bash.exe.stackdump b/2020/day16/bash.exe.stackdump new file mode 100644 index 0000000..7ae9491 --- /dev/null +++ b/2020/day16/bash.exe.stackdump @@ -0,0 +1,16 @@ +Stack trace: +Frame Function Args +00600000010 001800617BE (00180251890, 0018023DFD1, 00000000058, 000FFFFB770) +00600000010 001800490FA (00000000000, 00100000000, 00000000000, 00000000001) +00600000010 00180049132 (00000000000, 00000000000, 00000000058, 0018031F2C0) +00600000010 0018006D9C9 (0000000000A, 000FFFFC940, 001800458BF, 00000000000) +00600000010 0018006DB92 (00000000003, 000FFFFC940, 001800458BF, 000FFFFC940) +00600000010 0018006EA4C (000FFFFC940, 001802405E5, 001800EAF57, 0000000000D) +00600000010 001800596A6 (000FFFF0000, 00000000000, 00000000000, 773CE092FFFFFFFF) +00600000010 0018005A9C5 (00000000002, 0018031EBD0, 001800BE5F9, 00600040000) +00600000010 0018005AE89 (001800C7664, 00000000000, 00000000000, 00000000000) +000FFFFCCE0 0018005B149 (000FFFFCE00, 00000000000, 00000000030, 0000000002F) +000FFFFCCE0 00180049877 (00000000000, 00000000000, 00000000000, 00000000000) +000FFFFFFF0 001800482C6 (00000000000, 00000000000, 00000000000, 00000000000) +000FFFFFFF0 00180048374 (00000000000, 00000000000, 00000000000, 00000000000) +End of stack trace diff --git a/2020/day16/day16.py b/2020/day16/day16.py new file mode 100644 index 0000000..bebb6e0 --- /dev/null +++ b/2020/day16/day16.py @@ -0,0 +1,105 @@ +# /usr/bin/env python3 +import re +from collections import defaultdict + +""" +identify invalid nearby tickets by considering only whether tickets contain values that are not valid for any field. +""" + + +def main(): + rules, my_ticket, other_tickets = open("input.txt").read().split("\n\n") + rules = parse_fields(rules) + my_ticket = my_ticket.splitlines()[1] + other_tickets = other_tickets.splitlines()[1:] + print("Ticket scanning error rate ", part1(other_tickets, rules)) + part2(my_ticket, other_tickets, rules) + + +def parse_fields(fields): + fields_dict = {} + for field in fields.splitlines(): + k, v = field.split(": ") + ranges = re.findall(r"(\d+)-(\d+)", v) + fields_dict[k] = [range(int(r[0]), int(r[1]) + 1) for r in ranges] + return fields_dict + + +def part1(tickets, rules): + scanning_error_rate = 0 + for ticket in tickets: + scanning_error_rate += sum(validate_ticket(ticket, rules)) + return scanning_error_rate + + +def validate_ticket(ticket, rules): + invalid_fields = [] + for value in ticket.split(","): + value = int(value) + if not validate_field(value, *rules.values()): + invalid_fields.append(value) + return invalid_fields + + +def validate_field(field, *rules): + validations = (any(field in r for r in rule) for rule in rules) + return any(validations) + + +def part2(my_ticket, other_tickets, rules): + # filter only valid tickets + valid_tickets = [ticket for ticket in other_tickets if validate_ticket(ticket, rules) == []] + valid_tickets.append(my_ticket) # my ticket is valid + + # possible field for each index of a ticket + candidates = defaultdict(set) + for index in range(len(rules)): + def inner(): + for rule_name, constraints in rules.items(): + for ticket in valid_tickets: + field_value = int(ticket.split(",")[index]) + if not validate_field(field_value, constraints): + return + candidates[index].add(rule_name) + inner() + + sorted_candidates = sort_candidates(candidates) + + fields_indexes = {} + try: + while len(fields_indexes) != len(rules): + index, found = sorted_candidates.popitem() + found = next(iter(found)) + fields_indexes[index] = found + sorted_candidates = remove_item(sorted_candidates, found) + except: + pass + + fields_indexes = {k: v for k,v in fields_indexes.items() if v.startswith('departure')} + + total = 1 + my_ticket = my_ticket.split(',') + for index in fields_indexes: + total *= int(my_ticket[index]) + a = 1 + + +def sort_candidates(c): + return {x: c[x] for x in sorted(c, key=lambda k: len(c[k]), reverse=True)} + +def remove_item(candidates, item): + ret = {} + for key, value in candidates.items(): + try: + value.remove(item) + except ValueError: + pass + ret[key] = value + + #candidates = {k: set(v - item) for k,v in candidates.items()} + return ret + + + +if __name__ == "__main__": + main() diff --git a/2020/day16/input.txt b/2020/day16/input.txt new file mode 100644 index 0000000..7f109db --- /dev/null +++ b/2020/day16/input.txt @@ -0,0 +1,260 @@ +departure location: 32-69 or 86-968 +departure station: 27-290 or 301-952 +departure platform: 47-330 or 347-956 +departure track: 46-804 or 826-956 +departure date: 25-302 or 320-959 +departure time: 29-885 or 893-961 +arrival location: 33-643 or 649-963 +arrival station: 29-135 or 151-973 +arrival platform: 50-648 or 674-961 +arrival track: 45-761 or 767-971 +class: 46-703 or 725-951 +duration: 47-244 or 257-957 +price: 49-195 or 209-956 +route: 44-368 or 393-968 +row: 48-778 or 797-954 +seat: 31-421 or 427-964 +train: 42-229 or 245-961 +type: 31-261 or 281-964 +wagon: 36-428 or 445-967 +zone: 30-906 or 923-960 + +your ticket: +157,89,103,59,101,181,109,127,67,173,151,97,107,167,61,131,53,163,179,113 + +nearby tickets: +463,746,834,524,530,944,558,680,416,986,364,677,850,160,641,99,898,360,860,695 +131,550,365,282,759,549,212,841,933,177,109,407,859,5,560,119,929,178,725,769 +216,726,353,875,585,448,513,866,55,266,696,173,367,684,99,624,561,735,880,347 +775,949,284,404,832,445,4,368,702,492,577,133,930,170,212,642,213,881,616,67 +948,608,525,771,739,732,556,615,843,447,254,605,573,838,399,104,285,568,59,112 +491,225,446,229,585,462,159,898,365,811,538,469,223,364,943,931,860,835,607,864 +414,164,269,604,564,592,608,179,593,397,326,740,774,445,525,215,354,518,446,776 +880,224,616,325,182,619,635,875,580,78,499,699,225,158,408,119,400,555,514,591 +404,53,154,419,698,67,126,607,519,576,411,51,636,554,856,900,571,133,136,774 +758,87,214,54,193,99,400,544,452,63,481,559,488,897,867,463,426,946,284,189 +489,447,687,643,851,104,172,528,551,694,685,101,772,172,575,100,838,927,992,881 +287,871,570,537,130,290,492,510,163,477,751,273,802,854,624,228,530,591,640,801 +406,830,574,569,627,886,547,850,897,773,362,687,398,359,102,179,904,480,121,553 +110,879,900,570,508,612,944,408,160,505,767,702,645,65,753,588,463,871,403,359 +454,210,123,894,882,285,112,625,936,135,944,88,153,509,852,124,861,997,620,348 +185,302,106,452,607,408,111,875,204,861,769,545,499,460,541,895,329,756,329,929 +510,24,65,939,885,469,175,587,837,516,478,593,321,696,734,525,107,227,459,694 +449,461,195,330,768,501,308,869,747,837,935,109,125,212,212,410,405,358,323,740 +324,834,284,411,181,668,548,904,900,105,112,413,687,499,281,323,624,175,214,595 +222,110,150,626,488,688,185,593,738,409,619,419,351,87,836,172,474,613,539,641 +102,107,614,445,524,414,550,527,556,132,64,767,586,830,226,638,60,900,197,895 +173,508,122,768,479,624,554,177,496,726,536,853,607,640,167,845,415,536,248,859 +507,617,67,881,585,97,132,769,484,245,799,301,101,405,682,936,578,680,87,756 +491,847,160,221,94,832,889,120,576,120,124,756,847,113,169,155,688,217,400,573 +744,524,90,867,548,906,895,867,58,682,326,733,354,168,199,753,729,770,447,480 +282,89,694,575,738,862,879,131,542,539,590,605,697,675,631,301,834,571,765,325 +553,414,732,155,924,108,123,592,321,558,646,624,688,456,51,729,185,193,420,564 +259,454,89,579,475,240,290,90,883,740,88,615,856,348,474,101,486,539,98,413 +620,347,175,930,604,755,662,733,867,157,458,58,367,609,926,545,219,69,545,593 +58,121,126,826,263,218,219,456,691,536,66,193,701,354,564,866,676,182,804,948 +159,860,447,828,361,162,523,544,641,629,869,477,894,102,751,799,396,395,650,846 +200,65,905,393,856,56,874,906,949,412,741,570,56,479,600,541,578,348,734,365 +694,830,665,745,694,590,590,640,111,611,639,770,566,551,258,531,901,585,736,504 +626,219,100,934,573,583,847,949,562,847,739,672,559,585,638,527,771,826,947,131 +471,608,301,588,109,586,209,537,835,136,559,156,829,87,526,610,494,862,580,117 +319,158,288,158,897,100,453,166,194,327,609,756,58,412,213,133,628,518,942,59 +452,468,575,778,577,854,604,59,899,943,697,827,715,609,565,464,576,588,542,483 +676,827,772,460,875,415,587,218,660,577,612,731,697,122,94,502,101,301,195,210 +635,829,732,558,114,804,626,503,408,13,501,882,454,452,108,938,471,834,502,617 +283,53,517,497,628,552,884,194,560,938,552,833,531,278,218,896,618,878,837,118 +76,493,861,123,110,117,680,50,515,776,842,567,549,777,803,459,517,52,563,257 +887,861,214,872,487,582,641,741,636,186,364,563,552,633,630,350,151,902,172,165 +161,478,353,777,361,596,501,879,642,420,456,907,634,826,852,840,505,923,895,192 +905,510,756,415,772,533,153,799,407,571,171,425,117,229,610,631,187,65,850,774 +223,676,134,129,261,211,175,191,411,224,304,544,777,864,53,61,51,900,529,637 +272,747,598,799,458,534,747,591,218,545,571,183,157,946,557,622,126,866,396,591 +108,261,879,156,842,466,285,738,771,595,52,55,463,518,665,750,880,798,778,703 +90,322,517,743,456,911,579,290,923,126,848,868,599,870,628,590,120,544,353,546 +861,477,711,754,420,357,257,880,689,559,748,627,508,171,770,469,223,728,884,414 +60,538,906,571,902,494,284,493,258,745,124,684,94,646,451,90,850,180,175,514 +475,866,326,566,937,975,846,491,456,158,830,403,349,583,557,57,535,883,641,493 +498,580,467,116,614,615,629,161,528,454,81,474,843,640,740,96,848,544,99,530 +526,628,678,725,881,394,742,773,837,762,414,363,211,550,52,106,60,619,61,539 +152,618,802,64,205,828,480,595,898,895,479,527,395,281,95,301,117,357,839,855 +749,760,326,866,176,127,184,610,524,703,365,82,559,68,118,828,558,587,520,170 +905,457,569,641,610,849,226,223,517,740,407,843,905,738,360,115,92,228,59,987 +126,744,503,144,929,684,617,322,220,607,590,584,687,127,941,228,881,415,500,945 +475,495,582,51,57,595,400,217,646,134,50,153,185,212,698,876,228,347,736,604 +518,770,797,608,499,906,702,946,622,173,820,580,564,68,601,774,728,625,894,932 +320,700,588,572,539,470,570,548,556,859,767,284,245,948,411,924,830,935,288,692 +66,497,934,756,122,550,948,692,590,867,104,402,551,766,165,637,405,214,184,288 +363,675,211,426,549,115,321,690,595,566,867,843,883,220,598,54,604,837,483,420 +341,832,534,576,538,760,522,521,176,685,482,472,498,882,697,397,739,947,54,368 +777,469,466,123,111,613,236,846,494,191,218,575,800,611,498,193,364,932,633,188 +865,258,559,516,587,521,678,100,217,517,744,765,499,176,740,826,325,634,357,560 +429,505,736,515,495,702,938,281,152,680,925,193,880,117,494,841,631,110,576,123 +631,942,693,804,610,882,716,228,527,490,135,170,498,675,211,363,229,900,415,400 +62,900,736,564,483,99,512,946,210,209,767,92,833,187,117,412,898,627,749,711 +768,427,536,695,639,730,604,713,470,699,692,555,748,865,216,95,642,630,496,877 +505,626,759,772,151,590,227,505,849,680,551,580,203,223,836,579,754,408,288,168 +582,556,557,870,573,352,601,455,422,406,133,548,125,874,866,126,65,497,447,902 +174,62,357,591,219,836,528,588,903,129,864,335,525,851,124,731,397,754,880,104 +286,179,703,646,261,192,475,568,700,803,630,761,349,360,529,769,876,330,797,407 +575,63,937,450,943,129,484,399,159,642,942,462,417,368,406,506,694,990,702,570 +640,771,349,527,99,353,905,590,897,599,488,89,804,768,526,450,516,827,562,202 +852,584,998,584,584,406,726,868,554,690,587,349,451,69,104,733,397,183,773,156 +554,445,220,417,758,385,797,519,637,55,734,415,838,697,487,871,614,884,836,495 +425,881,508,865,497,774,598,102,134,322,360,350,676,408,211,559,606,416,474,460 +288,204,800,943,774,752,302,362,729,349,132,877,499,132,511,414,935,64,120,769 +864,638,568,282,504,646,394,114,774,580,325,513,552,258,413,868,905,826,155,469 +114,464,747,63,428,822,829,503,846,551,695,413,355,68,929,503,501,767,493,948 +583,577,250,55,521,542,777,507,613,630,109,678,635,752,804,700,875,495,938,410 +898,217,596,764,944,404,180,555,642,903,861,361,394,613,65,570,170,453,524,564 +401,849,744,590,545,161,503,568,159,286,327,213,865,348,529,686,330,769,423,327 +841,743,944,323,898,538,505,593,929,578,322,169,553,406,426,616,539,445,120,630 +861,470,636,747,468,900,619,897,548,310,939,171,111,755,328,901,360,409,553,183 +60,878,648,929,580,54,89,499,135,552,449,735,470,776,906,530,745,767,740,185 +221,496,747,508,894,421,535,289,800,457,257,176,517,422,549,114,534,287,686,489 +210,396,367,87,588,404,112,157,761,767,353,105,906,9,527,174,634,178,619,605 +699,406,577,742,561,589,544,289,864,93,333,732,726,61,583,428,605,261,684,360 +353,422,898,168,214,281,738,363,462,674,194,469,554,571,876,566,445,498,159,259 +88,684,191,496,512,121,632,538,675,456,745,306,935,773,497,550,778,853,933,756 +285,399,191,364,132,634,545,799,428,106,450,802,906,613,520,983,931,526,526,128 +393,351,222,184,126,290,874,492,799,189,483,947,24,61,568,355,751,680,848,939 +850,550,321,705,621,882,401,362,180,539,804,568,466,356,451,50,863,902,525,400 +626,364,59,727,610,356,112,172,518,594,213,157,949,480,501,171,182,133,271,284 +683,329,328,173,903,686,830,853,69,893,633,897,327,492,874,365,982,834,581,167 +158,631,725,732,94,157,100,924,847,122,547,21,520,855,572,494,928,726,510,604 +448,416,521,295,804,260,833,885,897,257,107,285,697,186,94,133,327,926,395,695 +499,360,700,18,217,323,50,462,100,66,399,635,327,516,935,399,534,451,680,727 +871,561,559,151,745,638,735,165,540,506,676,941,167,200,491,797,485,357,462,159 +882,678,465,103,803,885,322,517,630,742,258,189,274,942,93,183,395,771,691,421 +777,683,112,67,686,934,410,449,729,699,477,192,749,116,559,66,653,743,601,158 +873,874,327,695,835,366,675,729,166,545,613,142,162,219,593,546,427,152,902,636 +701,834,770,405,394,868,921,186,326,458,748,696,801,183,677,86,838,447,507,799 +739,744,597,226,167,94,92,662,797,163,603,636,368,476,289,355,349,428,632,858 +356,464,480,122,100,510,178,549,418,649,614,66,736,61,131,703,930,454,696,501 +446,329,850,898,411,483,220,937,421,510,738,514,603,492,706,398,62,494,520,99 +682,58,630,211,127,544,119,461,867,471,765,929,219,217,881,160,420,490,483,363 +606,835,897,563,150,679,367,419,536,899,537,117,574,512,577,215,612,702,508,941 +446,635,456,940,851,216,255,579,543,173,229,614,66,585,179,428,944,634,696,607 +643,408,501,351,157,737,607,581,173,53,733,941,748,363,468,860,480,548,713,411 +460,984,360,156,166,167,753,220,60,161,834,491,574,935,696,469,258,620,105,737 +233,284,803,874,698,842,833,633,526,604,50,697,216,827,466,862,756,864,610,358 +815,496,58,564,220,507,581,742,185,401,118,635,931,760,393,857,893,585,484,193 +946,322,897,489,602,448,211,773,148,937,774,178,924,947,479,539,486,870,872,576 +628,506,681,59,172,597,146,758,301,758,703,934,547,570,695,570,523,748,176,573 +725,54,930,421,631,177,19,616,357,98,476,61,229,356,155,626,60,873,454,110 +415,419,229,272,700,531,568,50,726,459,133,745,869,580,108,732,215,470,868,924 +219,175,177,356,847,879,211,932,853,675,732,753,425,215,579,695,492,257,415,929 +461,583,156,455,127,506,471,759,347,940,368,726,223,185,450,327,112,901,978,505 +679,62,609,477,744,123,263,583,568,476,743,162,761,760,679,518,526,939,602,285 +194,367,619,336,62,851,195,900,619,407,773,640,543,322,563,622,600,696,679,559 +897,591,404,79,213,577,803,605,556,939,949,594,52,893,286,476,61,496,797,321 +906,609,742,572,602,933,340,544,940,101,171,847,609,218,134,285,213,515,881,692 +539,445,773,870,756,82,754,855,687,396,587,167,281,116,175,427,803,54,797,537 +295,638,690,156,700,124,896,192,685,538,699,469,411,92,103,327,101,181,852,598 +688,640,58,258,229,175,603,566,883,745,120,751,361,983,895,152,871,776,565,475 +571,110,473,844,182,325,282,474,800,848,720,872,580,463,642,637,302,937,565,54 +884,477,454,11,851,768,155,427,617,894,395,471,127,756,119,349,499,933,569,367 +755,159,620,255,403,541,639,215,619,155,121,880,512,758,132,169,859,488,831,511 +733,869,737,830,169,174,163,194,931,891,99,209,743,101,570,934,100,156,642,63 +474,487,517,162,426,690,355,924,188,467,195,189,67,623,537,160,51,257,750,163 +773,597,167,448,992,485,524,749,839,414,581,419,69,544,155,302,108,489,210,640 +152,488,736,115,55,206,732,756,631,878,261,214,354,465,365,559,576,552,105,155 +114,411,759,2,478,283,569,394,607,488,524,678,90,870,856,581,941,844,184,111 +152,161,638,357,757,758,328,618,186,96,630,891,428,536,353,68,603,54,702,599 +168,170,603,134,769,278,853,447,219,743,526,450,729,457,289,758,842,102,493,758 +66,86,681,483,684,730,855,13,731,505,531,558,351,364,550,195,519,365,393,518 +857,544,529,602,566,333,499,414,181,778,357,112,134,539,901,135,827,697,854,53 +686,461,208,530,879,871,863,727,489,613,893,397,860,732,92,899,459,850,133,420 +853,701,562,352,54,574,423,428,495,746,759,355,507,737,540,777,456,179,587,91 +195,936,925,221,178,739,161,854,320,257,569,754,141,475,633,418,177,402,106,577 +535,329,629,684,877,727,509,750,727,158,537,527,514,461,321,574,769,320,647,679 +215,568,691,508,841,295,57,736,172,564,213,597,500,933,479,557,445,288,551,777 +478,597,540,116,494,449,10,101,546,611,67,777,482,408,409,130,578,212,636,934 +588,857,728,926,620,355,600,358,153,481,753,228,227,702,687,182,710,592,640,604 +381,565,728,741,221,522,215,615,590,494,154,569,760,747,926,530,56,411,875,367 +931,404,258,462,642,529,347,510,613,473,942,897,617,829,623,420,633,507,989,393 +211,449,284,518,593,840,94,133,126,518,144,540,504,521,857,884,602,587,460,941 +185,619,688,495,594,748,617,398,626,862,491,207,850,60,548,623,641,777,393,411 +898,404,559,524,461,488,898,773,870,59,641,778,528,399,462,54,67,450,82,498 +64,588,21,287,465,621,542,452,584,568,745,841,639,395,878,86,120,635,760,481 +734,282,753,261,469,180,114,578,284,945,755,715,924,92,799,122,213,113,104,514 +107,427,257,703,673,846,258,700,747,216,593,686,736,729,607,850,756,874,804,590 +540,549,180,156,496,124,124,871,118,193,596,865,350,110,66,119,1,855,640,464 +55,740,893,196,53,63,68,548,896,479,587,525,600,867,119,753,479,948,517,632 +846,480,885,573,494,680,358,949,56,498,583,471,193,663,859,452,412,506,566,359 +668,934,692,367,732,923,748,99,947,697,222,56,864,492,880,527,495,875,906,451 +562,91,529,354,728,423,288,400,467,177,881,221,539,834,942,448,455,178,800,466 +480,538,525,463,585,612,474,159,898,463,771,727,674,945,356,86,754,12,602,744 +183,935,224,324,287,700,801,755,364,705,68,454,419,861,857,846,356,326,301,533 +646,634,626,414,185,173,700,873,754,474,949,52,573,220,851,535,862,601,829,931 +866,584,746,402,350,751,754,588,762,863,584,555,580,565,225,868,868,193,88,531 +184,847,898,758,509,838,285,100,574,4,92,727,69,89,323,534,570,574,364,700 +773,67,591,402,512,753,509,624,213,123,157,298,511,164,501,445,222,401,496,545 +447,928,683,937,363,132,755,775,550,595,280,676,466,728,883,676,404,170,624,941 +540,455,903,484,302,804,302,742,944,569,186,927,777,400,688,504,546,564,554,15 +868,469,102,594,534,622,90,153,228,894,676,501,521,181,609,924,980,185,929,160 +214,614,107,586,52,582,112,482,114,757,410,609,827,948,161,893,198,398,212,421 +185,209,678,923,576,182,167,134,802,407,352,575,651,120,193,501,421,527,692,101 +445,539,361,605,125,522,72,552,623,482,760,326,188,898,750,933,604,692,905,176 +511,928,321,747,586,611,626,679,470,117,347,60,765,828,478,858,115,100,170,357 +762,751,677,349,694,865,868,619,157,928,165,558,492,829,453,574,727,743,537,496 +906,739,628,466,182,715,899,855,361,328,872,412,691,105,865,177,91,500,402,860 +719,95,933,551,735,597,690,608,479,847,92,118,827,105,193,728,726,135,482,876 +517,468,212,668,895,529,627,128,462,355,357,360,323,301,99,680,693,502,111,394 +735,802,625,259,364,760,95,283,928,176,929,524,299,593,840,832,323,129,61,878 +948,712,257,854,619,213,540,856,562,883,580,504,739,97,742,445,798,519,604,739 +527,695,855,743,459,540,544,536,932,932,872,486,455,248,575,220,473,893,450,158 +281,215,570,91,591,489,643,261,274,687,63,65,177,177,846,637,882,404,180,894 +106,416,356,926,944,458,19,580,528,215,850,935,927,399,69,761,941,851,730,258 +947,257,618,153,184,357,859,320,554,611,297,91,355,487,837,871,412,864,472,122 +591,99,86,521,399,396,647,397,848,773,525,93,800,927,454,517,592,893,756,592 +103,854,498,88,290,529,130,694,167,282,992,51,874,515,492,538,490,873,678,454 +259,945,171,512,639,925,684,830,64,637,642,458,360,349,147,873,330,164,729,364 +728,829,483,259,560,685,177,451,177,477,607,680,161,301,101,134,358,20,861,926 +733,602,875,641,932,349,947,393,212,678,217,403,636,69,450,541,882,600,297,631 +356,64,422,745,638,216,885,90,185,884,154,574,285,607,476,99,550,120,152,839 +832,631,942,741,458,353,467,219,605,769,570,516,848,771,465,99,149,348,880,696 +169,599,902,490,777,420,349,801,161,197,859,838,932,395,448,933,120,220,731,185 +623,558,994,412,58,286,944,155,102,156,850,124,840,896,129,842,465,515,835,127 +526,211,403,190,187,408,505,570,559,493,542,356,935,610,255,530,937,258,497,407 +680,368,864,745,761,393,179,834,186,754,547,646,827,750,777,57,935,161,159,94 +103,452,996,874,450,906,59,738,686,366,168,494,123,185,804,754,775,903,746,97 +641,635,768,62,51,762,526,726,931,485,166,840,181,754,475,104,598,870,302,636 +895,451,846,129,53,880,125,578,363,469,835,508,604,458,797,942,509,125,20,603 +977,128,557,622,728,859,352,465,526,693,213,468,896,829,92,582,96,483,852,868 +929,728,845,676,939,461,866,743,480,116,62,734,57,152,894,495,872,707,90,616 +676,878,768,543,216,195,868,322,160,603,325,824,415,638,171,488,904,104,847,468 +176,843,560,897,112,640,583,556,844,61,203,928,575,528,738,217,258,496,928,733 +330,534,456,554,421,227,765,224,742,400,170,457,846,489,610,545,226,122,900,60 +505,131,488,894,428,448,571,642,181,411,130,454,583,724,760,452,472,760,281,693 +630,446,420,809,826,859,129,187,602,842,287,214,131,694,416,879,770,837,676,769 +774,532,176,775,588,677,405,597,715,804,212,58,420,826,281,799,497,284,758,114 +215,993,733,325,776,365,325,54,544,285,755,115,774,895,614,885,642,514,738,927 +623,602,746,854,760,126,88,465,616,761,758,797,825,834,799,948,458,65,551,799 +852,348,522,108,631,124,693,867,544,686,496,703,183,409,23,642,754,284,221,478 +247,688,93,479,862,504,290,467,325,535,215,857,925,362,160,112,286,323,96,542 +940,353,688,568,903,156,693,877,877,121,624,178,91,140,514,94,532,761,538,744 +157,116,217,904,591,552,555,133,729,566,759,248,358,841,522,925,484,163,544,740 +417,842,119,612,135,595,815,801,939,906,571,446,557,800,800,617,512,124,586,64 +701,604,904,365,252,745,54,566,700,551,689,753,943,477,510,349,492,216,505,118 +849,61,899,97,723,642,797,546,105,92,289,832,596,578,108,125,212,281,948,358 +214,482,749,168,614,640,208,594,533,574,620,353,590,852,830,57,449,412,628,322 +354,776,725,902,412,177,448,682,610,422,462,799,106,213,840,860,410,767,475,321 +926,550,130,870,466,255,190,491,322,589,260,837,758,844,478,115,59,638,831,490 +215,367,184,170,223,882,511,615,807,748,324,832,416,103,742,801,475,553,851,96 +884,394,856,591,564,258,135,835,254,187,497,857,547,681,59,486,506,681,494,827 +138,573,394,531,356,105,839,731,593,680,614,523,404,594,65,455,330,221,489,619 +881,687,461,352,469,159,174,423,192,539,508,350,535,415,112,905,862,169,679,850 +416,488,681,546,606,139,760,427,868,541,616,599,900,504,561,528,505,702,742,948 +588,260,559,611,158,153,182,497,901,648,840,94,803,406,627,903,519,513,643,212 +870,934,586,799,161,638,852,173,608,322,422,289,925,726,499,468,445,111,897,883 +505,881,593,155,448,101,524,206,513,176,736,926,591,68,466,490,895,163,287,259 +606,540,415,448,602,400,399,557,859,599,660,325,803,837,288,876,160,690,932,498 +528,693,869,93,998,940,865,571,161,185,452,800,701,415,480,521,169,456,802,867 +396,534,841,880,727,560,445,737,745,292,326,471,578,288,519,943,871,585,64,949 +866,703,281,358,944,994,457,750,627,587,507,680,473,544,933,535,850,211,852,606 +547,580,409,510,588,307,517,219,520,757,944,689,126,768,481,189,55,827,874,366 +615,560,417,185,924,170,744,415,932,344,88,355,847,490,221,831,395,192,498,773 +934,943,836,676,489,173,293,736,471,641,288,500,680,194,596,186,555,228,109,420 +914,602,902,874,218,129,492,689,738,118,121,751,942,874,893,855,778,545,857,544 +457,325,531,881,682,526,837,223,751,642,209,488,937,410,587,944,547,746,821,352 +777,836,861,64,328,506,68,351,365,827,164,351,169,181,930,738,677,690,988,834 diff --git a/2020/day2/input.txt b/2020/day2/input.txt new file mode 100644 index 0000000..6158f52 --- /dev/null +++ b/2020/day2/input.txt @@ -0,0 +1,1000 @@ +13-15 c: cqbhncccjsncqcc +2-3 v: zvdvfd +9-14 b: rbrbnbbbqdfrht +11-12 k: kkkkkkkkkkxqk +4-5 b: bqbbdm +10-12 w: kwwkwwwrwzzwwwwzwswx +1-11 g: grrmgmqgghw +4-5 m: mbmhmvmwdvxmvpw +1-13 n: ndnnnnnnnnnns +11-18 l: lllllllllllllllllll +4-5 c: cccscc +2-4 k: bkfr +9-13 k: lcmsvkknrxtkkksgvkjg +1-2 b: bhwgb +1-4 j: zjjcjj +7-11 g: nnffggdmggr +3-4 z: zzhzz +4-10 g: mggkgvgggmggkggmqg +4-5 n: dcmnl +11-15 s: gzpdvsmnzsshswzs +10-14 x: xmvpxjtlxxhxtpdhsnx +5-15 v: zzhjdpgxlsvphzv +4-8 k: dsfktqchpkk +6-7 j: jzjgjqld +12-16 r: rrrrrrrrrrrhrrrrhrr +1-2 l: lllllll +2-3 q: jqxwtggmgqmzpljdvkt +8-11 p: xpmcppppwvzp +7-8 c: vwcvkcct +4-10 d: lsmdffzdsrk +2-3 p: sxpg +4-11 p: rzlgxshhpbp +1-4 b: qbbbbbbbbbbb +6-11 m: zwmzmmlbmxgphkks +1-4 n: lnnnn +15-16 h: hhbdmbhchhhkhhrw +10-11 k: kkkqtwkkkkkkkkn +2-13 m: mggmmxmrzmwglbmmm +12-14 g: ggggrggggxgwhggggd +7-11 l: llbqsqlkvll +1-3 f: ffff +4-9 h: qvnhvcmpmfdbqhkdsg +3-8 d: ddsdddddd +14-15 j: qjjjzjjjjjbxmjs +3-5 j: jjjjtctjjjs +12-13 q: qqqqqqqqqqqqgqqq +1-8 p: xpppzdpp +13-15 f: lnlnlkcwgnfqgmfhlwm +12-17 g: gfgtgrvcxggggtggjg +6-8 r: rrrrtwrqrrr +9-12 r: ctldssjlrzhvpmqrtxd +1-6 k: qkkkdkkkkkk +17-18 x: bxrxxbxxzpbxnqxcsmn +2-4 c: ccmr +1-7 m: mmmmfrdmmmhl +9-12 d: ddddddddxddhd +13-14 f: ffffffffjffbbff +4-6 c: ccchcc +6-7 r: rrsrrrrcrrjbrrrr +9-15 w: wzfbtqrwwgtmbxn +6-7 q: qqqqqqrq +1-7 l: lgpqzhlkb +6-8 d: dhddkndp +2-5 m: bjxmmmmm +5-16 t: nbgjntfhpwtbrcftxt +5-7 k: kkkkkhbkkkkk +8-19 t: dsdstttfjhnttttvgttt +3-4 t: ttltttt +1-5 l: flfllllllllbhldll +7-10 x: xxxxxxcxxxx +2-7 t: ttttttctttt +3-12 x: vlxfwpdncxzkmkxt +1-5 b: mbbbbbdbbbtbwbhpbt +3-16 q: fpqkkkqfkqdbrxlq +5-6 p: lpcbtppjpt +6-7 w: wcwwhwv +9-13 v: vvvvvvvvvvvvvvv +1-4 g: vgggtggghgggggggg +2-9 p: mppsrrzwxdt +4-5 f: ffffdfffffdf +2-5 x: xkjss +13-14 z: zzzzzzzzzzzzbhzz +2-10 p: xmtkzpbrrj +17-18 t: ttttttttttttttttttt +2-8 j: cjjqbzpd +4-12 z: zzzkzzhzzpzzdzz +1-2 d: rdcdt +2-3 j: wnltj +7-9 r: rlrfbrdrqrbdr +3-4 s: bcsss +12-14 h: hhhhhhhhhhhbhhh +3-5 h: rfhlc +8-15 f: ffffffflffffffff +3-15 s: ssxsssssssssssss +2-4 h: hlbhshhmhhhg +12-13 r: rrrrrrrrmrvrnrr +3-5 p: ppppjp +1-2 z: zqhdkgqqzfsxkjjzg +6-8 k: kkkkkkzd +1-12 h: qhhhhhhhhxhhhhh +9-14 p: ppppppppqppppfp +2-4 t: tsttt +18-19 t: cttttllttttwxtttttt +10-11 t: rkdbpntntttfw +4-14 m: mdmmgtlmmwmbmmmk +4-6 n: xxhnpmnfnn +15-16 g: ggggggsggggggggng +14-15 k: kpjxmkrksskpbwk +15-18 f: fffffsffffffffnfffff +18-19 p: gwpplnpndvpxgzjvhbpp +8-12 l: ldclrkllbgpwllllcxms +14-19 w: pxsjbtwwhdkptwcxwvr +2-17 m: mtmmmmmmmmmmmmmmmm +12-15 b: nbcsplrmvbjbqlc +1-4 z: bzzszzzzz +1-13 t: tttttttttttttttttt +6-7 j: jjjjjmvjjjjjjjjjjj +10-13 l: llclllllljllllll +11-12 c: mzckxzsbbxcq +2-14 k: kkckkkkbkkkkkrkkkkkk +3-5 s: msssvqszssprssss +7-10 f: fffffffffrf +2-4 l: dlwrl +3-7 v: slqgljmrqrwv +4-6 d: pdddddnddddddd +6-9 f: cnfffpfzfffffff +4-17 v: vvvnvvvvvvvvvvvvvv +7-9 q: qqqqqqqqkqqqqqnqq +15-16 q: qqqqqqqqqqqqqqqqqq +10-11 g: cgtrgggggggggg +10-12 x: xxsxxsjxfxxlx +3-12 j: jjljjjjjjjjjjjj +8-9 c: ccbccczccthcc +4-17 h: hhhfhhshhhhhhhhhhhh +1-2 p: prppr +4-12 q: qqqdqqqqqqqqqqq +7-11 b: bbmbqbrtlwb +4-7 l: lllhlllllz +3-4 r: rrqc +5-14 r: rrrrcrrrrrrqrrrrrrr +10-11 d: pxdcxxjsddd +9-11 s: sssssssspssssssss +1-2 j: jfjljjjjjjjjjjjjjj +3-4 v: vqnvvv +2-3 c: wlcntvmsshxcgzc +9-14 t: rbbljpttwwjtbj +10-11 s: gnrdtfzttks +1-4 x: xpxjxhdxx +9-12 c: chccccccmpfccc +14-16 j: jjjjjjjjjjjjjxjjj +5-6 d: rpdndsbddwdd +9-13 x: thpdhlcwxcxxvxbv +4-6 g: nfsgqnvbntgwvlzlmmxg +3-4 d: dttdcdtq +2-4 n: wnntzbr +2-10 j: jtpszbpjfjcgdjg +6-7 b: bdspbvb +10-14 z: vzznzzzwzlzzqzj +7-8 c: cccccccc +7-11 h: hklhdhssfbz +7-8 h: hhhhhhqzhhhhhs +3-5 b: bcgbwbbbbbdb +5-6 q: qqlxqbgtqpkqt +8-9 q: qqqqqhqkq +2-4 q: qshp +8-13 g: gggggggrgggbgghg +1-5 k: ktcpgpk +2-13 v: mvvwnvfkjrhvvdvvtsvk +12-13 k: kxpkkkckjtkkj +12-18 h: xhqngjkxqqzqhnhhhh +11-12 k: kkkkkkkkkkkjk +2-4 r: rdgrrr +3-4 x: xwjx +2-6 c: lcqzflc +13-14 t: smlkctgbsqpftx +4-5 b: fxtdbzbqbd +4-7 s: wmsssznjzsdkgvdsxhd +2-6 z: wpptkhk +14-16 p: pppppzpppppbprppppp +6-7 c: cccccbw +1-6 h: mhhhhhh +2-3 k: cwkgk +3-4 l: llcl +3-4 m: kmmx +14-20 h: hhhhhhhhhhhrhhhhhhhh +8-12 b: bcmbpbffwghcvjb +10-15 f: fffdfqwmzfdfrfdbpf +1-2 l: hlllljl +1-3 g: vgbgg +2-4 n: zgfn +18-20 w: gmbwtzgzpmdwstsffqzw +9-19 j: jjjjjjjjkjjjjjjjjjjj +16-19 f: fffffffffffffrffffzf +8-20 l: htdlzwsllllccwlflstf +3-4 w: wwww +2-4 b: sbbz +4-6 n: nnrzbbnlcrnsbk +7-8 c: wmzjtbvw +5-7 l: cldlljlzzz +5-6 h: hhzhbhhg +4-5 f: scmrfftkc +11-12 m: flfrbmdpdkpm +6-7 v: xvvvcvkbnvvq +4-11 h: qkjphjpfllhpqnbm +2-5 b: bqbwbbwsb +1-8 c: cqcscccbccrccq +1-13 c: cccccccccccckccc +7-8 h: hhhhhhhs +1-3 l: llxl +6-8 h: hhhhsnkv +6-13 m: mmmmmmmmmmhmpmmm +6-9 n: nrnmmnbnmn +7-14 k: whkpphhkxlnnmkbhtnt +4-10 n: nnnnnnnnnhkn +3-4 c: mcnw +8-13 b: bbbbbbbgbbbbbbbbb +8-9 c: lcccdkjcjrqwck +3-13 w: szmnhsmzwpdbkhtbf +4-5 r: prrrz +9-14 m: mmmmmmmmgmmmmmm +7-8 q: kqpgrqqp +16-17 p: fzxxpcpdhmvmrnvjp +7-9 v: vvvvvvqzxs +3-4 w: qwxw +1-2 x: xqkx +9-10 v: vccmlrlhvdtttfvcxwm +11-14 h: mhvthqhvhhgmfhhhkhch +3-4 n: nqzw +2-5 j: jbjjjjjjjjjjjjjj +11-15 g: bcxggqfmgzgfrdg +3-5 v: gvwvvvrzf +6-7 t: ttzdttr +4-9 j: cgqjqdjvjbfjwdlvdgj +5-6 s: hfflrzksshjqsbvsps +1-4 p: pppn +4-5 g: dprggmpfggbkpg +2-3 k: kbhkkkk +13-15 r: srrrtstrwwxzrrzr +2-4 b: lbbnbzbb +1-4 g: fvgz +5-11 q: hxdhqrqqprpq +2-4 z: zzgm +1-13 w: wwwwhwwwwwwwwwwwww +2-3 k: kkkkk +4-8 g: nlgmhplgcv +1-2 j: zncllmvgjnj +11-13 f: fffffffffffflff +2-8 p: bphqpxkr +2-9 b: bbbbbbfbdbhjpbbbjbbb +9-10 s: zpxnstzwsw +7-16 c: ccccccccccccncsvccc +6-8 r: rrwbrqgr +6-12 v: vvvvvvvqvpvvvvzdd +8-9 z: zzzzbzzmzzz +15-16 t: tfttttntxttqtttc +9-16 b: btbrbfplbbbmbbbbkbb +7-8 q: qrqxrlqg +8-12 q: qqqqqqqpqqqw +5-8 v: jrrlpvvcvkjzjvvvv +11-14 d: dddddddddddddq +5-6 f: rfxmfzf +3-4 t: tttqt +10-14 c: bcccccccccrccfc +3-7 n: snnqplvl +5-6 z: kshzfzhlcsbqwqb +6-11 s: sssssssssmsjsgssss +3-7 v: qgcxvxvg +12-17 v: vkvbsvxkvvnjvvrvvvx +2-4 d: ddrrxbd +8-10 x: tvxxtmgbsxpxbl +7-9 r: rzrbgbrrrrrrmhm +2-4 t: ttttt +5-9 x: xxtwxxnssxlxx +3-4 p: ppdp +3-7 g: ggtgggtg +1-2 k: kbbhjdkfvjqffcss +1-2 l: lrlvlll +10-12 x: xjkbqxkxzxxq +7-9 d: dddhdkpdfdf +5-8 m: mmmmmmmwm +3-9 l: sfrjlzhcll +7-18 m: mmmmmmcmmmmmmmmmmmm +1-3 w: mwplxwwww +7-8 t: tgtctbtrtdtttt +3-6 p: lfpbbgfbpdhnqz +5-6 d: ddddrd +1-3 b: llbbbbb +4-7 r: ktbrncrrnnsrr +8-10 r: rrrrrrrfrrbrr +1-8 l: wlklvlllnljlgtzll +2-4 m: mmhmmxsm +10-12 c: cmwkcnczsxmcrmjtc +2-8 q: qmqqqqqzqq +7-9 v: xvvvvwdnzzv +3-7 j: lsjvmbrjjmpcwqnvvdgc +3-9 l: bgmllldjrzhllsclc +1-6 p: ptppfjpqpp +7-8 r: mctrrstrrxrqtmrr +7-8 d: qddddddxddddddddd +4-11 r: rrrrrrrrrrbr +4-8 s: lsfvtfss +4-9 c: zcccccccj +11-12 v: vvvvvvvvvvvm +4-8 g: rggzlfgtm +3-8 j: jjjjjjfhjsgj +3-4 m: fmhmm +15-16 l: ltllhlljtllllbtlllgl +12-13 c: cccccvcccccqccccc +6-7 q: qqnlqqhqqq +1-8 z: znjqzxpz +10-13 k: kxzmkbxnkbkktmkk +8-15 k: bskzvggzsnlnxzz +9-10 v: vbvvgvcwvs +5-8 h: qhsnhhlhwpvzfb +15-16 g: gdcgggggggtgcgtg +8-9 z: fbgdnrzfb +6-7 d: ddkdddh +4-6 w: xzgfwwlbxft +1-3 h: hkjhh +1-3 p: pwprlp +8-12 j: jdjjjjjdjjcjvjjjjjj +11-14 m: bdsfwddfkgxsmrmm +3-10 m: tmmcmfmmjmm +3-4 b: dwhbzfjxl +2-5 n: nnnnjcnnn +16-17 v: vvvfnvvvltsxhrvvm +1-7 v: qvvvvvwvvvdvv +2-14 k: nxqblwwqmhqzkm +3-4 t: ttts +5-6 c: clnnfk +12-13 s: sssssssssssts +7-14 d: ddqdnwdkdmhddg +3-4 t: tmsttm +9-11 x: xxxtxxxxxxqxwntxj +8-14 l: lllqklwlvlllmbslzlln +9-12 n: sdsnnfncxnwnrn +1-5 f: qfffff +6-9 r: rzmphlrgrr +1-4 m: grdm +4-5 s: ssxsg +1-4 n: xhnznnxnnn +2-6 r: mcwldgbqlqsckgzlrd +1-3 l: llmllll +3-4 p: pjtgdnfjfcjtcnpgxpzq +6-7 m: mmvmmmtn +17-19 h: qgmhhhwwwhqhmhhthhch +3-14 s: lhmnsfdrvnngrsfhxd +1-6 p: pppppwp +4-6 l: lzllltrl +3-4 c: rpxccsc +13-16 h: qsdznfqmsftqqthh +2-4 k: wsvkm +1-18 h: chhhhhhhlhhhhhhhhhhh +17-18 d: xddddddddddddddddddd +2-3 t: jtbrhpzjfpzhcmjql +10-11 n: gjngnnncncnn +7-13 r: rrrrrsrrrrrrlwrrr +10-12 l: llldllslbldllwl +17-19 m: mmmmmmmmmmmmmmmmfmm +10-14 n: nnnnnnnnnbnnnnn +17-18 x: xrxcxxxxxxxxxxxxxxwx +3-4 b: lvxb +5-6 r: rrrrrrr +13-18 l: lllllllllllllllllpl +8-12 m: mmmmmmmqmmmmmmmm +7-8 l: llhqlllh +3-8 p: nmrppdvpxcphxgmkpbsl +9-10 v: hvsbttgsdvvj +5-9 k: kgmvzzzckkgldk +15-20 x: xqxxxjxxxxxxxxxxxxxl +5-6 t: bbwpwtwbhwgqttzjv +6-13 n: klzcfnnjqxrhjwpjfxnk +5-8 d: pcnndzddddnsdqh +5-14 k: kblbtvkwltfklk +4-11 q: zxwdkqqkvqq +10-12 s: tsssssssssssss +3-5 r: rddsrrdksfqfrgr +7-16 h: vdvhlsjxgvrbrxnhns +3-4 z: zxtz +4-8 x: xmnxdwmh +11-12 r: gwsnfrnckrrxrx +3-9 q: qqqqqqqqwqb +9-14 f: bfnfffffvfpfffff +6-9 p: pvpppkppcpp +3-4 m: mmmz +3-5 j: jjjjmjsjjrlkjjjjj +4-6 p: jpbpjs +6-9 r: bswdsrksdrzrgrfmjr +8-10 l: lllllllxll +3-7 v: vvhvvvvv +4-11 n: mnjpbldngrrkbthhmdp +2-4 r: frlrfblsrfzrhtpk +16-17 h: nbghhnzshclxhhmkr +2-5 z: zfzvzzzzzzzq +1-5 l: lllzlfl +9-10 d: dddddddddzd +11-12 p: pspppppppbzp +5-9 t: thzttpxrdhttdwqjsg +7-10 w: tfdfwlwwzdvpnww +4-6 z: fvcljzllwhbzscx +14-15 m: mmmmmmmmmmmmmcd +8-11 d: hgdmwgsdkdbghb +13-15 v: vmvdvvqvvvkvqvvv +13-14 f: fffffffclffffffmf +2-5 s: ssscn +11-13 w: wwwwwwwwwwwwww +7-9 l: xnwrlkskll +8-14 g: vggglvcrgscpgggt +4-5 w: wwwww +5-11 w: wwwwswwwwwwwwwww +6-7 g: gggbvjg +14-18 q: wqfqqqqqqnqsqrqqqq +6-7 z: zzzztzqczzzzz +6-12 n: wnnnnnnxftnkznpvvl +10-16 j: jjjjjdjjjrhjjjjj +1-10 l: lllllllllrll +9-13 g: gdgggggggggkggn +6-8 r: rrrrrrrs +16-17 k: kkkkkxkkkkkkkkkck +11-14 b: bbbjbxbfmqscqbdmgg +3-8 d: sjdkmjppbdddhdxd +6-7 g: xhkhwgqpbg +11-12 x: xxxxnxxwgxxbdl +6-8 c: cccscccwcccccccccc +9-16 h: vhhhhhchwnghmkzhr +5-9 v: vvvdnvvvvv +4-16 n: nmqncgnbfhqnnpnbxwrl +3-5 f: fljrf +13-14 m: mmmmmmmmmmmmgfmmmmmm +5-6 g: ggnggd +2-6 w: wlvhvw +13-18 h: hhhhhhhhhhhhhhhhhvh +7-19 m: mmmmmmmmmmmmmmmmmmwm +4-12 k: mcvtrtsdkvkkfjrmkn +1-8 t: qvmrtttn +6-7 f: fffffsf +10-11 m: mmmmmmmmmjl +15-17 v: mvrhvvvvnvrvzrvvfv +10-14 m: mmtmmmnmmmmmmxm +4-16 b: vcscdqcbcxswjfdbrqbx +8-9 z: zzzzzzznzvz +4-6 g: ggnggdpgggg +2-4 d: hddxxnzzw +9-10 g: gggggggggj +4-7 k: kkkvkkkkkk +1-3 r: rrrrj +14-15 w: wwwwwwwwwwwwwwwww +2-4 n: brfmln +18-19 b: bxbbbbbghbbbbbbbbwb +10-12 q: dqqqrqwcqgqqf +2-5 g: sxfzgtrxkrmstdzfmw +3-4 d: pcddq +11-16 w: sbqwlwzwwwwwtwww +2-12 c: wrccqxtccccchcccjcj +16-17 b: bbbtbbbbbbbbbbbqb +3-13 t: tttttttmgktdthtp +1-3 t: ttcg +13-14 z: zczzzzzzdwkzqz +5-6 n: bnjhnjhnnq +2-9 b: bjbgbzmlbbklbwt +4-5 b: dtlbbwtjbkzzbghbghzk +10-16 p: ppppppqpppwnpppppppp +5-6 b: cbbwtbjkm +15-16 p: ppppppppppppppqd +4-8 m: lgmmhgktslzhbvw +2-4 h: hhdlhhhhhhhhhhh +14-18 k: ktmkkkkkwkklkjrkklfk +5-7 x: sfxxsxx +8-9 v: lkvxdpvjv +7-8 r: rrrrrrsr +4-6 b: btcbbv +7-13 n: zhnhjhnmkzdbt +7-9 j: jvjjjjjjjjjjjjxjj +1-4 v: hdvfv +2-5 f: rznpnxqwncmtkwfxcxqh +16-17 x: zxgbhltrdhxkvvxsxf +1-2 h: hkhhh +3-4 h: zhxc +4-9 z: vsmzhzwgjxfg +11-13 x: xxxxxxxtzxxxc +11-12 d: dddddddgddqj +4-11 f: zkdhqnpgbff +2-3 q: qqlqgqqqv +4-9 b: bvnblwhbbkswmrhtf +7-13 t: cztskdtqdtrkt +4-5 f: fffcsf +4-9 f: ctblqrflf +1-2 l: lmllqhlnll +3-6 v: vvqvvvvr +7-9 b: bbrhbkjbb +1-8 p: xpppppppp +7-10 k: ckkpmktkqksgkkk +1-7 m: lmmmmmmmmmmmmmm +11-15 v: vvfvvmvvvvdvkvv +10-11 b: kbbbbbbzbhbb +11-12 l: jltgggtlcggllt +10-13 q: kqnqqqqqqqqqq +6-7 c: cjcccczc +5-11 t: kdtstshrhfkcx +3-12 v: vlvfzvwvxvvhvvsvvcvm +9-10 t: xttttttttttt +8-10 z: hctlkgjzvzh +3-5 g: gtkwgk +16-17 w: wwswwwwwwwwwwwwwwqww +4-11 j: lbmwjzjxjpjhzjjpbj +4-5 c: klbxc +3-5 w: wlhvb +4-8 x: xgxxxxxxxxxxxxdxnxx +2-5 n: nnnkhn +1-2 d: dxfd +11-12 w: wjcqszwqwkcb +6-11 v: sqpgzhnvndtmvvwl +3-4 m: mmmqmmm +1-3 d: mddb +6-7 w: wwwwwnwwwwwwww +12-14 z: zzzzzxzczzzrzzz +5-10 f: mtcmmhfftft +10-14 x: hhgvmxbwgxdcnz +10-16 z: wzfzzmlmxxfhzqcbsnl +3-4 p: ppvkppp +8-11 h: hhhkhhhjhpbhhhh +6-12 f: ffffdwffrsfffrffnfpk +5-11 z: xqwzzzzbzpwk +7-9 c: crccccccscccccc +4-5 b: qpcnz +2-13 m: lmnrrzfhmbwtmqbsg +12-13 k: kkkkkkdkkkkkmk +10-14 q: sdqfbqszdjhqfq +8-13 h: hhhhhjhhhhhhbhh +2-4 g: gfdb +12-19 n: wtrhndnnnbwnnnnjnnn +5-6 n: zdwnpn +3-5 f: ffsffffff +11-16 r: rrrvrrrrrrwrrrrrlrrr +6-8 n: nnnnnfnnn +10-13 b: brnlbblbkbbbjbbhx +7-8 q: ftrfnqgqc +11-12 c: ncccccccccgcccn +3-4 z: tzzctzwzzvz +3-5 t: tzrqg +7-10 m: mmmmmmrmmqmmm +1-2 c: cdccfcccc +10-11 k: kkkkkkkkkwkk +6-18 x: qndxdgmjvpppddwkbt +8-17 c: pxhszsccndlbzkwgvx +3-4 p: qlrvwdxpqtgwjrtqcc +2-4 q: lkjq +17-19 f: pffgflzxrxfdxffffnz +3-11 x: kzsvmhcxnwj +6-7 x: lxxxxxxcm +1-8 n: nnnnnnnrn +2-5 r: rtrrnr +2-4 n: csvhrvhlp +7-8 b: lbbpdbkb +2-8 t: ztcrbvmst +3-4 r: rwrr +7-15 b: tbtrrbbpwsrvklqb +9-13 d: dcfsgddmdsjgg +2-7 d: mvdzscd +6-8 d: jrjjdndq +1-3 m: mhmvhtmmlbztvmsvmtmb +10-12 c: ctwjbpkchccmbqw +2-3 z: jvzwcrbgqbhvzbf +2-7 g: qbwsdbg +4-7 s: jsxpbmsmkhktfdq +11-13 r: rrrrrrrrrrhrqr +9-14 d: zddcdgddddxddntddm +1-15 x: jgrxxxxfxkgbmsxzx +2-17 p: kcppppkppppppppwm +12-19 k: kkkkkkkkkkkmkkkkkkkk +1-4 x: nzpxg +5-12 p: xcbppqnppqgtrm +11-14 h: dlhzhhhsbllcwhh +13-14 q: qqqqqqqqqqqqqcq +11-16 t: ttgnswrltltttjtj +14-15 t: ttttvtttftttttjtc +3-5 s: xssns +9-11 q: mlqqtqnjqfl +3-4 z: nzzhz +2-5 k: skwbwkwgzj +1-3 p: pppppcppppbpp +5-10 r: rrrrlrrrrrr +2-3 l: jlffrztcckl +3-5 t: ttftttttr +3-6 q: qtqtmnlqck +1-4 v: vxfvmvxwvvjbxp +1-5 z: tzzzzszvzzrmzmz +10-11 l: lllllblllcx +1-4 p: vppppp +6-12 v: zvrwvvvrvhzb +2-4 x: xxnv +1-7 w: hwwwwwgwgwwbwqw +3-7 w: wwwwwlfw +5-6 l: kkpltd +4-5 d: ddnrdk +3-6 c: cncvkt +8-9 j: vblczlfjjkj +7-15 d: ddddxdgdddddddjddd +4-7 z: vvmzdspzwptz +5-7 t: cdrtfqt +6-9 j: jjjjjdjjjjjjjj +2-5 j: ljptkvvfl +6-7 l: vhhnllgx +5-6 g: gpcxwvgpvvgg +5-12 q: plzqqnqzrhqgljj +8-13 k: zkckdknkxkgkvmmkd +4-10 s: jkvstssfcsrckjnzzbsl +9-11 n: nlknnnnggnvnnnnn +8-9 s: ssssrsgstk +16-18 r: rrrrrrrrrrtrrrrbrrrr +4-5 f: qxrzfcgfqfp +2-10 p: pphtppppppplwpsp +2-5 q: qqqqsq +6-15 j: xjkxkjxxkjznjjj +9-13 f: fvfvjlfmltfgf +3-6 j: jnsrcj +1-7 h: vhhhhhhh +4-5 q: qrqqqf +2-3 v: mvxb +4-11 l: lllllllllldl +7-17 k: mkcxhcmbcpjckkqznh +7-9 v: vvpgvvvvs +7-11 j: jjjjjjjjjjjs +2-12 v: mlxjljvffxgv +3-4 t: hhfn +14-16 w: kwfwwqwcfcwwfmww +5-6 j: jjjjjg +11-12 n: nnnnnnrdnnmnn +8-9 b: dsbbbfbbbb +3-4 j: jjcjjj +1-3 r: wrnr +10-11 p: pppppppppqppp +12-13 v: vvvvvvvvvwvvvv +7-9 v: vvvqvvxvdvxv +9-14 r: mmrrrrnrrxrrrwrrrrrr +5-6 k: kkkkbkkr +13-17 v: dbvgrchdpnzvxrdfv +4-9 c: ccjbccqcpcclcc +6-8 m: mbjmmxnb +2-6 h: hhdhnvcc +9-16 t: tttttttttttttttgt +12-16 n: nnnnnnnnnnnnnnnwn +3-14 z: zzdzzzzzzzzzzzz +3-8 k: pmktwckzn +9-13 q: gqqqqqqqrqqqqq +3-6 l: lllllddll +7-8 x: slxxzplxsxkcxlxxx +2-5 v: vwvvd +6-7 n: xxnnnmnnn +2-4 z: zczz +2-12 p: pppppppppppvp +2-4 h: bqwhv +5-7 t: btzttjg +4-9 c: sxcskxxbcv +1-6 c: cccccpc +9-13 l: bcsllbvbjhrflt +5-9 c: zprfctdnt +1-5 z: zzzzz +4-8 h: bpshnhxhrbk +4-7 l: bqclvxf +5-6 m: mmmmmgwcmgjj +13-18 m: mmmnmmmmmmmmpmtmmgm +1-5 w: cwwgwwwwwww +14-16 h: hhhhhhhhhhhhhqhhh +6-7 v: bvvjvvbvvv +5-13 b: pbcbbqmbcsfblc +17-18 j: jjjwjsrjjmkjjqjjjj +4-6 t: ntttpt +6-7 v: mvvnvvc +11-12 v: vclgnzbvtvvjvs +8-13 r: rlrzkjkrrxmdvzgt +5-7 n: nnnnnnsnnnnn +3-6 q: qpkjpq +2-7 v: hvgnjfrkvx +6-10 g: xgmrggggpbggfqgdpm +9-10 s: ssssssswfszsdssszss +5-6 p: pppjppwpp +2-5 d: ddddddd +9-13 p: ppjhpbppxpxxt +10-15 t: cgtcnlltzdkbcjtvxs +8-11 m: dkmmvtdmkbhmk +3-4 z: rzzqzw +4-8 z: zcxzswbzzqzxwkzz +3-4 s: jsts +2-7 b: bsbbbbbbbbbbb +11-15 l: jjkslsltvfbqshl +3-14 c: cqtxcgmcgvgfcccmg +1-8 f: fbfwffhfbxffhlx +4-11 r: drrmrrrzcfrj +5-6 p: pwpvjp +11-14 d: pnrddqwdlpdbddwg +9-10 r: rrrwrrrznrrgqsr +3-12 v: vsvvbvvkvvpdrvvv +2-5 t: mtfqjrjlthk +13-17 r: rrrrrrrrrrrrrrrrtr +7-8 n: nnnnnnhnn +3-4 r: wrpr +1-14 p: ppppppppppppppppp +8-9 m: vzkbzwnmwfqmmmmcmmnd +11-14 p: pppnpvpwppvpppppppp +17-19 h: lzhxlhhchxhbxhwvhsx +10-11 n: nnnnznnnnlp +3-12 f: kwflsfqflxpzbgxzdhzv +8-10 x: xxvxxxxvxsxxlxxxx +1-2 c: dclflczlj +4-9 w: wwwtwwwwwww +2-8 t: pfvtlbtxt +4-9 f: pnfkffkfnh +8-10 v: vjvvvvvvvvvvvv +3-13 s: mfshscgmmrvzw +6-10 g: gzggggpggkggzggggg +13-14 n: fnnnnnnnnnwnrnnn +4-14 k: lbvkwrkjkxjskg +9-11 q: qqqqqqqqsqgq +17-18 q: qqqqqqqqqqqqqqqqqd +6-9 s: spsssgsrrssss +8-14 m: qmmqjmmmmtpmnzgmm +1-7 m: bmsrmmmmmmm +14-17 k: kskdbkkkkdkkkktkqkkk +4-5 c: ccccgfc +2-5 k: kkkkzk +2-11 q: qqwqlnqqqhtdvxqrc +4-6 m: fdxkmmd +7-10 j: mjgftcmjmjj +17-18 m: mmmmmmmmmmmmmmmmnm +2-4 v: svvv +6-8 x: jxxhrxlp +4-10 s: dsvdbsssmscs +18-19 k: zwdgknqvqkgdhdhktkmr +2-7 h: jdflgfh +6-8 z: zmpzzzzzzzzgz +3-6 m: mmrmmm +4-8 w: wwtwktws +4-10 k: dkjkqkkzvk +3-7 b: bbbbbbfbbb +4-12 z: zzzzzzzzzzzzz +5-9 z: nmqdzzkzzzbj +4-11 z: fzzgzzzzzztzz +1-7 w: whwwwzrw +5-6 t: tjtttv +9-11 v: vzvhvxvvnvwvvv +2-4 t: pkjtpp +14-15 n: njpwjnsbnnnnngnnvnnn +5-15 k: qtmvkkdjkslkqvk +2-4 s: skszs +2-3 g: zggjhgxzn +16-17 p: ppppmppppppppppnppp +4-10 z: zzzzzzzzzzz +17-18 s: sssgsssskssssssssbs +5-8 m: mmmmmmmbm +1-5 l: llllmlql +3-13 z: bmdwpgvzfdlgzgl +1-4 p: pjplgjr +1-9 v: vvvzvrvvk +6-18 w: whwpwwflbcwwvwwwwst +19-20 n: nnsnnjnnnnnnnnnnnnkx +9-10 m: rlmxrnqrmkmmwmmmmm +15-17 s: lvssssslssfsssksfb +3-4 q: qqqpq +7-13 h: hhhhhhhhhhhhdhhhhhhh +2-6 h: dvkfhhmk +4-6 s: nczssv +10-12 p: pppppppppppdpprp +16-18 s: sssssssssssssssgsg +7-12 h: hhhhhhvhhhhhh +4-12 f: ffftfffffffwff +4-7 s: csqcpssbgvvmwdb +6-10 p: ppppvppppdppd +6-8 h: hxjhthhgzh +3-10 f: fffffffffsf +4-11 g: trggxlrnqrgh +2-15 w: wjxwtvkwwpgwwww +1-4 v: zjxv +7-10 f: fffffflqff +4-6 g: mgwgpbg +1-10 z: vvzzzzzvzz +6-7 f: ffffffnf +11-15 w: wxzwwqdnnwwxjlwplcl +10-11 s: hsslzjgsssvxsshnsc +4-12 n: tlxdnpznjbknt +7-8 k: mkhcvjxk +10-12 j: jjjjjjjjjjnm +2-7 c: fckckdpcksjckwcc +3-8 s: sssdxssw +12-14 t: ttttttttqttxttttpttt +6-7 g: gggggggg +5-10 f: fqffzffffffffgf +6-7 t: ztqhpbt +5-12 w: swwfwwwwwpwbwj +2-4 w: qmww +5-8 v: vvjnvvpv +7-8 p: bcbtnppbxnnwpr +4-12 z: zzkzdxntzlfbkkzzzw +8-9 s: sssssssss +15-18 h: jhvhhhcxwhhhhmhhhj +6-10 w: bwwwwwwwwwwwww +5-9 l: mtqlhlwlh +5-7 l: ljllnllblpl +15-17 h: hpgdkhsjwfnsjmhqxf +3-4 g: gggxgggg +1-2 q: qdqm +6-10 n: hnnnqknnnnnlnnnnp +13-17 q: djstfsmmqlshqqbqnf +6-7 z: qzlzxzw +7-12 g: qhghvbwdcvkgjl +7-15 z: zzzzzznzzzzzzzzzzzzh +3-6 w: zchpwvw +3-4 c: wmbjp +6-9 k: tckbvkkxkkqk +11-13 p: pcppppppppppppbp +5-7 r: rrrrsrxrr +6-10 c: ccccczcccccccccc +7-8 j: jjpjjplj +5-7 m: mjmmmjrmfmmmmmmmm +1-7 t: ttttttnttvpt +6-12 t: tttfwtttttttttttttt +7-17 x: hxwgrqqlxmrxrcwsx +3-8 g: vjcgqrjhlq +13-18 n: nnnfnnngnnnnjnnnhln +13-15 f: ffffffffffffrbff +13-15 x: xmswzjhtthggslslgx +12-13 g: ggggggggggggggg +3-9 f: cxfskjcbmhmmcpwn +5-7 h: jxzbhbh +2-3 m: mhmlmq +1-3 m: rmmmgmzvcghdtgmsmnm +14-15 s: wzssphxtsskpssr +8-14 p: kppjppgfpprftj +2-7 r: prnmlrrbm +2-5 v: vvvvtvv +1-5 n: nnnnzn +2-5 t: xtlnfwhgvltx +3-4 v: gvtv +2-8 k: kvkstkfz +2-6 j: jdjjjnjjjjzjjjj +3-4 s: sshwsssss +2-10 w: mnhkdtwdzwvsq +6-8 b: bbbbkxbbtbbkbt +14-19 h: hhhhhhhhhhhhhhhhhhhh +6-10 d: ddddddddddddddd +10-13 t: ttttttttthttjttt +4-5 c: ctscw +8-9 b: bbbvbbgmb +10-12 s: sxssshsssswsscsx +3-7 r: rdhrrkrkrrrrcrhrrr +8-10 j: wjsslzjjntjjwjs +1-4 q: gqqw +4-6 t: tjlhvrt +2-10 s: ssssssnssssssssx +7-8 x: xxxxxxfw +6-13 r: sxtcgrffrpdprnklbxbw +1-3 p: ppbppppppp +2-3 b: jbfr +1-7 m: cmmmmqm +4-5 t: tttzt +7-9 s: zwbbbssvl +10-13 w: wwwwwwwwwwwwdw +13-14 n: nnnnnnnnnnnnnmkn +5-11 q: jpbzqwqbwttgzn +4-5 k: kkkwkkk +10-17 w: sgtklkflsrfqxfwhjm +6-12 w: wwjqwwlmphwkwwwwwjw +2-13 p: ppppppppppppzp +2-16 h: tslcwztxxtchgqlxsbx +2-9 p: slptvtljpxdkf +10-12 z: tnzzghzzgzfn +3-18 f: ffxfffffffffffffff +1-2 p: prdpdghkckdgpl +6-8 x: fxxnbwrx +7-9 z: zmzkzdpgjzzz +7-14 p: pppppppppppppppb +7-10 l: xltlzllllljzxlll +18-20 n: nnnnnnnqnnnnnnnnnmnb +15-18 p: pxmqxpmqwfntrpppmf +1-15 v: kgmvwvrvmcvtrvvwv +2-8 g: gxggggggg +4-5 f: clfjfqmpffjfff +3-5 r: rpjkf +2-9 h: hhhhhshhrhh +2-5 z: zxzzz +5-11 k: kkkkkkkkkkkk +8-9 n: nnddcfntnrgnnrnnc +1-11 f: dfffffffffff +2-4 x: dzphvg +4-5 w: mnzlr +2-6 f: jhrkfmg +2-17 z: czzvvzzczznzhwzbzz +2-5 r: xrjrg +2-3 g: gggg +7-9 s: ssssssbsssss +17-19 k: kcwktkxkkbkqnwkkkkdz +1-16 f: zmxdffmfgffxrffffqf +7-8 q: qtmrkbqjq +8-9 q: qqqqqqqqx +10-18 n: nnnnnnnnnznnnnnnnnnn +16-18 x: xwxxxxxxxxxxxxxxxrxx +15-18 t: tttttftptttttttcttt +10-11 h: hfxnlbsqxphtmstbhdn +7-13 z: vdzdzmzxvfzzz +2-5 n: nnpqgnnqnb +12-16 v: pvjvvnbqzjnvvvvpjv +4-5 d: ddddk +4-8 l: lxvhlbclhgd +3-12 v: vvkvvvvvvvvvvvvvvvvv +17-18 j: jjjjjjjjjjjjjjjjdj +6-7 b: ckbdbcsbb +9-11 q: qrhxpcjjqbqt +8-14 h: hhhhhhhhhhhhklhhhhn +2-3 b: bzbjb +2-15 w: nnmdgzhsvhpvswltvt +1-5 l: lbclz +15-17 d: wlddgdxsdcdfdcgdd +18-20 q: dqsldgqqfqwsstqlmqtz +1-6 q: qqqqqdq +2-6 j: jpjjjjjj +13-15 p: ztjlhtnsgphgxccpfsp +6-13 m: ghvvmrglmmmcm +3-6 b: nbbrmrfdlbs +1-3 j: fwhjsr +7-10 p: gcppcppzpppp +4-12 r: rrrrrrrrrrrrrr +16-20 d: djdddvdsddddlmddddpm +14-19 x: xzxjxxxxxxxxxxxxxxj +11-16 w: kwclzxjjwxlwkcnwkwv +3-11 b: zhhxsgqxqbbg +10-11 q: trbhqqzhdqw +9-13 l: vcvlvqlwrlfvll +7-9 x: xxxxxxxxgx +5-6 n: nnnngnn +2-5 p: pqpppppppqpxp +4-17 z: zxrmzwwxwhqxxmqrv +5-9 v: vvvvvvvvrvvvj +6-7 x: qkhbxxkxs +3-4 d: fcmd +5-9 f: nsnlxstff +6-9 x: hrtzmhrxxbmcc +3-7 w: wwwwwwsww +5-8 g: ngkdxggg +8-13 r: rrrrphrrrrrrrrrrdrt +2-6 f: rckzvzfrnp +4-6 k: bfrpttcfbwmvhgn +7-9 w: wwwwwwswww +13-15 n: nnnnnnnnnnnnnnn +4-8 j: jjjjjjjwjjj +9-11 h: hhhhhhrhhhhhh +4-7 h: thmhwrhss +1-3 d: ddddddddddddd +10-11 c: ckrcxwcdpqc +2-4 g: kgghg +3-12 s: ssssvwssssgqs +2-7 s: sssssszs +2-10 v: wvpbjqxvzsdpgmq +12-15 n: nnnnnnbnqvrkfnn +3-5 w: wlvdw +11-14 t: pfrbxgcrwndttj +6-7 w: qnnwwpfwwhw +7-10 n: nnnvnnhnnx +3-12 c: mmfcwvxqwpcclwlxfx +2-3 p: lgpxpppp +17-19 k: rfxvmnmfzrnktfpckpr +2-9 k: kkkknkkkkkkk +15-16 t: ttjmtttmttttttwt +9-10 r: rrrrrrrrmrrrr +3-4 p: jppppxf +7-8 k: nkqbvkkt +6-8 d: dddddrdddd +6-7 q: czbqdgnc +3-5 p: rxpppsx +4-6 t: thvtwv +2-13 d: dmdddddddddddd +16-18 n: nnnnnnnnnnnnnnnnnnn +11-12 s: ssfsdsmssswssh +3-5 v: kxnvvvmvrvdvvssvvv +5-8 x: nxxxxbxxxzx +3-5 t: ctttftt +5-7 s: hssvsgj +5-8 r: rrrrrrrcrx +1-13 v: vvvvvvvvvvvvpvvvvvv +5-9 h: gxlrhsgswhchfxbwjd +2-4 w: wgwb +6-12 v: pmxnjtfsvvxvv +1-4 n: vnntn +2-3 w: wwww +3-7 f: xmfbmnvnfkkmsd +10-12 x: xxxxxxjgxxxxx +2-3 l: cllvpbtmgzmrfmq +2-4 l: llrlllnlxll +5-10 h: hdhhhzhvtchhh +8-10 q: lhqmdwcfhqngq +1-5 t: twtfvcmktthtjltqvpwc +6-8 s: sxsghtbs +3-4 m: mmmmmmmmmmmmmmmm +16-17 l: rjdpxhtblvllgvwhl +5-13 s: brhsssnfcndsh +7-13 v: swkfswvmkvjbnsgvwp +1-3 k: wlfpzk +2-4 t: tpttt +2-9 t: cntttttcgtttt +5-6 r: rrrrbh +10-12 j: jjjjjjjjjzjjdj diff --git a/2020/day2/part1.py b/2020/day2/part1.py new file mode 100644 index 0000000..da33a13 --- /dev/null +++ b/2020/day2/part1.py @@ -0,0 +1,28 @@ +#! /usr/bin/env python3 + + +def parse_line(line): + repeat_range, letter, pwd = line.split(' ') + letter = letter[0] + repeat_min, repeat_max = repeat_range.split('-') + repeat_min, repeat_max = int(repeat_min), int(repeat_max) + return letter, range(repeat_min, repeat_max + 1), pwd + + +def test_password(line): + letter, repeat_range, pwd = parse_line(line) + count = pwd.count(letter) + return count in repeat_range + + +def main(inp): + with open(inp) as passwds: + valid_counter = 0 + for l in passwds: + if test_password(l): + valid_counter += 1 + print(f"Number of valid password in input : {valid_counter}") + + +if __name__ == "__main__": + main('./input.txt') diff --git a/2020/day2/part2.py b/2020/day2/part2.py new file mode 100644 index 0000000..b6fca22 --- /dev/null +++ b/2020/day2/part2.py @@ -0,0 +1,32 @@ +#! /usr/bin/env python3 + + +def xor(a, b): + return (a and not b) or (not a and b) + + +def parse_line(line): + repeat_range, letter, pwd = line.split(' ') + letter = letter[0] + first_pos, second_pos = repeat_range.split('-') + first_pos, second_pos = int(first_pos), int(second_pos) + return letter, first_pos, second_pos, pwd + + +def test_password(line): + letter, first_pos, second_pos, pwd = parse_line(line) + return xor(pwd[first_pos - 1] == letter, + pwd[second_pos - 1] == letter) + + +def main(inp): + with open(inp) as passwds: + valid_counter = 0 + for l in passwds: + if test_password(l): + valid_counter += 1 + print(f"Number of valid password in input : {valid_counter}") + + +if __name__ == "__main__": + main('./input.txt') diff --git a/2020/day3/day3.py b/2020/day3/day3.py new file mode 100644 index 0000000..c1daf39 --- /dev/null +++ b/2020/day3/day3.py @@ -0,0 +1,36 @@ +def check_slope_for_trees(plan, x_right=3, y_down=1): + x_max = len(plan[0]) + y_max = len(plan) + + x, y = 0, 0 + tree_count = 0 + while y < y_max - 1: + x += x_right + x %= x_max # wrap x + y += y_down + + pos = plan[y][x] + if pos == '#': + tree_count += 1 + return tree_count + + +def part1(inp): + plan = [line.rstrip() for line in open(inp)] + tree_count = check_slope_for_trees(plan) + print(f"number of trees : {tree_count}") + + +def part2(inp): + plan = [line.rstrip() for line in open(inp)] + slopes = [{"x": 1, "y": 1}, {"x": 3, "y": 1}, {"x": 5, "y": 1}, {"x": 7, "y": 1}, {"x": 1, "y": 2}] + tree_product = 1 + for slope in slopes: + tree_count = check_slope_for_trees(plan, slope["x"], slope["y"]) + tree_product *= tree_count + print(f"slope {slope} number of trees : {tree_count}") + print(f"Cumulative product of tress : {tree_product}") + +if __name__ == "__main__": + part1('input.txt') + part2('input.txt') diff --git a/2020/day3/input.txt b/2020/day3/input.txt new file mode 100644 index 0000000..6cfcb73 --- /dev/null +++ b/2020/day3/input.txt @@ -0,0 +1,323 @@ +...#...#....#....##...###....#. +#.#...#...#....#.........#..#.. +.#....##..#.#..##..##.......... +.....#.#.............#..#...... +.......#...#.##.#......#..#.#.. +#.#....#......##........##..... +.....##.#....#..#...#...##...#. +...#...#..#.......#..#...##...# +..........#...........##....... +..#..#..#...................#.. +#..#....#.....##.#.#..........# +.#.##.......###.....#.#...#.... +.#..##....##....#.......#...### +#.#..##...#.#..#............... +.........#....#.......##.#.#... +...###...##....##...#..##.#..#. +....#.........#..#...#.......#. +....................#..#.#.#... +..#....#..........#...........# +.#.....#..#.....##........##..# +#..##..#...##............#..##. +.#..##....#..........#..#.##.#. +..#####..#.#............##..... +...###.#....##..#.#....#.....#. +.#.......##....#...#.#.....##.. +...#....#...##.#...#..#........ +.####.....#....#.#.#...#....... +...#....#.....#.......#........ +#..#.#.......#...#............# +...#.....###.##....#.#.###.#... +.#.........#.......#.#....##... +#.#..#...#.#...##......#..#.... +.....#...#..#.#...#..###..#.... +......#.........#...###........ +.....#..##...#..........#.....# +..#..#.#.##.#...#....#....##..# +##....#.##...#.##.#..##....#... +.....#.#.#.#..#....##.#...#.#.. +.....##.......#........#....... +...#.#.....#...#...##.#......## +........#..#.#...#.#.....#.#..# +#..##...#.#...##..##...#.#...## +.##.#.#..#...#.....#.#.##.#...# +.#.####.........##.........#..# +.##..............#....#...#...# +......#...#..#...#..#..###.#... +.......##...#.#.#..##..#......# +.....#....#..##..#.........#... +.....#..#.#.#........#.#.####.. +#..#.......###....##........... +#..##..........#.#......#.#.... +.....##........#...#..##....... +###...#.##.#.#.#.#.##...##..... +....#...#........##.#.##..##... +.#..#.#.#......#.......##..#..# +.#...#.................#....#.. +.##..#..........#..##.......#.. +.#.#.#.....#..#.#.........##..# +...#......##...#.......#...##.. +##...###....#.###.............# +#.....#.#..#.#..#........#.#.#. +.....#.#......##..#.#.....#.##. +.......#...........#..#.......# +..#....#.#.#......#.....#...#.. +.....##........#..##..#..##.... +#.#........#...##....#.#..##... +#......#......#....#..#...#.##. +....#.#.......#.#.#............ +......####.#.##...#.#.##.....## +..###.#.#..#.........#.####.... +.#.......#..#.#....#.#..#.#.##. +#....#....#............##...##. +....#....#............#....#..# +..#........#..#....#..#..#...#. +.#......##....#..........#....# +#.##.....#..........#.###.#.... +....##...#.....#.#......#.##... +#.#.....#.......###.###..#..#.# +..###..##.............#.####.## +#....#.....#....#..##.......#.. +.....#....#...#.#.#.#..#...#.## +...#.....#..#....###......#.#.# +##.........#.#..#..#.#..#.....# +.#.....#.#....#.........##..#.# +.#.#..#.###..#..#..........#... +.##....#.#.#...#......##.....#. +#.#....#....#...#...##...#..#.. +#...#........#....#....#......# +#......#...#..#.#.##.....##..#. +....#...#......##...#..#....#.. +.#......##.##.......#.......#.. +.#...#..####...........#.#.#... +.........#...#.#.........#..... +#.##.....#.#..#.#.###...###..#. +#...##.###......#.###..##.#.##. +...##.#.....#....#..#......#... +#....###.#..#...##.....#......# +........###...#...#............ +........#....#...#...#....#...# +#....#..#..#....#.#........#.#. +##...#.....#.#..........#..#..# +#.#...##.....#........#...#...# +##.#.#.......#...#..#.###....#. +.#.......#....##..##...#.....#. +#....#....#.....#.......#...... +.##.##.##...##...#.#.#..#..#... +#..#..#.##....#......##....###. +.......#.#.........#..##.#...## +.#..##...#....#.....#.......... +..#.#...#......#.#..#.......... +.##....#.#.#.##.......###...#.. +..##.#...#.#.#.#.......#..#.... +#..#.......#...#........#.....# +.....#.......#......###..#..... +...##.#.......#.....##.....##.. +##..#.......#.#.....#....#..... +..#....#.##.##...#...#......#.. +.#..#.###.#....###........#...# +....##.##...##..#..#.#....#.... +..###...##.....##.............. +#....#...##...#....#..........# +.##........#......##...##...#.# +..#.#.##..........#......#..... +...#...#.........#.##........## +..#.#..#.#..#...#....#...#..... +...##...#..#.###.#..#.#...#.... +....###........#..#..##...#.... +#.#....##.......#.#........#... +.###...#..#.#.#.#..#...#..##.## +..#.........#####.#......#..#.. +#.....#.....##..#....#...#...#. +...#..#....##....##.....##.#... +.........#............#.##..... +....##.#..#....#.##.......#..## +.###....#.#..#......#.#.......# +.###...###.#.........#.#..#...# +.....#........#..#.#..#.#..##.# +.###..#....##.........#..##.... +..#.......#..#..##...#.###.#... +#.......#...........#.#...#.### +#.##.##...##.#...##..#.....#... +..#..#........###.#.....##..... +#.....##....#...##...####..#..# +....#........#...#...#......... +......#.#.#.#.......#..#.....## +..#..#....#.....#.#...##......# +..#....#...#.###.........#.###. +...#......##..#.#.....#...#.... +...#.......#...#...#........##. +............#...#..#....#.....# +....##......................#.. +#.#.#....#....#..........##.... +#.#.....#.#.##..#...#.##....##. +...#...#..#...#..#.#.#.......#. +#.....#..........#.........##.# +#...##..#..#.#.......###....#.. +.#...#..##....#.....##.......#. +....#.##.....#.........#.#....# +........#.#...####..#.......#.# +.####...#.#......####.....#.##. +###..#....#..#.......#.#..##..# +#......#.#....##..#.##.#....#.# +...###...#...#..##.#..#..#.#... +...##..##....#..#.....#........ +.....#..............#......#..# +......#....#......#..#......... +#..#.....#.##...........##..... +.#..#.#..................##.... +#.#..#..##...#....#.#......#... +.##.#.##......#.##...#...#...#. +..#...#.........#.#..#.#....#.. +.#.####.#..#.#......##.#..#.... +#..#.......#....#.............. +....#............#..#.......... +.....#####.....#.....#..##...## +#.#....#.#...............#..##. +.#.#..#...#......#.....#.#.#... +.#....#.#.#......#.....##....#. +....#....#.##..#.......###...## +.....#..#.##...#...#...#..#.#.. +##..#........#.#..#..##......#. +.#..#..##.......#..#.....#..... +.#.#.....###..##.#.#........... +..##..##.####..........#..#.... +..##..#..#...#....#......#.#... +#...#.#......##.....##.#..###.. +#..#..............#........##.# +.........#.##..#.#..#..##.##.#. +#....##....#.#..#.#...##..#.... +.#....#.......#............##.. +.......#.#.......#...#.#......# +......##...#.......#.#........# +..###..#.#.##....##...#....##.. +..##.##..........##..###....... +.#.#.#..#..#.#.......#.#...##.. +..#..##.........#.###..#......# +....#.#.#...##.#...#...##..###. +..###..##.........##...#...#..# +.#..##...#.......#.......#..#.# +........##....##....#.#.###.#.# +#.....#.#.................#.#.. +....#.#.#.....##.####.#......#. +....#.......#.#.##.##.......... +...#...........#...#.##...#.### +#....#....#..........#.##...... +##..#...........##.....##.##... +.#.##...##..##....#..#.....#### +#...#...#.##..........##..##... +....##..#....#.....#.#...#....# +..#....#..##...###.#.#......... +#......#.#.#...#...#.........#. +#............###.#.#.#..##...#. +.##.....####...##..##..#..##.#. +#..#........#.....#.#.....#...# +#............#....#.#.#........ +......##...##.#....#.....#...#. +..#........##......#.#.....##.. +.#..#..#.....##.......#..#.#..# +.#....#..#....##.#.#.#..#..#.## +.####.#..........#...#..##..... +...###..###...##..#............ +#..#.....##.#...#..##..#....... +.....##....#...###.##...#...... +...##..#...#..#..##....##....#. +...###....#.###.#.#.##....#.... +##.#.#.....#....#.#....#..#.... +.......##.....#.#..##...##...#. +.#....#.#...##.#..#....#.....#. +..#...#..#...#.##........#...#. +#....#......##.#....##...#.#..# +.....#..#..#..#......#...#.#.#. +..###....#........#...#.......# +###...#.......#.#.......##.##.. +......##.....#.#........#....#. +#.##..#.#.#.#..#....#.##.....#. +..........#.##.#...#...#..#..#. +..#...##.#..........#..##.###.. +..###..##.##..#.#...##.####..#. +#.#.#...............##....###.# +....#.........#.#....#.#....#.# +..#...#.###...#....###.....#... +..#..#....#...#............#... +.#..#....#..##.....##.......... +..#....#.#...#.#.#.#.......##.# +.........#....##........#.#.... +...#..##.#..#.##...#...#.#....# +....####...#...####.#....###..# +......##...#.##.#.......#..#... +#.#...#.#...#.#...#....#.#.#... +.#.....##...#.....###.#....#... +......##.....###...#.#...#.#... +#..#..##.#.#......#....#..#..#. +....#.###.....#..#...#.##.....# +##.##........#......#....#..##. +##.....##.#.....#.....##.....#. +.....#.##...#.#..#.#.#.....#... +.#.##..#...#.#..#.....#.#...... +.....##.......#..#...##..#..#.. +#.....#..#.####......#........# +.#..#..##.#..##............#..# +.##..#.#....##.##.....#......#. +.......##.........#..#......... +.#...#.......................#. +#......#.#....##.#.......#..#.. +..##..##......#.......#....#.#. +##......#......##...##......... +..#....####....#.#.....##.#.#.. +..........#..#.#.#.....#..#.#.. +##..##...........##.......#.... +##....#.#....#..#......###....# +...#.#.#..#.......##.......#... +#....#.......#.......#......... +...##......##....#...#......#.# +#......#####.#.........#.....#. +#..#.............#..#....#...#. +.......#.##..#..#..#..#....#### +......#.##..##..........###...# +.#.##....###..#........#....##. +#......#..#...###.#...#.....#.. +.#.#.......#....##.......#.#... +..#.##..#..##.....#.........#.# +#.#...#..#.##....#.......##.... +.#.....###....#.#..#...#.....#. +#...#..#.......#.#.....##...#.# +#.#####.........#....##.....#.. +#....#..##...#....#.##.......#. +.#.#.........##....##....#..... +...#..##.......#....#.#.#...... +#.###.##...###....#.....#.####. +.#...#.#.#..##.#..........#.... +#.#.....#.##.#..####.....##.#.. +...###.##..####.......#......## +.##..#.........#...#.#.....#.## +..#.....##....###.....#.#...##. +#....#....#..#....#.##......... +......###....#.#..#..#....##... +.#.#................#.......##. +...#.......#.........#.#....... +...#..........#...##.....###... +....#......#...#............... +.##...#....#.....#.##......#... +.#.....###...##..##...#.#...... +....##........#.....#...#....#. +#.........#.#...##...#.#..#.... +...#.#.....#.#........#.#....#. +.#........#.....#.#.#.#.#..#... +....#...#.....#.#....#........# +..###.#....#.#....##...##..#.## +.#....#.#.####.#.#.....#....... +.#...#...#.................##.# +..................##..#..#.#.#. +.#..#............##....###..... +.......#....#...........#...... +....#.#.#.....###.........#..## +...#.#....#.#.##.#.##.....##..# +.#.##.#...##...#.......#.....## +.#............#...#..##...#.#.# +#.##..#.##..#..##.###.#........ +..............##....#...#..#.#. +.#.#...#.#....#....###........# +.#....#.#....#......###........ +..#.......##......#.##.....#... +.....#......#..#...#.#.....#... \ No newline at end of file diff --git a/2020/day4/day4.py b/2020/day4/day4.py new file mode 100644 index 0000000..519da43 --- /dev/null +++ b/2020/day4/day4.py @@ -0,0 +1,47 @@ +#! /usr/bin/env python3 +import re + + +def main(inp): + inp = open(inp).read().split('\n\n') + valid_passeports = 0 + for l in inp: + l = re.split('[\n\s]', l) + passeport = dict(p.split(':') for p in l) + if check_passeport(passeport): + valid_passeports += 1 + print("Valid passeports ", valid_passeports) + + +def check_passeport(passeport): + fields = [ + ('byr', lambda v: 1920 <= int(v) <= 2002), # (Birth Year) + ('iyr', lambda v: 2010 <= int(v) <= 2020), # (Issue Year) + ('eyr', lambda v: 2020 <= int(v) <= 2030), # (Expiration Year) + ('hgt', validate_height), # (Height) + ('hcl', lambda v: re.search("#[0-9a-f]{6}", v)), # (Hair Color) + ('ecl', lambda v: v in ('amb', 'blu', 'brn', 'gry', 'grn', 'hzl', 'oth')), # (Eye Color) + ('pid', lambda v: len(v) == 9 and v.isdecimal()), # (Passport ID) + #'cid' # Country id, ignored + ] + for field, validator in fields: + value = passeport.get(field) + if value is None: + return False + elif not validator(value): + return False + return True + + +def validate_height(v): + unit = v[-2:] + height = int(v[:-2]) + if unit == 'cm': + return 150 <= height <= 193 + if unit == 'in': + return 59 <= height <= 76 + return False + + +if __name__ == "__main__": + main('input.txt') diff --git a/2020/day4/input.txt b/2020/day4/input.txt new file mode 100644 index 0000000..b6e341c --- /dev/null +++ b/2020/day4/input.txt @@ -0,0 +1,1136 @@ +ecl:hzl byr:1926 iyr:2010 +pid:221225902 cid:61 hgt:186cm eyr:2021 hcl:#7d3b0c + +hcl:#efcc98 hgt:178 pid:433543520 +eyr:2020 byr:1926 +ecl:blu cid:92 +iyr:2010 + +iyr:2018 +eyr:2026 +byr:1946 ecl:brn +hcl:#b6652a hgt:158cm +pid:822320101 + +iyr:2010 +hgt:138 ecl:grn pid:21019503 eyr:1937 byr:2008 hcl:z + +byr:2018 hcl:z eyr:1990 ecl:#d06796 iyr:2019 +hgt:176in cid:75 pid:153cm + +byr:1994 +hcl:#ceb3a1 hgt:176cm cid:80 pid:665071929 eyr:2024 iyr:2020 ecl:grn + +cid:280 byr:1955 ecl:blu hgt:155cm hcl:#733820 +eyr:2013 iyr:2011 pid:2346820632 + +hcl:#4a5917 hgt:61cm +pid:4772651050 +iyr:2026 ecl:brn byr:2015 eyr:2026 + +iyr:2019 hcl:#a97842 hgt:182cm eyr:2024 ecl:gry pid:917294399 byr:1974 + +ecl:#9c635c pid:830491851 hgt:175cm cid:141 +iyr:2010 +hcl:z +byr:2026 eyr:1998 + +byr:1927 iyr:2011 pid:055176954 ecl:gry hcl:#7d3b0c eyr:2025 hgt:166cm + +hcl:#733820 byr:2008 ecl:utc eyr:1920 pid:159cm hgt:66cm iyr:2030 + +pid:027609878 +eyr:2022 iyr:2012 +byr:1960 hgt:157cm +hcl:#b6652a +cid:117 +ecl:grn + +iyr:2025 pid:7190749793 ecl:grn byr:1984 hgt:71in hcl:c41681 +cid:259 eyr:1928 + +eyr:2029 pid:141655389 cid:52 hcl:#cfa07d iyr:2019 +ecl:blu hgt:69in byr:1938 + +eyr:2020 hgt:166cm +ecl:gry +pid:611660309 iyr:2011 +hcl:#623a2f byr:1943 + +hgt:190cm eyr:2022 byr:2000 cid:210 pid:728418346 hcl:#a97842 ecl:xry iyr:2015 + +byr:1973 eyr:2028 iyr:2012 +hcl:#ff0ec8 pid:740554599 ecl:amb cid:58 hgt:155cm + +iyr:2016 pid:922938570 ecl:oth hcl:#fffffd hgt:154cm eyr:2021 byr:1966 + +ecl:amb +byr:1929 +hcl:#c3bbea pid:511876219 +iyr:2019 +hgt:191cm +eyr:2026 + +ecl:utc hgt:155cm pid:#9f0a41 iyr:2012 hcl:#bd4141 +byr:1998 eyr:2020 + +ecl:grn hgt:173cm cid:321 pid:851120816 byr:1968 hcl:#a97842 eyr:2027 +iyr:2014 + +hgt:155cm hcl:#f40d77 pid:038224056 byr:1953 ecl:brn iyr:2014 +eyr:2022 + +pid:181869721 +iyr:2011 hgt:151cm hcl:#733820 cid:110 ecl:blu +byr:1931 eyr:2024 + +byr:1948 +hcl:#888785 +hgt:74in +cid:112 ecl:hzl pid:921761213 eyr:2028 +iyr:2015 + +ecl:gry +byr:1931 +pid:600127430 hcl:#341e13 eyr:2027 +iyr:2013 hgt:173cm + +hgt:178cm pid:530791289 hcl:#6b5442 +eyr:2022 byr:1979 iyr:2014 ecl:hzl + +pid:412193170 hcl:#cfa07d hgt:186cm iyr:2012 cid:284 eyr:2020 byr:1967 +ecl:grn + +hcl:#6b5442 +iyr:2015 pid:808448466 ecl:blu eyr:2022 hgt:159cm byr:1969 + +eyr:2020 +iyr:2019 hgt:170cm pid:8964201562 hcl:#6b5442 byr:1947 ecl:amb + +eyr:2029 ecl:hzl hcl:#866857 byr:1961 +iyr:2017 + +ecl:#3456ba eyr:2013 iyr:2020 pid:378280953 +hcl:z hgt:174cm + +hgt:172cm +cid:202 ecl:oth eyr:2021 byr:1980 +iyr:2012 +hcl:#cfa07d pid:605707698 + +cid:281 hgt:161cm iyr:2017 pid:122936432 hcl:#602927 byr:1981 ecl:gry eyr:2021 + +byr:1959 hgt:193cm pid:083900241 iyr:2020 eyr:2037 hcl:#623a2f +ecl:hzl + +iyr:2030 hgt:153cm eyr:2022 hcl:#efcc98 cid:131 +byr:2016 ecl:hzl pid:64053944 + +hgt:172cm eyr:2025 +hcl:#866857 +byr:1938 ecl:dne +pid:192cm iyr:2014 + +pid:016297574 cid:152 iyr:2015 +eyr:2024 hcl:#341e13 byr:1965 hgt:175cm +ecl:oth + +pid:604330171 cid:125 byr:1974 hgt:160cm iyr:2014 +eyr:2022 ecl:oth hcl:#6b5442 + +pid:59747275 +byr:2027 +hgt:145 +hcl:1fd71f iyr:1944 eyr:2037 ecl:brn + +iyr:2010 +eyr:2021 byr:1953 +pid:7098774146 ecl:brn hcl:98737d hgt:158cm + +hcl:#602927 eyr:2039 pid:#81a5a1 iyr:2012 cid:67 byr:1951 +ecl:#6551f5 hgt:76cm + +hgt:170cm ecl:oth +cid:235 eyr:2022 +byr:1929 iyr:2019 +hcl:#341e13 pid:797557745 + +iyr:2011 +hcl:#733820 +eyr:2022 pid:830183476 ecl:blu byr:1976 cid:157 hgt:75in + +hgt:164cm ecl:amb pid:653425455 hcl:#623a2f byr:1977 eyr:2020 +iyr:2013 + +byr:2009 eyr:1953 hgt:178cm pid:#5d02f0 +hcl:#a97842 iyr:2016 +ecl:amb + +pid:009643210 eyr:2036 ecl:zzz +cid:97 hcl:32e540 byr:2005 hgt:187cm iyr:2021 + +pid:155cm +iyr:2022 byr:2024 eyr:2031 ecl:amb cid:79 +hcl:#cfa07d hgt:69cm + +cid:176 ecl:oth +pid:688645779 byr:1933 eyr:2026 hgt:69cm +iyr:2016 hcl:#888785 + +hcl:#888785 +eyr:2027 +iyr:2020 pid:802243213 ecl:brn +hgt:179cm byr:1976 + +hcl:#6cad3e hgt:164cm byr:1982 iyr:2020 +ecl:gry +pid:142160687 eyr:2023 + +hcl:#18171d +hgt:153cm +iyr:2014 ecl:hzl cid:231 pid:167809118 byr:1997 eyr:2028 + +byr:1940 +ecl:hzl iyr:2016 cid:67 hcl:#c800da +pid:563956960 eyr:2021 +hgt:189cm + +pid:133094996 eyr:2032 hgt:60cm hcl:#623a2f byr:2030 ecl:dne iyr:2023 + +pid:65195409 hcl:d0d492 +iyr:1956 +byr:2019 ecl:#bb043f eyr:2031 hgt:167in + +iyr:2016 byr:2006 ecl:#35d62f eyr:2029 +hgt:186cm +hcl:1d8307 + +eyr:1935 iyr:1960 pid:346667344 ecl:grn hgt:170cm hcl:cfcc36 + +ecl:oth byr:1979 pid:165581192 +hgt:177cm +hcl:#c0946f +iyr:2011 + +iyr:2011 eyr:2030 pid:250840477 +byr:1934 cid:174 hgt:179cm hcl:#866857 +ecl:blu + +hgt:157cm hcl:#7d3b0c eyr:2027 pid:979510046 +ecl:oth + +iyr:2025 +hgt:69 +ecl:grt byr:1935 +eyr:1928 pid:168cm +cid:271 hcl:z + +pid:998166233 +iyr:2020 hgt:166cm ecl:amb byr:1995 hcl:#fffffd + +hcl:#ceb3a1 ecl:amb +iyr:2019 +eyr:2024 hgt:184cm byr:1980 pid:839215481 +cid:146 + +byr:1967 +pid:444303019 ecl:oth hgt:150cm eyr:2024 + +eyr:2023 byr:1960 iyr:2010 +cid:236 hcl:#733820 pid:900635506 +hgt:69in +ecl:hzl + +eyr:2029 pid:969574247 +hgt:150cm byr:1967 +iyr:2010 ecl:blu + +pid:575879605 iyr:2010 +ecl:hzl +byr:1963 +hgt:151cm +hcl:#c0946f cid:277 + +byr:1998 pid:621374275 +ecl:brn hcl:z iyr:2029 +eyr:2024 +hgt:68cm + +pid:365407169 ecl:amb hcl:#87f433 iyr:2011 eyr:2021 byr:1987 +hgt:175cm cid:201 + +hgt:175cm iyr:2020 +ecl:gry +eyr:2029 pid:806927384 cid:59 +byr:1932 hcl:#888785 + +pid:589898274 cid:113 hcl:z hgt:184cm eyr:2000 +ecl:lzr iyr:2016 byr:2016 + +ecl:#2bafbb +eyr:2038 iyr:2027 +hcl:#fffffd +hgt:174 byr:2007 +pid:093750113 + +eyr:2022 hgt:59in +hcl:#ceb3a1 +pid:159921662 ecl:gry +byr:1948 iyr:2014 +cid:50 + +hgt:190cm +iyr:2014 pid:480507618 hcl:#fffffd byr:1945 eyr:2029 + +byr:1951 hgt:152cm ecl:brn iyr:2016 eyr:2029 cid:179 pid:027575942 +hcl:#fffffd + +cid:198 pid:728480773 eyr:2028 hgt:153cm iyr:2018 +hcl:#888785 ecl:amb byr:1983 + +byr:1968 hcl:#c0946f ecl:grn eyr:2027 +iyr:2013 pid:269749807 +cid:227 +hgt:178cm + +eyr:2024 hgt:185cm ecl:oth +hcl:#448ace byr:1987 iyr:2018 pid:454243136 + +byr:1930 ecl:grn iyr:2018 hgt:158cm +hcl:#341e13 eyr:2021 + +eyr:2024 cid:194 pid:425431271 +hgt:169cm ecl:grn byr:1973 +iyr:2014 hcl:#fffffd + +ecl:grn cid:110 iyr:2013 hcl:#18171d +hgt:155cm eyr:2024 byr:1962 pid:522435225 + +byr:1934 ecl:hzl hgt:152cm iyr:2018 +eyr:2024 pid:079740520 + +ecl:grn eyr:2023 hcl:c3f119 pid:468039715 iyr:2013 hgt:150cm byr:1955 + +pid:809357582 eyr:2025 byr:1958 +hcl:#6b5442 iyr:2013 +hgt:161cm ecl:hzl + +hcl:#b6652a pid:068979430 byr:1960 iyr:2010 ecl:grn hgt:159cm eyr:2021 + +cid:105 pid:495292692 byr:1965 +hcl:#ceb3a1 hgt:160cm ecl:amb +iyr:2020 + +iyr:2010 +eyr:2024 byr:1941 ecl:grn hcl:#b35770 hgt:171cm cid:132 pid:975699036 + +pid:767448421 hgt:186cm hcl:#733820 +byr:1972 iyr:2020 eyr:2026 ecl:grn + +pid:036236909 iyr:2012 +hgt:181cm hcl:#888785 +eyr:2026 +ecl:hzl byr:1936 + +hgt:173cm +byr:1923 ecl:blu +eyr:2026 pid:570818321 +hcl:#733820 iyr:2016 +cid:59 + +pid:2711059768 +byr:2024 +cid:139 ecl:blu hcl:z hgt:60cm + +eyr:2025 +pid:671193016 +byr:1950 hcl:#6b4b25 iyr:2017 hgt:158cm ecl:blu + +hgt:175cm iyr:2015 ecl:amb +byr:1984 eyr:2026 pid:342782894 +cid:140 + +iyr:2019 eyr:2027 byr:1972 +pid:196266458 +hgt:158cm hcl:#7d3b0c cid:69 + +pid:604018034 iyr:2016 ecl:brn eyr:2028 hgt:172cm hcl:#6b5442 byr:1922 +cid:238 + +eyr:2024 ecl:gry byr:1970 pid:356551266 cid:340 hgt:162cm iyr:2013 + +ecl:amb +hgt:151cm hcl:#18171d byr:1921 pid:187276410 eyr:2030 iyr:2015 + +eyr:2030 pid:056372924 hcl:#d236d9 hgt:156cm +iyr:2014 ecl:blu + +iyr:2014 eyr:2028 byr:1991 +hcl:#b6652a pid:119231378 hgt:155cm ecl:blu +cid:77 + +hcl:#341e13 +eyr:2027 +iyr:2012 ecl:grn hgt:152cm pid:405955710 byr:1970 + +iyr:2013 hgt:180cm eyr:1978 ecl:amb byr:1929 pid:3198111997 hcl:z + +pid:32872520 ecl:#8a0dd4 iyr:1955 eyr:2036 +byr:2027 cid:133 hcl:z hgt:184in + +hgt:152cm pid:402361044 +hcl:#efcc98 eyr:2029 ecl:grn iyr:2014 +byr:1960 + +byr:1972 eyr:2026 pid:411187543 iyr:2014 +hgt:184cm cid:211 hcl:#866857 ecl:brn + +ecl:brn +hcl:#efcc98 +pid:311916712 +byr:1957 hgt:151cm eyr:2020 iyr:2020 + +iyr:1968 +hcl:a28220 +pid:#ed250d cid:240 eyr:2031 +hgt:181cm ecl:xry + +ecl:grn byr:1946 hgt:172cm iyr:2010 hcl:#b6652a pid:372011640 eyr:2026 + +ecl:brn +eyr:2026 byr:1980 hcl:#c0946f +hgt:151cm pid:153076317 iyr:2012 + +byr:1966 pid:852999809 ecl:oth +hgt:163cm +iyr:2014 eyr:2029 hcl:#341e13 + +ecl:blu +byr:1959 hgt:191cm pid:195095631 iyr:2016 hcl:#ceb3a1 eyr:2028 + +byr:2001 ecl:gry hcl:#888785 iyr:2018 hgt:177cm pid:576714115 + +iyr:2017 +byr:1949 +ecl:blu hgt:186cm cid:289 pid:859016371 +hcl:#ceb3a1 eyr:2021 + +byr:1999 hcl:#b6652a eyr:2023 +hgt:175cm +ecl:gry iyr:2013 cid:165 pid:194927609 + +hgt:70in eyr:2027 ecl:brn iyr:2012 pid:162238378 hcl:#ceb3a1 byr:1986 + +hgt:63in ecl:xry +byr:2011 iyr:2024 +hcl:5337b0 + +hcl:#341e13 eyr:2029 +hgt:184cm ecl:amb iyr:2012 +byr:1970 + +byr:1920 pid:472914751 +eyr:2028 +hgt:187cm hcl:#cfa07d cid:290 ecl:gry + +byr:1948 ecl:gry eyr:2025 hgt:151cm cid:276 hcl:#6b5442 pid:937979267 +iyr:2016 + +byr:1934 +pid:626915978 hcl:#623a2f hgt:167cm ecl:gry +iyr:2020 eyr:2023 + +byr:1949 +hgt:68in eyr:2027 iyr:2019 hcl:#733820 ecl:brn cid:237 +pid:057797826 + +pid:155cm +hgt:68cm ecl:lzr hcl:z cid:344 eyr:2028 iyr:2020 byr:2017 + +byr:1959 +hcl:#341e13 eyr:2022 +iyr:2019 pid:728703569 +hgt:167cm +ecl:oth + +ecl:grn +eyr:2024 byr:1999 +pid:566956828 +iyr:2015 cid:293 hcl:#602927 hgt:192cm + +byr:1939 +ecl:xry pid:929512270 hgt:66in iyr:1939 eyr:2030 hcl:#efcc98 + +eyr:2026 +iyr:2014 +pid:176cm hcl:#fffffd +ecl:gry +hgt:151cm byr:1933 +cid:256 + +ecl:oth eyr:2025 iyr:2017 hgt:159cm pid:055267863 cid:55 byr:2001 hcl:#cfa07d + +eyr:2029 byr:1954 ecl:hzl cid:123 iyr:2020 hgt:192cm hcl:#866857 +pid:225593536 + +pid:320274514 cid:289 byr:1963 +eyr:1942 +ecl:gmt hcl:z hgt:167in iyr:2022 + +byr:2013 +ecl:gmt +iyr:2011 +hcl:#733820 pid:#e7962f +hgt:178cm eyr:2029 + +pid:154cm ecl:hzl +eyr:2035 byr:2023 cid:104 iyr:2026 + +eyr:2024 ecl:hzl hcl:#7d3b0c iyr:2010 +pid:105864164 +byr:1955 +hgt:163cm + +eyr:2021 hgt:151cm +iyr:2017 hcl:#c0946f +ecl:amb +cid:150 +pid:296798563 +byr:1953 + +iyr:2012 +byr:1990 hcl:#341e13 +pid:189449931 eyr:2024 hgt:64in + +hcl:z cid:79 byr:2028 +eyr:2028 pid:886152432 +ecl:#ce0596 hgt:178cm +iyr:2029 + +ecl:brn +iyr:2019 hgt:151cm +hcl:#341e13 +byr:1969 +pid:468846056 +eyr:2022 + +ecl:grn hgt:157cm iyr:2012 +eyr:2020 +hcl:#b6652a cid:338 +byr:1954 pid:153867580 + +iyr:2011 +eyr:2027 +byr:1935 +hgt:151cm +ecl:blu pid:802665934 cid:276 hcl:#623a2f + +hcl:#efcc98 eyr:2026 ecl:amb +iyr:2014 pid:320160032 +hgt:157cm +byr:1976 + +eyr:2021 cid:172 +iyr:2012 ecl:oth hgt:187cm +pid:432856831 byr:2001 hcl:#733820 + +eyr:2028 ecl:amb hcl:#efcc98 +iyr:2020 byr:1954 hgt:153cm + +byr:1930 ecl:brn hcl:#fffffd +pid:458840035 hgt:178cm eyr:2021 +iyr:2011 cid:336 + +pid:216876576 hcl:#341e13 +eyr:2028 iyr:2018 hgt:177cm byr:1938 +ecl:brn cid:214 + +byr:2029 eyr:1987 +hgt:75cm pid:193cm hcl:#b6652a cid:246 iyr:2028 + +ecl:hzl hgt:151cm hcl:#7d3b0c +eyr:2030 pid:910999919 +iyr:2019 byr:1956 + +byr:1950 +cid:95 iyr:2013 ecl:grn +eyr:2020 hcl:#623a2f +pid:603817559 hgt:159cm + +pid:913791667 +iyr:2018 byr:1959 hcl:#a97842 hgt:179cm eyr:2029 ecl:gry + +hgt:71in +ecl:blu eyr:2028 +hcl:#18171d byr:1937 iyr:2011 pid:951572571 + +hcl:#b6652a iyr:2015 hgt:170cm ecl:blu cid:292 +byr:1977 pid:475457579 eyr:2020 + +ecl:amb eyr:2029 +pid:530769382 iyr:2018 cid:53 +hgt:63in +byr:1954 hcl:#07de91 + +hcl:#cfa07d hgt:185cm +byr:1929 iyr:2011 +eyr:2027 + +iyr:2019 ecl:oth byr:2023 hcl:#341e13 pid:879919037 +eyr:2030 hgt:174cm + +hcl:z hgt:182cm ecl:grn iyr:2010 eyr:2020 pid:2063425865 +cid:182 +byr:2019 + +byr:1930 hgt:185cm pid:412694897 eyr:2025 ecl:brn iyr:2020 +hcl:#a97842 + +hgt:150cm byr:1955 eyr:2020 cid:149 pid:597600808 +hcl:#ceb3a1 +ecl:hzl + +pid:209568495 +eyr:2026 byr:1928 hcl:#341e13 hgt:183cm ecl:brn iyr:2011 + +pid:723789670 ecl:blu iyr:2013 byr:1933 +cid:239 hcl:#7d3b0c eyr:2026 hgt:151cm + +byr:1978 eyr:2027 hgt:164cm +pid:009071063 +hcl:#602927 iyr:2014 ecl:blu + +hcl:#18171d ecl:grn hgt:154cm cid:154 iyr:2016 +byr:1952 pid:730027149 eyr:2024 + +eyr:2025 hcl:#888785 iyr:2013 cid:90 +byr:1975 ecl:grn +pid:619198428 hgt:161cm + +ecl:gry iyr:2013 pid:795604673 cid:198 byr:1962 +hcl:#6b5442 hgt:64in eyr:2021 + +hcl:#ceb3a1 ecl:oth iyr:2015 +eyr:2021 pid:920586799 cid:302 hgt:60in +byr:1964 + +eyr:2021 ecl:gry iyr:2019 +hcl:#6b5442 hgt:192cm +byr:1996 +pid:692698177 + +ecl:grn pid:141369492 byr:1956 eyr:2028 hcl:#6b5442 hgt:190cm iyr:2014 + +hcl:#6b5442 +ecl:grn iyr:2020 hgt:153cm +pid:312738382 eyr:2028 +byr:1985 + +byr:1979 +eyr:2021 ecl:gry hgt:175cm pid:787676021 cid:81 hcl:#b6652a iyr:2012 + +cid:80 hgt:188cm byr:1964 pid:105773060 iyr:2014 hcl:#733820 ecl:gry eyr:2028 + +byr:1960 pid:251870522 iyr:2018 hgt:168cm ecl:blu hcl:#c0946f eyr:2026 + +cid:270 +pid:#5661f0 hgt:182in +ecl:dne +byr:1930 +hcl:z iyr:2026 + +hcl:#888785 byr:1954 pid:170544716 eyr:2028 hgt:162cm cid:244 +iyr:2014 +ecl:grn + +iyr:2017 +hgt:69in +ecl:hzl +pid:544135985 hcl:#ceb3a1 eyr:2020 + +hcl:92d4a1 iyr:2018 pid:178cm +cid:347 +hgt:97 eyr:2017 +ecl:gmt byr:2004 + +ecl:oth iyr:2018 hcl:#fffffd byr:1999 pid:853396129 +cid:119 eyr:2026 hgt:178cm + +hgt:69in +hcl:#fffffd eyr:2026 byr:1922 +iyr:2010 ecl:oth pid:664840386 + +hgt:178cm +byr:2000 +iyr:2013 hcl:#cfa07d +eyr:2028 pid:842454291 +ecl:amb + +ecl:hzl +hcl:#733820 pid:316835287 byr:1998 +eyr:2024 +iyr:2015 hgt:165cm + +pid:684064750 byr:1928 ecl:gry iyr:2015 cid:343 +hgt:189cm +hcl:#4c6cb4 eyr:2020 + +byr:1923 hcl:#a97842 eyr:2024 ecl:gry +pid:095911913 +hgt:185cm iyr:2010 + +ecl:hzl +byr:1996 +eyr:2023 +hgt:177cm +hcl:#b6652a pid:011541746 +iyr:2011 + +hcl:#efcc98 +iyr:2014 ecl:oth byr:1942 pid:730960830 +hgt:183cm +eyr:2025 + +byr:1939 eyr:2029 ecl:amb hcl:#fffffd +hgt:188cm pid:732730418 iyr:2013 cid:313 + +hgt:164cm cid:217 byr:1985 hcl:#888785 eyr:2020 +iyr:2014 ecl:oth +pid:071172789 + +eyr:2024 pid:215897274 ecl:#c67898 +byr:1972 hcl:#866857 iyr:2010 hgt:170cm cid:310 + +ecl:hzl pid:030118892 byr:1941 hgt:158cm hcl:#b6652a +eyr:2029 iyr:2012 + +ecl:gry hcl:#c0946f hgt:166cm pid:604313781 +byr:1924 eyr:2023 iyr:2020 + +hcl:#602927 hgt:168cm eyr:2027 ecl:brn +pid:764635418 byr:1968 iyr:2010 + +pid:157933284 +ecl:grn +eyr:2030 byr:2000 +hgt:81 hcl:z + +hcl:#ec24d1 +pid:647881680 byr:1922 +hgt:178cm iyr:2020 ecl:amb eyr:2021 cid:94 + +ecl:hzl byr:1971 iyr:2018 pid:975690657 eyr:2027 +hgt:192in +cid:202 hcl:#c0946f + +pid:678999378 +hgt:61in +byr:1981 hcl:#cfa07d eyr:2029 iyr:2014 +ecl:oth + +eyr:2022 iyr:2012 ecl:grn pid:883419125 +hcl:#ceb3a1 +cid:136 hgt:75in +byr:1952 + +iyr:2018 hgt:185cm +byr:1985 pid:119464380 eyr:2028 hcl:#623a2f ecl:gry + +eyr:2025 hcl:#ceb3a1 byr:1953 +cid:277 hgt:164cm iyr:2010 pid:574253234 + +cid:252 ecl:amb pid:594663323 +hgt:75in hcl:#cfa07d iyr:2019 +eyr:2026 byr:1964 + +iyr:2026 hcl:z pid:60117235 ecl:lzr +byr:2016 hgt:156in eyr:1994 + +pid:448392350 +eyr:2022 hcl:#a97842 +hgt:157cm +ecl:hzl +iyr:2018 byr:1973 + +ecl:brn +byr:1951 +eyr:2028 +hcl:#7d3b0c iyr:2018 hgt:164cm + +hgt:156cm +byr:1963 +iyr:2014 eyr:2020 ecl:blu hcl:#ceb3a1 +pid:#a87d16 + +pid:447170366 ecl:blu hcl:#888785 +iyr:2012 cid:236 +hgt:167cm +eyr:2022 byr:1942 + +hcl:#623a2f +eyr:2020 iyr:2017 cid:128 ecl:amb pid:279550425 +byr:1983 hgt:154cm + +byr:2014 eyr:2034 hgt:176in hcl:z +ecl:#d4e521 +pid:3629053477 cid:177 +iyr:1970 + +pid:30370825 byr:1966 eyr:2026 +iyr:2026 hcl:#866857 +cid:346 ecl:#f7c189 + +iyr:2010 pid:271066119 eyr:2023 hcl:#efcc98 hgt:179cm byr:1956 + +byr:1966 hgt:156cm pid:977897485 cid:287 iyr:2011 hcl:#b6652a ecl:amb eyr:2029 + +cid:211 ecl:gmt byr:2017 +hcl:z eyr:2029 hgt:180in iyr:2021 pid:81920053 + +byr:2019 +pid:5229927737 hcl:75b4f1 hgt:146 iyr:2026 ecl:#92cf7d eyr:2032 + +eyr:2027 pid:604671573 +ecl:hzl +hgt:189cm byr:1979 +hcl:#efcc98 iyr:2020 + +iyr:2018 cid:192 +eyr:2029 ecl:grn +pid:653764645 hgt:179cm +hcl:#341e13 byr:1927 + +byr:2012 +iyr:2015 +hcl:#b6652a +pid:168500059 eyr:2038 cid:234 hgt:191cm ecl:zzz + +ecl:gry hcl:#623a2f byr:1925 +iyr:2016 +eyr:2028 cid:157 +hgt:154cm +pid:196280865 + +cid:319 pid:928322396 ecl:gry +byr:1949 +eyr:2028 +hcl:#341e13 hgt:171cm +iyr:2018 + +byr:2023 +iyr:1953 hgt:154cm ecl:dne +hcl:#888785 +pid:066246061 eyr:1983 + +hcl:z +iyr:2016 byr:1986 ecl:utc +hgt:179cm eyr:2019 pid:583251408 + +ecl:amb iyr:2014 pid:499004360 +byr:1927 eyr:2021 hgt:193cm hcl:#ceb3a1 + +pid:631303194 ecl:gry +hcl:#18171d cid:216 iyr:2019 +eyr:2024 hgt:178cm + +hcl:#341e13 cid:201 +byr:1949 iyr:2019 ecl:gry pid:372356205 +eyr:2024 + +hcl:#18171d +pid:867489359 +hgt:185cm +iyr:2020 ecl:amb +eyr:2030 +byr:1955 + +byr:1991 +ecl:brn eyr:2025 hgt:184cm iyr:2016 pid:202216365 + +ecl:xry pid:#524139 hgt:151cm hcl:z eyr:2031 byr:2030 iyr:2005 + +byr:1971 hgt:178cm ecl:amb hcl:#ceb3a1 +iyr:2010 +eyr:2026 pid:396974525 + +iyr:2014 +hgt:177cm pid:928522073 +eyr:2022 +ecl:hzl +hcl:#c0946f byr:1983 + +hgt:167cm hcl:#ceb3a1 iyr:2014 +pid:172415447 +eyr:2020 byr:1956 + +iyr:2011 hgt:188cm byr:1947 eyr:2020 pid:667108134 ecl:amb hcl:#44a86b + +cid:302 ecl:brn pid:292483175 hgt:154cm +byr:1997 +eyr:2026 +iyr:2014 hcl:#623a2f + +hgt:171cm +iyr:2014 hcl:z ecl:hzl pid:321513523 eyr:2027 cid:146 +byr:2001 + +eyr:1956 ecl:dne hgt:75cm hcl:82e1fa +iyr:2030 byr:2027 + +eyr:2020 +iyr:2011 pid:656669479 ecl:oth hgt:151cm hcl:#efcc98 byr:1981 + +iyr:2013 +byr:1934 +pid:142890410 hgt:62in +eyr:2022 +hcl:#87cca4 +ecl:hzl + +pid:006232726 +hgt:173cm ecl:hzl cid:110 +eyr:2026 hcl:#866857 iyr:2017 byr:1992 + +cid:208 +iyr:2014 ecl:brn eyr:2024 byr:1935 hgt:187cm +hcl:#b6652a +pid:770836724 + +iyr:2014 cid:144 hgt:169cm +eyr:2022 +ecl:oth +pid:117575716 hcl:#fffffd byr:1926 + +byr:1971 ecl:brn +hcl:#733820 eyr:1942 iyr:2013 +pid:606274259 hgt:163cm cid:196 + +byr:1964 +pid:997828217 eyr:2029 iyr:2017 ecl:blu hcl:#341e13 +hgt:158cm + +pid:568202531 hcl:#efcc98 hgt:154cm eyr:2029 iyr:2010 +byr:1946 +ecl:blu + +iyr:2011 +pid:619355919 +byr:1955 +ecl:brn hcl:#888785 eyr:2030 hgt:155cm + +ecl:hzl pid:367152545 +hgt:162cm +cid:221 hcl:#866857 +eyr:2024 +byr:1997 iyr:2019 + +hgt:157in +cid:268 hcl:32371d byr:2020 +ecl:zzz pid:1081234390 + +ecl:hzl eyr:2026 +byr:1969 pid:850482906 cid:166 hcl:#602927 hgt:60in +iyr:2019 + +hcl:#c0946f +hgt:176cm +ecl:brn eyr:2026 iyr:2018 cid:172 byr:1986 pid:172963254 + +ecl:grn iyr:2016 +hgt:187cm +byr:1983 +hcl:#efcc98 +pid:722084344 eyr:2025 + +ecl:oth hcl:#341e13 pid:130312766 hgt:171cm iyr:2018 byr:1927 eyr:2024 + +byr:2021 hgt:152cm hcl:74dda6 +eyr:1984 cid:216 +iyr:2018 pid:95283942 + +hcl:#b6652a pid:924778815 iyr:2017 ecl:gry +eyr:2035 +hgt:68cm + +iyr:2010 +hcl:#efcc98 ecl:brn eyr:2020 pid:801894599 hgt:163cm byr:1959 + +pid:798701070 eyr:2030 +hcl:#866857 ecl:hzl hgt:169cm byr:1994 cid:219 iyr:2010 + +pid:#e9b41b +hcl:#341e13 byr:1970 +iyr:2014 +ecl:oth cid:266 hgt:68cm eyr:2023 + +byr:1931 pid:929960843 hgt:187cm hcl:#6b5442 cid:52 iyr:2010 eyr:2024 ecl:brn + +iyr:2017 byr:1974 +ecl:hzl cid:243 pid:66053995 hgt:147 eyr:1920 hcl:z + +iyr:2012 byr:1962 ecl:brn pid:773399437 hcl:#341e13 +eyr:2026 + +pid:738442771 hgt:186cm eyr:2027 hcl:#efcc98 iyr:2013 +ecl:brn byr:1928 + +pid:855794198 +ecl:oth +hgt:67in +cid:81 +iyr:2011 hcl:#b6652a eyr:2020 +byr:1921 + +hcl:176abf hgt:161in +byr:2002 iyr:2016 eyr:2027 pid:639047770 ecl:brn +cid:178 + +pid:335686451 +hcl:#86c240 iyr:2017 hgt:190cm byr:1968 ecl:amb + +hgt:150cm +hcl:094a87 ecl:#09c463 eyr:1926 pid:537511570 byr:2009 +iyr:1998 + +hgt:74in +pid:927963411 +eyr:2026 ecl:gry cid:323 iyr:2012 hcl:#fffffd byr:1959 + +iyr:2018 byr:1978 +hcl:#ff1829 eyr:2023 +pid:823129853 ecl:hzl +hgt:65in + +pid:189cm +ecl:#00391e hgt:72cm hcl:11050f +byr:2029 +eyr:1994 +iyr:1935 +cid:186 + +ecl:grn byr:1942 pid:217290710 hgt:181cm eyr:2021 hcl:#7d3b0c iyr:2019 cid:320 + +byr:1983 iyr:2013 cid:122 hcl:#ceb3a1 eyr:2030 hgt:59in ecl:grn pid:946451564 + +ecl:amb +cid:236 hgt:184cm +hcl:#cfa07d iyr:2017 pid:934730535 eyr:2021 byr:2002 + +byr:1950 ecl:hzl eyr:2030 hcl:#623a2f pid:742249321 +hgt:158cm iyr:2018 + +byr:1946 eyr:2021 hcl:#a97842 pid:204671558 ecl:grn +iyr:2010 hgt:187cm + +hcl:#b6652a pid:528124882 hgt:162cm byr:1924 ecl:amb iyr:2027 cid:157 +eyr:2028 + +hgt:180cm iyr:2013 byr:1926 pid:232265934 hcl:#602927 ecl:oth + +byr:1984 ecl:brn +iyr:2016 pid:756596443 eyr:2030 hcl:#7d3b0c hgt:183cm + +hgt:185cm +hcl:#fffffd byr:1991 eyr:2023 iyr:2014 +ecl:amb +pid:759105859 + +cid:82 iyr:2012 hgt:160cm eyr:2022 pid:593798464 ecl:gry hcl:#4e7571 byr:1983 + +pid:478427550 +iyr:2010 +ecl:amb byr:1969 hgt:68in cid:94 eyr:2021 hcl:#866857 + +ecl:amb iyr:2019 byr:1986 hgt:170cm +hcl:#c0946f +pid:779205106 eyr:2027 + +ecl:brn eyr:2025 byr:1925 +hcl:#7d3b0c hgt:76in pid:576353079 iyr:2010 + +hgt:175cm hcl:4bf5ae ecl:amb +eyr:2029 pid:173cm cid:329 +iyr:1952 byr:1972 + +ecl:grn +eyr:2030 +iyr:2015 hcl:#c0946f +byr:1989 +hgt:178cm +pid:287209519 + +pid:834505198 byr:1985 ecl:gry eyr:2024 +cid:295 hgt:169cm iyr:2017 + +hgt:170cm +pid:054644831 eyr:2023 iyr:1949 ecl:amb +hcl:#888785 +byr:1955 + +hgt:171cm +pid:947263309 iyr:2015 byr:1944 eyr:2027 ecl:grn cid:79 hcl:#341e13 + +eyr:1982 +cid:147 +iyr:2015 +hgt:70cm hcl:a77c10 ecl:zzz byr:2007 +pid:161cm + +ecl:gry byr:1933 +hcl:#c0946f pid:483275512 iyr:2012 eyr:2025 hgt:161cm + +eyr:1985 hgt:176cm hcl:7b6ddc iyr:2012 cid:326 byr:1973 pid:929418396 ecl:gmt + +ecl:gry +byr:1971 +hgt:184cm +eyr:2027 hcl:#3adf2c iyr:2017 cid:210 +pid:693561862 + +eyr:2021 pid:779298835 byr:1921 hgt:193cm ecl:amb +iyr:2016 hcl:#ceb3a1 + +hcl:4a1444 +byr:2019 iyr:2024 hgt:182in +cid:87 ecl:#122264 +pid:181cm +eyr:1927 + +cid:267 ecl:amb eyr:2020 byr:2000 +hcl:#18171d iyr:2012 hgt:190cm pid:18525759 + +ecl:oth byr:1988 +iyr:2019 pid:660570833 +hcl:#866857 hgt:176cm + +eyr:2030 hcl:#866857 +byr:1967 cid:316 pid:560346474 iyr:2015 +hgt:160cm +ecl:gry + +ecl:hzl +iyr:2014 hgt:164cm hcl:#733820 eyr:2025 +pid:106302413 byr:1920 + +iyr:2016 pid:515066491 +ecl:grn eyr:2026 hgt:179cm hcl:#b6652a byr:1982 + +ecl:#7de6a0 +iyr:2004 eyr:1955 hgt:154cm cid:138 byr:2004 +pid:758934555 +hcl:a21980 + +pid:#2a21e0 ecl:#1b9b27 hgt:165in +byr:1998 iyr:2014 eyr:2032 + +eyr:2021 hgt:184cm pid:431054313 hcl:#ceb3a1 cid:109 byr:1977 ecl:blu +iyr:2011 + +pid:006339126 hgt:177cm +cid:188 hcl:#a97842 +iyr:1959 +ecl:xry + +byr:2000 +ecl:hzl eyr:2029 +iyr:2011 hcl:#866857 hgt:74in \ No newline at end of file diff --git a/2020/day5/day5.py b/2020/day5/day5.py new file mode 100644 index 0000000..df143ce --- /dev/null +++ b/2020/day5/day5.py @@ -0,0 +1,69 @@ +#! /usr/bin/env python3 +from itertools import product +from bisect import bisect + + +def main(filename): + results = {} + with open(filename) as inp: + for line in inp: + boarding_pass = line.rstrip() + row, col = parse_boarding_pass(boarding_pass) + seat_id = get_seat_id(row, col) + results[boarding_pass] = (row, col, seat_id) + part1(results) + part2(results) + + +def part1(results): + # part 1 + max_seat_id = max(x[2] for x in results.values()) + print("Max seat ID: ", max_seat_id) + + +def part2(results): + seat_ids = sorted(x[2] for x in results.values()) + missing_seat_ids = set(range(max(seat_ids))) - set(seat_ids) + print("Your seat id : ", max(missing_seat_ids)) + + +def parse_boarding_pass(boarding_pass, strategy="binary"): + "Poor man's dispatcher" + try: + to_call = globals()[f"parse_boarding_pass_{strategy}"] + return to_call(boarding_pass) + except KeyError: + raise KeyError(f"Bad strategy name {strategy}") + + +def parse_boarding_pass_binary(boarding_pass): + "Parse boarding pass using a binary conversion" + boarding_pass = boarding_pass.translate(str.maketrans("FLBR", "0011")) + row = boarding_pass[:7] + col = boarding_pass[7:] + return int(row, base=2), int(col, base=2) + + +def parse_boarding_pass_bisect(boarding_pass): + "Pass boarding pass using bisection algorithm" + row = bisect(boarding_pass[:7], lower_option="F", upper_option="B", max=127) + col = bisect(boarding_pass[7:], lower_option="L", upper_option="R", max=7) + return row, col + + +def bisect(inp, lower_option, upper_option, max): + min_v, max_v = 0, max + for l in inp: + length = max_v - min_v + if l == lower_option: + max_v = min_v + length // 2 + elif l == upper_option: + min_v = 1 + min_v + length // 2 + return min_v + +def get_seat_id(row, col): + return 8 * row + col + + +if __name__ == "__main__": + main('input.txt') diff --git a/2020/day5/input.txt b/2020/day5/input.txt new file mode 100644 index 0000000..2f95cdb --- /dev/null +++ b/2020/day5/input.txt @@ -0,0 +1,757 @@ +FBBBBBBLRR +FFFBFFFLLR +FFBBBBBRRL +BFFBFFBRLL +BFBFBBFLLR +FBFBBFBLLL +FBFBBBFRRR +FBFFBBBLRR +FBFBBBBRLL +FFFBBFBLLR +FBFBFFFRRL +FFBBBFFLLR +BFFFFFBRRR +FBFFFFFLLR +FFFBBFFRRL +FBBBBBBRRR +FBBFFBBRLR +FBFBFBBRLL +BFFBBFBLLR +FBFFFFBLLR +FFFBFFBRLL +BFBBBBBLRL +BFFBFBFLRR +FFBBFFBRLR +BFFFFBFLRR +BFFFFBBLRR +FBBFFFBLLL +FFBFBFBLRR +FBFBFBBRRL +FFBFBBBLRR +BFFBFFFRRL +BFBFBFBRRL +BFFBBBFRLR +BFBBFBFLLR +FBFBB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FBFBBFRRR +FBBBBBBRRL +FFBFFBFLLR +FFBFBBFRLL +FFBFBFFLLL +BFFFFFBLLL +BFFFBFBLLR +FFBBBFBLLR +FBBFFBFRLL +FBFBBBFLLL +FBFFFFFRRL +BFFBBFFRRL +BFBFFBFLLR +BFBBFBBRRR +BFFBBFFLRR +FBBFBBFRLL +FBBBBFBRLR +FFBFBBBRLR +FFFBFBBRRL +BFBBBBFRLL +FBFBBFFRRR +BFFFBBFRLL +FBFFBFBLLL +FBBFBBFLRR +BFBFFBFLRL +BFBFBFFRLR +BFBBBFBLRL +FBFFFFBRRL +FBBFFFFRRR +BFBFBFBLLL +BFBFBBBRLR +FBBFFBBRLL +BFBFFFFLRL +FFBFFFFLLL +FBFBFBFRLR +BFFBFBFLRL +FBFFBFFLRL +BFFFFFBLRR +FFBBFFFLLR +FFBFBFBLRL +BFBFFBFLLL +BFFBBFBRLR +FFBFFFBRLL +BFBBFFFRLL +BFFFFBBRRR +BFFBBFFLRL +FBFBBBBRRL +BFBFFBBLLR +FFBFBFBLLR +BFBFFBBRLR +BFBFBFFRRL +FBBFBBFLLR +BFBFBBBRLL +FBBBBBBLLL +BFFBBFFRLR +BFFFBBBRLR +FBFBBFFLRR +FBBBFFBRLR +BFBFFFBLRL +BFFFBFFLRR +FFBFFBBRLR +FFBFBFBLLL +BFFBBFBLRL +BFBFBFBRRR +FFBFBFBRRR +FFBBBBFRRL +FFBBBFBRLR +BFFBFBFRLL +BFFFBBFRRR +FFBFBFFRRR +BFFBBBBRLL \ No newline at end of file diff --git a/2020/day5/tests.py b/2020/day5/tests.py new file mode 100644 index 0000000..32ace84 --- /dev/null +++ b/2020/day5/tests.py @@ -0,0 +1,27 @@ +#! /usr/bin/env python3 +from day5 import * + +def tests(): + inputs = { + "FBFBBFFRLR": (44, 5, 357), + "BFFFBBFRRR": (70, 7, 567), + "FFFBBBFRRR": (14, 7, 119), + "BBFFBBFRLL": (102, 4, 820) + } + + test("bisect", inputs) + test("binary", inputs) + + +def test(strategy, inputs): + for boarding_pass, expected in inputs.items(): + row, col = parse_boarding_pass(boarding_pass, strategy=strategy) + seat_id = get_seat_id(row, col) + assert row == expected[0] + assert col == expected[1] + assert seat_id == expected[2] + print(row, col, seat_id, expected) + + +if __name__ == "__main__": + tests() diff --git a/2020/day6/day6.py b/2020/day6/day6.py new file mode 100644 index 0000000..c3f8a72 --- /dev/null +++ b/2020/day6/day6.py @@ -0,0 +1,29 @@ +#! /usr/bin/env python3 +from collections import Counter + + +def part1(inp): + groups = open(inp).read().split("\n\n") + number_of_questions = 0 + for group in groups: + unique_questions = set(group.replace("\n", "")) + number_of_questions += len(unique_questions) + print(number_of_questions) + + +def part2(inp): + # number of questions for which everyone in a group answered 'yes' + number_of_questions = 0 + groups = open(inp).read().split("\n\n") + + for group in groups: + group_length = group.count("\n") + 1 + group_counter = Counter(group.replace("\n", "")) + everyone_answered = [k for (k, v) in group_counter.items() if v == group_length] + number_of_questions += len(everyone_answered) + print(number_of_questions) + + +if __name__ == "__main__": + part1("input.txt") + part2("input.txt") diff --git a/2020/day6/input.txt b/2020/day6/input.txt new file mode 100644 index 0000000..790070a --- /dev/null +++ b/2020/day6/input.txt @@ -0,0 +1,2199 @@ +zvxc +dv +vh +xv +jvem + +mxfhdeyikljnz +vwzbjmsrgq + +vbtjnh +vhejnbti +vthnjb +tsbhjnv + +cbjemdvp +jdvuylp +ofpjaqgsrxvdn +dzvpbj +vbktpdj + +knyvdhsemu +sdyumkgvh +muyvdskh +syhkuvmd +dvmykshu + +rmantzovbsuxiljkchfgdqew +vficzosgwlmrdtqkueajbnxh +davqlntibxhojesrkugpzmwfc + +ifdmgrcve +bkqal +gxcwvt + +xeiokblasch +toxjlsbnciha +sovycihlabx +ximhylocabs +hixsolabc + +iyfkvmpolta +thpqodzifxc + +iexunoyhwv +ovweiyuhxn +uhojnvyxeiw + +vbncamhzojtqrlpse +wujapcidzx +zxjiuacwkgfdp + +bygewhzsnqvxaoc +sngqvepohyzdwxcab +yoxwzmgvesbqhcua +cqtbwehiavofzsgylx + +rxanvifdup +xuvpnfria +rfnpvixua +npiuxfarv +vnifuxpra + +ysrktfhc +trfkcysh +ktfycrsh +rhckstyf + +nq +kqin +nq +qn +nq + +yorbujt +evqkmscp + +fitkprweso +fszkmoretwpi +ptyoswrekim +iuwbrsgeockpajt +yewksitpro + +gtyaemflvc +fyvlecgmati +vgfyclemta + +k +tj +uebpy +vyma +ibdy + +p +p +p + +r +r +lya +b +r + +cht +hct +cth +tch +hct + +qdxpas +dpxsha +parlyekqsx +sxuotvpwaz +jqxspymae + +ngycrw +wgnv +sngw + +psb +us +s +s +s + +xnodk +dxok +tkxdo + +n +n +n + +tysg +gtys +syg +eghslqry +gyts + +qliwfgatpbdcy +aqwflpdygtcb +ypdcglqtwabf +dwgcytlbapqf + +nwvlqbusparkf +jhfbvnsqpr +nprqbzfevs +nvrqhboexmspfy + +tgr +rgt +gtr + +jokfqv +jqk +qjk + +fuv +mvuf +vfu + +mfw +mwf +fmw +fmw + +kt +jp + +fklnagsztb +znmtsfalpj + +o +qb + +h +peqyon +az + +n +n + +eagyvpmjqxs +qghjsapny +jayrqsgp +qasygjp + +yctzugn +ytzcgu +cuytgz + +bsfxcygptnlk +xrgocylkifuen + +os +wakdftzgh +losn +pn +yp + +pie +ei + +zpsxeb +tgynfiw +zomvqu +ludk + +s +s + +wuon +ngw +wn +nw +wn + +omrdjkzeb +ncdjuzborkm +zkebrdajmo + +tjwaxm +iztwvod +wqt +txwr +wt + +lpcbfwiksnvdhrqjut +punidbscqtrwjvkfhl +vrcqukphwjsdbtflin +dvkwlgnhutsrcjbqipf + +spzlowvtxdkjinfc +indjlksczxfptvo +czmaxkqnfpbvyshjdliot + +aqspmnkxie +trjhfclyogd +zwavixpbeu + +mozewqhxkduajgy +mogjekqnfuywzhxda +ozhkaxegyumwqdj +ajdzogmehwqrkyux + +qemykxdwipjfa +wdxaplmeyfkiqj +xmqplaekifdwzj +mjixwqzaedkfp +ofpmwxkqjeadi + +gpjydb +jpystgkd +gzjdpy +jpgyd +pgjydxh + +drockgqe +evanghozbi + +kfg +lmfwig +gf +fgsj + +zjfnabowyrtmxcgl +ycrjxazgfowbitlnm +hrlwegxokbqzatcnjfmy +jcobagxflzntymwr +grzotfxcymlwavbunj + +iamdhcgfynqzos +gyszifcnavdolhqm +qmnwziuropsacdgyh + +mwlgcedjtknxsuy +estmwlxuydjkci +hctlyawmxkjseud +jutsxdycwlkmie +mtwqyskbflxjzvcdeuo + +sdfwjm +wdsm +ygmqsxdei + +u +u +u + +dutb +dubt +dutb +tdu +idtu + +sqpfzwlvcjtx +haiv +dveyohgb +kuvhm +vik + +myzxofuacqsgi +kcamifojuybgqs + +mthngfuvykwci +numzktjydcxwio + +aspdgtikq +qpkgdtisa +qsgkdptia +pqtuakzdigxs +pdkqtiasg + +fityomxdwlscjazhkqp +pmzrcjhvntsobfq +shztqgmrjofcp +jmcngqhoputzefs + +whjgxi +wxjoihg +gxjwih + +hirpefgxsa +gahfytkz +qdjlzvwfahg +hbaofwgvc + +dhcnfgy +fyhdgc +gyctdhf + +hbmconewlqgsdzk +jqflbowkdsgc +hwkobvdcsqeilgn +lkcogsaypdwxbq + +enzrdgqyu +gvqrtoihlaj +qrgs +qpeurgzkxn + +grjdenycstpfbihqo +bfkhlgjrpeysomtvidqc + +fxmqujr +wmvghur +dpaeyko + +untpyr +urtpyn +apnutry +uptyrn +nustyrepg + +ofualjwvq +jeyoqru +yuxqioj +ushtogmdpqjcknb + +txeyfwrhl +xrhfytelw + +nu +niu + +rbmuneiz +neibzurm +mnerbizu + +mvtkp +vmpkzt +mpvkt + +vakc +erq +b +ijftomxy +zsg + +yptu +tpayoub + +zsqvdfw +zdswvfq +qzwsfdv +qwzdfsv + +pbwvzadgyturskqoefncxhmjl +thazxruyscfqndvpjklbgomwe + +xnomrqyzpe +ieudmxroqvbnz + +cldqr +ecdqr +ercqd +cdwrq + +kwzqcagfxvhjromti +hfsjcqxibokgravztmw +atkrogwjcxvfmzhiq +gwhztkxacfvrimqoj + +ztbqli +lobdrhgt +rbltoyh + +wfh +fh +hf +fh + +rnxkztpmi +umzigxnh +zyxilqnsm + +iox +oi + +ovugqjpxkshczewmr +smpgxuqzlehkwrvaocj +civspxkmhjwuzegoqr +jergszqvhkxucpomw + +mzsrlcfqpuaex +rtxaqnsjczvf +rxsuiazqcdf + +zvmltjegwxyfihnsaouq +tmwlgxyhoendfiaq +nrgptwaxleoqfihmyk +tlqhiawmnoyfegx +nhlwfcagqyotxmei + +dfoyublxhzajwktrv +olrfzuyphd +fynohuiqemlszr + +nmwedzq +qewzdn +zqnedw +qnzwedp +dqezwn + +lvugjzmsec +mgnlqsjzudvw + +yasmrkxvnpch +yxabnvhpskrdmcl +hvnkarsyxpmc +myhvconkpaxrs + +pfelbgs +a +vriu + +vfy +oj +izagebph +ck +mv + +hn +h +bjhtr +h +h + +saixpwbhqdverzcyfnktluo +kuqtfhewypnrbgvcdliozxs +deiyptgkwrzqlohbvxfucsn +bynqihpjwecotlfvzusdrkx + +yxvfnlwz +ecvwlfbgnz +rfphonqviwlz +nezbwvufl + +i +i +i +i +i + +hvbatqdzu +zvaqtumldb + +hqxbn +hqbn +hqbn + +ymikcgxdph +kmduhyxqenpil +kphygxmid +hidfkzxypm + +gve +eygv + +chds +hsdc +dcsh +hcsd + +pgakuncrze +rpackxegnz + +nhypde +ncepyd +ndpey +ydenp +yecndp + +qgjpeu +dfma +uwnfvsja +ohxcltz + +emgqlacpfvjhux +iudjrhwvfsxplmge + +fmwbpeyxna +wxdnafyeuibkj + +rqhzeaojuigyvp +ovtixs +ixov + +ms +m + +u +v +u +u + +yo +yo +yo + +rhnmlxbvdteckzpsjaw +cwzdraljthpnkxmeibvs +wavdlhjezskmbrnpcxt +pqadwkrmjbecxlnsthzv +zkpbawrdhnclsmtexvj + +djecv +jewcd +dejcb +dvjce +ecdj + +adiotklhj +oakyljdthi +laticokjdh +cialdtykjhfo +kadoequjtlih + +xcrfloupby +lufciypr +hrpcuyxfl + +fwngabh +njfgbwha +hgafbwn +bnhgawf +fbamhngw + +fwqe +qfmvup +fqa +fqe + +us +us +su +su + +lobh +b +bezjmi +iblz +sxbtav + +tjkdlfwm +klwmjfdt +lcwfvjmdktq +wlkfdtjm +kmdwltfj + +ngrzftbhoevylpiscd +rhvsfbliwkndcaxzoejyp +pfizbnldechsryov +csnrdfibyvpolzeh + +bhszfutjkrdxyeic +iscrkhbjwdlyxzefp + +rncodaythzpgelbu +udcnathrbsogelzy +yuhwglzreancitojbd +yhelzuodacnrbtg + +rv +fwla + +cuqsfzalw +caqzwlfus +wvcuflszaq +saqlcuzfw +uwscqaflz + +hnp +pnh + +y +y +ergy +y +y + +bmexpongud +pgktrwhbneqaxov +uiocxdgnebps + +vxtckwno +uenb + +xgomqzsuivnab +xusnvoqimgbza +vqizsuxbnamgo +zumvgxansqboi + +s +tsy +lf +rczxhvaopjew +ltm + +ipvefjzuhs +hiecsvzu +egykiushqbzdmovx +izhvesau +virsuhez + +ld +lg + +xnvszluechwptgm +uczsgowtpvlnmx +zmwglrpscuvtxyn +xmcstnvldzpguaw +miwblxuzgcptjvksnq + +ftwx +zcritxpbo +txsf + +buzcyxlmoknsvqrdpwta +iseplfgmrnjbwyvhtxk + +cmjpkingdflra +pcinrfladmkug +icrmngljadkpf + +saehfjb +dtuheqwbgxyonksjlc +ehvmjsb + +fcty +qopy +hyfv + +djkcm +jklmbd +mhrdkji + +xaropbcylemuh +benjalhducrpy +ecypvsklubhtirwfa +azrynhepulcb + +xe +xe +xe +ex + +os +os +asob +so + +omtnjhdvcw +ujotewxndvkfb + +svqlbwrctd +qfcbltsh + +eof +ebosn +owfe +xmyoe +rvmoew + +lmaus +ulam +auml + +ky +e +f +o +e + +figyhsul +fguyhlsi +lyhfigsu +yuglfshi + +myc +cmyd +myc +mcy + +dpnbhltm +mp +pmua +opxm +kvpgmuf + +hk +prv +rh +ixm + +umlcksxonaqft +bednjkpgirm + +tj +fxjtl +tcmj +tgzbvoprkqwu +ist + +bzats +haosb +abqsk +abgs +wvbfeuxasn + +knwbzryjvde +jdebkvryzcn +djbzykenv +euyfnkavdzbxmj + +srgkpw +apqbxusc +tpmwq +injolypfd + +onxflkzsqwetmdrayupbijv +blkorzdvyxiuawgnqpmstef +fsnpxiueltmzovwrabyqdk +bfxsyekrnvdqzoutwpiagmhl + +jahltpfywcnobux +hcwfadpkyzms +oglqhpifavcwyx + +migjhyvpnf +ufjyqv + +txoci +z +izvugb +rpydhl +xbm + +ajlfb +bfl +jslof +fzrnmlqek +ofdl + +crbuzmjlnsoixgyatf +gkbasourfjcimlxtnv +ndmwxstgfoubrcljia +qmfoxlhnrubetgjsaci + +msr +ir + +ypv +vp +vp +rpv +pv + +jquxr +hngqptklaeuimrw +frbdvoucq +drusqy +xqdzur + +ifnuymdhesgzpjkroqwc +nqshkiwoyfcupmjgrezd +cpqmjwreogdyhuznfkis +pzijugdfykreocnqhswm + +wletxi +twlxe +tjewrlmx +sflciwxet + +cqmtspovlhxzwknijgdbya +jktgvsnfmobiwxplqzyc +oniglefctyxvbzpsqkmjw + +aqbujkmecp +jcakubpeqm + +ms +s +g +d +s + +ymb +bmy +tbym +zmby +zymb + +zmajf +afd + +saqutcgmzpvrx +qzumvpcraxgts +zcmgpquxnrsavt +uxztgakmcqsypvr +xmvqurazcptsg + +xgcnvwikzmh +jualdmfogexcp +vrixcgqmbt +gcxms + +hlf +jzeubrawvgonf +yqxcpkhf + +wpkbqaver +kwenvqrpbd +pswekvrqb +vbepwrqk +rkweqpvb + +r +ef +eqh +e + +nvzfi +znmev +ohnlvzk +vnezjc + +whkjfmbtausedyvqx +tmqxhkfsydevuwba +srvfbdkymwtqxiehcupa +lsatxumedbwfkvyhq + +aligpe +glpaie +aliepg +eilagp + +xvigpscledkfwjbztn +sgejnlvxdtbzfckpiwh +vlcwftebgjsndpzixk +swkzngbdcexifltvjp + +zrethjknvsdwf +qldrsgybijfhz + +tlhogxqens +habqtneudxljgks +xqtsnelhmgo +qlnteghxs + +bhc +ec +ch +jgiyc + +xzfioelc +ozilcexf +zfeoxcli +clefxioz + +uqjkybfsehwxzlptrni +caryzpjnukwlxesgtbhf +jzwkubtlsypqhneforx +xlrwkspjyufnzebht + +tvzuoab +bv +bgv +bv + +ltujriwpmyna +jtrmpw +mwtspjr +tmorwjp + +tyjsqfripxz +rpzxytjqsif +xtyrspijzfq +ctixjyfzrsqp + +ycjihklnd +ezvuqn + +chtgvuilo +uvgticloh + +hmgyx +yghlx + +oejuvpaigsrqh +pijsveugqroha +eviqopasurjgh +iroqaphsuevjg +qauzoirjghsevp + +gumpokcdtinjberaxqfz +xdounkjezmrpfbicqgt +pzfgicekuymqnrxodbjt + +npy +nyp +ypn +ynp +ypn + +xfhucsdlpveoir +mnzobifxtkr + +hy +yh + +iumnsyqgw +wgyismd +rdmgwiyhfs +xzgywmis + +dwfplygjx +vuhewxszq +bxnrmocki +xtyea + +ouyqrtczxwj +xqtyujwocrzb +qjxuyrotkwcz + +qjtcyaoexnvl +nxtaqkjloce +tzcongqajpxle + +olubpxmfdayik +leqomjitfbay + +lygezhjmbi +clvphtkud + +vp +pv +pvkfw +pmv + +rpsclgeuhmkja +mcgypeuswakhio + +ajdpyugzbcswtei +pcadiemunsbgw +ludvapgecqsfbwi +elsugdcfnhbipwa + +vfzoqrbgjycuenwlxdts +fgdnclwtoyxqvuesjrzb +ejatdrohipbxucyvnwzfsqgl +utsloejxznvwybdrfgcq + +vwkaomqupbitzrh +pvawbkoztumqhr + +ijbcxau +cijuoea +cjifuyqa +cubtxaji +jxcaiu + +zsankwocrhb +dchzrbkmaswon + +jdcfne +nfedjc +qeczfjn +fcejqn +jnefvc + +vpzmjnb +zbvjqdys +zbxpdjmial +ktouerbjgwz +jsbzhc + +zbsi +zisb + +txvngrdas +vadsrgtx + +qgnvriol + +a +a +a +f + +mvuywsiaqcl +nqavfwhsicz + +yuomdcgnvwhakel +auwkhgoycmlevn + +icagyksq +crsahngi + +vb +ftlgxroupjyis +cvh + +vcimkpuafwqbryogjxdt +mxyftdriubhawgjcvpkq +rybptdfhaoxkgvmjuciqw +idxrkpygcwvltaefmbqju +trmjbiqpnyhvscwxafukgd + +esbdajqhvl +jdqlszev +foedswyvlunq +ixevsdtblmq +rvetlqsdk + +islfcy +yif +bify +ioymf + +hrcqst +pecr + +gwd +wdg +dgw +dgw + +ksyqndmahzgxejfp +sexhgkfzdapyqmjn +dejzykngpamhfqxs + +fmohepc +pucg +cp + +xvdmorgbsnawjlecztykpif +rsmwdvfplkencbzaotgjix + +wjhkg +gbkh +dklegsrmhy +hukgw + +flwu +lnzckx +vetd +myj +xwcp + +vjhnftpyr +nfhjvyrpt + +lne +nel +nle + +hgqjcse +chfja +jqcus +kozlctmiy + +h +h +h +h +h + +lwco +wloc +tlkuwco +lwoc + +egzxalry +zyxaklpge +zlwergaxy + +nghrpie +nqz +au +ytcdsfw +lbj + +jkcetobxnsyqwfdzuglv +gsnwvmzjxiteryacp +njcshegytvzxw + +qtsf +st +ts +ts +tps + +ckmnriay +sytrcng +ncywrg +ncygr + +rcnyivhla +ebgfdotjuks + +tfjcihobxywuvpezarkg +hckgoruvbxzenjipaywft +fwhtyrvebajgpkcuxoiz +oaruytpwzikbfhjxevgc + +oaxzdr +dopg +opzak +woqg +notveuy + +l +l +l +qn +m + +dvjuhlfmectponaxwyib +yfaltvohpnquirmzjdcxsb + +ib +bil +ib +bi + +sd +lo + +s +wsvef +va +jwvf +rdho + +or +lor +kro + +ze +e +e + +teh +ef +ek +fe + +dfbzgqpsk +pzgfaydsuxq +pgfqdsz +kzrfgqsdwp + +rxqgndcawfb +loyuzbmejivkhs + +jilybertvwkqcma +nuelmho +ledhomnuz +esfml +gxzpelm + +mikrjtbophlqduwsexvcy +mbrqlycjvskdwithuopex +qlwrcduykbmxsovijthep +xevmqplwtjyckbouirhds +bmytdrsxvupciloewqjkh + +wrnkojbmtzvchulxaisepyfdq +xicryqvwkumtozjdhsflegpabn + +yjxpwakhd +klhj +kjih +nshrgujk +skjhm + +fasz +aef +gmqipcfanvt +hsafl + +m +m +m +m + +ksyargzucfq +lyvjrmapbhqwt + +b +b +by +b + +d +dx + +lqdmrovwifbhpkg +dqvofhgzwipkmlsrbn +ihmvkdqbroflgpw +bghqvfipwodlkrm + +qzuabnldjsf +nabfzldjq + +ihkpj +skhj +khj + +pfhzgidaoumyclqwjb +oubaqdmhlzgjfcwyip +maqwihopcbdlzyfujg +aydlupjizwhofcbgmq + +dcifuhzpj +udizhcfj +uzcrijdhmf +uhfdcjize +dxbjhzaifuc + +mijthslvq +vslmjqhi + +yilmjrbsaugeqv +sokhewyczmgufabjv +maxbtsguvyejdlp + +bdysxeouwcn +otszxpnm +wbsxonkr + +btwjys +bjy +jby +bjy + +elobcuyqvps +ubeloqvyspc +elvcypobusq +qbcsuyeplov + +zshbqdmcxntwokevlpjugr +lubzdvwrksnhqcptmgyexjo + +csmyezwqxdpfh +zexmdwhcqsyfp +fdqeysphczxwm + +wx +x +x + +hmudcwtoix +duitheoxcmw +xeomwhtiucd +xmthuoiwdfc + +qgh +xburedysok +izaqc +vac + +c +xd +y + +bcqxzv +czxvb +xcdv + +rstdhfvyupaqnilgkx +thmdrvqkgyxpcewlafu +xkvfgpdtahinlsyquzr + +ionzfdqwacl +aliwfzcnodq +ysdoijcnpqalfwuzr +dialwcqofezn +lqwfncaoeizd + +vjnzhsyokprdwqt +slufncexiadgw + +lmanxbzrvkgju +cotlneyfp + +ehcxwrapivns +nvewjcaspixr +ecpdkqxvastmn + +okgbcwvytiznshexu +kwyszldpbuthoxnj +kotjwysnuzxhb +juzbwshqatknxomy +krzthuxqynfoswb + +rjfbkgapzqiwnecoh +ohjnfzrabwcgqipek +bgmzawokijpnqhfcre +vwherzicopkqbanjufg + +qrwxpijsu +apuwbfirqjs + +rgynxak +uaxpirf + +sf +f +uf +ihxfzdy + +dvcrwsbpziytjqhnuoa +ehgudqsyzkbrnpt +sptdxznyeuhrqb +uqzbhfynsrtdp +srpymhztqbdunl + +rqly +dlaxpwrji +rbljwh + +grascdfzlpxoeqvtyn +xcnfwvryspeukbodzlatg + +oqlucpvdizwh +trakqib +agitjq + +yslaopvredmzcjnighqtfk +ohgqmkatyrledjnifspzc + +xwliz +czvfiqxw +gyswmhb + +fpndrua +aurfp +rpuaf +raufp + +eukjozdbqcxpyl +qyfmkxzboulcpejd +zlquxdybcepjko + +dlgxuchpnmosfr +dxcoshzfguykpvm +awgdpubxiefsohqj + +abop +abvpo +napobc +vapob + +wryqzk +kwqyc +wyzqkr +ykwqzo +ywkqr + +jbk +tkbj +bjkcn +bjk +jkb + +fagxpiolshctke +xtiochpabflsk + +fqdteprviumho +meitwhforpduqv +utfrhempwodviq +nehmyipftrqdlucov + +anqedwylpuv +edoqpufvwzx +tiuqvjhcrpewkmd +psvudgeqw +gdwulbpvqze + +znugjimbptvefqhxr +suxktycoplwe + +qtludyrb +yqrludv +lqdyur +ldqryu +lurkzqyvad + +cwmikuhtgole +tzghimclkue +igtxkcpsmlydhe +khtglcqmuie +imhwecgltk + +pschkw +schnwpultqk +iwzohyej + +dwxbfsq +dswfbqx + +tpby +ptq +qpt +tp + +nqtocmfdjpskriev +agvctwbfxkyj + +kqdewilc +qweluikd + +qbyv +vb + +k +jmp + +lvnqfrdctwzk +xtljgevz +tusihlzv + +vrtojs +rvtzosj +jrcqvsutohwl +zvpsjtgoar + +wkh +wh +hbtl +qh + +jzcdykoafitepbxlqvmns +yqcpzvksoinjlebfdatxm + +rvmjscznedib +smineqdwcjvrz +duejsmrncviz +idrmvcsezlnjf + +qognsitfwkcmvd +qbonaiuktrc +ctkiyqnou +iptrcqjkhzoaxn + +msjqvb +wxfpej + +zgdmaphfuiols +oemgjuxavhcsfzdilp +gopdafmiulshz +zaphsolgumftid +fdgmahupzsoil + +svdmfou +uofmsdv +fuvsodm +uvmodfs +vsoumdf + +pn +gn +np +hsnc +nem + +ondycsxijkhztmb +sdtmkibxjyu + +cfdbyz +dbcfyz +ocfbzyd +bfzdyc +fcbydz + +rycjvanzo +qzecro +zrqoc + +iytqmcheg +gyiectmh + +idcpxfhmwbutsogkazl +iwoydxlchsezubtkgpma +fcwtdoulsphxmibkazg +woshuclmdzibaxpgkt + +lvpfdtgw +jysqnxkozermwc +aywockbuh + +hlgrnxofckptmqvaebsdwi +lhqtonswkdmvrcibfxape +wqimranhsepdotcfbxlvk +ksxwcidfaoqlbrvenhtpm +dncheprotawksmxflvbiq + +mkcyzpfseqg +yqgmkczvt +zbiqoynxkrjd + +qalxdcz +wuchrlszbepm + +tisl +tjoycs + +uixno +zicsuorn +xuqiokn + +qadwnkvfzltpib +ctehovpradslgxujwnmbfiq + +lnbzhdvqucg +udvzgqlcbhn +zcvhlqndgub + +dnkeso +enskdo +sneokd +oknsde +dekson + +aqxyozpubvjgcr +ybpjqrcoagxuzv +yrajbvpogcuqzx +ubarxgvqyjpzoc +xqupgyrovzcjba + +galcpxukjvdfz +jcvgulafdxpzk +gchxzuajvlkpdf + +pds +euwsvd +dsf + +phvzus +rhlztp +phzdla + +rfpbcyd +rbdycpf + +brwpvt +spvtrjb +vytpbr +tbsrvwp +rvtpb + +efmkb +bemkf +bekmf +temfkb + +jyzinpl +efxqapwo +rzup +dpcr + +bawpqhnvmtuxsflizck +avqcthmkpifswzlnxu +slmqcpnxivzahkutwf + +zsakf +skfeza + +neqbzcajpw +onzqsaxhcbwljdm + +do +do +od +od + +rieubqwd +cqrupedvitb +edbqirun + +hvrpjfwud +zpauyi +kbxmeupq +uptwfhgzaj + +vkqf +fhnpyx +gawucsozmdi +tbrpnlekj + +neriadovyhuzkqgc +rqflhpywekobzstjumcn + +bvzumtnorcqhyilgwe +tvnioyzlwmerhgbuq +wylinhomzvetrbuqgdc +ghbltunyeopfrqizmwavx + +jvrieqgfklch +pjndlghruvif + +xbwvzikjtnhfayp +tgcadrqjxuel + +lbxsjvamqwdfutrck +bwrxdaqzuftlmvk +zbtmakqxdfpruwlv + +jrisgax +gries +rigts +girjspe +pasieghr + +reqwbsjzlghkv +gkmvstdcaroqbzjp +qhrvngfjzsblku + +vtilu +i +i + +cmizk +kmcdwi +tokljcmiv + +gcmxdqoysrjhzvunkbtpwfi +rsvhxmjgbdupqotnywkcifz +byczhwkrnmujqoidfpstxgv +romdtyjgwbcpihafslznxqkvu + +kcx +wfsoxa +rcxk +xecl + +xhljmt +lheratmxj +fhmxtcwlb +xhlmaritg +thxmalo + +usfhzlidpmxvonr +luvxhfdcmrpn +xpfldmuhvrn +lumvrnedxfphk +lpvdnfurmxhk + +ukqco +bg +d +x + +wshkqpojltbyexrvfcmaiugd +ptxsveguqfjdimboarwclhky +figabshrwotdqjepmlxkyvcu +imgseacrdxfkyptwhvoblujq +wflyahpcgbrsmvkitejxoqud + +cdfihsmoy +smieho +mhsoi +oenshami +ozlhswmi + +pefjcrt +vdfzpwrtc +ptegcbfr + +uet +uet +eut + +ubyk +ukygtrole +jukzxqhvy +eumldfkyos +knaiuywrm + +ncjzgqof +qafcjnzog +zojngqfc + +uxkryjwflco +psolcaquvwkdnizre + +linoudwypsgbvmx +wugpsidobmnryv +udynmoswgb +kydhcbnozusmegwt +sygbrmudwnafo + +sfkatdxbyqezirv +skvtiarxeybzf +viyzrlampbxtskfe +vyqazixrftsebk + +bjwqhkryuz +zmwkyuqhjrb +qjuwrzhybsk +hyzwujqbkr + +wjahb +jywahb +jbawh +jwhba + +aetucrzpvn +esznbtkoy +eztdn +zonte + +dkpu +mpqcixu +pwu +psu +pudkhyv + +ydtaink +atndubyk +ocytkdain +wnvgzytadkps + +mtne +mten +netm +netm + +l +lz +l +l +l + +wfu +wfu +uwf +uwf + +wcxsiaokerlumjnqyfvhtbgd +abrlxsfzqjuwnotehgmdkcyv + +kate +aekt +akte +teak + +spxqizdhbuokw +pwdxibkuzsqohr +qkszwvaulbpdthoig +ouwqdkzypbhis + +xlskunagot +onxagbulsem +olnsagux + +mhrst +hm +hm +hknuimeg + +pzwtsrfhcmqidnaeybgxkluvoj +keugsjaimzwbxqcvndytfhlpor + +gezfhs +nsyftgje +csifykhegj +fdrgmqvse + +eqagibxdlst +gdisebqlxat +eogtidqaslbx +tdbqslaigxe +eltabiqxsdg + +hopcmlyfka +zleytsfdpcgbn + +iq +qm +ajngr + +jgnh +pdqzyblwuh +tovghj + +jsztoebhflkrncuygi +epzghnfcoljutisryk +ugnysrzftjieholckm +kyeuglztrshjnbfico + +q +q +q +q + +zch +zhc +ch +cdgh +hcw + +nubdmx +xunbd +dxunb +wbxund +udnbex + +dfcauy +afdcuy +dfcuya +uafcdyn +fudyac + +cdgkzushqaevntrop +ndhzqxgksrpotcaev +qetkhzodnsrcgvap +epcvrnokadgzhstq +nozqsrhcegpavdkt + +wbpaec +jmfyir + +wozuxcnegrjikhy +eritoghwxluynkjzc +okrecihjuwxznbgy +nuwirjxkezyghoc + +g +q +r + +jdr +rj +rj + +ogs +szgo +osyugw +sogj +ogs + +ixnlzuvyar +ryznvumlqfexi +icylvxzrnu +lurxhyvzni +nixylzvrut + +xv +xs +x +kfwax +hxu + +dkjohmvtxscaqpyzbie +bdvtjzyhoaecmxpiqks +eyhsxtdoazqvcbpmikj +oevbpqstmxchykizdja +mbvjkyzihcsqepadxot + +vkqgipbhsmczdaery +ckomvhixysdq +cvixystlohmkqd +noyqmhdfuvkcis + +jeqcx +xjqec +jceqx +qcjex + +okncyha +kha +wdqkamrhi + +uajtdcwglpxf +ldxgwjauscp +avciwljdyxupg +lgctupaxwjd +zjblqcxwkrgdanup + +ogpcjvltkizyrubnshf +xrpukdzmcsqlnofejigtvbh +nhvztyfbsuicjlrkopg + +rklv +lnvr +vrsle + +tdoeb +toebz +jbot + +ahntqkrwvxc +htray +tehar + +xbis +q +p + +y +y +y +y + +svpnoi +vsnroip + +rkdetpah +hpdmjrekao +ybzcrhkguew + +ha +qkj +vzcjq + +ubjqtpfxalnv +uftvrxjqpbnla +tbunjpvqfxalh + +izesvwkmyohlqr +jhtqnmyiawpskz + +jdoqhwbftxpavygze +zydthexqgwpkaovnfj +cdsvzfxwtigjamryhqep + +srvdcubotnwkx +dmhpqyzikcslargnj + +tcmoi +ptqeci +buvtic + +kisteoqyjapdrcgfx +sqdxjckrfoytap +ztrdcxsayfkqjop +rjxfkpdaqysozctm +fyctdxsrkaojqpu + +chtzwxr +ozcrsthux + +oqahrvuinct +uavtnforke +ounartv +akunvrot +uonvftmar + +hveqfbrwkdosnay +zofutwkxmpgnljic + +sexkhbfwvagzjq +hryamtnf +phacfo + +yzdbglajf +lybfajgzid +ldjagfbyz +djlyzfbga +lgyjzfabd + +mk +km +mk +mk + +vupse +utvf +veu +noubvi +vslpu + +gxcz +xgcz +zxgc +cgxz + +xsgkotfqldj +ltwmgjofxdsk + +sptmvzkdoxwqrefgn +zwa +ybwjzuchl + +jqdxzbhsctn +ocsat +tokewcs +usktc + +hqctliu +ilchptqu +quchitlj +lcuqtih +ipbqctulh + +wgihvaqrxpczsmflydjuket +mclinzpejdgtsfwqhyxkrvua + +sdgycjfmukezpx +bvwzqrmnti + +xoizphtv +mfzxhitopvag +hzipoxtv +rdtxiopvhz +hnvopxzti + +nluidsozya +sxcqziol + +vf +vf +fv +fv +vf + +x +x +mdtxr + +cspzldibokwq +bnktcpxzwlmeijqvd +pqkcyzhwbild + +zmdrvaxgtiq +jydtqgcm +dqgtxlm +fnxtegsmqrad +gkqmdtv + +zwulxhevg +jtwpxvdczlsh +znxlvhw +laozqhwrvgx +xmlvhfizw + +ixjseyvhfcupkz +jifehpsczxyvu +ixhvyweujozsmpfc +wpfskxljyceiuzhv +gydqfcphztjesirxuv + +bdolgwcua +cogbawu +ugabwco +obtcwagu +wcbuoga + +txjldzfwhbqcspemvgkiyn +kmdswhijztqfyclebvnpgx +szydcbewfnmvpxhijtqklg + +jfxehga +aoxhj +vuaozhjqxi +hxjqvia + +cyknepoazhsml +dhoecksznaylp +uktqnwrhivasbcxlepy +yshcfelankp + +mgbwxcvkrl +tzoauif +qpjntdoysueh + +n +n + +briatspxkzdwue +abdgifsljzuo + +vklpca +lkavpc + +lfxguyd +dzfuex + +zqxod +qxd +qdx +xhqude + +ovigcernldjwzy +idegzjvrwlyn + +cb +bc +rbcxdh +bc + +givtqeysrcjfzumod +isrgtyjavfwcoekdzmuq +zdgtmescqrvyiujfo +ogumbvzcdejyrtsiqf +qdfjsoetuvrymzcig + +fwruktphdzan +zkfpnrthwaud +unrhpzwtdafk + +odlubiyrqzfevnjpakwtgmx +lrsdjkauwbvztfymqginoxpe +omeqnvadjubzwkxritgyplf +fjzywpmkeaotldvguqbnixr + +emayzjxi +axzreyckm + +lduhiqwpjrnkto +ntcrjqdkwphloi +thjdwnklqirpo +tqpdwjilhoknr + +vi +iv +vir + +xoetdfmrbvl +dfebtomilx +fbltmdexo + +hmcuklq +lusqkch +iqjpulckh +suchkql + +gu +gu +gu +ugn +gu + +lvtfiecgrzxhm +tircajhne + +fm +if + +subio +buosi +boisu +busoi + +uwkhxabg +hofrviyqz +wkuhs + +zoswictnpdvjegqymbfura +cmrnqyupavzbfjegidtso +xpycanfhjrulqzvmtdbsegoi +iqdrfstyjgabzenpvckomu + +kzardg +dkzgura +zdagrk +gdrakz \ No newline at end of file diff --git a/2020/day7/day7.py b/2020/day7/day7.py new file mode 100644 index 0000000..0a49c32 --- /dev/null +++ b/2020/day7/day7.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python3 +import re +from collections import defaultdict, deque + + +def main(inp): + with open(inp) as input_rules: + rules = parse_rules(input_rules) + reverse_rules = build_reverse_rules(rules) + print(part1(reverse_rules)) + print(part2(rules, "shiny gold")) + + +def parse_rules(input_rules): + rules = {} + for input_rule in input_rules: + color, rule = input_rule.split(" bags contain ") + rules[color] = {color: int(number) for number, color in re.findall('(\d+) (\w+ \w+)', rule)} + return rules + + +def build_reverse_rules(rules): + reverse_rules = defaultdict(list) + for bag, inner_rules in rules.items(): + for c in inner_rules: + reverse_rules[c].append(bag) + return reverse_rules + + +def part1(reverse_rules): + queue = deque(("shiny gold",)) + may_contain_shiny_gold = set() + while queue: + color = queue.pop() + for c in reverse_rules.get(color, []): + if c not in may_contain_shiny_gold: + may_contain_shiny_gold.add(c) + queue.appendleft(c) + return len(may_contain_shiny_gold) + + +def part2(rules, color): + return sum(number + number * part2(rules, c) for c, number in rules[color].items()) + + +if __name__ == "__main__": + main("input.txt") diff --git a/2020/day7/input.txt b/2020/day7/input.txt new file mode 100644 index 0000000..e1380ca --- /dev/null +++ b/2020/day7/input.txt @@ -0,0 +1,594 @@ +pale cyan bags contain 2 posh black bags, 4 wavy gold bags, 2 vibrant brown bags. +dull lavender bags contain 3 pale tomato bags. +light red bags contain 3 wavy teal bags, 3 plaid aqua bags, 4 drab lavender bags, 2 bright coral bags. +wavy green bags contain 3 wavy indigo bags. +bright blue bags contain 5 vibrant tan bags. +dotted fuchsia bags contain 5 dark orange bags, 1 shiny coral bag. +pale tomato bags contain 2 bright magenta bags, 5 dull lime bags. +light black bags contain 1 posh lavender bag, 5 dotted gold bags, 4 faded bronze bags. +wavy turquoise bags contain 4 pale teal bags, 2 dim brown bags, 5 muted lime bags. +striped red bags contain 4 faded brown bags, 4 dotted purple bags. +wavy silver bags contain 5 muted chartreuse bags, 1 light silver bag, 3 striped silver bags. +posh lavender bags contain 5 striped silver bags, 3 wavy beige bags, 3 dim brown bags, 5 clear indigo bags. +pale maroon bags contain 1 striped white bag, 4 light blue bags. +drab turquoise bags contain 2 shiny tomato bags. +dark aqua bags contain 2 plaid silver bags. +vibrant coral bags contain 3 wavy lime bags, 2 shiny gold bags, 1 dotted orange bag, 3 muted indigo bags. +clear green bags contain 1 clear olive bag. +striped indigo bags contain 3 striped turquoise bags. +clear lime bags contain 3 mirrored green bags, 2 light tan bags. +drab bronze bags contain 5 plaid lavender bags, 1 muted yellow bag, 5 vibrant coral bags. +drab lavender bags contain 1 posh tomato bag, 4 muted salmon bags, 4 dull lime bags. +striped aqua bags contain 1 pale maroon bag. +wavy gray bags contain 3 light tan bags, 2 pale white bags, 2 bright magenta bags, 5 muted salmon bags. +faded aqua bags contain 1 plaid salmon bag, 4 dotted yellow bags. +drab cyan bags contain 1 posh tomato bag, 4 shiny turquoise bags. +vibrant blue bags contain no other bags. +light lime bags contain 3 vibrant purple bags. +clear gray bags contain 3 mirrored olive bags, 3 clear crimson bags, 5 dark orange bags, 2 dim gold bags. +bright magenta bags contain no other bags. +wavy purple bags contain 4 dim gold bags, 5 light green bags. +muted bronze bags contain 2 pale beige bags, 2 clear turquoise bags, 5 posh white bags, 1 wavy gray bag. +striped violet bags contain 1 light gold bag. +dull salmon bags contain 2 posh gray bags, 2 dotted blue bags. +striped orange bags contain 3 faded coral bags, 3 dotted lavender bags. +drab coral bags contain 1 wavy indigo bag, 1 dull black bag, 3 mirrored chartreuse bags. +plaid yellow bags contain 5 faded cyan bags. +dark maroon bags contain 2 mirrored silver bags, 5 muted salmon bags, 1 dull tomato bag. +dark yellow bags contain 1 drab maroon bag, 5 faded cyan bags, 4 clear indigo bags. +posh teal bags contain 3 vibrant maroon bags, 3 posh salmon bags. +mirrored black bags contain 1 drab fuchsia bag, 2 posh red bags. +drab salmon bags contain 2 dull plum bags. +muted green bags contain 4 plaid gray bags, 2 dim turquoise bags, 2 dull coral bags, 4 dim white bags. +bright indigo bags contain 1 bright turquoise bag, 4 dark beige bags. +wavy fuchsia bags contain 1 clear violet bag, 4 striped bronze bags, 1 mirrored indigo bag, 1 shiny cyan bag. +bright brown bags contain 5 dark purple bags. +dull turquoise bags contain 3 dim yellow bags, 2 dim indigo bags. +pale coral bags contain 4 posh indigo bags. +striped green bags contain 4 dull green bags, 5 dotted turquoise bags, 3 pale red bags, 2 dark gold bags. +faded maroon bags contain 3 dim green bags, 4 wavy purple bags. +vibrant lime bags contain 3 shiny fuchsia bags, 1 pale red bag, 1 vibrant bronze bag. +shiny plum bags contain 2 bright maroon bags, 5 dull tomato bags, 2 plaid salmon bags, 3 bright lime bags. +faded silver bags contain 1 posh turquoise bag, 5 posh white bags, 5 wavy lime bags, 3 shiny coral bags. +mirrored tomato bags contain 3 dotted tomato bags, 4 vibrant blue bags, 4 dull yellow bags, 5 clear chartreuse bags. +pale red bags contain 5 vibrant indigo bags, 4 vibrant red bags, 3 bright magenta bags, 3 dim indigo bags. +drab blue bags contain 2 bright magenta bags. +dim purple bags contain 4 drab lavender bags, 4 plaid yellow bags, 5 dull white bags, 3 clear white bags. +dim red bags contain 5 striped silver bags, 1 shiny red bag. +dim lime bags contain 5 plaid bronze bags, 5 drab salmon bags. +mirrored beige bags contain 3 bright tomato bags, 2 dull lime bags. +bright lime bags contain 5 clear chartreuse bags. +clear chartreuse bags contain 1 muted white bag, 1 vibrant bronze bag, 2 vibrant maroon bags, 4 clear lime bags. +dotted indigo bags contain 4 pale olive bags, 1 bright violet bag, 3 drab gray bags. +striped crimson bags contain 3 muted salmon bags. +plaid green bags contain 3 posh tomato bags. +dim brown bags contain 3 striped teal bags, 3 vibrant aqua bags, 3 plaid yellow bags. +faded turquoise bags contain 2 dim blue bags, 3 clear green bags, 3 striped bronze bags, 2 dim beige bags. +dotted coral bags contain 2 vibrant silver bags, 3 plaid crimson bags, 4 dull silver bags, 1 muted blue bag. +mirrored magenta bags contain 3 striped teal bags, 1 mirrored black bag, 4 shiny black bags. +shiny gray bags contain 3 bright magenta bags. +mirrored violet bags contain 5 drab blue bags, 5 dark brown bags. +dark beige bags contain 2 vibrant blue bags, 2 bright magenta bags, 1 dim indigo bag. +dark bronze bags contain 3 vibrant chartreuse bags, 2 posh turquoise bags, 4 faded aqua bags. +clear turquoise bags contain 1 mirrored green bag, 1 faded indigo bag, 4 shiny aqua bags, 4 dim tomato bags. +dark silver bags contain 5 posh purple bags, 4 dull silver bags. +dull tan bags contain 2 striped brown bags, 3 vibrant salmon bags, 1 drab gold bag. +mirrored gray bags contain 2 dim white bags, 4 muted white bags, 1 muted orange bag, 3 muted magenta bags. +faded black bags contain 3 faded aqua bags, 4 drab white bags, 2 dull lavender bags, 1 bright purple bag. +light fuchsia bags contain 3 pale magenta bags. +wavy lavender bags contain no other bags. +dull black bags contain 1 mirrored teal bag. +vibrant chartreuse bags contain 1 dull violet bag, 4 posh turquoise bags. +posh yellow bags contain 5 wavy gold bags. +shiny teal bags contain 2 drab salmon bags, 5 striped crimson bags. +plaid fuchsia bags contain 3 dim brown bags, 2 posh bronze bags, 1 striped aqua bag, 1 shiny chartreuse bag. +faded yellow bags contain 1 dotted tan bag, 3 dark coral bags. +mirrored orange bags contain 3 pale coral bags. +wavy indigo bags contain 5 shiny coral bags, 2 shiny yellow bags, 2 striped brown bags. +dotted salmon bags contain 1 drab turquoise bag, 1 vibrant lime bag, 3 dull chartreuse bags, 1 vibrant maroon bag. +dull magenta bags contain 3 shiny coral bags, 5 dull violet bags, 5 mirrored violet bags. +shiny tomato bags contain 1 dim salmon bag, 1 dim olive bag. +drab gold bags contain 3 drab maroon bags, 1 dotted black bag, 4 plaid orange bags. +bright yellow bags contain 4 muted teal bags, 1 faded maroon bag, 5 posh chartreuse bags, 5 plaid indigo bags. +dull plum bags contain 1 shiny salmon bag, 3 light tan bags. +posh gray bags contain 3 muted lime bags, 2 dotted green bags. +clear violet bags contain 5 vibrant maroon bags. +dotted bronze bags contain 3 light tan bags, 4 shiny yellow bags, 3 mirrored brown bags, 1 plaid yellow bag. +mirrored lime bags contain 2 bright teal bags, 2 dim gold bags, 2 dull tomato bags, 3 wavy green bags. +shiny indigo bags contain 3 dull silver bags, 2 dim cyan bags, 2 striped magenta bags. +vibrant crimson bags contain 2 light chartreuse bags. +dim magenta bags contain 5 plaid olive bags, 2 muted green bags, 4 bright crimson bags. +dim blue bags contain 1 bright silver bag, 2 shiny gray bags. +plaid teal bags contain 4 shiny aqua bags, 1 dull fuchsia bag, 4 bright lime bags. +dull teal bags contain 2 dotted black bags. +plaid gray bags contain 5 muted brown bags. +pale teal bags contain 5 striped olive bags, 1 dotted fuchsia bag, 3 dark teal bags, 2 dim purple bags. +clear beige bags contain 3 pale lime bags, 4 striped aqua bags, 3 mirrored red bags. +mirrored green bags contain 4 mirrored olive bags, 5 dim salmon bags, 4 vibrant bronze bags. +plaid aqua bags contain 2 pale white bags, 1 dull plum bag, 4 mirrored olive bags, 3 dim maroon bags. +pale aqua bags contain 5 bright salmon bags, 4 vibrant silver bags, 2 light orange bags. +plaid crimson bags contain 3 striped magenta bags. +mirrored red bags contain 5 dull coral bags, 5 pale yellow bags, 5 drab maroon bags, 2 dim gray bags. +pale black bags contain 1 light red bag, 4 faded teal bags. +dim turquoise bags contain 5 faded purple bags, 4 wavy fuchsia bags, 3 vibrant purple bags, 2 pale beige bags. +dim lavender bags contain 1 light blue bag. +pale gray bags contain 3 mirrored red bags, 5 light indigo bags. +clear magenta bags contain 5 bright gold bags, 5 dim lavender bags, 1 wavy lavender bag. +dull gold bags contain 4 dull fuchsia bags, 3 vibrant tan bags. +dim salmon bags contain 5 dull yellow bags, 4 pale beige bags. +drab magenta bags contain 2 vibrant salmon bags. +vibrant green bags contain 3 bright purple bags, 5 wavy brown bags, 5 dotted gray bags, 1 posh bronze bag. +dull brown bags contain 1 wavy tan bag, 1 shiny salmon bag. +clear white bags contain 5 bright lime bags, 3 light tan bags. +dotted lavender bags contain 5 wavy cyan bags, 2 dark indigo bags, 4 shiny gold bags. +dotted purple bags contain 5 dull teal bags, 3 shiny plum bags. +drab yellow bags contain 3 faded beige bags, 3 light silver bags. +dark orange bags contain 5 bright lime bags. +dotted cyan bags contain 1 vibrant lime bag, 1 wavy maroon bag, 2 dull tan bags, 5 shiny salmon bags. +posh indigo bags contain 5 dull yellow bags, 1 vibrant bronze bag. +dull chartreuse bags contain 2 wavy lavender bags, 5 vibrant blue bags. +posh blue bags contain 3 wavy maroon bags. +dim teal bags contain 3 muted turquoise bags, 1 vibrant black bag, 5 dotted tomato bags. +pale purple bags contain 1 striped olive bag. +drab chartreuse bags contain 1 clear orange bag, 2 plaid turquoise bags, 2 drab maroon bags. +plaid white bags contain 4 plaid indigo bags, 5 vibrant lime bags. +vibrant bronze bags contain 5 vibrant blue bags, 1 drab blue bag, 1 dull lime bag. +bright bronze bags contain 3 muted magenta bags, 3 dotted black bags, 1 pale lime bag, 2 dull violet bags. +dark indigo bags contain 3 bright maroon bags. +muted lavender bags contain 1 light white bag, 2 clear white bags, 2 posh white bags, 3 dim purple bags. +vibrant violet bags contain 5 dull magenta bags, 4 posh coral bags. +drab beige bags contain 2 plaid magenta bags, 2 muted bronze bags, 2 muted purple bags. +drab plum bags contain 4 mirrored tomato bags, 3 light lavender bags, 3 mirrored green bags, 5 muted salmon bags. +mirrored fuchsia bags contain 1 mirrored tomato bag, 5 dotted black bags, 2 posh white bags. +pale crimson bags contain 4 light plum bags. +dotted black bags contain 3 bright maroon bags. +wavy tomato bags contain 1 dim black bag, 5 vibrant coral bags, 1 mirrored purple bag. +bright aqua bags contain 5 pale lime bags, 3 striped teal bags. +vibrant purple bags contain 2 clear turquoise bags, 4 vibrant bronze bags, 1 dark lime bag, 3 clear crimson bags. +vibrant tan bags contain 4 posh black bags. +plaid turquoise bags contain 2 dotted violet bags, 5 mirrored plum bags. +dim violet bags contain 3 dotted orange bags. +bright tan bags contain 2 dark indigo bags, 4 faded purple bags, 4 dim blue bags. +muted chartreuse bags contain 4 dotted black bags, 5 mirrored tomato bags. +muted gold bags contain 2 wavy gray bags, 4 clear gold bags, 1 shiny gold bag. +dull indigo bags contain 3 mirrored maroon bags. +clear aqua bags contain 4 dim plum bags, 5 bright bronze bags. +muted maroon bags contain 1 striped crimson bag, 3 vibrant aqua bags. +muted blue bags contain 4 clear magenta bags, 4 pale bronze bags, 2 dull black bags, 4 striped olive bags. +drab aqua bags contain 3 faded crimson bags. +shiny olive bags contain 4 shiny salmon bags, 2 wavy plum bags, 4 pale bronze bags, 3 posh gold bags. +striped bronze bags contain 4 plaid olive bags, 4 plaid indigo bags, 1 pale white bag, 3 striped magenta bags. +mirrored gold bags contain 2 faded lavender bags. +faded blue bags contain 1 plaid bronze bag, 3 dim olive bags, 2 wavy crimson bags, 4 plaid silver bags. +plaid lime bags contain 2 dim yellow bags. +mirrored brown bags contain 4 light crimson bags. +plaid red bags contain 5 shiny aqua bags, 5 wavy lavender bags, 1 posh beige bag. +mirrored coral bags contain 4 mirrored lime bags, 5 muted orange bags, 5 dotted salmon bags, 1 faded purple bag. +mirrored olive bags contain 2 vibrant blue bags. +pale orange bags contain 4 wavy lime bags. +drab maroon bags contain 1 shiny yellow bag, 3 dull yellow bags, 1 wavy lavender bag, 2 dim salmon bags. +drab purple bags contain 5 bright tomato bags, 4 striped bronze bags, 2 bright chartreuse bags, 2 dark violet bags. +striped lime bags contain 5 posh turquoise bags, 1 dim purple bag. +wavy beige bags contain 5 shiny tomato bags, 3 drab lavender bags, 1 shiny orange bag. +bright gold bags contain 5 vibrant red bags, 1 shiny orange bag, 3 striped bronze bags. +muted magenta bags contain 4 light olive bags, 3 dotted tan bags. +dark lime bags contain 5 wavy lavender bags, 4 clear maroon bags, 2 striped beige bags, 4 plaid salmon bags. +pale silver bags contain 3 faded lavender bags, 2 dotted purple bags, 3 wavy crimson bags. +posh turquoise bags contain 5 dim yellow bags, 4 posh lime bags, 5 shiny orange bags. +shiny coral bags contain 2 dull tomato bags. +dim tomato bags contain 3 shiny aqua bags, 3 light cyan bags. +plaid tomato bags contain 3 faded indigo bags. +clear tan bags contain 3 mirrored indigo bags. +wavy maroon bags contain 1 dark silver bag. +drab teal bags contain 5 muted salmon bags, 4 plaid yellow bags, 4 bright red bags, 2 posh teal bags. +dim plum bags contain 5 posh salmon bags, 5 faded purple bags, 2 posh brown bags. +bright fuchsia bags contain 2 dark beige bags, 3 faded yellow bags. +clear silver bags contain 2 plaid tomato bags, 4 muted chartreuse bags. +shiny purple bags contain 5 muted lavender bags, 2 clear turquoise bags, 4 muted teal bags. +dark red bags contain 3 plaid plum bags, 2 dim indigo bags, 2 wavy gray bags. +dark white bags contain 4 muted bronze bags, 5 mirrored gold bags, 3 plaid lavender bags. +drab silver bags contain 1 dark gold bag, 3 muted white bags. +dark green bags contain 3 posh turquoise bags. +striped white bags contain 1 vibrant maroon bag, 1 shiny salmon bag. +striped lavender bags contain 1 light tomato bag, 5 light lime bags, 1 posh gold bag. +mirrored tan bags contain 2 posh fuchsia bags. +pale salmon bags contain 4 shiny blue bags. +dark black bags contain 1 dotted coral bag, 1 faded crimson bag, 4 drab violet bags, 5 clear chartreuse bags. +vibrant red bags contain 1 dim gold bag, 2 dull yellow bags, 1 faded brown bag, 4 light cyan bags. +pale turquoise bags contain 5 clear cyan bags. +bright olive bags contain 1 clear turquoise bag, 4 bright teal bags, 3 striped maroon bags, 1 striped gold bag. +shiny green bags contain 5 dim lime bags, 3 wavy brown bags, 2 faded magenta bags, 5 drab maroon bags. +vibrant tomato bags contain 3 striped plum bags, 2 vibrant maroon bags, 4 muted silver bags, 3 striped chartreuse bags. +vibrant yellow bags contain 3 pale beige bags, 4 dim orange bags, 4 dotted cyan bags. +muted aqua bags contain 3 vibrant purple bags. +dull orange bags contain 2 striped gray bags, 3 vibrant bronze bags, 2 bright turquoise bags. +wavy cyan bags contain 2 drab maroon bags, 4 shiny aqua bags, 5 clear lime bags. +faded tan bags contain 3 muted turquoise bags, 2 plaid purple bags, 3 clear crimson bags. +light maroon bags contain 5 wavy chartreuse bags, 3 mirrored silver bags, 5 muted plum bags, 2 mirrored blue bags. +shiny lavender bags contain 1 dark silver bag, 5 clear teal bags, 5 dark red bags, 4 faded red bags. +striped fuchsia bags contain 4 clear gold bags, 3 bright magenta bags, 3 bright aqua bags. +striped plum bags contain 4 bright lime bags, 5 dotted black bags, 5 drab beige bags. +dotted red bags contain 4 dim gold bags, 3 dim indigo bags, 4 striped olive bags, 5 dim white bags. +mirrored chartreuse bags contain 5 posh tomato bags. +dim white bags contain 5 clear maroon bags. +muted black bags contain 2 posh turquoise bags, 3 clear lavender bags, 2 shiny aqua bags, 2 pale red bags. +muted silver bags contain 4 striped white bags, 5 dotted tomato bags, 4 mirrored fuchsia bags, 2 clear maroon bags. +dotted lime bags contain 1 muted aqua bag, 3 mirrored tan bags. +faded chartreuse bags contain 4 vibrant violet bags, 5 faded magenta bags, 5 dim teal bags, 2 dim green bags. +light turquoise bags contain 1 dotted purple bag. +plaid cyan bags contain 1 bright magenta bag, 2 wavy chartreuse bags, 5 vibrant silver bags, 3 pale crimson bags. +dull maroon bags contain 5 dim black bags. +wavy violet bags contain 1 faded yellow bag. +vibrant teal bags contain 5 dim lime bags, 2 vibrant gold bags, 2 dim beige bags. +pale fuchsia bags contain 3 striped olive bags. +light brown bags contain 3 shiny chartreuse bags, 2 wavy purple bags. +dull green bags contain 3 striped orange bags, 2 posh indigo bags, 3 faded blue bags. +dark blue bags contain 5 striped magenta bags, 3 striped gray bags, 4 pale coral bags. +mirrored lavender bags contain 3 posh black bags. +shiny brown bags contain 5 dotted magenta bags, 4 dim chartreuse bags, 1 posh cyan bag. +muted brown bags contain 3 dull black bags, 3 pale maroon bags, 5 posh brown bags, 2 striped gray bags. +faded orange bags contain 1 dark orange bag. +muted fuchsia bags contain 3 plaid salmon bags. +clear plum bags contain 3 shiny red bags, 4 dim silver bags. +bright coral bags contain 4 pale yellow bags, 2 muted magenta bags, 2 bright chartreuse bags, 3 light olive bags. +muted coral bags contain 4 striped green bags. +drab olive bags contain 3 shiny salmon bags, 4 clear cyan bags. +dim silver bags contain 2 shiny plum bags. +wavy plum bags contain 3 mirrored fuchsia bags, 5 pale maroon bags, 5 posh salmon bags. +plaid coral bags contain 1 mirrored gold bag. +posh beige bags contain 3 mirrored maroon bags, 3 drab chartreuse bags, 3 dark salmon bags, 1 clear green bag. +drab green bags contain 1 bright teal bag, 3 muted chartreuse bags. +bright crimson bags contain 3 striped orange bags, 4 wavy plum bags. +posh chartreuse bags contain 5 clear white bags, 3 light red bags. +dim gray bags contain 1 mirrored fuchsia bag, 3 muted teal bags, 4 clear maroon bags, 5 striped white bags. +striped brown bags contain 2 muted orange bags. +dim tan bags contain 3 clear gold bags, 5 clear salmon bags, 2 dark chartreuse bags. +striped magenta bags contain 2 plaid indigo bags, 5 drab lavender bags, 2 dotted fuchsia bags, 4 shiny aqua bags. +dotted violet bags contain 3 dull tomato bags. +dotted tan bags contain 1 dark orange bag, 2 drab blue bags. +shiny beige bags contain 1 drab gold bag. +light plum bags contain 5 plaid tomato bags, 5 wavy gray bags, 1 dull tomato bag. +muted indigo bags contain 3 dim salmon bags. +clear red bags contain 3 mirrored beige bags. +mirrored silver bags contain 2 wavy plum bags, 4 vibrant magenta bags. +dark lavender bags contain 2 wavy violet bags, 5 muted green bags, 2 dim purple bags. +clear teal bags contain 4 wavy crimson bags. +light purple bags contain 5 faded black bags. +light salmon bags contain 3 vibrant beige bags, 3 striped white bags, 5 pale magenta bags, 5 muted blue bags. +dull gray bags contain 5 dim lavender bags. +posh aqua bags contain 1 light olive bag, 4 mirrored purple bags, 4 vibrant gold bags, 1 shiny aqua bag. +pale chartreuse bags contain 5 faded indigo bags. +striped cyan bags contain 1 shiny olive bag, 3 bright tomato bags, 1 faded beige bag. +clear coral bags contain 5 clear violet bags, 1 plaid tomato bag. +bright cyan bags contain 3 mirrored violet bags, 5 plaid magenta bags, 4 vibrant bronze bags. +posh tomato bags contain 3 shiny aqua bags, 1 pale beige bag. +bright lavender bags contain 4 clear beige bags, 2 faded lavender bags, 3 faded aqua bags, 5 pale purple bags. +dotted teal bags contain 5 plaid salmon bags, 1 posh turquoise bag, 2 muted silver bags. +clear tomato bags contain 5 bright indigo bags. +dotted silver bags contain 2 mirrored indigo bags. +plaid plum bags contain 4 light crimson bags. +wavy magenta bags contain 2 posh indigo bags, 2 vibrant indigo bags. +dull tomato bags contain 4 dull lime bags, 4 faded brown bags. +vibrant black bags contain 5 light crimson bags, 5 pale lavender bags, 3 dull blue bags, 2 pale coral bags. +pale bronze bags contain 3 vibrant violet bags. +wavy lime bags contain 5 shiny yellow bags, 2 pale white bags, 1 clear gold bag, 5 mirrored chartreuse bags. +striped gray bags contain 3 shiny tomato bags, 3 dull coral bags, 1 shiny aqua bag, 2 dark orange bags. +faded crimson bags contain 4 pale white bags, 3 muted bronze bags, 2 posh blue bags, 3 bright coral bags. +wavy orange bags contain 2 shiny indigo bags. +dotted white bags contain 1 striped tan bag, 4 bright silver bags, 1 shiny fuchsia bag, 3 posh gray bags. +posh bronze bags contain 4 muted silver bags, 1 light lavender bag. +dotted magenta bags contain 5 clear fuchsia bags, 4 faded indigo bags, 3 dull turquoise bags, 4 muted orange bags. +dull cyan bags contain 3 clear teal bags, 3 dim white bags, 3 dull tomato bags, 5 vibrant purple bags. +clear gold bags contain 4 dim gold bags, 3 dull lime bags, 4 faded brown bags, 4 wavy gray bags. +bright beige bags contain 3 dull cyan bags, 4 bright indigo bags, 2 dull lime bags. +clear orange bags contain 5 shiny salmon bags. +plaid silver bags contain 5 dotted purple bags, 1 dim maroon bag, 3 muted gold bags. +shiny white bags contain 1 light brown bag, 1 mirrored lime bag. +dark gray bags contain 5 shiny cyan bags, 2 drab tomato bags. +drab white bags contain 4 shiny tomato bags, 3 shiny gold bags, 3 dull lime bags, 3 plaid orange bags. +vibrant cyan bags contain 2 wavy purple bags, 4 light gold bags, 1 pale indigo bag, 2 striped fuchsia bags. +shiny yellow bags contain 4 shiny aqua bags, 2 dim salmon bags, 3 posh tomato bags, 5 muted salmon bags. +posh coral bags contain 2 striped gray bags, 4 dark orange bags, 5 posh magenta bags. +clear salmon bags contain 4 posh yellow bags, 2 pale violet bags, 3 mirrored violet bags. +posh olive bags contain 2 mirrored red bags, 3 faded gold bags. +faded fuchsia bags contain 5 bright gold bags, 3 pale tomato bags, 2 dotted bronze bags, 1 mirrored green bag. +striped maroon bags contain 4 posh maroon bags, 4 dim indigo bags, 5 shiny aqua bags, 4 posh lime bags. +dark violet bags contain 5 plaid tomato bags, 3 bright lime bags, 4 light lavender bags, 4 dark brown bags. +dim maroon bags contain 1 dark beige bag, 4 wavy gray bags, 5 shiny coral bags, 1 pale white bag. +wavy crimson bags contain 1 light tan bag, 5 dark beige bags. +plaid magenta bags contain 1 shiny turquoise bag, 1 dark lime bag, 5 dim salmon bags. +clear indigo bags contain 4 muted maroon bags. +clear olive bags contain 5 mirrored teal bags, 1 plaid lime bag, 3 dull magenta bags, 5 wavy gray bags. +mirrored white bags contain 3 pale gold bags. +wavy blue bags contain 1 dotted aqua bag, 5 dark green bags. +faded cyan bags contain 4 wavy gray bags, 5 vibrant bronze bags, 1 mirrored olive bag, 3 drab blue bags. +faded gray bags contain 2 drab brown bags, 4 dotted coral bags, 5 dim turquoise bags, 1 mirrored maroon bag. +dim coral bags contain 5 shiny olive bags, 3 light plum bags. +vibrant fuchsia bags contain 5 shiny chartreuse bags, 5 wavy bronze bags, 2 bright red bags. +dotted tomato bags contain 5 faded indigo bags, 3 vibrant maroon bags, 4 shiny coral bags. +faded salmon bags contain 3 dull silver bags, 2 wavy bronze bags, 2 drab teal bags. +vibrant orange bags contain 1 dotted beige bag. +muted violet bags contain 5 posh lime bags. +striped tan bags contain 3 muted lime bags. +drab violet bags contain 3 vibrant chartreuse bags, 5 posh turquoise bags, 1 bright cyan bag. +bright purple bags contain 2 vibrant bronze bags, 3 wavy beige bags, 2 plaid bronze bags. +vibrant maroon bags contain no other bags. +muted teal bags contain 2 bright turquoise bags. +bright plum bags contain 5 dark gold bags, 2 shiny turquoise bags, 1 dull yellow bag. +shiny crimson bags contain 3 wavy magenta bags. +wavy teal bags contain 5 faded indigo bags, 4 dotted gray bags, 3 pale chartreuse bags, 3 vibrant coral bags. +shiny blue bags contain 2 shiny salmon bags, 4 light tan bags, 1 dim salmon bag. +mirrored maroon bags contain 1 drab fuchsia bag, 3 dotted green bags, 3 muted white bags. +clear maroon bags contain 2 vibrant red bags, 5 bright maroon bags, 4 light olive bags. +bright salmon bags contain 1 dotted red bag, 4 vibrant beige bags, 3 dark maroon bags, 3 clear lavender bags. +pale gold bags contain 3 plaid olive bags. +faded lime bags contain 3 faded maroon bags, 5 mirrored aqua bags. +faded magenta bags contain 4 plaid orange bags, 5 vibrant violet bags, 1 dotted green bag, 3 wavy crimson bags. +wavy aqua bags contain 5 drab yellow bags, 5 posh bronze bags. +faded brown bags contain 3 mirrored green bags, 5 dim salmon bags, 4 vibrant blue bags, 1 wavy gray bag. +dark purple bags contain 4 pale beige bags, 3 drab lavender bags. +dull lime bags contain no other bags. +light orange bags contain 1 vibrant white bag, 1 striped magenta bag. +mirrored plum bags contain 1 clear green bag, 4 faded blue bags. +vibrant brown bags contain 4 dark crimson bags, 5 light plum bags. +shiny turquoise bags contain 1 dark lime bag. +dark plum bags contain 2 wavy coral bags, 2 striped gray bags, 4 muted blue bags, 2 dull aqua bags. +shiny red bags contain 1 plaid gray bag, 4 wavy beige bags, 5 dark red bags. +posh violet bags contain 5 striped chartreuse bags, 2 pale maroon bags, 1 dull lime bag. +light silver bags contain 2 clear silver bags, 1 dark indigo bag, 2 dim salmon bags, 2 drab salmon bags. +plaid orange bags contain 4 dim gold bags, 2 bright magenta bags, 4 drab lavender bags. +vibrant silver bags contain 5 posh plum bags, 3 vibrant aqua bags, 2 light lavender bags. +faded tomato bags contain 1 pale coral bag, 2 posh gold bags. +shiny silver bags contain 4 faded orange bags, 1 striped white bag, 2 faded turquoise bags, 5 striped gray bags. +plaid purple bags contain 2 posh olive bags, 3 pale maroon bags, 3 pale gold bags, 1 faded white bag. +light tomato bags contain 2 vibrant indigo bags, 4 dark orange bags, 5 muted bronze bags, 4 plaid tomato bags. +dull aqua bags contain 5 bright lime bags. +drab red bags contain 5 posh teal bags. +dotted gray bags contain 2 vibrant salmon bags, 4 mirrored chartreuse bags, 1 dotted tomato bag, 4 posh magenta bags. +dull bronze bags contain 3 mirrored brown bags. +shiny aqua bags contain no other bags. +dim gold bags contain no other bags. +pale blue bags contain 4 posh gray bags. +faded purple bags contain 5 shiny blue bags, 5 plaid salmon bags, 4 pale tomato bags, 2 dark gold bags. +striped teal bags contain 4 mirrored green bags. +shiny orange bags contain 4 faded lavender bags, 2 muted salmon bags, 2 dim indigo bags. +wavy yellow bags contain 5 clear silver bags, 2 shiny brown bags. +vibrant turquoise bags contain 1 vibrant magenta bag, 4 dull fuchsia bags, 5 mirrored green bags. +dark teal bags contain 5 dim tomato bags. +posh brown bags contain 3 dark orange bags. +vibrant gray bags contain 2 dark beige bags, 2 wavy teal bags, 3 light purple bags. +drab black bags contain 1 mirrored maroon bag, 3 pale silver bags, 3 dark brown bags, 1 shiny gray bag. +light blue bags contain 2 dim olive bags, 2 striped magenta bags. +muted turquoise bags contain 3 dim lime bags, 3 shiny coral bags. +faded red bags contain 5 clear gray bags. +bright chartreuse bags contain 4 plaid teal bags, 5 drab salmon bags, 5 wavy cyan bags. +light magenta bags contain 5 light aqua bags, 4 light crimson bags, 3 dark yellow bags, 1 light tomato bag. +striped coral bags contain 3 mirrored white bags. +shiny maroon bags contain 1 vibrant red bag, 3 bright red bags. +striped yellow bags contain 1 bright orange bag, 2 faded plum bags, 3 light olive bags, 3 shiny aqua bags. +dull olive bags contain 2 posh fuchsia bags, 2 dull coral bags, 2 faded red bags. +dotted yellow bags contain 1 drab salmon bag, 3 pale fuchsia bags. +light bronze bags contain 3 drab cyan bags, 5 mirrored orange bags, 4 plaid crimson bags. +shiny chartreuse bags contain 1 wavy cyan bag, 4 shiny tomato bags. +dull yellow bags contain no other bags. +faded plum bags contain 5 vibrant blue bags, 5 clear indigo bags, 5 posh teal bags, 4 posh plum bags. +wavy salmon bags contain 4 striped teal bags, 3 wavy tan bags, 1 clear white bag. +posh salmon bags contain 4 dull chartreuse bags, 4 shiny yellow bags, 2 dotted black bags, 3 clear lime bags. +dull white bags contain 2 dim olive bags, 4 vibrant bronze bags, 4 faded cyan bags. +shiny gold bags contain 5 bright maroon bags, 5 shiny aqua bags, 2 clear lime bags, 2 muted white bags. +posh plum bags contain 4 posh purple bags, 2 wavy beige bags, 5 plaid plum bags. +shiny magenta bags contain 4 shiny tan bags, 2 dull green bags, 3 mirrored purple bags. +wavy olive bags contain 4 vibrant olive bags, 2 clear fuchsia bags, 1 light plum bag, 2 dark violet bags. +muted lime bags contain 4 posh white bags, 4 shiny tomato bags. +light indigo bags contain 2 clear turquoise bags, 3 vibrant black bags, 3 striped lime bags. +muted yellow bags contain 3 mirrored tomato bags. +faded beige bags contain 5 clear red bags, 3 dull brown bags, 4 dark red bags, 1 vibrant magenta bag. +striped turquoise bags contain 2 bright aqua bags, 5 dim cyan bags, 1 pale lavender bag. +pale beige bags contain no other bags. +dull silver bags contain 3 bright lime bags, 2 pale tomato bags, 3 mirrored green bags. +clear cyan bags contain 1 vibrant blue bag, 2 faded cyan bags, 1 faded brown bag. +posh green bags contain 2 vibrant gray bags, 1 pale magenta bag. +muted beige bags contain 2 drab blue bags, 3 vibrant magenta bags, 5 pale tomato bags. +bright silver bags contain 4 dull brown bags, 4 vibrant violet bags, 4 dim violet bags. +mirrored bronze bags contain 2 bright indigo bags, 3 shiny coral bags. +dull red bags contain 4 dull plum bags, 1 striped black bag, 1 dim teal bag, 4 dim white bags. +dim chartreuse bags contain 3 drab maroon bags. +drab crimson bags contain 5 dull turquoise bags, 3 posh gold bags, 4 bright gold bags, 2 muted indigo bags. +wavy brown bags contain 1 muted white bag. +plaid violet bags contain 2 faded tomato bags. +muted salmon bags contain 1 light cyan bag, 1 vibrant blue bag. +mirrored salmon bags contain 1 dotted green bag, 2 plaid salmon bags. +posh lime bags contain 1 vibrant blue bag. +shiny tan bags contain 2 bright red bags, 1 dim maroon bag, 3 vibrant salmon bags. +vibrant aqua bags contain 5 shiny orange bags, 2 dull coral bags, 4 vibrant bronze bags, 5 dark indigo bags. +posh magenta bags contain 5 dim maroon bags, 2 wavy indigo bags. +posh red bags contain 4 dull black bags, 2 shiny tomato bags, 4 faded beige bags. +mirrored indigo bags contain 4 faded magenta bags, 1 light red bag, 3 muted gray bags, 2 plaid lavender bags. +drab indigo bags contain 4 dull tan bags, 2 dark coral bags. +vibrant lavender bags contain 5 posh turquoise bags, 4 posh bronze bags, 5 light tomato bags. +mirrored blue bags contain 1 striped bronze bag, 4 plaid salmon bags, 3 posh lime bags, 4 mirrored green bags. +plaid blue bags contain 4 bright violet bags, 5 clear red bags. +dark tan bags contain 3 faded chartreuse bags, 1 posh gold bag, 5 light chartreuse bags. +bright teal bags contain 3 pale yellow bags, 1 vibrant white bag, 3 shiny salmon bags, 1 plaid indigo bag. +dark gold bags contain 1 mirrored green bag. +plaid beige bags contain 5 dim cyan bags. +pale plum bags contain 4 striped olive bags, 1 mirrored violet bag. +drab orange bags contain 1 plaid cyan bag, 2 vibrant green bags, 4 striped crimson bags, 2 posh teal bags. +faded teal bags contain 4 muted salmon bags, 1 dim tomato bag, 5 clear white bags. +posh cyan bags contain 3 shiny gray bags, 2 posh indigo bags. +plaid tan bags contain 4 plaid silver bags, 2 dark beige bags, 3 plaid salmon bags, 5 light beige bags. +muted olive bags contain 5 vibrant salmon bags, 2 dull orange bags. +muted tan bags contain 5 wavy gold bags, 2 striped orange bags, 4 plaid lavender bags. +posh tan bags contain 3 shiny lavender bags, 5 vibrant red bags, 4 light bronze bags. +bright tomato bags contain 3 dull lime bags, 3 wavy gray bags. +dark turquoise bags contain 3 vibrant coral bags, 4 wavy beige bags. +faded indigo bags contain 4 wavy gray bags. +clear blue bags contain 2 pale yellow bags. +light gold bags contain 5 light olive bags, 4 clear white bags, 3 plaid silver bags, 2 bright maroon bags. +light lavender bags contain 2 dotted black bags, 4 plaid tomato bags, 4 dark orange bags, 5 shiny blue bags. +faded coral bags contain 5 pale gold bags, 4 dull black bags. +vibrant salmon bags contain 2 faded teal bags, 4 drab lavender bags, 5 clear teal bags, 1 dim olive bag. +muted orange bags contain 1 posh salmon bag, 2 light cyan bags, 5 shiny tomato bags, 4 dim olive bags. +clear black bags contain 3 wavy bronze bags, 4 wavy lime bags, 4 shiny black bags. +pale violet bags contain 1 faded violet bag, 3 pale chartreuse bags, 5 drab blue bags. +dotted plum bags contain 2 muted chartreuse bags, 3 vibrant turquoise bags, 5 posh brown bags. +plaid maroon bags contain 1 posh coral bag, 1 dull fuchsia bag. +dotted brown bags contain 1 posh lime bag, 5 dull turquoise bags. +pale green bags contain 3 drab magenta bags, 4 dim salmon bags, 1 vibrant chartreuse bag. +dark tomato bags contain 2 clear indigo bags, 1 light plum bag, 2 dull turquoise bags. +striped silver bags contain 5 dark red bags, 4 faded purple bags. +shiny fuchsia bags contain 2 dark gold bags, 3 dull tomato bags. +mirrored aqua bags contain 5 dark bronze bags. +dim beige bags contain 5 dull white bags. +dark chartreuse bags contain 4 light crimson bags, 3 dim salmon bags, 2 dark orange bags. +plaid chartreuse bags contain 4 drab blue bags. +dim green bags contain 4 muted bronze bags, 1 shiny indigo bag. +mirrored crimson bags contain 5 wavy fuchsia bags, 2 vibrant magenta bags. +clear yellow bags contain 3 plaid bronze bags, 1 light tan bag. +bright turquoise bags contain 3 shiny salmon bags. +drab brown bags contain 1 vibrant fuchsia bag. +dim bronze bags contain 2 dim aqua bags, 4 dim beige bags. +dim black bags contain 1 posh purple bag, 4 mirrored bronze bags, 5 posh plum bags. +plaid gold bags contain 4 posh silver bags, 5 light turquoise bags, 3 vibrant black bags. +drab lime bags contain 1 muted gold bag, 4 dotted red bags. +bright red bags contain 1 dull yellow bag, 4 mirrored gold bags. +vibrant white bags contain 2 dull lime bags, 2 faded indigo bags, 1 faded brown bag, 1 muted salmon bag. +drab fuchsia bags contain 3 pale beige bags, 3 dark orange bags. +striped tomato bags contain 1 dark lime bag, 5 dull coral bags. +faded green bags contain 2 wavy blue bags. +vibrant olive bags contain 3 bright tomato bags, 4 wavy beige bags. +dark coral bags contain 5 faded teal bags, 1 mirrored tomato bag, 3 dark orange bags, 5 plaid lime bags. +bright violet bags contain 4 dark lime bags. +wavy tan bags contain 4 light tan bags, 3 vibrant red bags, 2 mirrored olive bags. +dotted beige bags contain 5 striped gray bags, 4 posh plum bags, 1 bright turquoise bag, 4 striped fuchsia bags. +dotted turquoise bags contain 3 mirrored green bags, 4 posh gold bags, 5 drab plum bags. +striped beige bags contain 1 clear gold bag, 1 vibrant white bag, 3 faded cyan bags, 2 shiny gold bags. +posh silver bags contain 2 vibrant gold bags, 2 mirrored violet bags. +mirrored purple bags contain 2 dim yellow bags, 2 dull tomato bags. +shiny lime bags contain 4 clear olive bags, 4 mirrored silver bags, 1 muted tomato bag. +muted cyan bags contain 1 posh coral bag, 5 drab blue bags, 4 wavy lavender bags. +light aqua bags contain 1 dark orange bag. +shiny cyan bags contain 2 dark maroon bags, 5 shiny salmon bags, 5 muted salmon bags, 2 wavy bronze bags. +posh white bags contain 1 posh fuchsia bag. +vibrant plum bags contain 4 light crimson bags. +dotted blue bags contain 1 shiny tan bag, 3 light plum bags, 5 dotted gray bags. +posh maroon bags contain 5 mirrored violet bags. +dull violet bags contain 1 faded teal bag, 2 wavy cyan bags, 3 dull silver bags, 3 vibrant red bags. +posh gold bags contain 4 muted salmon bags, 4 dull plum bags, 3 muted bronze bags. +dim orange bags contain 2 dull coral bags. +dim aqua bags contain 1 drab maroon bag. +striped salmon bags contain 4 muted white bags. +dark cyan bags contain 3 plaid maroon bags. +wavy red bags contain 2 wavy maroon bags, 2 vibrant chartreuse bags, 5 wavy salmon bags. +light yellow bags contain 4 posh lime bags, 1 light white bag. +striped blue bags contain 5 plaid magenta bags, 5 vibrant gold bags. +dark olive bags contain 4 dim maroon bags, 2 shiny tan bags, 5 wavy green bags. +vibrant gold bags contain 1 dull beige bag, 4 posh turquoise bags. +muted white bags contain 1 dim indigo bag, 5 dull lime bags, 5 shiny aqua bags. +light violet bags contain 5 wavy bronze bags. +pale olive bags contain 1 dim gold bag, 2 shiny coral bags. +light gray bags contain 3 bright gold bags. +dim indigo bags contain 3 posh tomato bags, 5 pale tomato bags, 4 shiny aqua bags. +pale indigo bags contain 4 pale bronze bags, 5 light chartreuse bags. +muted red bags contain 3 clear white bags, 4 dull lavender bags, 5 muted purple bags. +plaid olive bags contain 3 dark orange bags, 3 dim gold bags. +dotted maroon bags contain 3 faded purple bags, 5 light green bags. +bright orange bags contain 1 shiny black bag, 2 dim lavender bags, 1 shiny olive bag. +wavy chartreuse bags contain 3 clear lime bags, 4 pale maroon bags. +mirrored turquoise bags contain 2 striped crimson bags, 4 vibrant bronze bags, 5 dotted lavender bags, 2 clear silver bags. +dull purple bags contain 4 posh crimson bags. +faded bronze bags contain 1 clear fuchsia bag, 2 light fuchsia bags, 2 pale chartreuse bags. +clear bronze bags contain 3 pale chartreuse bags, 5 dull tan bags, 1 vibrant tan bag. +vibrant magenta bags contain 4 shiny fuchsia bags, 2 shiny coral bags, 3 faded indigo bags, 4 pale tomato bags. +striped chartreuse bags contain 2 shiny orange bags, 3 mirrored tomato bags, 1 clear lime bag. +dotted green bags contain 1 pale beige bag, 2 mirrored bronze bags, 2 wavy crimson bags. +wavy white bags contain 3 posh magenta bags, 3 muted yellow bags, 3 wavy crimson bags, 4 vibrant olive bags. +muted plum bags contain 4 wavy gold bags. +faded violet bags contain 3 dark violet bags. +dull fuchsia bags contain 4 plaid indigo bags, 1 mirrored brown bag, 5 clear lime bags. +bright green bags contain 3 mirrored white bags, 5 dotted silver bags. +shiny violet bags contain 4 striped salmon bags. +dim fuchsia bags contain 3 striped red bags. +faded lavender bags contain 3 wavy tan bags, 2 clear lime bags. +dim cyan bags contain 4 drab white bags. +dark brown bags contain 5 clear gold bags, 3 vibrant blue bags. +clear lavender bags contain 5 striped turquoise bags, 1 light crimson bag, 5 light tan bags, 2 muted gold bags. +light green bags contain 3 striped silver bags, 4 bright silver bags, 2 light crimson bags. +pale lavender bags contain 5 clear violet bags. +dotted orange bags contain 3 dotted tomato bags, 2 dull plum bags, 5 posh purple bags, 2 drab turquoise bags. +bright black bags contain 3 posh chartreuse bags, 5 wavy indigo bags, 5 dull crimson bags, 2 clear turquoise bags. +dotted gold bags contain 5 striped white bags, 2 striped brown bags, 3 mirrored green bags, 3 dark violet bags. +plaid brown bags contain 3 striped chartreuse bags, 3 striped black bags, 2 bright chartreuse bags. +wavy coral bags contain 3 dim turquoise bags, 4 dim lime bags. +pale brown bags contain 4 dim white bags, 5 bright fuchsia bags, 2 clear orange bags. +mirrored teal bags contain 4 pale lavender bags, 5 vibrant maroon bags, 4 striped gray bags, 4 vibrant indigo bags. +posh orange bags contain 5 posh magenta bags, 4 posh violet bags, 2 plaid magenta bags, 4 muted cyan bags. +dim crimson bags contain 3 drab violet bags, 1 dotted aqua bag. +muted gray bags contain 4 vibrant lime bags, 1 dark maroon bag, 2 clear gold bags, 3 plaid gray bags. +clear brown bags contain 5 shiny tomato bags, 4 striped tan bags, 5 vibrant lavender bags, 1 pale white bag. +posh crimson bags contain 3 dim yellow bags, 4 shiny turquoise bags, 2 vibrant purple bags, 4 mirrored aqua bags. +plaid black bags contain 2 shiny tan bags, 1 pale olive bag, 2 wavy tan bags, 1 clear red bag. +dark crimson bags contain 3 drab fuchsia bags, 5 faded gold bags. +pale tan bags contain 5 posh black bags. +wavy bronze bags contain 1 clear lime bag. +wavy gold bags contain 2 dull lavender bags, 1 bright turquoise bag, 4 striped brown bags, 5 drab turquoise bags. +pale lime bags contain 2 faded cyan bags, 4 muted salmon bags, 4 shiny coral bags, 3 mirrored green bags. +dark magenta bags contain 4 faded chartreuse bags, 1 muted brown bag, 4 vibrant salmon bags, 2 dim indigo bags. +striped purple bags contain 3 mirrored olive bags. +dull crimson bags contain 2 clear orange bags. +dull beige bags contain 1 drab turquoise bag, 1 dark indigo bag, 1 dull white bag. +dotted aqua bags contain 4 dull chartreuse bags. +clear purple bags contain 2 muted beige bags, 3 dull black bags. +light crimson bags contain 1 faded brown bag, 1 vibrant red bag, 4 wavy lavender bags, 1 wavy gray bag. +clear fuchsia bags contain 1 dark maroon bag, 3 muted salmon bags. +muted crimson bags contain 5 light lime bags, 4 posh plum bags, 5 clear fuchsia bags, 1 wavy turquoise bag. +muted purple bags contain 3 dull gray bags, 5 posh gray bags. +shiny salmon bags contain 5 faded brown bags, 4 clear chartreuse bags. +plaid lavender bags contain 1 dim lime bag. +vibrant indigo bags contain 5 dim tomato bags, 2 striped beige bags, 2 mirrored olive bags. +mirrored cyan bags contain 3 plaid coral bags, 5 faded teal bags, 5 pale indigo bags, 3 bright fuchsia bags. +dim yellow bags contain 5 light crimson bags, 1 pale tomato bag. +dotted chartreuse bags contain 3 shiny blue bags. +light beige bags contain 3 bright teal bags, 1 pale tomato bag, 2 light blue bags. +dotted olive bags contain 3 bright indigo bags, 4 muted fuchsia bags. +pale white bags contain 1 vibrant maroon bag, 2 pale tomato bags, 2 bright magenta bags. +mirrored yellow bags contain 2 drab brown bags, 3 striped salmon bags, 4 clear olive bags, 1 dotted black bag. +light olive bags contain 2 bright magenta bags. +muted tomato bags contain 4 shiny lavender bags. +light chartreuse bags contain 5 light plum bags, 4 light olive bags, 3 dark indigo bags. +posh purple bags contain 2 wavy crimson bags. +bright maroon bags contain 4 faded indigo bags. +dull blue bags contain 3 dark brown bags, 3 dim indigo bags, 5 pale silver bags, 1 mirrored brown bag. +light coral bags contain 5 clear teal bags. +bright gray bags contain 3 muted black bags, 3 vibrant cyan bags. +posh fuchsia bags contain 3 clear gold bags, 1 dim salmon bag, 2 shiny salmon bags. +light white bags contain 3 dim cyan bags, 5 clear crimson bags, 3 dull fuchsia bags. +light teal bags contain 3 shiny fuchsia bags, 2 muted white bags, 3 shiny black bags. +plaid salmon bags contain 2 dotted black bags, 2 dark beige bags, 1 shiny coral bag. +wavy black bags contain 5 posh olive bags. +drab gray bags contain 3 mirrored tomato bags, 3 light crimson bags. +dim olive bags contain 5 clear chartreuse bags. +bright white bags contain 2 mirrored tan bags, 1 pale green bag, 5 dull magenta bags, 5 plaid lime bags. +striped olive bags contain 3 muted gold bags. +faded olive bags contain 1 muted indigo bag. +pale yellow bags contain 5 light olive bags, 5 plaid aqua bags, 1 clear white bag, 5 faded purple bags. +dull coral bags contain 4 light crimson bags, 5 shiny aqua bags, 5 wavy cyan bags, 3 dark beige bags. +vibrant beige bags contain 4 striped olive bags, 5 clear gold bags. +dark fuchsia bags contain 1 pale teal bag, 4 dull gray bags. +drab tomato bags contain 4 mirrored white bags. +clear crimson bags contain 4 pale tomato bags, 3 wavy gray bags, 4 drab blue bags, 1 mirrored olive bag. +dotted crimson bags contain 1 plaid crimson bag, 1 dark crimson bag, 1 striped beige bag, 4 pale fuchsia bags. +striped black bags contain 4 muted maroon bags. +shiny bronze bags contain 1 dotted tan bag, 1 vibrant beige bag, 5 faded tomato bags. +light cyan bags contain no other bags. +posh black bags contain 2 dim green bags. +striped gold bags contain 3 drab tan bags. +faded white bags contain 4 pale coral bags. +drab tan bags contain 4 clear gold bags, 5 drab silver bags. +light tan bags contain 2 dull lime bags, 1 muted salmon bag, 4 pale beige bags. +plaid indigo bags contain 3 plaid salmon bags, 1 vibrant maroon bag. +faded gold bags contain 3 dark coral bags. +dark salmon bags contain 5 bright gold bags, 1 pale white bag. +plaid bronze bags contain 3 drab gold bags, 4 dotted black bags. +shiny black bags contain 3 bright magenta bags, 2 dark indigo bags, 1 posh plum bag, 5 drab gold bags. +pale magenta bags contain 1 clear gold bag, 5 posh fuchsia bags, 2 faded cyan bags. diff --git a/2020/day8/day8.py b/2020/day8/day8.py new file mode 100644 index 0000000..81ed6f0 --- /dev/null +++ b/2020/day8/day8.py @@ -0,0 +1,49 @@ +#! /usr/bin/env python3 + + +def part1(instructions): + instruction_pointer = 0 + accumulator = 0 + visited_instructions = set() + while instruction_pointer not in visited_instructions: # return before executing any instruction a second time + if instruction_pointer >= len(instructions): # stop the program when ip is out of bounds + break + visited_instructions.add(instruction_pointer) + instruction, argument = instructions[instruction_pointer].split(" ") + if instruction == "acc": + accumulator += int(argument) + instruction_pointer += 1 + elif instruction == "jmp": + value = int(argument) + instruction_pointer += value + else: + instruction_pointer += 1 + return instruction_pointer, accumulator + + +def part2(instructions): + for index, line in enumerate(instructions): + permutation = generate_permutation(instructions, line, index) + if permutation is None: + continue + instruction_pointer, accumulator = part1(permutation) + if instruction_pointer == len(permutation): + return accumulator + + +def generate_permutation(instructions, line, index): + permutation = instructions[:] + instruction, arg = line.split(" ") + if instruction == "acc": # don't replace acc operations + return + elif instruction == "nop": + permutation[index] = f"jmp {arg}" + elif instruction == "jmp": + permutation[index] = f"nop {arg}" + return permutation + + +if __name__ == "__main__": + instructions = [line.rstrip() for line in open("input.txt")] + print("Part 1 : (ip, acc) ", part1(instructions)[1]) + print("Part 2 : (ip, acc) ", part2(instructions)) diff --git a/2020/day8/input.txt b/2020/day8/input.txt new file mode 100644 index 0000000..5b247e0 --- /dev/null +++ b/2020/day8/input.txt @@ -0,0 +1,608 @@ +jmp +232 +acc +21 +nop +120 +jmp +239 +acc +18 +acc +41 +jmp +72 +acc +47 +jmp +314 +jmp +1 +acc +47 +nop +175 +acc +33 +jmp +115 +nop -5 +acc +37 +acc +25 +acc +18 +jmp +304 +acc +0 +acc +16 +jmp +77 +acc +9 +acc -3 +jmp +93 +acc +16 +acc -15 +jmp +110 +jmp +76 +acc +36 +acc +11 +acc -3 +jmp +258 +jmp +241 +acc +42 +jmp +514 +nop +103 +acc +36 +acc -18 +jmp +47 +acc +5 +acc +37 +jmp +480 +acc -16 +jmp +1 +nop +498 +jmp +1 +jmp +12 +acc +0 +acc +35 +jmp +437 +jmp +326 +acc -15 +acc -7 +nop -2 +jmp +548 +jmp -4 +jmp +395 +jmp +258 +acc +37 +acc +17 +acc -18 +jmp +345 +acc -18 +acc +37 +acc +36 +jmp +217 +acc -4 +acc +39 +jmp -35 +jmp +252 +jmp +1 +nop +91 +jmp +402 +nop -40 +jmp +371 +jmp -72 +jmp +9 +acc +41 +jmp +95 +nop +252 +nop +30 +jmp +240 +nop +266 +jmp +462 +jmp +137 +acc -14 +jmp +203 +jmp +1 +acc +45 +acc -14 +acc -6 +jmp -9 +acc -15 +acc +6 +nop +298 +jmp -56 +jmp +14 +acc +32 +jmp +40 +acc +17 +nop +62 +acc +14 +jmp +119 +acc +49 +jmp -29 +acc +27 +acc -12 +acc +14 +acc +19 +jmp +253 +acc +19 +jmp +345 +acc -17 +acc +39 +jmp +1 +jmp +133 +jmp +268 +acc -14 +acc -16 +acc +45 +jmp +373 +jmp +116 +jmp +245 +acc -19 +acc +32 +jmp -22 +jmp +105 +acc -9 +acc +27 +acc +16 +nop +397 +jmp +110 +acc +13 +acc -10 +acc +10 +jmp -69 +jmp +29 +jmp +94 +acc +38 +acc +49 +acc +40 +jmp +261 +acc +43 +acc -13 +jmp +214 +acc -10 +nop -80 +acc +15 +jmp +228 +acc +0 +jmp +275 +jmp -69 +acc +46 +acc +4 +acc +24 +acc +6 +jmp +279 +acc -9 +nop +281 +jmp +286 +acc -4 +jmp +306 +jmp +342 +acc -14 +jmp +357 +acc -10 +nop -9 +acc +10 +acc +40 +jmp +427 +acc +0 +acc +32 +jmp +405 +acc +45 +acc +34 +nop +281 +acc +34 +jmp +394 +acc +41 +acc +20 +jmp -98 +jmp -60 +acc -3 +acc +17 +jmp +19 +acc +6 +nop +168 +acc +35 +jmp -141 +nop -62 +acc +8 +acc +16 +jmp +117 +acc +34 +acc -8 +acc +35 +acc -15 +jmp +85 +acc +2 +acc -9 +acc -4 +acc +49 +jmp +394 +nop -145 +acc +47 +jmp +16 +acc +10 +acc +0 +jmp +87 +nop -88 +acc -9 +acc -16 +acc +45 +jmp +374 +acc +28 +acc +38 +jmp -139 +acc -13 +acc +13 +jmp +143 +jmp -135 +jmp -4 +jmp -130 +acc +5 +nop -196 +jmp +48 +acc -10 +jmp +149 +acc -14 +jmp +210 +jmp +325 +acc +45 +acc +11 +acc -15 +jmp +97 +nop +107 +jmp -98 +acc -7 +acc -18 +jmp -181 +jmp +122 +acc -15 +jmp -49 +jmp +1 +acc +36 +acc -10 +jmp +1 +jmp +62 +acc +39 +jmp +105 +acc +19 +nop +253 +acc -11 +acc -9 +jmp +77 +acc +50 +acc +3 +acc -18 +acc +17 +jmp +56 +nop -209 +nop +272 +acc -13 +jmp +270 +nop +229 +acc +12 +jmp +1 +jmp -44 +acc -13 +jmp +1 +nop +275 +acc +45 +jmp -254 +acc -2 +acc -2 +nop -148 +jmp -91 +acc +2 +nop -30 +acc -8 +acc +0 +jmp -96 +nop +1 +jmp -74 +acc -19 +acc +10 +acc +26 +acc +30 +jmp -280 +acc +46 +acc -2 +acc -8 +jmp +277 +acc -9 +jmp +205 +acc -13 +acc +10 +jmp +1 +jmp +219 +acc +38 +acc +24 +acc +11 +jmp -129 +jmp -86 +jmp +1 +acc +0 +jmp +1 +acc +46 +jmp -135 +nop +218 +acc -14 +acc +0 +jmp +55 +acc +24 +jmp +213 +acc +19 +acc +16 +jmp -266 +acc +24 +acc +15 +jmp +158 +acc +3 +jmp -94 +acc +16 +acc +24 +acc +42 +jmp +201 +jmp -32 +acc +34 +nop -321 +jmp +212 +acc +12 +acc +41 +jmp -212 +acc +32 +jmp +236 +acc +45 +nop +253 +jmp +129 +nop -3 +acc +38 +jmp +35 +acc -15 +acc +21 +acc -7 +acc -6 +jmp +46 +jmp -5 +acc +5 +acc +4 +acc +42 +jmp +142 +acc +36 +jmp -180 +acc +23 +jmp -46 +acc +12 +jmp +5 +jmp +201 +acc +36 +acc -14 +jmp -30 +jmp -338 +acc +12 +acc +34 +acc +2 +jmp -310 +acc -15 +jmp -104 +jmp -148 +jmp +108 +acc +37 +acc -6 +acc +0 +acc +13 +jmp -324 +acc +49 +acc +37 +acc +37 +jmp +131 +acc +2 +acc +30 +acc +12 +jmp -238 +acc -12 +acc +4 +jmp -155 +acc +45 +acc -10 +nop -168 +nop +114 +jmp +113 +acc +15 +acc +41 +acc +6 +acc +34 +jmp +25 +acc +46 +acc +28 +acc +44 +acc -3 +jmp -70 +acc +2 +acc +37 +jmp -101 +jmp +51 +acc +45 +nop -399 +nop -60 +jmp -391 +acc +41 +jmp -57 +jmp -54 +acc +46 +jmp +90 +acc +6 +jmp +83 +acc +37 +jmp +1 +acc -6 +jmp -189 +acc +0 +jmp -241 +acc +35 +jmp -396 +acc +35 +acc +42 +acc +37 +acc +20 +jmp -81 +nop +74 +acc +41 +acc +23 +jmp +1 +jmp -349 +jmp -232 +acc +37 +acc +24 +jmp +121 +jmp -144 +acc +35 +acc +39 +acc -12 +acc +14 +jmp -113 +acc +2 +acc +29 +acc -6 +acc +0 +jmp -326 +jmp -426 +acc +18 +acc +39 +acc +22 +jmp +79 +jmp +23 +acc -17 +nop +42 +acc -8 +jmp -47 +acc -12 +jmp -276 +jmp -126 +acc +20 +acc +3 +acc +41 +jmp -31 +acc -1 +jmp +1 +jmp -241 +acc +9 +acc +12 +acc +0 +jmp +26 +acc +30 +nop +46 +jmp -134 +jmp -361 +acc +50 +nop -1 +nop -225 +jmp -226 +acc +42 +acc +0 +jmp +1 +jmp -170 +acc +14 +acc +19 +jmp -199 +nop +15 +acc -11 +acc +20 +jmp -161 +nop -348 +acc -6 +acc +49 +jmp -468 +acc +11 +jmp -413 +acc -11 +acc -1 +acc +45 +jmp -181 +jmp -380 +nop -128 +acc +40 +jmp -179 +acc -9 +acc +24 +jmp -358 +acc +50 +acc +13 +acc -15 +jmp +14 +acc +4 +acc +12 +jmp -365 +nop -269 +jmp -443 +nop -224 +jmp -108 +acc +46 +acc -11 +jmp -515 +acc -8 +nop -284 +jmp -444 +acc +15 +nop -11 +jmp -288 +acc +28 +acc +35 +jmp -416 +acc +27 +acc -8 +acc -10 +acc +0 +jmp -167 +acc -9 +acc +42 +acc +20 +jmp -63 +jmp -107 +acc -6 +jmp -335 +jmp -460 +acc -2 +jmp -420 +acc +27 +acc +6 +jmp -458 +acc +31 +nop +19 +nop -396 +jmp -479 +nop -234 +acc +42 +jmp -142 +jmp -511 +nop +28 +acc -9 +acc +36 +acc +38 +jmp +27 +acc -3 +acc +9 +acc -19 +acc +3 +jmp -133 +jmp -503 +jmp -267 +acc +40 +acc +41 +acc +13 +nop -492 +jmp -327 +jmp -339 +acc +17 +acc +4 +acc +45 +acc +13 +jmp -419 +acc +31 +acc +0 +acc +37 +acc -13 +jmp -210 +jmp -517 +acc -15 +jmp -47 +acc -16 +jmp -129 +acc +16 +nop -455 +nop -263 +jmp -74 +acc +5 +acc +20 +acc +45 +acc +23 +jmp -490 +jmp -53 +acc +40 +jmp +1 +acc -14 +acc -1 +jmp +1 \ No newline at end of file diff --git a/2020/day9/day9.py b/2020/day9/day9.py new file mode 100644 index 0000000..2c739fe --- /dev/null +++ b/2020/day9/day9.py @@ -0,0 +1,50 @@ +#!/usr/bin/env python3 +import itertools + + +def part1(inp): + preamble_size = 25 + with open(inp) as infile: + cleanfile = (int(l.rstrip()) for l in infile) + for nums in window(cleanfile, preamble_size + 1): + candidate = nums[-1] + if not test_number(candidate, nums[:-1]): + return candidate + return -1 + + +def window(seq, n): + it = iter(seq) + result = tuple(itertools.islice(it, n)) + if len(result) == n: + yield result + for elem in it: + result = result[1:] + (elem,) + yield result + + +def test_number(num, previous): + sums = set(sum(x) for x in itertools.combinations(previous, 2)) + return num in sums + + +def part2(infile, target: int): + lines = [int(l.rstrip()) for l in open(infile).readlines()] + total = 0 + visited = [] + for index, _ in enumerate(lines): + i = index + while total < target: + total += lines[i] + visited.append(lines[i]) + i += 1 + if total == target: + return max(visited) + min(visited) + visited.clear() + total = 0 + + +if __name__ == "__main__": + invalid_number = part1("input.txt") + print("part1 ", invalid_number) + print("part2 ", part2("input.txt", invalid_number)) diff --git a/2020/day9/input.txt b/2020/day9/input.txt new file mode 100644 index 0000000..20f8901 --- /dev/null +++ b/2020/day9/input.txt @@ -0,0 +1,1000 @@ +16 +19 +41 +7 +20 +3 +45 +40 +37 +25 +5 +22 +43 +48 +4 +23 +18 +47 +28 +11 +10 +42 +35 +6 +34 +21 +8 +9 +12 +7 +13 +38 +14 +15 +16 +17 +20 +19 +60 +22 +24 +27 +46 +44 +28 +18 +70 +23 +42 +25 +26 +21 +29 +30 +91 +34 +31 +32 +33 +35 +43 +41 +45 +47 +65 +39 +48 +49 +46 +44 +50 +51 +52 +63 +53 +54 +89 +59 +61 +64 +66 +105 +87 +68 +74 +92 +93 +124 +83 +154 +97 +217 +176 +120 +94 +122 +111 +106 +107 +246 +127 +123 +173 +125 +199 +142 +210 +151 +293 +185 +175 +207 +177 +299 +201 +383 +232 +200 +219 +450 +394 +213 +229 +234 +296 +401 +372 +267 +324 +530 +317 +328 +854 +352 +730 +518 +586 +377 +414 +560 +932 +432 +541 +453 +759 +447 +442 +463 +619 +749 +584 +591 +729 +641 +1049 +645 +947 +766 +784 +994 +877 +1307 +824 +846 +1661 +874 +1094 +1374 +889 +905 +1689 +1026 +1340 +1175 +1225 +1229 +1375 +2049 +2532 +1411 +2064 +1640 +1550 +1608 +1670 +2196 +1713 +2221 +2279 +2255 +2845 +1794 +1915 +1931 +4328 +2201 +2366 +2400 +2404 +3051 +2899 +3045 +3402 +3968 +2961 +3158 +3190 +3220 +5333 +6241 +3507 +3914 +5120 +3709 +4186 +4194 +3725 +3846 +7760 +4567 +5421 +7524 +8645 +5365 +6363 +11492 +6006 +6697 +6378 +6119 +6348 +8641 +11438 +7216 +10087 +7232 +7434 +7555 +10686 +13797 +9211 +7571 +11799 +17642 +13351 +15861 +11371 +11484 +11713 +12125 +12354 +12384 +23283 +12467 +15559 +13564 +14448 +21336 +21571 +24509 +14666 +23755 +15126 +19284 +25064 +27358 +18942 +22855 +28026 +25918 +23084 +43793 +24097 +23838 +46367 +24738 +24851 +26915 +26031 +50015 +28012 +29114 +52869 +29792 +47310 +47935 +38226 +34068 +44006 +41797 +42026 +42780 +46693 +46922 +48576 +47181 +74607 +48835 +48689 +52946 +89732 +54043 +54927 +63860 +116729 +57126 +76295 +68018 +71589 +81006 +206461 +82644 +85803 +83823 +88978 +113615 +95757 +166027 +143775 +95870 +102732 +97524 +103762 +103616 +126516 +108970 +135933 +165273 +120986 +125144 +184622 +162098 +139607 +152595 +163650 +166467 +264830 +169626 +221014 +198602 +384664 +204840 +193394 +199486 +493634 +324229 +201140 +207378 +229956 +278596 +234114 +414408 +246130 +294770 +264751 +292202 +301705 +476824 +420500 +330117 +428392 +368228 +493372 +391996 +392880 +464237 +400772 +394534 +441492 +408518 +431096 +575606 +437334 +464070 +480244 +498865 +716113 +771594 +918316 +556953 +593907 +820388 +825630 +1346708 +762762 +1012940 +760224 +823976 +784876 +839614 +803052 +795306 +878826 +1244544 +845852 +868430 +901404 +1826952 +944314 +979109 +1055818 +1150860 +1739620 +1317177 +1957222 +1378783 +1586738 +2882770 +1522986 +2903915 +1545100 +1555530 +1580182 +2737598 +2424390 +1671482 +1641158 +1714282 +1747256 +1769834 +1812744 +2218581 +1923423 +3078516 +3350016 +2206678 +2468037 +3969490 +2695960 +2901769 +4142004 +7319506 +3100630 +3103168 +3186258 +3125282 +3135712 +3221340 +3932863 +3953934 +3312640 +4714513 +3461538 +5321749 +3582578 +3736167 +4825192 +4902638 +4674715 +5108447 +5668216 +8793498 +6214409 +5799128 +6002399 +9260666 +8668447 +6203798 +9822960 +6260994 +6346622 +6357052 +6533980 +6774178 +9463937 +16238115 +8485216 +11117047 +11208695 +7318745 +15015069 +11021337 +12427192 +9783162 +11467344 +11670615 +12737778 +11801527 +12002926 +12263393 +12464792 +12550420 +12703674 +16169582 +24740704 +12880602 +12891032 +19693911 +14092923 +15803961 +18268378 +17101907 +18340082 +18527440 +24097807 +20804499 +29896884 +21250506 +22674194 +25441452 +23472142 +23804453 +35735535 +37205496 +36695485 +26983955 +25254094 +25584276 +34697022 +34331401 +25771634 +28694993 +42331893 +31194830 +32905868 +35370285 +55135900 +36867522 +39331939 +46772001 +66315894 +43924700 +46504600 +47928288 +47276595 +48726236 +49388729 +50838370 +80792222 +51025728 +52755589 +51355910 +72237807 +86103940 +54466627 +56966464 +59889823 +83372122 +70526769 +68276153 +103738465 +76199461 +83256639 +85836539 +100683877 +90429300 +116162507 +95893329 +95204883 +98114965 +100227099 +100414457 +123263535 +108322374 +102381638 +104111499 +200641556 +168503252 +111433091 +114356450 +171210646 +138802922 +144475614 +170941226 +151532792 +159456100 +162036000 +169093178 +176265839 +185634183 +250236013 +191098212 +196307786 +195431982 +266147499 +248587113 +202796095 +267778474 +206493137 +322474018 +215544590 +225789541 +253159372 +283278536 +303931714 +340783400 +290335714 +375000690 +474376748 +310988892 +468912719 +388430278 +453032108 +372573625 +376732395 +518014487 +386530194 +398228077 +401925119 +472640636 +418340685 +409289232 +520937846 +459652509 +478948913 +536778433 +865479107 +678932404 +587210250 +594267428 +715784090 +466456641 +1108148096 +1105224737 +1325131616 +846182703 +749306020 +945405554 +770801702 +763262589 +816568762 +2040915706 +800153196 +946067665 +827629917 +868941741 +875745873 +926109150 +1353347195 +1003235074 +1053666891 +1442194993 +1924716858 +1060724069 +1182240731 +1646547575 +1215762661 +1520107722 +1512568609 +1534064291 +1549459216 +1773697582 +1853820087 +1696910852 +1563415785 +1692314635 +1627783113 +2455413030 +1753739067 +1744687614 +1801855023 +1878980947 +1929344224 +2185475805 +2114390960 +2242964800 +4200100644 +2276486730 +4155467677 +2398003392 +2735870383 +3330153621 +3806705595 +3204883244 +5606640351 +3241773851 +4152323882 +3191198898 +3255730420 +3308103399 +3320097748 +3372470727 +4142691006 +4993053921 +3808325171 +5718101140 +6079081591 +4114820029 +4299866765 +5319274204 +4519451530 +4674490122 +5012357113 +5133873775 +5589202290 +6043973782 +8389604195 +6396082142 +6432972749 +8926738099 +6446929318 +10753571713 +6499302297 +9026204539 +6628201147 +6692568475 +7180795898 +8634271559 +7923145200 +8108191936 +8819318295 +8414686794 +8789310151 +8974356887 +9193941652 +9531808643 +9686847235 +10146230888 +10723076065 +11633176072 +15237915434 +19556321272 +12829054891 +12932275046 +13680098195 +15236239469 +15133573856 +20409923300 +15107255269 +25313274267 +14800760411 +15103941098 +16031337136 +16337831994 +17203996945 +17793675182 +17389043681 +17763667038 +18168298539 +18725750295 +26920852324 +40551189701 +20869306953 +28837173017 +27936310160 +33698361844 +25761329937 +26509153086 +31138592405 +28480858606 +29904701509 +34593040626 +46600840055 +29908015680 +30832097547 +31135278234 +31441773092 +32369169130 +33726875675 +46226216698 +35152710719 +53878461014 +35931965577 +63603063353 +52682182261 +46630636890 +47378460039 +59071588394 +52270483023 +53697640097 +54242188543 +95003553971 +54990011692 +58385560115 +59812717189 +67067243811 +86431784784 +67373738669 +113293460509 +61967375781 +95044836445 +114061600086 +66096044805 +68879586394 +71084676296 +113697880701 +82562602467 +83310425616 +94009096929 +98901119913 +99648943062 +101076100136 +106512671566 +108687651789 +107939828640 +109232200235 +200521768495 +113375571807 +118198277304 +125908761994 +128063420586 +167172144941 +136253325063 +184386525752 +130846962175 +134975631199 +137180721101 +139964262690 +270811224865 +153647278763 +165873028083 +336775093558 +177319522545 +200725043198 +198550062975 +208336594851 +207588771702 +250556292908 +216627480429 +217172028875 +222607772042 +559382865600 +249628896870 +268027683276 +253972182580 +258910382761 +265822593374 +317283785235 +329397025150 +348300857541 +272156352300 +533850276650 +293611541453 +713030144363 +330966801308 +415501924953 +449475874845 +375869585520 +424216252131 +425508623726 +415925366553 +424760800577 +433799509304 +439235252471 +439779800917 +481518154803 +521999865856 +531066735061 +512882565341 +547583724033 +524732976135 +755183053439 +754157825727 +565767893753 +1072316700168 +1053066600917 +624578342761 +669481126973 +706836386828 +746468726261 +1058377852065 +800085837651 +791794952073 +840141618684 +840686167130 +1371047069022 +1285224560788 +1090500869888 +1193393078198 +921297955720 +994400720144 +1034882431197 +1235249020726 +1331414729589 +1113351617786 +1190346236514 +1464719961445 +1312236620014 +1272604280581 +1640772004781 +1294059469734 +1376317513801 +1415949853234 +1765214238893 +1538263678334 +1858463689716 +1591880789724 +1631936570757 +2304861580129 +2557828841369 +1915698675864 +2193902236301 +2225228667711 +2107752337930 +2111644192234 +2507853301307 +2328941900931 +3884170815108 +2303697854300 +2385955898367 +2462950517095 +2566663750315 +2584840900595 +2648921794382 +3234781203517 +4017892469124 +2792267367035 +3223817360481 +3130144468058 +5539642783646 +3547635246621 +3507579465588 +3739688908687 +4023451013794 +4027342868098 +4219396530164 +4301654574231 +6608291914389 +5731670661788 +6299846832623 +4714897799298 +4791892418026 +6027048570552 +5620737101884 +4848906415462 +5255217884130 +5151504650910 +5233762694977 +10054391438650 +5922411835093 +9470047081714 +6016084727516 +6677779714679 +6637723933646 +7055214712209 +7287324155308 +10794903620896 +16354238271273 +8934294329462 +9068302945626 +8521051104395 +11148753248085 +9506790217324 +17341715593958 +12704828285231 +9563804214760 +11829284365589 +10000411066372 +10082669110439 +17589354050021 +10385267345887 +11073916486003 +11156174530070 +18361240641311 +11938496562609 +12653808661162 +12693864442195 +13315503648325 +15706026879272 +18436077403393 +16794114372632 +26009368090520 +30035580036153 +18906318450282 +18027841321719 +18084855319155 +20580706703327 +19070594432084 +28470122665042 +19564215281132 +19646473325199 +27868030858635 +38007713966510 +20467936456326 +34878969691787 +21459183831890 +23727725147165 +31560127111444 +54525443016986 +24592305223771 +43351083684478 +51124342392576 +29021530527597 +58606694838952 +34821955694351 +35700432822914 +45079962522604 +49929306496932 +36934159772001 +37155449751239 +58475650422836 +38634809713216 +38717067757283 +41105657157089 +60883174898404 +40114409781525 +41927120288216 +44195661603491 +45060241680097 +45186908979055 +56152432335215 +48320030370936 +53613835751368 +59414260918122 +78173039378829 +82041530069741 +79082570039455 +63843486221948 +70522388517265 +74936365475876