This commit is contained in:
Dory 2023-12-08 17:10:35 -08:00
parent d5ee7282e9
commit d9980e3b33
10 changed files with 1844 additions and 0 deletions

801
08/input.pl Normal file
View File

@ -0,0 +1,801 @@
:- op(700, xfx, to).
direction("lrlrrrlrrrlllrlrrllrlrrrlrlrrrlrlrrrlrlrrrlrrrlrllrrrlrlrlrrlrrlrlrrlrrlrrllrrrlrrrlrrlrrlrrlrrrllrrlrlrrlrlrrlrrlrlrrlrrllrlrrrlrrlrrrllrlrlrllrllrllrlrrllrrlrlrlrrlrllrrrllrrrlrrllrrrlrrrlrlrrrllrrrlrlrrrlllrrrlrlrlrrrlrrrlrrrlrlrrlllrrlrrrllrlrrrlrlrlllrrlrlrrrlrlrrrr").
gnk to lbv-qnp.
pjq to ghf-fjf.
klm to ttr-bql.
ldt to fxs-fbb.
tkh to nbh-jrn.
qnd to kjc-srd.
sng to bqp-lxn.
gms to jdn-nkm.
ntl to pts-dhk.
nbn to ffd-prl.
ncp to qkb-hmr.
nqt to rdk-bhc.
tdk to ghm-ghm.
bjs to tgc-gbj.
xnh to ggj-tkl.
nkv to gtc-ncp.
hfl to lqq-rvt.
hkc to bqm-nkp.
kch to gjg-gjg.
mfd to crd-vdp.
fnz to xsm-pqq.
nvt to tdn-jvt.
pcq to hld-bkq.
gpf to mnj-ngp.
pcx to lpd-bjk.
ccg to tts-tts.
bgg to tqp-nfg.
hsp to dvs-qqm.
tsx to gbv-kxm.
rkk to bnc-fnz.
hvj to rpd-mgb.
cxc to btd-vdn.
nbh to sqq-pjb.
cqn to srv-mcf.
lpd to ppr-rhs.
bkm to fjv-xtv.
kqv to pck-dxj.
vcl to pdn-mtc.
jvs to qqp-bdm.
mjt to jcx-nrr.
vsr to nqt-kng.
nkm to hnf-bfd.
hgj to bnt-kfk.
vmc to qnd-rkc.
djg to prd-lbd.
jct to nfm-njf.
fpx to njf-nfm.
hpd to snt-jxr.
qlk to kxv-klf.
hmr to tdk-cxj.
rql to qdp-gbq.
vdt to bgp-mxh.
pfv to tnh-lqv.
ttf to flv-skm.
qkl to jnb-skx.
rxc to qfp-vmv.
ngj to qpn-gsf.
mpz to jvh-bnb.
fpb to xnh-nms.
lqp to sng-vvm.
hqf to mnm-vhl.
xxj to prl-ffd.
kph to ttf-snq.
jdt to kch-jmc.
krk to pcx-bmg.
fjv to qlk-qsn.
mpg to ljg-pkd.
tch to rrq-qtl.
sds to jqr-bxr.
rkr to kvd-ngn.
tvj to xgs-pcq.
vsq to nhp-qqs.
rdk to xtd-mhb.
sgp to prp-xjd.
svn to bkm-nsv.
sjc to dgl-frh.
njx to trn-mhn.
rcg to bsn-dqr.
hxj to kdl-srr.
bqz to pql-frm.
nks to shm-shm.
fpj to stm-ctn.
sfm to pvc-tgm.
vss to mgv-jls.
dgl to nbb-bst.
xrq to lpn-mkf.
rsz to svm-xmg.
ttk to kst-mgq.
fjf to crc-rxf.
cmt to hph-kpl.
sdr to ltd-tvk.
bst to kqv-qph.
dgt to bcq-mlx.
qpn to mmd-lkl.
shm to frm-pql.
xdd to qcs-vmd.
snq to flv-skm.
tlf to qtc-grk.
cpb to dfx-gdn.
brj to ldr-cdr.
jnl to jtd-smv.
ftg to vrn-vrn.
gbj to vgh-djt.
tgs to fpb-qgt.
mhb to dkl-kmx.
gnh to sfq-jxk.
ltd to xjq-mbl.
pcr to jdd-ktl.
dmd to khc-kvh.
ftt to ltb-bld.
lmt to rkc-qnd.
jgt to fdt-vdd.
mdv to xts-mrf.
plv to kxc-cnm.
prj to shc-mnl.
pml to grx-qgj.
vvm to lxn-bqp.
ngn to gbg-xjx.
vcg to srv-mcf.
qfp to tjs-xpd.
lvx to fpx-jct.
rbc to drm-vhc.
xkt to ccg-flm.
sdh to bnf-gkn.
bvq to qsh-vsq.
smv to skn-hhj.
dbd to rsm-pkb.
dqr to hvs-dvc.
mnk to dxt-cld.
ffd to dlf-jpq.
gbg to tkp-kpm.
chk to mmt-mqc.
bxr to gmv-bgt.
sfd to xsp-sds.
prt to hdb-rcg.
qxj to qqt-bhg.
tgr to tqd-tjm.
gjg to rvq-tvj.
bfd to sgs-nch.
pnd to bpl-tkv.
jpg to gnq-qkp.
fdt to npf-sff.
dlx to xvp-bnr.
snt to qfr-rmt.
dnd to tvk-ltd.
ssf to llf-frv.
drk to ftg-lbt.
vqv to jvs-rrh.
xbv to dsc-nrl.
cvl to krf-njx.
xgp to bqj-rxc.
mlx to tbd-qsg.
jdf to ccg-ccg.
gvn to scn-pkh.
ncb to gkn-bnf.
llf to pnd-lmm.
shx to txm-prj.
knl to ksl-vqq.
jsk to sqd-mpg.
pps to khc-kvh.
nkj to dbd-rfb.
cnm to fcb-dhp.
txj to dbj-dlx.
qsh to qqs-nhp.
brc to pln-gms.
bhp to jnh-clp.
bql to sdr-dnd.
tgc to vgh-djt.
mhm to vhv-hfp.
ngp to hnn-hdx.
skm to sxh-ptr.
tfn to smk-gxl.
nsr to glb-pch.
rhs to xcx-rfh.
bnc to pqq-xsm.
xjx to kpm-tkp.
lft to tmh-ssp.
kvd to xjx-gbg.
skx to ngf-ntc.
ckq to fcl-mrm.
mtc to pbm-tgr.
rhv to tgs-kdv.
mmd to vmj-tfn.
psm to xdk-gsg.
kxm to rdn-xps.
pln to nkm-jdn.
hdk to skx-jnb.
xgs to hld-bkq.
fmb to phl-tfg.
lhh to xrf-stp.
ltb to tdc-bcx.
frv to lmm-pnd.
grk to fdh-cqd.
nrr to hns-kbj.
bgt to ldt-vbj.
srd to cbg-dmm.
knf to dvl-knl.
kxc to fcb-dhp.
ghb to nnj-qmh.
pgq to jjx-vsf.
skb to xxt-ntm.
lxp to prd-lbd.
prl to jpq-dlf.
frm to lbn-cpb.
ksl to fpt-ttc.
crc to rcl-hqf.
svm to bjs-xkd.
pxb to pmc-hpd.
jpq to mkj-mkc.
ttr to dnd-sdr.
cbh to ftd-jjq.
xps to nsp-lss.
kmx to qsl-sjc.
cld to mdp-ckq.
gxv to mkk-dbb.
bqp to tqh-lkn.
ftb to gjq-gxv.
kpl to drr-rsz.
mkf to sdh-ncb.
ssp to cbn-xcf.
xjq to nnd-tpt.
ntt to ndj-qfb.
plf to nbh-jrn.
xdk to gpf-fsg.
ntc to dgt-xrb.
sgj to qmh-nnj.
tnh to vgb-fdr.
dfx to hfc-ktx.
dbj to xvp-bnr.
vdd to sff-npf.
jkl to frt-cvl.
xsp to bxr-jqr.
dbp to psr-ljs.
khc to mjt-ktp.
tkp to vrx-gvn.
dkl to sjc-qsl.
dlp to xxj-nbn.
kln to hrp-jpm.
tpp to nhj-pcr.
qvf to qnp-lbv.
vmd to ctf-sfm.
nfm to qkl-hdk.
mcf to bjv-jxl.
pqg to xtq-qmc.
bgp to hft-ktd.
pts to ddg-rbc.
jls to shl-vpt.
dht to npc-krp.
tjm to khm-bxb.
trh to ndj-qfb.
ctf to pvc-tgm.
pmj to bhp-tdf.
aaa to mpf-vmm.
xcf to lvx-fnt.
frh to bst-nbb.
qll to hdb-rcg.
xvp to qhd-pml.
bnx to tlq-tsx.
bxb to jsj-kdq.
fpt to lbc-vjf.
fcb to tjk-mjd.
kng to rdk-bhc.
dbb to rfx-flk.
lqq to rtp-hgj.
lbt to vrn-rlt.
xkd to gbj-tgc.
lkn to xdd-cpc.
xhm to cnm-kxc.
dtc to qqt-bhg.
bpl to dms-gqc.
qpp to mrf-xts.
prk to nkp-bqm.
mgs to mpg-sqd.
stm to mts-ghd.
skd to mgv-jls.
qph to dxj-pck.
hdb to dqr-bsn.
dsc to vxm-chk.
tqf to gjt-fnj.
fxs to ghq-bvq.
sff to hkc-prk.
drr to xmg-svm.
rkp to xxn-ldq.
nnj to klg-hfl.
vjf to hmj-rdc.
lxn to tqh-lkn.
cxj to ghm-cmt.
hmc to gms-pln.
ljs to jdf-xkt.
xch to ttr-bql.
lkg to qxj-dtc.
qfb to mht-cfl.
rdn to lss-nsp.
dhs to shm-bqz.
nkt to gsg-xdk.
mch to htp-blc.
nvx to mgs-jsk.
qtc to fdh-fdh.
nnd to dgp-lbf.
gjv to xhm-plv.
gsg to fsg-gpf.
bnv to stm-ctn.
ldq to mch-gxs.
mhn to kph-pkc.
lbf to pps-dmd.
qdp to nkv-hsq.
mpf to mnk-lth.
dhq to cdr-ldr.
vmm to mnk-lth.
hft to brc-hmc.
ltr to nkt-psm.
hdx to gjc-ftt.
ghf to rxf-crc.
bkq to ftb-hjh.
bxx to njc-npk.
fvp to brg-ntj.
rdc to lht-vmg.
jkt to qpp-mdv.
pvp to ghb-sgj.
xxn to gxs-mch.
shc to gnh-pcj.
gsf to lkl-mmd.
krp to mgl-vgq.
jxk to tgn-tjp.
mgq to xrq-vbn.
fln to mgb-rpd.
dhp to mjd-tjk.
sqq to dvp-vcd.
hfh to cbh-jmm.
mbp to ndf-tfk.
klg to rvt-lqq.
npf to prk-hkc.
nms to ggj-tkl.
qqp to cgm-tch.
sfg to nvg-nsr.
rvq to xgs-pcq.
sqd to pkd-ljg.
jcx to hns-kbj.
qsn to kxv-klf.
glx to nkt-psm.
tjs to gjv-mpk.
qlj to xjd-prp.
nsv to fjv-xtv.
gxx to rfb-dbd.
hsr to brg-ntj.
hbf to cdc-nxl.
xss to psr-ljs.
qtl to tqf-hqm.
tkl to dnf-pvp.
brk to jkq-jkk.
scn to mfc-pmj.
gmv to vbj-ldt.
hns to lmt-vmc.
rgr to ntt-trh.
pnc to kch-kch.
xnk to jnl-qfh.
rrr to pqt-ngr.
tdn to kbc-ttk.
nqn to khn-ssf.
hmk to rrh-jvs.
rfb to pkb-rsm.
sfq to tgn-tjp.
jkq to svn-bdb.
ctn to mts-ghd.
qnt to tqp-nfg.
vhl to jjp-hbf.
rfh to plf-tkh.
ktd to brc-hmc.
vrx to scn-pkh.
bnt to jkl-jcl.
mdn to dlc-brk.
cbg to sks-pjq.
qfh to jtd-smv.
hvs to xgp-ccx.
nqh to bkx-vsr.
gqq to mbv-hmn.
lsn to ntm-xxt.
flq to rrr-qlt.
lxm to prt-qll.
hjh to gxv-gjq.
srv to jxl-bjv.
tmh to xcf-cbn.
prb to ktv-ndd.
jjq to qhq-qdb.
ksv to ntt-trh.
xkh to vjs-jgt.
sjp to qnt-bgg.
ntr to bnc-bnc.
pbm to tjm-tqd.
rpd to dvg-prb.
xpd to mpk-gjv.
nch to gkg-ngj.
ktp to jcx-nrr.
gqc to qnr-pfv.
mkc to vlf-sfd.
ntm to fbf-xnk.
tvk to mbl-xjq.
rmt to xkv-rhc.
nhp to dpm-mhm.
jnb to ngf-ntc.
rtp to bnt-kfk.
gjt to tkr-gpl.
tts to vfm-vfm.
flk to bnv-fpj.
cjj to qvf-gnk.
qkp to fbg-tpp.
xqt to jvt-tdn.
jvh to xkx-jkm.
ndj to cfl-mht.
jxx to brk-dlc.
xjd to smn-lkg.
jxl to kvb-rhv.
vmg to kkm-jkt.
fbg to nhj-pcr.
lkl to vmj-tfn.
nxl to xss-dbp.
src to ftg-lbt.
pdc to cqn-vcg.
bld to tdc-bcx.
nhj to ktl-jdd.
dgc to vfm-zzz.
ltx to qtc-grk.
ccx to bqj-rxc.
drm to dgb-pgx.
vqq to ttc-fpt.
bhc to xtd-mhb.
cdc to dbp-xss.
sxh to pnc-pnc.
kbc to kst-mgq.
dxt to ckq-mdp.
prp to smn-lkg.
sgs to ngj-gkg.
vbn to lpn-mkf.
bnf to kgk-pgk.
hld to ftb-hjh.
fgt to tcg-ntl.
vbt to dvs-qqm.
xvt to qll-prt.
sbh to bnb-jvh.
vgb to vss-skd.
xjj to cxc-pkx.
jkk to bdb-svn.
bsn to hvs-dvc.
dbx to qsr-hxj.
qsg to khj-vmp.
cpk to crd-vdp.
jgd to jmm-cbh.
vgh to cqm-dlp.
gbq to hsq-nkv.
grx to lsn-skb.
flm to tts-dgc.
ppr to xcx-rfh.
vdp to hvv-vdb.
gkn to pgk-kgk.
xda to bnb-jvh.
mnl to pcj-gnh.
mgb to prb-dvg.
fbb to bvq-ghq.
ntj to lxp-djg.
pqq to nvt-xqt.
tqp to tvg-fmv.
lqk to bpc-hsx.
mtg to tsm-pxb.
vsf to lxm-xvt.
hjb to bmg-pcx.
vmj to gxl-smk.
cxb to qlf-sjp.
hcp to ssf-khn.
qlh to hsx-bpc.
nfg to tvg-fmv.
pkb to lhh-hkj.
brg to djg-lxp.
tlq to kxm-gbv.
ddg to drm-vhc.
bqm to nvx-klt.
ktx to ljp-dvh.
xts to dhq-brj.
tfg to vqv-hmk.
jcd to vsf-jjx.
vfm to mpf-vmm.
lgj to njc-njc.
pqb to bgp-mxh.
cbn to lvx-fnt.
fcl to nqh-txn.
jnh to rkp-qdf.
lht to jkt-kkm.
mjd to pdc-prv.
qgt to xnh-nms.
kst to xrq-vbn.
kdv to fpb-qgt.
hfp to nnk-mbp.
bjk to ppr-rhs.
xxm to mfd-cpk.
qlt to pqt-ngr.
hmj to lht-vmg.
xdr to tcg-ntl.
nnk to tfk-ndf.
vjc to nsr-nvg.
mmm to qlf-sjp.
bnb to xkx-jkm.
ljg to vjc-sfg.
qqt to srf-xxm.
jpm to hsr-fvp.
gnq to fbg-tpp.
pjb to vcd-dvp.
nkp to klt-nvx.
gjc to ltb-bld.
mrf to dhq-brj.
srf to cpk-mfd.
fss to vxj-dhg.
xxz to tvj-rvq.
ndd to rgn-lsj.
tqd to khm-bxb.
xjb to pxb-tsm.
lsj to xch-klm.
jbj to jgd-hfh.
dms to qnr-pfv.
dlf to mkc-mkj.
hnn to ftt-gjc.
vxm to mqc-mmt.
lmm to tkv-bpl.
bmg to bjk-lpd.
qgj to lsn-skb.
frt to njx-krf.
skn to dht-dbm.
lbd to jxx-mdn.
kfk to jkl-jcl.
rrh to bdm-qqp.
nrl to chk-vxm.
lcx to vjs-jgt.
cnr to gbq-qdp.
tgn to pqb-vdt.
grt to dbj-dlx.
fdh to ntr-ntr.
crd to vdb-hvv.
dmm to pjq-sks.
vhc to pgx-dgb.
ftd to qdb-qhq.
npc to mgl-vgq.
prv to vcg-cqn.
tsm to pmc-hpd.
cqm to xxj-nbn.
bnr to pml-qhd.
nsp to cbr-gqq.
tjk to prv-pdc.
mst to knl-dvl.
vmp to jff-pqg.
tdf to jnh-clp.
mqc to hvj-fln.
vpt to bnx-jcc.
gkp to phl-tfg.
jjx to xvt-lxm.
mmt to fln-hvj.
crp to hfh-jgd.
dbm to krp-npc.
lqv to vgb-fdr.
xrf to gfv-phk.
rrq to tqf-hqm.
rxf to rcl-hqf.
jrn to pjb-sqq.
jtd to skn-hhj.
htp to jtr-vcl.
jmm to ftd-jjq.
mbl to nnd-tpt.
rcl to mnm-vhl.
lgs to qvf-gnk.
csc to cnr-rql.
mfc to bhp-tdf.
hsx to hsp-vbt.
gbv to rdn-xps.
vxj to qhv-lqp.
jkm to xjj-gmc.
mts to krk-hjb.
qdb to drk-src.
ggj to dnf-pvp.
xxt to xnk-fbf.
xsm to xqt-nvt.
qqm to xjb-mtg.
kdq to qlh-lqk.
hnb to tmh-ssp.
frj to vxj-dhg.
pql to lbn-cpb.
sks to ghf-fjf.
dlc to jkq-jkk.
jmc to gjg-xxz.
stp to gfv-phk.
qnp to lcx-xkh.
klf to cjj-lgs.
xsa to pqq-xsm.
ktv to rgn-lsj.
fdr to skd-vss.
pch to grt-txj.
ktl to xdr-fgt.
lbb to nrl-dsc.
xkv to jbj-crp.
khj to jff-pqg.
ngf to xrb-dgt.
dvh to qlj-sgp.
mrm to txn-nqh.
tgm to lgj-bxx.
mkk to rfx-flk.
rlt to fbh-lgl.
gxs to htp-blc.
xkx to gmc-xjj.
vmv to xpd-tjs.
mgl to ltx-tlf.
njc to nks-nks.
clp to qdf-rkp.
smk to nkj-gxx.
kpm to gvn-vrx.
bcq to tbd-qsg.
tpt to lbf-dgp.
cfa to frm-pql.
kvb to tgs-kdv.
bdm to cgm-tch.
jjp to cdc-nxl.
pmc to jxr-snt.
pgx to hcp-nqn.
lbc to rdc-hmj.
mbv to dbx-ddq.
kxv to lgs-cjj.
djt to dlp-cqm.
ldr to lft-hnb.
gxl to nkj-gxx.
smn to qxj-dtc.
dcj to gkp-fmb.
gdn to ktx-hfc.
kgk to phn-kln.
vbj to fbb-fxs.
ddq to qsr-hxj.
kjc to cbg-dmm.
blc to vcl-jtr.
qnr to lqv-tnh.
krf to trn-mhn.
jff to qmc-xtq.
mpk to plv-xhm.
pkc to ttf-snq.
vrn to fbh-fbh.
dvl to vqq-ksl.
xtd to kmx-dkl.
vdb to mxn-jpg.
fmv to rgr-ksv.
hmn to ddq-dbx.
trn to pkc-kph.
gkg to qpn-gsf.
mdp to mrm-fcl.
dhg to qhv-lqp.
bdb to nsv-bkm.
hph to drr-drr.
bkx to kng-nqt.
kvh to ktp-mjt.
vdn to glx-ltr.
tfk to cxb-mmm.
cqd to ntr-rkk.
hhj to dbm-dht.
vhv to nnk-mbp.
fbf to jnl-qfh.
pkx to btd-vdn.
phk to xbv-lbb.
qmh to klg-hfl.
shl to jcc-bnx.
fnt to jct-fpx.
hnf to nch-sgs.
lbv to lcx-xkh.
mkj to sfd-vlf.
ccl to rrr-qlt.
rsm to hkj-lhh.
hfc to ljp-dvh.
mxh to ktd-hft.
pvc to lgj-bxx.
mnj to hnn-hdx.
dhk to ddg-rbc.
jcl to frt-cvl.
fsg to ngp-mnj.
phl to hmk-vqv.
gfv to xbv-lbb.
txn to bkx-vsr.
gjq to dbb-mkk.
xcx to tkh-plf.
mht to knf-mst.
kdl to frj-fss.
mnm to jjp-hbf.
xmg to bjs-xkd.
qhq to drk-src.
dvc to ccx-xgp.
qqs to mhm-dpm.
tvg to ksv-rgr.
cgm to qtl-rrq.
qfr to rhc-xkv.
vlf to xsp-sds.
dnf to ghb-sgj.
qhv to sng-vvm.
rvt to hgj-rtp.
rgn to xch-klm.
qmc to flq-ccl.
tjp to vdt-pqb.
qkb to tdk-cxj.
snd to gkp-fmb.
cpc to qcs-vmd.
khn to llf-frv.
qlf to bgg-qnt.
vjs to fdt-vdd.
fnj to gpl-tkr.
mxn to gnq-qkp.
bqj to vmv-qfp.
npk to nks-dhs.
hja to xmg-svm.
hqm to fnj-gjt.
dvp to dcj-snd.
bcx to rkr-nth.
bhg to xxm-srf.
hsq to gtc-ncp.
txm to mnl-shc.
pqt to csc-xgc.
njf to qkl-hdk.
mgv to vpt-shl.
tkr to pgq-jcd.
lgl to sbh-mpz.
phn to hrp-jpm.
lbn to gdn-dfx.
jcc to tsx-tlq.
dxj to shx-chb.
khm to kdq-jsj.
xrb to bcq-mlx.
pcj to sfq-jxk.
dvs to xjb-mtg.
pck to chb-shx.
ttc to vjf-lbc.
pkd to vjc-sfg.
ghm to hph-hph.
chb to prj-txm.
qsr to kdl-srr.
tcg to dhk-pts.
ngr to csc-xgc.
vgq to ltx-tlf.
jqr to gmv-bgt.
tqh to cpc-xdd.
kkm to mdv-qpp.
lss to cbr-gqq.
dvg to ktv-ndd.
tbd to khj-vmp.
prd to mdn-jxx.
gpl to pgq-jcd.
tkv to gqc-dms.
rkc to srd-kjc.
qsl to dgl-frh.
jxr to rmt-qfr.
cfl to mst-knf.
bjv to rhv-kvb.
psr to jdf-xkt.
hpa to rvq-tvj.
qdf to ldq-xxn.
glb to grt-txj.
bpc to hsp-vbt.
flv to sxh-ptr.
jtr to mtc-pdn.
qcs to ctf-sfm.
srr to fss-frj.
dpm to hfp-vhv.
pdn to pbm-tgr.
vcd to dcj-snd.
kbj to lmt-vmc.
rhc to crp-jbj.
dgp to dmd-pps.
hvv to mxn-jpg.
lth to dxt-cld.
xtv to qsn-qlk.
cbr to mbv-hmn.
cdr to hnb-lft.
ghq to vsq-qsh.
tdc to nth-rkr.
xtq to flq-ccl.
gmc to cxc-pkx.
pgk to phn-kln.
nth to ngn-kvd.
pkh to pmj-mfc.
jdn to hnf-bfd.
fbh to sbh-sbh.
jdd to fgt-xdr.
hkj to xrf-stp.
klt to mgs-jsk.
ghd to hjb-krk.
hrp to fvp-hsr.
ptr to pnc-jdt.
ljp to sgp-qlj.
jvt to ttk-kbc.
zzz to vmm-mpf.
btd to glx-ltr.
gtc to qkb-hmr.
ndf to cxb-mmm.
dgb to nqn-hcp.
jsj to qlh-lqk.
nbb to kqv-qph.
xgc to rql-cnr.
qhd to grx-qgj.
rfx to fpj-bnv.
lpn to ncb-sdh.
nvg to pch-glb.

