diff options
author | Leah Neukirchen <leah@vuxu.org> | 2021-12-09 17:47:23 +0100 |
---|---|---|
committer | Leah Neukirchen <leah@vuxu.org> | 2021-12-09 17:47:23 +0100 |
commit | 6f4b012e1956c056ee82a8e81f4caed791db92c1 (patch) | |
tree | e0328538ef6758002cc15c01de04cdc405dd7d89 | |
parent | 3f2351d8ca5ac29808808873c44b9f63a871ac8c (diff) | |
download | adventofcode2021-6f4b012e1956c056ee82a8e81f4caed791db92c1.tar.gz adventofcode2021-6f4b012e1956c056ee82a8e81f4caed791db92c1.tar.xz adventofcode2021-6f4b012e1956c056ee82a8e81f4caed791db92c1.zip |
day08
-rw-r--r-- | day08 | 200 | ||||
-rw-r--r-- | day08.bqn | 9 | ||||
-rw-r--r-- | day08.clj | 33 |
3 files changed, 242 insertions, 0 deletions
diff --git a/day08 b/day08 new file mode 100644 index 0000000..657ffd4 --- /dev/null +++ b/day08 @@ -0,0 +1,200 @@ +aedcg db ecbdgf badfegc abfcde edb cbgfe bfdg bdgec agfbce | ecagd gcbde dbcefa bgfd +bgeadf egcbda cfebg ac caefbdg bacd ecfgad cabeg gca abgde | gcbef befcg ac ac +cbfge ed aegbcd gfdba aedf facbdge fdegba bfgcda befdg dge | adbgef dfgbe dbgfe agdfb +efdga dgebfc cefa edgfc decbagf cdagfe ade bgafd ae cadbge | adfcegb dgcfabe ea cbfdge +fe bdcge ecfbdg ecf bdfe gdacbe gdefcab gfcad cdgef ceagbf | ef bdceg begdafc efgdc +gfacedb bfgadc fbdgec eagcb cdfe cd gcd afedbg bdceg gfdeb | dcg gecdb adebfg cdbeg +bfecadg fdbage bdgfca cfba fdceg acdgeb dfa af acgbd gadcf | fad bacf adbgce gbdafc +fbaeg dbcegf acgfbd gadbecf bfagce ge bedfa bfagc cage efg | adbef gfcdeb bdgcaf dbegfc +bcad gcefbad afbdg cgfea gfedba dcbegf dagbfc gfcab cb gcb | bc cbfadeg ecfdgb gbc +eabgcd eagfbd fdgb gbdea dbaecgf fbe bf fdcbea gfeba faegc | egafc fbdg dabgefc agdeb +cf fabdg fbeagc gefc bfc caegb gbeacd cgafb cadbfe fagdecb | eabdcf bdeafcg acgbe fceg +acdgb gbcfe fbdecga df cgafed efbagc bcgdf dfgcbe fgd fbed | dbcag cfdgb dgfcbe gaecfb +fc cebad fdagb fbc gbfade dcfgbe dfcba gcaf degcfab afgcdb | gefbda bgcfde bfc gadfeb +cfagdb gfbd fg badgfce gfc ecdbfa bdfac gdafc fgeacb edacg | bfdca bgfd bgacfd gf +fae ebgad cgfba bdfagc fe ebfgdca bacdfe cabegf egbaf egfc | ef efdcba abdfce agcbf +gebfd aecf ecgab cbagfd cf gfecba dcbgafe cebfg dcbgea cbf | ebcagf fc acdfbg cfdbag +agfed fdaegcb facb ba bedfc abe edfba begadc gcdefb dfcaeb | becfd bea acbf ebdgcf +dfb fbdae eagcbf baegd fbcea cfde aedcfb df gabdfc fgadceb | adfbe badef gdbcaf ecfd +acdbg ebaf fcadge bgf dfgae gdafb fb gcfebda fegdba gcfdbe | agfced degafc bf cbdga +ecadg gf dgabfc fbedga bafdc bcgf gdf gfcad dcagfeb aecfdb | bfcg abfdce gf bgdeaf +cadbef dgef eg fbeda gae efagbd cgdab bgfcae adgeb cebdafg | dgebfa agdbe gefdab dgbae +edfgc ebdfc cgfbda gfbe cgbedf bfd fb edcba gfedac dfgcaeb | fbge fb caedb fb +gdbafce fcedb cdea cgebfa gfbdac dcb afceb dc bfedg fdbace | ebacfdg dbc cade fgcdbea +dgbcae eb begfa egb gbadf cbgdafe efbacg ecgfa cbfe dfgace | gfbcdae bgecfa fgdba fceag +dafbe ecfadgb dgb gcdf ecbgfa dg fbgda adgbfc ecbdga gfacb | bgeacd dgbeca gcdafeb fgbace +df fdc bdecf gacfeb cefgb bdaecfg gefd fdbgca edcab bdefcg | cdf dabfgce aecdb gbafdc +egcdfab aebfgd abdce bcgfad fgdceb gab gaebd ag bgedf feag | cbdae deabc agdeb dcgfeab +acfebd febac deagfb bedfagc efc afdbe eadc ec bcagf gbefdc | aced dcea ecda cbgaf +cefga fcaged dgef gf fgabced bceag cdfeab fcabgd dcafe gfa | dacfge fga gf eadgcfb +gd bdeacf fdbg egd fdecg gaecf dfebc gdabce dgecbf cgedbaf | bcdef dcfbea dfgb degcf +ebcag agde baedcg dfacbe bdacg da gebadcf dgfcb agfbce dba | gbeadc edgabc aedg fcbegad +deabc acb facgbe bdecf abdgce feacgd cegdbaf ba cgade bgda | ba bdga abc ab +cbgadef fb abcdgf bfac gefda gdabf dfb acbdg cdegfb agcebd | cfbegda cafb efdbcg bagecd +ecbdfga cagbef afged efdgc cagdbe efabdg gda da geafb fabd | fagedbc ad gefbda dcaegb +fabgde bfec bcafg bc fcgad gcebda cabegf cab eabfg eadcgfb | bacgef cbef fecb bac +dgb fgbca gdbca ceagdb dcgea gcfdea db dbeafcg cebd fbaedg | cagdfe gbd defcag abgedf +bgcedaf dfgbae efbag gabcdf bfacde gb gfeca bedg bafde gab | ebgdfca dfgaeb bdefa bga +becga fcgabd efabc cadfeg bf daefc dbef fbcaed afb gbacfde | gaedfc ceagb dfagec ebfd +dgcf egfbda dgfecb becfga dbefg dabec cfe ebcfd cf dbgaecf | ecf aecdb fc fcdbgae +gb fbegad bfag gdefc cedbfa cbaged afedb dbg dgeafbc gdfbe | gedfb bgdef egbcad dgb +cgbfae fdbgca dbcfe bedgaf daf fabge ad gead beadf geacbdf | afd adf dfcbe gcdbaf +bcfged fagce gfbadec abdceg ad cafed bfedca bcdfe dafb acd | ebgfdca ebdcga cfdaebg agcef +bdafc fed cfega dcbfae agfcdb caedf egbcfd dbea gaedcbf de | abdfcg dfe fcgbde edf +afdec bc gebaf egbdac fgbc afcbeg gcbaefd bce abegdf ebfac | fagdecb dcgbafe ceb adbegc +debga gaecdbf fgebca aeg ae ebadfg dgbce dgfabc dbafg efad | ega dgaefbc fbgad abcfge +fegbac bgaed gacd cegadbf dg acbge dge fdbea dgbfec cbdage | efcgbda gde ebcga gadebc +gdcfe debgcf bc gcb dfcgb gbafd eacgfd acebdfg edcb begafc | bcdfeg edbgcf gfbcd dbfcg +gfbc gb gcabd eagfcd dfgca fcdbag eadbc gba fdgeba dgbface | cafgdbe abg eagcdf abefgd +edabfc cagbf cb acgfbe bfc facgde agdfb bceg bacdgfe fegca | agecf gdcefa abgfd efagcb +aecbd gecba fecdab acfd fgbade ebcdf da egcdabf fdbgec abd | agebfd ecbda dafc bfedgc +egbdc dfaceg dfbcg gbeacd fgc gbcfaed fdgba gbecfd bcfe fc | bfce caegbd gcf gbcdf +decgfba adfe agf fgadbc gcdefa eacgf gceda fbgce fa cbdega | aegdc dcebga fa fgcaebd +acfe feagb cfgebd gbcda fcgab fgc gbefda agfbec cf gbacfde | eagcdfb ecfa gcf gbaefc +gfdc acgbfd dgafb fcadeb fbc eagbc adegfb adgcefb fc acgbf | bcf fgabdc cabgdf cf +gfcbad dbgcae cegafdb fegbda efdab geadb befcd af abf faeg | dceafbg bedga abf bcaged +fed defgc acgfbed dbegfc fegdba ed efgca bfdgc cagdfb ebdc | efabdg gcbfd decbgf cfbged +gfdeb fcegab bgdcea dbe acfgbde dbefag daef de aegbf dgbfc | cgeabd gcfdeba ebgafcd gcdfbea +fbead ega fegacd ag degba egdbc gbcfaed abecfd gedbfa fbag | age fabg bfag egcdb +cgbdef bcgafd cgafb acgfd cfd dc edgfa fbecgad gfcaeb dacb | cdf befgca bfcga agbecf +aebgc gefacdb ac gbcfea ace acfg bafge cabdfe geabfd cgdeb | aec ca begac fedbca +cbfage fbaed aebfdg dfa dbcfe gabef ecafdgb cdfega da bdag | edbfa debfag bdcfe abfge +faegb efcdba fdgce ecfdgb fca fgdaec ca adgc cfega degabfc | ebagf defcba acfge afegb +cgdbe ecabgd dagcb ac fgaecd gfecbd gfbda bfgedac acg beca | dgabf gac agfbd gdceba +bce gcdae dabefc gabfcd dacbe gefcdb bcdfa cadfegb be beaf | eb ecb facdb dacbgf +dfcgab eadgfb cg bgced gdcabfe gfdeb dbeca cbg fgcedb efgc | baedgf ebcfagd cegdfb bagfcde +ae fbgeca dabcf cae dgbeac fadecbg egbcd eagd bgfced bdace | fbcad bgfcea gefdbca ea +dgbfca afdge fag cgedf abdef gbea bfaedg abefcd ag bgcaefd | fagde adegfbc fbaedg ageb +eagf bcgfde gadeb ge bfecadg cadfbe gcdba efbda deagfb deg | egd fbdgec abcedf cagdb +dcegbaf aebdgf cagfe acgedb agdeb ecbd cfbdag adc gdeac cd | bcde edbc bdgafce bfaedgc +bcgeaf dacbg agcbdf bacged afgd cdafb af egadcbf caf fcebd | caf fgda bcdgea cfa +bgdac bagfcd ebg cedg eg ecafb dgeafb egabc dbagce adbecfg | fedbgac daefbgc gced egbfda +ab ebfgd bfa efbcag cgafedb abdc eafdc bdaef acfbed cegafd | adbcef daefc acdef ab +badcf bdgcf fbgcde cagb bgfdca ca fcgead dafeb gfcbead cad | ecfgad ac ecdfga bcdgf +ebfgad bcgedaf egfcb aebfg acgfde geadf bfa ba fadcgb edba | bgadcef ab gcebf ab +cfedagb fbecg cdegfb gbcafd edgb bd gaecbf fdebc adecf fbd | dabgcef egfbac edcgfb fcebg +gcdaef bedcga fagd gceda fa abcfeg efa eacfd efgbdac fdebc | dacfe adcfe fdag adgf +ae eda efdcagb decgf gacbd fecadb gacde acdgfb ebag cdageb | ea edgfc cadge edabcf +acbef ga dgcbe bgfa gcefab bagce dfacbe agcedf cga gadfbce | efgacb acbedf dcgeb acegb +afebdcg bedacg dgf abgfc df fgdbce agfbd fbeadg dafe egabd | gaebcd acgdefb feda bfdga +eb dacebg cfadb cdfaeg adgec efagdb bcgedaf edb cdbea gcbe | gfbdae be be ceadg +cegdf feagbd badegfc fedag adfb abegdc gad agebf ad bgcefa | abdf becdga dgefba adg +fec eadfg aefcd fecgdab efacgd bafdc bgdfce eagc dbagfe ec | egca gadfe ce eacg +beacdf dc dec abced aebgcf afcbe cdfb adgbe cdfgae decgabf | edc ced dce acdeb +ebgacf cfde abegcd abfec eadcfb ed dae fabgcde bdfag baefd | cdfe cfageb baefcd dcgaeb +dc gaedb dfgc dbc abgcef gebdc cbgef bedcaf bcadgef dbfcge | dgfbce edafgcb cd gdbfce +fbdagc degba dgbaec cfedabg gd beagc deabf agd cfagbe cedg | gced dga gfadbc gabce +gdafc dcfgba gbd dbefcg agebc dafb bgcda bd fgecad cdagefb | dacfg adbf bd fgecda +bgaec fcedb cgabde efgcab efgcb fg edgbfa fge gaefcbd cagf | gcfa ebcag gbcdea efbcgda +bga cabged eagdfc acfgdeb ab bcgad dgcae bcea bdefga dcfgb | gdbac dbfgea cgefda dbcag +adfbeg egb gcfba eg cbfagd cgef bagec cbead cbfgead bfcgae | afecbg cfge baecg geb +cegbadf cagef bdagcf acdeb abg bdgeac bfcade gedb begac bg | cefbad gb gfcea bg +fgecb dbgafc cgb debg bfgced cebfd faegc abfdce bg bfedgca | bdafce bgc gbc gb +fdgce gbecf cd cgabedf gfdae cgbdfe gacebf ebdafc fdc bcdg | dgbc feadbc fcdgeb ceadfb +ebcgdfa cfdabg befg efdac eb gfabce ebfac ebc cfabg ecgbda | gcbaf cfeda fegb gcebaf +fdgabce eagc abecf cfa dbfacg ac fcedb febadg bgeaf aecfgb | ac gbfea dgafbc ca +adeb edagf fegab eb bef dagcfe afgbc cgebdf fdegba cfeadgb | efb aefbdg fdgecb abde +ecfbg gbad bacdef bd begcd dcaefg daegcb dbc dgbafec aegdc | cbd edgca badg ecbgda +efcdg deb fbdec dgebca afecb db edagbfc abecgf badf cbefda | cedbagf fabd fbecd ebafc +edbaf gf egfa efabgd fbg bfdaec egdfbac dcgab dabfg cbdfge | acbdg bcdfge cbgad agfcbde +cfegd aef bacgf dfacegb cbfeda ea cdgfba afgceb gabe gcefa | eaf fegac egab fdbaec +dacbf cbgfd fbecad edab ab gdecaf cba fegbca decfa afgbedc | cefdag facdb ab fgdbace +bcgdef ecfbag bc cfdae ecb becaf gbac bdgeaf egbdacf agbef | bdcgfae eacdf eafbc begaf +ebcfg dabegc fbdca dafecb cgbafd edaf acbfe eab ae bdecfag | abfec bacgdf bae cdefba +dgafce bcgef fc gdefab abfc dgbecaf ecf bfaeg acgefb gcedb | agebf cbefg efbdgac afbc +gcbdea cdfge cafedbg aefc adgce cf cgf febdg gadcfe fdgbca | cdgafe gfc dgbfac aefc +gebadf agf fgec gceadf fg cgfda geadcbf abdgce acbdf eacgd | gbdeaf gedacf eafbgd fgdeac +dacfb cb cba dcabef ecdbfag ecbd eacdf agebcf acdgef gfbda | cab fdgeac bafcd cab +gecbaf gdfec gefda fbgcd ec fgbcda gfcbaed edfgcb cge dbec | ec feagd cagbdf bced +fcagde cagb ca acgfbd dbcfge bdfcg acf dfcba acebgfd beafd | fcbad ecfgda defab afebd +cdfga cdaegf dacefbg abcd db bgcfd acbgdf bagfde gbefc bdg | bcdafg dbg cadb bgd +cbedf ecagb gfbacde dbag dgbce bfeagc gacedb cgd gdfcea gd | aegcb gdc agcefb bagce +cdgfbae agcdef ecagd egdabf aeg eg bdcga cfaedb afcde ecfg | eg dbeagf aecdfb ge +fgdba agecb dacegf abedfg gadcbf bdfaecg cf bfcd gfc bfgac | gcf fbdc fdbc fgcabd +cgfba gfeab ceafbd ae dbegf cgbfeda fgcbad geca ecabfg efa | ea ecbagf fbcgda ea +fecgda decgb efg ebfcgad acbfdg acfe ef fcgda dbfgae egfcd | ef dfabge cgbafed cdgfa +eca cadfg ecagfb fcagdbe efbcdg edgca bdae bgcde ea eadcbg | ace agfcd gfbedc ae +ecgfbd fce aedcf dcegab dcega dgfcea fe dfacb geaf cfgaebd | afeg bcegda agfcde aecgdb +beafdcg acbeg fcegda gcf badfge fc cfbadg fgdae egcfa cedf | fc dabfge beadfg defc +gdf bdcef bfaeg dceg fdbgce fdgcbea gfdabc bgedf dg facdbe | bfdce fdbge cgfbde ebgdf +gac cfbged cgbae agedb ac ecgbafd faec ecgbaf cgdfab gcfeb | ac ebgda bgeca eafc +dbafge face abgcf ecgadb fbcgd adcefbg fgbae afbgce agc ac | fegadcb egbdac aecdgb afebcg +aefdb bfdgc fgbadce dcegbf ag adg dgfabc bgafd dabceg cfga | gbfeacd bgcdfa aebfd facgbd +fdaeb fecb fecbda bfgcda dfebag cab bcade cb ecgda fdbagce | bfagdc bc feabcd cb +gf gcbfad becdagf bfeg agcfe deafc agdecb cbgaef ceabg gcf | gf fg dfacbg fbacgde +afgecd gdefb abfc cefbga gaebf dbfagec gab ab gacef cgaedb | bga dcfageb cbaf acdfeg +ebfac fcd egabcf aecfdb efcad dfgbca fd acgde edfb dgecafb | adecg eacbdf fdeb fdc +fedagb fca cdagf gadfe cfedag geabdcf cegbaf caed ca dbgfc | fbcdg cdgfa agedf bgecdfa +fbadge aebfcgd afce becda deabf ec bagdc cde bcdefa bdefcg | aecf gdaebf dce bgdafe +eb egba fdaec adebf gcbdfa edgabf bgcfaed cbdgfe bed bafgd | dbaef cabdfge faedb aegb +badgefc dbe gcfde bd dabf dgeacb egbacf ebfag begdf fgeabd | ebd cbdega begdfa dfabge +agfdce gaebd bdcaegf aedgc abd eabcfd cdbgae febga gcdb db | cfebdag cbdg db acbfde +bcd fdab adbgfc acdgf fdbcgea bd fcbdg begcf ecgbad acdfge | dfecag fbad bgcfd dacfgb +abfge bfd df efgabcd cbefda bfdga cgfbea adefbg acgbd edgf | gabfe bgfea fd gdfe +dbacgfe dgeca efbcg bceadg eafdbg aeb agcdef acbd ab cebag | ecagfd ab egdac cbadfge +edcbgf cadbef egb acfeb bg geadf aefgbc gbfea dgcfeab acbg | ecfdbga bge decfba dabcef +ca dafgb cgda cabfd dacgfeb edfbc bca fdcbag dgeabf afecgb | feadbg bacfd cafgbd cba +abfgd ecgdafb dbegaf afdgcb bc cfb gcabf bcda dfgceb eacgf | cefbdag fbc fgbda cdab +bdeag ba dfbge dabegc cbag gabdefc dab ecagd dafecb cafgde | geadb ab bgac ebcdfa +abgfdc gcfbdea bafdc bedagf dbecag fgbc afedc fb bfd abgcd | dcbag gfbdac bdf aedgfb +cbed bgcefda acgbfd de cdbeag ebagd bgcda gabfe dacgfe aed | bedag bfadgc ade degacf +cegfbda gbed acfged gdecfb gdc cfdgb dg ebfdc bfedac gfcba | dbgfc cgd gcdefa gdcbfe +egfbc dfae cafged dagecb deg fgdca caegfbd dcefg adcgbf de | gafdc fcgbad afegdc defa +ae gedfba bcagd age becgf acbge afbgcd gdfebca agdbce ceda | ebdgacf abcged fadbeg gbdefca +cfdbea ebafc fbdea bagcf bedagf dcae cgdefb cfdeagb ec ceb | cdea ec ec ebcgfd +cfed fca bcgafd gfaedbc gfdae gcfae ebgfda aebgc fc gdafec | gdefba fedc bcgea baceg +ecgbdf debga cbegd bgcfdea aeg deafgc dfgab cabe ea gcabed | ebac abegdc fagbd fbaegdc +dbcgf cfgeab afedcgb cgabd ad fgdeba bad adec ecbag edgcab | ad begafc egcba ecgab +bdeacf acf cfebdga abfdg dcfe fabcge cf abcdge facdb ecdba | fdbca cebafd fac cadbe +bdfaeg gbdafec becad gebf fcaegd feagd bedfa fcdagb dfb fb | faegbdc bf adbce ecbda +aegcd gefab gfadcb dbegcfa fgeacb db bgd bagde bedf agfdbe | fgcbda agbcdf bd ebdf +cea cagf befca gefacdb gdaceb febdag ecdbf ceagfb ca febga | ac cbgead cgfbea dfbage +eabcdf dagfc fegdbac acgedb dae ed geacb edgb adecg efcgab | ade abgdec gcdae cdbgfae +fbadecg bcedf afbdec af fcdegb dbaf caf adefc facbge edcga | cgfdbe fgacbe bagcfe gcfdeb +dgefacb gbfdca fecbag egb bcgead gcfe ebfad afcgb gbeaf eg | gbe agfebcd ge abfeg +efacb eg gcfe gdbfa cbeagf bgfae fcebda gbaecd afdebgc age | gecf fceg bgacfe gdcbae +cegfdb gdbef da adf bdga gedafb dbeafc fadge geafc dgafebc | acfge cfabde fbdeag bdag +fbcdg ce ebgcaf eacb ebcgf gaefbdc fec edgbaf gafced gbafe | eabc decgbaf afcebdg gabef +dcabgf geafc gdcef fbea bgadec fgcabe af fga egcfbad ceabg | cebfag dcgef cgdeab gcaeb +af bcgefd bfedc cbadef fceba fca gaebc edfa fgacdb dgefcba | adbcef daef acdbgf cageb +caf debac cfabedg dbfcg gbaf af gdcefb edagfc fbcdag fcadb | fa acf dagebcf cdbfeg +fcedag gfabcd fceagbd dabefc gdc cg ebdfg bcag cgdbf cdfab | ceagbfd bdgfe gc cabfedg +ebcdgfa bc defbc fdbcge cgdb febadg abgcef bce efgbd eadcf | bedgf bdecf egacfb cb +gcfdab bad fdbace fcbde adfe daecb agecdbf aebgc ad bfdgec | bda bda fead cdfeb +bdega decgafb efg dbcfae baegf bgfc gf fabec gacfeb fcdaeg | gebda bgaefc faegdc adbeg +dfebc efd defbag cebda df fgeacb fgdbeac fdcg becgdf ebfcg | edgbfc dbgfce fgceb caebd +aefg bcagd cegfadb ge aecfbg ecagb bfaec egcfdb abfedc geb | gbaec bdaegcf bdcfeg cfegdb +cgbfad ecafgd eg bagdc gde gcbe bdfea edgab eadbcg facdbge | bfcagd beagd gadfec cadegf +gbacde adcbgf fcadb dgefb fedba cbfaegd ae daefbc cafe abe | dcbaf bedfg aeb debcfa +cegfd aegcd dcfbeg ecfbad da agfd bgcae dfacge dac cedgabf | cda bgace dca dcefg +fbcead ec cbef dgfabe efdac dbaef ecadfbg ecadbg ecd gfacd | ecd cgfda dbgafe dbefa +acbg gdbaf bfc edgcf fgdabc badfce dabgef cb cafdgbe fgcdb | gbac fbdga afedgcb bc +fge ebcfag abge abgfc gaecf dgfbeac fgbecd cfead ge dfagbc | ebga egab gaeb eg +adgefc bfde fcbga eab fcadeb be acedf gbaedc gfbcead fbcae | abe bae cegfabd bgcfa +afegbcd efagd gbcaef fedc dfcage ef cadfg fge fdgcba egdba | dbfcage gdafc acfdg ebdfgca +ca eac cfade dcfeg agfc cbfged gbaecd fdcebga abfde fceagd | cbaged cfgbed fagc aefdc +fgbcad baedgc bdgeaf agedb eadgc gcfedba acd gafec dc bdec | egabd ceagdb degca dca +bgdcaf ecbg acfbe eb gfbca facde fecagb gbfade gefbdca abe | adgefb eafcb eagbfc ecbg +bcgeaf bgcdfe egbdf fbc gcdfb cf fdgbcea decf bgcad defgab | efgacb bgdecf aefcbg cdfe +bg bga acgfdbe gdeb abgce bfcadg efcbda cdeab fcaeg adcegb | dfcabg fecdba gb efgadcb +bg egfcb gcebdf ebg egcfd abdfeg cdefgab dcgb cabfe gefacd | bgfaced fcdge gcadef gb +gdefbc gcedf dcaf aedgb dcfgaeb gdacef fa fbaecg eaf afdge | bdaeg fa efa fa +debc dbfgc edgbcf fgceb egacbf gdfac gdecbfa begdaf db dgb | gbcedf gbd gbeafc adebgf +bgce bdcafge eb fadec edacbg bdfgac cbgad fegbda aeb cebda | deacf afedgb eabdc fbegad +fd edf gcfae gabed dabf ebdcagf eadgf dfcgeb gedfab degbac | abedg df bcaedg fed +agbef aebcfg cegfb ba adfeg bgac fdbcea ebcadgf bea gcdfeb | gcfbe bae eba feadcb +gdbeca beadc eagb ecdgb cefdbg adefbgc fedgac aec ae dfacb | ae ea eacgdfb cfaedg +egfdb ebgcda ceadbfg cfdgea aeb ba cbegaf agbef cfage cbfa | ab aeb fabc efabcgd +fbaecgd bdafc dcgbf fgc bgca cg fcbgda gfdbe fadbec gadcfe | dbcfg gefdb gc dacbfeg +ge gbced efabgd dbagec gbe agce agbdcf dbcef cgfaedb abcdg | bcgedfa efcbd dfgcba cdefb +dcafbg cfegdb gfdeb dbegaf fab abcedfg gbae fdaec adbfe ba | fcdegba fegabd ab gfcabd +gfe fcbe bgdfce gcdbe gedbf cadegb ceagbfd cadfge ef gdbfa | gfdab cfbe bcegd gfe +bdcfae fbecd ecgdab afcd acefb edgfcb acb ca abfdceg egafb | ca edcfb dcfeb cfbeda +dacb edfba cdbgeaf eadfg ecgfbd db ecabgf ceadbf acebf bfd | faebd dbca afecbg fegbca +cdabe edfgca cgefb cfabed cfdbe cfd edabgc ecafbgd dfab fd | gdebac ecdba adfb bcefad +dcgbe gdfeab efca gbdacf fcedb fcd efadcb dbefa fc cegbdfa | fdc fdebca abedf afce +cdbfage fadc bdefga cafegb dag facgb da ebcgd gabcd abcdgf | afbgc edfabg ad bcadg +cfgedba gdafec gafdb fecb aedcbf cbead deagbc adfbc dfc fc | acbfd cbgfaed facedg fcd +gdea gdafbc dfebc gefdc feg ge gfceda cfdga fabegc cbgfead | ecgdf gfe dfceb afcegd +adbfg ebcfg cdbafe acfbdeg cgea gaefb dgbcfe bea bcafge ae | febgc ae ea bea +dcfaeg dcfbag gfcdeba fagb dgacb fgc cedbf fcgdb dbacge gf | fg fbcgd dcgafe fadgbc diff --git a/day08.bqn b/day08.bqn new file mode 100644 index 0000000..d9f1ac0 --- /dev/null +++ b/day08.bqn @@ -0,0 +1,9 @@ +str←•Import"bqn-libs/strings.bqn" +Dec←(10⊸×+⊣)´∘⌽ +d ← 'a'-˜" "⊸str.Split¨¨ " | "⊸str.Split¨ •FLines"day08" + +•Out +´ 2‿3‿4‿7 ∊˜ ≠¨∾1⊑¨d + +c ← 'a'-˜"abcefg"‿"cf"‿"acdeg"‿"acdfg"‿"bdcf"‿"abdfg"‿"abdefg"‿"acf"‿"abcdefg"‿"abcdfg" +P2 ← { ∧∘⊏⟜(+˝(∾𝕨)=⌜↕7)¨𝕩 } +•Out +´Dec¨((P2˜ c) ⊐ P2´)¨d diff --git a/day08.clj b/day08.clj new file mode 100644 index 0000000..18091d8 --- /dev/null +++ b/day08.clj @@ -0,0 +1,33 @@ +(ns org.vuxu.aoc2021.day08 + (:require [clojure.string :as str] + [clojure.set :as set])) + +(def data + (->> (slurp "day08") + str/split-lines + (map #(str/split % #" \| " 2)) + (map (partial map #(str/split % #" "))))) + +(def part1 + (->> data + (map second) + flatten + (map count) + (filter #{2 4 3 7}) ; LCD 1 4 7 8 + count)) +;; => 342 + +(def part2 + (let [canonical-pattern ["abcefg" "cf" "acdeg" "acdfg" "bdcf" + "abdfg" "abdefg" "acf" "abcdefg" "abcdfg"] + freq (frequencies (apply str canonical-pattern)) + dict (zipmap (map #(sort (map freq %)) canonical-pattern) + (range 10))] + (apply + (for [[digits output] data] + (let [line-freq (frequencies (apply str digits))] + (->> output + (map #(sort (map line-freq %))) + (map dict) + (apply str) + parse-long)))))) +;; => 1068933 |