mirror of
https://github.com/chylex/Advent-of-Code.git
synced 2025-05-17 13:34:03 +02:00
Add 2022 - Day 7 - Part 1
This commit is contained in:
parent
20f7f156e0
commit
2456d3d7a0
24
2022/.idea/runConfigurations/Day_07.xml
Normal file
24
2022/.idea/runConfigurations/Day_07.xml
Normal file
@ -0,0 +1,24 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Day 07" type="PythonConfigurationType" factoryName="Python">
|
||||
<module name="2022" />
|
||||
<option name="INTERPRETER_OPTIONS" value="" />
|
||||
<option name="PARENT_ENVS" value="true" />
|
||||
<envs>
|
||||
<env name="PYTHONUNBUFFERED" value="1" />
|
||||
</envs>
|
||||
<option name="SDK_HOME" value="" />
|
||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/07" />
|
||||
<option name="IS_MODULE_SDK" value="true" />
|
||||
<option name="ADD_CONTENT_ROOTS" value="true" />
|
||||
<option name="ADD_SOURCE_ROOTS" value="true" />
|
||||
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
|
||||
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/07/main.py" />
|
||||
<option name="PARAMETERS" value="" />
|
||||
<option name="SHOW_COMMAND_LINE" value="false" />
|
||||
<option name="EMULATE_TERMINAL" value="false" />
|
||||
<option name="MODULE_MODE" value="false" />
|
||||
<option name="REDIRECT_INPUT" value="false" />
|
||||
<option name="INPUT_FILE" value="" />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
991
2022/07/input.txt
Normal file
991
2022/07/input.txt
Normal file
@ -0,0 +1,991 @@
|
||||
$ cd /
|
||||
$ ls
|
||||
dir blrnnv
|
||||
dir ctfjwl
|
||||
dir dqf
|
||||
135993 dqqbcfr
|
||||
dir ftj
|
||||
125510 fzjdz
|
||||
dir jvtlfbzr
|
||||
31762 lsvw.lwr
|
||||
dir qfstpm
|
||||
dir sbprmc
|
||||
dir svbnljr
|
||||
dir tchbjclg
|
||||
dir wtm
|
||||
dir ztrz
|
||||
$ cd blrnnv
|
||||
$ ls
|
||||
169869 mjjj.wnq
|
||||
$ cd ..
|
||||
$ cd ctfjwl
|
||||
$ ls
|
||||
209537 zzdpcnmt.qbf
|
||||
$ cd ..
|
||||
$ cd dqf
|
||||
$ ls
|
||||
205200 hnbqlmmg
|
||||
80316 lmw.zmd
|
||||
dir mwj
|
||||
122312 tsrwvqbg.tzh
|
||||
$ cd mwj
|
||||
$ ls
|
||||
18195 bddslhrg.twf
|
||||
122813 qfccg.crl
|
||||
$ cd ..
|
||||
$ cd ..
|
||||
$ cd ftj
|
||||
$ ls
|
||||
dir clchr
|
||||
dir hmd
|
||||
40232 vtzlv
|
||||
$ cd clchr
|
||||
$ ls
|
||||
dir sbzf
|
||||
$ cd sbzf
|
||||
$ ls
|
||||
257770 thwhz.pgp
|
||||
$ cd ..
|
||||
$ cd ..
|
||||
$ cd hmd
|
||||
$ ls
|
||||
62643 bddslhrg.qzl
|
||||
dir lfpm
|
||||
277745 sgddpc
|
||||
117478 vjchlsrc.cmh
|
||||
7911 zzdpcnmt.qbf
|
||||
$ cd lfpm
|
||||
$ ls
|
||||
107158 bddslhrg
|
||||
253844 fzjdz.mlw
|
||||
217005 glzsnz.cvs
|
||||
71371 qfccg.crl
|
||||
193163 sdmmmds.nwt
|
||||
dir vlnbm
|
||||
$ cd vlnbm
|
||||
$ ls
|
||||
143113 lwhtsvg.bjm
|
||||
$ cd ..
|
||||
$ cd ..
|
||||
$ cd ..
|
||||
$ cd ..
|
||||
$ cd jvtlfbzr
|
||||
$ ls
|
||||
dir gwz
|
||||
dir hfftvmw
|
||||
dir jlftgw
|
||||
dir nnpvwtvt
|
||||
98713 wtbzpqvb
|
||||
$ cd gwz
|
||||
$ ls
|
||||
161853 blfnwqtm.vhw
|
||||
180524 fbqpql.bbw
|
||||
dir jvrdcf
|
||||
dir ldcmtwvt
|
||||
dir pjm
|
||||
dir qjj
|
||||
$ cd jvrdcf
|
||||
$ ls
|
||||
42681 bddslhrg
|
||||
dir cbcq
|
||||
dir fzjdz
|
||||
dir ghwnd
|
||||
dir gpbhtj
|
||||
dir hsmlb
|
||||
dir mjjj
|
||||
129934 sdmmmds.nwt
|
||||
dir wdvqhn
|
||||
196970 zzdpcnmt.qbf
|
||||
$ cd cbcq
|
||||
$ ls
|
||||
dir hsw
|
||||
262458 lbhzblh.zfn
|
||||
dir qbpvrr
|
||||
205708 sdmmmds.nwt
|
||||
263842 tqcgmwbj.bcn
|
||||
4847 vjchlsrc.cmh
|
||||
72550 wnmpdtrr.zrc
|
||||
$ cd hsw
|
||||
$ ls
|
||||
dir rdvfwbw
|
||||
$ cd rdvfwbw
|
||||
$ ls
|
||||
dir fthdrqnr
|
||||
$ cd fthdrqnr
|
||||
$ ls
|
||||
31974 htnpjdr.wsl
|
||||
$ cd ..
|
||||
$ cd ..
|
||||
$ cd ..
|
||||
$ cd qbpvrr
|
||||
$ ls
|
||||
198987 nnhpdvv.vvn
|
||||
$ cd ..
|
||||
$ cd ..
|
||||
$ cd fzjdz
|
||||
$ ls
|
||||
149832 ldb.qnt
|
||||
183866 nbnzfplj.lrs
|
||||
$ cd ..
|
||||
$ cd ghwnd
|
||||
$ ls
|
||||
177598 ggchv.tsv
|
||||
163367 mjjj
|
||||
13258 pdcf.flm
|
||||
$ cd ..
|
||||
$ cd gpbhtj
|
||||
$ ls
|
||||
dir cvm
|
||||
160598 fcng.sbf
|
||||
272547 ndnlzb
|
||||
285657 pvs.ldf
|
||||
166261 sdmmmds.nwt
|
||||
207433 zzdpcnmt.qbf
|
||||
$ cd cvm
|
||||
$ ls
|
||||
246462 fpwvfs.gpb
|
||||
133303 vjchlsrc.cmh
|
||||
$ cd ..
|
||||
$ cd ..
|
||||
$ cd hsmlb
|
||||
$ ls
|
||||
252425 tqcgmwbj.bcn
|
||||
$ cd ..
|
||||
$ cd mjjj
|
||||
$ ls
|
||||
96351 fvgj
|
||||
272667 qfccg.crl
|
||||
196309 ssv.ljs
|
||||
$ cd ..
|
||||
$ cd wdvqhn
|
||||
$ ls
|
||||
190200 sdmmmds.nwt
|
||||
dir tjgfcs
|
||||
214364 tqcgmwbj.bcn
|
||||
174218 wqpmmgtd
|
||||
$ cd tjgfcs
|
||||
$ ls
|
||||
dir gngb
|
||||
268455 hqctmf.cdg
|
||||
242060 prbwvv
|
||||
$ cd gngb
|
||||
$ ls
|
||||
102313 fhqgpb.cqc
|
||||
77189 mjjj.cdw
|
||||
163701 sdmmmds.nwt
|
||||
$ cd ..
|
||||
$ cd ..
|
||||
$ cd ..
|
||||
$ cd ..
|
||||
$ cd ldcmtwvt
|
||||
$ ls
|
||||
dir bqmbrr
|
||||
dir cfcfnspz
|
||||
dir fzjdz
|
||||
dir gvd
|
||||
dir mpqtgd
|
||||
9560 mqfdcz.wqt
|
||||
75810 shps
|
||||
249000 tqcgmwbj.bcn
|
||||
139099 zdv.zgz
|
||||
dir zpct
|
||||
$ cd bqmbrr
|
||||
$ ls
|
||||
175893 hwrdtwsv.brd
|
||||
$ cd ..
|
||||
$ cd cfcfnspz
|
||||
$ ls
|
||||
dir gmzsn
|
||||
dir gvrfbt
|
||||
105314 mjjj
|
||||
181873 vjchlsrc.cmh
|
||||
$ cd gmzsn
|
||||
$ ls
|
||||
dir bddslhrg
|
||||
$ cd bddslhrg
|
||||
$ ls
|
||||
dir cspptmpm
|
||||
258841 fzjdz.bfs
|
||||
dir npmh
|
||||
72584 qfccg.crl
|
||||
$ cd cspptmpm
|
||||
$ ls
|
||||
239223 fzjdz
|
||||
11003 sdmmmds.nwt
|
||||
73589 tqcgmwbj.bcn
|
||||
251204 vdz.jcd
|
||||
$ cd ..
|
||||
$ cd npmh
|
||||
$ ls
|
||||
186878 bddslhrg
|
||||
264830 bddslhrg.gdq
|
||||
$ cd ..
|
||||
$ cd ..
|
||||
$ cd ..
|
||||
$ cd gvrfbt
|
||||
$ ls
|
||||
200067 zcvjj
|
||||
$ cd ..
|
||||
$ cd ..
|
||||
$ cd fzjdz
|
||||
$ ls
|
||||
dir bddslhrg
|
||||
dir fvqszrj
|
||||
dir gqcdtjzj
|
||||
dir pcfr
|
||||
250120 pqqbpmr
|
||||
dir qbpvrr
|
||||
$ cd bddslhrg
|
||||
$ ls
|
||||
72852 sjn
|
||||
$ cd ..
|
||||
$ cd fvqszrj
|
||||
$ ls
|
||||
dir mmzcqr
|
||||
24439 tqcgmwbj.bcn
|
||||
dir vhpqjr
|
||||
$ cd mmzcqr
|
||||
$ ls
|
||||
dir gzfqggrr
|
||||
$ cd gzfqggrr
|
||||
$ ls
|
||||
162528 frdgcr.gnb
|
||||
$ cd ..
|
||||
$ cd ..
|
||||
$ cd vhpqjr
|
||||
$ ls
|
||||
194144 mjjj
|
||||
$ cd ..
|
||||
$ cd ..
|
||||
$ cd gqcdtjzj
|
||||
$ ls
|
||||
231917 pftb
|
||||
174091 vbzfgtwp
|
||||
$ cd ..
|
||||
$ cd pcfr
|
||||
$ ls
|
||||
dir dtbws
|
||||
76624 qfccg.crl
|
||||
dir qjqjd
|
||||
dir qjsldd
|
||||
$ cd dtbws
|
||||
$ ls
|
||||
dir vwjnsbjm
|
||||
$ cd vwjnsbjm
|
||||
$ ls
|
||||
56502 mjjj.jqj
|
||||
130426 qfglmz
|
||||
23199 vjchlsrc.cmh
|
||||
$ cd ..
|
||||
$ cd ..
|
||||
$ cd qjqjd
|
||||
$ ls
|
||||
71015 qfccg.crl
|
||||
40443 vjchlsrc.cmh
|
||||
$ cd ..
|
||||
$ cd qjsldd
|
||||
$ ls
|
||||
261945 fzjdz.vcw
|
||||
$ cd ..
|
||||
$ cd ..
|
||||
$ cd qbpvrr
|
||||
$ ls
|
||||
138915 fvh.sdp
|
||||
dir mdvqv
|
||||
168843 qbpvrr
|
||||
90599 tchbjclg
|
||||
226671 vjchlsrc.cmh
|
||||
$ cd mdvqv
|
||||
$ ls
|
||||
159050 bddslhrg
|
||||
2691 fzjdz
|
||||
245322 psr
|
||||
7732 zhnbgcc.lsc
|
||||
$ cd ..
|
||||
$ cd ..
|
||||
$ cd ..
|
||||
$ cd gvd
|
||||
$ ls
|
||||
84112 bhnt.gjg
|
||||
18231 gzrgd.vvj
|
||||
dir ntvmrrd
|
||||
234773 rcfbjzj
|
||||
281805 sdmmmds.nwt
|
||||
267837 zzdpcnmt.qbf
|
||||
$ cd ntvmrrd
|
||||
$ ls
|
||||
46209 lwvvwd.rtg
|
||||
$ cd ..
|
||||
$ cd ..
|
||||
$ cd mpqtgd
|
||||
$ ls
|
||||
99833 qbpvrr
|
||||
$ cd ..
|
||||
$ cd zpct
|
||||
$ ls
|
||||
dir bddslhrg
|
||||
272296 znffshsg.jrt
|
||||
$ cd bddslhrg
|
||||
$ ls
|
||||
81585 vjchlsrc.cmh
|
||||
$ cd ..
|
||||
$ cd ..
|
||||
$ cd ..
|
||||
$ cd pjm
|
||||
$ ls
|
||||
147674 rbctzb
|
||||
$ cd ..
|
||||
$ cd qjj
|
||||
$ ls
|
||||
21770 wtht.fpd
|
||||
$ cd ..
|
||||
$ cd ..
|
||||
$ cd hfftvmw
|
||||
$ ls
|
||||
dir bhvzrsv
|
||||
130208 cclgndpd
|
||||
dir fzjdz
|
||||
39285 jtmcp.pjv
|
||||
dir mbgvdmpp
|
||||
dir tchbjclg
|
||||
202920 vjchlsrc.cmh
|
||||
$ cd bhvzrsv
|
||||
$ ls
|
||||
167049 bts
|
||||
dir mjjj
|
||||
257434 qsrpmshg
|
||||
279724 sdmmmds.nwt
|
||||
149934 snpb.zwq
|
||||
254808 tqcgmwbj.bcn
|
||||
dir wgf
|
||||
$ cd mjjj
|
||||
$ ls
|
||||
dir mrlvp
|
||||
$ cd mrlvp
|
||||
$ ls
|
||||
197237 pmwjbf.lmn
|
||||
$ cd ..
|
||||
$ cd ..
|
||||
$ cd wgf
|
||||
$ ls
|
||||
77157 zzdpcnmt.qbf
|
||||
$ cd ..
|
||||
$ cd ..
|
||||
$ cd fzjdz
|
||||
$ ls
|
||||
77499 mjjj.pdq
|
||||
dir shrpdcg
|
||||
180282 zzdpcnmt.qbf
|
||||
$ cd shrpdcg
|
||||
$ ls
|
||||
22528 bddslhrg
|
||||
191369 mjjj.llb
|
||||
35213 sdmmmds.nwt
|
||||
131772 spfmhdpf.wtr
|
||||
284434 tpzg.qjg
|
||||
$ cd ..
|
||||
$ cd ..
|
||||
$ cd mbgvdmpp
|
||||
$ ls
|
||||
220250 fsdzqhc.ljm
|
||||
101355 vnrcwb
|
||||
$ cd ..
|
||||
$ cd tchbjclg
|
||||
$ ls
|
||||
113952 gjbp.qgs
|
||||
$ cd ..
|
||||
$ cd ..
|
||||
$ cd jlftgw
|
||||
$ ls
|
||||
dir bddslhrg
|
||||
210047 cdbch
|
||||
dir dvrb
|
||||
266336 fhvwlg
|
||||
139851 qfccg.crl
|
||||
dir rcqhb
|
||||
176510 vjchlsrc.cmh
|
||||
dir wfrjg
|
||||
$ cd bddslhrg
|
||||
$ ls
|
||||
78175 zzdpcnmt.qbf
|
||||
$ cd ..
|
||||
$ cd dvrb
|
||||
$ ls
|
||||
216103 fzjdz.blg
|
||||
$ cd ..
|
||||
$ cd rcqhb
|
||||
$ ls
|
||||
39727 cgfjm.dpt
|
||||
dir pwb
|
||||
$ cd pwb
|
||||
$ ls
|
||||
39040 sdmmmds.nwt
|
||||
$ cd ..
|
||||
$ cd ..
|
||||
$ cd wfrjg
|
||||
$ ls
|
||||
206877 zzdpcnmt.qbf
|
||||
$ cd ..
|
||||
$ cd ..
|
||||
$ cd nnpvwtvt
|
||||
$ ls
|
||||
264455 czrjz
|
||||
dir nfdv
|
||||
dir nmcp
|
||||
113232 pffgw.hbv
|
||||
dir qrzlrt
|
||||
$ cd nfdv
|
||||
$ ls
|
||||
dir fpldng
|
||||
dir jhj
|
||||
56720 ltv
|
||||
170870 rgvs.ggh
|
||||
$ cd fpldng
|
||||
$ ls
|
||||
157283 vzv.qrq
|
||||
$ cd ..
|
||||
$ cd jhj
|
||||
$ ls
|
||||
172487 qpfh.lpr
|
||||
$ cd ..
|
||||
$ cd ..
|
||||
$ cd nmcp
|
||||
$ ls
|
||||
273633 zzdpcnmt.qbf
|
||||
$ cd ..
|
||||
$ cd qrzlrt
|
||||
$ ls
|
||||
111080 bddslhrg
|
||||
$ cd ..
|
||||
$ cd ..
|
||||
$ cd ..
|
||||
$ cd qfstpm
|
||||
$ ls
|
||||
92950 hjr.zjn
|
||||
252254 sdmmmds.nwt
|
||||
$ cd ..
|
||||
$ cd sbprmc
|
||||
$ ls
|
||||
dir bddslhrg
|
||||
158704 bgnt.vbd
|
||||
dir cddp
|
||||
dir cpf
|
||||
dir hfns
|
||||
276655 phcccdq
|
||||
dir qbpvrr
|
||||
dir srjpcj
|
||||
55405 vhb.mbj
|
||||
$ cd bddslhrg
|
||||
$ ls
|
||||
238260 mjjj
|
||||
$ cd ..
|
||||
$ cd cddp
|
||||
$ ls
|
||||
87685 fzjdz.sbz
|
||||
$ cd ..
|
||||
$ cd cpf
|
||||
$ ls
|
||||
dir tchbjclg
|
||||
$ cd tchbjclg
|
||||
$ ls
|
||||
dir wjcvfvz
|
||||
$ cd wjcvfvz
|
||||
$ ls
|
||||
280711 svmf.czw
|
||||
$ cd ..
|
||||
$ cd ..
|
||||
$ cd ..
|
||||
$ cd hfns
|
||||
$ ls
|
||||
dir bbjnrhf
|
||||
dir cvjtpc
|
||||
101075 ddbml.vff
|
||||
dir gdlqtlv
|
||||
157960 mswfp.wcj
|
||||
187182 qddfchn.dpg
|
||||
59533 rfjvzcq
|
||||
47332 wszmlq.nbt
|
||||
$ cd bbjnrhf
|
||||
$ ls
|
||||
269590 dgmjpzcz
|
||||
dir mjjj
|
||||
84955 mjjj.jqn
|
||||
dir mwqvvsnt
|
||||
dir qbpvrr
|
||||
dir qtdmwqcj
|
||||
131930 tqcgmwbj.bcn
|
||||
dir vvwb
|
||||
$ cd mjjj
|
||||
$ ls
|
||||
dir hvvh
|
||||
$ cd hvvh
|
||||
$ ls
|
||||
235980 vmmvp.sbh
|
||||
$ cd ..
|
||||
$ cd ..
|
||||
$ cd mwqvvsnt
|
||||
$ ls
|
||||
242698 mjjj.qbm
|
||||
15137 rncwrgjl.jfr
|
||||
158528 sdmmmds.nwt
|
||||
$ cd ..
|
||||
$ cd qbpvrr
|
||||
$ ls
|
||||
dir gpc
|
||||
$ cd gpc
|
||||
$ ls
|
||||
184310 lqfgplfg
|
||||
$ cd ..
|
||||
$ cd ..
|
||||
$ cd qtdmwqcj
|
||||
$ ls
|
||||
30238 cfpng.fnl
|
||||
284340 gst
|
||||
dir lvcjcglg
|
||||
82263 twmnlqcq
|
||||
78023 zzdpcnmt.qbf
|
||||
$ cd lvcjcglg
|
||||
$ ls
|
||||
225027 lsdrg.wqv
|
||||
$ cd ..
|
||||
$ cd ..
|
||||
$ cd vvwb
|
||||
$ ls
|
||||
184590 trg.vmc
|
||||
156231 zzdpcnmt.qbf
|
||||
$ cd ..
|
||||
$ cd ..
|
||||
$ cd cvjtpc
|
||||
$ ls
|
||||
dir whqnlc
|
||||
$ cd whqnlc
|
||||
$ ls
|
||||
66362 jnsprdt.vrs
|
||||
dir tchbjclg
|
||||
dir zhw
|
||||
$ cd tchbjclg
|
||||
$ ls
|
||||
227846 vqjtc.pld
|
||||
$ cd ..
|
||||
$ cd zhw
|
||||
$ ls
|
||||
dir bgwcrp
|
||||
$ cd bgwcrp
|
||||
$ ls
|
||||
114175 dftv
|
||||
$ cd ..
|
||||
$ cd ..
|
||||
$ cd ..
|
||||
$ cd ..
|
||||
$ cd gdlqtlv
|
||||
$ ls
|
||||
121215 gbltpcv.prz
|
||||
41387 tqcgmwbj.bcn
|
||||
$ cd ..
|
||||
$ cd ..
|
||||
$ cd qbpvrr
|
||||
$ ls
|
||||
79921 tqcgmwbj.bcn
|
||||
263185 vjchlsrc.cmh
|
||||
$ cd ..
|
||||
$ cd srjpcj
|
||||
$ ls
|
||||
106650 fzjdz.tdf
|
||||
135245 qfccg.crl
|
||||
97014 tvlmvqm
|
||||
$ cd ..
|
||||
$ cd ..
|
||||
$ cd svbnljr
|
||||
$ ls
|
||||
286919 lwvw.zlr
|
||||
$ cd ..
|
||||
$ cd tchbjclg
|
||||
$ ls
|
||||
dir bljmjwm
|
||||
dir hsjww
|
||||
dir ptfsh
|
||||
dir qbpvrr
|
||||
147832 qfccg.crl
|
||||
$ cd bljmjwm
|
||||
$ ls
|
||||
dir cqtmhzbf
|
||||
dir mfpcdbg
|
||||
dir qlzg
|
||||
dir qtdh
|
||||
dir tbdff
|
||||
dir tchbjclg
|
||||
211603 zhr.gwl
|
||||
$ cd cqtmhzbf
|
||||
$ ls
|
||||
dir mmbgqlm
|
||||
150758 tqcgmwbj.bcn
|
||||
dir ztcbmbw
|
||||
$ cd mmbgqlm
|
||||
$ ls
|
||||
93439 bddslhrg.gnm
|
||||
25644 qbpvrr.jhm
|
||||
$ cd ..
|
||||
$ cd ztcbmbw
|
||||
$ ls
|
||||
dir cmwwg
|
||||
dir stgmndfd
|
||||
$ cd cmwwg
|
||||
$ ls
|
||||
239158 bfl.pwl
|
||||
dir dbvnwz
|
||||
17700 pqtpmpp
|
||||
dir tchbjclg
|
||||
$ cd dbvnwz
|
||||
$ ls
|
||||
217821 bzgsbc.zzp
|
||||
$ cd ..
|
||||
$ cd tchbjclg
|
||||
$ ls
|
||||
dir tpdtglwp
|
||||
52714 vjchlsrc.cmh
|
||||
111040 zzdpcnmt.qbf
|
||||
$ cd tpdtglwp
|
||||
$ ls
|
||||
287567 jmddscd
|
||||
$ cd ..
|
||||
$ cd ..
|
||||
$ cd ..
|
||||
$ cd stgmndfd
|
||||
$ ls
|
||||
38426 bll.pww
|
||||
$ cd ..
|
||||
$ cd ..
|
||||
$ cd ..
|
||||
$ cd mfpcdbg
|
||||
$ ls
|
||||
dir trjgzcj
|
||||
$ cd trjgzcj
|
||||
$ ls
|
||||
dir hngr
|
||||
268655 lgrwtch
|
||||
258843 pbpnjf.tmg
|
||||
100112 qbh
|
||||
72784 qbpvrr.cpg
|
||||
dir vbmqtf
|
||||
197735 vjchlsrc.cmh
|
||||
$ cd hngr
|
||||
$ ls
|
||||
82873 cwbmqp.llb
|
||||
261780 hsgwfv.pfn
|
||||
42859 ljt
|
||||
dir tchbjclg
|
||||
$ cd tchbjclg
|
||||
$ ls
|
||||
dir fhsgvttf
|
||||
253131 gtghn
|
||||
dir nzpcvjhp
|
||||
dir tpqrqtqj
|
||||
$ cd fhsgvttf
|
||||
$ ls
|
||||
56727 mjjj.vzf
|
||||
$ cd ..
|
||||
$ cd nzpcvjhp
|
||||
$ ls
|
||||
dir bddslhrg
|
||||
dir blhrls
|
||||
$ cd bddslhrg
|
||||
$ ls
|
||||
242433 vpvpqtqb.dfr
|
||||
$ cd ..
|
||||
$ cd blhrls
|
||||
$ ls
|
||||
110313 fzjdz.qtf
|
||||
$ cd ..
|
||||
$ cd ..
|
||||
$ cd tpqrqtqj
|
||||
$ ls
|
||||
dir dfjmpvj
|
||||
114636 gmqqrtv
|
||||
dir mjjj
|
||||
175067 wggfznff
|
||||
$ cd dfjmpvj
|
||||
$ ls
|
||||
174485 sjzg
|
||||
$ cd ..
|
||||
$ cd mjjj
|
||||
$ ls
|
||||
111397 pslm.fjf
|
||||
$ cd ..
|
||||
$ cd ..
|
||||
$ cd ..
|
||||
$ cd ..
|
||||
$ cd vbmqtf
|
||||
$ ls
|
||||
151429 tchbjclg.tzm
|
||||
$ cd ..
|
||||
$ cd ..
|
||||
$ cd ..
|
||||
$ cd qlzg
|
||||
$ ls
|
||||
127640 bddslhrg.wbj
|
||||
dir fzjdz
|
||||
dir ghllcw
|
||||
62733 qfccg.crl
|
||||
96986 qwgh
|
||||
268380 vjchlsrc.cmh
|
||||
$ cd fzjdz
|
||||
$ ls
|
||||
153535 gcjss
|
||||
$ cd ..
|
||||
$ cd ghllcw
|
||||
$ ls
|
||||
dir fzjdz
|
||||
dir hwfm
|
||||
2536 jglh.njg
|
||||
dir mjjj
|
||||
dir mlhwcg
|
||||
200842 qfccg.crl
|
||||
dir tchbjclg
|
||||
246542 tqcgmwbj.bcn
|
||||
dir tqtsl
|
||||
dir vpn
|
||||
$ cd fzjdz
|
||||
$ ls
|
||||
124920 jzsbrwj
|
||||
dir wtvfgcrq
|
||||
$ cd wtvfgcrq
|
||||
$ ls
|
||||
dir ltnzjbl
|
||||
187917 mjjj.svp
|
||||
dir nvgrzrbr
|
||||
dir pngcwl
|
||||
$ cd ltnzjbl
|
||||
$ ls
|
||||
151460 jmc.zjf
|
||||
252590 tchbjclg
|
||||
$ cd ..
|
||||
$ cd nvgrzrbr
|
||||
$ ls
|
||||
193994 qbpvrr.tsv
|
||||
152776 tchbjclg.swm
|
||||
243770 vqzs.hjp
|
||||
$ cd ..
|
||||
$ cd pngcwl
|
||||
$ ls
|
||||
74603 bddslhrg
|
||||
288915 vjchlsrc.cmh
|
||||
$ cd ..
|
||||
$ cd ..
|
||||
$ cd ..
|
||||
$ cd hwfm
|
||||
$ ls
|
||||
dir qbpvrr
|
||||
92630 vjchlsrc.cmh
|
||||
$ cd qbpvrr
|
||||
$ ls
|
||||
dir vlwbhgnv
|
||||
$ cd vlwbhgnv
|
||||
$ ls
|
||||
5248 tchbjclg
|
||||
$ cd ..
|
||||
$ cd ..
|
||||
$ cd ..
|
||||
$ cd mjjj
|
||||
$ ls
|
||||
255751 qfccg.crl
|
||||
$ cd ..
|
||||
$ cd mlhwcg
|
||||
$ ls
|
||||
115287 pfmch.ncr
|
||||
$ cd ..
|
||||
$ cd tchbjclg
|
||||
$ ls
|
||||
dir jgrmrzlh
|
||||
155900 jpljl.fnw
|
||||
$ cd jgrmrzlh
|
||||
$ ls
|
||||
dir mjjj
|
||||
96116 qbpvrr
|
||||
270714 tqcgmwbj.bcn
|
||||
$ cd mjjj
|
||||
$ ls
|
||||
59415 dpdgtz
|
||||
47363 twghmhf.qhf
|
||||
194434 vbnppl.fws
|
||||
$ cd ..
|
||||
$ cd ..
|
||||
$ cd ..
|
||||
$ cd tqtsl
|
||||
$ ls
|
||||
34243 qqf
|
||||
131945 qtplsbwd
|
||||
$ cd ..
|
||||
$ cd vpn
|
||||
$ ls
|
||||
286479 sdmmmds.nwt
|
||||
$ cd ..
|
||||
$ cd ..
|
||||
$ cd ..
|
||||
$ cd qtdh
|
||||
$ ls
|
||||
215668 nhfpn
|
||||
$ cd ..
|
||||
$ cd tbdff
|
||||
$ ls
|
||||
48347 qfccg.crl
|
||||
178091 vbsqcnmm
|
||||
$ cd ..
|
||||
$ cd tchbjclg
|
||||
$ ls
|
||||
dir bddslhrg
|
||||
dir cwn
|
||||
251313 hll.ctt
|
||||
dir qbpvrr
|
||||
dir scsp
|
||||
$ cd bddslhrg
|
||||
$ ls
|
||||
dir pqtj
|
||||
185542 qbpvrr
|
||||
dir tchbjclg
|
||||
$ cd pqtj
|
||||
$ ls
|
||||
141015 jtwpnb.wvf
|
||||
17260 lgvbns.pvt
|
||||
$ cd ..
|
||||
$ cd tchbjclg
|
||||
$ ls
|
||||
dir btsmnvn
|
||||
237149 hhgbtf.zzs
|
||||
258581 lwvfgbdj.gpp
|
||||
31561 mjjj
|
||||
240514 qbwq
|
||||
90283 qfccg.crl
|
||||
$ cd btsmnvn
|
||||
$ ls
|
||||
dir bddslhrg
|
||||
dir qbpvrr
|
||||
$ cd bddslhrg
|
||||
$ ls
|
||||
144007 tchbjclg.qql
|
||||
$ cd ..
|
||||
$ cd qbpvrr
|
||||
$ ls
|
||||
211075 mjjj
|
||||
$ cd ..
|
||||
$ cd ..
|
||||
$ cd ..
|
||||
$ cd ..
|
||||
$ cd cwn
|
||||
$ ls
|
||||
67908 gldrw
|
||||
231112 qbpvrr
|
||||
$ cd ..
|
||||
$ cd qbpvrr
|
||||
$ ls
|
||||
4482 fzjdz.lzr
|
||||
134244 rnscgpv.tvg
|
||||
211213 tmvzclz.mjg
|
||||
107771 wvzs.nns
|
||||
$ cd ..
|
||||
$ cd scsp
|
||||
$ ls
|
||||
30654 zzdpcnmt.qbf
|
||||
$ cd ..
|
||||
$ cd ..
|
||||
$ cd ..
|
||||
$ cd hsjww
|
||||
$ ls
|
||||
12233 crzr.jrf
|
||||
dir qbpvrr
|
||||
$ cd qbpvrr
|
||||
$ ls
|
||||
dir bddslhrg
|
||||
54681 fzjdz.wzv
|
||||
212670 hpmzrq
|
||||
dir mcvbjw
|
||||
138779 nhsdjmjj.szh
|
||||
dir nllvlzfr
|
||||
217275 tqcgmwbj.bcn
|
||||
$ cd bddslhrg
|
||||
$ ls
|
||||
261081 lbdqrjjp.ffj
|
||||
244506 wvn.ttr
|
||||
55843 zbng.zmm
|
||||
$ cd ..
|
||||
$ cd mcvbjw
|
||||
$ ls
|
||||
149468 rcvbqhh
|
||||
$ cd ..
|
||||
$ cd nllvlzfr
|
||||
$ ls
|
||||
162791 rdrhrnzc
|
||||
$ cd ..
|
||||
$ cd ..
|
||||
$ cd ..
|
||||
$ cd ptfsh
|
||||
$ ls
|
||||
163959 bddslhrg.wwb
|
||||
dir hthjj
|
||||
dir hwpv
|
||||
222930 ndvqsfbs.rfb
|
||||
dir rgrcfr
|
||||
dir rvrsrfl
|
||||
95254 tqcgmwbj.bcn
|
||||
282463 vjchlsrc.cmh
|
||||
181699 zzdpcnmt.qbf
|
||||
$ cd hthjj
|
||||
$ ls
|
||||
101683 dthb.hwv
|
||||
112759 mjmdfgl.vdz
|
||||
191795 whtfg
|
||||
$ cd ..
|
||||
$ cd hwpv
|
||||
$ ls
|
||||
244334 fzjdz.pgp
|
||||
$ cd ..
|
||||
$ cd rgrcfr
|
||||
$ ls
|
||||
dir wpslpf
|
||||
$ cd wpslpf
|
||||
$ ls
|
||||
87578 mjjj
|
||||
$ cd ..
|
||||
$ cd ..
|
||||
$ cd rvrsrfl
|
||||
$ ls
|
||||
dir qbpvrr
|
||||
$ cd qbpvrr
|
||||
$ ls
|
||||
dir gqv
|
||||
dir hfg
|
||||
dir lpbc
|
||||
dir ppp
|
||||
16805 snlhrz
|
||||
29365 wnd.mdj
|
||||
$ cd gqv
|
||||
$ ls
|
||||
229300 tqcgmwbj.bcn
|
||||
$ cd ..
|
||||
$ cd hfg
|
||||
$ ls
|
||||
1680 hcmmjtbq.wcv
|
||||
$ cd ..
|
||||
$ cd lpbc
|
||||
$ ls
|
||||
100372 lqf
|
||||
88156 sddtdz
|
||||
$ cd ..
|
||||
$ cd ppp
|
||||
$ ls
|
||||
79608 tchbjclg
|
||||
$ cd ..
|
||||
$ cd ..
|
||||
$ cd ..
|
||||
$ cd ..
|
||||
$ cd qbpvrr
|
||||
$ ls
|
||||
22955 zzdpcnmt.qbf
|
||||
$ cd ..
|
||||
$ cd ..
|
||||
$ cd wtm
|
||||
$ ls
|
||||
4584 qfccg.crl
|
||||
$ cd ..
|
||||
$ cd ztrz
|
||||
$ ls
|
||||
187968 fzjdz.thw
|
76
2022/07/main.py
Normal file
76
2022/07/main.py
Normal file
@ -0,0 +1,76 @@
|
||||
from typing import Optional
|
||||
|
||||
from utils.input import read_input_lines
|
||||
|
||||
|
||||
class Directory:
|
||||
def __init__(self, name: str, parent: Optional["Directory"]) -> None:
|
||||
self.name = name
|
||||
self.parent = parent if parent is not None else self
|
||||
self.child_directories = dict()
|
||||
self.child_files = dict()
|
||||
self.total_size = None
|
||||
|
||||
def record_directory(self, name: str) -> None:
|
||||
if name not in self.child_directories:
|
||||
self.child_directories[name] = Directory(name, self)
|
||||
self.total_size = None
|
||||
|
||||
def record_file(self, name: str, size: int) -> None:
|
||||
self.child_files[name] = size
|
||||
self.total_size = None
|
||||
|
||||
def get_size(self) -> int:
|
||||
if self.total_size is None:
|
||||
self.total_size = sum(self.child_files.values()) + sum(child.get_size() for child in self.child_directories.values())
|
||||
|
||||
return self.total_size
|
||||
|
||||
def collect_directories(self, target_list: list["Directory"]) -> None:
|
||||
target_list.append(self)
|
||||
|
||||
for child in self.child_directories.values():
|
||||
child.collect_directories(target_list)
|
||||
|
||||
|
||||
class Session:
|
||||
def __init__(self) -> None:
|
||||
self.root_directory = Directory("/", None)
|
||||
self.current_directory = self.root_directory
|
||||
|
||||
def handle_command(self, command: str) -> None:
|
||||
if command == "ls":
|
||||
return
|
||||
|
||||
(left, right) = command.split(" ", maxsplit = 1)
|
||||
|
||||
if left == "cd":
|
||||
if right == "/":
|
||||
self.current_directory = self.root_directory
|
||||
elif right == "..":
|
||||
self.current_directory = self.current_directory.parent
|
||||
else:
|
||||
self.current_directory = self.current_directory.child_directories[right]
|
||||
|
||||
def handle_listing(self, size_or_type: str, name: str) -> None:
|
||||
if size_or_type == "dir":
|
||||
self.current_directory.record_directory(name)
|
||||
else:
|
||||
self.current_directory.record_file(name, int(size_or_type))
|
||||
|
||||
|
||||
session = Session()
|
||||
|
||||
for line in read_input_lines():
|
||||
(left, right) = line.split(" ", maxsplit = 1)
|
||||
|
||||
if left == "$":
|
||||
session.handle_command(right)
|
||||
else:
|
||||
session.handle_listing(left, right)
|
||||
|
||||
all_directories = list()
|
||||
session.root_directory.collect_directories(all_directories)
|
||||
|
||||
total_size_of_interesting_directories = sum(directory.get_size() for directory in all_directories if directory.get_size() <= 100_000)
|
||||
print(f"Total size of interesting directories: {total_size_of_interesting_directories}")
|
@ -86,5 +86,5 @@ The versions should not matter, but I used Visual Studio 2019 with `MSVC v142 (1
|
||||
| 2021 | 04 | Kotlin | / | 2022 | 04 | Python |
|
||||
| 2021 | 05 | Kotlin | / | 2022 | 05 | Python |
|
||||
| 2021 | 06 | Kotlin | / | 2022 | 06 | Python |
|
||||
| 2021 | 07 | Kotlin | / | | | |
|
||||
| 2021 | 07 | Kotlin | / | 2022 | 07 | Python |
|
||||
| 2021 | 08 | Kotlin | / | | | |
|
||||
|
Loading…
Reference in New Issue
Block a user