From f3e12ea38799f4331537247a05132b915abc86ba Mon Sep 17 00:00:00 2001 From: tristan Date: Sun, 6 Dec 2020 14:25:47 +0000 Subject: [PATCH] 2020 day 5 and 6 --- 2020/05/part1.js | 39 + 2020/05/part2.js | 39 + 2020/06/input.txt | 2093 +++++++++++++++++++++++++++++++++++++++++++++ 2020/06/part1.js | 21 + 2020/06/part2.js | 21 + README.md | 2 + 6 files changed, 2215 insertions(+) create mode 100644 2020/05/part1.js create mode 100644 2020/05/part2.js create mode 100644 2020/06/input.txt create mode 100644 2020/06/part1.js create mode 100644 2020/06/part2.js diff --git a/2020/05/part1.js b/2020/05/part1.js new file mode 100644 index 0000000..086ea5a --- /dev/null +++ b/2020/05/part1.js @@ -0,0 +1,39 @@ +const fs = require('fs'); + +const data = fs.readFileSync('input.txt', 'utf-8'); +const lines = data.split('\n'); + +let max = 0 +// who really needs semicolons anyway +for (let i = 0; i < lines.length; i++) { + let line = lines[i] + let rowCode = line.substring(0, 7).replace(/F/g, "0").replace(/B/g, "1") + let colCode = line.substring(7).replace(/L/g, "0").replace(/R/g, "1") + + // another excuse to flex that recursive muscle + function getIndexFromBSP (BSP, min, max) { + if (BSP.length != 1) { + [min, max] = getIndexFromBSP (BSP.substring(0, BSP.length-1), min, max) + } + + switch (BSP[BSP.length-1]) { + case '0': + max = Math.floor((min + max) / 2) + break + case '1': + min = Math.ceil((min + max) / 2) + break + default: + console.log("something went wrong") + } + + return [min, max] + } + let row = getIndexFromBSP(rowCode, 0, 127)[0] + let col = getIndexFromBSP(colCode, 0, 7)[0] + + let seatID = (row * 8) + col + + max = seatID > max ? seatID : max +} +console.log(max) \ No newline at end of file diff --git a/2020/05/part2.js b/2020/05/part2.js new file mode 100644 index 0000000..605b8f6 --- /dev/null +++ b/2020/05/part2.js @@ -0,0 +1,39 @@ +const fs = require('fs'); + +const data = fs.readFileSync('input.txt', 'utf-8'); +const lines = data.split('\n'); + +let seats = [] +// who really needs semicolons anyway +for (let i = 0; i < lines.length; i++) { + let line = lines[i] + let rowCode = line.substring(0, 7).replace(/F/g, "0").replace(/B/g, "1") + let colCode = line.substring(7).replace(/L/g, "0").replace(/R/g, "1") + + // another excuse to flex that recursive muscle + function getIndexFromBSP (BSP, min, max) { + if (BSP.length != 1) { + [min, max] = getIndexFromBSP (BSP.substring(0, BSP.length-1), min, max) + } + + switch (BSP[BSP.length-1]) { + case '0': + max = Math.floor((min + max) / 2) + break + case '1': + min = Math.ceil((min + max) / 2) + break + default: + console.log("something went wrong") + } + + return [min, max] + } + let row = getIndexFromBSP(rowCode, 0, 127)[0] + let col = getIndexFromBSP(colCode, 0, 7)[0] + + seats [row] = seats[row] || [] + seats [row] [col] = (row*8)+col +} +// i just scrolled thru and found the one empty seat +console.log(seats.filter(row => row.length>7)) \ No newline at end of file diff --git a/2020/06/input.txt b/2020/06/input.txt new file mode 100644 index 0000000..962a618 --- /dev/null +++ b/2020/06/input.txt @@ -0,0 +1,2093 @@ +lqhksfnerg +negsc +snage +engs +sneg + +ctfzrdbsapql +srldfatzqcpb +qsntlprfdbza +ldptswouqbxzafr + +ncjolhqfbp +gphonqbflxj +jepdmfhsqtonz +cqpihonjbgf + +abytu +ayu +ayu +uhodlay +uay + +kzx +xjwk +kxfhsdc +xjk +jkx + +rwxckmfn +xpcrkft + +ntaf +lacuserbk + +sxwdfmnpl +xpsmnwlfd +lpxmwsndf +xfdmlwnps +pwlnmdsxf + +gjvcfamuty +uqfmjgzatpvyc +yfcjtavghm +amqfjkpgvyct +svgcenmylotjafbx + +yepqgs +nsfqwghce +segvq + +mi +l + +eirgvuadbphcfsmyqnzotxjlk +qjeintsxubmfchoavpyzglrkd +fdjeyhbxgqclsnaimoptkvruz +iexuntjgmvfhqykspzbdclrao +hkjgpqlyaxdtcnvobmrzifuse + +i +nl +on +zbp + +aqpjnkeowivfbdhgr +pgiojefhvrqdawknc + +ugmsibf +msbigfu +csgfimubj +mfisbgyu +nsmvuigfbe + +demjnxcwbsri +aypesftqhzluko + +ecoxhl +lochex +chelox +xhcoel +cholxe + +xntubrdemhylsoi +gfjihrutbaewzpoxlys + +iuqkewnyv +uyptkn +nyupsk + +e +f + +bxrsntkjdwivceapq +cqbakpimsvetnjxwrd +knvxqwpasurcodietbj +xvrqbdjiwsacykpent +npsavtbqxijkewrczld + +pk +qpwsk +zpk + +qdchnb +qwxbcdhyir +jhbdcq +hnecdbq + +tdryep +th +vxg +bre +e + +f +d +d + +rspjhlqocixnw +xicoqjpnlwsh +lxinqphjoscw +jhlowspincxq + +qptb +btpq +guqhbtpd + +nzloqtcxmfgdbj +tcfdnbmzgqlxo +bqkgnxazecltidsoymf +wtzmxcpflbongdhvq +zfroctngqdbmxl + +kcyhtoendvzwafbmuj +eltymcnhaowbkdzvuf +sfkmvobdnteuychzaw + +wetrpdnqab +qrpkenabgwtdl +nahwtbrpdsef + +hqbtefp +xslnrykmvau +zghcqtojidw + +gqsyhx +vcent + +pazioqhkbd +qnopbmrahdyk +dxbmkhaqotp +vkhaofqcdp +kqpzhaod + +ytljngqdmxfck +tcjmkfnqlgydx +mfctkldxqpjuynvg +ldtfnycxqkmjg +lndxtfkymgjcq + +elrfwpobjxa +mtpfoarbsdj + +qigtfkwhobpvrcyzjuelnd +zcawdbogrhqnlieyufpkt +hqlzcnrikfypswutoxbegd +butncgpyovzrlfwideqhk + +ozdnivyjlwkp +venpbsuzlodyw +xfdqnzhwyopvltcr +aizdgmlywponv + +tqg +qt +rqs + +whm +vadomyl +wmnqh +gwmps +mcnu + +loav +zdl + +vsleinyhgo +kshrxvaymptw +cqsubvf + +ofd +fod + +pdjrszhgkfe +dfshzegk +edhzfkgs + +wti +ftcwib +iwtoz +wiut + +joebqrhgxvst +alkgprwetohvznqdmcb +vbrgeoqhyjtix +thrfequgbxvo + +ejx +ezfmnx +iderjhxc + +hfrqe +rjambh + +ytsdznehwg +dwrohqyvmscgjz + +xdatzefv +kcxwhypoanlr + +tbvdcol +tblcodv + +kg +kyg + +wxtezyuomkfdhspqjcn +xuoqwtphyckfjndzsme +ouzwykhqfcndmspejxt +ncemfpxsquzwyhdtkvoj + +dyfvmobrspnlguqaw +vhalnuwbypod +xjuawvbptnyohld + +bmytkawjszl +jaystwzmkl +msatlkwzjy + +vghcafoer +graecvhzo +uavrcoheg +rhgvcaoe + +nvjga +avgni + +g +a +g +g + +otxj +xtjqo +xtoj +jxntoy +ltqjxoa + +i +ji +i +ai + +w +pw +qutdebyio +w + +camyzohlbrgd +ygcalmzbrdoh +hrbycdzmalgo + +hgsltxvwmc +loxsntghvdc +sgxclthv +ctvxlshg +yxcvsgthlf + +ekizadqujopgx +zuagvjsirokwpx +uoykijgpqaxzc +gqkoixpyabdjuz + +qjygvhmlkdbzsifcwapuonxrte +desvfncpryjamkzhgutwoi +nifhzpertsgmycjwauokdv +swohafgetuyvicpzjrnmkd + +dybpeckxz +zucgeyipqdnl +wspyefczlnhd +prevcytzod +pheyjdwzc + +vbpfnedqyoawhcr +qrhcewvabfopdnmy +afrvebhdocniykqpw +foqeawrbvyhpdcn +ncwaphbvoqdrfey + +dwj +wdzj + +mr +rm + +idnkmufx +demjykixo +kjdmxiov + +ukbflqhomzrwastyjgpex +voqkyihjufmxswgrztbc + +tjn +njv + +ruika +irkua +wairlkszu + +rfgphcezl +zcreg + +mce +mec +qsme +mpeyf + +wjcxoftvnr +zomvfjnyw +nywjofvtm +kvwhfunajolsigq + +y +n +n +y +oe + +nvjkryifxace +ziehtgnjfbyrlvka +xnpvjismakeyfr + +g +g +g +g +g + +vwgnj +ivoj +ugjv + +myzrbf +ymczfr +vmwroxhfj +mlfdr + +ajqerszpbdyvoufwlmgcnitxk +wmzuftgdkavjrlibenpoqxcys +gnpmcsxlwzvfateqdirkyujob + +bnfudi +inay +iuncv + +trqlgxaeouy +uvoqxktwejyr +otqeuxyr +xogreiyqut + +ficdymxhuboq +dvwiuexfc + +zbhndug +ugsdwphnv +nugdwh +dughnjio +jgsyuhnd + +f +qrcvkfu +f + +yvf +yfv +yfv + +qtnc +cbqn +qnc +tcqn + +rxyhizgjklumv +fidxgjlkyhvr +avncxqrjbkgplhiy +zrdkxtlgjvyhi + +zjq +f +u +prgot + +hrgktyczsvnmiolewbf +gbowmtzvynferksichl +svgbrzmcolkieynfhtw +vehwtyrmgsnickfozbl + +lbucxdo +jlcgdxiu + +hvtafpnwzex +vnxzwftehp +hezxvnpfwt +tnehfxvpzw + +wbmyejlv + +gevqi +eigv + +unogtlfwvcyjdr +jcuvlftdgnwroy + +kdlm +pklw +klfay +lk + +somjqeuvdk +rzaqodkmvxsj + +g +g +g +g + +ceihqtrjpbxso +xohipcersbqj +pibhoxsrjeftcq +pbcqvosehrjix +icbqhosrpejx + +jvldsruex +oktrdvslcujx +xdurvpjsl +mxesdiujvrl + +rgcdsax +alqsbd +fdavzs +ijsutahdpye +baqdsz + +jxcabgpuimtekqsy +iduqmetsognaybxp +yqwaburlxps + +ulesvzoijdnpfhkacwmxbrty +zvxrdjskefbthimwnpayoul +ihdnlkxrpgwjbyevozuatmfs +yixowledpbvrthjkzufsmna + +hxibvuzdowysmflpkqjgacnr +bhctimdakyqlsvxwjprounfg + +xolza +axzl +xazld +lzoax + +vjpdirbzwmcyeqtfgoulhsk +shzpugkqlobmridvjyewfc +ybufwljhrcdegsiozqvkmp +ucnbokilmgvqwjzsfphaeryxd + +fzwiyxutvmdpbqkgrj +vmqludbfywzkxpijtg +qwkuzbfxyjmdptigv +pmgifdkjtbuzywvqx + +jvxwlqr +rqfjmsveoaw +ptbyhvjqw +qwkvjxg + +qnaxrduhpfvoyjbksgw +qjnwieaoxrsfpzdhk + +nrcmyksodhaztijuwblv +ksxrufaqhwbcnme + +sqx +sjbql +gsqnpwk +sq + +cpgkrjvqx +vgkpqcxjr +qjxckapvorg +xjvqckprg +gkqrcpvxj + +ojyziuqkbe +fvuceart + +qpgyknd +kfvyjtd + +phfmqdwxnuvgo +ouxdblhnmpgq +amxnpihkdusoqr + +run +dnx +vnc +ponklq +nur + +ixoytfqugrvjzcdwlhkbesmp +qalryztjxumhevifnobpcgdw +bothiuxqjzefcglpwymdvar +lgfjctrixhzudaqmebpvoyw +zlwfoituxvdpqbejhycgrm + +lrwvkj +jqwc + +awvyst +vtysa + +ugxys +x +x +x +x + +ismv +mfi +ihofm + +lijwuxcbrfotekpangzmsvyd +onmsdklutybrcqavegwfxijp +vnyarmslcetoxjkwuqgdipfb +jtrsdmfcnwiveyxlobhukgpa +msatlerkovjnfgdicuywpxb + +xmyen +enymx +myxen +xyemn +xymen + +oaustqdifyxepkrwh +kbcvmrjn + +uqv +qrvw +qv +vqtmu +qv + +lo +l +l +t +l + +aoqujemitxrszgnywvlc +lauzwhvr +akulrbdzwv +lrwdpvhauz + +jhwycgso +trshda +hs +sh + +oydxjrhetainw +nbwdxloetyiar +entcioxrwadyh +tonyexrpdawi + +bkdrqlnjwshi +nkidbwshrqlj +hrqvfldjinsbkw +khdbsnwrjilq +wjnipadhqkrlbs + +iusqovtzgajpndcwl +icstgzpurhbwqnvjoka + +hvwcue +chwnejv +cxwvath + +yroksb +tbs +swb +sb +sb + +vgixnfosrpetb +rwpndfevylg + +alytpjgxn +styjnkmegil +npfyakjgxlt +vzdhtlonwygbjq + +dp +dp +pd +dp +pd + +cav +i +ac +chzu + +kdv +fld +dwq +qds + +x +wanxl + +cfborlazjq +pfcloajrwqbz +btonaqzidlfrgjc +lcfjzqsroba + +o +n +kwl +s +f + +oylasgwtbnu +wstxylzug +ikjvuqwltyhgs +ultbomgwnsyax + +iotqspcwuhr +uplinrgcvhews +tduspchwrim +sihrcbquotwp + +qjdnkl +ldnqa +qdiknl +qdmnlv +sltxwbqnyd + +rnzmybp +zfnwc +nkazdqg +uzesvmjn +vzn + +emp +epm +pem +mep +mpe + +zxhde +demhz +jadu +ckrpvglsw + +pegn +gnep +pgne +engp + +hjkeoyrglpcitbva +ubtzsmvakoly + +u +b + +ksanb +sbk +sbk +skvxdb +bkfs + +z +z +zo +wuqmz +gz + +jwbyaugknetqrmoxh +axwnmobetrjqkdyuhg +omvjbyhngureqxkatw + +lqdiban +ifbazln +bafzinl +ifsbanl + +dovkxjylabqmtizw +pawvoxdmbyizqtj +vwubiayopgxcjzqdtm +qbjtvowdnzsixamy + +ykpusjaqclowb +kjsclynwqapobu + +zasypunbwitorjvmeglqxhkdcf +bvlirhqwgskftxedonymuapcjz + +ezxghwr +rzgxnewh +erwxzhgv + +nkfvplstgaybmhorewzu +lakohrfuznjdsqvgmywp +tuyshcfwkpabzomglrnv +clnsrgvowhufamykzp + +gbrln +pb +b +bsw + +ugcnskomzepjvxifrtwq +vpmkutefjzgwrbsoncxiq +cmkesufoxvqprwidzgntj + +rpsheibkg +bokwgjeh + +sfwgbm +jmfgbws +sgfumwb +bfmgws + +qfxderyt +ikwyln + +nsrjpbtxuvcfgl +putvcjfrdlsonxegb +vgbjtrlsfxcpun +lnbgctvmsjrxiufp + +cnawzexsdlubpm +bufnvdiaxptlcmse +lbyugexmdncspa + +xtvpcfsdzewmgaqb +felcxvdpiqnuymow + +xoqt +tqxp +gtfqjkvbu +tqa +qta + +jplacdti +apfliojtcb +ilcapjtk +atcjilp +tuipnjleyasc + +by +by +yob +by + +m +mp + +kenjrtgyvxiqwmazchfbup +dezplgiwyxrq + +ra +wa +aw + +qldpihtceyfoksa +cfsopeatkilynqrdv +xctlfjsoapiguyqdke +syiupwbjlacefokqdt + +sc +twsq + +ewc +ce +ce +ceiaf + +wnqfklygehirdxazup +vqgepxnsziakrw +eznxgqwpriak +irnqvzwkpaxbeg + +gu +au + +ujvidwoe +jekiubdov +idunjveo +eidvunjo +evinoyduj + +irytzs +jhnr +r +mnrjdb +rnv + +ug +gu +ug +ug +ug + +ifndua +rafyduin +ufhvnadi +dyguamifn + +aihwljuqkezp +wzaiqlp +iplagzwq +qwizmpla + +pvedlxntwjf +veldpnftwj + +xvglbzusemwqihn +vkdbefxrtimp + +spcwi +pjewi +idpyfb +ivp +pwzioj + +e +v +za +z +g + +mjvxyaguoc +qlhypbgw +qegylr +gklyrniw + +tv +l +l + +tmrzoldvsiu +owzpglsidvtmu +hmtjvlodxsubyzi +tuvilzdoksma + +yenvdmsagq +nihfbxaymg + +hcylanqdjmwrpixbo +qmwxybpcdalohn +mxwoazyphndcblq +wzbydamnoqxhcpl +mnlcadybwxpqoh + +miupnhbvj +uwpnbhxjqiv + +rqgta +awkxo +hzjsdb +awfu + +gskncrox +npulc + +iugzcseolh +gshioluezc + +jqbi +pjqi +bqj +njoqv + +eitjbcr +lpskbhyfrgxuzoiawv + +fejdyanx +cyfjekxdon + +gqzniubejkx +zjingbqhuexk +gknzxqcuijeb +uxjnzvergikybq + +wub +w +tarx + +ghpi +hiasg +ahip +yicd + +brysq +hkgfbnmacr +wprtbyqls + +lzfqot +qolfz +lqfzkor +qopmzdeflcx +toqflz + +vhremdpywtabokuilx +oryhfcztaixlvmdwup + +mwvqzngluxpcoeidk +ufcgnxjvmdzqikhlpw +lwvkxmciuepndgqz +glmzpqknieudvxcws + +ibrduwhlcxtsnpyvamekzjf +zmuevtynhpfskralcwjxibd + +rvdpebnwsiugmaqzxj +sidlbyakwrhvgmjoef + +q +q +q + +jofkmbcunaxet +elqngabhskmy +wkmxacenib + +ezfpogadrbulys +sbamgenyopfzu + +utagkdzvwoqemchb +zthluvqinacgb +qcjhvutilznabgy + +gduwcpj +bcxgdswpurj +pujdwmcg + +zxcagirye +uzrljgq +gwtzhfrb +dxrgze + +m +m +m + +mzf +zfm +zfm +mfz +zfmo + +ovdqzm +dmqvoz +zmdqvo + +bisprlndef +abvltrnkxd +rndbyl + +zmglywve +lyvegwz + +gtmrhpujzfqskoxavydie +typwiahqfnkdumvgoxresz +qzevtxauogipcksyrhfdml + +rcova +pjcab +upacjb +alc + +kzp +kpz +yz + +aivymnlux +myuxvlias +lmyauixv +viumlxay +iyavulrdexm + +smgjbqifah +bixgqsfmha +gsfqpnmhbilae + +yb +fy + +hfvcgd +hfkxcugdo +fhemcdgo +hgqfxdcy +begthcfrdqi + +gcwtjyluzvbsnrkopmeai +uzbtyinrqmofsjdkcvwega + +s +s +s + +dsvpg +gdp +ndegr +digp + +jiylzgcomkurtvqpa +yvmjtapingcruo + +auijcbwfqkxyshl +xwhcyqukbislfaj +yiqcljkxfasruhbw +cjlfkxyqwuhiasb +iayklqhucsjwxbf + +z +s +s +si + +brayc +cykwbra +rxbcva +ckdabrh + +rlfvawcqemhub +ctuqfsbaehm + +wbrzpyacqhi +bmpalyhzgrc +vbazpnyshk +hzyijfacbp + +wgjohx +sxhjgwo + +alhkqy +dahfmjlcy + +g +g +g +g + +lpsbynokvrudcgzqmtijhx +snuhqjlokypfrbvcmidxg +yhwbjmxopvirguqscnldk + +mwzsclu +yuwslzm +alsumwz + +maj +mjxal + +asgryznlwqjdfcpkehbm +knehsopgjdrqa +dnapshekjgvqr +ajendtksguqphr + +puznxmqsrtfdckvyijbalg +kcgytbmsxvrunqjzlfaip +yuikxpqtafvbnszgjmcrl +qkvagxcjslbytnifpumzr + +pglvfdihqa +pntwkbzeco +ep + +fpjmzitnlkvbd +qdbknvtjfilrzm +bijznpmlkdtfv +otbjfznlmvdhsik + +x +x +gx +xk + +b +qge +kycnzjw +pixlb + +cpzgaufikyltmbqvesoj +fusibtgoayvjqkpe +ovtfbasiekjugryqp +iubyfkjqvsoepgat +akofugibyqetpdsjv + +yirboahn +ozvha +oah +hoav +aehco + +hspqcxmjrbfyktngi +sptqigfklmadncxrvybh + +wdksztumeroaplhxqbyvjfin +tadflskombxyhqewjrvipzn +afrejdkobnhstqyilpmxvwz +vzynhwtafpdqlkjoirxmebs +kqjpwxrdvtizfmlhenysbao + +wonxesaihurqkymd +sxyqkmwdbnljrgueiao +whenxordaumqksyi +krouemnawsidyqx +rmsukxeyqonwida + +ckywportslfhdaqixvmjn +gkvlapqwfscjzruoy + +dtevjz +feqndzgxlvrtboc +zteuvkd +dszvuheti +tvdewz + +ehaqfwylskdbzvmpgt +vagbfeqwptszykhmld +arpzbsvmweytfugjdchqlk +gpmvqkawhdstzlyebf +btaesiwkvpfdhzymlqg + +hozuack +yuaznf + +ozvmpady +paydovmz + +gtmbeikr +breigtmk +gebkritm +kmibgert + +jm +m +ml + +frexcnogyv +nrvgyzilodxufeh + +btvzjpu +zjvtubap +btzujpv +jdeptzvub +bvzpjqut + +fkdcirhqt +cidhrkvfq +icqdhrfvk +vktrchidfq +ldqascokxrhfig + +tlgjdsoapmciey +gitdwojaeslmynpc +dtycalegpmosji +mydoitvespcjlga +gladijvyoctfsemp + +hwieujqgsxc +sgxebjhnuqwc +kqgcxwuhtvesj +qgecmsjxwhu +cwjqmugeshx + +qjwldfsri +iqgbedvlsfrh +ujnldiksfqmpyrw + +a +a +a + +spotgrheckwqan +shwvnatgpkqcyoerz +hcgasrpewnoktq +tkewponscaqhrg + +bjrsxkeiucnpoz +xrkczspbfeu +kqcuytdsrhvgplbxa + +at +ae + +x +x +v +x + +ds +dr +xemdno + +bvpdiocu +pzvhuyxci + +a +u + +d +d + +rplowaxqj +rqvowa +yrombawnsteq +acujvqowr +wrxloaupq + +s +k +k +k + +zmn +pfgseobimq +mdkza +mzyvd +kwhmr + +uqmtreg +twleuoqm + +hm +mh +whm +hm + +ydegnjfmkr +kvglzrfs + +kovgzemjf +kfyighomzelj +fkzxtueogjm +fxkjozgmue +zofbvejmgk + +zatrhwfjiopulke +satohknewfuipjlzrv +ekioxurwfljpztah +lgqzopirjkhwaufte + +xgbozwltnevidfrjuhcysk +gwsmtbkroyfinadpjhevcxq + +x +dx +mxzr +x + +kaof +kodf +ofk +fko + +rkuoazney +azyrqhtdo +yalobrzcw +xioayfrze + +cusyzmjhqloftdpakegin +lmnjipdyogkfahuqstcze +mneocjwgilpfxzthsayqudk + +m +hwyug +ymna +drptzijlc +wm + +pg +pg + +lrobg +orqfnsv +nqao +ojmwdecz + +jmxlkan +mlauxtj +olcwmeaxqjnk +jxbpmltar +mljxdiszyagfv + +sgriuf +ugmpoxvyq +dgzcuqwnh + +m +e +m +y + +dqkh +qdhk +hkdq + +znfwuiodcryqsmbpvejg +xnqwcjrdebpzmgovysi +pihmyewrcgnjzqvdabsuo +tqdsnjwzovrbcgeiamfyp + +meztpcwrsnojquxkg +mekurwxtncojsqg +ktjwqocsnugxerm + +eplzc +ezpcl +lzypec + +jmlrkseozxdunqf +dknseojuqzmlx +nsxqljdeukbmiz +sqmvnxubokizlejd +ctqsjmlkpwxzdunghe + +klqgxyrdt +toykrdqgl + +fwkzcuvmogxjrbelthi +zfhtgbqnomvwxku +fuozbthvwkqgmx + +s +x +x + +pefqgwzlimyjncouh +qaduwhmysxjopieftrl +ojfphequiwmnykl + +ksfb +sbkf +sfbk +fbqvks + +eomabw +wemarv + +ghldr +iw +yj +po + +lpihfvqersujkzyb +vjlfrebkiq +jblqifrevk + +zgr +zg +zg +zg +gz + +hfvydluaxgipsq +otqcbfurygsvempk +ljnqdswvgpufy + +gdxbjivufyolq +usmbflyxiqdv + +kpfy +yrfpk +fpyk + +oencuyp +uceypoi +cypueo + +orcfsjhvxaqynibuk +cbixuyokaqvrnhsjf +qcoyfjxukrsnhavbi +fkyuhbvojnsxaqrci +vrcshuqxyfniakojb + +mvgbupxhfesodnzwjcq +dcjxzqyuepnvhfbsmgo +kpmzrsfebgaovnhcxu +npxgivuohmwsjefcbz + +xaujvbesdqgnz +augndvqbcjfzs + +eoyhpnrcldjbqfvtiua +laoyrgqzbuhndxwpvf + +pxfnblvuzijhdq +hdkljpbz + +jphqxmkwgsycurietbadzfv +vweygbzashxqcdji +wcbjdniysvhqeaxgz +dqxwhvbozjaiysgce +zwxghisaqbycjevd + +bzqgcuerktfsavwhnoydi +rbvyqdsiokcuganewhtzm + +tom +to +to +to +to + +rkfmtd +vkcunbq +rk +kf + +pkmifxjtwnz +kmsfanxteihjp +nmaftdji +ybqimuvojntf + +ns +r +r +cvhm +wnias + +mfsxucvboyj +cxomsbyvfj +fsbvomjyxc +mjhcvysbofx +xmfjcybovs + +quxomeysk +uqtokyxsm +yqohxbkm +uyoqkaxm + +br +rbi +brj + +paqhkzmcwfrsiubtvjnx +zktiqbucarpwnxmyhj +aikmgtyucrjnpqwhxzb +jkabpxztcrwhuqnmi +mnxzwbaitqrkujhpc + +szbanq +oegiflu +as +qpt +t + +qsu +faqiu +qsui +uroqckjv + +ufkcrahgitoyj +xknlcfujagd +gjcklauf +jkwafgcu + +gdmxn +boiygrca +hgs + +ybwclvjfkumxso +nvmkyowedlijuxcfsb +lzmqscybvxfukro + +fiprvjsgcenhtmalxzqo +phcgntoqmeviajfxlszr +zsxqctnevliohrpagmjf +sqgipcuanmtxlrvjehozf +vlczqjgoipafetmrnhxs + +ypwbf +pfwytb +pyfbw +btfwpy +ybpgwf + +wrzhafdpmx +tzspfhxnd +dkfhzwst +bgelqjdcyfizvhou + +peubvwgaqiclkfdxmsyjtr +kuwpsvlxbjrditgmqeacyf +btxejuiqcrpgslmadvfywk +gwalifqpdusrvmtjybcekx + +qvmhulrt +wcpzdsifex + +pohq +hqop +opqh +oqhp + +en +iws +tpr +qs + +lvfinmpcbzx +hkcsblgz +tcgzbkl +cblzw + +rsjie +ewjribms +ijers + +knizwxycoqe +dnqocbk +pkgsanof + +hravnysejobwi +nlfusgdxtpqmaki + +kuvboax +kjvohxa + +qwm +mwq + +xowbafsitjz +lawm +aylmw +wanur + +qcdsao +dqaos +opaksqd + +p +p +p +p +p + +wl +d +l +n +rwa + +rdi +dri +dir +ird +rdi + +ei +e +e +e +e + +favclpbni +icbfalnpv + +uokmvxgafizceprnydsht +pkeaonhzruqxgvdfmscytil +fpxhsgcrutovzykaenimd +aszthkimoyxdufvcregpn + +fgibsklo +dsokalnriegjzbf +kvwlocuys + +icnortpmfwy +vnqrofpmycit + +yaiempzjbvkgnrfco +tozadmejkbgqfcsiw + +crgtkhbajzdmlp +epnsvfhib +pvbhn + +fglxtqrb +uigxvbft +wxflbyg +xbpzndhfegj + +jiolrqxfapuwdngybhktzcv +bnerupsdkflaqjzvitcmxo + +znjus +qzsjna +znjs +uzjsn +zjxnks + +snwj +w +w +pw +w + +i +p +cd +qs + +f +ofm +f +f + +dv +av +cxkuo + +rbxieoyczljtuqvm +gnphsrckqifzeljw + +h +h +h +h +h + +exghrdkbivqsmcwal +vhicaqdmlbrywxsgek +mrvcbskheadwliqxg +yrmckldaqeghisvwxb +algoshwxzmbrqjdevcik + +omtswbxujpvfzd +yntcbxwl +aqtxyewb +tiybhgrkxw + +srkxfjlgtpedai +digtrkjsxyapq +djxrgapiktse + +fzlagmcnjwbd +chlzbgunwfj + +qszghewkntxaomu +xekowrasunz +xnksoeawzu +wjxaoduensbzfk + +oacfnvhugekystwp +ftncaykejwhbomz + +abrcsi +xctrvokbsg +yaescfbr + +vjwbpsleug +ghlwjekpbusv +jpuelswvfbg +yjwpvbeslgu +uwjegbpsvl + +jkvqesnto +kjot +jkot +jotk +otjk + +elf +nlg +vzl +yl +yl + +rgbf +yrzmhbn +rbv +btrp +fzrb + +uyetaqw +wheyaut +ateuyw +awyeut + +swuaon +usnwao + +udcyfksltzeqb +bkuycfstdqzel + +gjmbfxieklohpc +oglhiuyxjekcmfpr +okelfixjpgmch + +zixq +ziq +qgiz +iezq + +sdbjl +vyjsdb +glkdnjb +hdefnbj +opjbmd + +id +d + +l +l + +dsnze +senzd +dzesn + +cegqnbzyhtm +ovaksmjwrdbpicxul + +fzjxbck +ndjp +heyrsgaqm +tzof +xvdn + +kxtimcjayh +syavicktmxh +mpxcfatihky +kyxitmcah +taxhmyickv + +xlwjibshfgontek +njeixkslbogfhwt +hiwlbojxnktgfes + +udsygjltikqrmv +tulkrgijvm +teumkjvlgir +vgjkulrimt +rghkmlvpejtiu + +oegptdlksbixhcwqavjun +jacqedxslunipgh +enjgslzcmxupaqdih +zcndhlaqsepxugij +nqajehxpilcdgsu + +shdieqwxflurjzby +wmtajifoqcupgnkb + +xwck +ao + +zkpfgvda +kdgya +qwnbiheos +jr +muxfjcl + +wamxpysnl +qpydmrnj +nmypsl + +k +xtvweuplk +aykc +kyf + +uryfiabjvelptkmnsxow +pfcaoerluxdtnwjqbskm + +wqenhkxgypc +dnltwxzaofs + +srxmeabuodzq +oaeqdrubmzk +kdeaurobzqm + +rfungq +gfunqr +rqgufn +nftougqr + +jqthdmlfacp +liqumfdcj +qtjmglcskaf +lrbzwqyxoenmfjc + +dgz +fj +x +g + +qnhwlzjoac +wlzoajhcqn +jwqzcanohl +mwlzqonhjac + +asqtlpwnrm +nparsmd +sarnmpf +nspamxr + +ot +ozt + +cuokwgjmhxzidteslq +ytfqwpieraosbjn + +czoxdyvhasnit +zaxiovcynhts +juoyhvxatbnsiz + +owsjger +oerwgjs +rwsojeg +ojswgre +ewjsocrgv + +cmexibr +yxbir +irbx + +nbgpodvsxmzfqiteuj +mnvtqbpxuszjod +jtsqpovbxndmzu +spxbzqmodvjtun +oumjnpsvztdbqx + +vrwytk +kglvfrw +zxwusdonikph +mwgkj +warykt + +rkdijofslupwqgtvaxhy +jzdsuprykoiwfvlxaq +wfboijqpurvslkxdya +skylwcmauoexpijdvqfr + +pe +ep +e +eb +e + +uzrmjehfktblxsivqpo +rovklpubzdsfiheqxmt +ekzuprvbtisxoflhqm +imuhkftvbrepzslqxo +fmrtxblpzeosuvikhq + +oauifsgwqbtvkzxjycpml +kqmgzxjbwcoyiuvlatfps +pwjmqczoytaxgksvbiful +yqwsazxilvutcmbjopkfg +qtfdpxkmbzwacsgoiluyjv + +ykcjafmxlbehuqtiwvs +zqxudnmysc +ngrpcymsqxu + +qlyp +plqy +pqly +lyqp +yqlp + +dtszxekb +sxrgbztedm +wsdnyxobqtl + +oqmxabwknfy +mxyofkbqwaj + +xfqrjeh +hfqrjex +qbfxrhje +xhjeqfr +oqhrixfjcse + +pjaoerbtkqslx +fxkelnithrspa + +tdrpcbksa +daksbcptr +abskdptrc + +clidq +fqkmil +bioje + +wjetbyvxhoumkp +bfyenwakpvotxm + +adlqkrzvg +vlzaqgdr +zqdvryagl +lzarqgvd +arvlfqgdz + +xfsb +xbfs +xgbzsjf + +pbtrqilmkfwv +mkwflp +pkwflm +wfklsmup +wpkflm + +qkjhnsczmueftdpbrgvixw +kdejtqhfswnbmupcgxvzri +ghxwkqupdtbvscrmnzfeij +fbmrgtkxjqevhywsdzcnupi +enskiwxgdtpbquchvrjfzm + +u +u +u +u + +fitcw +dfvzabyu + +saewhufodzlxbjcrqivygmpk +jqxiopdmyluwkctsfzegbavr + +zsdfpajrnvqk +bkaxzpsrndvqj +danpsvrqjykz +ujspgrndaovkzq +tljnarpzvekwqsdmhi + +wyuemtvkdixl +direvlmytpnowauk +eigvlkwumyctd + +jcrpnzalft +jacrutndpeixz +jczvantrepk +ergcajnptzv + +iagonws +awings +wgiasn +anwsig +sngaiw + +qogitsbfzmxk +kefoxbiqtzs +tisfzvxobqk +castjxbqpifozk +okbfsnidqtzxe + +gocwh +otmhge +ogsh +ogh +sgho + +e +y +ixmds + +rtkcgwfx +tjxzckfhgbiw +aenyvmcfg + +ngspdqwv +hziq +qx +yqtf +qjz + +exgirhuwyjt +rxtuepwhgjisy +xtwyghrjeui +getuyijwcxrh +ughtwyxiejr + +vdh +devh + +y +y + +m +m +mpv + +ptvlsonebiqjwraxckumhzgf +lqtvbihsowmgeunckzjfapxr +xglbifczovtwrpqnmajeuksh +eoivpuqfcbhtnagjwkrzsxml +nubpeofjwmqvxgircahksztl + +uyltcxrzjegmfwbkio +tgpxmuvsobicfej +esvgjxcfmuotib +xifognqmbtdujeca +bxhfmiejcgout + +djaz +dajn +edja +tawdh + +hyp +yhvp +ydph + +z +z +z +z + +jeixykzcrfd +zexmdjk +xkzdje + +auih +uial +uia + +ucwkeiadhgsr +ihswgkrudea +gwezhskryadnuoi + +lvhmuranicfqpbt +bqhrlotfnzgacmu +fhdcslqwymbrutan + +u +bj +pkb +pj +i + +yg +mlyxo + +q +p +u + +yibeaxjpkcwsfm +ixpekjcaswmyrfbl +ecmbikjptafwyzsxq +sxfacbmiekjwyp + +vyzhmwginr +scjl + +s +c +h +s + +qxhngcyijptvazme +gdiwlszqfbtvcpxnejhy +eghzaniykvpqotmjuxc + +yasrbcwju +rzbacjug +abuzkxjcr + +yjdgutwfreslm +jlutewfdgsmry +tglyjcefrswmud + +cf +m +mn + +zbwlnqrc +zwrpc \ No newline at end of file diff --git a/2020/06/part1.js b/2020/06/part1.js new file mode 100644 index 0000000..23e93b0 --- /dev/null +++ b/2020/06/part1.js @@ -0,0 +1,21 @@ +const fs = require('fs'); + +const data = fs.readFileSync('test.txt', 'utf-8'); +const groups = data.split('\n\n'); + +let sum = 0 +for (let g = 0; g char == group[i])) { chars.push(group[i]) } + } + // keep a sum for our puzzle answer + sum += chars.length +} +console.log(sum) \ No newline at end of file diff --git a/2020/06/part2.js b/2020/06/part2.js new file mode 100644 index 0000000..3c9049a --- /dev/null +++ b/2020/06/part2.js @@ -0,0 +1,21 @@ +const fs = require('fs'); + +const data = fs.readFileSync('input.txt', 'utf-8'); +const groups = data.split('\n\n'); + +let sum = 0 +for (let g = 0; g