From 410815acf8f5b682a913eb7b9b70ef98332f7701 Mon Sep 17 00:00:00 2001 From: Karma Riuk Date: Wed, 2 Aug 2023 11:39:56 +0200 Subject: [PATCH] Added 2020 (python) --- 2020/1/input | 200 +++ 2020/1/prog.py | 75 + 2020/10/__pycache__/prog.cpython-38.pyc | Bin 0 -> 939 bytes 2020/10/input | 93 + 2020/10/prog.py | 23 + 2020/10/sample_1 | 11 + 2020/10/sample_2 | 31 + 2020/10/test.py | 12 + 2020/11/__pycache__/prog.cpython-38.pyc | Bin 0 -> 2963 bytes 2020/11/input | 91 + 2020/11/prog.py | 118 ++ 2020/11/sample | 10 + 2020/11/sample_no_occupied | 7 + 2020/11/test.py | 16 + 2020/12/__pycache__/prog.cpython-38.pyc | Bin 0 -> 2431 bytes 2020/12/__pycache__/test.cpython-38.pyc | Bin 0 -> 2964 bytes 2020/12/input | 760 +++++++++ 2020/12/prog.py | 67 + 2020/12/sample | 5 + 2020/12/test.py | 64 + 2020/13/__pycache__/prog.cpython-38.pyc | Bin 0 -> 1692 bytes 2020/13/__pycache__/test.cpython-38.pyc | Bin 0 -> 1288 bytes 2020/13/input | 2 + 2020/13/prog.py | 52 + 2020/13/sample | 2 + 2020/13/test.py | 20 + 2020/14/__pycache__/prog.cpython-38.pyc | Bin 0 -> 2251 bytes 2020/14/__pycache__/test.cpython-38.pyc | Bin 0 -> 1619 bytes 2020/14/input | 554 ++++++ 2020/14/prog.py | 69 + 2020/14/sample_1 | 4 + 2020/14/sample_2 | 4 + 2020/14/test.py | 42 + 2020/15/__pycache__/prog.cpython-39.pyc | Bin 0 -> 757 bytes 2020/15/__pycache__/test.cpython-39.pyc | Bin 0 -> 2055 bytes 2020/15/prog.py | 14 + 2020/15/test.py | 31 + 2020/16/__pycache__/prog.cpython-39.pyc | Bin 0 -> 2886 bytes 2020/16/__pycache__/test.cpython-39.pyc | Bin 0 -> 876 bytes 2020/16/input | 266 +++ 2020/16/prog.py | 77 + 2020/16/sample_p1 | 12 + 2020/16/sample_p2 | 11 + 2020/16/test.py | 15 + 2020/17/__pycache__/prog.cpython-39.pyc | Bin 0 -> 3399 bytes 2020/17/__pycache__/test.cpython-39.pyc | Bin 0 -> 945 bytes 2020/17/input | 9 + 2020/17/prog.py | 81 + 2020/17/sample | 3 + 2020/17/test.py | 16 + 2020/18/__pycache__/prog.cpython-39.pyc | Bin 0 -> 2586 bytes 2020/18/__pycache__/test.cpython-39.pyc | Bin 0 -> 2934 bytes 2020/18/input | 375 ++++ 2020/18/prog.py | 55 + 2020/18/sample_p1 | 4 + 2020/18/sample_p2 | 5 + 2020/18/test.py | 54 + 2020/2/input | 1000 +++++++++++ 2020/2/prog.py | 56 + 2020/3/input | 323 ++++ 2020/3/prog.py | 69 + 2020/4/__pycache__/prog.cpython-38.pyc | Bin 0 -> 690 bytes 2020/4/input | 1138 +++++++++++++ 2020/4/prog.py | 81 + 2020/4/sample | 13 + 2020/4/test.py | 50 + 2020/5/__pycache__/prog.cpython-38.pyc | Bin 0 -> 1804 bytes 2020/5/__pycache__/test.cpython-38.pyc | Bin 0 -> 474 bytes 2020/5/input.prod | 824 +++++++++ 2020/5/prog.py | 47 + 2020/5/sample.prod | 3 + 2020/5/test.py | 26 + 2020/6/__pycache__/prog.cpython-38.pyc | Bin 0 -> 1618 bytes 2020/6/input | 2084 +++++++++++++++++++++++ 2020/6/prog.py | 61 + 2020/6/sample | 15 + 2020/6/test.py | 23 + 2020/7/__pycache__/prog.cpython-38.pyc | Bin 0 -> 2655 bytes 2020/7/input | 594 +++++++ 2020/7/prog.py | 79 + 2020/7/sample_1 | 9 + 2020/7/sample_2 | 7 + 2020/7/test.py | 26 + 2020/8/__pycache__/prog.cpython-38.pyc | Bin 0 -> 1735 bytes 2020/8/input | 654 +++++++ 2020/8/prog.py | 62 + 2020/8/sample | 9 + 2020/8/test.py | 13 + 2020/9/__pycache__/prog.cpython-38.pyc | Bin 0 -> 1679 bytes 2020/9/input | 1000 +++++++++++ 2020/9/prog.py | 58 + 2020/9/sample | 20 + 2020/9/test.py | 15 + 93 files changed, 11719 insertions(+) create mode 100644 2020/1/input create mode 100644 2020/1/prog.py create mode 100644 2020/10/__pycache__/prog.cpython-38.pyc create mode 100644 2020/10/input create mode 100644 2020/10/prog.py create mode 100644 2020/10/sample_1 create mode 100644 2020/10/sample_2 create mode 100644 2020/10/test.py create mode 100644 2020/11/__pycache__/prog.cpython-38.pyc create mode 100644 2020/11/input create mode 100644 2020/11/prog.py create mode 100644 2020/11/sample create mode 100644 2020/11/sample_no_occupied create mode 100644 2020/11/test.py create mode 100644 2020/12/__pycache__/prog.cpython-38.pyc create mode 100644 2020/12/__pycache__/test.cpython-38.pyc create mode 100644 2020/12/input create mode 100644 2020/12/prog.py create mode 100644 2020/12/sample create mode 100644 2020/12/test.py create mode 100644 2020/13/__pycache__/prog.cpython-38.pyc create mode 100644 2020/13/__pycache__/test.cpython-38.pyc create mode 100644 2020/13/input create mode 100644 2020/13/prog.py create mode 100644 2020/13/sample create mode 100644 2020/13/test.py create mode 100644 2020/14/__pycache__/prog.cpython-38.pyc create mode 100644 2020/14/__pycache__/test.cpython-38.pyc create mode 100644 2020/14/input create mode 100644 2020/14/prog.py create mode 100644 2020/14/sample_1 create mode 100644 2020/14/sample_2 create mode 100644 2020/14/test.py create mode 100644 2020/15/__pycache__/prog.cpython-39.pyc create mode 100644 2020/15/__pycache__/test.cpython-39.pyc create mode 100644 2020/15/prog.py create mode 100644 2020/15/test.py create mode 100644 2020/16/__pycache__/prog.cpython-39.pyc create mode 100644 2020/16/__pycache__/test.cpython-39.pyc create mode 100644 2020/16/input create mode 100644 2020/16/prog.py create mode 100644 2020/16/sample_p1 create mode 100644 2020/16/sample_p2 create mode 100644 2020/16/test.py create mode 100644 2020/17/__pycache__/prog.cpython-39.pyc create mode 100644 2020/17/__pycache__/test.cpython-39.pyc create mode 100644 2020/17/input create mode 100644 2020/17/prog.py create mode 100644 2020/17/sample create mode 100644 2020/17/test.py create mode 100644 2020/18/__pycache__/prog.cpython-39.pyc create mode 100644 2020/18/__pycache__/test.cpython-39.pyc create mode 100644 2020/18/input create mode 100644 2020/18/prog.py create mode 100644 2020/18/sample_p1 create mode 100644 2020/18/sample_p2 create mode 100644 2020/18/test.py create mode 100644 2020/2/input create mode 100644 2020/2/prog.py create mode 100644 2020/3/input create mode 100644 2020/3/prog.py create mode 100644 2020/4/__pycache__/prog.cpython-38.pyc create mode 100644 2020/4/input create mode 100644 2020/4/prog.py create mode 100644 2020/4/sample create mode 100644 2020/4/test.py create mode 100644 2020/5/__pycache__/prog.cpython-38.pyc create mode 100644 2020/5/__pycache__/test.cpython-38.pyc create mode 100644 2020/5/input.prod create mode 100644 2020/5/prog.py create mode 100644 2020/5/sample.prod create mode 100644 2020/5/test.py create mode 100644 2020/6/__pycache__/prog.cpython-38.pyc create mode 100644 2020/6/input create mode 100644 2020/6/prog.py create mode 100644 2020/6/sample create mode 100644 2020/6/test.py create mode 100644 2020/7/__pycache__/prog.cpython-38.pyc create mode 100644 2020/7/input create mode 100644 2020/7/prog.py create mode 100644 2020/7/sample_1 create mode 100644 2020/7/sample_2 create mode 100644 2020/7/test.py create mode 100644 2020/8/__pycache__/prog.cpython-38.pyc create mode 100644 2020/8/input create mode 100644 2020/8/prog.py create mode 100644 2020/8/sample create mode 100644 2020/8/test.py create mode 100644 2020/9/__pycache__/prog.cpython-38.pyc create mode 100644 2020/9/input create mode 100644 2020/9/prog.py create mode 100644 2020/9/sample create mode 100644 2020/9/test.py 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 0000000000000000000000000000000000000000..10c7a30651bde4603756cb9ed65aa3c159517ed7 GIT binary patch literal 939 zcmZ8f&1(};5TAMbcC(EZg9MWbLauvh(xP|?rM9KVf(B6nW!dJv#--VhzTF7Q+f#ZM z!GoYeizojb@${~q@-KMNd0Semv&`)Kn3>{B?wvt-odz0 zL`goAp>g9hpO*&J#6n+*t-$s(A}!ivri6NUyFx;zdf&5CK7wx$pmE}~447f-1B0=$ zF}3;C@4w0t**}R?67?sUko_m(wM@%icHG;gZEth1Ip}W;`nk%c>-ihg9M0mRoMcJ9 zWqU4cDvvsN`(P@|u_ILju{tk|N(l`moQESITSQ8E&_7!ER8EN{(?pA4U9x*{xKnWrny-qL29Tpq zUl%!R<30454?eq#%3c~j43j8M!|)(r`*n2zUjE#A?1o!buYJ=fks&?MT+tJ|fnL9{ WnnQn>WMV#(TQ!9qVKjNG<>Mb}tI4eZ literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..b8cf8c4a39fccb6ff778f9b979e439d23747b683 GIT binary patch literal 2963 zcmai0TW=dh6rP#Ac)f8PH>7C-y#!jITOesG5C}z8P)k)1iYO^6Sgl;+*`y}E&TdLm z%}PklBZBgdL?WK}1N;)6_O(xW=cz)#cV@G8lBUJhoH=tjXXbq8GW+HDxXB%B`OZsvQy)9n~9Xb9Bmt{Gz z%aeI9zD8?pf#@B!yc9$R6-)b-Sj>g`@DYzUl@|12;Xo-DF>|-`I-jzhV+x;4G(3v(wv%Q?42u+VUSA z>7cEkMKd64IOc98;W&dQ$1*Hyoq9V=`ReF$ zsz}Slpi#9lgzBzV54goYDVlGdJ|qQ-1bV%0IgfBdtfxUh03+ zk>SISmFlX%NeimpSqp0qb7m9n2kyshbpXf8;y-#Gn6h&i6%i9 z7kpAwgvTq~=PoaEHH+B;AP{6FGy}pk5R*Ky00TmB7Lk$I#G`jKTjQEf!7Pp7oM8w| zYhbMki~-0ArtJao&t20T^0sC(Y>FKv1r5$XtO|3EqdD!%^yMqrN%_eyS~F+uJLjNG zK3WxPUgByO&OQle7ZNWPx}ZJSYpK7qCB^$JvHIYUUiR`XP-43jQ@j7-7g(v)LVP;L zTL##mn0gK5La5-poZD2>5J{azccX*Ef(RB(w^{XNQ-zJV+3iGX3cJ*CBEw|M;(5kM z4!v6&%FyO$350Q*m$+wpy!?-FN_(_q_z^90;>+AK6g!{TXG@Utg*pcv2cm+~g3`l8 z#SdVf7Zth3;dkoB1YIgr5)p>32;Nj?(G^$KsEvGEy^RSJ~O5J)7HBkoc$dsz3!r0hD zwYw7@Y1IVPM7hy!Z`MpHxd~-a86*oGvdKqNZ(+v38gK*K0lTP7kZs1Uc_aeauvaF? zJ}MU$+$yv+5U89;cDVCz^PpmtUa!PKidn|)9}y;kN((Uf9>KwKrzf8FjN`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LLLLL.LLLLLLLLLLLLL.LLLLLLLLLLLL.LLL.LLLLLLL.L.LLLLLLLLLL.LLLLLLL..L.LLLL.LLLLLLL.LLLLLLL.LLLLLL +LLLLL.LL.LLLLLLL..L.LL.LLLLL.LL.LLLLL.LLL.LLLLLLLLLLLL.LLLLL.LLLLLLL.LLLLLLL.LLLLLLLL.LLLLLL.LLLLLL +LL.LLLLL.LLLLLLLLLLLLLLLLLLL.LLLLLLLL.LLLLLLLLLLLLLLLL.LLLL..LLLLLLL.LLLLLLLLLLLLL.LL.LLLLLLLLLLLLL +..L.......L...........LL...L.L....L.........LL.L.LLL.L.........L..LL....L.L....LL.L......LL....L.L. +LLLLLLLLLLLLLLLL.LLLLL.LLLLL.LLLLLLLL.LL.LLLL.L.LL..LLLLLL.LL.LLLLLL.LLLLLL..LLLLLL.L.LLLLLL.LLLLLL +LL.LL.LL.LLLLLLL.LLLLLLLLLLLLLLLLLLLLLLLLLLLL.L.LLLLLL.L.LLL.LLLLLLL.LLLLLLL.LLLLLLLL.LLLLLL.LLLLLL +LLLLLLLL.L.LLLLL.LLLLL.LLLLLLLLLL.LLL..LLLL.LLL.LLLLLL.LLLLL.LLLLLLL.L.LLLLL.LLLLLLLL.LLLLLLLLLLLLL +LLLLLLLLLLLLLLLL.LLLLLLLLLLLLL.LLLLLLLLLLLLLLLL.LLLLLL.LLLLL.LLLLLLL.LLLLLLL.LLLLLLLLLL.LLLL.LLLLLL +LL.LLLLL.LLLLLLLLLLLLLLLLLLL.LLLLLLLL.LLLLLLLLL.LLLLL.LLLLLL.LLLLLL..LLLLLLL.LLLLLLLL.LLLLLLLLLL.LL +L........L.L.L...LL.LLL...L........LL..L...L..LL..LL.L.L....L..L..L.L....L.L.....LLL.L.LL...L...L.L +LLLLLLLL.L.LLLLL.LLLLLLLLLLLLLLLLLLLL.LLLLLLLL..LL.LLL.LLLLL.LLLLLLL.LLLLLLL.LLLLLLLL.LLLL.L.LLLLLL +LLLLLLLL.LLLLLLL.LLLLL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LLLLL.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 0000000000000000000000000000000000000000..bbbb87b51bffadc25c00c3ffcd5492ecb7b99759 GIT binary patch literal 2431 zcmbVN&u<$=6rLaJ_1bmPG!1DJ3WOqPEulC>LP*F8MJ*MF$`XxGE34JA^=#55_O3I# zZrW-skQ}%n;KHegRP<8B-@t#tWz+)_z4*+H3w&>Er%uX=wfF6t_h#Pv-g`4|KA)K> zGd$0~`rSV$G4>}7rk?@^m++>yK-4M4mDuM^7IOTAl8>ZvRAJv~%FwYA7m}j#AStN% z&{gF}T%Ayr{X(-CdTM4z=$m0FEQV~r)T}!BofvS=)Z8Ykp1#`R@G*G=7=m^gZ~7rf z#&V|1ipN4>(f2ETuHby1<@|s@W>?sN-(Z5h&pu<<+0Sg#es3}bu3BgqHw`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#nY3LS`JgJ^pK9p&u?!dm=XtoedA)i+<+7q%&R5eo)QR&7YRUhH8 z4s;L@E|My_fn*I7_?!*<{)UNx6xczw5y4<|AjS+xJxWQ2B z(7I#Vz<%-@U;vx_pIGhItEOYZZwTl*X7vtO-U6(E~}G(^sZ*yyUlc z)Udg6zoFm_USj~?!)vfb!GEw0+~x*YJz`5ifAA!<`lSvwT9gV4yhebL5?`diB@<9<}|VN~Vxt!Vo}WRhgiZ`qpFstVHs|>_&mW4hG@%fKw6BE7D?;>#a-7k+ zCIms7S@dOe<6srUI_WTHMnMeKG6c8(cZ2TYq2&e<0}@wfoJ+Edl@0UYg)-yJp6eI& zjsmuE7z%&ZuVW^#>3GkJJDT7$xUS-)*HBDAQ$sEw&r3$xy%CYuVP|kun}uvT!%|>! z>jH1$0_njlk_1T$5*CEuaqk|2oOqgOl~kx1+U4PpXu5h4N7Z#?lxi!s3FjG_jX9cv zc?na9=N+b3xR_xg0!y#UyPT+d%4I<47Pc~y*h3oo3w!0So${IAsxES>#hU7_iBCE} zF{M`HQ}hY*beA-a9z=aj_3XXIJbJ(4b*68S?mt<#sFQ{~Gq?qHI9krU6*mICLB8lA zX?o}SI*FSkZj+!lQxJ}v*HE{D!#NKj^g>UQu2Dkpde}|E@t|j^zH97OkH%fm1PEPya literal 0 HcmV?d00001 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.p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/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 0000000000000000000000000000000000000000..24b5c015115bcf9d08b14a901cd6884ec1c21197 GIT binary patch literal 757 zcmYjPPixdb6rX>|W}_7;g0@K6Yd|)&RPnGZN_#Fs@e(W{WX5gSWRgy17giDwwtfPy z9@Lwk!J{X?!W_KlC1-D5^v!PV`ojC=y_fgrmp7AaZTSe~#rgO63r6UNb^aFy&Qs9( z2>?eN=cvFD#)$U?;q*P`j60W3Lh7V|S=%GjI4!*xH4f19PEt$lpHMI?om0?y z7a#*7XWK7HYY7k-iSD9z?A`H!iG;Assb>J#{%!XBo(vg=Z zwT`Q@j{21n^ElI@P|yxVUOH22_xi_F-xm5CUiLWaTL1{}Vh``(`+zP{+cwXO<08pq z90zW92Lhd~?rs3AXs)Ptw!_KQJ_9#mi=@bv4H}kbwZ85olS0I?aVnKby;=3zTG8@G UMagHm7~37x_Hy0Cw|x))1#pzCFaQ7m literal 0 HcmV?d00001 diff --git a/2020/15/__pycache__/test.cpython-39.pyc b/2020/15/__pycache__/test.cpython-39.pyc new file mode 100644 index 0000000000000000000000000000000000000000..86f9497c4e80f1ffc601b852f4ef51c1c761a089 GIT binary patch literal 2055 zcmbtV&u`N(6tu^#e2Dj~s z#GMOpD-t)vACm(YPUTNP9C**!mPTWvQXToT{XN_H{N9V>RVqb><;&&|_l?fjPa2FC z|!vKVqPPzRy7S`Igwz91WQqAKrq*LU5x=(^n=^gGlqyY9=r*GVh` zCJo#~!Eejj>~($Xg(th7)$W0BJ%CsKc2w`J*H>{^Z_YL6tobD?^22C$=e5*uDV;YI z2qstKV`|B^LX#dNq-sIzGe=9@;pmAIoE#WnBA6tOj+1Z8YZs6Z9l0!+a)wnaFD zr>({Lr+(P)L~ZiOVWEBw>nhgpJ;Gb|kwtt1L-CpKaS)#bPdQC-dWOp>E}!8H#hDqd zptxd&D=Ds=;VO!&5(f-*PuT-alFT7FaF|C3zTtSF4T+T{V##f?ihy&c4*Q9T5)fH3 zCMLDu;>cVglznI?tRjxK3BIehsom0Tf;*TB0}+?JF!W{gkg~)nZupTam6r!R)9Oby2E$Qs) z(4=O^lTq;Nt6=gx(H97g(m4@VNZ#6X=WA$HiOTrybVd>yClggU6eTZXFQ}o&F%> zPEpjHOwn{!kv-EIN72IBQxq*srik31WUKPg^FP`+iWVubCq->>GDYP65k((b!8nSR zD9cV#v^1F_a(}95s9g5{%x=+lbCROgWQxvZ6a`y&Z;X-I%U4cOv}`v@lKvW!ZfQwh zzoZk$s|0m|YXsK`ZV=ogxJ8hD+^R=6jw~S1D5RV>xmh$t`Y3B7hgXH{Z8&CsJBa8) ih|M*`RS)kux`NfLe{CL{_mcnSeY%)K(u!{oHSI46s&NVc literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..1510acb9a159b284fe935871e62816a4be5de4c6 GIT binary patch literal 2886 zcmai0&5s;M6|YzQF+H<0vrAYxyCDff6pR~(UE4wyM5_gy$j3dz2*k+Nq%+kXw|06y zs(V-Vs{1sH;vggf90}5{#Kq#DK%6;nu0v#rlh538;`gfd)3L&g>ebh)s`q~N>i0V7 zbXo#G_4h9a-)Rc*AMRZI`RM!{rT7R!2}NVkcQy4%b(F7yL+Z=aQ{fk+8Y(*U`@ZU? zfoh`PQcH(HKTI2{y({%j8l_<>7h*vRBJ6cf#LF+Ruh_Z!f=~@5cTRq=MnotdpcMax zC`BdoilU1CBK|5TQc2}4C6DM>97*LLQ|)6Us9@VVkA%ncp?I)Xhox7A z3%W1sMjcgA6;zEaG2ce*DYR6inuh|bTBoZ{T1&isLC|VLt8=2&J=ap=w{l&a=qzuE z%KNpDK*`5{;gPr}Zi?ccHw4-LZy*)M;+36#R3!OqoDOCt$R@MB(vUuot(Imq47E(C zlgTJ8hTK2>F-UwZ_fU#eh!KE!(5?vp0oXsvxqnYQ6VJ$a*`$0Xjoi3lXkRy=YQy1AR^JlPyhRl4~LwVzJP-t=Mb19W@0Zrr-DdGq$>OixD}vnQstHO`81IL&9< z9qjU76mjs@C@lxp>W!`ObeN2bZ8T2xG@JPqy?4;epY+OXxSN(=^CE@@ZY;24c#m#uBp*t=32*11cWvW({C@A+eRVzlk(IrvzSy;)6^BOZ)HFCKvoT!H zlXCdTgd;uOn-%(Pn5UUS;)d>_>POBeo$9x^8|2w!a1&MX*jDJ>a=lwG!KYt`K4V<4 z?}A#iMs^H9;epLAkroFMt68AGz^fgJT9#rVJ`*KXi0pL`3CKu+gaA?Hqy4KoP!doH zPb?GIsf z6U6E)ZCFb;FxIMvu)Pfm6*MAHrvB&r|wp*s$G*oi$y3zV7A(I4XFN;cU~#+e$p5wNGqhH2qeol(*cafqX&w=EH*#ooAl z6~|t(lgWjd&f0kmjf~SmkKd-F)Dj{16r{=_$k(}`KigFC3SwoSEip6GJ>q>L-sewN z|ALQ>`t((3osU{>HO;L8jL#Y4J)S*hSpBj)fWRqkoGr2W55&r^*m&b~aze89?E=Tn zMHDZdSL#@v`v%kZGoqy*$-PnVJwz?WKhYlNs`Xvg~ENL@8+Q<@i7-)4VVZl@-H8 zE6z7XX}mm{S*uJi(@6Kmf0E>5q=&tH7BB1Xvo-4w{qAY#xl{U4b`pg82bea29fnph zuq~FE(j55xuA|O!%JG^$cGt};ic~ZinZ`*J_rq+!S*YL4E(JF3j>A!3XTd>kTIa~D zp`TeDtj*C@K2>|;bekij;ID}l M*;?*~E7v3XA4zhAj{pDw literal 0 HcmV?d00001 diff --git a/2020/16/__pycache__/test.cpython-39.pyc b/2020/16/__pycache__/test.cpython-39.pyc new file mode 100644 index 0000000000000000000000000000000000000000..59304b80699e37cb7649ff652e178c8fc640a9ee GIT binary patch literal 876 zcmZuvKX21O6u*CV+%zeuf{h^qiy7)R17bj^C_W5NiwfWoxICUnJ2SK z>ExyQpcigbosK48j>d=M!{q2`;SgK-6`h{MSuhg+ia>1{t;@=pBMMEEvPGNJQ z&C9ybs}m@Rh2J^TPM$C7#`)dcT5a4bT!ZhU-?Ybi4)Gi2h1JEWxd(OI<(LRe-^0me zeT0TZQiS&Dr@fB#!8&+{eF%9i`^TVk>=j?K4S$$Mi6v9PW`Z!Cu5j*{8GLPC)VXmn zH4nfryBOdGFW(Fi_7LtPZ0_c9ur$?K7B!1=hpX_>6mXKmuJNI?S^sP3qvze@e1X?)kpXmN`}{W_d#h;x literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..bebfc667e2b61b2b90c73602b4a81b6f611a68c4 GIT binary patch literal 3399 zcmbtW&2JmW6`z@%T`oVQD2^)2t?RN)ka`Q0VqCW_Tvce1Am|}53^+hhp$b89RthU} z$(>!v5;1!z4TLEWw?%t%Q`kUzFpxi>DA0ePry$3@;?;rH>sK5hNI#@K&ou=sN^_!(NV3!*M5uEYbr%|fo6zi=g$`#^4s z>Bv(hjGXDnS7nT(dMR{O6}&aI^uXQr!jf7(5c-|a5516$nR-F3d?3c0Gxg#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)7jD_7 TFg+40)#b|a@^W?M+dlsvtdzLA literal 0 HcmV?d00001 diff --git a/2020/17/__pycache__/test.cpython-39.pyc b/2020/17/__pycache__/test.cpython-39.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a2fdf54cff6a0c912fa4cabea254c41ea7fe3804 GIT binary patch literal 945 zcmaJ<%Wl&^6rG3dxM@-zLM&Ki!Nx4=Hk-0QRZ)akVIc^ckOxu7Ro0&-ks5`pl zA7GhJ;8$kDf>nNj75CanQz;cA`S?EO&YXMhAO;vm6{i5_oVzZ&x7-IReXcI_%nhp3!3f;J@L+h59v-DmTen|-F&s*+F?WKS9s_LH zDt1K#Z{-j{D}o4B2fB!T^hVox;U?JWdZCRMj^ML*0UU^{*mrtKBq#uNJR2ueL^dz$ zLMKe@oM|VgvwH44hu?zw!0O_3)3J%+7#~{g-qmO}eGvM!*IvKhB(_Lk#|?>xU|f

^FP7&;FI6VSm!>JL7DSpi>$d)({cvwN58#jFoikdqR`5%+v9&EUs$uLVIgMye4 z0cn^%!aals2%GL23w1U-0O(mPh-u7Y-o%m+c$w-<#PiwIVY5CS1CDag5U945w;k!@ QXYC6=#&@zlm)+<8013ghZU6uP literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..ced9446dcefdcab57235cf2f18207296236b0a15 GIT binary patch literal 2586 zcmcIm&u<$=6rPz~|4iaKX`8fFDNFg0Y$M{NAQ4p|YSqBemsCZV6l?35Bv#hD&g{Ar zYs~=%!KFfQZHw$=TNt(cwwPtqb&CHwk-uJyX_NJza43G8U zAN61IjQvT2*PjdqchRD6&`Bn_&uUDu0heOPYeLS+jLaVJnx$-&k+~N_=4Ii)u4QFW zP8_gW4${dNTu#Xnr1|maf-GZHkXKYuPGfdPUOdRuCe)<7v?p{|O{ocG^_jdZXP=2a z=QwwhxmOQi1FLpt7PjP~>nwb+c>-Cbtf{60r7A#=0UT0Zhx zZC};fX{H&pJ8{Z&gX}nd$Q&DO6D_)gZU-hjn(V=Z0UNTP#J;`BUNM)anJCuHwkuMx zw4B<0GfZ55;itvpEvM6Q))M-HZT z+tcuF`_w31fX=jVqLbW=sAK#Z*VA}IBcdYJQ)q#6!Oj_U$h#AC4lt0sCla2pt4xYL zOE1SvS_ym3q)m9q%xDf@*_XLK|CYxHVge+-6IT&bnR_NS*rPjJqG$E&#D)%`zf8c! zk62FxWk?E;1SDC71aFS;c_ur`_@L~dOhYXB9PwLJQ@%pJv;ki1a(xY}&Y7iY=PcS7 zdYnWO?6N_y#+efd@f?~t@n?J_Y=Ex89X=Uz#OETU<+k(Y!6VC5;g=U`n+c)7PxT@ykLWDVnbgpu}O!thE|X52N;{( zZmy~+O%MOZW6(R}0aX;D__=fj=L~m8>3kX?*V5!~t)!lUL4oJjcXZfk*GdTIYva=m zCZ{yj<9E>X1iJ3K>Is+wuGBsG#0wfq{#W*PFDy_QbhZ{9caiF$n@??Gi~&BK{+E)} zLQbYat29T;Jl{`qTD5(zp;DVxgPL#R{Iq;Ru`%b;2?ZjK2epDHWixJuL6lnfJnzd* zs36)z#0qBUSmdkOSy1u{*ED-3z*JLCDDpc7{|7~g9H54w#UMLmTPPU4OfNek1^R5C z3kDeolvsoOa7?gXF3Ct6MPrcINp_C)@+d1AnStb2l3ao$E+i;UG7H&nNq&>XBDRuz zpC`EyJ&y^d9XK~G4~r?kWvY%_)NhfPay6Yify}?H_1h%MQA*VTS*GR1jombB=!C$7 zPpJh|Qp;C?TQI=s1ybcwSE0?B?WT_6S^-4{l?Q;KDyv3_O}17M_6O>#^XR>gjf-dz zL3o0mD2fuF5oKU#%8Ssn4k-^i+GlD!)fdVa%A1I)M9jWt+gu{s5Aun*X(?x2t9ph7 zw2iiWK-=C!hdc8|kN*H15Z750Dx_|ZrDDkDfIz0?(U|q^b#$k+f=VmM?5h6 zFlE-bXq=_L3`pqXQv$E0>UDjCRvUj$J7Z*itrg0Suh!`ni0BFemZE5vOL@CAUAkPh G^86ohC^R+z literal 0 HcmV?d00001 diff --git a/2020/18/__pycache__/test.cpython-39.pyc b/2020/18/__pycache__/test.cpython-39.pyc new file mode 100644 index 0000000000000000000000000000000000000000..24aa10eef12aa7e0ea59877be5f3bedc376ec5d6 GIT binary patch literal 2934 zcmcguOK;>v5Vk!p&uf#-E~`LbF@lA0vSc!zB%4SG1;UC0FbBwKI9O)dNzBfRwkHxJ zZpn3zaE1ei`~dhJoP9xvlm9|ad|!JeJ4-Ss2(-4kTve`q)K}GA?NzHK4bS%*f4HxM z`;)@#lZCK{7VdxuP3T?ifM27lxAl)TkrCN5O=NxjYvVN2&OnnBd1&$zO;#9RXm%k% zZ_Uf zMOECww4?Q{oW&_8m&l3wSDAGu-V$%qOsI@jZD=ywm#HCaXfi+cTd(DUn0 zJlXT=oq_P{ABYpbA6bJ#YagQJY&aYB#!fx*!)Sf@ZCoKU9hne?CWxjlsds#Lg68_H z*%fH%y@GZV%oN&FfI9r&Ouf%6T-{=jzP568NJKhHYM_lG<2-$rm^UqD37%S};ijf*Ox zDykU_dr@gP%=bq-pv~j~cEUx;aTr-;^Db>lO`1U0*hm~GBtj(=IOtkJW|(M0u+cS|vH1ZIWy9N0a_HH-qJ+j3$@q`^zM+fFvK1dzIuh68d=) zWEl3;%@y>x5i-xZybxqA78D5ZytWB6w(NxdUaV|UvqOBq>=GF8v}oGFFH9eM3&Jj1 z?Gd%A(K79Uu4~pdgiYHHeyhX2UaJvg4zX*4)V9^YtCq5~X-+b=ae}=qU_3Vk?_E7$ zjy);fxB~P2`3DR;%m-OusQt(Cp6us2a85h5>{4vHZr|(qt{azJw>J=@F8PYxPXYY&iu z%IjfcgA;P~nm)djE-bwW3>#M#$UBT$pao`jfg9%!=52FU`64aZ0778KW9YYkvXkep{OW literal 0 HcmV?d00001 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) + 9 + 3 +2 * ((5 + 7 + 9 + 7 * 3 * 7) * 2 + 4 * 4 + (2 + 2 + 7) + 3) + 6 +8 * 3 * (6 + (6 * 8 * 2)) + 9 + 9 * 3 +(9 * 7 + 6) + 5 * (7 + 5 + 4) + 2 +(9 + 4 * (5 + 5 + 4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* 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 0000000000000000000000000000000000000000..73acc3cb1a22dcbef206597ca65c8ce53d874281 GIT binary patch literal 690 zcmY+C&1xGl5XWaEt-apXO=|i8hUVZUV299NO6Ug(J{sCkQkE36ShBlhy}OY%E(yD* zNM^?5 z7EogeYm~UbnpJQFABQzhpcWNdvx;w!X0}gR?bWTSRf)|Te3d^*z?ODDol2k?Qd6LOEO>HYK3YE#Qtr?|{xK?H4ovo%?MgHBL zshVVF`I)-3d=;nPLHo4#&v5i9U#ihrte5d1_&FWl7yq?C9n83o&baA@D|>|H#lzk5A=S7$(z`giI+vHte0fPMQKrAu^=E? zA}1_XXcbHAnIcWf=2oH54=B6Ec|g0&B{F`cS<*M{=qVr7pZ#bK96xQe0;R^7t<@482|tP literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..7d6937883af3dc8dac6a670bbee627b06532c8be GIT binary patch literal 1804 zcmZ`(OHUj}5bo-E?65q%25fK=Clgt+Jc+|1B;N>f0^t-P#j7L^k_F@K2CvwiS@#T< zjb<-da+a{FeNKzUIVV$R+uz7qG$3jJl?)x~J-^uCMFc$;rCF^TY73tv`Gr z{$}OP2R3mZqu7Q}vx<~Fq)nkodB2hJRdDEUN@yXpnu?%#+E-)H>S`QXpstY&ujojui6MP2q_`)(5f8+lqUF91g~BYUZP>6#d;PAqK_~0)mj}T@ z-{i`Yxe#3+r6{(c`+kqMTvvK z-4Q>z)j4qL*xxYM;m2HqIAN|Op7l^Chry0Bf>V&@2Jbs(lq;P15VmoQ^O8m6Y(O9I zzr|bdIfjGJm30>xDez4}MZAp*+y9sPeCdWXqP|0vjG`ve@KKugSX@Fn1{+uEHIwf+ zfT!7^kXy{+caeJJ>Z7-v+SzxxXmAw9F35b$Kk)&#oq>&b802{wcc7q$a0wfuaB z2PhTy5Mo}VTm!F^ib{`5Jd|tV(I*4H5|xjYpz^o_Rm|>(=sZ4jniEH8XH_upo-S1q zj7PD}`v{c;*6XFuL9X1CHUOu0wYiA}8>W5ST$O|-X4UVf*iZ-mRY#?zE?_bGnWc{P zGyS~0bilUGci8A+zgu#fDmZIF5k=C+h-ez~37Vpi%%@nna3CHG=a-qQSB_Xr+?59s zyp=d2`4WkMB&arDgkv(d@j-uar_6kEo=+Q&Tio=}sxBk-dub=*Ukh$Nf+R)%`kwiW z9elvzE(D^iBM@hi$o0{8%(Wxyq0zeg;i%5776ylb6LWrS&^PE2Z$x%bW?&WH~ Tt5-OQVgjNbO!4bCrt9He0S1_0 zK?iJbpbI_d!vI{^fn6BFXgLf88fe0};SCQh?4Ura5tr=l;8uio=paX%PP*7dXJu3Y z_Rwy1V{rBqz}_{R?r&)-n{w5!F_H^eEbfy$Gy^J4zooCW-)dj`exSAX{njU&GDNLg zpCYZ+d7{?Zr~GzAGq0w7WtLU3tms!*XtnceWu{3jl~qOg5|x9`CB_m#8LvsH_(pM5 zohX*;C{f7iD;9*8k_X#E1AAa02O literal 0 HcmV?d00001 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 +FBBBFFBR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FFRLR +FBBBFFFRRL +FFBBBBBRRR +FBBBFBFRLL +FBBBBFFRLL +FFBFBBFRLL +BFFBBFBRLL +FFBFFBFRRR +FFBBBBBLLL +BFFFBFBLRL +FBBBBBFLLL +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 0000000000000000000000000000000000000000..1b7fef7fa36be61b80f82d8d40169a11be1a2683 GIT binary patch literal 1618 zcmZ`(O>g5w7@iN?aYB=3yB}zwtb&9<0jXJ50xqj+(V`WnA}ENJC9q6p5~3!yJDw~b za!)A&PW%B5tvHqc!XKC`r#*Ay#Pg1uZo4aN&FgtTX6Bjqd0&6g?RFTRciMlYe};_x zP0HmbfbsyN`WixAQ(TE-o-oao{GF>ng~vf6v{VtamWrVT=f1Y;Knv9tyc_U#Rqr@V zBHdD(2f`#e){$l_w&E+!ndcTw2GCQT_v)eQ*71AYTzgU7tXBhiO6o3IbL1T^M7ZU{9tZe@A(oiWwidn<4Q0>cx{@cNjlj^2E2>j}G)m+bc7QF`c@a*|a%*lQfO_Nm zGoG|PMJW+Y{b+n4$M@&i;v1Fiz6;Yo80^Pw>N}&W<=pPvpBLk7UhQJigbiDMPvetD zB)gz0jP-niisiz|MOLDSUh}>Z<>O1qyaYYzSLJ+W?XxmT#58Nr4B&4db)KF77K|5- z@9Rg9q<32y^13)p7uhUNQ}pknA#aFm`=5e&mG&f%W{U*XTmyW)GS3z|O;FL;*rC(yMLmrER?PncSqxBA literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..c462363b5bf3f958720b68eb1e7f4db805b257e4 GIT binary patch literal 2655 zcmZ`*-)|d55Z>MU;j`noPMW4kNvVY>U=)(56nF`3P)o&=C5V8^P`QqG-^*(en<%MiYk7NH-10((&lVp;2Sv`C5I+vm@$fWmQsvaz|{$~5X0P8> zjc~uWrF2Wso8zB@CxLMbB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Mg!mgL8H+_ z^=mX9+dH{_6T4M$CsQ$b&gd)HuDf5vQJ5*5hiqFbYKzgf)X={Ltclj(bEjpp1hqzz zeW|+@Mcos%VY8 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 0000000000000000000000000000000000000000..3762f19b4a59176574732ca018f48e1dbf986e2d GIT binary patch literal 1735 zcmZWpOK%)S5bnpkcC$8{#Mn3_u!kJHLh@RXB66^-pjZ~Cm56z1MYLK?x9wqfXU08a zqo5fsYpx)!ykvuflpnyI-+*!&<;KZZ4jg=euXluj|nt&CS&r#`E9) z?EmgD_7@44hXdguX7(6FH5FIli1(Q0O8&@|que8>CzPlBBi55DP&KTMx~^Sy4f_o> zcjWdw?W_5rFkKyJPqPV|@CoNky|&HTH?~5Kn`c9SAwZ8XvvrW170lEXkA)ISPQ+0c%t3m_d)J~EFFFYG zD2ZPR30b?CHUqc86o{qbUyEg%3uJ*2KjAw95tiLkdci5Z08x@roSS*@SJ7Ng2PV^a z+PPEmkx{xCH#a~-%ae>jJl$(S+yz5rFyV?XA?->GU2|K>g8#sN60t+;5~bVep7GWx ztl1fVhtR+oVkX0}s(5@A(gM`|xSuDNQBmk-sFuNp^sw0={v6dN1cZj8t``avCy+@B z33L*=l|mGRcBXTndpNVB9kR7W>UJv`C+Vrpqx^iFR&o%A7H!)xOK@Y}0I7In?vOwz zro`s?=B1eSjm{26dDei5C5#8W@&7b$)4?}E5SqrNQ`t+Qr|u&cHuNokQoIzH2sZ*R z%=hFkwZ zYHRQ;_Q9d->Rm%$hYju4hlY9vZApu{H6y40V%Yq(eblASkz}Q&DWU4G=P)gn*Kuj~0EBUeJ0jp7>ZLAP0uuK`gEygbAl3PzX!2WFJ!s}Jo7U2-;A|E2 z`{O|r_xs&8-)i$|oz?7bV-{gxd)z+EKAOHzbm#17JQ(YKzj9MUAIL?8Th5kwus%-I W!ANh|-;4^p?##=;32M!ifd2;pws6z{ literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..51b593455e41a1cb2b83d60788bef3c07f5ab5be GIT binary patch literal 1679 zcmZWp&1xJ+5bo~z+1b@-wUUJ;J9dx*FFSXVrZZK z`KmwfGxirPt~L*gkI~ETAS9DKWf7AL(vj{dkGK-bk=_d-ec3p5BUgDcc)?{;wy^T$ zH6>(-^{i~4dQn3Ka&BMfNHtYMaoLgc&-e*G4!hf|yEuUlwzWCnG@dtskwSccUamt_ z%rM=OJQq?(=S2LpGUn2i-YGNujK5?L*$Mxe3HCnwf_=$;W7~H82EoIHzg7EXoE536 zy(BLVs+#NnxpU!Vo7^oz?7`hmIOcGRNPiY1cbomry1aIhyy}Wttgh8=n&e7Ts;u~X zwfA_Ksos99v$!`HO4a*B9;&=r8Sbt;z;fmO+WocOhrL1%_g0Iey0xArWi=RP#ReHE zDF7c=IKI87s=keLbv+#p;HiFqgpI{C7Z2Ia2V=)DQ7c}mQbvC*?3XK35VrxQ3BbT0z^F7sV=sB!)2cixNTq=76pmX#eP}7L#>{o|qItna{#MZI+Xa!mGl1gP|?G>8H;OHB$QoH-=2z!TddT@ml zQxw`(^D^XX(6?wa-r@Rftn@rYm)k@PD8h?INx1~#F7jr$;jL;n^Pz}!5q1rI0 z3BbXPQwf7wuyFi%1r7jm=DcM44gI@j4L1mm}2DlmkIDm$0GqH?JG{-H|Fiq%7 z(=vf+0zzp5>%*S1uzTmQ&%o9U?1Uz?umf}xTG)RX-OJMow4jVi_n9-Et+@2AM7cF? zSA4oQ?PbJnDQ1a;_}WYC2La1-m2c)wxS7T6Usny9R{_Z-lnl3hn~h$NUY%FGP3eS? zo)A7n_9E7mEtCmyz1y@L(F>T@PKtu^EqJBANjohfnO5aNTGdW@kkw9>?#C43VM5qlxG zC+nc!&*CKS_w_qC4&KpKx_lGw2oZ6!+lt(yI7{s_LGN5yX=0&G7#@veP)%t|agen< m&J?V@MLLx7E5bfQ!Fo272dUbi$}dBRK(xHhOxx|;3HU!3OJ(u^ literal 0 HcmV?d00001 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}") +