From ad04dffb69c86441a0b0cb6a13615dc5b252983f Mon Sep 17 00:00:00 2001 From: Teo-CD Date: Fri, 4 Dec 2020 23:10:35 +0100 Subject: [PATCH 01/28] 2020 AoC, Days 1-4 --- 2020/Day 1/Solution.py | 76 +++ 2020/Day 1/input.txt | 200 ++++++++ 2020/Day 2/Solution.py | 32 ++ 2020/Day 2/input.txt | 1000 ++++++++++++++++++++++++++++++++++++++ 2020/Day 3/Solution.py | 36 ++ 2020/Day 3/input.txt | 323 +++++++++++++ 2020/Day 4/Solution.py | 78 +++ 2020/Day 4/input.txt | 1029 ++++++++++++++++++++++++++++++++++++++++ README.md | 8 + 9 files changed, 2782 insertions(+) create mode 100644 2020/Day 1/Solution.py create mode 100644 2020/Day 1/input.txt create mode 100644 2020/Day 2/Solution.py create mode 100644 2020/Day 2/input.txt create mode 100644 2020/Day 3/Solution.py create mode 100644 2020/Day 3/input.txt create mode 100644 2020/Day 4/Solution.py create mode 100644 2020/Day 4/input.txt create mode 100644 README.md diff --git a/2020/Day 1/Solution.py b/2020/Day 1/Solution.py new file mode 100644 index 0000000..262cf90 --- /dev/null +++ b/2020/Day 1/Solution.py @@ -0,0 +1,76 @@ +target = 2020 +input_file = "/tmp/aocinput" + +def find_sum_of_two(): + large_n = [] + small_n = [] + + with open(input_file) as file: + line = file.readline() + while line and line != "\n": + halftarget_count = 0 + + number = int(line) + if number > target/2: + large_n.append(number) + elif number == target/2: + halftarget_count += 1 + else: + small_n.append(number) + + if halftarget_count == 2: + print(f"Found a sum : {target/2}*2 = {target}\nAnswer is {(target/2)**2}") + break + + line = file.readline() + + for big_one in large_n: + complement = target-big_one + if complement in small_n: + print(f"Found a sum : {big_one}+{complement} = {target}\nAnswer is {big_one*complement}") + return + + print("No sum found that can reach {target}") + +def sum_search(target_sum, inputs): + lower = [] + upper = [] + + for num in inputs: + if num < target_sum/2: + lower.append(num) + else: + upper.append(num) + + search_list = lower if len(lower) < len(upper) else upper + iter_list = upper if len(lower) < len(upper) else lower + + for num in iter_list: + if target_sum - num in search_list: + return num, target_sum-num + + return False + + +def find_sum_of_three(): + data = [] + subtracted_to_target = [] + with open(input_file) as file: + line = file.readline() + while line and line != "\n": + data.append(int(line)) + subtracted_to_target.append((target-data[-1],data[-1])) + + line = file.readline() + + data.sort() + + for sub_target in subtracted_to_target: + result = sum_search(sub_target[0],data) + if result: + print(f"Sum found : {result[0]}+{result[1]}+{sub_target[1]} = {target}\nResult is {result[0]*result[1]*sub_target[1]}") + return + + print("No sum found") + + diff --git a/2020/Day 1/input.txt b/2020/Day 1/input.txt new file mode 100644 index 0000000..ba38c4a --- /dev/null +++ b/2020/Day 1/input.txt @@ -0,0 +1,200 @@ +1322 +1211 +1427 +1428 +1953 +1220 +1629 +1186 +1354 +1776 +1906 +1849 +1327 +1423 +401 +1806 +1239 +1934 +1256 +1223 +1504 +1365 +1653 +1706 +1465 +1810 +1089 +1447 +1983 +1505 +1763 +1590 +1843 +1534 +1886 +1842 +1878 +1785 +1121 +1857 +1496 +1696 +1863 +1944 +1692 +1255 +1572 +1767 +1509 +1845 +1479 +1935 +1507 +1852 +1193 +1797 +1573 +1317 +1266 +1707 +1819 +925 +1976 +1908 +1571 +1646 +1625 +1719 +1980 +1970 +1566 +1679 +1484 +1818 +1985 +1794 +1699 +1530 +1645 +370 +1658 +1345 +1730 +1340 +1281 +1722 +1623 +1148 +1545 +1728 +1325 +1164 +1462 +1893 +1736 +160 +1543 +1371 +1930 +1162 +2010 +1302 +1967 +1889 +1547 +1335 +1416 +1359 +1622 +1682 +1701 +1939 +1697 +1436 +1367 +1119 +1741 +1466 +1997 +1856 +1824 +1323 +1478 +1963 +1832 +1748 +1260 +1244 +1834 +1990 +1567 +1147 +1588 +1694 +1487 +1151 +1347 +1315 +1502 +546 +730 +1742 +1869 +1277 +1224 +1169 +1708 +1661 +174 +1207 +1801 +1880 +1390 +1747 +1215 +1684 +1498 +1965 +1933 +1693 +1129 +1578 +1189 +1251 +1727 +1440 +1178 +746 +1564 +944 +1822 +1225 +1523 +1575 +1185 +37 +1866 +1766 +1737 +1800 +1633 +1796 +1161 +1932 +1583 +1395 +1288 +1991 +229 +1875 +1540 +1876 +1191 +1858 +1713 +1725 +1955 +1250 +1987 +1724 diff --git a/2020/Day 2/Solution.py b/2020/Day 2/Solution.py new file mode 100644 index 0000000..cbbc5f0 --- /dev/null +++ b/2020/Day 2/Solution.py @@ -0,0 +1,32 @@ +input_file = "/tmp/aocinput" + +def letter_count(): + valid_passwords = 0 + + with open(input_file) as passwords: + line = passwords.readline() + while line and line != "\n": + elements = line.split(" ") + min_req, max_req = elements[0].split("-") + password_count = elements[2].count(elements[1][0]) + if int(min_req) <= password_count <= int(max_req): + valid_passwords += 1 + + line = passwords.readline() + + print(f"There are {valid_passwords} valid passwords") + +def letter_position(): + valid_passwords = 0 + + with open(input_file) as passwords: + line = passwords.readline() + while line and line != "\n": + elements = line.split(" ") + first_pos, second_pos = elements[0].split("-") + if (elements[2][int(first_pos) - 1] == elements[1][0]) ^ (elements[2][int(second_pos) - 1] == elements[1][0]): + valid_passwords += 1 + + line = passwords.readline() + + print(f"There are {valid_passwords} valid passwords") \ No newline at end of file diff --git a/2020/Day 2/input.txt b/2020/Day 2/input.txt new file mode 100644 index 0000000..427015c --- /dev/null +++ b/2020/Day 2/input.txt @@ -0,0 +1,1000 @@ +1-13 r: gqdrspndrpsrjfjx +5-16 j: jjjjkjjzjjjjjfjzjjj +14-16 r: rrrnrrrrrcnrgxrr +1-3 k: bkktwhgktv +3-5 q: dxqqqzmqvs +11-14 s: sssssssssssssv +1-3 d: cdzdq +13-16 q: scdqpdgpkvbwwqbv +9-10 d: ddrdddlddd +15-17 v: jvvvvvvgcvvvvrcvnv +2-3 s: xssx +8-15 j: jwjjjjkhjjjltjmjjjr +7-15 m: wqspfmtpjftmplwp +1-11 s: swdgzhgsxtssndzfm +3-4 b: bgjrg +1-12 x: jxgxxxpjwpsht +5-15 x: xxjxwshpxjxxxxsnxvz +4-11 r: bjnrpswfprrng +12-14 j: wjjzmwnmmvzsjhnnkj +3-4 d: dddv +2-4 b: bfxx +15-16 r: rrrrrrrrrrrlrrphrr +6-11 j: jsljjjjjjjj +6-7 m: mpttcmmmmng +6-7 g: gsggggg +2-10 b: nbtbqbbfpb +4-6 h: hhqhrzkcrhh +13-14 b: bbbbbbbbbbnbbbb +5-6 g: gggggg +5-6 x: rsxvxx +3-6 q: wxqzqqqtzsq +1-2 h: sjhj +6-18 t: jtptcwtbfgffpkdwthbf +5-9 w: wwwwcwwww +15-16 g: wqdwztbmrqdmgmvc +8-15 t: ttttgztvtttnttb +9-11 r: rrvrrrrnhrzr +8-9 l: lllllllqwl +10-11 h: hhhhhhhhhhd +3-5 g: gggrwqc +5-12 f: ffcdxfglcffsf +6-7 f: fffffzk +3-5 b: btbbbb +2-8 z: wblnvfzzwzzbchx +13-14 r: rrrrrfrrrrrrlf +2-9 r: wgbmfvksl +5-12 m: xrmmfhmqdhmmvhvrzmwq +3-4 j: jwpd +6-8 v: mvfwgskpxgvcsr +1-3 c: ctpr +2-8 d: dzdfsddd +10-14 c: ccccczcccccqlchvclcc +2-8 s: sscwcfssssssdt +2-11 l: xlsslrlclfls +7-8 r: rrrjrrrrtdcr +7-9 z: zzzzzzzpzz +12-14 r: rrrrrrrrrrrprrr +13-14 g: hdczwngvjtgmhn +1-7 q: qqdqqqqvq +5-6 q: qqqqql +11-16 p: wgwrzltpskwgxprm +4-12 d: dvddddddwddz +15-16 q: qqqqqqqqqqqqqqqqq +1-5 m: mmrjmmqsjkm +13-14 m: mlmxmmmdmgmmmw +4-5 q: qcqvmhqdq +2-3 m: brdzbfzj +3-4 s: snshj +5-9 k: kzpkkbkvqjktrk +12-13 t: fltttttttjtpstttt +7-8 c: kcccfccccxtcc +2-6 q: nnjqqd +2-9 n: msnvnrxgldqnxnngsn +2-4 c: scccwp +12-13 c: ccbccqdcccfcvdccc +6-7 f: fmdffffxcbbpffl +2-6 r: rbrrrvr +7-10 j: jzjtjjqfvjj +3-7 j: jjrjjjjj +2-13 m: mmmlmqddkmtmmm +19-20 l: drpwllkdlsjslmllsdrv +3-5 v: vxmrwwvh +5-13 z: zzzzkzzzzzzzkzzzf +5-6 g: gggggfg +4-6 c: crfvlc +14-18 x: xxxxxxxxxjxxxzxdqc +4-7 p: plzqjtp +2-4 v: nmdbhftxvbv +5-8 s: knfcsbbsxssssxd +2-13 p: mpwpnbrnlxmqvfbltcq +7-11 v: vbvvvkfvvvg +14-17 x: xxrxxxbxxwmhxxpxqxv +5-7 f: qffndfmqfsrv +7-8 v: vvvqvvbvv +9-10 j: jjjdjjjslljjjjjch +4-6 l: lllplgr +3-4 n: nnqn +4-5 c: ccccc +1-2 q: lwhqw +6-7 d: dddmddqd +6-7 g: gggggzxg +2-10 j: jsjjjjjjjsjj +13-15 b: dxbbbbbbbbbbbmbbbmbl +5-10 q: qqqqwqqqqxq +12-13 j: jjjjjzjjjjbjxjjb +5-10 t: ttfttphtttttmthttp +3-4 t: tttj +7-8 n: nnknnpphfwnn +9-10 x: xxxxxxxxcx +14-17 h: hhkhhzxhhhhhhjhhxhh +4-5 w: whxtwwftw +10-12 q: xqgqsqqvqqlqqqdqpqrq +1-3 l: jsvlzrm +8-16 z: sbzzqzxzzzskzzxgrzcz +7-10 k: kkkkjklkkt +9-11 f: ffffwfffwflnwf +1-8 c: cmccwcqzzhxccr +6-9 h: vnfxddhrhbdqkqr +8-9 t: tzttdtttvvtb +6-9 q: qqqqqqqqqqqqq +15-17 k: kkkkkkkkkkkkkklkqk +3-10 p: pprppppppfp +5-11 d: nhgkdjgvmdddt +7-9 d: rdddddddpd +1-3 r: rrwrr +5-16 t: gttwtrqqmwwljhfn +6-9 q: qqqswdzllqqf +7-13 b: mxpxbjgvsncqwv +7-8 d: dddddrddds +3-4 z: zzqzz +10-18 z: zzzqzzzzbzzwzzpzzzz +8-9 p: pppppppppp +13-16 f: fffffffffffffxtf +8-9 w: fwgwwwlsfpww +4-5 g: grgmcpdqggwckq +16-17 g: gggggwgggggggggln +3-13 j: jjmjjjjjjjjjbjjjjjj +9-13 x: xxxxxxxxxxxxx +5-12 b: bbrmbhbbsgbbbpbbz +14-18 z: zzzszzszzzzzzzzzzzh +1-13 k: pkkkkkhgfkfbtkkpkf +3-14 v: vvvpdlvvvvdfvvjvvsv +12-13 m: mmmmrmbmmmmmmrmmm +12-14 v: vvvvvvvvvcrlvkvv +18-19 p: mxpppgpwcphkzppktppk +4-10 x: xxxxxxxxxxxxx +4-5 k: kklkkk +11-13 m: mmmvmmwmzwmmmnvgmm +7-11 p: qdppjspwtcpppp +4-8 l: lllllllll +12-16 j: jjvjtjjsstfjjnjjk +15-17 h: phhhhhhhhhhrhhhhh +4-7 j: sqfjjjj +3-20 m: wzmqhwmjmclzmmmdlzqm +8-13 m: jpmmbmtgmnprgt +8-13 h: hhhhjjhchhbhqshh +15-20 b: mbbbgbbzmkbbkbbpffqb +2-3 t: tdlt +10-16 l: llllkgllrnllllll +2-4 p: phpf +3-5 d: ddddd +5-6 h: hhhhhhh +2-3 j: cjjrj +7-10 g: hgwtggfgbcpgd +3-4 d: dddk +4-6 t: mltdtf +8-9 h: zhljxshhh +2-3 p: vqjgbsp +6-7 x: gcxvjxp +15-17 s: sswgssdsgssjlssss +1-3 m: qvswmm +1-7 v: svbrvsjv +3-5 j: vjhjdq +15-16 b: bbbnbbbmbbbbbbbdbbmb +6-19 k: spkgcpkhlkkthkgkfzkj +1-2 c: dxqxnrrlfnnc +7-11 j: qjjjjjkdrjjjjj +5-11 g: ztdgvvgwhrlgnq +3-4 c: fcmqglp +4-5 q: qqqqqqq +6-7 c: cccccrc +7-11 n: nnnnbnnnnnn +9-13 x: xxxxxbdtqxdwxsx +9-15 j: ljjjjjjjjjjjjjz +2-11 j: pjjhzmtwlgjwpkjjdwq +5-6 k: kkkkkk +12-13 q: qqqqqqqqqqqmg +3-14 j: nwkjjlbbrnqvqm +3-4 h: hhhhshhhhhhmrh +2-4 l: djkxl +1-9 t: tttttfttl +9-10 g: ckggggtggggggv +3-12 l: cqlclvwhpxwlnzzsqgs +8-14 d: ddddddddnddfdh +1-5 v: vvvvxm +2-5 q: mqqqqlqk +3-4 j: tkjpj +13-16 w: wwwwwwwwwwwwwwxww +13-18 m: mmmmmmmmmmmmmzmmmmm +2-4 x: xxfxx +1-2 d: ddvddddkdddd +3-5 c: cctdc +2-10 q: tqjkqqpsctx +2-18 n: nlnnhnxnnnnnnnnnnln +3-7 k: rkkkbkk +3-4 n: ngnn +3-11 d: dqdbwtbghbdj +3-5 q: fqqqq +5-10 x: xxxxfgxxjbxbhxx +5-6 m: mmtmcn +4-6 x: xxxkxk +17-19 b: bbbbbbbbbbbbbmbbbjbb +5-6 k: kkkkhk +10-12 k: kkkkkkkkkpkgk +3-4 z: zzzz +18-19 p: plcppppksppcnptppvmp +3-6 t: tdtrltmn +3-4 q: qqqq +10-19 v: vvzrvvvvvvvvvvvvvvhv +11-16 d: kjdtddddkdvcdddpd +12-16 l: lllllllllllllllll +4-10 b: dbvbqfqlrb +10-11 k: kbkvkhlkqrv +1-9 x: sbqnkxdmxpc +5-10 l: ldlllkllrln +9-13 j: bpjjjjjjjkjzjnj +11-12 j: jjjjjjjjdjjj +2-8 l: jllzbhjlqlwcltllq +4-5 s: gsssd +2-4 s: kswn +1-18 p: bpppppppppppppppptp +9-11 v: vhvvvvvvvvvv +2-5 v: vvkvvv +8-11 p: plplqpjhdzlfpppppl +11-18 g: ggggglgvgcgggggggg +9-11 r: rrrrwrrrmrzp +3-12 g: tggggmggwnpzvgpnp +13-17 t: tnvvttxttttvtftptgt +5-16 c: cccqccccjvcccccccczc +2-4 f: tfbfrjftf +2-4 s: ssssx +3-9 v: vvspvvvjv +3-4 h: hhxh +15-17 l: lllllllllqllmlvwblll +4-9 j: rjljjjjfjjskdkwttbjt +9-10 m: jmmmmmvmhh +1-8 w: wwwlcwgwwwp +1-8 j: mllsjncl +3-4 b: tfbkbssb +1-7 g: qvdbrjkdgggb +1-3 l: wlbll +4-6 v: jvzqbvvvg +2-3 w: vjlwx +10-12 c: ccvcccrccjfhgccdw +10-18 b: bbtbbbbbggbbbbbbbvb +8-9 j: jjjjjjjjjpjg +5-15 c: ccbccccccccccvccc +16-17 t: ttttgtttttttttttthtx +13-15 t: tvsmjtjttktztrt +9-12 c: jzrpnzdncldmxqjmvccb +6-7 v: jjdvpdhv +4-5 c: ccccccccccccc +6-7 t: ttzttttt +10-11 q: qgxqqqqqqqqqq +14-15 h: hhhhhhhhhhhhhhh +3-8 b: bbbbmbbbbb +11-12 r: rhlrsrrrrjrr +2-6 v: vrvvvhv +4-5 n: nnnhn +3-5 p: pqhmnjp +7-13 h: qhhcwhhhhqhhfq +10-11 d: dddddddddxh +10-11 d: gdcdcdddcddtddsddd +1-5 f: bffspf +5-8 s: skssblsg +8-11 m: mmmcmmmwmzmmmvm +6-8 q: kqqkmqhqq +2-8 q: nqnqbdgm +6-11 b: bbbbmbbqbbb +5-14 q: qqqqpbqqqqqqqgqq +2-5 p: prprwh +13-14 k: kkkkkkkkkkkkkkkk +2-7 v: vnvvdlwvd +2-3 t: hpsqzxrltrwbttwgbz +1-5 n: srnlwnnkjnnwhnf +2-3 r: dtlcv +2-5 h: hhthhdcm +2-11 d: rdxfbdhqpbdjjlhf +1-4 b: bxbshbjr +4-10 s: sthspqlnsst +1-10 h: mhwpfrbhhbn +16-18 g: gggggggglgjgggqcgzgg +3-4 d: dddd +12-16 h: dhhhhhhhshhhmnlhhhh +15-19 q: qmqkqqzqtqdqnqqzqqz +14-15 p: kgjpqpppppqpdpph +4-6 z: zzlzzztbbzzr +11-14 l: blllwlqmhlllldllll +2-4 q: qqrqc +5-6 r: qrrvrrr +2-4 f: fffv +13-15 v: vkvvvpvvvvvvvhvvvv +3-8 k: kzqkkkkkk +4-10 w: wvkwwcwxkwv +2-6 t: tvtttttttt +3-4 t: tttt +11-12 p: pzpzppplplppppk +6-12 p: pppppdpppppgp +5-9 w: wwwwwwwzwwww +4-6 m: mmmmmhmmq +4-9 j: xsqjsllnjj +6-9 c: zmcdccgtfccbccfc +4-5 p: vwpzhpp +15-16 v: pjtmwtrxmjnjfkvgrv +9-10 p: pppppppspp +2-10 f: vffzxnfnxfcfcsmtrncz +5-7 v: blwvvvvfvvh +12-16 z: zzzzzzzzzzzzzzzr +5-6 z: zkvhpz +9-13 w: wwnwwwwwwwwww +5-6 p: wmlhpptppmfvngh +9-11 r: rrrrrgsrrdrmrrrr +2-5 b: bbbbzb +13-15 r: rcrrrrrlrrrrqgfrrnr +5-7 k: klkmkkk +3-4 f: zfffgdnfff +3-4 q: qjbjhzltvl +17-19 w: wwwwwwmwwwwwwwwwqwqw +7-9 l: nlrldrlvlnvllllvf +8-9 m: mmmmmpmmm +11-16 k: kkmkkkwkkkkbkkkkd +11-14 s: mvsdsnsncsssrs +6-17 j: jjjjjgzjjsjjjjjjjjd +19-20 p: ppppppppppppppppppkp +1-16 k: nkkkkkkktkkxkkxz +2-4 c: xkcccvvcv +3-4 v: vvvvvkn +11-13 q: qqqqqqqqqqsqj +10-13 g: gxggggggggggg +3-4 x: xxpx +4-7 d: dvbddcdhdd +17-18 g: gggggggggggggggglbgg +18-19 m: mmmmmmmmmmmmmmmmsmtm +4-6 g: xbtgrgbgggmgcrx +8-13 w: wtwcwnwwwcwssxwpbw +2-3 v: vcsv +4-5 g: gggpt +2-3 g: tggtpgkg +3-4 p: pglt +9-12 v: vvvvvvvvvvvvn +11-15 f: fhffffffffnfffq +2-5 s: snssk +2-3 m: mmmm +10-14 x: xxmjbxbxkbwjxxxxj +5-14 l: lmlmlczxfsllzpkljt +6-12 n: nnnxpjtbjjdnrnsvxnwt +5-9 s: ssssfsssb +3-11 f: bffrlbwzfpf +3-4 t: twtt +1-4 r: rkxrsrlrr +7-8 x: xxxxxxlf +9-15 d: nddbddddxdddrdntdd +16-18 v: vrxvwgbqtlkzprlvwvrk +9-10 l: lllllllllzlll +3-18 l: mfllwjggswwjjgrnrl +5-7 j: jjjtjxjvqjjltjj +5-14 n: nnnnnnnnnnnnnnqn +3-12 l: pllqlhpllpklcds +2-5 f: fsgfrpfflq +4-8 q: xqsfqqqrqhqjsqndz +1-5 c: hcttt +13-14 r: rrrrrrrrrrrrrgrr +4-6 d: dddddt +3-4 d: tdqgdk +14-15 s: snskdsjxpsgmbsssssf +3-5 m: mhlcxmmmw +2-12 c: ccmccchbrrscv +14-16 c: ccccccrccccccccmc +8-17 w: pwqmtwwwwrwxwtmmww +5-8 h: hhhhmhhmlb +10-12 b: bbbqwbbbbbbb +6-7 n: nxnnnnl +7-10 v: vcvgvtgvvkwvtlvcv +10-11 t: ttttttktttttttt +2-5 t: tzdtkpsf +4-5 r: rrrmhr +9-10 w: wcdwxgxrwwwk +1-6 g: jggggcg +1-7 v: vvvvvvvmv +12-15 q: rqqqqkqqqjqqbqqqqqrq +3-10 w: vwwgwwwzwwwwxwwxsw +3-4 c: mmhfccccjclccrdccc +1-5 m: mmmmm +4-5 h: vhhxh +13-14 z: zzbzzzzzzzzzbcz +9-11 k: bkkskkkkkkk +1-6 j: jxvjrm +4-6 f: ffffff +3-5 m: mmmmmm +1-3 x: xxxxxxxxxxx +16-17 f: fffffffffffvfffrxf +3-4 f: fwff +2-11 j: zvbdwnthjfh +9-10 f: gffffffffff +1-3 z: zmrnxvs +5-16 k: llkdkrkvkkhkktkktlkd +9-13 z: mvjzzzkhzvzxzqmf +4-5 d: flgsdd +2-6 p: mftwthqkqqkp +2-4 f: vfff +7-12 w: swwwwwwwfwwwwqwfvw +10-13 c: csdkvcctnccncczc +12-15 q: qqqqqqhvqqqmqqcfqq +2-8 v: gvkfgbzvvmfmg +3-14 m: txwnzwhmcrnnltc +8-13 v: zsvmsddwnkvrkgmx +12-13 f: fffffffffffff +1-16 g: trrkggqglgbbgljx +13-14 c: ccxcccccccmccd +9-12 x: xxxxxxxxcxxlxx +10-14 q: qqqfcqwqqpqqqs +11-16 l: xllllllllllllbll +12-13 v: vvvvvvvvvvvvvv +17-18 g: gggggxggggggggggpcg +1-5 x: xxrxxklxgw +4-5 f: fffqt +10-11 l: llllbklllsgxllr +6-9 r: crfmrsjhpf +4-8 h: hhhchhhx +6-12 v: cvlvvvtbqcsvvzvlztv +2-3 x: bsgfvxdl +2-5 j: njzjjj +13-14 s: ssssssssssssfw +8-11 l: jllfllllllmlllll +2-11 p: pxppppppphq +6-9 f: crtfxvfmwwdvt +3-5 n: nnnnnn +3-4 h: hhhh +3-5 d: kldhd +18-19 x: xxxxxxxxxxxxxxfxxbs +4-5 k: kkkct +9-12 n: nxlnnpnnwnnb +2-4 g: gqggz +15-16 z: zzzzzzzzzzzzzzzz +8-10 p: kpcppjbrzqpfcpgppp +5-6 g: qggggrg +7-8 c: cccfncccccc +2-8 k: hgnsbkckkkqktkstks +3-14 x: xxlxjxxxxxxxxvxfbx +1-8 l: lllllllll +1-2 p: ptbmvp +10-15 k: jkkkkktkkkkkkkkkknzg +6-11 k: kkkkdgkkkkk +7-8 m: mmmmmmmm +13-19 z: zzzzzzzkzzzzkzzzvzxz +2-4 g: tghm +3-8 b: bbbbbvdb +6-8 d: dddddrvxdddfdd +5-10 m: mnmnsmmmmxmd +1-8 r: cgcnqrvfb +16-17 l: mhjqbmhszwllqqllr +2-4 s: csssts +7-10 j: jjjjjjzjqt +1-12 x: xmxtxxxxxtxxzdxx +5-6 w: wwnwmwrw +10-11 p: lpjpgpqpkpprdpppp +8-9 k: zhkkbkfkk +1-2 j: klhz +6-13 d: dmstddpddtddddddd +1-8 h: khvcwhhhhlj +8-11 s: bsssbzsfdrsssss +1-18 s: xsssssssssssssssstss +8-15 l: xjllsmjtlllmsxll +1-5 m: mmmmmm +17-18 k: kkkkkkkkwkkkkkkkbmk +1-7 t: tttttgtdclpkx +4-14 k: tgvzgdwkgtcdrd +2-3 z: tzprzcdzhnnll +2-4 j: rntmnjxbwq +5-6 r: rrnjnr +5-9 g: lrggvfggp +4-5 s: sssdl +4-18 h: hhhhhghphbshhhhhhhhh +4-6 s: sfpjvsk +1-10 m: fwgstfsjmtp +4-8 w: wpwwwwwmwsh +2-19 l: lnllllllllllllllllwl +4-15 v: vmwhvvwvvvvsvtdvvkv +5-6 p: lpppslppjppp +5-7 p: ppzppcmdppt +14-18 f: mffxfftfwffdffffffff +4-7 v: kvvdvjvvkmh +1-7 p: rdkzpkfdpzrxq +2-3 h: cdhhngnnjslfjbh +3-6 q: qqzqqwqt +5-10 s: kpcsszfcwsh +11-12 g: gggggggggggw +14-15 w: wwwwwwwwwwwwwsp +6-10 h: bhkzhhhsbhhh +3-4 l: fcnvfxtln +2-7 j: jzsjfrjjjmxqjxjjss +6-9 s: nvdhnsbhsdwxhlj +1-2 v: vvrp +2-5 h: qhnbhfbsdhs +3-4 x: xqvzps +3-4 m: mcmm +9-11 l: srdlflnwlrl +1-8 x: cxjgmlgwvqdpnbzn +3-4 q: qqqk +4-5 r: wsdlmbdv +1-3 d: tbtdddp +3-8 g: gsggsggvgggpgrgx +5-7 t: ktzrvktqpllxwzt +1-2 s: spss +6-19 d: dtjdmqdldddbdcnzkqpd +9-11 f: fffffffffzf +1-12 g: wggnvsgcrgmx +5-7 f: qfpzfmkfmfjc +14-15 j: jhjjjjjjxqjdvvfj +6-7 v: vvtvvqs +4-11 q: qqqxqcqjqqmqqgt +1-3 l: gbkhxlzld +1-4 s: pssz +13-16 x: xxxxxxxxxxxxfsxpp +3-6 p: mlptcpvcrppn +13-15 x: xxxxxxxxxxxxxxxxx +13-14 f: ffffffffffffff +2-5 j: jjpwj +2-7 r: xrrzrvrkjr +8-9 m: mmhlmhmmmpzpmmhgmvz +3-4 g: zgggdwgggdl +6-9 t: tttttxjzttttr +1-4 h: njzthhch +3-14 x: xprxtxbpxxxxlg +9-15 q: qqqqqjqqqqqqhqqqqq +4-6 w: wwfwwwrb +6-8 w: wwwwwwww +10-11 k: kkkkkkkkksl +3-4 n: nnqfvfn +11-13 c: ccccccccccccc +5-9 n: vnvnmnnnqfnq +13-14 f: ffpzrfflffffffqffff +17-18 p: ppppppppppthpppppzp +3-8 m: hsmzgwdmm +4-7 z: zlzhtzcnzzzz +6-13 b: bvbbbhbbbbbbgbb +11-16 x: lpxtdgxvzbxpcwxc +10-14 d: dddddddddrddddddd +2-5 j: lhjnv +2-3 p: pdkp +3-10 l: lnllqjpgqfl +1-4 t: ttttttt +4-8 q: qxzqqqfczksrwmmzx +1-4 l: lllll +5-19 z: ttzhzcbczmjxzrjzpwz +4-7 s: sgssssjs +12-13 s: sssssssssssbq +9-12 h: hhhlchhhvhwb +5-13 n: fncqnnnnwkhnn +10-13 g: ggggjggggrgcqgg +8-12 q: qqxqvqqmqrpdrxqq +5-6 l: ldwlvnllwq +12-15 v: cvvvkvvvvvvvvrvvvl +6-11 x: kxmthvnkgxq +6-9 n: nfdfnkmnln +3-5 x: nqcxt +2-7 p: tpgkbpwxhpzldtmrqd +8-9 r: rrrsrrzrrmrr +3-10 x: fmmjlxbqlz +1-10 g: cngggggqghf +10-11 r: frrrrrrrrgj +2-5 q: sqgqq +7-8 x: cxxxwxsvjgxx +8-16 t: ttttttgpttqttttt +4-8 n: ndznlllnqwpmnnfwvxb +4-15 j: jjbszvrjjjjfjjjwjjcj +4-5 c: ccvrlc +17-19 f: ffffkpfffjxffwffcff +3-4 z: qfzzz +7-9 s: szssssjsm +13-18 q: lngqqpvqqdjvcqdqvlq +7-8 b: bbbbbbbb +2-4 n: lnqr +11-13 k: kkkkkgkkkqxkhfk +2-4 g: tggqzdxp +3-5 t: ttvtft +2-4 v: pzbbr +1-4 h: thhhh +2-5 m: mqxdt +8-9 k: kkkkkkkkk +2-6 w: jqfwlhv +17-18 x: xhxxxkxxxxxxxxxxxbxx +9-10 p: ppwppdpxvvjzpp +10-16 h: hmhjpxmhvnhqhjfmb +11-15 k: kkxkkkkkkgckkkcs +5-9 b: cwcbjsqbdwmbw +10-11 z: zzzzzzzzzzz +14-16 w: wptvwbwdwwwwwwww +8-10 c: xccclcchcrvtqc +7-12 r: rhnrrrrrrrkqrrtm +3-5 h: hhrhph +7-10 c: wblrcccpctnhvdc +15-17 n: nnnnnnnnnnnnnnnnn +5-13 s: ssssssssrssmslsssv +8-19 k: pvqbhlzkwpnkcgkvkwk +4-5 s: pkrxgskxsswbqwlfxsvw +5-10 d: ddsbdcdsdd +12-13 q: hwrkqrhqrrxmw +5-15 b: blcbfqbgbnghjbnglbbb +1-3 z: zzczzz +3-14 s: jsxssskvsssptw +8-13 n: nnnnknnnnnnnnnn +3-11 c: ccccccccccbccccc +1-6 n: nnnlbn +9-12 k: qkkkkkkkkxwkkk +19-20 w: wwwwwwwrwwwwwwwwwwww +10-15 n: nnnnnnndnnndfnnnn +8-14 c: cvndjxlcsccwxl +1-3 v: vrvwv +8-10 s: rshsssjssss +2-10 n: nnjnnnnnnhnkm +1-2 c: ccbcflcp +3-6 v: jtntcsvvvhp +3-5 q: qqqql +17-19 p: ppppppppppppppppmpg +10-11 k: kkkkkkkkktrk +2-4 f: tgprtftkfx +8-9 x: xxxxxxxld +4-6 l: lhzllllzhv +8-9 g: bhgkfgsggxg +5-9 d: dkdddddmdwd +2-13 s: sdffzhrpbnvtswxsbrcs +7-8 q: qjqpdqvwqqdtxpq +5-8 n: lncnfnzxtsn +8-9 p: khtrxgvhtqwrfpqrd +2-4 s: zhln +5-6 q: bqqqddp +7-13 g: gggjggggggggg +10-12 w: wwwwwwwwwkww +1-4 b: bwbbdbhbl +9-18 j: jjjjjjjjjjjjjjjjjjj +10-18 j: jjjvjjjtjjqjjjjfbjd +11-13 m: mmdmmmmmdmmmqm +6-9 n: nnnndtnvfnn +2-3 q: qckq +16-17 x: xcxxxxxxxxxxxxxpxx +14-17 k: kkkkkkkkqkkkkkkck +3-8 l: llkllllvl +8-13 p: nkptlpntkcknppwpdhb +6-12 s: ssssssssssss +8-14 c: ccccccccccccccccsc +6-9 p: cpppdnppztxbpp +8-12 w: vshmsmbckwjmw +1-10 g: qqtfmmxnbg +1-6 m: mmkmmmfmw +5-8 v: vvvwxvvdqv +7-8 f: ffffffff +2-10 k: kkkkkkkkkk +1-4 g: wjhxhq +3-4 w: znpwwmwcwjgs +5-9 d: ddddrdddwl +6-8 j: kjjhvzrbrwcjjm +2-5 j: jhjjxjjsj +2-6 t: ccwdcm +4-12 q: qlqrsgqqhqqf +13-16 w: mwwwwwhwwwwwwwwwww +9-10 g: ggggggggggmtgwj +1-3 x: xxxx +1-3 n: jxtqjbhpkgrcrdrptvd +14-15 w: wwhwwwwwwwwwwww +7-10 d: wddddzvdddkdm +1-4 p: lzph +6-9 w: wwwzwswwr +17-18 t: kjtktrtfgkhpzthvsjt +12-13 j: jjjjjjjjjjjxs +8-9 r: srrzrmrxnhrrr +1-5 s: spzsshkzfmkdss +1-7 z: zzsmzzhzzxzzzzz +1-2 d: ddvx +2-9 h: hhhhhhhhhhh +6-8 p: ppppppppx +4-8 v: bqvvxmvtvhfvv +3-4 z: zzzz +2-4 r: rrrrrrr +4-5 r: mhrrrrrrq +5-6 b: nkhgfjrzqldbbbbmpx +7-8 n: nnnsnwnncdnn +13-15 p: pppntwcpppppppv +5-11 r: tmkrdcmrpcrrkrl +3-4 v: vvgf +4-5 j: jjvtcj +3-5 p: ppppp +1-3 r: mrrr +13-14 v: vvvvvsvvnvvvhxvvv +10-14 z: ltwsklmfdpvxmxgq +16-17 b: bbbbbbbbbbbbbbbqqbbb +3-8 q: qbpqpvqll +9-10 x: xxxxqtxxzxxxx +8-12 d: pdddnddcbcdx +2-3 m: fmmmsfmvcmkc +9-10 x: slxtnxxtjnnxjnq +5-13 h: hhshhhhvhffhhn +6-14 t: wwwmqttttkpmqtrt +1-5 b: mbbbb +10-12 k: kfkkpkrkkkkkkkh +5-6 m: mnlmbvmm +5-6 x: xxxxvl +5-7 b: dbbbpbc +2-19 t: qhdtkxjzdcwjqjkglpzr +1-4 h: hhgqhnhhhhfhhh +1-10 b: bqbbbbzbbbbbbwb +2-3 b: dbbkgnxmbtpg +3-8 r: rrrjrgrrwq +4-7 s: ssrfwfgvskmssws +13-14 m: smdmmmmmgmfmmjs +13-15 h: hhhshhwhjhhhhhhhh +12-13 n: nnnnnnnnnnnnnn +6-14 n: ndnnpqwrlgfrmn +3-16 m: rldkmmmkhmsmbnqbmgs +2-3 m: rmmmmm +5-9 x: xxxxfxxstxxs +4-8 b: bgbbbbgbbbb +9-11 c: kwcclccccscxp +10-17 v: vvvvvvvvvvvvvvvvvv +13-18 n: nrnnnnnnnnnnfnnnnpn +3-4 c: hbcc +13-14 w: wwgwwwwwwwwwwc +4-6 z: fwmzzzz +12-15 h: vhhfhhhhhwhrhhlkmhhh +1-5 v: jqvvhvvbt +4-5 n: vnnscn +5-6 n: qnrvnnndnffnkknfrdt +6-7 w: wwwwwvznwwwwww +6-12 h: hvhhhdhhhhhr +4-5 m: vtmmmmdmp +8-9 f: ffffffffffffffffdf +5-11 z: zzzzjzhzgjwzzhlz +8-10 d: mdnnfwswns +4-15 c: rptccckzhgcvlccbh +4-5 r: brrrgtd +4-15 x: rxsfxqhhzxdsxqxgw +8-9 c: ccccclcccccccc +2-9 l: mwltgglzztlpllgf +12-13 g: nnjgzggjkgzgd +4-6 j: jjfjjnj +11-14 m: mmfqpmkmmmmmmmrm +6-7 c: cccccqccmccccc +6-9 f: ffzgcfcpfwztjk +6-9 r: sjgrxnrvnqmmlxdrsp +3-11 c: cchwcfcckcn +7-10 p: jpzdflzgkxnbhj +5-6 b: bblblp +7-8 p: ppppppllppp +10-13 b: bbbbbvbbggbbb +5-6 p: pppptp +2-6 t: qttttjtt +3-6 n: vwlhczrnwpnvrnl +8-9 r: jrrdrrrjwrrrrrs +3-4 n: nnwqn +4-8 b: mbscbwxn +10-12 v: tqbvxmlqvvvv +1-9 l: qcllllncllcllllrn +6-10 b: gbbxfblbbx +11-13 g: gggqgggtgggtgrgsg +2-3 f: fjkz +5-11 t: tttttttttttt +5-18 j: zjdxgjjpshjjkjbtjvg +9-11 k: kjkfkwkkrkgk +1-8 w: hwhcwwbffvcdwzwbww +7-16 l: rrljlvlmmlssllkllqj +1-4 d: hddldvddddf +7-9 b: bgbbbrmblb +2-5 v: ltvvvv +5-6 r: rgrrdvrrrrrrr +8-9 n: wnnnnnnnn +1-8 q: sfmbjqqwvqqq +2-11 b: wblbmlrcwffl +4-5 n: cfmnn +15-16 g: gggggggggggggggq +6-10 x: xxxxxxxxltxxx +5-9 g: gggbgxgggpgn +8-10 z: zzztjzzzqzp +4-5 x: xxxfl +6-10 v: vvvhvvvvvv +6-8 v: tdrvsnvpvzxbwvv +8-11 q: qqqqqqqqqqjqqq +12-13 z: zjzzzvzjkzzzz +1-8 b: bsqqmbnbcwhkphfh +1-5 z: zdjzzrm +3-4 m: vlmmtbmmxcdkmdmfb +7-14 k: kkwpcjfkkkrknzkk +1-3 f: cfbljmpfghhgxdbg +6-7 n: mrnhnxn +16-17 g: gggggggggggggggmr +7-8 q: qqqkqhqqwkpzshq +9-15 j: jjjjjjjjjjpjjjj +5-6 t: tttttl +4-15 h: hhhhhbsbphhhlzgh +4-6 h: qhhlhh +2-6 f: wfwdff +1-7 c: rczccfx +3-8 b: jkznbbbqlk +8-14 r: srtchmrjxmzznm +4-8 s: ssgskspsdsmclrmxzp +9-12 j: kjjjfcjjljjqjj +3-5 l: lllvllll +15-16 s: sssssssssssssszs +5-6 z: zzzzmfjz +13-14 v: vnvvgvvvvwvvfrvspv +7-8 t: ttttttkst +17-18 f: ffffffffffffffffhx +8-11 b: bbbkbswbbpbnbbbbx +7-14 s: ssjfssssssjsdp +6-8 s: sssssqsps +5-8 h: hhdhphhmhhhh +8-9 r: prrmrpsrrrvrzrrrsrn +4-17 t: ttttjttjttthtktttt +7-9 v: tvvwvpvrbnvvvv +8-12 j: plfsgrjjgjrjwcgc +2-7 r: krqzzprxrldwg +4-11 k: sfpkkkcwkwk +2-3 z: zzhp +6-9 h: xkjwshvmhbjhfjvkwcmh +4-8 d: dvndvmdzn +3-6 r: wrrrrr +6-8 g: kggdgfgzz +3-5 j: jjjjj +2-9 x: qkksvkxxvxbxx +12-17 b: kjpbpbmddcnwbbbxb +2-10 w: rwpbpbwrbmwgwwvghvg +1-12 f: fbfqmffffftf +1-8 z: qvbjgplznjztjvqjhv +1-5 b: bbbbbbbbb +7-11 p: kddppkdtqpjcfpp +14-20 z: zzzzzmzzzzzzzzzzzzzz +7-8 p: sjspdphq +11-12 w: wpwwwwwwwwwd +7-12 d: sdddddkdjddd +6-8 g: gggfzzhglgxqpgbnbgbx +10-13 c: hcccctjcccccccn +14-16 k: kkkkkvkkkkkkkkpxk +16-18 c: ccccccccclcccccccjc +2-4 r: llrh +11-13 g: ggggggggggggm +1-4 z: zfwzzz +4-6 s: ssssfs +5-12 t: tttttntttttt +2-6 n: gnghnp +1-3 q: qqgq +10-11 f: rdzfzffhtfffffff +4-9 k: kpfhvkkkk +3-10 t: twlkttptttt +4-10 d: dkdvgkdddwd +5-12 t: ttttnttghtthtvtt +4-5 c: ctczwcccc +17-18 l: llllllllllllllllmx +2-8 t: knmttnttdjbtttvtkt +1-2 j: jdjjjj +12-16 j: wmqlfjlnxnvlrjkmj +13-17 s: snsdsssssssssssss +8-14 h: hhhhhfhhhwhphhscphd +9-10 b: bbbgbbbbqcb +15-16 z: fjjcjrwjtrcnltzz +6-8 s: ssssxjshd +2-4 k: kkkw +3-6 s: xsfgbpss +13-15 x: xxpxxxxdxxxgjxgxxx +4-5 l: llqlllsl +10-15 g: jggxgsggggggjtgg +2-6 b: prpbjbkbbkcb +7-9 h: hhhhhkfhh +8-11 f: fzhftffvffwffnl +11-15 x: xxxcxxxxxngxxxcxx +11-12 k: skkkkkkkkkxhn +5-15 n: cnnnnqqbnnnncznnp +1-3 v: vqvxlfwpjvxtpkvlhxjv +3-8 b: gfbbbsfbb +3-4 z: qzzzbczk +8-17 t: cpttttttpttttttttt +11-17 l: lprllfllllnlllllnll +7-8 f: ffffffrd +2-6 z: hghjzzwpwz +6-13 m: thzmtmcsmtctf +2-4 c: dctc +10-17 s: sssssssspzssssssl +6-10 j: jjjjljljjjjjzj +5-7 b: bbxbvsxphgrmnqgzbbx +1-11 l: rlnlllllllvlllll +13-16 b: bbbbfbnbbbbbzgbwbb +5-11 p: bpjpnpqpppjpmppphrk +1-3 l: llll +11-15 l: llgllllcllllllllfll +2-7 x: kxsnzzx +18-19 g: gglgggvqkjzgkgggzgg +3-5 j: fqvjjcjjhb +6-7 c: fccccccct +13-16 m: mzmtcgmcmmmkdmlk +5-9 w: wwsjwwwww +1-2 m: jzmj +16-18 m: mmmmmmvmmmmmmmmqwn +11-12 w: wwwbrwcwwxwwmwwrdww +3-4 v: nsvddwnvvvm +5-8 m: mjmrbpmh +2-3 t: xdrtzgdl +2-6 n: fnwwgnnzwsp +7-9 p: jpppppvppsqt +1-8 k: gkkkkkkkk +2-9 q: jqqqwfzxhqqqqsxqm +2-4 t: jtwt +6-20 d: hqdkcmkdndjrftmgjgqc +2-9 r: crgmrqpwrrr +9-15 p: pwmjlrgnrppwphg +3-4 t: ttqttttnttttt +1-5 v: hvvvv +1-2 x: ggxxxxt +17-18 m: mmmmmmmmmmmmmmmmcl +4-10 d: dxtmsjvhczfjd +8-10 x: xpbxsxpxgxqxxqxxk +6-9 f: ffffmffdwkfrlffx +8-10 m: ldmmgxxmbmnqftt +12-13 p: ppxpxhppgppqqpvppp +4-12 k: kkkkkkkgklkkjkkqvkk +3-4 x: xxcp +7-8 k: kkkkkkkr +11-14 d: dddkpddvdddddg +3-8 l: lsgmlqll +12-13 z: znzzzzzzzzzzrz +3-5 h: hhdphh +3-4 h: hqhhh +4-6 f: wfsfrffzf +8-12 k: ktkdmhvkxktkhr +2-6 d: dpdwdddd +7-12 n: nnnnnnpnnnnxn +1-3 v: vvvv +3-11 q: gmqqqqmqshpq +3-4 j: jjjjkjhjf +2-4 b: glbxb +13-14 s: ssssssssssrssds +16-18 d: dddddddddddddddddd +3-9 g: fgggzttsg +11-12 r: grrrrrrqrrrrrrr +2-5 q: cdqqv +6-11 l: lfclllslllxllll +2-3 d: dzdddg +2-4 n: tkwm +4-5 r: kdccjnrfrzrhplrz +4-16 j: tfxsmxlrjptjjrxw +16-17 p: stpsgsgwvqrzpblpsx +8-12 r: rrdrgrrgrrhrwqjmp +5-8 j: jjqjjkjjjjnv +2-7 n: wzgnnnnnn +1-3 v: vvvv +4-5 l: hlgnx +8-15 c: ccccpccczvcsccc +3-15 f: ffnfffffffffffv +4-5 w: wwjgww +10-15 d: ddddbcrddmddddld +7-11 w: wwwwwwwwwwz +3-4 h: hhhh +4-9 v: vvpgvvnvtv +8-11 q: qqqqvqqqxqcqnmq +2-5 s: lsnpdqqqsj +8-9 g: ggsgggggz +6-10 s: sssssbsbbtss +12-16 z: zhzzzszzzzznnzbwz +9-10 p: ppnpdpgldl +10-11 r: rrrrrrrlrtfrr +1-13 h: xhhrhhhhhhhhchhhhcp +5-14 m: mmmmmmmmmmmmmqm +8-9 h: hhhhchhhhhkt +3-4 f: fflf +7-13 s: ssssssssscsssjs +2-3 t: twlcfmbmbxtt +4-6 v: vdvhvf +1-7 c: bccccccccccc +13-14 r: wrrvrvrtrrrrrrrrrrr +1-3 b: sjvfpdrbcnwr +1-7 z: xzzzzwjz +6-14 j: jfrxjjjrqcqjwmbfjjjm +11-14 f: ffffffffffqffzqf +6-8 z: zzzzzrzw +1-5 j: jjjnjjjjj +9-10 g: ggggggxggg +7-9 r: rrrvrrbrdr +9-18 j: jjjjjjjjnjjjjjjjjfjj +14-18 q: kjtxqqqqltlpgqshdx +8-12 k: kkkkkkwjkkkfkkk +2-4 s: ssvs +3-5 z: zzfjk +9-10 m: rmmlmsmfmbj +14-15 z: nlzzzzzzzzzdzzzzzz +8-12 r: zrrrrprrxrrrrkrhk +1-2 z: qlfzd +1-6 j: kqjpjzpsgjjqz +1-5 s: qfssks +2-5 r: nrrzrr +4-6 g: kggggg +6-7 c: cccccdqcc +2-6 x: vjkxbrfwnj +16-18 s: kssssssswssssssssssb diff --git a/2020/Day 3/Solution.py b/2020/Day 3/Solution.py new file mode 100644 index 0000000..b524718 --- /dev/null +++ b/2020/Day 3/Solution.py @@ -0,0 +1,36 @@ +input_file = "/tmp/aocinput" + +map_table = [] + +with open(input_file) as slope_map: + line = slope_map.readline() + while line and line != "\n": + map_table.append(line) + line = slope_map.readline() + +def check_for_trees(direction=(3,1)): + x_pos = 0 + y_pos = 0 + + width = len(map_table[0]) + height = len(map_table) + + tree_count = 0 + + while y_pos < height-1: + x_pos,y_pos = ((x_pos+direction[0])%(width-1),y_pos+direction[1]) + if map_table[y_pos][x_pos] == "#": + tree_count += 1 + + print(f"We came close to {tree_count} trees by going {direction}.") + + return tree_count + +def check_multiple_directions(directions): + result = 1 + for direction in directions: + result *= check_for_trees(direction) + + print(f"Result is {result}.") + +check_multiple_directions([(1,1),(3,1),(5,1),(7,1),(1,2)]) \ No newline at end of file diff --git a/2020/Day 3/input.txt b/2020/Day 3/input.txt new file mode 100644 index 0000000..a3ac506 --- /dev/null +++ b/2020/Day 3/input.txt @@ -0,0 +1,323 @@ +.#......#..####.....#..#....... +#.#...#...#..#.#...#.#...##.##. +#.#....#..........#...##.....## +#.#.#.....##......#.#.......### +..#..###....#.#....#.#.#..#.... +.......#.#....##..##...#...#... +..#..#..#..###.......#.....#.#. +.#.......#...##...##.##......## +#.#.##..##.#..#....#..###..#.#. +#.....#.#.........#.....##.#.#. +..#.#....##..#...#...##........ +......#....#..##.#.#......###.. +.......#.......#......##...#... +.##.....#.......#...###.....##. +.#...#.##..##.#..##....#....... +..#......##...#..#...#.#.##.### +.##.##.....##....#..#......#.#. +.#.....#..###..#.##.#.....##.#. +......##..........#..........#. +.##....#.....#..##.#..#.#..###. +..##.......#....#...##...#..#.. +.##...#.....#.###.#.#..#...#.#. +.....##.#.##..##...#........... +..#..###.##.#.#.###...###..#.#. +.#........#..#.#........#.#...# +....##.......#....#.#.##.#..... +....##........######..###..#.#. +#.#.#............#.......#..#.. +...##...#.##.....#.#..#......#. +......#.##.#....##..#.#..###... +##.....#.#....#....#.##.#.###.. +#..#..#..##.#..##.##.##.#.##... +.###.####..#..#........#.....## +.......##..#.......#........... +.##...#............#.#.##...#.. +....##.....#...##..#..#.#..###. +...#.....#####.#..#...##....##. +#.....#.#.#....##.......##.#.#. +......#.#..#.##.#######......#. +#.##...##....#..###.#.......#.. +.....##...#....#...#....##.##.# +....###......#...###..#......## +..#...##..##.######..#.#......# +......##....#....##..#......##. +.#...#..##..#.###.#......#....# +##....##..#..####.#.....#...#.. +.#.......#...#.......##......#. +......#...#...#........#....... +.#........#.###...#..####.#..#. +##...#.#............#.....###.. +.....###.#.##...........###..#. +.#.#...#.....#.#.##..##...####. +..##.......#..#.##.#....#.....# +.#..#.#..####.....###.#.....#.. +..#..###.....####..#.##.#.#.##. +.###..#.....#......#...####.... +...#.#..#.#..#...#...#....##.## +..###....#.##.....#..........#. +###...#####......##............ +..###.....#........##.#...#..#. +..##.##.#.....##........##..#.# +##..#.#...#.#..#..###.#....#..# +....#..#.#.....#..#####...#.... +....#.........#......##.##..... +.#...####.##......##..##.#..#.# +...#...#.##..#...##..###...#... +###...#.....#.##.###.###..#.#.. +..#......#.###.....#..##.#...#. +#.....##.########...#####....#. +........##..#..##..##.#........ +....#.######....##..#..#.##..#. +#.......#..##..#..#.#.#..##.##. +...#.#..#..#.......#......###.# +.#.#..#.#..#.##.#.............# +#....#.##.#.#.....#..#.#..#.... +...###..#...#....#.........#.#. +.#..#.....##..#.#..#.#.......#. +..#...##...#......#......####.. +....#..#.......#.......#.#..#.. +#...#..#...........#.#..#.....# +#...#.#.......#...#....###....# +.#..#.#.##....#......#........# +..#...#..##..#..#..#..#...#.#.. +..#.#.........#....#....##..... +##.....##.#.#.#.........##..... +.##...#.##...........#...#...## +.##..##.#.#..........##..##.... +#....#....#.#...#.#..#....#.#.. +####....##.....#..##.###....... +#..#....#......##.#.#....#..... +.....#....#.###.##.........###. +#.......#.####..#..#..##....... +##.#.......#..##..#....#..#.#.. +..###...#.#...#.....##.##.####. +....#...#.#....#..#..#.....#.## +#.....##.#.#..#.##..#..##...... +................###..#....##... +..#.##.....#..........##.#...#. +..#.#..#.#....#.#.#..#..#..#.#. +#...#..##.#.#...#..#...#..#.... +#..#.#.........#..###........#. +.#...#.............#..###..#..# +#.........#.#..#...#.#.....#..# +....#..#..#.#.#...#...#.....##. +##...###.#.####..#......#...#.. +..#..##...#.#......#.#.......#. +#......###....##.#.##.......... +#####....###..#...............# +##.#...####....#....#...#....#. +.#.......#..#.....#...#.....### +...#..#.#.#....##......##...#.. +...#.....#...#.##.#..#.#....#.. +#...###....#...#.#....#........ +.#.......#........#...##.##.##. +.....#....#...##.....##...###.# +....#....#.#..#...##.##.##..... +.......#............#...#.#..#. +.#............#.....##.......#. +........#....#....##......##.## +.......##..#.#..#.##..###..##.# +#..##..##.........####.#.###... +#....#..#...##...#............. +#...#...###..........##..#..#.. +....#...#..#.....##...#........ +#.....#......#.#.....#...#..#.. +..#.....#.....#....#..#........ +..#..#.....#.#.........#..###.. +................###..#.#....#.. +#.....#.....#.#.#.#.#..#...#.#. +#....#....#.#..........#.#....# +....#..#......#..##.#...##..... +..#.#...#.####....#.#..#.#..#.. +.........##......#.....##...... +##.#.###.#.....#.....####.#..#. +.....#.....#..#....#..###.#.... +##..#.#...#.##....#....#....... +.....#......#.#...##..#.#...... +....##..#...#...##..##.#....#.# +............#..........##.#.... +##..#..#.##..##..#.#....#.#.#.. +.......#.#...#...#.#...#..#.... +#....#.#...#...#........#..#... +...........#.......#...##..###. +.#..##......#.##.........##..#. +...#...#...###.#.##....##.#..#. +#...#..#.#.#.....##..#.......#. +.##..#.###.##......#.#....#.#.# +..#....#.......#..#..#.#.#.##.. +#...#...###...###.........#.... +.#.#...#.....##.#.#..#....#.##. +.........#.#.##.....#.#.###.... +...#.#...#......#...####......# +...##..##....##......##...###.. +###...#..#.......##.....#....#. +...#..#..#..###...##.##..#..#.. +...#......#......##..#.#.##..#. +...#.........#....#.#....#.#... +##................#..#.#.....#. +....#.##...#..#.##...##.#.....# +......#..##.##..###.#..#.##.##. +.#.#...###.....###.....##...### +.##.....#.#.#..#..###..#..#..#. +#.......#..#..#....##.....#.... +...#.#.##..#..#......##.##...#. +....##.#......#...#..#..#...... +.####.#..#.....#..##.#...##..## +..#..#...#..........###..#....# +.#.#.##.##...#............#.... +........##..##......#.##..#.### +...#.#....###......##.......#.. +..##...#...#.#..#.....#.....#.. +##..#...###..#..#.#.#...#...#.. +.....#..#....##.....##.....###. +....##...###.#..#.#....##..#..# +#......#...#....#......#...##.. +....#.##...#.#......#.#.##...#. +.......#.....#...#####...#.#... +...#.....##.#............#..... +...#.#........#.#.#..#......... +....###......#.#.#..#.####.#..# +#.....#.#.#.....#.#.#.....#..#. +..##.##......#...#.#........... +###..###....#.#####......###... +..##..............##.#.#....#.# +#..#...#..........#..#.#.#..### +##.###............#....#.#...#. +#.#..#.#..##.#.#....#...#...... +#....#...#..##.....#..#.#..###. +..#.....#.#....#.#..#.##.#..##. +...##...#.#.##...#....###....#. +......###.####.......#..#.#.#.# +.#..............##........#.... +...##.##...##....#..#.......#.. +.....#.....#....###...#..#..#.# +.#.....#..#.....#......#.....## +#.#.##.#..#..#.....#.##..###... +..#......#...##.###..#.#...#..# +......#.....#...##......#...... +##.#........#..........#.....#. +#........##.#............##.... +...#......##...#.#.....##...... +...##.......#....#.#..#.#.###.. +..#....##..##.##.....###....#.. +..#...#.#...#.....#..........#. +......#...#...#.#.##.#...#.#.#. +.#...#......#.##........#...... +.##.##..#....#...#.#...##...... +#..#......#.#...........#....#. +....##.#....#...#..#....#.#..## +#....##.##....#.#..##.#........ +.##.##.#....##.....#..#....#..# +...#...#.....###.#.##.......... +....#...#....##.......###...... +#.........#......#.#.......#... +#..........#..##..#.#.......... +.....#.......#..##.##....##...# +........................#.#.... +#..#.........#.............#..# +#..#.....#.......#....#....#.#. +..##..##.......##....#...#..... +.##......#..##......#.###...... +...#.#........#.......##..###.. +..##...###.###......#...#....## +#...#...#.....###.#.#.#..#..... +#....#.........#..##...#...##.. +#..###..#.#.#.##.#..#.#....#.## +#...#.#.....#.###.#.......#.... +..##..#..#....#.#...........#.# +#.........#.#......#...##...... +.######......#..#....#.#.#....# +##..#.#..####.###.........#.... +###########.....##.##...#..#... +#...##.#.#....#.#....#......#.. +...#..##..#..##..#......#....#. +.#....#...#....#.#..##....##... +#..#.#............#....#.#...#. +...#...#..#.#.##......#..#.#... +#.#...##.....#..#.##......####. +.#.#..##..#.....#.#..#.##...... +#.#.##......##.....#..#.#..#... +#..##...#.##.#.......#.##...... +..#.......#.#.#...##..##...#... +.#...#..#..#.#.........#..##... +#..#.......#....#.#...#.###...# +.......#..#.......##.#.#...#.#. +.#.................###.#..###.. +..........#.#.....##..#####...# +#......#.#..##.#.#...#.##.#.... +#......#.#..##.##.#...#....#... +....#..#......#....#....####### +.#...#......#....###......#.### +#.#....#.#...#.###......#..#..# +.###......#.#...#.####.#..####. +######.#.....###.#...#.#.....#. +.#.###....#..#.#.....#.....#### +.......###.#.........#..#...... +#...#.....##.#......####....... +..#.#..##.#.#...#...#..##..##.. +.....#...##.....#...##......##. +##..#..#.##..#.#......#.....#.. +##.........#.#.##.#..#.#....#.# +.#........###...#.........#.... +...#..#.#..#....####........... +#.#....#..##..####.#...#.##.... +.#.....#.......#..........#..## +...#.......#...###..#.....#..## +.........#.###.#..##...#.##...# +.#..........##..####...#..#.#.# +.#...##...#............##...#.# +...#....#.#..........#.#..#.#.. +.#.#...##....##.#.#.#....#..... +....#..#.....#.#..#.#..#.##.### +.....#.#.....#..#......#.#.#... +.....#.#.#..###..#.#..###...#.. +#.......####...#.#..#......##.# +....#..#..###......###.##....#. +##.....#.....#.............#..# +#..#..#...##.....##..#..#.#.... +.....#.#.###...#............... +#.#.#.....#.#..#.#...#.......#. +..##.##............#....#..##.. +#....##...#.....#.###...#.#.... +#...##.#.........#...#....#.... +##.##.#...#.#...###..#....##..# +....#....##..#..#.......#...##. +.#...#...#..#.....#..###.#..#.# +....#..###......#....##....#... +#.#.....#....##.#..#.#...###... +.......#............#......#... +.##..#.###.#.............###... +..##...##.#.#.#.....#........## +....#.###....#..#..#...#...#..# +.....#...#...#..#....#.....##.. +###.#.#.....#......####.....#.. +#.#.###............#......#.... +..#.....#..#..#..#....#......#. +#...######...#....#.##...##.#.# +##.#.#.#..##......##.#..#.#...# +............#.#..#.##....#..... +......#............#.#...#..#.# +.#..##...##..#.#.#..###.....##. +#.###.#...........#...#....#... +....##.....#...##...#...###.#.# +.####.#.#.....#.#..#.#.##...... +.#...##......###...#..##..#.#.. +.#......#...#....##.....##..#.. +..........##.....###.##.#...#.# +.#........##.#..............#.. +#...###..#...#.....#....#.....# +...#......#..#...#...#..###.#.. +.#...##..#........#.......#.#.. +.#.#.##.........##.##......#..# +#...#.#.#...#.....#.#...#.#..#. +#.#..#...#...#...##..........#. +.#...........#....#..#.#..#.#.. +#.......#......#..#...#........ +.....#..#...##..###..##........ +......#...#.....#..#.#.#....##. +....##..##..##....###.##....... +.#........##.#.#...#..#........ +.....##...##...#......#..#...#. +..#.....#....###.#..##....#..#. +......#..#...####.#.....##.#### diff --git a/2020/Day 4/Solution.py b/2020/Day 4/Solution.py new file mode 100644 index 0000000..ddd8b25 --- /dev/null +++ b/2020/Day 4/Solution.py @@ -0,0 +1,78 @@ +import re + +input_file = "/tmp/aocinput" + +height_re = re.compile(r'^([0-9]+)(in|cm)$') +passport_id_re = re.compile(r'^[0-9]{9}$') +color_re = re.compile(r'^#[0-9a-f]{6}$') + +def check_limits(to_test, min_valid, max_valid): + return False if (to_test < min_valid or to_test > max_valid) else True + +def validate_passport(record): + for field in record: + if field[0] == "byr": + if not check_limits(int(field[1]), 1920, 2002): + return False + elif field[0] == "iyr": + if not check_limits(int(field[1]), 2010, 2020): + return False + elif field[0] == "eyr": + if not check_limits(int(field[1]), 2020, 2030): + return False + elif field[0] == "hgt": + regex_match = height_re.match(field[1]) + if not regex_match: + return False + if regex_match.groups()[1] == "cm" and not check_limits(int(regex_match.groups()[0]), 150,193): + return False + elif regex_match.groups()[1] == "in" and not check_limits(int(regex_match.groups()[0]),59,76): + return False + elif field[0] == "hcl": + regex_match = color_re.match(field[1]) + if not regex_match: + return False + elif field[0] == "ecl": + if field[1] not in ["amb","blu","brn","gry","grn","hzl","oth"]: + return False + elif field[0] == "pid": + regex_match = passport_id_re.match(field[1]) + if not regex_match: + return False + + return True + + +records = [[]] + +valid_passports = 0 + +with open(input_file) as passports: + line = passports.readline() + current_index = 0 + while line: + if line == "\n": + records.append([]) + current_index += 1 + line = passports.readline() + continue + + for raw_entry in line.rstrip().split(" "): + records[current_index].append(tuple(raw_entry.split(":"))) + + line = passports.readline() + +for record in records: + if len(record) == 8: + if validate_passport(record): + valid_passports += 1 + if len(record) == 7: + is_north_pole_credential = True + for field in record: + if field[0] == "cid": + is_north_pole_credential = False + break + if is_north_pole_credential and validate_passport(record): + valid_passports += 1 + +print(f"There are {valid_passports} valid passports out of {len(records)}") \ No newline at end of file diff --git a/2020/Day 4/input.txt b/2020/Day 4/input.txt new file mode 100644 index 0000000..242437a --- /dev/null +++ b/2020/Day 4/input.txt @@ -0,0 +1,1029 @@ +iyr:2015 +hgt:59cm byr:2029 cid:219 pid:9381688753 eyr:1992 hcl:#b6652a +ecl:#7a0fa6 + +ecl:blu iyr:2018 pid:943614755 cid:335 +byr:1968 +eyr:2026 + +pid:067285985 hcl:#ceb3a1 cid:281 +ecl:#07219a eyr:1944 +iyr:2025 +byr:2029 hgt:64cm + +hgt:185cm +ecl:gry cid:222 +iyr:2016 +hcl:#866857 byr:1970 pid:269105457 eyr:2026 + +pid:260043570 hcl:#b6652a cid:275 byr:1990 ecl:brn +hgt:163cm iyr:2012 + +hgt:181cm pid:604983466 +iyr:1930 eyr:2039 byr:1950 ecl:#906548 hcl:#b6652a + +iyr:2025 eyr:1956 hcl:z pid:#1c42cc byr:2006 +cid:327 hgt:141 ecl:#f2affc + +hgt:178cm byr:1939 pid:595705064 ecl:oth +iyr:2020 eyr:2026 +hcl:#888785 + +hgt:159cm iyr:2016 +hcl:#efcc98 pid:139063139 byr:1980 ecl:brn +eyr:2020 + +pid:646870519 hgt:179cm eyr:2022 iyr:2011 hcl:#602927 +ecl:brn +byr:1997 + +hgt:170cm hcl:#ceb3a1 iyr:2014 eyr:2023 ecl:oth pid:243067344 byr:1962 + +hcl:#866857 +ecl:oth pid:704529614 +byr:1941 cid:94 +eyr:2026 hgt:180cm +iyr:2010 + +iyr:1924 +pid:36196401 +hgt:74cm eyr:1921 +ecl:#3acf57 hcl:a4e4c0 byr:2024 +cid:153 + +pid:770262094 hcl:#866857 +eyr:2020 hgt:151cm +ecl:blu +iyr:2012 +byr:2002 +cid:242 + +pid:984364862 ecl:dne +iyr:2020 +hgt:151 eyr:2023 cid:314 hcl:z byr:2012 + +hgt:178cm iyr:2020 hcl:#6b5442 ecl:grn cid:323 eyr:2030 byr:1925 pid:285882039 + +iyr:2019 pid:986123633 +eyr:2024 byr:1990 hcl:#7d3b0c ecl:hzl hgt:192cm + +hgt:90 +byr:2025 iyr:1933 +ecl:dne eyr:2040 pid:8194347544 + +hgt:163cm byr:1934 eyr:2026 ecl:amb hcl:#eec6fb cid:303 pid:721792159 iyr:2013 + +iyr:2019 +byr:1920 hcl:#a97842 +cid:186 eyr:2020 +ecl:oth +hgt:167cm pid:217112082 + +pid:#55ce6b hcl:d30f6b eyr:2040 hgt:60cm ecl:dne iyr:1920 +cid:107 byr:2029 + +ecl:amb eyr:2024 pid:644304174 hcl:#6b5442 iyr:2018 +byr:1935 +hgt:182cm + +ecl:hzl pid:559383552 +hcl:#ceb3a1 eyr:2024 hgt:161cm byr:1968 iyr:2010 + +iyr:2018 +hcl:43fafb +hgt:65cm eyr:2027 +byr:1937 pid:#4bff3e ecl:grt + +eyr:2024 +iyr:2014 cid:163 byr:1924 hcl:#18171d +hgt:166cm + +eyr:2026 pid:955203781 +iyr:2016 cid:52 hgt:167cm +ecl:grn byr:1963 + +pid:479898570 hgt:165cm eyr:2024 byr:1932 +iyr:2010 ecl:grn +cid:88 +hcl:#c0a76e + +cid:241 hgt:178cm ecl:blu pid:069760797 hcl:#623a2f byr:1925 eyr:2029 iyr:2019 + +hgt:172cm eyr:2036 +iyr:2016 pid:#98caec +ecl:dne hcl:z + +ecl:#510672 iyr:1938 byr:2018 hgt:172in hcl:z cid:339 eyr:2039 +pid:#6c1216 + +hcl:#efcc98 +byr:1972 ecl:brn iyr:2011 pid:190911803 eyr:2025 hgt:171cm + +pid:0636917222 byr:2009 hgt:96 +hcl:z +iyr:1997 ecl:hzl eyr:2026 + +byr:1989 iyr:2011 pid:071588682 cid:155 ecl:grn +hcl:#ceb3a1 eyr:1955 hgt:170cm + +cid:266 hcl:#a97842 byr:1964 hgt:175cm +iyr:2017 ecl:brn + +pid:930133867 ecl:grn hcl:#733820 hgt:63in byr:1995 +eyr:2021 iyr:2014 + +eyr:2025 pid:284329794 +ecl:blu hcl:#ceb3a1 iyr:2012 +hgt:65in byr:1961 + +iyr:2010 byr:1998 +hgt:160cm +eyr:2029 hcl:#cfa07d +pid:253052921 +ecl:amb cid:324 + +pid:026835791 byr:1999 eyr:2022 hgt:162cm +hcl:#7d3b0c ecl:brn iyr:2014 + +pid:672752198 eyr:2030 byr:1952 hgt:65in iyr:2016 ecl:amb +hcl:#cfa07d + +hgt:193in +byr:2019 hcl:z pid:#cbc08c iyr:1951 ecl:#3e9f2f eyr:2002 + +ecl:utc pid:571477176 +byr:2012 eyr:1929 cid:240 +hgt:175in hcl:f4ef32 + +cid:93 hcl:#a5db2a +pid:274721479 byr:1940 eyr:2022 ecl:gry +hgt:157cm iyr:2012 + +pid:540858450 iyr:2014 cid:95 byr:1964 +hgt:156cm hcl:#866857 ecl:brn eyr:2026 + +pid:532626994 byr:1939 iyr:2017 +ecl:blu eyr:2026 +hcl:#fffffd hgt:184cm + +hgt:70 pid:404622083 +iyr:2026 +byr:2022 hcl:c1ba7f eyr:1979 ecl:lzr + +pid:931910908 +cid:177 hcl:#6b5442 +ecl:gry hgt:184cm +byr:1963 eyr:2020 +iyr:2014 + +iyr:2019 eyr:2022 hcl:#ceb3a1 hgt:191cm ecl:gry pid:954124659 cid:123 byr:1939 + +pid:411032659 byr:1950 +hgt:153cm eyr:2020 iyr:2014 ecl:hzl + +hgt:156cm eyr:2023 pid:29836124 byr:2017 hcl:56de83 ecl:zzz cid:179 +iyr:2018 + +hcl:#866857 iyr:2014 hgt:190cm byr:1998 pid:565524574 eyr:2020 + +byr:1973 hcl:#888785 iyr:2016 eyr:2028 hgt:173cm ecl:blu + +byr:1987 +pid:028825120 hcl:#7d3b0c +eyr:2023 hgt:190cm ecl:oth iyr:2014 + +eyr:2036 pid:172661617 +ecl:#ae607d byr:2017 hcl:z +hgt:82 cid:153 + +pid:202888577 eyr:2028 iyr:2013 +byr:1933 +hgt:68in cid:151 hcl:#b6652a ecl:brn + +iyr:2020 +ecl:amb eyr:2025 hcl:#a355be hgt:63in pid:146650894 + +iyr:2016 hgt:192cm pid:531372965 hcl:#fffffd +ecl:blu eyr:2025 + +eyr:2025 ecl:blu byr:1961 cid:224 iyr:2016 hcl:#6b5442 pid:368694418 +hgt:169cm + +pid:43707504 iyr:1945 +ecl:grt byr:2010 +eyr:2026 cid:273 +hgt:165in hcl:z + +hgt:159cm ecl:gry +hcl:#6b5442 +eyr:2030 pid:915819272 iyr:2015 + +pid:808392314 ecl:gry cid:285 hcl:#efcc98 byr:1923 hgt:161cm iyr:1941 eyr:2020 + +iyr:2017 +hgt:161cm +eyr:2025 hcl:#602927 ecl:oth pid:081917611 byr:1983 + +eyr:2028 pid:831032131 ecl:brn iyr:2013 hcl:#341e13 cid:198 byr:1991 hgt:67in + +hgt:181cm cid:320 pid:032769757 ecl:grn hcl:#733820 +eyr:2022 byr:1992 + +iyr:2010 cid:128 hgt:171cm byr:1932 pid:923377839 ecl:brn +hcl:#18171d eyr:2020 + +ecl:hzl iyr:2021 byr:2008 pid:569583509 hcl:f74823 +hgt:188in + +iyr:2016 hcl:z eyr:2021 ecl:#24ceee pid:349492243 hgt:67cm +cid:144 byr:2010 + +ecl:gry +byr:2029 hcl:3a0c30 hgt:163in eyr:1962 + +byr:1927 hgt:180 +cid:87 +ecl:#7ea777 +hcl:#623a2f iyr:2024 pid:597098940 eyr:2027 + +cid:89 hgt:193cm hcl:#623a2f +iyr:2010 eyr:2026 +pid:374988952 ecl:hzl byr:1973 + +eyr:2023 iyr:2013 byr:1977 +cid:329 pid:711256829 ecl:grn hgt:154cm +hcl:#866857 + +pid:212535692 ecl:brn +hcl:#b6652a hgt:169cm eyr:2025 byr:1920 iyr:2019 + +ecl:blu +byr:1962 +hgt:157cm iyr:2020 eyr:2027 pid:451039029 +hcl:#6b5442 + +hgt:187cm pid:187808959 eyr:2026 iyr:2020 +ecl:oth +byr:1956 hcl:#733820 + +byr:1959 hgt:160cm ecl:blu hcl:#6b5442 +cid:193 eyr:2026 +iyr:2014 +pid:812555315 + +hgt:153cm iyr:2011 +ecl:grn hcl:#ceb3a1 +eyr:2026 byr:1966 pid:503356330 + +ecl:#95d8a9 +eyr:2024 pid:382174744 +iyr:2025 +hgt:152 hcl:#888785 byr:2012 + +eyr:2028 +iyr:2017 byr:1938 +cid:279 hcl:#733820 ecl:amb pid:497365268 hgt:191cm + +cid:335 byr:1982 hgt:171cm iyr:2013 +ecl:hzl eyr:2030 +hcl:#efcc98 pid:018900639 + +eyr:2029 hgt:175cm pid:530128340 +hcl:#888785 +ecl:gry +byr:1947 iyr:2019 + +hgt:183cm +hcl:#6b5442 eyr:2023 ecl:grn +byr:1934 + +hcl:f8ed45 cid:54 iyr:1997 +hgt:69cm eyr:2037 ecl:gry +pid:184cm byr:2012 + +ecl:grn hcl:#733820 byr:1928 pid:002528194 +iyr:2014 eyr:2021 hgt:157cm + +hgt:163in +hcl:#c0946f byr:2018 eyr:2021 +iyr:1955 ecl:#216920 pid:87155266 +cid:298 + +eyr:2026 byr:1945 cid:161 iyr:2017 hgt:170cm hcl:#fffffd ecl:hzl pid:649441221 + +byr:1930 +iyr:2014 pid:151910079 hcl:#18171d ecl:oth eyr:2029 +hgt:169cm + +ecl:blu byr:1950 iyr:2010 cid:260 hcl:#cfa07d +hgt:167cm +pid:910685738 eyr:2021 + +hgt:182cm byr:1993 +eyr:2030 pid:073035999 hcl:#341e13 +cid:117 + +byr:1981 +hcl:#866857 +eyr:2028 iyr:2012 ecl:blu pid:620133246 hgt:157cm + +hgt:191cm +iyr:2010 pid:089995590 eyr:2023 ecl:amb byr:1986 hcl:#733820 + +iyr:2019 ecl:gry +hgt:165cm pid:910093364 hcl:#efcc98 byr:1997 +eyr:2028 +cid:153 + +hgt:83 hcl:174774 eyr:2032 +ecl:xry iyr:2017 byr:1940 + +byr:1943 +pid:980352645 +iyr:2015 hgt:66 eyr:2023 hcl:#b6652a ecl:oth + +ecl:amb byr:1980 hgt:164cm pid:775303596 hcl:#671bed iyr:2013 eyr:2030 + +hgt:173cm byr:1947 eyr:1947 iyr:1940 ecl:gmt hcl:7e515c + +hcl:#b6652a +iyr:2012 +eyr:2030 hgt:185cm ecl:grn + +ecl:amb byr:1940 hcl:#2943a5 iyr:2015 +hgt:185cm pid:931660417 +eyr:2021 + +eyr:1957 hcl:#623a2f +ecl:grt hgt:62cm pid:#af106a iyr:2012 +cid:59 byr:1985 + +ecl:amb eyr:2025 +pid:351412754 iyr:2014 byr:1941 hcl:#6b5442 hgt:174cm + +pid:5621200134 hcl:6ef9ba ecl:#ef68f5 eyr:1924 +hgt:63cm cid:188 byr:2004 + +hcl:#a97842 byr:1976 eyr:2020 hgt:171cm pid:041926354 iyr:2019 + +cid:234 +byr:2025 hcl:98619a pid:181cm eyr:1941 +iyr:2021 +hgt:167in ecl:#f5e651 + +hgt:73cm eyr:2028 byr:1985 iyr:1949 hcl:z ecl:utc cid:207 pid:#ee9f95 + +pid:179cm eyr:2030 hcl:b8e142 +hgt:69cm +iyr:1933 +byr:1934 +ecl:grn + +iyr:2028 eyr:1954 hgt:111 cid:180 pid:183391861 +byr:2030 hcl:1fb30f ecl:#0d0160 + +ecl:#0b3b2d hgt:191cm byr:2023 pid:727024676 eyr:2025 hcl:#b6652a + +hgt:66in +byr:1923 eyr:2023 ecl:gry +pid:454789451 iyr:2013 hcl:#cfa07d + +eyr:2020 +pid:339972685 +ecl:amb +iyr:2017 byr:1926 hgt:154cm +hcl:#18171d + +ecl:oth cid:302 +byr:1946 +hcl:#ceb3a1 +pid:622779476 eyr:2024 iyr:2012 hgt:158cm + +byr:2012 +pid:748786877 hgt:135 iyr:2016 hcl:b6e962 ecl:gry eyr:2011 + +byr:1997 +hcl:#a97842 +eyr:2022 pid:325672898 ecl:amb hgt:190cm iyr:2010 + +cid:210 hcl:#c0946f byr:1957 eyr:2022 +iyr:2020 pid:374646087 ecl:blu hgt:184cm + +eyr:2029 ecl:#353e0f +pid:#66ec82 +byr:2023 hcl:10d9d8 cid:271 + +pid:816485054 +eyr:2019 ecl:grn +hcl:#efcc98 hgt:185cm iyr:2013 +byr:2014 + +hcl:#866857 iyr:2014 byr:1953 eyr:2022 ecl:blu hgt:166cm + +pid:162cm hgt:59cm iyr:1981 +eyr:2025 byr:2009 +ecl:gmt hcl:116742 + +eyr:2028 hgt:67cm hcl:3d1f34 byr:1963 pid:62859332 +ecl:dne +iyr:2023 + +iyr:2013 +pid:271450754 eyr:2016 hcl:e20882 cid:186 hgt:157in ecl:utc byr:2023 + +pid:702200026 eyr:1968 ecl:gmt hcl:#888785 iyr:2018 hgt:193in byr:1943 + +eyr:2025 byr:1989 ecl:amb hcl:#866857 cid:119 +hgt:191cm +pid:556011434 + +hgt:178cm iyr:2013 +pid:928476807 +ecl:amb hcl:#623a2f byr:1996 eyr:2026 + +cid:222 +pid:325218825 eyr:2021 byr:1983 hgt:155cm ecl:brn iyr:2011 +hcl:#fffffd + +pid:949344785 ecl:grn eyr:2025 cid:182 byr:1974 hcl:#ceb3a1 +iyr:2011 + +cid:269 pid:669599426 hgt:176cm ecl:blu byr:1957 +iyr:2015 hcl:#623a2f eyr:2025 + +eyr:2023 hcl:#888785 +pid:178525132 iyr:2018 hgt:186cm + +ecl:hzl +byr:1940 iyr:2013 +hgt:185cm eyr:2028 +hcl:#7c73a3 + +hcl:z +byr:2001 cid:292 ecl:#d56bbd pid:93473192 +iyr:2003 hgt:150 +eyr:1922 + +eyr:2021 pid:786485899 +hgt:170cm hcl:#efcc98 byr:1955 +iyr:2010 ecl:brn + +hcl:#733820 ecl:hzl hgt:157cm byr:1944 eyr:2027 pid:906803629 iyr:2015 + +hgt:151cm ecl:blu iyr:2016 +hcl:#02ffd7 byr:1995 +pid:369315941 eyr:2026 + +cid:330 ecl:#18e883 eyr:2038 +hcl:z iyr:1929 +hgt:193 pid:33765426 + +pid:743094345 eyr:2027 +iyr:1949 byr:1955 +ecl:gry +hgt:160cm hcl:8dae67 + +cid:167 hcl:#18171d +iyr:2016 pid:214065645 byr:1942 eyr:2030 hgt:183cm ecl:hzl + +ecl:brn hcl:#623a2f cid:171 byr:1971 +iyr:2011 eyr:2028 +pid:607344613 +hgt:153cm + +byr:1921 pid:677007802 hcl:#341e13 ecl:brn iyr:2012 hgt:188cm eyr:2028 + +hgt:162cm cid:319 hcl:z iyr:2025 +byr:1989 eyr:1939 pid:67311222 +ecl:utc + +iyr:2014 eyr:2025 hgt:171cm +cid:302 byr:1997 +hcl:z +ecl:amb pid:101363367 + +ecl:oth iyr:2010 +cid:96 hgt:164cm hcl:4bc20a byr:1947 +pid:166115442 eyr:2030 + +byr:1964 +hcl:#6b5442 hgt:156cm eyr:2022 pid:426807062 ecl:brn cid:321 iyr:2012 + +byr:2012 hcl:#888785 cid:298 eyr:1920 ecl:zzz hgt:169cm pid:0660316558 iyr:2019 + +hcl:579266 byr:1931 pid:#aa5fd0 ecl:gry eyr:2017 hgt:60 iyr:1965 + +iyr:2011 +pid:610896691 hcl:#733820 +byr:1936 +ecl:gry eyr:2021 hgt:161cm + +pid:443246791 iyr:2015 hgt:158cm hcl:#18171d +byr:1928 ecl:brn cid:207 + +byr:1950 pid:644579904 hcl:#b6652a +eyr:2027 iyr:2017 +ecl:brn hgt:171cm + +iyr:2011 byr:1960 +eyr:2023 +hgt:171cm ecl:hzl +pid:331465564 cid:205 hcl:#18171d + +hgt:61cm eyr:1987 ecl:#9f458c byr:2023 pid:162cm hcl:z iyr:1997 + +hcl:59e376 pid:065607649 +iyr:2020 +byr:2010 ecl:blu + +pid:167cm byr:2022 hgt:150cm ecl:#06650a hcl:caa145 eyr:2032 +iyr:2015 + +byr:1932 +hcl:#419d73 +cid:203 iyr:2017 +pid:105921085 +ecl:gry + +pid:501585534 hcl:#418895 +iyr:2018 +hgt:157cm byr:1940 ecl:hzl eyr:2027 + +cid:220 hgt:171cm hcl:#623a2f +ecl:gry +iyr:2017 +pid:085309709 eyr:2024 byr:1932 + +hcl:#733820 eyr:2028 cid:93 +iyr:2017 +byr:1974 hgt:163cm ecl:grn pid:630322998 + +hcl:#602927 cid:97 hgt:166cm eyr:2025 +ecl:hzl iyr:2016 byr:1964 pid:355325363 + +iyr:2016 pid:402228657 hgt:174cm byr:1993 +eyr:2020 hcl:#733820 ecl:grn + +iyr:2020 hgt:171cm ecl:amb +hcl:#c0946f +byr:1939 +cid:316 pid:782384470 eyr:2030 + +byr:1983 pid:839608616 +eyr:2026 +hcl:#ceb3a1 cid:242 +hgt:192cm ecl:hzl + +pid:701022732 byr:1931 ecl:amb +hgt:70in hcl:#341e13 eyr:2030 iyr:2013 + +eyr:2027 +pid:740692321 byr:1940 +hgt:179cm ecl:blu cid:153 iyr:2010 + +iyr:2024 hcl:z ecl:zzz hgt:181in pid:#c38620 eyr:1976 cid:97 +byr:2029 + +byr:1999 ecl:lzr hcl:6f29a6 eyr:2023 +iyr:2018 cid:209 pid:401606571 hgt:163cm + +ecl:amb +byr:1996 hgt:181cm iyr:2018 hcl:#6b5442 pid:022285219 eyr:2021 + +cid:93 pid:807990476 +hgt:61in eyr:2027 hcl:#cfa07d ecl:oth iyr:2017 + +hcl:#7d3b0c pid:225151503 iyr:2013 cid:68 +eyr:2029 +ecl:brn hgt:64in byr:1959 + +eyr:2028 hgt:172in +iyr:2014 byr:1950 pid:187cm hcl:z ecl:brn + +byr:1982 +pid:978263388 eyr:2021 hgt:175cm iyr:2014 ecl:brn hcl:#a97842 + +hgt:162cm +eyr:2025 +pid:6533951177 byr:1993 iyr:2011 hcl:#c0946f ecl:hzl + +pid:182cm +iyr:2025 eyr:2035 hgt:59in +ecl:#799f29 hcl:z +byr:1920 cid:202 + +hcl:#733820 +eyr:2022 hgt:185cm byr:1989 pid:195276207 +ecl:blu iyr:2017 + +hcl:#7d3b0c +cid:257 ecl:gry +pid:123065639 byr:1951 iyr:2013 + +eyr:2039 ecl:#a82e90 byr:1927 pid:719738468 hgt:73cm + +hcl:605223 +hgt:162cm pid:50424035 +ecl:oth cid:343 byr:2025 iyr:2023 eyr:2024 + +hcl:699116 iyr:2001 +eyr:2022 +byr:2013 +hgt:171cm pid:8900968325 + +hcl:#efcc98 eyr:2029 ecl:grn pid:568953221 +byr:1986 +hgt:178cm +iyr:2020 + +pid:452235579 byr:1932 +ecl:grn +iyr:2010 hgt:189cm eyr:2028 +hcl:#602927 cid:258 + +ecl:xry iyr:2009 cid:334 pid:189cm +eyr:2032 byr:2005 hgt:172in hcl:z + +hgt:159cm hcl:z pid:166cm +ecl:oth eyr:2026 iyr:2020 + +eyr:2023 ecl:blu byr:1935 iyr:2015 +hcl:#866857 pid:542611829 +hgt:168cm + +pid:#ec3d53 +hcl:#ceb3a1 +byr:1999 eyr:2024 +hgt:188cm ecl:oth iyr:2018 + +byr:2003 hgt:167 +hcl:486800 +ecl:#29bdd6 eyr:2037 cid:169 iyr:2010 + +byr:1983 +eyr:2026 ecl:gry +pid:203934984 +hgt:181cm iyr:2020 hcl:#a97842 cid:184 + +hgt:180cm +iyr:1934 eyr:2038 hcl:#a97842 ecl:brn byr:1942 pid:427001597 + +hcl:#18171d byr:1988 +cid:267 hgt:188cm +ecl:amb +eyr:2028 pid:696617232 + +eyr:2024 hcl:#cfa07d +iyr:2013 pid:176cm hgt:189cm byr:1990 +ecl:gry + +eyr:2025 iyr:2015 hgt:153cm hcl:#ceb3a1 ecl:grn pid:686467422 byr:1961 cid:282 + +byr:1931 hgt:185cm ecl:oth +eyr:2022 +pid:561083684 hcl:#efcc98 +iyr:2012 + +byr:1948 cid:327 hgt:151cm +iyr:2016 hcl:#733820 ecl:oth pid:341978822 + +hcl:#ceb3a1 +byr:1978 iyr:2020 hgt:172cm +eyr:2022 ecl:oth pid:093317990 + +eyr:2029 +pid:096891409 iyr:2018 +hcl:#d82822 hgt:174cm ecl:hzl +byr:1988 + +hgt:170cm iyr:2018 pid:588142771 eyr:2022 hcl:#733820 +cid:273 byr:1940 ecl:#a608fe + +iyr:2029 eyr:1980 hcl:#341e13 byr:2027 ecl:grt +pid:443809337 hgt:180cm +cid:205 + +ecl:#f89df0 hgt:144 hcl:2f26ab iyr:1982 pid:#3b43c1 eyr:2032 byr:2012 + +ecl:hzl byr:1971 +pid:030850749 +hgt:170in +hcl:#ceb3a1 eyr:2023 iyr:2018 + +byr:1940 iyr:2020 +eyr:2026 pid:437820254 +hgt:179cm ecl:gry + +byr:2028 +eyr:1986 hcl:z +hgt:185in pid:773739744 ecl:dne iyr:2020 + +hcl:#a97842 +hgt:186cm cid:64 iyr:2016 +byr:1947 eyr:2021 + +byr:1988 hgt:160cm eyr:2023 hcl:#866857 pid:788805179 iyr:2022 ecl:amb + +hgt:164cm byr:1996 cid:338 hcl:#efcc98 +eyr:2029 pid:208596014 ecl:blu + +pid:357680064 byr:1960 eyr:2029 ecl:gry hgt:192cm hcl:#c0946f + +ecl:#d32320 +hgt:167in pid:19531341 +hcl:z +cid:346 iyr:2024 byr:2006 eyr:2035 + +pid:843729120 byr:1987 hgt:185cm eyr:2022 +ecl:amb +iyr:2012 hcl:#c0946f + +eyr:2020 byr:1961 iyr:2011 +hgt:162cm cid:54 pid:891397982 ecl:brn + +ecl:zzz byr:2019 iyr:2015 eyr:2028 hcl:43d56d +hgt:152cm +pid:182cm + +hcl:#18171d byr:1979 hgt:174cm +iyr:2013 cid:228 eyr:2022 ecl:amb pid:82422450 + +cid:156 iyr:2017 +byr:1924 +hcl:#b6652a ecl:gry hgt:184cm eyr:2027 pid:451347151 + +pid:850192502 hgt:65in +iyr:2011 hcl:#7d3b0c +eyr:2023 ecl:gry + +ecl:amb hgt:181cm iyr:2017 pid:233345009 byr:1934 +hcl:#341e13 +eyr:2024 cid:199 + +eyr:2026 pid:#4cb480 +iyr:1958 hgt:176cm ecl:dne hcl:z + +ecl:grn eyr:2027 hgt:178cm byr:1994 hcl:#341e13 +iyr:2016 pid:790075315 + +pid:140922484 +byr:1958 +eyr:2025 +iyr:2019 ecl:brn hgt:157cm hcl:#623a2f + +pid:466785488 hgt:160cm hcl:#cfa07d +byr:1947 +iyr:2010 +cid:198 eyr:2020 ecl:hzl + +ecl:oth +eyr:2022 byr:1963 +hcl:#fffffd iyr:2017 +hgt:171cm pid:463249115 + +hgt:73cm byr:1968 +pid:470317690 ecl:blu +iyr:2015 hcl:#c0946f cid:54 eyr:2029 + +hgt:162cm iyr:2014 +byr:1951 hcl:#b6652a eyr:2029 ecl:blu + +ecl:oth +hgt:176cm hcl:#888785 byr:1963 +iyr:2017 pid:453133253 eyr:2025 + +hcl:#efcc98 +eyr:2024 iyr:2020 cid:330 byr:1950 pid:937122408 ecl:gry hgt:162cm + +hgt:168cm +pid:745867335 +cid:165 hcl:#c0946f iyr:2018 ecl:grt eyr:2030 +byr:1932 + +byr:1949 pid:116003343 +hcl:#c0946f hgt:178cm eyr:2028 iyr:2020 cid:220 +ecl:hzl + +iyr:2013 +cid:314 pid:186cm hgt:74cm eyr:1973 ecl:hzl byr:2007 +hcl:180e0c + +pid:486330019 +byr:1999 ecl:oth hgt:154cm iyr:2019 eyr:2026 +hcl:#efcc98 + +eyr:2030 iyr:2018 hcl:#18171d byr:1950 +pid:648616604 hgt:160cm ecl:gry + +hgt:173cm +ecl:oth byr:1993 eyr:2029 hcl:#fffffd iyr:2010 pid:317451887 + +ecl:brn hgt:157cm +byr:1963 eyr:2023 pid:005387570 hcl:#866857 iyr:2012 + +pid:419695212 eyr:2020 byr:1957 cid:198 iyr:2015 hcl:#888785 hgt:168cm ecl:amb + +ecl:amb +iyr:2017 eyr:2024 pid:039995171 hcl:#a97842 +hgt:153cm byr:1983 + +byr:1979 eyr:2021 iyr:2011 hgt:157cm ecl:blu pid:110855542 hcl:#c0946f + +ecl:blu pid:948753945 eyr:2029 iyr:2012 hcl:#ceb3a1 +hgt:164cm byr:1988 + +iyr:2010 +eyr:2032 hcl:#fffffd pid:#175129 hgt:184cm +ecl:hzl byr:1985 + +hgt:189cm ecl:blu byr:1936 eyr:2027 hcl:#733820 +pid:728752361 iyr:2011 + +hcl:#733820 ecl:blu eyr:2023 hgt:172cm iyr:2017 +pid:013415387 byr:1947 + +byr:2012 iyr:2017 pid:#424ae4 +cid:172 hgt:166cm eyr:2022 +hcl:b1319b ecl:#6635d8 + +eyr:2030 +iyr:1928 hgt:185cm ecl:brn pid:#ac5a90 byr:1984 hcl:ac8f43 + +eyr:2027 +ecl:amb iyr:2014 hcl:#fffffd +pid:838758900 +hgt:177cm byr:1942 + +cid:166 iyr:2020 ecl:lzr hgt:70cm eyr:2040 byr:2004 hcl:#733820 + +eyr:2028 ecl:grn byr:2016 cid:61 iyr:2010 +hcl:#cfa07d +hgt:155in +pid:9594283803 + +ecl:gmt pid:984675198 +byr:1997 hgt:128 eyr:2037 hcl:#b6652a cid:299 + +iyr:2015 pid:733864914 eyr:2021 ecl:amb +byr:1971 cid:280 +hgt:181cm hcl:#054593 + +ecl:hzl hcl:#cfa07d eyr:2022 pid:832736421 +byr:1958 +iyr:2010 +cid:274 hgt:152cm + +eyr:2020 hcl:#6b5442 cid:223 hgt:155cm byr:1989 ecl:oth +iyr:2011 pid:549182194 + +iyr:2020 hcl:#cfa07d +eyr:2027 pid:093361240 byr:1941 cid:271 hgt:178cm ecl:brn + +ecl:blu cid:290 eyr:2027 +hgt:192cm byr:1945 hcl:#7d3b0c iyr:2020 pid:910713369 + +byr:1991 hcl:#ceb3a1 ecl:xry hgt:159cm pid:9496171384 +eyr:2030 iyr:2016 + +eyr:2020 pid:812617809 hcl:#7d3b0c +byr:1970 ecl:gmt +iyr:1971 hgt:157in + +pid:596027311 hcl:#866857 hgt:169cm byr:1945 eyr:2030 ecl:oth +iyr:2010 + +hgt:176cm +pid:213213359 byr:2012 hcl:be7b13 eyr:1971 ecl:gmt iyr:2011 +cid:64 + +pid:27107946 ecl:utc hgt:66cm byr:1928 eyr:2040 +cid:87 + +byr:1959 ecl:blu hcl:4e023b pid:9017609497 eyr:2023 hgt:68 iyr:2029 + +hgt:164cm eyr:2023 byr:2008 ecl:grn pid:420168481 hcl:#b6652a iyr:2012 + +eyr:1977 byr:1934 +ecl:brn cid:163 +iyr:2018 pid:2863284754 +hgt:150in hcl:#623a2f + +ecl:hzl eyr:2031 cid:145 hgt:186cm hcl:#cfa07d +byr:1941 iyr:2010 pid:722056139 + +ecl:blu eyr:2027 +hcl:#888785 iyr:2018 byr:1977 cid:278 hgt:156cm + +eyr:2039 hgt:82 byr:2007 +hcl:z iyr:2021 ecl:dne cid:191 +pid:#1cf69f + +pid:183cm cid:111 +hgt:66cm +iyr:1950 +eyr:1947 ecl:#016f6a + +ecl:hzl byr:1957 iyr:2015 hgt:186cm eyr:2029 hcl:#701e04 cid:149 pid:827898914 + +cid:214 pid:785688542 hgt:189cm byr:1974 ecl:brn +hcl:#18171d +eyr:2030 + +hcl:#866857 +cid:241 ecl:grn pid:389488422 byr:1959 iyr:2015 hgt:67in +eyr:2027 + +hcl:#6b5442 iyr:2011 hgt:193cm +eyr:2026 byr:1952 +pid:033382338 +ecl:grn + +iyr:2020 hgt:166cm byr:1927 +eyr:2029 ecl:hzl +pid:927006613 hcl:#623a2f + +ecl:gry pid:640783974 +hgt:71in byr:1945 iyr:2019 cid:268 hcl:#b6652a +eyr:2025 + +hcl:#733820 hgt:163cm +pid:1285584293 byr:1967 ecl:oth +cid:309 iyr:2020 eyr:2031 + +pid:910349085 iyr:2011 hcl:#623a2f byr:1956 +eyr:2025 ecl:gry +hgt:182cm + +pid:018283044 hcl:#602927 hgt:153cm ecl:gry iyr:2020 +eyr:2024 +byr:1990 + +hgt:184cm hcl:#866857 ecl:oth +eyr:2023 pid:405733635 cid:205 +byr:1987 iyr:2012 + +hgt:167cm +iyr:2015 ecl:brn +eyr:2025 +hcl:#18171d cid:313 byr:1960 + +hgt:165cm byr:1933 +iyr:2014 +cid:203 +hcl:#1cdbb3 +ecl:hzl eyr:2027 pid:747009469 + +hgt:169cm ecl:gry iyr:2014 +byr:1966 pid:621876532 hcl:#efcc98 + +cid:342 eyr:2029 hcl:#a97842 byr:1970 +ecl:oth +pid:137287449 hgt:180cm +iyr:2011 + +hcl:#cfa07d byr:1985 hgt:183cm ecl:grn +iyr:2013 eyr:2022 + +iyr:2023 +pid:164cm hcl:z byr:1966 +eyr:2021 ecl:utc + +hcl:#fffffd cid:60 +byr:1973 +pid:324648387 +hgt:177cm eyr:2022 iyr:2010 +ecl:oth + +pid:632056596 hcl:#efcc98 +hgt:73in ecl:brn byr:1928 iyr:2017 +eyr:2023 + +cid:144 ecl:amb eyr:2035 byr:1943 hgt:180cm +iyr:2012 +pid:155cm + +hcl:#6b5442 +pid:927492391 +eyr:2023 hgt:172cm byr:1958 cid:92 ecl:gry iyr:2019 + +iyr:2020 cid:82 +hgt:193in hcl:#b6652a +ecl:grn eyr:2034 byr:2026 + +iyr:1922 hcl:245cb3 byr:2015 +pid:151cm +eyr:2040 +ecl:lzr cid:136 hgt:101 + +byr:2025 +eyr:2029 +hgt:193in +cid:308 +ecl:gry iyr:2028 pid:9335153289 +hcl:z + +eyr:2030 hgt:163cm iyr:2014 +pid:147768826 ecl:blu byr:1922 hcl:#ceb3a1 cid:169 + +ecl:blu byr:2002 eyr:2028 pid:998185490 cid:165 iyr:2020 +hgt:188cm hcl:#c0946f diff --git a/README.md b/README.md new file mode 100644 index 0000000..3ecf2d1 --- /dev/null +++ b/README.md @@ -0,0 +1,8 @@ +# Advent of Code - trotFunky's pot O' code + +This is the repository where I'll be storing my solutions for the [Advent of Code](https://adventofcode.com) event run by [Eric Wastl](http://was.tl/). +The directory structure is simple : `year/day`, each day containing the input file and at least one file containing my solution(s). + +## Depencies + +Only Python3 for now ! From 5cef0347554e23fde421bbc7f94b87747caeeb89 Mon Sep 17 00:00:00 2001 From: trotFunky Date: Fri, 4 Dec 2020 23:10:35 +0100 Subject: [PATCH 02/28] 2020 AoC, Days 1-4 --- 2020/Day 1/Solution.py | 76 +++ 2020/Day 1/input.txt | 200 ++++++++ 2020/Day 2/Solution.py | 32 ++ 2020/Day 2/input.txt | 1000 ++++++++++++++++++++++++++++++++++++++ 2020/Day 3/Solution.py | 36 ++ 2020/Day 3/input.txt | 323 +++++++++++++ 2020/Day 4/Solution.py | 78 +++ 2020/Day 4/input.txt | 1029 ++++++++++++++++++++++++++++++++++++++++ README.md | 8 + 9 files changed, 2782 insertions(+) create mode 100644 2020/Day 1/Solution.py create mode 100644 2020/Day 1/input.txt create mode 100644 2020/Day 2/Solution.py create mode 100644 2020/Day 2/input.txt create mode 100644 2020/Day 3/Solution.py create mode 100644 2020/Day 3/input.txt create mode 100644 2020/Day 4/Solution.py create mode 100644 2020/Day 4/input.txt create mode 100644 README.md diff --git a/2020/Day 1/Solution.py b/2020/Day 1/Solution.py new file mode 100644 index 0000000..262cf90 --- /dev/null +++ b/2020/Day 1/Solution.py @@ -0,0 +1,76 @@ +target = 2020 +input_file = "/tmp/aocinput" + +def find_sum_of_two(): + large_n = [] + small_n = [] + + with open(input_file) as file: + line = file.readline() + while line and line != "\n": + halftarget_count = 0 + + number = int(line) + if number > target/2: + large_n.append(number) + elif number == target/2: + halftarget_count += 1 + else: + small_n.append(number) + + if halftarget_count == 2: + print(f"Found a sum : {target/2}*2 = {target}\nAnswer is {(target/2)**2}") + break + + line = file.readline() + + for big_one in large_n: + complement = target-big_one + if complement in small_n: + print(f"Found a sum : {big_one}+{complement} = {target}\nAnswer is {big_one*complement}") + return + + print("No sum found that can reach {target}") + +def sum_search(target_sum, inputs): + lower = [] + upper = [] + + for num in inputs: + if num < target_sum/2: + lower.append(num) + else: + upper.append(num) + + search_list = lower if len(lower) < len(upper) else upper + iter_list = upper if len(lower) < len(upper) else lower + + for num in iter_list: + if target_sum - num in search_list: + return num, target_sum-num + + return False + + +def find_sum_of_three(): + data = [] + subtracted_to_target = [] + with open(input_file) as file: + line = file.readline() + while line and line != "\n": + data.append(int(line)) + subtracted_to_target.append((target-data[-1],data[-1])) + + line = file.readline() + + data.sort() + + for sub_target in subtracted_to_target: + result = sum_search(sub_target[0],data) + if result: + print(f"Sum found : {result[0]}+{result[1]}+{sub_target[1]} = {target}\nResult is {result[0]*result[1]*sub_target[1]}") + return + + print("No sum found") + + diff --git a/2020/Day 1/input.txt b/2020/Day 1/input.txt new file mode 100644 index 0000000..ba38c4a --- /dev/null +++ b/2020/Day 1/input.txt @@ -0,0 +1,200 @@ +1322 +1211 +1427 +1428 +1953 +1220 +1629 +1186 +1354 +1776 +1906 +1849 +1327 +1423 +401 +1806 +1239 +1934 +1256 +1223 +1504 +1365 +1653 +1706 +1465 +1810 +1089 +1447 +1983 +1505 +1763 +1590 +1843 +1534 +1886 +1842 +1878 +1785 +1121 +1857 +1496 +1696 +1863 +1944 +1692 +1255 +1572 +1767 +1509 +1845 +1479 +1935 +1507 +1852 +1193 +1797 +1573 +1317 +1266 +1707 +1819 +925 +1976 +1908 +1571 +1646 +1625 +1719 +1980 +1970 +1566 +1679 +1484 +1818 +1985 +1794 +1699 +1530 +1645 +370 +1658 +1345 +1730 +1340 +1281 +1722 +1623 +1148 +1545 +1728 +1325 +1164 +1462 +1893 +1736 +160 +1543 +1371 +1930 +1162 +2010 +1302 +1967 +1889 +1547 +1335 +1416 +1359 +1622 +1682 +1701 +1939 +1697 +1436 +1367 +1119 +1741 +1466 +1997 +1856 +1824 +1323 +1478 +1963 +1832 +1748 +1260 +1244 +1834 +1990 +1567 +1147 +1588 +1694 +1487 +1151 +1347 +1315 +1502 +546 +730 +1742 +1869 +1277 +1224 +1169 +1708 +1661 +174 +1207 +1801 +1880 +1390 +1747 +1215 +1684 +1498 +1965 +1933 +1693 +1129 +1578 +1189 +1251 +1727 +1440 +1178 +746 +1564 +944 +1822 +1225 +1523 +1575 +1185 +37 +1866 +1766 +1737 +1800 +1633 +1796 +1161 +1932 +1583 +1395 +1288 +1991 +229 +1875 +1540 +1876 +1191 +1858 +1713 +1725 +1955 +1250 +1987 +1724 diff --git a/2020/Day 2/Solution.py b/2020/Day 2/Solution.py new file mode 100644 index 0000000..cbbc5f0 --- /dev/null +++ b/2020/Day 2/Solution.py @@ -0,0 +1,32 @@ +input_file = "/tmp/aocinput" + +def letter_count(): + valid_passwords = 0 + + with open(input_file) as passwords: + line = passwords.readline() + while line and line != "\n": + elements = line.split(" ") + min_req, max_req = elements[0].split("-") + password_count = elements[2].count(elements[1][0]) + if int(min_req) <= password_count <= int(max_req): + valid_passwords += 1 + + line = passwords.readline() + + print(f"There are {valid_passwords} valid passwords") + +def letter_position(): + valid_passwords = 0 + + with open(input_file) as passwords: + line = passwords.readline() + while line and line != "\n": + elements = line.split(" ") + first_pos, second_pos = elements[0].split("-") + if (elements[2][int(first_pos) - 1] == elements[1][0]) ^ (elements[2][int(second_pos) - 1] == elements[1][0]): + valid_passwords += 1 + + line = passwords.readline() + + print(f"There are {valid_passwords} valid passwords") \ No newline at end of file diff --git a/2020/Day 2/input.txt b/2020/Day 2/input.txt new file mode 100644 index 0000000..427015c --- /dev/null +++ b/2020/Day 2/input.txt @@ -0,0 +1,1000 @@ +1-13 r: gqdrspndrpsrjfjx +5-16 j: jjjjkjjzjjjjjfjzjjj +14-16 r: rrrnrrrrrcnrgxrr +1-3 k: bkktwhgktv +3-5 q: dxqqqzmqvs +11-14 s: sssssssssssssv +1-3 d: cdzdq +13-16 q: scdqpdgpkvbwwqbv +9-10 d: ddrdddlddd +15-17 v: jvvvvvvgcvvvvrcvnv +2-3 s: xssx +8-15 j: jwjjjjkhjjjltjmjjjr +7-15 m: wqspfmtpjftmplwp +1-11 s: swdgzhgsxtssndzfm +3-4 b: bgjrg +1-12 x: jxgxxxpjwpsht +5-15 x: xxjxwshpxjxxxxsnxvz +4-11 r: bjnrpswfprrng +12-14 j: wjjzmwnmmvzsjhnnkj +3-4 d: dddv +2-4 b: bfxx +15-16 r: rrrrrrrrrrrlrrphrr +6-11 j: jsljjjjjjjj +6-7 m: mpttcmmmmng +6-7 g: gsggggg +2-10 b: nbtbqbbfpb +4-6 h: hhqhrzkcrhh +13-14 b: bbbbbbbbbbnbbbb +5-6 g: gggggg +5-6 x: rsxvxx +3-6 q: wxqzqqqtzsq +1-2 h: sjhj +6-18 t: jtptcwtbfgffpkdwthbf +5-9 w: wwwwcwwww +15-16 g: wqdwztbmrqdmgmvc +8-15 t: ttttgztvtttnttb +9-11 r: rrvrrrrnhrzr +8-9 l: lllllllqwl +10-11 h: hhhhhhhhhhd +3-5 g: gggrwqc +5-12 f: ffcdxfglcffsf +6-7 f: fffffzk +3-5 b: btbbbb +2-8 z: wblnvfzzwzzbchx +13-14 r: rrrrrfrrrrrrlf +2-9 r: wgbmfvksl +5-12 m: xrmmfhmqdhmmvhvrzmwq +3-4 j: jwpd +6-8 v: mvfwgskpxgvcsr +1-3 c: ctpr +2-8 d: dzdfsddd +10-14 c: ccccczcccccqlchvclcc +2-8 s: sscwcfssssssdt +2-11 l: xlsslrlclfls +7-8 r: rrrjrrrrtdcr +7-9 z: zzzzzzzpzz +12-14 r: rrrrrrrrrrrprrr +13-14 g: hdczwngvjtgmhn +1-7 q: qqdqqqqvq +5-6 q: qqqqql +11-16 p: wgwrzltpskwgxprm +4-12 d: dvddddddwddz +15-16 q: qqqqqqqqqqqqqqqqq +1-5 m: mmrjmmqsjkm +13-14 m: mlmxmmmdmgmmmw +4-5 q: qcqvmhqdq +2-3 m: brdzbfzj +3-4 s: snshj +5-9 k: kzpkkbkvqjktrk +12-13 t: fltttttttjtpstttt +7-8 c: kcccfccccxtcc +2-6 q: nnjqqd +2-9 n: msnvnrxgldqnxnngsn +2-4 c: scccwp +12-13 c: ccbccqdcccfcvdccc +6-7 f: fmdffffxcbbpffl +2-6 r: rbrrrvr +7-10 j: jzjtjjqfvjj +3-7 j: jjrjjjjj +2-13 m: mmmlmqddkmtmmm +19-20 l: drpwllkdlsjslmllsdrv +3-5 v: vxmrwwvh +5-13 z: zzzzkzzzzzzzkzzzf +5-6 g: gggggfg +4-6 c: crfvlc +14-18 x: xxxxxxxxxjxxxzxdqc +4-7 p: plzqjtp +2-4 v: nmdbhftxvbv +5-8 s: knfcsbbsxssssxd +2-13 p: mpwpnbrnlxmqvfbltcq +7-11 v: vbvvvkfvvvg +14-17 x: xxrxxxbxxwmhxxpxqxv +5-7 f: qffndfmqfsrv +7-8 v: vvvqvvbvv +9-10 j: jjjdjjjslljjjjjch +4-6 l: lllplgr +3-4 n: nnqn +4-5 c: ccccc +1-2 q: lwhqw +6-7 d: dddmddqd +6-7 g: gggggzxg +2-10 j: jsjjjjjjjsjj +13-15 b: dxbbbbbbbbbbbmbbbmbl +5-10 q: qqqqwqqqqxq +12-13 j: jjjjjzjjjjbjxjjb +5-10 t: ttfttphtttttmthttp +3-4 t: tttj +7-8 n: nnknnpphfwnn +9-10 x: xxxxxxxxcx +14-17 h: hhkhhzxhhhhhhjhhxhh +4-5 w: whxtwwftw +10-12 q: xqgqsqqvqqlqqqdqpqrq +1-3 l: jsvlzrm +8-16 z: sbzzqzxzzzskzzxgrzcz +7-10 k: kkkkjklkkt +9-11 f: ffffwfffwflnwf +1-8 c: cmccwcqzzhxccr +6-9 h: vnfxddhrhbdqkqr +8-9 t: tzttdtttvvtb +6-9 q: qqqqqqqqqqqqq +15-17 k: kkkkkkkkkkkkkklkqk +3-10 p: pprppppppfp +5-11 d: nhgkdjgvmdddt +7-9 d: rdddddddpd +1-3 r: rrwrr +5-16 t: gttwtrqqmwwljhfn +6-9 q: qqqswdzllqqf +7-13 b: mxpxbjgvsncqwv +7-8 d: dddddrddds +3-4 z: zzqzz +10-18 z: zzzqzzzzbzzwzzpzzzz +8-9 p: pppppppppp +13-16 f: fffffffffffffxtf +8-9 w: fwgwwwlsfpww +4-5 g: grgmcpdqggwckq +16-17 g: gggggwgggggggggln +3-13 j: jjmjjjjjjjjjbjjjjjj +9-13 x: xxxxxxxxxxxxx +5-12 b: bbrmbhbbsgbbbpbbz +14-18 z: zzzszzszzzzzzzzzzzh +1-13 k: pkkkkkhgfkfbtkkpkf +3-14 v: vvvpdlvvvvdfvvjvvsv +12-13 m: mmmmrmbmmmmmmrmmm +12-14 v: vvvvvvvvvcrlvkvv +18-19 p: mxpppgpwcphkzppktppk +4-10 x: xxxxxxxxxxxxx +4-5 k: kklkkk +11-13 m: mmmvmmwmzwmmmnvgmm +7-11 p: qdppjspwtcpppp +4-8 l: lllllllll +12-16 j: jjvjtjjsstfjjnjjk +15-17 h: phhhhhhhhhhrhhhhh +4-7 j: sqfjjjj +3-20 m: wzmqhwmjmclzmmmdlzqm +8-13 m: jpmmbmtgmnprgt +8-13 h: hhhhjjhchhbhqshh +15-20 b: mbbbgbbzmkbbkbbpffqb +2-3 t: tdlt +10-16 l: llllkgllrnllllll +2-4 p: phpf +3-5 d: ddddd +5-6 h: hhhhhhh +2-3 j: cjjrj +7-10 g: hgwtggfgbcpgd +3-4 d: dddk +4-6 t: mltdtf +8-9 h: zhljxshhh +2-3 p: vqjgbsp +6-7 x: gcxvjxp +15-17 s: sswgssdsgssjlssss +1-3 m: qvswmm +1-7 v: svbrvsjv +3-5 j: vjhjdq +15-16 b: bbbnbbbmbbbbbbbdbbmb +6-19 k: spkgcpkhlkkthkgkfzkj +1-2 c: dxqxnrrlfnnc +7-11 j: qjjjjjkdrjjjjj +5-11 g: ztdgvvgwhrlgnq +3-4 c: fcmqglp +4-5 q: qqqqqqq +6-7 c: cccccrc +7-11 n: nnnnbnnnnnn +9-13 x: xxxxxbdtqxdwxsx +9-15 j: ljjjjjjjjjjjjjz +2-11 j: pjjhzmtwlgjwpkjjdwq +5-6 k: kkkkkk +12-13 q: qqqqqqqqqqqmg +3-14 j: nwkjjlbbrnqvqm +3-4 h: hhhhshhhhhhmrh +2-4 l: djkxl +1-9 t: tttttfttl +9-10 g: ckggggtggggggv +3-12 l: cqlclvwhpxwlnzzsqgs +8-14 d: ddddddddnddfdh +1-5 v: vvvvxm +2-5 q: mqqqqlqk +3-4 j: tkjpj +13-16 w: wwwwwwwwwwwwwwxww +13-18 m: mmmmmmmmmmmmmzmmmmm +2-4 x: xxfxx +1-2 d: ddvddddkdddd +3-5 c: cctdc +2-10 q: tqjkqqpsctx +2-18 n: nlnnhnxnnnnnnnnnnln +3-7 k: rkkkbkk +3-4 n: ngnn +3-11 d: dqdbwtbghbdj +3-5 q: fqqqq +5-10 x: xxxxfgxxjbxbhxx +5-6 m: mmtmcn +4-6 x: xxxkxk +17-19 b: bbbbbbbbbbbbbmbbbjbb +5-6 k: kkkkhk +10-12 k: kkkkkkkkkpkgk +3-4 z: zzzz +18-19 p: plcppppksppcnptppvmp +3-6 t: tdtrltmn +3-4 q: qqqq +10-19 v: vvzrvvvvvvvvvvvvvvhv +11-16 d: kjdtddddkdvcdddpd +12-16 l: lllllllllllllllll +4-10 b: dbvbqfqlrb +10-11 k: kbkvkhlkqrv +1-9 x: sbqnkxdmxpc +5-10 l: ldlllkllrln +9-13 j: bpjjjjjjjkjzjnj +11-12 j: jjjjjjjjdjjj +2-8 l: jllzbhjlqlwcltllq +4-5 s: gsssd +2-4 s: kswn +1-18 p: bpppppppppppppppptp +9-11 v: vhvvvvvvvvvv +2-5 v: vvkvvv +8-11 p: plplqpjhdzlfpppppl +11-18 g: ggggglgvgcgggggggg +9-11 r: rrrrwrrrmrzp +3-12 g: tggggmggwnpzvgpnp +13-17 t: tnvvttxttttvtftptgt +5-16 c: cccqccccjvcccccccczc +2-4 f: tfbfrjftf +2-4 s: ssssx +3-9 v: vvspvvvjv +3-4 h: hhxh +15-17 l: lllllllllqllmlvwblll +4-9 j: rjljjjjfjjskdkwttbjt +9-10 m: jmmmmmvmhh +1-8 w: wwwlcwgwwwp +1-8 j: mllsjncl +3-4 b: tfbkbssb +1-7 g: qvdbrjkdgggb +1-3 l: wlbll +4-6 v: jvzqbvvvg +2-3 w: vjlwx +10-12 c: ccvcccrccjfhgccdw +10-18 b: bbtbbbbbggbbbbbbbvb +8-9 j: jjjjjjjjjpjg +5-15 c: ccbccccccccccvccc +16-17 t: ttttgtttttttttttthtx +13-15 t: tvsmjtjttktztrt +9-12 c: jzrpnzdncldmxqjmvccb +6-7 v: jjdvpdhv +4-5 c: ccccccccccccc +6-7 t: ttzttttt +10-11 q: qgxqqqqqqqqqq +14-15 h: hhhhhhhhhhhhhhh +3-8 b: bbbbmbbbbb +11-12 r: rhlrsrrrrjrr +2-6 v: vrvvvhv +4-5 n: nnnhn +3-5 p: pqhmnjp +7-13 h: qhhcwhhhhqhhfq +10-11 d: dddddddddxh +10-11 d: gdcdcdddcddtddsddd +1-5 f: bffspf +5-8 s: skssblsg +8-11 m: mmmcmmmwmzmmmvm +6-8 q: kqqkmqhqq +2-8 q: nqnqbdgm +6-11 b: bbbbmbbqbbb +5-14 q: qqqqpbqqqqqqqgqq +2-5 p: prprwh +13-14 k: kkkkkkkkkkkkkkkk +2-7 v: vnvvdlwvd +2-3 t: hpsqzxrltrwbttwgbz +1-5 n: srnlwnnkjnnwhnf +2-3 r: dtlcv +2-5 h: hhthhdcm +2-11 d: rdxfbdhqpbdjjlhf +1-4 b: bxbshbjr +4-10 s: sthspqlnsst +1-10 h: mhwpfrbhhbn +16-18 g: gggggggglgjgggqcgzgg +3-4 d: dddd +12-16 h: dhhhhhhhshhhmnlhhhh +15-19 q: qmqkqqzqtqdqnqqzqqz +14-15 p: kgjpqpppppqpdpph +4-6 z: zzlzzztbbzzr +11-14 l: blllwlqmhlllldllll +2-4 q: qqrqc +5-6 r: qrrvrrr +2-4 f: fffv +13-15 v: vkvvvpvvvvvvvhvvvv +3-8 k: kzqkkkkkk +4-10 w: wvkwwcwxkwv +2-6 t: tvtttttttt +3-4 t: tttt +11-12 p: pzpzppplplppppk +6-12 p: pppppdpppppgp +5-9 w: wwwwwwwzwwww +4-6 m: mmmmmhmmq +4-9 j: xsqjsllnjj +6-9 c: zmcdccgtfccbccfc +4-5 p: vwpzhpp +15-16 v: pjtmwtrxmjnjfkvgrv +9-10 p: pppppppspp +2-10 f: vffzxnfnxfcfcsmtrncz +5-7 v: blwvvvvfvvh +12-16 z: zzzzzzzzzzzzzzzr +5-6 z: zkvhpz +9-13 w: wwnwwwwwwwwww +5-6 p: wmlhpptppmfvngh +9-11 r: rrrrrgsrrdrmrrrr +2-5 b: bbbbzb +13-15 r: rcrrrrrlrrrrqgfrrnr +5-7 k: klkmkkk +3-4 f: zfffgdnfff +3-4 q: qjbjhzltvl +17-19 w: wwwwwwmwwwwwwwwwqwqw +7-9 l: nlrldrlvlnvllllvf +8-9 m: mmmmmpmmm +11-16 k: kkmkkkwkkkkbkkkkd +11-14 s: mvsdsnsncsssrs +6-17 j: jjjjjgzjjsjjjjjjjjd +19-20 p: ppppppppppppppppppkp +1-16 k: nkkkkkkktkkxkkxz +2-4 c: xkcccvvcv +3-4 v: vvvvvkn +11-13 q: qqqqqqqqqqsqj +10-13 g: gxggggggggggg +3-4 x: xxpx +4-7 d: dvbddcdhdd +17-18 g: gggggggggggggggglbgg +18-19 m: mmmmmmmmmmmmmmmmsmtm +4-6 g: xbtgrgbgggmgcrx +8-13 w: wtwcwnwwwcwssxwpbw +2-3 v: vcsv +4-5 g: gggpt +2-3 g: tggtpgkg +3-4 p: pglt +9-12 v: vvvvvvvvvvvvn +11-15 f: fhffffffffnfffq +2-5 s: snssk +2-3 m: mmmm +10-14 x: xxmjbxbxkbwjxxxxj +5-14 l: lmlmlczxfsllzpkljt +6-12 n: nnnxpjtbjjdnrnsvxnwt +5-9 s: ssssfsssb +3-11 f: bffrlbwzfpf +3-4 t: twtt +1-4 r: rkxrsrlrr +7-8 x: xxxxxxlf +9-15 d: nddbddddxdddrdntdd +16-18 v: vrxvwgbqtlkzprlvwvrk +9-10 l: lllllllllzlll +3-18 l: mfllwjggswwjjgrnrl +5-7 j: jjjtjxjvqjjltjj +5-14 n: nnnnnnnnnnnnnnqn +3-12 l: pllqlhpllpklcds +2-5 f: fsgfrpfflq +4-8 q: xqsfqqqrqhqjsqndz +1-5 c: hcttt +13-14 r: rrrrrrrrrrrrrgrr +4-6 d: dddddt +3-4 d: tdqgdk +14-15 s: snskdsjxpsgmbsssssf +3-5 m: mhlcxmmmw +2-12 c: ccmccchbrrscv +14-16 c: ccccccrccccccccmc +8-17 w: pwqmtwwwwrwxwtmmww +5-8 h: hhhhmhhmlb +10-12 b: bbbqwbbbbbbb +6-7 n: nxnnnnl +7-10 v: vcvgvtgvvkwvtlvcv +10-11 t: ttttttktttttttt +2-5 t: tzdtkpsf +4-5 r: rrrmhr +9-10 w: wcdwxgxrwwwk +1-6 g: jggggcg +1-7 v: vvvvvvvmv +12-15 q: rqqqqkqqqjqqbqqqqqrq +3-10 w: vwwgwwwzwwwwxwwxsw +3-4 c: mmhfccccjclccrdccc +1-5 m: mmmmm +4-5 h: vhhxh +13-14 z: zzbzzzzzzzzzbcz +9-11 k: bkkskkkkkkk +1-6 j: jxvjrm +4-6 f: ffffff +3-5 m: mmmmmm +1-3 x: xxxxxxxxxxx +16-17 f: fffffffffffvfffrxf +3-4 f: fwff +2-11 j: zvbdwnthjfh +9-10 f: gffffffffff +1-3 z: zmrnxvs +5-16 k: llkdkrkvkkhkktkktlkd +9-13 z: mvjzzzkhzvzxzqmf +4-5 d: flgsdd +2-6 p: mftwthqkqqkp +2-4 f: vfff +7-12 w: swwwwwwwfwwwwqwfvw +10-13 c: csdkvcctnccncczc +12-15 q: qqqqqqhvqqqmqqcfqq +2-8 v: gvkfgbzvvmfmg +3-14 m: txwnzwhmcrnnltc +8-13 v: zsvmsddwnkvrkgmx +12-13 f: fffffffffffff +1-16 g: trrkggqglgbbgljx +13-14 c: ccxcccccccmccd +9-12 x: xxxxxxxxcxxlxx +10-14 q: qqqfcqwqqpqqqs +11-16 l: xllllllllllllbll +12-13 v: vvvvvvvvvvvvvv +17-18 g: gggggxggggggggggpcg +1-5 x: xxrxxklxgw +4-5 f: fffqt +10-11 l: llllbklllsgxllr +6-9 r: crfmrsjhpf +4-8 h: hhhchhhx +6-12 v: cvlvvvtbqcsvvzvlztv +2-3 x: bsgfvxdl +2-5 j: njzjjj +13-14 s: ssssssssssssfw +8-11 l: jllfllllllmlllll +2-11 p: pxppppppphq +6-9 f: crtfxvfmwwdvt +3-5 n: nnnnnn +3-4 h: hhhh +3-5 d: kldhd +18-19 x: xxxxxxxxxxxxxxfxxbs +4-5 k: kkkct +9-12 n: nxlnnpnnwnnb +2-4 g: gqggz +15-16 z: zzzzzzzzzzzzzzzz +8-10 p: kpcppjbrzqpfcpgppp +5-6 g: qggggrg +7-8 c: cccfncccccc +2-8 k: hgnsbkckkkqktkstks +3-14 x: xxlxjxxxxxxxxvxfbx +1-8 l: lllllllll +1-2 p: ptbmvp +10-15 k: jkkkkktkkkkkkkkkknzg +6-11 k: kkkkdgkkkkk +7-8 m: mmmmmmmm +13-19 z: zzzzzzzkzzzzkzzzvzxz +2-4 g: tghm +3-8 b: bbbbbvdb +6-8 d: dddddrvxdddfdd +5-10 m: mnmnsmmmmxmd +1-8 r: cgcnqrvfb +16-17 l: mhjqbmhszwllqqllr +2-4 s: csssts +7-10 j: jjjjjjzjqt +1-12 x: xmxtxxxxxtxxzdxx +5-6 w: wwnwmwrw +10-11 p: lpjpgpqpkpprdpppp +8-9 k: zhkkbkfkk +1-2 j: klhz +6-13 d: dmstddpddtddddddd +1-8 h: khvcwhhhhlj +8-11 s: bsssbzsfdrsssss +1-18 s: xsssssssssssssssstss +8-15 l: xjllsmjtlllmsxll +1-5 m: mmmmmm +17-18 k: kkkkkkkkwkkkkkkkbmk +1-7 t: tttttgtdclpkx +4-14 k: tgvzgdwkgtcdrd +2-3 z: tzprzcdzhnnll +2-4 j: rntmnjxbwq +5-6 r: rrnjnr +5-9 g: lrggvfggp +4-5 s: sssdl +4-18 h: hhhhhghphbshhhhhhhhh +4-6 s: sfpjvsk +1-10 m: fwgstfsjmtp +4-8 w: wpwwwwwmwsh +2-19 l: lnllllllllllllllllwl +4-15 v: vmwhvvwvvvvsvtdvvkv +5-6 p: lpppslppjppp +5-7 p: ppzppcmdppt +14-18 f: mffxfftfwffdffffffff +4-7 v: kvvdvjvvkmh +1-7 p: rdkzpkfdpzrxq +2-3 h: cdhhngnnjslfjbh +3-6 q: qqzqqwqt +5-10 s: kpcsszfcwsh +11-12 g: gggggggggggw +14-15 w: wwwwwwwwwwwwwsp +6-10 h: bhkzhhhsbhhh +3-4 l: fcnvfxtln +2-7 j: jzsjfrjjjmxqjxjjss +6-9 s: nvdhnsbhsdwxhlj +1-2 v: vvrp +2-5 h: qhnbhfbsdhs +3-4 x: xqvzps +3-4 m: mcmm +9-11 l: srdlflnwlrl +1-8 x: cxjgmlgwvqdpnbzn +3-4 q: qqqk +4-5 r: wsdlmbdv +1-3 d: tbtdddp +3-8 g: gsggsggvgggpgrgx +5-7 t: ktzrvktqpllxwzt +1-2 s: spss +6-19 d: dtjdmqdldddbdcnzkqpd +9-11 f: fffffffffzf +1-12 g: wggnvsgcrgmx +5-7 f: qfpzfmkfmfjc +14-15 j: jhjjjjjjxqjdvvfj +6-7 v: vvtvvqs +4-11 q: qqqxqcqjqqmqqgt +1-3 l: gbkhxlzld +1-4 s: pssz +13-16 x: xxxxxxxxxxxxfsxpp +3-6 p: mlptcpvcrppn +13-15 x: xxxxxxxxxxxxxxxxx +13-14 f: ffffffffffffff +2-5 j: jjpwj +2-7 r: xrrzrvrkjr +8-9 m: mmhlmhmmmpzpmmhgmvz +3-4 g: zgggdwgggdl +6-9 t: tttttxjzttttr +1-4 h: njzthhch +3-14 x: xprxtxbpxxxxlg +9-15 q: qqqqqjqqqqqqhqqqqq +4-6 w: wwfwwwrb +6-8 w: wwwwwwww +10-11 k: kkkkkkkkksl +3-4 n: nnqfvfn +11-13 c: ccccccccccccc +5-9 n: vnvnmnnnqfnq +13-14 f: ffpzrfflffffffqffff +17-18 p: ppppppppppthpppppzp +3-8 m: hsmzgwdmm +4-7 z: zlzhtzcnzzzz +6-13 b: bvbbbhbbbbbbgbb +11-16 x: lpxtdgxvzbxpcwxc +10-14 d: dddddddddrddddddd +2-5 j: lhjnv +2-3 p: pdkp +3-10 l: lnllqjpgqfl +1-4 t: ttttttt +4-8 q: qxzqqqfczksrwmmzx +1-4 l: lllll +5-19 z: ttzhzcbczmjxzrjzpwz +4-7 s: sgssssjs +12-13 s: sssssssssssbq +9-12 h: hhhlchhhvhwb +5-13 n: fncqnnnnwkhnn +10-13 g: ggggjggggrgcqgg +8-12 q: qqxqvqqmqrpdrxqq +5-6 l: ldwlvnllwq +12-15 v: cvvvkvvvvvvvvrvvvl +6-11 x: kxmthvnkgxq +6-9 n: nfdfnkmnln +3-5 x: nqcxt +2-7 p: tpgkbpwxhpzldtmrqd +8-9 r: rrrsrrzrrmrr +3-10 x: fmmjlxbqlz +1-10 g: cngggggqghf +10-11 r: frrrrrrrrgj +2-5 q: sqgqq +7-8 x: cxxxwxsvjgxx +8-16 t: ttttttgpttqttttt +4-8 n: ndznlllnqwpmnnfwvxb +4-15 j: jjbszvrjjjjfjjjwjjcj +4-5 c: ccvrlc +17-19 f: ffffkpfffjxffwffcff +3-4 z: qfzzz +7-9 s: szssssjsm +13-18 q: lngqqpvqqdjvcqdqvlq +7-8 b: bbbbbbbb +2-4 n: lnqr +11-13 k: kkkkkgkkkqxkhfk +2-4 g: tggqzdxp +3-5 t: ttvtft +2-4 v: pzbbr +1-4 h: thhhh +2-5 m: mqxdt +8-9 k: kkkkkkkkk +2-6 w: jqfwlhv +17-18 x: xhxxxkxxxxxxxxxxxbxx +9-10 p: ppwppdpxvvjzpp +10-16 h: hmhjpxmhvnhqhjfmb +11-15 k: kkxkkkkkkgckkkcs +5-9 b: cwcbjsqbdwmbw +10-11 z: zzzzzzzzzzz +14-16 w: wptvwbwdwwwwwwww +8-10 c: xccclcchcrvtqc +7-12 r: rhnrrrrrrrkqrrtm +3-5 h: hhrhph +7-10 c: wblrcccpctnhvdc +15-17 n: nnnnnnnnnnnnnnnnn +5-13 s: ssssssssrssmslsssv +8-19 k: pvqbhlzkwpnkcgkvkwk +4-5 s: pkrxgskxsswbqwlfxsvw +5-10 d: ddsbdcdsdd +12-13 q: hwrkqrhqrrxmw +5-15 b: blcbfqbgbnghjbnglbbb +1-3 z: zzczzz +3-14 s: jsxssskvsssptw +8-13 n: nnnnknnnnnnnnnn +3-11 c: ccccccccccbccccc +1-6 n: nnnlbn +9-12 k: qkkkkkkkkxwkkk +19-20 w: wwwwwwwrwwwwwwwwwwww +10-15 n: nnnnnnndnnndfnnnn +8-14 c: cvndjxlcsccwxl +1-3 v: vrvwv +8-10 s: rshsssjssss +2-10 n: nnjnnnnnnhnkm +1-2 c: ccbcflcp +3-6 v: jtntcsvvvhp +3-5 q: qqqql +17-19 p: ppppppppppppppppmpg +10-11 k: kkkkkkkkktrk +2-4 f: tgprtftkfx +8-9 x: xxxxxxxld +4-6 l: lhzllllzhv +8-9 g: bhgkfgsggxg +5-9 d: dkdddddmdwd +2-13 s: sdffzhrpbnvtswxsbrcs +7-8 q: qjqpdqvwqqdtxpq +5-8 n: lncnfnzxtsn +8-9 p: khtrxgvhtqwrfpqrd +2-4 s: zhln +5-6 q: bqqqddp +7-13 g: gggjggggggggg +10-12 w: wwwwwwwwwkww +1-4 b: bwbbdbhbl +9-18 j: jjjjjjjjjjjjjjjjjjj +10-18 j: jjjvjjjtjjqjjjjfbjd +11-13 m: mmdmmmmmdmmmqm +6-9 n: nnnndtnvfnn +2-3 q: qckq +16-17 x: xcxxxxxxxxxxxxxpxx +14-17 k: kkkkkkkkqkkkkkkck +3-8 l: llkllllvl +8-13 p: nkptlpntkcknppwpdhb +6-12 s: ssssssssssss +8-14 c: ccccccccccccccccsc +6-9 p: cpppdnppztxbpp +8-12 w: vshmsmbckwjmw +1-10 g: qqtfmmxnbg +1-6 m: mmkmmmfmw +5-8 v: vvvwxvvdqv +7-8 f: ffffffff +2-10 k: kkkkkkkkkk +1-4 g: wjhxhq +3-4 w: znpwwmwcwjgs +5-9 d: ddddrdddwl +6-8 j: kjjhvzrbrwcjjm +2-5 j: jhjjxjjsj +2-6 t: ccwdcm +4-12 q: qlqrsgqqhqqf +13-16 w: mwwwwwhwwwwwwwwwww +9-10 g: ggggggggggmtgwj +1-3 x: xxxx +1-3 n: jxtqjbhpkgrcrdrptvd +14-15 w: wwhwwwwwwwwwwww +7-10 d: wddddzvdddkdm +1-4 p: lzph +6-9 w: wwwzwswwr +17-18 t: kjtktrtfgkhpzthvsjt +12-13 j: jjjjjjjjjjjxs +8-9 r: srrzrmrxnhrrr +1-5 s: spzsshkzfmkdss +1-7 z: zzsmzzhzzxzzzzz +1-2 d: ddvx +2-9 h: hhhhhhhhhhh +6-8 p: ppppppppx +4-8 v: bqvvxmvtvhfvv +3-4 z: zzzz +2-4 r: rrrrrrr +4-5 r: mhrrrrrrq +5-6 b: nkhgfjrzqldbbbbmpx +7-8 n: nnnsnwnncdnn +13-15 p: pppntwcpppppppv +5-11 r: tmkrdcmrpcrrkrl +3-4 v: vvgf +4-5 j: jjvtcj +3-5 p: ppppp +1-3 r: mrrr +13-14 v: vvvvvsvvnvvvhxvvv +10-14 z: ltwsklmfdpvxmxgq +16-17 b: bbbbbbbbbbbbbbbqqbbb +3-8 q: qbpqpvqll +9-10 x: xxxxqtxxzxxxx +8-12 d: pdddnddcbcdx +2-3 m: fmmmsfmvcmkc +9-10 x: slxtnxxtjnnxjnq +5-13 h: hhshhhhvhffhhn +6-14 t: wwwmqttttkpmqtrt +1-5 b: mbbbb +10-12 k: kfkkpkrkkkkkkkh +5-6 m: mnlmbvmm +5-6 x: xxxxvl +5-7 b: dbbbpbc +2-19 t: qhdtkxjzdcwjqjkglpzr +1-4 h: hhgqhnhhhhfhhh +1-10 b: bqbbbbzbbbbbbwb +2-3 b: dbbkgnxmbtpg +3-8 r: rrrjrgrrwq +4-7 s: ssrfwfgvskmssws +13-14 m: smdmmmmmgmfmmjs +13-15 h: hhhshhwhjhhhhhhhh +12-13 n: nnnnnnnnnnnnnn +6-14 n: ndnnpqwrlgfrmn +3-16 m: rldkmmmkhmsmbnqbmgs +2-3 m: rmmmmm +5-9 x: xxxxfxxstxxs +4-8 b: bgbbbbgbbbb +9-11 c: kwcclccccscxp +10-17 v: vvvvvvvvvvvvvvvvvv +13-18 n: nrnnnnnnnnnnfnnnnpn +3-4 c: hbcc +13-14 w: wwgwwwwwwwwwwc +4-6 z: fwmzzzz +12-15 h: vhhfhhhhhwhrhhlkmhhh +1-5 v: jqvvhvvbt +4-5 n: vnnscn +5-6 n: qnrvnnndnffnkknfrdt +6-7 w: wwwwwvznwwwwww +6-12 h: hvhhhdhhhhhr +4-5 m: vtmmmmdmp +8-9 f: ffffffffffffffffdf +5-11 z: zzzzjzhzgjwzzhlz +8-10 d: mdnnfwswns +4-15 c: rptccckzhgcvlccbh +4-5 r: brrrgtd +4-15 x: rxsfxqhhzxdsxqxgw +8-9 c: ccccclcccccccc +2-9 l: mwltgglzztlpllgf +12-13 g: nnjgzggjkgzgd +4-6 j: jjfjjnj +11-14 m: mmfqpmkmmmmmmmrm +6-7 c: cccccqccmccccc +6-9 f: ffzgcfcpfwztjk +6-9 r: sjgrxnrvnqmmlxdrsp +3-11 c: cchwcfcckcn +7-10 p: jpzdflzgkxnbhj +5-6 b: bblblp +7-8 p: ppppppllppp +10-13 b: bbbbbvbbggbbb +5-6 p: pppptp +2-6 t: qttttjtt +3-6 n: vwlhczrnwpnvrnl +8-9 r: jrrdrrrjwrrrrrs +3-4 n: nnwqn +4-8 b: mbscbwxn +10-12 v: tqbvxmlqvvvv +1-9 l: qcllllncllcllllrn +6-10 b: gbbxfblbbx +11-13 g: gggqgggtgggtgrgsg +2-3 f: fjkz +5-11 t: tttttttttttt +5-18 j: zjdxgjjpshjjkjbtjvg +9-11 k: kjkfkwkkrkgk +1-8 w: hwhcwwbffvcdwzwbww +7-16 l: rrljlvlmmlssllkllqj +1-4 d: hddldvddddf +7-9 b: bgbbbrmblb +2-5 v: ltvvvv +5-6 r: rgrrdvrrrrrrr +8-9 n: wnnnnnnnn +1-8 q: sfmbjqqwvqqq +2-11 b: wblbmlrcwffl +4-5 n: cfmnn +15-16 g: gggggggggggggggq +6-10 x: xxxxxxxxltxxx +5-9 g: gggbgxgggpgn +8-10 z: zzztjzzzqzp +4-5 x: xxxfl +6-10 v: vvvhvvvvvv +6-8 v: tdrvsnvpvzxbwvv +8-11 q: qqqqqqqqqqjqqq +12-13 z: zjzzzvzjkzzzz +1-8 b: bsqqmbnbcwhkphfh +1-5 z: zdjzzrm +3-4 m: vlmmtbmmxcdkmdmfb +7-14 k: kkwpcjfkkkrknzkk +1-3 f: cfbljmpfghhgxdbg +6-7 n: mrnhnxn +16-17 g: gggggggggggggggmr +7-8 q: qqqkqhqqwkpzshq +9-15 j: jjjjjjjjjjpjjjj +5-6 t: tttttl +4-15 h: hhhhhbsbphhhlzgh +4-6 h: qhhlhh +2-6 f: wfwdff +1-7 c: rczccfx +3-8 b: jkznbbbqlk +8-14 r: srtchmrjxmzznm +4-8 s: ssgskspsdsmclrmxzp +9-12 j: kjjjfcjjljjqjj +3-5 l: lllvllll +15-16 s: sssssssssssssszs +5-6 z: zzzzmfjz +13-14 v: vnvvgvvvvwvvfrvspv +7-8 t: ttttttkst +17-18 f: ffffffffffffffffhx +8-11 b: bbbkbswbbpbnbbbbx +7-14 s: ssjfssssssjsdp +6-8 s: sssssqsps +5-8 h: hhdhphhmhhhh +8-9 r: prrmrpsrrrvrzrrrsrn +4-17 t: ttttjttjttthtktttt +7-9 v: tvvwvpvrbnvvvv +8-12 j: plfsgrjjgjrjwcgc +2-7 r: krqzzprxrldwg +4-11 k: sfpkkkcwkwk +2-3 z: zzhp +6-9 h: xkjwshvmhbjhfjvkwcmh +4-8 d: dvndvmdzn +3-6 r: wrrrrr +6-8 g: kggdgfgzz +3-5 j: jjjjj +2-9 x: qkksvkxxvxbxx +12-17 b: kjpbpbmddcnwbbbxb +2-10 w: rwpbpbwrbmwgwwvghvg +1-12 f: fbfqmffffftf +1-8 z: qvbjgplznjztjvqjhv +1-5 b: bbbbbbbbb +7-11 p: kddppkdtqpjcfpp +14-20 z: zzzzzmzzzzzzzzzzzzzz +7-8 p: sjspdphq +11-12 w: wpwwwwwwwwwd +7-12 d: sdddddkdjddd +6-8 g: gggfzzhglgxqpgbnbgbx +10-13 c: hcccctjcccccccn +14-16 k: kkkkkvkkkkkkkkpxk +16-18 c: ccccccccclcccccccjc +2-4 r: llrh +11-13 g: ggggggggggggm +1-4 z: zfwzzz +4-6 s: ssssfs +5-12 t: tttttntttttt +2-6 n: gnghnp +1-3 q: qqgq +10-11 f: rdzfzffhtfffffff +4-9 k: kpfhvkkkk +3-10 t: twlkttptttt +4-10 d: dkdvgkdddwd +5-12 t: ttttnttghtthtvtt +4-5 c: ctczwcccc +17-18 l: llllllllllllllllmx +2-8 t: knmttnttdjbtttvtkt +1-2 j: jdjjjj +12-16 j: wmqlfjlnxnvlrjkmj +13-17 s: snsdsssssssssssss +8-14 h: hhhhhfhhhwhphhscphd +9-10 b: bbbgbbbbqcb +15-16 z: fjjcjrwjtrcnltzz +6-8 s: ssssxjshd +2-4 k: kkkw +3-6 s: xsfgbpss +13-15 x: xxpxxxxdxxxgjxgxxx +4-5 l: llqlllsl +10-15 g: jggxgsggggggjtgg +2-6 b: prpbjbkbbkcb +7-9 h: hhhhhkfhh +8-11 f: fzhftffvffwffnl +11-15 x: xxxcxxxxxngxxxcxx +11-12 k: skkkkkkkkkxhn +5-15 n: cnnnnqqbnnnncznnp +1-3 v: vqvxlfwpjvxtpkvlhxjv +3-8 b: gfbbbsfbb +3-4 z: qzzzbczk +8-17 t: cpttttttpttttttttt +11-17 l: lprllfllllnlllllnll +7-8 f: ffffffrd +2-6 z: hghjzzwpwz +6-13 m: thzmtmcsmtctf +2-4 c: dctc +10-17 s: sssssssspzssssssl +6-10 j: jjjjljljjjjjzj +5-7 b: bbxbvsxphgrmnqgzbbx +1-11 l: rlnlllllllvlllll +13-16 b: bbbbfbnbbbbbzgbwbb +5-11 p: bpjpnpqpppjpmppphrk +1-3 l: llll +11-15 l: llgllllcllllllllfll +2-7 x: kxsnzzx +18-19 g: gglgggvqkjzgkgggzgg +3-5 j: fqvjjcjjhb +6-7 c: fccccccct +13-16 m: mzmtcgmcmmmkdmlk +5-9 w: wwsjwwwww +1-2 m: jzmj +16-18 m: mmmmmmvmmmmmmmmqwn +11-12 w: wwwbrwcwwxwwmwwrdww +3-4 v: nsvddwnvvvm +5-8 m: mjmrbpmh +2-3 t: xdrtzgdl +2-6 n: fnwwgnnzwsp +7-9 p: jpppppvppsqt +1-8 k: gkkkkkkkk +2-9 q: jqqqwfzxhqqqqsxqm +2-4 t: jtwt +6-20 d: hqdkcmkdndjrftmgjgqc +2-9 r: crgmrqpwrrr +9-15 p: pwmjlrgnrppwphg +3-4 t: ttqttttnttttt +1-5 v: hvvvv +1-2 x: ggxxxxt +17-18 m: mmmmmmmmmmmmmmmmcl +4-10 d: dxtmsjvhczfjd +8-10 x: xpbxsxpxgxqxxqxxk +6-9 f: ffffmffdwkfrlffx +8-10 m: ldmmgxxmbmnqftt +12-13 p: ppxpxhppgppqqpvppp +4-12 k: kkkkkkkgklkkjkkqvkk +3-4 x: xxcp +7-8 k: kkkkkkkr +11-14 d: dddkpddvdddddg +3-8 l: lsgmlqll +12-13 z: znzzzzzzzzzzrz +3-5 h: hhdphh +3-4 h: hqhhh +4-6 f: wfsfrffzf +8-12 k: ktkdmhvkxktkhr +2-6 d: dpdwdddd +7-12 n: nnnnnnpnnnnxn +1-3 v: vvvv +3-11 q: gmqqqqmqshpq +3-4 j: jjjjkjhjf +2-4 b: glbxb +13-14 s: ssssssssssrssds +16-18 d: dddddddddddddddddd +3-9 g: fgggzttsg +11-12 r: grrrrrrqrrrrrrr +2-5 q: cdqqv +6-11 l: lfclllslllxllll +2-3 d: dzdddg +2-4 n: tkwm +4-5 r: kdccjnrfrzrhplrz +4-16 j: tfxsmxlrjptjjrxw +16-17 p: stpsgsgwvqrzpblpsx +8-12 r: rrdrgrrgrrhrwqjmp +5-8 j: jjqjjkjjjjnv +2-7 n: wzgnnnnnn +1-3 v: vvvv +4-5 l: hlgnx +8-15 c: ccccpccczvcsccc +3-15 f: ffnfffffffffffv +4-5 w: wwjgww +10-15 d: ddddbcrddmddddld +7-11 w: wwwwwwwwwwz +3-4 h: hhhh +4-9 v: vvpgvvnvtv +8-11 q: qqqqvqqqxqcqnmq +2-5 s: lsnpdqqqsj +8-9 g: ggsgggggz +6-10 s: sssssbsbbtss +12-16 z: zhzzzszzzzznnzbwz +9-10 p: ppnpdpgldl +10-11 r: rrrrrrrlrtfrr +1-13 h: xhhrhhhhhhhhchhhhcp +5-14 m: mmmmmmmmmmmmmqm +8-9 h: hhhhchhhhhkt +3-4 f: fflf +7-13 s: ssssssssscsssjs +2-3 t: twlcfmbmbxtt +4-6 v: vdvhvf +1-7 c: bccccccccccc +13-14 r: wrrvrvrtrrrrrrrrrrr +1-3 b: sjvfpdrbcnwr +1-7 z: xzzzzwjz +6-14 j: jfrxjjjrqcqjwmbfjjjm +11-14 f: ffffffffffqffzqf +6-8 z: zzzzzrzw +1-5 j: jjjnjjjjj +9-10 g: ggggggxggg +7-9 r: rrrvrrbrdr +9-18 j: jjjjjjjjnjjjjjjjjfjj +14-18 q: kjtxqqqqltlpgqshdx +8-12 k: kkkkkkwjkkkfkkk +2-4 s: ssvs +3-5 z: zzfjk +9-10 m: rmmlmsmfmbj +14-15 z: nlzzzzzzzzzdzzzzzz +8-12 r: zrrrrprrxrrrrkrhk +1-2 z: qlfzd +1-6 j: kqjpjzpsgjjqz +1-5 s: qfssks +2-5 r: nrrzrr +4-6 g: kggggg +6-7 c: cccccdqcc +2-6 x: vjkxbrfwnj +16-18 s: kssssssswssssssssssb diff --git a/2020/Day 3/Solution.py b/2020/Day 3/Solution.py new file mode 100644 index 0000000..b524718 --- /dev/null +++ b/2020/Day 3/Solution.py @@ -0,0 +1,36 @@ +input_file = "/tmp/aocinput" + +map_table = [] + +with open(input_file) as slope_map: + line = slope_map.readline() + while line and line != "\n": + map_table.append(line) + line = slope_map.readline() + +def check_for_trees(direction=(3,1)): + x_pos = 0 + y_pos = 0 + + width = len(map_table[0]) + height = len(map_table) + + tree_count = 0 + + while y_pos < height-1: + x_pos,y_pos = ((x_pos+direction[0])%(width-1),y_pos+direction[1]) + if map_table[y_pos][x_pos] == "#": + tree_count += 1 + + print(f"We came close to {tree_count} trees by going {direction}.") + + return tree_count + +def check_multiple_directions(directions): + result = 1 + for direction in directions: + result *= check_for_trees(direction) + + print(f"Result is {result}.") + +check_multiple_directions([(1,1),(3,1),(5,1),(7,1),(1,2)]) \ No newline at end of file diff --git a/2020/Day 3/input.txt b/2020/Day 3/input.txt new file mode 100644 index 0000000..a3ac506 --- /dev/null +++ b/2020/Day 3/input.txt @@ -0,0 +1,323 @@ +.#......#..####.....#..#....... +#.#...#...#..#.#...#.#...##.##. +#.#....#..........#...##.....## +#.#.#.....##......#.#.......### +..#..###....#.#....#.#.#..#.... +.......#.#....##..##...#...#... +..#..#..#..###.......#.....#.#. +.#.......#...##...##.##......## +#.#.##..##.#..#....#..###..#.#. +#.....#.#.........#.....##.#.#. +..#.#....##..#...#...##........ +......#....#..##.#.#......###.. +.......#.......#......##...#... +.##.....#.......#...###.....##. +.#...#.##..##.#..##....#....... +..#......##...#..#...#.#.##.### +.##.##.....##....#..#......#.#. +.#.....#..###..#.##.#.....##.#. +......##..........#..........#. +.##....#.....#..##.#..#.#..###. +..##.......#....#...##...#..#.. +.##...#.....#.###.#.#..#...#.#. +.....##.#.##..##...#........... +..#..###.##.#.#.###...###..#.#. +.#........#..#.#........#.#...# +....##.......#....#.#.##.#..... +....##........######..###..#.#. +#.#.#............#.......#..#.. +...##...#.##.....#.#..#......#. +......#.##.#....##..#.#..###... +##.....#.#....#....#.##.#.###.. +#..#..#..##.#..##.##.##.#.##... +.###.####..#..#........#.....## +.......##..#.......#........... +.##...#............#.#.##...#.. +....##.....#...##..#..#.#..###. +...#.....#####.#..#...##....##. +#.....#.#.#....##.......##.#.#. +......#.#..#.##.#######......#. +#.##...##....#..###.#.......#.. +.....##...#....#...#....##.##.# +....###......#...###..#......## +..#...##..##.######..#.#......# +......##....#....##..#......##. +.#...#..##..#.###.#......#....# +##....##..#..####.#.....#...#.. +.#.......#...#.......##......#. +......#...#...#........#....... +.#........#.###...#..####.#..#. +##...#.#............#.....###.. +.....###.#.##...........###..#. +.#.#...#.....#.#.##..##...####. +..##.......#..#.##.#....#.....# +.#..#.#..####.....###.#.....#.. +..#..###.....####..#.##.#.#.##. +.###..#.....#......#...####.... +...#.#..#.#..#...#...#....##.## +..###....#.##.....#..........#. +###...#####......##............ +..###.....#........##.#...#..#. +..##.##.#.....##........##..#.# +##..#.#...#.#..#..###.#....#..# +....#..#.#.....#..#####...#.... +....#.........#......##.##..... +.#...####.##......##..##.#..#.# +...#...#.##..#...##..###...#... +###...#.....#.##.###.###..#.#.. +..#......#.###.....#..##.#...#. +#.....##.########...#####....#. +........##..#..##..##.#........ +....#.######....##..#..#.##..#. +#.......#..##..#..#.#.#..##.##. +...#.#..#..#.......#......###.# +.#.#..#.#..#.##.#.............# +#....#.##.#.#.....#..#.#..#.... +...###..#...#....#.........#.#. +.#..#.....##..#.#..#.#.......#. +..#...##...#......#......####.. +....#..#.......#.......#.#..#.. +#...#..#...........#.#..#.....# +#...#.#.......#...#....###....# +.#..#.#.##....#......#........# +..#...#..##..#..#..#..#...#.#.. +..#.#.........#....#....##..... +##.....##.#.#.#.........##..... +.##...#.##...........#...#...## +.##..##.#.#..........##..##.... +#....#....#.#...#.#..#....#.#.. +####....##.....#..##.###....... +#..#....#......##.#.#....#..... +.....#....#.###.##.........###. +#.......#.####..#..#..##....... +##.#.......#..##..#....#..#.#.. +..###...#.#...#.....##.##.####. +....#...#.#....#..#..#.....#.## +#.....##.#.#..#.##..#..##...... +................###..#....##... +..#.##.....#..........##.#...#. +..#.#..#.#....#.#.#..#..#..#.#. +#...#..##.#.#...#..#...#..#.... +#..#.#.........#..###........#. +.#...#.............#..###..#..# +#.........#.#..#...#.#.....#..# +....#..#..#.#.#...#...#.....##. +##...###.#.####..#......#...#.. +..#..##...#.#......#.#.......#. +#......###....##.#.##.......... +#####....###..#...............# +##.#...####....#....#...#....#. +.#.......#..#.....#...#.....### +...#..#.#.#....##......##...#.. +...#.....#...#.##.#..#.#....#.. +#...###....#...#.#....#........ +.#.......#........#...##.##.##. +.....#....#...##.....##...###.# +....#....#.#..#...##.##.##..... +.......#............#...#.#..#. +.#............#.....##.......#. +........#....#....##......##.## +.......##..#.#..#.##..###..##.# +#..##..##.........####.#.###... +#....#..#...##...#............. +#...#...###..........##..#..#.. +....#...#..#.....##...#........ +#.....#......#.#.....#...#..#.. +..#.....#.....#....#..#........ +..#..#.....#.#.........#..###.. +................###..#.#....#.. +#.....#.....#.#.#.#.#..#...#.#. +#....#....#.#..........#.#....# +....#..#......#..##.#...##..... +..#.#...#.####....#.#..#.#..#.. +.........##......#.....##...... +##.#.###.#.....#.....####.#..#. +.....#.....#..#....#..###.#.... +##..#.#...#.##....#....#....... +.....#......#.#...##..#.#...... +....##..#...#...##..##.#....#.# +............#..........##.#.... +##..#..#.##..##..#.#....#.#.#.. +.......#.#...#...#.#...#..#.... +#....#.#...#...#........#..#... +...........#.......#...##..###. +.#..##......#.##.........##..#. +...#...#...###.#.##....##.#..#. +#...#..#.#.#.....##..#.......#. +.##..#.###.##......#.#....#.#.# +..#....#.......#..#..#.#.#.##.. +#...#...###...###.........#.... +.#.#...#.....##.#.#..#....#.##. +.........#.#.##.....#.#.###.... +...#.#...#......#...####......# +...##..##....##......##...###.. +###...#..#.......##.....#....#. +...#..#..#..###...##.##..#..#.. +...#......#......##..#.#.##..#. +...#.........#....#.#....#.#... +##................#..#.#.....#. +....#.##...#..#.##...##.#.....# +......#..##.##..###.#..#.##.##. +.#.#...###.....###.....##...### +.##.....#.#.#..#..###..#..#..#. +#.......#..#..#....##.....#.... +...#.#.##..#..#......##.##...#. +....##.#......#...#..#..#...... +.####.#..#.....#..##.#...##..## +..#..#...#..........###..#....# +.#.#.##.##...#............#.... +........##..##......#.##..#.### +...#.#....###......##.......#.. +..##...#...#.#..#.....#.....#.. +##..#...###..#..#.#.#...#...#.. +.....#..#....##.....##.....###. +....##...###.#..#.#....##..#..# +#......#...#....#......#...##.. +....#.##...#.#......#.#.##...#. +.......#.....#...#####...#.#... +...#.....##.#............#..... +...#.#........#.#.#..#......... +....###......#.#.#..#.####.#..# +#.....#.#.#.....#.#.#.....#..#. +..##.##......#...#.#........... +###..###....#.#####......###... +..##..............##.#.#....#.# +#..#...#..........#..#.#.#..### +##.###............#....#.#...#. +#.#..#.#..##.#.#....#...#...... +#....#...#..##.....#..#.#..###. +..#.....#.#....#.#..#.##.#..##. +...##...#.#.##...#....###....#. +......###.####.......#..#.#.#.# +.#..............##........#.... +...##.##...##....#..#.......#.. +.....#.....#....###...#..#..#.# +.#.....#..#.....#......#.....## +#.#.##.#..#..#.....#.##..###... +..#......#...##.###..#.#...#..# +......#.....#...##......#...... +##.#........#..........#.....#. +#........##.#............##.... +...#......##...#.#.....##...... +...##.......#....#.#..#.#.###.. +..#....##..##.##.....###....#.. +..#...#.#...#.....#..........#. +......#...#...#.#.##.#...#.#.#. +.#...#......#.##........#...... +.##.##..#....#...#.#...##...... +#..#......#.#...........#....#. +....##.#....#...#..#....#.#..## +#....##.##....#.#..##.#........ +.##.##.#....##.....#..#....#..# +...#...#.....###.#.##.......... +....#...#....##.......###...... +#.........#......#.#.......#... +#..........#..##..#.#.......... +.....#.......#..##.##....##...# +........................#.#.... +#..#.........#.............#..# +#..#.....#.......#....#....#.#. +..##..##.......##....#...#..... +.##......#..##......#.###...... +...#.#........#.......##..###.. +..##...###.###......#...#....## +#...#...#.....###.#.#.#..#..... +#....#.........#..##...#...##.. +#..###..#.#.#.##.#..#.#....#.## +#...#.#.....#.###.#.......#.... +..##..#..#....#.#...........#.# +#.........#.#......#...##...... +.######......#..#....#.#.#....# +##..#.#..####.###.........#.... +###########.....##.##...#..#... +#...##.#.#....#.#....#......#.. +...#..##..#..##..#......#....#. +.#....#...#....#.#..##....##... +#..#.#............#....#.#...#. +...#...#..#.#.##......#..#.#... +#.#...##.....#..#.##......####. +.#.#..##..#.....#.#..#.##...... +#.#.##......##.....#..#.#..#... +#..##...#.##.#.......#.##...... +..#.......#.#.#...##..##...#... +.#...#..#..#.#.........#..##... +#..#.......#....#.#...#.###...# +.......#..#.......##.#.#...#.#. +.#.................###.#..###.. +..........#.#.....##..#####...# +#......#.#..##.#.#...#.##.#.... +#......#.#..##.##.#...#....#... +....#..#......#....#....####### +.#...#......#....###......#.### +#.#....#.#...#.###......#..#..# +.###......#.#...#.####.#..####. +######.#.....###.#...#.#.....#. +.#.###....#..#.#.....#.....#### +.......###.#.........#..#...... +#...#.....##.#......####....... +..#.#..##.#.#...#...#..##..##.. +.....#...##.....#...##......##. +##..#..#.##..#.#......#.....#.. +##.........#.#.##.#..#.#....#.# +.#........###...#.........#.... +...#..#.#..#....####........... +#.#....#..##..####.#...#.##.... +.#.....#.......#..........#..## +...#.......#...###..#.....#..## +.........#.###.#..##...#.##...# +.#..........##..####...#..#.#.# +.#...##...#............##...#.# +...#....#.#..........#.#..#.#.. +.#.#...##....##.#.#.#....#..... +....#..#.....#.#..#.#..#.##.### +.....#.#.....#..#......#.#.#... +.....#.#.#..###..#.#..###...#.. +#.......####...#.#..#......##.# +....#..#..###......###.##....#. +##.....#.....#.............#..# +#..#..#...##.....##..#..#.#.... +.....#.#.###...#............... +#.#.#.....#.#..#.#...#.......#. +..##.##............#....#..##.. +#....##...#.....#.###...#.#.... +#...##.#.........#...#....#.... +##.##.#...#.#...###..#....##..# +....#....##..#..#.......#...##. +.#...#...#..#.....#..###.#..#.# +....#..###......#....##....#... +#.#.....#....##.#..#.#...###... +.......#............#......#... +.##..#.###.#.............###... +..##...##.#.#.#.....#........## +....#.###....#..#..#...#...#..# +.....#...#...#..#....#.....##.. +###.#.#.....#......####.....#.. +#.#.###............#......#.... +..#.....#..#..#..#....#......#. +#...######...#....#.##...##.#.# +##.#.#.#..##......##.#..#.#...# +............#.#..#.##....#..... +......#............#.#...#..#.# +.#..##...##..#.#.#..###.....##. +#.###.#...........#...#....#... +....##.....#...##...#...###.#.# +.####.#.#.....#.#..#.#.##...... +.#...##......###...#..##..#.#.. +.#......#...#....##.....##..#.. +..........##.....###.##.#...#.# +.#........##.#..............#.. +#...###..#...#.....#....#.....# +...#......#..#...#...#..###.#.. +.#...##..#........#.......#.#.. +.#.#.##.........##.##......#..# +#...#.#.#...#.....#.#...#.#..#. +#.#..#...#...#...##..........#. +.#...........#....#..#.#..#.#.. +#.......#......#..#...#........ +.....#..#...##..###..##........ +......#...#.....#..#.#.#....##. +....##..##..##....###.##....... +.#........##.#.#...#..#........ +.....##...##...#......#..#...#. +..#.....#....###.#..##....#..#. +......#..#...####.#.....##.#### diff --git a/2020/Day 4/Solution.py b/2020/Day 4/Solution.py new file mode 100644 index 0000000..ddd8b25 --- /dev/null +++ b/2020/Day 4/Solution.py @@ -0,0 +1,78 @@ +import re + +input_file = "/tmp/aocinput" + +height_re = re.compile(r'^([0-9]+)(in|cm)$') +passport_id_re = re.compile(r'^[0-9]{9}$') +color_re = re.compile(r'^#[0-9a-f]{6}$') + +def check_limits(to_test, min_valid, max_valid): + return False if (to_test < min_valid or to_test > max_valid) else True + +def validate_passport(record): + for field in record: + if field[0] == "byr": + if not check_limits(int(field[1]), 1920, 2002): + return False + elif field[0] == "iyr": + if not check_limits(int(field[1]), 2010, 2020): + return False + elif field[0] == "eyr": + if not check_limits(int(field[1]), 2020, 2030): + return False + elif field[0] == "hgt": + regex_match = height_re.match(field[1]) + if not regex_match: + return False + if regex_match.groups()[1] == "cm" and not check_limits(int(regex_match.groups()[0]), 150,193): + return False + elif regex_match.groups()[1] == "in" and not check_limits(int(regex_match.groups()[0]),59,76): + return False + elif field[0] == "hcl": + regex_match = color_re.match(field[1]) + if not regex_match: + return False + elif field[0] == "ecl": + if field[1] not in ["amb","blu","brn","gry","grn","hzl","oth"]: + return False + elif field[0] == "pid": + regex_match = passport_id_re.match(field[1]) + if not regex_match: + return False + + return True + + +records = [[]] + +valid_passports = 0 + +with open(input_file) as passports: + line = passports.readline() + current_index = 0 + while line: + if line == "\n": + records.append([]) + current_index += 1 + line = passports.readline() + continue + + for raw_entry in line.rstrip().split(" "): + records[current_index].append(tuple(raw_entry.split(":"))) + + line = passports.readline() + +for record in records: + if len(record) == 8: + if validate_passport(record): + valid_passports += 1 + if len(record) == 7: + is_north_pole_credential = True + for field in record: + if field[0] == "cid": + is_north_pole_credential = False + break + if is_north_pole_credential and validate_passport(record): + valid_passports += 1 + +print(f"There are {valid_passports} valid passports out of {len(records)}") \ No newline at end of file diff --git a/2020/Day 4/input.txt b/2020/Day 4/input.txt new file mode 100644 index 0000000..242437a --- /dev/null +++ b/2020/Day 4/input.txt @@ -0,0 +1,1029 @@ +iyr:2015 +hgt:59cm byr:2029 cid:219 pid:9381688753 eyr:1992 hcl:#b6652a +ecl:#7a0fa6 + +ecl:blu iyr:2018 pid:943614755 cid:335 +byr:1968 +eyr:2026 + +pid:067285985 hcl:#ceb3a1 cid:281 +ecl:#07219a eyr:1944 +iyr:2025 +byr:2029 hgt:64cm + +hgt:185cm +ecl:gry cid:222 +iyr:2016 +hcl:#866857 byr:1970 pid:269105457 eyr:2026 + +pid:260043570 hcl:#b6652a cid:275 byr:1990 ecl:brn +hgt:163cm iyr:2012 + +hgt:181cm pid:604983466 +iyr:1930 eyr:2039 byr:1950 ecl:#906548 hcl:#b6652a + +iyr:2025 eyr:1956 hcl:z pid:#1c42cc byr:2006 +cid:327 hgt:141 ecl:#f2affc + +hgt:178cm byr:1939 pid:595705064 ecl:oth +iyr:2020 eyr:2026 +hcl:#888785 + +hgt:159cm iyr:2016 +hcl:#efcc98 pid:139063139 byr:1980 ecl:brn +eyr:2020 + +pid:646870519 hgt:179cm eyr:2022 iyr:2011 hcl:#602927 +ecl:brn +byr:1997 + +hgt:170cm hcl:#ceb3a1 iyr:2014 eyr:2023 ecl:oth pid:243067344 byr:1962 + +hcl:#866857 +ecl:oth pid:704529614 +byr:1941 cid:94 +eyr:2026 hgt:180cm +iyr:2010 + +iyr:1924 +pid:36196401 +hgt:74cm eyr:1921 +ecl:#3acf57 hcl:a4e4c0 byr:2024 +cid:153 + +pid:770262094 hcl:#866857 +eyr:2020 hgt:151cm +ecl:blu +iyr:2012 +byr:2002 +cid:242 + +pid:984364862 ecl:dne +iyr:2020 +hgt:151 eyr:2023 cid:314 hcl:z byr:2012 + +hgt:178cm iyr:2020 hcl:#6b5442 ecl:grn cid:323 eyr:2030 byr:1925 pid:285882039 + +iyr:2019 pid:986123633 +eyr:2024 byr:1990 hcl:#7d3b0c ecl:hzl hgt:192cm + +hgt:90 +byr:2025 iyr:1933 +ecl:dne eyr:2040 pid:8194347544 + +hgt:163cm byr:1934 eyr:2026 ecl:amb hcl:#eec6fb cid:303 pid:721792159 iyr:2013 + +iyr:2019 +byr:1920 hcl:#a97842 +cid:186 eyr:2020 +ecl:oth +hgt:167cm pid:217112082 + +pid:#55ce6b hcl:d30f6b eyr:2040 hgt:60cm ecl:dne iyr:1920 +cid:107 byr:2029 + +ecl:amb eyr:2024 pid:644304174 hcl:#6b5442 iyr:2018 +byr:1935 +hgt:182cm + +ecl:hzl pid:559383552 +hcl:#ceb3a1 eyr:2024 hgt:161cm byr:1968 iyr:2010 + +iyr:2018 +hcl:43fafb +hgt:65cm eyr:2027 +byr:1937 pid:#4bff3e ecl:grt + +eyr:2024 +iyr:2014 cid:163 byr:1924 hcl:#18171d +hgt:166cm + +eyr:2026 pid:955203781 +iyr:2016 cid:52 hgt:167cm +ecl:grn byr:1963 + +pid:479898570 hgt:165cm eyr:2024 byr:1932 +iyr:2010 ecl:grn +cid:88 +hcl:#c0a76e + +cid:241 hgt:178cm ecl:blu pid:069760797 hcl:#623a2f byr:1925 eyr:2029 iyr:2019 + +hgt:172cm eyr:2036 +iyr:2016 pid:#98caec +ecl:dne hcl:z + +ecl:#510672 iyr:1938 byr:2018 hgt:172in hcl:z cid:339 eyr:2039 +pid:#6c1216 + +hcl:#efcc98 +byr:1972 ecl:brn iyr:2011 pid:190911803 eyr:2025 hgt:171cm + +pid:0636917222 byr:2009 hgt:96 +hcl:z +iyr:1997 ecl:hzl eyr:2026 + +byr:1989 iyr:2011 pid:071588682 cid:155 ecl:grn +hcl:#ceb3a1 eyr:1955 hgt:170cm + +cid:266 hcl:#a97842 byr:1964 hgt:175cm +iyr:2017 ecl:brn + +pid:930133867 ecl:grn hcl:#733820 hgt:63in byr:1995 +eyr:2021 iyr:2014 + +eyr:2025 pid:284329794 +ecl:blu hcl:#ceb3a1 iyr:2012 +hgt:65in byr:1961 + +iyr:2010 byr:1998 +hgt:160cm +eyr:2029 hcl:#cfa07d +pid:253052921 +ecl:amb cid:324 + +pid:026835791 byr:1999 eyr:2022 hgt:162cm +hcl:#7d3b0c ecl:brn iyr:2014 + +pid:672752198 eyr:2030 byr:1952 hgt:65in iyr:2016 ecl:amb +hcl:#cfa07d + +hgt:193in +byr:2019 hcl:z pid:#cbc08c iyr:1951 ecl:#3e9f2f eyr:2002 + +ecl:utc pid:571477176 +byr:2012 eyr:1929 cid:240 +hgt:175in hcl:f4ef32 + +cid:93 hcl:#a5db2a +pid:274721479 byr:1940 eyr:2022 ecl:gry +hgt:157cm iyr:2012 + +pid:540858450 iyr:2014 cid:95 byr:1964 +hgt:156cm hcl:#866857 ecl:brn eyr:2026 + +pid:532626994 byr:1939 iyr:2017 +ecl:blu eyr:2026 +hcl:#fffffd hgt:184cm + +hgt:70 pid:404622083 +iyr:2026 +byr:2022 hcl:c1ba7f eyr:1979 ecl:lzr + +pid:931910908 +cid:177 hcl:#6b5442 +ecl:gry hgt:184cm +byr:1963 eyr:2020 +iyr:2014 + +iyr:2019 eyr:2022 hcl:#ceb3a1 hgt:191cm ecl:gry pid:954124659 cid:123 byr:1939 + +pid:411032659 byr:1950 +hgt:153cm eyr:2020 iyr:2014 ecl:hzl + +hgt:156cm eyr:2023 pid:29836124 byr:2017 hcl:56de83 ecl:zzz cid:179 +iyr:2018 + +hcl:#866857 iyr:2014 hgt:190cm byr:1998 pid:565524574 eyr:2020 + +byr:1973 hcl:#888785 iyr:2016 eyr:2028 hgt:173cm ecl:blu + +byr:1987 +pid:028825120 hcl:#7d3b0c +eyr:2023 hgt:190cm ecl:oth iyr:2014 + +eyr:2036 pid:172661617 +ecl:#ae607d byr:2017 hcl:z +hgt:82 cid:153 + +pid:202888577 eyr:2028 iyr:2013 +byr:1933 +hgt:68in cid:151 hcl:#b6652a ecl:brn + +iyr:2020 +ecl:amb eyr:2025 hcl:#a355be hgt:63in pid:146650894 + +iyr:2016 hgt:192cm pid:531372965 hcl:#fffffd +ecl:blu eyr:2025 + +eyr:2025 ecl:blu byr:1961 cid:224 iyr:2016 hcl:#6b5442 pid:368694418 +hgt:169cm + +pid:43707504 iyr:1945 +ecl:grt byr:2010 +eyr:2026 cid:273 +hgt:165in hcl:z + +hgt:159cm ecl:gry +hcl:#6b5442 +eyr:2030 pid:915819272 iyr:2015 + +pid:808392314 ecl:gry cid:285 hcl:#efcc98 byr:1923 hgt:161cm iyr:1941 eyr:2020 + +iyr:2017 +hgt:161cm +eyr:2025 hcl:#602927 ecl:oth pid:081917611 byr:1983 + +eyr:2028 pid:831032131 ecl:brn iyr:2013 hcl:#341e13 cid:198 byr:1991 hgt:67in + +hgt:181cm cid:320 pid:032769757 ecl:grn hcl:#733820 +eyr:2022 byr:1992 + +iyr:2010 cid:128 hgt:171cm byr:1932 pid:923377839 ecl:brn +hcl:#18171d eyr:2020 + +ecl:hzl iyr:2021 byr:2008 pid:569583509 hcl:f74823 +hgt:188in + +iyr:2016 hcl:z eyr:2021 ecl:#24ceee pid:349492243 hgt:67cm +cid:144 byr:2010 + +ecl:gry +byr:2029 hcl:3a0c30 hgt:163in eyr:1962 + +byr:1927 hgt:180 +cid:87 +ecl:#7ea777 +hcl:#623a2f iyr:2024 pid:597098940 eyr:2027 + +cid:89 hgt:193cm hcl:#623a2f +iyr:2010 eyr:2026 +pid:374988952 ecl:hzl byr:1973 + +eyr:2023 iyr:2013 byr:1977 +cid:329 pid:711256829 ecl:grn hgt:154cm +hcl:#866857 + +pid:212535692 ecl:brn +hcl:#b6652a hgt:169cm eyr:2025 byr:1920 iyr:2019 + +ecl:blu +byr:1962 +hgt:157cm iyr:2020 eyr:2027 pid:451039029 +hcl:#6b5442 + +hgt:187cm pid:187808959 eyr:2026 iyr:2020 +ecl:oth +byr:1956 hcl:#733820 + +byr:1959 hgt:160cm ecl:blu hcl:#6b5442 +cid:193 eyr:2026 +iyr:2014 +pid:812555315 + +hgt:153cm iyr:2011 +ecl:grn hcl:#ceb3a1 +eyr:2026 byr:1966 pid:503356330 + +ecl:#95d8a9 +eyr:2024 pid:382174744 +iyr:2025 +hgt:152 hcl:#888785 byr:2012 + +eyr:2028 +iyr:2017 byr:1938 +cid:279 hcl:#733820 ecl:amb pid:497365268 hgt:191cm + +cid:335 byr:1982 hgt:171cm iyr:2013 +ecl:hzl eyr:2030 +hcl:#efcc98 pid:018900639 + +eyr:2029 hgt:175cm pid:530128340 +hcl:#888785 +ecl:gry +byr:1947 iyr:2019 + +hgt:183cm +hcl:#6b5442 eyr:2023 ecl:grn +byr:1934 + +hcl:f8ed45 cid:54 iyr:1997 +hgt:69cm eyr:2037 ecl:gry +pid:184cm byr:2012 + +ecl:grn hcl:#733820 byr:1928 pid:002528194 +iyr:2014 eyr:2021 hgt:157cm + +hgt:163in +hcl:#c0946f byr:2018 eyr:2021 +iyr:1955 ecl:#216920 pid:87155266 +cid:298 + +eyr:2026 byr:1945 cid:161 iyr:2017 hgt:170cm hcl:#fffffd ecl:hzl pid:649441221 + +byr:1930 +iyr:2014 pid:151910079 hcl:#18171d ecl:oth eyr:2029 +hgt:169cm + +ecl:blu byr:1950 iyr:2010 cid:260 hcl:#cfa07d +hgt:167cm +pid:910685738 eyr:2021 + +hgt:182cm byr:1993 +eyr:2030 pid:073035999 hcl:#341e13 +cid:117 + +byr:1981 +hcl:#866857 +eyr:2028 iyr:2012 ecl:blu pid:620133246 hgt:157cm + +hgt:191cm +iyr:2010 pid:089995590 eyr:2023 ecl:amb byr:1986 hcl:#733820 + +iyr:2019 ecl:gry +hgt:165cm pid:910093364 hcl:#efcc98 byr:1997 +eyr:2028 +cid:153 + +hgt:83 hcl:174774 eyr:2032 +ecl:xry iyr:2017 byr:1940 + +byr:1943 +pid:980352645 +iyr:2015 hgt:66 eyr:2023 hcl:#b6652a ecl:oth + +ecl:amb byr:1980 hgt:164cm pid:775303596 hcl:#671bed iyr:2013 eyr:2030 + +hgt:173cm byr:1947 eyr:1947 iyr:1940 ecl:gmt hcl:7e515c + +hcl:#b6652a +iyr:2012 +eyr:2030 hgt:185cm ecl:grn + +ecl:amb byr:1940 hcl:#2943a5 iyr:2015 +hgt:185cm pid:931660417 +eyr:2021 + +eyr:1957 hcl:#623a2f +ecl:grt hgt:62cm pid:#af106a iyr:2012 +cid:59 byr:1985 + +ecl:amb eyr:2025 +pid:351412754 iyr:2014 byr:1941 hcl:#6b5442 hgt:174cm + +pid:5621200134 hcl:6ef9ba ecl:#ef68f5 eyr:1924 +hgt:63cm cid:188 byr:2004 + +hcl:#a97842 byr:1976 eyr:2020 hgt:171cm pid:041926354 iyr:2019 + +cid:234 +byr:2025 hcl:98619a pid:181cm eyr:1941 +iyr:2021 +hgt:167in ecl:#f5e651 + +hgt:73cm eyr:2028 byr:1985 iyr:1949 hcl:z ecl:utc cid:207 pid:#ee9f95 + +pid:179cm eyr:2030 hcl:b8e142 +hgt:69cm +iyr:1933 +byr:1934 +ecl:grn + +iyr:2028 eyr:1954 hgt:111 cid:180 pid:183391861 +byr:2030 hcl:1fb30f ecl:#0d0160 + +ecl:#0b3b2d hgt:191cm byr:2023 pid:727024676 eyr:2025 hcl:#b6652a + +hgt:66in +byr:1923 eyr:2023 ecl:gry +pid:454789451 iyr:2013 hcl:#cfa07d + +eyr:2020 +pid:339972685 +ecl:amb +iyr:2017 byr:1926 hgt:154cm +hcl:#18171d + +ecl:oth cid:302 +byr:1946 +hcl:#ceb3a1 +pid:622779476 eyr:2024 iyr:2012 hgt:158cm + +byr:2012 +pid:748786877 hgt:135 iyr:2016 hcl:b6e962 ecl:gry eyr:2011 + +byr:1997 +hcl:#a97842 +eyr:2022 pid:325672898 ecl:amb hgt:190cm iyr:2010 + +cid:210 hcl:#c0946f byr:1957 eyr:2022 +iyr:2020 pid:374646087 ecl:blu hgt:184cm + +eyr:2029 ecl:#353e0f +pid:#66ec82 +byr:2023 hcl:10d9d8 cid:271 + +pid:816485054 +eyr:2019 ecl:grn +hcl:#efcc98 hgt:185cm iyr:2013 +byr:2014 + +hcl:#866857 iyr:2014 byr:1953 eyr:2022 ecl:blu hgt:166cm + +pid:162cm hgt:59cm iyr:1981 +eyr:2025 byr:2009 +ecl:gmt hcl:116742 + +eyr:2028 hgt:67cm hcl:3d1f34 byr:1963 pid:62859332 +ecl:dne +iyr:2023 + +iyr:2013 +pid:271450754 eyr:2016 hcl:e20882 cid:186 hgt:157in ecl:utc byr:2023 + +pid:702200026 eyr:1968 ecl:gmt hcl:#888785 iyr:2018 hgt:193in byr:1943 + +eyr:2025 byr:1989 ecl:amb hcl:#866857 cid:119 +hgt:191cm +pid:556011434 + +hgt:178cm iyr:2013 +pid:928476807 +ecl:amb hcl:#623a2f byr:1996 eyr:2026 + +cid:222 +pid:325218825 eyr:2021 byr:1983 hgt:155cm ecl:brn iyr:2011 +hcl:#fffffd + +pid:949344785 ecl:grn eyr:2025 cid:182 byr:1974 hcl:#ceb3a1 +iyr:2011 + +cid:269 pid:669599426 hgt:176cm ecl:blu byr:1957 +iyr:2015 hcl:#623a2f eyr:2025 + +eyr:2023 hcl:#888785 +pid:178525132 iyr:2018 hgt:186cm + +ecl:hzl +byr:1940 iyr:2013 +hgt:185cm eyr:2028 +hcl:#7c73a3 + +hcl:z +byr:2001 cid:292 ecl:#d56bbd pid:93473192 +iyr:2003 hgt:150 +eyr:1922 + +eyr:2021 pid:786485899 +hgt:170cm hcl:#efcc98 byr:1955 +iyr:2010 ecl:brn + +hcl:#733820 ecl:hzl hgt:157cm byr:1944 eyr:2027 pid:906803629 iyr:2015 + +hgt:151cm ecl:blu iyr:2016 +hcl:#02ffd7 byr:1995 +pid:369315941 eyr:2026 + +cid:330 ecl:#18e883 eyr:2038 +hcl:z iyr:1929 +hgt:193 pid:33765426 + +pid:743094345 eyr:2027 +iyr:1949 byr:1955 +ecl:gry +hgt:160cm hcl:8dae67 + +cid:167 hcl:#18171d +iyr:2016 pid:214065645 byr:1942 eyr:2030 hgt:183cm ecl:hzl + +ecl:brn hcl:#623a2f cid:171 byr:1971 +iyr:2011 eyr:2028 +pid:607344613 +hgt:153cm + +byr:1921 pid:677007802 hcl:#341e13 ecl:brn iyr:2012 hgt:188cm eyr:2028 + +hgt:162cm cid:319 hcl:z iyr:2025 +byr:1989 eyr:1939 pid:67311222 +ecl:utc + +iyr:2014 eyr:2025 hgt:171cm +cid:302 byr:1997 +hcl:z +ecl:amb pid:101363367 + +ecl:oth iyr:2010 +cid:96 hgt:164cm hcl:4bc20a byr:1947 +pid:166115442 eyr:2030 + +byr:1964 +hcl:#6b5442 hgt:156cm eyr:2022 pid:426807062 ecl:brn cid:321 iyr:2012 + +byr:2012 hcl:#888785 cid:298 eyr:1920 ecl:zzz hgt:169cm pid:0660316558 iyr:2019 + +hcl:579266 byr:1931 pid:#aa5fd0 ecl:gry eyr:2017 hgt:60 iyr:1965 + +iyr:2011 +pid:610896691 hcl:#733820 +byr:1936 +ecl:gry eyr:2021 hgt:161cm + +pid:443246791 iyr:2015 hgt:158cm hcl:#18171d +byr:1928 ecl:brn cid:207 + +byr:1950 pid:644579904 hcl:#b6652a +eyr:2027 iyr:2017 +ecl:brn hgt:171cm + +iyr:2011 byr:1960 +eyr:2023 +hgt:171cm ecl:hzl +pid:331465564 cid:205 hcl:#18171d + +hgt:61cm eyr:1987 ecl:#9f458c byr:2023 pid:162cm hcl:z iyr:1997 + +hcl:59e376 pid:065607649 +iyr:2020 +byr:2010 ecl:blu + +pid:167cm byr:2022 hgt:150cm ecl:#06650a hcl:caa145 eyr:2032 +iyr:2015 + +byr:1932 +hcl:#419d73 +cid:203 iyr:2017 +pid:105921085 +ecl:gry + +pid:501585534 hcl:#418895 +iyr:2018 +hgt:157cm byr:1940 ecl:hzl eyr:2027 + +cid:220 hgt:171cm hcl:#623a2f +ecl:gry +iyr:2017 +pid:085309709 eyr:2024 byr:1932 + +hcl:#733820 eyr:2028 cid:93 +iyr:2017 +byr:1974 hgt:163cm ecl:grn pid:630322998 + +hcl:#602927 cid:97 hgt:166cm eyr:2025 +ecl:hzl iyr:2016 byr:1964 pid:355325363 + +iyr:2016 pid:402228657 hgt:174cm byr:1993 +eyr:2020 hcl:#733820 ecl:grn + +iyr:2020 hgt:171cm ecl:amb +hcl:#c0946f +byr:1939 +cid:316 pid:782384470 eyr:2030 + +byr:1983 pid:839608616 +eyr:2026 +hcl:#ceb3a1 cid:242 +hgt:192cm ecl:hzl + +pid:701022732 byr:1931 ecl:amb +hgt:70in hcl:#341e13 eyr:2030 iyr:2013 + +eyr:2027 +pid:740692321 byr:1940 +hgt:179cm ecl:blu cid:153 iyr:2010 + +iyr:2024 hcl:z ecl:zzz hgt:181in pid:#c38620 eyr:1976 cid:97 +byr:2029 + +byr:1999 ecl:lzr hcl:6f29a6 eyr:2023 +iyr:2018 cid:209 pid:401606571 hgt:163cm + +ecl:amb +byr:1996 hgt:181cm iyr:2018 hcl:#6b5442 pid:022285219 eyr:2021 + +cid:93 pid:807990476 +hgt:61in eyr:2027 hcl:#cfa07d ecl:oth iyr:2017 + +hcl:#7d3b0c pid:225151503 iyr:2013 cid:68 +eyr:2029 +ecl:brn hgt:64in byr:1959 + +eyr:2028 hgt:172in +iyr:2014 byr:1950 pid:187cm hcl:z ecl:brn + +byr:1982 +pid:978263388 eyr:2021 hgt:175cm iyr:2014 ecl:brn hcl:#a97842 + +hgt:162cm +eyr:2025 +pid:6533951177 byr:1993 iyr:2011 hcl:#c0946f ecl:hzl + +pid:182cm +iyr:2025 eyr:2035 hgt:59in +ecl:#799f29 hcl:z +byr:1920 cid:202 + +hcl:#733820 +eyr:2022 hgt:185cm byr:1989 pid:195276207 +ecl:blu iyr:2017 + +hcl:#7d3b0c +cid:257 ecl:gry +pid:123065639 byr:1951 iyr:2013 + +eyr:2039 ecl:#a82e90 byr:1927 pid:719738468 hgt:73cm + +hcl:605223 +hgt:162cm pid:50424035 +ecl:oth cid:343 byr:2025 iyr:2023 eyr:2024 + +hcl:699116 iyr:2001 +eyr:2022 +byr:2013 +hgt:171cm pid:8900968325 + +hcl:#efcc98 eyr:2029 ecl:grn pid:568953221 +byr:1986 +hgt:178cm +iyr:2020 + +pid:452235579 byr:1932 +ecl:grn +iyr:2010 hgt:189cm eyr:2028 +hcl:#602927 cid:258 + +ecl:xry iyr:2009 cid:334 pid:189cm +eyr:2032 byr:2005 hgt:172in hcl:z + +hgt:159cm hcl:z pid:166cm +ecl:oth eyr:2026 iyr:2020 + +eyr:2023 ecl:blu byr:1935 iyr:2015 +hcl:#866857 pid:542611829 +hgt:168cm + +pid:#ec3d53 +hcl:#ceb3a1 +byr:1999 eyr:2024 +hgt:188cm ecl:oth iyr:2018 + +byr:2003 hgt:167 +hcl:486800 +ecl:#29bdd6 eyr:2037 cid:169 iyr:2010 + +byr:1983 +eyr:2026 ecl:gry +pid:203934984 +hgt:181cm iyr:2020 hcl:#a97842 cid:184 + +hgt:180cm +iyr:1934 eyr:2038 hcl:#a97842 ecl:brn byr:1942 pid:427001597 + +hcl:#18171d byr:1988 +cid:267 hgt:188cm +ecl:amb +eyr:2028 pid:696617232 + +eyr:2024 hcl:#cfa07d +iyr:2013 pid:176cm hgt:189cm byr:1990 +ecl:gry + +eyr:2025 iyr:2015 hgt:153cm hcl:#ceb3a1 ecl:grn pid:686467422 byr:1961 cid:282 + +byr:1931 hgt:185cm ecl:oth +eyr:2022 +pid:561083684 hcl:#efcc98 +iyr:2012 + +byr:1948 cid:327 hgt:151cm +iyr:2016 hcl:#733820 ecl:oth pid:341978822 + +hcl:#ceb3a1 +byr:1978 iyr:2020 hgt:172cm +eyr:2022 ecl:oth pid:093317990 + +eyr:2029 +pid:096891409 iyr:2018 +hcl:#d82822 hgt:174cm ecl:hzl +byr:1988 + +hgt:170cm iyr:2018 pid:588142771 eyr:2022 hcl:#733820 +cid:273 byr:1940 ecl:#a608fe + +iyr:2029 eyr:1980 hcl:#341e13 byr:2027 ecl:grt +pid:443809337 hgt:180cm +cid:205 + +ecl:#f89df0 hgt:144 hcl:2f26ab iyr:1982 pid:#3b43c1 eyr:2032 byr:2012 + +ecl:hzl byr:1971 +pid:030850749 +hgt:170in +hcl:#ceb3a1 eyr:2023 iyr:2018 + +byr:1940 iyr:2020 +eyr:2026 pid:437820254 +hgt:179cm ecl:gry + +byr:2028 +eyr:1986 hcl:z +hgt:185in pid:773739744 ecl:dne iyr:2020 + +hcl:#a97842 +hgt:186cm cid:64 iyr:2016 +byr:1947 eyr:2021 + +byr:1988 hgt:160cm eyr:2023 hcl:#866857 pid:788805179 iyr:2022 ecl:amb + +hgt:164cm byr:1996 cid:338 hcl:#efcc98 +eyr:2029 pid:208596014 ecl:blu + +pid:357680064 byr:1960 eyr:2029 ecl:gry hgt:192cm hcl:#c0946f + +ecl:#d32320 +hgt:167in pid:19531341 +hcl:z +cid:346 iyr:2024 byr:2006 eyr:2035 + +pid:843729120 byr:1987 hgt:185cm eyr:2022 +ecl:amb +iyr:2012 hcl:#c0946f + +eyr:2020 byr:1961 iyr:2011 +hgt:162cm cid:54 pid:891397982 ecl:brn + +ecl:zzz byr:2019 iyr:2015 eyr:2028 hcl:43d56d +hgt:152cm +pid:182cm + +hcl:#18171d byr:1979 hgt:174cm +iyr:2013 cid:228 eyr:2022 ecl:amb pid:82422450 + +cid:156 iyr:2017 +byr:1924 +hcl:#b6652a ecl:gry hgt:184cm eyr:2027 pid:451347151 + +pid:850192502 hgt:65in +iyr:2011 hcl:#7d3b0c +eyr:2023 ecl:gry + +ecl:amb hgt:181cm iyr:2017 pid:233345009 byr:1934 +hcl:#341e13 +eyr:2024 cid:199 + +eyr:2026 pid:#4cb480 +iyr:1958 hgt:176cm ecl:dne hcl:z + +ecl:grn eyr:2027 hgt:178cm byr:1994 hcl:#341e13 +iyr:2016 pid:790075315 + +pid:140922484 +byr:1958 +eyr:2025 +iyr:2019 ecl:brn hgt:157cm hcl:#623a2f + +pid:466785488 hgt:160cm hcl:#cfa07d +byr:1947 +iyr:2010 +cid:198 eyr:2020 ecl:hzl + +ecl:oth +eyr:2022 byr:1963 +hcl:#fffffd iyr:2017 +hgt:171cm pid:463249115 + +hgt:73cm byr:1968 +pid:470317690 ecl:blu +iyr:2015 hcl:#c0946f cid:54 eyr:2029 + +hgt:162cm iyr:2014 +byr:1951 hcl:#b6652a eyr:2029 ecl:blu + +ecl:oth +hgt:176cm hcl:#888785 byr:1963 +iyr:2017 pid:453133253 eyr:2025 + +hcl:#efcc98 +eyr:2024 iyr:2020 cid:330 byr:1950 pid:937122408 ecl:gry hgt:162cm + +hgt:168cm +pid:745867335 +cid:165 hcl:#c0946f iyr:2018 ecl:grt eyr:2030 +byr:1932 + +byr:1949 pid:116003343 +hcl:#c0946f hgt:178cm eyr:2028 iyr:2020 cid:220 +ecl:hzl + +iyr:2013 +cid:314 pid:186cm hgt:74cm eyr:1973 ecl:hzl byr:2007 +hcl:180e0c + +pid:486330019 +byr:1999 ecl:oth hgt:154cm iyr:2019 eyr:2026 +hcl:#efcc98 + +eyr:2030 iyr:2018 hcl:#18171d byr:1950 +pid:648616604 hgt:160cm ecl:gry + +hgt:173cm +ecl:oth byr:1993 eyr:2029 hcl:#fffffd iyr:2010 pid:317451887 + +ecl:brn hgt:157cm +byr:1963 eyr:2023 pid:005387570 hcl:#866857 iyr:2012 + +pid:419695212 eyr:2020 byr:1957 cid:198 iyr:2015 hcl:#888785 hgt:168cm ecl:amb + +ecl:amb +iyr:2017 eyr:2024 pid:039995171 hcl:#a97842 +hgt:153cm byr:1983 + +byr:1979 eyr:2021 iyr:2011 hgt:157cm ecl:blu pid:110855542 hcl:#c0946f + +ecl:blu pid:948753945 eyr:2029 iyr:2012 hcl:#ceb3a1 +hgt:164cm byr:1988 + +iyr:2010 +eyr:2032 hcl:#fffffd pid:#175129 hgt:184cm +ecl:hzl byr:1985 + +hgt:189cm ecl:blu byr:1936 eyr:2027 hcl:#733820 +pid:728752361 iyr:2011 + +hcl:#733820 ecl:blu eyr:2023 hgt:172cm iyr:2017 +pid:013415387 byr:1947 + +byr:2012 iyr:2017 pid:#424ae4 +cid:172 hgt:166cm eyr:2022 +hcl:b1319b ecl:#6635d8 + +eyr:2030 +iyr:1928 hgt:185cm ecl:brn pid:#ac5a90 byr:1984 hcl:ac8f43 + +eyr:2027 +ecl:amb iyr:2014 hcl:#fffffd +pid:838758900 +hgt:177cm byr:1942 + +cid:166 iyr:2020 ecl:lzr hgt:70cm eyr:2040 byr:2004 hcl:#733820 + +eyr:2028 ecl:grn byr:2016 cid:61 iyr:2010 +hcl:#cfa07d +hgt:155in +pid:9594283803 + +ecl:gmt pid:984675198 +byr:1997 hgt:128 eyr:2037 hcl:#b6652a cid:299 + +iyr:2015 pid:733864914 eyr:2021 ecl:amb +byr:1971 cid:280 +hgt:181cm hcl:#054593 + +ecl:hzl hcl:#cfa07d eyr:2022 pid:832736421 +byr:1958 +iyr:2010 +cid:274 hgt:152cm + +eyr:2020 hcl:#6b5442 cid:223 hgt:155cm byr:1989 ecl:oth +iyr:2011 pid:549182194 + +iyr:2020 hcl:#cfa07d +eyr:2027 pid:093361240 byr:1941 cid:271 hgt:178cm ecl:brn + +ecl:blu cid:290 eyr:2027 +hgt:192cm byr:1945 hcl:#7d3b0c iyr:2020 pid:910713369 + +byr:1991 hcl:#ceb3a1 ecl:xry hgt:159cm pid:9496171384 +eyr:2030 iyr:2016 + +eyr:2020 pid:812617809 hcl:#7d3b0c +byr:1970 ecl:gmt +iyr:1971 hgt:157in + +pid:596027311 hcl:#866857 hgt:169cm byr:1945 eyr:2030 ecl:oth +iyr:2010 + +hgt:176cm +pid:213213359 byr:2012 hcl:be7b13 eyr:1971 ecl:gmt iyr:2011 +cid:64 + +pid:27107946 ecl:utc hgt:66cm byr:1928 eyr:2040 +cid:87 + +byr:1959 ecl:blu hcl:4e023b pid:9017609497 eyr:2023 hgt:68 iyr:2029 + +hgt:164cm eyr:2023 byr:2008 ecl:grn pid:420168481 hcl:#b6652a iyr:2012 + +eyr:1977 byr:1934 +ecl:brn cid:163 +iyr:2018 pid:2863284754 +hgt:150in hcl:#623a2f + +ecl:hzl eyr:2031 cid:145 hgt:186cm hcl:#cfa07d +byr:1941 iyr:2010 pid:722056139 + +ecl:blu eyr:2027 +hcl:#888785 iyr:2018 byr:1977 cid:278 hgt:156cm + +eyr:2039 hgt:82 byr:2007 +hcl:z iyr:2021 ecl:dne cid:191 +pid:#1cf69f + +pid:183cm cid:111 +hgt:66cm +iyr:1950 +eyr:1947 ecl:#016f6a + +ecl:hzl byr:1957 iyr:2015 hgt:186cm eyr:2029 hcl:#701e04 cid:149 pid:827898914 + +cid:214 pid:785688542 hgt:189cm byr:1974 ecl:brn +hcl:#18171d +eyr:2030 + +hcl:#866857 +cid:241 ecl:grn pid:389488422 byr:1959 iyr:2015 hgt:67in +eyr:2027 + +hcl:#6b5442 iyr:2011 hgt:193cm +eyr:2026 byr:1952 +pid:033382338 +ecl:grn + +iyr:2020 hgt:166cm byr:1927 +eyr:2029 ecl:hzl +pid:927006613 hcl:#623a2f + +ecl:gry pid:640783974 +hgt:71in byr:1945 iyr:2019 cid:268 hcl:#b6652a +eyr:2025 + +hcl:#733820 hgt:163cm +pid:1285584293 byr:1967 ecl:oth +cid:309 iyr:2020 eyr:2031 + +pid:910349085 iyr:2011 hcl:#623a2f byr:1956 +eyr:2025 ecl:gry +hgt:182cm + +pid:018283044 hcl:#602927 hgt:153cm ecl:gry iyr:2020 +eyr:2024 +byr:1990 + +hgt:184cm hcl:#866857 ecl:oth +eyr:2023 pid:405733635 cid:205 +byr:1987 iyr:2012 + +hgt:167cm +iyr:2015 ecl:brn +eyr:2025 +hcl:#18171d cid:313 byr:1960 + +hgt:165cm byr:1933 +iyr:2014 +cid:203 +hcl:#1cdbb3 +ecl:hzl eyr:2027 pid:747009469 + +hgt:169cm ecl:gry iyr:2014 +byr:1966 pid:621876532 hcl:#efcc98 + +cid:342 eyr:2029 hcl:#a97842 byr:1970 +ecl:oth +pid:137287449 hgt:180cm +iyr:2011 + +hcl:#cfa07d byr:1985 hgt:183cm ecl:grn +iyr:2013 eyr:2022 + +iyr:2023 +pid:164cm hcl:z byr:1966 +eyr:2021 ecl:utc + +hcl:#fffffd cid:60 +byr:1973 +pid:324648387 +hgt:177cm eyr:2022 iyr:2010 +ecl:oth + +pid:632056596 hcl:#efcc98 +hgt:73in ecl:brn byr:1928 iyr:2017 +eyr:2023 + +cid:144 ecl:amb eyr:2035 byr:1943 hgt:180cm +iyr:2012 +pid:155cm + +hcl:#6b5442 +pid:927492391 +eyr:2023 hgt:172cm byr:1958 cid:92 ecl:gry iyr:2019 + +iyr:2020 cid:82 +hgt:193in hcl:#b6652a +ecl:grn eyr:2034 byr:2026 + +iyr:1922 hcl:245cb3 byr:2015 +pid:151cm +eyr:2040 +ecl:lzr cid:136 hgt:101 + +byr:2025 +eyr:2029 +hgt:193in +cid:308 +ecl:gry iyr:2028 pid:9335153289 +hcl:z + +eyr:2030 hgt:163cm iyr:2014 +pid:147768826 ecl:blu byr:1922 hcl:#ceb3a1 cid:169 + +ecl:blu byr:2002 eyr:2028 pid:998185490 cid:165 iyr:2020 +hgt:188cm hcl:#c0946f diff --git a/README.md b/README.md new file mode 100644 index 0000000..3ecf2d1 --- /dev/null +++ b/README.md @@ -0,0 +1,8 @@ +# Advent of Code - trotFunky's pot O' code + +This is the repository where I'll be storing my solutions for the [Advent of Code](https://adventofcode.com) event run by [Eric Wastl](http://was.tl/). +The directory structure is simple : `year/day`, each day containing the input file and at least one file containing my solution(s). + +## Depencies + +Only Python3 for now ! From f44d5b9e661dffe9c63dacb102d5811495317e13 Mon Sep 17 00:00:00 2001 From: Teo-CD Date: Sat, 5 Dec 2020 00:04:09 +0100 Subject: [PATCH 03/28] Some cleanup, added a few comments all around --- .gitignore | 1 + 2020/Day 1/Solution.py | 32 +++++++++++++++++++++++++++----- 2020/Day 2/Solution.py | 6 ++++-- 2020/Day 3/Solution.py | 13 +++++++++---- 2020/Day 4/Solution.py | 14 +++++++++----- README.md | 2 +- 6 files changed, 51 insertions(+), 17 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b79602f --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +**/.idea diff --git a/2020/Day 1/Solution.py b/2020/Day 1/Solution.py index 262cf90..309b2a0 100644 --- a/2020/Day 1/Solution.py +++ b/2020/Day 1/Solution.py @@ -1,7 +1,14 @@ target = 2020 -input_file = "/tmp/aocinput" +input_file = "input.txt" + def find_sum_of_two(): + """ + Find two numbers from a list that add to a target. + This is done by separating the numbers in a smaller than half and bigger than half of the target, + and trying to find a match that would complement the sum, rather than adding everything together. + :return: None + """ large_n = [] small_n = [] @@ -14,6 +21,7 @@ def find_sum_of_two(): if number > target/2: large_n.append(number) elif number == target/2: + # Used for "early" exit if we find twice the half halftarget_count += 1 else: small_n.append(number) @@ -24,6 +32,7 @@ def find_sum_of_two(): line = file.readline() + # This was chosen in this order because of input I got : mainly large numbers for big_one in large_n: complement = target-big_one if complement in small_n: @@ -32,7 +41,14 @@ def find_sum_of_two(): print("No sum found that can reach {target}") + def sum_search(target_sum, inputs): + """ + Basically the same as above but for an arbitrary target and list of numbers. + :param target_sum: Sum that we are looking numbers to reach + :param inputs: List of numbers to search for a pair adding to target_sum + :return: The pair if found, False otherwise + """ lower = [] upper = [] @@ -42,6 +58,7 @@ def sum_search(target_sum, inputs): else: upper.append(num) + # As those list might be of a different repartition, search the smaller one while iterating on the larger one search_list = lower if len(lower) < len(upper) else upper iter_list = upper if len(lower) < len(upper) else lower @@ -53,24 +70,29 @@ def sum_search(target_sum, inputs): def find_sum_of_three(): + """ + Find a triplet of number that reach a target when added together. This time, constructing a list by subtracting each + number to the target, and using this list to check if the we can find two other numbers that add up to it. + To put it another way, instead of searching for a,b and c in a+b+c = t, search for a,b in a+b = t-c for every c. + :return: None + """ data = [] subtracted_to_target = [] with open(input_file) as file: line = file.readline() while line and line != "\n": data.append(int(line)) - subtracted_to_target.append((target-data[-1],data[-1])) + subtracted_to_target.append((target-data[-1], data[-1])) line = file.readline() + # Honestly not sure if it helps data.sort() for sub_target in subtracted_to_target: - result = sum_search(sub_target[0],data) + result = sum_search(sub_target[0], data) if result: print(f"Sum found : {result[0]}+{result[1]}+{sub_target[1]} = {target}\nResult is {result[0]*result[1]*sub_target[1]}") return print("No sum found") - - diff --git a/2020/Day 2/Solution.py b/2020/Day 2/Solution.py index cbbc5f0..bc23ba6 100644 --- a/2020/Day 2/Solution.py +++ b/2020/Day 2/Solution.py @@ -1,4 +1,5 @@ -input_file = "/tmp/aocinput" +input_file = "input.txt" + def letter_count(): valid_passwords = 0 @@ -16,6 +17,7 @@ def letter_count(): print(f"There are {valid_passwords} valid passwords") + def letter_position(): valid_passwords = 0 @@ -29,4 +31,4 @@ def letter_position(): line = passwords.readline() - print(f"There are {valid_passwords} valid passwords") \ No newline at end of file + print(f"There are {valid_passwords} valid passwords") diff --git a/2020/Day 3/Solution.py b/2020/Day 3/Solution.py index b524718..24d054e 100644 --- a/2020/Day 3/Solution.py +++ b/2020/Day 3/Solution.py @@ -1,4 +1,4 @@ -input_file = "/tmp/aocinput" +input_file = "input.txt" map_table = [] @@ -8,7 +8,8 @@ with open(input_file) as slope_map: map_table.append(line) line = slope_map.readline() -def check_for_trees(direction=(3,1)): + +def check_for_trees(direction=(3, 1)): x_pos = 0 y_pos = 0 @@ -17,8 +18,10 @@ def check_for_trees(direction=(3,1)): tree_count = 0 + # Might pose an issue for y speed different than a divisor of the number of lines ? while y_pos < height-1: - x_pos,y_pos = ((x_pos+direction[0])%(width-1),y_pos+direction[1]) + # x wraps around as the map is repeated on the right indefinitely + x_pos, y_pos = ((x_pos+direction[0]) % (width-1), y_pos+direction[1]) if map_table[y_pos][x_pos] == "#": tree_count += 1 @@ -26,6 +29,7 @@ def check_for_trees(direction=(3,1)): return tree_count + def check_multiple_directions(directions): result = 1 for direction in directions: @@ -33,4 +37,5 @@ def check_multiple_directions(directions): print(f"Result is {result}.") -check_multiple_directions([(1,1),(3,1),(5,1),(7,1),(1,2)]) \ No newline at end of file + +check_multiple_directions([(1, 1), (3, 1), (5, 1), (7, 1), (1, 2)]) diff --git a/2020/Day 4/Solution.py b/2020/Day 4/Solution.py index ddd8b25..bbee4b8 100644 --- a/2020/Day 4/Solution.py +++ b/2020/Day 4/Solution.py @@ -1,14 +1,16 @@ import re -input_file = "/tmp/aocinput" +input_file = "input.txt" height_re = re.compile(r'^([0-9]+)(in|cm)$') passport_id_re = re.compile(r'^[0-9]{9}$') color_re = re.compile(r'^#[0-9a-f]{6}$') + def check_limits(to_test, min_valid, max_valid): return False if (to_test < min_valid or to_test > max_valid) else True + def validate_passport(record): for field in record: if field[0] == "byr": @@ -24,16 +26,16 @@ def validate_passport(record): regex_match = height_re.match(field[1]) if not regex_match: return False - if regex_match.groups()[1] == "cm" and not check_limits(int(regex_match.groups()[0]), 150,193): + if regex_match.groups()[1] == "cm" and not check_limits(int(regex_match.groups()[0]), 150, 193): return False - elif regex_match.groups()[1] == "in" and not check_limits(int(regex_match.groups()[0]),59,76): + elif regex_match.groups()[1] == "in" and not check_limits(int(regex_match.groups()[0]), 59, 76): return False elif field[0] == "hcl": regex_match = color_re.match(field[1]) if not regex_match: return False elif field[0] == "ecl": - if field[1] not in ["amb","blu","brn","gry","grn","hzl","oth"]: + if field[1] not in ["amb", "blu", "brn", "gry", "grn", "hzl", "oth"]: return False elif field[0] == "pid": regex_match = passport_id_re.match(field[1]) @@ -57,7 +59,9 @@ with open(input_file) as passports: line = passports.readline() continue + # rstrip() strips the string from end of line characters et alia. for raw_entry in line.rstrip().split(" "): + # Split the different fields, then split them in (key,value) tuples records[current_index].append(tuple(raw_entry.split(":"))) line = passports.readline() @@ -75,4 +79,4 @@ for record in records: if is_north_pole_credential and validate_passport(record): valid_passports += 1 -print(f"There are {valid_passports} valid passports out of {len(records)}") \ No newline at end of file +print(f"There are {valid_passports} valid passports out of {len(records)}") diff --git a/README.md b/README.md index 3ecf2d1..80c202c 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Advent of Code - trotFunky's pot O' code This is the repository where I'll be storing my solutions for the [Advent of Code](https://adventofcode.com) event run by [Eric Wastl](http://was.tl/). -The directory structure is simple : `year/day`, each day containing the input file and at least one file containing my solution(s). +The directory structure is simple : `year/day`, each day containing the input file and at least one file containing my solution(s). The prompts of each puzzles will not be repeated here, so go check them on the site ! ## Depencies From 5e94b4e474c15c5be28b143f80fb2f22776e8d43 Mon Sep 17 00:00:00 2001 From: trotFunky Date: Sat, 5 Dec 2020 00:04:09 +0100 Subject: [PATCH 04/28] Some cleanup, added a few comments all around --- .gitignore | 1 + 2020/Day 1/Solution.py | 32 +++++++++++++++++++++++++++----- 2020/Day 2/Solution.py | 6 ++++-- 2020/Day 3/Solution.py | 13 +++++++++---- 2020/Day 4/Solution.py | 14 +++++++++----- README.md | 2 +- 6 files changed, 51 insertions(+), 17 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b79602f --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +**/.idea diff --git a/2020/Day 1/Solution.py b/2020/Day 1/Solution.py index 262cf90..309b2a0 100644 --- a/2020/Day 1/Solution.py +++ b/2020/Day 1/Solution.py @@ -1,7 +1,14 @@ target = 2020 -input_file = "/tmp/aocinput" +input_file = "input.txt" + def find_sum_of_two(): + """ + Find two numbers from a list that add to a target. + This is done by separating the numbers in a smaller than half and bigger than half of the target, + and trying to find a match that would complement the sum, rather than adding everything together. + :return: None + """ large_n = [] small_n = [] @@ -14,6 +21,7 @@ def find_sum_of_two(): if number > target/2: large_n.append(number) elif number == target/2: + # Used for "early" exit if we find twice the half halftarget_count += 1 else: small_n.append(number) @@ -24,6 +32,7 @@ def find_sum_of_two(): line = file.readline() + # This was chosen in this order because of input I got : mainly large numbers for big_one in large_n: complement = target-big_one if complement in small_n: @@ -32,7 +41,14 @@ def find_sum_of_two(): print("No sum found that can reach {target}") + def sum_search(target_sum, inputs): + """ + Basically the same as above but for an arbitrary target and list of numbers. + :param target_sum: Sum that we are looking numbers to reach + :param inputs: List of numbers to search for a pair adding to target_sum + :return: The pair if found, False otherwise + """ lower = [] upper = [] @@ -42,6 +58,7 @@ def sum_search(target_sum, inputs): else: upper.append(num) + # As those list might be of a different repartition, search the smaller one while iterating on the larger one search_list = lower if len(lower) < len(upper) else upper iter_list = upper if len(lower) < len(upper) else lower @@ -53,24 +70,29 @@ def sum_search(target_sum, inputs): def find_sum_of_three(): + """ + Find a triplet of number that reach a target when added together. This time, constructing a list by subtracting each + number to the target, and using this list to check if the we can find two other numbers that add up to it. + To put it another way, instead of searching for a,b and c in a+b+c = t, search for a,b in a+b = t-c for every c. + :return: None + """ data = [] subtracted_to_target = [] with open(input_file) as file: line = file.readline() while line and line != "\n": data.append(int(line)) - subtracted_to_target.append((target-data[-1],data[-1])) + subtracted_to_target.append((target-data[-1], data[-1])) line = file.readline() + # Honestly not sure if it helps data.sort() for sub_target in subtracted_to_target: - result = sum_search(sub_target[0],data) + result = sum_search(sub_target[0], data) if result: print(f"Sum found : {result[0]}+{result[1]}+{sub_target[1]} = {target}\nResult is {result[0]*result[1]*sub_target[1]}") return print("No sum found") - - diff --git a/2020/Day 2/Solution.py b/2020/Day 2/Solution.py index cbbc5f0..bc23ba6 100644 --- a/2020/Day 2/Solution.py +++ b/2020/Day 2/Solution.py @@ -1,4 +1,5 @@ -input_file = "/tmp/aocinput" +input_file = "input.txt" + def letter_count(): valid_passwords = 0 @@ -16,6 +17,7 @@ def letter_count(): print(f"There are {valid_passwords} valid passwords") + def letter_position(): valid_passwords = 0 @@ -29,4 +31,4 @@ def letter_position(): line = passwords.readline() - print(f"There are {valid_passwords} valid passwords") \ No newline at end of file + print(f"There are {valid_passwords} valid passwords") diff --git a/2020/Day 3/Solution.py b/2020/Day 3/Solution.py index b524718..24d054e 100644 --- a/2020/Day 3/Solution.py +++ b/2020/Day 3/Solution.py @@ -1,4 +1,4 @@ -input_file = "/tmp/aocinput" +input_file = "input.txt" map_table = [] @@ -8,7 +8,8 @@ with open(input_file) as slope_map: map_table.append(line) line = slope_map.readline() -def check_for_trees(direction=(3,1)): + +def check_for_trees(direction=(3, 1)): x_pos = 0 y_pos = 0 @@ -17,8 +18,10 @@ def check_for_trees(direction=(3,1)): tree_count = 0 + # Might pose an issue for y speed different than a divisor of the number of lines ? while y_pos < height-1: - x_pos,y_pos = ((x_pos+direction[0])%(width-1),y_pos+direction[1]) + # x wraps around as the map is repeated on the right indefinitely + x_pos, y_pos = ((x_pos+direction[0]) % (width-1), y_pos+direction[1]) if map_table[y_pos][x_pos] == "#": tree_count += 1 @@ -26,6 +29,7 @@ def check_for_trees(direction=(3,1)): return tree_count + def check_multiple_directions(directions): result = 1 for direction in directions: @@ -33,4 +37,5 @@ def check_multiple_directions(directions): print(f"Result is {result}.") -check_multiple_directions([(1,1),(3,1),(5,1),(7,1),(1,2)]) \ No newline at end of file + +check_multiple_directions([(1, 1), (3, 1), (5, 1), (7, 1), (1, 2)]) diff --git a/2020/Day 4/Solution.py b/2020/Day 4/Solution.py index ddd8b25..bbee4b8 100644 --- a/2020/Day 4/Solution.py +++ b/2020/Day 4/Solution.py @@ -1,14 +1,16 @@ import re -input_file = "/tmp/aocinput" +input_file = "input.txt" height_re = re.compile(r'^([0-9]+)(in|cm)$') passport_id_re = re.compile(r'^[0-9]{9}$') color_re = re.compile(r'^#[0-9a-f]{6}$') + def check_limits(to_test, min_valid, max_valid): return False if (to_test < min_valid or to_test > max_valid) else True + def validate_passport(record): for field in record: if field[0] == "byr": @@ -24,16 +26,16 @@ def validate_passport(record): regex_match = height_re.match(field[1]) if not regex_match: return False - if regex_match.groups()[1] == "cm" and not check_limits(int(regex_match.groups()[0]), 150,193): + if regex_match.groups()[1] == "cm" and not check_limits(int(regex_match.groups()[0]), 150, 193): return False - elif regex_match.groups()[1] == "in" and not check_limits(int(regex_match.groups()[0]),59,76): + elif regex_match.groups()[1] == "in" and not check_limits(int(regex_match.groups()[0]), 59, 76): return False elif field[0] == "hcl": regex_match = color_re.match(field[1]) if not regex_match: return False elif field[0] == "ecl": - if field[1] not in ["amb","blu","brn","gry","grn","hzl","oth"]: + if field[1] not in ["amb", "blu", "brn", "gry", "grn", "hzl", "oth"]: return False elif field[0] == "pid": regex_match = passport_id_re.match(field[1]) @@ -57,7 +59,9 @@ with open(input_file) as passports: line = passports.readline() continue + # rstrip() strips the string from end of line characters et alia. for raw_entry in line.rstrip().split(" "): + # Split the different fields, then split them in (key,value) tuples records[current_index].append(tuple(raw_entry.split(":"))) line = passports.readline() @@ -75,4 +79,4 @@ for record in records: if is_north_pole_credential and validate_passport(record): valid_passports += 1 -print(f"There are {valid_passports} valid passports out of {len(records)}") \ No newline at end of file +print(f"There are {valid_passports} valid passports out of {len(records)}") diff --git a/README.md b/README.md index 3ecf2d1..80c202c 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Advent of Code - trotFunky's pot O' code This is the repository where I'll be storing my solutions for the [Advent of Code](https://adventofcode.com) event run by [Eric Wastl](http://was.tl/). -The directory structure is simple : `year/day`, each day containing the input file and at least one file containing my solution(s). +The directory structure is simple : `year/day`, each day containing the input file and at least one file containing my solution(s). The prompts of each puzzles will not be repeated here, so go check them on the site ! ## Depencies From e3cb2ddd487134545efbd9ccf28786b08845b8b4 Mon Sep 17 00:00:00 2001 From: Teo-CD Date: Thu, 17 Dec 2020 16:57:44 +0100 Subject: [PATCH 05/28] Day 5 of 2020 done in Python --- 2020/Day 5/Solution.py | 42 +++ 2020/Day 5/input.txt | 824 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 866 insertions(+) create mode 100644 2020/Day 5/Solution.py create mode 100644 2020/Day 5/input.txt diff --git a/2020/Day 5/Solution.py b/2020/Day 5/Solution.py new file mode 100644 index 0000000..b5caddc --- /dev/null +++ b/2020/Day 5/Solution.py @@ -0,0 +1,42 @@ +from math import floor,ceil + +input_file = "input.txt" + +seats = [] + +with open(input_file) as boardings: + line = boardings.readline() + while line and line != "\n": + row_start = 0 + row_end = 127 + column_start = 0 + column_end = 7 + + for character in line: + if character == "F": + row_end = floor((row_start+row_end)/2) + elif character == "B": + row_start = ceil((row_start+row_end)/2) + elif character == "L": + column_end = floor((column_start+column_end)/2) + elif character == "R": + column_start = ceil((column_start+column_end)/2) + else: # End of line + seats.append(row_end*8+column_end) + + line = boardings.readline() + +print(f"Highest seat ID : {max(seats)}") + + +seats.sort() +possible_seats = list(range(seats[0], seats[-1]+1)) + +# There might be missing seats at the front or the back of the plane +# thus, if we sort and create a range between the smallest and largest ID +# and iterate over both, the number missing in the full range would be our seat. + +for i in range(len(seats)): + if seats[i] != possible_seats[i]: + print(f"Your seat is {possible_seats[i]}") + break diff --git a/2020/Day 5/input.txt b/2020/Day 5/input.txt new file mode 100644 index 0000000..6ef4cd6 --- /dev/null +++ b/2020/Day 5/input.txt @@ -0,0 +1,824 @@ +FFBBBFBLRL +BFFFBFBRRR +BFFFBFBLRL +BFFBFBBLRR +BBFFBFFRLL +BFFFBFBRLR +FFFFBBBRLR +BBFFFBBRRR +BBFBFBBRRR +BFFBBBFLRR +FFBBFBBRLR +BBFFBFFLLL +BFFFBFBLLR +FBBFFBFLRR +FBBFBBFRRL +BFFBBBBRRR +BFBBBBFLLL +BFFBFBFLRR +FBBFFBFRRR +FFBFB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BFBBFLLL +FBFFBBBLRR +BBFFBFFLLR +BFBBBFFRRR +FFFBFFFRRL +FBBFBBBRRL +FFFBFBBLLR +BFFFBFFRLL +BBFBFFBRRL +FFBFFFFRRL +FFBFBFBRLR +FBBFBFFRLL +FFFBBFBLLR +FFFBBBFRRL +FBBBBBFRLL +BFFFBBFRRL +BFBFBFBRRL +FBBBBFFLRR +FFFBBFBRRL +BFFBBFBRLR +BBFBFBBLLL +FFBFFFFLLR +FFBFFFFLRL +FFFFBBBLRR +BBFBBFBLRR +FBBBFBFLRR +FFFBFBBRLL +FBFFBBFRLR +FFBFBBFLRR +FFFBFBFLRL +FFFBBBBRLR +FBBFBBBRLR +FBFBFFBLRL +BFBBBBFLRL +BFFFFBBRRR +BFFBBBFRRL +BFFFFBBRLL +BFBFBFFLRR +BBFFBFBLRR +FBBFBBFLRL +FFFBFFFLLL +FBBBBFBRRR +FBFFFBBLLR +FBBFFBBLLR +FFBBFFFLLL +FFBFBFFLLL +FBFBFBFLRR +BBFFFBFLLR +BFFBBBBLRR +FBBFFFBLRL +FFFBFFBLRR +BFBFBFBLLR +FBFBBFFLRL +BFBFBFFRLL +FFBFBBBLLL +FBFFBBBRRR +FFBBFFFRRL +FFBBFBBRRR +FFBFFFBLRL +BFBBBFFLRL From 904241c081c51fff4c3d47a86bf789aeb9cbe538 Mon Sep 17 00:00:00 2001 From: trotFunky Date: Thu, 17 Dec 2020 16:57:44 +0100 Subject: [PATCH 06/28] Day 5 of 2020 done in Python --- 2020/Day 5/Solution.py | 42 +++ 2020/Day 5/input.txt | 824 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 866 insertions(+) create mode 100644 2020/Day 5/Solution.py create mode 100644 2020/Day 5/input.txt diff --git a/2020/Day 5/Solution.py b/2020/Day 5/Solution.py new file mode 100644 index 0000000..b5caddc --- /dev/null +++ b/2020/Day 5/Solution.py @@ -0,0 +1,42 @@ +from math import floor,ceil + +input_file = "input.txt" + +seats = [] + +with open(input_file) as boardings: + line = boardings.readline() + while line and line != "\n": + row_start = 0 + row_end = 127 + column_start = 0 + column_end = 7 + + for character in line: + if character == "F": + row_end = floor((row_start+row_end)/2) + elif character == "B": + row_start = ceil((row_start+row_end)/2) + elif character == "L": + column_end = floor((column_start+column_end)/2) + elif character == "R": + column_start = ceil((column_start+column_end)/2) + else: # End of line + seats.append(row_end*8+column_end) + + line = boardings.readline() + +print(f"Highest seat ID : {max(seats)}") + + +seats.sort() +possible_seats = list(range(seats[0], seats[-1]+1)) + +# There might be missing seats at the front or the back of the plane +# thus, if we sort and create a range between the smallest and largest ID +# and iterate over both, the number missing in the full range would be our seat. + +for i in range(len(seats)): + if seats[i] != possible_seats[i]: + print(f"Your seat is {possible_seats[i]}") + break diff --git a/2020/Day 5/input.txt b/2020/Day 5/input.txt new file mode 100644 index 0000000..6ef4cd6 --- /dev/null +++ b/2020/Day 5/input.txt @@ -0,0 +1,824 @@ +FFBBBFBLRL +BFFFBFBRRR +BFFFBFBLRL +BFFBFBBLRR +BBFFBFFRLL +BFFFBFBRLR +FFFFBBBRLR +BBFFFBBRRR +BBFBFBBRRR +BFFBBBFLRR +FFBBFBBRLR +BBFFBFFLLL +BFFFBFBLLR +FBBFFBFLRR +FBBFBBFRRL +BFFBBBBRRR +BFBBBBFLLL +BFFBFBFLRR +FBBFFBFRRR +FFBFBFBLRL +BFFFFBFLRR +FBBFFFFLRR +BFFFBBBLLL +BFBFFFBRLL +FFBBBBBRLL +FFBBFFBLLR +FBFFBBFLRL +FFBFFBBRRL +BFBBBBFLLR +BFFFFBFRRL +BFFBFFFLLL +FBFFFBFLRL +FBBBFFFLLL +FFBFBBFRLR +FBBBFBFRRL +BFBBBFBLLL +FBFFFBFLRR +FBFBFFBLRR +BFFFFBFLRL +FBFBFFFRRL +FBBFBFBLRL +FBBFFBFLLL +FBFBBBBRRR +FBBBBBFLRR +FBBBFBBLLR +FFFBFBFRLL +FFFBBFFLRR +BFBBFFBRRL +FFBFBFBRRL +FBFBBBBLRR +BFFBB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BFBBBRLR +FBFBFFBLRL +BFBBBBFLRL +BFFFFBBRRR +BFFBBBFRRL +BFFFFBBRLL +BFBFBFFLRR +BBFFBFBLRR +FBBFBBFLRL +FFFBFFFLLL +FBBBBFBRRR +FBFFFBBLLR +FBBFFBBLLR +FFBBFFFLLL +FFBFBFFLLL +FBFBFBFLRR +BBFFFBFLLR +BFFBBBBLRR +FBBFFFBLRL +FFFBFFBLRR +BFBFBFBLLR +FBFBBFFLRL +BFBFBFFRLL +FFBFBBBLLL +FBFFBBBRRR +FFBBFFFRRL +FFBBFBBRRR +FFBFFFBLRL +BFBBBFFLRL From 1b76468550ad5e0cfd78f86aa52eb949abb25e24 Mon Sep 17 00:00:00 2001 From: Teo-CD Date: Thu, 17 Dec 2020 17:39:24 +0100 Subject: [PATCH 07/28] Day 6 of 2020 done in Python --- 2020/Day 6/Solution.py | 46 + 2020/Day 6/input.txt | 2044 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 2090 insertions(+) create mode 100644 2020/Day 6/Solution.py create mode 100644 2020/Day 6/input.txt diff --git a/2020/Day 6/Solution.py b/2020/Day 6/Solution.py new file mode 100644 index 0000000..d0719a0 --- /dev/null +++ b/2020/Day 6/Solution.py @@ -0,0 +1,46 @@ +input_file = "input.txt" + +answers = [] +participants = [] + +with open(input_file) as group_answers: + line = group_answers.readline() + answers.append({}) + # Count from zero as the last line return is for the group separation + participant_count = 0 + + while line: + if line == "\n": + answers.append({}) + participants.append(participant_count) + participant_count = 0 + line = group_answers.readline() + continue + + for character in line: + if character == '\n': + participant_count += 1 + break + + # Count answers for each questions + if character in answers[-1]: + answers[-1][character] += 1 + else: + answers[-1][character] = 1 + + line = group_answers.readline() + +print(f"The total number of positive answers is {sum([len(answer_dict) for answer_dict in answers])}") + +sum_of_all_yes = 0 + +# Compare the count of yes for each answer with the count of people in the group. +# Do so by iterating over both arrays at once and then iterating over the keys of the answer dictionary. + +for index in range(len(participants)): + for key in answers[index]: + if answers[index][key] == participants[index]: + sum_of_all_yes += 1 + + +print(f"The total number of positive answer by each member of each group is {sum_of_all_yes}") diff --git a/2020/Day 6/input.txt b/2020/Day 6/input.txt new file mode 100644 index 0000000..e965d96 --- /dev/null +++ b/2020/Day 6/input.txt @@ -0,0 +1,2044 @@ +c +jc +ck +cue +c + +ysjircxtgfzpb +ynsxpgtcifz +riydpzsfxutcg +gsyitzdvpfcrox +yclxfzietsmghwp + +bacqdjhsf +fhbdjacsq +tbjmcxlqashdfo +hebjascfdq +bgqjscdfha + +pt +tp +xtzn +tu +pt + +zjn +nzj + +h +h +rzh +h + +cfqurmlxnzhpy +wjaufshgemktox + +ah +ahe +tvhrq + +awbte +tbawjen +wtubea +wjaebt +ewtab + +vlz +lv +vrqyl +lv +elv + +rfu +rpujz + +foniw +nfo + +kaumhjywgtvzndcire +qulkzxoinadvtbgymh +vgdzlahiounmykt +tkglyzdunsvmhoxiaf + +rxmdbgikaywentqvzhfolcpuj +enipkytvdmbgqzaufjxlohwrc + +gdhiqazwcv +mouqpltacvw +dcvyqhwfaj +wbhgaevcqn +vawqkcxr + +dmtaowgp +mwtdipa + +rvpwoshm +osvprmwh +smwpfvhr + +axmhdqzctfspgeu +zpmcauexshtfdq +dqfmteacshpxzu + +ptryjvufglaxmqwonck +nupfyjrwktlmxaqgvc +tjgapcflbmuynqwvxrk +rwjgnauflvymcotkqxdp +sejyrkqtwalhncxuvfpmg + +kjlucpqysrbe +cotlifeqgmspzkdr +prasckbluqe + +svjwcigopdflhy +corvxsaigbflwheyqzuj +dfclkgmwsvyithoj + +sxrynelg +elygxoms +glmexyt +uyxfgelkb + +cljshbxnaeqrivupwtgz +qplrtgeshxviaunwcbz +whcxivzgtaneqpsrbul +lvgzibncxwrdopqeatuhs +zlqcvbmrsktwpeaxinuhg + +fngcrihykv +irhgfkvcny +ivpcfgkhrny +ckhyirdfngv +vnchisygrkf + +rsqmk +kufbscval +yjksih +jksmo + +knszclmhryfvgdtwj +jhrwzlgdfyqcv + +ulbyhi +yqhuzsim +hkienuwfcy +yuhpio + +nqblomzhgtikdwjpcasyvuexf +kngcjvymbzqoahesfi + +xlebgtjpz +svlqfwkuaipbmc +rhgxplndb +lpzjbyo + +rzqpashvw +dmlcoq + +hkxi +kixh +hikx +xhik + +pljraokdmec +zhtdrlaqfgbnue + +peofrnkgauhzctwldjb +tgnbokrjufmshd +ygktbmnuodshrfjx + +bfzqvolaymsxue +beyvlnfsqzuxao +vfozbaisjyexhqgclrwu +fsxpaobulvzyeq +flzxbesauqvoy + +jipavclbehxrngdwsk +mkjshalwdxqntev + +ixrtj +wcmxij +mjwix +xzvjghbdnuqi +ixrjs + +lroxesmfqdbt +qtloefydr +lerfqivnjodt +eokdmftlxqr + +akow +ka + +pnjkvoxatm +jmktpoaxnv + +ufejltwq +teqfljuw +twqjufel +eultqwjf + +ucoleqmyxfwzhnriskt +lnkfuiythsxrzwemocq + +fvwakuorhpzyjmxl +ahltpwjozkxmf +wkpjzfhmdlexsao +jxolzknmhpwcfa +lfjhtsxqkmwoazpd + +guoytrawsiexknq +gopukszvctnjbai +iaglmuotnsk +kgdisuotafn + +pdtsnx +ns + +ign +ngi +ding + +dhryg +cksn +ih +ebpo +qxs + +bavsrfcntmgqxu +fxbnvpasmuogqc +gcusamnbfqxv +ikmnhvybqgxcdfusa + +k +jk +k +j +nh + +mjsfl +omisj + +umdoiqabcrhlyf +olymbihfdusaqc + +wuvymbghitrelazpok +gsmrepwzkuthbvil + +gfdjb +gbfjd +fgjbd + +jdxghipmorlvfzw +zqlcjwfrbvpoxmid +enwrflodjzstapmuyik + +laiegdk +nvhqlgz +xscuf + +ubtdong +nubdysrg +dgubn + +n +n +oycw + +dmlewthyrqnkxagvszb +vdgkyxabtqhnzmsewlr +hdbxnvtwzyspkqagmelr +hnzlrtywdfaqsjbemxgkv +mrkqbdsyaegvzlwxtnh + +rkouvs +kpobrgq +cxknfrow + +uyve +uyve +yvuce +vekouy +euyv + +avgoinutrxjymlpbqwhsek +pwirvaostmgjukxnqhebyl +okndimpehgtlsujqaxbywrv +anbvohsetlpqirxyfjkmwug +jqenglrhkuixbyapmvtsow + +zbos +szbo +szbo +obizs +zabso + +dstiveo +edsivo +evodsi + +vimbcytwuzajlqogpkfrexd +jdubvxkeofqrgzytipncla +gpkqrlyofaxzictejuvdb + +db +cbd +db +db +db + +k +k +k +k +k + +wqo +qo +oq +qoc +likmqoef + +vdfrjn +orjfna +fmrjnd + +iyashplx +haslxypi +ahpsxyil +yxhliaps +hiasyzpxl + +ucdlfx +lcxudf +cxdflu +dcxulf +fxlucd + +etfhylmiajvcdxnqbps +fastbwphiqdlruxymcokv +tsxfidhcymqapgblv +spzhavtmdqgjlyicbxf + +jxc +cjb + +cowg +qxzwajco + +rypjntgd +splna +pxuvcnke +ljpmznwrdft +podn + +uowirdqvc +gtpimard + +hntmubdlvspagxqy +ycbfnkjrzw + +bjvnyau +uakxynm + +danpzlubyhgsfxtkvjriewo +fahtkzslbpwyijongvrxud +galonbkpxzsdwtfrivjyuh + +gspxvjoq +oiqzjv +gqpjov +qjvonr +ujmahqyeobv + +gzuovxlmwhjbesqipak +tcjkrfanexgudqsb + +xkvgzaqfeih +vkqgiezcfxh +hzxkfvqgei +kxigvqhezf +yxgzkhefdivq + +ypaof +opya +yaop + +tiefwhqyzxr +tljiwxyeqhrzf +qezwhtsifxry +zfrpxeqytwhi + +fbscaxrhpdeqz +rehxpfg +fhroxep +kpxhtref + +tynqhrdulomfxazgipjb +oltrqiwcfjaspvuekn + +epbvtfldsixj +xcdnzbetv +zbvltcadx +txzbmvd +qktdovwxuhb + +uqtewcsrdiyphkxjvboz +hovsxtqckzurwipyje +xcpwthszuiknjoyqevr + +bqckxnvtdfspzu +vcfdanxspzkqtbu +dxckstuqvzynbpf + +hjus +oxsuhj +hjsu + +bxait +bftijxaw +tabix + +gvmdl +kfla +utpywqrsz +ngol +xiha + +ydvxqtkarigh +iohkgyczqtdrxs + +pzhxoytmave +xzamvptoyeh +stimxyevapzoh +vxmohptayez +hlvpyamoexrzt + +vdjsy +dsyv + +wedcxpt +viawqdpefco +cesudwp +upwtdceg +pweucd + +u +u +u +u +u + +unwkls +fkuanylm +lumank +eqlorxcgkuvtn +lzufnkh + +wembhayqcks +bksyqhceamw +qwceskyabhm +iwekfymbchqas +sormjywlhbzupckaeq + +krtohjcvxidyfm +sewgzil +piwbza +uqib + +ghpnicabeuroftvkyzm +raionvykhtfcbpmzgeu +tnzgcvubrhaefmkpioy +pvfnetiycurkomazgbh +honmbpfvzctkiryaegu + +q +h +jdg + +bykvmpgojzwlrcexi +yzwerjpcbgkivoxlm +ecvyijmbpzwrkxgol +wyjripkzlmcxgoebv +ljzcrwoemkpgisxbyv + +ugmaicqtejkbhsx +xtahjbsimcqukeg +ximchajkfgtvbuesq + +nrqfdcghioslp +lzsrthgfndoip +drslpfgniho + +q +fqb +q +qfdz +umaxtq + +joucqnzsgt +jgquo +uoqgyjpb +eojlqgu +ujgkwqo + +lhcrnxkogepw +wheorgpcnxkl +wrexgponhlck + +chgqirekozbypjst +hyqdvsjbrctzgpuoi + +fylsimtuvad +ytgdhicfjauvml +vafiuldmtyp +uptifdslmvay + +obkuc +wnm +rvgqdayhjte +x +pfs + +yrkv +rdvyt +fynrejcw +yrdk + +dfqnchypg +hgypnfdqc +pcqhgydfn +qcgfjhndyp + +b +t +t +t +t + +ehajgwscibr +uhdcmiwbjr +irbknwjhc + +gihcrjazpld +adgsnzjxlihrp +lzfhgdajpir +rgzlhnjqidpa + +rzpvjmbuac +qwbgmzurcpj +ujpmzbfrc +mucbrfzjp + +fu +fu +uf +fu + +tliwkzcanyjebq +mealtnofizcqjbsw + +eakbolcjugnmwdhrzy +elumwbzorjhnkcgayd +arnhycmjebduwgolkz +zbwaklmordhcgejynu + +ysnalmr +lsynrmf +simnbrfl +lsnimr +kmqlwsrxn + +ozbdtcgifhe +iocmtzdgefvh +efcgtdihzo +oczphgetlfdi + +wumdilea +jyahzgspq +iba + +wsonzrb +rboszwn +ozbnysrw +wbznros + +wzumjfrvscpq +cliwvsqbfzpeoru + +d +tdpm +rd + +vgnpfu +kgpaqictf + +phjlzk +pu +up +iwp + +edsbcnioxqlafupywkh +lfbqrhnxiseacyjkpow +xgeonhfqcybsapkiwrl + +wvczikeobyuamfpd +bxroupgizjkaytcmenwf + +q +q +q +kq +q + +eintqz +tqin +qitys +tifqxkh +qitsmv + +hdtzoyjrqkwpalv +owzjvahkdqlyprt +jhoywtdvkrpazlq +oyzavltphdkqwrj + +sxgfl +fxlge +glfx + +ntozcvdqes +ordesnczqtv +ntedczuvqos +svtaeodcznq + +lcpoi +uxinkaol +eyoila +owliy +jzhqdtlirmfsbgvo + +mje +jem + +kqunjoi +jiuno +oinju +tohinj +uionj + +o +pcgodj +oi +o +osi + +sqvmoejdgibuwyxrknfzapt +czlystrwjvpef + +ybtaflcopmirjdusxzvkhq +zlevmpqauroticjhbgkxfd +frumxlpzqivcwthkbdaoj + +wdivrf +fzritwjn +eioxqhkyfs +fiv + +gvs +scmrg + +vzgt +tzg +gwozt +wgzto +gtpdz + +rvh +r +zr +r +rdw + +fqkxosbgwynic +csfikqnbxgwyo +kogibcsqynfwx + +rpzsjhlaefxbvmodunigw +pxwgvfdlonieamhbsrju + +prgk +hepxkrvgi +kprg + +esfjanprvxzugcqdyowimhl +ktihxpnvwzogrclysbqadme + +cdykos +disycok +kdysloc + +chgzpxym +xhpgmczy +ghcyzpxm +hcpxyzgm +gpyxzchm + +pvkzy +pvgkxy +pyquvfcl +ywdvmhprena +cyvupq + +tyobwsehjrfunziqmg +cwujptqkreodvmfa + +r +nb +c +dktyap +sn + +maqevwtijbnlp +vrlkjawbmqnipt + +phizanuolbfgrt +bzipnauglforht +oignblthfapzur + +fd +d +d +d +d + +razemjtpsxgiq +peqmsarxgjwizt +ixjtzeargmpsq +itqermazxsjgp +ztmiqsxajerpg + +i +p +pu + +itkxhb +buxki +aicksxdpb + +qpczutx +gczjuhtq + +txqncbg +qtogvjcb +gcqrbt +bcaqrtg + +eqtwvkrnhusy +njtsqhwru + +ua +akcq +ai + +mgdcoxrnwvletpkbusihy +bdmslhpkgonvreiucyxtw + +lfoazxqyw +yrpbmnkceu + +j +j + +uwrzpvaxindebtloch +izvoxwbpuanrchet +tmrakvncphwiezobxu +pwruaixbhctvzedlon +rsebuowhxigtnjpcvqaz + +msnvf +ajx + +vgahuqimkblfyjexotp +hygaiepjlvuksmxoqfbt +ytlhbfmkoxujgedpvaiq + +xcdv +xgv +vxlu + +km +m +mfk +cyqwm + +rawphceqti +ylgmjconzbvsu + +lwy +ywl +yldw + +cmgsiykfd +icmgksdyf +mcdfsgiky +imksdcfogy + +avptxrnwubqi +vunbxwldt +vzkocbwn + +svhkjpfmzudeyc +hpmugixtezkavjd +zeqpxvmhdukj + +tw +ztw +wt + +bwfjxu +tjfvwub +ubnojfw + +ktnipjyeq +tkiwyb + +wmhqjc +hjwmcq +mhqjwc +hmjwqc + +hkzjgb +hgbjk +ghbjkz +kgxfbjyh + +ofwinqzbmkjgdxv +clbfwtozkiaugdvjnpqeh + +qmdrsbjeptgkw +wpnqkregtd +kfqewhdlgirzp + +sgqkuptxlvic +jkpgsxbt + +mvfik +xnljsuek +kibrpzfh +bkmcwr + +qzyv +yvmzq +qvz +zqvg + +vxjbaeirnylzhocpkqwstd +qvsuyerpthjwbcaizlxodkn +ozsaxtledcyvwpkjngbrihq +csvirwzhjoxlbnkqdtyape + +b +coxe +u + +kexawtfpg +guwfptxake +xpkgfteaw + +tgnr +nrgt +grnt + +kludgpxi +gkdxrp + +aibgqykuvs +bzgausdvwciq +qvbsgniua +iusqjvabg +bpvusajiyqg + +w +xu +kbu + +u +u +u +u +uoei + +zogb +ob +ob +boe +sbo + +cs +zm + +oleqm +oilq +qmlo + +woxzdcshnl +ldoshwxp + +ntkbjxpqwhlmecsrdga +qpebarkoizywsxmlfgdju + +mxk +yxm +kmx +xym +xzvmb + +nl +no +on +n +n + +fqlyezxtjgoa +hyeoatksq + +khtj +asmu +thkn + +t +z +z +m +z + +tyz +tyz + +gkmdubiacx +imjkudgcx +gdumcxik +gmuckidx + +iysarmnfphgctzj +hngozfpmstayj +yaskgvuqmdzhfnpbexjl + +edwvrzuloqfsctim +wromkzfdaicelvqnt +wokdiecqtvrsnmuf +kemtocfqvrdisw +owjdtqicxyfvgremhp + +ihdrnakm +andmkri + +ojetcq +aubtkl + +qsyfchx +hykvzfg +xye +rlwioyj + +odzqbvmlrfkjgye +vwlojbqdanrxtsyk +dohigvpjqyblkr +ulocbvjkyidqrp + +ketyogpsabhzwxiqfl +jixcwguhefqzkmbdolatn + +pko +kpo +pko + +wm +wm +mps +m +mw + +nghwmdf +hmfdgw +hfmgdjw +fmhvgdjw +dgwjfmh + +umnkpzedga +gpokqdzmeun +mhctzkgnuebdp +jpszkgeyunfdrxm + +bfcdysziphquxvmjagen +zfduabihvnqgpjsymcxe +nzabmuxyvijqfcedgpsh +hpsxnacvfdqguijbtzmye +cbsevkuanpdhmqifzjxyg + +hrjlbfwq +rfjwqbhl +fojqbkhlm +qfhjbls +qhlfcwjbu + +vfjicx +vjicfx +fcxjiv + +j +uc +n +q +q + +bmrvzsa +eaoqubzxmrnf + +yjnvze +najyvtze +zynvej + +wf +fb + +bejpn +bpnje + +o +yc + +jwhsena +uw +utwn +nwc +xmvw + +htsqagwko +lydzerxjunvifpm + +drujlenvswomythgkp +xaeypwrhsikbtucdlgn +azylhrdkeftsnuwigcqp + +opzvefmcgst +epscmzofgtv +ozmtgevfcps +zgotvspmfce +tspzfgecovm + +uvsi +epgju + +srbpygw +sdwoyebv + +wiacz +aiwzc +azicw +wczxapi + +vria +rcvdah + +qvleubajx +buvqxealyj + +vegtzmpl +gslnxzv +dowlkygvf +gmvel +pgvzsl + +mp +k +k +ubo +m + +jdymxhqeszrfgo +iheugkxmrwsbynjadfvoz +oyjrtsgzmfepxhd +hdxlzryejmgcosf + +pndcs +cwdsp + +oceishrgqp +tsgphoje +zenpkougasl +hgorxeywsfpb + +pzejodvy +vyzdejop +ejdvyzpo +yozvjped + +mdjzibuqrvkecl +qcaejodxlgbvuiprzh +ajyzdvrgeqbiclu +ncslezwfutrvqjib + +n +o +s + +wnqftxaurblhpikmzjv +qxfyiwjnmhtbkpauzrl +cirtbjmpeafkudnhzwlqgx +ztrxfauslbjmqpwnihk + +xfrtleh +hkxzi +byhxj + +vloiwkeadbcqrgx +obldgwaymxjvqier + +dryhtpoawvi +inpaowhrtydbv +hyotdwvrip +vioytprwdh +qywoprdhgtvil + +vszuj +jo +mjpihxr + +y +e +a +a +a + +npju +jun +ejnuv +nuj + +fgpcswhmdixy +crxhiwkdmotpgnfysb +wgihuydcpmfxs + +acesgkpv +raosgpvc + +pcorf +pfcrol + +zsympkbl +psykzlamb +zylskpmb +yzlpksmb +yblzsmpk + +lrdgspoxqaywvjiu +swdjupvrixelgaq +xublsdjqyrpgvaiowe +jpgqmxalrsdvfuiw + +pxlfi +bdvsk +ne +eirhgn + +qsvrmp +aqgzys + +chpukadomensgfj +jlnepdzuok +dewnpjquktriob + +aqshxtgruwkzncoi +iwtxlnbzakoqcdu +qzxadiolmtunecjpwk + +vzasxecfdigkbj +acsdvefzijbk +yibvdcfujzasnke +fozvndsbcjkaie + +mjbdpsh +mbdypxj +mbypdj +cpmjfbd + +cjdvlgzk + +pwuskgtc +cktwugp + +stxgacjdnbezwoukhivlypr +zpieoljbaknyguswfxtcvhrd + +frqpswzajgk +tusgjqkapzfw +gazwfskqjrp + +yuqsj +hrwmgvkial +hernctopbzdm + +xudtjlakfqhepzm +kflzpjexdqamtuh +qtlmbdauprfovyhkexnzj +zkathjldumepfxq + +ltezfiwcsnxyg +zckxfelsgtywni + +hmlxoknayqwgtfs +hgfaqtlsxowmynk +salxqwnyfoghmkt +lfqyantmwgokdhxs + +hpcduo +odpcuh +dmhoupc + +vijeghudcaspxomwkyrzblt +kzrhpsabulxycodtemiwvqgj + +ydrcxhkwbenqj +xnkyqedhbcj +jbexydknqch + +jlqkisftwdahnpemcrb +wstfplujibdkcyqe +cfjiqlpyszutdwebk + +vhtumyxriocj +vcjyhrtmiuxo +xroyjemuictvh + +qlxymefuiwvbrgn +wqvlfixmngyrube +gmfnbewyvixurlzq +flwuxrmnvegyibq +vrqfbixlmnwjygcue + +znxadjwcqsihbfovupt +tsdjqraoxfuegcinv + +rjtsfzxhigdamkcqpb +enmawxiyuorclfsqv + +lagipb +sgapwni +vgmapix +pacligt +pirga + +jsnbm +wxlioajqbytr +vpghbj +mnkdjbu + +dvb +bdv +vdbh + +cmfkubsnwhvydl +kodmluyvbnscwf +ncuywdmlvkbsf + +wxzt +x +t +ga + +wyidutgqxcan +ktjcqgdy +yrtdpcqjg + +pfbdrmwtgv +vldcrbxwgfe +rbhpvfzgdmnw +vaorgqfdpbzw + +tdsyjbpkzwx +slnead +edqhrnsgia + +a +a +a +n + +zprvfqcgi +pvyfzgqbidl +ewxufqzi + +tsbaq +qatlsk +qtasf + +ewmsx +igawsxrm +wsxme +wmsxe +cmwzsx + +wovxhanyftglrkzmiscu +iufrvxzcyqjgebthmso + +em +k +k +k + +aerg +fedapg +ega +agme + +wroghldeqtnc +cgtnrdoweqlh +nogdrthcezlpqw +chdolwtgrneq +gowehqndctrl + +lrbvsgexaqptnfwjmcdhouk +rnjsuegkbxmwpcqflaohvt +gswokutqamfhxnrljevcbp +rufgtqlonsawmvjhbkcpxe +ubkcaolmvjsxhtenwfqrpg + +wexgind +nediwxg +dgeiwvxn + +pejqdczw +zwjepc +vjemowcz + +abzdgfhko +trvsjuqmx + +wnxjbcqogyfdzhitapku +ugczsntijqkwfyab +knjbwagltcyiuerfqz +fzwctuyigkajnbqs +rktyifgajecnzwqbsu + +jyidghp +jgyidph +dgjpiyh +pjiyhgd + +vdwrlxqbphykjmuzftcio +tmxifqbpyazncesrkouj + +fwildrejtbhzsknxpqyo +jyusnvtlowefhzdikgxrq +kotzwhsafniljdxeqyr +sxikerjqyaolzfhdnwgt +mkdnogzqwlrjxesiytfh + +bivzsuthgrpd +nphkubrq +wabukmhrpj + +nplkgxfhsaomrjuze +uhskaxfrnpmglzoj +jgkarmzonlsfphux + +mdhxznwoelckfgay +pxmbeohgnwyfacklz +agnzfexclwokymhb +mclgxfeoywkhnaz +enxjkczfomhayglw + +o +o +o +g +o + +pymldua +lymudap +malkyupd + +mhnx +xmnh +jhnmlx + +zmniyxufgbtjcvpk +gkzxcvbmtipnfyju +cnzmptbixvyfjkgu + +fxdbvymtgqnrozw +pgrmznsvtkfwuxboqy +xfmzvygabltrwqno + +pkgi +pmikeag +gkivp +ipjkvtg +kgpui + +cygobhesdxvpiutlajknz +zinkjdbeyhstlvgxpucr +xudegivwzpkjbqtycshfnl +egixvjubncaklzphdyts + +flepqzvch +hclvpqdez +vlctxzyhqpe +vehqclzp + +rchxbltygzekmudo +ercgl +jnacwglre +sclreg +galercp + +gsbtcuih +ubisvegatphdc +vtfiecsugxbdh +scrtibhugoq + +baxqpi +axrjiqbp +ixbpaq +qpbxfwai + +ogpedvhwuzbc +ltsfr +mjriax +rqkty + +s +s +s +s +s + +tuabpkqxvroyhjz +ptksvbyajurqoz + +aiz +ikza +izdva +azi +iza + +czpng +gpc +gumck +cgu +yxrsgetch + +ufz +xoicgj + +abt +erabt +gzbntw +tb + +ndvfc +xetilhb + +hvfxeqlwdkpozuabmijcygstnr +thfylcdbwnexovmzriqjasgkpu + +qodgh +ojqhdg +odmchltqeugr +qohgdp + +lyutwgix +whtcrdjnsvfe + +eugizoflxqjmrsdn +sdjofexzmigruqln +nqzrfimxsdjgoelu +rjfqosdglumxeizn +gdrmsjhoxeqfznlui + +wboy +wyob +obwy +woyb + +xofzdbqlernhvjip +dbmwjoflxipr +xriplfjobd + +lb +b +yb +b +bey + +jsuehvblciq +jivushbcqe + +jpdisezohtu +tjihdpozuse +dpuhztoiejs +uestoipdjhz +hejopstuzid + +ahqwolftrvz +rlckoaeumtjywsghbqxz + +elbjcwqpyfsrh +zgkixucotmnylavd + +ovwpgedlfajy +djaoulgepyvwi + +vxanb +kanxhv +uvxan +vnax +xnav + +vqhknrjeua +dvrjcqae +kqjvcrea +vobalfjpxgqr + +mfcaysjvl +iypgxdwzokbu +smy + +nsxhqofuk +qkjfox +xqwokfy +dkqfoxv + +ncprkyix +ijxykrnc +nykxirc +nkrcyxi + +vqylnfdcsgxu +cunqdlafgsyvx +cdfnxvjlguyrsi + +sxrklj +etma + +xpdgmf +dahxmpg +wernogsvlt +xpgqm +qgkb + +avcmxptndkowj +aoduwpjktcnvx +xwtcovnpakjd +wzdvcpokjxnast + +twobeiakfrmpgjdyqsn +owmfryguxadcnebkivhl + +hevgwtocbdkz +hbkoavxzdcetw +oesktmwdvyz + +anmzwy +mknwazy + +aendgmvjolfzy +jgfnbymvoeadczl +ybdmpofnralgzjve +naolymjwvzedfg +goxnvmfalsejyzd + +qrcbadgel +hoseabdjrg + +muar +trwum +umrw +umt +nmgsfucjlyipbk + +iolqwxkjzcpsg +xjkbfplzqin + +nsiuqctvbf +ycwqgokibud + +wi +srnvx +asrx +ax +s + +nolmhubsafxjgc +wancbvsjmqkxzglu + +lr +lr +lr +lr +hlr + +hwcjl +anbqmskw +owiyl + +sk +sk +ks +sk +sk + +gishwxe +plfkxmbyhzjwvtoad +nuehwcx +rhwxq + +xemwhdsozfqtvajcnk +osjueztdcxqhrvfnmwk +kncxosjfwdhrtzmqve + +av +x +u +g + +sehzwjqgfxicamkrnbp +wznemrfajqxhpkcisgb + +whq +h +h +h +h + +pwhltnxiq +xhpiwnlqt +tipqwnxlh +wixtqhnpl +pwqxintlh + +dqmxibuv +vdxqiubj +vnadfxquib +uixqbdv +qxvdibu + +qtzgodpv +zgfkvqtdp +ztdqvmbpgo +tpdvziqg + +syml +mys + +htuseaxzln +uxlnzatseh +sznaxutleh +thxzealsnu +ltzuahxnse + +bh +bu +bu +onwb + +xidlsobaqgh +rxdgouqslbach +bxvsqoglhad +qepgdkxowblajhsnz + +vizqmhner +zynmvedi +szbmnewvir +nmfvtpwize + +csazebwqdmtrolvxinphf +ynfjamsqlcgpwohu + +rfld +dlf +ivklhozd + +piyxdelnma +eclroyapnbvudfmtsx +yimadzlpexnq +xkgedyqlhmpan +yxnhalepmd + +mwyskbjad +opmdbhskcjxyuwe +fsrjbywgdnmvikz +sdymbqtkwilj + +bipr +kwbjotea +b + +ugokxmcabzp +wslrjept +plfviewy + +owvkzbdijtnpfhl +eondwjtgkbli + +hgdjzupisnwmvtxoecyk +gyopdewzvtjxckmisnh +dpmtvocszigjnwkhey +wdphmnelgqjtksfciozvy + +wludkmqjnpxvyigboasrc +fsjolrybcgqivwxpudmkan +dowxgcirmjapsvuylnqkb +baulnkrcqgijvsyodpxwm + +gbxedknljayfhcvu +xztjkfeblgiqvydau +gvlksybpemdxjawiuf + +pds +ldfs +shg +sa + +oyhipj +pdohywb +paqlhou +omrgyphtwd + +puexjovza +bgvcejrisy +wrejvq + +swzkvxtafnqyi +wksiqxzvfnyta + +buxsqlordam +ixslbpnfvtukahze + +zvnbreaqmwsodcy +vmwsadyobqznrec +ebvmawdrzcnqsyo +cbmwoaynszdvqer + +vxdzibpaw +avsfegby +akvbc +zabvu + +dhlxsy +ldyxsw +lsayzx +yxsjlh + +xtbe +plj + +n +m +owx + +ali +md + +jmi +jl +jac +lj +jlc + +whjagdblr +wdhrgbajl +jahbewndlrfpg +warljgdvbh +grsldajwbh + +ubi +dwb +lnb +pbx + +nmsjacwzqdh +pbfkugeytoi +rkvxl + +vdx +bndx +xvd + +nezmhlw +exzmwgslhuon +wtemnqhpliz +fnedlbkvwmhzg + +zcvoarqi +uqg +thqg + +qedaghsxln +csxldqen +denxhyqls + +blegpfuaznrdhoj +zghslinmvxejroaqp + +yjev +eyvj + +xhnqtvlaewfgupyrz +zghfpnxtyelvaqurw + +bsno +dovpt +glfjzw +hxmfc +iyrkqu + +ta +l +m +brq + +ezchvnpy +jphbyvcrze +vychzep +hytcpevz + +wurmizf +dyqlwmuvi +uimbw +euibwm +zmiuwhae + +bdngyolcxipva +gswmucjby + +xzrkwep +njblugmhqvrsizw + +dijwksuhyrefmbtzp +wsrtempdbijykuzc +bewszdumjptcyrki +dmbjkyzwpcesruti + +utameknglfxci +ohmnetvqjsawbik + +ves +s +qbpkiywt +gfe + +eogztnu +monutzeg + +fjqvucdoz +cfzvuyodqn + +j +t +j +j + +xwcpkudjagnzmto +czjgdnwmtkxua +xjnkcwglzdutma + +g +fisteknohd +xmg +uxrqz + +y +y +y +y +y + +yebaxitskm +txljeyaimok + +wytxl +w +wj +w +w + +y +ym +y +y +y + +tuqacpofz +afzuotp +autzfpgdro +oufzatp +asnzfuotp + +fmxcdtakjqsolvnwzpre +cwslxozmedvqprakft +zcepkrqaowsxdmlfvt +adkrcltzfwqomxepvs +cftdkzsuvxwroelapmq + +vnukwf +wfu +wuvf +uqfw +fucw + +ucezxlv +xcluzev +ecuizvxl +veluxcz +zexcvlu + +cfdzeomh +hzfmde +lnrmhzifd +mzfdh + +imklvjabtqdxcw +dqtmiwjflcavkx +tldzxkqnmwjcsavi +lrvfgtdcjxakpmiwq + +hfgvjpminkouyscxdwzle +fimyuswanovkdgzelcjxthp +cyhigexozldsvknfumwjp + +obgv +bvo +orgvb +xpvsboau +bov + +tidn +ljs +rly +oljsrah + +hlpkbqo +oklbp + +upsfvhjeqiolra +pfjovuahelqsrim +yqanieuglpvojsrhf + +rzlsoiwnmfjxac +ajvextygdhwum +jqmpaxwt +mygwbjpeaxdk + +dnkilgqrscye +khlzdxpbwo +lgkrdm +lvdtgk +sfdklmtj + +u +u + +kctfengbsqdjy +jtsehoqfbgix +aweqmugpzr + +gfkxci +iocxfu +mdxneihrfqcj +csiopxf +uyitxfoc + +w +q +vjgesf +zkpxc +n + +aiqlfegkx +rboptwvjsnu + +ysamgbzc +bczsga +daubcszg + +dufvmajroptly +hsdwlyp + +ogjwnmhktvubi +uigwtjkb +kqwiuetz + +fmdwnscru +yli + +cnjr +rcjn +jncxr +jcrn +rjnc + +tjzqs +jblstz + +rmxcinhbeql +mrfbtlenquhxij + +n +g +bwh +rju + +mdol +mdol +dmol +lomd +modl + +apzodfktx +zjkopdtxfa +oxjfakptzd +owdkacxupzyft +aofkzpdtx + +jmibuxvgcodkrewfnasz +fsrzunjcbxdmweakigvo +axkedgfubjczvowinmrs +gruxwiscodkavjefmbzn + +mqpubxrzhktcfj +hotqnigsavzeylmd + +ntmkpjuzcilgd +hpdugjkqltzxnmci + +dxwbfonuvjaskyeqzipctrlh +wkcxydvhiaurbqepotljnzsf +tafgehdurxybzwpkojvlscnqi + +af +f +f +f + +povwrfhklm +azvixotjbegsy +svjnocd + +ysfeukcdrbxnl +scpyrextbwokdufn +skcudxneqryfbl + +hmwbzcodtijqavxnsyl +vlpcaqyjsfiortmhz +hvmizletopsjyaqc +vmqajlgostizyhc +kvcoqmajlyzhist + +x +x +x +x +x + From 9b505dc8d6aaaf8856dc66b18b05351b64c2bf77 Mon Sep 17 00:00:00 2001 From: trotFunky Date: Thu, 17 Dec 2020 17:39:24 +0100 Subject: [PATCH 08/28] Day 6 of 2020 done in Python --- 2020/Day 6/Solution.py | 46 + 2020/Day 6/input.txt | 2044 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 2090 insertions(+) create mode 100644 2020/Day 6/Solution.py create mode 100644 2020/Day 6/input.txt diff --git a/2020/Day 6/Solution.py b/2020/Day 6/Solution.py new file mode 100644 index 0000000..d0719a0 --- /dev/null +++ b/2020/Day 6/Solution.py @@ -0,0 +1,46 @@ +input_file = "input.txt" + +answers = [] +participants = [] + +with open(input_file) as group_answers: + line = group_answers.readline() + answers.append({}) + # Count from zero as the last line return is for the group separation + participant_count = 0 + + while line: + if line == "\n": + answers.append({}) + participants.append(participant_count) + participant_count = 0 + line = group_answers.readline() + continue + + for character in line: + if character == '\n': + participant_count += 1 + break + + # Count answers for each questions + if character in answers[-1]: + answers[-1][character] += 1 + else: + answers[-1][character] = 1 + + line = group_answers.readline() + +print(f"The total number of positive answers is {sum([len(answer_dict) for answer_dict in answers])}") + +sum_of_all_yes = 0 + +# Compare the count of yes for each answer with the count of people in the group. +# Do so by iterating over both arrays at once and then iterating over the keys of the answer dictionary. + +for index in range(len(participants)): + for key in answers[index]: + if answers[index][key] == participants[index]: + sum_of_all_yes += 1 + + +print(f"The total number of positive answer by each member of each group is {sum_of_all_yes}") diff --git a/2020/Day 6/input.txt b/2020/Day 6/input.txt new file mode 100644 index 0000000..e965d96 --- /dev/null +++ b/2020/Day 6/input.txt @@ -0,0 +1,2044 @@ +c +jc +ck +cue +c + +ysjircxtgfzpb +ynsxpgtcifz +riydpzsfxutcg +gsyitzdvpfcrox +yclxfzietsmghwp + +bacqdjhsf +fhbdjacsq +tbjmcxlqashdfo +hebjascfdq +bgqjscdfha + +pt +tp +xtzn +tu +pt + +zjn +nzj + +h +h +rzh +h + +cfqurmlxnzhpy +wjaufshgemktox + +ah +ahe +tvhrq + +awbte +tbawjen +wtubea +wjaebt +ewtab + +vlz +lv +vrqyl +lv +elv + +rfu +rpujz + +foniw +nfo + +kaumhjywgtvzndcire +qulkzxoinadvtbgymh +vgdzlahiounmykt +tkglyzdunsvmhoxiaf + +rxmdbgikaywentqvzhfolcpuj +enipkytvdmbgqzaufjxlohwrc + +gdhiqazwcv +mouqpltacvw +dcvyqhwfaj +wbhgaevcqn +vawqkcxr + +dmtaowgp +mwtdipa + +rvpwoshm +osvprmwh +smwpfvhr + +axmhdqzctfspgeu +zpmcauexshtfdq +dqfmteacshpxzu + +ptryjvufglaxmqwonck +nupfyjrwktlmxaqgvc +tjgapcflbmuynqwvxrk +rwjgnauflvymcotkqxdp +sejyrkqtwalhncxuvfpmg + +kjlucpqysrbe +cotlifeqgmspzkdr +prasckbluqe + +svjwcigopdflhy +corvxsaigbflwheyqzuj +dfclkgmwsvyithoj + +sxrynelg +elygxoms +glmexyt +uyxfgelkb + +cljshbxnaeqrivupwtgz +qplrtgeshxviaunwcbz +whcxivzgtaneqpsrbul +lvgzibncxwrdopqeatuhs +zlqcvbmrsktwpeaxinuhg + +fngcrihykv +irhgfkvcny +ivpcfgkhrny +ckhyirdfngv +vnchisygrkf + +rsqmk +kufbscval +yjksih +jksmo + +knszclmhryfvgdtwj +jhrwzlgdfyqcv + +ulbyhi +yqhuzsim +hkienuwfcy +yuhpio + +nqblomzhgtikdwjpcasyvuexf +kngcjvymbzqoahesfi + +xlebgtjpz +svlqfwkuaipbmc +rhgxplndb +lpzjbyo + +rzqpashvw +dmlcoq + +hkxi +kixh +hikx +xhik + +pljraokdmec +zhtdrlaqfgbnue + +peofrnkgauhzctwldjb +tgnbokrjufmshd +ygktbmnuodshrfjx + +bfzqvolaymsxue +beyvlnfsqzuxao +vfozbaisjyexhqgclrwu +fsxpaobulvzyeq +flzxbesauqvoy + +jipavclbehxrngdwsk +mkjshalwdxqntev + +ixrtj +wcmxij +mjwix +xzvjghbdnuqi +ixrjs + +lroxesmfqdbt +qtloefydr +lerfqivnjodt +eokdmftlxqr + +akow +ka + +pnjkvoxatm +jmktpoaxnv + +ufejltwq +teqfljuw +twqjufel +eultqwjf + +ucoleqmyxfwzhnriskt +lnkfuiythsxrzwemocq + +fvwakuorhpzyjmxl +ahltpwjozkxmf +wkpjzfhmdlexsao +jxolzknmhpwcfa +lfjhtsxqkmwoazpd + +guoytrawsiexknq +gopukszvctnjbai +iaglmuotnsk +kgdisuotafn + +pdtsnx +ns + +ign +ngi +ding + +dhryg +cksn +ih +ebpo +qxs + +bavsrfcntmgqxu +fxbnvpasmuogqc +gcusamnbfqxv +ikmnhvybqgxcdfusa + +k +jk +k +j +nh + +mjsfl +omisj + +umdoiqabcrhlyf +olymbihfdusaqc + +wuvymbghitrelazpok +gsmrepwzkuthbvil + +gfdjb +gbfjd +fgjbd + +jdxghipmorlvfzw +zqlcjwfrbvpoxmid +enwrflodjzstapmuyik + +laiegdk +nvhqlgz +xscuf + +ubtdong +nubdysrg +dgubn + +n +n +oycw + +dmlewthyrqnkxagvszb +vdgkyxabtqhnzmsewlr +hdbxnvtwzyspkqagmelr +hnzlrtywdfaqsjbemxgkv +mrkqbdsyaegvzlwxtnh + +rkouvs +kpobrgq +cxknfrow + +uyve +uyve +yvuce +vekouy +euyv + +avgoinutrxjymlpbqwhsek +pwirvaostmgjukxnqhebyl +okndimpehgtlsujqaxbywrv +anbvohsetlpqirxyfjkmwug +jqenglrhkuixbyapmvtsow + +zbos +szbo +szbo +obizs +zabso + +dstiveo +edsivo +evodsi + +vimbcytwuzajlqogpkfrexd +jdubvxkeofqrgzytipncla +gpkqrlyofaxzictejuvdb + +db +cbd +db +db +db + +k +k +k +k +k + +wqo +qo +oq +qoc +likmqoef + +vdfrjn +orjfna +fmrjnd + +iyashplx +haslxypi +ahpsxyil +yxhliaps +hiasyzpxl + +ucdlfx +lcxudf +cxdflu +dcxulf +fxlucd + +etfhylmiajvcdxnqbps +fastbwphiqdlruxymcokv +tsxfidhcymqapgblv +spzhavtmdqgjlyicbxf + +jxc +cjb + +cowg +qxzwajco + +rypjntgd +splna +pxuvcnke +ljpmznwrdft +podn + +uowirdqvc +gtpimard + +hntmubdlvspagxqy +ycbfnkjrzw + +bjvnyau +uakxynm + +danpzlubyhgsfxtkvjriewo +fahtkzslbpwyijongvrxud +galonbkpxzsdwtfrivjyuh + +gspxvjoq +oiqzjv +gqpjov +qjvonr +ujmahqyeobv + +gzuovxlmwhjbesqipak +tcjkrfanexgudqsb + +xkvgzaqfeih +vkqgiezcfxh +hzxkfvqgei +kxigvqhezf +yxgzkhefdivq + +ypaof +opya +yaop + +tiefwhqyzxr +tljiwxyeqhrzf +qezwhtsifxry +zfrpxeqytwhi + +fbscaxrhpdeqz +rehxpfg +fhroxep +kpxhtref + +tynqhrdulomfxazgipjb +oltrqiwcfjaspvuekn + +epbvtfldsixj +xcdnzbetv +zbvltcadx +txzbmvd +qktdovwxuhb + +uqtewcsrdiyphkxjvboz +hovsxtqckzurwipyje +xcpwthszuiknjoyqevr + +bqckxnvtdfspzu +vcfdanxspzkqtbu +dxckstuqvzynbpf + +hjus +oxsuhj +hjsu + +bxait +bftijxaw +tabix + +gvmdl +kfla +utpywqrsz +ngol +xiha + +ydvxqtkarigh +iohkgyczqtdrxs + +pzhxoytmave +xzamvptoyeh +stimxyevapzoh +vxmohptayez +hlvpyamoexrzt + +vdjsy +dsyv + +wedcxpt +viawqdpefco +cesudwp +upwtdceg +pweucd + +u +u +u +u +u + +unwkls +fkuanylm +lumank +eqlorxcgkuvtn +lzufnkh + +wembhayqcks +bksyqhceamw +qwceskyabhm +iwekfymbchqas +sormjywlhbzupckaeq + +krtohjcvxidyfm +sewgzil +piwbza +uqib + +ghpnicabeuroftvkyzm +raionvykhtfcbpmzgeu +tnzgcvubrhaefmkpioy +pvfnetiycurkomazgbh +honmbpfvzctkiryaegu + +q +h +jdg + +bykvmpgojzwlrcexi +yzwerjpcbgkivoxlm +ecvyijmbpzwrkxgol +wyjripkzlmcxgoebv +ljzcrwoemkpgisxbyv + +ugmaicqtejkbhsx +xtahjbsimcqukeg +ximchajkfgtvbuesq + +nrqfdcghioslp +lzsrthgfndoip +drslpfgniho + +q +fqb +q +qfdz +umaxtq + +joucqnzsgt +jgquo +uoqgyjpb +eojlqgu +ujgkwqo + +lhcrnxkogepw +wheorgpcnxkl +wrexgponhlck + +chgqirekozbypjst +hyqdvsjbrctzgpuoi + +fylsimtuvad +ytgdhicfjauvml +vafiuldmtyp +uptifdslmvay + +obkuc +wnm +rvgqdayhjte +x +pfs + +yrkv +rdvyt +fynrejcw +yrdk + +dfqnchypg +hgypnfdqc +pcqhgydfn +qcgfjhndyp + +b +t +t +t +t + +ehajgwscibr +uhdcmiwbjr +irbknwjhc + +gihcrjazpld +adgsnzjxlihrp +lzfhgdajpir +rgzlhnjqidpa + +rzpvjmbuac +qwbgmzurcpj +ujpmzbfrc +mucbrfzjp + +fu +fu +uf +fu + +tliwkzcanyjebq +mealtnofizcqjbsw + +eakbolcjugnmwdhrzy +elumwbzorjhnkcgayd +arnhycmjebduwgolkz +zbwaklmordhcgejynu + +ysnalmr +lsynrmf +simnbrfl +lsnimr +kmqlwsrxn + +ozbdtcgifhe +iocmtzdgefvh +efcgtdihzo +oczphgetlfdi + +wumdilea +jyahzgspq +iba + +wsonzrb +rboszwn +ozbnysrw +wbznros + +wzumjfrvscpq +cliwvsqbfzpeoru + +d +tdpm +rd + +vgnpfu +kgpaqictf + +phjlzk +pu +up +iwp + +edsbcnioxqlafupywkh +lfbqrhnxiseacyjkpow +xgeonhfqcybsapkiwrl + +wvczikeobyuamfpd +bxroupgizjkaytcmenwf + +q +q +q +kq +q + +eintqz +tqin +qitys +tifqxkh +qitsmv + +hdtzoyjrqkwpalv +owzjvahkdqlyprt +jhoywtdvkrpazlq +oyzavltphdkqwrj + +sxgfl +fxlge +glfx + +ntozcvdqes +ordesnczqtv +ntedczuvqos +svtaeodcznq + +lcpoi +uxinkaol +eyoila +owliy +jzhqdtlirmfsbgvo + +mje +jem + +kqunjoi +jiuno +oinju +tohinj +uionj + +o +pcgodj +oi +o +osi + +sqvmoejdgibuwyxrknfzapt +czlystrwjvpef + +ybtaflcopmirjdusxzvkhq +zlevmpqauroticjhbgkxfd +frumxlpzqivcwthkbdaoj + +wdivrf +fzritwjn +eioxqhkyfs +fiv + +gvs +scmrg + +vzgt +tzg +gwozt +wgzto +gtpdz + +rvh +r +zr +r +rdw + +fqkxosbgwynic +csfikqnbxgwyo +kogibcsqynfwx + +rpzsjhlaefxbvmodunigw +pxwgvfdlonieamhbsrju + +prgk +hepxkrvgi +kprg + +esfjanprvxzugcqdyowimhl +ktihxpnvwzogrclysbqadme + +cdykos +disycok +kdysloc + +chgzpxym +xhpgmczy +ghcyzpxm +hcpxyzgm +gpyxzchm + +pvkzy +pvgkxy +pyquvfcl +ywdvmhprena +cyvupq + +tyobwsehjrfunziqmg +cwujptqkreodvmfa + +r +nb +c +dktyap +sn + +maqevwtijbnlp +vrlkjawbmqnipt + +phizanuolbfgrt +bzipnauglforht +oignblthfapzur + +fd +d +d +d +d + +razemjtpsxgiq +peqmsarxgjwizt +ixjtzeargmpsq +itqermazxsjgp +ztmiqsxajerpg + +i +p +pu + +itkxhb +buxki +aicksxdpb + +qpczutx +gczjuhtq + +txqncbg +qtogvjcb +gcqrbt +bcaqrtg + +eqtwvkrnhusy +njtsqhwru + +ua +akcq +ai + +mgdcoxrnwvletpkbusihy +bdmslhpkgonvreiucyxtw + +lfoazxqyw +yrpbmnkceu + +j +j + +uwrzpvaxindebtloch +izvoxwbpuanrchet +tmrakvncphwiezobxu +pwruaixbhctvzedlon +rsebuowhxigtnjpcvqaz + +msnvf +ajx + +vgahuqimkblfyjexotp +hygaiepjlvuksmxoqfbt +ytlhbfmkoxujgedpvaiq + +xcdv +xgv +vxlu + +km +m +mfk +cyqwm + +rawphceqti +ylgmjconzbvsu + +lwy +ywl +yldw + +cmgsiykfd +icmgksdyf +mcdfsgiky +imksdcfogy + +avptxrnwubqi +vunbxwldt +vzkocbwn + +svhkjpfmzudeyc +hpmugixtezkavjd +zeqpxvmhdukj + +tw +ztw +wt + +bwfjxu +tjfvwub +ubnojfw + +ktnipjyeq +tkiwyb + +wmhqjc +hjwmcq +mhqjwc +hmjwqc + +hkzjgb +hgbjk +ghbjkz +kgxfbjyh + +ofwinqzbmkjgdxv +clbfwtozkiaugdvjnpqeh + +qmdrsbjeptgkw +wpnqkregtd +kfqewhdlgirzp + +sgqkuptxlvic +jkpgsxbt + +mvfik +xnljsuek +kibrpzfh +bkmcwr + +qzyv +yvmzq +qvz +zqvg + +vxjbaeirnylzhocpkqwstd +qvsuyerpthjwbcaizlxodkn +ozsaxtledcyvwpkjngbrihq +csvirwzhjoxlbnkqdtyape + +b +coxe +u + +kexawtfpg +guwfptxake +xpkgfteaw + +tgnr +nrgt +grnt + +kludgpxi +gkdxrp + +aibgqykuvs +bzgausdvwciq +qvbsgniua +iusqjvabg +bpvusajiyqg + +w +xu +kbu + +u +u +u +u +uoei + +zogb +ob +ob +boe +sbo + +cs +zm + +oleqm +oilq +qmlo + +woxzdcshnl +ldoshwxp + +ntkbjxpqwhlmecsrdga +qpebarkoizywsxmlfgdju + +mxk +yxm +kmx +xym +xzvmb + +nl +no +on +n +n + +fqlyezxtjgoa +hyeoatksq + +khtj +asmu +thkn + +t +z +z +m +z + +tyz +tyz + +gkmdubiacx +imjkudgcx +gdumcxik +gmuckidx + +iysarmnfphgctzj +hngozfpmstayj +yaskgvuqmdzhfnpbexjl + +edwvrzuloqfsctim +wromkzfdaicelvqnt +wokdiecqtvrsnmuf +kemtocfqvrdisw +owjdtqicxyfvgremhp + +ihdrnakm +andmkri + +ojetcq +aubtkl + +qsyfchx +hykvzfg +xye +rlwioyj + +odzqbvmlrfkjgye +vwlojbqdanrxtsyk +dohigvpjqyblkr +ulocbvjkyidqrp + +ketyogpsabhzwxiqfl +jixcwguhefqzkmbdolatn + +pko +kpo +pko + +wm +wm +mps +m +mw + +nghwmdf +hmfdgw +hfmgdjw +fmhvgdjw +dgwjfmh + +umnkpzedga +gpokqdzmeun +mhctzkgnuebdp +jpszkgeyunfdrxm + +bfcdysziphquxvmjagen +zfduabihvnqgpjsymcxe +nzabmuxyvijqfcedgpsh +hpsxnacvfdqguijbtzmye +cbsevkuanpdhmqifzjxyg + +hrjlbfwq +rfjwqbhl +fojqbkhlm +qfhjbls +qhlfcwjbu + +vfjicx +vjicfx +fcxjiv + +j +uc +n +q +q + +bmrvzsa +eaoqubzxmrnf + +yjnvze +najyvtze +zynvej + +wf +fb + +bejpn +bpnje + +o +yc + +jwhsena +uw +utwn +nwc +xmvw + +htsqagwko +lydzerxjunvifpm + +drujlenvswomythgkp +xaeypwrhsikbtucdlgn +azylhrdkeftsnuwigcqp + +opzvefmcgst +epscmzofgtv +ozmtgevfcps +zgotvspmfce +tspzfgecovm + +uvsi +epgju + +srbpygw +sdwoyebv + +wiacz +aiwzc +azicw +wczxapi + +vria +rcvdah + +qvleubajx +buvqxealyj + +vegtzmpl +gslnxzv +dowlkygvf +gmvel +pgvzsl + +mp +k +k +ubo +m + +jdymxhqeszrfgo +iheugkxmrwsbynjadfvoz +oyjrtsgzmfepxhd +hdxlzryejmgcosf + +pndcs +cwdsp + +oceishrgqp +tsgphoje +zenpkougasl +hgorxeywsfpb + +pzejodvy +vyzdejop +ejdvyzpo +yozvjped + +mdjzibuqrvkecl +qcaejodxlgbvuiprzh +ajyzdvrgeqbiclu +ncslezwfutrvqjib + +n +o +s + +wnqftxaurblhpikmzjv +qxfyiwjnmhtbkpauzrl +cirtbjmpeafkudnhzwlqgx +ztrxfauslbjmqpwnihk + +xfrtleh +hkxzi +byhxj + +vloiwkeadbcqrgx +obldgwaymxjvqier + +dryhtpoawvi +inpaowhrtydbv +hyotdwvrip +vioytprwdh +qywoprdhgtvil + +vszuj +jo +mjpihxr + +y +e +a +a +a + +npju +jun +ejnuv +nuj + +fgpcswhmdixy +crxhiwkdmotpgnfysb +wgihuydcpmfxs + +acesgkpv +raosgpvc + +pcorf +pfcrol + +zsympkbl +psykzlamb +zylskpmb +yzlpksmb +yblzsmpk + +lrdgspoxqaywvjiu +swdjupvrixelgaq +xublsdjqyrpgvaiowe +jpgqmxalrsdvfuiw + +pxlfi +bdvsk +ne +eirhgn + +qsvrmp +aqgzys + +chpukadomensgfj +jlnepdzuok +dewnpjquktriob + +aqshxtgruwkzncoi +iwtxlnbzakoqcdu +qzxadiolmtunecjpwk + +vzasxecfdigkbj +acsdvefzijbk +yibvdcfujzasnke +fozvndsbcjkaie + +mjbdpsh +mbdypxj +mbypdj +cpmjfbd + +cjdvlgzk + +pwuskgtc +cktwugp + +stxgacjdnbezwoukhivlypr +zpieoljbaknyguswfxtcvhrd + +frqpswzajgk +tusgjqkapzfw +gazwfskqjrp + +yuqsj +hrwmgvkial +hernctopbzdm + +xudtjlakfqhepzm +kflzpjexdqamtuh +qtlmbdauprfovyhkexnzj +zkathjldumepfxq + +ltezfiwcsnxyg +zckxfelsgtywni + +hmlxoknayqwgtfs +hgfaqtlsxowmynk +salxqwnyfoghmkt +lfqyantmwgokdhxs + +hpcduo +odpcuh +dmhoupc + +vijeghudcaspxomwkyrzblt +kzrhpsabulxycodtemiwvqgj + +ydrcxhkwbenqj +xnkyqedhbcj +jbexydknqch + +jlqkisftwdahnpemcrb +wstfplujibdkcyqe +cfjiqlpyszutdwebk + +vhtumyxriocj +vcjyhrtmiuxo +xroyjemuictvh + +qlxymefuiwvbrgn +wqvlfixmngyrube +gmfnbewyvixurlzq +flwuxrmnvegyibq +vrqfbixlmnwjygcue + +znxadjwcqsihbfovupt +tsdjqraoxfuegcinv + +rjtsfzxhigdamkcqpb +enmawxiyuorclfsqv + +lagipb +sgapwni +vgmapix +pacligt +pirga + +jsnbm +wxlioajqbytr +vpghbj +mnkdjbu + +dvb +bdv +vdbh + +cmfkubsnwhvydl +kodmluyvbnscwf +ncuywdmlvkbsf + +wxzt +x +t +ga + +wyidutgqxcan +ktjcqgdy +yrtdpcqjg + +pfbdrmwtgv +vldcrbxwgfe +rbhpvfzgdmnw +vaorgqfdpbzw + +tdsyjbpkzwx +slnead +edqhrnsgia + +a +a +a +n + +zprvfqcgi +pvyfzgqbidl +ewxufqzi + +tsbaq +qatlsk +qtasf + +ewmsx +igawsxrm +wsxme +wmsxe +cmwzsx + +wovxhanyftglrkzmiscu +iufrvxzcyqjgebthmso + +em +k +k +k + +aerg +fedapg +ega +agme + +wroghldeqtnc +cgtnrdoweqlh +nogdrthcezlpqw +chdolwtgrneq +gowehqndctrl + +lrbvsgexaqptnfwjmcdhouk +rnjsuegkbxmwpcqflaohvt +gswokutqamfhxnrljevcbp +rufgtqlonsawmvjhbkcpxe +ubkcaolmvjsxhtenwfqrpg + +wexgind +nediwxg +dgeiwvxn + +pejqdczw +zwjepc +vjemowcz + +abzdgfhko +trvsjuqmx + +wnxjbcqogyfdzhitapku +ugczsntijqkwfyab +knjbwagltcyiuerfqz +fzwctuyigkajnbqs +rktyifgajecnzwqbsu + +jyidghp +jgyidph +dgjpiyh +pjiyhgd + +vdwrlxqbphykjmuzftcio +tmxifqbpyazncesrkouj + +fwildrejtbhzsknxpqyo +jyusnvtlowefhzdikgxrq +kotzwhsafniljdxeqyr +sxikerjqyaolzfhdnwgt +mkdnogzqwlrjxesiytfh + +bivzsuthgrpd +nphkubrq +wabukmhrpj + +nplkgxfhsaomrjuze +uhskaxfrnpmglzoj +jgkarmzonlsfphux + +mdhxznwoelckfgay +pxmbeohgnwyfacklz +agnzfexclwokymhb +mclgxfeoywkhnaz +enxjkczfomhayglw + +o +o +o +g +o + +pymldua +lymudap +malkyupd + +mhnx +xmnh +jhnmlx + +zmniyxufgbtjcvpk +gkzxcvbmtipnfyju +cnzmptbixvyfjkgu + +fxdbvymtgqnrozw +pgrmznsvtkfwuxboqy +xfmzvygabltrwqno + +pkgi +pmikeag +gkivp +ipjkvtg +kgpui + +cygobhesdxvpiutlajknz +zinkjdbeyhstlvgxpucr +xudegivwzpkjbqtycshfnl +egixvjubncaklzphdyts + +flepqzvch +hclvpqdez +vlctxzyhqpe +vehqclzp + +rchxbltygzekmudo +ercgl +jnacwglre +sclreg +galercp + +gsbtcuih +ubisvegatphdc +vtfiecsugxbdh +scrtibhugoq + +baxqpi +axrjiqbp +ixbpaq +qpbxfwai + +ogpedvhwuzbc +ltsfr +mjriax +rqkty + +s +s +s +s +s + +tuabpkqxvroyhjz +ptksvbyajurqoz + +aiz +ikza +izdva +azi +iza + +czpng +gpc +gumck +cgu +yxrsgetch + +ufz +xoicgj + +abt +erabt +gzbntw +tb + +ndvfc +xetilhb + +hvfxeqlwdkpozuabmijcygstnr +thfylcdbwnexovmzriqjasgkpu + +qodgh +ojqhdg +odmchltqeugr +qohgdp + +lyutwgix +whtcrdjnsvfe + +eugizoflxqjmrsdn +sdjofexzmigruqln +nqzrfimxsdjgoelu +rjfqosdglumxeizn +gdrmsjhoxeqfznlui + +wboy +wyob +obwy +woyb + +xofzdbqlernhvjip +dbmwjoflxipr +xriplfjobd + +lb +b +yb +b +bey + +jsuehvblciq +jivushbcqe + +jpdisezohtu +tjihdpozuse +dpuhztoiejs +uestoipdjhz +hejopstuzid + +ahqwolftrvz +rlckoaeumtjywsghbqxz + +elbjcwqpyfsrh +zgkixucotmnylavd + +ovwpgedlfajy +djaoulgepyvwi + +vxanb +kanxhv +uvxan +vnax +xnav + +vqhknrjeua +dvrjcqae +kqjvcrea +vobalfjpxgqr + +mfcaysjvl +iypgxdwzokbu +smy + +nsxhqofuk +qkjfox +xqwokfy +dkqfoxv + +ncprkyix +ijxykrnc +nykxirc +nkrcyxi + +vqylnfdcsgxu +cunqdlafgsyvx +cdfnxvjlguyrsi + +sxrklj +etma + +xpdgmf +dahxmpg +wernogsvlt +xpgqm +qgkb + +avcmxptndkowj +aoduwpjktcnvx +xwtcovnpakjd +wzdvcpokjxnast + +twobeiakfrmpgjdyqsn +owmfryguxadcnebkivhl + +hevgwtocbdkz +hbkoavxzdcetw +oesktmwdvyz + +anmzwy +mknwazy + +aendgmvjolfzy +jgfnbymvoeadczl +ybdmpofnralgzjve +naolymjwvzedfg +goxnvmfalsejyzd + +qrcbadgel +hoseabdjrg + +muar +trwum +umrw +umt +nmgsfucjlyipbk + +iolqwxkjzcpsg +xjkbfplzqin + +nsiuqctvbf +ycwqgokibud + +wi +srnvx +asrx +ax +s + +nolmhubsafxjgc +wancbvsjmqkxzglu + +lr +lr +lr +lr +hlr + +hwcjl +anbqmskw +owiyl + +sk +sk +ks +sk +sk + +gishwxe +plfkxmbyhzjwvtoad +nuehwcx +rhwxq + +xemwhdsozfqtvajcnk +osjueztdcxqhrvfnmwk +kncxosjfwdhrtzmqve + +av +x +u +g + +sehzwjqgfxicamkrnbp +wznemrfajqxhpkcisgb + +whq +h +h +h +h + +pwhltnxiq +xhpiwnlqt +tipqwnxlh +wixtqhnpl +pwqxintlh + +dqmxibuv +vdxqiubj +vnadfxquib +uixqbdv +qxvdibu + +qtzgodpv +zgfkvqtdp +ztdqvmbpgo +tpdvziqg + +syml +mys + +htuseaxzln +uxlnzatseh +sznaxutleh +thxzealsnu +ltzuahxnse + +bh +bu +bu +onwb + +xidlsobaqgh +rxdgouqslbach +bxvsqoglhad +qepgdkxowblajhsnz + +vizqmhner +zynmvedi +szbmnewvir +nmfvtpwize + +csazebwqdmtrolvxinphf +ynfjamsqlcgpwohu + +rfld +dlf +ivklhozd + +piyxdelnma +eclroyapnbvudfmtsx +yimadzlpexnq +xkgedyqlhmpan +yxnhalepmd + +mwyskbjad +opmdbhskcjxyuwe +fsrjbywgdnmvikz +sdymbqtkwilj + +bipr +kwbjotea +b + +ugokxmcabzp +wslrjept +plfviewy + +owvkzbdijtnpfhl +eondwjtgkbli + +hgdjzupisnwmvtxoecyk +gyopdewzvtjxckmisnh +dpmtvocszigjnwkhey +wdphmnelgqjtksfciozvy + +wludkmqjnpxvyigboasrc +fsjolrybcgqivwxpudmkan +dowxgcirmjapsvuylnqkb +baulnkrcqgijvsyodpxwm + +gbxedknljayfhcvu +xztjkfeblgiqvydau +gvlksybpemdxjawiuf + +pds +ldfs +shg +sa + +oyhipj +pdohywb +paqlhou +omrgyphtwd + +puexjovza +bgvcejrisy +wrejvq + +swzkvxtafnqyi +wksiqxzvfnyta + +buxsqlordam +ixslbpnfvtukahze + +zvnbreaqmwsodcy +vmwsadyobqznrec +ebvmawdrzcnqsyo +cbmwoaynszdvqer + +vxdzibpaw +avsfegby +akvbc +zabvu + +dhlxsy +ldyxsw +lsayzx +yxsjlh + +xtbe +plj + +n +m +owx + +ali +md + +jmi +jl +jac +lj +jlc + +whjagdblr +wdhrgbajl +jahbewndlrfpg +warljgdvbh +grsldajwbh + +ubi +dwb +lnb +pbx + +nmsjacwzqdh +pbfkugeytoi +rkvxl + +vdx +bndx +xvd + +nezmhlw +exzmwgslhuon +wtemnqhpliz +fnedlbkvwmhzg + +zcvoarqi +uqg +thqg + +qedaghsxln +csxldqen +denxhyqls + +blegpfuaznrdhoj +zghslinmvxejroaqp + +yjev +eyvj + +xhnqtvlaewfgupyrz +zghfpnxtyelvaqurw + +bsno +dovpt +glfjzw +hxmfc +iyrkqu + +ta +l +m +brq + +ezchvnpy +jphbyvcrze +vychzep +hytcpevz + +wurmizf +dyqlwmuvi +uimbw +euibwm +zmiuwhae + +bdngyolcxipva +gswmucjby + +xzrkwep +njblugmhqvrsizw + +dijwksuhyrefmbtzp +wsrtempdbijykuzc +bewszdumjptcyrki +dmbjkyzwpcesruti + +utameknglfxci +ohmnetvqjsawbik + +ves +s +qbpkiywt +gfe + +eogztnu +monutzeg + +fjqvucdoz +cfzvuyodqn + +j +t +j +j + +xwcpkudjagnzmto +czjgdnwmtkxua +xjnkcwglzdutma + +g +fisteknohd +xmg +uxrqz + +y +y +y +y +y + +yebaxitskm +txljeyaimok + +wytxl +w +wj +w +w + +y +ym +y +y +y + +tuqacpofz +afzuotp +autzfpgdro +oufzatp +asnzfuotp + +fmxcdtakjqsolvnwzpre +cwslxozmedvqprakft +zcepkrqaowsxdmlfvt +adkrcltzfwqomxepvs +cftdkzsuvxwroelapmq + +vnukwf +wfu +wuvf +uqfw +fucw + +ucezxlv +xcluzev +ecuizvxl +veluxcz +zexcvlu + +cfdzeomh +hzfmde +lnrmhzifd +mzfdh + +imklvjabtqdxcw +dqtmiwjflcavkx +tldzxkqnmwjcsavi +lrvfgtdcjxakpmiwq + +hfgvjpminkouyscxdwzle +fimyuswanovkdgzelcjxthp +cyhigexozldsvknfumwjp + +obgv +bvo +orgvb +xpvsboau +bov + +tidn +ljs +rly +oljsrah + +hlpkbqo +oklbp + +upsfvhjeqiolra +pfjovuahelqsrim +yqanieuglpvojsrhf + +rzlsoiwnmfjxac +ajvextygdhwum +jqmpaxwt +mygwbjpeaxdk + +dnkilgqrscye +khlzdxpbwo +lgkrdm +lvdtgk +sfdklmtj + +u +u + +kctfengbsqdjy +jtsehoqfbgix +aweqmugpzr + +gfkxci +iocxfu +mdxneihrfqcj +csiopxf +uyitxfoc + +w +q +vjgesf +zkpxc +n + +aiqlfegkx +rboptwvjsnu + +ysamgbzc +bczsga +daubcszg + +dufvmajroptly +hsdwlyp + +ogjwnmhktvubi +uigwtjkb +kqwiuetz + +fmdwnscru +yli + +cnjr +rcjn +jncxr +jcrn +rjnc + +tjzqs +jblstz + +rmxcinhbeql +mrfbtlenquhxij + +n +g +bwh +rju + +mdol +mdol +dmol +lomd +modl + +apzodfktx +zjkopdtxfa +oxjfakptzd +owdkacxupzyft +aofkzpdtx + +jmibuxvgcodkrewfnasz +fsrzunjcbxdmweakigvo +axkedgfubjczvowinmrs +gruxwiscodkavjefmbzn + +mqpubxrzhktcfj +hotqnigsavzeylmd + +ntmkpjuzcilgd +hpdugjkqltzxnmci + +dxwbfonuvjaskyeqzipctrlh +wkcxydvhiaurbqepotljnzsf +tafgehdurxybzwpkojvlscnqi + +af +f +f +f + +povwrfhklm +azvixotjbegsy +svjnocd + +ysfeukcdrbxnl +scpyrextbwokdufn +skcudxneqryfbl + +hmwbzcodtijqavxnsyl +vlpcaqyjsfiortmhz +hvmizletopsjyaqc +vmqajlgostizyhc +kvcoqmajlyzhist + +x +x +x +x +x + From 435fe19dcc8689d21627ced40481c62b4672047e Mon Sep 17 00:00:00 2001 From: Teo-CD Date: Thu, 17 Dec 2020 23:01:52 +0100 Subject: [PATCH 09/28] Day 7 of 2020 done in Python --- 2020/Day 7/Solution.py | 105 ++++++++ 2020/Day 7/input.txt | 595 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 700 insertions(+) create mode 100644 2020/Day 7/Solution.py create mode 100644 2020/Day 7/input.txt diff --git a/2020/Day 7/Solution.py b/2020/Day 7/Solution.py new file mode 100644 index 0000000..e76cfa6 --- /dev/null +++ b/2020/Day 7/Solution.py @@ -0,0 +1,105 @@ +import re + +bag_re = re.compile(r'(?:([a-z\s]+) bags contain)?(?:\s?([0-9]) ([a-z\s]+)\sbags?[,.])') + +input_file = "input.txt" + + +def find_bags_containing_bag(search_bag="shiny gold"): + # Stores the bag colors that can store the bag in the key + bag_relations = {} + + with open(input_file) as rules: + line = rules.readline() + + while line and line != "\n": + match = bag_re.findall(line) + + if not match: + line = rules.readline() + continue + + parent_bag = match[0][0] + + for sub_match in match: + + if sub_match[2] in bag_relations and parent_bag not in bag_relations[sub_match[2]]: + bag_relations[sub_match[2]].append(parent_bag) + else: + bag_relations[sub_match[2]] = [parent_bag] + + line = rules.readline() + + explored_bags = [] + bags_to_explore = [search_bag] + + usable_bags = 0 + + while len(bags_to_explore) > 0: + current_exploration = bags_to_explore.pop(0) + explored_bags.append(current_exploration) + + if current_exploration not in bag_relations: + continue + + for bag in bag_relations[current_exploration]: + if bag not in explored_bags and bag not in bags_to_explore: + usable_bags += 1 + bags_to_explore.append(bag) + + print(f"The number of bags that can contain a {search_bag} bag is {usable_bags}") + + +def count_bags_contained_in_bag(search_bag="shiny gold"): + # Stores the number of bags a bag directly contains + bag_counts = {} + # Stores the bags contained and how many of them + bags_contained = {} + + with open(input_file) as rules: + line = rules.readline() + + while line and line != "\n": + match = bag_re.findall(line) + + if not match: + line = rules.readline() + continue + + parent_bag = match[0][0] + + bags_contained[parent_bag] = [] + bag_counts[parent_bag] = 0 + + for sub_match in match: + bag_counts[parent_bag] += int(sub_match[1]) + bags_contained[parent_bag].append((sub_match[2], int(sub_match[1]))) + + line = rules.readline() + + explored_bags = [] + bags_to_explore = [(search_bag, 1)] + + total_bags = 0 + + # For each bag, fetch the total amount of bag it contains and multiply it by the number of times + # this bag has been counted. Then, add the contained bag to the list of bags to count while keeping track of + # the multiplier. + # For ex. : a bag contains two blue bags. The blue bags are added with a multiplier of two. + # The blue bags contain each three red bags. Thus, we count six red bags and add them with a multiplier of six. + while len(bags_to_explore) > 0: + current_exploration = bags_to_explore.pop(0) + explored_bags.append(current_exploration) + + if current_exploration[0] not in bag_counts: + continue + + # Add the number of bags contained, multiplied by the number of times this has appeared in this "bag descent" + total_bags += bag_counts[current_exploration[0]]*current_exploration[1] + + for bag in bags_contained[current_exploration[0]]: + # Keep track of the number of bags that appear in total by multiplying the number of bags + # by the number of times the current bag appears in this "bag descent" + bags_to_explore.append((bag[0], current_exploration[1]*bag[1])) + + print(f"The total number of bags a {search_bag} contains {total_bags}") diff --git a/2020/Day 7/input.txt b/2020/Day 7/input.txt new file mode 100644 index 0000000..414ec7b --- /dev/null +++ b/2020/Day 7/input.txt @@ -0,0 +1,595 @@ +muted coral bags contain 1 bright magenta bag, 1 dim aqua bag. +muted orange bags contain 2 bright red bags. +dim olive bags contain 2 dull silver bags, 4 posh blue bags. +dim white bags contain 4 shiny indigo bags, 4 posh tan bags, 3 faded blue bags. +dotted salmon bags contain 5 bright black bags, 3 bright purple bags, 5 bright olive bags. +faded purple bags contain 4 pale beige bags, 2 striped violet bags, 3 muted olive bags, 4 vibrant chartreuse bags. +dark maroon bags contain 1 muted chartreuse bag, 1 muted violet bag, 2 bright lime bags. +bright tomato bags contain 4 dark chartreuse bags, 2 striped blue bags, 2 drab magenta bags, 2 faded gray bags. +light orange bags contain 2 bright tomato bags, 5 muted olive bags, 1 mirrored green bag, 3 drab bronze bags. +posh cyan bags contain 5 pale blue bags, 5 mirrored bronze bags, 4 dim magenta bags. +pale lime bags contain 4 light violet bags, 4 dotted black bags, 3 pale chartreuse bags. +striped lavender bags contain 4 shiny yellow bags, 1 mirrored green bag, 1 light blue bag. +dull orange bags contain 1 shiny white bag, 3 clear crimson bags, 5 posh tan bags. +posh lavender bags contain 5 vibrant orange bags, 3 dim aqua bags. +light beige bags contain 5 dim silver bags, 2 bright teal bags, 3 dotted tomato bags. +drab lime bags contain 5 faded lavender bags, 3 muted violet bags, 1 muted coral bag. +faded lavender bags contain 5 wavy blue bags, 2 plaid aqua bags. +dull bronze bags contain 2 dark lavender bags, 1 dotted silver bag. +plaid lavender bags contain 1 drab red bag, 4 wavy lime bags, 2 shiny olive bags. +vibrant plum bags contain 4 clear indigo bags, 3 light bronze bags, 1 striped coral bag. +dull cyan bags contain 4 striped cyan bags, 5 bright magenta bags, 2 pale brown bags. +clear gold bags contain 4 faded black bags, 1 shiny chartreuse bag, 1 mirrored green bag. +dotted olive bags contain 5 striped cyan bags, 2 dark chartreuse bags, 1 bright aqua bag, 1 pale blue bag. +light cyan bags contain 1 mirrored green bag. +faded tan bags contain 2 dim teal bags, 4 wavy green bags. +dull olive bags contain 1 striped teal bag, 2 drab green bags, 2 light red bags. +plaid red bags contain 2 muted cyan bags. +faded coral bags contain 1 striped maroon bag. +light aqua bags contain 2 muted plum bags, 5 mirrored bronze bags, 4 striped coral bags, 1 posh violet bag. +bright aqua bags contain 2 pale coral bags, 4 mirrored bronze bags, 1 light gold bag, 2 plaid lime bags. +muted yellow bags contain 1 wavy blue bag, 5 drab violet bags, 3 wavy black bags, 2 bright teal bags. +vibrant yellow bags contain 4 dull silver bags, 4 dark tan bags, 2 drab magenta bags. +clear purple bags contain 1 posh bronze bag, 5 vibrant black bags, 3 bright bronze bags. +faded tomato bags contain 2 shiny turquoise bags, 5 vibrant yellow bags. +muted gold bags contain 1 vibrant purple bag, 5 clear aqua bags, 1 mirrored white bag. +drab magenta bags contain no other bags. +posh brown bags contain 5 muted plum bags, 5 mirrored aqua bags, 3 wavy chartreuse bags, 1 dull lavender bag. +bright red bags contain 3 drab violet bags, 3 clear blue bags. +striped red bags contain 4 vibrant orange bags, 2 vibrant turquoise bags. +dotted green bags contain 1 pale green bag, 2 posh teal bags, 1 muted blue bag, 2 clear tomato bags. +pale fuchsia bags contain 3 dim blue bags. +light plum bags contain 4 clear green bags, 3 clear crimson bags, 1 vibrant aqua bag, 5 faded gray bags. +dim violet bags contain 3 faded bronze bags, 5 dark turquoise bags. +wavy indigo bags contain 2 pale green bags, 2 clear tomato bags, 2 dotted black bags. +dark salmon bags contain 4 dotted silver bags. +plaid bronze bags contain 2 shiny magenta bags. +mirrored aqua bags contain 1 wavy green bag, 1 striped bronze bag, 4 light blue bags. +mirrored gray bags contain 2 clear beige bags. +wavy olive bags contain 3 dim brown bags, 5 clear green bags, 4 pale white bags. +vibrant magenta bags contain 3 striped cyan bags, 3 mirrored purple bags. +dotted teal bags contain 4 pale coral bags. +posh orange bags contain 1 wavy chartreuse bag, 2 mirrored orange bags, 5 dark white bags, 1 vibrant salmon bag. +dotted brown bags contain 5 drab silver bags, 5 bright tomato bags, 3 mirrored coral bags, 2 striped bronze bags. +posh purple bags contain 5 striped purple bags, 1 wavy beige bag, 3 clear beige bags. +dark bronze bags contain 5 posh white bags, 5 muted coral bags, 4 light blue bags. +plaid violet bags contain 5 dark fuchsia bags. +drab gray bags contain 5 plaid bronze bags, 4 dark salmon bags, 5 mirrored blue bags. +muted tan bags contain 1 striped olive bag, 5 vibrant magenta bags, 5 mirrored green bags. +wavy magenta bags contain 2 striped beige bags, 4 vibrant blue bags. +dull violet bags contain no other bags. +drab blue bags contain 1 drab red bag, 4 dark gray bags. +shiny crimson bags contain 1 shiny magenta bag, 5 shiny silver bags, 4 striped salmon bags, 5 light magenta bags. +muted teal bags contain 2 shiny teal bags, 5 dim fuchsia bags, 2 dim red bags. +dotted gold bags contain 2 clear red bags, 1 wavy beige bag. +dotted white bags contain 4 plaid chartreuse bags. +muted lavender bags contain 1 striped silver bag. +vibrant teal bags contain 1 faded blue bag. +striped tan bags contain 3 muted salmon bags, 4 striped purple bags, 3 striped silver bags. +light blue bags contain 2 drab violet bags. +dim salmon bags contain 1 pale chartreuse bag. +dark lavender bags contain 2 dull brown bags, 5 pale teal bags, 2 muted lime bags, 4 pale beige bags. +wavy beige bags contain 4 posh tan bags, 3 muted brown bags, 1 pale magenta bag, 5 muted magenta bags. +drab olive bags contain 1 striped indigo bag, 2 dull beige bags, 5 bright magenta bags. +pale cyan bags contain 2 bright olive bags. +dark blue bags contain 1 posh indigo bag, 2 bright lime bags. +dark chartreuse bags contain 3 muted brown bags, 3 light violet bags, 1 mirrored green bag. +dim bronze bags contain 1 muted plum bag, 5 pale red bags. +dotted fuchsia bags contain 3 drab violet bags. +posh fuchsia bags contain 1 mirrored maroon bag. +bright coral bags contain 2 vibrant gray bags, 2 drab aqua bags. +dark orange bags contain 2 bright salmon bags, 1 plaid cyan bag, 3 plaid beige bags. +dotted turquoise bags contain 4 wavy green bags, 1 plaid lavender bag, 1 dotted olive bag, 1 dark silver bag. +plaid salmon bags contain 3 faded plum bags, 4 dark teal bags, 2 wavy green bags. +clear cyan bags contain 3 dull tan bags, 2 shiny olive bags, 5 shiny brown bags. +posh tan bags contain 5 dim lime bags, 1 shiny indigo bag, 2 dark chartreuse bags. +muted violet bags contain 1 wavy blue bag, 1 dark silver bag. +dull indigo bags contain 3 posh plum bags, 5 shiny coral bags, 5 dull crimson bags. +mirrored violet bags contain 2 posh plum bags, 5 dark indigo bags. +pale tomato bags contain 1 bright tomato bag, 3 striped salmon bags, 1 posh silver bag. +shiny tomato bags contain 3 shiny coral bags, 5 striped orange bags, 1 posh bronze bag, 1 wavy silver bag. +dull silver bags contain 3 light violet bags, 2 dim white bags, 2 dull beige bags, 3 pale maroon bags. +dark gray bags contain 5 drab green bags, 5 mirrored green bags, 4 faded gray bags, 3 drab white bags. +wavy orange bags contain 1 light maroon bag, 3 shiny beige bags, 5 drab silver bags. +pale lavender bags contain 4 shiny white bags, 4 bright indigo bags, 5 shiny teal bags, 3 clear crimson bags. +pale chartreuse bags contain 3 dark lavender bags. +posh green bags contain 1 plaid plum bag, 3 drab maroon bags. +clear lavender bags contain 1 vibrant purple bag, 4 pale orange bags. +dim red bags contain 1 posh coral bag, 5 pale yellow bags, 5 plaid aqua bags, 3 striped bronze bags. +light violet bags contain no other bags. +dull aqua bags contain 3 posh bronze bags, 2 muted plum bags. +faded beige bags contain 5 vibrant orange bags, 5 clear magenta bags. +vibrant black bags contain 5 wavy orange bags. +faded silver bags contain 1 wavy olive bag. +dark brown bags contain 3 light indigo bags, 1 muted salmon bag. +mirrored green bags contain no other bags. +plaid tomato bags contain 1 faded gray bag, 3 striped teal bags, 2 dotted beige bags, 2 dark coral bags. +faded salmon bags contain 1 vibrant purple bag, 1 dark cyan bag, 3 muted maroon bags. +faded white bags contain 1 mirrored tan bag, 2 pale fuchsia bags, 3 wavy gray bags, 3 plaid maroon bags. +posh crimson bags contain 2 dull tan bags, 4 striped silver bags, 1 clear fuchsia bag. +striped silver bags contain 5 dull tan bags, 3 striped blue bags, 1 dark silver bag, 1 clear green bag. +dim green bags contain 1 striped coral bag, 3 plaid gray bags, 4 clear green bags, 3 drab indigo bags. +shiny gold bags contain 2 dark chartreuse bags, 2 bright silver bags, 1 striped bronze bag, 2 pale maroon bags. +wavy coral bags contain 1 clear magenta bag. +bright white bags contain 4 dim teal bags, 4 plaid violet bags, 5 dotted chartreuse bags. +dull lime bags contain 5 vibrant salmon bags, 1 wavy fuchsia bag. +dark red bags contain 2 mirrored gray bags, 5 drab tomato bags, 1 faded purple bag. +mirrored cyan bags contain 5 bright cyan bags. +dim blue bags contain 3 dull beige bags, 3 shiny white bags, 4 posh purple bags. +pale teal bags contain 3 striped tomato bags, 1 plaid plum bag, 5 mirrored green bags, 1 striped blue bag. +posh silver bags contain 1 light violet bag, 3 dull blue bags. +faded black bags contain 2 bright tomato bags, 1 striped teal bag, 1 dim maroon bag. +posh plum bags contain 5 faded gray bags. +striped beige bags contain 4 dotted fuchsia bags, 1 pale teal bag, 5 shiny cyan bags, 5 striped indigo bags. +striped indigo bags contain 4 muted olive bags, 1 dotted silver bag, 3 clear fuchsia bags, 3 dull orange bags. +dull black bags contain 4 dark gold bags, 4 dark tan bags, 2 pale orange bags, 2 light gold bags. +dark yellow bags contain 3 posh teal bags. +vibrant gold bags contain 3 dull cyan bags, 1 mirrored maroon bag. +dull gray bags contain 5 plaid plum bags, 4 mirrored aqua bags. +muted chartreuse bags contain 4 dull blue bags, 1 dull tan bag, 2 light green bags, 4 mirrored green bags. +dim maroon bags contain 1 striped teal bag. +bright orange bags contain 3 muted maroon bags, 5 muted tomato bags, 4 striped maroon bags, 1 faded gray bag. +faded orange bags contain 3 posh lime bags, 1 clear purple bag, 4 dotted magenta bags. +dotted red bags contain 4 plaid tan bags, 1 dull tan bag, 2 posh beige bags, 5 bright turquoise bags. +dotted orange bags contain 4 bright black bags. +wavy plum bags contain 3 dull plum bags, 3 dotted cyan bags. +clear turquoise bags contain 2 striped blue bags, 4 wavy plum bags, 2 dark olive bags, 2 striped maroon bags. +wavy chartreuse bags contain 3 shiny yellow bags. +muted turquoise bags contain 2 plaid indigo bags. +dotted bronze bags contain 2 pale red bags, 3 dull lavender bags, 4 striped crimson bags. +clear black bags contain 3 striped plum bags, 3 plaid violet bags, 3 shiny chartreuse bags, 4 bright tomato bags. +shiny brown bags contain 5 posh lime bags, 1 posh bronze bag, 4 wavy brown bags. +posh bronze bags contain 1 mirrored gray bag, 2 bright plum bags, 5 dark gold bags. +dark crimson bags contain 4 wavy orange bags, 4 wavy green bags, 1 muted brown bag, 2 dotted purple bags. +faded red bags contain 2 plaid violet bags, 5 dull orange bags, 1 mirrored tomato bag, 3 dim aqua bags. +drab purple bags contain 1 posh violet bag, 1 dotted cyan bag, 3 muted magenta bags, 2 wavy black bags. +dotted beige bags contain 4 shiny green bags, 5 striped maroon bags. +dim magenta bags contain 1 dull violet bag, 3 striped tomato bags. +striped white bags contain 4 dim maroon bags. +vibrant tan bags contain 1 bright lime bag, 3 faded black bags, 3 bright olive bags. +bright olive bags contain 5 drab orange bags, 2 drab black bags, 4 muted salmon bags. +dark white bags contain 2 mirrored beige bags, 1 bright teal bag, 2 posh beige bags. +pale gold bags contain 5 dark orange bags. +vibrant indigo bags contain 1 muted purple bag. +faded turquoise bags contain 5 pale indigo bags. +faded bronze bags contain 1 clear magenta bag, 4 faded gold bags. +shiny gray bags contain 3 striped crimson bags, 2 dim brown bags, 3 drab red bags. +mirrored magenta bags contain 3 wavy maroon bags, 2 pale beige bags. +muted lime bags contain 4 clear beige bags, 5 vibrant chartreuse bags, 1 dark turquoise bag, 5 dim crimson bags. +vibrant crimson bags contain 1 dotted fuchsia bag, 1 pale tomato bag, 4 dark turquoise bags. +vibrant cyan bags contain 4 mirrored brown bags, 3 wavy green bags. +pale orange bags contain 1 pale gray bag, 2 wavy green bags, 5 plaid plum bags. +vibrant maroon bags contain 3 bright red bags. +light bronze bags contain 1 dull blue bag, 2 posh crimson bags, 5 drab magenta bags. +dim beige bags contain 4 shiny yellow bags, 4 muted lavender bags. +pale black bags contain 5 mirrored fuchsia bags, 4 striped salmon bags, 2 dark turquoise bags, 4 dotted orange bags. +dark turquoise bags contain 2 striped purple bags, 5 bright teal bags. +drab crimson bags contain 1 faded turquoise bag, 4 vibrant crimson bags. +pale maroon bags contain 3 dull violet bags. +bright salmon bags contain 5 pale lime bags, 4 bright cyan bags. +dull beige bags contain 3 striped tomato bags, 3 dotted black bags. +clear fuchsia bags contain 4 shiny white bags, 1 mirrored fuchsia bag, 4 drab violet bags, 1 pale magenta bag. +wavy gold bags contain 1 vibrant black bag, 2 dotted indigo bags, 5 faded silver bags, 1 muted cyan bag. +plaid maroon bags contain 3 bright silver bags, 5 mirrored coral bags. +dim cyan bags contain 3 muted white bags, 2 wavy maroon bags. +wavy purple bags contain 4 bright teal bags, 4 dull turquoise bags, 2 vibrant aqua bags. +muted cyan bags contain 3 muted olive bags, 3 dim brown bags, 4 striped indigo bags. +striped olive bags contain 2 clear blue bags, 2 plaid indigo bags, 3 faded blue bags, 3 bright tomato bags. +plaid orange bags contain 2 bright indigo bags, 2 vibrant blue bags, 5 light gray bags, 3 faded tomato bags. +striped plum bags contain 5 posh gold bags, 5 bright bronze bags, 2 clear gold bags, 2 dark lime bags. +dim crimson bags contain 4 posh tan bags. +drab aqua bags contain 3 mirrored lime bags, 4 pale salmon bags, 2 wavy coral bags, 4 light brown bags. +bright silver bags contain 4 muted salmon bags, 2 striped salmon bags, 5 shiny turquoise bags. +shiny beige bags contain 2 light plum bags, 4 dim maroon bags, 3 pale brown bags, 1 pale maroon bag. +shiny tan bags contain 4 posh chartreuse bags, 3 dim tan bags, 2 pale green bags, 5 light tomato bags. +wavy silver bags contain 3 drab magenta bags. +light brown bags contain 5 dim fuchsia bags, 3 drab brown bags, 4 posh bronze bags, 4 bright cyan bags. +striped green bags contain 5 bright bronze bags, 1 striped gray bag, 4 wavy fuchsia bags, 2 striped indigo bags. +faded brown bags contain 3 dim brown bags. +clear maroon bags contain 2 mirrored magenta bags, 3 light cyan bags. +dim black bags contain 3 dull turquoise bags. +muted bronze bags contain 3 bright green bags. +drab green bags contain 4 posh gold bags. +muted magenta bags contain 5 muted brown bags, 2 dark chartreuse bags, 5 pale magenta bags. +light chartreuse bags contain 5 dim lime bags, 1 faded blue bag, 5 striped salmon bags. +dull teal bags contain 3 shiny teal bags. +faded blue bags contain 5 shiny indigo bags, 5 drab magenta bags, 1 dim lime bag, 5 striped teal bags. +pale red bags contain 1 dull brown bag, 1 bright tomato bag. +dim indigo bags contain 2 vibrant white bags. +light gold bags contain 5 shiny gold bags. +clear green bags contain 2 muted brown bags, 4 mirrored orange bags. +posh red bags contain 1 striped salmon bag, 4 posh silver bags, 1 pale blue bag. +dull coral bags contain 2 pale bronze bags, 3 shiny lime bags, 5 muted chartreuse bags. +dotted plum bags contain 4 plaid fuchsia bags, 1 mirrored coral bag, 4 clear beige bags, 4 bright gray bags. +shiny black bags contain 5 dotted indigo bags. +drab white bags contain 5 wavy lime bags, 1 posh bronze bag, 3 striped crimson bags. +light fuchsia bags contain 3 striped maroon bags, 3 muted coral bags, 3 light green bags. +dotted tan bags contain 1 wavy aqua bag, 3 dull turquoise bags. +dark tomato bags contain 4 dull violet bags, 4 shiny gold bags, 2 clear fuchsia bags, 5 striped teal bags. +posh yellow bags contain 1 dotted brown bag, 5 mirrored aqua bags. +dark silver bags contain 3 striped blue bags, 3 faded gray bags. +clear chartreuse bags contain 2 faded green bags, 4 vibrant lavender bags, 5 faded lime bags, 5 plaid lavender bags. +dotted gray bags contain 3 drab orange bags. +vibrant beige bags contain 2 bright olive bags, 2 plaid gold bags, 3 drab lime bags. +light lime bags contain 1 bright teal bag, 1 shiny cyan bag. +dark aqua bags contain 4 striped silver bags, 1 vibrant bronze bag, 2 plaid orange bags. +shiny plum bags contain 3 bright tomato bags, 2 clear crimson bags, 2 dull violet bags, 2 posh bronze bags. +posh gray bags contain 4 pale maroon bags, 4 plaid gold bags, 3 bright red bags. +dark olive bags contain 4 pale aqua bags, 4 bright brown bags, 2 dotted gray bags. +dim tan bags contain 5 mirrored orange bags, 5 pale magenta bags, 3 striped teal bags. +drab chartreuse bags contain 3 posh olive bags. +clear lime bags contain 1 vibrant gold bag, 1 faded beige bag, 2 dark lime bags, 1 faded gold bag. +pale plum bags contain 5 dim lavender bags, 3 dim turquoise bags, 5 muted aqua bags, 4 bright maroon bags. +mirrored lime bags contain 4 dim brown bags, 2 muted tomato bags. +wavy violet bags contain 3 mirrored chartreuse bags, 5 wavy gold bags, 1 faded gray bag, 2 dim maroon bags. +posh coral bags contain 5 bright turquoise bags, 2 dark fuchsia bags, 4 light crimson bags. +shiny olive bags contain 2 shiny coral bags, 2 posh bronze bags. +faded yellow bags contain 5 striped black bags, 1 dotted black bag. +dotted chartreuse bags contain 3 shiny maroon bags, 2 pale magenta bags, 5 wavy beige bags, 5 dim silver bags. +dotted lavender bags contain 5 muted silver bags, 2 striped purple bags. +posh olive bags contain 5 dotted yellow bags, 1 light salmon bag. +shiny magenta bags contain 1 striped yellow bag, 1 dotted yellow bag, 1 bright teal bag, 3 striped tan bags. +clear red bags contain 5 shiny teal bags. +posh black bags contain 1 shiny lime bag, 1 shiny salmon bag. +dotted yellow bags contain 3 dull gold bags, 3 dotted fuchsia bags, 1 shiny teal bag, 2 bright black bags. +drab salmon bags contain 5 plaid white bags, 4 dull lavender bags, 4 striped red bags, 1 posh bronze bag. +shiny white bags contain 4 striped tomato bags, 4 posh tan bags. +clear olive bags contain 2 bright plum bags, 1 clear green bag. +light tomato bags contain 5 dark purple bags. +wavy crimson bags contain 2 plaid plum bags, 1 vibrant tomato bag, 4 mirrored plum bags. +muted indigo bags contain 1 posh coral bag, 1 posh lavender bag, 1 muted coral bag, 4 faded lime bags. +mirrored coral bags contain 3 vibrant chartreuse bags, 5 muted magenta bags, 2 shiny salmon bags. +bright violet bags contain 2 dotted aqua bags, 3 dark yellow bags, 1 clear purple bag. +mirrored white bags contain 1 wavy chartreuse bag, 3 clear aqua bags, 3 bright tan bags. +mirrored orange bags contain no other bags. +drab violet bags contain 1 drab magenta bag, 4 striped purple bags. +pale white bags contain 1 muted maroon bag, 1 clear crimson bag, 3 dotted fuchsia bags, 3 clear bronze bags. +dull green bags contain 3 mirrored fuchsia bags, 4 mirrored purple bags, 2 dotted green bags. +pale tan bags contain 2 dark fuchsia bags, 5 shiny white bags, 4 bright red bags, 5 posh plum bags. +dull tan bags contain 5 clear blue bags, 1 shiny turquoise bag. +shiny turquoise bags contain 5 striped teal bags, 5 clear crimson bags, 4 dim lime bags, 2 faded gray bags. +shiny lime bags contain 1 plaid indigo bag, 1 dim lime bag, 5 dotted beige bags, 2 dotted indigo bags. +bright fuchsia bags contain 4 plaid chartreuse bags, 1 drab red bag. +wavy lavender bags contain 1 muted olive bag, 3 shiny tan bags, 5 posh tan bags, 4 bright green bags. +shiny violet bags contain 2 dull lime bags, 1 dotted crimson bag, 5 dark lime bags, 4 shiny salmon bags. +dotted maroon bags contain 1 vibrant crimson bag. +mirrored bronze bags contain 5 posh silver bags, 3 mirrored lime bags. +light green bags contain 1 pale indigo bag, 4 vibrant chartreuse bags, 1 dull beige bag, 5 pale aqua bags. +clear indigo bags contain 5 dull turquoise bags. +faded indigo bags contain 3 muted tomato bags, 2 dotted fuchsia bags, 4 striped silver bags. +shiny green bags contain 3 striped salmon bags, 4 posh gold bags. +muted crimson bags contain 4 dark indigo bags. +posh gold bags contain 4 mirrored fuchsia bags, 3 muted brown bags, 5 dim lime bags. +pale brown bags contain 3 striped teal bags, 2 bright magenta bags. +dark indigo bags contain 1 muted tomato bag. +light turquoise bags contain 2 vibrant turquoise bags, 2 bright silver bags. +shiny salmon bags contain 4 pale gray bags. +faded fuchsia bags contain 4 light chartreuse bags, 4 posh lime bags. +mirrored teal bags contain 4 dull orange bags, 1 muted turquoise bag, 2 vibrant aqua bags, 3 faded blue bags. +muted tomato bags contain 4 drab green bags, 3 pale coral bags, 5 bright green bags. +bright plum bags contain 4 drab magenta bags, 5 light violet bags. +striped brown bags contain 3 vibrant turquoise bags, 2 plaid crimson bags, 2 wavy gray bags. +muted white bags contain 5 posh white bags. +muted beige bags contain 3 shiny cyan bags, 4 dim brown bags, 3 clear blue bags. +dim coral bags contain 4 wavy fuchsia bags. +light indigo bags contain 2 faded bronze bags, 3 dim magenta bags. +dark black bags contain 5 faded fuchsia bags, 5 mirrored olive bags, 3 dotted fuchsia bags. +vibrant green bags contain 5 bright purple bags, 5 muted chartreuse bags. +plaid fuchsia bags contain 5 bright aqua bags, 2 shiny indigo bags. +light red bags contain 1 vibrant aqua bag. +light gray bags contain 2 bright maroon bags, 3 dim turquoise bags, 2 faded gold bags. +faded gold bags contain 3 dull tan bags, 2 dotted black bags. +striped lime bags contain 5 muted fuchsia bags, 3 bright tomato bags, 3 drab teal bags. +dim purple bags contain 4 drab lavender bags. +plaid aqua bags contain 4 shiny indigo bags, 2 pale teal bags, 3 clear crimson bags, 2 striped purple bags. +wavy fuchsia bags contain 4 shiny turquoise bags, 3 muted salmon bags. +bright lavender bags contain 4 light gold bags, 1 bright magenta bag. +striped tomato bags contain no other bags. +bright indigo bags contain 4 striped yellow bags, 2 clear crimson bags. +dull tomato bags contain 5 mirrored orange bags, 3 vibrant yellow bags. +striped violet bags contain 1 clear beige bag, 4 drab violet bags. +vibrant turquoise bags contain 4 light violet bags, 2 plaid gold bags. +dim aqua bags contain 1 bright teal bag, 1 wavy silver bag. +dim lavender bags contain 2 dull aqua bags, 1 plaid maroon bag, 1 light gray bag, 4 wavy maroon bags. +vibrant violet bags contain 3 posh gold bags, 3 shiny plum bags, 4 muted coral bags, 4 posh indigo bags. +shiny chartreuse bags contain 5 light violet bags, 5 plaid aqua bags. +dull brown bags contain 1 dull violet bag, 1 striped salmon bag, 1 wavy tan bag. +muted silver bags contain 4 dark red bags, 2 muted violet bags. +striped blue bags contain no other bags. +plaid silver bags contain 5 dotted red bags, 2 faded teal bags, 2 faded olive bags. +faded lime bags contain 3 vibrant chartreuse bags. +vibrant silver bags contain 3 pale violet bags, 3 dark purple bags. +clear tomato bags contain 3 clear salmon bags, 2 light blue bags, 2 striped yellow bags. +pale indigo bags contain 3 clear green bags. +dim turquoise bags contain 3 pale teal bags, 4 shiny white bags. +bright tan bags contain 3 dotted beige bags. +light tan bags contain 3 dark teal bags, 4 muted brown bags. +plaid white bags contain 3 clear white bags, 1 dotted gold bag, 1 striped beige bag, 3 mirrored lavender bags. +faded aqua bags contain 1 bright plum bag. +pale crimson bags contain 2 mirrored magenta bags, 2 bright tan bags, 4 clear maroon bags. +mirrored tomato bags contain 5 bright bronze bags. +bright bronze bags contain 3 light red bags. +plaid green bags contain 5 striped green bags, 3 vibrant orange bags. +drab teal bags contain 4 plaid orange bags, 4 dotted teal bags, 1 vibrant chartreuse bag. +posh chartreuse bags contain 3 shiny teal bags, 5 dark tan bags, 1 dull olive bag. +dim lime bags contain 3 pale magenta bags, 5 striped tomato bags, 2 drab magenta bags, 4 striped blue bags. +vibrant fuchsia bags contain 5 plaid tomato bags, 2 dark coral bags, 5 mirrored lime bags, 3 plaid violet bags. +mirrored turquoise bags contain 5 wavy gray bags, 3 faded lavender bags, 5 muted fuchsia bags, 5 clear red bags. +plaid magenta bags contain 1 clear bronze bag, 3 muted cyan bags, 3 clear fuchsia bags. +muted blue bags contain 4 dotted indigo bags, 5 dim magenta bags. +dotted lime bags contain 5 vibrant aqua bags, 1 clear olive bag, 1 clear green bag. +dim teal bags contain 5 mirrored teal bags, 4 dotted teal bags, 1 mirrored tomato bag, 2 dull violet bags. +plaid blue bags contain 5 posh yellow bags, 2 mirrored crimson bags, 4 drab lavender bags, 5 plaid fuchsia bags. +drab turquoise bags contain 1 dotted plum bag, 4 dim gold bags, 3 mirrored white bags, 2 posh coral bags. +striped maroon bags contain 2 dim coral bags, 4 light cyan bags. +vibrant blue bags contain 2 dotted beige bags, 4 shiny green bags, 3 posh bronze bags, 3 posh olive bags. +posh teal bags contain 5 wavy beige bags, 1 striped black bag, 3 dotted teal bags. +light yellow bags contain 1 wavy olive bag, 4 shiny green bags, 2 clear teal bags. +dim silver bags contain 1 dark lime bag, 1 bright red bag. +drab gold bags contain 4 mirrored purple bags, 3 wavy maroon bags. +striped gray bags contain 3 wavy silver bags. +bright maroon bags contain 5 dull olive bags, 4 shiny gold bags. +dotted silver bags contain 4 dim tan bags, 3 posh tan bags, 1 clear crimson bag. +dark green bags contain 4 dim teal bags, 5 dull tan bags, 1 pale blue bag, 5 clear aqua bags. +clear crimson bags contain 1 posh gold bag, 1 dull violet bag, 4 mirrored green bags. +bright green bags contain 5 clear bronze bags, 2 wavy beige bags. +drab yellow bags contain 2 dim lavender bags, 4 striped indigo bags, 4 wavy green bags. +bright brown bags contain 5 drab maroon bags, 2 wavy beige bags. +dark purple bags contain 5 dark green bags. +striped magenta bags contain 2 vibrant blue bags, 3 muted yellow bags, 3 muted violet bags. +dim orange bags contain 4 dim fuchsia bags. +drab brown bags contain 3 plaid lavender bags, 3 mirrored plum bags, 1 faded black bag. +light magenta bags contain 2 clear beige bags, 3 shiny plum bags, 3 drab violet bags. +faded gray bags contain 5 mirrored green bags, 3 dull violet bags. +dull crimson bags contain 1 light gray bag, 2 dull gray bags. +dotted blue bags contain 2 faded lavender bags, 2 mirrored fuchsia bags, 2 dark blue bags. +bright black bags contain 4 dark chartreuse bags, 5 dim turquoise bags, 5 clear green bags, 2 striped teal bags. +dim plum bags contain 4 posh silver bags, 3 clear red bags. +plaid gray bags contain 2 clear silver bags, 1 posh lime bag, 3 striped gray bags, 3 dotted maroon bags. +muted plum bags contain 4 plaid aqua bags, 1 wavy gray bag, 2 light crimson bags, 1 dull red bag. +dark magenta bags contain 4 drab white bags, 5 dark lavender bags, 5 dim teal bags, 5 bright tan bags. +clear brown bags contain 2 mirrored teal bags, 1 striped silver bag, 3 mirrored purple bags, 3 faded gray bags. +muted brown bags contain 1 striped teal bag, 3 pale magenta bags, 3 striped tomato bags. +bright gray bags contain 1 dark fuchsia bag. +wavy teal bags contain 5 faded gold bags, 5 bright plum bags. +wavy bronze bags contain 4 posh turquoise bags, 5 muted red bags, 3 plaid crimson bags. +shiny lavender bags contain 4 bright tan bags, 5 drab teal bags, 1 shiny tan bag. +pale silver bags contain 2 mirrored beige bags, 2 drab crimson bags, 4 clear coral bags, 3 plaid brown bags. +drab silver bags contain 1 dark fuchsia bag, 3 drab magenta bags, 4 pale violet bags, 5 dull tan bags. +bright chartreuse bags contain 1 bright green bag. +light salmon bags contain 2 dim brown bags, 4 dark gold bags, 2 dull silver bags, 4 bright bronze bags. +clear silver bags contain 4 shiny gray bags, 3 drab green bags, 5 dim aqua bags, 2 drab olive bags. +wavy tomato bags contain 3 wavy green bags. +dotted magenta bags contain 4 posh purple bags. +striped fuchsia bags contain 4 vibrant maroon bags, 4 wavy tomato bags, 3 clear coral bags, 3 striped indigo bags. +wavy green bags contain 1 plaid aqua bag. +clear plum bags contain 2 wavy silver bags, 3 posh red bags, 2 dark gray bags, 4 dull brown bags. +striped aqua bags contain 5 dull gold bags, 5 mirrored green bags. +dull maroon bags contain 5 posh crimson bags, 1 muted tomato bag, 5 shiny gold bags. +muted green bags contain 5 faded blue bags, 2 dark tan bags, 1 mirrored bronze bag, 2 dotted crimson bags. +mirrored purple bags contain 3 clear green bags, 2 bright plum bags, 4 muted olive bags. +dull purple bags contain 3 plaid tan bags, 5 bright turquoise bags. +pale coral bags contain 1 clear olive bag. +wavy gray bags contain 4 light gold bags, 5 clear beige bags, 4 dim lime bags. +wavy cyan bags contain 2 striped olive bags. +drab orange bags contain 1 mirrored purple bag, 2 muted cyan bags, 4 posh purple bags. +wavy lime bags contain 2 striped indigo bags, 3 plaid plum bags, 3 drab violet bags, 5 muted magenta bags. +dull blue bags contain 3 drab magenta bags, 1 shiny teal bag, 5 mirrored fuchsia bags, 2 posh plum bags. +dark teal bags contain 4 shiny gray bags. +pale beige bags contain 4 faded blue bags, 2 dull red bags, 3 wavy beige bags, 2 dull tan bags. +pale purple bags contain 2 pale maroon bags. +clear magenta bags contain 3 muted olive bags, 3 bright teal bags, 4 dull salmon bags, 2 mirrored coral bags. +dark tan bags contain 2 plaid plum bags, 5 bright purple bags, 4 mirrored aqua bags. +pale turquoise bags contain 3 striped silver bags, 2 bright gray bags. +shiny indigo bags contain 5 mirrored fuchsia bags. +plaid plum bags contain no other bags. +plaid yellow bags contain 5 bright beige bags, 2 dull tan bags, 3 dim crimson bags, 1 vibrant tomato bag. +pale gray bags contain 5 mirrored green bags, 3 plaid aqua bags, 5 pale violet bags. +dotted crimson bags contain 5 striped lavender bags, 3 shiny orange bags. +plaid teal bags contain 2 bright aqua bags, 1 posh olive bag, 4 shiny white bags, 3 dotted beige bags. +dim brown bags contain 5 striped tomato bags, 5 wavy black bags, 3 pale magenta bags. +vibrant gray bags contain 4 dark cyan bags, 5 drab purple bags, 2 mirrored crimson bags, 4 dark turquoise bags. +light olive bags contain 2 mirrored teal bags. +posh aqua bags contain 5 muted cyan bags, 1 plaid aqua bag, 4 mirrored plum bags. +wavy tan bags contain 5 clear fuchsia bags, 1 bright silver bag, 5 clear green bags, 2 bright teal bags. +shiny cyan bags contain 3 clear green bags, 2 bright black bags, 3 muted magenta bags, 4 mirrored orange bags. +mirrored fuchsia bags contain no other bags. +plaid beige bags contain 4 wavy indigo bags, 2 bright green bags, 1 light magenta bag, 2 plaid tomato bags. +drab cyan bags contain 5 posh yellow bags, 5 dull white bags. +drab tan bags contain 5 wavy teal bags. +muted aqua bags contain 3 dim blue bags, 1 dim tan bag, 3 dim white bags. +posh tomato bags contain 1 clear purple bag, 4 vibrant crimson bags. +pale aqua bags contain 5 wavy fuchsia bags, 2 striped bronze bags. +pale magenta bags contain no other bags. +pale violet bags contain 1 pale maroon bag. +shiny teal bags contain 4 striped tomato bags, 1 bright plum bag, 1 dim crimson bag, 1 plaid aqua bag. +vibrant aqua bags contain 4 mirrored green bags, 4 dim crimson bags, 4 faded blue bags. +faded violet bags contain 1 dark green bag, 4 mirrored maroon bags, 1 dark lavender bag, 4 bright black bags. +mirrored tan bags contain 3 mirrored magenta bags. +faded cyan bags contain 5 dotted crimson bags, 1 vibrant yellow bag, 3 shiny bronze bags. +posh violet bags contain 4 dotted beige bags. +striped salmon bags contain 3 posh purple bags, 4 clear green bags. +mirrored indigo bags contain 2 posh plum bags. +dim gold bags contain 2 posh gold bags, 5 faded gray bags. +striped bronze bags contain 4 mirrored orange bags. +light white bags contain 3 shiny plum bags, 5 striped indigo bags. +muted purple bags contain 2 dull orange bags, 4 drab maroon bags, 4 striped lavender bags, 4 dim teal bags. +clear violet bags contain 5 plaid yellow bags, 3 dark lavender bags, 2 wavy salmon bags. +dotted black bags contain 1 pale brown bag, 1 drab magenta bag, 5 plaid plum bags, 5 clear crimson bags. +wavy black bags contain 5 dim lime bags, 4 drab magenta bags, 5 mirrored orange bags, 3 plaid plum bags. +plaid purple bags contain 4 dull maroon bags. +dotted cyan bags contain 4 pale indigo bags, 1 dark coral bag. +bright magenta bags contain 3 clear fuchsia bags, 2 plaid plum bags, 1 clear blue bag, 1 dim white bag. +posh blue bags contain 4 dark purple bags. +vibrant tomato bags contain 5 muted tomato bags, 5 striped indigo bags, 3 clear crimson bags. +drab black bags contain 3 dotted orange bags, 1 pale tomato bag, 2 bright maroon bags. +clear salmon bags contain 3 pale maroon bags. +mirrored beige bags contain 5 dark lavender bags, 5 light violet bags, 3 striped tomato bags. +muted gray bags contain 4 muted gold bags, 4 clear indigo bags, 4 light maroon bags. +posh indigo bags contain 4 faded aqua bags. +wavy red bags contain 3 dim crimson bags, 3 clear red bags, 3 wavy beige bags, 1 vibrant purple bag. +striped purple bags contain 4 mirrored orange bags, 3 drab magenta bags, 1 bright plum bag, 3 striped teal bags. +dull magenta bags contain 2 dim crimson bags, 2 wavy olive bags. +wavy brown bags contain 3 faded tomato bags, 1 muted olive bag, 2 light tomato bags, 1 shiny orange bag. +clear coral bags contain 2 shiny maroon bags. +dotted indigo bags contain 1 posh silver bag. +pale green bags contain 1 striped crimson bag, 3 dim coral bags, 5 mirrored aqua bags, 4 light cyan bags. +vibrant chartreuse bags contain 1 clear beige bag, 4 muted magenta bags, 2 mirrored orange bags, 5 pale teal bags. +muted salmon bags contain 1 muted brown bag, 5 dark chartreuse bags, 3 posh gold bags, 2 shiny indigo bags. +mirrored gold bags contain 2 dotted bronze bags, 3 muted bronze bags, 4 clear orange bags. +light purple bags contain 2 light blue bags, 5 muted black bags, 4 posh indigo bags. +clear aqua bags contain 2 muted chartreuse bags, 2 dotted black bags, 4 wavy black bags. +faded crimson bags contain 5 shiny salmon bags, 2 striped plum bags. +bright cyan bags contain 2 wavy olive bags, 3 muted turquoise bags. +pale yellow bags contain 1 pale beige bag, 3 striped cyan bags. +striped crimson bags contain 5 shiny indigo bags, 4 dim brown bags, 5 muted salmon bags, 5 mirrored green bags. +mirrored brown bags contain 1 pale tomato bag, 1 striped purple bag, 5 posh gold bags. +bright lime bags contain 2 muted red bags, 1 pale lavender bag, 1 posh white bag. +posh turquoise bags contain 3 pale white bags. +drab red bags contain 3 dark fuchsia bags. +striped gold bags contain 1 mirrored brown bag, 5 drab lavender bags, 4 dotted lavender bags. +dull red bags contain 2 dim crimson bags. +striped cyan bags contain 3 striped salmon bags, 3 wavy beige bags, 2 dim tan bags. +vibrant lime bags contain 1 pale lavender bag. +dotted violet bags contain 4 plaid gold bags, 3 clear green bags. +pale olive bags contain 3 light orange bags, 4 wavy silver bags, 4 shiny indigo bags. +plaid olive bags contain 4 dim purple bags, 5 wavy chartreuse bags, 3 posh plum bags, 4 light violet bags. +dotted coral bags contain 1 striped olive bag, 1 wavy gray bag, 1 vibrant chartreuse bag. +drab lavender bags contain 1 mirrored crimson bag. +mirrored crimson bags contain 3 dark gold bags. +vibrant orange bags contain 1 light blue bag, 3 mirrored brown bags, 2 mirrored plum bags, 3 pale lavender bags. +dull chartreuse bags contain 3 dotted bronze bags, 3 striped teal bags. +wavy turquoise bags contain 4 muted fuchsia bags. +shiny purple bags contain 5 drab salmon bags. +plaid brown bags contain 2 bright green bags, 5 clear aqua bags, 2 plaid plum bags. +pale bronze bags contain 3 bright red bags, 3 pale black bags, 1 wavy lime bag, 4 light maroon bags. +vibrant white bags contain 5 striped yellow bags, 4 dark tan bags. +mirrored blue bags contain 1 plaid indigo bag, 5 muted chartreuse bags, 2 plaid lime bags, 2 drab green bags. +wavy aqua bags contain 4 mirrored orange bags. +drab bronze bags contain 1 bright purple bag, 5 dim coral bags, 4 shiny green bags, 2 pale beige bags. +mirrored chartreuse bags contain 2 mirrored tomato bags, 4 posh lime bags, 5 posh tan bags, 4 pale aqua bags. +bright blue bags contain 3 dark violet bags. +mirrored yellow bags contain 2 pale tomato bags, 4 vibrant gold bags, 1 faded teal bag, 2 bright purple bags. +plaid black bags contain 2 plaid purple bags, 5 dotted bronze bags. +shiny silver bags contain 1 dull lavender bag, 5 pale magenta bags, 2 drab white bags. +mirrored salmon bags contain 1 muted lime bag, 4 shiny bronze bags. +muted maroon bags contain 3 muted lime bags, 1 muted turquoise bag. +light black bags contain 3 striped beige bags, 2 shiny olive bags, 2 drab olive bags. +wavy blue bags contain 2 dull violet bags, 1 pale magenta bag, 3 bright black bags. +light silver bags contain 1 shiny bronze bag, 2 faded lavender bags. +shiny coral bags contain 2 mirrored tomato bags, 2 faded fuchsia bags, 2 striped violet bags, 4 shiny orange bags. +striped coral bags contain 1 clear indigo bag, 3 muted bronze bags, 4 shiny turquoise bags. +shiny bronze bags contain 4 light gold bags. +bright crimson bags contain 4 mirrored blue bags, 3 dull aqua bags, 5 muted lavender bags, 1 dotted turquoise bag. +striped turquoise bags contain 3 striped indigo bags, 3 clear fuchsia bags, 4 bright black bags, 1 vibrant aqua bag. +faded green bags contain 3 posh olive bags, 4 bright violet bags, 5 dull yellow bags, 3 dull olive bags. +dark coral bags contain 2 wavy green bags, 2 shiny cyan bags, 5 light red bags, 3 bright red bags. +clear teal bags contain 3 plaid beige bags, 5 faded aqua bags, 2 dim yellow bags, 5 bright gray bags. +plaid chartreuse bags contain 2 dark magenta bags, 5 wavy olive bags, 2 plaid plum bags. +shiny aqua bags contain 1 wavy indigo bag, 1 dull bronze bag, 4 shiny bronze bags. +wavy salmon bags contain 2 pale lime bags, 4 drab silver bags. +striped yellow bags contain 4 faded black bags. +mirrored black bags contain 5 muted yellow bags. +bright gold bags contain 2 mirrored crimson bags, 1 vibrant purple bag. +vibrant purple bags contain 1 muted tomato bag, 5 shiny green bags, 1 dark turquoise bag. +dull fuchsia bags contain 1 wavy gold bag, 2 plaid yellow bags. +light maroon bags contain 5 striped indigo bags, 3 muted red bags, 3 muted lime bags, 2 striped lavender bags. +clear yellow bags contain 3 plaid beige bags. +clear tan bags contain 2 vibrant red bags, 4 light chartreuse bags. +dotted tomato bags contain 5 vibrant black bags, 5 dotted gray bags, 5 plaid red bags. +dark plum bags contain 5 dotted orange bags, 2 mirrored blue bags, 1 light indigo bag. +posh magenta bags contain 3 dim gold bags, 1 drab coral bag, 3 shiny tomato bags. +posh salmon bags contain 4 posh tomato bags, 3 pale silver bags. +vibrant bronze bags contain 4 posh orange bags. +dim tomato bags contain 2 dull black bags, 1 striped aqua bag. +posh white bags contain 3 shiny plum bags, 2 wavy olive bags. +mirrored plum bags contain 5 dotted teal bags, 2 bright maroon bags. +light coral bags contain 3 dull brown bags, 4 pale red bags, 4 dull orange bags, 5 dim crimson bags. +striped teal bags contain 1 plaid plum bag, 4 striped tomato bags, 1 mirrored orange bag, 5 mirrored fuchsia bags. +striped orange bags contain 4 dark crimson bags, 5 drab green bags, 5 striped tan bags. +dark gold bags contain 2 bright plum bags, 1 striped purple bag, 3 wavy beige bags. +drab fuchsia bags contain 5 wavy orange bags. +dull salmon bags contain 2 dull olive bags, 4 bright silver bags, 1 muted tomato bag. +shiny fuchsia bags contain 2 mirrored fuchsia bags, 1 bright black bag, 2 clear orange bags, 4 wavy gold bags. +clear bronze bags contain 4 posh purple bags, 3 dim gold bags, 3 light chartreuse bags, 1 shiny cyan bag. +dim gray bags contain 5 muted beige bags, 1 dim purple bag. +faded magenta bags contain 3 mirrored aqua bags, 3 vibrant maroon bags, 5 drab red bags, 1 light magenta bag. +muted fuchsia bags contain 1 dim indigo bag, 5 vibrant purple bags, 2 posh silver bags. +posh beige bags contain 3 dark gold bags. +bright yellow bags contain 2 mirrored blue bags. +clear orange bags contain 4 vibrant purple bags, 2 clear fuchsia bags. +pale salmon bags contain 4 wavy black bags, 3 muted olive bags, 5 wavy teal bags, 3 dotted orange bags. +dim chartreuse bags contain 1 mirrored bronze bag, 5 shiny lavender bags, 4 dark red bags. +clear gray bags contain 4 bright indigo bags, 5 wavy coral bags, 4 drab tomato bags, 1 mirrored tomato bag. +drab maroon bags contain 2 dotted lime bags, 2 muted beige bags, 2 clear aqua bags, 4 drab silver bags. +muted black bags contain 4 wavy fuchsia bags, 1 striped cyan bag, 4 faded purple bags. +clear blue bags contain 2 striped teal bags. +mirrored red bags contain 3 posh plum bags, 2 striped beige bags. +dull lavender bags contain 2 vibrant purple bags. +shiny maroon bags contain 4 vibrant chartreuse bags. +dim fuchsia bags contain 1 striped maroon bag, 3 faded gray bags, 4 vibrant aqua bags. +faded plum bags contain 5 posh black bags, 4 striped turquoise bags, 1 striped plum bag. +plaid cyan bags contain 1 dim turquoise bag, 1 mirrored tan bag, 5 plaid fuchsia bags. +muted olive bags contain 5 wavy beige bags, 5 striped tomato bags, 5 posh tan bags, 2 pale magenta bags. +dark cyan bags contain 5 wavy green bags, 4 muted violet bags. +vibrant lavender bags contain 1 mirrored orange bag, 4 dull yellow bags, 5 bright silver bags. +drab beige bags contain 1 drab yellow bag. +plaid indigo bags contain 5 clear olive bags, 4 striped teal bags, 4 pale violet bags, 4 shiny gold bags. +dark fuchsia bags contain 3 drab magenta bags, 1 mirrored orange bag. +faded chartreuse bags contain 5 pale blue bags, 3 dim tan bags, 5 dull red bags, 4 wavy maroon bags. +shiny orange bags contain 3 dark gold bags, 2 posh silver bags, 1 dull cyan bag, 4 drab silver bags. +striped black bags contain 5 wavy teal bags, 5 light chartreuse bags, 4 wavy coral bags. +light crimson bags contain 2 dim gold bags. +wavy yellow bags contain 2 dark lime bags, 1 bright fuchsia bag, 2 plaid purple bags, 4 dark bronze bags. +faded teal bags contain 3 posh bronze bags, 1 striped yellow bag, 3 dim aqua bags. +plaid gold bags contain 5 bright black bags, 2 shiny yellow bags, 5 mirrored orange bags, 5 dark lime bags. +clear beige bags contain 3 faded blue bags, 1 plaid plum bag. +dull plum bags contain 1 mirrored green bag, 3 mirrored lime bags. +bright beige bags contain 4 shiny white bags, 5 faded teal bags, 3 mirrored plum bags. +plaid turquoise bags contain 4 striped gray bags. +dark beige bags contain 5 plaid brown bags, 4 bright plum bags. +dull white bags contain 3 posh coral bags. +vibrant red bags contain 4 plaid red bags. +drab indigo bags contain 5 shiny black bags, 3 mirrored brown bags, 4 muted olive bags, 2 mirrored coral bags. +plaid lime bags contain 4 dim gold bags. +plaid tan bags contain 2 dark fuchsia bags, 3 dotted purple bags, 5 dull bronze bags, 3 light blue bags. +mirrored maroon bags contain 4 mirrored green bags, 1 dark tomato bag. +shiny red bags contain 1 dim salmon bag, 1 plaid plum bag, 4 drab orange bags, 5 shiny teal bags. +dark lime bags contain 4 shiny white bags, 3 shiny indigo bags, 4 light cyan bags, 2 muted brown bags. +dull yellow bags contain 3 muted brown bags, 1 light maroon bag. +mirrored silver bags contain 3 pale brown bags, 5 mirrored yellow bags, 1 pale teal bag, 4 plaid red bags. +light teal bags contain 3 posh plum bags. +drab tomato bags contain 2 pale coral bags, 5 clear olive bags. +mirrored lavender bags contain 3 plaid fuchsia bags, 3 muted yellow bags. +drab plum bags contain 5 plaid olive bags. +dotted purple bags contain 2 plaid red bags, 4 mirrored bronze bags, 5 shiny teal bags, 3 dim blue bags. +vibrant coral bags contain 1 dotted lime bag, 5 shiny salmon bags, 3 mirrored blue bags, 2 striped indigo bags. +faded olive bags contain 1 drab blue bag, 4 vibrant indigo bags, 3 dotted lavender bags, 5 muted silver bags. +wavy white bags contain 3 mirrored maroon bags, 2 dim white bags, 2 dark magenta bags, 4 clear fuchsia bags. +clear white bags contain 2 light chartreuse bags, 5 plaid fuchsia bags, 2 drab lime bags, 1 clear indigo bag. +pale blue bags contain 2 dim crimson bags, 4 light green bags, 4 vibrant aqua bags, 5 drab white bags. +mirrored olive bags contain 2 bright gold bags, 4 bright tomato bags. +vibrant salmon bags contain 5 dim maroon bags, 2 dull cyan bags. +plaid coral bags contain 1 bright gray bag. +plaid crimson bags contain 2 muted black bags, 3 drab turquoise bags, 2 mirrored beige bags. +faded maroon bags contain 5 drab tan bags, 4 mirrored brown bags, 1 light silver bag. +vibrant brown bags contain 2 faded salmon bags, 2 posh plum bags, 5 wavy lime bags, 2 shiny beige bags. +dull gold bags contain 5 shiny salmon bags, 3 drab silver bags, 1 wavy beige bag. +bright turquoise bags contain 5 wavy blue bags, 4 muted chartreuse bags. +light lavender bags contain 1 drab olive bag, 1 posh violet bag. +posh maroon bags contain 5 bright chartreuse bags, 4 muted black bags, 3 dull tan bags, 2 mirrored gray bags. +muted red bags contain 1 striped crimson bag, 5 light blue bags. +dark violet bags contain 2 muted blue bags, 1 light bronze bag. +striped chartreuse bags contain 1 dark violet bag, 1 faded turquoise bag, 3 vibrant tomato bags, 5 dotted teal bags. +dull turquoise bags contain 3 drab tan bags. +vibrant olive bags contain 2 drab purple bags. +shiny yellow bags contain 2 faded lavender bags, 4 shiny cyan bags. +posh lime bags contain 3 light plum bags, 4 clear magenta bags. +dotted aqua bags contain 3 dim lime bags, 2 light green bags. +dim yellow bags contain 4 bright brown bags, 4 wavy coral bags. +shiny blue bags contain 4 dotted yellow bags, 1 dim crimson bag, 1 clear black bag. +wavy maroon bags contain 4 vibrant aqua bags, 4 striped bronze bags, 3 dotted silver bags. +drab coral bags contain 1 wavy teal bag, 3 plaid orange bags, 2 posh orange bags, 1 mirrored olive bag. +bright teal bags contain 2 pale magenta bags. +bright purple bags contain 4 shiny chartreuse bags, 5 plaid lime bags, 2 dim magenta bags. + From 259f6916087b3391de63a3acf78a6c462d87ad1f Mon Sep 17 00:00:00 2001 From: trotFunky Date: Thu, 17 Dec 2020 23:01:52 +0100 Subject: [PATCH 10/28] Day 7 of 2020 done in Python --- 2020/Day 7/Solution.py | 105 ++++++++ 2020/Day 7/input.txt | 595 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 700 insertions(+) create mode 100644 2020/Day 7/Solution.py create mode 100644 2020/Day 7/input.txt diff --git a/2020/Day 7/Solution.py b/2020/Day 7/Solution.py new file mode 100644 index 0000000..e76cfa6 --- /dev/null +++ b/2020/Day 7/Solution.py @@ -0,0 +1,105 @@ +import re + +bag_re = re.compile(r'(?:([a-z\s]+) bags contain)?(?:\s?([0-9]) ([a-z\s]+)\sbags?[,.])') + +input_file = "input.txt" + + +def find_bags_containing_bag(search_bag="shiny gold"): + # Stores the bag colors that can store the bag in the key + bag_relations = {} + + with open(input_file) as rules: + line = rules.readline() + + while line and line != "\n": + match = bag_re.findall(line) + + if not match: + line = rules.readline() + continue + + parent_bag = match[0][0] + + for sub_match in match: + + if sub_match[2] in bag_relations and parent_bag not in bag_relations[sub_match[2]]: + bag_relations[sub_match[2]].append(parent_bag) + else: + bag_relations[sub_match[2]] = [parent_bag] + + line = rules.readline() + + explored_bags = [] + bags_to_explore = [search_bag] + + usable_bags = 0 + + while len(bags_to_explore) > 0: + current_exploration = bags_to_explore.pop(0) + explored_bags.append(current_exploration) + + if current_exploration not in bag_relations: + continue + + for bag in bag_relations[current_exploration]: + if bag not in explored_bags and bag not in bags_to_explore: + usable_bags += 1 + bags_to_explore.append(bag) + + print(f"The number of bags that can contain a {search_bag} bag is {usable_bags}") + + +def count_bags_contained_in_bag(search_bag="shiny gold"): + # Stores the number of bags a bag directly contains + bag_counts = {} + # Stores the bags contained and how many of them + bags_contained = {} + + with open(input_file) as rules: + line = rules.readline() + + while line and line != "\n": + match = bag_re.findall(line) + + if not match: + line = rules.readline() + continue + + parent_bag = match[0][0] + + bags_contained[parent_bag] = [] + bag_counts[parent_bag] = 0 + + for sub_match in match: + bag_counts[parent_bag] += int(sub_match[1]) + bags_contained[parent_bag].append((sub_match[2], int(sub_match[1]))) + + line = rules.readline() + + explored_bags = [] + bags_to_explore = [(search_bag, 1)] + + total_bags = 0 + + # For each bag, fetch the total amount of bag it contains and multiply it by the number of times + # this bag has been counted. Then, add the contained bag to the list of bags to count while keeping track of + # the multiplier. + # For ex. : a bag contains two blue bags. The blue bags are added with a multiplier of two. + # The blue bags contain each three red bags. Thus, we count six red bags and add them with a multiplier of six. + while len(bags_to_explore) > 0: + current_exploration = bags_to_explore.pop(0) + explored_bags.append(current_exploration) + + if current_exploration[0] not in bag_counts: + continue + + # Add the number of bags contained, multiplied by the number of times this has appeared in this "bag descent" + total_bags += bag_counts[current_exploration[0]]*current_exploration[1] + + for bag in bags_contained[current_exploration[0]]: + # Keep track of the number of bags that appear in total by multiplying the number of bags + # by the number of times the current bag appears in this "bag descent" + bags_to_explore.append((bag[0], current_exploration[1]*bag[1])) + + print(f"The total number of bags a {search_bag} contains {total_bags}") diff --git a/2020/Day 7/input.txt b/2020/Day 7/input.txt new file mode 100644 index 0000000..414ec7b --- /dev/null +++ b/2020/Day 7/input.txt @@ -0,0 +1,595 @@ +muted coral bags contain 1 bright magenta bag, 1 dim aqua bag. +muted orange bags contain 2 bright red bags. +dim olive bags contain 2 dull silver bags, 4 posh blue bags. +dim white bags contain 4 shiny indigo bags, 4 posh tan bags, 3 faded blue bags. +dotted salmon bags contain 5 bright black bags, 3 bright purple bags, 5 bright olive bags. +faded purple bags contain 4 pale beige bags, 2 striped violet bags, 3 muted olive bags, 4 vibrant chartreuse bags. +dark maroon bags contain 1 muted chartreuse bag, 1 muted violet bag, 2 bright lime bags. +bright tomato bags contain 4 dark chartreuse bags, 2 striped blue bags, 2 drab magenta bags, 2 faded gray bags. +light orange bags contain 2 bright tomato bags, 5 muted olive bags, 1 mirrored green bag, 3 drab bronze bags. +posh cyan bags contain 5 pale blue bags, 5 mirrored bronze bags, 4 dim magenta bags. +pale lime bags contain 4 light violet bags, 4 dotted black bags, 3 pale chartreuse bags. +striped lavender bags contain 4 shiny yellow bags, 1 mirrored green bag, 1 light blue bag. +dull orange bags contain 1 shiny white bag, 3 clear crimson bags, 5 posh tan bags. +posh lavender bags contain 5 vibrant orange bags, 3 dim aqua bags. +light beige bags contain 5 dim silver bags, 2 bright teal bags, 3 dotted tomato bags. +drab lime bags contain 5 faded lavender bags, 3 muted violet bags, 1 muted coral bag. +faded lavender bags contain 5 wavy blue bags, 2 plaid aqua bags. +dull bronze bags contain 2 dark lavender bags, 1 dotted silver bag. +plaid lavender bags contain 1 drab red bag, 4 wavy lime bags, 2 shiny olive bags. +vibrant plum bags contain 4 clear indigo bags, 3 light bronze bags, 1 striped coral bag. +dull cyan bags contain 4 striped cyan bags, 5 bright magenta bags, 2 pale brown bags. +clear gold bags contain 4 faded black bags, 1 shiny chartreuse bag, 1 mirrored green bag. +dotted olive bags contain 5 striped cyan bags, 2 dark chartreuse bags, 1 bright aqua bag, 1 pale blue bag. +light cyan bags contain 1 mirrored green bag. +faded tan bags contain 2 dim teal bags, 4 wavy green bags. +dull olive bags contain 1 striped teal bag, 2 drab green bags, 2 light red bags. +plaid red bags contain 2 muted cyan bags. +faded coral bags contain 1 striped maroon bag. +light aqua bags contain 2 muted plum bags, 5 mirrored bronze bags, 4 striped coral bags, 1 posh violet bag. +bright aqua bags contain 2 pale coral bags, 4 mirrored bronze bags, 1 light gold bag, 2 plaid lime bags. +muted yellow bags contain 1 wavy blue bag, 5 drab violet bags, 3 wavy black bags, 2 bright teal bags. +vibrant yellow bags contain 4 dull silver bags, 4 dark tan bags, 2 drab magenta bags. +clear purple bags contain 1 posh bronze bag, 5 vibrant black bags, 3 bright bronze bags. +faded tomato bags contain 2 shiny turquoise bags, 5 vibrant yellow bags. +muted gold bags contain 1 vibrant purple bag, 5 clear aqua bags, 1 mirrored white bag. +drab magenta bags contain no other bags. +posh brown bags contain 5 muted plum bags, 5 mirrored aqua bags, 3 wavy chartreuse bags, 1 dull lavender bag. +bright red bags contain 3 drab violet bags, 3 clear blue bags. +striped red bags contain 4 vibrant orange bags, 2 vibrant turquoise bags. +dotted green bags contain 1 pale green bag, 2 posh teal bags, 1 muted blue bag, 2 clear tomato bags. +pale fuchsia bags contain 3 dim blue bags. +light plum bags contain 4 clear green bags, 3 clear crimson bags, 1 vibrant aqua bag, 5 faded gray bags. +dim violet bags contain 3 faded bronze bags, 5 dark turquoise bags. +wavy indigo bags contain 2 pale green bags, 2 clear tomato bags, 2 dotted black bags. +dark salmon bags contain 4 dotted silver bags. +plaid bronze bags contain 2 shiny magenta bags. +mirrored aqua bags contain 1 wavy green bag, 1 striped bronze bag, 4 light blue bags. +mirrored gray bags contain 2 clear beige bags. +wavy olive bags contain 3 dim brown bags, 5 clear green bags, 4 pale white bags. +vibrant magenta bags contain 3 striped cyan bags, 3 mirrored purple bags. +dotted teal bags contain 4 pale coral bags. +posh orange bags contain 1 wavy chartreuse bag, 2 mirrored orange bags, 5 dark white bags, 1 vibrant salmon bag. +dotted brown bags contain 5 drab silver bags, 5 bright tomato bags, 3 mirrored coral bags, 2 striped bronze bags. +posh purple bags contain 5 striped purple bags, 1 wavy beige bag, 3 clear beige bags. +dark bronze bags contain 5 posh white bags, 5 muted coral bags, 4 light blue bags. +plaid violet bags contain 5 dark fuchsia bags. +drab gray bags contain 5 plaid bronze bags, 4 dark salmon bags, 5 mirrored blue bags. +muted tan bags contain 1 striped olive bag, 5 vibrant magenta bags, 5 mirrored green bags. +wavy magenta bags contain 2 striped beige bags, 4 vibrant blue bags. +dull violet bags contain no other bags. +drab blue bags contain 1 drab red bag, 4 dark gray bags. +shiny crimson bags contain 1 shiny magenta bag, 5 shiny silver bags, 4 striped salmon bags, 5 light magenta bags. +muted teal bags contain 2 shiny teal bags, 5 dim fuchsia bags, 2 dim red bags. +dotted gold bags contain 2 clear red bags, 1 wavy beige bag. +dotted white bags contain 4 plaid chartreuse bags. +muted lavender bags contain 1 striped silver bag. +vibrant teal bags contain 1 faded blue bag. +striped tan bags contain 3 muted salmon bags, 4 striped purple bags, 3 striped silver bags. +light blue bags contain 2 drab violet bags. +dim salmon bags contain 1 pale chartreuse bag. +dark lavender bags contain 2 dull brown bags, 5 pale teal bags, 2 muted lime bags, 4 pale beige bags. +wavy beige bags contain 4 posh tan bags, 3 muted brown bags, 1 pale magenta bag, 5 muted magenta bags. +drab olive bags contain 1 striped indigo bag, 2 dull beige bags, 5 bright magenta bags. +pale cyan bags contain 2 bright olive bags. +dark blue bags contain 1 posh indigo bag, 2 bright lime bags. +dark chartreuse bags contain 3 muted brown bags, 3 light violet bags, 1 mirrored green bag. +dim bronze bags contain 1 muted plum bag, 5 pale red bags. +dotted fuchsia bags contain 3 drab violet bags. +posh fuchsia bags contain 1 mirrored maroon bag. +bright coral bags contain 2 vibrant gray bags, 2 drab aqua bags. +dark orange bags contain 2 bright salmon bags, 1 plaid cyan bag, 3 plaid beige bags. +dotted turquoise bags contain 4 wavy green bags, 1 plaid lavender bag, 1 dotted olive bag, 1 dark silver bag. +plaid salmon bags contain 3 faded plum bags, 4 dark teal bags, 2 wavy green bags. +clear cyan bags contain 3 dull tan bags, 2 shiny olive bags, 5 shiny brown bags. +posh tan bags contain 5 dim lime bags, 1 shiny indigo bag, 2 dark chartreuse bags. +muted violet bags contain 1 wavy blue bag, 1 dark silver bag. +dull indigo bags contain 3 posh plum bags, 5 shiny coral bags, 5 dull crimson bags. +mirrored violet bags contain 2 posh plum bags, 5 dark indigo bags. +pale tomato bags contain 1 bright tomato bag, 3 striped salmon bags, 1 posh silver bag. +shiny tomato bags contain 3 shiny coral bags, 5 striped orange bags, 1 posh bronze bag, 1 wavy silver bag. +dull silver bags contain 3 light violet bags, 2 dim white bags, 2 dull beige bags, 3 pale maroon bags. +dark gray bags contain 5 drab green bags, 5 mirrored green bags, 4 faded gray bags, 3 drab white bags. +wavy orange bags contain 1 light maroon bag, 3 shiny beige bags, 5 drab silver bags. +pale lavender bags contain 4 shiny white bags, 4 bright indigo bags, 5 shiny teal bags, 3 clear crimson bags. +pale chartreuse bags contain 3 dark lavender bags. +posh green bags contain 1 plaid plum bag, 3 drab maroon bags. +clear lavender bags contain 1 vibrant purple bag, 4 pale orange bags. +dim red bags contain 1 posh coral bag, 5 pale yellow bags, 5 plaid aqua bags, 3 striped bronze bags. +light violet bags contain no other bags. +dull aqua bags contain 3 posh bronze bags, 2 muted plum bags. +faded beige bags contain 5 vibrant orange bags, 5 clear magenta bags. +vibrant black bags contain 5 wavy orange bags. +faded silver bags contain 1 wavy olive bag. +dark brown bags contain 3 light indigo bags, 1 muted salmon bag. +mirrored green bags contain no other bags. +plaid tomato bags contain 1 faded gray bag, 3 striped teal bags, 2 dotted beige bags, 2 dark coral bags. +faded salmon bags contain 1 vibrant purple bag, 1 dark cyan bag, 3 muted maroon bags. +faded white bags contain 1 mirrored tan bag, 2 pale fuchsia bags, 3 wavy gray bags, 3 plaid maroon bags. +posh crimson bags contain 2 dull tan bags, 4 striped silver bags, 1 clear fuchsia bag. +striped silver bags contain 5 dull tan bags, 3 striped blue bags, 1 dark silver bag, 1 clear green bag. +dim green bags contain 1 striped coral bag, 3 plaid gray bags, 4 clear green bags, 3 drab indigo bags. +shiny gold bags contain 2 dark chartreuse bags, 2 bright silver bags, 1 striped bronze bag, 2 pale maroon bags. +wavy coral bags contain 1 clear magenta bag. +bright white bags contain 4 dim teal bags, 4 plaid violet bags, 5 dotted chartreuse bags. +dull lime bags contain 5 vibrant salmon bags, 1 wavy fuchsia bag. +dark red bags contain 2 mirrored gray bags, 5 drab tomato bags, 1 faded purple bag. +mirrored cyan bags contain 5 bright cyan bags. +dim blue bags contain 3 dull beige bags, 3 shiny white bags, 4 posh purple bags. +pale teal bags contain 3 striped tomato bags, 1 plaid plum bag, 5 mirrored green bags, 1 striped blue bag. +posh silver bags contain 1 light violet bag, 3 dull blue bags. +faded black bags contain 2 bright tomato bags, 1 striped teal bag, 1 dim maroon bag. +posh plum bags contain 5 faded gray bags. +striped beige bags contain 4 dotted fuchsia bags, 1 pale teal bag, 5 shiny cyan bags, 5 striped indigo bags. +striped indigo bags contain 4 muted olive bags, 1 dotted silver bag, 3 clear fuchsia bags, 3 dull orange bags. +dull black bags contain 4 dark gold bags, 4 dark tan bags, 2 pale orange bags, 2 light gold bags. +dark yellow bags contain 3 posh teal bags. +vibrant gold bags contain 3 dull cyan bags, 1 mirrored maroon bag. +dull gray bags contain 5 plaid plum bags, 4 mirrored aqua bags. +muted chartreuse bags contain 4 dull blue bags, 1 dull tan bag, 2 light green bags, 4 mirrored green bags. +dim maroon bags contain 1 striped teal bag. +bright orange bags contain 3 muted maroon bags, 5 muted tomato bags, 4 striped maroon bags, 1 faded gray bag. +faded orange bags contain 3 posh lime bags, 1 clear purple bag, 4 dotted magenta bags. +dotted red bags contain 4 plaid tan bags, 1 dull tan bag, 2 posh beige bags, 5 bright turquoise bags. +dotted orange bags contain 4 bright black bags. +wavy plum bags contain 3 dull plum bags, 3 dotted cyan bags. +clear turquoise bags contain 2 striped blue bags, 4 wavy plum bags, 2 dark olive bags, 2 striped maroon bags. +wavy chartreuse bags contain 3 shiny yellow bags. +muted turquoise bags contain 2 plaid indigo bags. +dotted bronze bags contain 2 pale red bags, 3 dull lavender bags, 4 striped crimson bags. +clear black bags contain 3 striped plum bags, 3 plaid violet bags, 3 shiny chartreuse bags, 4 bright tomato bags. +shiny brown bags contain 5 posh lime bags, 1 posh bronze bag, 4 wavy brown bags. +posh bronze bags contain 1 mirrored gray bag, 2 bright plum bags, 5 dark gold bags. +dark crimson bags contain 4 wavy orange bags, 4 wavy green bags, 1 muted brown bag, 2 dotted purple bags. +faded red bags contain 2 plaid violet bags, 5 dull orange bags, 1 mirrored tomato bag, 3 dim aqua bags. +drab purple bags contain 1 posh violet bag, 1 dotted cyan bag, 3 muted magenta bags, 2 wavy black bags. +dotted beige bags contain 4 shiny green bags, 5 striped maroon bags. +dim magenta bags contain 1 dull violet bag, 3 striped tomato bags. +striped white bags contain 4 dim maroon bags. +vibrant tan bags contain 1 bright lime bag, 3 faded black bags, 3 bright olive bags. +bright olive bags contain 5 drab orange bags, 2 drab black bags, 4 muted salmon bags. +dark white bags contain 2 mirrored beige bags, 1 bright teal bag, 2 posh beige bags. +pale gold bags contain 5 dark orange bags. +vibrant indigo bags contain 1 muted purple bag. +faded turquoise bags contain 5 pale indigo bags. +faded bronze bags contain 1 clear magenta bag, 4 faded gold bags. +shiny gray bags contain 3 striped crimson bags, 2 dim brown bags, 3 drab red bags. +mirrored magenta bags contain 3 wavy maroon bags, 2 pale beige bags. +muted lime bags contain 4 clear beige bags, 5 vibrant chartreuse bags, 1 dark turquoise bag, 5 dim crimson bags. +vibrant crimson bags contain 1 dotted fuchsia bag, 1 pale tomato bag, 4 dark turquoise bags. +vibrant cyan bags contain 4 mirrored brown bags, 3 wavy green bags. +pale orange bags contain 1 pale gray bag, 2 wavy green bags, 5 plaid plum bags. +vibrant maroon bags contain 3 bright red bags. +light bronze bags contain 1 dull blue bag, 2 posh crimson bags, 5 drab magenta bags. +dim beige bags contain 4 shiny yellow bags, 4 muted lavender bags. +pale black bags contain 5 mirrored fuchsia bags, 4 striped salmon bags, 2 dark turquoise bags, 4 dotted orange bags. +dark turquoise bags contain 2 striped purple bags, 5 bright teal bags. +drab crimson bags contain 1 faded turquoise bag, 4 vibrant crimson bags. +pale maroon bags contain 3 dull violet bags. +bright salmon bags contain 5 pale lime bags, 4 bright cyan bags. +dull beige bags contain 3 striped tomato bags, 3 dotted black bags. +clear fuchsia bags contain 4 shiny white bags, 1 mirrored fuchsia bag, 4 drab violet bags, 1 pale magenta bag. +wavy gold bags contain 1 vibrant black bag, 2 dotted indigo bags, 5 faded silver bags, 1 muted cyan bag. +plaid maroon bags contain 3 bright silver bags, 5 mirrored coral bags. +dim cyan bags contain 3 muted white bags, 2 wavy maroon bags. +wavy purple bags contain 4 bright teal bags, 4 dull turquoise bags, 2 vibrant aqua bags. +muted cyan bags contain 3 muted olive bags, 3 dim brown bags, 4 striped indigo bags. +striped olive bags contain 2 clear blue bags, 2 plaid indigo bags, 3 faded blue bags, 3 bright tomato bags. +plaid orange bags contain 2 bright indigo bags, 2 vibrant blue bags, 5 light gray bags, 3 faded tomato bags. +striped plum bags contain 5 posh gold bags, 5 bright bronze bags, 2 clear gold bags, 2 dark lime bags. +dim crimson bags contain 4 posh tan bags. +drab aqua bags contain 3 mirrored lime bags, 4 pale salmon bags, 2 wavy coral bags, 4 light brown bags. +bright silver bags contain 4 muted salmon bags, 2 striped salmon bags, 5 shiny turquoise bags. +shiny beige bags contain 2 light plum bags, 4 dim maroon bags, 3 pale brown bags, 1 pale maroon bag. +shiny tan bags contain 4 posh chartreuse bags, 3 dim tan bags, 2 pale green bags, 5 light tomato bags. +wavy silver bags contain 3 drab magenta bags. +light brown bags contain 5 dim fuchsia bags, 3 drab brown bags, 4 posh bronze bags, 4 bright cyan bags. +striped green bags contain 5 bright bronze bags, 1 striped gray bag, 4 wavy fuchsia bags, 2 striped indigo bags. +faded brown bags contain 3 dim brown bags. +clear maroon bags contain 2 mirrored magenta bags, 3 light cyan bags. +dim black bags contain 3 dull turquoise bags. +muted bronze bags contain 3 bright green bags. +drab green bags contain 4 posh gold bags. +muted magenta bags contain 5 muted brown bags, 2 dark chartreuse bags, 5 pale magenta bags. +light chartreuse bags contain 5 dim lime bags, 1 faded blue bag, 5 striped salmon bags. +dull teal bags contain 3 shiny teal bags. +faded blue bags contain 5 shiny indigo bags, 5 drab magenta bags, 1 dim lime bag, 5 striped teal bags. +pale red bags contain 1 dull brown bag, 1 bright tomato bag. +dim indigo bags contain 2 vibrant white bags. +light gold bags contain 5 shiny gold bags. +clear green bags contain 2 muted brown bags, 4 mirrored orange bags. +posh red bags contain 1 striped salmon bag, 4 posh silver bags, 1 pale blue bag. +dull coral bags contain 2 pale bronze bags, 3 shiny lime bags, 5 muted chartreuse bags. +dotted plum bags contain 4 plaid fuchsia bags, 1 mirrored coral bag, 4 clear beige bags, 4 bright gray bags. +shiny black bags contain 5 dotted indigo bags. +drab white bags contain 5 wavy lime bags, 1 posh bronze bag, 3 striped crimson bags. +light fuchsia bags contain 3 striped maroon bags, 3 muted coral bags, 3 light green bags. +dotted tan bags contain 1 wavy aqua bag, 3 dull turquoise bags. +dark tomato bags contain 4 dull violet bags, 4 shiny gold bags, 2 clear fuchsia bags, 5 striped teal bags. +posh yellow bags contain 1 dotted brown bag, 5 mirrored aqua bags. +dark silver bags contain 3 striped blue bags, 3 faded gray bags. +clear chartreuse bags contain 2 faded green bags, 4 vibrant lavender bags, 5 faded lime bags, 5 plaid lavender bags. +dotted gray bags contain 3 drab orange bags. +vibrant beige bags contain 2 bright olive bags, 2 plaid gold bags, 3 drab lime bags. +light lime bags contain 1 bright teal bag, 1 shiny cyan bag. +dark aqua bags contain 4 striped silver bags, 1 vibrant bronze bag, 2 plaid orange bags. +shiny plum bags contain 3 bright tomato bags, 2 clear crimson bags, 2 dull violet bags, 2 posh bronze bags. +posh gray bags contain 4 pale maroon bags, 4 plaid gold bags, 3 bright red bags. +dark olive bags contain 4 pale aqua bags, 4 bright brown bags, 2 dotted gray bags. +dim tan bags contain 5 mirrored orange bags, 5 pale magenta bags, 3 striped teal bags. +drab chartreuse bags contain 3 posh olive bags. +clear lime bags contain 1 vibrant gold bag, 1 faded beige bag, 2 dark lime bags, 1 faded gold bag. +pale plum bags contain 5 dim lavender bags, 3 dim turquoise bags, 5 muted aqua bags, 4 bright maroon bags. +mirrored lime bags contain 4 dim brown bags, 2 muted tomato bags. +wavy violet bags contain 3 mirrored chartreuse bags, 5 wavy gold bags, 1 faded gray bag, 2 dim maroon bags. +posh coral bags contain 5 bright turquoise bags, 2 dark fuchsia bags, 4 light crimson bags. +shiny olive bags contain 2 shiny coral bags, 2 posh bronze bags. +faded yellow bags contain 5 striped black bags, 1 dotted black bag. +dotted chartreuse bags contain 3 shiny maroon bags, 2 pale magenta bags, 5 wavy beige bags, 5 dim silver bags. +dotted lavender bags contain 5 muted silver bags, 2 striped purple bags. +posh olive bags contain 5 dotted yellow bags, 1 light salmon bag. +shiny magenta bags contain 1 striped yellow bag, 1 dotted yellow bag, 1 bright teal bag, 3 striped tan bags. +clear red bags contain 5 shiny teal bags. +posh black bags contain 1 shiny lime bag, 1 shiny salmon bag. +dotted yellow bags contain 3 dull gold bags, 3 dotted fuchsia bags, 1 shiny teal bag, 2 bright black bags. +drab salmon bags contain 5 plaid white bags, 4 dull lavender bags, 4 striped red bags, 1 posh bronze bag. +shiny white bags contain 4 striped tomato bags, 4 posh tan bags. +clear olive bags contain 2 bright plum bags, 1 clear green bag. +light tomato bags contain 5 dark purple bags. +wavy crimson bags contain 2 plaid plum bags, 1 vibrant tomato bag, 4 mirrored plum bags. +muted indigo bags contain 1 posh coral bag, 1 posh lavender bag, 1 muted coral bag, 4 faded lime bags. +mirrored coral bags contain 3 vibrant chartreuse bags, 5 muted magenta bags, 2 shiny salmon bags. +bright violet bags contain 2 dotted aqua bags, 3 dark yellow bags, 1 clear purple bag. +mirrored white bags contain 1 wavy chartreuse bag, 3 clear aqua bags, 3 bright tan bags. +mirrored orange bags contain no other bags. +drab violet bags contain 1 drab magenta bag, 4 striped purple bags. +pale white bags contain 1 muted maroon bag, 1 clear crimson bag, 3 dotted fuchsia bags, 3 clear bronze bags. +dull green bags contain 3 mirrored fuchsia bags, 4 mirrored purple bags, 2 dotted green bags. +pale tan bags contain 2 dark fuchsia bags, 5 shiny white bags, 4 bright red bags, 5 posh plum bags. +dull tan bags contain 5 clear blue bags, 1 shiny turquoise bag. +shiny turquoise bags contain 5 striped teal bags, 5 clear crimson bags, 4 dim lime bags, 2 faded gray bags. +shiny lime bags contain 1 plaid indigo bag, 1 dim lime bag, 5 dotted beige bags, 2 dotted indigo bags. +bright fuchsia bags contain 4 plaid chartreuse bags, 1 drab red bag. +wavy lavender bags contain 1 muted olive bag, 3 shiny tan bags, 5 posh tan bags, 4 bright green bags. +shiny violet bags contain 2 dull lime bags, 1 dotted crimson bag, 5 dark lime bags, 4 shiny salmon bags. +dotted maroon bags contain 1 vibrant crimson bag. +mirrored bronze bags contain 5 posh silver bags, 3 mirrored lime bags. +light green bags contain 1 pale indigo bag, 4 vibrant chartreuse bags, 1 dull beige bag, 5 pale aqua bags. +clear indigo bags contain 5 dull turquoise bags. +faded indigo bags contain 3 muted tomato bags, 2 dotted fuchsia bags, 4 striped silver bags. +shiny green bags contain 3 striped salmon bags, 4 posh gold bags. +muted crimson bags contain 4 dark indigo bags. +posh gold bags contain 4 mirrored fuchsia bags, 3 muted brown bags, 5 dim lime bags. +pale brown bags contain 3 striped teal bags, 2 bright magenta bags. +dark indigo bags contain 1 muted tomato bag. +light turquoise bags contain 2 vibrant turquoise bags, 2 bright silver bags. +shiny salmon bags contain 4 pale gray bags. +faded fuchsia bags contain 4 light chartreuse bags, 4 posh lime bags. +mirrored teal bags contain 4 dull orange bags, 1 muted turquoise bag, 2 vibrant aqua bags, 3 faded blue bags. +muted tomato bags contain 4 drab green bags, 3 pale coral bags, 5 bright green bags. +bright plum bags contain 4 drab magenta bags, 5 light violet bags. +striped brown bags contain 3 vibrant turquoise bags, 2 plaid crimson bags, 2 wavy gray bags. +muted white bags contain 5 posh white bags. +muted beige bags contain 3 shiny cyan bags, 4 dim brown bags, 3 clear blue bags. +dim coral bags contain 4 wavy fuchsia bags. +light indigo bags contain 2 faded bronze bags, 3 dim magenta bags. +dark black bags contain 5 faded fuchsia bags, 5 mirrored olive bags, 3 dotted fuchsia bags. +vibrant green bags contain 5 bright purple bags, 5 muted chartreuse bags. +plaid fuchsia bags contain 5 bright aqua bags, 2 shiny indigo bags. +light red bags contain 1 vibrant aqua bag. +light gray bags contain 2 bright maroon bags, 3 dim turquoise bags, 2 faded gold bags. +faded gold bags contain 3 dull tan bags, 2 dotted black bags. +striped lime bags contain 5 muted fuchsia bags, 3 bright tomato bags, 3 drab teal bags. +dim purple bags contain 4 drab lavender bags. +plaid aqua bags contain 4 shiny indigo bags, 2 pale teal bags, 3 clear crimson bags, 2 striped purple bags. +wavy fuchsia bags contain 4 shiny turquoise bags, 3 muted salmon bags. +bright lavender bags contain 4 light gold bags, 1 bright magenta bag. +striped tomato bags contain no other bags. +bright indigo bags contain 4 striped yellow bags, 2 clear crimson bags. +dull tomato bags contain 5 mirrored orange bags, 3 vibrant yellow bags. +striped violet bags contain 1 clear beige bag, 4 drab violet bags. +vibrant turquoise bags contain 4 light violet bags, 2 plaid gold bags. +dim aqua bags contain 1 bright teal bag, 1 wavy silver bag. +dim lavender bags contain 2 dull aqua bags, 1 plaid maroon bag, 1 light gray bag, 4 wavy maroon bags. +vibrant violet bags contain 3 posh gold bags, 3 shiny plum bags, 4 muted coral bags, 4 posh indigo bags. +shiny chartreuse bags contain 5 light violet bags, 5 plaid aqua bags. +dull brown bags contain 1 dull violet bag, 1 striped salmon bag, 1 wavy tan bag. +muted silver bags contain 4 dark red bags, 2 muted violet bags. +striped blue bags contain no other bags. +plaid silver bags contain 5 dotted red bags, 2 faded teal bags, 2 faded olive bags. +faded lime bags contain 3 vibrant chartreuse bags. +vibrant silver bags contain 3 pale violet bags, 3 dark purple bags. +clear tomato bags contain 3 clear salmon bags, 2 light blue bags, 2 striped yellow bags. +pale indigo bags contain 3 clear green bags. +dim turquoise bags contain 3 pale teal bags, 4 shiny white bags. +bright tan bags contain 3 dotted beige bags. +light tan bags contain 3 dark teal bags, 4 muted brown bags. +plaid white bags contain 3 clear white bags, 1 dotted gold bag, 1 striped beige bag, 3 mirrored lavender bags. +faded aqua bags contain 1 bright plum bag. +pale crimson bags contain 2 mirrored magenta bags, 2 bright tan bags, 4 clear maroon bags. +mirrored tomato bags contain 5 bright bronze bags. +bright bronze bags contain 3 light red bags. +plaid green bags contain 5 striped green bags, 3 vibrant orange bags. +drab teal bags contain 4 plaid orange bags, 4 dotted teal bags, 1 vibrant chartreuse bag. +posh chartreuse bags contain 3 shiny teal bags, 5 dark tan bags, 1 dull olive bag. +dim lime bags contain 3 pale magenta bags, 5 striped tomato bags, 2 drab magenta bags, 4 striped blue bags. +vibrant fuchsia bags contain 5 plaid tomato bags, 2 dark coral bags, 5 mirrored lime bags, 3 plaid violet bags. +mirrored turquoise bags contain 5 wavy gray bags, 3 faded lavender bags, 5 muted fuchsia bags, 5 clear red bags. +plaid magenta bags contain 1 clear bronze bag, 3 muted cyan bags, 3 clear fuchsia bags. +muted blue bags contain 4 dotted indigo bags, 5 dim magenta bags. +dotted lime bags contain 5 vibrant aqua bags, 1 clear olive bag, 1 clear green bag. +dim teal bags contain 5 mirrored teal bags, 4 dotted teal bags, 1 mirrored tomato bag, 2 dull violet bags. +plaid blue bags contain 5 posh yellow bags, 2 mirrored crimson bags, 4 drab lavender bags, 5 plaid fuchsia bags. +drab turquoise bags contain 1 dotted plum bag, 4 dim gold bags, 3 mirrored white bags, 2 posh coral bags. +striped maroon bags contain 2 dim coral bags, 4 light cyan bags. +vibrant blue bags contain 2 dotted beige bags, 4 shiny green bags, 3 posh bronze bags, 3 posh olive bags. +posh teal bags contain 5 wavy beige bags, 1 striped black bag, 3 dotted teal bags. +light yellow bags contain 1 wavy olive bag, 4 shiny green bags, 2 clear teal bags. +dim silver bags contain 1 dark lime bag, 1 bright red bag. +drab gold bags contain 4 mirrored purple bags, 3 wavy maroon bags. +striped gray bags contain 3 wavy silver bags. +bright maroon bags contain 5 dull olive bags, 4 shiny gold bags. +dotted silver bags contain 4 dim tan bags, 3 posh tan bags, 1 clear crimson bag. +dark green bags contain 4 dim teal bags, 5 dull tan bags, 1 pale blue bag, 5 clear aqua bags. +clear crimson bags contain 1 posh gold bag, 1 dull violet bag, 4 mirrored green bags. +bright green bags contain 5 clear bronze bags, 2 wavy beige bags. +drab yellow bags contain 2 dim lavender bags, 4 striped indigo bags, 4 wavy green bags. +bright brown bags contain 5 drab maroon bags, 2 wavy beige bags. +dark purple bags contain 5 dark green bags. +striped magenta bags contain 2 vibrant blue bags, 3 muted yellow bags, 3 muted violet bags. +dim orange bags contain 4 dim fuchsia bags. +drab brown bags contain 3 plaid lavender bags, 3 mirrored plum bags, 1 faded black bag. +light magenta bags contain 2 clear beige bags, 3 shiny plum bags, 3 drab violet bags. +faded gray bags contain 5 mirrored green bags, 3 dull violet bags. +dull crimson bags contain 1 light gray bag, 2 dull gray bags. +dotted blue bags contain 2 faded lavender bags, 2 mirrored fuchsia bags, 2 dark blue bags. +bright black bags contain 4 dark chartreuse bags, 5 dim turquoise bags, 5 clear green bags, 2 striped teal bags. +dim plum bags contain 4 posh silver bags, 3 clear red bags. +plaid gray bags contain 2 clear silver bags, 1 posh lime bag, 3 striped gray bags, 3 dotted maroon bags. +muted plum bags contain 4 plaid aqua bags, 1 wavy gray bag, 2 light crimson bags, 1 dull red bag. +dark magenta bags contain 4 drab white bags, 5 dark lavender bags, 5 dim teal bags, 5 bright tan bags. +clear brown bags contain 2 mirrored teal bags, 1 striped silver bag, 3 mirrored purple bags, 3 faded gray bags. +muted brown bags contain 1 striped teal bag, 3 pale magenta bags, 3 striped tomato bags. +bright gray bags contain 1 dark fuchsia bag. +wavy teal bags contain 5 faded gold bags, 5 bright plum bags. +wavy bronze bags contain 4 posh turquoise bags, 5 muted red bags, 3 plaid crimson bags. +shiny lavender bags contain 4 bright tan bags, 5 drab teal bags, 1 shiny tan bag. +pale silver bags contain 2 mirrored beige bags, 2 drab crimson bags, 4 clear coral bags, 3 plaid brown bags. +drab silver bags contain 1 dark fuchsia bag, 3 drab magenta bags, 4 pale violet bags, 5 dull tan bags. +bright chartreuse bags contain 1 bright green bag. +light salmon bags contain 2 dim brown bags, 4 dark gold bags, 2 dull silver bags, 4 bright bronze bags. +clear silver bags contain 4 shiny gray bags, 3 drab green bags, 5 dim aqua bags, 2 drab olive bags. +wavy tomato bags contain 3 wavy green bags. +dotted magenta bags contain 4 posh purple bags. +striped fuchsia bags contain 4 vibrant maroon bags, 4 wavy tomato bags, 3 clear coral bags, 3 striped indigo bags. +wavy green bags contain 1 plaid aqua bag. +clear plum bags contain 2 wavy silver bags, 3 posh red bags, 2 dark gray bags, 4 dull brown bags. +striped aqua bags contain 5 dull gold bags, 5 mirrored green bags. +dull maroon bags contain 5 posh crimson bags, 1 muted tomato bag, 5 shiny gold bags. +muted green bags contain 5 faded blue bags, 2 dark tan bags, 1 mirrored bronze bag, 2 dotted crimson bags. +mirrored purple bags contain 3 clear green bags, 2 bright plum bags, 4 muted olive bags. +dull purple bags contain 3 plaid tan bags, 5 bright turquoise bags. +pale coral bags contain 1 clear olive bag. +wavy gray bags contain 4 light gold bags, 5 clear beige bags, 4 dim lime bags. +wavy cyan bags contain 2 striped olive bags. +drab orange bags contain 1 mirrored purple bag, 2 muted cyan bags, 4 posh purple bags. +wavy lime bags contain 2 striped indigo bags, 3 plaid plum bags, 3 drab violet bags, 5 muted magenta bags. +dull blue bags contain 3 drab magenta bags, 1 shiny teal bag, 5 mirrored fuchsia bags, 2 posh plum bags. +dark teal bags contain 4 shiny gray bags. +pale beige bags contain 4 faded blue bags, 2 dull red bags, 3 wavy beige bags, 2 dull tan bags. +pale purple bags contain 2 pale maroon bags. +clear magenta bags contain 3 muted olive bags, 3 bright teal bags, 4 dull salmon bags, 2 mirrored coral bags. +dark tan bags contain 2 plaid plum bags, 5 bright purple bags, 4 mirrored aqua bags. +pale turquoise bags contain 3 striped silver bags, 2 bright gray bags. +shiny indigo bags contain 5 mirrored fuchsia bags. +plaid plum bags contain no other bags. +plaid yellow bags contain 5 bright beige bags, 2 dull tan bags, 3 dim crimson bags, 1 vibrant tomato bag. +pale gray bags contain 5 mirrored green bags, 3 plaid aqua bags, 5 pale violet bags. +dotted crimson bags contain 5 striped lavender bags, 3 shiny orange bags. +plaid teal bags contain 2 bright aqua bags, 1 posh olive bag, 4 shiny white bags, 3 dotted beige bags. +dim brown bags contain 5 striped tomato bags, 5 wavy black bags, 3 pale magenta bags. +vibrant gray bags contain 4 dark cyan bags, 5 drab purple bags, 2 mirrored crimson bags, 4 dark turquoise bags. +light olive bags contain 2 mirrored teal bags. +posh aqua bags contain 5 muted cyan bags, 1 plaid aqua bag, 4 mirrored plum bags. +wavy tan bags contain 5 clear fuchsia bags, 1 bright silver bag, 5 clear green bags, 2 bright teal bags. +shiny cyan bags contain 3 clear green bags, 2 bright black bags, 3 muted magenta bags, 4 mirrored orange bags. +mirrored fuchsia bags contain no other bags. +plaid beige bags contain 4 wavy indigo bags, 2 bright green bags, 1 light magenta bag, 2 plaid tomato bags. +drab cyan bags contain 5 posh yellow bags, 5 dull white bags. +drab tan bags contain 5 wavy teal bags. +muted aqua bags contain 3 dim blue bags, 1 dim tan bag, 3 dim white bags. +posh tomato bags contain 1 clear purple bag, 4 vibrant crimson bags. +pale aqua bags contain 5 wavy fuchsia bags, 2 striped bronze bags. +pale magenta bags contain no other bags. +pale violet bags contain 1 pale maroon bag. +shiny teal bags contain 4 striped tomato bags, 1 bright plum bag, 1 dim crimson bag, 1 plaid aqua bag. +vibrant aqua bags contain 4 mirrored green bags, 4 dim crimson bags, 4 faded blue bags. +faded violet bags contain 1 dark green bag, 4 mirrored maroon bags, 1 dark lavender bag, 4 bright black bags. +mirrored tan bags contain 3 mirrored magenta bags. +faded cyan bags contain 5 dotted crimson bags, 1 vibrant yellow bag, 3 shiny bronze bags. +posh violet bags contain 4 dotted beige bags. +striped salmon bags contain 3 posh purple bags, 4 clear green bags. +mirrored indigo bags contain 2 posh plum bags. +dim gold bags contain 2 posh gold bags, 5 faded gray bags. +striped bronze bags contain 4 mirrored orange bags. +light white bags contain 3 shiny plum bags, 5 striped indigo bags. +muted purple bags contain 2 dull orange bags, 4 drab maroon bags, 4 striped lavender bags, 4 dim teal bags. +clear violet bags contain 5 plaid yellow bags, 3 dark lavender bags, 2 wavy salmon bags. +dotted black bags contain 1 pale brown bag, 1 drab magenta bag, 5 plaid plum bags, 5 clear crimson bags. +wavy black bags contain 5 dim lime bags, 4 drab magenta bags, 5 mirrored orange bags, 3 plaid plum bags. +plaid purple bags contain 4 dull maroon bags. +dotted cyan bags contain 4 pale indigo bags, 1 dark coral bag. +bright magenta bags contain 3 clear fuchsia bags, 2 plaid plum bags, 1 clear blue bag, 1 dim white bag. +posh blue bags contain 4 dark purple bags. +vibrant tomato bags contain 5 muted tomato bags, 5 striped indigo bags, 3 clear crimson bags. +drab black bags contain 3 dotted orange bags, 1 pale tomato bag, 2 bright maroon bags. +clear salmon bags contain 3 pale maroon bags. +mirrored beige bags contain 5 dark lavender bags, 5 light violet bags, 3 striped tomato bags. +muted gray bags contain 4 muted gold bags, 4 clear indigo bags, 4 light maroon bags. +posh indigo bags contain 4 faded aqua bags. +wavy red bags contain 3 dim crimson bags, 3 clear red bags, 3 wavy beige bags, 1 vibrant purple bag. +striped purple bags contain 4 mirrored orange bags, 3 drab magenta bags, 1 bright plum bag, 3 striped teal bags. +dull magenta bags contain 2 dim crimson bags, 2 wavy olive bags. +wavy brown bags contain 3 faded tomato bags, 1 muted olive bag, 2 light tomato bags, 1 shiny orange bag. +clear coral bags contain 2 shiny maroon bags. +dotted indigo bags contain 1 posh silver bag. +pale green bags contain 1 striped crimson bag, 3 dim coral bags, 5 mirrored aqua bags, 4 light cyan bags. +vibrant chartreuse bags contain 1 clear beige bag, 4 muted magenta bags, 2 mirrored orange bags, 5 pale teal bags. +muted salmon bags contain 1 muted brown bag, 5 dark chartreuse bags, 3 posh gold bags, 2 shiny indigo bags. +mirrored gold bags contain 2 dotted bronze bags, 3 muted bronze bags, 4 clear orange bags. +light purple bags contain 2 light blue bags, 5 muted black bags, 4 posh indigo bags. +clear aqua bags contain 2 muted chartreuse bags, 2 dotted black bags, 4 wavy black bags. +faded crimson bags contain 5 shiny salmon bags, 2 striped plum bags. +bright cyan bags contain 2 wavy olive bags, 3 muted turquoise bags. +pale yellow bags contain 1 pale beige bag, 3 striped cyan bags. +striped crimson bags contain 5 shiny indigo bags, 4 dim brown bags, 5 muted salmon bags, 5 mirrored green bags. +mirrored brown bags contain 1 pale tomato bag, 1 striped purple bag, 5 posh gold bags. +bright lime bags contain 2 muted red bags, 1 pale lavender bag, 1 posh white bag. +posh turquoise bags contain 3 pale white bags. +drab red bags contain 3 dark fuchsia bags. +striped gold bags contain 1 mirrored brown bag, 5 drab lavender bags, 4 dotted lavender bags. +dull red bags contain 2 dim crimson bags. +striped cyan bags contain 3 striped salmon bags, 3 wavy beige bags, 2 dim tan bags. +vibrant lime bags contain 1 pale lavender bag. +dotted violet bags contain 4 plaid gold bags, 3 clear green bags. +pale olive bags contain 3 light orange bags, 4 wavy silver bags, 4 shiny indigo bags. +plaid olive bags contain 4 dim purple bags, 5 wavy chartreuse bags, 3 posh plum bags, 4 light violet bags. +dotted coral bags contain 1 striped olive bag, 1 wavy gray bag, 1 vibrant chartreuse bag. +drab lavender bags contain 1 mirrored crimson bag. +mirrored crimson bags contain 3 dark gold bags. +vibrant orange bags contain 1 light blue bag, 3 mirrored brown bags, 2 mirrored plum bags, 3 pale lavender bags. +dull chartreuse bags contain 3 dotted bronze bags, 3 striped teal bags. +wavy turquoise bags contain 4 muted fuchsia bags. +shiny purple bags contain 5 drab salmon bags. +plaid brown bags contain 2 bright green bags, 5 clear aqua bags, 2 plaid plum bags. +pale bronze bags contain 3 bright red bags, 3 pale black bags, 1 wavy lime bag, 4 light maroon bags. +vibrant white bags contain 5 striped yellow bags, 4 dark tan bags. +mirrored blue bags contain 1 plaid indigo bag, 5 muted chartreuse bags, 2 plaid lime bags, 2 drab green bags. +wavy aqua bags contain 4 mirrored orange bags. +drab bronze bags contain 1 bright purple bag, 5 dim coral bags, 4 shiny green bags, 2 pale beige bags. +mirrored chartreuse bags contain 2 mirrored tomato bags, 4 posh lime bags, 5 posh tan bags, 4 pale aqua bags. +bright blue bags contain 3 dark violet bags. +mirrored yellow bags contain 2 pale tomato bags, 4 vibrant gold bags, 1 faded teal bag, 2 bright purple bags. +plaid black bags contain 2 plaid purple bags, 5 dotted bronze bags. +shiny silver bags contain 1 dull lavender bag, 5 pale magenta bags, 2 drab white bags. +mirrored salmon bags contain 1 muted lime bag, 4 shiny bronze bags. +muted maroon bags contain 3 muted lime bags, 1 muted turquoise bag. +light black bags contain 3 striped beige bags, 2 shiny olive bags, 2 drab olive bags. +wavy blue bags contain 2 dull violet bags, 1 pale magenta bag, 3 bright black bags. +light silver bags contain 1 shiny bronze bag, 2 faded lavender bags. +shiny coral bags contain 2 mirrored tomato bags, 2 faded fuchsia bags, 2 striped violet bags, 4 shiny orange bags. +striped coral bags contain 1 clear indigo bag, 3 muted bronze bags, 4 shiny turquoise bags. +shiny bronze bags contain 4 light gold bags. +bright crimson bags contain 4 mirrored blue bags, 3 dull aqua bags, 5 muted lavender bags, 1 dotted turquoise bag. +striped turquoise bags contain 3 striped indigo bags, 3 clear fuchsia bags, 4 bright black bags, 1 vibrant aqua bag. +faded green bags contain 3 posh olive bags, 4 bright violet bags, 5 dull yellow bags, 3 dull olive bags. +dark coral bags contain 2 wavy green bags, 2 shiny cyan bags, 5 light red bags, 3 bright red bags. +clear teal bags contain 3 plaid beige bags, 5 faded aqua bags, 2 dim yellow bags, 5 bright gray bags. +plaid chartreuse bags contain 2 dark magenta bags, 5 wavy olive bags, 2 plaid plum bags. +shiny aqua bags contain 1 wavy indigo bag, 1 dull bronze bag, 4 shiny bronze bags. +wavy salmon bags contain 2 pale lime bags, 4 drab silver bags. +striped yellow bags contain 4 faded black bags. +mirrored black bags contain 5 muted yellow bags. +bright gold bags contain 2 mirrored crimson bags, 1 vibrant purple bag. +vibrant purple bags contain 1 muted tomato bag, 5 shiny green bags, 1 dark turquoise bag. +dull fuchsia bags contain 1 wavy gold bag, 2 plaid yellow bags. +light maroon bags contain 5 striped indigo bags, 3 muted red bags, 3 muted lime bags, 2 striped lavender bags. +clear yellow bags contain 3 plaid beige bags. +clear tan bags contain 2 vibrant red bags, 4 light chartreuse bags. +dotted tomato bags contain 5 vibrant black bags, 5 dotted gray bags, 5 plaid red bags. +dark plum bags contain 5 dotted orange bags, 2 mirrored blue bags, 1 light indigo bag. +posh magenta bags contain 3 dim gold bags, 1 drab coral bag, 3 shiny tomato bags. +posh salmon bags contain 4 posh tomato bags, 3 pale silver bags. +vibrant bronze bags contain 4 posh orange bags. +dim tomato bags contain 2 dull black bags, 1 striped aqua bag. +posh white bags contain 3 shiny plum bags, 2 wavy olive bags. +mirrored plum bags contain 5 dotted teal bags, 2 bright maroon bags. +light coral bags contain 3 dull brown bags, 4 pale red bags, 4 dull orange bags, 5 dim crimson bags. +striped teal bags contain 1 plaid plum bag, 4 striped tomato bags, 1 mirrored orange bag, 5 mirrored fuchsia bags. +striped orange bags contain 4 dark crimson bags, 5 drab green bags, 5 striped tan bags. +dark gold bags contain 2 bright plum bags, 1 striped purple bag, 3 wavy beige bags. +drab fuchsia bags contain 5 wavy orange bags. +dull salmon bags contain 2 dull olive bags, 4 bright silver bags, 1 muted tomato bag. +shiny fuchsia bags contain 2 mirrored fuchsia bags, 1 bright black bag, 2 clear orange bags, 4 wavy gold bags. +clear bronze bags contain 4 posh purple bags, 3 dim gold bags, 3 light chartreuse bags, 1 shiny cyan bag. +dim gray bags contain 5 muted beige bags, 1 dim purple bag. +faded magenta bags contain 3 mirrored aqua bags, 3 vibrant maroon bags, 5 drab red bags, 1 light magenta bag. +muted fuchsia bags contain 1 dim indigo bag, 5 vibrant purple bags, 2 posh silver bags. +posh beige bags contain 3 dark gold bags. +bright yellow bags contain 2 mirrored blue bags. +clear orange bags contain 4 vibrant purple bags, 2 clear fuchsia bags. +pale salmon bags contain 4 wavy black bags, 3 muted olive bags, 5 wavy teal bags, 3 dotted orange bags. +dim chartreuse bags contain 1 mirrored bronze bag, 5 shiny lavender bags, 4 dark red bags. +clear gray bags contain 4 bright indigo bags, 5 wavy coral bags, 4 drab tomato bags, 1 mirrored tomato bag. +drab maroon bags contain 2 dotted lime bags, 2 muted beige bags, 2 clear aqua bags, 4 drab silver bags. +muted black bags contain 4 wavy fuchsia bags, 1 striped cyan bag, 4 faded purple bags. +clear blue bags contain 2 striped teal bags. +mirrored red bags contain 3 posh plum bags, 2 striped beige bags. +dull lavender bags contain 2 vibrant purple bags. +shiny maroon bags contain 4 vibrant chartreuse bags. +dim fuchsia bags contain 1 striped maroon bag, 3 faded gray bags, 4 vibrant aqua bags. +faded plum bags contain 5 posh black bags, 4 striped turquoise bags, 1 striped plum bag. +plaid cyan bags contain 1 dim turquoise bag, 1 mirrored tan bag, 5 plaid fuchsia bags. +muted olive bags contain 5 wavy beige bags, 5 striped tomato bags, 5 posh tan bags, 2 pale magenta bags. +dark cyan bags contain 5 wavy green bags, 4 muted violet bags. +vibrant lavender bags contain 1 mirrored orange bag, 4 dull yellow bags, 5 bright silver bags. +drab beige bags contain 1 drab yellow bag. +plaid indigo bags contain 5 clear olive bags, 4 striped teal bags, 4 pale violet bags, 4 shiny gold bags. +dark fuchsia bags contain 3 drab magenta bags, 1 mirrored orange bag. +faded chartreuse bags contain 5 pale blue bags, 3 dim tan bags, 5 dull red bags, 4 wavy maroon bags. +shiny orange bags contain 3 dark gold bags, 2 posh silver bags, 1 dull cyan bag, 4 drab silver bags. +striped black bags contain 5 wavy teal bags, 5 light chartreuse bags, 4 wavy coral bags. +light crimson bags contain 2 dim gold bags. +wavy yellow bags contain 2 dark lime bags, 1 bright fuchsia bag, 2 plaid purple bags, 4 dark bronze bags. +faded teal bags contain 3 posh bronze bags, 1 striped yellow bag, 3 dim aqua bags. +plaid gold bags contain 5 bright black bags, 2 shiny yellow bags, 5 mirrored orange bags, 5 dark lime bags. +clear beige bags contain 3 faded blue bags, 1 plaid plum bag. +dull plum bags contain 1 mirrored green bag, 3 mirrored lime bags. +bright beige bags contain 4 shiny white bags, 5 faded teal bags, 3 mirrored plum bags. +plaid turquoise bags contain 4 striped gray bags. +dark beige bags contain 5 plaid brown bags, 4 bright plum bags. +dull white bags contain 3 posh coral bags. +vibrant red bags contain 4 plaid red bags. +drab indigo bags contain 5 shiny black bags, 3 mirrored brown bags, 4 muted olive bags, 2 mirrored coral bags. +plaid lime bags contain 4 dim gold bags. +plaid tan bags contain 2 dark fuchsia bags, 3 dotted purple bags, 5 dull bronze bags, 3 light blue bags. +mirrored maroon bags contain 4 mirrored green bags, 1 dark tomato bag. +shiny red bags contain 1 dim salmon bag, 1 plaid plum bag, 4 drab orange bags, 5 shiny teal bags. +dark lime bags contain 4 shiny white bags, 3 shiny indigo bags, 4 light cyan bags, 2 muted brown bags. +dull yellow bags contain 3 muted brown bags, 1 light maroon bag. +mirrored silver bags contain 3 pale brown bags, 5 mirrored yellow bags, 1 pale teal bag, 4 plaid red bags. +light teal bags contain 3 posh plum bags. +drab tomato bags contain 2 pale coral bags, 5 clear olive bags. +mirrored lavender bags contain 3 plaid fuchsia bags, 3 muted yellow bags. +drab plum bags contain 5 plaid olive bags. +dotted purple bags contain 2 plaid red bags, 4 mirrored bronze bags, 5 shiny teal bags, 3 dim blue bags. +vibrant coral bags contain 1 dotted lime bag, 5 shiny salmon bags, 3 mirrored blue bags, 2 striped indigo bags. +faded olive bags contain 1 drab blue bag, 4 vibrant indigo bags, 3 dotted lavender bags, 5 muted silver bags. +wavy white bags contain 3 mirrored maroon bags, 2 dim white bags, 2 dark magenta bags, 4 clear fuchsia bags. +clear white bags contain 2 light chartreuse bags, 5 plaid fuchsia bags, 2 drab lime bags, 1 clear indigo bag. +pale blue bags contain 2 dim crimson bags, 4 light green bags, 4 vibrant aqua bags, 5 drab white bags. +mirrored olive bags contain 2 bright gold bags, 4 bright tomato bags. +vibrant salmon bags contain 5 dim maroon bags, 2 dull cyan bags. +plaid coral bags contain 1 bright gray bag. +plaid crimson bags contain 2 muted black bags, 3 drab turquoise bags, 2 mirrored beige bags. +faded maroon bags contain 5 drab tan bags, 4 mirrored brown bags, 1 light silver bag. +vibrant brown bags contain 2 faded salmon bags, 2 posh plum bags, 5 wavy lime bags, 2 shiny beige bags. +dull gold bags contain 5 shiny salmon bags, 3 drab silver bags, 1 wavy beige bag. +bright turquoise bags contain 5 wavy blue bags, 4 muted chartreuse bags. +light lavender bags contain 1 drab olive bag, 1 posh violet bag. +posh maroon bags contain 5 bright chartreuse bags, 4 muted black bags, 3 dull tan bags, 2 mirrored gray bags. +muted red bags contain 1 striped crimson bag, 5 light blue bags. +dark violet bags contain 2 muted blue bags, 1 light bronze bag. +striped chartreuse bags contain 1 dark violet bag, 1 faded turquoise bag, 3 vibrant tomato bags, 5 dotted teal bags. +dull turquoise bags contain 3 drab tan bags. +vibrant olive bags contain 2 drab purple bags. +shiny yellow bags contain 2 faded lavender bags, 4 shiny cyan bags. +posh lime bags contain 3 light plum bags, 4 clear magenta bags. +dotted aqua bags contain 3 dim lime bags, 2 light green bags. +dim yellow bags contain 4 bright brown bags, 4 wavy coral bags. +shiny blue bags contain 4 dotted yellow bags, 1 dim crimson bag, 1 clear black bag. +wavy maroon bags contain 4 vibrant aqua bags, 4 striped bronze bags, 3 dotted silver bags. +drab coral bags contain 1 wavy teal bag, 3 plaid orange bags, 2 posh orange bags, 1 mirrored olive bag. +bright teal bags contain 2 pale magenta bags. +bright purple bags contain 4 shiny chartreuse bags, 5 plaid lime bags, 2 dim magenta bags. + From 6aca049908d95973afd3309359e3d854658310fd Mon Sep 17 00:00:00 2001 From: Teo-CD Date: Mon, 21 Dec 2020 00:15:59 +0100 Subject: [PATCH 11/28] Day 8 of 2020 done in Python Single threaded brute force for finding the correct fix. Don't really like it : might be something smarter to do, will try threads. --- 2020/Day 8/Solution.py | 62 ++++ 2020/Day 8/input.txt | 636 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 698 insertions(+) create mode 100644 2020/Day 8/Solution.py create mode 100644 2020/Day 8/input.txt diff --git a/2020/Day 8/Solution.py b/2020/Day 8/Solution.py new file mode 100644 index 0000000..80d6b5d --- /dev/null +++ b/2020/Day 8/Solution.py @@ -0,0 +1,62 @@ +input_file = "input.txt" + + +def run_file(current_line=0, explored_lines=None, accumulator=0, switch=False): + """ + Run the program contained in the eponymous list. If switch is True, try and correct the program + to be able to complete it. Otherwise, exit on program end or repeated instruction. + :param current_line: Position to start at in the program (Program Counter) + :param explored_lines: Array of already executed instructions, to detect repeats + :param accumulator: Starting value of the accumulator + :param switch: If True, try to switch a nop to a jmp or vice-versa to fix the program + :return: True if booted successfully or if a correction allowed to boot. + """ + if explored_lines is None: + explored_lines = list() + + while current_line <= len(program) - 1: + if current_line in explored_lines: + print(f"Instruciton at line {current_line} would have been executed twice.\n" + f"The accumulator value at this point was {accumulator}") + return False + + instruction, argument = program[current_line].split(" ") + explored_lines.append(current_line) + + if instruction == "jmp": + if switch: + # Simulate nop by copying the current state and adding one the the current_line + if run_file(current_line+1, explored_lines.copy(), accumulator): + print(f"Successful modification at line {current_line}") + return True + + current_line += int(argument) + + elif instruction == "nop": + if switch: + # Simulate a jump by copying the current state but adding the current argument to the current_line + if run_file(current_line+int(argument), explored_lines.copy(), accumulator): + print(f"Successful modification at line {current_line}") + return True + + current_line += 1 + + elif instruction == "acc": + accumulator += int(argument) + current_line += 1 + + print(f"Booted successfully !\nThe final accumulator value was {accumulator}") + return True + + +program = [] + + +with open(input_file) as instructions: + line = instructions.readline() + while line and line != "\n": + line = line.strip("\n") + program.append(line) + line = instructions.readline() + +run_file(switch=True) diff --git a/2020/Day 8/input.txt b/2020/Day 8/input.txt new file mode 100644 index 0000000..b97230b --- /dev/null +++ b/2020/Day 8/input.txt @@ -0,0 +1,636 @@ +acc -13 +jmp +37 +acc -19 +jmp +1 +jmp +1 +jmp +413 +acc +10 +jmp +194 +jmp +587 +jmp +388 +acc +48 +nop +284 +acc +35 +jmp +239 +acc +0 +jmp +58 +acc +22 +acc +45 +acc +25 +acc +23 +jmp +544 +jmp +610 +nop +273 +jmp +554 +jmp +584 +acc +30 +jmp +481 +acc +29 +jmp +342 +acc +9 +acc +23 +nop +377 +jmp +483 +acc +33 +jmp +128 +nop +560 +nop +437 +jmp +485 +acc +2 +acc +30 +jmp +456 +acc +0 +acc -15 +nop +126 +acc +47 +jmp +299 +acc +36 +acc +9 +jmp -21 +acc +10 +acc +26 +acc -3 +acc +31 +jmp +337 +nop +517 +jmp +303 +acc +20 +nop -43 +acc +30 +acc +24 +jmp +348 +jmp +158 +acc +23 +acc +16 +acc +40 +jmp +1 +jmp +465 +acc +12 +jmp +276 +acc +0 +acc +32 +acc +43 +jmp +487 +acc +40 +acc +49 +nop +540 +jmp +455 +acc +24 +jmp +481 +acc +30 +nop +256 +acc +29 +acc +14 +jmp +390 +jmp +1 +acc -3 +jmp +1 +jmp +295 +acc +6 +acc +46 +acc +16 +nop +128 +jmp -38 +acc +0 +acc +16 +acc +10 +jmp +185 +acc -19 +acc +0 +acc +23 +acc -16 +jmp +180 +acc +14 +jmp +1 +acc +31 +acc -4 +jmp +439 +jmp +204 +acc +50 +acc +12 +nop +154 +jmp +474 +acc -16 +jmp +511 +acc +6 +acc +32 +jmp +504 +acc +17 +acc +21 +acc -18 +jmp +298 +acc -17 +acc +16 +acc +4 +acc +18 +jmp +18 +acc -10 +acc +26 +acc +36 +jmp +166 +nop -109 +jmp +266 +acc -9 +jmp +306 +nop +324 +acc +16 +acc +33 +acc +18 +jmp -50 +acc +25 +jmp +196 +acc +21 +jmp +308 +jmp +38 +acc +27 +jmp -48 +acc +14 +acc +46 +acc +48 +acc +15 +jmp +223 +acc +0 +acc +12 +jmp -115 +acc +19 +acc +27 +acc +30 +jmp +377 +jmp -144 +jmp +231 +acc +1 +jmp +410 +acc +41 +jmp +138 +acc -13 +acc -8 +acc -7 +acc +25 +jmp +366 +acc +8 +jmp +182 +acc +2 +nop +104 +acc +24 +acc +21 +jmp -43 +acc -8 +acc +37 +acc +23 +jmp +292 +jmp +365 +acc +33 +nop -144 +acc -10 +jmp +387 +acc +13 +acc -6 +acc -12 +nop +134 +jmp +345 +acc +5 +acc +16 +acc +35 +acc +50 +jmp +250 +acc +46 +jmp +105 +acc -6 +nop -152 +jmp +233 +jmp -88 +acc +39 +jmp +59 +acc -4 +acc +47 +jmp +165 +acc +32 +acc +49 +acc +24 +jmp +344 +acc -5 +acc +3 +jmp +359 +acc +27 +jmp +72 +acc +0 +acc +16 +acc +40 +jmp +98 +acc +2 +acc +23 +acc +48 +acc +2 +jmp -33 +jmp -186 +acc +27 +nop -83 +acc +2 +acc +19 +jmp -141 +acc +39 +acc +34 +acc +33 +jmp +282 +jmp +306 +acc +12 +jmp +317 +acc +32 +acc +50 +acc +17 +jmp +52 +acc +3 +acc +35 +jmp +328 +acc +26 +nop +163 +acc +6 +acc +19 +jmp +154 +acc +4 +jmp +1 +jmp +373 +acc -12 +acc +47 +jmp +1 +jmp -234 +acc +45 +acc +46 +acc -14 +acc +50 +jmp -134 +acc +26 +jmp +128 +jmp +233 +acc +23 +nop -133 +jmp -154 +jmp +260 +acc +21 +acc +14 +nop -89 +acc +9 +jmp -113 +acc +10 +acc +5 +jmp +127 +acc -9 +acc +2 +jmp +286 +nop +274 +jmp +93 +acc +46 +acc +36 +jmp +53 +acc +30 +jmp -126 +acc +11 +acc +11 +acc +23 +jmp +296 +nop -100 +jmp +304 +jmp +219 +acc +16 +jmp -93 +acc +12 +jmp +1 +jmp +205 +acc +6 +acc -11 +jmp +202 +jmp +107 +jmp +1 +jmp -224 +acc +24 +acc +50 +acc +37 +jmp +45 +acc +25 +acc -15 +jmp -151 +jmp +1 +acc +47 +jmp -196 +jmp +1 +jmp +300 +jmp +116 +acc +39 +acc +0 +nop -176 +acc -7 +jmp -53 +acc +20 +nop -216 +nop +291 +jmp +38 +acc +0 +acc +32 +acc -19 +jmp -28 +jmp -176 +acc +33 +acc +11 +acc +47 +nop -58 +jmp -203 +acc +48 +acc +50 +acc +41 +jmp -315 +acc -12 +acc +23 +acc +32 +jmp +210 +acc +46 +acc -11 +acc -16 +jmp +103 +acc +25 +nop +95 +acc +9 +jmp -117 +nop +18 +acc -19 +acc +38 +jmp -130 +acc +22 +jmp +25 +nop +201 +nop +205 +acc +14 +jmp -124 +jmp -46 +acc +9 +jmp -257 +acc -19 +acc -17 +acc +36 +acc +24 +jmp -210 +jmp -231 +acc +40 +jmp +46 +nop -192 +acc -13 +acc +7 +acc +33 +jmp +103 +acc +18 +acc +37 +acc -14 +jmp -11 +acc +12 +nop -240 +acc +35 +acc +33 +jmp -274 +acc -9 +acc +24 +jmp -128 +nop -129 +acc -17 +jmp -62 +acc +0 +acc +42 +nop +116 +jmp -44 +acc +16 +jmp +179 +acc -8 +acc +8 +jmp -149 +acc +39 +acc +2 +acc +14 +acc +12 +jmp -373 +jmp +76 +jmp -232 +jmp -385 +acc +22 +acc +41 +acc +28 +jmp -179 +acc +0 +acc +22 +acc +15 +jmp -291 +acc -18 +jmp -222 +acc +45 +acc -15 +jmp +61 +acc +10 +acc +16 +acc +43 +jmp +177 +acc +43 +acc -12 +acc +20 +acc +27 +jmp -13 +acc -14 +jmp -336 +nop -158 +acc +3 +nop -409 +acc +17 +jmp -257 +acc +0 +nop +124 +jmp +1 +jmp +117 +jmp -179 +acc -17 +acc -2 +jmp +1 +jmp -37 +acc +42 +jmp +175 +acc -9 +acc +12 +acc +4 +jmp +69 +acc -7 +jmp +1 +acc +32 +jmp +54 +jmp -444 +acc +7 +jmp -87 +acc -6 +nop -323 +acc +47 +acc -5 +jmp -143 +jmp +1 +nop -44 +acc +27 +acc +21 +jmp -184 +jmp -404 +jmp -70 +acc +32 +jmp -13 +acc +0 +nop -452 +acc +1 +acc +31 +jmp -77 +jmp -401 +acc +42 +jmp -428 +nop -120 +acc -17 +nop -75 +acc +6 +jmp +20 +jmp -291 +acc +7 +jmp +37 +acc +10 +acc +15 +jmp +1 +acc +11 +jmp -363 +acc -14 +nop -321 +jmp -40 +acc +41 +acc +31 +jmp +58 +jmp -493 +acc +32 +acc -10 +acc +44 +jmp -211 +acc +47 +acc +23 +jmp -241 +jmp -224 +acc -1 +jmp -350 +acc +8 +jmp -280 +acc -19 +acc +0 +acc +17 +jmp -274 +acc +27 +acc +11 +jmp -82 +acc +48 +acc +27 +jmp -518 +acc +3 +jmp -124 +jmp +1 +jmp -490 +acc +41 +jmp -238 +acc -6 +jmp -386 +jmp -189 +acc -11 +jmp +80 +acc -8 +acc +9 +nop -99 +jmp +56 +acc -18 +jmp -83 +acc +28 +acc +13 +jmp -228 +acc +32 +acc +34 +acc +3 +jmp -272 +nop -410 +acc +13 +acc -17 +jmp -236 +acc +45 +acc +0 +acc +19 +nop +29 +jmp +38 +jmp -75 +acc +7 +acc +33 +acc +40 +jmp -180 +jmp -557 +acc +22 +jmp -249 +acc +44 +acc +45 +acc +2 +acc -19 +jmp -537 +acc +44 +acc +32 +acc -14 +acc +39 +jmp -406 +jmp -488 +acc +14 +acc +41 +jmp -327 +acc +17 +acc +25 +nop -573 +acc +0 +jmp -563 +acc +18 +nop -282 +acc +13 +acc +45 +jmp -325 +acc +41 +acc -10 +nop -47 +nop -223 +jmp -155 +acc +14 +acc +23 +jmp +23 +acc +21 +nop -229 +acc +27 +acc -5 +jmp -95 +acc +2 +acc -10 +nop -451 +jmp -393 +jmp -406 +acc +42 +acc +18 +acc +49 +jmp -307 +acc -11 +jmp +1 +jmp -424 +jmp -192 +acc +49 +acc -1 +acc -17 +jmp -355 +jmp -268 +nop -320 +acc +1 +jmp -134 +acc +46 +jmp -564 +acc +40 +acc +29 +acc +13 +nop -285 +jmp -272 +acc +19 +acc -14 +acc +25 +acc +18 +jmp +1 From e5dbc8f1e65fd861abd7d84dfe82b446d8481426 Mon Sep 17 00:00:00 2001 From: trotFunky Date: Mon, 21 Dec 2020 00:15:59 +0100 Subject: [PATCH 12/28] Day 8 of 2020 done in Python Single threaded brute force for finding the correct fix. Don't really like it : might be something smarter to do, will try threads. --- 2020/Day 8/Solution.py | 62 ++++ 2020/Day 8/input.txt | 636 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 698 insertions(+) create mode 100644 2020/Day 8/Solution.py create mode 100644 2020/Day 8/input.txt diff --git a/2020/Day 8/Solution.py b/2020/Day 8/Solution.py new file mode 100644 index 0000000..80d6b5d --- /dev/null +++ b/2020/Day 8/Solution.py @@ -0,0 +1,62 @@ +input_file = "input.txt" + + +def run_file(current_line=0, explored_lines=None, accumulator=0, switch=False): + """ + Run the program contained in the eponymous list. If switch is True, try and correct the program + to be able to complete it. Otherwise, exit on program end or repeated instruction. + :param current_line: Position to start at in the program (Program Counter) + :param explored_lines: Array of already executed instructions, to detect repeats + :param accumulator: Starting value of the accumulator + :param switch: If True, try to switch a nop to a jmp or vice-versa to fix the program + :return: True if booted successfully or if a correction allowed to boot. + """ + if explored_lines is None: + explored_lines = list() + + while current_line <= len(program) - 1: + if current_line in explored_lines: + print(f"Instruciton at line {current_line} would have been executed twice.\n" + f"The accumulator value at this point was {accumulator}") + return False + + instruction, argument = program[current_line].split(" ") + explored_lines.append(current_line) + + if instruction == "jmp": + if switch: + # Simulate nop by copying the current state and adding one the the current_line + if run_file(current_line+1, explored_lines.copy(), accumulator): + print(f"Successful modification at line {current_line}") + return True + + current_line += int(argument) + + elif instruction == "nop": + if switch: + # Simulate a jump by copying the current state but adding the current argument to the current_line + if run_file(current_line+int(argument), explored_lines.copy(), accumulator): + print(f"Successful modification at line {current_line}") + return True + + current_line += 1 + + elif instruction == "acc": + accumulator += int(argument) + current_line += 1 + + print(f"Booted successfully !\nThe final accumulator value was {accumulator}") + return True + + +program = [] + + +with open(input_file) as instructions: + line = instructions.readline() + while line and line != "\n": + line = line.strip("\n") + program.append(line) + line = instructions.readline() + +run_file(switch=True) diff --git a/2020/Day 8/input.txt b/2020/Day 8/input.txt new file mode 100644 index 0000000..b97230b --- /dev/null +++ b/2020/Day 8/input.txt @@ -0,0 +1,636 @@ +acc -13 +jmp +37 +acc -19 +jmp +1 +jmp +1 +jmp +413 +acc +10 +jmp +194 +jmp +587 +jmp +388 +acc +48 +nop +284 +acc +35 +jmp +239 +acc +0 +jmp +58 +acc +22 +acc +45 +acc +25 +acc +23 +jmp +544 +jmp +610 +nop +273 +jmp +554 +jmp +584 +acc +30 +jmp +481 +acc +29 +jmp +342 +acc +9 +acc +23 +nop +377 +jmp +483 +acc +33 +jmp +128 +nop +560 +nop +437 +jmp +485 +acc +2 +acc +30 +jmp +456 +acc +0 +acc -15 +nop +126 +acc +47 +jmp +299 +acc +36 +acc +9 +jmp -21 +acc +10 +acc +26 +acc -3 +acc +31 +jmp +337 +nop +517 +jmp +303 +acc +20 +nop -43 +acc +30 +acc +24 +jmp +348 +jmp +158 +acc +23 +acc +16 +acc +40 +jmp +1 +jmp +465 +acc +12 +jmp +276 +acc +0 +acc +32 +acc +43 +jmp +487 +acc +40 +acc +49 +nop +540 +jmp +455 +acc +24 +jmp +481 +acc +30 +nop +256 +acc +29 +acc +14 +jmp +390 +jmp +1 +acc -3 +jmp +1 +jmp +295 +acc +6 +acc +46 +acc +16 +nop +128 +jmp -38 +acc +0 +acc +16 +acc +10 +jmp +185 +acc -19 +acc +0 +acc +23 +acc -16 +jmp +180 +acc +14 +jmp +1 +acc +31 +acc -4 +jmp +439 +jmp +204 +acc +50 +acc +12 +nop +154 +jmp +474 +acc -16 +jmp +511 +acc +6 +acc +32 +jmp +504 +acc +17 +acc +21 +acc -18 +jmp +298 +acc -17 +acc +16 +acc +4 +acc +18 +jmp +18 +acc -10 +acc +26 +acc +36 +jmp +166 +nop -109 +jmp +266 +acc -9 +jmp +306 +nop +324 +acc +16 +acc +33 +acc +18 +jmp -50 +acc +25 +jmp +196 +acc +21 +jmp +308 +jmp +38 +acc +27 +jmp -48 +acc +14 +acc +46 +acc +48 +acc +15 +jmp +223 +acc +0 +acc +12 +jmp -115 +acc +19 +acc +27 +acc +30 +jmp +377 +jmp -144 +jmp +231 +acc +1 +jmp +410 +acc +41 +jmp +138 +acc -13 +acc -8 +acc -7 +acc +25 +jmp +366 +acc +8 +jmp +182 +acc +2 +nop +104 +acc +24 +acc +21 +jmp -43 +acc -8 +acc +37 +acc +23 +jmp +292 +jmp +365 +acc +33 +nop -144 +acc -10 +jmp +387 +acc +13 +acc -6 +acc -12 +nop +134 +jmp +345 +acc +5 +acc +16 +acc +35 +acc +50 +jmp +250 +acc +46 +jmp +105 +acc -6 +nop -152 +jmp +233 +jmp -88 +acc +39 +jmp +59 +acc -4 +acc +47 +jmp +165 +acc +32 +acc +49 +acc +24 +jmp +344 +acc -5 +acc +3 +jmp +359 +acc +27 +jmp +72 +acc +0 +acc +16 +acc +40 +jmp +98 +acc +2 +acc +23 +acc +48 +acc +2 +jmp -33 +jmp -186 +acc +27 +nop -83 +acc +2 +acc +19 +jmp -141 +acc +39 +acc +34 +acc +33 +jmp +282 +jmp +306 +acc +12 +jmp +317 +acc +32 +acc +50 +acc +17 +jmp +52 +acc +3 +acc +35 +jmp +328 +acc +26 +nop +163 +acc +6 +acc +19 +jmp +154 +acc +4 +jmp +1 +jmp +373 +acc -12 +acc +47 +jmp +1 +jmp -234 +acc +45 +acc +46 +acc -14 +acc +50 +jmp -134 +acc +26 +jmp +128 +jmp +233 +acc +23 +nop -133 +jmp -154 +jmp +260 +acc +21 +acc +14 +nop -89 +acc +9 +jmp -113 +acc +10 +acc +5 +jmp +127 +acc -9 +acc +2 +jmp +286 +nop +274 +jmp +93 +acc +46 +acc +36 +jmp +53 +acc +30 +jmp -126 +acc +11 +acc +11 +acc +23 +jmp +296 +nop -100 +jmp +304 +jmp +219 +acc +16 +jmp -93 +acc +12 +jmp +1 +jmp +205 +acc +6 +acc -11 +jmp +202 +jmp +107 +jmp +1 +jmp -224 +acc +24 +acc +50 +acc +37 +jmp +45 +acc +25 +acc -15 +jmp -151 +jmp +1 +acc +47 +jmp -196 +jmp +1 +jmp +300 +jmp +116 +acc +39 +acc +0 +nop -176 +acc -7 +jmp -53 +acc +20 +nop -216 +nop +291 +jmp +38 +acc +0 +acc +32 +acc -19 +jmp -28 +jmp -176 +acc +33 +acc +11 +acc +47 +nop -58 +jmp -203 +acc +48 +acc +50 +acc +41 +jmp -315 +acc -12 +acc +23 +acc +32 +jmp +210 +acc +46 +acc -11 +acc -16 +jmp +103 +acc +25 +nop +95 +acc +9 +jmp -117 +nop +18 +acc -19 +acc +38 +jmp -130 +acc +22 +jmp +25 +nop +201 +nop +205 +acc +14 +jmp -124 +jmp -46 +acc +9 +jmp -257 +acc -19 +acc -17 +acc +36 +acc +24 +jmp -210 +jmp -231 +acc +40 +jmp +46 +nop -192 +acc -13 +acc +7 +acc +33 +jmp +103 +acc +18 +acc +37 +acc -14 +jmp -11 +acc +12 +nop -240 +acc +35 +acc +33 +jmp -274 +acc -9 +acc +24 +jmp -128 +nop -129 +acc -17 +jmp -62 +acc +0 +acc +42 +nop +116 +jmp -44 +acc +16 +jmp +179 +acc -8 +acc +8 +jmp -149 +acc +39 +acc +2 +acc +14 +acc +12 +jmp -373 +jmp +76 +jmp -232 +jmp -385 +acc +22 +acc +41 +acc +28 +jmp -179 +acc +0 +acc +22 +acc +15 +jmp -291 +acc -18 +jmp -222 +acc +45 +acc -15 +jmp +61 +acc +10 +acc +16 +acc +43 +jmp +177 +acc +43 +acc -12 +acc +20 +acc +27 +jmp -13 +acc -14 +jmp -336 +nop -158 +acc +3 +nop -409 +acc +17 +jmp -257 +acc +0 +nop +124 +jmp +1 +jmp +117 +jmp -179 +acc -17 +acc -2 +jmp +1 +jmp -37 +acc +42 +jmp +175 +acc -9 +acc +12 +acc +4 +jmp +69 +acc -7 +jmp +1 +acc +32 +jmp +54 +jmp -444 +acc +7 +jmp -87 +acc -6 +nop -323 +acc +47 +acc -5 +jmp -143 +jmp +1 +nop -44 +acc +27 +acc +21 +jmp -184 +jmp -404 +jmp -70 +acc +32 +jmp -13 +acc +0 +nop -452 +acc +1 +acc +31 +jmp -77 +jmp -401 +acc +42 +jmp -428 +nop -120 +acc -17 +nop -75 +acc +6 +jmp +20 +jmp -291 +acc +7 +jmp +37 +acc +10 +acc +15 +jmp +1 +acc +11 +jmp -363 +acc -14 +nop -321 +jmp -40 +acc +41 +acc +31 +jmp +58 +jmp -493 +acc +32 +acc -10 +acc +44 +jmp -211 +acc +47 +acc +23 +jmp -241 +jmp -224 +acc -1 +jmp -350 +acc +8 +jmp -280 +acc -19 +acc +0 +acc +17 +jmp -274 +acc +27 +acc +11 +jmp -82 +acc +48 +acc +27 +jmp -518 +acc +3 +jmp -124 +jmp +1 +jmp -490 +acc +41 +jmp -238 +acc -6 +jmp -386 +jmp -189 +acc -11 +jmp +80 +acc -8 +acc +9 +nop -99 +jmp +56 +acc -18 +jmp -83 +acc +28 +acc +13 +jmp -228 +acc +32 +acc +34 +acc +3 +jmp -272 +nop -410 +acc +13 +acc -17 +jmp -236 +acc +45 +acc +0 +acc +19 +nop +29 +jmp +38 +jmp -75 +acc +7 +acc +33 +acc +40 +jmp -180 +jmp -557 +acc +22 +jmp -249 +acc +44 +acc +45 +acc +2 +acc -19 +jmp -537 +acc +44 +acc +32 +acc -14 +acc +39 +jmp -406 +jmp -488 +acc +14 +acc +41 +jmp -327 +acc +17 +acc +25 +nop -573 +acc +0 +jmp -563 +acc +18 +nop -282 +acc +13 +acc +45 +jmp -325 +acc +41 +acc -10 +nop -47 +nop -223 +jmp -155 +acc +14 +acc +23 +jmp +23 +acc +21 +nop -229 +acc +27 +acc -5 +jmp -95 +acc +2 +acc -10 +nop -451 +jmp -393 +jmp -406 +acc +42 +acc +18 +acc +49 +jmp -307 +acc -11 +jmp +1 +jmp -424 +jmp -192 +acc +49 +acc -1 +acc -17 +jmp -355 +jmp -268 +nop -320 +acc +1 +jmp -134 +acc +46 +jmp -564 +acc +40 +acc +29 +acc +13 +nop -285 +jmp -272 +acc +19 +acc -14 +acc +25 +acc +18 +jmp +1 From 9c2774be196ffdf457156b7aa872564546322064 Mon Sep 17 00:00:00 2001 From: Teo-CD Date: Mon, 21 Dec 2020 00:38:11 +0100 Subject: [PATCH 13/28] 2020 day 8 : alternative Python solution Solved with threads, slower by 20-30% for this workload apparently. Might be because it is the same solution, juste using a new thread for each test instead of one thread. Early exit does not seem to improve things, as the threads complete very quickly. --- 2020/Day 8/Solution - with threads.py | 73 +++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 2020/Day 8/Solution - with threads.py diff --git a/2020/Day 8/Solution - with threads.py b/2020/Day 8/Solution - with threads.py new file mode 100644 index 0000000..8ece44e --- /dev/null +++ b/2020/Day 8/Solution - with threads.py @@ -0,0 +1,73 @@ +from threading import Thread, current_thread, main_thread + +input_file = "input.txt" + +threads = [] + + +def run_file(current_line=0, explored_lines=None, accumulator=0, switch=False): + """ + Run the program contained in the eponymous list. If switch is True, try and correct the program + to be able to complete it on other threads. Otherwise, exit on program end or repeated instruction. + :param current_line: Position to start at in the program (Program Counter) + :param explored_lines: Array of already executed instructions, to detect repeats + :param accumulator: Starting value of the accumulator + :param switch: If True, try to switch a nop to a jmp or vice-versa to fix the program + :return: True if booted successfully or if a correction allowed to boot. + """ + if explored_lines is None: + explored_lines = list() + + while current_line <= len(program) - 1: + if current_line in explored_lines: + print(f"Instruciton at line {current_line} would have been executed twice.\n" + f"The accumulator value at this point was {accumulator}") + return False + + instruction, argument = program[current_line].split(" ") + explored_lines.append(current_line) + + if instruction == "jmp": + if switch: + # Simulate nop by copying the current state and adding one the the current_line + threads.append(Thread(name=str(current_line), target=run_file, + args=(current_line+1, explored_lines.copy(), accumulator))) + threads[-1].start() + + current_line += int(argument) + + elif instruction == "nop": + if switch: + # Simulate a jump by copying the current state but adding the current argument to the current_line + threads.append(Thread(name=str(current_line), target=run_file, + args=(current_line+int(argument), explored_lines.copy(), accumulator))) + threads[-1].start() + + current_line += 1 + + elif instruction == "acc": + accumulator += int(argument) + current_line += 1 + + print(f"Booted successfully !\nThe final accumulator value was {accumulator}") + if current_thread() != main_thread(): + print(f"The boot was possible thanks to a modification on line {current_thread().name}") + + return True + + +program = [] + + +with open(input_file) as instructions: + line = instructions.readline() + while line and line != "\n": + line = line.strip("\n") + program.append(line) + line = instructions.readline() + +run_file(switch=True) + +# Wait for children to terminate +for thread in threads: + thread.join() From 86925c33297ba6b58a008c6cda34b8fb17aa2904 Mon Sep 17 00:00:00 2001 From: trotFunky Date: Mon, 21 Dec 2020 00:46:50 +0100 Subject: [PATCH 14/28] 2020 day 8 : alternative Python solution Solved with threads, slower by 20-30% for this workload apparently. Might be because it is the same solution, juste using a new thread for each test instead of one thread. Early exit does not seem to improve things, as the threads complete very quickly. --- 2020/Day 8/Solution - with threads.py | 73 +++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 2020/Day 8/Solution - with threads.py diff --git a/2020/Day 8/Solution - with threads.py b/2020/Day 8/Solution - with threads.py new file mode 100644 index 0000000..8ece44e --- /dev/null +++ b/2020/Day 8/Solution - with threads.py @@ -0,0 +1,73 @@ +from threading import Thread, current_thread, main_thread + +input_file = "input.txt" + +threads = [] + + +def run_file(current_line=0, explored_lines=None, accumulator=0, switch=False): + """ + Run the program contained in the eponymous list. If switch is True, try and correct the program + to be able to complete it on other threads. Otherwise, exit on program end or repeated instruction. + :param current_line: Position to start at in the program (Program Counter) + :param explored_lines: Array of already executed instructions, to detect repeats + :param accumulator: Starting value of the accumulator + :param switch: If True, try to switch a nop to a jmp or vice-versa to fix the program + :return: True if booted successfully or if a correction allowed to boot. + """ + if explored_lines is None: + explored_lines = list() + + while current_line <= len(program) - 1: + if current_line in explored_lines: + print(f"Instruciton at line {current_line} would have been executed twice.\n" + f"The accumulator value at this point was {accumulator}") + return False + + instruction, argument = program[current_line].split(" ") + explored_lines.append(current_line) + + if instruction == "jmp": + if switch: + # Simulate nop by copying the current state and adding one the the current_line + threads.append(Thread(name=str(current_line), target=run_file, + args=(current_line+1, explored_lines.copy(), accumulator))) + threads[-1].start() + + current_line += int(argument) + + elif instruction == "nop": + if switch: + # Simulate a jump by copying the current state but adding the current argument to the current_line + threads.append(Thread(name=str(current_line), target=run_file, + args=(current_line+int(argument), explored_lines.copy(), accumulator))) + threads[-1].start() + + current_line += 1 + + elif instruction == "acc": + accumulator += int(argument) + current_line += 1 + + print(f"Booted successfully !\nThe final accumulator value was {accumulator}") + if current_thread() != main_thread(): + print(f"The boot was possible thanks to a modification on line {current_thread().name}") + + return True + + +program = [] + + +with open(input_file) as instructions: + line = instructions.readline() + while line and line != "\n": + line = line.strip("\n") + program.append(line) + line = instructions.readline() + +run_file(switch=True) + +# Wait for children to terminate +for thread in threads: + thread.join() From c9671c5e3448225ff95ad8c3b7e9c5c135c602cf Mon Sep 17 00:00:00 2001 From: Teo-CD Date: Mon, 21 Dec 2020 01:42:23 +0100 Subject: [PATCH 15/28] Day 9 of 2020 done in Python --- 2020/Day 9/Solution.py | 72 +++ 2020/Day 9/input.txt | 1000 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 1072 insertions(+) create mode 100644 2020/Day 9/Solution.py create mode 100644 2020/Day 9/input.txt diff --git a/2020/Day 9/Solution.py b/2020/Day 9/Solution.py new file mode 100644 index 0000000..28488af --- /dev/null +++ b/2020/Day 9/Solution.py @@ -0,0 +1,72 @@ +input_file = "input.txt" + + +# Sum each pair of number available, return True if target can be reached +def is_sum_of_two(available_numbers, target): + for index in range(len(available_numbers)): + for number in available_numbers[index+1:]: + if available_numbers[index]+number == target: + return True + return False + + +def find_invalid_digit(): + sliding_last_digits = [] + + with open(input_file) as encoded_digits: + line = encoded_digits.readline() + + # Read the header data + while len(sliding_last_digits) < 25: + sliding_last_digits.append(int(line)) + line = encoded_digits.readline() + + while line and line != "\n": + if not is_sum_of_two(sliding_last_digits, int(line)): + print(f"{int(line)} is not the sum of two of the 25 preceding numbers.") + return int(line) + + sliding_last_digits.pop(0) + sliding_last_digits.append(int(line)) + + line = encoded_digits.readline() + + +def find_vulnerability(invalid_digit=0): + """ + This works by adding every contiguous number until it goes over the target number. + When it goes over, it drops the first number of the contiguous series until it can add the new one. + Thus, the contiguous slice of the main list of number only shrinks on one side and only expands on the other. + """ + currently_summed = [] + current_sum = 0 + + with open(input_file) as encoded_digits: + line = encoded_digits.readline() + next_number = int(line) + + while line and line != "\n": + if current_sum == invalid_digit: + print(f"Found contiguous sum : {currently_summed}\n" + f"The vulnerability is : {min(currently_summed)}+{max(currently_summed)} = " + f"{min(currently_summed) + max(currently_summed)}") + break + + elif current_sum + next_number < invalid_digit: + currently_summed.append(next_number) + current_sum += next_number + + elif current_sum + next_number > invalid_digit: + # Would continue indefinitely if nex_number > invalid_digit. Should not happen. + while current_sum + next_number > invalid_digit: + # Pop the first numbers of the list until we can add the new one + current_sum -= currently_summed.pop(0) + + currently_summed.append(next_number) + current_sum += next_number + + line = encoded_digits.readline() + next_number = int(line) + + +find_vulnerability(find_invalid_digit()) diff --git a/2020/Day 9/input.txt b/2020/Day 9/input.txt new file mode 100644 index 0000000..c3b902a --- /dev/null +++ b/2020/Day 9/input.txt @@ -0,0 +1,1000 @@ +26 +36 +37 +9 +8 +22 +41 +5 +17 +44 +40 +31 +10 +33 +30 +50 +24 +4 +12 +46 +39 +45 +42 +7 +27 +13 +58 +11 +14 +53 +9 +15 +23 +18 +16 +21 +17 +49 +19 +20 +32 +31 +22 +30 +24 +35 +28 +33 +25 +47 +57 +26 +27 +29 +83 +34 +37 +36 +59 +46 +39 +51 +44 +54 +56 +48 +49 +100 +62 +50 +52 +72 +53 +55 +60 +96 +61 +91 +65 +70 +85 +87 +88 +114 +83 +113 +92 +93 +97 +104 +142 +99 +102 +103 +153 +105 +108 +115 +116 +148 +144 +152 +177 +135 +167 +171 +201 +256 +182 +176 +252 +185 +190 +196 +203 +202 +348 +240 +208 +292 +213 +300 +323 +301 +315 +367 +302 +502 +393 +357 +353 +358 +390 +760 +361 +375 +492 +710 +398 +405 +448 +509 +421 +594 +505 +566 +810 +690 +603 +924 +655 +1317 +711 +823 +714 +1171 +719 +736 +759 +1080 +773 +803 +819 +953 +1528 +869 +1195 +1522 +1071 +1509 +1169 +2270 +1314 +1514 +1369 +1366 +1425 +1430 +2620 +2125 +1455 +1830 +1495 +1532 +4045 +1576 +1622 +2397 +1822 +2501 +3331 +2240 +2385 +2664 +2942 +2483 +2680 +2683 +6285 +2791 +2796 +2855 +2987 +4522 +2950 +3108 +3198 +3317 +4207 +3398 +3816 +5031 +4809 +4062 +4868 +4625 +5667 +5049 +5338 +5163 +5587 +5363 +7318 +6506 +5646 +5651 +7405 +5937 +7214 +9874 +6306 +10612 +7379 +11586 +9708 +9179 +15648 +8871 +8687 +16263 +9674 +10212 +10387 +15046 +15901 +19548 +11009 +31549 +40236 +11297 +18965 +13151 +17087 +19920 +16014 +22320 +17766 +16558 +17558 +30262 +17866 +18361 +19083 +19984 +19886 +33617 +39878 +21396 +26343 +22306 +24448 +24160 +27311 +27855 +63879 +29165 +35097 +32572 +47775 +33572 +34324 +40072 +57630 +35919 +53325 +36227 +37444 +38969 +44046 +41282 +45844 +43702 +45556 +58020 +46466 +48608 +51471 +55166 +94135 +80653 +70016 +66144 +70243 +80251 +83910 +76413 +72146 +73363 +77509 +88915 +73671 +103576 +99302 +84984 +188560 +89258 +181085 +92022 +95074 +97937 +136160 +158162 +128529 +136387 +143379 +138290 +168180 +142389 +157273 +145509 +149776 +147034 +169531 +158655 +162586 +162929 +191324 +281669 +174242 +258003 +187195 +187096 +189959 +193011 +226466 +264689 +264916 +266819 +274677 +389395 +301044 +287898 +320202 +292543 +308095 +342787 +309620 +480909 +321584 +325515 +438931 +374291 +361338 +361437 +532680 +377055 +419477 +382970 +607476 +491155 +684166 +531735 +541496 +635135 +602163 +1216846 +580441 +600638 +744992 +617715 +631204 +1022890 +647099 +686952 +686853 +722775 +735629 +738393 +738492 +1271073 +1903798 +1067136 +874125 +1032651 +1149450 +1073231 +1353344 +1121937 +1181079 +1613092 +1231842 +1198156 +1750088 +1248919 +1264814 +1278303 +1333952 +2436941 +2590651 +1805529 +1458404 +2222681 +2936449 +1941261 +1906776 +1947356 +2105882 +2980007 +2872025 +2195168 +2455889 +2320093 +2303016 +2379235 +2429998 +2447075 +2707323 +2513733 +2736707 +2543117 +3263933 +5086558 +3365180 +4136429 +3399665 +3405760 +4053238 +4863210 +3848037 +3854132 +4485117 +4758905 +4498184 +4515261 +4574403 +4816749 +4623109 +4682251 +4826310 +5807050 +4960808 +5056850 +5250440 +8422030 +5908297 +6629113 +6764845 +7219312 +9361394 +7897849 +7253797 +8422440 +8717342 +9932691 +8339249 +9138370 +12962358 +10489301 +13383248 +9631253 +9439858 +9305360 +16126239 +9787118 +10017658 +10211248 +16392167 +14611834 +13393958 +17152003 +15104094 +16615191 +14473109 +15151646 +15593046 +19950349 +17056591 +18936613 +25032904 +17477619 +18443730 +19071111 +27108872 +19226976 +18745218 +31230333 +19516608 +19804776 +36342516 +20228906 +23605206 +27867067 +31668425 +31837688 +36844097 +35101995 +43969517 +29624755 +36704595 +32649637 +35500321 +34534210 +36414232 +35921349 +38298087 +37188948 +68010941 +38974124 +62714735 +38261826 +39321384 +39745514 +64726750 +43834112 +48095973 +60309801 +130725676 +61293180 +67183847 +66329350 +62274392 +87841487 +110163462 +99283925 +72689269 +70034531 +70455559 +75388356 +73110297 +75450774 +76163072 +77235950 +149484846 +77583210 +78007340 +79066898 +132308923 +127001142 +114425323 +131748739 +133982449 +123567572 +134403477 +128603742 +132729951 +137662748 +140490090 +104054607 +145799566 +148038769 +232658349 +143565856 +148498653 +200111439 +179505381 +153399022 +154819160 +155590550 +202634470 +157074238 +213470375 +218479930 +248407772 +238458084 +310409710 +272066225 +227622179 +252093376 +289365422 +286161401 +258873767 +396446541 +247620463 +439560423 +291604625 +430256649 +406912536 +382441339 +308218182 +395532322 +402439623 +311893398 +466080263 +359708708 +370544613 +446102109 +648736579 +479715555 +499688404 +475242642 +530939992 +575526823 +545035168 +506494230 +577766026 +539225088 +986209785 +555838645 +599822807 +603498023 +620111580 +671602106 +667926890 +990656193 +861612585 +730253321 +682438011 +805810817 +834951350 +925817664 +921344751 +954958197 +1133604671 +1006182634 +1014467730 +1062332875 +1432311894 +1045719318 +1868143692 +1223609603 +1095063733 +1609680657 +1155661452 +1203320830 +1271424913 +1545929244 +1339528996 +1488248828 +1608255675 +1731628481 +1565204671 +1744770886 +1939415488 +1756296101 +1932000298 +2179323989 +2000677515 +3476399367 +2571387305 +2250725185 +2108052193 +2317144231 +2904733667 +2298384563 +4230384861 +3695711589 +4503387603 +6248158489 +2474745743 +3003053394 +2827777824 +2947784671 +3935620090 +5936297605 +3296833152 +4040052491 +3501066987 +3688296399 +5155458852 +4406436756 +5007101813 +4549109748 +4358777378 +5078503009 +4425196424 +4582797936 +4615528794 +6163042142 +6234004653 +5302523567 +5422530414 +5477799137 +5975812730 +5771578895 +5830831218 +6124610976 +11398343144 +17522954120 +6797900139 +6985129551 +8990819966 +9971640162 +8113492823 +8765214134 +8783973802 +8907887126 +8941575314 +10591341524 +9040725218 +9007994360 +10558610666 +9918052361 +10725053981 +14889825110 +14838825578 +10900329551 +16956769713 +11602410113 +13783029690 +11955442194 +20739415996 +16769540301 +15750343685 +14911392962 +15769103353 +16878706957 +16897466625 +17805939352 +17549187936 +23897819470 +18048719578 +17949569674 +18926046721 +18958777579 +19566605026 +20476663027 +25811722513 +38736645048 +22502739664 +22855771745 +27797796176 +23557852307 +25385439803 +26866835156 +27705785879 +55615352005 +42422376771 +30661736647 +30680496315 +32647810310 +33776173582 +34847036299 +35755509026 +43360910449 +45825612735 +45747365850 +63775182409 +38492651747 +38525382605 +42069344690 +64925116435 +45358511409 +46060591971 +46413624052 +80205547708 +48943292110 +64456669897 +52252274959 +54572621035 +66198437626 +61342232962 +63309546957 +63328306625 +65527532614 +81853562196 +68623209881 +104020184361 +129148839818 +80561996437 +77018034352 +84272748455 +80594727295 +83851163156 +110870293949 +131951516506 +91419103380 +91772135461 +95003884081 +131590655387 +143871543394 +103515913145 +119029290932 +106824895994 +145991724415 +124651779919 +126869765576 +126637853582 +172139123026 +134150742495 +145641244233 +149185206318 +157580030789 +157612761647 +164445890451 +168123911611 +164867475750 +172013830675 +291083744033 +256010102312 +183191238841 +186422987461 +186776019542 +295176930733 +210340809139 +222545204077 +225854186926 +231476675913 +233462749576 +251289633501 +291505329332 +275823059900 +291730773284 +325736673258 +303221275022 +344356050331 +523207449197 +329626592322 +322058652098 +329313366201 +332991387361 +336881306425 +355205069516 +774497082698 +1000351269624 +617242002590 +373199007003 +397116828681 +448399391003 +432886013216 +454021879990 +457330862839 +509285809476 +484752383077 +613789425382 +567328389232 +567553833184 +594952048306 +625279927120 +632534641223 +1096555734796 +1373550276627 +994038192553 +776080532088 +662304753562 +669872693786 +1454373149614 +770315835684 +1110704144565 +806085020219 +821598398006 +827220886993 +830002841897 +1199863030455 +942083245916 +911352742829 +966616672315 +1052080772309 +1454133039229 +1276094178944 +1134882222416 +1389152231190 +1804754916202 +1619318119673 +1763681643922 +2203553118524 +1440188529470 +1492307595459 +1332177447348 +1483903151568 +2300504974019 +2141946276371 +2946440634688 +2216373118183 +1627683418225 +2449320961570 +2251943802764 +1741355584726 +1853435988745 +1877969415144 +2046234965245 +2018697444624 +3193907147392 +2410976401360 +2772365976818 +2524034453606 +2721329678538 +2816080598916 +4834778043540 +3119991013684 +2824485042807 +2924091681038 +2959860865573 +3185613436093 +3625849427939 +3594791573471 +4235070562807 +4574124052913 +4495555926815 +3369039002951 +3731405403889 +3993299387490 +3760053029350 +4264412390105 +6906532328175 +4064932409869 +4429673845984 +4935010854966 +6149883881545 +5245364132144 +5340115052522 +5645421359576 +6010098478900 +5748576723845 +5784345908380 +5883952546611 +7681169362908 +6145474301666 +11402088254990 +6963830576422 +7354844602821 +7362338390441 +8329344799974 +7100444406840 +7129092032301 +7491458433239 +7753352416840 +7824985439219 +10890785491720 +13429746086753 +8494606255853 +10683587578811 +10180374987110 +10585479184666 +11393998083421 +11088691776367 +11429767267956 +18558859300257 +11532922632225 +13826643664574 +12984396953451 +13245918708506 +15595050662693 +14064274983262 +14491430422742 +21575263508480 +14853796823680 +35401907173054 +53960766473311 +33005030776436 +15244810850079 +15578337856059 +18674981242963 +19080085440519 +54580294284916 +19178193834664 +20765854171776 +21674170961033 +26333502626446 +22926920715646 +22518459044323 +27008105124015 +28318074087316 +27737349131248 +32501624907537 +26230315661957 +37009889467065 +28555705406004 +28918071806942 +70158632140975 +45413588066965 +30098607673759 +30823148706138 +62600232581296 +41475126512036 +33919792093042 +34253319099022 +61261424223037 +38258279275183 +57180239814668 +39944048006440 +44192630005356 +44601091676679 +45445379759969 +52617066718082 +48748774706280 +64351926772781 +53967664793205 +56655420938190 +73519163483621 +109765514839746 +57473777212946 +85667756517392 +59016679480701 +60921756379897 +97274958755884 +126952159354077 +64742940799180 +72511598374205 +92561114724522 +68173111192064 From 4803f7646ff3d13e6fed6031720bbe902b92f98e Mon Sep 17 00:00:00 2001 From: trotFunky Date: Mon, 21 Dec 2020 01:42:23 +0100 Subject: [PATCH 16/28] Day 9 of 2020 done in Python --- 2020/Day 9/Solution.py | 72 +++ 2020/Day 9/input.txt | 1000 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 1072 insertions(+) create mode 100644 2020/Day 9/Solution.py create mode 100644 2020/Day 9/input.txt diff --git a/2020/Day 9/Solution.py b/2020/Day 9/Solution.py new file mode 100644 index 0000000..28488af --- /dev/null +++ b/2020/Day 9/Solution.py @@ -0,0 +1,72 @@ +input_file = "input.txt" + + +# Sum each pair of number available, return True if target can be reached +def is_sum_of_two(available_numbers, target): + for index in range(len(available_numbers)): + for number in available_numbers[index+1:]: + if available_numbers[index]+number == target: + return True + return False + + +def find_invalid_digit(): + sliding_last_digits = [] + + with open(input_file) as encoded_digits: + line = encoded_digits.readline() + + # Read the header data + while len(sliding_last_digits) < 25: + sliding_last_digits.append(int(line)) + line = encoded_digits.readline() + + while line and line != "\n": + if not is_sum_of_two(sliding_last_digits, int(line)): + print(f"{int(line)} is not the sum of two of the 25 preceding numbers.") + return int(line) + + sliding_last_digits.pop(0) + sliding_last_digits.append(int(line)) + + line = encoded_digits.readline() + + +def find_vulnerability(invalid_digit=0): + """ + This works by adding every contiguous number until it goes over the target number. + When it goes over, it drops the first number of the contiguous series until it can add the new one. + Thus, the contiguous slice of the main list of number only shrinks on one side and only expands on the other. + """ + currently_summed = [] + current_sum = 0 + + with open(input_file) as encoded_digits: + line = encoded_digits.readline() + next_number = int(line) + + while line and line != "\n": + if current_sum == invalid_digit: + print(f"Found contiguous sum : {currently_summed}\n" + f"The vulnerability is : {min(currently_summed)}+{max(currently_summed)} = " + f"{min(currently_summed) + max(currently_summed)}") + break + + elif current_sum + next_number < invalid_digit: + currently_summed.append(next_number) + current_sum += next_number + + elif current_sum + next_number > invalid_digit: + # Would continue indefinitely if nex_number > invalid_digit. Should not happen. + while current_sum + next_number > invalid_digit: + # Pop the first numbers of the list until we can add the new one + current_sum -= currently_summed.pop(0) + + currently_summed.append(next_number) + current_sum += next_number + + line = encoded_digits.readline() + next_number = int(line) + + +find_vulnerability(find_invalid_digit()) diff --git a/2020/Day 9/input.txt b/2020/Day 9/input.txt new file mode 100644 index 0000000..c3b902a --- /dev/null +++ b/2020/Day 9/input.txt @@ -0,0 +1,1000 @@ +26 +36 +37 +9 +8 +22 +41 +5 +17 +44 +40 +31 +10 +33 +30 +50 +24 +4 +12 +46 +39 +45 +42 +7 +27 +13 +58 +11 +14 +53 +9 +15 +23 +18 +16 +21 +17 +49 +19 +20 +32 +31 +22 +30 +24 +35 +28 +33 +25 +47 +57 +26 +27 +29 +83 +34 +37 +36 +59 +46 +39 +51 +44 +54 +56 +48 +49 +100 +62 +50 +52 +72 +53 +55 +60 +96 +61 +91 +65 +70 +85 +87 +88 +114 +83 +113 +92 +93 +97 +104 +142 +99 +102 +103 +153 +105 +108 +115 +116 +148 +144 +152 +177 +135 +167 +171 +201 +256 +182 +176 +252 +185 +190 +196 +203 +202 +348 +240 +208 +292 +213 +300 +323 +301 +315 +367 +302 +502 +393 +357 +353 +358 +390 +760 +361 +375 +492 +710 +398 +405 +448 +509 +421 +594 +505 +566 +810 +690 +603 +924 +655 +1317 +711 +823 +714 +1171 +719 +736 +759 +1080 +773 +803 +819 +953 +1528 +869 +1195 +1522 +1071 +1509 +1169 +2270 +1314 +1514 +1369 +1366 +1425 +1430 +2620 +2125 +1455 +1830 +1495 +1532 +4045 +1576 +1622 +2397 +1822 +2501 +3331 +2240 +2385 +2664 +2942 +2483 +2680 +2683 +6285 +2791 +2796 +2855 +2987 +4522 +2950 +3108 +3198 +3317 +4207 +3398 +3816 +5031 +4809 +4062 +4868 +4625 +5667 +5049 +5338 +5163 +5587 +5363 +7318 +6506 +5646 +5651 +7405 +5937 +7214 +9874 +6306 +10612 +7379 +11586 +9708 +9179 +15648 +8871 +8687 +16263 +9674 +10212 +10387 +15046 +15901 +19548 +11009 +31549 +40236 +11297 +18965 +13151 +17087 +19920 +16014 +22320 +17766 +16558 +17558 +30262 +17866 +18361 +19083 +19984 +19886 +33617 +39878 +21396 +26343 +22306 +24448 +24160 +27311 +27855 +63879 +29165 +35097 +32572 +47775 +33572 +34324 +40072 +57630 +35919 +53325 +36227 +37444 +38969 +44046 +41282 +45844 +43702 +45556 +58020 +46466 +48608 +51471 +55166 +94135 +80653 +70016 +66144 +70243 +80251 +83910 +76413 +72146 +73363 +77509 +88915 +73671 +103576 +99302 +84984 +188560 +89258 +181085 +92022 +95074 +97937 +136160 +158162 +128529 +136387 +143379 +138290 +168180 +142389 +157273 +145509 +149776 +147034 +169531 +158655 +162586 +162929 +191324 +281669 +174242 +258003 +187195 +187096 +189959 +193011 +226466 +264689 +264916 +266819 +274677 +389395 +301044 +287898 +320202 +292543 +308095 +342787 +309620 +480909 +321584 +325515 +438931 +374291 +361338 +361437 +532680 +377055 +419477 +382970 +607476 +491155 +684166 +531735 +541496 +635135 +602163 +1216846 +580441 +600638 +744992 +617715 +631204 +1022890 +647099 +686952 +686853 +722775 +735629 +738393 +738492 +1271073 +1903798 +1067136 +874125 +1032651 +1149450 +1073231 +1353344 +1121937 +1181079 +1613092 +1231842 +1198156 +1750088 +1248919 +1264814 +1278303 +1333952 +2436941 +2590651 +1805529 +1458404 +2222681 +2936449 +1941261 +1906776 +1947356 +2105882 +2980007 +2872025 +2195168 +2455889 +2320093 +2303016 +2379235 +2429998 +2447075 +2707323 +2513733 +2736707 +2543117 +3263933 +5086558 +3365180 +4136429 +3399665 +3405760 +4053238 +4863210 +3848037 +3854132 +4485117 +4758905 +4498184 +4515261 +4574403 +4816749 +4623109 +4682251 +4826310 +5807050 +4960808 +5056850 +5250440 +8422030 +5908297 +6629113 +6764845 +7219312 +9361394 +7897849 +7253797 +8422440 +8717342 +9932691 +8339249 +9138370 +12962358 +10489301 +13383248 +9631253 +9439858 +9305360 +16126239 +9787118 +10017658 +10211248 +16392167 +14611834 +13393958 +17152003 +15104094 +16615191 +14473109 +15151646 +15593046 +19950349 +17056591 +18936613 +25032904 +17477619 +18443730 +19071111 +27108872 +19226976 +18745218 +31230333 +19516608 +19804776 +36342516 +20228906 +23605206 +27867067 +31668425 +31837688 +36844097 +35101995 +43969517 +29624755 +36704595 +32649637 +35500321 +34534210 +36414232 +35921349 +38298087 +37188948 +68010941 +38974124 +62714735 +38261826 +39321384 +39745514 +64726750 +43834112 +48095973 +60309801 +130725676 +61293180 +67183847 +66329350 +62274392 +87841487 +110163462 +99283925 +72689269 +70034531 +70455559 +75388356 +73110297 +75450774 +76163072 +77235950 +149484846 +77583210 +78007340 +79066898 +132308923 +127001142 +114425323 +131748739 +133982449 +123567572 +134403477 +128603742 +132729951 +137662748 +140490090 +104054607 +145799566 +148038769 +232658349 +143565856 +148498653 +200111439 +179505381 +153399022 +154819160 +155590550 +202634470 +157074238 +213470375 +218479930 +248407772 +238458084 +310409710 +272066225 +227622179 +252093376 +289365422 +286161401 +258873767 +396446541 +247620463 +439560423 +291604625 +430256649 +406912536 +382441339 +308218182 +395532322 +402439623 +311893398 +466080263 +359708708 +370544613 +446102109 +648736579 +479715555 +499688404 +475242642 +530939992 +575526823 +545035168 +506494230 +577766026 +539225088 +986209785 +555838645 +599822807 +603498023 +620111580 +671602106 +667926890 +990656193 +861612585 +730253321 +682438011 +805810817 +834951350 +925817664 +921344751 +954958197 +1133604671 +1006182634 +1014467730 +1062332875 +1432311894 +1045719318 +1868143692 +1223609603 +1095063733 +1609680657 +1155661452 +1203320830 +1271424913 +1545929244 +1339528996 +1488248828 +1608255675 +1731628481 +1565204671 +1744770886 +1939415488 +1756296101 +1932000298 +2179323989 +2000677515 +3476399367 +2571387305 +2250725185 +2108052193 +2317144231 +2904733667 +2298384563 +4230384861 +3695711589 +4503387603 +6248158489 +2474745743 +3003053394 +2827777824 +2947784671 +3935620090 +5936297605 +3296833152 +4040052491 +3501066987 +3688296399 +5155458852 +4406436756 +5007101813 +4549109748 +4358777378 +5078503009 +4425196424 +4582797936 +4615528794 +6163042142 +6234004653 +5302523567 +5422530414 +5477799137 +5975812730 +5771578895 +5830831218 +6124610976 +11398343144 +17522954120 +6797900139 +6985129551 +8990819966 +9971640162 +8113492823 +8765214134 +8783973802 +8907887126 +8941575314 +10591341524 +9040725218 +9007994360 +10558610666 +9918052361 +10725053981 +14889825110 +14838825578 +10900329551 +16956769713 +11602410113 +13783029690 +11955442194 +20739415996 +16769540301 +15750343685 +14911392962 +15769103353 +16878706957 +16897466625 +17805939352 +17549187936 +23897819470 +18048719578 +17949569674 +18926046721 +18958777579 +19566605026 +20476663027 +25811722513 +38736645048 +22502739664 +22855771745 +27797796176 +23557852307 +25385439803 +26866835156 +27705785879 +55615352005 +42422376771 +30661736647 +30680496315 +32647810310 +33776173582 +34847036299 +35755509026 +43360910449 +45825612735 +45747365850 +63775182409 +38492651747 +38525382605 +42069344690 +64925116435 +45358511409 +46060591971 +46413624052 +80205547708 +48943292110 +64456669897 +52252274959 +54572621035 +66198437626 +61342232962 +63309546957 +63328306625 +65527532614 +81853562196 +68623209881 +104020184361 +129148839818 +80561996437 +77018034352 +84272748455 +80594727295 +83851163156 +110870293949 +131951516506 +91419103380 +91772135461 +95003884081 +131590655387 +143871543394 +103515913145 +119029290932 +106824895994 +145991724415 +124651779919 +126869765576 +126637853582 +172139123026 +134150742495 +145641244233 +149185206318 +157580030789 +157612761647 +164445890451 +168123911611 +164867475750 +172013830675 +291083744033 +256010102312 +183191238841 +186422987461 +186776019542 +295176930733 +210340809139 +222545204077 +225854186926 +231476675913 +233462749576 +251289633501 +291505329332 +275823059900 +291730773284 +325736673258 +303221275022 +344356050331 +523207449197 +329626592322 +322058652098 +329313366201 +332991387361 +336881306425 +355205069516 +774497082698 +1000351269624 +617242002590 +373199007003 +397116828681 +448399391003 +432886013216 +454021879990 +457330862839 +509285809476 +484752383077 +613789425382 +567328389232 +567553833184 +594952048306 +625279927120 +632534641223 +1096555734796 +1373550276627 +994038192553 +776080532088 +662304753562 +669872693786 +1454373149614 +770315835684 +1110704144565 +806085020219 +821598398006 +827220886993 +830002841897 +1199863030455 +942083245916 +911352742829 +966616672315 +1052080772309 +1454133039229 +1276094178944 +1134882222416 +1389152231190 +1804754916202 +1619318119673 +1763681643922 +2203553118524 +1440188529470 +1492307595459 +1332177447348 +1483903151568 +2300504974019 +2141946276371 +2946440634688 +2216373118183 +1627683418225 +2449320961570 +2251943802764 +1741355584726 +1853435988745 +1877969415144 +2046234965245 +2018697444624 +3193907147392 +2410976401360 +2772365976818 +2524034453606 +2721329678538 +2816080598916 +4834778043540 +3119991013684 +2824485042807 +2924091681038 +2959860865573 +3185613436093 +3625849427939 +3594791573471 +4235070562807 +4574124052913 +4495555926815 +3369039002951 +3731405403889 +3993299387490 +3760053029350 +4264412390105 +6906532328175 +4064932409869 +4429673845984 +4935010854966 +6149883881545 +5245364132144 +5340115052522 +5645421359576 +6010098478900 +5748576723845 +5784345908380 +5883952546611 +7681169362908 +6145474301666 +11402088254990 +6963830576422 +7354844602821 +7362338390441 +8329344799974 +7100444406840 +7129092032301 +7491458433239 +7753352416840 +7824985439219 +10890785491720 +13429746086753 +8494606255853 +10683587578811 +10180374987110 +10585479184666 +11393998083421 +11088691776367 +11429767267956 +18558859300257 +11532922632225 +13826643664574 +12984396953451 +13245918708506 +15595050662693 +14064274983262 +14491430422742 +21575263508480 +14853796823680 +35401907173054 +53960766473311 +33005030776436 +15244810850079 +15578337856059 +18674981242963 +19080085440519 +54580294284916 +19178193834664 +20765854171776 +21674170961033 +26333502626446 +22926920715646 +22518459044323 +27008105124015 +28318074087316 +27737349131248 +32501624907537 +26230315661957 +37009889467065 +28555705406004 +28918071806942 +70158632140975 +45413588066965 +30098607673759 +30823148706138 +62600232581296 +41475126512036 +33919792093042 +34253319099022 +61261424223037 +38258279275183 +57180239814668 +39944048006440 +44192630005356 +44601091676679 +45445379759969 +52617066718082 +48748774706280 +64351926772781 +53967664793205 +56655420938190 +73519163483621 +109765514839746 +57473777212946 +85667756517392 +59016679480701 +60921756379897 +97274958755884 +126952159354077 +64742940799180 +72511598374205 +92561114724522 +68173111192064 From 078c98ee1d886f4f290362d813843567cfd7b441 Mon Sep 17 00:00:00 2001 From: Teo-CD Date: Mon, 21 Dec 2020 22:21:07 +0100 Subject: [PATCH 17/28] Day 10 of 2020 solved in Python --- 2020/Day 10/Solution.py | 68 +++++++++++++++++++++++++ 2020/Day 10/input.txt | 110 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 178 insertions(+) create mode 100644 2020/Day 10/Solution.py create mode 100644 2020/Day 10/input.txt diff --git a/2020/Day 10/Solution.py b/2020/Day 10/Solution.py new file mode 100644 index 0000000..bb0a10e --- /dev/null +++ b/2020/Day 10/Solution.py @@ -0,0 +1,68 @@ +input_file = "input.txt" + +adapters = [] + +with open(input_file) as adapter_ratings: + line = adapter_ratings.readline() + + while line and line != "\n": + adapters.append(int(line)) + line = adapter_ratings.readline() + +adapters.sort() +computer_adapter = max(adapters) + 3 + +# List of couples separated by three, which must be present to have a working chain +fixed_points = [] + +one_diffs = 0 +three_diffs = 1 # As the computer adapter is always the highest one we got plus three + +# The charging outlet is 0, compute the difference now +if adapters[0] == 1: + one_diffs += 1 +elif adapters[0] == 3: + fixed_points.append((adapters[0], 0)) + three_diffs += 1 + +for index in range(len(adapters)-1): + current_difference = adapters[index+1] - adapters[index] + if current_difference == 1: + one_diffs += 1 + elif current_difference == 3: + if (adapters[index], index) not in fixed_points: + fixed_points.append((adapters[index], index)) + fixed_points.append((adapters[index+1], index+1)) + three_diffs += 1 + +print(f"The product of one and three differences is : {one_diffs}*{three_diffs} = {one_diffs*three_diffs}") + +# The last adapter is always needed as it is the only link possible to the computer adapter +if (adapters[-1], len(adapters)-1) not in fixed_points: + fixed_points.append((adapters[-1], len(adapters)-1)) + +# Compute the distance separating each fixed point. If they are not successive, it means that there are possible +# permutations between those two fixed points. Store the count of numbers we can choose from + +separation_distance = [] +for index in range(len(fixed_points) - 1): + if fixed_points[index + 1][1] - fixed_points[index][1] > 1: + separation_distance.append(fixed_points[index + 1][1] - fixed_points[index][1] - 1) + +# Distance between 0 and the first fixed point +separation_distance.insert(0, fixed_points[0][1]) + +total_combinations = 1 + +# This would probably not work in a general case other than this puzzle, as I only take into account small possible +# separations, which is all I have got. +for separation in separation_distance: + # If we have three numbers, it means that we have at least a separation of 4 jolts between the two fixed points, + # which is not possible to cross if we do not choose any number between those two. So, do not count this choice. + if separation == 3: + # Number of subsets of a set is 2^n where n is the number of elements in the set. + total_combinations *= 2**3 - 1 + else: + total_combinations *= 2**separation + +print(f"The number of combinations is : {total_combinations}") diff --git a/2020/Day 10/input.txt b/2020/Day 10/input.txt new file mode 100644 index 0000000..46ad475 --- /dev/null +++ b/2020/Day 10/input.txt @@ -0,0 +1,110 @@ +160 +34 +123 +159 +148 +93 +165 +56 +179 +103 +171 +44 +110 +170 +147 +98 +25 +37 +137 +71 +5 +6 +121 +28 +19 +134 +18 +7 +66 +90 +88 +181 +89 +41 +156 +46 +8 +61 +124 +9 +161 +72 +13 +172 +111 +59 +105 +51 +109 +27 +152 +117 +52 +68 +95 +164 +116 +75 +78 +180 +81 +47 +104 +12 +133 +175 +16 +149 +135 +99 +112 +38 +67 +53 +153 +2 +136 +113 +17 +145 +106 +31 +45 +169 +146 +168 +26 +36 +118 +62 +65 +142 +130 +1 +140 +84 +94 +141 +122 +22 +48 +102 +60 +178 +127 +73 +74 +87 +182 +35 From f243461998d7767cbc0f29675e8ad540ee871da0 Mon Sep 17 00:00:00 2001 From: trotFunky Date: Mon, 21 Dec 2020 22:21:07 +0100 Subject: [PATCH 18/28] Day 10 of 2020 solved in Python --- 2020/Day 10/Solution.py | 68 +++++++++++++++++++++++++ 2020/Day 10/input.txt | 110 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 178 insertions(+) create mode 100644 2020/Day 10/Solution.py create mode 100644 2020/Day 10/input.txt diff --git a/2020/Day 10/Solution.py b/2020/Day 10/Solution.py new file mode 100644 index 0000000..bb0a10e --- /dev/null +++ b/2020/Day 10/Solution.py @@ -0,0 +1,68 @@ +input_file = "input.txt" + +adapters = [] + +with open(input_file) as adapter_ratings: + line = adapter_ratings.readline() + + while line and line != "\n": + adapters.append(int(line)) + line = adapter_ratings.readline() + +adapters.sort() +computer_adapter = max(adapters) + 3 + +# List of couples separated by three, which must be present to have a working chain +fixed_points = [] + +one_diffs = 0 +three_diffs = 1 # As the computer adapter is always the highest one we got plus three + +# The charging outlet is 0, compute the difference now +if adapters[0] == 1: + one_diffs += 1 +elif adapters[0] == 3: + fixed_points.append((adapters[0], 0)) + three_diffs += 1 + +for index in range(len(adapters)-1): + current_difference = adapters[index+1] - adapters[index] + if current_difference == 1: + one_diffs += 1 + elif current_difference == 3: + if (adapters[index], index) not in fixed_points: + fixed_points.append((adapters[index], index)) + fixed_points.append((adapters[index+1], index+1)) + three_diffs += 1 + +print(f"The product of one and three differences is : {one_diffs}*{three_diffs} = {one_diffs*three_diffs}") + +# The last adapter is always needed as it is the only link possible to the computer adapter +if (adapters[-1], len(adapters)-1) not in fixed_points: + fixed_points.append((adapters[-1], len(adapters)-1)) + +# Compute the distance separating each fixed point. If they are not successive, it means that there are possible +# permutations between those two fixed points. Store the count of numbers we can choose from + +separation_distance = [] +for index in range(len(fixed_points) - 1): + if fixed_points[index + 1][1] - fixed_points[index][1] > 1: + separation_distance.append(fixed_points[index + 1][1] - fixed_points[index][1] - 1) + +# Distance between 0 and the first fixed point +separation_distance.insert(0, fixed_points[0][1]) + +total_combinations = 1 + +# This would probably not work in a general case other than this puzzle, as I only take into account small possible +# separations, which is all I have got. +for separation in separation_distance: + # If we have three numbers, it means that we have at least a separation of 4 jolts between the two fixed points, + # which is not possible to cross if we do not choose any number between those two. So, do not count this choice. + if separation == 3: + # Number of subsets of a set is 2^n where n is the number of elements in the set. + total_combinations *= 2**3 - 1 + else: + total_combinations *= 2**separation + +print(f"The number of combinations is : {total_combinations}") diff --git a/2020/Day 10/input.txt b/2020/Day 10/input.txt new file mode 100644 index 0000000..46ad475 --- /dev/null +++ b/2020/Day 10/input.txt @@ -0,0 +1,110 @@ +160 +34 +123 +159 +148 +93 +165 +56 +179 +103 +171 +44 +110 +170 +147 +98 +25 +37 +137 +71 +5 +6 +121 +28 +19 +134 +18 +7 +66 +90 +88 +181 +89 +41 +156 +46 +8 +61 +124 +9 +161 +72 +13 +172 +111 +59 +105 +51 +109 +27 +152 +117 +52 +68 +95 +164 +116 +75 +78 +180 +81 +47 +104 +12 +133 +175 +16 +149 +135 +99 +112 +38 +67 +53 +153 +2 +136 +113 +17 +145 +106 +31 +45 +169 +146 +168 +26 +36 +118 +62 +65 +142 +130 +1 +140 +84 +94 +141 +122 +22 +48 +102 +60 +178 +127 +73 +74 +87 +182 +35 From 8fe41ecd3b7b47b910eda5266c23d2ceb0099e52 Mon Sep 17 00:00:00 2001 From: Teo-CD Date: Tue, 22 Dec 2020 00:19:10 +0100 Subject: [PATCH 19/28] Day 11 part 1 of 2020 done in Python --- 2020/Day 11/Solution.py | 80 ++++++++++++++++++++++++++++++++++++ 2020/Day 11/input.txt | 91 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 171 insertions(+) create mode 100644 2020/Day 11/Solution.py create mode 100644 2020/Day 11/input.txt diff --git a/2020/Day 11/Solution.py b/2020/Day 11/Solution.py new file mode 100644 index 0000000..aad45b7 --- /dev/null +++ b/2020/Day 11/Solution.py @@ -0,0 +1,80 @@ +input_file = "input.txt" + +# -1 is floor +# 0 is empty seat +# 1 is occupied seat + +# Map represents each cell with [current_state,next_state] +# Would a dictionary be better ? +seating_map = [] + + +def load_map(): + with open(input_file) as text_map: + line = text_map.readline().strip("\n") + + while line: + seating_map.append([]) + for character in line: + # Set every seat to occupied as its the first iteration anyway + seating_map[-1].append([1 if character == 'L' else -1, 1]) + + line = text_map.readline().strip("\n") + + +def run_adjacent_seats(): + """ + Run the cellular automata with the following rules : + If empty and adjacent are empty, seat + If seated and 4 or more neighbours, become empty + If floor, pass + """ + load_map() + + game_stable = False + occupied_seats = 0 + iteration = 0 + + while not game_stable: + + for i in range(len(seating_map)): + for j in range(len(seating_map[0])): + current_cell = seating_map[i][j] + if current_cell[0] < 0: + continue + + seated_neighbours = 0 + + for cell_position in [(i+di, j+dj) for di in [-1, 0, 1] for dj in [-1, 0, 1]]: + if cell_position != (i, j) and \ + 0 <= cell_position[0] < len(seating_map) and 0 <= cell_position[1] < len(seating_map[0]): + + seated_neighbours += 1 if seating_map[cell_position[0]][cell_position[1]][0] > 0 else 0 + + if current_cell[0] == 0 and seated_neighbours == 0: + current_cell[1] = 1 + elif current_cell[0] == 1 and seated_neighbours >= 4: + current_cell[1] = 0 + + game_stable = True + occupied_seats = 0 + + # Should be integrated to the first loop to speed things up + for i in range(len(seating_map)): + for j in range(len(seating_map[0])): + current_cell = seating_map[i][j] + if current_cell[0] < 0: + continue + + if game_stable and current_cell[0] != current_cell[1]: + game_stable = False + + current_cell[0] = current_cell[1] + occupied_seats += current_cell[0] + + iteration += 1 + + print(f"The number of occupied seats when stabilized is {occupied_seats}") + + +run_adjacent_seats() diff --git a/2020/Day 11/input.txt b/2020/Day 11/input.txt new file mode 100644 index 0000000..69da577 --- /dev/null +++ b/2020/Day 11/input.txt @@ -0,0 +1,91 @@ +LLLLLLLLLLL.LLLLLLLLLLLL.LLLLL.LLLLLLLLLLLLL.LLLLLLLLL.LLL.LLLLLLLLLL.LLLLLLL.LLLLLLLLLLLLLLLLLLL +LLLLLL.LLLLLLLLLL.LLLLLL.LLLLL.LLLLLLL.LLLLL.LLLLLLLLLLLLLLLLLL.LLLLL.LLLLLLLLLLLLL.LLLLLLLLLLLLL +LLLLLLLLLLL.LLLLL.LLLLLL.LLLLL.LLLLLLLLLLLLL.LLLLLLLLL.LLLLLLLL.LLLLL.LLLLLL.LLLLLL.LLLLLLLLLLLLL +LLLLLL.LLLLLLLLLL.LLLLLL.LLLLLLLLLLLLL.LLLLLLLLLLLLL.L.LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL +LLLLLL.LLLL.LLLLL.LLLL.LLLLLLL.LLLLLLL.LLLLL.LLLLLL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LLLLLLLL.LLLLLLLLLLLLL.LLLLLLLLLLLLL +LLLLLLLLLL..LLLLLLLLLLLLLLLLLL.LLLLLLLLLLLLL.LLLLLLLLL.LLLLLLLL.LLLLL.LLLLLLL.LLLLL.LLLLLLLLLLLLL +LLLLLL.LLLL.LLLLL.LLLLLL.LLLLL.LLLLLLL.LLLLL.LLLL.LLLLLLLLLLLL.LLLLLL.LLLLLLL.LLLLL.LLLLLLLLL.LLL +.L...LL.LLL...L.LL.LL..L......LL.....LL..L..............L....L........LLL...L.L..LL...L....L..... +LLLLLL.LLLLLLLLLL..LLLLL.LLLLL.LLLLLLLLLLLLL.LLLLLLLLL.LLLLLLLL.LLLLL.LLLLLLL.LLLLL.LLLLLLLLLLLLL +LLLLLLLLLLLLLLLLL.LLLLLL.LLLLL.LLLL.LL.LLLLLL.LLLLLLLL.LLLLLLLL.LLLLL.LLLLLLL.LLLLL.LLLLLLLLLLLLL +LLLLLL.LLLLLLLLLLLLLLLLLLLLLLL.LLLLLLL.LLLLL.LLLLLLLLL.LLLLLLLL.LLLLLLLLLLLLL.LLLLL.LLLLLLLLLLLLL +LLLL.LL.LLLLLLL.L.LLLLLL.LLLLL.LLLLLLLLLLLLL.LLLLLLLLLLLLLLLLLL.LLLLL.LLLLLLL.LLLLL.LLLLLLLLLLLLL +LLLLLLLLLLL.LLLLL.LLLLLL.LLLLLLLLLLLLL..LLLLLLLLLLLLLLLLLLLLLLL.LL.LLLLLLLLLL.LLLLL.LLLLLLLLLLLLL +LLLLLLLLLLL.LLLLLLLLLLLLLLL.LL.LLLLLLLL..LLL.LLLLLLLLL.LLLLLLLLLLL.LLLLLLLLLL.LLLLL.LLLLLLLLLLLLL From b00ae2ab04a18cc9f174d50caf0e5464e3581090 Mon Sep 17 00:00:00 2001 From: trotFunky Date: Tue, 22 Dec 2020 00:19:10 +0100 Subject: [PATCH 20/28] Day 11 part 1 of 2020 done in Python --- 2020/Day 11/Solution.py | 80 ++++++++++++++++++++++++++++++++++++ 2020/Day 11/input.txt | 91 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 171 insertions(+) create mode 100644 2020/Day 11/Solution.py create mode 100644 2020/Day 11/input.txt diff --git a/2020/Day 11/Solution.py b/2020/Day 11/Solution.py new file mode 100644 index 0000000..aad45b7 --- /dev/null +++ b/2020/Day 11/Solution.py @@ -0,0 +1,80 @@ +input_file = "input.txt" + +# -1 is floor +# 0 is empty seat +# 1 is occupied seat + +# Map represents each cell with [current_state,next_state] +# Would a dictionary be better ? +seating_map = [] + + +def load_map(): + with open(input_file) as text_map: + line = text_map.readline().strip("\n") + + while line: + seating_map.append([]) + for character in line: + # Set every seat to occupied as its the first iteration anyway + seating_map[-1].append([1 if character == 'L' else -1, 1]) + + line = text_map.readline().strip("\n") + + +def run_adjacent_seats(): + """ + Run the cellular automata with the following rules : + If empty and adjacent are empty, seat + If seated and 4 or more neighbours, become empty + If floor, pass + """ + load_map() + + game_stable = False + occupied_seats = 0 + iteration = 0 + + while not game_stable: + + for i in range(len(seating_map)): + for j in range(len(seating_map[0])): + current_cell = seating_map[i][j] + if current_cell[0] < 0: + continue + + seated_neighbours = 0 + + for cell_position in [(i+di, j+dj) for di in [-1, 0, 1] for dj in [-1, 0, 1]]: + if cell_position != (i, j) and \ + 0 <= cell_position[0] < len(seating_map) and 0 <= cell_position[1] < len(seating_map[0]): + + seated_neighbours += 1 if seating_map[cell_position[0]][cell_position[1]][0] > 0 else 0 + + if current_cell[0] == 0 and seated_neighbours == 0: + current_cell[1] = 1 + elif current_cell[0] == 1 and seated_neighbours >= 4: + current_cell[1] = 0 + + game_stable = True + occupied_seats = 0 + + # Should be integrated to the first loop to speed things up + for i in range(len(seating_map)): + for j in range(len(seating_map[0])): + current_cell = seating_map[i][j] + if current_cell[0] < 0: + continue + + if game_stable and current_cell[0] != current_cell[1]: + game_stable = False + + current_cell[0] = current_cell[1] + occupied_seats += current_cell[0] + + iteration += 1 + + print(f"The number of occupied seats when stabilized is {occupied_seats}") + + +run_adjacent_seats() diff --git a/2020/Day 11/input.txt b/2020/Day 11/input.txt new file mode 100644 index 0000000..69da577 --- /dev/null +++ b/2020/Day 11/input.txt @@ -0,0 +1,91 @@ +LLLLLLLLLLL.LLLLLLLLLLLL.LLLLL.LLLLLLLLLLLLL.LLLLLLLLL.LLL.LLLLLLLLLL.LLLLLLL.LLLLLLLLLLLLLLLLLLL +LLLLLL.LLLLLLLLLL.LLLLLL.LLLLL.LLLLLLL.LLLLL.LLLLLLLLLLLLLLLLLL.LLLLL.LLLLLLLLLLLLL.LLLLLLLLLLLLL +LLLLLLLLLLL.LLLLL.LLLLLL.LLLLL.LLLLLLLLLLLLL.LLLLLLLLL.LLLLLLLL.LLLLL.LLLLLL.LLLLLL.LLLLLLLLLLLLL +LLLLLL.LLLLLLLLLL.LLLLLL.LLLLLLLLLLLLL.LLLLLLLLLLLLL.L.LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL +LLLLLL.LLLL.LLLLL.LLLL.LLLLLLL.LLLLLLL.LLLLL.LLLLLLLLL.LLLLLLLL.LLLLL.LLLLLLL.LLLLL.LLLLLLLLLLLLL +LLLL.LLLLLLLLLLLLLLLLLLL.LLLLLLLLLLLLLLLLLLL.LLLLLLLLL.LLLLLLLL.LLLLLLLLLLL.LLLLLLL.LLLLLLLLLLLLL +LLLLLL.LLLL.LLLLL.LLLLLLLLLLLLLLLLLLLL..LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL.LLLLL.LLLLLLLLLLLLL +.L..LLL...L....LLLL.L..L...............LLLLLL..LL.L.....L.....L.L.L.L.L...LLL.....L.L....LLL.LL.. +LLLLLL.LLLLLLLLLL.LLLLLLLLLLL.LLLLLLLLLLLLLL.LLLLLLLLL.LLLLLLLL.LLLLL.LLLLLLL.LLLLL.LLLLLLLLLLLLL +LLLLLL.LLLL.LLLLL.LLLLLL.LLLLL.LLLLLLLLLLLLL.LLLLLLLLL.LL.LLLLL.LLLL.LLLLLLLL.LLLLL.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LLLLLLLLLLLLLLLLLLLLL.LLLLLLL.LLLLL.LLLLLLLLL.LLLLLLLL.LLLLLLLLLLLLL.LLLLL.LLLLLLLLLLLLL +LLLL.LL.LLLLLLL.L.LLLLLL.LLLLL.LLLLLLLLLLLLL.LLLLLLLLLLLLLLLLLL.LLLLL.LLLLLLL.LLLLL.LLLLLLLLLLLLL +LLLLLLLLLLL.LLLLL.LLLLLL.LLLLLLLLLLLLL..LLLLLLLLLLLLLLLLLLLLLLL.LL.LLLLLLLLLL.LLLLL.LLLLLLLLLLLLL +LLLLLLLLLLL.LLLLLLLLLLLLLLL.LL.LLLLLLLL..LLL.LLLLLLLLL.LLLLLLLLLLL.LLLLLLLLLL.LLLLL.LLLLLLLLLLLLL From 4f147f4f7a940d766180d9ada5a48f6ff0854eb6 Mon Sep 17 00:00:00 2001 From: Teo-CD Date: Fri, 3 Dec 2021 23:59:40 +0000 Subject: [PATCH 21/28] First day of 2021, done in Rust --- .gitignore | 2 + 2021/Day 1/input.txt | 2000 ++++++++++++++++++++++++++ 2021/Day 1/rust_solution/Cargo.lock | 5 + 2021/Day 1/rust_solution/Cargo.toml | 9 + 2021/Day 1/rust_solution/src/main.rs | 38 + README.md | 7 +- 6 files changed, 2060 insertions(+), 1 deletion(-) create mode 100644 2021/Day 1/input.txt create mode 100644 2021/Day 1/rust_solution/Cargo.lock create mode 100644 2021/Day 1/rust_solution/Cargo.toml create mode 100644 2021/Day 1/rust_solution/src/main.rs diff --git a/.gitignore b/.gitignore index b79602f..bb42c5f 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ **/.idea +**/target + diff --git a/2021/Day 1/input.txt b/2021/Day 1/input.txt new file mode 100644 index 0000000..13c1d1f --- /dev/null +++ b/2021/Day 1/input.txt @@ -0,0 +1,2000 @@ +199 +203 +200 +201 +196 +195 +196 +214 +227 +225 +229 +260 +246 +253 +271 +281 +280 +295 +310 +293 +295 +297 +298 +297 +306 +299 +290 +292 +289 +287 +291 +296 +294 +287 +286 +287 +289 +290 +281 +283 +282 +275 +256 +265 +242 +231 +226 +216 +227 +226 +249 +238 +237 +247 +245 +250 +264 +267 +259 +258 +264 +261 +249 +246 +239 +240 +259 +258 +280 +279 +278 +281 +272 +256 +255 +271 +286 +290 +286 +288 +290 +294 +292 +294 +292 +293 +294 +291 +298 +303 +301 +330 +331 +336 +362 +371 +374 +368 +367 +368 +366 +364 +371 +377 +378 +384 +386 +388 +393 +409 +423 +422 +411 +412 +426 +430 +441 +460 +462 +464 +469 +461 +483 +452 +455 +457 +468 +506 +509 +514 +525 +512 +524 +523 +522 +531 +549 +548 +549 +548 +524 +525 +528 +526 +537 +544 +549 +546 +525 +532 +535 +543 +544 +545 +525 +536 +538 +541 +524 +534 +542 +538 +539 +544 +543 +539 +538 +527 +553 +552 +562 +560 +561 +573 +574 +570 +571 +568 +569 +571 +573 +566 +567 +584 +591 +607 +605 +604 +605 +617 +615 +617 +606 +608 +609 +613 +616 +635 +634 +637 +635 +634 +655 +639 +646 +637 +628 +622 +648 +645 +640 +652 +653 +659 +661 +658 +650 +667 +670 +668 +680 +682 +673 +668 +678 +677 +675 +676 +677 +675 +688 +681 +676 +684 +675 +664 +665 +654 +660 +664 +663 +667 +658 +661 +676 +675 +680 +681 +690 +693 +697 +721 +733 +739 +740 +739 +751 +765 +766 +752 +748 +763 +772 +771 +782 +784 +797 +799 +817 +812 +811 +795 +783 +785 +790 +785 +784 +782 +771 +756 +759 +783 +772 +774 +779 +783 +786 +780 +783 +779 +777 +778 +777 +762 +778 +777 +770 +773 +769 +770 +771 +764 +765 +761 +745 +754 +758 +759 +746 +738 +740 +742 +767 +765 +754 +755 +758 +762 +760 +761 +757 +761 +770 +773 +777 +776 +777 +769 +767 +793 +805 +798 +793 +803 +809 +808 +817 +804 +809 +805 +804 +806 +808 +812 +830 +831 +832 +831 +819 +820 +823 +822 +812 +814 +812 +842 +858 +855 +856 +862 +860 +855 +839 +840 +841 +840 +846 +850 +859 +861 +852 +846 +848 +845 +833 +843 +846 +849 +889 +890 +894 +904 +907 +904 +905 +906 +907 +910 +902 +906 +900 +907 +906 +899 +887 +867 +866 +873 +878 +885 +880 +890 +863 +860 +859 +885 +856 +853 +854 +852 +864 +855 +874 +875 +874 +875 +871 +872 +867 +870 +873 +874 +860 +862 +879 +878 +879 +880 +881 +882 +878 +882 +885 +890 +902 +903 +905 +906 +909 +917 +916 +934 +932 +935 +937 +935 +910 +911 +907 +902 +904 +910 +917 +918 +943 +945 +959 +973 +972 +969 +973 +972 +958 +957 +959 +963 +968 +961 +960 +973 +971 +970 +977 +1002 +1012 +1011 +1007 +1017 +1024 +1014 +1013 +1019 +1005 +984 +983 +980 +993 +999 +982 +988 +989 +990 +992 +988 +989 +988 +981 +958 +973 +966 +965 +942 +926 +933 +928 +932 +940 +927 +930 +920 +930 +897 +905 +907 +889 +882 +888 +889 +872 +873 +885 +884 +886 +887 +898 +901 +902 +895 +880 +894 +886 +882 +885 +890 +896 +880 +881 +866 +872 +875 +903 +901 +907 +899 +920 +921 +934 +935 +937 +928 +929 +927 +928 +935 +906 +908 +906 +882 +883 +887 +891 +892 +898 +903 +907 +909 +916 +917 +945 +935 +937 +928 +918 +927 +916 +929 +919 +931 +954 +953 +954 +956 +953 +947 +937 +941 +960 +968 +951 +955 +954 +938 +939 +946 +945 +947 +948 +951 +943 +949 +946 +954 +952 +949 +943 +936 +944 +941 +950 +952 +948 +947 +971 +970 +969 +974 +971 +1000 +1005 +1007 +1009 +1008 +1000 +998 +999 +1001 +1008 +1001 +1024 +1005 +998 +1016 +1018 +1019 +1020 +1021 +1057 +1056 +1052 +1044 +1045 +1057 +1058 +1074 +1075 +1069 +1056 +1055 +1056 +1052 +1059 +1070 +1043 +1039 +1035 +1025 +1015 +1018 +1029 +1033 +1042 +1038 +1031 +1033 +1023 +1016 +1019 +1018 +1016 +1018 +1020 +1009 +1008 +997 +973 +983 +990 +996 +1002 +1001 +1000 +1002 +1001 +1015 +1016 +1015 +1019 +1020 +1016 +1010 +1009 +1008 +1016 +1018 +1015 +1011 +1004 +999 +1000 +1027 +1035 +1050 +1051 +1068 +1058 +1072 +1086 +1089 +1060 +1043 +1028 +1026 +1028 +1052 +1050 +1042 +1040 +1036 +1055 +1050 +1051 +1049 +1053 +1054 +1059 +1058 +1066 +1059 +1061 +1070 +1071 +1068 +1059 +1060 +1065 +1066 +1068 +1060 +1059 +1070 +1069 +1068 +1067 +1068 +1070 +1069 +1066 +1073 +1065 +1066 +1050 +1052 +1050 +1056 +1055 +1063 +1062 +1057 +1054 +1048 +1047 +1051 +1049 +1043 +1017 +1016 +1002 +1005 +992 +994 +999 +1001 +1017 +1026 +1024 +1028 +1040 +1039 +1046 +1022 +1023 +992 +995 +1019 +1022 +1023 +1011 +1004 +1005 +993 +991 +992 +995 +996 +997 +1009 +1011 +1012 +1017 +1030 +1029 +1031 +1024 +1033 +1008 +1006 +1018 +1020 +1015 +1020 +1031 +1029 +1026 +1030 +1042 +1039 +1029 +1027 +1008 +1003 +1019 +1000 +1001 +995 +996 +994 +988 +989 +988 +987 +994 +997 +1000 +994 +997 +989 +991 +985 +975 +982 +981 +986 +980 +979 +973 +984 +985 +983 +981 +956 +925 +924 +919 +913 +915 +917 +914 +916 +895 +910 +924 +919 +914 +928 +935 +927 +930 +932 +936 +939 +944 +948 +947 +946 +945 +948 +944 +942 +944 +958 +956 +947 +955 +990 +995 +996 +1007 +1009 +1013 +1012 +1011 +1020 +1019 +1021 +1016 +1038 +1050 +1043 +1046 +1047 +1043 +1040 +1039 +1045 +1046 +1030 +1031 +1034 +1035 +1045 +1066 +1085 +1092 +1101 +1100 +1101 +1099 +1084 +1085 +1086 +1090 +1091 +1087 +1100 +1099 +1092 +1095 +1101 +1102 +1118 +1117 +1138 +1139 +1132 +1127 +1131 +1132 +1130 +1128 +1130 +1150 +1149 +1157 +1158 +1156 +1157 +1155 +1170 +1175 +1167 +1166 +1177 +1174 +1186 +1187 +1186 +1185 +1189 +1193 +1204 +1191 +1196 +1198 +1186 +1198 +1215 +1210 +1211 +1212 +1211 +1207 +1206 +1198 +1202 +1190 +1185 +1190 +1199 +1222 +1225 +1222 +1234 +1236 +1260 +1261 +1262 +1272 +1289 +1286 +1290 +1297 +1295 +1270 +1291 +1299 +1303 +1318 +1342 +1356 +1361 +1362 +1326 +1325 +1333 +1329 +1349 +1353 +1367 +1368 +1371 +1369 +1353 +1351 +1349 +1352 +1354 +1353 +1356 +1355 +1362 +1366 +1368 +1370 +1349 +1354 +1357 +1356 +1360 +1357 +1361 +1363 +1364 +1345 +1338 +1335 +1334 +1322 +1329 +1333 +1334 +1331 +1330 +1337 +1348 +1347 +1348 +1317 +1307 +1313 +1330 +1323 +1324 +1327 +1334 +1336 +1334 +1332 +1338 +1341 +1342 +1373 +1375 +1374 +1372 +1373 +1371 +1370 +1375 +1363 +1361 +1366 +1389 +1390 +1366 +1380 +1381 +1379 +1383 +1400 +1402 +1404 +1409 +1410 +1434 +1439 +1443 +1448 +1434 +1462 +1463 +1462 +1464 +1465 +1471 +1465 +1464 +1469 +1473 +1480 +1486 +1488 +1492 +1494 +1495 +1496 +1504 +1496 +1495 +1472 +1469 +1465 +1466 +1455 +1464 +1465 +1474 +1475 +1490 +1499 +1490 +1492 +1489 +1500 +1504 +1500 +1499 +1500 +1510 +1511 +1516 +1511 +1515 +1512 +1499 +1506 +1509 +1493 +1495 +1496 +1485 +1486 +1476 +1475 +1484 +1485 +1469 +1477 +1478 +1467 +1468 +1469 +1477 +1478 +1475 +1473 +1461 +1468 +1470 +1496 +1491 +1506 +1505 +1526 +1530 +1528 +1529 +1533 +1555 +1558 +1557 +1554 +1557 +1559 +1560 +1562 +1561 +1563 +1564 +1550 +1559 +1558 +1559 +1554 +1535 +1538 +1541 +1540 +1529 +1528 +1519 +1527 +1535 +1518 +1523 +1519 +1536 +1562 +1561 +1566 +1568 +1583 +1584 +1599 +1585 +1581 +1588 +1559 +1561 +1574 +1587 +1574 +1576 +1589 +1588 +1582 +1581 +1584 +1604 +1563 +1555 +1561 +1564 +1548 +1541 +1542 +1546 +1548 +1550 +1566 +1544 +1523 +1525 +1521 +1541 +1550 +1551 +1548 +1558 +1561 +1560 +1550 +1563 +1578 +1582 +1563 +1557 +1558 +1557 +1559 +1574 +1569 +1577 +1576 +1577 +1571 +1573 +1572 +1574 +1577 +1581 +1566 +1535 +1539 +1540 +1536 +1545 +1544 +1513 +1511 +1509 +1502 +1489 +1490 +1495 +1488 +1492 +1513 +1519 +1520 +1521 +1530 +1512 +1514 +1512 +1517 +1518 +1520 +1519 +1527 +1526 +1527 +1528 +1529 +1522 +1525 +1529 +1525 +1524 +1525 +1527 +1529 +1524 +1523 +1525 +1533 +1535 +1536 +1555 +1557 +1573 +1572 +1571 +1590 +1593 +1594 +1593 +1565 +1566 +1554 +1572 +1567 +1569 +1566 +1597 +1616 +1630 +1641 +1638 +1634 +1647 +1651 +1649 +1652 +1659 +1660 +1651 +1656 +1653 +1654 +1653 +1658 +1643 +1642 +1641 +1654 +1655 +1656 +1666 +1673 +1682 +1665 +1663 +1670 +1654 +1668 +1667 +1656 +1646 +1655 +1662 +1680 +1683 +1682 +1683 +1684 +1722 +1702 +1710 +1711 +1715 +1728 +1730 +1735 +1736 +1750 +1755 +1756 +1755 +1752 +1761 +1768 +1767 +1760 +1751 +1747 +1764 +1763 +1762 +1748 +1753 +1745 +1752 +1754 +1746 +1747 +1748 +1756 +1761 +1756 +1734 +1711 +1712 +1721 +1727 +1726 +1731 +1729 +1715 +1716 +1733 +1738 +1740 +1756 +1755 +1748 +1744 +1751 +1756 +1774 +1775 +1755 +1746 +1754 +1758 +1767 +1785 +1786 +1787 +1788 +1766 +1787 +1786 +1788 +1762 +1757 +1752 +1760 +1781 +1750 +1757 +1762 +1767 +1770 +1744 +1743 +1747 +1756 +1763 +1775 +1769 +1760 +1759 +1766 +1768 +1764 +1759 +1761 +1792 +1798 +1800 +1802 +1813 +1810 +1822 +1824 +1816 +1842 +1843 +1835 +1833 +1834 +1837 +1826 +1830 +1850 +1855 +1857 +1862 +1856 +1877 +1878 +1875 +1850 +1847 +1846 +1847 +1846 +1826 +1829 +1825 +1817 +1818 +1815 +1834 +1833 +1822 +1825 +1815 +1817 +1815 +1816 +1810 +1822 +1815 +1817 +1821 +1820 +1814 +1802 +1799 +1814 +1834 +1830 +1842 +1828 +1836 +1849 +1851 +1849 +1848 +1849 +1865 +1885 +1895 +1904 +1910 +1921 +1937 +1941 +1970 +1968 +1975 +1982 +2003 +2012 +2011 +2008 +2006 +1997 +1994 +1991 +1989 +1988 +1995 +1976 +2006 +2018 +2015 +2023 +2022 +2023 +2048 +2038 +2039 +2041 +2057 +2058 +2059 +2060 +2059 +2061 +2031 +2032 +2033 +2020 +2019 +2023 +2032 +2034 +2027 +2029 +2027 +2018 +2028 +2055 +2054 +2043 +2047 +2046 +2055 +2047 +2056 +2037 +2032 +2003 +2002 +1999 +2001 +1996 +2000 +2002 +2004 +1988 +1990 +1999 +1986 +1988 +1986 +1985 +1977 +1978 +1977 +1973 +1977 +1978 +1985 +1988 +1964 +1967 +1989 +1984 +1980 +1979 +1980 +1999 +2006 +2004 +2018 +2051 +2024 +2023 +2025 +2026 +2012 +2000 +2017 +2018 +2017 +2019 +2017 +2025 +2030 +2038 +2016 +2001 +2020 +2018 +2010 +2013 +2028 +2031 +2018 +2019 +2009 +2015 +2011 +2012 +2024 +2027 +2028 +2018 +2007 +2009 +2011 +2009 +2008 +2006 +2008 +2013 +2017 +2027 +2030 +2031 +2029 +2045 +2064 +2065 +2064 +2077 +2075 +2066 +2037 +2038 +2043 +2047 +2049 +2055 +2090 +2092 +2101 +2115 +2117 +2130 +2131 +2130 +2136 +2141 +2145 +2151 +2150 +2149 +2150 +2143 +2150 +2139 +2142 +2140 +2146 +2147 +2148 +2146 +2141 +2158 +2176 +2195 +2194 +2190 +2187 +2188 +2205 +2206 +2208 +2207 +2208 +2200 +2199 +2193 +2169 +2188 +2189 +2183 +2202 +2170 +2164 +2165 +2166 +2177 +2181 +2198 +2197 +2207 +2201 +2206 +2203 +2209 +2213 +2214 +2216 +2218 +2219 +2214 +2235 +2239 +2235 +2253 +2246 +2247 +2246 +2247 +2246 +2251 +2249 +2275 +2285 +2293 +2294 +2295 +2299 +2303 +2302 +2303 +2276 +2282 +2287 +2294 +2299 +2301 +2300 +2306 +2294 +2301 +2296 +2289 +2291 +2300 +2301 +2287 +2286 +2307 +2305 +2315 +2305 +2309 +2334 +2337 +2348 +2349 +2350 +2332 +2342 +2341 +2338 +2310 +2316 +2333 +2335 +2330 +2342 +2349 +2341 +2363 +2368 +2374 +2360 +2359 +2350 +2348 +2359 +2365 +2364 +2355 +2341 +2339 +2345 +2338 +2335 +2323 +2324 +2318 +2294 +2296 +2297 +2286 +2282 +2278 +2276 +2272 +2267 +2269 +2270 +2269 +2266 +2268 +2264 +2268 +2260 +2263 +2297 +2311 +2319 +2301 +2292 +2302 +2309 +2307 +2303 +2306 +2311 +2293 +2278 +2284 +2288 +2271 +2273 +2275 +2278 +2279 +2283 +2318 +2315 +2312 +2325 +2346 +2339 +2314 +2303 +2304 +2279 +2278 +2269 +2267 +2270 +2277 +2287 +2285 +2288 +2289 +2288 +2284 +2283 +2281 +2289 +2288 +2275 +2278 +2265 +2267 +2262 +2259 +2260 +2261 +2251 +2250 +2254 +2253 +2242 +2240 +2241 +2226 +2232 +2236 +2201 +2182 +2183 +2191 +2185 +2192 +2197 +2211 +2210 +2208 +2218 +2219 +2228 +2227 +2225 +2226 +2225 +2226 +2229 +2233 +2237 +2236 +2211 +2215 +2216 +2236 +2227 +2228 +2227 +2226 +2244 +2260 +2258 +2257 +2258 +2250 +2248 +2229 +2225 +2223 +2222 +2221 +2220 +2219 +2213 +2214 +2212 +2216 +2217 +2220 +2216 +2217 +2223 +2227 +2231 +2225 +2228 +2230 +2233 +2226 +2224 +2241 +2221 +2220 +2224 +2221 +2220 +2223 +2221 +2246 +2247 +2246 +2222 +2226 +2237 +2250 +2251 +2276 +2288 +2309 +2304 +2330 +2323 +2327 +2350 +2349 +2348 +2346 +2354 +2350 +2323 +2320 +2313 +2315 +2314 +2316 +2332 +2338 +2341 diff --git a/2021/Day 1/rust_solution/Cargo.lock b/2021/Day 1/rust_solution/Cargo.lock new file mode 100644 index 0000000..38ad082 --- /dev/null +++ b/2021/Day 1/rust_solution/Cargo.lock @@ -0,0 +1,5 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +[[package]] +name = "rust_solution" +version = "0.1.0" diff --git a/2021/Day 1/rust_solution/Cargo.toml b/2021/Day 1/rust_solution/Cargo.toml new file mode 100644 index 0000000..811accc --- /dev/null +++ b/2021/Day 1/rust_solution/Cargo.toml @@ -0,0 +1,9 @@ +[package] +name = "rust_solution" +version = "0.1.0" +authors = ["Teo-CD"] +edition = "2018" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/2021/Day 1/rust_solution/src/main.rs b/2021/Day 1/rust_solution/src/main.rs new file mode 100644 index 0000000..4222670 --- /dev/null +++ b/2021/Day 1/rust_solution/src/main.rs @@ -0,0 +1,38 @@ +use std::fs; + +fn first_puzzle(input: &String) { + // Go through each line and subtract it to the previous one, keeping only the positive results + // and counting them, knowing that the first diff is invalid. + let count = input.lines().scan(0, |current, line| { + let previous = *current; + *current = line.parse::().unwrap(); + Some(*current - previous)}).filter(|diff| diff.is_positive()).count() - 1; + + println!("Count of single increases : {}", count); +} + +fn second_puzzle(input: &String) { + let count = input.lines().scan([0; 4], |sliding_window: &mut [i32; 4], line|{ + let place = sliding_window[3]; + sliding_window[(place % 3) as usize] = line.parse::().unwrap(); + sliding_window[3] = place + 1; + + if sliding_window[3] < 3 { + Some(-1) + } else { + Some(sliding_window[0..3].iter().sum::()) + } + }).filter(|sum| !sum.is_negative()).scan(0, |current, sum| { + let previous = *current; + *current = sum; + Some(*current - previous)}).filter(|diff| diff.is_positive()).count() - 1; + + println!("Count of triple sums increasing : {}", count); +} + +fn main() { + let contents = fs::read_to_string("../input.txt").expect("Could not open file."); + first_puzzle(&contents); + second_puzzle(&contents); + 0; +} diff --git a/README.md b/README.md index 80c202c..440684f 100644 --- a/README.md +++ b/README.md @@ -5,4 +5,9 @@ The directory structure is simple : `year/day`, each day containing the input fi ## Depencies -Only Python3 for now ! +2020: + - Python3 + +2021: + - Rust (Cargo) + From f29637ec2691fc35448eb96711ec54768b57ff22 Mon Sep 17 00:00:00 2001 From: trotFunky Date: Fri, 3 Dec 2021 23:59:40 +0000 Subject: [PATCH 22/28] First day of 2021, done in Rust --- .gitignore | 2 + 2021/Day 1/input.txt | 2000 ++++++++++++++++++++++++++ 2021/Day 1/rust_solution/Cargo.lock | 5 + 2021/Day 1/rust_solution/Cargo.toml | 9 + 2021/Day 1/rust_solution/src/main.rs | 38 + README.md | 7 +- 6 files changed, 2060 insertions(+), 1 deletion(-) create mode 100644 2021/Day 1/input.txt create mode 100644 2021/Day 1/rust_solution/Cargo.lock create mode 100644 2021/Day 1/rust_solution/Cargo.toml create mode 100644 2021/Day 1/rust_solution/src/main.rs diff --git a/.gitignore b/.gitignore index b79602f..bb42c5f 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ **/.idea +**/target + diff --git a/2021/Day 1/input.txt b/2021/Day 1/input.txt new file mode 100644 index 0000000..13c1d1f --- /dev/null +++ b/2021/Day 1/input.txt @@ -0,0 +1,2000 @@ +199 +203 +200 +201 +196 +195 +196 +214 +227 +225 +229 +260 +246 +253 +271 +281 +280 +295 +310 +293 +295 +297 +298 +297 +306 +299 +290 +292 +289 +287 +291 +296 +294 +287 +286 +287 +289 +290 +281 +283 +282 +275 +256 +265 +242 +231 +226 +216 +227 +226 +249 +238 +237 +247 +245 +250 +264 +267 +259 +258 +264 +261 +249 +246 +239 +240 +259 +258 +280 +279 +278 +281 +272 +256 +255 +271 +286 +290 +286 +288 +290 +294 +292 +294 +292 +293 +294 +291 +298 +303 +301 +330 +331 +336 +362 +371 +374 +368 +367 +368 +366 +364 +371 +377 +378 +384 +386 +388 +393 +409 +423 +422 +411 +412 +426 +430 +441 +460 +462 +464 +469 +461 +483 +452 +455 +457 +468 +506 +509 +514 +525 +512 +524 +523 +522 +531 +549 +548 +549 +548 +524 +525 +528 +526 +537 +544 +549 +546 +525 +532 +535 +543 +544 +545 +525 +536 +538 +541 +524 +534 +542 +538 +539 +544 +543 +539 +538 +527 +553 +552 +562 +560 +561 +573 +574 +570 +571 +568 +569 +571 +573 +566 +567 +584 +591 +607 +605 +604 +605 +617 +615 +617 +606 +608 +609 +613 +616 +635 +634 +637 +635 +634 +655 +639 +646 +637 +628 +622 +648 +645 +640 +652 +653 +659 +661 +658 +650 +667 +670 +668 +680 +682 +673 +668 +678 +677 +675 +676 +677 +675 +688 +681 +676 +684 +675 +664 +665 +654 +660 +664 +663 +667 +658 +661 +676 +675 +680 +681 +690 +693 +697 +721 +733 +739 +740 +739 +751 +765 +766 +752 +748 +763 +772 +771 +782 +784 +797 +799 +817 +812 +811 +795 +783 +785 +790 +785 +784 +782 +771 +756 +759 +783 +772 +774 +779 +783 +786 +780 +783 +779 +777 +778 +777 +762 +778 +777 +770 +773 +769 +770 +771 +764 +765 +761 +745 +754 +758 +759 +746 +738 +740 +742 +767 +765 +754 +755 +758 +762 +760 +761 +757 +761 +770 +773 +777 +776 +777 +769 +767 +793 +805 +798 +793 +803 +809 +808 +817 +804 +809 +805 +804 +806 +808 +812 +830 +831 +832 +831 +819 +820 +823 +822 +812 +814 +812 +842 +858 +855 +856 +862 +860 +855 +839 +840 +841 +840 +846 +850 +859 +861 +852 +846 +848 +845 +833 +843 +846 +849 +889 +890 +894 +904 +907 +904 +905 +906 +907 +910 +902 +906 +900 +907 +906 +899 +887 +867 +866 +873 +878 +885 +880 +890 +863 +860 +859 +885 +856 +853 +854 +852 +864 +855 +874 +875 +874 +875 +871 +872 +867 +870 +873 +874 +860 +862 +879 +878 +879 +880 +881 +882 +878 +882 +885 +890 +902 +903 +905 +906 +909 +917 +916 +934 +932 +935 +937 +935 +910 +911 +907 +902 +904 +910 +917 +918 +943 +945 +959 +973 +972 +969 +973 +972 +958 +957 +959 +963 +968 +961 +960 +973 +971 +970 +977 +1002 +1012 +1011 +1007 +1017 +1024 +1014 +1013 +1019 +1005 +984 +983 +980 +993 +999 +982 +988 +989 +990 +992 +988 +989 +988 +981 +958 +973 +966 +965 +942 +926 +933 +928 +932 +940 +927 +930 +920 +930 +897 +905 +907 +889 +882 +888 +889 +872 +873 +885 +884 +886 +887 +898 +901 +902 +895 +880 +894 +886 +882 +885 +890 +896 +880 +881 +866 +872 +875 +903 +901 +907 +899 +920 +921 +934 +935 +937 +928 +929 +927 +928 +935 +906 +908 +906 +882 +883 +887 +891 +892 +898 +903 +907 +909 +916 +917 +945 +935 +937 +928 +918 +927 +916 +929 +919 +931 +954 +953 +954 +956 +953 +947 +937 +941 +960 +968 +951 +955 +954 +938 +939 +946 +945 +947 +948 +951 +943 +949 +946 +954 +952 +949 +943 +936 +944 +941 +950 +952 +948 +947 +971 +970 +969 +974 +971 +1000 +1005 +1007 +1009 +1008 +1000 +998 +999 +1001 +1008 +1001 +1024 +1005 +998 +1016 +1018 +1019 +1020 +1021 +1057 +1056 +1052 +1044 +1045 +1057 +1058 +1074 +1075 +1069 +1056 +1055 +1056 +1052 +1059 +1070 +1043 +1039 +1035 +1025 +1015 +1018 +1029 +1033 +1042 +1038 +1031 +1033 +1023 +1016 +1019 +1018 +1016 +1018 +1020 +1009 +1008 +997 +973 +983 +990 +996 +1002 +1001 +1000 +1002 +1001 +1015 +1016 +1015 +1019 +1020 +1016 +1010 +1009 +1008 +1016 +1018 +1015 +1011 +1004 +999 +1000 +1027 +1035 +1050 +1051 +1068 +1058 +1072 +1086 +1089 +1060 +1043 +1028 +1026 +1028 +1052 +1050 +1042 +1040 +1036 +1055 +1050 +1051 +1049 +1053 +1054 +1059 +1058 +1066 +1059 +1061 +1070 +1071 +1068 +1059 +1060 +1065 +1066 +1068 +1060 +1059 +1070 +1069 +1068 +1067 +1068 +1070 +1069 +1066 +1073 +1065 +1066 +1050 +1052 +1050 +1056 +1055 +1063 +1062 +1057 +1054 +1048 +1047 +1051 +1049 +1043 +1017 +1016 +1002 +1005 +992 +994 +999 +1001 +1017 +1026 +1024 +1028 +1040 +1039 +1046 +1022 +1023 +992 +995 +1019 +1022 +1023 +1011 +1004 +1005 +993 +991 +992 +995 +996 +997 +1009 +1011 +1012 +1017 +1030 +1029 +1031 +1024 +1033 +1008 +1006 +1018 +1020 +1015 +1020 +1031 +1029 +1026 +1030 +1042 +1039 +1029 +1027 +1008 +1003 +1019 +1000 +1001 +995 +996 +994 +988 +989 +988 +987 +994 +997 +1000 +994 +997 +989 +991 +985 +975 +982 +981 +986 +980 +979 +973 +984 +985 +983 +981 +956 +925 +924 +919 +913 +915 +917 +914 +916 +895 +910 +924 +919 +914 +928 +935 +927 +930 +932 +936 +939 +944 +948 +947 +946 +945 +948 +944 +942 +944 +958 +956 +947 +955 +990 +995 +996 +1007 +1009 +1013 +1012 +1011 +1020 +1019 +1021 +1016 +1038 +1050 +1043 +1046 +1047 +1043 +1040 +1039 +1045 +1046 +1030 +1031 +1034 +1035 +1045 +1066 +1085 +1092 +1101 +1100 +1101 +1099 +1084 +1085 +1086 +1090 +1091 +1087 +1100 +1099 +1092 +1095 +1101 +1102 +1118 +1117 +1138 +1139 +1132 +1127 +1131 +1132 +1130 +1128 +1130 +1150 +1149 +1157 +1158 +1156 +1157 +1155 +1170 +1175 +1167 +1166 +1177 +1174 +1186 +1187 +1186 +1185 +1189 +1193 +1204 +1191 +1196 +1198 +1186 +1198 +1215 +1210 +1211 +1212 +1211 +1207 +1206 +1198 +1202 +1190 +1185 +1190 +1199 +1222 +1225 +1222 +1234 +1236 +1260 +1261 +1262 +1272 +1289 +1286 +1290 +1297 +1295 +1270 +1291 +1299 +1303 +1318 +1342 +1356 +1361 +1362 +1326 +1325 +1333 +1329 +1349 +1353 +1367 +1368 +1371 +1369 +1353 +1351 +1349 +1352 +1354 +1353 +1356 +1355 +1362 +1366 +1368 +1370 +1349 +1354 +1357 +1356 +1360 +1357 +1361 +1363 +1364 +1345 +1338 +1335 +1334 +1322 +1329 +1333 +1334 +1331 +1330 +1337 +1348 +1347 +1348 +1317 +1307 +1313 +1330 +1323 +1324 +1327 +1334 +1336 +1334 +1332 +1338 +1341 +1342 +1373 +1375 +1374 +1372 +1373 +1371 +1370 +1375 +1363 +1361 +1366 +1389 +1390 +1366 +1380 +1381 +1379 +1383 +1400 +1402 +1404 +1409 +1410 +1434 +1439 +1443 +1448 +1434 +1462 +1463 +1462 +1464 +1465 +1471 +1465 +1464 +1469 +1473 +1480 +1486 +1488 +1492 +1494 +1495 +1496 +1504 +1496 +1495 +1472 +1469 +1465 +1466 +1455 +1464 +1465 +1474 +1475 +1490 +1499 +1490 +1492 +1489 +1500 +1504 +1500 +1499 +1500 +1510 +1511 +1516 +1511 +1515 +1512 +1499 +1506 +1509 +1493 +1495 +1496 +1485 +1486 +1476 +1475 +1484 +1485 +1469 +1477 +1478 +1467 +1468 +1469 +1477 +1478 +1475 +1473 +1461 +1468 +1470 +1496 +1491 +1506 +1505 +1526 +1530 +1528 +1529 +1533 +1555 +1558 +1557 +1554 +1557 +1559 +1560 +1562 +1561 +1563 +1564 +1550 +1559 +1558 +1559 +1554 +1535 +1538 +1541 +1540 +1529 +1528 +1519 +1527 +1535 +1518 +1523 +1519 +1536 +1562 +1561 +1566 +1568 +1583 +1584 +1599 +1585 +1581 +1588 +1559 +1561 +1574 +1587 +1574 +1576 +1589 +1588 +1582 +1581 +1584 +1604 +1563 +1555 +1561 +1564 +1548 +1541 +1542 +1546 +1548 +1550 +1566 +1544 +1523 +1525 +1521 +1541 +1550 +1551 +1548 +1558 +1561 +1560 +1550 +1563 +1578 +1582 +1563 +1557 +1558 +1557 +1559 +1574 +1569 +1577 +1576 +1577 +1571 +1573 +1572 +1574 +1577 +1581 +1566 +1535 +1539 +1540 +1536 +1545 +1544 +1513 +1511 +1509 +1502 +1489 +1490 +1495 +1488 +1492 +1513 +1519 +1520 +1521 +1530 +1512 +1514 +1512 +1517 +1518 +1520 +1519 +1527 +1526 +1527 +1528 +1529 +1522 +1525 +1529 +1525 +1524 +1525 +1527 +1529 +1524 +1523 +1525 +1533 +1535 +1536 +1555 +1557 +1573 +1572 +1571 +1590 +1593 +1594 +1593 +1565 +1566 +1554 +1572 +1567 +1569 +1566 +1597 +1616 +1630 +1641 +1638 +1634 +1647 +1651 +1649 +1652 +1659 +1660 +1651 +1656 +1653 +1654 +1653 +1658 +1643 +1642 +1641 +1654 +1655 +1656 +1666 +1673 +1682 +1665 +1663 +1670 +1654 +1668 +1667 +1656 +1646 +1655 +1662 +1680 +1683 +1682 +1683 +1684 +1722 +1702 +1710 +1711 +1715 +1728 +1730 +1735 +1736 +1750 +1755 +1756 +1755 +1752 +1761 +1768 +1767 +1760 +1751 +1747 +1764 +1763 +1762 +1748 +1753 +1745 +1752 +1754 +1746 +1747 +1748 +1756 +1761 +1756 +1734 +1711 +1712 +1721 +1727 +1726 +1731 +1729 +1715 +1716 +1733 +1738 +1740 +1756 +1755 +1748 +1744 +1751 +1756 +1774 +1775 +1755 +1746 +1754 +1758 +1767 +1785 +1786 +1787 +1788 +1766 +1787 +1786 +1788 +1762 +1757 +1752 +1760 +1781 +1750 +1757 +1762 +1767 +1770 +1744 +1743 +1747 +1756 +1763 +1775 +1769 +1760 +1759 +1766 +1768 +1764 +1759 +1761 +1792 +1798 +1800 +1802 +1813 +1810 +1822 +1824 +1816 +1842 +1843 +1835 +1833 +1834 +1837 +1826 +1830 +1850 +1855 +1857 +1862 +1856 +1877 +1878 +1875 +1850 +1847 +1846 +1847 +1846 +1826 +1829 +1825 +1817 +1818 +1815 +1834 +1833 +1822 +1825 +1815 +1817 +1815 +1816 +1810 +1822 +1815 +1817 +1821 +1820 +1814 +1802 +1799 +1814 +1834 +1830 +1842 +1828 +1836 +1849 +1851 +1849 +1848 +1849 +1865 +1885 +1895 +1904 +1910 +1921 +1937 +1941 +1970 +1968 +1975 +1982 +2003 +2012 +2011 +2008 +2006 +1997 +1994 +1991 +1989 +1988 +1995 +1976 +2006 +2018 +2015 +2023 +2022 +2023 +2048 +2038 +2039 +2041 +2057 +2058 +2059 +2060 +2059 +2061 +2031 +2032 +2033 +2020 +2019 +2023 +2032 +2034 +2027 +2029 +2027 +2018 +2028 +2055 +2054 +2043 +2047 +2046 +2055 +2047 +2056 +2037 +2032 +2003 +2002 +1999 +2001 +1996 +2000 +2002 +2004 +1988 +1990 +1999 +1986 +1988 +1986 +1985 +1977 +1978 +1977 +1973 +1977 +1978 +1985 +1988 +1964 +1967 +1989 +1984 +1980 +1979 +1980 +1999 +2006 +2004 +2018 +2051 +2024 +2023 +2025 +2026 +2012 +2000 +2017 +2018 +2017 +2019 +2017 +2025 +2030 +2038 +2016 +2001 +2020 +2018 +2010 +2013 +2028 +2031 +2018 +2019 +2009 +2015 +2011 +2012 +2024 +2027 +2028 +2018 +2007 +2009 +2011 +2009 +2008 +2006 +2008 +2013 +2017 +2027 +2030 +2031 +2029 +2045 +2064 +2065 +2064 +2077 +2075 +2066 +2037 +2038 +2043 +2047 +2049 +2055 +2090 +2092 +2101 +2115 +2117 +2130 +2131 +2130 +2136 +2141 +2145 +2151 +2150 +2149 +2150 +2143 +2150 +2139 +2142 +2140 +2146 +2147 +2148 +2146 +2141 +2158 +2176 +2195 +2194 +2190 +2187 +2188 +2205 +2206 +2208 +2207 +2208 +2200 +2199 +2193 +2169 +2188 +2189 +2183 +2202 +2170 +2164 +2165 +2166 +2177 +2181 +2198 +2197 +2207 +2201 +2206 +2203 +2209 +2213 +2214 +2216 +2218 +2219 +2214 +2235 +2239 +2235 +2253 +2246 +2247 +2246 +2247 +2246 +2251 +2249 +2275 +2285 +2293 +2294 +2295 +2299 +2303 +2302 +2303 +2276 +2282 +2287 +2294 +2299 +2301 +2300 +2306 +2294 +2301 +2296 +2289 +2291 +2300 +2301 +2287 +2286 +2307 +2305 +2315 +2305 +2309 +2334 +2337 +2348 +2349 +2350 +2332 +2342 +2341 +2338 +2310 +2316 +2333 +2335 +2330 +2342 +2349 +2341 +2363 +2368 +2374 +2360 +2359 +2350 +2348 +2359 +2365 +2364 +2355 +2341 +2339 +2345 +2338 +2335 +2323 +2324 +2318 +2294 +2296 +2297 +2286 +2282 +2278 +2276 +2272 +2267 +2269 +2270 +2269 +2266 +2268 +2264 +2268 +2260 +2263 +2297 +2311 +2319 +2301 +2292 +2302 +2309 +2307 +2303 +2306 +2311 +2293 +2278 +2284 +2288 +2271 +2273 +2275 +2278 +2279 +2283 +2318 +2315 +2312 +2325 +2346 +2339 +2314 +2303 +2304 +2279 +2278 +2269 +2267 +2270 +2277 +2287 +2285 +2288 +2289 +2288 +2284 +2283 +2281 +2289 +2288 +2275 +2278 +2265 +2267 +2262 +2259 +2260 +2261 +2251 +2250 +2254 +2253 +2242 +2240 +2241 +2226 +2232 +2236 +2201 +2182 +2183 +2191 +2185 +2192 +2197 +2211 +2210 +2208 +2218 +2219 +2228 +2227 +2225 +2226 +2225 +2226 +2229 +2233 +2237 +2236 +2211 +2215 +2216 +2236 +2227 +2228 +2227 +2226 +2244 +2260 +2258 +2257 +2258 +2250 +2248 +2229 +2225 +2223 +2222 +2221 +2220 +2219 +2213 +2214 +2212 +2216 +2217 +2220 +2216 +2217 +2223 +2227 +2231 +2225 +2228 +2230 +2233 +2226 +2224 +2241 +2221 +2220 +2224 +2221 +2220 +2223 +2221 +2246 +2247 +2246 +2222 +2226 +2237 +2250 +2251 +2276 +2288 +2309 +2304 +2330 +2323 +2327 +2350 +2349 +2348 +2346 +2354 +2350 +2323 +2320 +2313 +2315 +2314 +2316 +2332 +2338 +2341 diff --git a/2021/Day 1/rust_solution/Cargo.lock b/2021/Day 1/rust_solution/Cargo.lock new file mode 100644 index 0000000..38ad082 --- /dev/null +++ b/2021/Day 1/rust_solution/Cargo.lock @@ -0,0 +1,5 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +[[package]] +name = "rust_solution" +version = "0.1.0" diff --git a/2021/Day 1/rust_solution/Cargo.toml b/2021/Day 1/rust_solution/Cargo.toml new file mode 100644 index 0000000..811accc --- /dev/null +++ b/2021/Day 1/rust_solution/Cargo.toml @@ -0,0 +1,9 @@ +[package] +name = "rust_solution" +version = "0.1.0" +authors = ["Teo-CD"] +edition = "2018" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/2021/Day 1/rust_solution/src/main.rs b/2021/Day 1/rust_solution/src/main.rs new file mode 100644 index 0000000..4222670 --- /dev/null +++ b/2021/Day 1/rust_solution/src/main.rs @@ -0,0 +1,38 @@ +use std::fs; + +fn first_puzzle(input: &String) { + // Go through each line and subtract it to the previous one, keeping only the positive results + // and counting them, knowing that the first diff is invalid. + let count = input.lines().scan(0, |current, line| { + let previous = *current; + *current = line.parse::().unwrap(); + Some(*current - previous)}).filter(|diff| diff.is_positive()).count() - 1; + + println!("Count of single increases : {}", count); +} + +fn second_puzzle(input: &String) { + let count = input.lines().scan([0; 4], |sliding_window: &mut [i32; 4], line|{ + let place = sliding_window[3]; + sliding_window[(place % 3) as usize] = line.parse::().unwrap(); + sliding_window[3] = place + 1; + + if sliding_window[3] < 3 { + Some(-1) + } else { + Some(sliding_window[0..3].iter().sum::()) + } + }).filter(|sum| !sum.is_negative()).scan(0, |current, sum| { + let previous = *current; + *current = sum; + Some(*current - previous)}).filter(|diff| diff.is_positive()).count() - 1; + + println!("Count of triple sums increasing : {}", count); +} + +fn main() { + let contents = fs::read_to_string("../input.txt").expect("Could not open file."); + first_puzzle(&contents); + second_puzzle(&contents); + 0; +} diff --git a/README.md b/README.md index 80c202c..440684f 100644 --- a/README.md +++ b/README.md @@ -5,4 +5,9 @@ The directory structure is simple : `year/day`, each day containing the input fi ## Depencies -Only Python3 for now ! +2020: + - Python3 + +2021: + - Rust (Cargo) + From 218321e6ae43c5db77e113b61267651488c687c2 Mon Sep 17 00:00:00 2001 From: Teo-CD Date: Sat, 4 Dec 2021 00:08:34 +0000 Subject: [PATCH 23/28] Added comments for Day 1 2021 --- 2021/Day 1/rust_solution/src/main.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/2021/Day 1/rust_solution/src/main.rs b/2021/Day 1/rust_solution/src/main.rs index 4222670..2806a66 100644 --- a/2021/Day 1/rust_solution/src/main.rs +++ b/2021/Day 1/rust_solution/src/main.rs @@ -12,6 +12,8 @@ fn first_puzzle(input: &String) { } fn second_puzzle(input: &String) { + // For each input, add it to a circular buffer whose write position is stored at the end. + // For all but the first two elements, output the sum of the circular buffer. let count = input.lines().scan([0; 4], |sliding_window: &mut [i32; 4], line|{ let place = sliding_window[3]; sliding_window[(place % 3) as usize] = line.parse::().unwrap(); @@ -22,7 +24,9 @@ fn second_puzzle(input: &String) { } else { Some(sliding_window[0..3].iter().sum::()) } + // Filter out the first two elements, can't generate a three-element sum. }).filter(|sum| !sum.is_negative()).scan(0, |current, sum| { + // Subtract each successive elements, similarly to the first solution. let previous = *current; *current = sum; Some(*current - previous)}).filter(|diff| diff.is_positive()).count() - 1; From a20909dbc8ef74933ad3793f74cbd42c120dbf83 Mon Sep 17 00:00:00 2001 From: trotFunky Date: Sat, 4 Dec 2021 00:08:34 +0000 Subject: [PATCH 24/28] Added comments for Day 1 2021 --- 2021/Day 1/rust_solution/src/main.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/2021/Day 1/rust_solution/src/main.rs b/2021/Day 1/rust_solution/src/main.rs index 4222670..2806a66 100644 --- a/2021/Day 1/rust_solution/src/main.rs +++ b/2021/Day 1/rust_solution/src/main.rs @@ -12,6 +12,8 @@ fn first_puzzle(input: &String) { } fn second_puzzle(input: &String) { + // For each input, add it to a circular buffer whose write position is stored at the end. + // For all but the first two elements, output the sum of the circular buffer. let count = input.lines().scan([0; 4], |sliding_window: &mut [i32; 4], line|{ let place = sliding_window[3]; sliding_window[(place % 3) as usize] = line.parse::().unwrap(); @@ -22,7 +24,9 @@ fn second_puzzle(input: &String) { } else { Some(sliding_window[0..3].iter().sum::()) } + // Filter out the first two elements, can't generate a three-element sum. }).filter(|sum| !sum.is_negative()).scan(0, |current, sum| { + // Subtract each successive elements, similarly to the first solution. let previous = *current; *current = sum; Some(*current - previous)}).filter(|diff| diff.is_positive()).count() - 1; From 57bf7b2194f931b3af4457dcc33770c80c7109e5 Mon Sep 17 00:00:00 2001 From: Teo-CD Date: Sat, 4 Dec 2021 01:18:16 +0000 Subject: [PATCH 25/28] 2021 Day 2 done in Rust Code is currently fairly ugly, will try to refactor in a more functional fashion --- 2021/Day 2/input.txt | 1000 ++++++++++++++++++++++++++ 2021/Day 2/rust_solution/Cargo.lock | 5 + 2021/Day 2/rust_solution/Cargo.toml | 9 + 2021/Day 2/rust_solution/src/main.rs | 43 ++ 4 files changed, 1057 insertions(+) create mode 100644 2021/Day 2/input.txt create mode 100644 2021/Day 2/rust_solution/Cargo.lock create mode 100644 2021/Day 2/rust_solution/Cargo.toml create mode 100644 2021/Day 2/rust_solution/src/main.rs diff --git a/2021/Day 2/input.txt b/2021/Day 2/input.txt new file mode 100644 index 0000000..171b7da --- /dev/null +++ b/2021/Day 2/input.txt @@ -0,0 +1,1000 @@ +forward 6 +down 8 +down 5 +down 9 +forward 2 +down 5 +down 5 +forward 1 +forward 7 +down 8 +up 2 +down 4 +up 8 +down 8 +forward 3 +forward 4 +down 1 +forward 5 +up 7 +down 7 +down 8 +forward 2 +up 3 +forward 1 +forward 6 +forward 9 +forward 7 +forward 8 +forward 2 +forward 3 +up 2 +up 8 +down 1 +forward 7 +down 7 +down 2 +forward 6 +down 1 +forward 5 +down 3 +forward 6 +down 7 +up 1 +up 3 +forward 7 +forward 6 +forward 8 +down 4 +down 2 +up 5 +down 2 +forward 2 +up 5 +forward 6 +down 3 +down 1 +down 5 +forward 6 +up 6 +down 7 +down 8 +down 2 +forward 3 +down 5 +down 4 +forward 7 +forward 9 +up 9 +up 8 +up 4 +forward 8 +forward 5 +down 4 +up 2 +forward 9 +up 5 +down 5 +up 9 +forward 2 +forward 3 +down 6 +down 8 +forward 8 +up 5 +down 5 +forward 7 +forward 6 +forward 8 +up 3 +forward 3 +forward 1 +up 8 +down 8 +down 2 +down 4 +up 7 +up 2 +up 9 +up 4 +forward 6 +down 8 +down 1 +forward 6 +forward 6 +down 4 +down 2 +up 7 +down 9 +down 9 +up 2 +up 7 +down 4 +down 2 +forward 1 +down 1 +up 5 +up 5 +forward 9 +up 3 +down 7 +forward 7 +down 4 +down 8 +up 1 +down 4 +down 7 +forward 5 +up 9 +forward 5 +forward 1 +forward 8 +forward 6 +forward 5 +forward 1 +down 4 +down 6 +forward 5 +forward 2 +forward 3 +down 1 +up 2 +up 9 +forward 4 +up 8 +down 7 +down 8 +up 7 +down 2 +forward 7 +up 1 +forward 5 +forward 1 +forward 8 +forward 1 +up 8 +down 6 +down 7 +forward 2 +down 8 +down 8 +forward 8 +up 8 +down 6 +down 7 +down 4 +down 7 +forward 6 +up 3 +forward 3 +down 2 +down 8 +down 3 +down 9 +forward 9 +forward 7 +down 6 +down 4 +forward 6 +down 2 +down 7 +up 7 +up 8 +forward 2 +forward 8 +down 3 +up 2 +forward 9 +down 2 +up 3 +down 1 +down 1 +down 4 +down 8 +up 2 +up 8 +forward 2 +forward 1 +up 1 +forward 7 +down 8 +down 1 +down 7 +up 3 +down 3 +forward 8 +forward 2 +forward 7 +down 2 +up 9 +up 3 +up 5 +down 4 +up 3 +forward 4 +up 5 +down 9 +down 9 +forward 2 +forward 2 +down 2 +down 8 +down 3 +down 5 +forward 6 +down 6 +up 5 +down 2 +down 4 +down 9 +down 3 +forward 7 +down 1 +forward 1 +down 4 +up 1 +down 9 +forward 5 +up 2 +down 3 +forward 8 +forward 9 +up 9 +down 2 +forward 8 +down 4 +down 5 +forward 6 +forward 5 +forward 4 +down 6 +down 9 +down 2 +forward 9 +down 4 +up 8 +up 9 +up 2 +up 5 +up 5 +forward 9 +up 1 +forward 6 +forward 7 +forward 8 +forward 9 +up 2 +forward 3 +forward 4 +forward 6 +forward 9 +up 5 +up 5 +down 3 +forward 1 +forward 3 +forward 2 +forward 3 +forward 6 +forward 7 +down 4 +down 2 +down 1 +forward 2 +down 5 +forward 3 +forward 6 +down 8 +down 9 +forward 4 +forward 6 +down 6 +down 6 +forward 3 +down 6 +down 8 +down 1 +forward 7 +forward 9 +down 2 +down 5 +forward 1 +forward 3 +down 2 +forward 1 +down 8 +down 1 +forward 4 +down 8 +forward 5 +forward 1 +down 7 +down 7 +forward 3 +forward 1 +forward 6 +forward 7 +forward 5 +up 1 +forward 2 +down 9 +forward 3 +up 1 +forward 2 +down 1 +down 6 +down 3 +forward 7 +down 5 +down 4 +down 1 +forward 9 +forward 9 +down 5 +forward 7 +forward 3 +forward 5 +down 1 +forward 6 +down 8 +up 2 +forward 6 +down 3 +forward 2 +forward 9 +forward 4 +down 1 +down 3 +forward 9 +forward 3 +forward 8 +forward 9 +up 3 +up 1 +forward 1 +forward 2 +down 8 +down 9 +down 2 +down 1 +down 3 +down 2 +forward 9 +forward 7 +down 5 +forward 1 +forward 6 +forward 3 +forward 9 +down 2 +forward 8 +down 5 +down 1 +forward 5 +forward 3 +down 6 +forward 6 +down 8 +forward 2 +up 5 +forward 1 +down 2 +down 6 +forward 9 +forward 7 +down 1 +down 3 +down 6 +up 3 +down 4 +forward 8 +forward 1 +forward 7 +down 2 +down 5 +down 9 +forward 6 +down 5 +forward 5 +up 1 +down 5 +forward 8 +up 9 +forward 2 +down 6 +forward 2 +forward 7 +up 2 +down 9 +down 7 +up 7 +down 6 +up 5 +forward 1 +down 8 +forward 8 +forward 1 +forward 7 +down 9 +down 6 +forward 3 +down 6 +down 1 +down 1 +down 1 +down 3 +down 7 +down 7 +down 3 +down 5 +forward 4 +down 4 +forward 7 +forward 5 +down 9 +down 9 +forward 7 +down 3 +down 9 +down 4 +forward 3 +down 7 +down 2 +forward 2 +down 6 +forward 9 +forward 9 +forward 5 +up 4 +down 7 +down 2 +up 9 +up 4 +forward 8 +forward 1 +down 8 +up 5 +down 4 +down 3 +forward 2 +down 7 +down 2 +down 1 +down 9 +forward 7 +forward 7 +up 8 +up 4 +down 3 +down 8 +forward 6 +forward 5 +forward 5 +forward 5 +down 3 +down 8 +forward 4 +forward 7 +forward 1 +up 3 +up 9 +down 6 +up 4 +down 7 +forward 8 +forward 4 +forward 3 +up 8 +up 3 +down 3 +forward 6 +down 2 +forward 7 +forward 4 +forward 8 +down 3 +down 9 +down 9 +down 2 +forward 8 +up 4 +down 3 +forward 8 +forward 5 +forward 7 +down 6 +up 9 +forward 3 +down 2 +forward 5 +forward 2 +down 7 +forward 6 +forward 2 +up 9 +down 1 +down 1 +forward 4 +up 1 +forward 9 +down 3 +down 4 +down 2 +forward 3 +forward 3 +forward 3 +up 7 +up 8 +down 5 +forward 1 +forward 7 +up 9 +up 3 +down 3 +down 8 +forward 6 +up 5 +up 5 +forward 4 +down 2 +down 8 +down 1 +forward 6 +down 3 +forward 3 +forward 6 +forward 1 +up 3 +up 1 +down 5 +down 2 +down 7 +down 1 +forward 9 +down 4 +down 8 +forward 9 +forward 7 +forward 8 +down 1 +down 2 +up 7 +down 5 +down 2 +down 1 +up 4 +up 8 +up 7 +down 4 +forward 3 +down 2 +down 2 +forward 5 +forward 4 +down 8 +up 4 +forward 4 +up 1 +down 3 +down 9 +down 9 +down 3 +up 8 +forward 1 +forward 6 +down 6 +down 2 +forward 8 +down 3 +forward 8 +forward 2 +forward 9 +up 3 +forward 6 +down 5 +forward 6 +forward 2 +up 7 +down 9 +forward 2 +up 2 +forward 7 +down 1 +down 5 +down 6 +forward 8 +down 6 +forward 4 +forward 1 +forward 3 +forward 4 +up 4 +forward 4 +down 4 +forward 2 +forward 5 +forward 2 +forward 5 +down 9 +up 2 +up 1 +down 2 +up 4 +up 5 +forward 2 +down 3 +down 9 +forward 3 +down 8 +down 9 +forward 5 +down 3 +forward 5 +down 3 +up 8 +forward 7 +forward 1 +down 2 +down 7 +forward 3 +down 8 +forward 9 +down 4 +down 1 +down 7 +down 4 +up 5 +forward 1 +down 4 +forward 1 +forward 8 +up 1 +up 5 +up 2 +up 2 +down 4 +down 7 +forward 2 +down 8 +up 8 +down 9 +down 3 +down 6 +down 3 +down 1 +forward 7 +up 8 +forward 5 +up 5 +down 8 +down 1 +down 8 +down 6 +down 5 +forward 2 +up 5 +down 6 +forward 9 +up 6 +down 5 +down 7 +up 9 +down 1 +forward 4 +up 6 +forward 2 +down 5 +down 5 +forward 2 +up 6 +forward 1 +down 8 +forward 4 +up 8 +down 3 +forward 8 +down 8 +forward 5 +down 6 +down 3 +forward 1 +down 4 +down 8 +up 1 +down 1 +down 2 +up 9 +forward 2 +forward 3 +down 7 +down 2 +forward 7 +up 8 +down 2 +down 8 +down 9 +up 1 +down 5 +down 5 +down 4 +down 8 +down 9 +up 5 +forward 2 +down 4 +down 3 +down 2 +forward 5 +forward 8 +down 8 +down 1 +forward 9 +down 5 +forward 5 +down 2 +up 3 +up 9 +down 1 +down 9 +forward 7 +up 7 +forward 3 +up 6 +forward 8 +down 2 +down 1 +down 7 +forward 5 +down 8 +down 4 +forward 7 +forward 4 +down 6 +forward 9 +down 3 +forward 2 +down 3 +down 1 +down 1 +up 1 +up 3 +down 6 +forward 3 +up 9 +down 4 +up 2 +down 3 +up 1 +down 8 +down 5 +forward 7 +forward 2 +forward 9 +down 8 +down 5 +down 6 +up 3 +forward 2 +up 8 +down 4 +forward 7 +down 8 +down 6 +down 4 +forward 7 +up 9 +down 4 +forward 2 +forward 5 +down 3 +up 6 +up 6 +down 2 +down 4 +forward 8 +forward 5 +forward 3 +forward 5 +down 5 +down 5 +down 6 +forward 3 +forward 7 +forward 1 +down 8 +down 5 +forward 7 +up 7 +down 9 +down 9 +down 9 +up 6 +down 2 +down 3 +forward 1 +up 7 +up 8 +forward 5 +down 1 +down 3 +down 3 +forward 5 +down 7 +down 1 +up 2 +down 2 +down 3 +forward 7 +down 9 +forward 6 +down 5 +forward 2 +down 5 +forward 6 +up 3 +down 8 +up 2 +forward 5 +forward 1 +forward 5 +forward 8 +forward 6 +forward 9 +forward 6 +up 6 +up 5 +down 8 +down 3 +down 5 +down 2 +forward 9 +forward 8 +down 1 +up 1 +up 6 +down 6 +forward 4 +down 3 +forward 6 +forward 1 +up 5 +down 6 +up 9 +down 7 +down 2 +down 9 +down 5 +forward 5 +up 2 +forward 8 +down 2 +down 8 +forward 6 +down 4 +forward 8 +down 7 +down 8 +down 1 +forward 3 +down 6 +down 9 +down 3 +forward 3 +down 8 +forward 8 +down 7 +forward 6 +forward 8 +down 8 +up 7 +down 1 +forward 2 +forward 3 +down 5 +up 8 +down 3 +down 4 +down 7 +forward 9 +forward 7 +forward 1 +down 3 +forward 9 +down 8 +forward 2 +down 2 +down 9 +down 4 +down 3 +up 6 +up 9 +down 3 +down 2 +forward 5 +down 3 +down 2 +down 8 +forward 6 +forward 5 +up 4 +forward 9 +forward 8 +forward 9 +down 2 +forward 2 +up 6 +forward 1 +down 5 +forward 2 +down 8 +up 2 +up 3 +down 3 +up 2 +up 1 +up 5 +forward 1 +forward 2 +down 8 +up 3 +down 9 +forward 7 +up 5 +down 4 +down 4 +up 3 +forward 2 +up 5 +down 4 +down 4 +up 5 +forward 8 +down 8 +down 6 +forward 7 +down 1 +down 3 +down 1 +forward 3 +down 5 +down 3 +forward 3 +up 2 +forward 2 +down 9 +up 8 +forward 8 +up 8 +forward 1 +forward 9 +forward 3 +down 8 +down 3 +forward 8 +forward 4 +down 2 +forward 2 +down 2 +down 5 +down 7 +down 5 +forward 8 +up 3 +forward 1 +down 1 +forward 3 +down 9 +forward 2 +forward 2 +forward 7 +down 7 +down 2 +forward 9 +up 5 +up 7 +forward 8 +forward 1 +down 7 +down 8 +down 3 +forward 6 diff --git a/2021/Day 2/rust_solution/Cargo.lock b/2021/Day 2/rust_solution/Cargo.lock new file mode 100644 index 0000000..38ad082 --- /dev/null +++ b/2021/Day 2/rust_solution/Cargo.lock @@ -0,0 +1,5 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +[[package]] +name = "rust_solution" +version = "0.1.0" diff --git a/2021/Day 2/rust_solution/Cargo.toml b/2021/Day 2/rust_solution/Cargo.toml new file mode 100644 index 0000000..811accc --- /dev/null +++ b/2021/Day 2/rust_solution/Cargo.toml @@ -0,0 +1,9 @@ +[package] +name = "rust_solution" +version = "0.1.0" +authors = ["Teo-CD"] +edition = "2018" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/2021/Day 2/rust_solution/src/main.rs b/2021/Day 2/rust_solution/src/main.rs new file mode 100644 index 0000000..f6e0eea --- /dev/null +++ b/2021/Day 2/rust_solution/src/main.rs @@ -0,0 +1,43 @@ +use std::fs; + +fn first_puzzle(input: &String) { + let mut position = [0; 2]; + for line in input.lines() { + if line.contains("forward") { + // Surely there is a better way to parse a string for an integer ? + position[0] += line.rsplit(' ').next().unwrap().parse::().unwrap(); + } else if line.contains("up") { + position[1] -= line.rsplit(' ').next().unwrap().parse::().unwrap(); + } else if line.contains("down") { + position[1] += line.rsplit(' ').next().unwrap().parse::().unwrap(); + } + } + + println!("Position : {}, {}", position[0], position[1]); + println!("Multiplied : {}", position[0] * position[1]); +} + +fn second_puzzle(input: &String) { + let mut position = [0; 3]; + for line in input.lines() { + if line.contains("forward") { + let forward_move = line.rsplit(' ').next().unwrap().parse::().unwrap(); + position[0] += forward_move; + position[1] += forward_move * position[2]; + } else if line.contains("up") { + position[2] -= line.rsplit(' ').next().unwrap().parse::().unwrap(); + } else if line.contains("down") { + position[2] += line.rsplit(' ').next().unwrap().parse::().unwrap(); + } + } + + println!("Position : {}, {}", position[0], position[1]); + println!("Multiplied : {}", position[0] * position[1]); +} + +fn main() { + let contents = fs::read_to_string("../input.txt").expect("Could not open file."); + first_puzzle(&contents); + second_puzzle(&contents); + 0; +} From 31f3680949f5b91187661b9c8a0cc0468e411ebf Mon Sep 17 00:00:00 2001 From: trotFunky Date: Sat, 4 Dec 2021 01:18:16 +0000 Subject: [PATCH 26/28] 2021 Day 2 done in Rust Code is currently fairly ugly, will try to refactor in a more functional fashion --- 2021/Day 2/input.txt | 1000 ++++++++++++++++++++++++++ 2021/Day 2/rust_solution/Cargo.lock | 5 + 2021/Day 2/rust_solution/Cargo.toml | 9 + 2021/Day 2/rust_solution/src/main.rs | 43 ++ 4 files changed, 1057 insertions(+) create mode 100644 2021/Day 2/input.txt create mode 100644 2021/Day 2/rust_solution/Cargo.lock create mode 100644 2021/Day 2/rust_solution/Cargo.toml create mode 100644 2021/Day 2/rust_solution/src/main.rs diff --git a/2021/Day 2/input.txt b/2021/Day 2/input.txt new file mode 100644 index 0000000..171b7da --- /dev/null +++ b/2021/Day 2/input.txt @@ -0,0 +1,1000 @@ +forward 6 +down 8 +down 5 +down 9 +forward 2 +down 5 +down 5 +forward 1 +forward 7 +down 8 +up 2 +down 4 +up 8 +down 8 +forward 3 +forward 4 +down 1 +forward 5 +up 7 +down 7 +down 8 +forward 2 +up 3 +forward 1 +forward 6 +forward 9 +forward 7 +forward 8 +forward 2 +forward 3 +up 2 +up 8 +down 1 +forward 7 +down 7 +down 2 +forward 6 +down 1 +forward 5 +down 3 +forward 6 +down 7 +up 1 +up 3 +forward 7 +forward 6 +forward 8 +down 4 +down 2 +up 5 +down 2 +forward 2 +up 5 +forward 6 +down 3 +down 1 +down 5 +forward 6 +up 6 +down 7 +down 8 +down 2 +forward 3 +down 5 +down 4 +forward 7 +forward 9 +up 9 +up 8 +up 4 +forward 8 +forward 5 +down 4 +up 2 +forward 9 +up 5 +down 5 +up 9 +forward 2 +forward 3 +down 6 +down 8 +forward 8 +up 5 +down 5 +forward 7 +forward 6 +forward 8 +up 3 +forward 3 +forward 1 +up 8 +down 8 +down 2 +down 4 +up 7 +up 2 +up 9 +up 4 +forward 6 +down 8 +down 1 +forward 6 +forward 6 +down 4 +down 2 +up 7 +down 9 +down 9 +up 2 +up 7 +down 4 +down 2 +forward 1 +down 1 +up 5 +up 5 +forward 9 +up 3 +down 7 +forward 7 +down 4 +down 8 +up 1 +down 4 +down 7 +forward 5 +up 9 +forward 5 +forward 1 +forward 8 +forward 6 +forward 5 +forward 1 +down 4 +down 6 +forward 5 +forward 2 +forward 3 +down 1 +up 2 +up 9 +forward 4 +up 8 +down 7 +down 8 +up 7 +down 2 +forward 7 +up 1 +forward 5 +forward 1 +forward 8 +forward 1 +up 8 +down 6 +down 7 +forward 2 +down 8 +down 8 +forward 8 +up 8 +down 6 +down 7 +down 4 +down 7 +forward 6 +up 3 +forward 3 +down 2 +down 8 +down 3 +down 9 +forward 9 +forward 7 +down 6 +down 4 +forward 6 +down 2 +down 7 +up 7 +up 8 +forward 2 +forward 8 +down 3 +up 2 +forward 9 +down 2 +up 3 +down 1 +down 1 +down 4 +down 8 +up 2 +up 8 +forward 2 +forward 1 +up 1 +forward 7 +down 8 +down 1 +down 7 +up 3 +down 3 +forward 8 +forward 2 +forward 7 +down 2 +up 9 +up 3 +up 5 +down 4 +up 3 +forward 4 +up 5 +down 9 +down 9 +forward 2 +forward 2 +down 2 +down 8 +down 3 +down 5 +forward 6 +down 6 +up 5 +down 2 +down 4 +down 9 +down 3 +forward 7 +down 1 +forward 1 +down 4 +up 1 +down 9 +forward 5 +up 2 +down 3 +forward 8 +forward 9 +up 9 +down 2 +forward 8 +down 4 +down 5 +forward 6 +forward 5 +forward 4 +down 6 +down 9 +down 2 +forward 9 +down 4 +up 8 +up 9 +up 2 +up 5 +up 5 +forward 9 +up 1 +forward 6 +forward 7 +forward 8 +forward 9 +up 2 +forward 3 +forward 4 +forward 6 +forward 9 +up 5 +up 5 +down 3 +forward 1 +forward 3 +forward 2 +forward 3 +forward 6 +forward 7 +down 4 +down 2 +down 1 +forward 2 +down 5 +forward 3 +forward 6 +down 8 +down 9 +forward 4 +forward 6 +down 6 +down 6 +forward 3 +down 6 +down 8 +down 1 +forward 7 +forward 9 +down 2 +down 5 +forward 1 +forward 3 +down 2 +forward 1 +down 8 +down 1 +forward 4 +down 8 +forward 5 +forward 1 +down 7 +down 7 +forward 3 +forward 1 +forward 6 +forward 7 +forward 5 +up 1 +forward 2 +down 9 +forward 3 +up 1 +forward 2 +down 1 +down 6 +down 3 +forward 7 +down 5 +down 4 +down 1 +forward 9 +forward 9 +down 5 +forward 7 +forward 3 +forward 5 +down 1 +forward 6 +down 8 +up 2 +forward 6 +down 3 +forward 2 +forward 9 +forward 4 +down 1 +down 3 +forward 9 +forward 3 +forward 8 +forward 9 +up 3 +up 1 +forward 1 +forward 2 +down 8 +down 9 +down 2 +down 1 +down 3 +down 2 +forward 9 +forward 7 +down 5 +forward 1 +forward 6 +forward 3 +forward 9 +down 2 +forward 8 +down 5 +down 1 +forward 5 +forward 3 +down 6 +forward 6 +down 8 +forward 2 +up 5 +forward 1 +down 2 +down 6 +forward 9 +forward 7 +down 1 +down 3 +down 6 +up 3 +down 4 +forward 8 +forward 1 +forward 7 +down 2 +down 5 +down 9 +forward 6 +down 5 +forward 5 +up 1 +down 5 +forward 8 +up 9 +forward 2 +down 6 +forward 2 +forward 7 +up 2 +down 9 +down 7 +up 7 +down 6 +up 5 +forward 1 +down 8 +forward 8 +forward 1 +forward 7 +down 9 +down 6 +forward 3 +down 6 +down 1 +down 1 +down 1 +down 3 +down 7 +down 7 +down 3 +down 5 +forward 4 +down 4 +forward 7 +forward 5 +down 9 +down 9 +forward 7 +down 3 +down 9 +down 4 +forward 3 +down 7 +down 2 +forward 2 +down 6 +forward 9 +forward 9 +forward 5 +up 4 +down 7 +down 2 +up 9 +up 4 +forward 8 +forward 1 +down 8 +up 5 +down 4 +down 3 +forward 2 +down 7 +down 2 +down 1 +down 9 +forward 7 +forward 7 +up 8 +up 4 +down 3 +down 8 +forward 6 +forward 5 +forward 5 +forward 5 +down 3 +down 8 +forward 4 +forward 7 +forward 1 +up 3 +up 9 +down 6 +up 4 +down 7 +forward 8 +forward 4 +forward 3 +up 8 +up 3 +down 3 +forward 6 +down 2 +forward 7 +forward 4 +forward 8 +down 3 +down 9 +down 9 +down 2 +forward 8 +up 4 +down 3 +forward 8 +forward 5 +forward 7 +down 6 +up 9 +forward 3 +down 2 +forward 5 +forward 2 +down 7 +forward 6 +forward 2 +up 9 +down 1 +down 1 +forward 4 +up 1 +forward 9 +down 3 +down 4 +down 2 +forward 3 +forward 3 +forward 3 +up 7 +up 8 +down 5 +forward 1 +forward 7 +up 9 +up 3 +down 3 +down 8 +forward 6 +up 5 +up 5 +forward 4 +down 2 +down 8 +down 1 +forward 6 +down 3 +forward 3 +forward 6 +forward 1 +up 3 +up 1 +down 5 +down 2 +down 7 +down 1 +forward 9 +down 4 +down 8 +forward 9 +forward 7 +forward 8 +down 1 +down 2 +up 7 +down 5 +down 2 +down 1 +up 4 +up 8 +up 7 +down 4 +forward 3 +down 2 +down 2 +forward 5 +forward 4 +down 8 +up 4 +forward 4 +up 1 +down 3 +down 9 +down 9 +down 3 +up 8 +forward 1 +forward 6 +down 6 +down 2 +forward 8 +down 3 +forward 8 +forward 2 +forward 9 +up 3 +forward 6 +down 5 +forward 6 +forward 2 +up 7 +down 9 +forward 2 +up 2 +forward 7 +down 1 +down 5 +down 6 +forward 8 +down 6 +forward 4 +forward 1 +forward 3 +forward 4 +up 4 +forward 4 +down 4 +forward 2 +forward 5 +forward 2 +forward 5 +down 9 +up 2 +up 1 +down 2 +up 4 +up 5 +forward 2 +down 3 +down 9 +forward 3 +down 8 +down 9 +forward 5 +down 3 +forward 5 +down 3 +up 8 +forward 7 +forward 1 +down 2 +down 7 +forward 3 +down 8 +forward 9 +down 4 +down 1 +down 7 +down 4 +up 5 +forward 1 +down 4 +forward 1 +forward 8 +up 1 +up 5 +up 2 +up 2 +down 4 +down 7 +forward 2 +down 8 +up 8 +down 9 +down 3 +down 6 +down 3 +down 1 +forward 7 +up 8 +forward 5 +up 5 +down 8 +down 1 +down 8 +down 6 +down 5 +forward 2 +up 5 +down 6 +forward 9 +up 6 +down 5 +down 7 +up 9 +down 1 +forward 4 +up 6 +forward 2 +down 5 +down 5 +forward 2 +up 6 +forward 1 +down 8 +forward 4 +up 8 +down 3 +forward 8 +down 8 +forward 5 +down 6 +down 3 +forward 1 +down 4 +down 8 +up 1 +down 1 +down 2 +up 9 +forward 2 +forward 3 +down 7 +down 2 +forward 7 +up 8 +down 2 +down 8 +down 9 +up 1 +down 5 +down 5 +down 4 +down 8 +down 9 +up 5 +forward 2 +down 4 +down 3 +down 2 +forward 5 +forward 8 +down 8 +down 1 +forward 9 +down 5 +forward 5 +down 2 +up 3 +up 9 +down 1 +down 9 +forward 7 +up 7 +forward 3 +up 6 +forward 8 +down 2 +down 1 +down 7 +forward 5 +down 8 +down 4 +forward 7 +forward 4 +down 6 +forward 9 +down 3 +forward 2 +down 3 +down 1 +down 1 +up 1 +up 3 +down 6 +forward 3 +up 9 +down 4 +up 2 +down 3 +up 1 +down 8 +down 5 +forward 7 +forward 2 +forward 9 +down 8 +down 5 +down 6 +up 3 +forward 2 +up 8 +down 4 +forward 7 +down 8 +down 6 +down 4 +forward 7 +up 9 +down 4 +forward 2 +forward 5 +down 3 +up 6 +up 6 +down 2 +down 4 +forward 8 +forward 5 +forward 3 +forward 5 +down 5 +down 5 +down 6 +forward 3 +forward 7 +forward 1 +down 8 +down 5 +forward 7 +up 7 +down 9 +down 9 +down 9 +up 6 +down 2 +down 3 +forward 1 +up 7 +up 8 +forward 5 +down 1 +down 3 +down 3 +forward 5 +down 7 +down 1 +up 2 +down 2 +down 3 +forward 7 +down 9 +forward 6 +down 5 +forward 2 +down 5 +forward 6 +up 3 +down 8 +up 2 +forward 5 +forward 1 +forward 5 +forward 8 +forward 6 +forward 9 +forward 6 +up 6 +up 5 +down 8 +down 3 +down 5 +down 2 +forward 9 +forward 8 +down 1 +up 1 +up 6 +down 6 +forward 4 +down 3 +forward 6 +forward 1 +up 5 +down 6 +up 9 +down 7 +down 2 +down 9 +down 5 +forward 5 +up 2 +forward 8 +down 2 +down 8 +forward 6 +down 4 +forward 8 +down 7 +down 8 +down 1 +forward 3 +down 6 +down 9 +down 3 +forward 3 +down 8 +forward 8 +down 7 +forward 6 +forward 8 +down 8 +up 7 +down 1 +forward 2 +forward 3 +down 5 +up 8 +down 3 +down 4 +down 7 +forward 9 +forward 7 +forward 1 +down 3 +forward 9 +down 8 +forward 2 +down 2 +down 9 +down 4 +down 3 +up 6 +up 9 +down 3 +down 2 +forward 5 +down 3 +down 2 +down 8 +forward 6 +forward 5 +up 4 +forward 9 +forward 8 +forward 9 +down 2 +forward 2 +up 6 +forward 1 +down 5 +forward 2 +down 8 +up 2 +up 3 +down 3 +up 2 +up 1 +up 5 +forward 1 +forward 2 +down 8 +up 3 +down 9 +forward 7 +up 5 +down 4 +down 4 +up 3 +forward 2 +up 5 +down 4 +down 4 +up 5 +forward 8 +down 8 +down 6 +forward 7 +down 1 +down 3 +down 1 +forward 3 +down 5 +down 3 +forward 3 +up 2 +forward 2 +down 9 +up 8 +forward 8 +up 8 +forward 1 +forward 9 +forward 3 +down 8 +down 3 +forward 8 +forward 4 +down 2 +forward 2 +down 2 +down 5 +down 7 +down 5 +forward 8 +up 3 +forward 1 +down 1 +forward 3 +down 9 +forward 2 +forward 2 +forward 7 +down 7 +down 2 +forward 9 +up 5 +up 7 +forward 8 +forward 1 +down 7 +down 8 +down 3 +forward 6 diff --git a/2021/Day 2/rust_solution/Cargo.lock b/2021/Day 2/rust_solution/Cargo.lock new file mode 100644 index 0000000..38ad082 --- /dev/null +++ b/2021/Day 2/rust_solution/Cargo.lock @@ -0,0 +1,5 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +[[package]] +name = "rust_solution" +version = "0.1.0" diff --git a/2021/Day 2/rust_solution/Cargo.toml b/2021/Day 2/rust_solution/Cargo.toml new file mode 100644 index 0000000..811accc --- /dev/null +++ b/2021/Day 2/rust_solution/Cargo.toml @@ -0,0 +1,9 @@ +[package] +name = "rust_solution" +version = "0.1.0" +authors = ["Teo-CD"] +edition = "2018" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/2021/Day 2/rust_solution/src/main.rs b/2021/Day 2/rust_solution/src/main.rs new file mode 100644 index 0000000..f6e0eea --- /dev/null +++ b/2021/Day 2/rust_solution/src/main.rs @@ -0,0 +1,43 @@ +use std::fs; + +fn first_puzzle(input: &String) { + let mut position = [0; 2]; + for line in input.lines() { + if line.contains("forward") { + // Surely there is a better way to parse a string for an integer ? + position[0] += line.rsplit(' ').next().unwrap().parse::().unwrap(); + } else if line.contains("up") { + position[1] -= line.rsplit(' ').next().unwrap().parse::().unwrap(); + } else if line.contains("down") { + position[1] += line.rsplit(' ').next().unwrap().parse::().unwrap(); + } + } + + println!("Position : {}, {}", position[0], position[1]); + println!("Multiplied : {}", position[0] * position[1]); +} + +fn second_puzzle(input: &String) { + let mut position = [0; 3]; + for line in input.lines() { + if line.contains("forward") { + let forward_move = line.rsplit(' ').next().unwrap().parse::().unwrap(); + position[0] += forward_move; + position[1] += forward_move * position[2]; + } else if line.contains("up") { + position[2] -= line.rsplit(' ').next().unwrap().parse::().unwrap(); + } else if line.contains("down") { + position[2] += line.rsplit(' ').next().unwrap().parse::().unwrap(); + } + } + + println!("Position : {}, {}", position[0], position[1]); + println!("Multiplied : {}", position[0] * position[1]); +} + +fn main() { + let contents = fs::read_to_string("../input.txt").expect("Could not open file."); + first_puzzle(&contents); + second_puzzle(&contents); + 0; +} From 8d63db3d648e8523f6c73ae8c3a6cc4722244757 Mon Sep 17 00:00:00 2001 From: Teo-CD Date: Sat, 4 Dec 2021 20:47:11 +0000 Subject: [PATCH 27/28] 2021 Day 3 done in Rust I'm not especially proud of the code : it's messy, took a long time and could probably be vastly improved. I could have used the intersperse iterator method but it's currently in nightly only. Maybe another way of parsing the string would have prevented the need ? --- 2021/Day 3/input.txt | 1000 ++++++++++++++++++++++++++ 2021/Day 3/rust_solution/Cargo.lock | 5 + 2021/Day 3/rust_solution/Cargo.toml | 9 + 2021/Day 3/rust_solution/src/main.rs | 86 +++ 4 files changed, 1100 insertions(+) create mode 100644 2021/Day 3/input.txt create mode 100644 2021/Day 3/rust_solution/Cargo.lock create mode 100644 2021/Day 3/rust_solution/Cargo.toml create mode 100644 2021/Day 3/rust_solution/src/main.rs diff --git a/2021/Day 3/input.txt b/2021/Day 3/input.txt new file mode 100644 index 0000000..29fa12f --- /dev/null +++ b/2021/Day 3/input.txt @@ -0,0 +1,1000 @@ +011110111101 +110010010001 +111011111111 +110011010100 +111100000011 +010101001001 +010101000010 +100111101000 +110110101110 +001001101000 +101100100110 +101001100110 +101110000110 +011111111100 +110010000101 +000011111001 +101000110001 +100111011101 +011011011011 +111100000100 +010100101100 +110010000110 +101000001101 +010100110011 +111101101100 +100101000011 +101000100111 +111010010000 +011111000110 +110100101010 +011010000000 +101110100111 +010000001000 +001111001010 +001011101011 +100001110010 +001100100100 +111110011110 +000011101011 +101100111011 +000000101011 +101000000100 +001000101011 +110101000111 +011010111011 +100011101011 +110101011000 +001110110010 +100011101110 +001101011001 +000101100100 +010000101100 +100010001100 +100101001010 +011010110001 +111001110110 +111101111101 +000010011000 +110100111000 +011010000100 +000000010110 +100000001001 +110101101001 +111010100001 +101011110000 +110100101111 +010000010110 +111010110100 +011110010110 +001100001111 +001110001110 +111001110101 +010111000110 +101111001101 +010011010011 +000001110101 +101100010001 +111101110011 +101000010101 +100110011001 +010101011101 +111111101110 +010011010010 +110000101111 +100101111001 +011110100110 +111100110000 +100000111000 +011010011111 +101001101110 +110001110111 +101011001111 +010101110010 +000110001100 +101110011011 +000111111100 +001001011110 +010000100101 +110110111101 +001000011001 +011011110101 +100000001011 +010110000011 +110011001100 +110000110010 +111000110111 +110000001000 +011110101001 +001111101010 +001111000111 +100010100010 +001001010100 +001101101001 +000011000011 +101010101101 +101101011000 +000010001000 +011101110101 +000001011110 +001000101001 +000110000000 +100010111011 +001111111111 +001101110101 +001101100100 +101000011110 +010001010101 +111011010000 +000011011101 +101101001010 +010000110001 +111110011000 +110011100111 +000110111100 +010110001101 +010100010100 +101010100001 +011010111001 +010001100100 +010100111011 +010010010111 +011100011011 +101110110111 +011111101000 +101110001101 +001001100111 +101100101010 +100001010101 +100101000101 +101000000011 +110000101110 +001000111000 +011100000000 +101100111110 +000100101001 +010100111111 +000101110000 +101111100010 +110011101110 +011001000100 +111001001000 +000001111010 +100100010011 +101010101001 +010110010000 +110011110111 +101000010000 +100000101010 +110010011010 +001001001111 +001011011000 +011101100110 +100101101010 +110010111100 +110000100100 +010010001100 +010011010101 +110011000010 +101111110010 +001011010001 +001011001010 +100000001010 +000110010010 +000111101111 +110011101100 +110100110010 +100100010100 +010001100010 +001101101111 +111110110001 +111101000101 +000101101111 +000100110100 +001000111011 +011000111000 +101000011001 +110110110000 +111111111010 +000000001010 +000010101010 +001000001001 +101001100101 +001001000101 +101111110111 +101101001100 +001110111011 +101000111101 +010100000000 +110011011011 +000110100001 +100110111010 +000011100001 +010000010111 +110111011100 +111100001011 +001111011001 +000011011100 +111110011011 +010110000010 +001000010100 +011110011110 +111100001101 +110011100101 +011111110000 +100111011010 +000000111011 +111111001010 +010100111100 +000101111000 +110010011111 +110111101001 +100011000001 +111001100010 +100101000001 +010111111101 +110010110001 +001101001001 +100101101001 +011000110101 +101110011001 +101111101010 +100111010001 +011100111000 +001100000111 +001110011110 +010010000101 +010010110001 +111010001101 +000010110001 +010110101110 +011111111000 +100000101001 +111101011101 +000001010100 +000011001011 +110000011100 +000011001110 +110101010110 +011000110011 +000111111000 +100000110000 +001010101010 +001001101001 +011101011011 +100011110000 +111011011000 +111101110100 +000001010110 +100011110100 +101101000010 +000011011011 +101011110110 +100001101011 +010111100000 +000011000010 +000111001111 +011001100100 +110110010010 +000011110111 +101001001011 +010110110101 +001100000110 +000111101110 +110011010011 +101001010010 +010011110100 +110101011010 +101100101011 +101110010110 +010000000011 +010001101001 +101010011110 +010101100001 +100100000110 +000010010111 +101100101110 +000111000001 +110100111111 +010011100000 +011101110000 +011111011110 +101011011110 +100011110010 +001100011100 +011010010111 +101010011001 +110100100110 +001011100111 +001001101110 +010001001000 +101111100100 +101011010001 +100101100001 +010000101001 +000100000011 +101011101000 +000001100101 +110001101111 +001110000111 +010010000110 +101001101101 +100110011000 +100110000110 +000000110010 +000111100001 +001000101110 +110000000111 +110011101111 +101110010010 +110010001110 +101111011010 +000001000000 +110010100111 +100111010111 +001100101111 +001110111001 +111100011100 +011000010100 +100101101101 +100001001110 +111110100011 +101111001000 +010111000100 +110001110010 +001110101111 +101000000111 +010001010111 +000000000111 +010001111100 +011100000110 +010100010000 +101000010001 +101110000100 +111111110001 +110000001101 +111001111111 +000100011111 +111001101000 +001011111111 +110100001011 +111011000001 +001111101101 +101011110100 +101010110010 +101111110011 +011100100100 +001101011110 +000100001011 +100001011101 +101000010110 +001011110111 +110101000101 +011011011110 +001010000001 +000111000010 +100101001001 +000001110010 +110100010011 +111100101101 +100111011001 +000110101111 +101010000100 +011101011000 +001110000010 +001000111101 +110000011000 +010010010110 +100101011000 +000010010100 +110001101010 +101010000110 +111111010010 +001111001000 +110100101001 +010001000001 +001111110010 +110001011011 +111100000001 +011011110111 +111001001111 +110010000100 +100101111011 +001000111001 +111010001010 +101100100100 +101000111110 +000100101110 +111000101001 +001001010110 +100100101101 +111111011100 +111001110011 +011111001100 +101010101100 +000011010001 +110111001110 +010100000111 +110011100000 +101001000010 +000111101001 +010100011111 +011101001001 +100110010010 +100110101010 +010001110010 +011101000101 +001111100010 +011010111111 +110110001110 +010010010000 +101100110011 +111111011101 +000011000101 +100000111100 +111101010011 +100111010011 +110010011011 +000011111100 +011110011000 +101100000101 +111110000011 +100100001011 +000010011001 +111000011101 +111000110101 +110010100010 +101001010100 +010001110011 +001101001011 +010000101111 +111011100000 +000110000111 +000011100000 +000101011101 +000101100001 +011100100000 +011100001011 +011110111011 +111110010010 +111000010110 +000110001110 +111100011001 +010110000110 +000001010111 +100001111001 +100111100001 +011000111011 +111111101001 +001000000001 +001101100011 +111101010100 +001101110001 +110100111011 +000111011010 +000111110100 +010100000011 +010001110101 +101100000011 +110011111000 +010010101001 +101111011100 +101101101101 +111110000100 +001011000000 +010100001110 +001001011011 +011000011101 +110111110101 +101010010111 +110101000010 +111111000000 +101010101110 +101100110101 +100110001011 +011010110010 +000010110010 +000101001001 +000011110011 +101010111111 +011000101101 +111001100101 +000110101001 +110100000001 +110010000001 +111011011110 +101110110101 +000001111001 +100100011011 +011111111001 +100111101110 +101010010011 +000010110000 +011110111010 +000011110100 +101010010001 +110000011001 +100100110010 +100110100110 +110000110001 +100111010100 +000111011100 +110001000100 +011000010010 +101111111110 +011100011100 +000001001110 +111101101000 +110011001011 +010001000110 +000111000000 +000001001001 +100100011100 +101111011101 +000111001001 +010001011111 +001100100101 +011101000100 +011001110101 +100111100110 +010110000100 +111011100011 +110000011010 +011000101111 +100010100011 +111101001111 +000111010110 +011001110000 +101101011011 +010011000111 +110001101100 +000100001110 +110101111000 +111100001110 +100101011110 +111011101110 +110010101111 +110111101101 +110100011001 +000111111111 +011001101110 +001100010000 +110011110000 +011010110101 +011110111100 +100001110000 +110101101110 +000010001100 +011001101100 +100000110110 +100111110111 +101110001100 +010101000011 +110001110001 +011001011001 +011001111001 +111010011001 +110011011010 +001011011110 +111000000100 +101110111001 +110000111010 +101010110101 +110001011111 +011001011111 +101110010101 +010110110111 +010101100101 +010111111000 +010000011101 +100111010000 +100001111101 +001101111010 +001000000011 +010110111011 +010001110111 +000011001000 +110001111010 +111101001001 +110000000100 +111100001000 +111010000110 +000100011110 +110101101011 +001011110100 +011101011001 +110101010100 +110010011001 +100101001111 +100110110100 +000101001101 +001011101110 +101000001010 +001100101010 +100010011011 +100011100001 +000101011111 +111001100110 +101110101011 +111101111100 +001000001010 +001100010100 +111010100111 +000101110001 +001010100001 +001111110110 +110110101000 +110110000110 +011110111110 +100111110001 +011000001110 +110101010011 +010110001110 +111110010001 +100101111000 +001111100101 +110011001010 +111101010010 +111111000011 +001100101011 +100001101100 +100001110110 +110000000001 +000101001011 +111111110111 +000100010000 +101010110011 +111001101011 +010111100010 +001000011011 +010010110011 +001010111101 +010011011011 +011110000001 +010101011111 +001011101100 +010000010000 +111001100111 +111001010011 +111000111010 +001100011110 +010111011101 +010110000111 +010101100010 +011110011100 +100101000111 +011010000111 +000101010111 +100101001100 +011010110011 +011000011110 +010011110101 +111000101111 +111010101111 +101111010110 +100100101000 +101011111100 +100001001000 +000100010101 +001001100000 +110100100001 +100011110001 +101110110110 +110011000100 +011001000101 +111001110111 +111011010110 +101110110010 +100110111001 +110101011011 +110110000011 +000111101101 +100011010010 +111000100101 +010001100000 +010011111001 +010101010101 +110011110101 +100000100110 +110010101000 +000100110101 +010010110111 +111000001001 +001011111011 +010000111001 +111011001110 +011101110110 +010001111001 +111001111110 +101010101111 +101111111101 +110011101010 +010011000110 +101001111010 +101110000101 +000010000110 +111110000111 +001010111011 +010110011111 +001011101101 +011101011110 +000010000010 +101011010011 +011100011000 +111000100011 +011111011111 +110000001010 +000100000100 +101010111101 +110000111000 +001100110000 +111111011010 +110100110000 +000000000000 +101001000000 +110010110101 +011011001100 +101101101110 +010110100011 +101111000000 +111011100101 +110100100010 +010111000001 +110110011000 +011101111110 +000010110110 +111000000011 +001101110010 +100000110011 +000110000011 +100111110000 +011110110011 +111010101010 +010010001011 +101111000110 +001010000011 +101111010000 +011000111001 +001001111101 +010100011001 +000000010011 +001111001001 +011000010000 +011001111111 +100010101001 +010000100011 +111111101101 +011011001000 +011001010011 +111011011001 +010001110110 +110010110000 +000000000011 +110110000000 +011101001101 +011010000101 +101011100110 +001101010010 +100000000100 +100100010001 +100110011111 +111100001010 +001100011111 +000100000110 +011011010010 +011010001100 +011111101011 +011010101001 +110111000110 +110000110110 +011110110000 +010011011101 +010011100100 +000110111001 +111011111001 +101111010010 +011000111100 +101111111010 +110011000001 +000100011000 +110101110100 +011001101010 +100011011101 +001011110011 +110010111110 +000110001101 +111011101001 +100110100001 +101011011010 +001000101010 +101011100111 +110110000001 +100100000010 +101100010011 +111001010101 +011100000101 +100010111100 +010110100010 +100100110001 +100111001001 +011101010010 +101101111000 +111100100111 +111011001000 +100111011111 +111001100001 +010001111011 +011110100100 +111111010101 +101011111110 +110101101100 +000100101111 +011110001000 +101101001110 +001111111010 +110011100110 +110110011100 +111111100000 +000000010001 +100100001101 +101000101110 +100001011010 +100011000100 +110011110110 +000000110100 +010110001010 +101000110000 +110110001001 +000001000101 +011111100111 +000011110101 +101111010101 +010101001111 +110111001111 +101001110010 +011001010111 +101000101010 +100100000111 +100011001011 +110010000000 +001000110001 +100010001101 +010001000010 +101101111111 +111001001011 +101001011100 +000100111100 +110000000101 +101010011101 +000101000111 +111000101100 +001100000100 +010010100101 +011010100010 +111000100110 +001001111010 +101001001111 +011000100011 +011000001100 +011110101111 +111011111110 +101001001010 +010000001111 +000000000101 +000111001010 +100001000111 +111101010001 +010011001111 +001110010000 +101101001001 +000110110111 +001101011011 +111100100010 +101010001000 +001001101100 +011110001101 +000101000011 +111101100111 +100110000010 +111010100101 +011010011110 +000000101000 +001011001000 +001001011010 +011100000100 +000011010101 +111110011100 +001101110110 +100011101111 +011001110010 +011100100111 +010101001100 +000101010000 +101001101001 +100101110111 +101101100110 +000101100010 +111011000011 +010010010011 +000111111110 +010101100011 +000001010010 +111100110010 +101011001010 +010110011110 +011001101111 +011100001010 +001111001100 +000110100011 +101011101010 +011111111110 +100011011011 +101010011111 +010001110001 +100010101101 +010101010011 +100001010001 +111010011000 +011110100010 +001111000101 +111101101010 +011110100000 +111110001101 +110010010100 +000001010011 +000100101100 +111000111111 +011111000011 +010000011001 +000110001011 +111100101110 +001000110101 +001011111100 +001111010001 +101000100101 +000101001100 +000110101010 +010010011111 +111101001000 +101110110011 +111100100110 +101010101011 +101010101010 +100000111001 +000101000001 +100010010101 +011000101000 +100100001111 +110111100011 +101100000000 +001011110001 +110011001111 +000001000011 +001100111011 +101100010000 +001111000001 +111100000101 +101010111011 +011111110010 +011111010001 +101011010100 +000111111011 +110000100110 +110111110000 +100101101110 +001011000001 +101100001101 +011100010010 +000110100110 +010101110111 +111100101011 +101101001101 +011011111110 +011100011001 +110010011100 +000001011100 +101110100110 +010001011100 +011111001010 +100111100101 +111111000010 diff --git a/2021/Day 3/rust_solution/Cargo.lock b/2021/Day 3/rust_solution/Cargo.lock new file mode 100644 index 0000000..38ad082 --- /dev/null +++ b/2021/Day 3/rust_solution/Cargo.lock @@ -0,0 +1,5 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +[[package]] +name = "rust_solution" +version = "0.1.0" diff --git a/2021/Day 3/rust_solution/Cargo.toml b/2021/Day 3/rust_solution/Cargo.toml new file mode 100644 index 0000000..b9efffa --- /dev/null +++ b/2021/Day 3/rust_solution/Cargo.toml @@ -0,0 +1,9 @@ +[package] +name = "rust_solution" +version = "0.1.0" +authors = ["Teo-CD "] +edition = "2018" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/2021/Day 3/rust_solution/src/main.rs b/2021/Day 3/rust_solution/src/main.rs new file mode 100644 index 0000000..1145225 --- /dev/null +++ b/2021/Day 3/rust_solution/src/main.rs @@ -0,0 +1,86 @@ +use std::fs; + +/// Count number of ones in each bit position. If the count is less than half of the total number +/// of entries, then 0 is more common. +fn find_most_common_bits(input: &String) -> Vec { + let width = input.lines().nth(0).unwrap().len(); + let mut bit_counts: Vec = std::vec::from_elem(0, width); + for value in input.lines() { + let mut chars = value.chars(); + for index in 0..width { + bit_counts[index] += if chars.next().unwrap() == '1' { 1 } else { 0 }; + } + } + bit_counts +} + +/// Loop while finding the most/least common bit for the current position until we find +/// a single number in the list. +fn reduce_by_count(input: &String, most_common: bool) -> String { + let mut count = input.lines().count(); + let mut bit_index = 0; + let mut filtered_input = input.clone(); + while count > 1 { + let most_common_bit = if find_most_common_bits(&filtered_input)[bit_index] + >= filtered_input.lines().count() as i16 / 2 + { + if most_common { + '1' + } else { + '0' + } + } else { + if most_common { + '0' + } else { + '1' + } + }; + // Filter out the numbers which don't match the current most/least common bit. + filtered_input = filtered_input + .lines() + .filter(|line: &&str| line.chars().nth(bit_index).unwrap() == most_common_bit) + .map(|line| line.to_owned() + '\n'.to_string().as_str()) // Add the line separator back + .collect(); + count = filtered_input.lines().count(); + bit_index += 1; + } + + String::from(filtered_input.lines().next().unwrap()) +} + +fn main() { + let contents = fs::read_to_string("../input.txt").expect("Could not open file."); + let bit_counts = find_most_common_bits(&contents); + + // Compute power consumption + let mut gamma: u32 = 0; + let mut epsilon: u32 = 0; + for count in bit_counts { + gamma <<= 1; + epsilon <<= 1; + gamma |= if count > contents.lines().count() as i16 / 2 { + 1 + } else { + 0 + }; + epsilon |= if count > contents.lines().count() as i16 / 2 { + 0 + } else { + 1 + } + } + + println!( + "Submarine power consumption : {}", + gamma as u64 * epsilon as u64 + ); + + // Compute oxygen generator rating and CO2 scrubber rating. + // from_str_radix converts from a string of the binary representation to an integer. + let ox_gen = isize::from_str_radix(reduce_by_count(&contents, true).as_str(), 2).unwrap(); + let co2_scrub = isize::from_str_radix(reduce_by_count(&contents, false).as_str(), 2).unwrap(); + println!("Oxygen generator rating : {}", ox_gen); + println!("CO2 scrubber rating : {}", co2_scrub); + println!("Life support rating : {}", ox_gen * co2_scrub); +} From 394a8bfc3c3c409fea0e0e8c8d4a46f8a4bce640 Mon Sep 17 00:00:00 2001 From: trotFunky Date: Sat, 4 Dec 2021 20:47:15 +0000 Subject: [PATCH 28/28] 2021 Day 3 done in Rust I'm not especially proud of the code : it's messy, took a long time and could probably be vastly improved. I could have used the intersperse iterator method but it's currently in nightly only. Maybe another way of parsing the string would have prevented the need ? --- 2021/Day 3/input.txt | 1000 ++++++++++++++++++++++++++ 2021/Day 3/rust_solution/Cargo.lock | 5 + 2021/Day 3/rust_solution/Cargo.toml | 9 + 2021/Day 3/rust_solution/src/main.rs | 86 +++ 4 files changed, 1100 insertions(+) create mode 100644 2021/Day 3/input.txt create mode 100644 2021/Day 3/rust_solution/Cargo.lock create mode 100644 2021/Day 3/rust_solution/Cargo.toml create mode 100644 2021/Day 3/rust_solution/src/main.rs diff --git a/2021/Day 3/input.txt b/2021/Day 3/input.txt new file mode 100644 index 0000000..29fa12f --- /dev/null +++ b/2021/Day 3/input.txt @@ -0,0 +1,1000 @@ +011110111101 +110010010001 +111011111111 +110011010100 +111100000011 +010101001001 +010101000010 +100111101000 +110110101110 +001001101000 +101100100110 +101001100110 +101110000110 +011111111100 +110010000101 +000011111001 +101000110001 +100111011101 +011011011011 +111100000100 +010100101100 +110010000110 +101000001101 +010100110011 +111101101100 +100101000011 +101000100111 +111010010000 +011111000110 +110100101010 +011010000000 +101110100111 +010000001000 +001111001010 +001011101011 +100001110010 +001100100100 +111110011110 +000011101011 +101100111011 +000000101011 +101000000100 +001000101011 +110101000111 +011010111011 +100011101011 +110101011000 +001110110010 +100011101110 +001101011001 +000101100100 +010000101100 +100010001100 +100101001010 +011010110001 +111001110110 +111101111101 +000010011000 +110100111000 +011010000100 +000000010110 +100000001001 +110101101001 +111010100001 +101011110000 +110100101111 +010000010110 +111010110100 +011110010110 +001100001111 +001110001110 +111001110101 +010111000110 +101111001101 +010011010011 +000001110101 +101100010001 +111101110011 +101000010101 +100110011001 +010101011101 +111111101110 +010011010010 +110000101111 +100101111001 +011110100110 +111100110000 +100000111000 +011010011111 +101001101110 +110001110111 +101011001111 +010101110010 +000110001100 +101110011011 +000111111100 +001001011110 +010000100101 +110110111101 +001000011001 +011011110101 +100000001011 +010110000011 +110011001100 +110000110010 +111000110111 +110000001000 +011110101001 +001111101010 +001111000111 +100010100010 +001001010100 +001101101001 +000011000011 +101010101101 +101101011000 +000010001000 +011101110101 +000001011110 +001000101001 +000110000000 +100010111011 +001111111111 +001101110101 +001101100100 +101000011110 +010001010101 +111011010000 +000011011101 +101101001010 +010000110001 +111110011000 +110011100111 +000110111100 +010110001101 +010100010100 +101010100001 +011010111001 +010001100100 +010100111011 +010010010111 +011100011011 +101110110111 +011111101000 +101110001101 +001001100111 +101100101010 +100001010101 +100101000101 +101000000011 +110000101110 +001000111000 +011100000000 +101100111110 +000100101001 +010100111111 +000101110000 +101111100010 +110011101110 +011001000100 +111001001000 +000001111010 +100100010011 +101010101001 +010110010000 +110011110111 +101000010000 +100000101010 +110010011010 +001001001111 +001011011000 +011101100110 +100101101010 +110010111100 +110000100100 +010010001100 +010011010101 +110011000010 +101111110010 +001011010001 +001011001010 +100000001010 +000110010010 +000111101111 +110011101100 +110100110010 +100100010100 +010001100010 +001101101111 +111110110001 +111101000101 +000101101111 +000100110100 +001000111011 +011000111000 +101000011001 +110110110000 +111111111010 +000000001010 +000010101010 +001000001001 +101001100101 +001001000101 +101111110111 +101101001100 +001110111011 +101000111101 +010100000000 +110011011011 +000110100001 +100110111010 +000011100001 +010000010111 +110111011100 +111100001011 +001111011001 +000011011100 +111110011011 +010110000010 +001000010100 +011110011110 +111100001101 +110011100101 +011111110000 +100111011010 +000000111011 +111111001010 +010100111100 +000101111000 +110010011111 +110111101001 +100011000001 +111001100010 +100101000001 +010111111101 +110010110001 +001101001001 +100101101001 +011000110101 +101110011001 +101111101010 +100111010001 +011100111000 +001100000111 +001110011110 +010010000101 +010010110001 +111010001101 +000010110001 +010110101110 +011111111000 +100000101001 +111101011101 +000001010100 +000011001011 +110000011100 +000011001110 +110101010110 +011000110011 +000111111000 +100000110000 +001010101010 +001001101001 +011101011011 +100011110000 +111011011000 +111101110100 +000001010110 +100011110100 +101101000010 +000011011011 +101011110110 +100001101011 +010111100000 +000011000010 +000111001111 +011001100100 +110110010010 +000011110111 +101001001011 +010110110101 +001100000110 +000111101110 +110011010011 +101001010010 +010011110100 +110101011010 +101100101011 +101110010110 +010000000011 +010001101001 +101010011110 +010101100001 +100100000110 +000010010111 +101100101110 +000111000001 +110100111111 +010011100000 +011101110000 +011111011110 +101011011110 +100011110010 +001100011100 +011010010111 +101010011001 +110100100110 +001011100111 +001001101110 +010001001000 +101111100100 +101011010001 +100101100001 +010000101001 +000100000011 +101011101000 +000001100101 +110001101111 +001110000111 +010010000110 +101001101101 +100110011000 +100110000110 +000000110010 +000111100001 +001000101110 +110000000111 +110011101111 +101110010010 +110010001110 +101111011010 +000001000000 +110010100111 +100111010111 +001100101111 +001110111001 +111100011100 +011000010100 +100101101101 +100001001110 +111110100011 +101111001000 +010111000100 +110001110010 +001110101111 +101000000111 +010001010111 +000000000111 +010001111100 +011100000110 +010100010000 +101000010001 +101110000100 +111111110001 +110000001101 +111001111111 +000100011111 +111001101000 +001011111111 +110100001011 +111011000001 +001111101101 +101011110100 +101010110010 +101111110011 +011100100100 +001101011110 +000100001011 +100001011101 +101000010110 +001011110111 +110101000101 +011011011110 +001010000001 +000111000010 +100101001001 +000001110010 +110100010011 +111100101101 +100111011001 +000110101111 +101010000100 +011101011000 +001110000010 +001000111101 +110000011000 +010010010110 +100101011000 +000010010100 +110001101010 +101010000110 +111111010010 +001111001000 +110100101001 +010001000001 +001111110010 +110001011011 +111100000001 +011011110111 +111001001111 +110010000100 +100101111011 +001000111001 +111010001010 +101100100100 +101000111110 +000100101110 +111000101001 +001001010110 +100100101101 +111111011100 +111001110011 +011111001100 +101010101100 +000011010001 +110111001110 +010100000111 +110011100000 +101001000010 +000111101001 +010100011111 +011101001001 +100110010010 +100110101010 +010001110010 +011101000101 +001111100010 +011010111111 +110110001110 +010010010000 +101100110011 +111111011101 +000011000101 +100000111100 +111101010011 +100111010011 +110010011011 +000011111100 +011110011000 +101100000101 +111110000011 +100100001011 +000010011001 +111000011101 +111000110101 +110010100010 +101001010100 +010001110011 +001101001011 +010000101111 +111011100000 +000110000111 +000011100000 +000101011101 +000101100001 +011100100000 +011100001011 +011110111011 +111110010010 +111000010110 +000110001110 +111100011001 +010110000110 +000001010111 +100001111001 +100111100001 +011000111011 +111111101001 +001000000001 +001101100011 +111101010100 +001101110001 +110100111011 +000111011010 +000111110100 +010100000011 +010001110101 +101100000011 +110011111000 +010010101001 +101111011100 +101101101101 +111110000100 +001011000000 +010100001110 +001001011011 +011000011101 +110111110101 +101010010111 +110101000010 +111111000000 +101010101110 +101100110101 +100110001011 +011010110010 +000010110010 +000101001001 +000011110011 +101010111111 +011000101101 +111001100101 +000110101001 +110100000001 +110010000001 +111011011110 +101110110101 +000001111001 +100100011011 +011111111001 +100111101110 +101010010011 +000010110000 +011110111010 +000011110100 +101010010001 +110000011001 +100100110010 +100110100110 +110000110001 +100111010100 +000111011100 +110001000100 +011000010010 +101111111110 +011100011100 +000001001110 +111101101000 +110011001011 +010001000110 +000111000000 +000001001001 +100100011100 +101111011101 +000111001001 +010001011111 +001100100101 +011101000100 +011001110101 +100111100110 +010110000100 +111011100011 +110000011010 +011000101111 +100010100011 +111101001111 +000111010110 +011001110000 +101101011011 +010011000111 +110001101100 +000100001110 +110101111000 +111100001110 +100101011110 +111011101110 +110010101111 +110111101101 +110100011001 +000111111111 +011001101110 +001100010000 +110011110000 +011010110101 +011110111100 +100001110000 +110101101110 +000010001100 +011001101100 +100000110110 +100111110111 +101110001100 +010101000011 +110001110001 +011001011001 +011001111001 +111010011001 +110011011010 +001011011110 +111000000100 +101110111001 +110000111010 +101010110101 +110001011111 +011001011111 +101110010101 +010110110111 +010101100101 +010111111000 +010000011101 +100111010000 +100001111101 +001101111010 +001000000011 +010110111011 +010001110111 +000011001000 +110001111010 +111101001001 +110000000100 +111100001000 +111010000110 +000100011110 +110101101011 +001011110100 +011101011001 +110101010100 +110010011001 +100101001111 +100110110100 +000101001101 +001011101110 +101000001010 +001100101010 +100010011011 +100011100001 +000101011111 +111001100110 +101110101011 +111101111100 +001000001010 +001100010100 +111010100111 +000101110001 +001010100001 +001111110110 +110110101000 +110110000110 +011110111110 +100111110001 +011000001110 +110101010011 +010110001110 +111110010001 +100101111000 +001111100101 +110011001010 +111101010010 +111111000011 +001100101011 +100001101100 +100001110110 +110000000001 +000101001011 +111111110111 +000100010000 +101010110011 +111001101011 +010111100010 +001000011011 +010010110011 +001010111101 +010011011011 +011110000001 +010101011111 +001011101100 +010000010000 +111001100111 +111001010011 +111000111010 +001100011110 +010111011101 +010110000111 +010101100010 +011110011100 +100101000111 +011010000111 +000101010111 +100101001100 +011010110011 +011000011110 +010011110101 +111000101111 +111010101111 +101111010110 +100100101000 +101011111100 +100001001000 +000100010101 +001001100000 +110100100001 +100011110001 +101110110110 +110011000100 +011001000101 +111001110111 +111011010110 +101110110010 +100110111001 +110101011011 +110110000011 +000111101101 +100011010010 +111000100101 +010001100000 +010011111001 +010101010101 +110011110101 +100000100110 +110010101000 +000100110101 +010010110111 +111000001001 +001011111011 +010000111001 +111011001110 +011101110110 +010001111001 +111001111110 +101010101111 +101111111101 +110011101010 +010011000110 +101001111010 +101110000101 +000010000110 +111110000111 +001010111011 +010110011111 +001011101101 +011101011110 +000010000010 +101011010011 +011100011000 +111000100011 +011111011111 +110000001010 +000100000100 +101010111101 +110000111000 +001100110000 +111111011010 +110100110000 +000000000000 +101001000000 +110010110101 +011011001100 +101101101110 +010110100011 +101111000000 +111011100101 +110100100010 +010111000001 +110110011000 +011101111110 +000010110110 +111000000011 +001101110010 +100000110011 +000110000011 +100111110000 +011110110011 +111010101010 +010010001011 +101111000110 +001010000011 +101111010000 +011000111001 +001001111101 +010100011001 +000000010011 +001111001001 +011000010000 +011001111111 +100010101001 +010000100011 +111111101101 +011011001000 +011001010011 +111011011001 +010001110110 +110010110000 +000000000011 +110110000000 +011101001101 +011010000101 +101011100110 +001101010010 +100000000100 +100100010001 +100110011111 +111100001010 +001100011111 +000100000110 +011011010010 +011010001100 +011111101011 +011010101001 +110111000110 +110000110110 +011110110000 +010011011101 +010011100100 +000110111001 +111011111001 +101111010010 +011000111100 +101111111010 +110011000001 +000100011000 +110101110100 +011001101010 +100011011101 +001011110011 +110010111110 +000110001101 +111011101001 +100110100001 +101011011010 +001000101010 +101011100111 +110110000001 +100100000010 +101100010011 +111001010101 +011100000101 +100010111100 +010110100010 +100100110001 +100111001001 +011101010010 +101101111000 +111100100111 +111011001000 +100111011111 +111001100001 +010001111011 +011110100100 +111111010101 +101011111110 +110101101100 +000100101111 +011110001000 +101101001110 +001111111010 +110011100110 +110110011100 +111111100000 +000000010001 +100100001101 +101000101110 +100001011010 +100011000100 +110011110110 +000000110100 +010110001010 +101000110000 +110110001001 +000001000101 +011111100111 +000011110101 +101111010101 +010101001111 +110111001111 +101001110010 +011001010111 +101000101010 +100100000111 +100011001011 +110010000000 +001000110001 +100010001101 +010001000010 +101101111111 +111001001011 +101001011100 +000100111100 +110000000101 +101010011101 +000101000111 +111000101100 +001100000100 +010010100101 +011010100010 +111000100110 +001001111010 +101001001111 +011000100011 +011000001100 +011110101111 +111011111110 +101001001010 +010000001111 +000000000101 +000111001010 +100001000111 +111101010001 +010011001111 +001110010000 +101101001001 +000110110111 +001101011011 +111100100010 +101010001000 +001001101100 +011110001101 +000101000011 +111101100111 +100110000010 +111010100101 +011010011110 +000000101000 +001011001000 +001001011010 +011100000100 +000011010101 +111110011100 +001101110110 +100011101111 +011001110010 +011100100111 +010101001100 +000101010000 +101001101001 +100101110111 +101101100110 +000101100010 +111011000011 +010010010011 +000111111110 +010101100011 +000001010010 +111100110010 +101011001010 +010110011110 +011001101111 +011100001010 +001111001100 +000110100011 +101011101010 +011111111110 +100011011011 +101010011111 +010001110001 +100010101101 +010101010011 +100001010001 +111010011000 +011110100010 +001111000101 +111101101010 +011110100000 +111110001101 +110010010100 +000001010011 +000100101100 +111000111111 +011111000011 +010000011001 +000110001011 +111100101110 +001000110101 +001011111100 +001111010001 +101000100101 +000101001100 +000110101010 +010010011111 +111101001000 +101110110011 +111100100110 +101010101011 +101010101010 +100000111001 +000101000001 +100010010101 +011000101000 +100100001111 +110111100011 +101100000000 +001011110001 +110011001111 +000001000011 +001100111011 +101100010000 +001111000001 +111100000101 +101010111011 +011111110010 +011111010001 +101011010100 +000111111011 +110000100110 +110111110000 +100101101110 +001011000001 +101100001101 +011100010010 +000110100110 +010101110111 +111100101011 +101101001101 +011011111110 +011100011001 +110010011100 +000001011100 +101110100110 +010001011100 +011111001010 +100111100101 +111111000010 diff --git a/2021/Day 3/rust_solution/Cargo.lock b/2021/Day 3/rust_solution/Cargo.lock new file mode 100644 index 0000000..38ad082 --- /dev/null +++ b/2021/Day 3/rust_solution/Cargo.lock @@ -0,0 +1,5 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +[[package]] +name = "rust_solution" +version = "0.1.0" diff --git a/2021/Day 3/rust_solution/Cargo.toml b/2021/Day 3/rust_solution/Cargo.toml new file mode 100644 index 0000000..b9efffa --- /dev/null +++ b/2021/Day 3/rust_solution/Cargo.toml @@ -0,0 +1,9 @@ +[package] +name = "rust_solution" +version = "0.1.0" +authors = ["Teo-CD "] +edition = "2018" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/2021/Day 3/rust_solution/src/main.rs b/2021/Day 3/rust_solution/src/main.rs new file mode 100644 index 0000000..1145225 --- /dev/null +++ b/2021/Day 3/rust_solution/src/main.rs @@ -0,0 +1,86 @@ +use std::fs; + +/// Count number of ones in each bit position. If the count is less than half of the total number +/// of entries, then 0 is more common. +fn find_most_common_bits(input: &String) -> Vec { + let width = input.lines().nth(0).unwrap().len(); + let mut bit_counts: Vec = std::vec::from_elem(0, width); + for value in input.lines() { + let mut chars = value.chars(); + for index in 0..width { + bit_counts[index] += if chars.next().unwrap() == '1' { 1 } else { 0 }; + } + } + bit_counts +} + +/// Loop while finding the most/least common bit for the current position until we find +/// a single number in the list. +fn reduce_by_count(input: &String, most_common: bool) -> String { + let mut count = input.lines().count(); + let mut bit_index = 0; + let mut filtered_input = input.clone(); + while count > 1 { + let most_common_bit = if find_most_common_bits(&filtered_input)[bit_index] + >= filtered_input.lines().count() as i16 / 2 + { + if most_common { + '1' + } else { + '0' + } + } else { + if most_common { + '0' + } else { + '1' + } + }; + // Filter out the numbers which don't match the current most/least common bit. + filtered_input = filtered_input + .lines() + .filter(|line: &&str| line.chars().nth(bit_index).unwrap() == most_common_bit) + .map(|line| line.to_owned() + '\n'.to_string().as_str()) // Add the line separator back + .collect(); + count = filtered_input.lines().count(); + bit_index += 1; + } + + String::from(filtered_input.lines().next().unwrap()) +} + +fn main() { + let contents = fs::read_to_string("../input.txt").expect("Could not open file."); + let bit_counts = find_most_common_bits(&contents); + + // Compute power consumption + let mut gamma: u32 = 0; + let mut epsilon: u32 = 0; + for count in bit_counts { + gamma <<= 1; + epsilon <<= 1; + gamma |= if count > contents.lines().count() as i16 / 2 { + 1 + } else { + 0 + }; + epsilon |= if count > contents.lines().count() as i16 / 2 { + 0 + } else { + 1 + } + } + + println!( + "Submarine power consumption : {}", + gamma as u64 * epsilon as u64 + ); + + // Compute oxygen generator rating and CO2 scrubber rating. + // from_str_radix converts from a string of the binary representation to an integer. + let ox_gen = isize::from_str_radix(reduce_by_count(&contents, true).as_str(), 2).unwrap(); + let co2_scrub = isize::from_str_radix(reduce_by_count(&contents, false).as_str(), 2).unwrap(); + println!("Oxygen generator rating : {}", ox_gen); + println!("CO2 scrubber rating : {}", co2_scrub); + println!("Life support rating : {}", ox_gen * co2_scrub); +}