diff options
-rw-r--r-- | AoC2022/07/input | 1040 | ||||
-rw-r--r-- | AoC2022/07/solver.el | 69 |
2 files changed, 1109 insertions, 0 deletions
diff --git a/AoC2022/07/input b/AoC2022/07/input new file mode 100644 index 0000000..77eb5a2 --- /dev/null +++ b/AoC2022/07/input @@ -0,0 +1,1040 @@ +$ cd / +$ ls +dir bsncwlw +dir dssnr +290062 lpj.tpq +183564 rfhsnp.mfv +dir sfb +199911 ttctlvjp +dir vhbnn +253955 vngjfb.nlm +284563 vzgpzlv.hgm +$ cd bsncwlw +$ ls +264332 gzsrhr.snp +94633 ttctlvjp +$ cd .. +$ cd dssnr +$ ls +101990 vmqbwtd.dqv +$ cd .. +$ cd sfb +$ ls +dir dth +dir gmgwq +dir hmvtj +dir jrcgrvp +dir mjqww +234348 nrrtpbqw +dir ntczgz +dir qvfnt +dir tvmv +dir vrsdff +dir wndttgwm +$ cd dth +$ ls +214526 btvzp +$ cd .. +$ cd gmgwq +$ ls +270924 czj.rsc +dir lfnhb +97804 snqqrvwd.hbq +99847 tjcpgqnm.dvv +$ cd lfnhb +$ ls +110202 cvffv.wzr +45842 lfnhb +181410 mjqww.zhl +72379 snqqrvwd.tsb +46957 vdjjgd.lnb +dir vrsdff +$ cd vrsdff +$ ls +191477 jrcgrvp.plv +292376 mjqww +97997 vdjjgd.lnb +5027 zplw.cmd +$ cd .. +$ cd .. +$ cd .. +$ cd hmvtj +$ ls +dir dqvjbhg +$ cd dqvjbhg +$ ls +98579 vdjjgd.lnb +$ cd .. +$ cd .. +$ cd jrcgrvp +$ ls +dir dzrcrcz +3233 lfnhb.frn +dir sln +dir sqtj +268936 ttctlvjp +dir tzqsbwnb +$ cd dzrcrcz +$ ls +218954 bppp.qfg +206406 zwhtbhg.jms +$ cd .. +$ cd sln +$ ls +269167 fvsc +274943 mjtb.gpd +$ cd .. +$ cd sqtj +$ ls +dir cvjwqpz +dir djqjv +11761 frrdhnsz.ltt +dir htc +dir lfnhb +dir mcfdlh +dir mjqww +$ cd cvjwqpz +$ ls +46716 fpd.ljl +$ cd .. +$ cd djqjv +$ ls +dir gplnb +282457 jgbn.zhm +dir jrcgrvp +dir lfnhb +$ cd gplnb +$ ls +dir gqrlz +dir srpcmhq +dir vrsdff +$ cd gqrlz +$ ls +43021 pmshlv +124139 vrsdff +255316 zpgwmgf +$ cd .. +$ cd srpcmhq +$ ls +128669 jrcgrvp +dir lfnhb +243510 vrsdff.pgt +134902 vzmfbcv.pbc +dir znfw +$ cd lfnhb +$ ls +150844 lfnhb +202341 vngjfb.nlm +$ cd .. +$ cd znfw +$ ls +dir cdnh +dir ctpslqg +dir jrcgrvp +dir tmjnj +dir ttfczgwn +$ cd cdnh +$ ls +83983 bhlmzppw.gzp +dir fdvcmbt +14625 fphdhzbw.fnf +dir ndbztbq +217778 rzvzpn.gzv +$ cd fdvcmbt +$ ls +dir hzgmnswh +dir wtt +$ cd hzgmnswh +$ ls +dir wshrmd +$ cd wshrmd +$ ls +314723 vrsdff.rtc +$ cd .. +$ cd .. +$ cd wtt +$ ls +32262 tqsvdvfp.ggd +$ cd .. +$ cd .. +$ cd ndbztbq +$ ls +91717 sgvn.rss +$ cd .. +$ cd .. +$ cd ctpslqg +$ ls +249954 hnpc.cht +119625 vdjjgd.lnb +$ cd .. +$ cd jrcgrvp +$ ls +dir lfnhb +dir prrhq +$ cd lfnhb +$ ls +115317 ncdpc.mvm +$ cd .. +$ cd prrhq +$ ls +78208 mjqww.mhs +280559 qqhtc.tmr +275434 ttctlvjp +$ cd .. +$ cd .. +$ cd tmjnj +$ ls +20439 cgvctg.sqm +69239 ftlrq.pll +127427 gwgpwlg.dhd +dir snqqrvwd +dir vbqdpjp +$ cd snqqrvwd +$ ls +27706 mjsgdblr +64740 vdjjgd.lnb +$ cd .. +$ cd vbqdpjp +$ ls +dir pchgrt +$ cd pchgrt +$ ls +59640 hmtsjzf +$ cd .. +$ cd .. +$ cd .. +$ cd ttfczgwn +$ ls +85314 pmshlv +$ cd .. +$ cd .. +$ cd .. +$ cd vrsdff +$ ls +315614 jrcgrvp.vgn +$ cd .. +$ cd .. +$ cd jrcgrvp +$ ls +184058 wqmmcclb +$ cd .. +$ cd lfnhb +$ ls +201903 cplb +79091 jgbn.zhm +1778 tpjq.qpr +62410 wtvwvw.gwf +$ cd .. +$ cd .. +$ cd htc +$ ls +dir hhlvws +229278 jrcgrvp.phz +dir njh +$ cd hhlvws +$ ls +174639 lfnhb.wbt +174488 qrjsccz.mbm +107151 vrz.ctn +$ cd .. +$ cd njh +$ ls +dir vzhhrvqj +$ cd vzhhrvqj +$ ls +154428 rnhn.nwm +$ cd .. +$ cd .. +$ cd .. +$ cd lfnhb +$ ls +230816 mmq.fqh +dir nbwtcrpl +dir rlz +62597 rnmdwrw.ljf +552 rtw +232443 vdjjgd.lnb +dir vgvq +$ cd nbwtcrpl +$ ls +dir ftflrgzj +86404 mjqww.zqd +159575 mwpd.gwc +dir nsjfj +dir pfg +$ cd ftflrgzj +$ ls +dir glpnz +282475 vrsdff.ppc +$ cd glpnz +$ ls +dir cdw +dir hjntz +dir jdszmcd +250018 mjqww.gdv +$ cd cdw +$ ls +164522 jgbn.zhm +93952 jhdbcd.swb +$ cd .. +$ cd hjntz +$ ls +257626 vdjjgd.lnb +$ cd .. +$ cd jdszmcd +$ ls +dir lfnhb +dir nwmjhbt +$ cd lfnhb +$ ls +144608 jrcgrvp +$ cd .. +$ cd nwmjhbt +$ ls +81512 cnlwmv.pvq +$ cd .. +$ cd .. +$ cd .. +$ cd .. +$ cd nsjfj +$ ls +158675 shsgq +$ cd .. +$ cd pfg +$ ls +98277 lfnhb.tjc +dir snqqrvwd +170691 vtmmz +$ cd snqqrvwd +$ ls +121715 ffr.zpv +105094 jgbn.zhm +$ cd .. +$ cd .. +$ cd .. +$ cd rlz +$ ls +247967 bmlqhfnm +270713 mtg +207128 wvblbnz +$ cd .. +$ cd vgvq +$ ls +209343 jrcgrvp +$ cd .. +$ cd .. +$ cd mcfdlh +$ ls +15958 pbtp.pmh +$ cd .. +$ cd mjqww +$ ls +dir jrcgrvp +dir lfnhb +55522 pmshlv +dir qvmhbp +dir zldldv +$ cd jrcgrvp +$ ls +189839 jrcgrvp +73108 pdzcm.gqm +$ cd .. +$ cd lfnhb +$ ls +dir fgcmvwd +42810 jgbn.zhm +dir jrcgrvp +dir vdpbmtf +$ cd fgcmvwd +$ ls +28530 mjqww.zdr +$ cd .. +$ cd jrcgrvp +$ ls +5386 gpgtds.sdh +$ cd .. +$ cd vdpbmtf +$ ls +284528 crwdp.hhm +54212 pmshlv +$ cd .. +$ cd .. +$ cd qvmhbp +$ ls +dir jrcgrvp +dir ptlmpl +dir vhql +160711 wwt +$ cd jrcgrvp +$ ls +dir ndmprm +254907 rqzhqpt.dbj +dir tvbrzjrq +226311 zjbwrbw +$ cd ndmprm +$ ls +dir jqrdvnbp +dir mjqww +$ cd jqrdvnbp +$ ls +299157 snqqrvwd +$ cd .. +$ cd mjqww +$ ls +dir mjqww +101780 snqqrvwd.fvp +$ cd mjqww +$ ls +40424 pmshlv +$ cd .. +$ cd .. +$ cd .. +$ cd tvbrzjrq +$ ls +172207 bbb.lmg +dir mjqww +dir snqqrvwd +218707 ttctlvjp +289582 vngjfb.nlm +$ cd mjqww +$ ls +dir vrsdff +$ cd vrsdff +$ ls +dir dbfqmmvq +$ cd dbfqmmvq +$ ls +19934 qghnzsv.rgc +$ cd .. +$ cd .. +$ cd .. +$ cd snqqrvwd +$ ls +27161 vdjjgd.lnb +$ cd .. +$ cd .. +$ cd .. +$ cd ptlmpl +$ ls +235908 hlwzt +171817 mbdsf.lvm +$ cd .. +$ cd vhql +$ ls +167713 ddzm.qnz +1725 ggnccf.sbd +dir gmstw +229981 jzp.ldj +80353 lfnhb.qzs +dir tnjnlj +286555 ttctlvjp +$ cd gmstw +$ ls +299744 jrcgrvp.lqt +dir jshshg +dir pmjmngss +145296 vrsdff +152354 vzrwgjpc.msq +$ cd jshshg +$ ls +169710 jgbn.zhm +309539 vnclc +$ cd .. +$ cd pmjmngss +$ ls +305357 mjqww.qph +$ cd .. +$ cd .. +$ cd tnjnlj +$ ls +dir jwtj +dir pghml +$ cd jwtj +$ ls +dir jjtbcdpv +101453 lfnhb +dir ppvbjrhr +dir tplsqph +$ cd jjtbcdpv +$ ls +247459 lprglf.pbt +8862 wjwf.btb +$ cd .. +$ cd ppvbjrhr +$ ls +83453 mjplqgvf.bzc +$ cd .. +$ cd tplsqph +$ ls +300026 nzfjn.plg +dir zwh +$ cd zwh +$ ls +160407 vngjfb.nlm +$ cd .. +$ cd .. +$ cd .. +$ cd pghml +$ ls +88913 bpjf.clf +$ cd .. +$ cd .. +$ cd .. +$ cd .. +$ cd zldldv +$ ls +160867 vngjfb.nlm +$ cd .. +$ cd .. +$ cd .. +$ cd tzqsbwnb +$ ls +dir lfnhb +dir stdnrj +dir wgfvcjcf +dir wrtnvm +$ cd lfnhb +$ ls +230926 wprbvfc.llh +$ cd .. +$ cd stdnrj +$ ls +118152 nrctwt.hpw +$ cd .. +$ cd wgfvcjcf +$ ls +12672 bmcscsw.tvj +$ cd .. +$ cd wrtnvm +$ ls +162743 jgbn.zhm +$ cd .. +$ cd .. +$ cd .. +$ cd mjqww +$ ls +dir bqpmsnv +dir cfzqvmlc +135084 mjqww.zpw +63486 srf +dir tfzbhps +171527 vdjjgd.lnb +dir vrsdff +$ cd bqpmsnv +$ ls +90710 jgbn.zhm +240953 plvbfgp.cvp +$ cd .. +$ cd cfzqvmlc +$ ls +dir vcfwwlb +$ cd vcfwwlb +$ ls +11321 vdjjgd.lnb +$ cd .. +$ cd .. +$ cd tfzbhps +$ ls +300432 brv +273987 jrcgrvp +dir mjqww +dir qjsjj +8449 rjqrnfct +dir rvm +dir vrsdff +117697 zhwbllv.lpj +$ cd mjqww +$ ls +dir mjqww +250614 mzp +dir rfwwp +dir vrsdff +89064 zqzmpqhd.sgm +$ cd mjqww +$ ls +82140 bqgbbwm +$ cd .. +$ cd rfwwp +$ ls +dir cgmzd +dir jrcgrvp +3536 njnpg +40653 vdjjgd.lnb +99587 vngjfb.nlm +$ cd cgmzd +$ ls +75395 jqnhv.qpl +218635 pmshlv +17021 vngjfb.nlm +$ cd .. +$ cd jrcgrvp +$ ls +58428 dhfqqwt.wtn +196643 jgbn.zhm +dir snqqrvwd +309352 vdjjgd.lnb +$ cd snqqrvwd +$ ls +238675 dzpvwv.ncp +69199 lfnhb.mrb +$ cd .. +$ cd .. +$ cd .. +$ cd vrsdff +$ ls +67256 jqmss.lhp +dir jrvsrhlf +101311 lhbmv.bwl +$ cd jrvsrhlf +$ ls +191305 snqqrvwd +$ cd .. +$ cd .. +$ cd .. +$ cd qjsjj +$ ls +dir bljbhwg +dir fbzg +73749 gth.wwq +dir lfnhb +296698 lfnhb.ccj +62939 mjqww +dir rcltts +$ cd bljbhwg +$ ls +7022 ttctlvjp +$ cd .. +$ cd fbzg +$ ls +290427 vlm.wtf +$ cd .. +$ cd lfnhb +$ ls +232147 hchjd.gvt +87988 pbdsbh.mtj +$ cd .. +$ cd rcltts +$ ls +271382 pmshlv +dir whthc +$ cd whthc +$ ls +248784 pvltmhwq.hww +$ cd .. +$ cd .. +$ cd .. +$ cd rvm +$ ls +dir fgblz +219799 tmdlnjw +280804 trs +198792 ttctlvjp +103869 vdjjgd.lnb +117484 vngjfb.nlm +dir vrsdff +$ cd fgblz +$ ls +146821 ftwzjf +34704 ttctlvjp +$ cd .. +$ cd vrsdff +$ ls +dir jfgdp +113986 rslfvqnj +$ cd jfgdp +$ ls +247425 vdjjgd.lnb +215872 vngjfb.nlm +$ cd .. +$ cd .. +$ cd .. +$ cd vrsdff +$ ls +dir rlbbqld +274950 vrsdff.brz +190523 vrsdff.sgs +$ cd rlbbqld +$ ls +dir mjqww +204582 ttctlvjp +$ cd mjqww +$ ls +dir fjpnsv +293683 jgbn.zhm +$ cd fjpnsv +$ ls +dir gssqhzr +dir tnbrwc +$ cd gssqhzr +$ ls +194501 rtqjsrh.qbr +208907 vdjjgd.lnb +$ cd .. +$ cd tnbrwc +$ ls +301363 vrsdff.bjs +$ cd .. +$ cd .. +$ cd .. +$ cd .. +$ cd .. +$ cd .. +$ cd vrsdff +$ ls +243129 tzftr.lnd +54940 vszlnw.nnz +$ cd .. +$ cd .. +$ cd ntczgz +$ ls +dir brzscmg +dir fzcp +$ cd brzscmg +$ ls +253980 jsnwqhts +$ cd .. +$ cd fzcp +$ ls +133626 qpdlplzt.ccr +$ cd .. +$ cd .. +$ cd qvfnt +$ ls +197353 bnmw +dir glzzbcfr +dir rbw +278771 tjsqs.lqr +258759 vdjjgd.lnb +$ cd glzzbcfr +$ ls +205953 jgbn.zhm +207362 snqqrvwd +$ cd .. +$ cd rbw +$ ls +164242 mjqww.lqb +$ cd .. +$ cd .. +$ cd tvmv +$ ls +80194 lpntbv.phh +$ cd .. +$ cd vrsdff +$ ls +dir bgmfwb +dir dvqtdsr +118820 jrcgrvp.nsr +dir pggh +132530 stj.ldg +3436 vwpdb.gmf +dir zlzjmjvn +$ cd bgmfwb +$ ls +dir bqzdswtj +6018 jrcgrvp +276452 jwpms.snh +dir njv +173910 pmshlv +144465 qwqstp +186879 rqchbwl.mwm +dir vrsdff +$ cd bqzdswtj +$ ls +dir jzqcnnw +dir njccj +$ cd jzqcnnw +$ ls +dir fwt +dir rgvmcsb +235477 ttctlvjp +$ cd fwt +$ ls +20557 lfnhb.hqz +$ cd .. +$ cd rgvmcsb +$ ls +89387 snvcfdpf.hvf +$ cd .. +$ cd .. +$ cd njccj +$ ls +262201 lfnhb +200215 ttctlvjp +232220 vngjfb.nlm +$ cd .. +$ cd .. +$ cd njv +$ ls +dir vrsdff +$ cd vrsdff +$ ls +17060 nnvjbqgl +$ cd .. +$ cd .. +$ cd vrsdff +$ ls +dir bjsmnvpp +dir bsgdhgf +dir pgzj +dir snqqrvwd +dir vwn +$ cd bjsmnvpp +$ ls +172378 vngjfb.nlm +$ cd .. +$ cd bsgdhgf +$ ls +32538 dggftf +$ cd .. +$ cd pgzj +$ ls +1788 gsfqvvws.nsd +dir jrg +dir vrsdff +$ cd jrg +$ ls +116492 jgbn.zhm +$ cd .. +$ cd vrsdff +$ ls +dir tjngdssd +$ cd tjngdssd +$ ls +194563 snqqrvwd.gmw +$ cd .. +$ cd .. +$ cd .. +$ cd snqqrvwd +$ ls +dir dlwn +103245 pmshlv +dir pzcl +163325 vngjfb.nlm +40822 vrsdff.chz +$ cd dlwn +$ ls +dir ffhpr +119317 hnb.nzj +$ cd ffhpr +$ ls +131380 bcfwsgs.tzg +209987 jgbn.zhm +286370 pmshlv +$ cd .. +$ cd .. +$ cd pzcl +$ ls +dir mjqww +$ cd mjqww +$ ls +178542 vrsdff.sqs +$ cd .. +$ cd .. +$ cd .. +$ cd vwn +$ ls +268238 vrsdff.mcr +$ cd .. +$ cd .. +$ cd .. +$ cd dvqtdsr +$ ls +109637 gznfwq.tjf +26909 jrcgrvp.gzb +dir pqshn +dir qrdwn +299319 snqqrvwd.dlq +191068 ttctlvjp +dir zgqqb +32751 zzgd +$ cd pqshn +$ ls +292725 sjmctn.ddl +$ cd .. +$ cd qrdwn +$ ls +249329 fmzdmv +dir jrcgrvp +dir snmsbc +158902 vdjjgd.lnb +$ cd jrcgrvp +$ ls +114378 vdjjgd.lnb +$ cd .. +$ cd snmsbc +$ ls +dir ftqwmwh +64765 jgbn.zhm +dir qbcs +$ cd ftqwmwh +$ ls +dir bnqlv +$ cd bnqlv +$ ls +136350 cwlmqt.bbh +dir vrsdff +$ cd vrsdff +$ ls +141840 vngjfb.nlm +228473 vrsdff +$ cd .. +$ cd .. +$ cd .. +$ cd qbcs +$ ls +119659 pmshlv +$ cd .. +$ cd .. +$ cd .. +$ cd zgqqb +$ ls +76559 jgbn.zhm +51194 tfjjcvg.wcz +182300 vdjjgd.lnb +$ cd .. +$ cd .. +$ cd pggh +$ ls +dir bptq +141811 jfggzwlr.qfv +dir mjqww +280055 rvgjwv +47733 tzvslczc +$ cd bptq +$ ls +142261 djwzwblq +dir hzm +171045 jrcgrvp +dir jzdz +65989 pfdm +$ cd hzm +$ ls +dir lwzcrrn +$ cd lwzcrrn +$ ls +75543 rjbvvlns +$ cd .. +$ cd .. +$ cd jzdz +$ ls +29854 rdjhtht +$ cd .. +$ cd .. +$ cd mjqww +$ ls +76340 jrcgrvp.ppr +dir lfnhb +$ cd lfnhb +$ ls +244279 ttctlvjp +$ cd .. +$ cd .. +$ cd .. +$ cd zlzjmjvn +$ ls +116546 vngjfb.nlm +$ cd .. +$ cd .. +$ cd wndttgwm +$ ls +201916 pbjrts.vjz +14494 swbmqtg +$ cd .. +$ cd .. +$ cd vhbnn +$ ls +dir gwj +dir hnsphswl +dir sspz +dir zpgg +$ cd gwj +$ ls +299701 mghnhljr.tmp +$ cd .. +$ cd hnsphswl +$ ls +dir bmpsvbmv +dir ndb +dir pwmfc +dir qrrrt +$ cd bmpsvbmv +$ ls +dir hwpndl +$ cd hwpndl +$ ls +2660 mjqww.bjm +$ cd .. +$ cd .. +$ cd ndb +$ ls +16600 jqdswj.dvp +241104 jscnpf +32178 nwgsvh +$ cd .. +$ cd pwmfc +$ ls +16607 pmshlv +234937 ttctlvjp +127344 vdjjgd.lnb +95778 zgv.src +dir zzvg +$ cd zzvg +$ ls +dir blrd +dir fscnr +147045 smdlbzl +107844 snqqrvwd.gzg +$ cd blrd +$ ls +86042 lfnhb.hpq +$ cd .. +$ cd fscnr +$ ls +135422 zpdlcd +$ cd .. +$ cd .. +$ cd .. +$ cd qrrrt +$ ls +5908 cwwc +dir dgswrljc +dir dlhdg +5261 jgbn.zhm +310282 pmshlv +134603 vngjfb.nlm +202988 zcdtsqq.qfv +$ cd dgswrljc +$ ls +40499 lrttnqm.zbc +312009 pmshlv +$ cd .. +$ cd dlhdg +$ ls +66562 pmshlv +$ cd .. +$ cd .. +$ cd .. +$ cd sspz +$ ls +dir dfs +dir gzwlzc +139140 vngjfb.nlm +222854 vrsdff.bwn +$ cd dfs +$ ls +228281 jjbrp.mjz +204654 nsvv.mjt +309232 qwhfjsnt.ptj +$ cd .. +$ cd gzwlzc +$ ls +dir bsqbbfgz +$ cd bsqbbfgz +$ ls +14589 qgtmg.vgr +$ cd .. +$ cd .. +$ cd .. +$ cd zpgg +$ ls +125276 wfjfpb.wmh diff --git a/AoC2022/07/solver.el b/AoC2022/07/solver.el new file mode 100644 index 0000000..ab97c08 --- /dev/null +++ b/AoC2022/07/solver.el @@ -0,0 +1,69 @@ +;;; solver.el --- Day 07 -*- lexical-binding: t; -*- +;; +;; Copyright (C) 2022 Óscar Nájera +;; +;; Author: Óscar Nájera <hi@oscarnajera.com> +;; Maintainer: Óscar Nájera <hi@oscarnajera.com> +;; Created: December 08, 2022 +;; Modified: December 08, 2022 +;; Version: 0.0.1 +;; Keywords: abbrev bib c calendar comm convenience data docs emulations extensions faces files frames games hardware help hypermedia i18n internal languages lisp local maint mail matching mouse multimedia news outlines processes terminals tex tools unix vc wp +;; Homepage: https://github.com/titan/solver +;; Package-Requires: ((emacs "24.3")) +;; +;; This file is not part of GNU Emacs. +;; +;;; Commentary: +;; +;; Day 07 +;; +;;; Code: + + +(require 'cl-lib) + +(with-temp-buffer + (insert "$ cd / +$ ls +dir a +14848514 b.txt +8504156 c.dat +dir d +$ cd a +$ ls +dir e +29116 f +2557 g +62596 h.lst +$ cd e +$ ls +584 i +$ cd .. +$ cd .. +$ cd d +$ ls +4060174 j +8033020 d.log +5626152 d.ext +7214296 k") + (let ((data (split-string (buffer-string) "\n"))) + (cl-labels ((scan () + (cl-loop for item = (pop data) + while (and item (not (string= "$ cd .." item))) + when (parse item) + collect it)) + (parse (entry) + (pcase (split-string entry) + (`("$" "cd" ,dir) (cons dir (scan))) + (`("$" "ls") nil) + (`("dir" ,dir) nil) + (`(,size ,name) (cons name (string-to-number size)))))) + + (scan) + ))) + + + +(append '(5 6 8) (cons 5 8)) +(provide 'solver) +;;; solver.el ends here |