800
08/input.txt Normal file
View File

@ -0,0 +1,800 @@
LRLRRRLRRRLLLRLRRLLRLRRRLRLRRRLRLRRRLRLRRRLRRRLRLLRRRLRLRLRRLRRLRLRRLRRLRRLLRRRLRRRLRRLRRLRRLRRRLLRRLRLRRLRLRRLRRLRLRRLRRLLRLRRRLRRLRRRLLRLRLRLLRLLRLLRLRRLLRRLRLRLRRLRLLRRRLLRRRLRRLLRRRLRRRLRLRRRLLRRRLRLRRRLLLRRRLRLRLRRRLRRRLRRRLRLRRLLLRRLRRRLLRLRRRLRLRLLLRRLRLRRRLRLRRRR
GNK = (LBV, QNP)
PJQ = (GHF, FJF)
KLM = (TTR, BQL)
LDT = (FXS, FBB)
TKH = (NBH, JRN)
QND = (KJC, SRD)
SNG = (BQP, LXN)
GMS = (JDN, NKM)
NTL = (PTS, DHK)
NBN = (FFD, PRL)
NCP = (QKB, HMR)
NQT = (RDK, BHC)
TDK = (GHM, GHM)
BJS = (TGC, GBJ)
XNH = (GGJ, TKL)
NKV = (GTC, NCP)
HFL = (LQQ, RVT)
HKC = (BQM, NKP)
KCH = (GJG, GJG)
MFD = (CRD, VDP)
FNZ = (XSM, PQQ)
NVT = (TDN, JVT)
PCQ = (HLD, BKQ)
GPF = (MNJ, NGP)
PCX = (LPD, BJK)
CCG = (TTS, TTS)
BGG = (TQP, NFG)
HSP = (DVS, QQM)
TSX = (GBV, KXM)
RKK = (BNC, FNZ)
HVJ = (RPD, MGB)
CXC = (BTD, VDN)
NBH = (SQQ, PJB)
CQN = (SRV, MCF)
LPD = (PPR, RHS)
BKM = (FJV, XTV)
KQV = (PCK, DXJ)
VCL = (PDN, MTC)
JVS = (QQP, BDM)
MJT = (JCX, NRR)
VSR = (NQT, KNG)
NKM = (HNF, BFD)
HGJ = (BNT, KFK)
VMC = (QND, RKC)
DJG = (PRD, LBD)
JCT = (NFM, NJF)
FPX = (NJF, NFM)
HPD = (SNT, JXR)
QLK = (KXV, KLF)
HMR = (TDK, CXJ)
RQL = (QDP, GBQ)
VDT = (BGP, MXH)
PFV = (TNH, LQV)
TTF = (FLV, SKM)
QKL = (JNB, SKX)
RXC = (QFP, VMV)
NGJ = (QPN, GSF)
MPZ = (JVH, BNB)
FPB = (XNH, NMS)
LQP = (SNG, VVM)
HQF = (MNM, VHL)
XXJ = (PRL, FFD)
KPH = (TTF, SNQ)
JDT = (KCH, JMC)
KRK = (PCX, BMG)
FJV = (QLK, QSN)
MPG = (LJG, PKD)
TCH = (RRQ, QTL)
SDS = (JQR, BXR)
RKR = (KVD, NGN)
TVJ = (XGS, PCQ)
VSQ = (NHP, QQS)
RDK = (XTD, MHB)
SGP = (PRP, XJD)
SVN = (BKM, NSV)
SJC = (DGL, FRH)
NJX = (TRN, MHN)
RCG = (BSN, DQR)
HXJ = (KDL, SRR)
BQZ = (PQL, FRM)
NKS = (SHM, SHM)
FPJ = (STM, CTN)
SFM = (PVC, TGM)
VSS = (MGV, JLS)
DGL = (NBB, BST)
XRQ = (LPN, MKF)
RSZ = (SVM, XMG)
TTK = (KST, MGQ)
FJF = (CRC, RXF)
CMT = (HPH, KPL)
SDR = (LTD, TVK)
BST = (KQV, QPH)
DGT = (BCQ, MLX)
QPN = (MMD, LKL)
SHM = (FRM, PQL)
XDD = (QCS, VMD)
SNQ = (FLV, SKM)
TLF = (QTC, GRK)
CPB = (DFX, GDN)
BRJ = (LDR, CDR)
JNL = (JTD, SMV)
FTG = (VRN, VRN)
GBJ = (VGH, DJT)
TGS = (FPB, QGT)
MHB = (DKL, KMX)
GNH = (SFQ, JXK)
LTD = (XJQ, MBL)
PCR = (JDD, KTL)
DMD = (KHC, KVH)
FTT = (LTB, BLD)
LMT = (RKC, QND)
JGT = (FDT, VDD)
MDV = (XTS, MRF)
PLV = (KXC, CNM)
PRJ = (SHC, MNL)
PML = (GRX, QGJ)
VVM = (LXN, BQP)
NGN = (GBG, XJX)
VCG = (SRV, MCF)
QFP = (TJS, XPD)
LVX = (FPX, JCT)
RBC = (DRM, VHC)
XKT = (CCG, FLM)
SDH = (BNF, GKN)
BVQ = (QSH, VSQ)
SMV = (SKN, HHJ)
DBD = (RSM, PKB)
DQR = (HVS, DVC)
MNK = (DXT, CLD)
FFD = (DLF, JPQ)
GBG = (TKP, KPM)
CHK = (MMT, MQC)
BXR = (GMV, BGT)
SFD = (XSP, SDS)
PRT = (HDB, RCG)
QXJ = (QQT, BHG)
TGR = (TQD, TJM)
GJG = (RVQ, TVJ)
BFD = (SGS, NCH)
PND = (BPL, TKV)
JPG = (GNQ, QKP)
FDT = (NPF, SFF)
DLX = (XVP, BNR)
SNT = (QFR, RMT)
DND = (TVK, LTD)
SSF = (LLF, FRV)
DRK = (FTG, LBT)
VQV = (JVS, RRH)
XBV = (DSC, NRL)
CVL = (KRF, NJX)
XGP = (BQJ, RXC)
MLX = (TBD, QSG)
JDF = (CCG, CCG)
GVN = (SCN, PKH)
NCB = (GKN, BNF)
LLF = (PND, LMM)
SHX = (TXM, PRJ)
KNL = (KSL, VQQ)
JSK = (SQD, MPG)
PPS = (KHC, KVH)
NKJ = (DBD, RFB)
CNM = (FCB, DHP)
TXJ = (DBJ, DLX)
QSH = (QQS, NHP)
BRC = (PLN, GMS)
BHP = (JNH, CLP)
BQL = (SDR, DND)
TGC = (VGH, DJT)
MHM = (VHV, HFP)
NGP = (HNN, HDX)
SKM = (SXH, PTR)
TFN = (SMK, GXL)
NSR = (GLB, PCH)
RHS = (XCX, RFH)
BNC = (PQQ, XSM)
XJX = (KPM, TKP)
LFT = (TMH, SSP)
KVD = (XJX, GBG)
SKX = (NGF, NTC)
CKQ = (FCL, MRM)
MTC = (PBM, TGR)
RHV = (TGS, KDV)
MMD = (VMJ, TFN)
PSM = (XDK, GSG)
KXM = (RDN, XPS)
PLN = (NKM, JDN)
HDK = (SKX, JNB)
XGS = (HLD, BKQ)
FMB = (PHL, TFG)
LHH = (XRF, STP)
LTB = (TDC, BCX)
FRV = (LMM, PND)
GRK = (FDH, CQD)
NRR = (HNS, KBJ)
BGT = (LDT, VBJ)
SRD = (CBG, DMM)
KNF = (DVL, KNL)
KXC = (FCB, DHP)
GHB = (NNJ, QMH)
PGQ = (JJX, VSF)
SKB = (XXT, NTM)
LXP = (PRD, LBD)
PRL = (JPQ, DLF)
FRM = (LBN, CPB)
KSL = (FPT, TTC)
CRC = (RCL, HQF)
SVM = (BJS, XKD)
PXB = (PMC, HPD)
JPQ = (MKJ, MKC)
TTR = (DND, SDR)
CBH = (FTD, JJQ)
XPS = (NSP, LSS)
KMX = (QSL, SJC)
CLD = (MDP, CKQ)
GXV = (MKK, DBB)
BQP = (TQH, LKN)
FTB = (GJQ, GXV)
KPL = (DRR, RSZ)
MKF = (SDH, NCB)
SSP = (CBN, XCF)
XJQ = (NND, TPT)
NTT = (NDJ, QFB)
PLF = (NBH, JRN)
XDK = (GPF, FSG)
NTC = (DGT, XRB)
SGJ = (QMH, NNJ)
TNH = (VGB, FDR)
DFX = (HFC, KTX)
DBJ = (XVP, BNR)
VDD = (SFF, NPF)
JKL = (FRT, CVL)
XSP = (BXR, JQR)
DBP = (PSR, LJS)
KHC = (MJT, KTP)
TKP = (VRX, GVN)
DKL = (SJC, QSL)
DLP = (XXJ, NBN)
KLN = (HRP, JPM)
TPP = (NHJ, PCR)
QVF = (QNP, LBV)
VMD = (CTF, SFM)
NFM = (QKL, HDK)
MCF = (BJV, JXL)
PQG = (XTQ, QMC)
BGP = (HFT, KTD)
PTS = (DDG, RBC)
JLS = (SHL, VPT)
DHT = (NPC, KRP)
TJM = (KHM, BXB)
TRH = (NDJ, QFB)
CTF = (PVC, TGM)
PMJ = (BHP, TDF)
AAA = (MPF, VMM)
XCF = (LVX, FNT)
FRH = (BST, NBB)
QLL = (HDB, RCG)
XVP = (QHD, PML)
BNX = (TLQ, TSX)
BXB = (JSJ, KDQ)
FPT = (LBC, VJF)
FCB = (TJK, MJD)
KNG = (RDK, BHC)
DBB = (RFX, FLK)
LQQ = (RTP, HGJ)
LBT = (VRN, RLT)
XKD = (GBJ, TGC)
LKN = (XDD, CPC)
XHM = (CNM, KXC)
DTC = (QQT, BHG)
BPL = (DMS, GQC)
QPP = (MRF, XTS)
PRK = (NKP, BQM)
MGS = (MPG, SQD)
STM = (MTS, GHD)
SKD = (MGV, JLS)
QPH = (DXJ, PCK)
HDB = (DQR, BSN)
DSC = (VXM, CHK)
TQF = (GJT, FNJ)
FXS = (GHQ, BVQ)
SFF = (HKC, PRK)
DRR = (XMG, SVM)
RKP = (XXN, LDQ)
NNJ = (KLG, HFL)
VJF = (HMJ, RDC)
LXN = (TQH, LKN)
CXJ = (GHM, CMT)
HMC = (GMS, PLN)
LJS = (JDF, XKT)
XCH = (TTR, BQL)
LKG = (QXJ, DTC)
QFB = (MHT, CFL)
RDN = (LSS, NSP)
DHS = (SHM, BQZ)
NKT = (GSG, XDK)
MCH = (HTP, BLC)
NVX = (MGS, JSK)
QTC = (FDH, FDH)
NND = (DGP, LBF)
GJV = (XHM, PLV)
GSG = (FSG, GPF)
BNV = (STM, CTN)
LDQ = (MCH, GXS)
MHN = (KPH, PKC)
LBF = (PPS, DMD)
QDP = (NKV, HSQ)
MPF = (MNK, LTH)
DHQ = (CDR, LDR)
VMM = (MNK, LTH)
HFT = (BRC, HMC)
LTR = (NKT, PSM)
HDX = (GJC, FTT)
GHF = (RXF, CRC)
BKQ = (FTB, HJH)
BXX = (NJC, NPK)
FVP = (BRG, NTJ)
RDC = (LHT, VMG)
JKT = (QPP, MDV)
PVP = (GHB, SGJ)
XXN = (GXS, MCH)
SHC = (GNH, PCJ)
GSF = (LKL, MMD)
KRP = (MGL, VGQ)
JXK = (TGN, TJP)
MGQ = (XRQ, VBN)
FLN = (MGB, RPD)
DHP = (MJD, TJK)
SQQ = (DVP, VCD)
HFH = (CBH, JMM)
MBP = (NDF, TFK)
KLG = (RVT, LQQ)
NPF = (PRK, HKC)
NMS = (GGJ, TKL)
QQP = (CGM, TCH)
SFG = (NVG, NSR)
RVQ = (XGS, PCQ)
SQD = (PKD, LJG)
JCX = (HNS, KBJ)
QSN = (KXV, KLF)
GLX = (NKT, PSM)
TJS = (GJV, MPK)
QLJ = (XJD, PRP)
NSV = (FJV, XTV)
GXX = (RFB, DBD)
HSR = (BRG, NTJ)
HBF = (CDC, NXL)
XSS = (PSR, LJS)
QTL = (TQF, HQM)
TKL = (DNF, PVP)
BRK = (JKQ, JKK)
SCN = (MFC, PMJ)
GMV = (VBJ, LDT)
HNS = (LMT, VMC)
RGR = (NTT, TRH)
PNC = (KCH, KCH)
XNK = (JNL, QFH)
RRR = (PQT, NGR)
TDN = (KBC, TTK)
NQN = (KHN, SSF)
HMK = (RRH, JVS)
RFB = (PKB, RSM)
SFQ = (TGN, TJP)
JKQ = (SVN, BDB)
CTN = (MTS, GHD)
QNT = (TQP, NFG)
VHL = (JJP, HBF)
RFH = (PLF, TKH)
KTD = (BRC, HMC)
VRX = (SCN, PKH)
BNT = (JKL, JCL)
MDN = (DLC, BRK)
CBG = (SKS, PJQ)
QFH = (JTD, SMV)
HVS = (XGP, CCX)
NQH = (BKX, VSR)
GQQ = (MBV, HMN)
LSN = (NTM, XXT)
FLQ = (RRR, QLT)
LXM = (PRT, QLL)
HJH = (GXV, GJQ)
SRV = (JXL, BJV)
TMH = (XCF, CBN)
PRB = (KTV, NDD)
JJQ = (QHQ, QDB)
KSV = (NTT, TRH)
XKH = (VJS, JGT)
SJP = (QNT, BGG)
NTR = (BNC, BNC)
PBM = (TJM, TQD)
RPD = (DVG, PRB)
XPD = (MPK, GJV)
NCH = (GKG, NGJ)
KTP = (JCX, NRR)
GQC = (QNR, PFV)
MKC = (VLF, SFD)
NTM = (FBF, XNK)
TVK = (MBL, XJQ)
RMT = (XKV, RHC)
NHP = (DPM, MHM)
JNB = (NGF, NTC)
RTP = (BNT, KFK)
GJT = (TKR, GPL)
TTS = (VFM, VFM)
FLK = (BNV, FPJ)
CJJ = (QVF, GNK)
QKP = (FBG, TPP)
XQT = (JVT, TDN)
JVH = (XKX, JKM)
NDJ = (CFL, MHT)
JXX = (BRK, DLC)
XJD = (SMN, LKG)
JXL = (KVB, RHV)
VMG = (KKM, JKT)
FBG = (NHJ, PCR)
LKL = (VMJ, TFN)
NXL = (XSS, DBP)
SRC = (FTG, LBT)
PDC = (CQN, VCG)
BLD = (TDC, BCX)
NHJ = (KTL, JDD)
DGC = (VFM, ZZZ)
LTX = (QTC, GRK)
CCX = (BQJ, RXC)
DRM = (DGB, PGX)
VQQ = (TTC, FPT)
BHC = (XTD, MHB)
CDC = (DBP, XSS)
SXH = (PNC, PNC)
KBC = (KST, MGQ)
DXT = (CKQ, MDP)
PRP = (SMN, LKG)
SGS = (NGJ, GKG)
VBN = (LPN, MKF)
BNF = (KGK, PGK)
HLD = (FTB, HJH)
FGT = (TCG, NTL)
VBT = (DVS, QQM)
XVT = (QLL, PRT)
SBH = (BNB, JVH)
VGB = (VSS, SKD)
XJJ = (CXC, PKX)
JKK = (BDB, SVN)
BSN = (HVS, DVC)
DBX = (QSR, HXJ)
QSG = (KHJ, VMP)
CPK = (CRD, VDP)
JGD = (JMM, CBH)
VGH = (CQM, DLP)
GBQ = (HSQ, NKV)
GRX = (LSN, SKB)
FLM = (TTS, DGC)
PPR = (XCX, RFH)
VDP = (HVV, VDB)
GKN = (PGK, KGK)
XDA = (BNB, JVH)
MNL = (PCJ, GNH)
MGB = (PRB, DVG)
FBB = (BVQ, GHQ)
NTJ = (LXP, DJG)
PQQ = (NVT, XQT)
TQP = (TVG, FMV)
LQK = (BPC, HSX)
MTG = (TSM, PXB)
VSF = (LXM, XVT)
HJB = (BMG, PCX)
VMJ = (GXL, SMK)
CXB = (QLF, SJP)
HCP = (SSF, KHN)
QLH = (HSX, BPC)
NFG = (TVG, FMV)
PKB = (LHH, HKJ)
BRG = (DJG, LXP)
TLQ = (KXM, GBV)
DDG = (DRM, VHC)
BQM = (NVX, KLT)
KTX = (LJP, DVH)
XTS = (DHQ, BRJ)
TFG = (VQV, HMK)
JCD = (VSF, JJX)
VFM = (MPF, VMM)
LGJ = (NJC, NJC)
PQB = (BGP, MXH)
CBN = (LVX, FNT)
FCL = (NQH, TXN)
JNH = (RKP, QDF)
LHT = (JKT, KKM)
MJD = (PDC, PRV)
QGT = (XNH, NMS)
KST = (XRQ, VBN)
KDV = (FPB, QGT)
HFP = (NNK, MBP)
BJK = (PPR, RHS)
XXM = (MFD, CPK)
QLT = (PQT, NGR)
HMJ = (LHT, VMG)
XDR = (TCG, NTL)
NNK = (TFK, NDF)
VJC = (NSR, NVG)
MMM = (QLF, SJP)
BNB = (XKX, JKM)
LJG = (VJC, SFG)
QQT = (SRF, XXM)
JPM = (HSR, FVP)
GNQ = (FBG, TPP)
PJB = (VCD, DVP)
NKP = (KLT, NVX)
GJC = (LTB, BLD)
MRF = (DHQ, BRJ)
SRF = (CPK, MFD)
FSS = (VXJ, DHG)
XXZ = (TVJ, RVQ)
NDD = (RGN, LSJ)
TQD = (KHM, BXB)
XJB = (PXB, TSM)
LSJ = (XCH, KLM)
JBJ = (JGD, HFH)
DMS = (QNR, PFV)
DLF = (MKC, MKJ)
HNN = (FTT, GJC)
VXM = (MQC, MMT)
LMM = (TKV, BPL)
BMG = (BJK, LPD)
QGJ = (LSN, SKB)
FRT = (NJX, KRF)
SKN = (DHT, DBM)
LBD = (JXX, MDN)
KFK = (JKL, JCL)
RRH = (BDM, QQP)
NRL = (CHK, VXM)
LCX = (VJS, JGT)
CNR = (GBQ, QDP)
TGN = (PQB, VDT)
GRT = (DBJ, DLX)
FDH = (NTR, NTR)
CRD = (VDB, HVV)
DMM = (PJQ, SKS)
VHC = (PGX, DGB)
FTD = (QDB, QHQ)
NPC = (MGL, VGQ)
PRV = (VCG, CQN)
TSM = (PMC, HPD)
CQM = (XXJ, NBN)
BNR = (PML, QHD)
NSP = (CBR, GQQ)
TJK = (PRV, PDC)
MST = (KNL, DVL)
VMP = (JFF, PQG)
TDF = (JNH, CLP)
MQC = (HVJ, FLN)
VPT = (BNX, JCC)
GKP = (PHL, TFG)
JJX = (XVT, LXM)
MMT = (FLN, HVJ)
CRP = (HFH, JGD)
DBM = (KRP, NPC)
LQV = (VGB, FDR)
XRF = (GFV, PHK)
RRQ = (TQF, HQM)
RXF = (RCL, HQF)
JRN = (PJB, SQQ)
JTD = (SKN, HHJ)
HTP = (JTR, VCL)
JMM = (FTD, JJQ)
MBL = (NND, TPT)
RCL = (MNM, VHL)
LGS = (QVF, GNK)
CSC = (CNR, RQL)
MFC = (BHP, TDF)
HSX = (HSP, VBT)
GBV = (RDN, XPS)
VXJ = (QHV, LQP)
JKM = (XJJ, GMC)
MTS = (KRK, HJB)
QDB = (DRK, SRC)
GGJ = (DNF, PVP)
XXT = (XNK, FBF)
XSM = (XQT, NVT)
QQM = (XJB, MTG)
KDQ = (QLH, LQK)
HNB = (TMH, SSP)
FRJ = (VXJ, DHG)
PQL = (LBN, CPB)
SKS = (GHF, FJF)
DLC = (JKQ, JKK)
JMC = (GJG, XXZ)
STP = (GFV, PHK)
QNP = (LCX, XKH)
KLF = (CJJ, LGS)
XSA = (PQQ, XSM)
KTV = (RGN, LSJ)
FDR = (SKD, VSS)
PCH = (GRT, TXJ)
KTL = (XDR, FGT)
LBB = (NRL, DSC)
XKV = (JBJ, CRP)
KHJ = (JFF, PQG)
NGF = (XRB, DGT)
DVH = (QLJ, SGP)
MRM = (TXN, NQH)
TGM = (LGJ, BXX)
MKK = (RFX, FLK)
RLT = (FBH, LGL)
GXS = (HTP, BLC)
XKX = (GMC, XJJ)
VMV = (XPD, TJS)
MGL = (LTX, TLF)
NJC = (NKS, NKS)
CLP = (QDF, RKP)
SMK = (NKJ, GXX)
KPM = (GVN, VRX)
BCQ = (TBD, QSG)
TPT = (LBF, DGP)
CFA = (FRM, PQL)
KVB = (TGS, KDV)
BDM = (CGM, TCH)
JJP = (CDC, NXL)
PMC = (JXR, SNT)
PGX = (HCP, NQN)
LBC = (RDC, HMJ)
MBV = (DBX, DDQ)
KXV = (LGS, CJJ)
DJT = (DLP, CQM)
LDR = (LFT, HNB)
GXL = (NKJ, GXX)
SMN = (QXJ, DTC)
DCJ = (GKP, FMB)
GDN = (KTX, HFC)
KGK = (PHN, KLN)
VBJ = (FBB, FXS)
DDQ = (QSR, HXJ)
KJC = (CBG, DMM)
BLC = (VCL, JTR)
QNR = (LQV, TNH)
KRF = (TRN, MHN)
JFF = (QMC, XTQ)
MPK = (PLV, XHM)
PKC = (TTF, SNQ)
VRN = (FBH, FBH)
DVL = (VQQ, KSL)
XTD = (KMX, DKL)
VDB = (MXN, JPG)
FMV = (RGR, KSV)
HMN = (DDQ, DBX)
TRN = (PKC, KPH)
GKG = (QPN, GSF)
MDP = (MRM, FCL)
DHG = (QHV, LQP)
BDB = (NSV, BKM)
HPH = (DRR, DRR)
BKX = (KNG, NQT)
KVH = (KTP, MJT)
VDN = (GLX, LTR)
TFK = (CXB, MMM)
CQD = (NTR, RKK)
HHJ = (DBM, DHT)
VHV = (NNK, MBP)
FBF = (JNL, QFH)
PKX = (BTD, VDN)
PHK = (XBV, LBB)
QMH = (KLG, HFL)
SHL = (JCC, BNX)
FNT = (JCT, FPX)
HNF = (NCH, SGS)
LBV = (LCX, XKH)
MKJ = (SFD, VLF)
CCL = (RRR, QLT)
RSM = (HKJ, LHH)
HFC = (LJP, DVH)
MXH = (KTD, HFT)
PVC = (LGJ, BXX)
MNJ = (HNN, HDX)
DHK = (DDG, RBC)
JCL = (FRT, CVL)
FSG = (NGP, MNJ)
PHL = (HMK, VQV)
GFV = (XBV, LBB)
TXN = (BKX, VSR)
GJQ = (DBB, MKK)
XCX = (TKH, PLF)
MHT = (KNF, MST)
KDL = (FRJ, FSS)
MNM = (JJP, HBF)
XMG = (BJS, XKD)
QHQ = (DRK, SRC)
DVC = (CCX, XGP)
QQS = (MHM, DPM)
TVG = (KSV, RGR)
CGM = (QTL, RRQ)
QFR = (RHC, XKV)
VLF = (XSP, SDS)
DNF = (GHB, SGJ)
QHV = (SNG, VVM)
RVT = (HGJ, RTP)
RGN = (XCH, KLM)
QMC = (FLQ, CCL)
TJP = (VDT, PQB)
QKB = (TDK, CXJ)
SND = (GKP, FMB)
CPC = (QCS, VMD)
KHN = (LLF, FRV)
QLF = (BGG, QNT)
VJS = (FDT, VDD)
FNJ = (GPL, TKR)
MXN = (GNQ, QKP)
BQJ = (VMV, QFP)
NPK = (NKS, DHS)
HJA = (XMG, SVM)
HQM = (FNJ, GJT)
DVP = (DCJ, SND)
BCX = (RKR, NTH)
BHG = (XXM, SRF)
HSQ = (GTC, NCP)
TXM = (MNL, SHC)
PQT = (CSC, XGC)
NJF = (QKL, HDK)
MGV = (VPT, SHL)
TKR = (PGQ, JCD)
LGL = (SBH, MPZ)
PHN = (HRP, JPM)
LBN = (GDN, DFX)
JCC = (TSX, TLQ)
DXJ = (SHX, CHB)
KHM = (KDQ, JSJ)
XRB = (BCQ, MLX)
PCJ = (SFQ, JXK)
DVS = (XJB, MTG)
PCK = (CHB, SHX)
TTC = (VJF, LBC)
PKD = (VJC, SFG)
GHM = (HPH, HPH)
CHB = (PRJ, TXM)
QSR = (KDL, SRR)
TCG = (DHK, PTS)
NGR = (CSC, XGC)
VGQ = (LTX, TLF)
JQR = (GMV, BGT)
TQH = (CPC, XDD)
KKM = (MDV, QPP)
LSS = (CBR, GQQ)
DVG = (KTV, NDD)
TBD = (KHJ, VMP)
PRD = (MDN, JXX)
GPL = (PGQ, JCD)
TKV = (GQC, DMS)
RKC = (SRD, KJC)
QSL = (DGL, FRH)
JXR = (RMT, QFR)
CFL = (MST, KNF)
BJV = (RHV, KVB)
PSR = (JDF, XKT)
HPA = (RVQ, TVJ)
QDF = (LDQ, XXN)
GLB = (GRT, TXJ)
BPC = (HSP, VBT)
FLV = (SXH, PTR)
JTR = (MTC, PDN)
QCS = (CTF, SFM)
SRR = (FSS, FRJ)
DPM = (HFP, VHV)
PDN = (PBM, TGR)
VCD = (DCJ, SND)
KBJ = (LMT, VMC)
RHC = (CRP, JBJ)
DGP = (DMD, PPS)
HVV = (MXN, JPG)
LTH = (DXT, CLD)
XTV = (QSN, QLK)
CBR = (MBV, HMN)
CDR = (HNB, LFT)
GHQ = (VSQ, QSH)
TDC = (NTH, RKR)
XTQ = (FLQ, CCL)
GMC = (CXC, PKX)
PGK = (PHN, KLN)
NTH = (NGN, KVD)
PKH = (PMJ, MFC)
JDN = (HNF, BFD)
FBH = (SBH, SBH)
JDD = (FGT, XDR)
HKJ = (XRF, STP)
KLT = (MGS, JSK)
GHD = (HJB, KRK)
HRP = (FVP, HSR)
PTR = (PNC, JDT)
LJP = (SGP, QLJ)
JVT = (TTK, KBC)
ZZZ = (VMM, MPF)
BTD = (GLX, LTR)
GTC = (QKB, HMR)
NDF = (CXB, MMM)
DGB = (NQN, HCP)
JSJ = (QLH, LQK)
NBB = (KQV, QPH)
XGC = (RQL, CNR)
QHD = (GRX, QGJ)
RFX = (FPJ, BNV)
LPN = (NCB, SDH)
NVG = (PCH, GLB)

