commit 410815acf8f5b682a913eb7b9b70ef98332f7701 Author: Karma Riuk Date: Wed Aug 2 11:39:56 2023 +0200 Added 2020 (python) diff --git a/2020/1/input b/2020/1/input new file mode 100644 index 0000000..4249d4a --- /dev/null +++ b/2020/1/input @@ -0,0 +1,200 @@ +1946 +1859 +1654 +1806 +1648 +1873 +1216 +1831 +1610 +1779 +1626 +1332 +1713 +1919 +1353 +1720 +1818 +1976 +1993 +1617 +1678 +1655 +1725 +1686 +1737 +1696 +1046 +1814 +1909 +1618 +2006 +1903 +1528 +1635 +1457 +1924 +1734 +1723 +1735 +1984 +1846 +1921 +1587 +2009 +1607 +1987 +1910 +1571 +1898 +1869 +1537 +1446 +1535 +1802 +1847 +1966 +1944 +1793 +1383 +1850 +1274 +347 +1208 +1748 +1906 +1771 +1849 +1773 +1792 +1705 +1538 +1564 +2003 +1994 +1545 +1704 +1657 +1483 +1701 +1724 +1293 +1834 +1712 +1950 +1844 +1290 +1692 +1820 +1585 +1986 +1328 +1841 +1709 +1232 +1945 +1684 +1787 +1991 +1914 +16 +1977 +1620 +1825 +1866 +1615 +1832 +496 +1932 +1819 +1559 +1870 +1677 +1650 +1594 +1664 +1600 +1622 +1862 +1937 +1624 +1580 +1931 +1803 +1839 +1755 +1952 +1473 +1694 +1864 +1178 +1163 +1790 +393 +1776 +1871 +1999 +1923 +1174 +1557 +1646 +1200 +1842 +1432 +1573 +1913 +1954 +1599 +1980 +1948 +1430 +1298 +1835 +1643 +1742 +1609 +1649 +1382 +1343 +1263 +1908 +1703 +1922 +1764 +1603 +1330 +588 +954 +1772 +1553 +975 +1499 +1552 +1214 +1829 +1698 +1797 +1807 +1961 +1947 +1845 +1881 +1821 +1815 +1623 +1675 +1478 +1886 +1951 +1700 +1890 +1876 +1781 +1853 +1983 +1901 +1939 +1292 +853 +1879 +1652 \ No newline at end of file diff --git a/2020/1/prog.py b/2020/1/prog.py new file mode 100644 index 0000000..161ebf7 --- /dev/null +++ b/2020/1/prog.py @@ -0,0 +1,75 @@ +def get_file_input(filename): + ret = set() + with open("input", "r") as f: + for i, line in enumerate(f.readlines()): + if " " in line: + raise ValueError(f"Only on value can be put per line in the input file (space detected at line {i} the input file).") + ret.add(int(line)) + return ret + +def get_2_numbers(s: set): + goal = 2020 + + known = set() + for e in s: + sub_goal = 2020 - e + if sub_goal in known: + return e, sub_goal + known.add(e) + + +def init_dict(s: set): + ret = dict() + for e in s: + ret[e] = {e} + return ret + + +def get_n_numbers(n_entries: int, s: set, data: dict): + if data == {}: + data = init_dict(s) + + if n_entries == 2: + goal = 2020 + + for e in s: + sub_goal = 2020 - e + if sub_goal in data.keys(): + return e, *data[sub_goal] + else: + new_data = {} + for e in s: + for result, values in data.items(): + if e in values: pass + new_data[result + e] = values | {e} + return get_n_numbers(n_entries - 1, s, new_data) + +def get_result(*ns: int): + ret = 1 + for n in ns: + ret *= n + return ret + +def main(n_entries = 2, use_sample_input = True): + sample = { 1721, + 979, + 366, + 299, + 675, + 1456} + + res = get_result( + *get_n_numbers( + n_entries, + sample if use_sample_input else get_file_input("input"), + {}) + ) + + if use_sample_input: + expected = 241861950 if n_entries == 3 else 514579 # if n_entries == 2 + return f"{res} {res==expected}".upper() + else: + return res + + +print(main(n_entries = 3, use_sample_input = False)) diff --git a/2020/10/__pycache__/prog.cpython-38.pyc b/2020/10/__pycache__/prog.cpython-38.pyc new file mode 100644 index 0000000..10c7a30 Binary files /dev/null and b/2020/10/__pycache__/prog.cpython-38.pyc differ diff --git a/2020/10/input b/2020/10/input new file mode 100644 index 0000000..dc30936 --- /dev/null +++ b/2020/10/input @@ -0,0 +1,93 @@ +47 +99 +115 +65 +10 +55 +19 +73 +80 +100 +71 +110 +64 +135 +49 +3 +1 +98 +132 +2 +38 +118 +66 +116 +104 +87 +79 +114 +40 +37 +44 +97 +4 +140 +60 +86 +56 +133 +7 +146 +85 +111 +134 +53 +121 +77 +117 +21 +12 +81 +145 +129 +107 +93 +22 +48 +11 +54 +92 +78 +67 +20 +138 +125 +57 +96 +26 +147 +124 +34 +74 +143 +13 +28 +126 +50 +29 +70 +39 +63 +41 +91 +32 +84 +144 +27 +139 +33 +88 +72 +23 +103 +16 \ No newline at end of file diff --git a/2020/10/prog.py b/2020/10/prog.py new file mode 100644 index 0000000..17f788c --- /dev/null +++ b/2020/10/prog.py @@ -0,0 +1,23 @@ +def get_input(sample = False, number = 1): + with open(f"sample_{number}" if sample else "input", 'r') as f: + return [int(i) for i in f.readlines()] + +def get_result(data: list, part = 1): + data.sort() + data = [0] + data + [data[-1] + 3] + diffs = [] + + for i in range(len(data) - 1): + n1, n2 = data[i], data[i + 1] + diffs.append(n2 - n1) + + if part == 1: + return diffs.count(1) * diffs.count(3) + else: + for diff in diffs + return 0 + + +if __name__ == "__main__": + print(get_result(get_input())) + diff --git a/2020/10/sample_1 b/2020/10/sample_1 new file mode 100644 index 0000000..cd1b40b --- /dev/null +++ b/2020/10/sample_1 @@ -0,0 +1,11 @@ +16 +10 +15 +5 +1 +11 +7 +19 +6 +12 +4 \ No newline at end of file diff --git a/2020/10/sample_2 b/2020/10/sample_2 new file mode 100644 index 0000000..be5c492 --- /dev/null +++ b/2020/10/sample_2 @@ -0,0 +1,31 @@ +28 +33 +18 +42 +31 +14 +46 +20 +48 +47 +24 +23 +49 +45 +19 +38 +39 +11 +1 +32 +25 +35 +8 +17 +7 +9 +4 +2 +34 +10 +3 \ No newline at end of file diff --git a/2020/10/test.py b/2020/10/test.py new file mode 100644 index 0000000..c0000a1 --- /dev/null +++ b/2020/10/test.py @@ -0,0 +1,12 @@ +from prog import * + +inp_1 = get_input(sample = True, number = 1) +result_1_1 = get_result(inp_1) +expected_1_1 = 35 +print(f"{result_1_1 = } {result_1_1 == expected_1_1}") + + +inp_2 = get_input(sample = True, number = 2) +result_1_2 = get_result(inp_2) +expected_1_2 = 220 +print(f"{result_1_2 = } {result_1_2 == expected_1_2}") diff --git a/2020/11/__pycache__/prog.cpython-38.pyc b/2020/11/__pycache__/prog.cpython-38.pyc new file mode 100644 index 0000000..b8cf8c4 Binary files /dev/null and b/2020/11/__pycache__/prog.cpython-38.pyc differ diff --git a/2020/11/input b/2020/11/input new file mode 100644 index 0000000..97835ce --- /dev/null +++ b/2020/11/input @@ -0,0 +1,91 @@ +LLLLLLLL.LLLLLLLLLLLLL.LLLLL.LLLLLLLL.LLLLLLLLLLLLLLLL.LLLL..LLLLLLL..LLLLLL.LLLLLLLL.L.LLLLLLLLLLL +LLLLL.LL.LLLLLLL.LLLLL.LLLLL.LLLLLLL..LLLLLLLLLLLLLLLL.LLLLLLLLLL.LL.L.LLLLL.LLL.LLLL..LLLLLLLLLLL. +LLLLLLLL.LLLLLLLLL.LLL.LLLL..LLLLLLLL.LLLLLLLLL.LLLLLLLLLLLL.LL.LLLL.LLLLL.L.LLL.LLLLLLLLLLL.LLLL.L +L.LLLLL..LLLLLLL..LLL.LLLLLL.LLLLLLLL.LLLLLLLLL.LLLLLLLLLLLLLLLLLLLL.LLLLLLL.LLLLLLLL.LLLLLLLLLLLLL +LLLLLLLLLLLLLLL...LLLLLLLLL..L.LLLLLLLLLLLLLLLL.LLL.LL.LLLLL.LLLLLLLLLLLLLLL.LLLLLLLL.LLLLLL.LLLLLL +LLLLLLLL.LLLLLLL.LLLLL.LLLLL.LLLLLLLLL.LLLLLLLL.LLLLLLLLLLLL.LLLLLLL.LLLLLLLLLLLLLL.LLLLLLLL..LLLLL +LL.LLLLL.LLLLLLL.LLLLL.LLLLL.LLLLLLLLLL.LLLL.LL.LLLLLL.LLL.LLL.LLL.LLLLL.LLL.LLLLLLLL..L.LLLLLLLL.L +LLLLLLLL.LLLL.LLLLLLLL.LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL.LLLLL..LLL.LL.LLLLLLL.LLLLLLLL..LLLLLLLLLLLL +LLLLLLLL.LLLLLLL.LLLLL.LLLLL.LL.LLLLL.LLLLLLLLL.LLLLLL.LLL.L.LLLLLLLLLLLLLLL.LLLLLLLL.LLLLLL.LLLLL. +.L.LL..L.L...L.LL....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LLL +.....LL.L..L..L..LL.............LL...L..L.LLLLL.L.L...L.....L...L.....L....LL.L..L.....LLL......... +LLLLLLLLLLLL.LLL.LLLLLLL.LLLL.LLLLLLL.LLLLLLLLL.LLLLLLLLLLLLLLLLLLLL.LLLLLLL.LL.LL.LL.LLLL.L.LLLLLL +LLLLLLLLLL.LLL.L.LLLLLLLLLLL.LLLLLLLL.LLL..LLLL.LLLLLLLLLLLL.LLLLLLL.LLLLLLL.LLLL.LLL.LLLLLLLL.LLLL +LLL.LLLL.LLL.LLL.LLLLL.LLLL..LLLLL.LL.LL.LLLLLL.LLLLLL.LLLLL.LLLLLLL.LLLLLLL.LLLLLLLLLLLLLLLLLLLLLL +LLLLLLLL.LLLLLL..L.LLLLLLL.L.LLLLLL.L.LLLLLLLLL.LLLLLL.LLLLLLLLLLLLL.LLLLLLLLLLLLLLLLLLLLLLL.LLLLLL +LLLL.LLLLLLLLLLL.LLLLL.LLLLL.LLLLLLLL.LLLLLL.LL.LLLLLL.LLLLL.L.LLLLLLLLLLLLLLLLL.LLLL.LLLLLL.LLLLLL +LLLLLLLL.LLLLLLLLLLLLL.LLLLL.LLLLLLLL.LLLLLLL.L.LLLLLL.LLLLL.LLLLLLLLLLLLLLLLLLLLLL.L.LLLLLL.LLLLLL +LLLLLLLL.LLLLLLL.LLLLLLLL.LLLL.LLLLLLLLLLLLLLLL.LLLLLLLLLL.L.LL.LLLL.LLLLLLLLLLLLLLLL.LLLLLL.LLL.LL +LLLLLLLL.LLLLLLL.LLLLLLL.LLLLLLLLLLLL.LLLLLLLLLLLLLLLL.LLLLL.LLLLLLL.LLLLLLL.LL.LLLLL.LLLLLLLLLLLLL +LLLLLLLL.LLLLLLLLLLLLL.LLLLL.LLLLLLLL.LLL.LLLLL.LLLLLLLLLLLL.LLLLLLLLLLLLLLL.LLL.LLLLLLLLLLL.LLLLLL +..LL..LL..LL......L....L....L....L....L..L...........L.L...L.L.L...LL.L..L..........LLLL.L..L.L.... +LLLLLLLL.LLLL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.LLL.LLLLL +L.......L....L....L.LL..L.LL...L.L.LL........L......L.......LL.L.L...L...L...LL.L.L.L.............. +LLLLLLLLLLLLLLLLLLLLLL.LLLLL.LLLLLLLL.LLLLLLLLL.LLLLLLLLLLL..LLLL.LL.LLLLLLL.L.LLLL.L.L.LLLL.LLLLLL +LLLLLLLLLL.LLLLL.LLLLL.L.LLL..LLLL.LLLL.LLLLL.LLLLLLLL.L.LLL.LLLLLLL.LLLLLLLLLLLL.LLL.LLLLLLLLLLLLL +LLLLLLLL.LLLLLLLL.LLLL.LLLLLLLLLLLL.L.LLLLLLLLL.LLLLLL.L.LLLLLLLLLLL.LLLLLLL..LLLLLLL.LLLLLLLLLLLLL +LLLLLLLL.L.LLLL..LLLLL.LLLLL.LLLLLLLLLLLLLLLLL..LLLLLL.LLLLL.LL.LLLL.LLLLLLL.LLLLLLLLLLLLLLL.LLLLLL +LLLLLLLL..LLLLLL.LLLLLLLLLLLLLLLLLLL.LLLLLL.LLL.LLLLLL.LLLLL.LLLLLLL.LLLLLLL.LLLLLLLL.LLLL.L..LLLLL +LLLLLLLL.LLLLLLL.LLLLL.LLLLLLLLLLLLLL.LLLLLLLLL.LLLLLL.LLLLL.LLLLLLL.L.LLLLLLLLL.LLLL.LLLLLL.LLLLLL +LLLLLLLL.LLLLLLL.LLLLL.LLLLLLLLLLLLLL.L.LLLLLLLLLL.L.L..LLLL.LLLLLLL.LLLLLLL.LLLLL.LLLLLLLLL.LLLLLL +LLLLLLLL.LLLLLLL.LLLLL.LLLLLLLLLLLLL..LLLLLLLLL.LLLLLL.LLLLL.LLLLLLL.LLLLLLL.LLLLLLLLLLLLLLL.LLLLLL +..LL.....L....L...L.LL........LL.L........L....L....L.L....LLL.L....LLLLLL.L.L.L..LLL.L.L.L..LL..LL +LLLL.LLL.LLLLLL.LLLLLL.LLLLLLLLLLLLL.LLLLLLLLLLLLLLLLL.LLLLL.LLLLLLLLLLLLLLL.LLLLLLLL.LLLLL.LLLLLLL +LLLLLLLL.LLLLLLL.LLLLL.LLLL..LLLLLLLL.LLLLLL.LL.L.LLLL.LLLLL.LLL.LLL.LLLLLLL.LLLLL.LLLLLLLLL.LLLLL. +LLLLLLLLLLLLLLLLLLLL.L.LLLLLLLLLLLLLL.LLLL.LLLL.LLLLLL.LLLLL..LLLLLL.LLLLLLL.LLLLL.LL.LLLLLL.LLLLLL +LLLLLLLL.LLLLLLLLLLLLL.LLLLL.LLLLLLLL.LLLLLLLLL.LLL.LL.L.LLLLLLLL.LLLLLLLLLL.LLLLLLLLLLLLLLLL.LLLLL +LLLLLLLL.LLLLLLL.LLLLL.LLLLLLLLLLLLLL.LLLL.LLLL.LLLLLL.LLLLL.LLLLLLL.LLLLLLLLLL.LLLLL.LLLLLL.LLLLLL +LLL.LLLLLLLLLLLL.LLLLL.LLL.LLLLLLLLLLLLLLLLLLLLLLL.LLL.LLLLL.LLLLLLL.LLLLLLL.LLLL.LLL.LLLLLL.LLLLLL \ No newline at end of file diff --git a/2020/11/prog.py b/2020/11/prog.py new file mode 100644 index 0000000..6eec44e --- /dev/null +++ b/2020/11/prog.py @@ -0,0 +1,118 @@ +def get_input(sample = False, sample_name = "sample"): + with open(sample_name if sample else "input", "r") as f: + return [list(l.strip()) for l in f.readlines()] + + +def is_there_occupied(range_x, range_y, seats): + try: + for x, y in zip(range_x, range_y): + # print(f"\tChecking: {x}, {y}") + if seats[y][x] == "#": + # print(f"\tFound an # at {x}, {y}") + return True + elif seats[y][x] == "L": + return False + return False + except IndexError: + return False + + + +def count_occupied_direction(center_x, center_y, seats): + count = 0 + len_x = len(seats[0]) + len_y = len(seats) + + directions = [ + ( # N + [center_x] * center_y, + range(center_y - 1, -1, -1) + ), + ( # NE + range(center_x + 1, len_x), + range(center_y - 1, -1, -1) + ), + ( # E + range(center_x + 1, len_x), + [center_y] * (len_x - center_x) + ), + ( # SE + range(center_x + 1, len_x), + range(center_y + 1, len_y) + ), + ( # S + [center_x] * (len_y - center_y), + range(center_y + 1, len_y) + ), + ( # SW + range(center_x - 1, -1, -1), + range(center_y + 1, len_y) + ), + ( # W + range(center_x - 1, -1, -1), + [center_y] * center_x + ), + ( # NW + range(center_x - 1, -1, -1), + range(center_y - 1, -1, -1), + ) + ] + + for range_x, range_y in directions: + if is_there_occupied(range_x, range_y, seats): + count += 1 + + return count + +def count_occupied_around(center_x, center_y, seats): + count = 0 + len_x = len(seats[0]) + len_y = len(seats) + + for y in range(center_y-1, center_y+2): + for x in range(center_x-1, center_x+2): + + if x in range(len_x) and y in range(len_y) and (x, y) != (center_x, center_y): + if seats[y][x] == "#" : count += 1 + + return count + + +def get_dummy_seats(len_x, len_y): + ret = [] + for y in range(len_y): + line = "" + for x in range(len_x): + line += "." + ret.append(line) + return ret + +def get_result(seats: list, part = 1): + len_x = len(seats[0]) + len_y = len(seats) + prev_seats = get_dummy_seats(len_x, len_y) + + while prev_seats != seats: + new_seats = [[item for item in line] for line in seats] + for y in range(len_y): + for x in range(len_x): + place = seats[y][x] + if place == ".": continue + count = count_occupied_around(x, y, seats) if part == 1 else count_occupied_direction(x, y, seats) + + if place == "L" and count == 0: + new_seats[y][x] = "#" + elif place == "#" and count >= (4 if part == 1 else 5): + new_seats[y][x] = "L" + + prev_seats = seats + seats = new_seats + + count = 0 + for line in seats: + for char in line: + if char == "#": count += 1 + return count + +if __name__ == "__main__": + print(get_result(get_input(), part = 2)) diff --git a/2020/11/sample b/2020/11/sample new file mode 100644 index 0000000..ff5431a --- /dev/null +++ b/2020/11/sample @@ -0,0 +1,10 @@ +L.LL.LL.LL +LLLLLLL.LL +L.L.L..L.. +LLLL.LL.LL +L.LL.LL.LL +L.LLLLL.LL +..L.L..... +LLLLLLLLLL +L.LLLLLL.L +L.LLLLL.LL \ No newline at end of file diff --git a/2020/11/sample_no_occupied b/2020/11/sample_no_occupied new file mode 100644 index 0000000..74c3c6f --- /dev/null +++ b/2020/11/sample_no_occupied @@ -0,0 +1,7 @@ +.##.##. +#.#.#.# +##...## +...L... +##...## +#.#.#.# +.##.##. \ No newline at end of file diff --git a/2020/11/test.py b/2020/11/test.py new file mode 100644 index 0000000..78f3b3e --- /dev/null +++ b/2020/11/test.py @@ -0,0 +1,16 @@ +from prog import * + +inp = get_input(sample = True) + +result_1 = get_result(inp) +expected_1 = 37 + +print(f"{result_1 = } {result_1 == expected_1}") +print() + +inp_no_occupied = get_input(sample = True, sample_name = "sample_no_occupied") +print(count_occupied_direction(3, 3, inp_no_occupied)) + +result_2 = get_result(inp, part = 2) +expected_2 = 26 +print(f"{result_2 = } {result_2 == expected_2}") diff --git a/2020/12/__pycache__/prog.cpython-38.pyc b/2020/12/__pycache__/prog.cpython-38.pyc new file mode 100644 index 0000000..bbbb87b Binary files /dev/null and b/2020/12/__pycache__/prog.cpython-38.pyc differ diff --git a/2020/12/__pycache__/test.cpython-38.pyc b/2020/12/__pycache__/test.cpython-38.pyc new file mode 100644 index 0000000..0f7a914 Binary files /dev/null and b/2020/12/__pycache__/test.cpython-38.pyc differ diff --git a/2020/12/input b/2020/12/input new file mode 100644 index 0000000..285b372 --- /dev/null +++ b/2020/12/input @@ -0,0 +1,760 @@ +F35 +L90 +S5 +F4 +R90 +F46 +W3 +N1 +L90 +F13 +S5 +E5 +R180 +S1 +F39 +N2 +R90 +S1 +F94 +R90 +F55 +L90 +S2 +R90 +W3 +S5 +E3 +R180 +S4 +L90 +F40 +N5 +W5 +N3 +F88 +L90 +W3 +F12 +W1 +N1 +F65 +L90 +E1 +N1 +L270 +E3 +F67 +R90 +R180 +N3 +W5 +N4 +R90 +F48 +R180 +F50 +E3 +S4 +F50 +N4 +L90 +N5 +F26 +L90 +F21 +N5 +L90 +R90 +F13 +R90 +S2 +E4 +F33 +N5 +R90 +F78 +L180 +N3 +E5 +N4 +L180 +N3 +F12 +E4 +L90 +N2 +F32 +L270 +F13 +L90 +S5 +F100 +N4 +W4 +L270 +N1 +L90 +E5 +F30 +W3 +S3 +E4 +F38 +E3 +E2 +L90 +N1 +L180 +F89 +E1 +R90 +F51 +R90 +F12 +E5 +L90 +S3 +E3 +S3 +L180 +F66 +L180 +N3 +F26 +W4 +E2 +N4 +F90 +S4 +R90 +W4 +F79 +R90 +F38 +W3 +F10 +R90 +W1 +L180 +F34 +E5 +N4 +F30 +S4 +W1 +L180 +N2 +W1 +F76 +S5 +L270 +N5 +W1 +L90 +F4 +N1 +R90 +F86 +N1 +L90 +N1 +F75 +S4 +F85 +N3 +L270 +N5 +F85 +S4 +F84 +R180 +W2 +F10 +R90 +F72 +L90 +F90 +W4 +L90 +F94 +R90 +E4 +R90 +S2 +L90 +W3 +F89 +W3 +S2 +R90 +E1 +S1 +E5 +N1 +F77 +L90 +N2 +F52 +S1 +W1 +N5 +R90 +S2 +L90 +F97 +N1 +F54 +L90 +F3 +S2 +W5 +F71 +W2 +F86 +E5 +N1 +F32 +R270 +F1 +E4 +F18 +R180 +R90 +E1 +S5 +S3 +W2 +F75 +W4 +N1 +F3 +E1 +F46 +R90 +N4 +W5 +L90 +F76 +W2 +F62 +N2 +F29 +E2 +N4 +F60 +L90 +N2 +L90 +F31 +R270 +F97 +S4 +F75 +L90 +S4 +F51 +L90 +W5 +L90 +F53 +R270 +N1 +L90 +E3 +R90 +W1 +F44 +N1 +F97 +R90 +N2 +W4 +F27 +L90 +F91 +E1 +S5 +R180 +W5 +N2 +L90 +E2 +N5 +F34 +F26 +R90 +N2 +E4 +S5 +F58 +W1 +F3 +N5 +E3 +S2 +W4 +N2 +W5 +F19 +L180 +W4 +F68 +L90 +N5 +R90 +F65 +S4 +R180 +S4 +L90 +F59 +R90 +E3 +R90 +F44 +L90 +E5 +F19 +W5 +N4 +F10 +N4 +L90 +S4 +L90 +W3 +F75 +R180 +E5 +F97 +E3 +F63 +S3 +F53 +W2 +F53 +N1 +L90 +F14 +S3 +E5 +L90 +N5 +F28 +L90 +F3 +L90 +S2 +F52 +S2 +F99 +S5 +W2 +L90 +S1 +W5 +L90 +S1 +F11 +R90 +W4 +R90 +F11 +N3 +W3 +N5 +F39 +W1 +F50 +N2 +L90 +W4 +F88 +S5 +W4 +R270 +W4 +F55 +R90 +E3 +R180 +S1 +E3 +F100 +E3 +F38 +N3 +F28 +E5 +R90 +F94 +R180 +F95 +R90 +W4 +R180 +F40 +N4 +R90 +S5 +F69 +E2 +F2 +N5 +W2 +F16 +S2 +F71 +W2 +N3 +L90 +F36 +W1 +F90 +N5 +R90 +F93 +E2 +F23 +N1 +L90 +F22 +R90 +L90 +N4 +L180 +F7 +L90 +W2 +F29 +N2 +L90 +E4 +R90 +N5 +F13 +R180 +F87 +L90 +S1 +L90 +E2 +R90 +F19 +S4 +F100 +L270 +W1 +L180 +F87 +N1 +F100 +R90 +S3 +L90 +W1 +N1 +L90 +W2 +F98 +L180 +S1 +W4 +S5 +F45 +S4 +L90 +E1 +S4 +F31 +E1 +S1 +E2 +R90 +S5 +L90 +F12 +R180 +W1 +L90 +N1 +L90 +F23 +E4 +S2 +L90 +E5 +S4 +F21 +N3 +R90 +W4 +E5 +F32 +S1 +E2 +L90 +F45 +L90 +W3 +L180 +F100 +S5 +F88 +S5 +F29 +E1 +L180 +F12 +S5 +F52 +N2 +F31 +R90 +E1 +L90 +F64 +W3 +L90 +N1 +R90 +F60 +E2 +F4 +S1 +F97 +F62 +L180 +F66 +R90 +E1 +S5 +R90 +S3 +F96 +W1 +N2 +F95 +R90 +E3 +R90 +E2 +S2 +E4 +F42 +S4 +E4 +L90 +E1 +F73 +L90 +N3 +L90 +F82 +S3 +R270 +S5 +W1 +R90 +W2 +S1 +S3 +L90 +F74 +S3 +F13 +R180 +F32 +E2 +S2 +F93 +N1 +R270 +F4 +E5 +F63 +W2 +L180 +F26 +E3 +N5 +R90 +N3 +L270 +F22 +N1 +W5 +F29 +S5 +R90 +S1 +F3 +N4 +R90 +E3 +R90 +N2 +L90 +N3 +F42 +W4 +F37 +L90 +F15 +W3 +N5 +F25 +E2 +F33 +E2 +S1 +L90 +F55 +E4 +L90 +W1 +N1 +F30 +E2 +R90 +E2 +F80 +L90 +W2 +S1 +F9 +L270 +W2 +F82 +L90 +F94 +N5 +F16 +W5 +F74 +R180 +N3 +F58 +W5 +F95 +R270 +S4 +F55 +L90 +N1 +L180 +F85 +N2 +R90 +E1 +L90 +F57 +S2 +L90 +F31 +L180 +S3 +L90 +F58 +N3 +L270 +N3 +R270 +F15 +L180 +N4 +L90 +N5 +R180 +E1 +S4 +F11 +L90 +E5 +N4 +E3 +L90 +E4 +F71 +R90 +S2 +E3 +L90 +S3 +F90 +W4 +F8 +R180 +N3 +W4 +S4 +F58 +N4 +E1 +L180 +S4 +W1 +R180 +F47 +S1 +L90 +R90 +N1 +E1 +N4 +R180 +N2 +E1 +R90 +E3 +L90 +F67 +N3 +F51 +N1 +F41 +L180 +R90 +F5 +E2 +S5 +W1 +F51 +R180 +N1 +E1 +F91 +R90 +N2 +L90 +F66 +L90 +S3 +L90 +F52 +E2 +S1 +F66 +R180 +F18 +W5 +L90 +W1 +F88 +S1 +R180 +F92 +L90 +S5 +F19 +L90 +E3 +S3 +E3 +N5 +W3 +F8 +E2 +S4 +F3 \ No newline at end of file diff --git a/2020/12/prog.py b/2020/12/prog.py new file mode 100644 index 0000000..7e94e74 --- /dev/null +++ b/2020/12/prog.py @@ -0,0 +1,67 @@ +def get_input(sample = False): + with open("sample" if sample else "input") as f: + return [(line[:1], int(line[1:])) for line in f.readlines()] + +def new_dir_after_rotate(cur_dir: str, L_or_R: str, amount: int): + orientations = ["N", "E", "S", "W"] + cur_dir_i = orientations.index(cur_dir) + return orientations[(cur_dir_i + (1 if L_or_R == "R" else -1) * amount // 90) % len(orientations)] + +def new_waypoint_after_rotate(cur_wp: list, L_or_R: str, amount: int): + ret = [0, 0] + + rot = amount // 90 % 4 + if (rot, L_or_R) == (1, "L") or (rot, L_or_R) == (3, "R"): + ret[0] = -cur_wp[1] + ret[1] = cur_wp[0] + elif rot == 2: + ret[0] = -cur_wp[0] + ret[1] = -cur_wp[1] + elif (rot, L_or_R) == (3, "L") or (rot, L_or_R) == (1, "R"): + ret[0] = cur_wp[1] + ret[1] = -cur_wp[0] + + return ret + +def get_result(instructions: dict, part = 1): + position = [0, 0] + waypoint = [10, 1] + cur_dir = "E" + + + add_to_vertical = lambda dir, x: (1 if dir == "N" else -1) * x + add_to_horizontal = lambda dir, x: (1 if dir == "E" else -1) * x + + for cmd, amount in instructions: + if part == 1: + if cmd == "F": + if cur_dir in ["N", "S"]: + position[1] += add_to_vertical(cur_dir, amount) + elif cur_dir in ["E", "W"]: + position[0] += add_to_horizontal(cur_dir, amount) + elif cmd in ["L", "R"]: + cur_dir = new_dir_after_rotate(cur_dir, cmd, amount) + elif cmd in ["N", "E", "S", "W"]: + if cmd in ["N", "S"]: + position[1] += add_to_vertical(cmd, amount) + elif cmd in ["E", "W"]: + position[0] += add_to_horizontal(cmd, amount) + else: + if cmd == "F": + position[0] += waypoint[0] * amount + position[1] += waypoint[1] * amount + elif cmd in ["L", "R"]: + waypoint = new_waypoint_after_rotate(waypoint, cmd, amount) + elif cmd in ["N", "E", "S", "W"]: + if cmd in ["N", "S"]: + waypoint[1] += add_to_vertical(cmd, amount) + elif cmd in ["E", "W"]: + waypoint[0] += add_to_horizontal(cmd, amount) + + + return sum(map(lambda x: abs(x), position)) + +if __name__ == "__main__": + print(get_result(get_input(), part = 2)) + + diff --git a/2020/12/sample b/2020/12/sample new file mode 100644 index 0000000..48c2a50 --- /dev/null +++ b/2020/12/sample @@ -0,0 +1,5 @@ +F10 +N3 +F7 +R90 +F11 \ No newline at end of file diff --git a/2020/12/test.py b/2020/12/test.py new file mode 100644 index 0000000..9f190f3 --- /dev/null +++ b/2020/12/test.py @@ -0,0 +1,64 @@ +import unittest +from prog import * + +class Rotate(unittest.TestCase): + def test_rotate_L90(self): + self.assertEqual(new_dir_after_rotate("N", "L", 90), "W") + self.assertEqual(new_dir_after_rotate("E", "L", 90), "N") + self.assertEqual(new_dir_after_rotate("S", "L", 90), "E") + self.assertEqual(new_dir_after_rotate("W", "L", 90), "S") + + def test_rotate_R90(self): + self.assertEqual(new_dir_after_rotate("N", "R", 90), "E") + self.assertEqual(new_dir_after_rotate("E", "R", 90), "S") + self.assertEqual(new_dir_after_rotate("S", "R", 90), "W") + self.assertEqual(new_dir_after_rotate("W", "R", 90), "N") + + def test_rotate_L180(self): + self.assertEqual(new_dir_after_rotate("N", "L", 180), "S") + self.assertEqual(new_dir_after_rotate("E", "L", 180), "W") + self.assertEqual(new_dir_after_rotate("S", "L", 180), "N") + self.assertEqual(new_dir_after_rotate("W", "L", 180), "E") + + def test_rotate_R180(self): + self.assertEqual(new_dir_after_rotate("N", "R", 180), "S") + self.assertEqual(new_dir_after_rotate("E", "R", 180), "W") + self.assertEqual(new_dir_after_rotate("S", "R", 180), "N") + self.assertEqual(new_dir_after_rotate("W", "R", 180), "E") + + def test_rotate_L270(self): + self.assertEqual(new_dir_after_rotate("N", "L", 270), "E") + self.assertEqual(new_dir_after_rotate("E", "L", 270), "S") + self.assertEqual(new_dir_after_rotate("S", "L", 270), "W") + self.assertEqual(new_dir_after_rotate("W", "L", 270), "N") + + def test_rotate_R270(self): + self.assertEqual(new_dir_after_rotate("N", "R", 270), "W") + self.assertEqual(new_dir_after_rotate("E", "R", 270), "N") + self.assertEqual(new_dir_after_rotate("S", "R", 270), "E") + self.assertEqual(new_dir_after_rotate("W", "R", 270), "S") + + def test_rotate_L360(self): + self.assertEqual(new_dir_after_rotate("N", "L", 360), "N") + self.assertEqual(new_dir_after_rotate("E", "L", 360), "E") + self.assertEqual(new_dir_after_rotate("S", "L", 360), "S") + self.assertEqual(new_dir_after_rotate("W", "L", 360), "W") + + def test_rotate_R360(self): + self.assertEqual(new_dir_after_rotate("N", "R", 360), "N") + self.assertEqual(new_dir_after_rotate("E", "R", 360), "E") + self.assertEqual(new_dir_after_rotate("S", "R", 360), "S") + self.assertEqual(new_dir_after_rotate("W", "R", 360), "W") + +class Result(unittest.TestCase): + def setUp(self): + self.inp = get_input(sample = True) + + def test_part_1(self): + result = get_result(self.inp) + self.assertEqual(result, 25) + + def test_part_2(self): + result = get_result(self.inp, part = 2) + self.assertEqual(result, 286) + diff --git a/2020/13/__pycache__/prog.cpython-38.pyc b/2020/13/__pycache__/prog.cpython-38.pyc new file mode 100644 index 0000000..123c50c Binary files /dev/null and b/2020/13/__pycache__/prog.cpython-38.pyc differ diff --git a/2020/13/__pycache__/test.cpython-38.pyc b/2020/13/__pycache__/test.cpython-38.pyc new file mode 100644 index 0000000..d1f1b42 Binary files /dev/null and b/2020/13/__pycache__/test.cpython-38.pyc differ diff --git a/2020/13/input b/2020/13/input new file mode 100644 index 0000000..22ec6b5 --- /dev/null +++ b/2020/13/input @@ -0,0 +1,2 @@ +1002462 +37,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,41,x,x,x,x,x,x,x,x,x,601,x,x,x,x,x,x,x,x,x,x,x,19,x,x,x,x,17,x,x,x,x,x,23,x,x,x,x,x,29,x,443,x,x,x,x,x,x,x,x,x,x,x,x,13 \ No newline at end of file diff --git a/2020/13/prog.py b/2020/13/prog.py new file mode 100644 index 0000000..b6fd033 --- /dev/null +++ b/2020/13/prog.py @@ -0,0 +1,52 @@ +from math import gcd + +def get_input(sample = False): + with open("sample" if sample else 'input', 'r') as f: + ret = [] + lines = f.readlines() + ret.append(int(lines[0])) + ret.append([int(x) if x != "x" else x for x in lines[1].split(',')]) + + return ret + +def get_next_bus_departure(bus_id: int, cur_time: int): + return bus_id * math.ceil(cur_time / bus_id) + +def get_result(data: list, part = 1): + cur_time = data[0] + busses = data[1] + + if part == 1: + eta_n_bus = {} + for bus in busses: + if bus == 'x': continue + + eta = get_next_bus_departure(bus, cur_time) + eta_n_bus[eta] = bus + + earliest = min(eta_n_bus.keys()) + earliest_bus = eta_n_bus[earliest] + waiting_time = earliest - cur_time + return waiting_time * earliest_bus + else: + step = busses[0] + bus_n_offsets = [(bus, offset) for offset, bus in enumerate(busses) if bus != 'x'] + time = 0 + + for bus, offset in bus_n_offsets[1:]: + while True: + time += step + if (time + offset) % bus == 0: + step = lcm(step, bus) + break + return time + + + + +def lcm(a, b): + return abs(a*b) // gcd(a, b) + + +if __name__ == "__main__": + print(get_result(get_input(), part = 2)) diff --git a/2020/13/sample b/2020/13/sample new file mode 100644 index 0000000..e473080 --- /dev/null +++ b/2020/13/sample @@ -0,0 +1,2 @@ +939 +7,13,x,x,59,x,31,19 \ No newline at end of file diff --git a/2020/13/test.py b/2020/13/test.py new file mode 100644 index 0000000..f4b67df --- /dev/null +++ b/2020/13/test.py @@ -0,0 +1,20 @@ +from prog import * +import unittest + +class Methods(unittest.TestCase): + def test_get_input(self): + inp = get_input(sample = True) + self.assertEqual(inp, [939, [7, 13, 'x', 'x', 59, 'x', 31, 19]]) + +class Result(unittest.TestCase): + def setUp(self): + self.inp = get_input(sample = True) + + def test_part_1(self): + self.assertEqual(get_result(self.inp), 295) + + def test_part_2(self): + self.assertEqual(get_result([0, [7, 13]], part = 2), 77) + self.assertEqual(get_result([0, [17, 'x', 13, 19]], part = 2), 3417) + self.assertEqual(get_result(self.inp, part = 2), 1068781) + diff --git a/2020/14/__pycache__/prog.cpython-38.pyc b/2020/14/__pycache__/prog.cpython-38.pyc new file mode 100644 index 0000000..55cebae Binary files /dev/null and b/2020/14/__pycache__/prog.cpython-38.pyc differ diff --git a/2020/14/__pycache__/test.cpython-38.pyc b/2020/14/__pycache__/test.cpython-38.pyc new file mode 100644 index 0000000..f50465c Binary files /dev/null and b/2020/14/__pycache__/test.cpython-38.pyc differ diff --git a/2020/14/input b/2020/14/input new file mode 100644 index 0000000..aebbd64 --- /dev/null +++ b/2020/14/input @@ -0,0 +1,554 @@ +mask = 1110X1110XXX101X0011010X110X10X0110X +mem[40257] = 51331021 +mem[18433] = 464024066 +mem[9993] = 463909 +mask = 11X011010X110X101X011X1X010X10100001 +mem[54152] = 692939 +mem[31079] = 22525259 +mem[33597] = 474240 +mem[3881] = 919507 +mem[24651] = 48975360 +mem[14815] = 1554 +mem[17731] = 1337580 +mask = X0X0111111000000100101100X000X10X001 +mem[56856] = 474071 +mem[3724] = 29660 +mem[18229] = 189 +mem[34570] = 419796001 +mem[11355] = 65374715 +mem[37999] = 522634 +mask = 1111X0111XX00000111X1010X1101XX01110 +mem[3262] = 99770791 +mem[4906] = 11370 +mem[12532] = 1083912 +mask = 10110101101X1X00X1111010001001010X10 +mem[46252] = 84993342 +mem[5286] = 1013690 +mask = 11X001110111101X001101XX100110001010 +mem[55055] = 516 +mem[38350] = 615 +mem[51960] = 2038 +mem[61990] = 957107 +mem[24357] = 8172 +mask = 1XXX1111X101001X011X000X110110001X01 +mem[57990] = 3734 +mem[50349] = 101222011 +mem[45511] = 42986512 +mem[40272] = 403 +mem[54329] = 1626458 +mem[26816] = 448210757 +mask = 11101111011000X01X1XX100X0XXX010X001 +mem[51488] = 333041 +mem[30893] = 3258 +mem[31999] = 14972408 +mem[48851] = 74906 +mem[22619] = 3442368 +mask = 0X000X11X10XXX101011010X001111111011 +mem[6850] = 1224301 +mem[48485] = 34534000 +mem[24614] = 1055775 +mask = 0100X11101X100X0X11100XX110011101100 +mem[18755] = 100409700 +mem[31397] = 114132362 +mask = 1110111111000X011XX1X10011X001011001 +mem[25234] = 575 +mem[54990] = 110437 +mem[5738] = 872 +mem[37430] = 206977297 +mem[40257] = 767384 +mem[478] = 5752 +mask = 111001110111101X001101X1100110X010X1 +mem[21231] = 2835725 +mem[14092] = 1259011 +mem[23506] = 3099 +mask = 1110001X1111001X1101101XXX100X0010XX +mem[37900] = 79419475 +mem[37628] = 125826 +mem[11380] = 624 +mem[36032] = 284016390 +mem[47266] = 767 +mask = XX10X1101101XXX0111110011100X111110X +mem[48427] = 18603 +mem[19559] = 124107997 +mem[49782] = 29154 +mem[3724] = 136805 +mem[49580] = 148450462 +mem[54342] = 180288875 +mask = 110011110101X01001X10XX11X1XX111X011 +mem[49856] = 445359 +mem[7226] = 4303932 +mem[62181] = 12485531 +mem[45386] = 1037 +mask = X1X01111X1010010XX11X1000100XX1000X1 +mem[32337] = 31771 +mem[55567] = 1438485 +mem[49504] = 452407 +mem[15890] = 64458173 +mem[9930] = 43490551 +mask = 101X1111111X00101X110X100100XX111101 +mem[11172] = 30476781 +mem[16705] = 10356 +mem[9799] = 3517752 +mem[35121] = 991958953 +mem[12861] = 13640943 +mem[15424] = 98158 +mask = X110011X010XX01100X100010X1XX0001101 +mem[31621] = 456005334 +mem[57990] = 5145 +mem[7067] = 127283 +mem[57106] = 322139 +mem[49968] = 2140844 +mask = 1X1001X1X01X10110XX101XX010X00000100 +mem[42602] = 128159 +mem[26816] = 7253653 +mem[26531] = 42978 +mem[7592] = 249896576 +mem[7956] = 1315 +mask = 111011X1X11100X011X1010101XXX0XX0010 +mem[52446] = 1677086 +mem[44919] = 1499581 +mem[34842] = 5043767 +mem[24471] = 579304892 +mem[4380] = 1934 +mem[44081] = 2818 +mask = X1101X0X110X00X111X001001100111X0010 +mem[44457] = 10924 +mem[61114] = 41913513 +mem[25625] = 1074 +mem[53821] = 4293765 +mem[21864] = 895125 +mem[18764] = 24202 +mask = X111011X0110XX0X1011110111000011000X +mem[28782] = 3396 +mem[51935] = 250016 +mem[29096] = 1633 +mask = 100011111X0X000X1011101X00001100X011 +mem[50213] = 21062 +mem[17583] = 17889 +mem[6214] = 755665 +mem[41630] = 554432 +mem[36640] = 21683065 +mem[9993] = 663 +mask = 10X0111111X00010X0X1000X0000101X1000 +mem[31206] = 1563 +mem[31999] = 893563867 +mem[25234] = 16239 +mem[16826] = 1185 +mem[6325] = 308015 +mask = 111000X11101001X11X1010000101XXX0010 +mem[714] = 174841 +mem[47336] = 1080 +mem[48590] = 5902057 +mask = 111011110X1100001101101111X10101X1X1 +mem[11741] = 285199 +mem[32864] = 794118 +mem[50294] = 3086 +mem[21244] = 13500488 +mem[52937] = 668328 +mem[25942] = 14773413 +mask = X11001111X10000011X101X0111010000X01 +mem[55993] = 227666987 +mem[54990] = 29299 +mem[10848] = 14517154 +mem[26412] = 920115307 +mask = 1X0X11111100001XX00100X01X0010111101 +mem[14992] = 62272953 +mem[48256] = 5676 +mem[19361] = 168138195 +mem[144] = 986 +mem[36032] = 911 +mask = 1X10001111110X1X110X10X1X01X1010X001 +mem[9960] = 4200 +mem[8832] = 1841117 +mask = 111X111101X00X101X11010000111111X001 +mem[32864] = 15880 +mem[9966] = 7278514 +mem[46710] = 1818748 +mem[1863] = 13021558 +mask = 1110001111X1001011X11001101000XX0XXX +mem[63705] = 3162416 +mem[45211] = 686629227 +mem[26397] = 17094 +mem[9999] = 783527 +mem[25355] = 2865745 +mem[37999] = 982 +mask = XXX01111110000XX10X10100010XX1X01001 +mem[36032] = 1405160 +mem[25234] = 10488275 +mem[56856] = 9235 +mem[62886] = 10583974 +mask = 01000111X10X00X11011X0X11010111XX00X +mem[9960] = 108631252 +mem[20641] = 236021 +mem[54181] = 898590 +mem[47206] = 357135433 +mask = 0X00X11111010010111X0000011001110X01 +mem[34160] = 168879 +mem[31424] = 28869180 +mem[24916] = 10670389 +mem[738] = 352 +mem[47762] = 8844766 +mask = 111011X10110X010X011X00000001100XXXX +mem[22643] = 52619618 +mem[26725] = 18104217 +mem[51488] = 348349 +mask = 1X1011110XXX00101111100000110000X10X +mem[56604] = 38442 +mem[64943] = 178378 +mem[14699] = 13770627 +mask = 11X01111001010X01011100000010X10X010 +mem[17095] = 9031632 +mem[21925] = 157279 +mem[16803] = 28186944 +mask = 010XX11XX1X0001X10X11101X00111011X01 +mem[18863] = 1188008 +mem[5968] = 795 +mem[43052] = 2990150 +mem[38515] = 747 +mem[44368] = 496 +mem[45434] = 2077409 +mask = 0X10111X111100111X1X000XXX00X01X1010 +mem[13059] = 23890054 +mem[51572] = 29407 +mem[39964] = 4094674 +mem[59053] = 5346433 +mask = 1110011111X100X011011X11111110X11100 +mem[1791] = 12339300 +mem[51641] = 105572 +mem[22529] = 1649 +mem[29570] = 930208 +mask = 11101111X1XX00101X111000XX000X10X0X1 +mem[19744] = 1667 +mem[18167] = 556 +mem[52216] = 39333 +mem[8118] = 28457779 +mem[14409] = 7493808 +mem[32337] = 34018 +mask = 0110X1111X010X10001X1110011X0010001X +mem[40] = 27424 +mem[6244] = 41469 +mem[6612] = 214 +mem[36981] = 34852720 +mem[35860] = 74811624 +mem[44120] = 82357013 +mem[5999] = 395 +mask = X1X0111111000001XX11X1000XX001000010 +mem[12392] = 8235335 +mem[52538] = 236135318 +mem[7227] = 6809 +mask = 111011X10110X010111100001X00X00000X1 +mem[13662] = 270146 +mem[49569] = 11401458 +mem[49782] = 12256 +mask = X11X11110X10X000101111XXXX0100100001 +mem[63774] = 25139 +mem[47309] = 107486126 +mem[39140] = 884 +mem[35267] = 2032 +mem[16513] = 3724990 +mem[47901] = 120378235 +mem[47121] = 574 +mask = 1100X1X100110110XX010111110111101111 +mem[21716] = 53071834 +mem[9997] = 343 +mem[34175] = 109609 +mem[22643] = 59660540 +mask = 011X1X10111X001111X100X1011010100001 +mem[2872] = 4637 +mem[7429] = 13346151 +mem[21514] = 521995 +mask = 0111X1X1X11010001011X10011000X11110X +mem[34817] = 34195656 +mem[59139] = 1538904 +mem[33597] = 7322219 +mem[43471] = 2053 +mem[31759] = 352 +mem[24649] = 393907 +mask = 0010X1111X10001010X100001X010011111X +mem[53821] = 389983024 +mem[30685] = 681448 +mem[14409] = 8810596 +mem[58403] = 202202 +mem[59589] = 11132409 +mem[36376] = 1035668 +mem[10107] = 282 +mask = 1X00110101X1001010011010X0100000X001 +mem[35009] = 1137976 +mem[30376] = 893048407 +mem[44428] = 1634 +mask = X01X11111111001X111X10X111X00X1111X0 +mem[3088] = 1335 +mem[57928] = 2122936 +mem[14992] = 1850 +mem[50886] = 596 +mem[20951] = 1834738 +mask = X11111X1X0X000001X11XX1010X10X000001 +mem[46309] = 1344734 +mem[57393] = 7607663 +mem[64140] = 412481329 +mem[31937] = 4156010 +mask = 01000XX11100XX1110X10X00X011X11010X0 +mem[21092] = 188978 +mem[58601] = 747 +mask = 11101XX11100X001100001000X0000X11X10 +mem[49580] = 681666 +mem[28396] = 6693 +mem[21446] = 2871 +mem[8409] = 129741145 +mem[26851] = 64088468 +mask = 1X101111X111X001101010X001000000XX11 +mem[50617] = 2893221 +mem[44352] = 351080 +mem[6973] = 74704635 +mem[35215] = 58274979 +mem[34986] = 204485850 +mem[46431] = 483390728 +mask = 11101X11011100101101X00X010010X0X100 +mem[21875] = 106030145 +mem[18755] = 2197864 +mem[21518] = 110524 +mask = 101001011101X0001111XX01X000010X10X1 +mem[3866] = 10698 +mem[25215] = 23678 +mem[16705] = 8210939 +mem[40472] = 1601 +mem[43847] = 4262784 +mem[20280] = 845863570 +mask = X110XX1XX101001011X101X01000X00100X1 +mem[57100] = 7125772 +mem[64179] = 73893 +mem[54526] = 3175087 +mem[62001] = 1973479 +mask = 11X0111XXX00001010111X00X00X0XX01011 +mem[54845] = 10595 +mem[31178] = 10986515 +mem[16074] = 765117 +mem[39388] = 548 +mem[16713] = 2599663 +mask = 0100X111110100XX1X11X1X1001000110XX1 +mem[21508] = 3155 +mem[28193] = 144849 +mem[8918] = 5192 +mem[610] = 1144170 +mem[61348] = 102390786 +mem[43515] = 27343 +mem[63705] = 10436512 +mask = X100X11101000011101XXXX1101001XX0X01 +mem[47313] = 28073 +mem[33901] = 90318443 +mem[64222] = 7293 +mask = X110111XX11X00011X1X101X0100000XX001 +mem[24490] = 2682 +mem[9264] = 627919 +mem[1411] = 8120967 +mem[17130] = 1272496 +mem[2438] = 30859917 +mask = 110XXX111101X0X00X11100X010X011001X1 +mem[6973] = 19850171 +mem[51470] = 67939742 +mask = 10100111110100XX111100XX1X01X0010110 +mem[11147] = 30 +mem[22117] = 3508 +mem[32551] = 29083435 +mask = 101001XX1101X0001111X0010X01XXX11X01 +mem[18544] = 482715873 +mem[56829] = 24246491 +mem[19107] = 39530 +mem[11939] = 361324 +mem[64069] = 3257668 +mem[37976] = 2801177 +mask = X1101101X1110X10X001101X10X0110001X1 +mem[41961] = 94719 +mem[5528] = 319045708 +mem[31759] = 597770 +mem[3298] = 54756 +mem[39780] = 454394346 +mask = 11101111X1X1X010111101001X101011XX0X +mem[6325] = 54296774 +mem[53884] = 2248 +mem[41087] = 315232205 +mem[17418] = 227971462 +mem[46081] = 5766 +mask = 1010XX00X1011000X1110X0X000110XX1100 +mem[36022] = 2440 +mem[309] = 11100855 +mem[40840] = 113562551 +mem[51488] = 1410 +mem[38724] = 80445305 +mem[46414] = 693 +mask = 100011111X010011X11100X01001XX0X1001 +mem[6850] = 1658 +mem[27296] = 2089 +mem[34000] = 227145532 +mem[36309] = 6512 +mem[8049] = 41857993 +mem[3603] = 2183079 +mem[9019] = 583919731 +mask = 11XX1XX1110000011X0XX1101100X101101X +mem[42218] = 3195265 +mem[24649] = 20411584 +mask = 1110111X0101X0100011000011000X00X001 +mem[21925] = 945752010 +mem[26816] = 463236906 +mem[8118] = 75 +mem[7382] = 3470 +mem[24647] = 65907 +mem[34226] = 703 +mask = X11011111101X01011111011XX0000101001 +mem[54526] = 523463 +mem[12392] = 240399435 +mask = X01011111110001011111XX00XX00011X001 +mem[29635] = 370994023 +mem[1064] = 1593105 +mem[39783] = 4929783 +mem[7721] = 3697 +mem[19747] = 911509249 +mem[12181] = 8022 +mem[9277] = 269282378 +mask = 1100111XXX0X000110X1X0001100010010X1 +mem[62185] = 768934 +mem[8118] = 238 +mem[16448] = 67217 +mem[1286] = 2768751 +mask = 11X001X11110X0001111X01010X0X0000XX0 +mem[26659] = 4857903 +mem[15890] = 41829451 +mem[61153] = 1745 +mem[33685] = 1322893 +mem[58844] = 22060038 +mask = 11X0X111011100X011011111XXX00011001X +mem[41057] = 504 +mem[9775] = 90755012 +mem[35694] = 1327 +mem[14023] = 5965 +mem[46660] = 15962 +mem[45618] = 93484 +mask = X01111111X11001011100X01X000X0XXX01X +mem[41817] = 30341471 +mem[40062] = 2045 +mem[20631] = 3206 +mem[57953] = 99 +mask = X11011X101X11000111100011101X0001110 +mem[53840] = 154298805 +mem[46322] = 653989 +mem[36288] = 427196 +mem[50550] = 54235668 +mem[61463] = 9653 +mem[58758] = 8531442 +mem[25942] = 187891326 +mask = 1X1011111100001010X1X00000000X1XX001 +mem[24145] = 670 +mem[39140] = 8027405 +mask = 01X01110X11000111111100X001100101X1X +mem[1858] = 465546026 +mem[53156] = 33616871 +mem[34303] = 3814644 +mem[9993] = 424038168 +mem[18379] = 105249 +mask = 1110111X0111001X111101010X11X00X1010 +mem[37628] = 1729777 +mem[14716] = 37020621 +mem[40472] = 633 +mask = 1110111XX11X000X1111001X01000011X00X +mem[32816] = 22945 +mem[58409] = 4261203 +mask = 0110111111110001110X0X1XX111X01110X1 +mem[25234] = 1845 +mem[11313] = 26080 +mem[9420] = 894744 +mem[55530] = 854 +mask = 011011101X11001111X100X00011X0010100 +mem[11839] = 96131 +mem[53757] = 1408 +mem[44034] = 27236 +mem[2385] = 383509 +mask = 111111110XX000001X110X0X00010000XX1X +mem[32942] = 18689 +mem[45731] = 632528 +mem[51515] = 65228710 +mem[7190] = 512188 +mem[55271] = 109657287 +mask = X1101X1111110000111X0X0001001110X010 +mem[31454] = 53024958 +mem[39884] = 1067 +mem[45511] = 12320135 +mem[49866] = 122369 +mem[57038] = 27967196 +mem[29561] = 2925457 +mask = 1X1XXXX11X10X0001111101101101000011X +mem[5666] = 246869 +mem[16826] = 4819818 +mem[9708] = 56613002 +mem[19527] = 979537 +mem[46710] = 1863 +mem[24930] = 9732123 +mask = 0010X11111XX00101X110X0011100X01X000 +mem[54809] = 7602 +mem[46221] = 1952 +mem[18345] = 3892597 +mem[5738] = 9611 +mem[53884] = 2050573 +mem[35694] = 1819 +mem[52446] = 1143 +mask = 01001111110100XX0XXX010000001010XX01 +mem[7226] = 7110 +mem[58560] = 9302 +mem[47854] = 13408926 +mem[50530] = 115326557 +mask = 00101111111000101111000X010X001X00X0 +mem[46080] = 88122926 +mem[36726] = 990065 +mem[6612] = 244727289 +mem[3724] = 7537840 +mem[41817] = 244009305 +mem[42763] = 100935344 +mask = 11111X110010X0001X1111000X1000111101 +mem[29093] = 3116673 +mem[17213] = 576 +mem[42218] = 742524 +mask = 00101X101X010010111X11X1110001X10X1X +mem[18167] = 5096 +mem[18013] = 110009 +mem[12532] = 548 +mem[58899] = 72440595 +mask = 00111111X111X0111110X1011X1101111001 +mem[12181] = 417885 +mem[28523] = 561 +mem[63924] = 785190 +mem[31937] = 27019144 +mem[569] = 149095763 +mem[54809] = 2678 +mem[14355] = 15451 +mask = 10101X11X1000X1X100111011001X1101001 +mem[29525] = 27635 +mem[38648] = 286224 +mem[40257] = 33000302 +mem[2385] = 87334 +mask = 100011X1110000X1X0010X10X10001011011 +mem[10671] = 752653692 +mem[29096] = 28346 +mem[64943] = 5823968 +mem[8985] = 1725 +mem[14409] = 432068 +mask = 11101X11XX11X00011110X0111X11X001X10 +mem[35782] = 26162 +mem[18167] = 265539 +mem[53514] = 17777350 +mask = 0110111X111X00X111X100000111X0100XXX +mem[11289] = 25199 +mem[21966] = 1577738 +mem[33100] = 7214029 +mem[14371] = 225814 +mask = 1110X111111000X011X11X1XX0XX0010X000 +mem[54809] = 164605380 +mem[38947] = 1624427 +mem[63150] = 221584 +mask = 11101111XX0110X0X01101X010XX101X1X00 +mem[28523] = 622707 +mem[8072] = 227741 +mem[6611] = 15393 +mem[2600] = 386986740 +mask = 110010X111010X10X1110001X11001110101 +mem[46256] = 1543619 +mem[58524] = 128793487 +mem[39996] = 2787 \ No newline at end of file diff --git a/2020/14/prog.py b/2020/14/prog.py new file mode 100644 index 0000000..7d86c55 --- /dev/null +++ b/2020/14/prog.py @@ -0,0 +1,69 @@ +import re + +def get_input(sample = False, sample_n = 1): + with open(f"sample_{sample_n}" if sample else 'input', 'r') as f: + return [line.strip() for line in f.readlines()] + + +def parse_val_masks(mask: str): + mask_0 = 0 + mask_1 = 0 + for c in mask: + if c == "X": + mask_0 = (mask_0 << 1) + 1 + mask_1 = mask_1 << 1 + elif c == "0": + mask_0 = mask_0 << 1 + mask_1 = mask_1 << 1 + elif c == "1": + mask_0 = (mask_0 << 1) + 1 + mask_1 = (mask_1 << 1) + 1 + + return mask_0, mask_1 + +def masked_value(value: int, masks: tuple): + return (value & masks[0]) | masks[1] + +def decode_memory_address(address: int, mask: str): + ret = {address} + for i, c in enumerate(mask): + shift_amount = len(mask) - 1 - i + if c in ['1', 'X']: + new_ret = set() + for addr in ret: + if c == '1': + new_ret.add(addr | (1 << shift_amount)) + elif c == 'X': + new_ret.update((addr | (1 << shift_amount), addr & ~(1 << shift_amount))) + ret = new_ret + return ret + + + +def get_result(instructions: list, part = 1): + mem_re = re.compile(r'^mem\[(\d+)\] = (\d+)$') + mask_re = re.compile(r'^mask = ([X10]{36})$') + mem = {} + val_masks = (0, 0) + mem_masks = "" + + for cmd in instructions: + if match := mem_re.match(cmd): + index, value = (int(x) for x in match.groups()) + + indexes = {index} if part == 1 else decode_memory_address(index, mem_mask) + for i in indexes: + mem[i] = masked_value(value, val_masks) if part == 1 else value + + elif match := mask_re.match(cmd): + val_masks = parse_val_masks(*match.groups()) + mem_mask = match.groups()[0] + + else: + raise ValueError(f"The instruction `{cmd}` is not valid") + + return sum(mem.values()) + +if __name__ == "__main__": + print(get_result(get_input(), part = 2)) + diff --git a/2020/14/sample_1 b/2020/14/sample_1 new file mode 100644 index 0000000..fa0dd0a --- /dev/null +++ b/2020/14/sample_1 @@ -0,0 +1,4 @@ +mask = XXXXXXXXXXXXXXXXXXXXXXXXXXXXX1XXXX0X +mem[8] = 11 +mem[7] = 101 +mem[8] = 0 \ No newline at end of file diff --git a/2020/14/sample_2 b/2020/14/sample_2 new file mode 100644 index 0000000..b4b4e06 --- /dev/null +++ b/2020/14/sample_2 @@ -0,0 +1,4 @@ +mask = 000000000000000000000000000000X1001X +mem[42] = 100 +mask = 00000000000000000000000000000000X0XX +mem[26] = 1 \ No newline at end of file diff --git a/2020/14/test.py b/2020/14/test.py new file mode 100644 index 0000000..18df7d2 --- /dev/null +++ b/2020/14/test.py @@ -0,0 +1,42 @@ +from prog import * +import unittest + +class Methods(unittest.TestCase): + def test_parse_masks(self): + self.assertEqual( + parse_masks("XXXXXXXXXXXXXXXXXXXXXXXXXXXXX1XXXX0X"), + ( + 0b111111111111111111111111111111111101, + 0b000000000000000000000000000001000000 + ) + ) + + self.assertEqual( + parse_masks("XXXXXXXXX1XXXXXXXX1X0XXXXXXXX1XXXX0X"), + ( + 0b111111111111111111110111111111111101, + 0b000000000100000000100000000001000000 + ) + ) + + self.assertEqual( + parse_masks("XXXXX11XXXX1XX000XX0XXXXXXXXX1XXXX0X"), + ( + 0b111111111111110001101111111111111101, + 0b000001100001000000000000000001000000 + ) + ) + + def test_decode_memory(self): + mask = "000000000000000000000000000000X1001X" + self.assertEqual(decode_memory_address(42, mask), {26, 27, 58, 59}) + + mask = "00000000000000000000000000000000X0XX" + self.assertEqual(decode_memory_address(26, mask), {16, 17, 18, 19, 24, 25, 26, 27}) + +class Result(unittest.TestCase): + def test_part1(self): + self.assertEqual(get_result(get_input(sample = True, sample_n = 1)), 165) + + def test_part2(self): + self.assertEqual(get_result(get_input(sample = True, sample_n = 2), part = 2), 208) diff --git a/2020/15/__pycache__/prog.cpython-39.pyc b/2020/15/__pycache__/prog.cpython-39.pyc new file mode 100644 index 0000000..24b5c01 Binary files /dev/null and b/2020/15/__pycache__/prog.cpython-39.pyc differ diff --git a/2020/15/__pycache__/test.cpython-39.pyc b/2020/15/__pycache__/test.cpython-39.pyc new file mode 100644 index 0000000..86f9497 Binary files /dev/null and b/2020/15/__pycache__/test.cpython-39.pyc differ diff --git a/2020/15/prog.py b/2020/15/prog.py new file mode 100644 index 0000000..d207ae9 --- /dev/null +++ b/2020/15/prog.py @@ -0,0 +1,14 @@ +from yaml import dump +def get_result(inp: list, part = 1): + last_pos = {n: i+1 for i, n in enumerate(inp[:-1])} + prev_item = inp[-1] + for i in range(len(inp), 2020 if part == 1 else 30_000_000): + cur_item = 0 if prev_item not in last_pos.keys() else i - last_pos[prev_item] + last_pos[prev_item] = i + prev_item = cur_item + + return cur_item + +if __name__ == "__main__": + print(get_result([20, 9, 11, 0, 1, 2], part = 2)) + diff --git a/2020/15/test.py b/2020/15/test.py new file mode 100644 index 0000000..22e4db0 --- /dev/null +++ b/2020/15/test.py @@ -0,0 +1,31 @@ +from prog import * +import unittest + +class Methods(unittest.TestCase): + pass + +class Result(unittest.TestCase): + def test_p1(self): + self.assertEqual(get_result([0, 3, 6]), 436) + self.assertEqual(get_result([1, 3, 2]), 1) + self.assertEqual(get_result([2, 1, 3]), 10) + self.assertEqual(get_result([1, 2, 3]), 27) + self.assertEqual(get_result([2, 3, 1]), 78) + self.assertEqual(get_result([3, 2, 1]), 438) + self.assertEqual(get_result([3, 1, 2]), 1836) + + + def test_p2_1(self): + self.assertEqual(get_result([0, 3, 6], part = 2), 175594) + def test_p2_2(self): + self.assertEqual(get_result([1, 3, 2], part = 2), 2578) + def test_p2_3(self): + self.assertEqual(get_result([2, 1, 3], part = 2), 3544142) + def test_p2_4(self): + self.assertEqual(get_result([1, 2, 3], part = 2), 261214) + def test_p2_5(self): + self.assertEqual(get_result([2, 3, 1], part = 2), 6895259) + def test_p2_6(self): + self.assertEqual(get_result([3, 2, 1], part = 2), 18) + def test_p2_7(self): + self.assertEqual(get_result([3, 1, 2], part = 2), 362) diff --git a/2020/16/__pycache__/prog.cpython-39.pyc b/2020/16/__pycache__/prog.cpython-39.pyc new file mode 100644 index 0000000..1510acb Binary files /dev/null and b/2020/16/__pycache__/prog.cpython-39.pyc differ diff --git a/2020/16/__pycache__/test.cpython-39.pyc b/2020/16/__pycache__/test.cpython-39.pyc new file mode 100644 index 0000000..59304b8 Binary files /dev/null and b/2020/16/__pycache__/test.cpython-39.pyc differ diff --git a/2020/16/input b/2020/16/input new file mode 100644 index 0000000..943a34c --- /dev/null +++ b/2020/16/input @@ -0,0 +1,266 @@ +departure location: 31-221 or 241-952 +departure station: 27-780 or 787-957 +departure platform: 34-405 or 411-970 +departure track: 41-672 or 689-963 +departure date: 26-827 or 843-970 +departure time: 38-283 or 297-963 +arrival location: 50-250 or 259-970 +arrival station: 35-878 or 884-950 +arrival platform: 49-746 or 772-955 +arrival track: 37-457 or 481-954 +class: 28-418 or 443-970 +duration: 32-722 or 728-970 +price: 41-519 or 525-966 +route: 50-606 or 628-974 +row: 46-92 or 111-967 +seat: 41-112 or 135-972 +train: 25-540 or 556-957 +type: 39-574 or 585-954 +wagon: 32-699 or 719-957 +zone: 49-71 or 83-951 + +your ticket: +61,151,137,191,59,163,89,83,71,179,67,149,197,167,181,173,53,139,193,157 + +nearby tickets: +854,509,243,913,926,411,308,322,69,875,779,371,51,514,367,873,524,645,934,322 +358,885,814,800,197,363,388,50,138,820,854,793,89,738,733,306,796,334,387,8 +194,897,151,634,178,597,173,791,251,344,306,568,804,145,142,136,573,173,242,508 +793,667,856,328,284,596,215,70,873,507,777,948,851,922,694,153,743,250,926,142 +219,870,66,945,803,485,325,670,788,186,822,365,451,512,906,443,678,404,312,173 +329,572,654,409,804,563,847,330,265,148,875,904,173,411,927,259,945,536,148,920 +788,867,405,249,51,454,819,512,306,850,384,337,71,587,316,649,724,389,645,318 +271,143,266,447,322,187,650,254,497,155,860,405,655,946,635,862,517,937,729,721 +211,856,566,262,156,201,804,735,172,809,870,56,313,801,447,508,622,517,91,807 +312,334,928,657,776,276,319,893,163,162,244,206,446,719,568,856,391,831,722,931 +250,68,900,183,785,790,270,922,312,914,269,664,305,337,350,904,778,896,68,371 +516,650,391,333,604,730,406,779,341,354,447,162,884,53,803,327,861,721,321,328 +654,169,947,825,395,4,374,569,518,885,315,563,67,900,195,511,789,739,345,863 +909,871,876,874,194,141,151,54,805,381,943,413,556,553,268,305,629,774,179,540 +325,299,721,195,772,376,255,699,737,911,567,274,859,186,780,605,556,568,220,162 +482,799,304,784,495,136,949,938,140,58,773,152,855,342,884,393,276,445,557,821 +534,807,455,221,832,89,658,734,947,945,672,259,456,137,558,557,902,744,382,315 +274,775,797,928,940,299,821,653,216,918,163,814,162,63,929,640,321,456,362,257 +889,188,454,309,488,457,775,183,166,382,916,262,322,307,716,204,664,411,790,354 +366,894,820,567,180,641,146,859,517,497,735,186,310,362,203,381,824,885,718,513 +60,813,630,672,88,947,663,405,515,376,51,182,910,380,903,847,318,843,542,572 +447,300,897,602,55,918,664,272,623,245,368,411,699,157,735,587,722,641,574,356 +890,804,648,369,731,848,394,866,249,884,3,652,212,876,742,892,517,844,667,932 +89,524,529,628,324,944,860,449,887,392,112,805,592,181,905,929,323,787,140,54 +301,885,646,353,657,820,572,629,666,891,195,378,274,849,729,24,196,875,515,212 +709,197,454,827,733,742,91,175,366,572,508,314,170,282,744,316,164,69,178,801 +218,457,484,161,800,860,911,492,250,898,455,888,252,54,932,745,393,856,363,519 +207,923,189,314,182,483,179,730,174,186,324,481,658,494,294,167,492,854,803,778 +800,87,644,61,586,517,645,905,190,573,316,855,150,170,304,389,218,979,388,741 +846,482,84,326,798,745,926,725,362,176,340,197,165,572,268,912,481,558,335,632 +184,773,536,594,945,494,738,401,649,949,404,135,274,467,817,299,853,740,603,926 +843,855,551,798,443,586,481,721,809,340,142,570,774,938,150,485,154,299,822,857 +272,782,366,666,658,917,731,509,733,371,639,245,585,312,336,805,111,868,642,511 +447,888,511,822,822,940,527,909,274,938,867,984,193,274,527,449,487,888,515,560 +304,174,393,1,170,444,568,634,395,481,260,586,729,634,694,55,305,531,501,162 +629,585,932,813,572,945,598,369,743,375,178,411,397,648,221,805,648,72,817,698 +631,554,698,861,906,380,484,70,739,606,359,519,418,111,728,564,935,208,90,383 +90,500,825,163,899,532,392,641,571,484,220,877,530,351,368,918,229,337,367,50 +171,341,914,323,737,256,647,939,745,138,908,648,690,857,145,774,855,919,745,605 +179,906,324,91,365,322,843,512,857,324,139,69,902,823,332,313,776,254,653,457 +668,237,456,573,913,503,140,200,283,449,241,148,148,323,635,734,694,143,815,924 +84,195,63,216,356,730,457,67,923,654,269,173,646,400,65,664,641,455,400,294 +401,373,418,600,848,659,740,59,400,796,418,449,721,993,644,163,875,444,949,87 +628,934,497,657,336,325,398,62,384,150,672,335,785,170,305,241,167,361,502,571 +458,858,501,491,271,217,569,162,168,205,335,325,744,380,54,303,884,794,916,646 +280,498,728,358,587,171,891,525,935,819,843,398,515,671,729,418,257,512,871,591 +288,891,658,311,853,166,510,84,502,937,633,360,143,692,374,92,515,393,60,277 +447,153,383,332,260,447,694,299,531,490,636,534,166,137,892,858,817,498,654,784 +252,799,885,852,856,774,89,154,333,590,338,504,165,378,696,606,53,728,349,537 +221,281,278,179,737,813,522,798,355,283,193,570,921,928,264,745,585,241,351,808 +556,244,60,858,452,221,655,595,204,603,899,329,417,449,503,894,192,56,980,587 +875,780,350,728,889,527,671,790,589,857,520,936,180,942,818,448,558,664,920,819 +355,858,531,976,530,135,55,336,894,150,194,905,379,496,338,299,262,247,511,574 +182,637,184,865,7,933,55,826,733,738,820,245,566,655,632,564,529,900,538,342 +905,509,943,814,798,819,417,485,327,61,160,168,616,210,788,936,788,365,908,497 +50,946,380,527,894,203,267,810,906,198,569,803,888,170,555,694,659,70,371,590 +591,815,364,401,766,815,275,596,176,634,370,561,505,181,890,138,452,735,518,147 +827,683,52,534,656,510,328,323,52,278,815,930,743,137,53,190,903,741,660,875 +167,859,260,725,923,917,922,142,339,388,363,508,914,667,790,862,515,282,212,350 +161,882,443,265,517,483,776,650,661,499,887,794,302,516,150,412,485,698,820,185 +345,487,810,868,871,190,209,507,327,534,86,856,305,877,931,210,121,886,903,567 +843,875,362,560,320,17,869,64,948,561,896,248,778,174,54,947,792,386,630,366 +916,904,884,91,867,796,862,153,453,449,397,908,485,264,53,848,141,936,889,551 +569,740,646,200,792,649,213,719,787,456,933,414,361,526,340,732,63,135,469,865 +359,384,221,87,650,396,241,197,281,947,19,418,527,738,172,486,857,282,262,525 +854,603,494,532,160,329,162,537,358,887,415,913,487,531,172,177,393,521,940,698 +403,535,738,334,827,530,527,495,229,526,512,340,248,170,866,188,691,820,398,822 +654,241,630,740,920,485,532,722,479,348,90,51,87,158,241,389,301,531,496,350 +547,143,492,534,871,939,303,306,88,247,268,55,363,312,564,344,740,560,277,150 +915,823,90,651,852,416,668,207,905,563,249,308,84,338,216,67,346,112,523,924 +825,734,211,581,454,811,340,347,207,532,506,400,660,412,328,573,319,146,735,519 +540,875,176,220,355,184,885,854,780,572,83,142,181,387,371,603,925,514,654,9 +398,402,561,151,608,565,528,850,136,497,939,386,943,919,938,86,946,329,380,367 +390,912,651,811,563,63,20,368,146,187,173,538,658,364,938,264,869,194,573,845 +154,331,321,244,189,445,88,873,208,650,312,368,744,932,243,345,792,58,995,637 +172,813,638,66,859,161,915,921,928,383,587,644,388,183,868,358,319,681,602,567 +399,866,603,207,557,172,366,349,707,812,664,806,454,299,593,779,772,651,502,170 +310,777,312,917,406,670,874,187,559,945,58,505,393,393,418,666,158,297,811,664 +66,936,270,595,515,844,546,491,638,314,381,177,791,805,264,640,342,693,172,160 +521,270,906,822,273,269,448,905,456,304,176,330,249,211,492,780,515,539,802,640 +135,790,271,772,935,492,300,875,827,896,282,260,891,915,657,879,505,88,283,303 +443,275,414,237,888,596,729,938,161,514,147,275,854,497,652,629,366,910,264,922 +370,146,402,649,328,859,789,787,794,665,321,810,174,777,889,396,649,389,494,410 +642,629,221,538,400,591,84,983,815,692,267,267,266,179,667,564,566,359,689,159 +499,806,219,663,690,536,535,664,83,370,531,640,589,988,654,511,260,666,173,531 +670,733,900,881,635,313,281,449,179,695,513,397,915,774,532,209,343,375,889,661 +654,300,195,921,434,564,143,861,720,893,875,208,860,777,557,305,62,774,71,139 +342,916,201,899,741,357,645,363,146,317,630,380,287,370,773,649,174,358,876,667 +875,736,866,60,867,308,159,152,296,872,354,241,56,586,656,513,491,933,213,323 +564,632,648,503,190,728,270,272,850,666,348,663,263,201,406,206,697,249,504,164 +568,592,738,518,277,456,780,635,883,70,218,411,722,403,175,910,334,413,484,175 +827,198,282,832,53,111,414,411,329,388,909,208,602,531,745,734,195,52,502,938 +493,324,779,691,882,746,335,891,937,594,527,145,167,729,848,315,54,556,731,746 +163,153,806,795,246,398,312,505,52,897,880,780,590,519,70,487,533,53,498,896 +220,339,843,212,524,596,151,412,853,865,860,496,360,810,559,357,201,746,491,734 +137,822,270,870,852,53,730,761,648,165,481,801,414,370,399,519,944,305,343,814 +455,303,137,919,166,336,448,532,531,211,504,773,593,698,905,455,171,995,500,603 +851,631,742,789,332,205,818,350,386,495,528,544,361,210,693,827,305,870,689,506 +111,163,207,780,595,393,874,692,368,300,10,485,220,450,499,860,398,190,593,211 +631,871,733,921,864,599,170,653,361,362,211,746,219,258,313,370,193,321,207,188 +897,831,929,868,843,342,901,791,450,537,280,445,511,667,719,389,197,360,398,945 +375,906,876,211,457,361,373,557,65,164,170,184,794,728,692,22,503,325,395,142 +812,360,395,735,69,825,445,904,356,804,336,858,542,366,171,642,504,903,917,939 +156,309,731,695,723,450,940,632,793,262,62,638,728,378,186,446,919,263,247,821 +534,215,60,854,730,867,163,927,799,994,932,865,670,269,791,857,347,53,744,664 +507,373,844,729,451,264,455,283,923,366,514,212,272,378,307,814,410,662,557,531 +606,87,594,289,893,772,511,926,111,939,165,314,413,53,650,936,498,263,309,179 +788,153,740,318,856,444,337,183,178,632,50,180,245,490,792,443,163,723,489,510 +301,140,324,571,884,508,868,872,301,730,798,484,593,147,259,350,700,810,852,692 +416,943,853,178,827,565,279,566,317,892,251,857,817,217,538,271,348,63,264,140 +378,346,699,393,903,943,534,880,151,302,414,397,819,933,689,150,893,397,598,58 +277,311,645,525,904,141,112,697,347,151,877,376,149,643,358,793,929,773,881,310 +855,488,659,250,513,918,64,484,889,488,360,91,51,274,932,735,880,54,737,369 +732,89,976,659,299,772,494,185,268,369,891,513,305,342,188,264,86,945,657,732 +417,155,392,689,171,186,53,982,931,85,803,147,376,825,499,945,158,719,193,904 +206,397,910,722,591,359,315,268,194,356,606,948,728,822,805,198,63,292,791,140 +719,664,490,521,562,938,592,404,401,276,316,313,637,803,177,937,453,794,851,282 +587,530,400,165,944,873,350,696,389,930,636,260,780,879,383,825,660,655,305,656 +890,914,67,299,824,914,360,211,68,186,206,899,705,443,246,361,734,568,846,909 +379,976,403,160,939,737,817,777,263,742,416,506,325,111,597,213,887,405,330,507 +211,641,930,320,790,719,362,90,792,323,696,519,925,599,92,173,466,592,923,142 +495,529,164,911,505,668,357,390,88,731,628,630,170,519,910,416,69,335,667,473 +616,746,332,354,905,730,83,59,903,525,313,571,304,925,56,844,643,383,793,909 +556,668,601,848,397,175,260,152,727,672,787,664,788,281,369,199,453,573,574,149 +216,174,851,71,790,366,785,213,594,640,746,216,656,729,207,157,86,570,176,731 +384,606,204,809,199,303,285,779,509,493,52,217,391,451,596,69,885,629,69,929 +844,157,61,571,186,184,728,831,646,898,146,902,661,54,391,219,928,62,204,218 +271,391,809,504,852,157,986,853,889,413,940,791,137,271,628,221,493,813,932,365 +482,190,329,886,921,162,802,914,787,532,452,790,873,210,657,810,595,235,395,323 +821,339,199,325,414,150,16,259,566,730,496,799,445,371,249,177,936,511,88,135 +903,147,384,485,70,300,268,345,830,631,318,269,787,174,937,500,360,511,90,910 +84,322,277,178,280,153,915,191,92,571,327,822,646,65,413,638,540,715,886,245 +455,465,316,696,515,112,265,788,533,367,205,193,641,144,282,651,530,190,601,604 +218,802,398,351,142,886,357,932,210,638,152,734,90,53,787,343,531,873,17,737 +339,90,808,176,322,316,157,598,302,590,327,775,218,151,806,372,165,478,184,299 +900,527,921,413,884,573,380,221,482,942,566,778,879,668,144,161,567,208,659,326 +365,854,372,112,176,457,416,569,152,871,740,809,652,371,147,90,784,735,851,788 +386,388,573,919,277,69,608,803,813,933,905,855,862,337,326,719,733,563,667,450 +593,187,825,503,142,187,559,719,175,193,495,849,564,61,524,511,593,737,867,605 +199,395,635,487,910,822,944,864,415,661,988,55,153,375,248,187,196,641,819,160 +389,878,304,196,904,395,716,628,925,135,145,593,632,495,649,598,209,86,812,859 +653,406,798,497,806,556,84,320,202,278,363,787,594,824,305,585,208,192,213,395 +55,691,789,88,876,910,594,331,274,862,51,563,875,370,614,900,569,947,172,666 +149,736,926,525,16,929,263,52,444,645,935,83,452,347,815,509,806,454,152,868 +307,605,265,638,578,797,864,855,414,895,372,495,849,65,318,926,888,528,372,646 +189,941,53,531,699,415,342,635,633,244,805,193,794,180,976,339,54,456,196,316 +369,322,332,874,468,52,197,518,507,356,489,694,268,796,351,655,206,655,907,244 +347,382,161,675,628,745,689,349,662,776,893,787,210,854,411,376,855,510,111,155 +322,597,266,874,448,774,306,916,905,416,550,820,249,483,663,378,931,65,793,281 +357,149,598,734,873,344,802,943,745,850,218,61,479,873,58,203,268,371,279,348 +261,154,947,178,866,360,733,484,195,806,342,312,942,334,252,189,804,221,556,912 +245,338,858,532,804,565,892,445,491,889,329,190,264,599,347,567,901,879,321,929 +452,1,213,593,847,850,372,898,660,414,738,947,497,485,795,390,245,632,887,814 +152,362,445,694,860,272,848,363,2,944,334,926,450,823,943,249,142,318,190,907 +188,919,70,513,56,501,148,164,600,401,211,353,219,321,449,521,897,71,792,303 +989,592,493,60,369,655,86,263,772,779,181,537,263,180,450,173,370,84,596,344 +491,671,934,539,513,163,830,111,314,647,266,798,667,179,325,849,921,356,864,204 +331,491,181,921,193,925,644,178,411,532,643,874,68,87,601,555,788,343,890,217 +218,945,341,669,802,143,571,140,188,154,899,777,573,88,302,257,444,587,411,908 +559,572,365,448,179,930,668,636,58,354,142,7,403,318,387,382,157,388,188,447 +302,365,799,547,211,872,729,55,585,904,799,189,922,152,645,925,561,273,313,446 +892,213,531,257,539,855,316,242,349,886,242,248,153,822,670,176,586,670,386,310 +556,215,50,270,668,484,140,333,867,55,326,944,70,414,454,83,510,626,569,283 +179,455,501,670,902,185,536,574,376,900,195,919,982,629,148,884,662,487,845,331 +65,794,491,211,322,388,888,343,782,644,135,558,564,263,488,666,335,275,672,206 +281,252,887,594,52,203,194,587,606,155,777,843,451,412,851,56,196,194,794,498 +812,640,850,777,175,450,918,160,418,165,507,304,532,445,385,373,504,492,499,712 +451,153,209,486,153,500,645,328,324,912,979,691,657,490,381,572,199,931,86,336 +796,603,908,792,228,525,58,807,363,572,657,66,350,55,331,515,484,775,456,137 +280,265,910,174,128,343,356,775,200,372,112,598,447,56,154,516,859,268,265,938 +318,628,356,396,452,266,742,906,180,273,797,661,309,327,310,201,888,872,622,320 +84,50,311,898,363,320,208,341,358,672,354,995,818,731,199,791,176,810,740,327 +494,454,931,721,394,918,507,553,656,167,210,662,730,530,807,695,647,917,863,356 +737,193,215,937,53,347,54,381,793,271,632,389,69,526,162,374,699,324,7,333 +160,716,746,199,306,629,873,628,163,903,249,585,695,281,403,322,630,261,528,150 +327,797,533,660,669,638,924,532,307,53,495,24,396,691,908,185,516,283,720,845 +574,216,58,458,202,221,793,164,454,906,457,182,62,696,943,376,300,312,741,919 +344,358,691,566,794,316,592,298,361,654,731,189,819,573,493,250,296,894,194,744 +385,873,483,249,699,808,736,166,899,789,486,900,777,646,345,148,739,762,658,63 +662,923,853,888,256,259,242,87,589,332,821,876,143,516,367,213,91,935,330,794 +311,532,802,374,355,526,337,795,662,161,475,646,631,147,561,63,452,194,871,55 +216,165,263,561,268,896,283,699,327,495,869,332,527,701,260,729,245,145,698,742 +880,731,453,593,334,919,564,639,335,924,905,65,363,942,780,247,733,411,921,719 +373,908,601,315,914,656,825,928,351,902,859,734,986,537,639,823,816,634,181,859 +500,137,378,918,515,923,411,735,415,819,599,346,146,400,459,899,906,798,859,518 +670,622,590,346,793,518,396,571,810,790,168,866,486,948,602,91,221,283,337,849 +277,452,731,532,61,266,391,575,503,397,569,825,562,71,298,911,364,175,635,312 +265,322,849,816,501,821,910,928,909,15,512,539,205,396,564,516,538,851,851,642 +271,55,901,353,313,386,498,408,383,58,412,337,211,572,217,65,804,917,449,518 +283,364,187,806,153,891,279,372,350,502,195,338,454,412,538,446,854,864,721,609 +778,366,398,596,892,867,412,195,274,812,535,883,921,51,353,340,933,83,61,598 +788,404,934,21,246,888,654,539,145,418,150,658,510,91,281,930,788,932,910,282 +634,156,798,159,565,487,592,633,390,910,139,854,277,140,585,2,332,513,492,932 +380,198,209,696,417,385,50,329,804,745,935,516,591,735,719,694,768,731,508,111 +174,734,268,301,854,745,518,615,345,312,244,565,633,506,599,789,773,352,886,178 +891,216,324,184,527,449,572,535,378,911,339,659,979,928,560,823,773,318,814,386 +565,58,253,415,177,402,86,206,201,192,948,395,648,694,628,899,865,561,401,323 +863,340,557,324,136,986,245,167,482,354,596,56,89,374,178,690,242,849,637,346 +341,601,416,697,308,777,188,785,150,526,263,903,915,661,897,734,164,497,510,137 +92,599,932,895,325,499,199,139,561,191,668,697,511,329,315,815,833,887,813,443 +402,396,495,852,386,453,148,84,826,800,263,564,52,606,659,871,698,185,266,522 +645,878,352,812,865,776,881,902,262,917,810,205,165,314,606,368,739,644,853,559 +517,527,452,807,306,68,181,523,216,628,874,719,605,269,266,155,897,496,817,369 +507,927,927,220,378,775,865,380,339,631,366,917,491,643,156,574,391,543,51,515 +906,244,787,280,194,806,813,213,523,890,745,671,665,377,336,449,169,565,630,909 +259,791,87,329,191,275,540,71,155,176,362,874,217,320,827,517,774,782,398,70 +496,820,812,332,706,370,417,857,649,500,308,559,794,394,181,58,777,92,413,383 +651,368,357,324,153,244,385,868,70,667,280,372,742,314,556,800,298,578,492,561 +160,159,324,902,340,158,455,205,370,875,986,787,193,85,507,650,333,663,843,319 +744,391,514,399,936,65,928,197,678,450,586,662,732,632,654,359,640,203,272,443 +170,362,136,567,303,596,186,287,183,663,199,811,742,603,338,360,275,918,169,808 +402,330,894,481,802,218,199,906,147,492,364,315,697,821,842,150,665,720,728,455 +56,184,204,629,586,197,354,519,318,697,694,742,176,338,664,900,140,518,71,880 +483,932,861,559,212,503,663,394,863,918,560,887,745,322,881,940,896,60,167,344 +629,590,176,650,719,374,152,518,409,930,902,643,266,922,205,375,196,387,875,948 +556,63,800,148,78,886,169,697,516,663,158,185,341,889,499,802,167,851,342,871 +399,402,946,386,175,640,886,682,633,493,507,371,670,145,892,162,166,198,632,214 +560,915,526,498,923,305,667,216,602,864,519,186,924,326,241,905,329,407,824,163 +417,0,138,596,495,797,189,64,404,799,670,381,658,912,482,161,651,537,270,354 +139,815,530,914,592,318,337,447,449,911,809,184,263,264,781,826,328,731,538,338 +302,448,272,163,505,313,691,940,392,878,817,258,800,905,642,738,349,856,264,932 +493,307,64,283,86,925,153,815,600,850,511,698,280,520,305,904,493,179,531,367 +357,817,648,386,513,806,592,701,735,372,573,564,855,214,366,848,353,816,136,264 +201,631,313,145,538,912,447,363,194,796,561,668,777,306,780,488,323,646,251,451 +934,66,490,826,314,168,821,603,539,417,735,864,902,895,358,197,998,777,307,525 +170,60,858,249,557,197,476,396,416,810,932,737,396,929,602,198,529,657,450,871 +68,390,153,452,377,907,231,587,187,332,778,385,112,690,513,874,906,357,380,393 +492,822,261,729,548,138,655,283,485,640,497,920,482,897,320,810,183,175,488,698 +902,286,366,890,405,603,911,259,499,940,374,271,376,515,694,904,948,653,516,743 +595,506,741,630,948,401,915,884,549,386,847,166,914,694,690,569,368,371,777,388 +445,245,145,821,633,141,417,948,327,204,147,149,325,507,857,890,73,537,191,380 +506,734,638,342,534,55,719,473,369,322,945,894,365,803,889,404,405,179,663,145 +383,857,774,404,674,338,350,495,187,884,304,507,862,948,155,207,259,61,651,362 +147,338,892,348,629,210,488,243,299,451,162,161,689,657,280,365,581,302,518,137 +721,274,947,627,570,892,489,328,221,318,443,557,50,648,250,166,532,186,629,944 +539,532,191,984,112,282,801,200,913,336,948,739,815,777,161,50,742,804,159,212 +67,343,887,712,273,500,661,141,57,172,567,356,65,515,788,631,693,922,897,373 +196,512,803,383,864,802,694,348,417,826,591,8,797,194,191,794,206,862,159,739 +489,519,484,399,276,774,270,944,176,173,263,908,522,377,744,593,196,162,416,655 +269,384,55,177,142,699,741,225,807,497,908,314,744,586,221,778,395,276,390,151 +694,211,643,822,773,348,329,174,269,866,276,242,565,856,167,919,555,343,776,243 \ No newline at end of file diff --git a/2020/16/prog.py b/2020/16/prog.py new file mode 100644 index 0000000..300dc69 --- /dev/null +++ b/2020/16/prog.py @@ -0,0 +1,77 @@ +import re + +################################################################################# +# # +# DISCLAIMER: THE SOLUTION I FOUND THE THIS DAY IS HORRIBLE, I AIN'T PROUD OF # +# IT AT ALL (IT WORKS THO) # +# # +################################################################################# + + +def get_input(sample = False, part = 1): + with open(f"sample_p{part}" if sample else "input", "r") as f: + ret = {} + data = f.read().split("\n\n") + ranges = {} + for line in data[0].split("\n"): + name, range = get_range(line) + ranges[name] = range + + ret["ranges"] = ranges + ret["my ticket"] = [int(v) for v in data[1].split("\n")[1].split(",")] + ret["nearby tickets"] = [[int(v) for v in line.split(",")] for line in data[2].split("\n")[1:]] + return ret + + +def get_range(range_str: str): + range_re = re.compile(r'(.+): (\d+)-(\d+) or (\d+)-(\d+)') + name, min_1, max_1, min_2, max_2 = range_re.match(range_str).groups() + return name, [range(int(min_1), int(max_1) + 1), range(int(min_2), int(max_2) + 1)] + + +def get_result(inp: dict, part = 1): + invalid_values = [] + invalid_ticket_indices = set() + for i_ticket, ticket in enumerate(inp["nearby tickets"]): + for value in ticket: + is_value_valid = False + for r in inp["ranges"].values(): + if value in r[0] or value in r[1]: + is_value_valid = True + break + + if not is_value_valid: + invalid_values.append(int(value)) + invalid_ticket_indices.add(i_ticket) + + if part == 1: + return sum(invalid_values) + + valid_tickets = [ticket for i, ticket in enumerate(inp['nearby tickets']) if i not in invalid_ticket_indices] + + range_to_index = {name: {i for i in range(len(valid_tickets[0]))} for name in inp["ranges"]} + + for ticket in valid_tickets: + for i, value in enumerate(ticket): + for name, rng in inp["ranges"].items(): + if not (value in rng[0] or value in rng[1]): + range_to_index[name].discard(i) + + # I'M SO SORRY FOR THIS WHILE LOOP, BUT I FOUND NO OTHER WAY TO "MUTUALLY EXCLUDE" EVERY SET OF INDICES FROM ONE ANOTHER... :/ + while list(map(lambda x: len(x), range_to_index.values())) != [1]*len(range_to_index): + for name, indices in range_to_index.items(): + if len(indices) == 1: + for i_name, i_indices in range_to_index.items(): + if name != i_name: + range_to_index[i_name] = i_indices - indices + + re_dep = re.compile(r'^departure ') + ret = 1 + for name, index in range_to_index.items(): + if re_dep.match(name) != None: + ret *= inp["my ticket"][index.pop()] + + return ret + +if __name__ == "__main__": + print(get_result(get_input(), part = 2)) diff --git a/2020/16/sample_p1 b/2020/16/sample_p1 new file mode 100644 index 0000000..ba62efb --- /dev/null +++ b/2020/16/sample_p1 @@ -0,0 +1,12 @@ +class: 1-3 or 5-7 +row: 6-11 or 33-44 +seat: 13-40 or 45-50 + +your ticket: +7,1,14 + +nearby tickets: +7,3,47 +40,4,50 +55,2,20 +38,6,12 \ No newline at end of file diff --git a/2020/16/sample_p2 b/2020/16/sample_p2 new file mode 100644 index 0000000..c629bd3 --- /dev/null +++ b/2020/16/sample_p2 @@ -0,0 +1,11 @@ +class: 0-1 or 4-19 +row: 0-5 or 8-19 +seat: 0-13 or 16-19 + +your ticket: +11,12,13 + +nearby tickets: +3,9,18 +15,1,5 +5,14,9 \ No newline at end of file diff --git a/2020/16/test.py b/2020/16/test.py new file mode 100644 index 0000000..eb6ad9b --- /dev/null +++ b/2020/16/test.py @@ -0,0 +1,15 @@ +from prog import * +import unittest + +class Methods(unittest.TestCase): + pass + +class Result(unittest.TestCase): + def test_p1(self): + inp = get_input(sample = True) + self.assertEqual(get_result(self.inp), 71) + + def test_p2(self): + inp = get_input(sample = True, part = 2) + self.assertEqual(get_result(inp, part = 2), 71) + diff --git a/2020/17/__pycache__/prog.cpython-39.pyc b/2020/17/__pycache__/prog.cpython-39.pyc new file mode 100644 index 0000000..bebfc66 Binary files /dev/null and b/2020/17/__pycache__/prog.cpython-39.pyc differ diff --git a/2020/17/__pycache__/test.cpython-39.pyc b/2020/17/__pycache__/test.cpython-39.pyc new file mode 100644 index 0000000..a2fdf54 Binary files /dev/null and b/2020/17/__pycache__/test.cpython-39.pyc differ diff --git a/2020/17/input b/2020/17/input new file mode 100644 index 0000000..6045d21 --- /dev/null +++ b/2020/17/input @@ -0,0 +1,9 @@ +#.##..... +.#.#.##.. +###...... +....##.#. +#....###. +.#.#.#... +.##...##. +#..#.###. +......... diff --git a/2020/17/prog.py b/2020/17/prog.py new file mode 100644 index 0000000..ef4fadc --- /dev/null +++ b/2020/17/prog.py @@ -0,0 +1,81 @@ +def get_input(sample = False): + with open('sample' if sample else 'input', 'r') as f: + ret = {0: {0: {}}} + lines = f.readlines() + for y, row in enumerate(lines, start = -len(lines) // 2): + ret[0][0][y] = {} + row = row.strip() + for x, cube in enumerate(row, start = -len(row) // 2): + ret[0][0][y][x] = cube + return ret + +def count_actives(space: dict): + ret = 0 + for w in space.values(): + for z in w.values(): + for y in z.values(): + for x in y.values(): + if x == "#": + ret += 1 + return ret + +def count_active_neighbours(space: dict, center_x, center_y, center_z, center_w): + ret = 0 + for w in range(center_w - 1, center_w + 2): + if w not in space.keys(): continue + for z in range(center_z - 1, center_z + 2): + if z not in space[w].keys(): continue + for y in range(center_y - 1, center_y + 2): + if y not in space[w][z].keys(): continue + for x in range(center_x - 1, center_x + 2): + if x in space[w][z][y].keys() and (x, y, z, w) != (center_x, center_y, center_z, center_w) and space[w][z][y][x] == "#": + ret += 1 + return ret + + +def print_space(space: dict): + for w, time in sorted(space.items()): + for z, plain in sorted(space[w].items()): + print(f"\t{z = } {w = }") + for y, row in sorted(plain.items()): + print(f"\t{''.join([value for key, value in sorted(row.items())])}") + print() + + + + +def get_result(space_4d: list, part = 1): + for cycle in range(6): + next_space_4d = {} + for w in range(min(space_4d) - 1, max(space_4d) + 2) if part == 2 else [0]: + space = space_4d[w] if w in space_4d else {z_0 : {y_0: {x_0: '.' for x_0 in space_4d[0][0][0]} for y_0 in space_4d[0][0]} for z_0 in space_4d[0]} + next_space_4d[w] = {} + for z in range(min(space) - 1, max(space) + 2): + plain = space[z] if z in space else {y_0: {x_0: '.' for x_0 in space[0][0]} for y_0 in space[0]} + next_space_4d[w][z] = {} + + for y in range(min(plain) - 1, max(plain) + 2): + row = plain[y] if y in plain else {x_0: '.' for x_0 in space[0][0]} + next_space_4d[w][z][y] = {} + + for x in range(min(row) - 1, max(row) + 2): + cube = row[x] if x in row else '.' + count = count_active_neighbours(space_4d, x, y, z, w) + if cube == "#": + if count in [2, 3]: + next_cube = "#" + else: + next_cube = "." + else: + if count == 3: + next_cube = "#" + else: + next_cube = "." + next_space_4d[w][z][y][x] = next_cube + space_4d = next_space_4d + + return count_actives(space_4d) + + +if __name__ == "__main__": + print(get_result(get_input(), part = 2)) diff --git a/2020/17/sample b/2020/17/sample new file mode 100644 index 0000000..17630fd --- /dev/null +++ b/2020/17/sample @@ -0,0 +1,3 @@ +.#. +..# +### \ No newline at end of file diff --git a/2020/17/test.py b/2020/17/test.py new file mode 100644 index 0000000..b351110 --- /dev/null +++ b/2020/17/test.py @@ -0,0 +1,16 @@ +from prog import * +import unittest + +class Methods(unittest.TestCase): + pass + +class Result(unittest.TestCase): + def setUp(self): + self.inp = get_input(sample = True) + + def test_p1(self): + self.assertEqual(get_result(self.inp), 112) + + def test_p2(self): + self.assertEqual(get_result(self.inp, part = 2), 848) + diff --git a/2020/18/__pycache__/prog.cpython-39.pyc b/2020/18/__pycache__/prog.cpython-39.pyc new file mode 100644 index 0000000..ced9446 Binary files /dev/null and b/2020/18/__pycache__/prog.cpython-39.pyc differ diff --git a/2020/18/__pycache__/test.cpython-39.pyc b/2020/18/__pycache__/test.cpython-39.pyc new file mode 100644 index 0000000..24aa10e Binary files /dev/null and b/2020/18/__pycache__/test.cpython-39.pyc differ diff --git a/2020/18/input b/2020/18/input new file mode 100644 index 0000000..f8777b6 --- /dev/null +++ b/2020/18/input @@ -0,0 +1,375 @@ +(7 * 5 * 6 + (9 * 8 + 3 * 3 + 5) + 7) * (6 + 3 * 9) + 6 + 7 + (7 * 5) * 4 +(4 + 9 + (8 * 2) + 5) * 8 + (3 + 2 * 3 * 7 * (7 * 4 * 5) * 9) * 2 +3 + 7 + (9 + 6 + 4 * 7 * 3 + 5) * 9 +3 + 3 * (5 + (7 * 5 + 4 * 8 + 9 * 2) + 3) * 8 * 7 +(8 + 3 + 7 * 7) + (3 + 8) * 4 + 2 +2 + 9 * (7 + 3 * 3 * 8)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 * 5) * (7 * 2 * 8 * 2) + (5 * 4)) + 7 * 8 + 9 +(8 + 4 + (5 * 4 * 6) * 2 * 8) * (6 + (9 * 4 * 5) * 7 * 5 * 4) + 3 + ((2 + 2) + 7 + 5 * 7 * 2 + 4) * 5 + (9 * 3 * (9 + 3 * 4 * 8 * 7 + 9)) +6 * 7 * 3 * (7 * 2 + (6 * 4 * 5) * (5 * 3 * 8 + 8 + 3 + 9)) * (7 * 9 + 7 * 5) +4 + 2 + (3 * (9 + 7) * 6) +(8 + (8 * 4)) + (7 + 3 * 5) + 4 + 4 + 7 +(7 + 7 * 4 * 4 * 4) * 4 + 3 \ No newline at end of file diff --git a/2020/18/prog.py b/2020/18/prog.py new file mode 100644 index 0000000..d9035ed --- /dev/null +++ b/2020/18/prog.py @@ -0,0 +1,55 @@ +import re +calc_re = re.compile(r'(\d+) ([+*]) (\d+)') + +def get_input(sample = False, part = 1): + with open(f'sample_p{part}' if sample else 'input', 'r') as f: + return [line.strip() for line in f.readlines()] + +def find_closing_bracket_starting_at(index: int, string: str): + open_br = 0 + for i, c in enumerate(string[index:], start=index): + if c == "(": + open_br += 1 + elif c == ")": + open_br -= 1 + if open_br == 0: + return i + +def evaluate_advanced(calc: str): + starting_bracket = calc.find("(") + if starting_bracket != -1: + end_bracket = find_closing_bracket_starting_at(starting_bracket, calc) + return evaluate_advanced(calc[:starting_bracket] + str(evaluate_advanced(calc[starting_bracket+1:end_bracket])) + calc[end_bracket+1:]) + + additions = [external_group for external_group, internal_group in re.findall(r'((\d+ \+ )+\d+)', calc)] + for add in additions: + calc = calc.replace(add, str(eval(add)), 1) + return eval(calc) + + + +def evaluate_l2r(calc: str): + starting_bracket = calc.find("(") + if starting_bracket != -1: + end_bracket = find_closing_bracket_starting_at(starting_bracket, calc) + return evaluate_l2r(calc[:starting_bracket] + str(evaluate_l2r(calc[starting_bracket+1:end_bracket])) + calc[end_bracket+1:]) + + match = calc_re.match(calc) + + first, operation, second = match.groups() + first, second = int(first), int(second) + + rest = calc[match.end():] + if operation == "+": + new = first + second + elif operation == "*": + new = first * second + + return new if len(rest) == 0 else evaluate_l2r(str(new) + rest) + + +def get_result(inp: list, part = 1): + return sum((evaluate_l2r(op) if part == 1 else evaluate_advanced(op)) for op in inp) + +if __name__ == "__main__": + print(get_result(get_input(), part = 2)) diff --git a/2020/18/sample_p1 b/2020/18/sample_p1 new file mode 100644 index 0000000..9e1ad36 --- /dev/null +++ b/2020/18/sample_p1 @@ -0,0 +1,4 @@ +2 * 3 + (4 * 5) +5 + (8 * 3 + 9 + 3 * 4 * 3) +5 * 9 * (7 * 3 * 3 + 9 * 3 + (8 + 6 * 4)) +((2 + 4 * 9) * (6 + 9 * 8 + 6) + 6) + 2 + 4 * 2 diff --git a/2020/18/sample_p2 b/2020/18/sample_p2 new file mode 100644 index 0000000..721ec45 --- /dev/null +++ b/2020/18/sample_p2 @@ -0,0 +1,5 @@ +1 + (2 * 3) + (4 * (5 + 6)) +2 * 3 + (4 * 5) +5 + (8 * 3 + 9 + 3 * 4 * 3) +5 * 9 * (7 * 3 * 3 + 9 * 3 + (8 + 6 * 4)) +((2 + 4 * 9) * (6 + 9 * 8 + 6) + 6) + 2 + 4 * 2 diff --git a/2020/18/test.py b/2020/18/test.py new file mode 100644 index 0000000..54ed3dd --- /dev/null +++ b/2020/18/test.py @@ -0,0 +1,54 @@ +from prog import * +import unittest + +class Methods(unittest.TestCase): + def test_bracket(self): + self.assertEqual(find_closing_bracket_starting_at(4, "1 + (1 + 2)"), 10) + self.assertEqual(find_closing_bracket_starting_at(0, "(1 + 2)"), 6) + self.assertEqual(find_closing_bracket_starting_at(1, "((1 + 2) + 2)"), 7) + self.assertEqual(find_closing_bracket_starting_at(0, "((1 + 2) + 2)"), 12) + + def test_evaluate_l2r_simple(self): + self.assertEqual(evaluate_l2r("1 + 1"), 2) + self.assertEqual(evaluate_l2r("51 + 24"), 75) + self.assertEqual(evaluate_l2r("223 * 23"), 5129) + + def test_evaluate_adv_simple(self): + self.assertEqual(evaluate_advanced("1 + 1"), 2) + self.assertEqual(evaluate_advanced("51 + 24"), 75) + self.assertEqual(evaluate_advanced("223 * 23"), 5129) + + def test_evaluate_l2r_medium(self): + self.assertEqual(evaluate_l2r("1 + 1 + 1"), 3) + self.assertEqual(evaluate_l2r("12 + 278 + 3"), 293) + self.assertEqual(evaluate_l2r("22 * 2 + 1"), 45) + self.assertEqual(evaluate_l2r("3 + 2 * 10"), 50) + + def test_evaluate_adv_medium(self): + self.assertEqual(evaluate_advanced("11 + 12 + 13 * 21 + 22 * 31 + 32 + 33 + 34"), 201240) + self.assertEqual(evaluate_advanced("12 + 278 + 3"), 293) + self.assertEqual(evaluate_advanced("22 * 2 + 1"), 66) + self.assertEqual(evaluate_advanced("3 + 2 * 10"), 50) + + def test_evaluate_l2r_hard(self): + self.assertEqual(evaluate_l2r("2 * 3 + (4 * 5)"), 26) + self.assertEqual(evaluate_l2r("5 + (8 * 3 + 9 + 3 * 4 * 3)"), 437) + self.assertEqual(evaluate_l2r("5 * 9 * (7 * 3 * 3 + 9 * 3 + (8 + 6 * 4))"), 12240) + self.assertEqual(evaluate_l2r("((2 + 4 * 9) * (6 + 9 * 8 + 6) + 6) + 2 + 4 * 2"), 13632) + + def test_evaluate_adv_hard(self): + self.assertEqual(evaluate_advanced("3 * 3 + (1 * 1 * 1)"), 12) + self.assertEqual(evaluate_advanced("1 + (2 * 3) + (4 * (5 + 6))"), 51) + self.assertEqual(evaluate_advanced("2 * 3 + (4 * 5)"), 46) + self.assertEqual(evaluate_advanced("5 + (8 * 3 + 9 + 3 * 4 * 3)"), 1445) + self.assertEqual(evaluate_advanced("5 * 9 * (7 * 3 * 3 + 9 * 3 + (8 + 6 * 4))"), 669060) + self.assertEqual(evaluate_advanced("((2 + 4 * 9) * (6 + 9 * 8 + 6) + 6) + 2 + 4 * 2"), 23340) + +class Result(unittest.TestCase): + def test_p1(self): + self.assertEqual(get_result(get_input(sample = True)), 26335) + + def test_p2(self): + self.assertEqual(get_result(get_input(sample = True, part = 2), part = 2), 693942) + + diff --git a/2020/2/input b/2020/2/input new file mode 100644 index 0000000..ab3442e --- /dev/null +++ b/2020/2/input @@ -0,0 +1,1000 @@ +3-4 l: vdcv +6-9 d: dddddkzdl +6-13 f: mfswqfrqffrvfvf +10-12 l: sfzlnwcptlnlflq +2-4 m: qbwcmt +15-16 v: vvvvvvvvnvvvvcvvvvgv +1-4 n: wnnzfln +1-3 x: xxgx +7-8 j: jjjjjfvh +6-8 x: xxzxxnnwx +3-8 t: djtdznbtgwtrhxf +7-9 w: glwwwwxtxwlwwwcp +4-5 g: jggjtgggg +9-10 c: trgjrcbfcwf +9-10 v: vvvbvmvcvvvv +3-14 p: pptzpppppppppsfrsppc +3-5 n: nnznmkn +1-13 t: fxtrpgtzztsfnmzmmtg +13-15 d: dcztmqjdmclgdhdcd +3-4 j: mjjjjc +13-18 x: fxxgxxxxxxxxxxxxxcx +2-4 f: fxqs +3-4 w: ffmbwwnn +12-13 k: dlpdzkhbkkkftkb +5-11 r: vrdxrrrrrtrqz +7-8 b: bbbbbbrcb +13-16 c: wzccvzccclccczcc +10-11 m: lmmmmmmmmwqmm +6-10 f: fffqjfznvfhz +8-9 h: hvfhhvgklhhpfmh +4-17 p: hpprnpsppcppppppfp +9-13 z: zzzzrgtzzzzzzzzzzl +6-10 l: lllllqlllplll +3-10 j: vjjjwjjjjjjjj +4-8 j: jjjjjjjjjjc +2-5 s: jsgtsfsw +1-2 b: brwpbbbbb +2-5 m: tbkpfbvnqmpjbbx +7-8 m: xxbgmbmnmmwmdhmm +9-12 v: phsslrznvrsvtxgv +10-14 v: rnnvvrvvvzbhmcx +13-15 b: bbbbbbbbbbgbwbbb +2-5 w: bwldjwwz +5-7 d: dddjthk +10-12 c: pckcccccccccl +2-11 b: rdjqkdbzxzqfgn +3-8 s: dsssmshs +8-10 d: dddfdddsdj +2-4 l: slgltjzwzrnlllrh +6-10 z: vrcvgrgzphxd +10-13 b: mnblbbbbbbbfvbbbbx +8-16 n: wznnnbfhndnnnnngnn +6-8 v: fvvvzqks +3-6 n: znqnbnzwnn +15-16 g: wggzxsgcgjwgxhgggg +10-13 x: xlvxxxxxkxxxfxx +2-6 z: jpznbgszmj +13-19 j: jjzjjjdjwxlnjhwsrtj +5-6 p: bvppqqppcp +19-20 r: rrrrrrrrbrrrrrrrrrvd +4-7 j: jjjjjjljj +5-6 k: kkkkkck +1-2 k: zbkk +11-13 r: rrsrrrwrrrrrr +6-11 z: zzgzznzzzzwzzrzpzgc +7-11 l: llvlllllllllllll +7-8 f: fffffjffnp +3-4 j: pxcw +9-11 k: zkkkkkkkdkzx +12-13 g: fgglgvggxhgks +6-7 d: kbdddftdddl +14-15 m: dmmjwnxxfdfhwvcdd +3-4 b: bbbsbt +2-9 d: tgsvznmnnrgvtldjbj +4-5 l: ljxtc +5-8 j: jnvsjlfw +3-4 v: zrklbf +1-15 v: vvvvvvvvvvvvvvtv +5-6 n: ssnnnngnsxkphtnwrk +6-7 k: kkkkkkdk +2-4 d: xchmdk +12-13 v: vfvvmvvvpvvwvpvvvdm +3-14 d: dzcddwdddddfdfdwd +1-6 b: dbbbbsb +12-14 b: bbbxbbbbbbbjbb +1-8 s: sssssssgn +5-10 d: ddddwddddvdd +10-12 s: sssmssssskswssss +3-13 q: cdqfcqvszbzqnhvxlw +8-10 z: tmgzkvxzzvz +8-10 n: nnnnntnqnhrsnn +2-7 r: vjrctrhprhc +6-8 w: bzfxrwwfmx +3-5 x: xxxwxb +5-9 z: vbspkzfsrrpdcfl +8-9 z: jgqzzzzzwq +5-12 x: dvqvjsdfjxgtxkd +5-6 r: rrrrrr +1-4 f: xdzngd +15-18 x: xxxxxxxxxxxxxxvvxx +1-4 g: qcwjpxgtvgkf +13-15 m: mhmmmmmmmhmmqmmmmmmv +5-11 n: nnnndnnnnnnnnnnnn +4-9 n: tjgnpqsnpxpzfw +10-13 q: qqlqdqqqqqqqnqq +8-14 g: gdcggnknjsgdskq +3-5 l: vlllll +16-18 t: ttttttttttttttttmt +9-14 b: kbhbcbbbbbqbsbr +3-9 f: jzrnxffljfmhffftdng +1-4 z: pbzs +10-11 h: lrrgpmhshtfg +1-5 n: mnqjwjpfnnzn +1-8 r: zrrrprrkr +8-9 g: gkbtggcpf +3-8 q: qqsqqgqqqqm +17-18 j: jjjjjjjjjjjjjjjjgkj +13-14 t: tttttttttmtttfttt +2-6 c: cvcccqc +4-17 c: sfnckrcmlcpmcpcgbkct +10-12 d: dddddddqvddd +3-5 d: ddddtd +10-11 h: hchhhhhhhvg +3-11 j: mmlcjsjhjbpjjjxsk +11-12 w: wwwwwwwwwwwww +9-10 c: ccccccccccc +5-7 x: ckhdnfgjrdkxqphvjtvs +10-12 s: ssssjsssshstd +7-8 m: mmmmmmmg +3-4 v: vjvvt +2-3 f: hmknf +3-5 g: bgsglggg +12-13 x: vxxxdcgxxxfxx +3-20 h: hhhtkvrmfswvmkzmbvmh +2-3 v: vvvv +3-14 g: zgpggzgqxjzggg +15-16 c: ggcjccnccccccccc +11-12 d: wrdrdxsfdzddkl +6-7 q: vqqknqq +2-6 w: wwwwwwwkck +4-6 l: dplldljlvxrrm +2-18 m: pmwfkqlknsxzjmdzkmxd +5-11 q: rqkzqxqmqtqnzqqqxk +6-7 s: sssssskss +9-10 w: wwwwwwwwsw +5-7 x: jxxxhxwxxxxxxxx +4-5 t: ttbttfm +2-4 h: mlhhhkhc +13-14 l: llllllllllllfjl +8-10 k: kllkkkjkkkk +1-3 s: sssbdss +2-3 z: zlbzzzzzz +9-10 r: rrvrrrfrdfrr +4-12 k: vkkkbkhkzkkk +11-12 l: llllllllllcgc +5-6 k: hkzkkkkgdsghdk +3-5 n: nzsxk +12-14 r: rwrrrrrrrrrprxrrr +4-7 k: kkxkkkkkkk +12-16 b: bbbbbbbbbbbbbbbbb +13-16 p: ppppppppppppzppfp +15-19 j: tjjjjjdjjjjmjjccbjm +1-3 l: llll +3-4 x: hxkl +9-15 n: ktnpmnnnlnxnnft +6-7 q: qqdtcqs +13-14 g: lgghndddgllnfg +7-14 k: cdzkjkkksksbwkjb +7-11 w: cwcsvqwfwhw +14-18 m: mmmmmmmmmmmmmhmmmjmm +4-5 c: cvfctcsncscbmj +4-5 r: zrnrrnxct +2-3 b: ggdlb +8-9 x: cpxskxxxxbxn +12-14 v: vvvvvwvvvvvbvw +13-16 n: pmhnhpnntncxqrmd +2-4 m: mmxm +7-10 m: mmmrqwsmnkgbdbrmmjjm +7-8 z: zzzzzzzzzz +2-3 p: pppnfltzpd +1-10 h: hhslhfsgtxphhncg +5-6 m: txmhxhtmgm +4-5 v: wsnvrsvx +8-12 p: pfbdlnrphdfplvpqx +10-13 b: nbpjvgghsbplb +9-15 h: ghcxbptxsgvvvptqx +4-5 t: tttgf +2-3 l: lsnl +1-11 v: vvvvvvvvvvvvvvvv +6-7 r: brnrrrr +3-4 k: bkkvkrtmzj +17-18 p: pppppwphpkpppppppp +8-11 f: fqfffdffffpfffffffff +14-16 z: zznzzzbzzzzdzzzsz +10-11 v: xtvfnxdrvqnxg +8-13 c: tcwtbcpfvdccs +5-6 b: btbnbdb +2-4 d: ddxmcb +6-9 p: qpppzppbpsplpppppxp +7-12 z: zzzzzztzqzzqzz +4-5 h: hhhmb +7-10 f: frftffhfff +4-5 c: xccmv +8-11 x: rfglxxxhxwvxxfcxx +7-10 k: kkqnjxzckmmbkkk +6-7 h: hhxsdhhwh +15-18 r: rmrrlrrrrrrrrtncrcr +10-11 x: srnxxbbhxxx +13-14 c: cccccccccccchx +5-8 r: rrrrfrrhrrr +11-15 v: vvvvvvvvvvvvwvvvsvv +6-8 q: qqkqlnqzmqqx +2-3 h: hhzq +10-12 l: lllflllllpqt +7-9 m: mlmmmmmmm +4-12 b: pbbhbrrhzxvrgcsfmqq +8-10 g: tggrgggbgdggmg +9-10 s: sssssksspsss +4-8 k: dtkkkkkkkkkkmk +19-20 j: jjjjjjjjjjjjjjjjjjjj +3-8 r: rrrrxrrrrrrr +9-10 p: qmgzfbqpnp +1-4 w: wwwsw +1-15 f: fffffffftzftxhfwfbx +1-5 t: rtttttlxtjtttsq +3-4 f: fmffkt +16-18 n: kfnnnlnnnsgscnzmrv +3-4 w: wwmk +7-9 l: lllkbllllllllljtjll +7-13 l: pqzbtxmqslllqkx +6-18 j: qlnjjvrtzqkfrnjxjk +6-8 q: qtpqqpqg +6-8 c: cccfccxd +3-4 f: fhff +4-5 x: xjxfhqkhx +16-18 k: xvbktrmqkckwkrkkjkk +9-13 v: vvvbvvvvvvvvnvvlmvv +1-7 k: wkkkkkqkk +2-4 z: jpzlxfjbh +5-8 l: lllllpllfllllr +7-8 r: rrrrrrwnr +5-6 d: ddddftd +4-5 q: vqlqn +3-13 p: pppsppmpbppppppppn +1-3 w: wwww +4-5 d: tfrpfcdlft +5-10 r: rrrrppxrrvrm +9-10 t: dtttttttgvtt +8-12 j: jjjhjjjljjjjjpjj +6-7 b: lpfpzljhbl +3-6 k: kzkqkrkckkv +3-7 q: rvqdtsqqjfftzllflnx +2-3 l: glsjcsrlmn +5-8 g: gggxhggpgg +12-14 q: zqqsqqqqqqqqxqqq +9-11 q: qqqqsqjtqqq +9-10 g: gggggcggggg +12-14 z: zzzzzzzzzzzlzzzzzz +1-6 s: gvqttcgrqqsbndv +8-19 z: mzzzpkzdzzzskfhzzlj +4-6 h: kmlbhwthhp +8-9 x: xxxxxxxvk +1-2 k: drjkkkk +10-12 z: zdzsgzzzwvzrzszzzzzz +13-14 f: lffdffjfbfdxjd +11-12 b: rppkbnjgcqrr +1-2 l: lllq +5-6 m: mmmmzr +6-14 l: lllbldllpllllblllcl +4-9 d: rdtdcwnbqjbthddr +13-15 v: vvcwvvqvzvvvfvg +9-10 g: gpxpwxhmgg +13-14 n: njpndvsvfgrrhnb +3-5 r: rrrrr +7-13 h: hhdcgscdxmhwhg +3-4 l: tnhf +10-13 c: mfcvbcmcccqhc +6-7 x: cdwfdxxxxxx +5-7 b: wbbzwbcx +4-6 h: vhhzpqjhk +5-8 r: hffprngr +14-15 p: pppppppppppspjm +8-12 z: pzqdhzzkzzzzxzzc +1-8 b: kbbfdvvcsdjlbw +16-18 k: rqwtgtwzgsnvlkdkkk +8-10 w: xllfslwwsf +2-5 m: qmbdm +10-12 b: bhbbbbbwtbbbbbhbb +8-14 c: cscdccccccccxcp +3-5 c: rcdpz +16-18 q: qqqqqqqqqqnqqqqbql +3-4 x: xjxx +6-7 n: gnnnnxwqn +16-17 f: tffrffffffffffffff +5-6 d: ddddgm +2-7 r: prrrssrrkrjrrr +12-16 g: ggxbxggtgbggccwgggtv +10-14 n: nnkntpnvncnnnznnr +3-5 c: qccwcx +7-17 v: jvvvvhvvvpvvqvgvv +3-6 c: cclccs +8-10 m: nwtmfcnmmmmm +1-2 p: hrpp +2-3 j: hdnjgt +1-3 h: jhgvhjhh +9-10 j: jjjjjjjjvl +12-15 h: hhshhhhthhhhhnhn +5-8 k: qkvmkwckvlkl +12-15 j: jjjjjjjkjjjwjjlj +11-16 v: tvmrmvvvwwqrxwvg +5-7 b: dbhtpjvxqzbhbz +3-4 b: mqbg +4-7 t: tttbtvt +8-13 h: hhhhchhhhqfhhhhhthr +1-6 w: lhwqgrbbwbv +1-11 t: ttttpttttttt +2-5 l: rlwllvfhw +7-8 m: jmmrmmmmlmmm +3-5 s: smsss +15-19 p: mfpzcghppcgpgqpfvxfw +6-7 n: jnldsnb +7-9 x: xwbwdxjhcxxvxx +1-2 c: cbqprgfjfpc +3-4 g: gngf +7-10 w: twvvwwtwwtwwsgwws +2-9 g: ggngggglgrzk +7-9 p: xpphpkppppp +11-12 p: pppppxpppppppppp +3-4 g: fzqrl +6-7 x: xxxxxmw +3-4 r: rrrn +8-11 b: bbhbbbbrbbwbkb +3-11 d: xxvfmvrdmzhfmvmhhp +1-12 z: mzzzkzwzzzxfzzzzzzzz +5-11 g: gzbjgxghddggkgq +5-8 g: grpggrgg +1-6 f: lfffffsfffff +8-10 x: slxxxgxxqxxx +4-13 l: lllllllllllllvll +8-9 z: zzzzdhzzz +13-15 l: rglrmcqvgjzvlklx +2-4 q: nsxs +2-3 v: vvqcv +13-14 b: bbbbbbbbbbbbbb +13-14 x: rxxdxnxxtxxxqq +1-4 s: jmsssssgssvppss +6-7 j: pgvjkxcvjslmj +2-5 w: jwwswgl +5-7 m: mmnmmxp +2-6 k: tkkkxwtkrk +4-15 n: nnnnngnnnnnnnnnnnt +7-11 x: dxxtxxxvwtnx +11-14 s: ssrvphskdsstzsszrnsz +11-12 l: rclllgbllblb +6-7 x: fxhbmnj +15-17 q: kqvhwsqhqqqhmqqtqqlq +12-14 k: kksktkkkkkkkkfk +3-4 h: hshk +14-17 v: vvvqvvkvvvvvvvjkvxv +2-6 f: vfvfrp +4-12 z: bzzqszhwffrhr +2-9 b: sbdjfbndbhcclrmblccn +11-13 j: jjjjjjjjjjgjkjjjjj +15-17 f: fpffffsfffffffdfjfff +6-7 v: tlvvvvv +11-19 l: llllllllllllllllllll +1-6 w: wwbwwwwww +3-7 s: cpsvmss +2-11 r: rrpnkchfzljwxmrrvvw +7-12 n: msgpplgpfnkmxlm +4-13 f: sjpfqpnzqzznfftfhgfs +13-14 q: qqqqqqqqqqqqqqq +13-14 j: jjjmjjjjjjjjgq +2-4 q: qdrds +5-10 s: ssssqssssbs +6-8 c: ccdcchchcc +18-20 z: xztgqzzckzgcpzzzjzdz +5-8 z: ctpdzzzzzqzmvzxn +6-8 b: bbmkgbfkb +2-10 x: xxxxxxxxxxx +5-6 z: gzzzqk +4-7 c: cccvccj +7-8 d: dddddddd +9-11 c: ccdccfccxcccc +1-4 z: zjzzzz +6-8 z: zlmjbzvz +8-10 v: gvtjvgvzvjphscn +8-10 d: dcdddddddddddddd +7-8 p: mjpwppppp +1-11 w: wwwwwnwwwwwww +7-9 j: jjjjjjjjj +6-8 q: dmqdqqzt +3-10 p: tsqcpgmzgh +11-15 s: ssslsxrlbfqsssssss +5-10 m: dpmtmhbdmk +3-5 p: wpjqv +10-13 p: lhvkzxprppmtprj +4-6 w: nlfjwz +19-20 c: kzckcfsqpdvssgcgktcm +1-2 p: ppgltbv +3-4 w: ngwwfttwqg +10-11 p: ppppppnpllgp +2-4 t: tkttptt +3-6 x: xwrjpcf +14-17 q: qcqbqfqqkqdqrqqqq +4-8 n: qsncdnbknpn +8-10 s: wzscpmssrshh +3-8 p: pfppppgpp +11-15 b: tqdbgfbbbgjbbbg +12-15 h: lwhhjzhpmhzhhnhmhh +4-5 w: nwccwlpwdvtlwwr +11-16 w: wwwwwwwwwwswwwwxw +6-9 q: qqqqqqqqqqqqqqqq +8-12 t: tqttjtttpgbtlt +14-15 v: vvvvkvgvvvvvvvg +2-12 f: fpfflxzxffwxfvfff +7-12 m: hmmmmwmmbmlm +2-3 z: mmlzzz +12-16 h: hhbhhhkhhfhpbghm +15-18 s: ssssxsssssmsssqssx +8-9 s: sqsqdtmssqscxxs +1-10 n: nnbnnngnnn +10-14 c: ccbcvscncrccng +7-8 k: kkhkxrkkctkpjkkck +10-11 g: bgpgggkcwzs +9-17 l: llllllllckwllllllwl +7-12 q: gqqqjbxtqvqxzjhvjrjj +1-3 s: ssnsc +3-10 n: nnnnnnnnnnnnnnnn +9-12 l: blfnqllsllll +5-8 s: sgsgstssl +1-4 c: cccwcc +7-9 h: hhhhhhhhhhh +2-4 s: sssss +8-10 f: vznpfffrsffscgfzft +4-5 r: hnrns +4-5 z: zzzlgz +10-18 w: wwwwwwwwwwwwwwwwwwww +3-12 b: bfmbbbbfbbltbg +14-15 z: zzjxrhrjsbrrzgd +1-2 z: zzzzz +4-11 x: pxgxwphxmgxpt +1-16 c: cbgnxcccxsrcbmcvqc +3-6 n: cnppnnjnxnnjss +8-9 r: zltfbjwrrlmtrzqrh +1-3 z: zzqzzzzzzz +4-7 n: vgndgdndbxcnznxc +2-9 w: wwwwwcfnww +1-4 b: tbbrbbbbbcbbbbbbbbdk +7-8 h: hhhwhzhhhhtf +12-13 j: jjjjjjjjjjjjj +2-8 m: rthcgnxmm +2-7 l: glzctbjh +5-7 d: dddddddx +12-13 x: xxxxxxxxxxxxs +6-11 t: ltnfnnqttvtkjnlk +6-7 x: qxxxxpfxxx +1-3 d: kdndzd +6-11 f: zfxfmffptsffmffvfz +1-4 x: xxxxxxx +4-5 l: lllllllll +4-8 c: cjccccgckrdpvv +13-14 z: zzzwzzzzzzzzkkzp +1-3 r: lgtr +3-17 g: ggtgjgmggggggggggggg +4-5 q: qqqqqq +2-6 v: vvvlvvv +4-17 c: nwqcprgftnqgcrjpcjb +7-10 x: xlxfrjxxxxgnxx +2-14 q: qqqqqqqqqqqqqsqqq +4-8 x: xxxxxxxxxxx +1-16 z: bzzzzzzzzmzzzzldzzzz +2-4 v: bffhzd +3-4 r: rrrr +5-8 x: xxxxxnsxd +1-17 g: gbngjggxgggjgzvjk +2-3 b: sgbb +11-14 p: ppppppppppppppp +3-9 q: vhsjtqppqgdqdqlf +1-3 w: wcwzsfzwwcwdwncwp +7-11 f: ffffffdfffff +3-8 g: ksgdcqqgtkmgjbzsf +5-8 s: tsssccswss +1-7 r: brrrrrhrrrrr +5-7 g: ggxmgggcwgz +2-4 h: hhwh +9-18 w: wwwwwwwwhwwwwwwwwbw +1-7 m: ndmmbmmmmmmm +5-7 j: jjvjvjt +3-8 m: plnmcmkfmmcm +4-5 r: rrrjzr +4-8 k: kkkgkjknkjkk +17-18 s: srngdqpwxcrbqrprss +4-9 t: mbkjrtntztrttt +1-10 w: hwwwwwwwwwwtx +5-9 f: lfvhfxndfffmxhf +7-8 n: pnnnnnbvnnnnnnnnnhnn +1-10 b: jjtptpmmqv +1-3 p: rqppqt +1-11 t: pbtwdttkttmtxj +5-6 g: jpkfggtcmj +6-8 f: fffffpfvf +9-13 t: ttttttttdtttg +3-5 r: prrjr +18-19 b: bbbbbbbbbbbbbbbbbbb +5-7 v: vjvjxjhvrv +8-10 z: zzzsznzxttgspzzzz +5-13 m: mngmcbmqbxmzjfm +1-3 b: xbhb +12-14 m: mfmmbgmmmmmcmz +3-6 n: jpnpnnn +3-14 j: xmgjqkzfctctxwgjms +7-14 k: lbkfcbctkgkjkqvjdwkc +6-8 l: lhthfgllfvbpxchct +5-6 h: hhhhhk +6-9 c: qkxtbqltkzcrdcgckncc +13-15 w: fhsvgcxwfcgxwvwwwkb +3-4 c: cccmcj +3-4 m: mhmcmm +4-5 k: skkqg +4-16 m: mgmcmmmmmmmmmmmtmmm +3-5 g: gggbsg +9-15 l: dnslgllwlflmlllllll +3-4 h: mhhh +3-5 z: vkjzlzzvrztwg +11-12 q: qqqqqqqqqqqq +5-10 p: xpxprppppgzppp +1-4 z: kzzhzszzzzzzzz +2-7 j: nsjfszt +8-13 j: qtrjfmbjfswrj +2-10 s: ssscwcsnsssrt +1-12 w: zwwwwwwwwwwx +2-4 p: ppgvf +2-3 n: hnnxmgtchqwgnfx +11-12 z: bfzlvgdzpfzzzgvhz +1-6 d: czqqdjrxs +6-7 r: rrrrrkz +4-7 d: hxdzddvq +2-4 g: slwgs +13-14 f: mqfhrlftvvfkff +12-14 d: ddddddddddhqdc +1-3 f: ffzff +4-5 r: mrrrkrrrrrrkr +3-4 m: mmwl +2-5 j: jljjsjdj +4-5 f: fkfdf +16-17 s: dzdsrsgmsjffsnssls +10-17 f: fffffhffffhffffff +8-10 v: fvvvvvvvvz +4-9 n: nnnpsnjstl +8-11 x: xxzdxfjczxx +4-10 k: nrkxhfzspmfpzcl +7-10 x: pxxjlcbtsjxdc +1-14 s: fsszssssssfsssss +5-7 d: ddgdgdvddd +2-11 t: jttpshfcmlt +1-3 v: pvdv +5-7 x: xxkxxxx +13-14 d: ddddxdvdppdcrdhk +2-6 h: hhmhpc +6-11 g: jxhsggmgcrp +13-16 r: krrrnccjrrtrtrrlprrr +3-4 f: ffff +5-7 t: ttttttttttttt +5-7 d: ndddjdw +7-12 w: wgjwwbwcxfww +2-6 s: sxsssbs +12-14 l: xlxslmmjpvmzll +4-6 h: hdhhhhdhkch +9-11 j: jjjjjjjjjjj +6-8 d: dddddddn +5-6 b: bbbbsnbbbbb +1-8 h: hhhhhhhhhh +5-11 p: ppppppppppp +11-12 d: dddddddddddk +1-2 b: bbpbb +2-8 j: jjhhjzjjt +5-6 k: kfkjkk +3-5 j: kgjjjjqnjcfmjjrc +2-5 l: jtmzhlcs +3-6 v: vvvvvvv +15-16 v: vpvvvvvvvvjvvsvvvvvv +15-16 h: hhhhhhhhmhhhdhhh +2-3 k: ksdg +7-11 b: dbhbbbbbhbbrb +4-14 k: kkkknkkkkkbtkkk +5-6 j: smdndsgfm +2-3 c: sccc +10-15 w: bwwwbwwwcwwlwwpwwwww +3-6 w: wwwwwww +14-19 s: jqdgjszsssssdrssjszs +5-10 p: vpppbppppp +4-7 p: zcpltzbsjmcgpv +2-8 j: tfjjjjjnprj +14-15 m: mmmmmmmmmmmmmhqm +1-6 t: pttttct +9-10 n: qnbnzxjfnnkb +5-6 v: vvvvjvv +7-8 v: qvvbvpvvvf +2-15 s: sjsssssssssssstss +7-10 b: bvbbbbnbbbbb +13-14 b: bqbbbjqbbbbbtq +3-7 k: cltbmkkb +8-9 c: mlscsmqccfmccszsslck +3-4 k: kklckk +5-7 c: cccmclg +5-7 d: dnddddd +1-5 f: xfffbffffffffff +13-15 n: nnnnnnnnnnnnnnqfnn +3-6 t: ttttqztttcttt +3-4 s: ssnws +9-11 f: bcvkzrdrcffgzjgvf +3-10 r: rrrdrrqrrrrrr +3-6 h: bbqhkh +3-8 n: nngnwthw +1-11 x: ffqbbnxcpkrlzhm +3-4 b: bbbbnnb +5-6 f: lfdwqjffmj +7-16 v: vvvvvvvvvvvvvvvvv +13-15 m: zmmmzmmmmmmmmkmrmmmm +1-2 r: rrrr +12-14 d: dkdddddddddddcddd +14-15 r: crlrtjkrrnhqrrr +5-9 w: xjjwpcpfffchxtww +15-16 d: jdcchsgdjtjdcxdrlwx +9-15 p: cpmpppprpnpppsp +6-7 w: jlqkwww +1-12 p: wpfqzppptpflp +4-14 x: xxxxxxxxxxxxxxxxxx +1-4 z: xzzjz +2-10 t: zvbnlwltbkvvcf +5-9 v: vpvvvvfvvvvv +2-12 l: lllllllllllllllll +2-6 w: wmcwzpvxqsbxrrw +11-12 l: lldlllllllrllgll +9-13 h: hhhhhhhhdhxhrhh +6-9 x: xxxzxxxxxxxx +1-15 x: vcsxxxgxxxxwxxbbxx +7-12 d: fmddcdfndddddkdnrgt +12-14 x: wlmbpdxxrxbxdxg +5-9 l: gnllscnsz +4-5 j: jjjjj +6-10 q: kvctnxpqhqfhjb +6-8 q: vqqnqcqpqq +2-9 k: mvxsbrxzr +10-11 c: lbcgbpsxhcc +9-17 x: xkdpklsvxqlkvrlvx +3-14 j: trjcmjzjqkbjjj +7-8 k: kkkkkkhfg +1-3 f: pfdf +9-12 s: glcjzdmllprrrxmdds +9-11 b: bwbbbbbbbbqb +2-14 f: kzfffbzfhfffflf +5-7 n: ngnnnnn +6-10 t: tttttrtttjtt +7-8 f: fvffzfpff +3-5 h: jbhkx +9-11 b: qckbnjtbcbb +12-15 m: mmmmkmmmmqmmmmjxm +9-11 c: cdckczpcccc +1-3 v: wzxq +8-11 q: qhqqqqqlqqnqq +4-9 j: mpjjqsdsj +13-17 s: sssssssssssssssss +4-7 x: knbxqrxxzl +15-17 m: mmmmmmmmmmmmmmmmmmm +6-10 w: wxnwfhwqdd +9-11 r: crrrrcrnrrwrrmrrrm +9-15 l: klflxlcllldllllll +1-4 n: vpnznn +2-4 k: cjkg +7-8 m: xqmmrmmjjshmfm +4-6 f: sfffff +2-7 l: mltmmnldsnnl +5-6 j: tjjdjxjjbs +4-5 p: ppmnp +2-3 b: bzrb +5-17 h: dmpdgxthrcppfznbhchw +3-4 p: pppp +3-5 v: vvhvvr +9-10 g: gflzqwbvgsgnbzngmgr +8-17 z: xpvzsrhgzqtdcfjzl +1-4 x: khxjxxvd +3-4 z: czzz +10-12 m: zjzcmmpxmjxmxzm +7-9 k: kkkkkkkktkzkkk +16-17 d: ddrdgdxdddddgddwmd +2-16 f: xmsflgsvfwnfmxwnnmg +4-12 b: ltbkbqbbbbbc +12-14 t: tctlnvtjttsgztthtxtt +9-14 x: xxxgpxvlkxdxdrxxrxwx +15-17 s: xsssssssssssssvgw +10-16 q: hqqpqxjqbsxqfqbm +4-5 v: vvvnvvvttv +15-16 v: rwshvltmvgvcvpvv +4-5 j: jjjjjjjj +3-5 w: jwfwp +4-5 m: nddmm +10-13 t: rtttnttttttttj +14-17 l: llllllllllllltlcnl +7-16 p: crjhtmpppgkpvgnpt +6-9 b: bbfbbhbfgdrb +1-2 q: qkqq +17-20 f: hwcftkmtzhftmnfwfsdf +2-4 w: wjtww +10-11 p: pppppppppppp +5-12 l: dntvlnljwkkldgp +3-4 s: gmkvlqxsx +8-10 m: qmmmmmmmmm +12-14 p: gtbnfmlvtkppwp +7-8 t: ttttttvs +12-18 j: jjjjjjjjjjjjjjjjjb +5-7 p: tfrppwpcpppp +11-13 h: hthhhhzfbhhhdhhph +1-7 n: ncgsvwvlvwlhbtmnnnpx +10-11 j: djjbsjljjxf +5-12 n: cnjqkknnnnmjnq +18-20 z: zzzzzzzzzzzzzzzzzbzp +2-5 m: kphbm +12-13 g: tzrqwrjgzkxgg +8-9 w: mwwwkwwwww +2-6 j: jbxjjzjjjjj +9-10 j: jjjjjjjjznj +5-6 j: jjjspjj +8-18 g: jggmgpfggbvggvgggggl +3-5 n: nnxnh +3-18 n: nnlnnnnnngnnnnnnnhnn +6-10 r: rcrctghspmrrbrcrrrrq +18-19 s: sfxqssssgssscxsdrss +7-10 b: pbbbbbbgvbzbbz +15-17 m: mmmmmmmmmmmmmmhmmm +4-11 s: sssgssssssssssssxfss +7-9 g: ggtgggggg +4-8 w: wwwwwwwt +17-20 p: pppppppppppppppppppn +2-5 w: hdxrw +9-18 c: cccccccccwcccccccc +1-9 l: qllllllllllllll +15-16 g: ggggggggggggggnj +8-9 s: sjszkrhsss +12-18 g: ggggggggggggggggggg +5-6 s: ksnsxspsw +4-8 p: pppbpppcppppp +4-10 f: fffffffffff +1-2 d: dqdd +7-8 w: wwjwvhvcwbwww +3-5 h: xghfhzhqw +4-5 q: qqqzpw +5-9 q: fxkrhqrjq +2-4 m: mmjm +1-4 p: wpmg +7-13 n: nnnqfdtnnnnftnlnnn +2-11 w: vwphpjskljxgqsgqzph +2-4 w: wwwwgfkmpcf +6-10 w: htgtkwwrmwvgrdmkzt +3-4 s: sssstss +11-20 l: dqlqmkllqclbmzklllrt +1-6 g: gfgcwgvzkrhgjslg +2-13 j: jjjszjxjljjjjqjjvjjh +4-19 q: qqqlqqqqqqqqqqqqqqfq +11-14 j: jbjjjjjjjjrjjp +10-11 f: fpffvfffspvkf +4-5 v: vhvlvhgh +6-8 h: nsfklqhtxg +2-3 z: czwnzzp +1-10 c: wcmvcrcmjmcmbcckfcdc +2-4 f: hzbrjqqntbbffbfl +2-5 b: bzmbwztrb +7-9 z: bscfzxzxz +13-14 z: zzzzznzzzzzzbn +3-7 t: rlxttrcmfttlt +4-6 h: rldcbhx +11-12 g: vfgfdgffbrrg +1-10 s: ssssssssjsss +7-13 k: dqbklkhvlgphjqhvgc +8-18 x: xxxxdxxxxxxxxxxxxzxl +1-3 x: xxxx +11-12 z: ttzhvzzzxkzzzzgz +5-7 h: hjmhhhhh +10-12 l: lllllllpllllwmwwb +2-6 j: hfjqlm +6-9 n: mnnqfnpkw +7-8 c: cckcqchscc +4-5 q: qqqqq +11-13 d: dddddddjddddgd +3-11 q: qvqlqqqqlknnqhq +1-4 h: hnphh +9-15 f: ffffffffffffffffffff +4-7 p: pxpvbpcz +9-14 g: ggggggggwgggggg +1-2 w: wwwwwwwwww +4-5 g: ggcgggvg +11-15 k: kkkgtkcjmwkrkkkkkk +3-4 w: wzww +8-10 k: kkkkkkkwjqtkkkkkkkk +5-6 n: djnfkmzzbc +12-18 x: jxxnxhqxxxxsxxxbxxxx +13-14 p: hbmspppspppkgp +15-16 d: dtddddddddddddpkd +4-6 q: bvqqcpq +2-4 h: dqhsjpp +10-11 l: llllllklwll +4-5 h: dhhcdh +3-5 t: mvntxdsxftt +5-9 w: wxpqwwqwjf +14-15 c: cccccccccccccccc +6-8 b: bbtbbdbwb +4-7 g: gdpqgrj +1-6 p: qppppppp +1-14 s: sqssssbrszsskmss +7-9 n: nnnnnnvsn +4-7 r: nrltrrhndcbrr +8-18 d: dddddddpdddddddddfdd +1-3 b: bbbbb +6-7 f: fpfplqf +2-8 j: jjjjjjjsj +3-5 h: ndhwxnb +4-5 z: zzcztzv +5-6 c: ccccck +3-4 q: qjqqqqq +4-19 q: nsqqgqpgmjsmbkpzwvl +13-15 r: rrrrrrrrrrrrrrrrr +6-12 k: kckvkkhkfbkkkkkkr +3-5 x: xxxxsxx +3-4 s: ssff +2-7 l: pgwllllhlxwl +8-18 z: zzzzzzzzzzzzzzzzzz +1-11 c: fhhcjcchrlxcpcc +3-4 w: zhcjwjnwgwg +1-7 x: zxlpxmxt +12-13 k: jskdrkmhkkkndk +1-8 x: xmpwwvrx +10-12 r: kprvkppwczjt +1-12 b: sbbbvgbbzgbtbklsbb +1-2 z: zzgqpwhzrhnrgjrgrstz +9-11 s: ssssxssssss +3-10 k: sbksdgcrkkxfgc +7-8 n: nnnnnnzf +13-14 j: jjjjjjjjjjjjjj +3-4 f: fmff +13-14 k: nkkkkkkkkkkkkk +2-3 w: zbtww +1-5 k: kgmkkrckdp +4-5 p: xphlp +3-4 k: tzzh +2-6 s: jssvsxdsszsthspslztk +1-3 z: mzzzqzzz +5-7 h: hkhhwgwlchnh +8-14 v: dvvvhggtsvdwgx +3-8 d: dxdrkjcd +2-4 d: pkmb +8-11 b: bbbbbbbmbbkbbb +3-12 j: wxljjrjjjjhzj +5-17 c: wbnpcnngzcgcgbqwvkh +2-6 q: sqlbhq +1-3 n: nlbqgnhcnnznj +2-3 k: gkncgkn +4-6 g: gwxglggzhnq +3-14 j: dgjcfxrjcgwjmjdmggk +2-3 z: qvnrlzs +11-12 k: kdtwlzkjfdkkfkn +15-18 b: bqpxdxbbhkbnfdbfpb +5-15 j: jjjjgjjrjjjjjmmjjjj +8-13 t: tthtpttttmtktttt +6-8 f: wxbpffcf +8-9 b: bbbbbbbwr +8-14 l: xmlrtbphkjrxrg +15-18 x: qxxxlpxxmxxhmmxxxx +7-11 c: cccccsclcrc +1-4 k: kkkkkk +3-4 j: jdqq +11-15 b: vgfqbwsrkhgjhjv +13-16 k: kkkkkfkkkkckkkkkkk +18-20 b: lwwgrrbtwbcvdhbwbmbf +7-12 m: mmmmmmmmmmmmmm +2-12 l: pllndrxbzqzlmzstmbvw +3-14 r: rrrrrrrrrrrrrrrrrrr +1-16 p: ppppppppppppppppppp +5-9 x: mtbxxxjxxxxd +2-4 r: rrrrrrrrrr +3-4 k: kfkz +3-5 m: mgmmmm +11-12 l: blcpjbfvzjll +2-4 z: tzzzd +5-9 z: zzzzqzzzrzjzzzzz +10-14 m: mmmmmmmmmmmmvcmmm +2-7 w: jwchkdws +12-14 p: mdpppjpppppppppppr +15-18 v: vvvvvvvvvvvvvvtvvcv +4-10 p: pppfmbkhqppkvzpp +3-17 p: ppppppjppppppppppppp +3-6 r: cjvklrqrnhkk +1-3 s: sssss +2-6 d: dqddctdjd +12-16 k: kkprkzdksmkbkfxd +8-13 g: pggggggzwgggwgggmg +13-16 b: sbwbbpbhbbbbdbbgb +10-14 c: ccccccccccccccccc +4-8 j: cxkxmzcrsnvbkfvmlk +5-13 l: lmdnlnkbtspvll +3-4 g: ggmgmmhwfmg +5-7 d: ddddjdp +11-15 v: vplvcvvdvhvmvtv +10-12 r: rhrrrjrslrrnrqrrrzrn +2-6 x: xhxxxxxx +5-10 s: zmrkslzcdsrssfsssss +5-7 r: rrrrrrr +3-4 g: ggpx +14-15 s: sssssssssssssmb +1-5 w: smclhnwxff +4-9 l: lllcllllqvlllll +1-4 s: lhpd +12-14 b: cwbdzbbbbdbfqc +5-13 b: qtbsqbvjbcxbkznrlb +10-12 f: fffpfffffxfqffffff +15-16 x: xkxdqrxlwxxvxtxx +14-15 p: ppjpgdppppppppgpp +10-16 n: nnwnnnnnnnrqnnnn +5-7 k: kwwzqdn +2-3 m: mchvnq +6-10 h: vhhxzphthw +5-6 r: slpcrr +17-18 b: bbbbcmbbbbbbbbbbpzbb +3-5 s: wfscss +9-12 r: rfjrrtrrrrkrr +1-8 t: tstztmttgtttfvt +8-9 f: fffffffjnff +7-13 l: lkxclrlgldxllcll +10-12 s: bssssdssbsxc +8-12 t: tttttttwtttttt +3-11 d: ndrndqqzqhdnjf +1-10 g: xgqgggqggfmgggggggmg +8-9 x: kttxbdnxxxcfjxxrxgxx +4-10 n: ndjrqmcxnh +12-13 c: txpwlvzhxhcwbpg +8-9 z: crsqsztzz +5-6 b: vbwbjb +4-5 v: vvvvv +2-6 d: tdsddddx +4-10 r: hzqzrrnwrrhrrfrfwrr +11-18 g: ggggggggggggggggggg +1-7 z: zhcppxz +7-9 r: rrwrrrrrr +1-9 l: hlllllllqllpllllllvd +1-4 g: jklqjgvtxsggfjggg +2-18 m: mmqmmmjkmmmlkmmmlvmm +1-8 w: kwgwxzshwwwc +6-7 f: fffzfgk +6-8 t: ttttthtcttk +3-14 s: hsszwzdxkhsphrtrcbs +4-10 l: lllllbllllll +3-8 g: gggdgggkj +1-4 x: xxxcx +3-7 k: tqhknrkxjxqv +11-19 p: pwwppgsztplgssgtpsp +11-12 k: kkkkkkkkkklgkkk +4-16 h: tnhhcgldlnzngvhb +8-11 w: znwwwwwwwwwwww +8-9 m: mbtmmmccjvmtm +14-15 l: lllllllllltllfw +11-16 z: kfslzzwszdmsnptcz +5-6 g: qgggggk +3-8 k: kkmdkwkd +9-14 v: vvvvvvcvnvvvxwvfvv +3-7 v: vvtvvvcmvvvvxvvvv +6-7 l: dnfjfzfhhn +9-10 g: mtzwcwgfjgshqg +2-9 s: bsgcgjrqs +3-4 c: ccpc +9-14 n: nnnnnnnnnnnnnnknnnn +4-5 p: tppxsp +4-6 x: xmxxnxxw +3-4 m: mmmm +15-16 s: swshctdsksqgcsqsr +2-4 x: xxxxxx +6-7 h: hhvhhhh +8-15 n: nnmvfnhnlndnwgjthmb +4-5 z: fvzzzw +1-12 m: wmjwgmmlmmmm +7-16 n: xhnxjkjprznthqmdnwnl +6-9 b: bbbbbbbbb +17-19 d: ddwdlddkrgdkdddpqdj +6-9 b: bbbbbbbbbb +7-19 l: llvllllllclllflllll +7-9 h: lhhhhhfhhhh +7-10 m: hsdgdmmqqncdcgfxpb +7-8 h: hqzcmvhw +3-7 l: clkllltlwlp +1-2 g: gsgggggqgg +6-8 j: qjjqqcjjjjtjs +11-14 r: nrlhdrrlbrrxgg +3-10 s: tsxfscsfsws +6-7 t: tstttdtbt +6-7 r: rrcxrplkrnrrrbrpl +3-11 b: pbwvpbkbzdbwbvlb +5-11 d: wgwhfxtjmdfd +7-12 m: chmmmrmrmxmqjcpmb +1-2 n: nntnnn +4-12 l: lllllllllllnllll +4-5 c: ccchc \ No newline at end of file diff --git a/2020/2/prog.py b/2020/2/prog.py new file mode 100644 index 0000000..ef6a3c5 --- /dev/null +++ b/2020/2/prog.py @@ -0,0 +1,56 @@ +def get_file_input(filename: str): + ret = set() + with open(filename, "r") as f: + for line in f.readlines(): + rule, *pwd = line.split(":") + pwd = "".join(pwd).strip() + ret.add((pwd, rule)) + return ret + +def main(use_sample_input = True): + sample = { + ("abcde", "1-3 a"), + ("cdefg", "1-3 b"), + ("ccccccccc", "2-9 c"), + } + expected_result = 2 + + res = get_result(sample if use_sample_input else get_file_input("input")) + + if use_sample_input: + return f"{res} {res==expected_result}" + else: + return res + +def check_n_chars(pwd: str, char: str, n_min: int, n_max: int) -> bool: # part 1 + n = 0 + for c in pwd: + if c == char: + n += 1 + return n_min <= n and n <= n_max + +def check_pos_chars(pwd:str, char: str, pos1: int, pos2: int) -> bool: # part 2 + return (pwd[pos1] == char) != (pwd[pos2] == char) + + +def is_pwd_ok(pwd: str, rule: str) -> bool: + *delimiters, char = rule.split(" ") + n_min, n_max = "".join(delimiters).split("-") + n_min = int(n_min) + n_max = int(n_max) + + return check_pos_chars(pwd, char, n_min - 1, n_max - 1) + + +def get_result(data: dict) -> int: + ret = 0 + for pwd, rule in data: + b = is_pwd_ok(pwd, rule) + ret += 1 if b else 0 + + return ret + + + +print(main(use_sample_input = False)) + diff --git a/2020/3/input b/2020/3/input new file mode 100644 index 0000000..ada25cf --- /dev/null +++ b/2020/3/input @@ -0,0 +1,323 @@ +.............#...#....#.....##. +.#...##.........#.#.........#.# +.....##......#.......#......... +.......#...........#.#......... +#...........#...#..#.#......#.. +.........##....#.#...#......... +.....#.........#.#...........#. +....#...............##....##... +#.#.............#..#.......#.#. +...#........................... +......#..#....#.............#.. +........#......#.......#....... +....#.....#..#.#...#.........#. +..#.#.......#.##...#....#.....# +...........#.........#..#...... +#...........#.#..#...#.#.#....# +........#...................... +....#.#.....#....#.......#..#.. +.............................#. +....##..........#.....##......# +......#.....................#.. +..#.....##.......#............. +....#.#..............#.#....... +..#.#........#.....#..##....... +.....#...##.........##....#.#.. +.#....#..#..#...........#...... +.............#.....##........#. +..#....#............#.........# +###..........#........#.......# +#...#..#.#.#.........#..#...... +..#....#......#.............#.. +#...#........#..#...#.....#.... +.#..........#.#........#....... +#.....#.........#..#......#.... +....#....##........#......#.... +.......#....#.....#..#..#.....# +.........#...#.#...#.##........ +.##.##...........#..##..#...... +.#.##....#........#...#........ +.......##.........##.####.....# +....#..##....#................. +.#........#..........#......... +##....##..........##........#.. +#......#...........#....#..#... +.......#..#....##..##.....#.... +.........#.#.#...#.....#....... +......#...#...#....#......#.... +##....#..........#....##....##. +###.........#...#...#.......... +#.....##.#........#.......#.... +#...............#...##.#......# +..#.....####.###......#......#. +....#.......#..........#....... +....##..............#.#.#...... +.......##..#.......#........... +..#.......##....#.......###...# +........#...#.......#.#...#.... +.........##....#..#....#....... +............#.#.......#.#...... +.....#.....#...#....#.##....... +.......#.........#.......#..... +.#..#...#.....#............#.## +.......#.#......##............. +##.#......#.....#.#............ +.#....#.....#............#...#. +.........#.......#.#........... +#............#.##...#..#...#.#. +......#....#.......#....#...... +..........#........#..#.#...... +#..##.......#.........#..#..... +.........#.....##........#.#..# +..#................#........... +....#..#........##.........#..# +###...#....##.#......##.......# +.......#......##..#.......#.... +.......###...#...#..........##. +................#.......#...... +.#......##.##........#......... +....##.#.....##.......#........ +...........#...........#.....#. +..#........#..#.#...#.#........ +#...............#...#.##.##.#.# +................#.......#...... +.#..#......#........#.#........ +...##..#.......#.......#..#.... +.#.....#.#....##..#........#... +........##......#..........#... +.#.......#.......#...#..#...... +.#..##.....#....#............#. +...#..........#....#........#.. +..#.#..#.......#.#.##.......... +#........###.....#.#.......#.## +.....#....##.............#.#..# +..##............#...##......... +...#.........#...........#..... +...#......#.#...#..###......... +.............#...##............ +.....##..##.####.#..#......#.#. +.#...#.....#.....#.#.....#..... +.........#.......###.....#..##. +.##.#..#..........#.##.#.#..... +.#...#...#.#.##......#..#...... +.............#......#......#... +#.....................#......#. +...#.....#.....#....#........#. +................##..#....#..#.. +#.###...#.....................# +...#..#....#.......#.........#. +...........#..#..#...........#. +.......#..#......#....#.#...... +..........#......#..#....#..... +.#.#.....#...#.#...#...#.#....# +.....#.......#............#...# +#.#....#......#......#........# +.#.#..#.........##...#......... +#..###..#...................... +..#.#..#....................... +.##.....#...#......#..#........ +...#...........#...#.......##.. +..#...........#........#....... +........#....#.....#.#......... +..........#...........#.....#.. +......#...#...##.#............. +.#...#...##.................... +............###.........#...... +.#.#...................#..#.... +....#.#...#.#........#.#....... +....#...#...........#.......#.# +...........#............#...##. +.....####....#.#......#.#...... +.##.............#............#. +......#.........#............## +#.#....#...##....#.......#....# +.....#.#....#..#..#...#..#.#..# +.........................#..... +......#.#....###.......#....#.. +.....................##.#...#.# +..#.....#.#.#...#...#.......... +........#..##........#...#...#. +..........#.#.##....#....##.... +.............#..#.............. +..#.##..#.......#...#..#..##..# +..#..#....#.#..........#..#.... +..........#....#...#......#.... +.##...#.......................# +.#.....#....#..........#....... +...........#..#......##.....#.. +......###.#..##....#...#.##.... +.......#..#.#....#............. +...#..#......##.........###.#.. +...........#............##...#. +...#...#...........##.....#.... +..................#............ +.#.#.#...#..............#..##.. +#.#....#........#.........#.##. +#.#.#.......#.....#..........#. +...##.....##.#.....#........... +.#....#..............##...##..# +........##..................... +#..#..#.....###.............#.. +.......#...........#........... +.........#..................... +.......#...#...#.....##........ +......#.........#........#..... +...#....##..#.####.#.......#.#. +.....#..#......#........#.##..# +.##....#......##......#...###.. +..###.#........##.#...#.......# +............#......##....#.#... +.....#....##..##............##. +......##....#.#...#....#.#..#.# +.......#.........#.#.....#.#... +.......#.#....#................ +.##...###..#.....#............# +#.#......#.#..#..#.#...#..#..#. +..#.#.#.....#............#...## +.##....###.........#..#........ +.#..#.#..#.#....#.........##.#. +....#..#...##.##........#...... +........#.#....##....#....#.... +.......#..#..#.#..............# +#....#....#.....#....#......... +.#.###...#....#.......#........ +.........#.#....##....#...#.... +....#.............#.....##.##.. +.....#.....#...##..#.#.##...##. +.........#..#................## +...##..##......#.....#........# +.#....#.....#.#......#..###.... +#.....#..#..................... +....#.#...#.#.................# +.....##..................#..... +#....##...#.##..###...#........ +##.#.........#.......#....#.... +.#.#.............##..#.##...... +...#.#..............#......#... +.............#.........#.....#. +#.......#........#......#.....# +.....#..............#.##.#..... +#......##...................#.. +##.#.....#..........#........#. +#...........##...........#..... +.#...#.....#..#..##....#....... +.....#.........#....##.#....... +#........#......#.............# +.#..................####.#..... +#...#......#....##...#.#..#..#. +............#.#............#... +............#........#.#..###.. +.#..#..#..#.#.#.....#.#........ +#.....#..#.#...#..#..#........# +#................#....#..#..... +....#..#..#.#......#.#..#.....# +.#..#.......#...##.#.#.....#..# +#.....................#.......# +.............#.......#...#..... +....#......#.........###.##.... +....#..#.......#.#........#.... +....#...#....#.#....#.......... +...#..#......#.............#... +.......###.#.........#....#.#.. +..#.....##..................... +.#.#...........#..##....#...... +..........##.#....#.#.......... +...........#.#..#.#..#.#....... +..........#..#...#.....##...... +.....#.........#...#.#..#...... +#.#................#..........# +...#.....##.#..#...#.##.......# +.....##...........#............ +.....#...#...#...#.#.....#..... +...........##.................. +.........#................#.... +......#.....#.#...#.......#.... +...#...#........#...#...#.#.#.. +...............##..#....##...#. +...#.#...........##.......##..# +...........#............#...... +.#....#.#.......##.#.#.#....... +.....#.#..#.#.#................ +.#............#...#.#.......... +.....#.......#.#.......#.....#. +#....#...........#...#....##... +..#...#..##.....#....#..#...... +#.#.........#..#.#..#.#......#. +................#......##...... +#........#..............#....#. +........#..#.#........#..#..#.. +#..........#......#............ +..##.......#..#.......#....#... +.#........#..#..#.#.......##... +................#.............. +#.................#...........# +##..#...................#....## +#..#....#.....#.#..#.#.#......# +#................#.#.#...#..... +.............#..#...#..##...#.# +#..................#........... +..............#..#.....##.....# +..#...............#.#.......... +.....#......#....#..#...#...... +.#......#...##.....###.....#... +...##...##.##....#.#.#..#...... +....#.#.......#..##....#.##.... +...#.........#.#.....#...#...## +.##.#.........##..#.##..#...... +.#...#......#......#.........#. +.............#................. +..........#..............#..... +##...........#...#...###....#.. +....#...............#.......... +.......####.....#......#....... +........#..........#..#........ +..#.......#..#................. +......#.#..##...##....#........ +.##...#........#...#....#...#.. +.......................#....... +.........##..#..#...#....##...# +..#..#...#.....#.........#..#.. +.......#....#.........#...#..#. +.............#................. +.....##..#.....###....##.#..... +....#.#..#..#.#.....##....#..#. +......#..#..............#.##..# +..#..#......#.#.........#..#... +..........#.#..#....#.....#.... +.....................#......... +...#.....#.......##..#.#....... +.....#...#..........###....#.#. +......#.....##............#...# +.......#..........#.#..#...#..# +#...#..#...........#..##..#.... +.#......#.......##.....#..#.... +...#..#....#.......##......#... +........#.......##...#.......#. +.....#........#................ +......#........#....#.......... +...#....#....###.........#.#... +##..............#......#..#.#.. +.........##....#........#..#.#. +.......#.##.#........#........# +.....###..#..#...........#....# +.......#....##.......#.#...#... +#..............#.#....#..#...#. +#..#....#..#.#............#..#. +.#...##.#..................#... +...#...............##.........# +###..............#.#..#.#.#.... +.#......#.#.....##.......#..... +...#.................#.#....... +.#...#....#...#..#......#...#.. +...##....#........#.#.#..#..... +..#.....#........#....#.#...... +...........#.#...#............. +......#.....#.....#.........#.. +.#.##.###...#.##.......#....... +.............#....#.......#.... +..............#...........#.... +.............#..#.#.....#....#. +.......#........##...##..##.... +..##...#............#..#......# +.............#...##.....#...... +.#...##..##.#.........#.##...#. \ No newline at end of file diff --git a/2020/3/prog.py b/2020/3/prog.py new file mode 100644 index 0000000..06d7d3c --- /dev/null +++ b/2020/3/prog.py @@ -0,0 +1,69 @@ +def get_file_input(filename: str): + ret = [] + with open(filename, "r") as f: + for line in f.readlines(): + ret.append(line.strip()) + return ret + +def main(use_sample_input = True, part = 1): + sample = [ + "..##.......", + "#...#...#..", + ".#....#..#.", + "..#.#...#.#", + ".#...##..#.", + "..#.##.....", + ".#.#.#....#", + ".#........#", + "#.##...#...", + "#...##....#", + ".#..#...#.#" + ] + + s = sample if use_sample_input else get_file_input("input") + + if part == 1: + expected_result = 7 + res = get_result(s, 3, 1) + else: + expected_result = 336 + slopes = { + (1, 1), + (3, 1), + (5, 1), + (7, 1), + (1, 2) + } + + tmp = [] + for slope in slopes: + tmp.append(get_result(s, *slope)) + + res = mult_all(*tmp) + + if use_sample_input: + return f"{res} {res==expected_result}".upper() + else: + return res + +def mult_all(*ns: int): + ret = 1 + for n in ns: + ret *= n + return ret + +def get_result(l: list, inc_x: int, inc_y: int): + ret = 0 + x = 0 + y = 0 + while y < len(l): + if l[y][x] == "#": + ret += 1 + x += inc_x + x %= len(l[0]) + y += inc_y + return ret + +print(main(use_sample_input = False, part = 2)) + + diff --git a/2020/4/__pycache__/prog.cpython-38.pyc b/2020/4/__pycache__/prog.cpython-38.pyc new file mode 100644 index 0000000..73acc3c Binary files /dev/null and b/2020/4/__pycache__/prog.cpython-38.pyc differ diff --git a/2020/4/input b/2020/4/input new file mode 100644 index 0000000..e8f9469 --- /dev/null +++ b/2020/4/input @@ -0,0 +1,1138 @@ +byr:1971 +eyr:2039 +hgt:172in pid:170cm hcl:17106b iyr:2012 ecl:gry +cid:339 + +hgt:161cm eyr:2027 +ecl:grn iyr:2011 hcl:#a97842 byr:1977 pid:910468396 + +cid:257 +ecl:gry hgt:186cm iyr:2012 +byr:1941 +eyr:2029 +pid:108935675 +hcl:#cfa07d + +hgt:165in +hcl:#cfa07d eyr:2035 pid:82570731 +byr:1973 +cid:74 ecl:xry + +eyr:2020 cid:105 iyr:2012 pid:947726115 +hcl:#ceb3a1 ecl:grn byr:1966 hgt:151cm + +hcl:#888785 eyr:2027 ecl:hzl byr:1966 +pid:853607760 +iyr:2012 +hgt:155cm + +hgt:61cm +iyr:2019 +byr:1952 pid:#1468e6 eyr:2033 ecl:#7d39d5 hcl:z + +pid:2306523501 +eyr:2032 hcl:z ecl:brn +cid:266 hgt:151in iyr:2024 +byr:2008 + +hcl:#a97842 hgt:191cm eyr:2025 ecl:gry byr:1923 pid:574171850 iyr:2019 + +hgt:140 +iyr:1987 byr:2003 +eyr:2013 cid:242 hcl:z +ecl:#19177c pid:150cm + +byr:1959 +hgt:169cm hcl:#7d3b0c ecl:gry eyr:2028 cid:107 pid:584790749 + +byr:1955 +cid:309 +hcl:#a97842 +pid:740105085 iyr:2020 +hgt:188cm ecl:oth eyr:2029 + +iyr:2016 hcl:#cfa07d eyr:2026 +hgt:151cm +pid:394185014 ecl:grn byr:1974 + +pid:226566060 ecl:blu cid:272 hgt:188cm hcl:#efcc98 +eyr:2029 iyr:2014 +byr:1956 + +pid:#7c7a9d ecl:#8fa327 +eyr:2006 iyr:2022 +hcl:#7d3b0c hgt:169 +byr:2025 + +hgt:188in byr:2015 ecl:xry +iyr:1975 +eyr:1928 +pid:8939875193 hcl:7bbcce + +hgt:193cm +eyr:2029 +pid:141707808 byr:1997 +cid:83 iyr:2019 +ecl:hzl hcl:#cfa07d + +iyr:2019 +pid:681586971 +hcl:#6b5442 hgt:165cm +eyr:2022 ecl:brn byr:1985 + +byr:1970 +iyr:2016 hgt:156in pid:#e32394 eyr:2024 +hcl:#efcc98 ecl:grt + +iyr:2013 +ecl:grn pid:341584587 eyr:2027 hgt:185cm hcl:#18171d +byr:1935 +cid:113 + +hcl:#fffffd ecl:grn iyr:2010 +pid:738986504 hgt:98 eyr:2024 +byr:1968 + +pid:175337478 ecl:oth hgt:173cm hcl:#733820 +eyr:2025 byr:1960 +cid:283 iyr:2018 + +byr:1959 +hcl:#341e13 eyr:2023 +pid:566612260 hgt:176cm +iyr:2017 ecl:grn + +cid:321 pid:355095309 byr:1945 +hgt:161cm +eyr:2029 iyr:2017 +ecl:brn hcl:#733820 + +hcl:#c0946f pid:75316487 iyr:2013 cid:201 hgt:152cm ecl:lzr byr:1996 eyr:1928 + +hgt:160cm iyr:2010 hcl:#a018b9 +eyr:2024 ecl:amb +cid:347 + +eyr:2021 +pid:893047101 iyr:2016 ecl:hzl hcl:#866857 byr:1988 +hgt:166cm + +hcl:#7d3b0c +ecl:blu pid:085336099 eyr:2024 +iyr:2019 hgt:178cm byr:1999 + +ecl:grt iyr:2022 +hcl:z +hgt:192cm byr:2010 + +pid:677187953 eyr:2025 iyr:2020 hgt:163cm byr:1957 ecl:grn hcl:#cfa07d + +cid:213 +byr:1987 +pid:113078018 ecl:blu iyr:2013 eyr:2022 +hcl:#7d3b0c hgt:157cm + +ecl:blu hcl:#c0946f hgt:186cm +byr:1992 eyr:2028 iyr:2010 + +pid:#b01156 hgt:67 +byr:2014 ecl:#35dca0 eyr:1922 hcl:790130 + +hcl:#602927 +ecl:blu hgt:173cm byr:1974 pid:116377061 cid:294 eyr:2030 iyr:2010 + +hgt:151cm eyr:2022 iyr:2011 ecl:blu byr:1987 hcl:#733820 +pid:#b90d2e + +cid:188 +byr:1990 +hcl:#602927 iyr:2026 +pid:530373696 +hgt:154cm ecl:gry +eyr:2029 + +hgt:178cm eyr:2027 +hcl:#733820 +ecl:grn iyr:2014 pid:575371227 byr:1965 + +hcl:#fffffd iyr:2020 +hgt:185cm ecl:amb pid:692760311 +byr:1961 + +byr:1967 pid:397518948 ecl:lzr iyr:2015 hcl:#cfa07d cid:328 +hgt:177cm eyr:2035 + +hcl:#8e1608 +pid:554618249 iyr:2010 hgt:176cm cid:220 +ecl:brn byr:1928 eyr:2029 + +eyr:2030 +ecl:oth cid:177 hcl:#602927 +iyr:2010 hgt:66in +pid:915661465 byr:1992 + +ecl:brn pid:558826437 hgt:151cm byr:1936 hcl:#fffffd +eyr:2021 iyr:2012 + +eyr:2033 +iyr:2019 hgt:190cm byr:1953 +hcl:#6b5442 +pid:584941735 ecl:hzl + +hgt:71cm +byr:2015 iyr:2025 +ecl:#663b65 eyr:2039 hcl:z pid:62548949 + +ecl:hzl byr:1943 +iyr:2020 hgt:175cm pid:830628564 hcl:#7d3b0c eyr:2021 + +hgt:182cm byr:1951 cid:175 eyr:2021 pid:635966127 ecl:blu iyr:2014 hcl:#18171d + +hcl:#733820 iyr:2011 pid:581100835 eyr:2022 ecl:grn byr:1985 hgt:192cm + +iyr:2013 +ecl:grn +hgt:185cm hcl:#a97842 byr:1981 eyr:2029 pid:711625030 + +byr:1995 +pid:326992839 +iyr:2015 +eyr:2028 hcl:#733820 ecl:hzl + +hgt:160 +eyr:2037 ecl:#6b6b83 +cid:123 iyr:2028 +pid:7692333345 +hcl:z byr:2029 + +hcl:#6b5442 iyr:2030 +hgt:165cm byr:2028 ecl:#21516d +eyr:2039 +pid:182cm + +hgt:159cm iyr:2018 pid:610521467 eyr:2028 ecl:amb byr:1934 hcl:#602927 + +ecl:blu +hcl:#09d9a5 hgt:162cm iyr:2020 +eyr:2025 byr:1971 pid:406714780 + +hgt:179cm eyr:2022 hcl:#18171d +ecl:blu pid:314891131 iyr:2015 +byr:2002 + +hcl:#623a2f hgt:181cm pid:442693333 byr:1990 ecl:grn eyr:2027 +iyr:2011 + +iyr:2022 eyr:1939 +pid:557187110 hcl:#18171d hgt:60cm ecl:#d6ac04 byr:1984 + +ecl:grn byr:1948 hgt:174cm pid:438876745 cid:321 +iyr:2018 +hcl:#866857 eyr:2023 + +hgt:189cm iyr:2012 hcl:#602927 pid:978388052 ecl:brn +eyr:2030 + +ecl:amb cid:235 +byr:1938 +pid:315825546 hcl:#ceb3a1 eyr:2029 +iyr:2013 hgt:171cm + +ecl:dne hcl:z +hgt:76cm byr:2010 +cid:185 eyr:2001 + +hcl:#733820 byr:1988 pid:558453117 +hgt:66in +ecl:oth iyr:2010 eyr:2021 + +byr:1926 pid:796557821 cid:155 hcl:#efcc98 +hgt:159cm eyr:2023 ecl:oth iyr:2016 + +byr:2023 eyr:2031 hcl:0ba99a pid:14902250 +hgt:132 ecl:#9b89b1 iyr:2017 + +hcl:#a97842 byr:1926 +cid:205 +ecl:blu +iyr:2016 hgt:159cm eyr:2029 + +byr:1939 hcl:#866857 +pid:025607627 hgt:174cm cid:309 eyr:2026 ecl:brn + +ecl:hzl pid:805133506 +iyr:2014 +byr:1991 +hcl:#cfa07d +cid:350 +hgt:190cm + +hgt:155cm byr:1941 eyr:2024 +cid:164 hcl:#602927 iyr:2013 pid:531781358 ecl:amb + +hcl:#72a068 hgt:164cm +pid:621006770 +ecl:brn +eyr:2029 byr:1969 + +byr:1991 +ecl:grn iyr:2020 +pid:9921729009 eyr:2029 hcl:#623a2f +hgt:62in + +iyr:2017 ecl:hzl +pid:768217275 eyr:2020 byr:1937 +hcl:#866857 hgt:157cm + +cid:270 byr:1993 hcl:#733820 ecl:hzl pid:722650020 +hgt:174cm iyr:2010 +eyr:2021 + +hcl:#c0946f ecl:blu +hgt:154cm +eyr:2022 byr:1929 pid:357023679 iyr:2010 + +ecl:hzl +iyr:2013 hgt:165cm byr:1979 eyr:2023 hcl:#733820 pid:008734536 + +hcl:#341e13 +eyr:2030 byr:1993 +iyr:2014 hgt:193cm +cid:346 +ecl:blu pid:536339538 + +eyr:2030 +ecl:hzl +cid:296 pid:660062554 hcl:#efcc98 +byr:1977 hgt:179cm +iyr:2010 + +cid:119 pid:498520651 hgt:159cm +eyr:2029 iyr:2015 hcl:#18171d +ecl:gmt +byr:1950 + +eyr:2025 iyr:2010 hcl:#efcc98 pid:196372989 hgt:181cm byr:1952 ecl:oth + +cid:317 +eyr:2026 ecl:blu hcl:#733820 +hgt:184cm +pid:549730813 byr:1927 iyr:2018 + +pid:591769824 +hgt:180cm +byr:1920 +ecl:blu +eyr:2021 hcl:#cfa07d iyr:2017 + +pid:988946348 hgt:183cm cid:117 byr:1955 ecl:blu +iyr:2015 hcl:#623a2f eyr:2029 + +iyr:2014 +eyr:2026 hgt:184cm +ecl:oth +hcl:#7d3b0c pid:252101860 + +byr:1995 +hgt:182cm ecl:brn hcl:#6b5442 +iyr:2012 eyr:2028 pid:482757872 + +iyr:2017 cid:333 ecl:gry hcl:#623a2f hgt:157cm eyr:2021 +pid:487895819 +byr:1951 + +hcl:#fffffd +hgt:193cm eyr:2025 byr:1927 iyr:2014 ecl:oth pid:989206297 + +eyr:2030 ecl:brn hcl:#18171d hgt:193cm +iyr:2013 byr:1953 pid:862636088 + +hcl:#fffffd +pid:204286737 ecl:gry byr:1923 +hgt:181cm +iyr:2015 +eyr:2023 + +cid:288 pid:413935643 ecl:gry +iyr:2012 +hgt:171cm +hcl:#623a2f +eyr:2020 byr:1943 + +byr:2023 hcl:#c0946f +ecl:oth +pid:182634296 eyr:2009 +cid:306 hgt:183cm +iyr:2029 + +eyr:2026 ecl:hzl byr:2003 +iyr:2027 pid:734296691 hgt:188cm hcl:#fffffd + +hcl:#18171d ecl:gry pid:401957684 eyr:2020 +iyr:2017 cid:141 byr:1944 hgt:74in + +ecl:grn hcl:z +pid:335097003 byr:1925 +hgt:170in iyr:2020 eyr:2022 + +pid:727198487 +hgt:173cm +cid:323 hcl:#18171d iyr:2012 eyr:2024 +byr:1995 ecl:blu + +ecl:amb hcl:#602927 +pid:460274414 +hgt:76in byr:1995 +iyr:2020 +eyr:2028 + +byr:2002 ecl:oth pid:101164770 +hgt:172cm hcl:#fffffd eyr:2023 iyr:2016 + +ecl:blu hcl:#888785 iyr:2016 pid:031162631 eyr:2025 hgt:186cm +byr:1959 + +ecl:blu pid:093242619 hgt:188cm byr:1970 +eyr:2025 +hcl:#6b5442 +iyr:2020 + +byr:1990 eyr:2025 ecl:grn +pid:907309460 +iyr:2011 hcl:#602927 hgt:62in + +pid:346468647 eyr:2021 +ecl:oth hgt:169cm +iyr:2010 cid:233 +hcl:#b6652a byr:1977 + +pid:904834317 iyr:2011 +hcl:#b6652a eyr:2028 cid:281 +byr:1944 hgt:187cm ecl:gry + +eyr:1988 pid:663941602 +hgt:156in +hcl:#fa2e93 iyr:2015 ecl:gry byr:1953 + +hgt:184cm cid:107 pid:094829817 +ecl:gry byr:1998 eyr:2023 iyr:2017 + +eyr:2020 ecl:gry byr:1955 hcl:#a97842 pid:553841536 + +hgt:185cm eyr:2022 hcl:#341e13 ecl:oth byr:1934 pid:863541754 cid:178 +iyr:2016 + +eyr:2029 iyr:2014 byr:1937 cid:232 hgt:177cm hcl:#fffffd ecl:blu +pid:076753558 + +hcl:#cfa07d +hgt:168cm +ecl:grn +pid:664159349 eyr:2028 iyr:2017 byr:1972 + +hcl:#a97842 +byr:1987 +eyr:2020 hgt:182cm +iyr:2018 +ecl:brn pid:560272731 + +hgt:172cm cid:125 ecl:blu pid:291640184 +byr:1926 +iyr:2014 hcl:#ceb3a1 + +iyr:2027 hgt:84 hcl:z +ecl:#b68fec +pid:809408661 +byr:2018 eyr:1927 cid:87 + +pid:951007276 cid:260 eyr:2025 +ecl:brn iyr:2015 byr:1957 +hcl:#4b8216 hgt:161cm + +pid:359973697 hcl:#6b5442 +eyr:2022 hgt:169cm +byr:1965 ecl:brn iyr:2013 + +iyr:2012 hgt:65in eyr:2024 pid:842371195 +ecl:amb +hcl:#341e13 byr:2000 + +ecl:hzl hgt:170cm byr:1950 +cid:289 eyr:2037 iyr:2021 hcl:#18171d pid:389051819 + +hgt:159cm +ecl:amb hcl:#c0946f eyr:2020 pid:010539976 iyr:2011 byr:1921 + +hgt:176cm cid:270 pid:838338992 +eyr:2024 hcl:#866857 +ecl:amb iyr:2015 byr:1982 + +ecl:blu +cid:246 hgt:185cm +byr:1987 +hcl:#fffffd pid:042361456 eyr:2022 +iyr:2010 + +hgt:164cm +pid:881486702 ecl:brn byr:1969 hcl:#c0946f +iyr:2010 eyr:2030 + +iyr:2019 hcl:#6b5442 hgt:167cm +ecl:amb +cid:207 byr:1922 +eyr:2025 pid:343956182 + +ecl:oth iyr:2012 +hgt:158cm +eyr:2024 hcl:#602927 byr:1964 + +byr:1988 pid:030965463 hgt:154cm +ecl:gry eyr:2020 cid:227 +iyr:2012 +hcl:#3edc53 + +hgt:178cm hcl:#c0946f byr:1945 ecl:amb eyr:2030 + +hgt:158cm pid:270264980 eyr:2027 iyr:2016 byr:1928 cid:259 +ecl:gry hcl:#733820 + +byr:2026 hgt:164in cid:235 ecl:xry +hcl:z pid:2517730699 +eyr:2033 iyr:2024 + +ecl:grn hgt:69cm pid:1321222581 byr:1987 +eyr:2035 +iyr:2018 hcl:#fffffd + +hcl:#733820 cid:244 +ecl:gry iyr:2013 eyr:2028 +pid:794178180 hgt:74in byr:1923 + +hcl:#a97842 byr:1934 ecl:hzl eyr:2027 +pid:401882857 +iyr:2018 hgt:185cm + +iyr:2018 +pid:665564950 byr:1990 ecl:hzl +hgt:154cm +eyr:2026 hcl:#623a2f + +hcl:#602927 cid:189 byr:1967 pid:332861702 eyr:2021 +hgt:163cm +ecl:amb + +ecl:grn pid:734161280 hgt:184cm +iyr:2018 eyr:2020 byr:1929 hcl:#a97842 + +iyr:2018 byr:1925 +eyr:2022 hgt:193cm ecl:hzl +hcl:#341e13 +pid:008582320 + +byr:2025 ecl:dne hgt:167cm pid:48963526 +iyr:2025 hcl:z +eyr:2034 + +hcl:#cfa07d ecl:hzl eyr:2029 cid:194 byr:1936 +iyr:2020 +hgt:186cm +pid:328573727 + +iyr:2011 hgt:188cm pid:338435675 cid:326 ecl:gry +eyr:2027 +hcl:#6b5442 +byr:1958 + +pid:165cm +hgt:70 iyr:1996 +eyr:2034 cid:210 hcl:z ecl:#75606f byr:2027 + +hgt:180in hcl:#a0515a pid:#97a753 +byr:2026 iyr:2016 +eyr:1995 + +eyr:2020 +hcl:#18171d byr:1978 iyr:2012 hgt:68in +ecl:amb cid:346 pid:332495922 + +ecl:blu hgt:61in pid:747650669 +byr:1961 eyr:2028 +iyr:2020 +hcl:#4992f2 + +byr:1958 iyr:2017 ecl:oth +hgt:153cm +hcl:#602927 eyr:2023 pid:108391213 + +byr:1976 eyr:2023 iyr:2015 hgt:177cm pid:391628371 hcl:#8069c4 +ecl:grn + +pid:910402636 ecl:gry hgt:188cm byr:1924 hcl:#82dfdc eyr:2029 + +byr:1978 pid:302223240 iyr:2017 +hgt:174cm +hcl:#6b6569 ecl:blu eyr:2027 + +cid:135 +byr:1995 iyr:2015 ecl:oth pid:054611703 +eyr:2023 +hcl:#7d3b0c hgt:75in + +ecl:grn +eyr:2020 hgt:184cm pid:444944678 iyr:2019 hcl:#efcc98 + +byr:1946 +hgt:70in eyr:2022 hcl:#6b5442 ecl:amb iyr:2018 pid:859762925 + +byr:1995 eyr:2022 +ecl:grn pid:575081777 +hcl:#341e13 +hgt:183in iyr:2018 + +eyr:2028 hgt:162cm byr:1989 hcl:#0bd11f +iyr:2020 ecl:gry +pid:073498924 + +iyr:2014 +pid:122787281 byr:1982 cid:138 eyr:2021 hcl:#866857 ecl:hzl hgt:184cm + +cid:198 byr:2014 +pid:5529128129 +hgt:185in +iyr:2025 +hcl:z +eyr:2023 +ecl:gmt + +eyr:2021 hgt:170cm +cid:74 +iyr:2019 pid:943445928 byr:1980 +ecl:oth hcl:#ceb3a1 + +iyr:2020 eyr:2030 pid:201122734 cid:246 hgt:169cm ecl:grn hcl:#fffffd byr:1962 + +pid:025560194 +byr:1989 +hcl:#cfa07d hgt:182cm ecl:blu eyr:2025 iyr:2012 + +hgt:151cm +hcl:#efcc98 ecl:blu +byr:1983 eyr:2023 pid:814513328 iyr:2013 cid:73 + +byr:1961 pid:536384108 hgt:188cm ecl:amb iyr:2013 eyr:2027 hcl:#888785 cid:121 + +pid:364607819 +eyr:2024 ecl:amb hcl:#b6652a iyr:2016 +byr:2000 hgt:187cm + +hcl:z eyr:1956 iyr:2028 +hgt:168cm cid:105 +byr:2026 +ecl:#5b17d3 + +cid:207 pid:913509058 ecl:brn byr:2001 eyr:2026 +hcl:#866857 iyr:2019 +hgt:180cm + +pid:363979129 +eyr:2027 iyr:2013 +ecl:gry hcl:#866857 byr:1957 hgt:62in + +byr:1932 +eyr:2027 +hgt:66in ecl:hzl hcl:#efcc98 pid:417620217 iyr:2013 + +iyr:2013 cid:331 hgt:192cm +hcl:#d896d9 pid:795744816 byr:1935 + +byr:1960 hcl:#888785 hgt:176cm ecl:hzl pid:025206542 +iyr:2015 eyr:2030 + +ecl:oth hgt:182cm +hcl:#341e13 +pid:526568190 iyr:2018 cid:280 byr:1997 +eyr:2028 + +hgt:186cm pid:273625601 byr:1993 iyr:2018 eyr:2021 hcl:#733820 +ecl:blu + +hgt:74cm +byr:1981 eyr:2024 +ecl:amb iyr:2012 pid:154027492 hcl:#733820 + +hcl:#a97842 pid:347084450 ecl:oth +eyr:2030 hgt:176cm byr:1955 cid:229 +iyr:2013 + +hcl:#fffffd byr:1979 iyr:2017 +pid:183840860 hgt:177cm ecl:blu eyr:2023 + +pid:045246162 eyr:2021 byr:1928 hgt:190cm ecl:gry hcl:#602927 + +pid:273620987 +eyr:2022 hgt:162cm +cid:269 +byr:1991 hcl:#602927 ecl:amb iyr:2019 + +pid:621069556 ecl:amb +cid:202 byr:2020 hgt:189cm +iyr:2014 hcl:#fffffd +eyr:2027 + +eyr:2022 byr:1988 +hgt:190cm +pid:349839553 hcl:#602927 iyr:2018 ecl:gry + +iyr:2014 ecl:gry +hcl:#733820 eyr:2025 hgt:179cm pid:231854667 byr:1984 +cid:102 + +eyr:2020 +pid:509400891 hcl:#cfa07d hgt:172cm +ecl:grn byr:1997 iyr:2020 + +iyr:2017 byr:1994 hgt:174cm ecl:amb +pid:685743124 +hcl:#fffffd eyr:2029 + +iyr:2012 hgt:177cm byr:1999 pid:549190825 hcl:#b6652a eyr:2028 ecl:oth cid:316 + +hgt:192cm ecl:grn byr:1924 +iyr:2011 eyr:2029 hcl:#efcc98 +pid:215962187 + +iyr:2011 hcl:#866857 +cid:164 +hgt:184cm +ecl:gry eyr:2023 byr:1959 pid:204093118 + +hgt:172cm ecl:hzl hcl:#3f2f3a pid:623470811 byr:1938 iyr:2013 eyr:2022 + +hcl:#b6652a +iyr:2019 hgt:152in +ecl:oth +pid:189008850 byr:2006 + +ecl:oth hcl:#602927 +pid:049746898 byr:1924 hgt:150cm eyr:2026 +iyr:2014 + +ecl:oth +eyr:2028 byr:2018 hcl:#733820 +pid:8676207205 iyr:2018 +hgt:190cm + +eyr:2023 cid:308 hgt:170cm ecl:oth iyr:2014 hcl:#18171d pid:874405208 byr:1936 + +eyr:2021 ecl:hzl +pid:423603306 +hcl:#c0946f cid:147 +byr:1988 iyr:2016 hgt:164cm + +hgt:176cm iyr:2010 +hcl:#6b5442 cid:280 byr:1988 ecl:hzl pid:967151288 eyr:2028 + +cid:299 hgt:163cm ecl:gry +pid:561439154 eyr:2023 +hcl:#cfa07d iyr:2019 byr:1959 + +pid:635547007 +ecl:blu +byr:1996 hcl:#7d3b0c cid:280 eyr:2023 +hgt:170cm iyr:2017 + +hcl:#888785 iyr:2014 +ecl:brn +hgt:190cm byr:1941 eyr:2021 + +hcl:#c0946f cid:199 hgt:162cm ecl:amb pid:130696599 eyr:2022 iyr:2018 byr:1948 + +cid:314 hcl:#a4fc09 ecl:hzl iyr:2019 +pid:886849824 eyr:2026 byr:1933 hgt:178cm + +byr:1996 iyr:2016 eyr:2030 hgt:169cm +pid:119207760 +hcl:#ef542c +ecl:brn + +iyr:2030 eyr:2039 hcl:#c0946f pid:#7336a0 hgt:182cm cid:347 +ecl:#c81361 byr:2003 + +pid:727812879 iyr:2013 eyr:2027 hgt:172cm +hcl:#7d3b0c ecl:gry byr:1966 + +hcl:#341e13 +iyr:2016 pid:744997238 +cid:322 +byr:1973 +ecl:hzl eyr:2028 hgt:190cm + +hgt:171cm eyr:2026 +iyr:2014 ecl:oth +pid:074049558 hcl:#04083f byr:1923 + +pid:973713235 +eyr:2021 +ecl:brn +byr:1922 hcl:#fffffd iyr:2012 +hgt:178cm + +ecl:#10165d +cid:201 eyr:2026 pid:#ceefa8 byr:2020 +hgt:164cm iyr:2011 +hcl:9fccf7 + +ecl:blu +hgt:165cm iyr:2012 eyr:2025 pid:775787557 +byr:1952 hcl:#623a2f + +pid:6186829005 ecl:lzr hcl:z hgt:69in iyr:2021 byr:2018 eyr:1974 + +pid:824641755 eyr:2028 byr:1950 hgt:184cm +hcl:#c0946f +iyr:2014 + +hcl:#7d3b0c cid:84 hgt:187cm iyr:2015 +pid:895876610 +byr:1988 eyr:2023 + +hcl:#fffffd +hgt:157cm iyr:2020 eyr:2030 ecl:grn pid:486236241 + +iyr:2010 +eyr:2029 +hgt:74in ecl:hzl byr:1926 pid:348573885 hcl:#9d1214 + +hgt:171cm ecl:oth +eyr:2022 pid:148728436 byr:1993 hcl:#a97842 iyr:2013 + +iyr:2019 +hgt:151cm +eyr:2020 pid:319882814 ecl:grn byr:1966 cid:256 hcl:#3107b3 + +hgt:184cm ecl:grn +byr:1947 +eyr:2025 iyr:2015 pid:827962962 cid:62 hcl:#f3a364 + +iyr:2013 +hcl:#fffffd pid:215012801 ecl:amb eyr:2024 +hgt:154cm +byr:1973 + +ecl:hzl hgt:152cm +hcl:#623a2f +byr:1944 eyr:2022 pid:295632731 +cid:243 iyr:2019 + +ecl:brn +iyr:2011 pid:089250747 byr:1984 hcl:73e739 cid:253 hgt:161cm eyr:2021 + +hcl:#18171d byr:1944 pid:732054667 eyr:2021 +ecl:oth hgt:173cm + +ecl:gry pid:445116331 +hcl:#a97842 +hgt:187cm eyr:2026 iyr:2020 byr:1992 + +hcl:80c091 pid:745555899 +iyr:2021 +hgt:170cm +byr:1990 + +pid:058987865 byr:1927 cid:209 +hcl:#65ccf6 eyr:2025 +ecl:brn iyr:2012 hgt:164cm + +hgt:67cm +byr:2026 hcl:f8e749 iyr:2023 eyr:1921 ecl:lzr + +eyr:2028 iyr:2013 pid:103268377 hgt:179cm byr:1922 +ecl:hzl +hcl:#7d3b0c + +byr:1923 ecl:gry hgt:167cm hcl:#7fc8ee iyr:2015 pid:427963077 eyr:2024 + +byr:1927 ecl:grn pid:741328150 +eyr:2029 hcl:#733820 +iyr:2015 hgt:157cm + +hgt:70cm hcl:e76970 iyr:1945 cid:186 +byr:1921 eyr:2029 +pid:823622634 +ecl:zzz + +hgt:61cm cid:87 hcl:d5e5ff +eyr:2024 ecl:dne pid:182634269 +iyr:2029 + +hcl:#623a2f eyr:2020 byr:1936 ecl:gry pid:236984204 +iyr:2011 hgt:156cm + +pid:872645776 +byr:2023 +cid:220 ecl:blu hgt:172cm eyr:2033 +iyr:2010 hcl:ff82f9 + +pid:774489073 iyr:2013 byr:1922 ecl:brn eyr:2025 hcl:#18171d hgt:163cm + +eyr:2024 hgt:65in byr:1962 iyr:2019 +pid:112233558 hcl:#888785 ecl:grn + +hgt:172cm eyr:2022 +hcl:#18171d ecl:blu +pid:609008608 iyr:2013 +cid:244 byr:1980 + +cid:124 hgt:175in eyr:2025 +hcl:674e80 pid:099875931 iyr:1956 + +byr:1926 hgt:188cm +ecl:hzl eyr:2021 +iyr:2018 +hcl:#866857 pid:557800355 + +byr:1939 pid:200409089 +eyr:2026 hgt:164cm +ecl:grn iyr:2013 +hcl:#733820 + +cid:73 hgt:169cm iyr:2016 byr:1976 ecl:gry eyr:2024 +pid:043453462 + +pid:609818712 hcl:#733820 byr:1958 +eyr:2025 hgt:187cm iyr:2017 ecl:gry + +hgt:66in pid:618590610 iyr:2013 byr:1938 hcl:#d1bda9 +eyr:2022 +ecl:grn cid:69 + +hgt:156cm pid:755742405 +byr:1929 hcl:#6b5442 eyr:2024 +iyr:2018 +ecl:gry +cid:105 + +eyr:2030 pid:77022842 +hgt:160cm byr:1989 +iyr:2011 hcl:#7d3b0c ecl:blu + +iyr:2015 +hcl:#341e13 byr:1968 pid:434159843 +ecl:amb hgt:150cm +eyr:2030 + +hcl:z eyr:1993 pid:#b3a5a6 iyr:1947 hgt:176in +ecl:#78876d + +cid:249 hcl:#cfa07d +hgt:180cm ecl:gry eyr:2026 byr:1965 +pid:048327438 iyr:2010 + +pid:136468890 ecl:gry +byr:1940 +hcl:#fffffd hgt:185cm iyr:2016 eyr:2021 + +hcl:#b6652a hgt:180in byr:1976 eyr:2022 pid:156cm ecl:#737836 +iyr:2013 + +ecl:amb iyr:2016 hgt:162cm byr:1955 pid:193cm eyr:2028 cid:346 +hcl:#733820 + +iyr:2010 byr:1932 eyr:2025 ecl:grn +pid:595837820 +hcl:#341e13 +hgt:166cm cid:224 + +pid:481646831 +eyr:2029 +hcl:#623a2f cid:319 iyr:2016 +ecl:brn hgt:160cm byr:1944 + +ecl:zzz pid:428329840 cid:238 iyr:2022 hgt:76cm +hcl:#a97842 +byr:2024 eyr:2028 + +iyr:2014 hgt:170cm +byr:1963 hcl:#623a2f +eyr:2026 pid:225910806 ecl:gry + +ecl:grn iyr:2010 hgt:193cm byr:1928 eyr:2028 pid:343022641 hcl:#733820 + +eyr:2023 ecl:grn +byr:1950 iyr:2012 hcl:#866857 pid:400725165 +hgt:193cm + +cid:195 iyr:2014 ecl:oth eyr:2027 byr:1966 +hgt:177cm hcl:#18171d pid:913894485 + +iyr:2015 hgt:154cm +cid:206 +pid:134599284 hcl:#602927 +eyr:2023 ecl:brn +byr:1983 + +ecl:#2d0e7a pid:#f34625 eyr:1942 iyr:2027 byr:2013 hcl:z hgt:162cm + +hgt:189cm byr:1965 iyr:2011 +cid:178 ecl:hzl +hcl:#b6652a eyr:2026 pid:683560227 + +eyr:2030 pid:047446524 ecl:grn hgt:167cm iyr:2017 hcl:#602927 +byr:1920 + +cid:86 +iyr:1920 hgt:193cm +eyr:2027 pid:401913877 ecl:hzl +hcl:#888785 byr:1953 + +byr:1991 +ecl:grn +iyr:2016 +hcl:#5e1ef2 hgt:186cm +pid:076499738 +eyr:2025 + +eyr:2030 hcl:#18171d pid:750694893 +hgt:157cm iyr:2020 cid:338 +byr:1956 ecl:gry + +iyr:2027 pid:#37f002 hgt:164cm ecl:#80df11 +hcl:#aeacee cid:320 +eyr:2039 byr:1956 + +iyr:2014 hcl:#733820 ecl:grn +byr:1960 +eyr:2025 pid:667089568 + +hgt:163cm +byr:1962 cid:108 ecl:gry hcl:#733820 iyr:2012 +eyr:2029 pid:763684725 + +byr:1984 hcl:#888785 hgt:159cm iyr:2012 ecl:gry +eyr:2024 cid:236 pid:174711749 + +ecl:gry pid:044931271 +hcl:#b6652a eyr:2029 iyr:2013 byr:1985 + +byr:1973 iyr:2018 hcl:#a97842 pid:937214113 ecl:blu +cid:247 hgt:186cm eyr:2023 + +cid:108 pid:231782961 iyr:2017 +eyr:2034 hgt:170cm byr:2025 hcl:#18171d ecl:utc + +pid:298274796 byr:1928 hcl:#a97842 hgt:188cm iyr:2011 ecl:gry eyr:2028 + +hgt:65cm iyr:1943 eyr:2025 +hcl:z +pid:65702335 ecl:#bb54e6 byr:2010 + +pid:499116613 eyr:2024 +ecl:gry hcl:#cfa07d hgt:193cm byr:1999 +cid:278 iyr:2015 + +hcl:#6b5442 eyr:2027 hgt:175cm byr:1988 +ecl:brn pid:410075320 iyr:2010 + +pid:269678991 ecl:oth iyr:2013 +hcl:#602927 byr:1991 eyr:2023 + +ecl:oth +pid:144593265 hcl:#fffffd +eyr:2020 iyr:2018 +byr:1975 hgt:160cm +cid:304 + +iyr:2014 hcl:#ceb3a1 eyr:2029 +byr:1951 pid:520804395 hgt:185cm ecl:oth + +hgt:159cm +pid:312887994 +cid:205 +iyr:2016 ecl:hzl hcl:#866857 eyr:2029 byr:1944 + +iyr:2023 ecl:#54c85c byr:2030 +eyr:1946 cid:190 pid:512417622 + +byr:1946 eyr:2023 hgt:163cm +hcl:#2d4e9c ecl:brn pid:839043333 iyr:2014 + +iyr:2027 cid:122 hgt:187cm eyr:1975 ecl:grn byr:1920 +hcl:#c0946f + +eyr:2029 hgt:189cm ecl:blu byr:1922 iyr:2016 +pid:924104599 +hcl:#b6652a + +hgt:162cm +iyr:2016 byr:1921 hcl:#18171d eyr:1938 ecl:hzl +pid:682222023 + +cid:118 pid:959515596 +byr:1921 iyr:2010 eyr:2029 hcl:#7d3b0c ecl:oth hgt:158cm + +ecl:#8ac844 pid:162cm +hcl:8f4d80 hgt:150in byr:2005 +eyr:2008 +iyr:2017 cid:174 + +hcl:z byr:1936 +pid:255481052 eyr:2021 +iyr:2012 hgt:170cm cid:276 ecl:hzl + +iyr:2013 byr:1935 hgt:179cm +eyr:2023 ecl:amb pid:073621563 hcl:#623a2f + +hcl:#18171d cid:230 byr:1989 ecl:oth eyr:2021 hgt:181cm pid:661224730 +iyr:2019 + +pid:748039140 iyr:2020 eyr:2020 ecl:#6ebbc2 hcl:#fffffd hgt:171cm +byr:1995 + +ecl:hzl pid:758144605 hcl:#ceb3a1 hgt:186cm +eyr:2028 iyr:2014 +byr:1928 + +ecl:hzl +hgt:66in +byr:2000 iyr:2017 eyr:2020 +pid:162973694 hcl:#a97842 + +iyr:2012 pid:749770535 +byr:1969 cid:148 +hcl:#733820 +hgt:180cm eyr:2021 ecl:hzl + +iyr:2010 +byr:1958 +hgt:164cm +ecl:blu hcl:#733820 pid:890634327 eyr:2024 + +hgt:70in pid:218397894 +iyr:2020 eyr:2025 ecl:gry hcl:#341e13 +byr:1970 + +eyr:2020 pid:854208004 hgt:157cm hcl:#7d3b0c ecl:amb byr:1981 iyr:2020 + +byr:1924 +cid:321 eyr:2028 hcl:#cfa07d iyr:2010 ecl:amb pid:036669613 hgt:170cm + +ecl:#6649d4 pid:0026989865 cid:188 +hgt:152in +byr:1950 hcl:z eyr:1928 iyr:1963 + +hcl:#ceb3a1 ecl:grn eyr:2028 pid:074363489 iyr:2010 hgt:173cm byr:1966 + +eyr:2030 +pid:9731612333 ecl:#f8824c +iyr:2022 hgt:161in +byr:2023 +cid:316 +hcl:z + +hgt:175cm iyr:2016 eyr:2024 cid:244 +byr:1952 +pid:085432899 +hcl:#fffffd ecl:brn + +ecl:brn eyr:2026 iyr:2017 hgt:75in +pid:745302991 byr:1969 hcl:#7394c7 \ No newline at end of file diff --git a/2020/4/prog.py b/2020/4/prog.py new file mode 100644 index 0000000..03e45cb --- /dev/null +++ b/2020/4/prog.py @@ -0,0 +1,81 @@ +import re + +def extract_passports(passports: list): + ret = [] + kv_re = re.compile(r'(\w+):(#?\w+)') + + for passport in passports: + dic = {} + for key, val in kv_re.findall(passport): + dic[key] = val + ret.append(dic) + + return ret + + +def get_input(sample = False): + with open("sample" if sample else "input", "r") as f: + content = f.read() + passports = content.split("\n\n") + return extract_passports(passports) + +def is_passport_valid_1(passport: dict): + fields = {"byr", "iyr", "eyr", "hgt", "hcl", "ecl", "pid"} + keys = set(passport.keys()) + return keys == fields or keys == fields | {"cid"} + +between = lambda m1, x, m2: int(m1) <= int(x) and int(x) <= int(m2); + +def is_height_valid(height: str): + h_re = re.compile(r'^(\d+)(cm|in)$') + if h_re.match(height) == None: return False + + number, measure = h_re.findall(height)[0] + + return (measure == "cm" and between(150, number, 193)) or (measure == "in" and between(59, number, 76)) + + +def is_passport_valid_2(passport: dict): + is_four_digits = lambda x: re.match(r'^\d{4}$', x) != None + + rules = {"byr": lambda x: is_four_digits(x) and between(1920, x, 2002), + "iyr": lambda x: is_four_digits(x) and between(2010, x, 2020), + "eyr": lambda x: is_four_digits(x) and between(2020, x, 2030), + "hgt": is_height_valid, + "hcl": lambda x: re.match(r'^#[a-f0-9]{6}$', x) != None, + "ecl": lambda x: x in ["amb", "blu", "brn", "gry", "grn", "hzl", "oth"], + "pid": lambda x: re.match(r'^\d{9}$', x) != None, + "cid": lambda x: True} + + # try: + # print(passport["hcl"], rules["hcl"](passport["hcl"])) + # except KeyError as e: + # pass + + for key, val in passport.items(): + if not rules[key](val): + return False + return True + +def get_result(passports: list, part = 1): + ret = 0 + print(f"{len(passports)=}") + for p in passports: + if (part == 1 and is_passport_valid_1(p)) or (part == 2 and is_passport_valid_2(p) and is_passport_valid_1(p)): + ret += 1 + return ret + + +def main(sample = False, part = 1): + inp = get_input(sample = sample) + res = get_result(inp, part = part) + + if sample: + expected = 2 if part == 2 else 0 + print(f"{res=}") + print(res == expected) + else: + print(res) + + +main(sample = False, part = 2) diff --git a/2020/4/sample b/2020/4/sample new file mode 100644 index 0000000..3b38741 --- /dev/null +++ b/2020/4/sample @@ -0,0 +1,13 @@ +ecl:gry pid:860033327 eyr:2020 hcl:#fffffd +byr:1937 iyr:2017 cid:147 hgt:183cm + +iyr:2013 ecl:amb cid:350 eyr:2023 pid:028048884 +hcl:#cfa07d byr:1929 + +hcl:#ae17e1 iyr:2013 +eyr:2024 +ecl:brn pid:760753108 byr:1931 +hgt:179cm + +hcl:#cfa07d eyr:2025 pid:166559648 +iyr:2011 ecl:brn hgt:59in \ No newline at end of file diff --git a/2020/4/test.py b/2020/4/test.py new file mode 100644 index 0000000..f7709d5 --- /dev/null +++ b/2020/4/test.py @@ -0,0 +1,50 @@ +from prog import get_input + +expected = [ + { + 'ecl' : 'gry', + 'pid' : '860033327', + 'eyr' : '2020', + 'hcl' : '#fffffd', + 'byr' : '1937', + 'iyr' : '2017', + 'cid' : '147', + 'hgt' : '183cm', + }, + + { + 'iyr' : '2013', + 'ecl' : 'amb', + 'cid' : '350', + 'eyr' : '2023', + 'pid' : '028048884', + 'hcl' : '#cfa07d', + 'byr' : '1929', + }, + + { + 'hcl' : '#ae17e1', + 'iyr' : '2013', + 'eyr' : '2024', + 'ecl' : 'brn', + 'pid' : '760753108', + 'byr' : '1931', + 'hgt' : '179cm', + }, + + { + 'hcl' : '#cfa07d', + 'eyr' : '2025', + 'pid' : '166559648', + 'iyr' : '2011', + 'ecl' : 'brn', + 'hgt' : '59in', + }, + ] + +out = get_input(sample = True) +for o, e in zip(out, expected): + print(o) + print(e) + +print(out == expected) diff --git a/2020/5/__pycache__/prog.cpython-38.pyc b/2020/5/__pycache__/prog.cpython-38.pyc new file mode 100644 index 0000000..7d69378 Binary files /dev/null and b/2020/5/__pycache__/prog.cpython-38.pyc differ diff --git a/2020/5/__pycache__/test.cpython-38.pyc b/2020/5/__pycache__/test.cpython-38.pyc new file mode 100644 index 0000000..211d061 Binary files /dev/null and b/2020/5/__pycache__/test.cpython-38.pyc differ diff --git a/2020/5/input.prod b/2020/5/input.prod new file mode 100644 index 0000000..f239a37 --- /dev/null +++ b/2020/5/input.prod @@ -0,0 +1,824 @@ +FFFFBFBLLR +BFBFFBBLLR +BBFFFFBLRR +FBFBFFFRLL +BFFBFFFRRR +BFBFBFFRLR +FFFBBBBLRL +BFFFFBFLLL +FFFFBBFLLR +BBFFBFFRRR +FBBFBBFLRL +BFBFFBFLRR +FBFFBFFLLL +FFFBFFFRLR +FFFBFBBLLR +BBFFBFFLRL +FFFFFBBRLR +BFFBFBBLLR +FFBBBBBLRR +FBBFFBBLLR +FFFFFBBLLR +FBBFFFBRLR +FFBFBBFRRR +FBBFFFFLRL +FFBFBBFLLR +BFBBBBFRRL +FFFFBBBLLR +FFBFFFFRLL +FFBBFFBLRL +BBFFFBBRLR +FBBFBBFRLL +FBBBFBFRRR +FBBBBBBRLR +BFBBFBBRRL +FBBBBFFRLR +FBFBFBBLLL +FBBFFFBLRL +BFFBBBFRLL +FFBFFBBLLL +FFFFFFBRLL +BFFBFBFRLR +FBBFBBBRRL +BFBFBFFLLR +BFBFBFBRLL +FBFBBBFLRL +FBFFFBFRLR +FBBBBBBRRL +BFBBFFBLLL +BFFFFFBLRR +BFFBFFFLRL +FBBBFFBLLL +BFBFBFFLRR +BFBFBFFRRL +FBBBFFFLRR +FFBBFFBRLL +BFBFFFFLRR +FFFFBBFRRL +FFFFBBFLRL +BFFBBFBRRR +FBFBBFBRRR +FFBFFBFLLR +BFFFFBBLRL +FBBFBFFLRR +BFFBFBFLLL +BFFBFBFRRR +FBBBFFBRLL +FBFFFBBRRL +BBFFBFFRRL +BBFFBBFLLR +BBFFFBBRLL +FFFBFFBLRL +BBFFFFBRRR +FBFBBFBRLR +BFBBFBFLLR +FFBFFFFRLR +FBBFFFBR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BFLLL +FBBFFBFLLL +BBFFBFFRLL +FBFFFBFLLL diff --git a/2020/5/prog.py b/2020/5/prog.py new file mode 100644 index 0000000..9281a4f --- /dev/null +++ b/2020/5/prog.py @@ -0,0 +1,47 @@ +def get_input(sample = False): + filename = "sample" if sample else "input" + with open(filename + ".prod", "r") as f: + return [line.strip() for line in f.readlines()] + +def char_to_bin(char: str): + if char not in ["F", "B", "L", "R"]: + raise ValueError(f"Character `{char=}` cannot be transformed into binary") + return 0 if char == "F" or char == "L" else 1 + +def seat_to_bin(seat: str): + if len(seat) == 1: + return char_to_bin(seat) + return char_to_bin(seat[0])*2**(len(seat)-1) + seat_to_bin(seat[1:]) + +def seats_to_binary_list(seats: list): + return [seat_to_bin(seat) for seat in seats] + + +def get_result(seats: list, part = 1): + if part == 1: + return max(seats) + else: + candidates = [] + seats.sort() + + prev = seats[0] + for i in range(1, len(seats)): + next = seats[i] + if prev + 2 == next: + candidates.append(prev + 1) + prev = next + return candidates + + + + +def main(sample = False, part = 1): + inp = seats_to_binary_list( + get_input(sample = sample) + ) + return get_result(inp, part=part) + +print(main(part = 2)) + + + diff --git a/2020/5/sample.prod b/2020/5/sample.prod new file mode 100644 index 0000000..b036d3e --- /dev/null +++ b/2020/5/sample.prod @@ -0,0 +1,3 @@ +BFFFBBFRRR +FFFBBBFRRR +BBFFBBFRLL diff --git a/2020/5/test.py b/2020/5/test.py new file mode 100644 index 0000000..1b7615e --- /dev/null +++ b/2020/5/test.py @@ -0,0 +1,26 @@ +from prog import seat_to_bin + +seats = ["FFFF", # 0000 = 0 + "FFFB", # 0001 = 1 + "FFBF", # 0010 = 2 + "FFBB", # 0011 = 3 + "FBFF", # 0100 = 4 + "FBFB", # 0101 = 5 + "FBBF", # 0110 = 6 + "FBBB", # 0111 = 7 + "BFFF", # 1000 = 8 + "BFFB", # 1001 = 10 + "BFBF", # 1010 = 11 + "BFBB", # 1011 = 12 + "BBFF", # 1100 = 13 + "BBFB", # 1101 = 14 + "BBBF", # 1110 = 15 + "BBBB", # 1111 = 16 +] + +expected = list(range(17)) + +for v, e in zip(seats, expected): + actual = seat_to_bin(v) + if actual != e: + print(v, actual, e) diff --git a/2020/6/__pycache__/prog.cpython-38.pyc b/2020/6/__pycache__/prog.cpython-38.pyc new file mode 100644 index 0000000..1b7fef7 Binary files /dev/null and b/2020/6/__pycache__/prog.cpython-38.pyc differ diff --git a/2020/6/input b/2020/6/input new file mode 100644 index 0000000..01433c7 --- /dev/null +++ b/2020/6/input @@ -0,0 +1,2084 @@ +donpevkjhymzl +ezyopckdlnvmj + +tqwfdoxvim +imzpqwruhynlca +wkemdqfvigo + +kztsuvpgoheyfdrqbnxmlw +onzbdgsrqxhetkvypfulwm +eomvusqtbnwghfzdyxplkr +lthqvfxbnrpdoekugmzyws + +tlsgumiveq +suevmtgrix + +jpcvhae +kfwg + +scbmvulizfajxwdkohynr +nrwjblvodackhmteufixz +crjnozhvmxuilfdgwbak +cjxfvaklnrmzhodubiw + +wepjrhznqbsdcg +bgkxwdzjpcnh +bzhngpwdjc + +zcwd +bcsdwi +dzwc +cndjtw +widc + +fxcdeujrgyimhtnbl +rgxubfaswmyetdzcpj + +qcyvwlznk +pixvryeqmabkg +oyhwkvslqtu +syfvqkj + +oxaqtvbck +xdaocgmjbhr + +itmqhlrpfkjex +glipefrhqdjt +lfxujtahqrkiep + +r +r +r +r +r + +zrevcbqlfd +fevqbcrz +bznrqefvc +venbfqczr +ezcfrqvb + +jckiqemdhafpblg +hmgkceqdfablipj +apfhidgbqjmeklc +jbgafikphedlqcmu +jgipbhyrqkcadmtloef + +oc +cwl +c +pqcum + +dyqefuvk +jwpeyutcvrqfknd +ueqfvkdy +mqkedfuvy + +wjmflnycpikaudbh +badpwluhyckmfijn +laicfpmukdjwbyhn +wbunyimlakfhjcdp +pkdayicwhjulfnbm + +lyvucwjsqpobtxfz +juplywzofxqtbc +bjcpotyxfwzquil +gqcpxouftzylwjbk + +o +o +om +o + +cv +cv +dkv +nlqvar + +uympvfa +fpvmauy +upfmyal +mrfxyaup +fpauym + +yefrc +eycrf +jcery + +mikwhc +kwhicm +wckmih +cimhkpw +cwkhim + +jr +nj + +qdn +dpobj +bdhkcirag +lxfszwtvyeum + +evztimrx +wvtesixcjz +xezvnti +itexvzrp + +cdmytuohafwrn +onqrdzbtajhwcy +agvoswrcytkhn +ionpyahrctwl + +nfizudpgjas +zcsfpgiujdan +zuasjgfnipd +pdszgjniauf + +tmznlxi +znilmx +nzmlix + +praqydusmlntzoejbgkficvwh +paxnwvbzejqlgryuhscotfikdm +ydvetlcfiqpnbmorhswazujgk +tczvygrfuqibdelpwkamjhnos + +wtkx +txkw +tkxw +wxkt +kwxt + +xozfqwskiyjdlmerbtgvpu +ztviaxedfwjloryqmupb +zuwqtfbdoirejmxvply +prldimefuqtyvobwjxz + +lnbchfiueqgkvdypxjsrt +gjfsnriecpdhuxqyktblv +evrqsyfgdpnujtcbxilhk +icgrdksboavhfluqyjtxpnme + +fvsdtxqopuyizback +xdptiuasqfzkvhcybe +bktzicvfxwuyhspoad +dybuvfizapxcslrkgt + +sip +y +y +v +o + +binuks +iksubn +unbisk + +ec +ce +ce +ce + +mszqjkigr +zqjsimgr +jgszimrq + +brgqwumhfsjoan +tqjoruxwhm + +bexsrhfowdm +qmrwjfbedxy + +bmjzeradwpcvq +lzbmqdjw +ukfbhtjdqsyomzi +zplwmjqbd + +suacmtzvfwgkberyj +yawctsbmvrzujkeg + +wkvdqfrj +rjstv +irjv + +gjrzwdlaxhnybk +fwcelavjtkq +sjkwyudaiogpl + +cepjqyrxgbtozmvsnwfaldi +ewblsmizdaoxvpqfgjncyr +dmqjczpuflxkvogiwybaesrn +izcvlbrxopjgmfydeawnsq + +krbsuf +ybfusk +ksrubfh +kbuwsf + +cflimnt +fimtcny + +gr +gr +gr +rg + +boksruxtpwhaylfvezinmgq +pghkurfnlsazwxtqemvy +ahwztefxyujgrmknvslqp +lvtrehgwmyszpfkxauqn +uvwytrhqmfaklgxsnpezj + +ojwxbtai +ebjplmknha +gzjab +yrdbja +aqgbjv + +xqbadntilesgj +qafljdgeistxnk +vdhjisgpnlecatx + +bctjy +jzcbtly +yjctb + +hu +x + +hbxnqzvimyjpr +xjvqmhryzib + +xgt +qxgt +lxgt +xgt + +bcrfvtxq +bwodrhgfnj +rfbelmx +xfrpub + +z +z +z +z +z + +wkqnhmyvpgcafs +anuqkgcmpsh + +gakdvbjity +uxqszephnmt + +gsmqkvlw +ygljknwqs +vnwlksgq +kflgqodsw + +esixowgfrdkchbvluyjzmt +zwlbyjexfgrkivthduscom +bejtzkgouvrhwdciylfmsx +vgiwfukltmcxzhdjyrseob +bvuzhwkjfelxmgiosrdyct + +jxcwht +jtwo +jtw + +alugckni + +rdfbt +ertfmjb +urfakt +tfrdv +rjftg + +zgvcnoyk +jrbydop + +yjhzdwgrubc +thdijqcoegmzybwxsfn + +sc +cs +sc +sc + +ixgqhbsoyzektrjvlu +eizybgxusrhqkoljtv +bgsjuteyoivhkzxlrq + +eimgdwa +ubqsylj +pojylrx + +hlekwmnst +khnpvb +lhkgbxo +khoj +uqkfihrz + +tvahpybefouj +htfjeyaov +ovjehatfy + +qcwplbzsxej +evtnljchmoqu +zlecjqdx + +kgswxnvjym +xkbjymvgwnrd +njkompgxyvw +vhzwnfkjxgmiy +gkvmrtqjnxyuoaw + +hif +pcx +eiad + +vnsk +nkvs + +ekvmjptnlg +vgqthpnmzeyu +tvgmnspexj +mvektcnpsdlg +gpirbeamcntkvo + +xzhbpqwomfny +dzneqbmtkarsocugpwy + +e +e + +cgdbaqiwxkhoune +ljzpfsmtvr + +bemtdp +mcbpwetzxksrn +bmpte + +zxegywkmlanphqt +yrqbijeg +ocgyqferd + +thlbysev +tlhsbyve +ysteovhlb +blevshyt +vehyktdlbs + +jvzqgfrmnsyedwkt +wylnmqpsdjferzvg +rmdwjgyfzsqevn +izvrjqmdwnfxegyks + +jrexchzindpmboa +pconhxiezjmdbra +rocpziedxjanmbh +pjzxdrmoienhcab +ioexrmhdbzjcpan + +ubljqsrwgpifknhd +iadsruznklqwpj + +zelwsurf +sewlzu +wluzes + +pkhfwsqdj +sjfzpdiqkohubt + +fovri +oibrvf +rzvoyhf +bmtrfov +vfopr + +fjrisuvcobytqdzklhap +qnhimfbzxoawcrdky + +zekrvspofhlx +mhkfeol +lkoehmf +olhkfe +hyofeiklm + +c +ban +cih + +zexlfrhwpbqjd +aqzwrjhexpbcl +exsjqpwhbizr + +mluc +a + +bwrmls +xtnfjyqc +aegov + +jbaygdz +zefikdjxb + +xsqwujrdcbaghpe +bujaxwhprcsedgq +ubgdahwxrqjsecp +qgapujrxedcwshb + +guyhqjtcipsoevnrzbf +hzoinufbgryesvtjpqc +cohugrenvjtibzsfpqy +ietnfojgvczshbqurpy +zrnoeugthfyqsplcvibj + +jov +ojv +voj +voj +jov + +qxpyrsgkwz +rskzywpgqx +zpgwykrsxq +ghsywzpxkqr +grzxpwsqky + +u +u + +jynpslzeuqt +ragksuyzv +eojku +dxmhui + +zlnbdqyxpuwjhierm +gsqxnzlwrhbympuedji +ycmqodpxirekfhnubwj +givpsxwyburhmjdqetn +xendipyuhmjqblwr + +xqncdiyzkwfuejv +ziquhfdxcnvjkyw +uznkxchjfyviwdq +cnkydfiwzvxjuq +ywkjfudicnxhzqv + +wfuesonbqzkxt +opuqtskbfdzjwn + +mzanofu +zdxnufaoh +owzfuamn + +egtdsnihaxql +altgoisbe +avztsiejlpfu + +a +a +a +v + +ygvdhfqw +gwyfvq +qfygvw + +gojmeplisnrc +etudhorwnsmc +rmosnxepkc +mnxcobsrgke +oncrsmez + +c +c +c +c +c + +cjurmasxnkglvzqwi +aiwmsgrvuckzjtbqdnx +uizfxqvsnkegacjrmw + +nyurgszpwcb +qtkzbywsregumfcoh + +t +xne +g + +svdh +wercbzj +mqu +dlh + +qmvhgiyzxj +nhveqgzyf +tygvhqzf + +hlryuivgbxjnmew +qpjnvukoigzmxerby + +plguriyjtvnqfxaozdbscwe +gercvwnlqbiadpouzsftmjy + +vhcrk +lw +ny + +vwhjsgcu +jvcswhgu + +zsaxovhnumj +smyhanuvjxzog +wusmzvhxanjo + +xonrstqdzjym +ojdsrflmethvgzyuq +myodgskltzrqj +mdyujcpsfqzotr +qyomsjdtrazibw + +zfgoqjkmiyawlexph +gjhpfeizyolwmqaxk +upifygltsaewxmqokrhzj +xmjwzhakyiqepgolf + +ithjs +jskti +sikjoznph +kroifsazxj +uliecdbvyjs + +k +k +k +l +k + +trlpyzghaxdbjscqvkf +tsxpayjicvzbrgld +lazjdgtscnbpvx + +qkncgfsoba +sganfqjockb +qkafbcnsog +afngkqbsco + +bstnrzhxydgfplqcuv +rfvhpqynugltxzdbcs + +ejh +ygqsah +inudlvmtcpozb +kexfa + +bukyz +bynur +choulyw +ufy +kyqpu + +nirqajlwbsu +brtfkzwycqn +rnbspwlxqiom + +jkeyhbdagorvni +byhdjovrkaegni + +vxeh +evkgx +lxvngk +pyajdzirvx + +iyjltnzes +pisomvjnfly +liyjsnz + +xymbztecg +tgwceozyxb +xeygtwabcz + +ndsgmpyht +cpghtdsmny +htdgmspny +tmpdhysng + +juvrlpx +vrxlpc +isnalvpkxr +lvpgxmarf + +cshqipz +uzhsqcpt + +giersvh +hsirdegv +isuvhegr +iesvhrg + +zfyedlcuibhwsxrtagjqk +ceuadzmtrilfbyjqwgsx +jicptudzlwrayfgqxbse +nsreiaqwbgfoltdzcyvxju +rzebuolydjvxsgtafiwkcq + +p +sigez +y +y + +izlqxjauwfecbk +aiefxbl +bialfex + +pvwbtn +mbvpwt +pwb +weblp + +sldajoqrgikuxpehyzwb +ixtelkyzsawgjhord +osldejgizwrvyhkax + +zouvafmwjprbsed +iepkswvumtabogdf + +bprahdke +ctedr +berodl +qndmeyurxgjzfwi + +ihpoydxbjck +itbhovcwdpkxjy +qpixnkcobyjhd +cbjopkhydix +xkoidcfbyjhp + +zbsxrimcl +yxsrcbl +xsclmbr +uxhbrlsce + +igytblcpu +gzabl +dnbmgl +sbmghxl + +moxrsndj +jsxnd +ksdjnx +ndjxs +xdjns + +izslgdythjorpw +jilzspofrhydtwg + +ehbw +qdaw + +qbvyjplgfomatzhc +cyflomhbatqvpzjni +bvuhxdotlfyajcqzpm + +zcb +bzc +jcbz +czbx +czb + +clrwvjduntqkgbzyxs +diakrlvxzytungjqswec +ugvxjkmcrsqlnwdzyt +xwvrycqhsgnztdklju + +fiqko +oqfik +qofki + +woyalnhrciezxkvutjg +lkogcnzietyjrvawxuh + +pgwzuhdmx +pmuhwdzx +pdzwmhxu + +ojyqvtzhl +tkjxlys + +ltgwyonxpudb +moydwlpzugbn +dpnowymlgxu +wuoygpjnldhi +yanpwsugflo + +nibmfhqscljzrtgyadue +dnsufmahjglyrqticbez +rslbjgdfuaqmyhtczien + +dize +dem + +pqdwgrcf +cwdgfpr +wrxpdlcfgu + +kecojbdrlsivzahtfyuxp +yahlvfgdetoqjuiz +fzjivhaeylmtndowu + +mqidyrcjlofwbasvzhu +qubfsroahdjipzvmcwyl +nvjplhuafzqwbmsdyrcio +jdmobxerwqslfzygavikuh + +r +rt +renqh +rz +lr + +wzegudnxlfmrvsj +othqwix +xbwahyotkcp + +azgvil +uzl +p +kswcrxndhbjmty +qfpie + +opmwj +po +nadxzfo + +ermgqa +aqmygr + +nvlhbi +kxbncilm +ilkpnb +zwednuoqtislb +nyjrbilf + +exnctrkgqzhs +ih +hw +vfuh + +lbpyefqwacjgidx +cejfqpbygdlxawi +qcdlewjpxiaybgf +jcqdxilyapbwfge +xpcidqyfalgjweb + +mlitd +mn +ryphqgb +tcik +uitkdc + +qerh +hyeqr +eqrh + +m +m +m + +kqbut +b +b +yhlbmszi + +ign +ign +gni +gni +ign + +duwl +dzuwi +olwud + +de +ed +de +de + +nkfuvrq +itdmjozkxgcpa + +xbghdct +dcxgthb +gxdthcb + +qbmerpojvlagihdxcw +alewovtqmixkcrjpdghb +joplxmaqvcrigbdewh +iulwvqpbjdeomcrxagh + +qmwonecigvyrzxa +xcqovgezwmhn + +rzkdhoqajeus +dakhezqusjro +dzjqoausehr +hsuorqizeydbtjva +ujqrheozsad + +yexorb +eoyrx +reyozx +rxyeo + +btxmgi +obaheumrtnx +bcxhumrt +bvkfwmxtqyls +xudptmizb + +cue +ue +eu + +aj +ja +ja +ja +alj + +sq +hqs + +sxladpvgftwz +nyuqbcajomrhis + +heoyntkc +xnygtkohe +nhltkeyo + +tmsgiqvfluh +dlwqtbfacozgmi + +j +m +nj + +hfrbmwjc +cbjwmhx + +ketvc +cektv +vktec + +yenoaclvitgfupmhrz +ctnopmlgiyjqkersxhuf + +k +k + +qswzr +jhgzcoayqn +viqf +lmetqdubk + +kcqfhwru +zjqvdhm + +yasdizqwhrvxo +roswcnaxiqvhgbz +isvhrxoqmapwkz +yxachvrzisqobw +relszwiahvxqo + +d +d +d +j +d + +epdrbcsvx +xpcdvbres +bxdpevrcs + +nx +ybnx +nx +kxfn +nx + +khq +qtjhu +nxohafelcq +pjhqu + +xhfwlatiepzmcjsnrbkdo +zpnxfjomsecithrdalkb +arxlodtjcmqeisbzhfvnk +rdakehsfxnjilzcbompt + +d +d +d +zylwd + +dw +wd +wd +wd + +lifx +lzien + +xmlfdkqn +zstlvkehudbonmipqwxa +dmnrxlqkj +xdmqkygncl + +fxpsjhumkirzvlnwobeayt +xfvjcaihbropmdstgwenukl + +wjcfk +nfjc +fcj +fjc +fcjn + +lyr +ylr +ylr + +eytqsihkocxbrgvzdmw +dzfrsktxvcwqomiegbh +kcgswrtimvjoeqbduxhz + +zuvlq +uzlqv +vzuql +quzvl +lfquvzh + +jbhr +jfbrxh +brhj +jeharvbq +zjbhnr + +hrx +rihx +hxr +hxr + +puljdkigxwsmntb +lpiwntubmkqgsj +blwsukigthjmpn +frmkltgbyeusjnwpi +lpqnkgsjmbtuiw + +ujtrelawhfiqsozbgxpk +woibperhglkjtqfxvsau + +wkthv +olvqacdyxgpmh +khvsnw +hevwkb +hrvfej + +ui +iu +fiu +iu + +vcapxqg +qkjpwuganhb +pegqaxf + +qbelwaf +qfjcgewn +mqwfxe +wqycfeu +qohfeiwprdt + +wo +rocaw +wo + +hqeyfglrw +behfylwq +yhelzwsfqb + +sduomekpxfrliwavytjhzq +svpdefjmaircyxuqohlwztk +kvtrhupelqmxjsowdizafy +uxyvefotzjwidhsprkmalq + +fprevkusajgncldhzimbwqot +qwnvsizdjetcmryhoalugkfb +fmwsktgqhrlnijzbaoceuvd +nbarqeultwsjmhivfdkcozg + +jqu +ujnq + +endwgsmzfcaqr +qsmwfrgzacned + +vwme +wjamveb +weum +twmezrg +bawjem + +kdhzcpgqiomfwyjlsatnu +gktdaqlozhjcmupyvnwsfi +ohncldbjausiptkxwyq + +geukr +kfgn + +q +q +q +q +h + +hrb +rbh +rkhb +rhb + +ldpencbzmxshwia +elurvxpznahigdkocmwb + +vxeptowscmuhig +owxegucpmlsty +ygqeuotpsmxcw + +iowfcmk +gokwlrzmnep +xowmk +woknuvym + +zmhc +zhmc +cmzh + +jxp +xj +xjy +jx +jx + +bwhiryzfeutoxl +msnpivuqwkbajcd + +mzfcrdpxusvtohgnqjlbae +xfrynequbdjtvamlowgpczs + +dn +d + +rchyd +dryh +hrydp +rdyh + +nejf +fijnrm +nhlfekiz +whnfe +qotxnbspgyvduafc + +ielxrbunfsh +kqewhomcgptyadv + +qktlubevfoiynsadzhxwpmj +ejwhsuogyqxzrkipbmcdf + +f +f +f +f + +ydhrpqvelcit +lhrdkatesyivqp +fepwvtdqrljznuybih +ohemxydrqtpivl +pvgiyltqehxdrs + +mpwesbxkogizjcfrlq +fjgwbymkzselxprqoi + +kbdyqaufern +myzgiwcp + +ixjotau +cfljotixua + +pulwjsrahkezq +jlcrvdpiuazfsn +zbycmjglspauxdr +glcaposfzjuidvr + +tdfqh +gcz +fnpmc +vak +orbu + +dbgzyspejv +xigeymrdk +mwexdgy +yeadugmth +cdgkewyfq + +aduflnjh +jdfhnaul + +iwpk +qufnbav + +r +wd +r +r + +nq +rq +yzq +nzq +eqpfb + +cqnv +cnq +oncv +cnwz + +a +b +a +a + +ibc +zca +ca +lc + +jhzuqnitk +tikqjzubr +onzkiuqjt +qujthznmoik + +mlbdxcuzjeoipqytaskvwrgfnh +zghibtpoqrjyancuskdxmlwfev + +kuolxsifydbmep +mlpoiydexfbsuk +fbmkyxduepsilo +dozbuyktrmxiwlnpscafe +dikmsobhepxuylf + +jkebfzawcyxsqniurldpmoh +rqjwymcuaniofldsbek +ubkijedynomascflqwr +uatfielnyoscdkjqmwbr +wigmqrkdysloejcbufna + +bdeaowzflgtuycp +ueghpydwtlxjcavf + +pkye +ke +ket +ek +ek + +lhntvadrkufwescgb +qdrbnzwfieltuoxagvpkch +ngvkjdwamlhuyfrtbce +sfgarwlhbnedtcuykv + +y +a + +vosbcqyuwhk +skycvquolwhb +csuhwvoqbky +kcobuywvshq +uyqbwvcshko + +lsen +nzrlv +luhjinxq +ntml + +bxtjw +ibtjswpqflvx +xodtjwrb +xrwjtyb +wxjbtr + +vc +vc +vcen +bctvl + +vt +tv +tv +tv +tv + +akx +ank +ka +kax + +fi +i +dilzc +i + +e +a +e +c +c + +wgishljxzeufqbdamry +bmgrxydsahiqjfluwze + +jzhwgbeotdmup +uskhbvypwl +wcpkhfub + +mgoflsua +gmluaofs +oasgflum + +myswzflpqvuatxknbdegj +uqbgdevtljwfszkyarpxmn + +ctwlfnisxezhdpu +tlczdnwshmip +ctwpnslzihd +nglihtpdsmzcw +cdlhwpiznst + +kyblsmitxjq +kxlmbsijar +jcxlsbfvmkzio +vbrzijolaxwkms + +k +k +k +k +uk + +thnxru +qxyrtuhn +tnhusrx + +eomv +cgvxfmyseqbi +verm +vanem + +dhbuplfwreozxygvic +gexucnfplhyriwozbkvd +wuyoezvchfigxbdlrp +fpyrciwvdzugxloehb + +tzjvre +rvzjet +vztejr +evjrtz +evzjrt + +zkwqa +gnxlruozpfe +qmtzchky +vybzw + +ivanhem +mnahevi +mihnqeva +anihemv + +elw +bewl +lew + +mcrfzgkphioj +rlpigtmhckzo +azpirgsckuofhm +mhedpqxbozignk +jkhyopizgmav + +cewmxkn +cxmenwk +ewxcnmk +knmxecw +kmexwcn + +furandwxcpebkih +bockvuwxhaiperfn +abfkupcnhzerixywm +kbeanuxihdcpwrf + +kydunijzc +unywcfkizjpd +yjnzmkldeuhic + +jbpky +pbky +kyb +djbkyg +blyfku + +uaksgtnm +maxngukvst +seftjuknihaogm +tnwukgampsd +mygksatnu + +frykaibhmqocwupnles +wcamqulkhsbeiorpynf +rycpimbhakleuqfnosw +oeynsahumfblqcrikpw +scabehnompiquklwfyr + +nxi +ni +in +in + +zrqglywd +tqyehuroi + +snzbcvtkryhxuwfiojqmade +qduzryecmobsntxhakviwfj +keftvjiozrxambcqhsdnuyw + +elidfk +zkdli +ilkd + +losmpg +pgmrasco +jhsbpofieg +ongcmps + +kiglzftorbv +yitmpjkqzha +mhiqkztejuncx + +mpskhgatqrxcywlebduf +pexqbwaycfsldgrhtk +balxfgvyecwtshrpkdq +kewstgclydqhprxfjaib + +ey +yq +qy +y + +i +k + +isu +insu + +ncpakrm +rnekmacs + +xs +xs +xs +sx +xs + +y +y +y +y + +sxcjonw +xsenoj +oipvxnsfgqkjl +zxbshnojwu +bjoszxn + +zvathnqlcgxiboweus +wtuvanxlezihgcdso + +xk +kx +kwx +xk + +etrbigydaohsumc +pwmalnfvzjy + +yhj +exhkjz +njho +jhno + +syltikaxprongdmbv +tnmjzkqprsadyogvxbi +ahdvmgnskuixcywrbpto + +rxinz +xk + +svd +sdv +divs +vds + +lm +adlyu +ql +ctkxhrnlb +vlujw + +irhxaewlgqjf +jgiwhraltqkxe +hjgwaulrtixeq +geixhaljqwrd +mznqvjgsxelcroywapbih + +bgtp +tblzq +fbtz +ltxb + +hxolrdgytjwbazcmv +hrwxioacgyqtlzmbjp +bzwrumgstxhyacolj +jcyhrabglvzoxtmw +zlrmgxohetwakcybj + +rns +tib + +vbyqlneakcsz +rgmpdvwik + +wobkderiq +yzhewd +fieqgw +smcpejwxlvut + +afmznvekygspctobl +wpxrlbhdtqijyvou + +dlh +lhfd +hdl +hdl + +enbzhorlvais +lieszanh + +sgvfkilbqa +aurnvsb +abnmshv + +s +b +k +h + +cw +webfiyz + +mjdla +anzmd +dqjmla +adgpoum + +tne +ne + +ncdlqwmk +ikcndqw + +p +egzj +piy + +jodrtu +ohasru + +kpufqxezgbdlj +kxglfedpzbqu +qbdlxepzkugf +kujqzpfglbex +hlkcuoepqbtgzxfr + +tphmylucsnbevjrxdw +njdfmpvrxcb +rcnfmjdxpvb +bvmkrdxcgjnp +fjxvinpcdrmb + +bvhdipkwsagrzqxoeultynfc +klefxwratbyvpiqhgudonscz +tbzwfraikuqhenxgsmoldypvc + +lgubtdvcpnaeskrjwhfm +btzrnviochdeuwmlksfp + +g +g + +rgeanvoku +keuvzrogyan +onvegaukr +kfnogecvqrau + +isnmdpj +skjxbgm +sbjguma +cmosbqj + +ctafijyo +egbvdhpwksmu +xntqyr + +eowfzg +zfgeow + +aoib +oaib +ouabi +aiob +aboi + +wyjviubfg +htdkazcpoml + +dxtyqhrabwfcokjezil +wtjbehzkilgcvarxqyfuod +ftbpoadqejywichnzxrlk + +dprqcval +rdvlpqa +phfuqrnjvd + +iblxrpvzfqoujstwdnkhmce +mnstfolircdbxhwuzkvqejp +nkvrswjbtipfueodcmhxzql +kuhtsdviowqxncjpzmblfre + +icsf +sbcif +icslf +sfchym +scgfli + +chtybjgeowzmfqpnx +gfnbwlptcyxm +tyxapvnbimgfwuc +tnfmwpcgsdrxby + +yxjhnaqbtvlpd +prlgthi +pemszgthl +pktrlhu + +itplafwyzndrqcbgs +dnrbyaztwpifcqlgs +qrnbwcxifdspagltzy +swkziqbplcjngrautfdho + +aige +txbvjl +tcbdj + +mgyujcwaktszefqoirdhvxnb +zytsgavicowhmufxnkdrjbeq +hvlegnkiuqdmpxbcafrowzjyts + +atsmqfczgdloujnbkh +clgmhtabjzknqudofs +kcqtjbusohznlgfmad +qtjbhdnoacfmksgvuzl + +bejmhwlnv +jvhbmlwen +wmhlnejvb +mbenjwlhv +wbvnljhme + +ojrf +ojrf +rfoj +jfor +jfor + +mjgndvtfecposairblxhkz +vknpmfzbglhreoasjcitxd +bswvxjgfmerudnczytlaoihpk +xrifvklnjztgcaobhsempd + +ymcthsuirlpzxbf +uyjxcfzirqm +nyumiwfgcexzr +rftouxzsvmalciy + +midctzbgpsjqwer +iwtdebmsrqgz +nimbszqregdtw + +lizoduphs +sruhdilopz + +zsapyuc +kmqdneholgxvwb +tjricusf + +h +lh +lmn +jo +y + +tvqsz +sqdvpxecmby +znwqsujgv +nvgoqsf +vqst + +scwm +wmc + +uogmpy +zygpxu + +y +cy +yc +yw +y + +bmilekvzfouqjdc +zvfaodqhmcjklb + +meh +ehm +hlem +emfynhp +mekh + +nelmicxufzj +czjflxmwi +itfxzcpdlmjo + +rfnxwmva +ouiarcb +jryekl + +gtjdialpk +lyjmonspwf +pvdljz +lpjr +ukjexlbpq + +r +r +r + +hbz +xg + +lsprfiznqxwoejkbmgyd +dmeqgizopjfrkxnwybls + +ngprdljf +ljzrngf +fgrznjlu +yfgsjrln +glrjfnciu + +wfv +wvf +vwfb + +yqbpmancd +dfjrv +sdiolrvhwf + +xvnbgkal +uxvfglisnak +kyclemvqjngotpxa +vgasnlkx + +jkfoeuypq +hejyfok +zvilgoyjfmkw +fxkojy +ofkejy + +xvoskgnrfi +nokrwivgs +sinrkvzgo +svnrikgoe +ovgsnirek + +niy +nqiye +iywn +xyni + +qauhvi +vaihqu + +akpwgyulbfe +fauyvtzlkwngosb +cmghwyklrfbua +wpxcabemgfkqluhy + +yqvlidbmhkpgtuszf +vjzyupbhlitq +yvulwitqbzh +izblthxqvcyu +aqfezybvkunihtl + +slmvntra +vrslatm +rauqsmtv + +mvb +m + +tlzinqbsjgrw +bqsntjdr +qpcsbjntr + +rodmgwef +wzekof +fzowe +ofwe +fokhwe + +zpsimtknaldgfebq +bpadkftzilsegnxqm + +mupfnj +hsnu +unh +syiuhcn + +entlxzavdbpfsowuq +qfzntxowlbvdpasue +wznhspobtqleauxvd +pzwnsxluqbecdvato + +bhowvre +sjztdmr +oevalywrx + +vzdokpinc +dynavsgjo +nvsbgod + +xjecrkvq +cejqkfrvx +vekmcjirxqgd +vckelqrxtj + +abf +fuba +afb +baf + +trcmhwa +mrwycftdha +bmhitcogjqeak + +zlrufcghipwjxmkaqno +gprkuxlfhcqjawnm +anfygcklxwurpmqhj + +szxdjetgavuy +xjtiyegua +yucexjtag + +zudgemcxtp +woac +yiwco +ayckq +sjcqobk + +hr +lpvn +pel +gykbqia +f + +rzpmnhoeudlcawbiyfvxg +xeycvthsrfmwbpnaluzio + +soyvdbuzf +uzdoysmf +gzsuyfdot + +w +uw +w +w + +mixeawbdrpozjqlvkhyf +arxnwybjzlhqdoeikgm +otdibuckxjyezwhlaqrm +kyzdirhxwaljoqbme +hdrmleqjybizwsokxa + +og +glob +gvon +og + +vqef +qve +qelshv +veq +qev + +wtcfmjopqisz +tfmqigrjzcbp + +poa +pokcw +jitdospb +rospav + +csfqhwendrbigt +qfthwcrbnsedi + +kx +kx +x +wcx +x + +umxvbsypightkdeq +mknbothiadpeqx +khbieqpdtmx +ptbkiqwdhxecm +mkzhexqjatpidbf + +inazybxjlp +ylaqbnjihxpz +ljybxnzmspiawv +teyjaxpfkdcblzni +zinyapbxlj + +rdusztincoephyx +eythcponriszxdu +cimzenhxusdpyrot +prhtndyuscxoize + +nptqdiemfalyuhbgv +xiynrzpaubelvftdkmgq +vahmlunpetgqiyfdb +luytfvqpbagmenid + +fykps +kpfys +fkspy +fksyp + +wb +gthprjo + +gyshflcjudtnwiaborvxzqkem +ejzgxrkavbohntmscwqduyfi +xnjprtevydzkihfwbmagqcuos + +odegpjrticlauqyk +jloadrvubcqgiype +orghjiqdfmawylnupe + +blepmn +emnlpb + +cflwhius +srqfuwcl +cjwspxlfu +lafrwcsu + +euvyacbzm +tywmxaugpbc + +vbafy +bavyf + +tsqrmciwkvz +iqtkwrzbvms + +hbdkfelts +ktedslbxf +elkvzfbpwtsod +blfekqsdt + +bmxlhiakopjrvcnwduytef +jrbaflehdzcivxnkwputmoy + +igmdlqvjkt +sntyfoxaruc +zhbtpuxew + +qhftyzkdpe +zdfeptqkyh +qchpdkfytez +zfpqtydekh +ekfptzqdyh + +mdnhxrtla +xdcmolrgefjat +xrdtlmiay +pmryuxtsdlhza +maldtxr + +gzrycsoeifxqmlv +vqefmclnxsopikrgyz +rzqcveygiolxmsf +ecsvgyqflromizx + +dqjormwctbe +ewmzxivtqk +vlwetqmg +tenqwzlxmak +hqkmfwetg + +pamruofskhgx +nbaicywlvurjqt + +cfhprmjydtwib +eylox +gqoxyz + +mg +eyj + +pqvdhf +dpqvf +pvsqdf + +ocguwrzdpejvknfitbh +peodckrzbfqtiuwn +ezotrbnpwiducfk + +ewahyrtcxpu +foqzcjeyuw +nuyewlcif +wcmuiyeb +vdykwmcieu + +mrljx +rjoibh + +eyaxshrvujwkd +wevusxahdyjkr + +szgcmlvbwp +mlhzbvgtrpcs + +pkytqjfruxvmawhsgdnbol +laosxkvfpmutbjngwqd +xkabnslgtfvudoeqmwpj +wopmuvgfxkqjdaltsnb +uvmspqfdjnkotgxwabl + +c +rc +ch + +wvha +whv +whv + +lmcpuqaikfzyod +youipzclkmvftqa +cilkadqwzpyofmu +lmuacikyfopqz +uolwmcyzfpikqa + +yncbugjr +nujgyw +vjyguon + +yzchibmu +nujzplx + +uhlcpnjxy +hyxlpunc +plnhcyxu +xnhkplcyu +lxychupn + +sqhtziykurw +nscgvfodlmbejax + +vodwenxyrmthbfpcgqzuji +vuopdbwtijqxgnlefczmsyhr + +jnlwdvrtbaief +gwvijtnehc + +yndsmw +pwsyndecm +mwyrnsfd + +hantryqklbd +lfnrhakbydqt +lrynhdtqkba +hkqrtanbldy +aqdsgblhvyntkr + +nacrmgizuqhwlpjx +fnigmsuzwplajxqch +gmzjuplhxiqnwac +ijlznaugxchqmpw + +vbuozwdxrnetj +vuerdznwxobjt + +zlyfqigecsjvbx +kmznlbuoejs + +rce +w + +nwjie +xulkaegsy +vipehm +oevcrbf +jme + +lvyzgheudsna +ehzdyasuln +helnuyzxdsa +udbeasnyzhl +bynahsuldez + +qepdrhamt +ifnd +nxfdy + +gsuap +pmoausw +tsanupi + +gyhaiveludnjftqbswzrm +smbvnyijzafetrlhdgwqu +hyevmqlcisxzbfukgndjtwra +lmzuqfewdjsvrgtahbiny \ No newline at end of file diff --git a/2020/6/prog.py b/2020/6/prog.py new file mode 100644 index 0000000..1fdc98a --- /dev/null +++ b/2020/6/prog.py @@ -0,0 +1,61 @@ +def get_input(sample = False): + ret = [] + with open("sample" if sample else "input", "r") as f: + group = [] + for line in f.readlines(): + if line == "\n": # empty line + ret.append(group) + group = [] + else: + group.append(line.strip()) + ret.append(group) # add last group + return ret + +def list_of_string_to_list(s: set): + ret = [] + for string in s: + ret += list(string) + return ret + +def grouped_answers(answers: list): + ret = [] + start_i = 0 + prev = answers[start_i] + for cur_i in range(1, len(answers)): + cur = answers[cur_i] + if prev != cur: + ret.append(answers[start_i:cur_i]) + start_i = cur_i + prev = cur + ret.append(answers[start_i:]) # add last answer + return ret + +def list_of_string_to_set(s: set): + ret = set() + for string in s: + ret |= set(string) + return ret + +def get_result(inp: list, part = 1): + ret = 0 + for group in inp: + if part == 1: + ret += len(list_of_string_to_set(group)) + else: + group_len = len(group) + splitted_answers = list_of_string_to_list(group) + splitted_answers.sort() + ga = grouped_answers(splitted_answers) + ret += sum(map(lambda x: int(len(x) == group_len), ga)) + + + return ret + + + + +if __name__ == "__main__": + print(get_result(get_input(), part = 2)) + + + diff --git a/2020/6/sample b/2020/6/sample new file mode 100644 index 0000000..8fdfebd --- /dev/null +++ b/2020/6/sample @@ -0,0 +1,15 @@ +abc + +a +b +c + +ab +ac + +a +a +a +a + +b \ No newline at end of file diff --git a/2020/6/test.py b/2020/6/test.py new file mode 100644 index 0000000..9d2e369 --- /dev/null +++ b/2020/6/test.py @@ -0,0 +1,23 @@ +from prog import * + +inp = get_input(sample = True) + +expected_inp = [ + ["abc"], + + ["a", "b", "c"], + + ["ab", "ac"], + + ["a", "a", "a", "a"], + + ["b"] + ] +expected_result_1 = 11 +expected_result_2 = 6 + +print(inp == expected_inp) + +print(get_result(inp) == expected_result_1) + +print(get_result(inp, part = 2) == expected_result_2) diff --git a/2020/7/__pycache__/prog.cpython-38.pyc b/2020/7/__pycache__/prog.cpython-38.pyc new file mode 100644 index 0000000..c462363 Binary files /dev/null and b/2020/7/__pycache__/prog.cpython-38.pyc differ diff --git a/2020/7/input b/2020/7/input new file mode 100644 index 0000000..a3c0fc6 --- /dev/null +++ b/2020/7/input @@ -0,0 +1,594 @@ +dull silver bags contain 2 striped magenta bags, 2 dark coral bags, 1 bright orange bag, 4 plaid blue bags. +dark plum bags contain 3 wavy teal bags. +wavy turquoise bags contain 3 bright salmon bags. +mirrored gold bags contain 3 wavy brown bags, 5 posh beige bags, 3 light crimson bags, 3 vibrant salmon bags. +drab green bags contain 4 dull white bags, 1 posh indigo bag. +faded lime bags contain 1 dim magenta bag, 1 wavy salmon bag, 4 dull purple bags. +mirrored blue bags contain 5 bright orange bags, 1 muted black bag, 2 muted brown bags, 2 vibrant gold bags. +faded crimson bags contain 4 wavy teal bags, 4 mirrored fuchsia bags, 3 plaid white bags. +faded magenta bags contain 2 clear orange bags, 5 dull green bags, 2 pale white bags. +pale red bags contain 5 shiny gold bags, 4 dull gold bags, 2 drab black bags. +dark coral bags contain 1 light turquoise bag. +faded chartreuse bags contain 4 shiny brown bags, 4 mirrored beige bags, 4 clear purple bags. +muted coral bags contain 4 pale coral bags, 4 plaid brown bags. +bright teal bags contain 5 striped blue bags, 4 faded orange bags, 2 faded crimson bags. +wavy green bags contain 5 dim chartreuse bags. +clear white bags contain 2 mirrored fuchsia bags. +clear aqua bags contain 1 faded beige bag. +vibrant yellow bags contain 5 posh brown bags. +pale lavender bags contain 1 striped beige bag, 2 striped cyan bags. +mirrored lime bags contain 3 bright orange bags. +faded tan bags contain 2 drab beige bags. +dark indigo bags contain 1 dark brown bag, 5 shiny beige bags, 1 vibrant indigo bag. +drab teal bags contain 2 vibrant fuchsia bags, 3 muted green bags, 5 dotted magenta bags, 2 shiny lavender bags. +shiny aqua bags contain 1 shiny gold bag, 4 clear white bags, 4 faded gold bags. +dull bronze bags contain 4 vibrant teal bags, 1 vibrant violet bag. +dark aqua bags contain 4 posh white bags. +dim coral bags contain 2 light yellow bags. +faded salmon bags contain 5 muted brown bags, 2 dotted red bags, 3 drab yellow bags, 4 dark red bags. +bright lavender bags contain 5 wavy maroon bags, 5 light brown bags, 5 bright silver bags, 1 dark gray bag. +mirrored cyan bags contain 4 dotted cyan bags, 5 striped orange bags, 1 vibrant gold bag. +drab aqua bags contain 3 striped black bags, 4 dark salmon bags, 1 drab white bag, 4 faded crimson bags. +striped purple bags contain 5 faded yellow bags, 2 faded brown bags. +drab fuchsia bags contain 4 vibrant violet bags, 5 mirrored yellow bags. +shiny red bags contain 3 faded cyan bags, 1 dull beige bag, 1 shiny blue bag, 5 dull cyan bags. +mirrored teal bags contain 4 clear brown bags, 5 light bronze bags, 3 light teal bags, 2 pale tomato bags. +dotted orange bags contain 3 dull white bags, 2 wavy blue bags. +dotted lavender bags contain 1 vibrant aqua bag, 4 shiny magenta bags, 3 dull plum bags. +pale crimson bags contain 4 muted cyan bags, 1 posh brown bag, 3 light magenta bags. +shiny black bags contain 4 vibrant chartreuse bags, 1 mirrored yellow bag, 3 posh brown bags, 5 vibrant violet bags. +clear bronze bags contain 5 dull violet bags, 3 pale plum bags. +striped lavender bags contain 1 dark plum bag, 2 striped yellow bags. +plaid indigo bags contain 2 plaid chartreuse bags. +shiny teal bags contain 4 wavy gray bags, 4 drab teal bags, 1 dark silver bag. +dull turquoise bags contain 1 wavy gray bag. +striped brown bags contain 1 striped olive bag, 1 wavy olive bag, 5 posh brown bags. +dotted magenta bags contain 4 drab silver bags, 3 light olive bags, 1 bright tan bag, 4 dull gold bags. +plaid yellow bags contain 5 drab black bags, 1 wavy lavender bag, 1 drab silver bag. +muted blue bags contain 5 posh aqua bags. +shiny olive bags contain 4 dark salmon bags, 1 faded gold bag, 3 drab chartreuse bags, 4 dotted yellow bags. +vibrant lime bags contain 4 shiny aqua bags, 1 bright maroon bag, 4 striped orange bags. +dim crimson bags contain 5 faded crimson bags. +vibrant gray bags contain 1 mirrored coral bag, 5 wavy beige bags, 3 drab turquoise bags. +posh chartreuse bags contain 3 light plum bags, 2 pale green bags, 5 drab white bags. +striped beige bags contain 5 dull red bags, 5 drab salmon bags, 3 vibrant salmon bags. +dotted tan bags contain 4 wavy crimson bags, 4 shiny orange bags, 1 drab turquoise bag. +vibrant aqua bags contain 1 vibrant gray bag, 5 light violet bags, 3 dim yellow bags. +faded turquoise bags contain 2 faded yellow bags, 4 mirrored coral bags. +mirrored purple bags contain 3 pale orange bags. +dim white bags contain 1 drab turquoise bag. +bright purple bags contain 5 muted chartreuse bags, 1 dotted yellow bag, 3 bright salmon bags. +drab red bags contain 1 mirrored magenta bag. +clear coral bags contain 4 drab black bags, 3 dark black bags. +mirrored orange bags contain 1 muted chartreuse bag. +wavy cyan bags contain 3 posh lime bags, 4 dark magenta bags, 4 vibrant turquoise bags. +pale magenta bags contain 4 vibrant turquoise bags, 3 clear gold bags. +posh gold bags contain 5 dotted lime bags, 5 wavy silver bags, 4 muted crimson bags, 1 dull yellow bag. +clear silver bags contain 1 drab indigo bag. +faded violet bags contain 2 mirrored bronze bags. +muted turquoise bags contain 2 plaid green bags, 2 light yellow bags, 4 dark violet bags. +striped bronze bags contain 4 striped white bags, 1 dim yellow bag, 5 clear aqua bags. +muted aqua bags contain 5 plaid green bags. +wavy teal bags contain no other bags. +pale black bags contain 5 dark salmon bags. +clear gold bags contain 2 plaid white bags, 5 drab coral bags, 5 pale coral bags. +muted chartreuse bags contain 5 faded crimson bags. +dotted fuchsia bags contain 1 plaid brown bag, 1 dark violet bag. +bright tomato bags contain 1 bright blue bag. +dim bronze bags contain 1 dotted green bag, 5 pale violet bags, 4 vibrant chartreuse bags, 3 striped yellow bags. +bright beige bags contain 1 drab blue bag. +vibrant olive bags contain 3 dotted olive bags. +clear tomato bags contain 1 light gray bag, 2 light turquoise bags, 2 striped yellow bags. +mirrored beige bags contain 3 light coral bags, 2 bright teal bags, 1 wavy magenta bag. +shiny gold bags contain 3 pale silver bags, 3 mirrored yellow bags, 2 shiny black bags, 2 light magenta bags. +plaid aqua bags contain 4 plaid crimson bags, 4 dim gray bags, 3 plaid orange bags, 2 dotted blue bags. +light green bags contain 2 light violet bags, 5 striped violet bags, 5 drab brown bags, 4 dull white bags. +vibrant beige bags contain 3 posh violet bags, 2 plaid blue bags, 4 shiny lavender bags, 5 wavy orange bags. +drab orange bags contain 3 striped beige bags, 3 posh teal bags, 5 drab silver bags, 1 dark indigo bag. +shiny orange bags contain 3 dark aqua bags, 4 clear beige bags, 2 mirrored lime bags, 3 dark violet bags. +wavy maroon bags contain 3 vibrant chartreuse bags. +wavy olive bags contain 5 dark aqua bags, 1 light yellow bag, 1 shiny crimson bag. +dotted cyan bags contain 2 drab gold bags. +muted cyan bags contain 1 clear gold bag, 4 dark plum bags, 2 wavy lavender bags, 5 vibrant indigo bags. +posh cyan bags contain 1 light fuchsia bag, 1 dark maroon bag. +faded bronze bags contain 2 muted salmon bags, 4 dim violet bags, 5 dark tan bags, 3 vibrant white bags. +pale green bags contain 4 muted turquoise bags, 1 vibrant green bag, 1 drab white bag. +clear brown bags contain 4 wavy teal bags, 4 drab violet bags. +striped salmon bags contain 5 mirrored orange bags, 1 shiny yellow bag, 1 muted beige bag, 1 clear purple bag. +posh brown bags contain 3 posh white bags, 4 drab chartreuse bags, 5 dark violet bags, 4 wavy teal bags. +mirrored green bags contain 1 dim tan bag. +bright yellow bags contain 2 striped indigo bags, 2 dark silver bags. +wavy yellow bags contain 3 dotted gold bags, 3 posh green bags. +light chartreuse bags contain 3 faded blue bags, 3 mirrored yellow bags, 3 shiny plum bags, 4 light red bags. +dark lime bags contain 5 vibrant chartreuse bags, 2 clear brown bags, 1 posh brown bag. +muted magenta bags contain 4 shiny silver bags, 2 dotted yellow bags, 4 pale fuchsia bags, 5 muted tan bags. +light plum bags contain 4 drab gold bags. +dim tomato bags contain 1 light silver bag. +pale lime bags contain 4 dull blue bags. +dim black bags contain 1 dark plum bag, 1 dull crimson bag, 5 wavy white bags, 2 plaid chartreuse bags. +muted teal bags contain 3 dim black bags, 4 mirrored lavender bags, 5 dull indigo bags, 3 clear red bags. +muted purple bags contain 1 mirrored red bag. +dull coral bags contain 5 pale teal bags, 2 faded cyan bags, 4 pale black bags, 2 muted olive bags. +vibrant red bags contain 4 light teal bags, 5 shiny fuchsia bags, 1 drab purple bag, 2 muted olive bags. +mirrored tomato bags contain 4 posh brown bags. +shiny coral bags contain 5 clear turquoise bags, 2 wavy salmon bags, 1 drab brown bag. +wavy indigo bags contain 1 vibrant brown bag, 2 dim turquoise bags, 1 posh violet bag, 1 plaid green bag. +dotted gold bags contain 5 pale aqua bags, 1 bright olive bag. +dotted violet bags contain 2 drab olive bags, 1 plaid cyan bag, 2 posh beige bags. +pale fuchsia bags contain 5 faded beige bags, 5 dark purple bags. +shiny chartreuse bags contain 1 striped tan bag, 5 pale tomato bags. +clear gray bags contain 1 bright fuchsia bag, 4 dotted olive bags, 2 light teal bags, 4 shiny magenta bags. +vibrant tomato bags contain 1 clear crimson bag, 3 pale purple bags, 3 faded gray bags. +light orange bags contain 5 plaid brown bags. +shiny tomato bags contain 3 light olive bags, 5 dim silver bags, 3 posh violet bags, 2 striped lavender bags. +faded green bags contain 2 dotted gold bags, 1 dark plum bag, 1 dull gray bag, 5 dark brown bags. +dim gray bags contain 5 muted white bags, 2 mirrored yellow bags, 1 muted tomato bag. +faded black bags contain 3 faded teal bags, 3 striped lavender bags, 2 striped blue bags, 4 muted lavender bags. +clear lime bags contain 3 mirrored yellow bags, 1 light yellow bag. +dark silver bags contain 4 wavy orange bags, 2 muted green bags. +plaid black bags contain 3 wavy indigo bags, 1 pale red bag. +mirrored black bags contain 5 dull black bags, 4 clear coral bags, 1 wavy olive bag, 4 dull silver bags. +light coral bags contain 5 drab black bags, 1 dark magenta bag, 1 drab teal bag, 1 mirrored crimson bag. +shiny yellow bags contain 5 faded indigo bags. +posh plum bags contain 3 faded maroon bags, 2 vibrant indigo bags, 1 bright turquoise bag. +faded olive bags contain 1 vibrant gray bag, 4 drab teal bags, 5 wavy teal bags. +dim plum bags contain 1 plaid white bag, 4 wavy beige bags, 3 wavy green bags. +muted tomato bags contain 5 dotted red bags, 1 drab purple bag, 1 light orange bag. +clear fuchsia bags contain 1 mirrored olive bag, 2 faded salmon bags. +striped violet bags contain 2 light olive bags, 1 plaid olive bag, 5 light white bags. +dim aqua bags contain 2 vibrant purple bags, 5 drab silver bags. +striped crimson bags contain 5 muted coral bags. +bright indigo bags contain 3 muted gold bags. +dotted black bags contain 4 shiny crimson bags, 5 dark salmon bags, 5 faded crimson bags, 2 vibrant magenta bags. +faded indigo bags contain 1 drab tomato bag. +bright bronze bags contain 1 wavy lime bag, 4 pale violet bags. +drab turquoise bags contain 2 drab gold bags, 2 vibrant gold bags, 4 pale tomato bags. +wavy black bags contain 2 dotted brown bags, 1 light salmon bag. +posh green bags contain 1 striped olive bag, 5 vibrant turquoise bags, 4 pale coral bags. +clear green bags contain 4 dull bronze bags, 4 shiny crimson bags, 1 light white bag. +dull chartreuse bags contain 2 dim aqua bags, 3 shiny black bags. +drab lime bags contain 1 wavy chartreuse bag, 4 mirrored chartreuse bags, 1 posh olive bag, 5 mirrored lavender bags. +bright tan bags contain 4 muted tan bags, 5 shiny gold bags, 1 mirrored red bag, 3 dull crimson bags. +dim maroon bags contain 3 clear red bags, 5 dark brown bags, 2 bright maroon bags, 1 muted teal bag. +drab tomato bags contain 4 dim orange bags, 2 mirrored violet bags, 3 faded purple bags. +muted gold bags contain 1 dim cyan bag. +striped white bags contain 1 plaid white bag, 1 posh purple bag, 3 muted cyan bags, 2 pale crimson bags. +wavy beige bags contain 2 plaid white bags, 3 dark brown bags. +vibrant turquoise bags contain 2 muted turquoise bags, 3 plaid green bags, 1 shiny crimson bag. +dark fuchsia bags contain 1 pale purple bag, 1 dim fuchsia bag, 3 light teal bags, 3 vibrant magenta bags. +dotted aqua bags contain 1 bright white bag, 5 clear gold bags, 5 clear tomato bags. +faded silver bags contain 1 light lime bag, 4 wavy gold bags. +faded brown bags contain 4 light aqua bags. +bright gray bags contain 3 faded red bags, 2 muted plum bags, 1 wavy brown bag. +wavy tan bags contain 1 pale maroon bag, 5 posh black bags. +bright blue bags contain 5 posh purple bags. +striped gold bags contain 4 dull tan bags, 1 shiny crimson bag, 2 clear blue bags. +bright magenta bags contain 4 shiny orange bags. +dotted brown bags contain 4 faded teal bags, 5 mirrored coral bags. +muted silver bags contain 5 striped black bags, 3 faded beige bags, 4 plaid crimson bags, 2 wavy brown bags. +wavy purple bags contain 1 dim brown bag, 1 bright yellow bag, 5 shiny lime bags. +dull plum bags contain 1 posh black bag, 4 vibrant fuchsia bags, 5 dull bronze bags. +dotted red bags contain 5 striped tomato bags, 4 shiny orange bags, 4 clear magenta bags, 5 pale coral bags. +light violet bags contain 2 bright beige bags, 5 mirrored plum bags, 3 wavy fuchsia bags, 1 clear tan bag. +dark teal bags contain 3 dull gray bags, 2 dark aqua bags, 1 clear beige bag. +light fuchsia bags contain 2 muted silver bags, 2 striped beige bags. +posh blue bags contain 5 striped olive bags, 5 dim coral bags. +light black bags contain 2 drab coral bags, 2 shiny indigo bags. +pale chartreuse bags contain 5 pale tomato bags. +drab gold bags contain 1 faded gold bag, 5 shiny gold bags. +posh bronze bags contain 2 drab aqua bags, 5 pale gray bags. +light tomato bags contain 5 wavy lime bags. +dull tan bags contain 3 drab blue bags, 4 dull green bags, 4 clear violet bags. +muted beige bags contain 5 clear white bags, 5 faded crimson bags. +faded fuchsia bags contain 5 plaid purple bags, 1 shiny silver bag, 4 muted violet bags. +bright green bags contain 5 dim teal bags, 5 shiny crimson bags, 5 clear crimson bags. +mirrored fuchsia bags contain 4 posh white bags, 5 wavy teal bags, 2 dark violet bags. +vibrant plum bags contain 2 posh yellow bags. +plaid bronze bags contain 4 dotted coral bags, 4 dull green bags, 2 plaid chartreuse bags. +plaid fuchsia bags contain 5 bright white bags. +dull red bags contain 2 mirrored fuchsia bags, 3 vibrant violet bags, 2 bright olive bags, 1 dim orange bag. +faded gray bags contain 1 dull purple bag, 2 posh salmon bags. +wavy plum bags contain 4 pale violet bags, 3 striped magenta bags, 4 pale red bags. +dark crimson bags contain 4 dim yellow bags, 1 dotted purple bag, 2 wavy indigo bags, 4 clear black bags. +pale cyan bags contain 5 shiny coral bags, 4 shiny beige bags, 2 plaid olive bags. +dull violet bags contain 3 wavy olive bags, 1 dull gray bag, 5 vibrant turquoise bags, 1 plaid purple bag. +wavy chartreuse bags contain 1 dotted magenta bag, 3 bright orange bags, 1 mirrored red bag. +dark cyan bags contain 5 dotted turquoise bags, 1 clear purple bag, 1 dim teal bag. +posh coral bags contain 3 muted bronze bags. +pale yellow bags contain 1 drab tomato bag. +plaid turquoise bags contain 1 muted gray bag. +dotted purple bags contain 5 posh silver bags, 4 dark salmon bags. +light indigo bags contain 4 mirrored red bags, 4 light olive bags. +faded plum bags contain 3 mirrored gold bags. +faded coral bags contain 5 dull tan bags. +clear indigo bags contain 5 mirrored magenta bags, 1 clear maroon bag, 1 bright blue bag, 5 light aqua bags. +dim cyan bags contain 5 plaid green bags. +dotted maroon bags contain 5 pale maroon bags, 2 dark indigo bags. +faded beige bags contain 1 plaid chartreuse bag. +striped indigo bags contain 1 dark gray bag, 3 drab olive bags. +clear yellow bags contain 4 dull gray bags, 1 muted green bag. +light lavender bags contain 4 pale coral bags, 2 light yellow bags, 2 light indigo bags. +light turquoise bags contain 5 pale fuchsia bags, 5 vibrant fuchsia bags, 5 vibrant magenta bags, 3 pale indigo bags. +light purple bags contain 2 light cyan bags. +bright gold bags contain 1 dark aqua bag. +muted bronze bags contain 2 light teal bags. +striped gray bags contain 2 light cyan bags, 1 pale black bag, 5 plaid plum bags. +wavy orange bags contain 2 pale coral bags, 2 dim coral bags. +wavy silver bags contain 2 posh white bags, 1 faded beige bag. +clear chartreuse bags contain 1 vibrant lime bag, 2 faded plum bags, 1 striped chartreuse bag, 5 clear maroon bags. +vibrant tan bags contain 3 striped lime bags, 4 pale maroon bags, 2 muted turquoise bags, 4 dark lime bags. +posh aqua bags contain 2 muted tan bags, 2 shiny blue bags, 2 posh purple bags. +bright orange bags contain no other bags. +drab coral bags contain no other bags. +light white bags contain 5 striped yellow bags. +wavy violet bags contain 1 pale silver bag, 2 shiny fuchsia bags, 1 vibrant violet bag, 1 shiny plum bag. +dark white bags contain 4 shiny maroon bags, 2 dim brown bags, 2 dark beige bags, 1 pale blue bag. +vibrant violet bags contain 4 striped blue bags, 1 mirrored lime bag, 1 posh white bag. +vibrant lavender bags contain 4 dotted magenta bags, 1 wavy red bag, 3 pale coral bags, 3 clear indigo bags. +dark purple bags contain 4 posh white bags. +mirrored lavender bags contain 5 clear brown bags, 2 faded gold bags. +striped silver bags contain 3 light yellow bags, 1 drab violet bag. +faded blue bags contain 3 muted violet bags, 4 wavy plum bags, 2 pale indigo bags, 1 wavy bronze bag. +drab cyan bags contain 4 dim tomato bags, 1 plaid lavender bag, 4 pale red bags, 2 drab olive bags. +clear lavender bags contain 3 wavy olive bags, 5 bright gray bags, 3 wavy beige bags, 2 dim violet bags. +striped aqua bags contain 3 mirrored lavender bags. +plaid tomato bags contain 2 posh cyan bags, 3 pale silver bags. +plaid salmon bags contain 1 muted lavender bag, 5 muted green bags, 3 bright aqua bags. +light blue bags contain 1 light white bag, 4 clear violet bags, 3 dark brown bags. +dark blue bags contain 5 posh aqua bags. +faded teal bags contain 3 light beige bags. +plaid chartreuse bags contain 4 wavy teal bags. +wavy gray bags contain 3 drab white bags, 2 muted lavender bags. +pale maroon bags contain 4 faded crimson bags, 4 vibrant chartreuse bags, 1 plaid green bag, 1 vibrant turquoise bag. +dark bronze bags contain 4 faded turquoise bags, 2 faded silver bags, 5 faded salmon bags. +pale coral bags contain 3 mirrored yellow bags, 4 dark plum bags, 2 dark aqua bags, 4 plaid white bags. +mirrored magenta bags contain 5 vibrant lime bags, 4 vibrant chartreuse bags, 3 striped aqua bags. +mirrored salmon bags contain 4 striped salmon bags, 1 posh tan bag, 3 faded bronze bags. +drab tan bags contain 5 vibrant violet bags. +vibrant indigo bags contain 1 pale coral bag, 1 light teal bag, 2 light magenta bags. +plaid lavender bags contain 1 striped silver bag, 1 clear lime bag. +muted plum bags contain 2 plaid crimson bags. +posh gray bags contain 5 mirrored lime bags. +clear maroon bags contain 5 wavy bronze bags, 3 dim gold bags, 2 muted beige bags, 5 posh coral bags. +striped maroon bags contain 2 dotted violet bags, 4 bright fuchsia bags, 4 striped aqua bags. +faded yellow bags contain 2 wavy teal bags, 3 wavy lavender bags. +posh black bags contain 1 drab silver bag, 2 clear white bags, 5 muted silver bags. +muted indigo bags contain 1 dark green bag, 1 plaid chartreuse bag, 3 bright indigo bags, 5 wavy silver bags. +wavy brown bags contain 5 faded red bags, 4 bright orange bags, 3 dim black bags. +vibrant coral bags contain 5 plaid white bags, 5 vibrant indigo bags. +wavy white bags contain 1 plaid green bag, 3 drab chartreuse bags, 1 posh white bag. +pale violet bags contain 2 shiny orange bags, 4 plaid crimson bags. +clear black bags contain 4 wavy blue bags, 5 plaid tan bags, 4 clear magenta bags. +faded aqua bags contain 2 wavy teal bags. +dotted green bags contain 5 shiny orange bags, 1 light magenta bag. +bright coral bags contain 2 shiny fuchsia bags, 4 light lime bags, 1 shiny gold bag. +vibrant fuchsia bags contain 1 vibrant chartreuse bag, 1 striped black bag. +dark turquoise bags contain 5 shiny salmon bags, 2 light lavender bags. +shiny green bags contain 1 pale silver bag, 4 dim red bags, 3 dark lime bags, 4 drab coral bags. +clear red bags contain 5 light teal bags, 5 posh brown bags. +dull gold bags contain 1 drab tan bag, 4 striped tomato bags, 5 pale maroon bags, 2 dim crimson bags. +mirrored red bags contain 3 shiny crimson bags, 4 plaid brown bags, 2 shiny black bags. +pale blue bags contain 1 wavy crimson bag, 4 faded beige bags, 4 shiny chartreuse bags. +clear beige bags contain 4 plaid crimson bags, 5 shiny crimson bags. +drab salmon bags contain 4 dim crimson bags, 3 light magenta bags, 1 clear violet bag. +vibrant magenta bags contain 4 dim black bags. +dark salmon bags contain 3 dull green bags, 4 faded red bags. +posh white bags contain no other bags. +light lime bags contain 5 dark aqua bags. +vibrant salmon bags contain 4 striped tomato bags, 4 clear aqua bags. +clear teal bags contain 3 striped gray bags. +plaid silver bags contain 3 vibrant violet bags, 2 muted magenta bags, 3 dark olive bags, 4 mirrored gold bags. +striped cyan bags contain 4 light gold bags, 2 dotted magenta bags. +wavy bronze bags contain 1 plaid crimson bag, 1 dull gray bag, 5 dull tan bags, 1 mirrored teal bag. +dim olive bags contain 4 vibrant lime bags, 2 shiny crimson bags, 2 muted turquoise bags. +dotted blue bags contain 4 vibrant gray bags, 2 shiny beige bags. +plaid blue bags contain 5 drab silver bags. +dark olive bags contain 1 pale coral bag, 4 vibrant indigo bags. +pale gray bags contain 3 dotted crimson bags, 1 striped magenta bag, 5 wavy white bags, 2 vibrant blue bags. +mirrored brown bags contain 2 bright cyan bags, 4 plaid brown bags, 5 faded turquoise bags. +wavy gold bags contain 1 wavy coral bag. +pale teal bags contain 3 vibrant magenta bags. +mirrored turquoise bags contain 4 mirrored olive bags, 5 bright yellow bags. +dark chartreuse bags contain 4 dotted cyan bags, 5 shiny turquoise bags, 5 vibrant salmon bags, 4 wavy yellow bags. +muted gray bags contain 3 dim orange bags. +posh turquoise bags contain 4 clear lavender bags, 5 dim coral bags, 2 striped salmon bags. +shiny cyan bags contain 4 striped gold bags. +drab olive bags contain 2 plaid cyan bags, 1 mirrored lime bag. +posh tomato bags contain 2 drab tan bags, 3 shiny orange bags. +muted fuchsia bags contain 1 pale salmon bag, 3 wavy violet bags, 3 mirrored maroon bags. +pale bronze bags contain 3 drab yellow bags, 3 muted chartreuse bags. +striped green bags contain 3 striped orange bags, 2 dull green bags, 3 vibrant tan bags. +faded orange bags contain 3 mirrored plum bags, 5 mirrored lime bags, 5 faded red bags. +dull aqua bags contain 2 striped coral bags. +dotted olive bags contain 4 faded salmon bags, 1 wavy green bag. +vibrant silver bags contain 4 mirrored yellow bags, 2 dotted salmon bags, 3 drab silver bags. +striped olive bags contain 1 mirrored fuchsia bag, 1 faded gold bag, 1 mirrored lavender bag. +dark violet bags contain no other bags. +mirrored olive bags contain 5 dull teal bags, 1 dim white bag. +plaid tan bags contain 4 pale gray bags, 2 dim crimson bags, 1 clear violet bag, 1 wavy lime bag. +pale tomato bags contain 5 posh green bags, 4 faded red bags. +dim turquoise bags contain 1 shiny gold bag, 5 drab blue bags. +muted lime bags contain 3 vibrant lime bags, 1 pale plum bag, 1 dark indigo bag. +drab beige bags contain 3 vibrant magenta bags. +posh beige bags contain 2 dark violet bags. +muted olive bags contain 2 pale brown bags, 5 light gray bags, 3 wavy green bags, 2 drab tan bags. +dim orange bags contain 1 clear lime bag, 4 faded beige bags, 2 mirrored fuchsia bags. +dull salmon bags contain 4 striped coral bags, 3 striped aqua bags. +dull maroon bags contain 3 clear brown bags, 5 dull magenta bags, 1 dim red bag. +mirrored coral bags contain 5 muted tan bags, 4 dotted magenta bags, 5 dim olive bags. +posh olive bags contain 4 dull magenta bags, 4 wavy blue bags, 2 drab yellow bags, 5 dotted gold bags. +mirrored violet bags contain 2 pale fuchsia bags. +drab bronze bags contain 4 drab chartreuse bags. +wavy fuchsia bags contain 2 dark gray bags, 5 muted silver bags. +pale plum bags contain 3 vibrant salmon bags, 5 drab chartreuse bags, 2 posh violet bags. +mirrored aqua bags contain 2 pale aqua bags. +bright silver bags contain 3 drab black bags, 5 dark salmon bags, 2 shiny beige bags, 2 posh lavender bags. +plaid lime bags contain 4 faded teal bags, 5 pale brown bags, 5 dim red bags. +dotted turquoise bags contain 3 dim olive bags, 2 mirrored blue bags, 3 dull lime bags, 4 vibrant lavender bags. +drab maroon bags contain 5 bright red bags. +wavy lavender bags contain 1 striped lime bag, 1 posh brown bag. +shiny beige bags contain 5 shiny aqua bags, 3 muted teal bags, 5 clear gold bags. +dark gold bags contain 4 clear maroon bags, 2 dotted maroon bags, 3 light red bags. +light aqua bags contain 2 dim red bags, 3 pale red bags. +posh teal bags contain 3 muted brown bags, 5 shiny gold bags, 5 dotted purple bags. +dull lavender bags contain 5 shiny blue bags. +dark tan bags contain 1 muted tan bag, 5 vibrant turquoise bags, 4 dark violet bags, 4 muted plum bags. +light beige bags contain 2 mirrored fuchsia bags, 1 drab chartreuse bag, 1 muted tan bag. +pale olive bags contain 3 clear brown bags. +dark maroon bags contain 5 dull plum bags, 3 muted green bags. +muted red bags contain 4 pale tan bags, 1 bright white bag. +light tan bags contain 3 light purple bags, 2 pale aqua bags, 3 wavy bronze bags. +clear magenta bags contain 3 vibrant chartreuse bags, 1 dim crimson bag. +dark orange bags contain 2 posh cyan bags, 1 wavy brown bag, 5 dull black bags. +dim lavender bags contain 5 drab fuchsia bags. +dotted beige bags contain 5 light blue bags, 4 plaid tan bags, 2 wavy maroon bags, 5 dim crimson bags. +dim green bags contain 3 plaid tan bags, 1 drab blue bag, 1 clear aqua bag. +plaid brown bags contain 3 muted turquoise bags, 4 drab chartreuse bags. +bright black bags contain 5 striped white bags. +plaid gold bags contain 3 shiny lime bags, 1 plaid maroon bag, 4 bright blue bags. +pale white bags contain 4 drab chartreuse bags, 3 pale tan bags, 5 pale aqua bags. +drab violet bags contain no other bags. +light magenta bags contain 3 faded crimson bags. +light gold bags contain 1 dim lavender bag, 3 light magenta bags, 5 drab gold bags. +plaid coral bags contain 1 vibrant salmon bag, 3 striped tomato bags, 3 posh blue bags. +dotted white bags contain 1 wavy lavender bag. +striped yellow bags contain 4 drab black bags, 2 faded red bags, 2 shiny gold bags, 4 dark aqua bags. +dark yellow bags contain 5 wavy bronze bags, 5 bright purple bags. +faded white bags contain 3 light tomato bags. +muted white bags contain 5 faded gold bags, 1 plaid magenta bag, 3 drab white bags, 5 dim brown bags. +faded red bags contain 1 posh brown bag, 2 muted turquoise bags, 3 plaid crimson bags, 4 shiny orange bags. +dark red bags contain 5 shiny salmon bags. +dull gray bags contain 2 posh white bags. +bright salmon bags contain 2 shiny aqua bags, 3 dotted crimson bags, 1 drab violet bag, 4 pale chartreuse bags. +mirrored chartreuse bags contain 1 vibrant magenta bag, 3 plaid salmon bags, 1 plaid chartreuse bag, 3 muted violet bags. +vibrant orange bags contain 5 posh yellow bags. +dark gray bags contain 1 plaid chartreuse bag, 2 drab violet bags, 1 bright chartreuse bag, 1 muted purple bag. +mirrored crimson bags contain 3 drab coral bags, 5 dull lime bags. +muted violet bags contain 3 dotted crimson bags, 3 light olive bags. +shiny brown bags contain 2 dark lavender bags, 2 vibrant yellow bags, 1 dark black bag, 2 drab olive bags. +muted green bags contain 1 dull cyan bag, 5 dull red bags, 4 pale chartreuse bags. +drab yellow bags contain 3 pale tomato bags. +dotted tomato bags contain 2 shiny magenta bags, 3 mirrored tomato bags, 5 plaid chartreuse bags. +plaid red bags contain 3 pale cyan bags. +bright red bags contain 1 shiny beige bag. +plaid purple bags contain 5 dull gold bags. +dark green bags contain 3 pale salmon bags, 3 dim brown bags, 2 wavy violet bags, 2 pale chartreuse bags. +plaid orange bags contain 1 vibrant chartreuse bag, 2 dotted coral bags, 1 posh teal bag. +plaid violet bags contain 1 shiny maroon bag. +posh tan bags contain 1 shiny beige bag, 2 dim magenta bags, 1 dark violet bag. +bright aqua bags contain 1 drab brown bag, 4 dotted purple bags. +vibrant white bags contain 4 light gray bags, 2 dark fuchsia bags, 1 pale cyan bag. +striped red bags contain 5 faded gold bags, 5 drab crimson bags, 3 faded turquoise bags. +dull purple bags contain 1 pale crimson bag. +shiny blue bags contain 1 pale violet bag, 5 mirrored plum bags, 3 posh white bags, 1 light yellow bag. +clear salmon bags contain 2 striped lime bags, 1 dull violet bag. +faded gold bags contain 3 light teal bags, 3 wavy teal bags. +mirrored yellow bags contain 2 muted turquoise bags, 4 drab chartreuse bags. +plaid gray bags contain 4 plaid plum bags. +plaid white bags contain no other bags. +drab black bags contain 2 mirrored yellow bags, 2 drab chartreuse bags, 1 shiny orange bag. +dotted chartreuse bags contain 2 vibrant cyan bags, 2 light salmon bags, 3 vibrant red bags, 5 light turquoise bags. +faded lavender bags contain 3 dark tomato bags, 5 muted lime bags, 4 light fuchsia bags, 4 dull lavender bags. +vibrant cyan bags contain 2 clear crimson bags, 3 pale orange bags, 4 dull indigo bags, 3 light red bags. +bright maroon bags contain 2 muted tan bags, 2 light teal bags. +drab silver bags contain 3 bright chartreuse bags, 4 pale crimson bags, 5 dotted crimson bags, 5 faded yellow bags. +drab purple bags contain 5 drab blue bags. +dim gold bags contain 1 bright cyan bag, 5 dull white bags, 3 vibrant blue bags. +dark beige bags contain 4 pale coral bags, 1 pale indigo bag. +dotted salmon bags contain 2 drab violet bags, 5 posh white bags. +vibrant crimson bags contain 5 faded teal bags, 3 dotted green bags, 1 clear maroon bag. +dim chartreuse bags contain 3 clear white bags. +bright violet bags contain 1 dim yellow bag, 1 muted purple bag, 4 muted teal bags, 5 striped cyan bags. +dim magenta bags contain 1 pale aqua bag, 4 pale maroon bags, 5 mirrored red bags, 4 drab yellow bags. +dim brown bags contain 5 faded salmon bags, 4 dotted magenta bags, 5 drab tomato bags, 2 faded teal bags. +shiny lime bags contain 5 dotted black bags, 4 plaid turquoise bags, 2 dim tomato bags, 2 clear magenta bags. +drab magenta bags contain 3 dark beige bags. +faded cyan bags contain 2 striped lime bags, 4 bright red bags. +dark brown bags contain 4 mirrored lime bags, 1 bright orange bag. +posh fuchsia bags contain 5 shiny gold bags, 5 pale salmon bags, 1 light coral bag, 1 mirrored plum bag. +shiny magenta bags contain 4 dark aqua bags. +dark lavender bags contain 1 pale purple bag, 3 vibrant yellow bags. +vibrant brown bags contain 2 posh teal bags, 1 wavy silver bag, 2 pale plum bags. +muted black bags contain 5 faded crimson bags, 3 dim crimson bags, 4 vibrant magenta bags. +muted brown bags contain 5 striped olive bags, 5 dark brown bags, 2 clear brown bags, 4 plaid white bags. +pale orange bags contain 4 bright blue bags, 3 dark aqua bags, 1 clear gold bag. +light cyan bags contain 3 muted silver bags. +drab white bags contain 2 drab tan bags, 2 striped tomato bags, 4 dull gray bags, 5 drab blue bags. +dim tan bags contain 3 mirrored bronze bags, 3 faded salmon bags, 4 drab purple bags. +dull tomato bags contain 3 clear lime bags. +wavy aqua bags contain 3 dotted orange bags, 5 shiny crimson bags. +shiny lavender bags contain 5 vibrant blue bags, 4 pale purple bags, 1 wavy bronze bag, 2 posh violet bags. +shiny white bags contain 5 faded blue bags, 5 pale cyan bags. +wavy blue bags contain 4 vibrant chartreuse bags, 4 plaid brown bags, 3 plaid white bags, 2 faded gold bags. +striped magenta bags contain 2 dark olive bags, 5 bright chartreuse bags. +vibrant black bags contain 4 plaid white bags, 2 dull silver bags, 5 striped purple bags, 1 dark plum bag. +dull green bags contain 2 dull crimson bags. +vibrant chartreuse bags contain 2 bright orange bags, 4 dark aqua bags. +dim violet bags contain 2 dark teal bags, 4 plaid brown bags, 4 mirrored yellow bags. +clear blue bags contain 5 posh maroon bags. +faded tomato bags contain 5 clear beige bags, 4 bright orange bags. +posh violet bags contain 3 clear gold bags. +striped tomato bags contain 2 shiny black bags. +muted crimson bags contain 4 light aqua bags, 3 dim gold bags. +clear tan bags contain 4 drab tomato bags, 4 mirrored bronze bags, 1 shiny chartreuse bag. +posh magenta bags contain 4 posh red bags, 3 light bronze bags. +dim blue bags contain 5 dim gray bags, 1 light turquoise bag, 5 muted bronze bags. +drab plum bags contain 1 vibrant plum bag, 4 striped coral bags. +pale silver bags contain 5 drab black bags. +posh purple bags contain 2 dark brown bags. +drab indigo bags contain 1 muted lavender bag, 2 posh salmon bags, 1 pale brown bag. +striped blue bags contain 4 wavy teal bags. +wavy magenta bags contain 1 dotted salmon bag, 1 drab black bag, 2 dull tan bags, 1 drab silver bag. +pale turquoise bags contain 4 dark lime bags, 4 drab maroon bags. +shiny tan bags contain 4 plaid coral bags, 3 dim black bags, 1 dull plum bag. +light teal bags contain 3 dark violet bags. +mirrored silver bags contain 1 striped salmon bag, 1 clear chartreuse bag, 2 clear orange bags, 2 posh aqua bags. +wavy coral bags contain 2 muted teal bags, 1 wavy white bag. +wavy crimson bags contain 1 shiny aqua bag, 3 muted beige bags. +shiny bronze bags contain 1 posh indigo bag, 5 wavy blue bags, 1 faded gold bag, 3 striped tomato bags. +shiny maroon bags contain 1 clear tomato bag, 1 wavy crimson bag. +bright turquoise bags contain 3 dull tan bags, 3 vibrant teal bags. +faded purple bags contain 1 plaid chartreuse bag. +bright white bags contain 2 faded gold bags. +clear orange bags contain 4 striped blue bags, 2 mirrored lime bags, 5 muted turquoise bags. +clear cyan bags contain 1 dim plum bag, 3 shiny brown bags, 1 muted purple bag, 2 plaid lime bags. +plaid teal bags contain 2 faded aqua bags, 4 wavy olive bags. +dotted lime bags contain 5 posh olive bags, 2 pale orange bags. +muted tan bags contain 1 dull gray bag, 2 dark aqua bags, 1 pale violet bag. +striped orange bags contain 3 mirrored lime bags, 2 dull crimson bags, 4 faded gold bags, 3 pale silver bags. +light olive bags contain 2 dark tan bags, 3 dim orange bags, 5 mirrored yellow bags. +plaid magenta bags contain 2 wavy orange bags, 1 wavy chartreuse bag, 5 striped coral bags. +dark magenta bags contain 3 bright white bags, 3 plaid purple bags, 3 striped black bags, 4 light beige bags. +dark black bags contain 3 pale tan bags, 4 mirrored orange bags, 3 dull teal bags. +posh orange bags contain 4 bright aqua bags, 1 dim crimson bag, 4 dim turquoise bags, 1 dotted bronze bag. +dull crimson bags contain 4 vibrant violet bags. +clear turquoise bags contain 1 muted brown bag, 2 dull yellow bags, 3 pale black bags, 1 plaid crimson bag. +vibrant blue bags contain 2 clear beige bags. +dull lime bags contain 4 shiny plum bags, 3 vibrant magenta bags, 3 dark olive bags. +drab brown bags contain 4 clear green bags. +mirrored plum bags contain 2 faded red bags. +shiny fuchsia bags contain 2 muted cyan bags, 4 dark aqua bags, 3 light olive bags, 2 clear gold bags. +vibrant purple bags contain 3 pale aqua bags, 3 dark lime bags, 1 bright chartreuse bag. +bright crimson bags contain 1 vibrant gold bag. +shiny plum bags contain 2 clear olive bags, 4 dark plum bags. +shiny crimson bags contain no other bags. +dull beige bags contain 1 mirrored coral bag. +dim salmon bags contain 1 clear tomato bag, 2 shiny teal bags, 4 plaid olive bags, 3 plaid purple bags. +muted maroon bags contain 2 muted violet bags, 4 dark white bags. +pale aqua bags contain 4 dark beige bags, 1 muted brown bag. +bright plum bags contain 4 dim black bags. +striped tan bags contain 3 bright orange bags, 3 dark violet bags, 4 drab blue bags, 2 vibrant lime bags. +clear crimson bags contain 3 wavy brown bags, 1 faded blue bag, 2 striped cyan bags. +dim indigo bags contain 3 dotted lime bags, 1 dotted purple bag. +pale tan bags contain 2 drab blue bags, 5 dim orange bags, 5 wavy olive bags, 3 striped tomato bags. +vibrant bronze bags contain 5 clear red bags, 5 posh red bags. +dotted bronze bags contain 1 light yellow bag. +wavy salmon bags contain 2 striped olive bags, 4 muted teal bags. +shiny turquoise bags contain 3 dark teal bags, 1 plaid yellow bag. +faded maroon bags contain 1 vibrant salmon bag, 5 dotted magenta bags, 1 faded tan bag, 5 striped tomato bags. +vibrant teal bags contain 4 light teal bags, 3 pale orange bags, 5 drab white bags. +vibrant gold bags contain 1 muted cyan bag, 2 mirrored plum bags, 1 drab coral bag, 4 dark lime bags. +bright cyan bags contain 2 muted silver bags, 5 plaid bronze bags, 3 light beige bags, 2 faded crimson bags. +shiny silver bags contain 4 mirrored fuchsia bags, 2 clear violet bags, 3 faded beige bags. +dark tomato bags contain 4 clear lime bags, 2 light beige bags, 3 bright turquoise bags. +mirrored indigo bags contain 5 posh chartreuse bags, 5 clear tomato bags. +dotted indigo bags contain 2 drab olive bags, 2 dim indigo bags, 5 dotted magenta bags. +shiny gray bags contain 4 muted chartreuse bags, 4 plaid gray bags, 3 dull red bags, 5 striped orange bags. +dim yellow bags contain 1 muted cyan bag, 4 mirrored fuchsia bags, 1 faded gold bag, 1 drab turquoise bag. +bright lime bags contain 5 shiny bronze bags, 3 wavy aqua bags, 4 plaid turquoise bags. +dotted gray bags contain 2 shiny gold bags. +striped black bags contain 1 wavy teal bag, 5 dim chartreuse bags, 4 mirrored lavender bags. +pale beige bags contain 2 posh black bags, 4 clear white bags. +posh indigo bags contain 5 plaid white bags. +dull blue bags contain 4 dark violet bags, 2 clear magenta bags, 4 dotted crimson bags. +mirrored white bags contain 5 faded yellow bags. +bright brown bags contain 3 pale gray bags. +light gray bags contain 3 clear magenta bags, 5 wavy brown bags, 3 dotted salmon bags. +muted orange bags contain 1 bright magenta bag, 1 bright plum bag. +clear purple bags contain 1 shiny gold bag, 1 dark white bag. +striped coral bags contain 5 pale gray bags, 3 wavy chartreuse bags. +plaid green bags contain no other bags. +plaid maroon bags contain 5 posh brown bags, 3 striped crimson bags, 4 plaid green bags. +light maroon bags contain 3 muted gray bags, 5 dull crimson bags, 2 shiny maroon bags. +pale purple bags contain 2 striped white bags, 3 plaid chartreuse bags, 1 mirrored lime bag. +muted yellow bags contain 5 vibrant purple bags, 1 dark teal bag. +plaid olive bags contain 1 light crimson bag, 1 faded gold bag, 1 vibrant blue bag. +dim beige bags contain 4 muted silver bags, 3 mirrored beige bags, 4 striped violet bags. +striped chartreuse bags contain 3 dull teal bags. +muted salmon bags contain 2 posh salmon bags, 2 posh silver bags. +dim red bags contain 2 drab blue bags, 4 plaid crimson bags, 3 vibrant gold bags. +dull magenta bags contain 5 faded crimson bags, 1 shiny orange bag, 1 dark tan bag. +plaid beige bags contain 1 vibrant turquoise bag. +striped teal bags contain 2 dim chartreuse bags, 4 dark green bags. +dotted plum bags contain 2 light cyan bags. +dotted yellow bags contain 5 posh black bags, 5 dull tan bags, 2 dull violet bags, 5 muted plum bags. +dotted coral bags contain 1 striped tomato bag, 2 light crimson bags, 3 clear violet bags. +dull fuchsia bags contain 3 plaid purple bags, 4 mirrored red bags. +dull yellow bags contain 5 vibrant violet bags, 2 dark olive bags. +dull white bags contain 5 posh olive bags, 5 pale tomato bags, 2 bright teal bags. +pale brown bags contain 3 dim crimson bags, 3 pale indigo bags, 1 dim chartreuse bag, 4 muted teal bags. +shiny violet bags contain 1 muted tomato bag, 2 dull yellow bags, 1 drab teal bag. +drab blue bags contain 3 vibrant gold bags, 4 drab black bags. +posh lavender bags contain 5 shiny plum bags, 3 drab salmon bags, 4 dim brown bags, 4 plaid blue bags. +dull teal bags contain 2 drab turquoise bags, 1 shiny crimson bag, 5 shiny aqua bags. +shiny purple bags contain 3 drab orange bags, 4 dark red bags, 4 vibrant fuchsia bags, 2 light fuchsia bags. +pale salmon bags contain 2 plaid chartreuse bags, 3 striped white bags. +posh silver bags contain 4 clear magenta bags, 5 light magenta bags. +light salmon bags contain 4 vibrant olive bags. +striped turquoise bags contain 1 faded magenta bag, 3 shiny indigo bags, 4 striped lavender bags. +dotted crimson bags contain 2 pale silver bags, 2 striped magenta bags, 1 striped white bag. +dull brown bags contain 5 clear crimson bags, 1 dotted green bag, 4 dull magenta bags, 3 dim tan bags. +plaid cyan bags contain 1 striped orange bag, 2 muted cyan bags. +muted lavender bags contain 5 mirrored fuchsia bags. +dim lime bags contain 1 muted black bag. +light bronze bags contain 1 dull crimson bag, 5 dim chartreuse bags. +dull olive bags contain 2 vibrant coral bags, 3 shiny teal bags, 4 plaid purple bags. +posh yellow bags contain 5 dark lime bags, 3 mirrored plum bags. +bright fuchsia bags contain 1 striped silver bag. +posh maroon bags contain 4 dotted magenta bags, 4 posh yellow bags, 2 drab beige bags. +posh salmon bags contain 2 muted green bags. +mirrored gray bags contain 4 striped silver bags. +dull cyan bags contain 2 bright orange bags, 4 dark plum bags. +light crimson bags contain 3 drab fuchsia bags, 3 bright blue bags, 1 dark purple bag. +light red bags contain 3 dim maroon bags, 4 muted green bags, 3 dotted olive bags. +dull indigo bags contain 2 plaid brown bags, 1 wavy white bag, 2 vibrant turquoise bags, 5 drab chartreuse bags. +drab crimson bags contain 2 vibrant salmon bags. +posh red bags contain 3 mirrored violet bags, 1 striped tomato bag, 2 striped olive bags. +drab chartreuse bags contain no other bags. +posh lime bags contain 3 drab violet bags, 1 bright coral bag. +wavy red bags contain 4 striped gray bags, 3 posh salmon bags, 1 dotted violet bag, 3 striped aqua bags. +striped fuchsia bags contain 3 bright crimson bags, 3 dark silver bags, 1 clear magenta bag, 3 drab salmon bags. +striped plum bags contain 2 drab tan bags, 5 pale gold bags, 1 dull white bag, 1 clear coral bag. +mirrored maroon bags contain 1 dark magenta bag, 1 plaid purple bag, 2 light gray bags. +shiny indigo bags contain 2 drab teal bags. +dim silver bags contain 1 striped aqua bag, 3 dull tan bags, 3 striped tan bags, 2 wavy maroon bags. +shiny salmon bags contain 5 faded beige bags. +dull black bags contain 3 vibrant plum bags, 2 plaid chartreuse bags, 1 muted brown bag, 2 clear tomato bags. +clear plum bags contain 3 striped maroon bags, 2 dark white bags. +vibrant green bags contain 5 light orange bags, 5 mirrored magenta bags, 3 bright teal bags, 2 striped brown bags. +drab gray bags contain 1 plaid maroon bag, 2 pale tan bags, 1 plaid white bag. +wavy lime bags contain 2 clear gold bags, 2 bright chartreuse bags, 1 faded crimson bag. +light silver bags contain 4 dim maroon bags, 1 mirrored teal bag. +light brown bags contain 5 muted magenta bags. +dim fuchsia bags contain 5 pale purple bags, 5 wavy orange bags, 5 clear lime bags. +vibrant maroon bags contain 4 light gray bags. +dim purple bags contain 2 muted white bags, 2 shiny aqua bags. +clear olive bags contain 3 bright olive bags. +drab lavender bags contain 4 mirrored crimson bags, 3 bright violet bags, 5 posh gold bags, 2 bright olive bags. +light yellow bags contain 1 posh brown bag, 2 pale violet bags. +plaid crimson bags contain 1 plaid green bag, 3 shiny crimson bags. +pale indigo bags contain 3 clear aqua bags, 2 pale silver bags. +mirrored bronze bags contain 4 muted tomato bags, 4 bright white bags, 1 faded crimson bag. +dim teal bags contain 1 muted salmon bag. +clear violet bags contain 2 dim coral bags, 2 faded beige bags. +dotted silver bags contain 2 posh plum bags, 4 pale chartreuse bags. +pale gold bags contain 2 vibrant gold bags, 1 dotted magenta bag. +posh crimson bags contain 4 dull yellow bags, 3 clear fuchsia bags. +dull orange bags contain 3 dull silver bags, 3 clear violet bags, 4 clear chartreuse bags, 3 faded salmon bags. +striped lime bags contain 5 mirrored plum bags, 4 faded gold bags, 3 wavy white bags, 3 light teal bags. +mirrored tan bags contain 4 dull silver bags, 4 light coral bags, 2 plaid lavender bags. +wavy tomato bags contain 4 clear orange bags, 5 shiny fuchsia bags, 3 light red bags. +dotted teal bags contain 5 dark salmon bags, 1 light indigo bag, 4 pale white bags, 5 clear olive bags. +bright olive bags contain 1 dark tan bag, 4 striped orange bags, 3 bright orange bags. +plaid plum bags contain 1 shiny maroon bag, 1 dotted coral bag. +bright chartreuse bags contain 2 wavy blue bags. \ No newline at end of file diff --git a/2020/7/prog.py b/2020/7/prog.py new file mode 100644 index 0000000..bd05c43 --- /dev/null +++ b/2020/7/prog.py @@ -0,0 +1,79 @@ +import re +import json + + +my_bag = "shiny gold" + +def get_input(sample = False, sample_number: int = 1): + with open("sample_%d" % sample_number if sample else "input", "r") as f: + return [line.strip() for line in f.readlines()] + +def split_n_bags(string: str): + zero_bags = "no other" + + if string == zero_bags: + return "", 0 + + for i in range(len(string)): + if string[i] == " ": + return string[i+1:], int(string[:i]) + +def parse_input(lines: list): + ret = {} + bag_re = re.compile(" ?bags?[ ,.]?") + + for line in lines: + outer, inner = line.split("contain ") + + outer = bag_re.sub("", outer) + inner = [bag_re.sub("", x) for x in inner.split(", ")] + + if outer not in ret: + ret[outer] = {} + + children = {} + for items in inner: + bag, n = split_n_bags(items) + if n != 0: + children[bag] = n + + if len(children) > 0: + ret[outer]["children"] = children + + for child in children: + if child not in ret: ret[child] = {} + + if "parents" not in ret[child]: ret[child]["parents"] = set() + ret[child]["parents"].add(outer) + return ret + +def fetch_parents_of(child: str, data: dict): + if "parents" not in data[child]: + return [child] + parents = data[child]["parents"] + + parents_total = [child] if child != my_bag else [] + for parent in parents: + parents_total.extend(fetch_parents_of(parent, data)) + + return parents_total + +def count_parents_of(child: str, data: dict): + return len(set(fetch_parents_of(child, data))) + +def count_children_of(parent: str, data: dict): + if "children" not in data[parent]: + return 0 + children = data[parent]["children"] + + return sum([number + number * count_children_of(child, data) for child, number in children.items()]) + + +def get_result(data: dict, sample: bool = False, part: int = 1): + if part == 1: + return count_parents_of(my_bag, data) + else: + return count_children_of(my_bag, data) + +if __name__ == "__main__": + print(get_result(parse_input(get_input()), part = 2)) diff --git a/2020/7/sample_1 b/2020/7/sample_1 new file mode 100644 index 0000000..e7ba02e --- /dev/null +++ b/2020/7/sample_1 @@ -0,0 +1,9 @@ +light red bags contain 1 bright white bag, 2 muted yellow bags. +dark orange bags contain 3 bright white bags, 4 muted yellow bags. +bright white bags contain 1 shiny gold bag. +muted yellow bags contain 2 shiny gold bags, 9 faded blue bags. +shiny gold bags contain 1 dark olive bag, 2 vibrant plum bags. +dark olive bags contain 3 faded blue bags, 4 dotted black bags. +vibrant plum bags contain 5 faded blue bags, 6 dotted black bags. +faded blue bags contain no other bags. +dotted black bags contain no other bags. \ No newline at end of file diff --git a/2020/7/sample_2 b/2020/7/sample_2 new file mode 100644 index 0000000..38b2f50 --- /dev/null +++ b/2020/7/sample_2 @@ -0,0 +1,7 @@ +shiny gold bags contain 2 dark red bags. +dark red bags contain 2 dark orange bags. +dark orange bags contain 2 dark yellow bags. +dark yellow bags contain 2 dark green bags. +dark green bags contain 2 dark blue bags. +dark blue bags contain 2 dark violet bags. +dark violet bags contain no other bags. \ No newline at end of file diff --git a/2020/7/test.py b/2020/7/test.py new file mode 100644 index 0000000..53db106 --- /dev/null +++ b/2020/7/test.py @@ -0,0 +1,26 @@ +from prog import * +import yaml + +inp_1 = parse_input(get_input(sample = True)) +inp_2 = parse_input(get_input(sample = True, sample_number = 2)) + + +result_1 = get_result(inp_1) +print(f"{result_1 = }") +print(f"{result_1 == 4}") +print() + + +# print(yaml.dump(inp_1)) +result_2_1 = get_result(inp_1, part = 2) + +print(f"{result_2_1 = }") +print(f"{result_2_1 == 32}") +print() + +# print(yaml.dump(inp_2)) +result_2_2 = get_result(inp_2, part = 2) +print(f"{result_2_2 = }") +print(f"{result_2_2 == 126}") +print() + diff --git a/2020/8/__pycache__/prog.cpython-38.pyc b/2020/8/__pycache__/prog.cpython-38.pyc new file mode 100644 index 0000000..3762f19 Binary files /dev/null and b/2020/8/__pycache__/prog.cpython-38.pyc differ diff --git a/2020/8/input b/2020/8/input new file mode 100644 index 0000000..53bc576 --- /dev/null +++ b/2020/8/input @@ -0,0 +1,654 @@ +acc +45 +nop +631 +acc +12 +acc -10 +jmp +127 +acc +28 +jmp +460 +jmp +619 +acc +15 +jmp +277 +nop +83 +acc +40 +acc +34 +acc +15 +jmp +108 +acc +10 +nop +61 +jmp +485 +jmp +44 +acc +3 +jmp +460 +acc +46 +acc +32 +jmp +12 +acc -1 +jmp +213 +acc +40 +acc +4 +nop +97 +acc +18 +jmp +613 +acc +15 +acc +14 +nop +374 +jmp +487 +jmp +1 +acc -1 +acc +32 +jmp +1 +jmp +418 +acc +10 +acc -9 +jmp +1 +jmp +117 +acc -5 +nop +539 +nop +456 +jmp +191 +acc +16 +jmp +431 +jmp +341 +acc -17 +acc +22 +acc +33 +acc +15 +jmp +152 +nop +277 +jmp +394 +acc -13 +acc +49 +acc -19 +jmp -26 +acc -5 +acc +13 +jmp +49 +acc +37 +acc +49 +nop +420 +acc +38 +jmp +515 +nop +168 +acc +22 +nop +151 +acc +25 +jmp +504 +acc -16 +jmp +73 +acc -6 +acc +40 +acc +9 +jmp +143 +acc +40 +acc -6 +acc +31 +nop +530 +jmp +265 +acc -13 +acc +40 +jmp +312 +acc +36 +jmp -55 +jmp +430 +jmp +551 +acc +10 +acc +18 +nop -25 +jmp +178 +acc +22 +jmp +176 +jmp +462 +acc +22 +acc +23 +acc +3 +acc +0 +jmp +162 +acc +0 +acc +27 +jmp +100 +nop +234 +acc +3 +nop +70 +nop +112 +jmp -62 +acc +8 +jmp +214 +jmp -38 +acc -15 +acc +48 +jmp +289 +nop +6 +nop +523 +jmp +286 +nop -9 +jmp +234 +jmp -74 +acc +33 +acc +14 +nop -11 +jmp -37 +acc +30 +jmp +277 +acc +35 +acc +4 +jmp +96 +acc +26 +nop +256 +acc -14 +jmp +389 +acc -19 +acc -12 +jmp +397 +jmp +477 +nop +141 +acc +21 +acc +16 +nop +29 +jmp +407 +acc +48 +jmp +243 +acc +43 +acc +41 +nop +384 +acc +24 +jmp +180 +jmp +372 +jmp +44 +acc +4 +nop +234 +acc +49 +jmp +343 +acc +0 +jmp -91 +acc -8 +acc +26 +jmp -9 +acc +37 +nop +321 +jmp +143 +jmp +278 +jmp -38 +acc +46 +nop +67 +acc +32 +jmp +445 +nop +143 +acc +35 +acc -19 +acc +33 +jmp +39 +jmp -24 +nop +393 +acc +0 +acc +36 +acc +44 +jmp -134 +acc +31 +acc +37 +acc +5 +acc -1 +jmp +291 +acc +37 +acc +36 +acc -3 +jmp -183 +acc -10 +acc +29 +acc +7 +acc +32 +jmp +205 +acc +38 +acc +20 +jmp +45 +acc +26 +acc +0 +acc +17 +acc +37 +jmp +289 +acc +20 +acc +6 +acc +18 +jmp -50 +acc +41 +acc +50 +jmp +419 +acc +20 +jmp +333 +jmp +250 +acc +35 +acc +13 +jmp -175 +acc -4 +nop +179 +jmp -57 +jmp +243 +acc -6 +acc +23 +nop -149 +jmp +1 +jmp -97 +acc -14 +acc +26 +acc +5 +nop +6 +jmp -223 +acc +12 +nop +115 +acc +38 +jmp -77 +acc +1 +acc +25 +acc +0 +jmp +276 +acc +37 +acc +31 +acc +7 +jmp +201 +acc +16 +acc +39 +acc +24 +jmp +54 +acc +45 +nop -96 +acc +17 +acc -7 +jmp +339 +acc +6 +jmp +317 +acc +12 +acc -1 +acc -4 +acc +14 +jmp +89 +acc +2 +acc +30 +jmp +60 +jmp +239 +acc +25 +acc -9 +jmp +82 +acc +45 +jmp +1 +nop +3 +jmp +1 +jmp +311 +jmp +142 +acc +36 +nop +253 +jmp +341 +acc +26 +acc +32 +acc +30 +jmp -182 +jmp +184 +jmp +331 +acc +6 +jmp -68 +nop -209 +acc +1 +acc +48 +jmp -23 +acc +11 +acc +30 +acc +45 +acc -3 +jmp -238 +jmp +1 +acc +9 +jmp +45 +acc +45 +jmp +1 +acc +44 +acc +29 +jmp -73 +acc -4 +acc +0 +acc +0 +jmp +294 +acc +35 +acc +21 +jmp +309 +nop +316 +acc -13 +jmp +1 +jmp +324 +acc -14 +acc +42 +jmp -99 +nop -103 +acc +16 +jmp -226 +nop +317 +nop +316 +acc -16 +jmp -192 +acc +33 +nop -47 +jmp -305 +jmp -81 +nop -197 +nop +249 +jmp +157 +nop -85 +jmp -246 +acc +8 +acc -14 +acc +20 +jmp -181 +acc +46 +nop +164 +acc +12 +acc -18 +jmp -199 +acc +10 +acc -9 +acc +17 +acc +15 +jmp +134 +acc -17 +acc -3 +jmp +18 +acc +35 +acc -14 +jmp +254 +acc -4 +acc +41 +acc +45 +jmp -346 +acc -18 +acc +41 +acc +48 +acc +27 +jmp -33 +acc -1 +acc -3 +acc +11 +acc -13 +jmp -224 +acc +22 +nop -73 +acc -12 +acc -18 +jmp +213 +jmp +1 +acc +39 +acc +19 +jmp +66 +jmp +126 +acc +37 +acc -17 +acc +17 +jmp -4 +acc -6 +acc +18 +acc +9 +acc -7 +jmp -195 +acc +33 +acc +24 +acc +25 +acc -19 +jmp -340 +acc +40 +acc +10 +acc +23 +jmp -308 +jmp +1 +acc +9 +jmp +1 +nop +104 +jmp +233 +jmp -24 +acc +29 +jmp -367 +acc -15 +jmp +107 +acc +12 +jmp +89 +nop -381 +jmp +1 +acc -2 +nop +233 +jmp +238 +acc +46 +acc -15 +acc +47 +jmp -290 +nop -323 +acc -9 +acc -6 +acc +0 +jmp -315 +acc +21 +nop +196 +acc +24 +acc +18 +jmp -49 +acc +21 +jmp +1 +jmp -47 +acc +49 +nop -120 +jmp -413 +acc +30 +jmp -284 +acc -17 +jmp -212 +nop +39 +nop -87 +acc -18 +jmp -122 +jmp -90 +nop +76 +jmp -277 +acc +34 +acc +49 +jmp +92 +nop +168 +acc -1 +acc +0 +jmp +26 +jmp -270 +jmp +1 +acc +14 +acc +11 +jmp +41 +acc -15 +jmp +144 +jmp +149 +acc +48 +jmp -260 +acc +27 +acc -3 +jmp +105 +acc +47 +acc -10 +jmp -316 +acc -4 +acc +41 +acc -3 +nop -289 +jmp -332 +nop -281 +nop -379 +nop +62 +jmp -456 +acc +34 +acc +23 +jmp +52 +acc +7 +jmp -374 +acc -18 +acc +45 +jmp +53 +acc +29 +nop -407 +acc +34 +jmp +9 +acc +49 +acc -1 +acc -1 +jmp +1 +jmp -55 +acc -3 +acc +5 +jmp -280 +jmp +1 +acc -13 +nop -173 +jmp -131 +acc +5 +acc +34 +jmp +105 +jmp -56 +jmp -485 +acc -14 +nop -389 +acc +13 +acc +27 +jmp -482 +nop -418 +jmp -394 +acc -9 +jmp -435 +acc -14 +nop -172 +acc +43 +jmp -159 +jmp +67 +acc +9 +acc +22 +jmp +15 +nop -405 +jmp -406 +jmp +1 +acc -19 +jmp -118 +acc +49 +jmp -385 +jmp +90 +acc -10 +jmp +10 +acc +8 +nop -315 +acc -14 +jmp -167 +jmp +49 +jmp -49 +jmp -275 +acc -1 +jmp -136 +acc +24 +acc +45 +jmp -259 +acc +2 +nop -370 +acc -18 +acc +4 +jmp -45 +acc +9 +jmp -542 +nop -39 +nop -16 +jmp +66 +acc -1 +nop -59 +acc +23 +acc -8 +jmp -91 +acc +7 +acc +37 +jmp -400 +acc +39 +jmp -162 +nop -346 +acc +5 +acc +50 +jmp -115 +jmp -141 +acc +2 +acc -18 +nop -179 +acc -19 +jmp -306 +acc -10 +acc +30 +jmp -115 +nop -47 +jmp -82 +acc +9 +acc -4 +jmp -139 +acc +18 +acc +16 +jmp -241 +jmp +1 +acc -3 +acc +11 +jmp -309 +acc +3 +acc +0 +acc +40 +jmp +1 +jmp -369 +acc +31 +jmp +1 +acc +35 +jmp -427 +acc +5 +acc -2 +jmp -26 +acc +29 +nop -121 +acc +6 +jmp -86 +nop -294 +jmp -391 +acc +50 +nop -96 +nop -325 +nop -134 +jmp -355 +acc +6 +jmp +1 +jmp -396 +nop -440 +jmp -89 +acc +22 +jmp -437 +acc +41 +acc +8 +acc +29 +jmp -603 +acc -18 +acc +16 +acc +42 +jmp -339 +acc +43 +acc -19 +nop -168 +nop -253 +jmp -198 +jmp -613 +jmp -346 +acc -4 +acc +7 +acc +40 +jmp -294 +jmp -423 +acc -4 +acc +48 +acc +41 +jmp +1 +jmp -49 +acc +4 +acc +28 +acc +9 +acc +38 +jmp -522 +jmp -5 +acc +3 +acc +6 +acc -8 +acc +44 +jmp +1 \ No newline at end of file diff --git a/2020/8/prog.py b/2020/8/prog.py new file mode 100644 index 0000000..8d8c472 --- /dev/null +++ b/2020/8/prog.py @@ -0,0 +1,62 @@ +def get_input(sample = False): + with open("sample" if sample else "input", "r") as f: + return [line.strip() for line in f.readlines()] + +def parse_instruction(instruction: str): + return instruction[:3], int(instruction[4:]) + +def cmd_n_to_instruction(cmd, n): + return str(cmd) + " " + (f"+{n}" if n >= 0 else f"{n}") + + +def instruction_results(cmd, n, i, acc): + if cmd == "nop": + return i + 1, acc + elif cmd == "jmp": + return i + n, acc + elif cmd == "acc": + return i + 1, acc + n + + +def get_result(instructions: list, part = 1): + acc = 0 + i = 0 + + if part == 1: + visited = set() + while i not in visited: + visited.add(i) + + i, acc = instruction_results(*parse_instruction(instructions[i]), i, acc) + else: + history = [] + revert = False + switched_indices = set() + + while i < len(instructions): + cmd, n = parse_instruction(instructions[i]) + + if i in history: + revert = True + + if not revert: + history.append(i) + i += n if cmd == "jmp" else 1 + else: + if cmd in ["jmp", "nop"] and i not in switched_indices: + instructions[i] = cmd_n_to_instruction("jmp" if cmd == "nop" else "nop", n) + switched_indices.add(i) + revert = False + else: + i = history[-1] + history = history[:-1] + + for i in history: + cmd, n = parse_instruction(instructions[i]) + if cmd == "acc": + acc += n + + return acc + +if __name__ == "__main__": + print(get_result(get_input(), part = 2)) diff --git a/2020/8/sample b/2020/8/sample new file mode 100644 index 0000000..be3fc2d --- /dev/null +++ b/2020/8/sample @@ -0,0 +1,9 @@ +nop +0 | +acc +1 | 1 +jmp +4 | +acc +3 | 5 +jmp -3 | +acc -99 | +acc +1 | 1 +jmp -4 | +acc +6 | diff --git a/2020/8/test.py b/2020/8/test.py new file mode 100644 index 0000000..789b8da --- /dev/null +++ b/2020/8/test.py @@ -0,0 +1,13 @@ +from prog import * + +inp = get_input(sample = True) + +result_1 = get_result(inp) +expected_1 = 5 + +print(f"{result_1 = } {result_1 == expected_1}") + +result_2 = get_result(inp, part = 2) + +expected_2 = 8 +print(f"{result_2 = } {result_2 == expected_2}") diff --git a/2020/9/__pycache__/prog.cpython-38.pyc b/2020/9/__pycache__/prog.cpython-38.pyc new file mode 100644 index 0000000..51b5934 Binary files /dev/null and b/2020/9/__pycache__/prog.cpython-38.pyc differ diff --git a/2020/9/input b/2020/9/input new file mode 100644 index 0000000..a732513 --- /dev/null +++ b/2020/9/input @@ -0,0 +1,1000 @@ +17 +42 +18 +39 +1 +16 +13 +31 +35 +32 +47 +11 +40 +23 +29 +30 +3 +38 +43 +27 +41 +9 +19 +14 +46 +44 +4 +20 +5 +6 +10 +7 +12 +17 +8 +13 +25 +11 +37 +49 +15 +16 +22 +21 +18 +23 +24 +32 +19 +9 +14 +26 +27 +20 +76 +28 +29 +36 +30 +31 +33 +38 +42 +34 +57 +25 +58 +40 +37 +44 +50 +82 +109 +47 +23 +71 +45 +81 +75 +55 +48 +54 +70 +53 +61 +56 +60 +69 +85 +84 +94 +105 +87 +67 +141 +107 +123 +101 +83 +76 +216 +142 +103 +130 +121 +109 +165 +143 +136 +116 +224 +187 +160 +151 +150 +154 +183 +226 +159 +330 +177 +184 +185 +192 +179 +295 +212 +282 +225 +230 +328 +339 +266 +252 +267 +362 +301 +304 +305 +329 +414 +429 +549 +336 +363 +356 +369 +391 +371 +404 +641 +494 +905 +455 +572 +518 +621 +785 +519 +705 +1424 +605 +665 +734 +685 +909 +888 +727 +692 +973 +760 +740 +1118 +974 +922 +1099 +949 +1027 +1258 +1184 +2398 +1211 +1224 +1124 +2006 +1270 +1290 +1419 +2335 +1377 +1432 +1452 +1649 +2297 +1500 +1864 +2426 +2160 +1871 +2021 +2283 +2414 +2809 +3885 +2308 +2348 +2394 +2494 +3430 +3398 +2709 +2667 +2796 +5385 +3797 +4840 +3101 +4167 +3364 +3371 +3735 +6379 +3892 +5079 +9750 +4842 +4656 +4702 +4742 +5015 +7902 +4888 +5203 +5505 +8486 +5376 +5463 +5897 +14281 +8594 +6993 +6465 +8252 +6735 +7263 +10785 +8548 +8634 +9358 +16886 +9544 +9444 +16351 +9630 +9903 +11273 +10091 +13837 +18725 +10839 +20688 +11360 +18138 +13200 +17182 +26772 +13728 +15515 +22558 +15811 +19333 +17906 +17992 +18902 +20383 +29352 +35907 +37870 +19721 +46105 +59833 +20930 +22199 +24039 +25088 +24560 +32533 +26928 +80216 +40500 +29243 +39716 +38369 +48254 +33717 +37627 +36808 +41920 +38623 +53391 +40651 +43129 +43760 +44281 +44969 +46759 +47858 +46238 +48599 +51488 +53803 +70160 +56171 +69743 +62960 +83780 +73433 +95311 +82596 +85680 +75431 +109198 +115353 +79274 +84411 +121648 +89250 +155840 +90519 +91207 +104770 +158271 +130649 +100087 +105291 +152756 +210898 +277488 +132703 +136393 +152707 +148864 +218383 +154705 +181726 +159842 +169793 +163685 +226939 +173661 +179769 +180457 +230736 +457257 +232790 +314429 +451173 +252843 +205378 +237994 +347291 +269096 +333164 +285257 +467136 +620966 +303569 +314547 +318390 +386781 +455050 +449553 +390624 +360226 +353430 +556384 +385835 +733126 +474474 +618421 +798464 +443372 +458221 +687547 +906223 +554353 +572665 +663795 +1021489 +618116 +678616 +621959 +1309506 +671820 +713656 +739265 +744054 +907783 +746061 +827904 +1865890 +1478888 +1706247 +1579603 +1145768 +901593 +1122016 +1012574 +2614030 +1127018 +1172469 +1285754 +1281911 +1647048 +1459717 +1293779 +1483319 +2360704 +1415874 +1567169 +1916523 +1490115 +1573965 +1758635 +1729497 +1914167 +2023609 +2028611 +2294485 +3196078 +2973434 +2694187 +3595780 +2739638 +2775869 +2454380 +2928959 +2575690 +2709653 +2943036 +2899193 +3057284 +2905989 +2983043 +3064080 +3219612 +3248750 +5543235 +3488132 +3643664 +4208652 +4052220 +4323096 +4870175 +5682674 +6193046 +5285343 +5030070 +5164033 +5766937 +5842229 +5474883 +5558733 +5608846 +5805182 +5882236 +7229085 +5889032 +6468362 +6283692 +12661408 +12082078 +7131796 +8673734 +9891326 +11357079 +12725954 +11694214 +9900245 +11317112 +10194103 +13703804 +21217357 +26984294 +11033616 +11083729 +11363915 +11167579 +11414028 +12350598 +11771268 +12172724 +12357394 +12752054 +20846458 +17023122 +23764626 +15805530 +18565060 +19791571 +21314273 +23256453 +22581607 +20094348 +21361682 +21608131 +32268864 +26973109 +22117345 +22497757 +23536639 +22531494 +22938847 +36814693 +23943992 +34710115 +31317114 +25109448 +39725163 +37869580 +32828652 +46475486 +37922875 +38356631 +58290223 +41408621 +41456030 +41702479 +45203796 +44615102 +43725476 +44648839 +45029251 +47640942 +56365291 +79304138 +62256657 +46882839 +82571714 +49053440 +62979028 +68834924 +57938100 +93668542 +81648351 +71185283 +80059110 +76279506 +79765252 +82864651 +83111100 +83158509 +85427955 +88374315 +88340578 +91531678 +107627867 +162503466 +138536163 +151319606 +160952489 +95936279 +104820939 +141049200 +106991540 +137997210 +126773024 +129123383 +147464789 +151244393 +159525861 +156044758 +229389778 +162876352 +165975751 +166269609 +168586464 +173768533 +176714893 +179872256 +333294394 +236751250 +200757218 +255896407 +211812479 +202927819 +222709303 +231593963 +342984502 +233764564 +264770234 +318921110 +276588172 +315570619 +307289151 +322020509 +322314367 +399740315 +328852103 +522856758 +397863572 +342354997 +350483426 +356587149 +498793366 +434521782 +403685037 +532484579 +933315148 +414740298 +436692383 +665298869 +685339499 +587084601 +498534798 +541358406 +598902539 +583877323 +622859770 +707029466 +644334876 +672797793 +1065039184 +763373885 +692838423 +834555955 +698942146 +707070575 +1197735512 +1256675116 +871214165 +818425335 +1578243631 +1433458494 +851432681 +935227181 +1039893204 +1082412121 +1097437337 +1121394568 +1248387872 +1228212199 +1462316031 +1267194646 +1317132669 +1365636216 +1038347917 +1391780569 +1803267089 +1525495910 +1753652516 +1558503256 +1578284740 +1689639500 +1858318539 +2188346834 +1669858016 +2135785254 +2827952247 +4406236987 +1975120385 +2078241121 +2120760038 +2286735789 +2487030784 +2515582518 +2266560116 +2305542563 +3387954684 +6381357372 +2792000433 +2841615006 +2917276479 +3533623641 +3312155772 +3136787996 +3636744377 +3248142756 +3359497516 +3528176555 +4773766573 +4053361506 +4280662948 +4095880423 +6305231163 +4261856174 +4199001159 +4387320154 +4553295905 +5357197524 +5147157569 +6165419235 +6607640272 +6887880856 +5633615439 +10024668852 +8440681660 +6054064475 +7920943795 +7412859022 +9534477723 +6996241893 +6776319311 +10441384629 +7581538061 +8294881582 +8149241929 +9637860472 +8940616059 +8460857333 +8752297064 +11800179176 +12241255711 +11522616759 +12035038425 +14460300817 +12409934750 +15145483822 +11687679914 +15936857952 +12830383786 +13050306368 +13466923497 +15291123475 +19269217975 +13772561204 +18578476531 +14357857372 +15730779990 +15876419643 +16444123511 +16901538993 +17213154397 +23322795935 +24989540256 +34515334483 +26147980731 +24572923127 +23557655184 +23722718339 +24097614664 +35010475849 +27564099557 +24737986282 +25880690154 +26297307283 +26517229865 +27239484701 +30985715601 +43510461680 +28130418576 +51121754741 +30088637362 +55969327516 +34114693390 +44008223068 +42202694653 +40535950332 +46880451119 +47280373523 +85713156333 +47655269848 +48130578311 +47820333003 +49603408493 +48835600946 +50618676436 +96483859612 +51035293565 +76317388043 +53536791984 +54647648441 +55369903277 +72291332015 +64203330752 +97545015052 +112333909063 +81935026393 +80995144509 +74650643722 +82738644985 +87416401451 +87816323855 +103190236280 +179222504597 +125152988989 +95475602851 +184961416503 +96655933949 +110017551718 +99454277382 +104572085549 +191959462463 +153286476524 +108184440425 +135642792950 +136365047786 +119573234029 +136494662767 +146138357145 +155645788231 +194223877751 +168811468364 +157389288707 +162067045173 +170155046436 +287435065314 +183291926706 +192131536800 +194929880233 +196110211331 +204026362931 +201228019498 +324457256595 +207638717807 +255100065613 +272007840736 +227757674454 +243827233375 +305797839386 +255216026979 +326200757071 +256067896796 +292140450998 +360943005164 +319456333880 +338966514800 +358617308205 +327544335143 +425371073415 +451210276944 +375423463506 +559845327703 +387061417033 +560897904999 +499895130171 +405254382429 +408866737305 +527107906349 +462854744786 +471584907829 +678073642085 +482973701433 +563283567255 +1011055604647 +511283923775 +810551422629 +767351820571 +611596784878 +792315799462 +702967798649 +666510849943 +686161643348 +946906744736 +762484880539 +875318593677 +780677845935 +795928154338 +814121119734 +1071765232372 +868109127215 +871721482091 +1470319619220 +934439652615 +1406024560444 +1238936728400 +1197445567123 +1046257268688 +1174880352133 +1495283598111 +1635460947786 +1739830609306 +1667634393139 +1278107634821 +1352672493291 +2250997465155 +1428995730482 +1808742149227 +1630594007754 +1543162726474 +1939874359587 +1576606000273 +1610049274072 +1682230246949 +1917978750779 +3304025747338 +1806161134706 +2212547287436 +2109320004748 +2541540866799 +2221137620821 +2626441297605 +2398929761979 +3794160191629 +3084268769527 +2854713635094 +2630780128112 +3614903283933 +2707103365303 +2781668223773 +3111225977431 +3368870090069 +3119768726747 +4880631747611 +3549923633659 +6575828415402 +3186655274345 +3292279521021 +4459519617578 +5910410956868 +4890988228521 +3915481139454 +4321867292184 +4330457625569 +6230994704178 +4620067382800 +5029709890091 +5892894201204 +5974482361841 +10851062086978 +5337883493415 +5412448351885 +5488771589076 +7912346903821 +5901436950520 +6297881251776 +10594549744641 +6412048247768 +7751799138599 +10232278249052 +6478934795366 +7102136413799 +10223351826773 +9889963501295 +8237348431638 +10394415934820 +8941934674984 +8652324917753 +8950525008369 +18875676744526 +9649777272891 +16263510438863 +15138548861967 +16404124056352 +10750331845300 +11313885302405 +12776816047142 +11390208539596 +12199318202296 +12313485198288 +14535229683414 +12890983043134 +13514184661567 +13581071209165 +15420869470350 +15339484845437 +25354649064721 +16889673349391 +17179283106622 +20436666633934 +28049414344981 +27794332595948 +17602849926122 +19700856853669 +20400109118191 +22540760316025 +23641314888434 +33950851295501 +22064217147705 +28920556054602 +47895409380746 +33213482681076 +24512803400584 +29378601308918 +25204468241422 +26405167704701 +33291092161325 +27095255870732 +42957498990843 +51759816769422 +59618650385777 +34068956456013 +34492523275513 +38002959044313 +42241617169694 +37303706779791 +39667067073827 +88997251694695 +40100965971860 +42464326265896 +44604977463730 +52561870943036 +46577020548289 +49159473018437 +79868112709614 +86023818090478 +49717271642006 +135574272242984 +51609635946123 +60386348032057 \ No newline at end of file diff --git a/2020/9/prog.py b/2020/9/prog.py new file mode 100644 index 0000000..f884737 --- /dev/null +++ b/2020/9/prog.py @@ -0,0 +1,58 @@ +import yaml + +def get_input(sample = False): + with open('sample' if sample else 'input', 'r') as f: + return [int(line) for line in f.readlines()] + + +def get_preamble(data: list, size: int): + preamble = {} + + for i in range(size): + x = data[i] + for j in range(i + 1, size): + y = data[j] + preamble[(x, y)] = x + y + + return preamble + +def print_preamble(dic: dict): + for keys, value in dic.items(): + print(f"{keys}: {value}") + +def get_result(data: list, part = 1, sample = False): + if part == 1: + pre_size = 5 if sample else 25 + preamble = get_preamble(data, pre_size) + + for i in range(pre_size, len(data)): + + elem = data[i] + + if elem not in preamble.values(): + return elem + + elem_to_pop = data[i - pre_size] + new_preamble = {} + for keys, value in preamble.items(): + if elem_to_pop not in keys: + new_preamble[keys] = value + preamble = new_preamble + + for p in range(i - pre_size + 1, i): + elem_p = data[p] + preamble[(elem, elem_p)] = elem_p + elem + + else: + objective = get_result(data, part = 1, sample = sample) + for length in range(2, len(data)): + for i in range(len(data) - length): + tmp = data[i:i+length] + if sum(tmp) == objective: + return min(tmp) + max(tmp) + + + +if __name__ == "__main__": + print(get_result(get_input(), part = 2)) + diff --git a/2020/9/sample b/2020/9/sample new file mode 100644 index 0000000..cda4246 --- /dev/null +++ b/2020/9/sample @@ -0,0 +1,20 @@ +35 +20 +15 +25 +47 +40 +62 +55 +65 +95 +102 +117 +150 +182 +127 +219 +299 +277 +309 +576 \ No newline at end of file diff --git a/2020/9/test.py b/2020/9/test.py new file mode 100644 index 0000000..4ba66c9 --- /dev/null +++ b/2020/9/test.py @@ -0,0 +1,15 @@ +from prog import * + +inp = get_input(sample = True) + +size = 5 + +result_1 = get_result(inp, sample = True) +expected_1 = 127 + +print(f"{result_1 = } {result_1 == expected_1}") + +result_2 = get_result(inp, part = 2, sample = True) +expected_2 = 62 +print(f"{result_2 = } {result_2 == expected_2}") +