16
08/part1.pl Normal file
View File

@ -0,0 +1,16 @@
:- op(700, xfx, l).
:- op(700, xfx, r).
From l To :- From to To-_.
From r To :- From to _-To.
answer(Answer) :- path([], aaa, Path), length(Path, Answer).
path(_, zzz, []) :- !. % getting full path instead of just length for debugging
path(Directions, From, [Move | Cdr]) :-
next_step(Directions, Move, Remain),
G =.. [Move, From, To], G,
path(Remain, To, Cdr).
next_step([Move | Remain], Move, Remain).
next_step([], Move, Remain) :- direction(Str), atom_chars(Str, [Move | Remain]).

85
08/part2.cheese.pl Normal file
View File

@ -0,0 +1,85 @@
:- table direction_loop/1.
:- op(700, xfx, l).
:- op(700, xfx, r).
From l To :- From to To-_.
From r To :- From to _-To.
% We want to satisfy {Offset_i + Stride_i*Loops_i + Sub_ij = Z}
answer() :-
starts(Starts),
maplist([S, S-Off-Stride-Loop]>>(zloop([], S, 0, [], Off, Stride, Loop)),
Starts, Events),
maplist(split, Events, EquationSets),
pick(EquationSets, Eqs),
index1(Eqs, IEqs),
write('Find N_i such that: '),
foldl(write_eq, IEqs, _, _),
write('Z\n'),
% foldl(satisfy, EquationsN, _, Answer),
true.
write_eq(I-(A-B-C), _, _) :-
writef('%t + %t*N%t ', [A, B, I]),
(C =\= 0 -> writef('+ %t ', [C]); true),
write('= ').
% satisfy((A-B-C), N, Z, Z) :- natnum(N), Z is A + B*N + C.
% [mma-2-2-[0-mmz], nna-3-6-[0-nnz, 3-nnz]] -> [2-2-0, 3-6-0, 3-6-3]
split(_-_-_-[], []).
split(A-Offset-Stride-[Sub-_ | Loop], [Offset-Stride-Sub | Cdr]) :-
split(A-Offset-Stride-Loop, Cdr).
% Everything above this is not needed to get the input answer
% starts(Starts),
% maplist([S, S-Off-Stride-Loop]>>(zloop([], S, 0, [], Off, Stride, Loop)),
% Starts, Loops).
% then find the LCD of the strides (which are equal to offsets).
zloop(_, _, _, Zs, Offset, Stride, Loop) :-
Zs = [FirstZIndex-Z | _], reverse(Zs, [LastZIndex-Z | ReversedZs]),
DeltaZ is LastZIndex - FirstZIndex, DeltaZ =\= 0,
direction_len(Len),
divmod(DeltaZ, Len, _, 0),
Offset = FirstZIndex, Stride = DeltaZ,
foldl([Idx-Z, NewIdx-Z, Off, Off]>>(NewIdx is Idx - Off),
ReversedZs, ReversedLoop, Offset, _),
reverse(ReversedLoop, Loop),
!.
zloop(Directions, Node, Index, Zs, Offset, Stride, Loop) :-
( is_end(Node)
-> append(Zs, [Index-Node], NewZs)
; NewZs = Zs
),
next_step(Directions, Move, Remain),
G =.. [Move, Node, To], G,
NewIndex is Index + 1,
zloop(Remain, To, NewIndex, NewZs, Offset, Stride, Loop).
starts(Starts) :- findall(X, X to _, Nodes), include(is_start, Nodes, Starts).
is_start(Node) :- atom_chars(Node, [_, _, a]).
is_end(Node) :- atom_chars(Node, [_, _, z]).
next_step([Move | Remain], Move, Remain).
next_step([], Move, Remain) :- direction_list([Move | Remain]).
direction_list(Dir) :- direction(Str), atom_chars(Str, Dir).
direction_len(Len) :- direction_list(D), length(D, Len).
% pick([[1,2,3], [4], [5,6]], X). X = [1,4,5]; X = [1,4,6]; X = [2,4,5]; ...
pick(ListOfLists, Items) :-
maplist([SubList, X]>>(member(X, SubList)), ListOfLists, Items).
index1(L, IL) :- reverse(L, RL), index1r(RL, IRL), reverse(IRL, IL).
index1r([X], [1-X]).
index1r([X, Y | Cdr], [NextI-X, I-Y | ICdr]) :-
index1r([Y | Cdr], [I-Y | ICdr]), NextI is I + 1.
same_elements([_]).
same_elements([X-_, Y-Z2 | Cdr]) :- X =:= Y, same_elements([Y-Z2 | Cdr]).
natnum(0).
natnum(N) :- natnum(N0), N is N0 + 1.

25
08/part2.naive.pl Normal file
View File

@ -0,0 +1,25 @@
:- op(700, xfx, l).
:- op(700, xfx, r).
From l To :- From to To-_.
From r To :- From to _-To.
answer(Answer) :- starts(Starts), path([], Starts, Answer).
path(_, EndNodes, []) :- all_ends(EndNodes), !.
path(Directions, FromList, Moves) :-
next_step(Directions, Move, Remain),
maplist(Move, FromList, ToList),
path(Remain, ToList, RemainingMoves),
Moves is RemainingMoves + 1.
next_step([Move | Remain], Move, Remain).
next_step([], Move, Remain) :- direction(Str), atom_chars(Str, [Move | Remain]).
starts(StartNodes) :-
findall(Node, Node to _, Nodes),
include(is_start, Nodes, StartNodes).
all_ends(Nodes) :- maplist(is_end, Nodes).
is_start(Node) :- atom_chars(Node, [_, _, a]).
is_end(Node) :- atom_chars(Node, [_, _, z]).

78
08/part2.naive2.pl Normal file
View File

@ -0,0 +1,78 @@
:- table direction_loop/1.
:- op(700, xfx, l).
:- op(700, xfx, r).
From l To :- From to To-_.
From r To :- From to _-To.
answer(Answer) :-
starts(Starts),
maplist([S, S-Off-Stride-Loop]>>(zloop([], S, 0, [], Off, Stride, Loop)),
Starts, Events),
maplist([Node, Node-0-0]>>(true), Starts, StartPositions),
next_zevent(Events, StartPositions, Answer).
next_zevent(AllZEvents, CurrPositions, Index) :-
maplist(index_of, AllZEvents, CurrPositions, Candidates),
writef('curr=%t, cand=%t, idx=%t\n', [CurrPositions, Candidates, Index]),
( same_elements(Candidates)
-> Candidates = [Index-_ | _]
; min_member(_-Z, Candidates),
member(Z-NLoops-SubLoop, CurrPositions),
member(Z-Offset-Stride-Loop, AllZEvents),
next(Z-Offset-Stride-Loop, Z-NLoops-SubLoop, Z-NextNLoops-NextSubLoop),
select(Z-_-_, CurrPositions, Z-NextNLoops-NextSubLoop, NextPositions),
% writef('next=%t, z=%t, idx=%t\n', [NextPositions, Z, Index]),
next_zevent(AllZEvents, NextPositions, Index)
).
index_of(A-Offset-Stride-Loop, A-NLoops-SubLoop, Index-A) :-
nth0(SubLoop, Loop, LoopPosition-_),
Index is Offset + NLoops*Stride + LoopPosition.
next(A-_-_-Loop, A-NLoops-SubLoop, A-NextNLoops-NextSubLoop) :-
length(Loop, LoopLen),
( SubLoop < LoopLen - 1
-> NextNLoops is NLoops, NextSubLoop is SubLoop + 1
; NextNLoops is NLoops + 1, NextSubLoop is 0).
% Everything above this is not needed to get the input answer
% starts(Starts),
% maplist([S, S-Off-Stride-Loop]>>(zloop([], S, 0, [], Off, Stride, Loop)),
% Starts, Loops).
% then find the LCD of the strides (which are equal to offsets).
zloop(_, _, _, Zs, Offset, Stride, Loop) :-
Zs = [FirstZIndex-Z | _], reverse(Zs, [LastZIndex-Z | ReversedZs]),
DeltaZ is LastZIndex - FirstZIndex, DeltaZ =\= 0,
direction_len(Len),
divmod(DeltaZ, Len, _, 0),
Offset = FirstZIndex, Stride = DeltaZ,
foldl([Idx-Z, NewIdx-Z, Off, Off]>>(NewIdx is Idx - Off),
ReversedZs, ReversedLoop, Offset, _),
reverse(ReversedLoop, Loop),
!.
zloop(Directions, Node, Index, Zs, Offset, Stride, Loop) :-
( is_end(Node)
-> append(Zs, [Index-Node], NewZs)
; NewZs = Zs
),
next_step(Directions, Move, Remain),
G =.. [Move, Node, To], G,
NewIndex is Index + 1,
zloop(Remain, To, NewIndex, NewZs, Offset, Stride, Loop).
starts(Starts) :- findall(X, X to _, Nodes), include(is_start, Nodes, Starts).
is_start(Node) :- atom_chars(Node, [_, _, a]).
is_end(Node) :- atom_chars(Node, [_, _, z]).
next_step([Move | Remain], Move, Remain).
next_step([], Move, Remain) :- direction_list([Move | Remain]).
direction_list(Dir) :- direction(Str), atom_chars(Str, Dir).
direction_len(Len) :- direction_list(D), length(D, Len).
same_elements([_]).
same_elements([X-_, Y-Z2 | Cdr]) :- X =:= Y, same_elements([Y-Z2 | Cdr]).

9
08/test.pl Normal file
View File

@ -0,0 +1,9 @@
% cat input.txt \
% | sed -r -e 's~^(.*) = \((.*), (.*)\)$~\L\1 to \L\2-\L\3.~' \
% | sed -r -e 's~^([RL]+)$~:- op(700, xfx, to).\ndirection("\L\1").~' > input.pl
:- op(700, xfx, to).
direction("llr").
aaa to bbb-bbb.
bbb to aaa-zzz.
zzz to zzz-zzz.

9
08/test.txt Normal file
View File

@ -0,0 +1,9 @@
RL
AAA = (BBB, CCC)
BBB = (DDD, EEE)
CCC = (ZZZ, GGG)
DDD = (DDD, DDD)
EEE = (EEE, EEE)
GGG = (GGG, GGG)
ZZZ = (ZZZ, ZZZ)

11
08/test2.pl Normal file
View File

@ -0,0 +1,11 @@
:- op(700, xfx, to).
direction("lr").
mma to mmb-xxx.
mmb to xxx-mmz.
mmz to mmb-xxx.
nna to nnb-xxx.
nnb to nnc-nnc.
nnc to nnz-nnz.
nnz to nnb-nnb.
xxx to xxx-xxx.

10
08/test2.txt Normal file
View File

@ -0,0 +1,10 @@
LR
11A = (11B, XXX)
11B = (XXX, 11Z)
11Z = (11B, XXX)
22A = (22B, XXX)
22B = (22C, 22C)
22C = (22Z, 22Z)
22Z = (22B, 22B)
XXX = (XXX, XXX)