Compare commits

..

31 Commits

Author SHA1 Message Date
7f398eed00 2023 - Day 25 2023-12-25 17:05:00 +01:00
7951f60e7f Improved day 24 solution 2023-12-25 01:01:29 +01:00
6233ade178 Fixed formatting 2023-12-25 00:41:27 +01:00
fbd9e84f5f 2023 - Day 24 2023-12-24 23:53:36 +01:00
72e4c18b31 2023 - Day 23 2023-12-24 16:26:54 +01:00
e1d2a785f5 2023 - Day 22 2023-12-23 03:53:04 +01:00
295bfed6b4 Optimzed the solution for day 21 and actually calculate the answer for part 2 in code 2023-12-22 01:59:35 +01:00
6aaca41194 Kinda did part 2 2023-12-21 16:21:24 +01:00
6195d1579a 2023 - Day 21 [Part 1] 2023-12-21 15:24:47 +01:00
7320181194 Properly solve day 20 part 2 2023-12-20 17:36:34 +01:00
fbceb13123 2023 - Day 20 [Part 2 works with manual help] 2023-12-20 15:26:09 +01:00
bd741d38d4 2023 - Day 19 2023-12-19 14:26:49 +01:00
800325b518 2023 - Day 18 2023-12-18 13:38:33 +01:00
6a69dd2a8f 2023 - Day 17 2023-12-18 00:03:45 +01:00
002c7ad007 2023 - Day 16 2023-12-17 23:42:27 +01:00
9004a8c891 2023 - Day 15 2023-12-15 11:34:00 +01:00
6416c98c73 2023 - Day 14 2023-12-15 10:24:10 +01:00
a9fe2fa9be 2023 - Day 13 2023-12-14 01:15:27 +01:00
86202a10e6 Added early abort if there are too many damaged springs in a row 2023-12-12 14:55:31 +01:00
250417760b 2023 - Day 12 2023-12-12 14:54:55 +01:00
a8035fd0fc 2023 - Day 11 2023-12-11 11:56:14 +01:00
058653a3d9 Made my initial solution work 2023-12-10 21:18:48 +01:00
7734633c9f 2023 - Day 10 2023-12-10 20:25:19 +01:00
d0e6c3c4ad 2023 - Day 09 2023-12-09 19:20:11 +01:00
5cb00bb9a9 Improved new script 2023-12-09 01:07:15 +01:00
22e26996ad 2023 - Day 08 2023-12-08 23:41:17 +01:00
47ff0fd30a Optimized the solution and fix bugs that did not effect the results 2023-12-07 13:57:59 +01:00
ac3bca6139 2023 - Day 07 2023-12-07 12:40:28 +01:00
be45fce088 2023 - Day 06 2023-12-06 13:33:47 +01:00
c2b8638be2 Cleanup and added comments 2023-12-05 22:54:35 +01:00
408473c50a Prefer this syntax for only taking the second part of a split 2023-12-05 22:02:46 +01:00
77 changed files with 14586 additions and 72 deletions

View File

@@ -8,6 +8,8 @@ edition = "2021"
[dependencies] [dependencies]
anyhow = "1.0.75" anyhow = "1.0.75"
lazy_static = "1.4.0" lazy_static = "1.4.0"
nalgebra = "0.32.3"
petgraph = "0.6.4"
regex = "1.10.2" regex = "1.10.2"
[features] [features]

2
2023/input/06/input Normal file
View File

@@ -0,0 +1,2 @@
Time: 42 68 69 85
Distance: 284 1005 1122 1341

2
2023/input/06/test-1 Normal file
View File

@@ -0,0 +1,2 @@
Time: 7 15 30
Distance: 9 40 200

1000
2023/input/07/input Normal file

File diff suppressed because it is too large Load Diff

5
2023/input/07/test-1 Normal file
View File

@@ -0,0 +1,5 @@
32T3K 765
T55J5 684
KK677 28
KTJJT 220
QQQJA 483

740
2023/input/08/input Normal file
View File

@@ -0,0 +1,740 @@
LRRRLLRLLRRLRLRRRLRLRRRLRRLLRRRLRRLRLLRLLRRLRLLLLRRLRRLRLLRRLRRRLLLRRLRLRRLRRRLRRRLLRLRRRLLRRLRRRLRRLRLRRLRRLLRLRLRRRLRRLRRLRRRLRRLRRLRLRRRLRRRLRRRLLLRLRRLRLRRRLRRRLRRLRRLLRLRRLLRRLLRLRRLRLRRLRRRLRLRRLRLRRRLLRRLLRLRRRLRRRLRRRLRRRLLLRLRRLRRRLRRRLRLLRRLLRRLRLRLLRRLRRLLRRRLRLRRRLRRRR
RTF = (TRM, KNP)
FNJ = (DRR, MJH)
KNM = (CGF, LSP)
MDH = (CMN, VKC)
VKM = (FLM, SNG)
CMK = (JNV, PHR)
XJN = (GLC, SXG)
MGJ = (GCQ, XFC)
VKV = (DCV, QND)
HJR = (JMR, TKR)
QDR = (NNR, VBQ)
NGT = (QPS, JRL)
LNP = (XLG, HJN)
TRT = (CBR, BGZ)
QMP = (NTN, QPC)
LMV = (CGS, NGH)
FLV = (QMV, QNL)
RHV = (BGC, RTF)
SLD = (BSP, BNH)
SNK = (XCJ, QGG)
CPM = (RHJ, TKJ)
JGS = (XPM, FRL)
MFC = (DFM, HHP)
TDP = (FCD, RRJ)
JSS = (TQN, PTG)
XBD = (RTF, BGC)
NLH = (RBF, MKL)
MTV = (JCJ, BNV)
BSP = (RMB, GLP)
RBD = (MGM, RBG)
KGT = (BDQ, KBL)
SCC = (CXH, PJD)
SST = (HCP, HVM)
MVK = (JJL, LKV)
LLV = (KSH, TSN)
CDK = (TDR, GPN)
FQL = (HKL, DLZ)
XSQ = (NBX, VTC)
JGV = (HFL, PSV)
PCH = (FXX, QGP)
PMJ = (VHS, SMQ)
VTC = (CTB, HPS)
SPM = (XSD, FFP)
BCC = (XGG, VRC)
LPP = (SMD, SRF)
DDS = (XJN, NNQ)
HNH = (DXB, SPC)
CNH = (TCP, GCL)
XDP = (DPP, CPM)
VBX = (XJN, NNQ)
HCK = (NRF, LBG)
PXX = (HCX, PBL)
XKV = (HRB, HGC)
CHH = (RHT, KKX)
PPN = (NXV, PGP)
TKJ = (CSL, VSS)
HCP = (HDT, NVR)
JMM = (CTM, FXL)
XMF = (JVP, BBV)
QXD = (XHV, PGF)
KNP = (NNC, PHX)
NKR = (DTK, DLL)
RLJ = (NKB, QQM)
FKG = (KSG, RDQ)
VKF = (GQH, DJQ)
LKB = (FFP, XSD)
LGR = (FJT, KHV)
HJN = (DXT, VSG)
JJR = (GPN, TDR)
PKQ = (PBG, XSG)
VGT = (RRK, PJT)
GJR = (CTH, HML)
BKV = (HTL, XKH)
PGR = (SPV, LFG)
TKX = (FHJ, SJD)
RPF = (CML, XXS)
DGP = (BDQ, KBL)
PPX = (JXH, TKL)
VMJ = (HLL, FHX)
GDK = (SDR, TBL)
RXG = (NNX, JCB)
DLN = (RLJ, FPL)
MJH = (TXS, PXX)
QQD = (THQ, GJN)
NQS = (CBF, FQL)
SLK = (MLG, MGJ)
KVR = (GDB, VTQ)
DHC = (GVG, RTQ)
FLM = (TRK, NQM)
SPC = (RNS, BSB)
QMT = (LFB, BSX)
GCS = (LMB, QXS)
FVK = (TDP, XMK)
RTQ = (DSC, HDP)
PCG = (DKM, KDJ)
DKM = (PKV, RXG)
HCX = (MRM, GRM)
NLM = (XDX, KNM)
PKD = (LVC, QLT)
QPD = (MNT, ZZZ)
TSN = (RQF, BSG)
VLC = (TBH, BNQ)
VVD = (MTV, JVT)
GXD = (JMM, HSF)
TPT = (TLL, HFC)
MRM = (VTD, KVR)
TFF = (RPF, MSH)
PBJ = (BMM, LTG)
HGC = (VGT, TRG)
BFM = (CDL, KLQ)
TRM = (PHX, NNC)
CCN = (BGG, MVK)
FCK = (KBP, BRX)
GDM = (DQR, HRH)
PTG = (QDR, JRK)
SCN = (MRX, LNJ)
HSF = (FXL, CTM)
SQN = (HFS, KXS)
HCQ = (SCN, CPR)
FSK = (RVX, DGG)
VTQ = (CGD, QHG)
DPP = (RHJ, TKJ)
RRK = (BFN, QNH)
GTC = (GTP, KGJ)
FSN = (DRR, MJH)
GKC = (KQX, QSP)
CPN = (RVX, DGG)
KBL = (BVV, GJR)
CTM = (SLD, DRK)
LFR = (CHT, PCB)
SNG = (NQM, TRK)
KSG = (QFM, QCT)
DSV = (NKR, VMK)
GNB = (CPN, FSK)
HKD = (XBB, GFV)
NQM = (HNH, CCR)
NJS = (GVV, LPP)
DCG = (LCN, MGN)
SVN = (CBR, CBR)
FXX = (FNJ, FSN)
DFR = (GDK, RXK)
KMQ = (KXJ, LMV)
PHX = (QKS, KPF)
LKM = (QQD, VGN)
JSG = (LGD, VVD)
MGM = (BQJ, CTP)
PDF = (MJB, CPQ)
NGX = (MVS, PBJ)
QPC = (LJR, RGZ)
MRJ = (GJB, TJG)
PCR = (CVR, MSD)
SSF = (PFK, TKC)
RJP = (LSN, NJS)
QMS = (MVS, PBJ)
HCV = (LNP, BKR)
HXH = (MNT, MNT)
DJD = (MMQ, PLB)
PKV = (NNX, JCB)
LGX = (KBP, BRX)
GHT = (XSQ, HSD)
BGG = (JJL, LKV)
NRF = (SSK, NTV)
QSV = (PPV, VJB)
LHP = (PTG, TQN)
VGN = (GJN, THQ)
PBH = (GXD, NNB)
MMJ = (JKS, CMK)
XVC = (LLV, GRL)
RST = (SJS, BRN)
BDQ = (BVV, GJR)
HVM = (HDT, NVR)
DGK = (NGN, VDN)
GQN = (KSG, RDQ)
MKL = (DCG, QDT)
BFL = (MMQ, PLB)
MSD = (DNM, MCC)
DFM = (NSC, FLV)
DJQ = (CBS, VHP)
RJD = (MGF, SCR)
XQK = (VBX, DDS)
PGP = (KGT, DGP)
TKL = (LKM, MGV)
RVX = (PKD, MNK)
GJB = (HDG, XTV)
HFG = (RJP, VXB)
BSG = (HXH, QPD)
KXS = (MKC, CDM)
QKV = (XMF, CJX)
XKJ = (XQK, RDH)
VHS = (SNK, PHP)
GRM = (KVR, VTD)
GLC = (KJM, QHK)
KHC = (LMV, KXJ)
NTN = (LJR, LJR)
BFN = (BCC, GPK)
HML = (RLX, MDH)
BTD = (HHQ, XTH)
DRR = (PXX, TXS)
BBP = (SVN, TRT)
FHX = (VRK, JQL)
JXH = (LKM, MGV)
DNF = (HFS, KXS)
MNT = (DCX, FDP)
MSH = (XXS, CML)
BNV = (JPL, MPG)
KGJ = (NSL, QQC)
BKR = (HJN, XLG)
KJG = (LTM, RNL)
QGG = (QDQ, HVT)
MNK = (LVC, QLT)
NNB = (HSF, JMM)
XBF = (GQH, DJQ)
GQH = (VHP, CBS)
KJM = (FGM, DML)
MRX = (BFM, VTN)
CPR = (MRX, LNJ)
LRP = (MCX, LSD)
QHL = (VLP, VLP)
VKC = (TGM, DNT)
FRN = (LGX, FCK)
MRR = (PCG, GTG)
QTT = (NRJ, CKC)
XVK = (QRQ, MRJ)
SJD = (BGN, XKR)
CKT = (KPH, MRR)
HFB = (JKS, CMK)
MJB = (RSX, XVC)
HSD = (NBX, VTC)
HHQ = (VPR, TNF)
KQT = (FHX, HLL)
BMX = (GQP, VKM)
BKK = (CNH, FNN)
CXV = (XMF, CJX)
BRX = (FQJ, QMT)
MQV = (NRJ, CKC)
QBR = (QSV, MTB)
CDL = (JHM, QXD)
XTH = (VPR, TNF)
BBJ = (FJT, KHV)
CXS = (MGF, SCR)
HBL = (XKB, XKJ)
PHT = (BDS, KHF)
RJR = (QLS, HCK)
THQ = (GCS, GXV)
QNB = (BBJ, LGR)
XFC = (CFP, XDP)
BMM = (DQF, TGS)
NVR = (QNB, HVX)
QHG = (XRB, DPB)
HFS = (MKC, CDM)
LCK = (HXR, QPF)
GHF = (NQP, RBD)
XPM = (RVC, QSX)
CFP = (CPM, DPP)
GJC = (PPN, FMR)
QFM = (XCR, PPX)
XCF = (QKV, CXV)
TTX = (HTC, HTC)
XLG = (DXT, VSG)
QNH = (GPK, BCC)
FHJ = (XKR, BGN)
SPV = (RVF, DFR)
FNN = (GCL, TCP)
SXG = (QHK, KJM)
TSD = (QBR, MLV)
PFV = (KXK, NQX)
LKS = (LKB, SPM)
DQF = (XKV, QKR)
HHT = (LHP, JSS)
NSH = (MBK, PRM)
SRF = (GDM, CPD)
BDS = (GDN, RJB)
KQX = (HVS, JGS)
JHM = (XHV, PGF)
KXF = (LNP, BKR)
KRB = (MHM, NDN)
FHR = (JRL, QPS)
GJN = (GCS, GXV)
QLT = (DFK, NGQ)
GTP = (NSL, QQC)
NCM = (PMJ, QTF)
JVP = (NVX, KKM)
JRK = (NNR, VBQ)
CBR = (QGX, QDB)
SJS = (PGG, PGG)
DML = (NMJ, TKX)
GPN = (JDL, DHV)
HKL = (FHR, NGT)
CVN = (FXX, QGP)
TBH = (GJC, SGC)
VTM = (LFR, NTZ)
JFC = (VVD, LGD)
BSB = (VLC, GML)
MGV = (QQD, VGN)
PGG = (TRJ, TRJ)
LGD = (JVT, MTV)
TKC = (BFB, QCD)
CPX = (HXC, MBP)
JGD = (LHP, JSS)
CBS = (VVJ, FQR)
KMB = (HCK, QLS)
VBT = (CXJ, PHT)
VPR = (JFC, JSG)
TKR = (MVD, HFG)
RXK = (SDR, TBL)
DRK = (BNH, BSP)
SCR = (PCR, SXP)
DMN = (VDN, NGN)
KTA = (FHR, NGT)
PHP = (XCJ, QGG)
KPF = (TPV, VBM)
MGQ = (DCV, QND)
LSN = (GVV, LPP)
KPM = (BDK, GTC)
QMM = (DJD, BFL)
DXT = (PGR, BMQ)
MKX = (PKQ, BCN)
BFB = (QMM, TXJ)
GFD = (LSD, MCX)
PFK = (QCD, BFB)
LTM = (DLV, DCC)
SSK = (SRG, NSB)
LHC = (TDJ, FPQ)
LFG = (DFR, RVF)
RBH = (VKM, GQP)
GDN = (DMN, DGK)
GTG = (DKM, KDJ)
BVK = (KVJ, KGP)
QMQ = (TRJ, HMF)
NNQ = (GLC, SXG)
XTJ = (MXN, MDT)
MCP = (HFL, PSV)
HTC = (LFR, LFR)
DLV = (KRB, KBJ)
RBG = (CTP, BQJ)
CDD = (XKB, XKJ)
RBF = (QDT, DCG)
VJL = (MRR, KPH)
HRH = (CQC, NSH)
FNG = (XBD, RHV)
QGM = (FKG, GQN)
BDK = (KGJ, GTP)
HDG = (DPD, GVF)
GFP = (XKH, HTL)
NDJ = (CPX, LCR)
NGN = (CKT, VJL)
QRQ = (TJG, GJB)
VSS = (TLF, MKX)
DHV = (BKV, GFP)
QXS = (MBN, MKK)
NBX = (HPS, CTB)
LXB = (NCM, RRR)
GQL = (GKC, GCC)
JCB = (RSG, PDF)
JRL = (QMN, NKD)
PBL = (MRM, GRM)
KHF = (GDN, RJB)
MPG = (GFQ, MFC)
VTN = (KLQ, CDL)
CSN = (HQG, HQG)
KSH = (RQF, RQF)
BGQ = (CCG, NLH)
GVV = (SRF, SMD)
JJL = (QMS, NGX)
HBT = (CGH, RQJ)
RSX = (LLV, GRL)
CTH = (RLX, MDH)
CXH = (GRV, RLB)
QKR = (HGC, HRB)
TDR = (DHV, JDL)
TBL = (DNF, SQN)
BMQ = (SPV, LFG)
MVX = (XQS, MKV)
RNL = (DLV, DCC)
CCG = (RBF, MKL)
TRJ = (FLG, FLG)
XFP = (NLL, BTD)
CHT = (NCJ, BGQ)
KMK = (CXV, QKV)
MVS = (BMM, LTG)
PNM = (HTC, VTM)
BSX = (HJR, PXV)
RSV = (BTD, NLL)
QHK = (FGM, DML)
QNG = (RQP, QHB)
XRX = (KXF, HCV)
DPD = (PCD, GHT)
KXJ = (CGS, NGH)
VTD = (GDB, VTQ)
QND = (BVJ, HKD)
VBQ = (PBH, SBT)
SGC = (FMR, PPN)
NTZ = (PCB, CHT)
DQR = (NSH, CQC)
KVJ = (SCC, JCN)
SXP = (CVR, MSD)
RQP = (NNF, DRD)
CJX = (JVP, BBV)
RQJ = (XCF, KMK)
PGF = (SGX, DHC)
JLM = (XQS, MKV)
KBB = (BML, NSJ)
PMD = (HCQ, RQS)
VDN = (VJL, CKT)
LCR = (HXC, MBP)
GFV = (LRP, GFD)
PLA = (GFS, XPP)
FPQ = (JLD, CJJ)
KBP = (FQJ, QMT)
BBV = (NVX, KKM)
DSC = (RTV, KMV)
KKX = (VKF, XBF)
MDT = (RQQ, RST)
PJT = (QNH, BFN)
MGX = (HXR, QPF)
RHT = (XBF, VKF)
DLZ = (NGT, FHR)
RRJ = (JLM, MVX)
SXV = (QRQ, MRJ)
BJX = (FMC, LXB)
CJJ = (GHF, GXQ)
HQR = (TTX, TTX)
QHB = (NNF, DRD)
RGZ = (XPP, GFS)
TCP = (CXS, RJD)
KRJ = (MLV, QBR)
HXC = (NLG, KBB)
MGN = (GNB, FCS)
GXQ = (RBD, NQP)
GPK = (XGG, VRC)
LQD = (CVN, PCH)
MJV = (VLP, QMP)
LNJ = (VTN, BFM)
QSX = (FMQ, QNG)
GRL = (KSH, TSN)
VJB = (HHT, JGD)
QGP = (FSN, FNJ)
TXT = (PCH, CVN)
CML = (TSV, GQL)
FQJ = (LFB, BSX)
PHR = (LVG, BNJ)
PMX = (KXF, HCV)
FRL = (QSX, RVC)
HDP = (KMV, RTV)
SBT = (NNB, GXD)
QLS = (NRF, LBG)
RDH = (DDS, VBX)
TPV = (VHH, KJG)
KBJ = (NDN, MHM)
MCX = (LCK, MGX)
PPT = (XBD, RHV)
QMN = (XRX, PMX)
DCC = (KBJ, KRB)
KPC = (XDX, KNM)
MFM = (VRL, MHV)
CGD = (DPB, XRB)
CGS = (KJF, KPM)
XCJ = (QDQ, HVT)
XGG = (MCP, JGV)
QGX = (VTS, BJX)
QSP = (JGS, HVS)
RQS = (CPR, SCN)
NSJ = (RBK, TPT)
DGG = (MNK, PKD)
MLG = (GCQ, XFC)
BML = (TPT, RBK)
KHV = (TSH, BKK)
BQJ = (XVK, SXV)
GCC = (KQX, QSP)
VMK = (DLL, DTK)
FMR = (NXV, PGP)
GVF = (PCD, GHT)
HLL = (JQL, VRK)
PCB = (NCJ, BGQ)
TSV = (GKC, GCC)
GLP = (CCN, LMC)
CDM = (NHJ, QGM)
MDJ = (KGP, KVJ)
LSD = (LCK, MGX)
MXN = (RQQ, RST)
DFK = (VMJ, KQT)
BGN = (BVK, MDJ)
LJR = (GFS, XPP)
RHJ = (VSS, CSL)
VRK = (FRN, LRR)
CGF = (RBH, BMX)
DLL = (CKP, KMN)
LVC = (NGQ, DFK)
MVD = (RJP, VXB)
TTG = (NKR, VMK)
RCV = (RQS, HCQ)
NQP = (MGM, RBG)
HNT = (FPL, RLJ)
JCJ = (JPL, MPG)
VHJ = (CDD, HBL)
HFL = (QHL, MJV)
XMK = (RRJ, FCD)
NHJ = (FKG, GQN)
VTS = (LXB, FMC)
FGM = (NMJ, TKX)
JLD = (GHF, GXQ)
NSL = (LQD, TXT)
HHL = (LKB, SPM)
JPL = (GFQ, MFC)
XRB = (HBT, KRM)
MNM = (MHV, VRL)
CCR = (DXB, SPC)
CPQ = (RSX, XVC)
QQM = (TFL, RJV)
XXK = (SLK, JST)
LBT = (CBF, CBF)
XKR = (MDJ, BVK)
QMV = (QTT, MQV)
CTP = (SXV, XVK)
NVX = (HQR, TNP)
HQG = (SVN, SVN)
XCR = (JXH, TKL)
PJD = (GRV, RLB)
CGH = (XCF, KMK)
VRC = (MCP, JGV)
GCQ = (XDP, CFP)
DCV = (BVJ, HKD)
SRG = (PSK, QLV)
BGC = (KNP, TRM)
TDJ = (JLD, CJJ)
FBH = (NQX, KXK)
TRK = (CCR, HNH)
RRR = (PMJ, QTF)
LJA = (QGX, QDB)
KJF = (GTC, BDK)
FFP = (JDS, FVK)
GML = (TBH, BNQ)
KGP = (JCN, SCC)
JMR = (HFG, MVD)
MBP = (KBB, NLG)
CBF = (HKL, HKL)
FDP = (CDK, JJR)
SDR = (SQN, DNF)
VXB = (LSN, NJS)
JDL = (GFP, BKV)
XHV = (DHC, SGX)
LRR = (FCK, LGX)
VVJ = (XTJ, KKJ)
HXR = (BGT, LFH)
HDT = (QNB, HVX)
SMQ = (PHP, SNK)
KDJ = (PKV, RXG)
GFS = (NDJ, SCX)
QQC = (TXT, LQD)
QCD = (TXJ, QMM)
NGQ = (KQT, VMJ)
PRM = (KMQ, KHC)
NCJ = (NLH, CCG)
FJT = (BKK, TSH)
LMB = (MBN, MKK)
XQS = (SST, VBD)
MGF = (PCR, SXP)
TJG = (HDG, XTV)
SGX = (GVG, RTQ)
CKC = (CSN, JXD)
JVT = (JCJ, BNV)
QDQ = (PFV, FBH)
FQR = (KKJ, XTJ)
NXV = (DGP, KGT)
BCN = (PBG, XSG)
DRD = (LHC, TRB)
JDS = (TDP, XMK)
MKC = (QGM, NHJ)
JST = (MLG, MGJ)
TRG = (RRK, PJT)
JCN = (PJD, CXH)
PXV = (JMR, TKR)
MCC = (LBT, NQS)
RBK = (HFC, TLL)
CKP = (BRH, CHH)
BVJ = (XBB, GFV)
HRB = (TRG, VGT)
NNF = (TRB, LHC)
DXB = (RNS, BSB)
VBM = (KJG, VHH)
PPV = (JGD, HHT)
MHV = (TSD, KRJ)
BNH = (GLP, RMB)
NLG = (NSJ, BML)
LBG = (SSK, NTV)
NMJ = (SJD, FHJ)
PSK = (XCD, SSF)
CSL = (MKX, TLF)
MKK = (LKS, HHL)
VBD = (HVM, HCP)
NNX = (RSG, PDF)
HGT = (RCV, PMD)
PLB = (RSV, XFP)
KXK = (VKV, MGQ)
MHM = (KFR, CNM)
AAA = (DCX, FDP)
RMB = (CCN, LMC)
BGT = (BBF, TFF)
DNT = (RNT, XXK)
GVG = (HDP, DSC)
MKV = (VBD, SST)
HFC = (MMJ, HFB)
NDN = (KFR, CNM)
RVC = (FMQ, QNG)
JNV = (BNJ, LVG)
TRB = (FPQ, TDJ)
XDX = (LSP, CGF)
RJB = (DMN, DGK)
CPD = (DQR, HRH)
NRJ = (CSN, JXD)
XXS = (TSV, GQL)
FCD = (JLM, MVX)
BNQ = (GJC, SGC)
TNP = (TTX, PNM)
NSB = (QLV, PSK)
HVX = (BBJ, LGR)
JQL = (LRR, FRN)
GXV = (LMB, QXS)
HBZ = (PPT, FNG)
NNR = (PBH, SBT)
CTB = (RJR, KMB)
HTL = (KPC, NLM)
RLX = (VKC, CMN)
NGH = (KPM, KJF)
SMD = (CPD, GDM)
LKV = (QMS, NGX)
DCX = (JJR, CDK)
TNF = (JFC, JSG)
XTV = (GVF, DPD)
LVG = (DLN, HNT)
CVR = (DNM, MCC)
JXA = (CHT, PCB)
DPB = (HBT, KRM)
LFH = (BBF, TFF)
VHH = (RNL, LTM)
DNM = (LBT, LBT)
JXD = (HQG, BBP)
RNS = (GML, VLC)
KKJ = (MDT, MXN)
NFA = (FNG, PPT)
XBB = (GFD, LRP)
HMF = (FLG, HBZ)
LTG = (TGS, DQF)
HHP = (NSC, FLV)
GFQ = (HHP, DFM)
XCD = (TKC, PFK)
FXL = (SLD, DRK)
LMC = (BGG, MVK)
XXL = (PHT, CXJ)
FPL = (NKB, QQM)
LFB = (PXV, HJR)
MBN = (LKS, HHL)
QKB = (HBL, CDD)
RJV = (VHJ, QKB)
KMV = (DSV, TTG)
QPF = (BGT, LFH)
TFL = (VHJ, QKB)
SCX = (CPX, LCR)
BRH = (KKX, RHT)
XKH = (KPC, NLM)
FCS = (CPN, FSK)
FMQ = (QHB, RQP)
GRV = (MFM, MNM)
QPS = (NKD, QMN)
NTV = (NSB, SRG)
NLL = (XTH, HHQ)
QDT = (LCN, MGN)
RTV = (DSV, TTG)
RLB = (MNM, MFM)
QKS = (VBM, TPV)
QCT = (XCR, PPX)
KMN = (BRH, CHH)
TLF = (BCN, PKQ)
JKS = (JNV, PHR)
PBG = (VBT, XXL)
NQX = (VKV, MGQ)
FLG = (FNG, PPT)
RNT = (SLK, JST)
BNJ = (DLN, HNT)
QLV = (SSF, XCD)
FMC = (RRR, NCM)
BRN = (PGG, QMQ)
MBK = (KMQ, KHC)
TXJ = (DJD, BFL)
LCN = (FCS, GNB)
TLL = (MMJ, HFB)
GDB = (QHG, CGD)
XSD = (JDS, FVK)
BBF = (RPF, MSH)
NSC = (QNL, QMV)
GQP = (FLM, SNG)
LSP = (BMX, RBH)
KPH = (PCG, GTG)
XPP = (SCX, NDJ)
QNL = (MQV, QTT)
TSH = (FNN, CNH)
MMQ = (RSV, XFP)
XSG = (XXL, VBT)
GCL = (RJD, CXS)
XHD = (RCV, PMD)
TXS = (HCX, PBL)
RSG = (CPQ, MJB)
CXJ = (KHF, BDS)
BGZ = (QDB, QGX)
MTB = (VJB, PPV)
MLV = (QSV, MTB)
NKB = (RJV, TFL)
QDB = (VTS, BJX)
KLQ = (QXD, JHM)
HPS = (RJR, KMB)
TQN = (JRK, QDR)
VHP = (FQR, VVJ)
VRL = (TSD, KRJ)
RDQ = (QCT, QFM)
BVV = (HML, CTH)
QTF = (VHS, SMQ)
CMN = (TGM, DNT)
TGM = (XXK, RNT)
HVS = (FRL, XPM)
NKD = (XRX, PMX)
VLP = (NTN, NTN)
CNM = (HGT, XHD)
PSV = (QHL, MJV)
RQF = (HXH, HXH)
HVT = (FBH, PFV)
RVF = (GDK, RXK)
PCD = (HSD, XSQ)
ZZZ = (FDP, DCX)
KKM = (HQR, TNP)
KRM = (CGH, RQJ)
VSG = (PGR, BMQ)
KFR = (HGT, XHD)
RQQ = (SJS, BRN)
NNC = (QKS, KPF)
CQC = (MBK, PRM)
XKB = (RDH, XQK)
TGS = (XKV, QKR)
DTK = (CKP, KMN)

9
2023/input/08/test-1 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)

5
2023/input/08/test-2 Normal file
View File

@@ -0,0 +1,5 @@
LLR
AAA = (BBB, BBB)
BBB = (AAA, ZZZ)
ZZZ = (ZZZ, ZZZ)

10
2023/input/08/test-3 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)

200
2023/input/09/input Normal file
View File

@@ -0,0 +1,200 @@
4 7 14 17 8 -3 40 284 1054 3047 7774 18514 42224 93097 198790 410780 820904 1587039 2972406 5405827 9575760
13 26 44 80 164 361 809 1779 3761 7595 14712 27667 51418 96397 185632 370526 764205 1608876 3406248 7160410 14814288
7 29 66 132 264 549 1164 2429 4873 9313 16946 29454 49122 78969 122892 185823 273899 394645 557170 772376 1053180
4 12 30 67 132 234 382 585 852 1192 1614 2127 2740 3462 4302 5269 6372 7620 9022 10587 12324
2 -7 -12 5 83 304 825 1930 4126 8339 16326 31524 60745 117473 228159 444058 863130 1669793 3205496 6091003 11433015
19 37 58 82 109 139 172 208 247 289 334 382 433 487 544 604 667 733 802 874 949
13 38 85 173 329 598 1062 1881 3394 6351 12388 24919 50736 102855 205682 404727 785534 1511550 2900900 5582289 10809214
22 36 50 64 78 92 106 120 134 148 162 176 190 204 218 232 246 260 274 288 302
12 19 44 94 170 273 428 741 1505 3379 7690 16965 35920 73403 146423 288884 571005 1142650 2328614 4832776 10161751
13 31 55 85 121 163 211 265 325 391 463 541 625 715 811 913 1021 1135 1255 1381 1513
-1 -6 -11 -16 -21 -26 -31 -36 -41 -46 -51 -56 -61 -66 -71 -76 -81 -86 -91 -96 -101
-7 -4 1 5 18 78 281 836 2166 5113 11395 24648 52730 112561 239752 506795 1055794 2154637 4288752 8302746 15603689
10 10 6 10 58 234 708 1799 4086 8613 17277 33560 63876 119961 222947 410039 745066 1334612 2351960 4071710 6918670
6 -1 -4 6 38 101 204 356 566 843 1196 1634 2166 2801 3548 4416 5414 6551 7836 9278 10886
18 33 58 89 113 102 19 -151 -332 -237 816 4165 12155 28592 59313 112885 201446 341701 556086 874113 1333909
9 36 76 129 195 274 366 471 589 720 864 1021 1191 1374 1570 1779 2001 2236 2484 2745 3019
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
12 14 14 25 84 272 747 1794 3893 7803 14657 26060 44179 71811 112412 170067 249378 355244 492504 665411 876902
5 13 24 55 145 366 834 1719 3252 5736 9593 15522 24904 40677 69058 122831 227727 435239 849010 1679301 3353475
10 22 53 118 232 410 667 1018 1478 2062 2785 3662 4708 5938 7367 9010 10882 12998 15373 18022 20960
14 29 48 76 124 218 413 811 1591 3074 5862 11106 20993 39660 75101 143587 280453 566488 1190981 2597257 5806239
15 33 77 165 319 573 988 1673 2824 4813 8382 15035 27824 53013 103809 208864 431181 908257 1932899 4107549 8624741
0 6 20 51 122 297 735 1784 4130 9028 18687 37000 71067 134442 253856 482482 924903 1782520 3435024 6588364 12553249
12 24 34 38 31 7 -41 -121 -242 -414 -648 -956 -1351 -1847 -2459 -3203 -4096 -5156 -6402 -7854 -9533
13 32 57 100 187 357 665 1191 2060 3502 6052 11145 22655 50458 118076 278353 644947 1455264 3196219 6854814 14412615
15 34 66 133 280 581 1139 2078 3525 5580 8272 11499 14950 18007 19625 18188 11339 -4218 -32946 -80735 -155196
0 19 52 99 160 235 324 427 544 675 820 979 1152 1339 1540 1755 1984 2227 2484 2755 3040
11 26 63 142 292 548 958 1619 2768 4961 9380 18315 35875 68989 128765 232282 404897 683156 1118405 1781204 2766654
-3 9 28 56 113 247 537 1093 2078 3815 7117 14120 30148 67548 153076 341406 738867 1543937 3114970 6082220 11532363
6 24 62 125 229 410 741 1367 2569 4881 9326 17946 35052 70144 144457 304889 652104 1394482 2947110 6106207 12345559
2 3 22 69 150 282 532 1089 2378 5225 11082 22321 42606 77352 134280 224077 361170 564623 859166 1276365 1855942
7 14 28 42 58 106 286 856 2410 6225 14921 33702 72677 151193 305960 606484 1184929 2294888 4428038 8545010 16526252
9 12 31 92 230 485 896 1493 2287 3258 4341 5410 6260 6587 5966 3827 -571 -8168 -20133 -37896 -63182
1 14 51 136 315 677 1382 2701 5086 9304 16688 29580 52066 91131 158393 272609 463183 774946 1274521 2058632 3264765
13 25 39 68 145 346 837 1954 4338 9181 18700 37050 72020 138034 261208 487500 895339 1614537 2853781 4939576 8370171
-7 -9 -13 -8 42 219 678 1686 3698 7521 14657 27996 53216 101691 196743 387406 778956 1600221 3349773 7107057 15179205
16 24 40 65 104 176 320 592 1048 1708 2496 3151 3104 1316 -3928 -15274 -36608 -73424 -133256 -226179 -365384
-1 13 48 119 245 449 767 1284 2219 4089 8014 16311 33700 69739 143527 292235 585572 1148764 2196908 4083479 7364698
7 13 38 90 172 282 413 553 685 787 832 788 618 280 -273 -1093 -2237 -3767 -5750 -8258 -11368
0 -1 7 35 92 188 342 595 1028 1785 3101 5335 9008 14846 23828 37239 56728 84371 122739 174971 244852
27 47 73 114 189 331 594 1067 1900 3344 5800 9861 16316 26066 39879 57884 78673 97845 105787 84444 2783
2 -3 5 37 110 259 567 1228 2666 5762 12302 25860 53476 108682 216668 422661 804906 1493979 2700515 4753783 8153866
2 7 34 93 193 357 646 1190 2236 4245 8109 15629 30517 60387 120517 240638 476686 930395 1780876 3333989 6097449
21 35 49 61 65 50 -1 -112 -315 -651 -1171 -1937 -3023 -4516 -6517 -9142 -12523 -16809 -22167 -28783 -36863
11 25 52 109 215 389 663 1131 2061 4105 8657 18436 38415 77283 149720 279890 506719 891729 1530450 2568735 4225663
7 12 21 34 51 72 97 126 159 196 237 282 331 384 441 502 567 636 709 786 867
-1 5 24 73 186 425 907 1857 3705 7258 14006 26685 50350 94441 176685 330182 615659 1141583 2095476 3790157 6728418
15 29 60 126 262 540 1099 2180 4173 7718 13983 25401 47434 92431 187518 390006 816655 1698669 3485638 7045690 14060466
21 44 79 133 219 349 521 709 881 1097 1789 4415 12831 35974 92880 221911 497941 1065530 2205607 4473153 8983035
22 47 88 152 257 437 752 1310 2301 4034 6973 11811 19729 33185 57884 107000 209244 422965 859074 1716102 3331013
19 38 61 94 159 317 705 1587 3419 6928 13205 23812 40903 67359 106937 164433 245859 358634 511789 716186 984751
15 39 75 123 183 255 339 435 543 663 795 939 1095 1263 1443 1635 1839 2055 2283 2523 2775
18 29 46 74 118 183 274 396 554 753 998 1294 1646 2059 2538 3088 3714 4421 5214 6098 7078
1 0 -2 -7 -18 -26 29 336 1343 3952 9792 21583 43604 82278 146887 250430 410637 651152 1002898 1505637 2209738
9 22 54 107 180 269 367 464 547 600 604 537 374 87 -355 -986 -1843 -2966 -4398 -6185 -8376
15 30 63 128 258 533 1138 2479 5409 11662 24677 51151 103958 207625 408542 793752 1524859 2897750 5445011 10106818 18508538
3 11 27 66 172 435 1017 2207 4546 9091 17922 35038 67837 129431 242110 442339 787749 1366667 2310821 3811954 6143186
26 52 104 199 370 676 1223 2215 4061 7571 14281 26954 50311 92053 164242 285116 481420 791342 1268150 1984633 3038456
10 20 58 146 322 647 1212 2158 3735 6437 11263 20184 36980 68838 129680 247589 481942 963055 1982435 4192778 9037066
-3 0 19 79 235 602 1400 3014 6069 11520 20757 35725 59059 94234 145730 219212 321725 461904 650199 899115 1223467
2 9 16 23 30 37 44 51 58 65 72 79 86 93 100 107 114 121 128 135 142
8 10 20 50 115 236 457 892 1832 3957 8722 19039 40491 83533 167515 327971 629536 1188172 2208208 4042144 7284363
5 8 11 14 17 20 23 26 29 32 35 38 41 44 47 50 53 56 59 62 65
8 26 65 146 316 663 1341 2624 5023 9514 17937 33635 62411 113908 203613 355960 609658 1027726 1717281 2868628 4830662
9 17 37 78 149 259 417 632 913 1269 1709 2242 2877 3623 4489 5484 6617 7897 9333 10934 12709
20 38 78 154 280 470 738 1098 1564 2150 2870 3738 4768 5974 7370 8970 10788 12838 15134 17690 20520
7 24 47 81 136 225 362 557 805 1066 1233 1085 222 -2021 -6684 -15319 -30157 -54308 -91997 -148839 -232156
0 1 -2 -3 9 62 236 730 1970 4767 10534 21571 41427 75348 130820 218216 351556 549389 835806 1241593 1805533
3 6 17 53 156 407 939 1945 3678 6448 10644 16862 26335 42111 71980 135406 279566 615947 1402676 3226260 7393115
10 14 24 34 47 98 296 908 2528 6411 15120 33747 72146 148909 298384 583295 1118426 2117292 3987296 7525720 14319117
6 9 14 40 129 360 864 1837 3555 6422 11141 19209 34150 64331 129087 271621 585396 1266455 2713600 5713306 11768647
20 46 99 205 403 741 1279 2113 3437 5662 9612 16817 29922 53229 93386 160233 267810 435526 689481 1063925 1602829
1 -3 -16 -37 -52 -24 125 554 1603 4032 9538 21770 48166 103065 212703 422887 810357 1499095 2683124 4657661 7860848
15 27 41 48 38 19 62 398 1607 4947 12880 29877 63658 127217 242445 447220 810212 1462984 2670744 4988351 9600271
30 55 99 181 341 651 1226 2235 3912 6567 10597 16497 24871 36443 52068 72743 99618 134007 177399 231469 298089
8 19 40 95 231 522 1073 2037 3667 6440 11313 20214 36973 69143 131709 254841 500234 995487 2006112 4085673 8387151
12 29 60 119 244 510 1052 2120 4203 8274 16223 31560 60485 113437 207249 368051 635078 1065555 1740846 2774069 4319394
21 35 62 112 205 390 770 1534 3007 5757 10855 20481 39217 76578 151615 300791 590793 1138511 2141100 3919854 6982573
-1 0 5 14 27 44 65 90 119 152 189 230 275 324 377 434 495 560 629 702 779
15 25 54 108 189 298 441 637 927 1383 2116 3282 5085 7776 11647 17019 24223 33573 45330 59656 76557
13 15 16 23 58 163 406 888 1751 3187 5448 8857 13820 20839 30526 43618 60993 83687 112912 150075 196798
8 21 34 47 60 73 86 99 112 125 138 151 164 177 190 203 216 229 242 255 268
0 9 40 105 216 385 624 945 1360 1881 2520 3289 4200 5265 6496 7905 9504 11305 13320 15561 18040
5 9 31 90 225 511 1093 2256 4558 9063 17712 33854 62927 113248 196881 330673 537887 851569 1322065 2033214 3135009
14 32 65 126 231 399 652 1015 1516 2186 3059 4172 5565 7281 9366 11869 14842 18340 22421 27146 32579
16 31 59 114 216 393 692 1217 2225 4328 8874 18619 38863 79316 157097 301464 561142 1015477 1791117 3086528 5207418
25 48 85 150 280 562 1170 2410 4780 9072 16583 29586 52395 93748 172014 326185 638123 1275552 2571281 5162458 10224290
25 46 83 141 230 371 602 984 1607 2596 4117 6383 9660 14273 20612 29138 40389 54986 73639 97153 126434
18 31 60 135 311 678 1382 2668 4956 8961 15868 27573 47001 78512 128406 205538 322054 494259 743628 1097971 1592763
21 48 96 181 334 609 1091 1904 3219 5262 8322 12759 19012 27607 39165 54410 74177 99420 131220 170793 219498
18 28 41 75 171 406 911 1901 3730 7004 12834 23400 43124 80886 153787 292822 550230 1006860 1775083 2987825 4756165
7 16 48 120 261 531 1049 2030 3831 7006 12370 21072 34677 55257 85491 128774 189335 272364 384148 532216 725493
8 11 29 87 229 520 1042 1880 3091 4646 6332 7598 7326 3505 -7217 -30131 -73246 -148283 -271921 -467335 -766069
7 13 24 59 160 415 991 2177 4437 8473 15298 26319 43430 69115 106561 159781 233747 334533 469468 647299 878364
18 32 60 116 213 363 585 940 1624 3168 6820 15212 33440 70732 143055 277580 521391 960022 1757523 3240240 6062704
-4 -7 -1 28 110 302 699 1445 2744 4871 8183 13130 20266 30260 43907 62139 86036 116837 155951 204968 265670
22 35 67 129 230 384 629 1065 1918 3637 7031 13453 25038 45002 78009 130613 211782 333511 511531 766121 1123030
15 33 77 173 374 787 1624 3286 6502 12571 23801 44317 81531 148727 269365 483718 858087 1495811 2547551 4216723 6757554
18 47 97 189 354 628 1047 1642 2434 3429 4613 5947 7362 8754 9979 10848 11122 10507 8649 5129 -542
14 25 46 95 214 486 1051 2114 3943 6866 11288 17755 27083 40535 59955 87640 125532 173023 222266 249351 199012
18 36 60 90 126 168 216 270 330 396 468 546 630 720 816 918 1026 1140 1260 1386 1518
14 32 64 129 250 457 795 1334 2178 3470 5390 8143 11934 16927 23185 30588 38726 46764 53276 56045 51826
24 48 80 114 151 204 309 562 1228 3014 7682 19333 46981 109581 245726 532281 1120276 2304490 4659592 9309226 18462519
9 28 63 134 279 559 1060 1903 3283 5568 9499 16542 29453 53127 95812 170779 298549 509788 848991 1379086 2187099
8 8 7 5 2 -2 -7 -13 -20 -28 -37 -47 -58 -70 -83 -97 -112 -128 -145 -163 -182
-1 2 18 60 141 274 472 748 1115 1586 2174 2892 3753 4770 5956 7324 8887 10658 12650 14876 17349
20 27 34 41 48 55 62 69 76 83 90 97 104 111 118 125 132 139 146 153 160
10 30 62 108 170 257 399 681 1326 2881 6603 15220 34388 75445 160625 333097 676895 1357967 2711435 5430457 10976083
23 27 33 52 106 235 504 1010 1889 3323 5547 8856 13612 20251 29290 41334 57083 77339 103013 135132 174846
4 11 21 34 50 69 91 116 144 175 209 246 286 329 375 424 476 531 589 650 714
-4 -1 2 10 34 98 272 758 2068 5345 12890 28970 60994 121156 228656 412622 715868 1199635 1949474 3082442 4755794
21 30 31 25 13 -9 -55 -154 -355 -732 -1389 -2465 -4139 -6635 -10227 -15244 -22075 -31174 -43065 -58347 -77699
4 12 30 76 187 427 907 1844 3713 7600 15961 34160 73458 156678 328807 676706 1365506 2705112 5269876 10109828 19115437
9 23 58 116 205 355 653 1320 2867 6390 14107 30327 63214 128026 253037 490173 933684 1752420 3245799 5943513 10791206
17 16 22 56 148 344 725 1445 2800 5360 10241 19669 38091 74208 144420 278248 526283 971040 1740680 3024798 5090230
13 16 25 41 65 98 141 195 261 340 433 541 665 806 965 1143 1341 1560 1801 2065 2353
21 40 64 103 184 349 650 1152 1962 3302 5631 9792 17133 29596 50051 83992 145651 275472 582970 1341041 3177182
3 6 24 80 206 440 830 1452 2457 4176 7328 13390 25196 47830 89862 164942 293711 505906 842424 1356964 2116682
12 21 34 62 123 239 446 841 1713 3847 9168 22032 51708 116973 254314 532059 1073914 2096945 3971102 7310034 13106297
17 19 17 20 47 136 362 858 1829 3555 6414 11046 18963 34255 67667 145431 327161 740367 1644463 3545588 7396567
11 33 61 102 174 306 538 921 1517 2399 3651 5368 7656 10632 14424 19171 25023 32141 40697 50874 62866
10 22 44 75 115 171 284 598 1506 3938 9915 23607 53356 115562 242174 495118 993898 1967721 3852127 7463913 14308751
9 12 19 51 139 320 640 1186 2180 4174 8380 17155 34671 67931 128748 238449 439487 822724 1587149 3161951 6441487
11 32 68 126 212 338 545 948 1813 3685 7610 15551 31215 61722 120906 235602 457115 881274 1682148 3166760 5861114
4 6 11 16 18 14 1 -24 -64 -122 -201 -304 -434 -594 -787 -1016 -1284 -1594 -1949 -2352 -2806
5 14 17 8 -10 0 154 721 2238 5692 12832 26749 53001 101813 192341 360811 675779 1266182 2371803 4432002 8238072
7 17 40 78 149 302 645 1396 2970 6128 12256 23945 46252 89397 174271 343099 679057 1340763 2620584 5039928 9500511
11 26 61 121 225 420 795 1495 2735 4814 8129 13189 20629 31224 45903 65763 92083 126338 170213 225617 294697
6 5 11 28 67 169 437 1072 2412 4986 9617 17649 31475 55807 100744 188965 371746 762575 1603683 3390746 7095403
11 14 26 58 124 244 467 942 2078 4844 11280 25359 54540 112843 227363 452379 899585 1801110 3636518 7379896 14964376
7 13 23 37 73 185 497 1265 2992 6660 14232 29750 61661 127515 263009 538679 1089674 2167524 4228610 8083880 15151202
12 34 65 112 187 307 494 775 1182 1752 2527 3554 4885 6577 8692 11297 14464 18270 22797 28132 34367
24 45 76 117 168 229 300 381 472 573 684 805 936 1077 1228 1389 1560 1741 1932 2133 2344
20 42 81 151 274 474 782 1271 2159 4052 8462 18855 42715 95570 208876 445649 931901 1920493 3921194 7964326 16129275
14 15 20 43 112 286 687 1547 3270 6509 12258 21959 37624 61972 98581 152055 228206 334251 479024 673203 929552
16 26 49 113 263 564 1104 1997 3386 5446 8387 12457 17945 25184 34554 46485 61460 80018 102757 130337 163483
13 21 44 91 174 319 600 1215 2635 5876 12970 27755 57206 113784 219872 416611 781841 1466127 2763048 5241467 9985262
10 18 39 92 210 445 881 1679 3202 6299 12868 26894 56330 116568 237008 473629 932842 1815712 3497445 6665552 12552178
23 44 67 91 132 234 485 1058 2316 5059 11078 24359 53620 117500 254920 545448 1149018 2383217 4873604 9845500 19687217
6 0 -11 -24 -30 -11 77 345 1046 2694 6237 13294 26466 49731 88933 152375 251526 401852 623781 943812 1395778
18 30 64 146 315 625 1163 2110 3899 7565 15437 32402 68116 140840 284229 559773 1080416 2056576 3886978 7338046 13894977
6 15 34 63 102 151 210 279 358 447 546 655 774 903 1042 1191 1350 1519 1698 1887 2086
4 14 24 34 50 101 285 867 2467 6406 15343 34475 73848 152844 308861 613987 1206919 2354222 4568737 8840286 17087455
-5 -9 -17 -29 -45 -65 -89 -117 -149 -185 -225 -269 -317 -369 -425 -485 -549 -617 -689 -765 -845
12 24 36 48 60 72 84 96 108 120 132 144 156 168 180 192 204 216 228 240 252
13 30 61 121 241 471 883 1574 2669 4324 6729 10111 14737 20917 29007 39412 52589 69050 89365 114165 144145
7 7 -2 -12 11 151 577 1589 3675 7579 14380 25582 43215 69947 109207 165319 243647 350751 494554 684520 931843
11 27 66 148 300 556 957 1551 2393 3545 5076 7062 9586 12738 16615 21321 26967 33671 41558 50760 61416
14 30 69 146 276 472 751 1158 1814 2986 5175 9257 16882 31826 64146 141378 335518 822406 2003157 4737816 10772536
10 15 24 43 93 234 605 1484 3378 7172 14414 27913 53008 100168 190085 363322 698366 1345713 2593620 4997599 9637955
1 -1 -5 -2 23 101 300 757 1721 3607 7061 13036 22879 38429 62126 97131 147457 218111 315247 446330 620311
-1 -2 13 54 133 274 525 984 1863 3623 7219 14497 28785 55717 104323 188409 328239 552516 900641 1425208 2194669
11 8 19 60 145 283 475 711 967 1202 1355 1342 1053 349 -941 -3023 -6141 -10580 -16669 -24784 -35351
-3 3 25 83 214 475 946 1733 2971 4827 7503 11239 16316 23059 31840 43081 57257 74899 96597 123003 154834
19 33 57 102 193 384 789 1647 3461 7290 15348 32218 67296 139654 287521 586270 1181494 2347838 4590050 8810205 16573334
16 32 67 130 228 380 644 1157 2188 4204 7949 14536 25552 43176 70310 110723 169208 251752 365719 520046 725452
-4 -7 -10 -13 -16 -19 -22 -25 -28 -31 -34 -37 -40 -43 -46 -49 -52 -55 -58 -61 -64
6 0 -1 13 58 174 463 1168 2842 6700 15319 33986 73261 153834 315684 635168 1256474 2448851 4710185 8954744 16855508
17 21 26 32 39 47 56 66 77 89 102 116 131 147 164 182 201 221 242 264 287
18 24 30 36 42 48 54 60 66 72 78 84 90 96 102 108 114 120 126 132 138
8 18 38 78 161 336 706 1485 3117 6535 13723 28886 60754 126884 261373 528410 1046221 2030675 3878211 7329809 13802378
1 17 57 142 316 673 1404 2874 5755 11276 21706 41270 77840 146004 272601 506680 937325 1725195 3157359 5740566 10356100
13 22 36 71 173 434 1019 2218 4544 8913 16968 31651 58210 106027 192137 348404 636607 1180136 2229164 4290479 8377331
20 33 62 124 239 433 751 1295 2308 4335 8522 17186 34930 70824 142590 284445 561536 1096265 2116210 4041472 7643885
12 19 31 71 180 417 862 1628 2883 4886 8068 13259 22292 39418 74260 147476 301083 617090 1252234 2506948 4971597
16 35 58 84 129 256 635 1653 4095 9414 20107 40227 76106 137465 239274 405034 672626 1104557 1805384 2950374 4831127
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
4 10 24 67 168 369 753 1517 3130 6644 14264 30331 62930 126403 245125 458989 831144 1458638 2486736 4127811 6685844
13 20 27 34 41 48 55 62 69 76 83 90 97 104 111 118 125 132 139 146 153
5 16 45 111 258 579 1257 2639 5370 10625 20488 38538 70713 126534 220782 375732 624059 1012542 1606703 2496529 3803436
-6 -11 -12 -1 30 89 184 323 514 765 1084 1479 1958 2529 3200 3979 4874 5893 7044 8335 9774
21 28 48 94 179 316 518 798 1169 1644 2236 2958 3823 4844 6034 7406 8973 10748 12744 14974 17451
20 40 75 133 225 363 558 818 1146 1538 1981 2451 2911 3309 3576 3624 3344 2604 1247 -911 -4083
-5 -5 -10 -19 -16 51 304 986 2544 5790 12260 25049 50716 103457 213853 446457 933805 1939865 3974510 7993713 15739652
16 18 28 61 142 309 631 1256 2504 5020 10002 19519 36934 67447 118773 201970 332432 531062 825640 1252401 1857838
9 26 54 85 113 139 174 240 369 600 974 1527 2281 3233 4342 5514 6585 7302 7302 6089 3009
14 28 45 76 143 279 537 1027 2014 4145 8946 19863 44343 97800 210836 441850 898246 1770938 3388859 6302846 11411751
21 40 65 95 140 248 555 1371 3318 7539 16000 31910 60287 108701 188228 314652 509955 804138 1237419 1862857 2749454
9 28 69 145 272 472 779 1255 2034 3432 6198 12056 24835 52745 112772 238757 495479 1001904 1967523 3746087 6910594
29 41 51 59 65 69 71 71 69 65 59 51 41 29 15 -1 -19 -39 -61 -85 -111
7 12 26 60 128 241 409 655 1039 1689 2845 4945 8822 16140 30276 57954 112055 216162 411548 767474 1395828
21 33 45 57 69 81 93 105 117 129 141 153 165 177 189 201 213 225 237 249 261
27 43 57 67 78 121 289 797 2086 5009 11158 23415 46838 90026 167145 300838 526281 896675 1490467 2420551 3845586
11 38 78 144 259 448 722 1052 1345 1456 1294 1103 2028 7144 23332 64994 162268 380677 869401 1978519 4534958
27 49 92 166 278 444 709 1166 1960 3258 5161 7529 9685 9959 5028 -10997 -47791 -120401 -251262 -472712 -830080
12 24 37 58 116 281 689 1587 3434 7123 14425 28799 56762 110070 209025 387294 698704 1226562 2096141 3491072 5674488
10 25 59 131 272 525 941 1574 2476 3690 5253 7284 10390 16936 34267 81829 205414 503567 1173671 2588513 5418388
15 22 35 54 79 110 147 190 239 294 355 422 495 574 659 750 847 950 1059 1174 1295
7 16 25 34 43 52 61 70 79 88 97 106 115 124 133 142 151 160 169 178 187
-4 -3 7 42 130 311 637 1172 1992 3185 4851 7102 10062 13867 18665 24616 31892 40677 51167 63570 78106
7 20 49 103 202 387 744 1466 2987 6226 12972 26422 51863 97498 175531 304013 510955 844516 1397947 2367673 4181236
6 26 73 177 381 744 1358 2398 4230 7602 13946 25860 47997 89012 166166 316082 618662 1247330 2569083 5334503 11023997
7 20 51 111 217 413 816 1711 3744 8301 18213 38991 80870 162026 313424 585857 1059845 1859178 3169007 5259511 8516295
24 38 64 115 219 438 907 1901 3931 7858 14997 27161 46568 75502 115582 166451 223650 275390 297878 248791 58425
8 22 50 114 257 555 1137 2218 4144 7436 12800 21040 32769 47757 63683 73968 64256 6978 -146722 -478602 -1119591
27 55 94 155 260 437 719 1147 1772 2646 3787 5098 6215 6254 3422 -5548 -26183 -67327 -142524 -271787 -483818
5 11 17 23 29 35 41 47 53 59 65 71 77 83 89 95 101 107 113 119 125
21 42 77 130 209 333 553 1010 2061 4521 10111 22298 47924 100469 206712 420389 850041 1715168 3457893 6961526 13970951
23 37 51 65 79 93 107 121 135 149 163 177 191 205 219 233 247 261 275 289 303
8 16 31 66 153 353 781 1672 3523 7350 15098 30236 58558 109195 195822 338018 562706 905564 1412257 2139294 3154263

3
2023/input/09/test-1 Normal file
View File

@@ -0,0 +1,3 @@
0 3 6 9 12 15
1 3 6 10 15 21
10 13 16 21 30 45

1
2023/input/09/test-2 Normal file
View File

@@ -0,0 +1 @@
0 3 6 9 12 15

1
2023/input/09/test-3 Normal file
View File

@@ -0,0 +1 @@
1 3 6 10 15 21

1
2023/input/09/test-4 Normal file
View File

@@ -0,0 +1 @@
10 13 16 21 30 45

140
2023/input/10/input Normal file
View File

@@ -0,0 +1,140 @@
J7F--7-|7FJ.FF|.FJ77.FJFL7FFF-J7F7-J-77F|-|7LL7.|FJ7F|JF|.FLF7-FF--7.-J.7-FF7F-77.LJFJ-FF.F|-F----77F77.JF|F|7F.|7-FJ-F777..F-7|77F7FFFF7FJ7
|L7.LL.|7J.F-.|-|JJF7-F7.|-JJ.|LLL.|7|JF|7|F7-FF7-.FLJLJL-.||LF|JLFFJLJ-7-JL77-7FJ-F-J.FJ-.|FL---7L7-FJ..FF-|-J-L|-||.L77-7-J.L-FJFL|-7-FJJ.
|.|FL7||F--JJ|-.JJ.J.LJ|7|J---J..L|--|F-|7F|FF-J|---J.F7J.F|7JL|F7JJ|.L-J|.7|F-JJ.FF7-J||--|J.|.F|FJ7|F-7-JJL-J7FL7F7FF.7JLLFFLJL--7|7JL|J.L
|FF7.||FF-F|.LL7|.7L-7.F7JL7FL|7.LJJ.-|F777LF|F7|J-FF7JJ.F||F7-L.||J|..LFFF-L.L|7||L77.L-7JJ.|7-FJ|7F|7|||.FFF-7-|FJL-|7JF7F|..F|FL7-L7..F|.
L7|7.L--L7F77|L|J-...-|.J7F||LL|.F7L-.L7||FF-J|LJF--J|J..J--||.F-7J.F|JFF7JLLJ.LF|J7JLJ-LJ7FF|F-JFJ-JLLJ-J--|J-|-FFJ7JLJ77LJ.J--77|||.|.L-7J
|LF77L.|LLL-J7FJJ.|7F7L--FJJJ-FJ7|7.LFLJFFJL7FJ|FJF--J.|77|JL7-|-J-7L|LF.LJ-L-JFFJ7|J|J7|F-|-LL-7|7J||..||L7.FL7FF|FJ|.LJ||||.|FJL-FJFFF7FL.
F7LL7.FL7|-L-FJ|F-J||F7|-7JJ-L7FJ.|FLLJ--|.||L--JFJF7J.FF7FF7J7.FJL7-|.L7LF7.JJ7|L-||L7|7L||FLF-JL-7-F77F|-F7--LJ-7J.LL-L7----JLJJL|-F||L7L|
LLJFLJLLJ-F7FL-LJ..L|J.7|.||.LLF-FL|JJL.|J-FJF-7FJ-||FF-JL7||.7-|LF-77|FF7.|-JLFLJ|F7J7F7FFF7LL-7F-JFJL77JFFJ.|L|J.|7.|.FJJ|.|FJJ-FL--J7F|F|
-77-LLFJFJ|FLL7|L-77|-J.L777F-FF7L|L7|FF.F7L7|FLJ-FJL7L--7LJL7-7J7JLF7JL7|7LF7JL|-F|L7FJL7F-7F--JL-7L7FJ--|7.L||L77JF---|.-L7LF|7.-F7|-FFJ-F
LF7.|7F-JJ7JFJLF.|LL7..FJ7--LL7|F---F77|FJ|FJL77JJL-7L7F7|F--J||L7-.|J-|FLJ.FJ-L|-FJFJ|F-JL7|L----7L-J|LL-7-7JL|7.JL|.|.-LJLJ.|.F|J.-L7FJ|7L
.L7FFL|J.FF-|7.F7F|J|--77|.|FFLFF7.L||F7L7LJF7L-7F7||FJ||||F7|FJF-.|JLF--7-FLJL|L-L7|FJL-7FJ|F7F--JF--J-LF|-J.7|.J7.|.---J-|F-FLJ..LJFFJ7|7L
F7J7|7||FLJFJ7---FF7J|-L7F7FL--FJ|FF||||FJF-JL--J||FJL-J||||L7F7JJF77|LJ||FF|L-L.|L||L7F-JL7|||L7F-JF7LFLJLJ.-JLL77F-7|LJF-JF7|-LF-L--|.LLFJ
L|LJJ|LF7J-L7JFJ.J.F-JLL|.F7|FFL7L7FJ||||FJF--7F7||L---7||LJFJ||..|F777FF77LLF-L.LJ|L-JL---J|||FJL-7|L-7-F7.|||JL7J|--7-FFJFLJ-F-JJ.L|FJ.L.F
|||.FL7L|777L7L77|F7.|.LF-||F--7L7|L7|||||-|F-J|||L7F7FJ||F-JFJL7F7||F-7|L77||.|..FL-------7LJ|L7F-JL7FJ7F-7|-|7J.FJ-F|.FL7L|7||LL7J.F||F--7
FL--|-L-J7J7|-FLJ--JFFF-7FJ|L-7L7|L-J||LJL-J|F7||L7|||L7|||F7|F-J|||LJFJ|FJLJJ|-F-----7F-7-|F-JL||F77|||F7.|JF7|.J7FFLJF|L-7LFJLJ|J7FJJ7L7F|
7-FFJ-L|J.LL|||F.|-FLFJFJL7|F7|FJL--7|L-7F7FJ|||||||||FJLJ|||||F7|LJF-JFJL7J7F7|L----7|L7|FJL-7FJLJL7||FJL-7-|L-7LJ777|LJ7L7-|-LF|7-JL7-7|F|
F.F7.-7|7F77L7FJ-F-|LL7L--J|||||F7F-JL-7LJ|L-JLJL7|||||F--J||||||L7FJL||F-J7-||7|FLF-JL-J||F--JL7F-7||||F--JL|F-J|LL7-7J.--JFJ..F7J7LL.LFL.|
|J.L7-J-F-J-L77..|7|FLL7F-7LJ|||||L--7FJF7|F7F---J|||LJL7-FJ||LJL-J|F7FJ|LF7-|L7FF7L----7LJL-7F7LJFJ||||L7F7FJL--777JF7F-7L|L---J7|-.|F-JJFL
.FF--.||L|-.|LF-FJL-JJJLJFJF7LJLJ|F77||FJ|||LJF-7-||L--7L7L7|L7F-7FJ||L7L7|L7|FJFJ|F7F-7L7F--J|L-7L7||||FJ|||F--7|F77|F|7-FLJF|LJ|||F77JF7.L
LLJ77FL7LL|-L.|JL7|....F-JFJL7F-7|||FJ|L7||L7FJFJFJL---JFJJ|L7||7LJFJL7L7||FJ|L7L7|||L7|J||LF7L7FJFJLJLJL-JLJL7LLJ||F---7.F|--J-L|J|JL7.-L7|
|7.LFLJJ.F7..7J.|.L-77FL--JF7LJ-||||L7|FJLJFJL7L7L--7F7FJF7L7LJL--7L7FJFJLJ||L7L7||||FJL7|L7|L7||FJF-7F-7F7F7FJ.LFJ||F--J.L77.7...F.|.LFJJ.J
.L7-J7..LLL77FF7-F|.LFF---7||F-7|LJ|FJ|L-7FJF7L7L7F7LJ||FJ|FJF----JFJ|7L7F-JF7|FJ||||L-7||FJ|FJ|LJFJ7LJLLJLJLJF-7L7LJL7LL-J.7-77--JF--7L|J.|
J-7-.FF..--F7FJ|FF77.FL--7|||L7|L7FJL7L--JL7||FJFJ||F7||L7||FJF7F77L7|F7|L-7|||L-JLJ|F7|||L7|||L-7|JF---7F--7|L7|FJF-7L7J|.-|JLL.|.|7|F-7L-J
|F||FJL777L||L7L7||F---7FJLJ|FJL7||F7L---7FJ||L7L-J|||||L|||L7|LJL7FJ||||F-J|||F--7FJ||||L7||L7F7|L7|F--J|F-JF7||L7||L-J-J.|FJ.|F-J-77F7L7.|
|LF77|7J|F7||F|FJ|||F--JL7F7LJF7LJ||L7F-7|L-J|FJF--J|LJ|FJLJFJL7F7||FJ||||F7||LJF7||FJLJ|FJ||FJ|LJFJ||F-7|L--J|||FJL----7J.L--J-|-FF.7LJ7F-7
FLLJ77F.F|LJL7|L7|||L7JF7LJL7FJL-7|L7|L7LJF--J|FJLF7L7FJL7F7L7F||LJ|L-JLJ||||L7FJ|||L--7|L7||L7|F-JFJ|L7||F---J|||F7F---J-F-F..|.FFJJ|F|-JL7
F7JF|JL|7L--7|L7|||L7|FJL7F7LJF7F||F||JL7FJLF7|L7FJ|FJ|F7||L-JFJ|F7|F----J|LJFJL7|||F7FJL7||L7||L77L7|||LJL--7|||||LJJF7F7J-L-F|-|J|.FF|7JF.
|J--7JJF----J|7||||F|||F-J||-FJL-J|FJ|F7|L--JLJFJL7|L7LJ|||F7FJFJ|LJL-7F7FJF-JF7||||||L-7|||FJ|L7L7FJL7|F----JFJLJL7F-JLJ|.LL-F|-|J..|LLJF7J
J.77|..L7F7F7L-JLJL7|||L-7||FJF--7|L7|||L7F--7FJF|||L|F-J||||L7L-JF--7|||L7L-7|||||||L--JLJLJFJFJFJL7FJ|L-7F7FJF7F7LJF---J77||F77JF-7JJL--|J
.-JF7FJ-LJLJL---7F-J|||F-J||L-JF-J|FJLJL-J|F7LJF7FJL-JL7FJ||L7L--7L-7LJ||||F-J|||||||F7F-7F--JLL7|F7|L-JF-J||L7|LJ|F-JF---7F--J|JJL7L7F.|-77
L-F..7-7LF7|F--7||F7|||L-7|L---JF7|L--7F-7LJL--J|L--7F7LJFJ|FJF-7L-7L77||FJ|F7|||LJ|LJLJFJ|F-7F-JLJLJF--JF-J|FJL7FLJF7|F--J|F--J|7LL7LFF77FJ
F7|F7J.FFJL-JF7LJLJLJ||F-JL-----J||F77LJFJF7F7F-JF7-LJL-7|FJL-JFJF7|FJFJ|L7|||||L-7L7F-7L7||FJL--7F--JF7|L-7||F-JF--JLJL-7.|L----7-|7|L|J-J7
LLJ7.FFFJF7F-JL-7F7F7|||F7F-7F7F-JLJ|F-7L7|LJLJF-JL-7F7FJ|L---7L7||||FJFJJ|||||L-7|FJL7|FJLJL7F7L|L-7J|L7F7|LJL-7L7F-----JFJF----JJ||-L|||L-
F|7|-.|L7|LJ|F7FJ|LJ|||||||FJ||L--7FJL7L-J|F--7L-7F-J|||FJF--7|FJ|LJ||FJF7|||||F-J|L7FJ||F---J|L7L-7|FJFJ|||F--7L-JL7FF7F7|FJF7F7-FL7LFJLL-|
L7-|7F|FLJ-F7||L7|F-J||||LJ|FJL7F-J|F7L--7||F-JF7||F7||||-|F-J||7|F-J||L||||||||F7L7||FJ||F7F7L7|F7|||FJL|LJL-7L--7FJFJLJLJL-JLJ|-JLJFJ-7L-J
||FJ-7L-LF-JLJL7LJL-7LJ||F-JL7FJL-7LJL7F7|LJL7FJ|||||||||FJ|F7||FJL7FJL7|LJ||||LJ|FJ||L7|||LJ|FJ||||LJ|F-JF---J7F7LJFJF7F--7F--7|L-7J-J.|7|7
--|-F|7.LL----7|F7F7L-7LJ|7F-JL7F7L-7FJ|||-F-JL7||||||LJ||LLJ||||F7|L7FJ|F-J|||LFJL7|L7|||L-7||FJ||L7FJ|F-JFS.F-JL7FJFJ|L-7|L-7||-FL||LFJJ-|
J.|-JLF7-F----JLJLJL--JF7L7|F7FJ||F-JL-J||FJF7FJLJLJ|L7||L--7|||LJ||FJL7|L7FJ||FJF7||FJLJ|F-JLJ|FJL7|L7|L7FJL7|F-7LJFJ.L--JL--JLJ.-7L-7-.|J.
JFLJ.FJL-JF7F----7F----JL7|LJ||FJ|L7F7F7|||FJ|L-7F--JFJFJF7FJLJL7FJLJF7|L7LJFJ||FJ|||L7F-JL--7FJL-7||-||LLJF7LJL7L--JF7.F-7F-7-L7|-7-7.LJ7.|
LJ|LFL---7|LJF---J|F-----J|F7||L7L-J||||LJ||FJF7||F7FJ7L7|||F---JL---J|L-JF-JFJ||FJ|L7|L7F7F7|L7F7|||FJ|F--JL-7FJ|F7-|L-JFJ|FJ7.FFJF77JLF|-F
.L77FF--7LJFFJF7F7||F7F7F7LJLJL-JF--JLJL-7|||FJ||||||F--J|LJ|F7F7F-7F7|.F-JF7|J||L7L7||FJ||||L7||||||L7|L----7LJF-J|FJF--J-|L---7.F|L7..J.F.
..|J||F7L---JFJ||LJLJLJLJL7F7F7F7L7F-7F-7|||||FJ|||LJL7F7L7|LJ|||L7|||L7|F7|LJFJL7L-J||L7|||L7|LJ||||7LJ7F---JF7L-7LJFJ|F--JF---JF7|FJ--L7|7
J-F7LLJ|F---7L7LJ.F------7||||||L-J|FLJ-||||LJL7||L-7FJ||FJF--J||FJ||L7|||LJF-JF7L--7LJFJ||L7|L-7LJLJF---JF--7|L-7|F-JLFJF--JFF7F|LJ|J7|-JLL
F-J|||L|L7F7|FJLF-JF7F7F7LJ|LJLJLF7L---7|||L--7|||F-JL7||L7|F7FJ||FJL7|||L7FJF7||F7FJF7L7|L7|L--JF7.FJF7F7|F-J|F7||L--7L7L----JL7L-7L-7J.J-.
JJ.F-LFJFJ|LJ|F7L--JLJLJL-7|F-7F-J|F7F-JLJL-7FJLJ|L7F-J||FJ|||L7LJL7FJLJL7|L7|||LJ|L-JL7||FJ|F---JL7L-JLJLJL7FJ|LJ|F--JFJF7F--7FJFL|F-JF7J77
.L7JF-L7|FJF-J|L---7F7F7F7LJL7|L-7LJLJF----7|L--7L7||F7||L7LJL7|F--JL7F-7||FJ|LJF-JF7F-J||L7|L7F--7L--------J|FJF7|L7F7|FJLJF7LJF7FJL--7.L-.
...FJ7.LJL-JF7L---7LJLJLJL---J|F7L----JF7F-J|F--JFJ|LJLJL7L7F7LJL-7F7|L7LJ|L7L-7|F7||L-7LJFJ|FJ|F7L7F--------JL-JLJFJ||||LF7||F7|||F---J-J.7
7FF-J|L-F---JL7F--JF-----7F7F7LJL-----7||L7FJL--7L7L---7.L7LJ|F---J|LJJL-7L7|F-JLJ|||F7L-7L-JL-J|L-J|F-------------JFJLJL7|||||||||L7|.LJJ|J
.-FJ.L-F|F-7F7LJF--JF--7-LJLJ|F7F7F7F7LJ|FJL----JF|F7F-JF7|F-JL7F-7L----7L7||L--7FJ|||L--JF-----JF--JL-----7F7F---7FJF--7LJLJLJLJLJFJJJ.|F-J
7J|J-LFFJ|7LJL-7|F--JF7L7F77FJ|||LJLJL-7LJJF-----7LJ||F-JLJ|-F7||FJF7F-7|FJ||F7FJL7||L---7|F7F-7FJF-7F----7|||L-7FJL7|F7L---------7L7|7FF|||
|.LJ-LLL7|F--7FJ|L7F7|L7LJL-JFJLJF-----JF-7L7F---JF7LJL-7F7|FJLJ||FJ|L7|||FJ||||F7LJ|F--7|||||FLJFL7|L-7F7|LJL--JL--JLJ|F--7F7-F-7L-J7--|.J.
F77|.F-7LJ|F7LJFJFJ|LJ7L--7F7|F7|L---7F7L7L-JL----J|F-7FJ|LJ|F--J||FJFJ||LJFJ|LJ|L--JL-7||LJLJF7LF7|L-7LJ||F--7F7F7F7F7LJF7LJL-JFJ-L--7.L7.7
-JF--F.77.||L7FJ|L7|F-----J|LJ|L--7F7LJL-JF--------J|FJL7|.FJL-7FJ|L7L7|L-7L7L-7|F--7F-JLJF-7FJL7||L-7L--JLJF7||LJLJLJL7FJL7F7F7|F777L-.FLF-
.||LL|-L7LLJJ|L--7LJL-----7L-7L7F7LJL--7F7L-----7F--JL7FJL7|F-7|L7|FJFJL--JFJF-J|||FJL-7F7L7LJF7LJL-7|F-----J||L------7|L-7|||||LJL-7-.FL..|
FLJL|JJ.-.F--JF7FJ|F7JF7F-JF-JFLJL----7LJL7F7F--J|F-7FJL-7|||-||FJ|L7|F7F--JFJF7LJFJF7FJ|L7L-7|L---7|LJF-----JL-------JL7FJLJ|||F---J|-|7-L7
|L7F7-.LL-L-7FJLJ.FJL-J|L-7L-7F-------J.F7|||L---JL7LJF-7LJ||L|||FJFJ|||L7F7L-J|F-JFJLJJL7L-7LJF---JL7LL-----7F-7JF7FF7LLJ|F7|||L----77|L.||
F|FLLJ-||||L||F---JF7F7L--JF-JL------7LFJ|||L7F-7F-JF-JFJF-JL7LJ||L|FJ|L-J||F7FJL-7L7F-77L-7L-7L7F7F7L7F7F---J|FJFJL-JL---7|||||F----JL--LJ|
|L7.||7LF7-J||L----JLJL7F--JF-------7|FJFJLJLLJFLJF7|F-J7L-7FJF7LJ|||F|F7FJ||LJ|F7|FJL7L---JF7L7LJLJL7LJ||F--7||FJF7F7F7F7LJ||||L-7J||-|-FF-
F-J.LL|JLJ7.LJF7F-7F7F7LJF7.L7F----7LJ|FJF7|.F7F7J|LJL7F7F7LJF|L-7FJ|FJ|LJ.|L7F-JLJ|F7L---7FJL7L---7FJF7LJ|F-J|LJFJ||LJ||L7FJ||L--J--|FJJ|7.
||-|.|.L|7FF7.||L7LJ||L--JL7.LJF7JFJ|FJ|F|L7FJLJL7|F--J|||||F-JF-JL-JL7L--7|FJL-7F-J|||F7FJ|F-JF--7|L7||F-JL--JF7L7||F7LJ|LJL|L--7JJLL-L-777
-7.LL77-|7L|L-JL-JF7|L---7FJF7FJL7L-7|FJFJFJ|F---J||.F7|LJL7|F7L7F-7J7L7F-J||F7FJ|F-JL-JLJFJL--JF-JL7||LJF-----JL-JLJ|L-----7|F7FJ777.7F-|77
LLJ.L|-.LJ|L------J|L-7F-JL7|||F7L--J|L7|FJ-||F7F7|L7|||F7FJ||L-J|FJJF-JL7FJ||LJFJL7F7F7F7|F---7L--7LJ|F-JF------7F7FL7F----JLJLJ7.LLLJ|-LLJ
|.|-.L|.|.FJF-7F---JF7|L--7LJ|LJL----JFJ||F-JLJLJ||FJ||||LJFJL7-FJ|FLL-7FJL7|L-7L7FJ|||LJLJL--7L-7|L--JL--JF----7LJL--JL---7.LLFL|.FFJ-J7.LJ
FL7F-JF|-L7-L7LJF7F-J||-F7L-7|F7.F7F-7L-JLJF7F7F7||L-JLJL--JF7L-JFJ7-L7LJJ7LJJLL-JL-JLJ-F7F7F7L-7|F7F------JF7F7L----------J..FF-7-|J||.--JF
FJL|7F7J|.||LL7FJLJF-JL-JL--JLJL-JLJJL-7F--JLJ||LJ|F7F7F-7F7|L--7L-77-||7.F|.LF7F7-F----JLJ||L--JLJLJF------JLJL---7F------77FJ.FL7|F|--L7F7
L7-L7|J|7-L7-FLJFF7L-7F--7F---7F7F-7F-7|L----7LJF7||LJ|L7|||L--7L7FJ.LLF-F-F--JLJL7L------7|L--------J7F----7F7F7F7LJF7F---JF|..FLJJ|7.|F|7.
FJ|L||L--.|.FF7F7||F-J|F-JL7F-J|||JLJFJL7F7F-JF7|LJ|F7L-JLJL-7FJ-LJ.||||-JFL7F---7|F-7F---JL-7|F--7F7F7L---7LJLJLJL--JLJF7F77F7F7.|-L--FJ|F|
JFJJ|FF|.F7-FJLJLJLJF-JL-7FJL7FJ||F-7L-7||||F-J|L-7LJL-7F7F-7||.FJLJJ-JJ.LJ.||JF-J||FJL---7F7L-JF7LJLJ|.F--J-F7LF----7F7|LJL-JLJ|.J.FJLL.JJJ
L----7L7.-JFL7F7F-7FJF---J|F-JL7LJL7L--JLJLJL-7L--JF7F-J|||FJLJ7.|.|7.|FF7.FLJFL7FJ|L7F7F7LJL7F7|L7F-7L7L---7|L7L7F--J|LJF7F----J.||L7.F-L|.
|||7LLJ|-J-F-LJ||FLJ-L----JL---JF7JL---7F7F7F7|F7F7|LJF-JLJL--7.FL7|FJ-F||77JFF-JL7L7LJLJ|7F7LJLJ-||7L7|F---J|FJFJL7F-JF-J||F7F7J7FJ7-L-.LF7
|-FL.|FJ7|.-JJ.LJF7F7F7FF---7F7FJ|F----J||||||||LJ|L--JF-7F7F7L7J|F77J-FJ77|LLL-7FJ.L--7FJFJL7F7F-J|F-J|L----JL-JF7LJF7L7LLJ|LJL--7JLL-LJ.LJ
J.7.7FJ.F----7FLL|||||L7L--7LJ|L7|L-----JLJLJLJL-7|F---JL||LJL-JL-JL-7FJLF--7FF-JL7F---J||L-7|||L--JL-7L--7F-7F-7|L7FJL7L7F7|F----J77.L|-7.|
FLJ---.FF7F--L-F-JLJ|L7|JF7L-7|FJL------7F-7F-7F-J|L7LF-7|L--7.LFJ.|L-JF.L-7L7L-7FJL---7L7F7||||F-7F7FL--7LJFJL7||JLJF7L7LJLJ|LF--777-FF-|.|
F--.F.LF.|J.||.L---7L-JL-JL--JLJF7F7F7F7LJ.LJF|L-7L7L-JFJL-7FJ7|FJ-|L|-|-.LL7L--JL7F7F7|FJ|LJLJ|L7LJ|F7F-JF7|F7||L---JL7L---7L-JF7L--77|L-7|
7-L7|.||-7JFLJ-F7F7L---7F7F--7F-JLJLJLJL---7F7|F7|FJF-7L7F7LJ|-FJFJJ.F.|LF-7|F-7F7LJLJLJL7L---7|FJF7LJLJF-J|||LJ|F--7F7L--7JL--7|L---JJ77-J7
L-7LF|7|L|L|-LFJLJL-7F7LJ||F-J|F------7F-7FJ||LJLJL7L7L7LJL--7.-.|.F7.F7.L7LJ|FJ|L------7|F7F-J|L7|L----JF-JLJF7LJF-J|L--7L7F7FLJ7L||JLLLJL|
JJ||LF-7-L-|JJL--7F7LJL--J|L--J|F----7|L7LJ-|L-7F-7L7L7|F7F-7|-|7|-|.F|7J7|F7|L-JF7F----JLJ|L-7|LLJF7F--7L---7|L-7L-7L-7.L7LJ|F7F77F7J|.L-F|
L-.-.|L|F7F7JF7F7||L--7F7FJF---J|F---JL-JF--JF7LJFJFJFJ||LJFLJF77|.7J||7FF|||L7F-JLJF7F---7L--JL7F-JLJF7L--7FJ|F-JF7L--JF7L-7||LJL7|L777|-J.
.|.|L|.7JFJL-J|||LJF7FLJLJLL----JL-------JF7FJ|F7L7|FJ7LJF7F7FJJJ7-|.LJL77LJL7|L--7FJLJ7F7L7F7F7LJF-7FJL--7LJ-||F7|L7F-7||F7LJL7F-J|FJF777F7
--77J|-JLL---7LJL-7||F7FF7F---------7F----J|L7|||FJ|L7F-7||||77|L|-J-JFLF7JJLLJF-7LJF---J|.||LJ|F-JFLJ.F7FJF7FJLJ||FJ|FJ|||L7F7|L--JL-J|7JL|
.FJ--J.7L|7LFJF--7|||||FJ|L-----7F-7LJF---7|FJLJLJFJFJ|FJ|||L7F7F7--J---|L77F|.L7L-7L-7F7L7||F-JL7F7F--JLJF|||F--J|L-JL-JLJFJ|||F---7F-JJJ||
F7.LLF7.F-7L|FJF-JLJLJ|L7L---7F-JL7L-7|F--J|L--7F7L-JFJL-J|L7||LJ|7.F7L||FJF7F-FJF7L--J|L7LJ|L---J|LJF-----JLJL---JF7F7F7F7L-JLJL--7LJ|J---|
|L7JLLF-7..F||FJF7F7F7L7|F7F7LJF--JF7LJL7F7L---J|L7LFJF--7|FJ||F-J.F7|FFJL7|L7JL-JL--7FJLL7FJJF---JF7|F---7F7F-7F7FJLJLJ|||F-7F7F-7L--77.|.|
L-J..||7F.L-LJL-JLJ||L7LJ||||F7|FF7||F-7LJL7F---JFJFJFJF7LJL7LJL7F7||F7L7FJL7|F--7F7FJ|F--J|F-JF---JLJL--7LJ|L7|||L--7F7LJLJFJ||L7L---JJ-FF7
F-7F-7|FF-.FF7-F--7LJ7L--JLJ||LJFJLJLJ|L---J|F--7L7|FJFJL--7L7F7LJLJ||L-JL-7||L-7LJ||FJL7F7||F7|F---7F---JF7L7||||F--J|L---7|FJL-J7F7.|J.|||
F-F-|L-7|FLL||FJF-JF7F7F7F7-LJF7L--7F7F7F7F-JL-7|FJ||FJF---J7LJL7F--JL7F---J|L-7L-7|LJF7||LJLJLJL--7|L----JL7|||||L7F7|F---JLJF7-F7|L77L--JJ
L7|LLFJFJ77L||L7|F7|LJLJ||L---J|.F7LJ||LJLJF7F-J||FJ|L7L--7F-7F7||F77-|L7F-7L-7L-7||JFJ|LJF----7F--J|FF7F--7|||||L7||||L------JL7|LJFJ|.F|LJ
|LJ-F-.|.FF-JL-J|||L---7|L----7|FJ|F7LJF7F-JLJF7LJL7|FL7F-J|FJ|||||L7FJFJ|FJF7|F7||L7|FJF7L--7FJL--7L7||L-7LJLJLJ-|LJLJF7F-7F---J|F-J|F777F7
FLJ-J|LJFLL7F7F7LJL7JF-J|F7LF7||L7|||F-J|L----JL7F7|L7-|L-7||FJLJ||FJL7|FJL7||LJ|||FJ|L7|L---JL--7FL7LJL--J7F----7L7F-7|LJ7LJ7F7J||FF7||7-||
|7JLLFJ.|FLLJLJL--7L-JF7LJL-JLJL-JLJ|L-7|F7F-7F-J||L7L7|F-J|||F-7|||F7|||F-J|L7FJLJ|FJFJL-7F--7F-JF-JF-7F--7|F---JJLJ7|L---7F7|L-JL-JLJL7JL7
|777||JL|F77-LF---JF7FJL7F---------7L--J|||L7||F7||L|FJ||F7||||7LJ|LJ||LJ|F7|FJL-7FJL7L7F7LJF-JL--JF-J|LJF-J||F-7LF7FFJF7F-J|||F---7F---J..-
-JF7L7.|F||F7LL----JLJJ|LJF-------7L---7|||FJLJ||||FJL7|LJ||LJL-7FJF-JL-7||LJ|F-7||F7|FJ||F7L--7F-7|.F---J|FJLJFJFJL7|FJLJF-JLJL7F7LJFF|.F.|
LFJ|.LFF7||||F-----7F77F-7L----7F7L--7FJLJLJF-7|LJLJF-JL-7|L7F--JL7L-7F-J||F-JL7||LJLJL7||||F7LLJFJL7L-----JF-7L-JF-JLJF77L-7F--J||7F77F7-J7
L7.LF7FJ|||||L----7LJL7L7|F7F-7LJL--7|L7|F7FJFJL--7FJF--7|L7|L---7L7FJ|F7LJL7F7||L---7FJ|||||L7F7L--J7F-----J-|F-7|.F7FJ|F-7|L---JL-JL-J|.JJ
F|7-L7L7LJ||L7F---JF-7|FJLJ|L7L-----JL7L-J|L7|F-7F||F|F-JL7LJF---JFJ||LJL7F7LJ|||F--7||.|||||FJ||F7JF7L--7F7F7LJ-|L-J|L7|L7||F----------J7|7
F-J.|FJL-7||FJL-7F-JJ||L--7L-JF-7F-7-LL-7FJFJ||FJFJL7|L-7L|F-JF7LFJFJF7JFLJ|F-J||L-7|||FJLJLJL7|||L-JL7F-J|LJL-7FJF--JFJL-JLJL-7-F7F----77LJ
LJLFFF7F-JLJL---J|F--JL--7L7F-J.LJLL7-F7LJFJFJ||FJF-J|F-JFJL-7|L7L7L-JL7F7FJ|F7||F7|LJ|L--7F--J|LJF--7|L-7|F---JL-J.F-JF7F7F7F7L-JLJF7F-J7|.
.L77.LFJF-7F-7F--JL---7F7L-J|F7-F77FJFJL-7L7L7||L7L-7||F-JF7FJL7L7|F---J||L7||LJ||||F-JF7FJ|F7-L--JF7||F7LJL-7F7F7F-JF7||||||||F7F--JLJF77J.
-||LF-L7|FJ|FJ|-F7F---J|L---J|L-JL-JLL7F-J7L7LJL-JF7|||L-7|LJF7L7|||F7F7|L7||L-7|||||F7||L7LJL7F---JLJLJL----J|LJLJF7|LJLJ||||LJ|L----7|L77L
FJ77FJ.LJL7||FJFJLJF-7FJJF---JF--7F7F7|L7LF7L--7F7|LJ||.FJ|F7|L-J||LJLJ|L7||L7FJLJ||LJ||L-JF--JL---7F7F7F----7|F-7FJLJF--7LJ||F-JF---7LJFJ7J
F||L7|-J7|LJLJJ|F7FJJLJF7L7F--JF7LJLJLJFJFJ|F77LJ||F7|L7L7|||L7F7LJF---J.|LJFJL--7LJF7|L--7L7LF7F7FLJLJ||F---J||LLJF7FJF7L-7|||F7L--7L7FJ|||
-F7JL77F-LLJJ-|LJLJF7F-J|-LJJF7|L---7F7|FJFJ|L-7FJLJ|L7L-JLJL7LJ|F7L7LF-7L7FJF7F7L-7|LJF--JFJFJLJ|F---7LJL---7|L---JLJFJL--JLJ||L7F7|JLJFLJJ
|LL7-L-L7|FJ..FF---J|L-7L----JLJF--7LJLJL7|JL-7|L7F-JLL7F----JF7LJL7L7L7|FJ|F|||L-7||F7L--7L7L7F-JL-7FJF--7F7LJF----7FJF----7.LJFJ||L7||JJJ.
LFJF-L|-LF|-77.L---7L7FJF--7F7F7|F7L-7F-7|L7F7||FJ|F---JL7F7F7|L-7.L7L7||L7|FJ|L-7LJLJ|F7FJFJFJ|F7F-J|JL-7LJL-7L---7|L-JF---JF-7L-JL7|-|F|LF
L77J||L77||7|.F7JF7L7||FJF-J|||LJ|L--JL7||FJ||||L7|L----7||||||F-JF7|FJ||7||L7|F7L-7F-J||L7|-L7|||L7FJF7|L--7LL7F7FJ|F-7L7F7|L7L-7J7||J.L-.|
FL|FF|JF-LJLFF||FJL-JLJ|FL-7||L7FJF-7F7||||FJ|||FJ|F7F-7|||||LJL7FJLJL7||FJL7||||F7|L7FJL7|L7FJ||L7|L7|L7F-7|F7LJLJ|LJFL7LJL7FJF-JJ-LJ7-||-7
J|L7.L7J|L77L|||L7F-7F-JF-7LJL-JL7|FJ|||||||FJ|LJJLJ||F||||||F--JL7F7F||||F-J|||LJ||FJ|F-J|FJL7LJF|L7||FJL7|LJL------7F7|F-7||FJJ.FFLJ-FJJ7J
LFJ|-L|--7JFF-J|-|L7LJF7L7L------J|L7|LJLJ|||FJF----JL7||||LJ|F7F7LJL7LJ||L7FJ||F-J|L7|L7FJL7FJJF-JFJ|||F7|L7F-----7FJ||LJ.|LJ|JL|F7J|||-L7.
F|L--7L-LLF7|F7|FJFJLFJL7|F7F--7F7|FJL--7FJ|||JL7F7F7FJ|||L7FJ|LJL7F7L-7||FJL7||L7FJ7|L7||F-JL-7|F7|FJ|LJ||FJL--7F7LJFJL--7|F-J|LL-JF77|.-J7
L.F..LJ7LF|LJ||LJFJF-JF7LJ|||F7||LJL-7F-J|FJLJF-J|||||FJ|L7|L7L7F-J||F7|||L-7|LJFJL-7L7|||L7F7FJ||||L7|F-J|L7F-7LJL--JF7F7||L--7.||FL-77-|7|
|7L-|7|L.L|F-JL7FJJL--JL-7|LJ|LJ|F---JL-7||F7-|F7||||||FJ7LJ-L-JL7FJ||LJ||F-JL-7L7F-JFJ|LJ7LJ||-LJ||FJ|L7FJFJL7|F7F-7FJLJ|||F7FJ-FF777L7.L|J
L77LJ-|.77LJF--J|F-------JL-7L7FJL-7F7F-J|||L-J|LJ||||||FF7F-----JL7|L7-LJ|F7F7|FJL-7L7|F7F--JL--7LJL7|.||7L7FJLJ|L7|L--7LJLJ|L77LJL7JLJ7-|J
.J77-LJF-JJ7|F-7|L7F7F7F7F7FJ|LJF7FJ||L7FJ||F7FJF-J|||||FJLJF-7F7F-J|FJF7FJ|||LJL7F7L7|||LJF-7F7FJJF-JL7||F-J|F7|L7||F-7L-7|-|FJ7LJ7|.||FJL7
|J.|F7JLFJ|L||-LJFJ|||||LJ||F---JLJFJ|FJ|FJ||LJ.L7FJ||LJL--7|FJ|||F-JL-J|L7|||F--J||FJ|||F-JL|||L-7L-7FJLJL-7LJ|F7LJLJ7L-7L7FLJJ--LF-FL-7-FJ
77-LJ7-LJJFJLJJF-JFJ||||F7LJL7F--7FJFJ|FJ|FJL-7-FJL7||.F---J||FJ||L7F-7FJFJ|||L7F7||L7LJLJF--J|L7FJF7||F-7F-JF7LJL7LF--7L|FJJLJ.LF-L.7J7L.J7
|F7FL7-7L7LFJ.|L-7|FJ||||L---J|F-JL7L-JL7|L7F7L7L7FJLJFJF7F7|||FJ|FJL7|L7L7|||FJ|||L7L7F--JF7FJFJ|7|LJLJFJL7FJL7F7L-JF7L7LJJLFJFJ|FLF..|F--7
7|JFLJFJ|LFJFJ7FFJ|L7|LJL7F7F7|L7F7L--7FLJFJ|L7L7LJF--JFJ|||||||FJ|F7|L-JF||LJL7|||FJFJL--7||L7|FJFJF-7FJF7|L-7|||F-7|L-JF7-LJ-F7FL-|.F7LJ7|
-JFFJ7.7LF--7L-FJFJFJ|7F-J||||L7LJ|F--JF-7L7|FJFJF7L7F7|FJ|||||||FLJ|L-7F7|L7F-J|LJ|FJF7F-J||FJLJ7L7|J|L-J||F-JLJ|L7|L---JL-7J.L|7J-L--F7.LJ
J-JJ7L-JF7J-J.LL-JLL7L7L7FJ|||FJF-JL7F-JFJL||L7|FJL-J|LJ|FJLJ||LJF--JF7LJ||FJL-7|F7|L-J|L7FJ|L7F---J|FJF-7|||F7F7|FJ|F7F-7F-J7FFJ|-7.-JFJ7LJ
..LFJ7-7777|7F-7|7|FL7|FJL7LJ||FL--7|L-7L--J|FJ||F-7FJ-FJL--7||F-JF7FJL-7|LJF--J||LJF--JLLJFJFJL-7F7|L7|FJ||LJLJ||L7||||FJL7|JL--7F-7.-L-JJ|
77J|LJ7JLJJ7-L77LJ|F-LJL7FJF-J|F---J|F-JF7F7||FJLJ-LJLFJF-7FJLJ|F7||L7F7LJF7|F-7||F7L--7-F7L7L7F-J|||FJ|L-J|F7F-JL-J||||L7FJ-77-L||LF7FJ77-F
-J7L-7F.J7FF.LLJ.F-F7|-L||-L7FJL-7F7||F7||||||L----7F-JFJF||F77LJ||L7LJL-7|LJ|FJ|LJ|F7FJFJ|J|FJL-7|||L7L-7FJ||L----7LJLJ-|L7-777JL7.LLLLFJ.|
LJF7--JJF7-L-|L7F|LLLF7JLJ7FJ|F-7||||||||||||L7F7F7|L7FJF-JLJL-7FJ|FJF7F-JL7FJ|FJF-J||L7L7L-JL7.FJ|||7|F-JL7||F----J-|7J.L-J-JJJF7L-F.L|L|--
|F-|F|JLFJ||-7F-FFJ|-LFF7F-|FJL7LJ|||||||||LJ.||||||FJ|.L-7F7F-JL7|L7||L-7FJ|FJL7L-7||FJ|L7F7FJFJFJ||FJL-7FJ||L-7F7.F-7-7-L7L-7F-|77.FF7JL-7
F--J7|7FF-LL7-J.7..|-LFJJ-LLJF7|F7|||||||||F--J|LJLJL7|F--J|||JF7LJ||||F7|L7|L7FJF-J||L-7FJ|||FJFJL||L7F-JL-J|F7LJL7L7|7|7LF--F-7|-7FLLL-JJ|
|.FJFJ||.FFJ|.|.|J-J.|.L|L-LFJLJ|||LJLJ||LJL7F7L---7J||L--7||L-JL7FFJ||||L7||FJ|L|F-J|F7||FJLJ|FJF-J|L||F7F--J||F-7L-JL--7J|J.|L|J.L|.L7JLF|
-7--7--J.-7J---FJ7|FL7-7JF7LL--7|||F---JL7F7LJ|F---JFJL7F-J|L7F-7|FJFJ||L7|||L7|FJL-7||LJ|L7F-JL7|F7|FJLJ|L--7|||-|F--7F7L7L7-L-J.|FJ7-L-JLJ
LJLLL|F---L77F7||7J7.|L77L-J.|7|||||F-7F7||L-7|L-7F7L7FJL7FJFJ|FJ|L7|FJL7LJLJ|||L7F7||L-7|FJL7F-JLJLJ|F-7|F--J||L7LJLL||L-J7L7J.LFLJ.7..F7F|
L-L7..7J.FJ-7F7JJJ.L7|-L|-|7F-FJ|LJLJFJ||||F7LJF7LJL7LJJFJ|FJFJL-JFLJ|F7L----7LJF|||||F7|||F-JL--7F--JL7LJ|F7FJL7L-77FLJ-JJ|L7FFF7|LFJ|-F-F-
L-----|-|||J||.||F|JLJFLJ7|L-7L-JJ-|L|FJLJLJL7FJL7F-JF-7L-JL7|7L|FFF-J|L-----JFLLLJ||||||||L-7F--JL-7F7L7|LJ||JFJF7L7JLJL|7.F-J7LJ|-|FJFJ.||
FF--J-J.LF77|JFLL7JJ.FLF.L7|JF|||LF|.||JLF---JL-7|L--JFJFLJJLJ77L-F|F7L----7JJF-||L||LJLJLJF-JL-7.F-J|L7|F--JL7L-JL-JJ.|LJJJ-7|-7-|L7JJFFFF7
LLJFLFJ7FJL.|J|77J|7.FJ|.L-77-LL77J|.LJ-FJF7F7F-JL7F7FJF|LLLLL|-|L-LJL7F7F-J7LJ.77L||LF|7JLL7F-7|-L-7|FLJL7F-7L--7J7.|-L-|FLFFF-J|F-||FJ7.LL
LL--7|.JL-JFJ7J|7.7.F7LF|JJ|.|7|-|.L7|.|L7|LJ|L7F7||LJ--7J-F7LJL7-|JLFJ||L-7-J7F|L7LJ-L-JFLFJL7LJ-F-JL---7||FJF--J-|7F7.7LF-FJL77FJ.7-J.L-JL
F7FF||LJ|.L7|.LF77LJ||.-|.|LJ-L-77-7FFF-.LJF-JFJ|LJL7L||.--7J..F|-77FL7|L7FJ7||-|--.|.||JL-|F-J.|LL-7F7F7|LJL7L-7JJFFJJ---J-J.-F-LJ-FJLF7|7J
F7-|L77LL-FLF7.L|.FL|7-LL-LJL-L-FJF-JL|-7-LL-7L7L7F7L-77-JFF--7-L-LJ7.LJJLJF-|J.77F-LJJJ7|LLJ.|-F-JLLJLJ||.|LL7FJ.F-JJJFJFJ.J.LF7-|FL-7LJLL7
FL7FJJ7F--J--7--J7|.LJF7-7L7.FJ||-JL7.|.F.|JFJFJFJ|L7FJJLFJ|L-JFLF|F-L7J7LJJL||L-7J|L-JJ|--JJ77F|L|7J|-LLJ--JFJL-7JLL7-|FJJ7JF-JL-|||-J7JJ7F
L-|JJ-L-FJJ.FJLFLJL7JJ---|J|-|FLF-|7.FLFF-JFL7L7|FJJ||F-7--|7.|-J.LL.L-77..|.L7.-J|L|--|LJ..L7LF|F7-.|77.L7FLL-7FJ..L|.LFJL-7F7LFL.FJL||LF|.
|.||7FJL|JJ7|7JFJ|J.|F-7L|-L|L|FJ7LJ-FJF|.FF-JFJ|L7-|LJFJ.F7F-7L77|L-|7F-77L|.7-LFJ|FJ-7|-|7..--J||L-J|-7-FL-|-LJJ-J.L7FJ7J.-JJ.JJ7LJ.L|.7|.
-|L--F7|||-J7F-JLFJ.F-77L7..7-L|JJ7JL7||LFLL--JLL-J-|F7|.JLJJ7|JLFJ-F-FLFJ77.7L|.|FLJJL|F.LJF7|L7F77F|..JLL7-77|.L7L|77JL-.-7|F|.F|.LJ7JFL|-
|JL.L|-L|J-L--..F.77--|JLJ-LLJ-7JL.|J.L|.|JLJ.|LJJJ.LJLJ7LFJJLF--|LF-J..7.L-.7L7J.J-7JJFJ-L7J|J-LJ7--J-7JJ.J.LLL---7LLJ.--J-JJ-L-JJ-|LF--JLJ

5
2023/input/10/test-1 Normal file
View File

@@ -0,0 +1,5 @@
-L|F7
7S-7|
L|7||
-L-J|
L|-JF

5
2023/input/10/test-2 Normal file
View File

@@ -0,0 +1,5 @@
7-F7-
.FJ|7
SJLL7
|F--J
LJ.LJ

9
2023/input/10/test-3 Normal file
View File

@@ -0,0 +1,9 @@
...........
.S-------7.
.|F-----7|.
.||.....||.
.||.....||.
.|L-7.F-J|.
.|..|.|..|.
.L--J.L--J.
...........

9
2023/input/10/test-4 Normal file
View File

@@ -0,0 +1,9 @@
..........
.S------7.
.|F----7|.
.||....||.
.||....||.
.|L-7F-J|.
.|..||..|.
.L--JL--J.
..........

10
2023/input/10/test-5 Normal file
View File

@@ -0,0 +1,10 @@
.F----7F7F7F7F-7....
.|F--7||||||||FJ....
.||.FJ||||||||L7....
FJL7L7LJLJ||LJ.L-7..
L--J.L7...LJS7F-7L7.
....F-J..F7FJ|L7L7L7
....L7.F7||L7|.L7L7|
.....|FJLJ|FJ|F7|.LJ
....FJL-7.||.||||...
....L---J.LJ.LJLJ...

10
2023/input/10/test-6 Normal file
View File

@@ -0,0 +1,10 @@
FF7FSF7F7F7F7F7F---7
L|LJ||||||||||||F--J
FL-7LJLJ||||||LJL-77
F--JF--7||LJLJ7F7FJ-
L---JF-JLJ.||-FJLJJ7
|F|F-JF---7F7-L7L|7|
|FFJF7L7F-JF7|JL---7
7-L-JL7||F7|L7F-7F7|
L.L7LFJ|||||FJL7||LJ
L7JLJL-JLJLJL--JLJ.L

140
2023/input/11/input Normal file
View File

@@ -0,0 +1,140 @@
.......................................................................................#........................................#..........#
..........#.....#.........................#..................................#..............#...............................................
.......................#.........................#.....#......#....................................#.......................#................
............................................................................................................................................
........................................................................#...................................................................
.................................#...............................................#.............#...............#.......................#....
..#.............................................................#...........................................................................
..........................................#.......#........................................................#................................
....................................................................#...............................#....................#..................
......#......................#..............................................................................................................
...........................................................#....................................................................#...........
#................#...........................................................#......#.....#.....#....................#......................
.......................#.............#...............#..................#...................................................................
..........#....................#..............................................................................#............#............#...
.............................................#.....................................................................................#........
......#............................................................................................................#........................
...................................#................................#......................#................................................
..#..........#......#.......................................................................................................................
.......................................................#.....#..................................#....................................#......
.................................................#......................................#.............#.........................#...........
.......................................#...................................#...................................#............................
....#...............................................................................................................#......#...............#
...........#.........................................#.............................#........................................................
................................#...........................................................................#...............................
.......#.............................#........................#...............................#.........................................#...
..............#..........#.................#............#.....................#.............................................................
...#..............................................................#.....................................................#...................
............................................................................................................................................
................................................#................................#............................................#.............
..........#.....................................................................................................#...........................
......................#.................................................#................................#.........................#........
......#..........................#......................................................................................................#...
..........................#...............#..........#.....................................#................................................
..............................................................................#.................#...........................................
....................#................#.......................#.......#....................................................#................#
....#.............................................................................#.................................#.......................
................#.......................................#.............................................#......#..............................
........#...................................................................#...............................................................
..........................................#.......#.........................................................................#...............
....................................................................#...........................#.....................#.....................
.#.................#.....#............#........................#.................................................................#......#...
.............................................#........#...................#........#........................................................
...............#........................................................................#...................................................
....#............................................#......................................................#...........................#.......
...........#.........#............#..........................#.................#................................#.........#.................
.............................#.............#......................#.........................#...................................#...........
#.....................................#.....................................................................................................
...................................................................................#..............#....................#..................#.
..........................#...........................................#...................................#.................................
............................................................................................................................................
......................................................#.......................#.......#.....................................................
....................................#.......#....................#..........................................................................
...#................#.......................................................................#................#.................#............
.............................#........................................................................#...................#............#....
..........#..............................#.......#.....................#........#...............#...........................................
..............................................................#...................................................................#.........
...........................................................................................................#.................#..............
.................#......#...........#.................#............#..................#............................#........................
.....#...............................................................................................#......................................
............#..................................................................................................#.......#...............#....
................................#.........#.................................#...............................................................
................................................#..........#.......................#........................................................
.#.................#.............................................................................#..................#.............#.........
........................#............#..................................#................#..................................................
......#...............................................................................................#......#...........................#..
.....................................................................................#..................................#...................
..........#..........................................#...........#............................................................#.............
.............................................................................................#....................#.........................
.......................................................................................................................................#....
....#................#.................#........#...........................................................#..............#................
............................................................................................................................................
............................................................................................................................................
..............#.........#............................................................#.................................#....................
.............................#................................#....................................#........................................
.......................................................#...................................#.................#..............................
.....................#..................................................................................................................#...
...#.................................#.............#................................................................#........#..............
............................................................#...............................................................................
.......#....................................................................................................................................
.............................#.........................................................................................#..........#.......#.
.....................................................#...........................................#..........................................
..........................................#...........................#.........#...........................................................
..................#...................................................................#......................#..............................
.......................#.......................#...................................................................#......#.................
#............#..................#...........................................#........................#......................................
.....................................#............................#.........................................................................
............................................................................................#............#.....#..................#.........
..........................................#...................#....................#........................................#...............
..................................................#.........................................................................................
.....#............#...............................................................................................#....................#....
......................................................#.......................................#.............................................
..............................#..............#..............................................................................................
......................................#................................#.................................#............#........#...........#
...#..........#.....#...........................................................#...........................................................
.....................................................................................#.....#......#........................#................
.......................................................#...........#..............................................................#.........
............................................#..............................#.............................................................#..
................#..........#.................................................................................#..............................
......................................#..............................................................#......................................
#.......#...............................................................#.............................................#...............#.....
..........................................#....................................................#............................................
....#.................#................................................................#....................................................
...............#.............#..................................................................................#.........#..............#..
....................................#..............................................................#...............................#........
............................................................................................................................................
......#.............#.............................................#.............#...........................................................
...........................#............................................................................#.........#.........................
#......................................#....................................................#...........................#..............#....
...............................................#.....#......................................................................................
.............#.........#......#....................................................................................................#........
..............................................................#.....#............#..........................................................
.........#...............................................................................................................................#..
......................................#.....#...............................#...........#....................#..............................
.....................................................................................................#..............#.......................
....#.......................#.....#.................................................#.......................................................
...........................................................................................................................#.....#..........
.................#........................#......................................................................#..........................
.#.................................................................#..........#..........#..............#...................................
.......................................................#.....#..............................................................................
.........#.....................................#...................................................#.........#..............................
.................................#...............................................#.....................................#.............#.....#
.........................#..................................................................................................................
....................#.................................................#.....#...................................#...............#...........
...................................................#...........#.............................#..............................................
....................................................................................#..................#....................................
....#...........#......................#...............#....................................................................................
.........#........................................................................................#...................#...................#.
......................#......#.............................................................#................................................
#..............................................................................#............................................................
..............#....................#.........................................................................................#......#.......
.................................................#...................#...............................#......................................
....................#......#..................................#...........#.......#....................................#....................
..........#.....................................................................................................#...........................
.....#...................................................#.....................................................................#............
........................#.......#......#......#..................#........................................................................#.
.............................................................................#.............................#................................
..............#........................................................................#....................................................
.....................#.............#...................#.........................#..........#...............................................
.............................#............#....................#.........#.......................#..................................#.......
........................................................................................................#...................................

10
2023/input/11/test-1 Normal file
View File

@@ -0,0 +1,10 @@
...#......
.......#..
#.........
..........
......#...
.#........
.........#
..........
.......#..
#...#.....

1000
2023/input/12/input Normal file

File diff suppressed because it is too large Load Diff

6
2023/input/12/test-1 Normal file
View File

@@ -0,0 +1,6 @@
???.### 1,1,3
.??..??...?##. 1,1,3
?#?#?#?#?#?#?#? 1,3,1,6
????.#...#... 4,1,1
????.######..#####. 1,6,5
?###???????? 3,2,1

1385
2023/input/13/input Normal file

File diff suppressed because it is too large Load Diff

15
2023/input/13/test-1 Normal file
View File

@@ -0,0 +1,15 @@
#.##..##.
..#.##.#.
##......#
##......#
..#.##.#.
..##..##.
#.#.##.#.
#...##..#
#....#..#
..##..###
#####.##.
#####.##.
..##..###
#....#..#

100
2023/input/14/input Normal file
View File

@@ -0,0 +1,100 @@
...#.O.#.#.O.O....#...O....#..#........OO.O#...O..O#O#.......O.O....O.....#...OO#.O....OOO..OO#..#..
.##.....#.OOO.OO#...O.......O#..O.##OO.O.......O##....O....#O..O..#.#....#OO..#...O.O#.#...#....#O.O
O...##.O.O.O.O..#.#.....#O....#..#O..O...O..OO..O...##.......OO#..OOO..#O..#.O#.O......#..#O..O..O.O
..OO....OOO....O.O..OOO.....O........#...O.O.O.O..O#.O...O..#.#O........O.....#O...##....#...#.#....
##.O.O#..O..##O.....O.#.....O.O#O.O..#...#...OO.##OOO...OO#...O...O........O.#.O.........#O.#...#.#.
.#.O.O.....#..O###..O#.#..O....O.O....#...##.O..O.OOO..O.O..O#.O..O....#.#.O..#..##O...O....#O#.....
.......O...##..O..O##..##...O....###.O.#.#.O......O...O.O......#O.....#..O..O#..##O.O#O##O....O#....
.#O..#....##.##..O#..#..#..O........OO....#..##.O.#.O.O..OO.O.O#..#O##O......OO...O...OO...#....OO..
#.....O#......O#.....#..O...#O..OO..OO.#O...O...O.........O...#O...O.....#.....#...#.....O##.O.....O
OO.O..O...O......#.O......#O....#..#.#...O.O....O.#.O#...O........O......#.#O#.O...O.........#O....O
O.O..O..#......O.O.OO...OO..##.....OO.....#.O...O.#.#...OO..OO.O.........#O..#.O...O#.#..O..OO.##O..
..#.......O....#...#....##..O.O......O....O#.O..O..#.#.O#O.O.#...#.##.....O...O.O...O.#...O...O.#...
.O...#..O.....O.O.....OO.O.O.......O..O..........#...O..O..O......O....#OOO...O#O...#.O#........O...
.OO#....#.....O...#.###..#..O..O.....#O..#..OO...OOO#.O#..O#O........#..#.O..OOO#O#..O..OO........#.
..O.....#..#..O.............#..O.O..O#.......#.O.........O.#..OO.O..#..##..O.O#O....OO.O.O.O.....O#.
........#O..O#OO...#.##O.O....O...O..........##.#O..O......O..O.#...#O.O.OO...#.#OOO.#...O#....#.O.#
.....O.O...#OO#.OO#......#..O.O..#.OO.......#...#.O.O#.O.#O.O#..#O##..OO...#......#.O....#.....O.#O.
.O#OOOO...#.#..........O#.#.#.#.O....O..O...O...OOO.O.O.O..OO..O..O#.#...#....#...#O#.OO.O..#.O#....
OO#OO..#.O.#....#..#.#..#O#.O#O#.#..O.O....#..O...OO..O..#........#.O...O#.#.....#....O.....#.O.....
.O.....#...OO...#..O..#..O..O##..OO...O....#.O.#............###.O.#..O..O.........O..#.O..O.#OO.#...
.##O.#.O.#....O..O..#..O.#.O..##O..O......OO...#...O..OO#....O..O#O.##.OO#...O#...#.......O.O#.#OO..
.OO#O#...O..##.O......O..O.O....O...OOO.O..#...O#.#.O.OOO..#...#.##..OO..................OOOOO...###
.#..##...####.O#...O........O...#O..O..O....O##O..O..OO..#.....#...O.....OO......OOO.#..O.##OO##...#
....O#........O##.O...O#..#.O#O...O...O.O........#..#.#.O......O..#.....#.O..#.#..#..#O....O##...#..
.O..OO.O##..O...O.OO....O.OOO..#O#.O##......O.O#....O#O.O......#.O..#O..#O.........#..OO....#.OO..O.
.#OO..#OO.###........#...#..#.O..#O.O#O...O.#.....O...#......O.......#.O.#.##.O..#O.O###OOOO...#..O.
##...OOO.#..........O#...O#.....OO...O#..OO.OO.#.OOO..OO....O..OOO...##O...O.........##O...#.#O.....
.#....O.....#OO.O.OO..O......#.OO..#O...O..##O.#O....#O.OO..#O.OO...O..O.#..##...O......#O##OO.#.O..
.#..O....O....#......#.O.##...OO.O.O...O.OO.O....#...#..O....O#O..#...#.#..#...OO......OOO...O..#...
#.#OO.#....O.#.OO....#........O.O.##...O.#.................OOOO....O..#......O..#.#...O....#.O#OO.#O
....O.O.......##..O.........OO#O..O.O#.#.#.O....#..OO.O..O#O....O..O.O......O.O.#..O.......O.O..O.O#
...........#OO...O....#.O.#..#O.O#.....O..O.....O#.....OO.#O...#O.#O.#.....OO.O.O....OO......O#O.O..
OOOO.OO..O....O.O...O..#.........O#.##OOO#.O..O.O.O......O..#..O..#..#.O..O....O#O.#OO..O.O...O#.##.
##.O.#O.#OO#..........OO#.OO.#..#.#......#.OO...#.O.O.......O##....O..O..#.#.#O....O..##.#OO.O..O..O
#O...OO..#.#....##.O#.#...##OO#........O#.O..O#.........O.O.#....O.#.O.......O..OOO......O#O.###.O..
....O#....#..O...#.#.....O.O#O..#O....O...O.OO#...O..O#.##.O.....O...#..#.O.....O...O#..O.#...#.#O..
O.OO......#..O...O.O....#...OO..O#.O..OO..#.##.....#....O.O#O#.O....O..#..OOO..O....O.O..#..O.O..O..
.#..#..##O..O.....O#.#.O.O..O..OO..O.O..OO.##.O...O..O#........O.............#.OO..#......O..#O#OOO.
.#..##...O.#..OO...O..#..#O#..#..##.O#.#.....#....O.O..O.........#.###...#.O##..O...#.O.OO..........
........#O.......O...O#.#....#.O#....#..O.....OO........O...#.........##.....O...O#.O...O.O..#OO.O.#
.#..#.O##..##.O#.#.......OO...OO#...#O#............#.#...#...O...#.O..#O.#.O.........O..OO.O...O.#..
#.O#OO...OO.O.#...##........#....O.#.O.....##.#.O.O.O.#..O#...O..#......#..O...###O..OO..##..OO.#OOO
.OO...#O....O##.O...O.#....O...#O.......O.....OO.O...O..#...OO.OO.O#...O##.....O..#.#...#OO......O..
..O..#...O...##..O...O..OO.O.O.O.....#.....O.....O..#OOO.....OOOO#.#.O..O..#........O.#O#.#O..O.##..
.....##.....O.....O#...##.OOO....O.O..O.#.#O........OO.....#...##...#.#......#....OO.O.....#O....#.#
..O.OO#....O..O.#O.#OO#..#.O.##.#..#.OO##....O#...#..O.#..#...#.#....OOOO.#...OOOO..O.........##O.O.
O.O.#......O#...O..#.......#O.O..OOOO..#....#.#.OO.O..#O......#.#....#...#..O....#O.OO..O.......#.#.
...O.O....O#......#.O.O....O#.#..#O.#.....#...#...#.O#.........O.OO..O###...O....O.#.O.#.....##..O..
.#.OO...O#O.....O#....O......OO...OO.OOOOOO##....#..#..#O.#.OO....O#..OO.#O........O#..O.O#.#.......
#OO#.#.....O#OOO#...O.........#......O#.......O.....O#.#O...O........#....O...O.....#.......##.OOO#.
..#.O##..#OO..#....#O....#....#..........#O...#...O.#.O.O###O..O..#...#.OO....##..O.O.O.....O..O....
....OOO#.#......#..O.O......##O.#.O.#.O.OO....#..O.......#.....#O.O...##O###.##.##..#.O.#.O#..#..O#.
......O#OO......#.#..#.O#OO#O..O#O.O##.......O...O........O......O#.....#..#....#...#.#..O...O##.#O.
#..OO..O.O.....#O.O.#.#......O......O.#....O.#OO.........#.O.O#..#..#.O..O.#..#...#...O.#..........O
..O#OOO#.#.....O.....O..##.#..OOO.O..#..O#...##O..OO...#....#..#...#...OO.....##OO#.OO...#.O....#.#.
#.#O.............#....O#.....O.....O.##O.....#.#.#.....O....O...O...##..O...#........#O..##.#.....##
.O.....O...#O.#.O#..O#........#.##...O##O..........O##.O......O..#....##....###......O##..##O..#.O#.
.#...#..#..O.O.............#....O.OO.....OO#O.....OO..OOO#O.O.O.O...#...#.........OO..O#.O...#.##..#
..O...#O#.......#OO..........OO#..#.....OO#...#OO.O#....OO....O..O..#....#OO......O#O...#......O..O.
O.......O..O..#O.....O#O.........O##.O#.#.O.O....##....O.#....O....OOO..#O#...#...O.O#.O.....O.O#.O.
O.#O....O..##....O.........##.OO###....O...O...O..O#O#...#O.O.O....#..O..#..#.O.......###..#....#..O
.........O..#O...O..OO.....#...O..#O#.....O....#O#....##...#.OOOO.O..O#...O..O.O#.#..O.O..#..#.OO...
...#.....#..OO.O.#.#.O.....O#...#..O...O..O..#...O..O.O..#...#.###..#..##O.#.#O.......O..##O.O.O#...
.##O......O....#....O....#O..#.....#.O..O.O.O..#.#O.....O#.O...#.#O.#...#.........O....O....OO..O...
.OO.O.O.O#O..O##.O...OO.....O..O....O....#..#...O.O...O....O.#.O......#O.#.O#O..O...O.O.#.O..O.#....
O#..#.#..#..#...#.O...O.###.##.OO.O.#.OOO..O..#O.#.O...OO...O.OOO....#.....#OO.O##.O.#.#O...#.#.....
.#.....#.........O.#.........#...OO..O.#.O...O##O...#..O.O.OO#....###.OO.....#..........#.#OO...O.O.
........OO..O.O.#..O.#.......#.#O.OOO...OO.O............O#O#...O...#.O.....#...........O...#..OO.O#O
..#.#.#...O....#O.......#...#...O###.O.....O.O.OO....#O...OO.O.O........O.O.#O.O....OO.....OO.....#.
#..OOO#......O.#.O#...#..#..O..O.O.O.#...O#OOO.#...O.#.OO.#O..#....#..#O....O.#.O...O...O#OO...#....
.....#.....##...O....#..O..O.....O#OO.#O#.....O...O.##.#........O..O........#.#......##......#..#..O
O..O....O.##..#.#O##.#.....OO....O.##O......#...#..OO.O.....#...#........O..O#O##.O.......#..##O..##
#.....#O....O...#OOO#..O#.O.....O..OO.#..#.#.O#..O..O#.O###....O......O.#.O..#O.....#.......##O.O..O
O.O.#..#....O....O.......#.O..O#O#.O..........#O.....#OO.O...#.OO.....#...O....OO....#...O....O.#..O
..#...OO....OO......O....#..#..........##..##..#.....##...#..#O.....#OO......#........O.....O..O...#
.OO#...O#.O....#.........OO#...O#..O.#..O.O.O.#O......##.O.......O...O...###.O......O....O...#.OO#..
..O..O#O.#..O.#O...OOO#O.#.O....O.#......O....#....###....OO......O...#...OO.#....O........O#..#..OO
#..OO..O......#...##..O#.O........O.O...##.#O...O...#O#.O.O....#.............#.O#.#..O..#..OO#.....#
#..........O...O##.O#..O..OO..O.....#O.#.O......#......O.O....##.O#OO..O.O..O.O.O..#..O....O..#....O
.O.O...O.#..O.O....#.#.O.O.##.##..O..#OOOO.###...#O...#...O.....O...#.##.OO..O.#..#.O.#.......O....#
#....#....OOOOOOO.#...OO....##O.#..#......O..#..........O......##..O..###..#.O....O.......OO......#.
.O.O..##.O.#O.#...#....O..O.....#..##......O.......O..O#.O##.#........O..#.O.#.O.O..##..###..##.#...
..OOO..O##..OOOO.O.....OO##..O..O.#....#.....OO......O.OOO#...#O.OO...O.O......O#..O.##....###...#.O
....O...O.O....#..O#.O.....O.O.#.......O##...O#..OO.O.O##...#.....O#.###....O....#O.........OO..O.O.
O#.O......##..#.#..............#......#.#.OO#......##O#OO..OOO..##.O##....#..O...#......##O.O##...OO
...#OO....OO...O#.#..##....OO.#..#O......O#....#.O.....O.#O..OO.#..OO...O#.O#....O.#.OO.O.O#..O.....
#..O.OO#O...O..O..........#..#.#..#..#O.....#O#..O....#..O...O.#.#O#.#OO.....OOO.#..#.........O...O#
....O......#..........O...#.....OOOO........#.#OO.O............O...#....O........#....#....#........
...O.......###...O.O...#O.##O.OOO.........O.###.O.......O....O.O...O.#.....#..#O..#..OO..O.O...O....
O.O#....##.O.O.....O....#............OO.#O...O..#...##.#.#O#O.#.....O......O....#.OO#.O#....#.....O.
..O####.O.........O...........OO..OO.#.....O.......#..O#.O....O#...##.......#.#....O..O..O#..##.....
.#..#......O.##.O.OOO.O.OO....O.......#......#.O...OOOO...O..#..#.O.#......O...O#.#.O.#.O....O....O.
##....O.O..O..O.#...O##.......O....#...#OOO.O..##.....#....O.......#O..#.#O..O.#.......O..#.O.O#.O##
...O....O#O.#...#......#..O.O.O.O...O.....O..O.#..#.....O#...OO...#.O.O....#..OOO...#.....OO.OO..O..
O##.O.##.O#OO...OO...OO..O....OO#O.#O..O.O....OO..........O..#.O.#O#.......O.O..#O#....#..#...#O..#.
.#.#..........#.......#..OO#....O.#.#.O.....OO.#.O..#.#.O....#..O....#..#..O.#O#O.....#.O.O.#O.O.#O.
.O.#....##O...#..OOO.#......#...#.O.......OO....#.......#..#.OOO........OO..O..###O##..O.....O##....
OO##..O#....O.##.......O...#........O.O...#O#.#.OOO....#......#.#O.O.O..O..O...#.#.O.O.OOO.O#O......
#O...#....OOO.O...#O....O...O..........O..#..O#.O..#O.....#......#.#..#.OO..#....#O#....O...O....##.
.OOOO......##.#O.#O...#......O..#..O..#.O...O.OO...............#O...O..##..#.#....O...O..O.##..O.O..

10
2023/input/14/test-1 Normal file
View File

@@ -0,0 +1,10 @@
O....#....
O.OO#....#
.....##...
OO.#O....O
.O.....O#.
O.#..O.#.#
..O..#O..O
.......O..
#....###..
#OO..#....

1
2023/input/15/input Normal file

File diff suppressed because one or more lines are too long

1
2023/input/15/test-1 Normal file
View File

@@ -0,0 +1 @@
rn=1,cm-,qp=3,cm=2,qp-,pc=4,ot=9,ab=5,pc-,pc=6,ot=7

110
2023/input/16/input Normal file
View File

@@ -0,0 +1,110 @@
\....../..-......-.\.........\.......................-....../......../....................................|...
......\../../.....\-................../...........|................-../.............-./........|.|............
..-...-..../..............................-..............\.........-../...........................-.\.......\.
............./-..........|..............\/.................../........../............\.......|................
....|.....\.../...|..............\/..|-.................-..........\.\........................\...............
...........\...........-..|..../..\.-|........................-/.|/....../.........\.....|................/...
./....-|./.......|......-...-............-.......-......................................../....-............\.
....\...........|............-............-..\..|...|.........-..||.................\/...........|-|.|-.......
-............................-....................|........-...............\..................\...............
...............\......................-....../......|..||.|.-........................./......-............\...
.-...|........-.......|.........|....|.....-.........|..|............................./.../\...-........\.....
....................../...........-......-..--.|-...............-....................\......\.................
-....................-......-......./.......\|./......./........|...........|..................|..............
..-............../....................|.............-.......-.................-..................\......\.|...
....................\...............................................|.....\................../..-/............
...-.-/...\.//...|.............|........................\.............-|..|...........--..\........./...\.....
....................................................................\..........-......................-/......
..................................\......-.....-...........-.............-...........\...................|...-
......................\........|../..............-.........../......-...|......../.\......./..||..............
................................/......-................................./.........-......\./......|..........
........../....../....\.\|......-..............................\.....................--......|.............\..
..-.................-............../\............|.......................................\...|....\...........
./................\.|....\.........................../................|..............-....-..../..............
../...........\.\/./........\........-\...-/...........-............../........................|..............
......\.||.....................|..................\..............|........../......\/........../.....-........
..|/...........\.....|../.......\...........-.............|..............-........|...............-.....|.....
....................../.....-..|.......-...-...|.....................|./...\.........-........................
......................../........../\../.........-...\........./...............................|..\...........
.......................|\............./...|...............\/-...............|........................../..\...
..|....-.......\..................................\................................|......../.|..............-
........../...\.\........-......|.\.|.....................-............/..\..........|.../...-.............../
..\.-..............-............/..-..\..............\.........\....../...|........|........\....../..........
.....................|........................../..|....|.-.../........................-.\../-................
./..........-....|......|.|.................-....|........\......|............../.........................../.
....-..................................................................................-............|..-....//
......./...-.......................-..-.........-.............|........................../....................
.-...................-.......................................|.......-.................../..\...............\|
.........|.\......-.....\............./-....................../.........-..|....|......-......................
......./............./..........-......-......\...................................../............/..\.........
.....\......-................................/..........|.............\........\............/.................
......../..............\.........................|..........\......-............\.....|.....\....|...\|....-..
.....\.......\/................/...\.......|./......|............\./..........|/.....\\..\...\...|..-.........
..................|.....................-..........\....................../...../..............|......../..../
........./...........|....-..\.....................--..|......|...\|.......|...............|...-.||...........
..............-.....\...|...|./...|..........-......../......./..........-...../..|........../................
..|.../...................................|...................|......./..-.....-..............-...............
...-.........../..................-..........|.........................\..-................//\............/...
|...............\.........\.../.....................|.....-........................\...........-../.-......-..
........//..........-......................-....\...-.......-./.../......../........./...........|.|..........
...................\..../...../...|........--.....\../..........|...........................|.\...............
.\......................-........|\.....\....|.........\...............|.......\...-...|.................-....
.....................|......./..-........................../......-.........../........................../....
--.............\..........\-..../..-........\....-..........|./....|.\.................-..--.....\../.........
.......|........../|...................|.................\..-..........\../....|\.....|...-.......\..-........
........../|.|.....\....................|\..\...........-............./.......|.\.............................
...........|..........-..............|.....|-................/.........|..../.........................-.......
......-..........................|............-.......|/...-....--/................/..-.........|.............
......../.-.............|....\.../............................|.|.....|....../...............\............./..
........./.......\..........\...........\.....\..|....-...../........./........................./..|..........
...|...|........\.......-.......\..................\....................../............-...|.........\........
.........-...........|.........\....................../..........-.....\|.\...................\...............
.....|..........|................................../......................|............/.....|.........|..-|..
.../.......\....//....../....\....../..........\........................./....................\....-.../......
/.......\..\...........\................-|............/...-|.|...-..........\.................\.....|.../.....
.....-\.........|....../.......\.............-..........................\...........................\.........
.|.............|................\....\...........-................./............./............................
./...|\...........-\....................\..............-....|....|..........-.........|.../.....-.....\.\.....
....-...............|........-............./.....\....../..\.|.....|./.\......-...........\....../.\.......\..
..........\.....\................../......|.\..../.\..-......-.........-............/....\...................\
..\.........|.....\..........\............./...-....../....|.......-|\-............................../........
..|...\/........\..-\.|.\......./.....|.........-..|........|......................|..........................
............|..........................--.-....\..............-................................|...|..........
.-............../.....................|........../.................-....../.-...........................\-....
.-.........................-......|-./\.........................\.....|.................|......|..\.......\...
.....\...|....-......................................-...............\...........\..\...\..-|.....\...........
|...........|................|.........-............|....................|............-..-.............../....
.................../.|...........\.......\....|......-..|.....................\...................|..\.....\..
.|........-.../...|....../...|......|.|.|..-......\............../....|...........\|.......|.......\\.........
.......|.....-..-.-./....-/\.|./.............|.../......\...|/............/........./...-..........|\.\.......
..|.........-....\.........\.......\....-................|-..........................-.|............|.........
......-..\......|..\.../......\|..........|............../........../............/..\........................|
|/.|................../....|............../..........-........-............................|.\................
........|.....|/................../....\....../....../...................--..............\/..\................
.../-..........................|...-.........-.................\\.......-\.........\..|.....|.................
-./...-.....-....................../.../........./........-........../.........-...........\..................
.\../............|.\..........-.................................\.............../............../.........\./..
...-.....-......-......../.\...\................\...........|.................................................
...........-...//.....-/...-...........\|./......................\.........................|.-|...|...........
....../.....................-.......|........|-..................\............-.....................|.........
.....................\.\................../..|/......\........|.\..............|\..............\..-...........
....\................|\......................./.....-...............................-......../....-...........
...\....................-....|......|........-.\..|.......................\...\.|..............|............/.
...................-/.....................................-..\............-............-.............-....\...
.|....../.....\.....-.../......../..../..\.-...........\.../................|........\.................../....
.......|........./........................\.....-........-...............\....../....|../....\......./........
..........|.........../|......|......................-..............|./......................................\
....................../...../..............|.||............./......-......\...................................
\........|...-..................\./.................\.\.........-....\........../.../.-...\...................
....-..........|.......-......../................................./.../....-.............-..........\-........
..............................-.............\..\......................................-......../..............
......./.\|......../...-........|.........|................/.........................-....|...\.........|.....
......|..........-.......-............./........|..\...|.|..-.............................-.-...\.............
.||...........-.......\...../.....................-././..../.............-................|../.............--.
................\.-.....-\..........\.............\............/.........\.......-........\...................
......./...........\........\./.|..............|......-...........\................\...../.\...../..........|.
.-..-...|.....................-....../..............-.\|....\.......|..|....././.......|......................
./...-..................../................/....-/..\............/..................................\.........
....\.-..........\-......../............|...\.............|..................|.....\.................../......
...........-/..\..-................-....|............/...-.|.......-.|........./.....-/......./...............
..../...-.....\..............-..\.....\.|............./...|.\..................\...|.........\-./..|...../....

10
2023/input/16/test-1 Normal file
View File

@@ -0,0 +1,10 @@
.|...\....
|.-.\.....
.....|-...
........|.
..........
.........\
..../.\\..
.-.-/..|..
.|....-|.\
..//.|....

141
2023/input/17/input Normal file
View File

@@ -0,0 +1,141 @@
314412134515235343233533333536633455653353226524463545367577644655564375735567774443767545555476326253354625332434443364224465621314212153555
541151354452244522426632553456444465355436252633745744545656765664467373344353475666347765767443443552326263264235346622346265464551153535535
331313213153324653452333663333462335265624455475544677337533645646454544573377667566554353775343377532656434266344566626434262245532313441542
231231134242452536244266236256525426355273354474573763575656667355645557536446754366667563657447367737456645352222534556245645343351335322223
251433112552564352445455233433553362245337533756634643733533466354356373567633334767437674677465346746774546242625352644324265246422513313355
413125324132545243423242425355265226355444733776744656536465355674555733753474534534433566567674774473567333452433553242344623352255235253434
532355354346566256462226323353453233574773645645433345534463465454533556537575575577754774536656666577567366323533434336553634632645651225243
455311523432626356642246453352635354666745454767466646743434437774334444766744753773634355543363377575473337333424664332326565454236653544323
424523363662246263654465624464655447744774567556775663763465367677374675753355374345346677343654333775353543635753655256634466626335324551131
312234524445243642435564344443643546563334674463666677677375666374376637677377675656367674677655374445445436364656344562424423465563566224112
115435666634232345425362663436566563773563533376643646553453766464636476757674637467374456676436444363454454565354445236442434463546522456311
154534345264644332453643233644775666573434664657335643647354474373543563433577357373746663547554745737536477775465743462232356456544633335612
451266255244444535322452434645573365766537743665343557476666464758667467776574476764465334655477443443745655654457677624263534623665264555224
353335563222253235535444636573356337445367344474777333557878464768444788856675585565465366454733456455674536433473654575346243664464634353361
133423654653562566524555363736665736664674537436557377575766444544774854555847644678448674465647577673665776754454646667262236226252353332253
133244534342626454662664766673363454654775367333568448688558578768686448546868444748457676856473435435676655374655443447465552545633333543332
243466552334262456344733345534573753356536657446767756788575445478764548775685776647768646456856765643745556543743664466543662642344456546633
225656624252654654257373356646344537466547455766887558787658686656447855868447485884684656856578745535456436454746473564736542642544625222354
263225332334642334675643644754654536773763445878468566857854558584444644768557757487854646584847654777756335644546467463376674663436535646452
462346565445343656664446656746533643745447844866758554785454458448648877657447474444486777886656567775334434446577467565433575636665445223642
363266453445466566556667366355434346533355777566657774487686846454565466845574688847467448668876766446676776475563644443566363242625262335623
325363664656255465436433336773567347537767485744446565664446855866487664586568787776655755686868765886664344557456735673467475426333444333354
622523453334652767737546677766537644476465885765644778876688488446747664448447488668445647744766848776656844776733757447477443333425525625425
333623242525533576376533574476577337665748887566464644665446655885548856787747865488577777487546544876644587367343333376355575457243464345323
543454255433367553446637345433677465656546447845788656747548755757888785557588445647856758456654456888685858475473564764673634765655244332245
623536555425575563774673767455733665777686666786545674684485686454886457575558854685585754647856666454488644483445777757775736767455653333323
335365452534347455445473435765736686586454476877577676868665648588444785645788688755665567847847585545847774845545765767665374567754666353346
465462453636344566675354655574674445647778775756448777556676575896785898598558875578854754655544448684755674768743663367375367764556356656544
363442635343777335564633673354845878587776886578665748646577867786688655765785766556946866764484465548878588568456776747534365377563626244552
232634453453763747553644733568475457767854754657478566598876656677877858987888958665955775887757458758846446485486633766635574537637743535463
522344452575745446776443535457848555475857457855478488988789876956765857655568587967855966667854884755868658474447474543647465737337736454553
663552627334333773546633445548767755868645584584477759875859697897758656889957568796889865757587657865664687876775763343644433447356576623322
445264645556337754376544665585466787575557454745756756569865889888669678579697997988759885795864747457454586846847864776454355655747776434462
622455277467655667357753578774565877584888457466786879796679896785676566558958878758687656579956856668584545646457888846333776555447355326455
332544567353564566667655876454688564476674785685585555898896589897779866986569586598987767875687986855654688558578465866465363654354575635354
362352774453665775437766846688756656644468774687855675597596697959675558598777586676566558856799988477458485845764474846545665733565465642235
653443463447775343644765866587748864448654759898689676566898666986677759957898699679989767966696878566674676885568556746354374333576755645346
233457756564473374745676786648657667555644559576795697887955798889695765895777795769767775857776555687668866577657748875665546353337347453544
544435543735775756436586648877447574576649986595589858785976896678788775858975897998958798577699775668576788768487847776466567574473543737433
552254545736366367557746645875766864684655876967787578968965796566679766856567978896897569787898896679846454688458564765474667745344575656652
446576536675377537777877667464484755588965569999587859678868658589679797766778779556888989997779955859977746666655578676475336765356674466355
664473477475337634746565456787867874856975589795859955596796869957859878755688955799686898799975987695678655645557444554578533555356365636576
465574733563457536788876484884757745657879799597655969996679655767876986677677885995975575988689878558975568885475654565747543764777545434764
655353564364767347457778866577575747857576977959767669999755887968768679988668899777968856587559585695675755788768567745454887754734566654776
367447364467773735858756877784568848579768578757989966677688997788886686879996878778959688959859779665977976845865465575445443764647473556443
575575376547735375465674555454756677556699558557789786866688889777886986677798966766867857656867689689857999565775845768554668773553355667455
234337435764637437477847577878544788568595659969575976666789796968969867888879989998669978798695996588697968856484458578564864454363357443746
757374646667343374658776784548485699556687968567959887878767769896667677769799977697998887555798975859969987654847844667488486337577646667436
746675344636443355447847877775585975688786658585856976688798979766676667669777869966786696985578695567558879587875686667857658435634537537574
565477576353557754765856675584756757758869688899685888866867969967789996777977696786786799899578969989676858577478878648884558444634344565534
545776547376457656484767664474675785787867996876586886969967867667968766667869896988688866988899565575789556889485458685687857857634755536555
556547536534744464666677768654665678867877599566799896796696767679697779667679787798778776868867566879877875598887644644556565875437573346464
475674567766655748846675487577896855868786656856889676967777888896899798696668996799767868967695859567789998779678567645654866474475575474564
575776574667667488585664655566878858856696985666978969677996768866897769698998978797769697696678578875896978895756568847474676767653445435775
654337754774366757587856446454599578896669889566879786768967788796796669876779987979768676978667976655798586598867767646745874485743333475573
654535367644768656654887558678576586959758878969989678877897997899999966989878689799986869688867799655667586798667456578885664544463374435766
373454367345364747845477877778675566899885865996967677867679667777788676989889796668969976888798995987599977865979678558884576658675654335775
445765373433585588645685488858679558587596589669677997776969767976999889898898766997786967866698797999857865789796785754485546845444454775674
337734475564468456565466675695986676969896699869686898678978677788879779787799996887768688996869667576965976777685546448666856777733574373737
644734774466757856744886858488965696559799868986877886989867976897888778788788798986886797677969698965795977998975557467585758586844655756455
554577373345575856457564758579875559586586796866798868679677697988989997977997877768988676689966886665767569769698685685548846746574457776477
667557463566744755788558777855777886587799679787686877796677897998989989988989787886668788678666969975976669795676556888447866647567743646364
477373654454748646848578744889989655567667976978866867686997789989879798778898999797966898766997896877988557566598698448764657467667475673343
547767744463684588776576646599966657599868977798867767969869998988789788779979999878667887668677976995895669795776694454475565788475343635657
575346733753567857486747775687658558698895999787897796978778979899978798987797778998888699888676688686959695889576575786886446768854464455437
473546446375756484756475658876679886997566686887666679669897979779788997978979778799998867676769798987567787967859975765844867475587534537454
776453776365684567446656644967786587775958996676668967679898799998788799879898877877989898977976777678699685585766764777775447488756354556446
736736635634666666775484566586558589788997989786967767799887998789888988797899987888989886989697987667599676976788787665844667557685574343647
573544375367857645884646554755995555778899999998889786688779888888989988897997798979897867888697867777955555886985854554867878658455476654776
547366346654785856677675467857768875867789767867687996698877797797899878799797879777887699877699896968665989587996796455854847576445446464566
553774575776675458645746458988598759889577967677669966899798979999979999789878997799789966699879979775697777599869796745465885585456345737663
353767574665657756756574574787569598778898766697776969787797997797878998797878779887779986689876898989659798867989978566746888666457646435435
653737743445665787556877448595787969666796786787697768767778799999788897889878889979979888788689777869688958985877955585488544558456364563435
763637337773885888664576787665577575587575866776988989688778799898797888889889798798876887679867876995756675876698764657588677588473535647734
637644466754745688456758488895558797777587677768679999666877988788777879979897997898778676778876797665975669889776876777657444686464667776673
666575766736756646478667475789986767858855969986999798899899997877987998799899899987896677686676868779995578576986677485854676545866776337365
766455377434588788655477784898599856578797767798869686878899988797778797777877899788897777699996979975569757859898676546748776486667636474556
545447346666475474465466565586969777578988877798779686777788998788798997877998897979899997796697788985669755797567897486874854548465473567557
444655447566445854654474455756878599795979666889787989699799799788789899798878779887786786978766799797798756556977755677546455687663556373733
457756474767867685745767766688656959868969669698696779769987889977889997879978988997869666968688686686667595765685954465848754645545676346656
577777634634784475566585487766898679766857589876666797878786899778877977888988789997897987777866866875865657958858898886558674477546645373733
375564455343464778546576465699596776656969768977898766987868978799797977799899998977676887796966769685566567875598986866656546864673577335644
764536374744688766576577885877665755778667698767767896866976678787887997777989979797997897886879998588785565797599856764646476874865657375337
543643663577445575575746865856699797886966697787689988987898997887889778799878876968676879669667867865969569598866786777478684447473535476464
636376576444445784685557667858867858989886768887678798987997786899978898979778799676976968699687687696799958596989878545477776884836466676544
763557453467756688577756587779998976955765595888976888986678666799789998989886898897796979988899965969688858788595854765644557856563554676536
577357635456488886845878554769765556955985655979997878697999677778688978698787966866789866976999769896799668958869464854575446585434637564676
364747645336576587565657758877675688959786977998788886798766997696767666867669986699686998698989755758698855876979464485786565446476634357363
764673654455638867657864677868688686876669689896868776679986866978666986986777787686788676788988756558765565677587548746675558674337566464735
467553475334767444466644884457796887977895865685877786688968766788798869987667677976979679776875687896785677785585464887785478847566336676367
754553573564374878888686745468795559998559558576899666976769996769969687868797787688689676689897687688897755999976676746558645464445673675377
654645755747464485667558574456877887787569867679887798667687868677876778669689666779886968896876685659976676658686566557864768873645664376734
445544646666653788765567845564557669976567696868566987669896966988769778889996997766998998877788995567766676565676856665458647445467373676373
335345454544774365576884545776447679769795858986755876876678877988676979788677979897688799775658967569577968775874488767645745846353477357637
366377754753734477674448744864875789898856866979656686786676967688978696879889689678998668967576985558585659776884567855454458533567566333343
634577374346476446555445785448644766995595858979896666888979689876778998787897688787799698888955955598989698964778556874557885545653374555466
677556475565736667777484485656567599957978799986798886767978668896669897777678898796786667657569787669575865654655784846475888734563453447733
436473576775565774677876476556488659989779567768788785959799789889869898668776868679767999878696597975756768458548448585844656454736734654746
547357337753544344646667465664866846685869885977886995876969889768689977867696698867687576899598699757796587666875856478644854555674435777546
347756377665473476788767458886747667756788579676986758786598768688666796797777766975688995896569669597986656644477885868658863643356336436767
435655633356663457687474657867868586557857757898656955676959979987699988668797969575679668986989599968778575744456465555448545746745553656636
232735335633336435364776478856564678779895856986785956779795856697686755768967786866756967879579989575999767445845658488464367745456563766652
365534555754666343356858854544586845478695766698595578657657699589559657775566978578796968698978756676686864564748787854774355466336575533356
332456745574334636435755766547766858677477558867578676869797997655556578565658577689657675777885779856545854766587588785885553755574346447734
642637766374645667576784676645584544887786985679965689779986669967558768898687899778796895789897896869675566888667844764866335475676646746344
446266775465654344746545588648865455558567795956557678858587988789596567768697587755599776658585659584746544448586656576843675434737573434342
224663653636375747635334754667777785765845587767875669699965575665656696965569779879659798977576858957685655475765764488774657635437473366356
625426436574367576377455445457768877844667877696677657787998676675855585695556989557695768975657585787668568586645766544775754777736377573643
254365447437365344543734686478587446577464478577858696676989769786995956675995686669859566789766667744858454484774566846375675636477476676335
422222654656766733456576778578576885587687484547879668859979585659755658767565669789967569955759486556587466846657846867463337773463345653456
222663564645657663455455778578554485465786786857688856768877956578786888557568998985866787655554855578544846755487777674735775777464734622546
254425667467346335477743536684857855446886765847878588867978695556586758898799875967867665697587665575484878864786575464647575364434365244232
545624253753775647574566377467768786547854476484446767697887679959597569976686666989776986887485646865745586658564643373645345733746736652366
445252323737357543544335573665464678448566785686457785666686788888585959758897989777867765544747588555474847478855647656665644764466453436244
624334552663634667443673377457587668454844544466745588644789865859879759688676686967574556546474878564576746445776434547637734437356426553336
646342663527575634777653454344647768685555578668685585747484849669788588997988769574756864788445847464484765785557365333564764664464523466625
433646226555554733443535333646458856474776865656467548576566554476676858654688585874478857475648667678875678885646635637756557467755533632524
524224632242777744344347444334366578578575877467887886555676854678445574565875655468577574858767577688754564753666644467764676465333565552463
332524536526246557754755777633656654474784458587665548686487884874566865658745654485687757788578847456445876553653343573443456766725335256642
232554544665423736756756355734633455656467675747788778876765845585468587877455867666855787577686557854444777576433354455347456475525443524464
442536554246245356477665466553537546467888677788466877467686486657667685476657657467447667888766845477874466347633375765374567555252355555234
466244246525246247457757744364447343554644867457546676778874586655685744567645544464686645886845556867444547446577475333544476334534663633245
256564536546536663747336555334445355353685446444654655484676486875548856554568564566857447765885764477666734375743576475547457262563335256256
422666323232323265733677534764557654535733767547847748648476454756566877767566745674454856755477854786445654433454543465347365665232624666552
424322552553422235336774436334655656753464566788846587546678666644787566484885754665684866448466644745643776645476477537765745622326366565354
345543454253666434265365537663576573436433745778877446564777478457575846747454774548745457745447684757344355355745445557775262543464556444634
336332264656464436433635346557737336357437635546658478488856868457865746755647874844656478545747333465337573563736436377474556263642424323626
522645624243565434556446456664775367336437757757366675878887787775687654585666655745655846458333674745667336355753654677662464322345536366444
555355255625526523556533365744375654336575555355636447444755865586587665788476558447664564566644433656467374766543333653256234262433543666243
352442235334564446432432343454456456335337663466436474364547647547857775677445776846844647434465354643576547346346673562543352236432233355555
513442263654563562566354553554666563746565354466655433636643784876456456474465676577343673465465554337444354653537646325625464335245434545645
412166442223555666442324255746337746664773367543767373733737677365555364633674664745736555765655345666573457674453644222662456622244462436234
335154546633442632244453333547453533644646357535376775746533656673644367657346633466673535437637674353457475533764463643233554553226563253531
344355262636555362325466655254444447336435574534775754465675544754737373636474353733766573766355474364665466456367352423244564562442343664431
311413135435554264436263252552354346437465375467563776374733477357475637647547553646677354774353547337664736454445366643346246333553342424441
535433415243554224545433322662227453333764757337343766763564757456745673733566554346344364757363656755345357754222664244523544535662564243331
134111534364445323222623622364552434633767676433737455655363547774354473747466434563657563745543347455674446543443655424426366324335634323325
351255341465626465234256523662254632653447333533467334465363354667336765477454734657366335356637333466453444525332662564422333455463641114144
552341443344524565642265436465366522436473534654637564453564353534556774457633576376544536465446545333744663365656323344662535233245324445313
221252532115466236652623632522433654526676365575647434775344354564367573777346436744774454673664564335344245253635255564364626663532252232132
144524115433215643653323636235532663522464736374347774777656443757553555345734367444567773663755546434263345354363654655245244254515334312415

13
2023/input/17/test-1 Normal file
View File

@@ -0,0 +1,13 @@
2413432311323
3215453535623
3255245654254
3446585845452
4546657867536
1438598798454
4457876987766
3637877979653
4654967986887
4564679986453
1224686865563
2546548887735
4322674655533

5
2023/input/17/test-2 Normal file
View File

@@ -0,0 +1,5 @@
111111111111
999999999991
999999999991
999999999991
999999999991

794
2023/input/18/input Normal file
View File

@@ -0,0 +1,794 @@
R 4 (#4b18e0)
U 4 (#0b4f93)
R 4 (#6d70b0)
U 12 (#86edc3)
R 4 (#435460)
U 3 (#07f023)
R 8 (#33dd00)
U 5 (#599aa3)
L 11 (#83c702)
U 5 (#3f0501)
L 7 (#4bf232)
U 9 (#3f0503)
L 2 (#4955d2)
U 5 (#24f2e3)
L 9 (#16abf2)
U 6 (#60f753)
L 3 (#678dd2)
U 3 (#736093)
L 3 (#007482)
D 7 (#446e11)
L 6 (#0482a2)
D 8 (#997fd1)
L 4 (#4891e2)
D 6 (#2547b1)
L 5 (#501bf2)
D 8 (#7ed033)
L 8 (#0dabe2)
U 8 (#7184d3)
L 2 (#748a42)
U 5 (#12e093)
L 7 (#672432)
D 7 (#19c6a3)
L 4 (#1c5c22)
D 2 (#6e8a23)
L 10 (#5cd602)
U 9 (#1d8ff3)
L 7 (#359ce2)
U 6 (#333143)
R 11 (#0422f2)
D 10 (#235323)
R 6 (#64bc72)
U 10 (#6ea5f3)
R 11 (#68df60)
U 10 (#0952c3)
L 4 (#5206d2)
U 6 (#09c2a3)
L 5 (#45f7e0)
U 6 (#6d15e3)
L 6 (#271740)
D 6 (#6d15e1)
L 7 (#2e6a20)
U 9 (#178883)
L 9 (#430370)
U 4 (#2ee7e3)
L 7 (#8bdcf0)
D 9 (#5cebd3)
L 3 (#3d5a50)
D 4 (#5ecc23)
L 8 (#095b52)
U 9 (#3b7121)
L 10 (#8061b2)
U 4 (#3b7123)
L 7 (#209272)
U 4 (#493833)
L 9 (#7d9b02)
U 5 (#283633)
L 3 (#0db702)
U 3 (#437d73)
L 14 (#721282)
U 4 (#059a63)
L 2 (#4630d2)
U 5 (#6c5f43)
L 13 (#2949c2)
U 3 (#590a93)
R 5 (#4f5650)
U 5 (#71c3e3)
L 8 (#308540)
D 15 (#4fbc53)
L 2 (#4fa760)
U 15 (#41d523)
L 8 (#6bd380)
U 6 (#5cb553)
R 6 (#76acc0)
U 10 (#6be3a3)
R 6 (#5d61b0)
D 10 (#6dd101)
R 4 (#04f600)
U 4 (#4ea101)
R 2 (#6c2630)
U 5 (#498ac1)
R 5 (#0667a0)
U 5 (#120ef3)
R 3 (#31c080)
U 5 (#861cd3)
R 11 (#364e90)
D 5 (#6dd103)
R 9 (#6fe5b0)
D 11 (#119d43)
R 6 (#111310)
D 14 (#2ff323)
R 7 (#177432)
U 12 (#0ccbd3)
R 2 (#77c592)
U 9 (#6eee43)
R 10 (#21e622)
U 8 (#0bc513)
L 8 (#5398a0)
U 2 (#53cca3)
L 10 (#463c20)
U 5 (#53cca1)
R 8 (#174b20)
U 11 (#09ddc3)
R 6 (#20c940)
U 11 (#2fc6c3)
R 8 (#7ab1b0)
U 6 (#7ab291)
R 3 (#057160)
U 6 (#008331)
R 11 (#62c440)
U 12 (#3233a1)
R 2 (#1ceaa0)
U 4 (#4ef663)
R 3 (#7e5670)
U 2 (#4ef661)
R 5 (#3ccc40)
U 8 (#6e3531)
L 13 (#3964a0)
U 5 (#68b801)
R 13 (#83d220)
U 5 (#459901)
R 2 (#053a70)
U 6 (#4d18d3)
R 11 (#8a23d0)
U 8 (#4d18d1)
R 9 (#2cce90)
D 14 (#48af61)
L 6 (#045500)
D 6 (#0b4971)
L 8 (#18fa70)
D 7 (#7d8d03)
L 3 (#6ba530)
D 9 (#061783)
R 9 (#2c9c30)
D 13 (#402993)
R 8 (#18e9c0)
D 7 (#51e7a3)
R 15 (#18e9c2)
D 3 (#0ae133)
R 5 (#4929f0)
D 3 (#8d4623)
R 4 (#277680)
U 11 (#034583)
R 7 (#1ea1a0)
D 11 (#6cc5e3)
R 8 (#8894e0)
U 5 (#2fc6c1)
R 6 (#4dd6d0)
U 3 (#7f5b21)
R 11 (#219440)
U 4 (#2db8a1)
R 6 (#4053a0)
U 6 (#2df7e1)
R 12 (#086710)
U 8 (#47c7c1)
R 4 (#41ee90)
U 3 (#1dfa61)
R 3 (#5c3610)
U 7 (#483023)
R 10 (#2b6060)
D 3 (#327133)
R 8 (#2e4b30)
D 14 (#212321)
R 8 (#4bfd00)
D 5 (#5f0b81)
R 4 (#718450)
D 14 (#320dd1)
R 5 (#103630)
D 6 (#911953)
R 4 (#3f6190)
D 7 (#212323)
L 4 (#7f84b0)
D 10 (#2816a1)
R 5 (#026f80)
D 2 (#528ab1)
R 8 (#04e160)
D 11 (#655ca3)
R 2 (#0a1bf0)
D 3 (#6872c3)
R 12 (#7ad510)
D 8 (#72fe63)
R 7 (#109a50)
D 9 (#66ae31)
R 3 (#0828a2)
D 12 (#039eb1)
R 8 (#6f2c60)
D 6 (#46dae1)
R 12 (#76c900)
D 8 (#724711)
L 10 (#0a41a0)
D 8 (#73f301)
L 2 (#029092)
D 5 (#2ee5b3)
R 9 (#794702)
U 9 (#2ee5b1)
R 9 (#745f72)
U 2 (#108e61)
R 4 (#30e792)
U 10 (#099281)
R 11 (#347f32)
U 4 (#319ab1)
L 5 (#44a712)
U 9 (#623681)
L 6 (#3b5002)
U 10 (#25e431)
R 6 (#4f3f22)
U 4 (#226f51)
R 5 (#26f7b2)
U 8 (#588341)
R 4 (#09de02)
D 11 (#423f21)
L 6 (#6c9ee2)
D 10 (#423f23)
R 6 (#3badf2)
D 4 (#2c0a93)
R 4 (#521a32)
U 7 (#4ee803)
R 15 (#47f6d2)
U 2 (#673651)
R 4 (#5c10b2)
U 9 (#4dc641)
L 11 (#4d7032)
U 6 (#299111)
L 8 (#8d06b2)
U 8 (#22e4d1)
L 7 (#7dac02)
U 4 (#58e171)
L 7 (#17e332)
D 12 (#211931)
L 4 (#7e1732)
D 5 (#502911)
L 4 (#88c6c2)
D 5 (#430ba1)
L 3 (#3e4de0)
D 13 (#481b11)
L 5 (#5925e0)
U 4 (#1cecb1)
L 7 (#11ecf0)
U 7 (#634bc1)
R 7 (#6218d2)
U 7 (#7990f3)
L 5 (#576b42)
U 4 (#7990f1)
L 10 (#145832)
U 9 (#609ef1)
L 3 (#0d8822)
U 4 (#2b1f83)
L 3 (#77a562)
U 5 (#2b1f81)
L 6 (#3d05c2)
U 7 (#4b56d1)
L 5 (#1f6272)
U 8 (#916891)
R 6 (#087ce0)
U 6 (#2cf203)
R 12 (#285e60)
U 9 (#6ae623)
R 9 (#8a34a0)
U 9 (#6ae621)
L 9 (#15b200)
U 11 (#40c541)
R 5 (#0c7fc0)
D 7 (#2d5ad3)
R 9 (#42f280)
D 7 (#8140a3)
R 3 (#255770)
D 10 (#8140a1)
R 12 (#4ac260)
D 5 (#2d5ad1)
R 8 (#083780)
U 15 (#40c543)
R 7 (#028ab0)
U 13 (#2cf201)
R 5 (#1461d0)
U 2 (#23bff1)
R 4 (#1a4992)
U 3 (#355fc1)
R 7 (#6cafd2)
U 5 (#355fc3)
R 6 (#226752)
D 6 (#5af021)
R 11 (#526e82)
D 6 (#055ac1)
R 4 (#460a42)
D 3 (#055ac3)
R 6 (#565542)
D 3 (#3cd6a1)
L 7 (#2da922)
D 10 (#708ea3)
R 7 (#687472)
D 4 (#4ec333)
R 4 (#58d602)
U 7 (#4dd3e3)
R 3 (#23a7c0)
U 10 (#51fa83)
R 5 (#23a7c2)
D 5 (#188363)
R 14 (#5bc432)
U 4 (#3f0d23)
R 8 (#27a940)
U 3 (#62a3a3)
R 10 (#27a942)
U 6 (#0ceab3)
R 2 (#4479c2)
U 12 (#8beb63)
L 2 (#0b84a2)
U 3 (#3aa313)
L 7 (#270672)
U 15 (#4bd563)
L 5 (#4d8072)
U 6 (#045183)
R 12 (#08fed2)
U 11 (#52d323)
R 2 (#050992)
U 9 (#618533)
R 4 (#17a282)
D 7 (#08e921)
R 3 (#1a0d22)
D 6 (#0e8541)
R 11 (#61b232)
D 7 (#6635f1)
R 5 (#617832)
D 5 (#08f4f3)
R 2 (#490c22)
D 3 (#234821)
R 3 (#476942)
D 12 (#234823)
R 11 (#31b6d2)
D 4 (#08f4f1)
L 6 (#129582)
D 6 (#507ed1)
R 6 (#1e7010)
D 8 (#5490e1)
R 10 (#093bb0)
D 4 (#7cefc1)
R 9 (#6fe430)
D 3 (#0160b1)
L 8 (#1a8570)
D 2 (#2722f3)
L 4 (#2eb860)
D 12 (#572d83)
L 7 (#556c20)
U 12 (#50d5c1)
L 6 (#3a0932)
D 3 (#0a1701)
L 6 (#2294f0)
D 4 (#5f04e1)
L 13 (#62c590)
D 7 (#5f04e3)
R 6 (#1660e0)
D 2 (#34e001)
R 6 (#23b340)
D 12 (#1e92e1)
R 6 (#786d10)
U 12 (#44f8d1)
R 4 (#786d12)
D 3 (#3f6cf1)
R 3 (#2e2812)
D 3 (#185ac3)
R 3 (#7976e2)
D 14 (#0a5201)
R 4 (#15e3e2)
D 3 (#825221)
R 3 (#699e12)
U 3 (#8ca423)
R 14 (#04ffb2)
U 3 (#185ac1)
R 2 (#0a3482)
U 4 (#59d541)
L 10 (#5b8ab2)
U 4 (#59d543)
L 6 (#395af2)
U 3 (#2fdcb1)
R 7 (#1d5670)
U 3 (#3801c1)
R 6 (#65de30)
U 7 (#522db1)
R 11 (#9a9020)
U 12 (#382413)
R 11 (#55b6c0)
U 8 (#382411)
L 4 (#4549e0)
U 7 (#2f1091)
L 7 (#127550)
U 7 (#3e2ee1)
R 7 (#1b7ba0)
U 5 (#0177e1)
L 10 (#581e30)
U 4 (#0177e3)
L 8 (#287b30)
U 5 (#4667a1)
R 6 (#3a6730)
U 6 (#7575e1)
R 6 (#4d8f90)
U 8 (#06a251)
R 2 (#32a980)
U 5 (#92bbf3)
R 3 (#465200)
D 4 (#1e82a3)
R 7 (#5e49b0)
U 4 (#282471)
R 6 (#95ba62)
U 3 (#3fc1e1)
R 3 (#95ba60)
U 9 (#495841)
R 3 (#3bece0)
D 13 (#06a253)
R 3 (#58ed10)
D 4 (#3c4df3)
R 7 (#830800)
D 10 (#3c4df1)
R 4 (#39bca0)
D 4 (#0e26a1)
R 6 (#09cd40)
D 6 (#725971)
R 10 (#624800)
D 11 (#49ae11)
R 11 (#3ed060)
D 7 (#49ae13)
L 12 (#3e0b20)
D 4 (#569191)
L 3 (#1bb070)
D 7 (#0b1803)
L 10 (#045fa0)
U 6 (#8cb0a3)
L 7 (#57ca40)
D 6 (#146f43)
L 9 (#5ad0b0)
D 3 (#22f873)
R 10 (#249e42)
D 5 (#429003)
R 11 (#35bf52)
D 7 (#162bc1)
R 7 (#5689a2)
D 10 (#162bc3)
R 12 (#286a32)
D 9 (#54b443)
R 10 (#505c32)
D 3 (#831903)
R 7 (#003ab0)
D 11 (#6a9af3)
R 10 (#39f710)
U 11 (#1f31b3)
R 5 (#6fc5c0)
D 4 (#071b73)
R 7 (#3fe110)
D 9 (#5fd6e3)
R 9 (#3fd500)
D 3 (#2fc9b3)
R 6 (#727a40)
D 7 (#531d23)
R 14 (#02afc0)
D 6 (#1e5cb1)
R 4 (#717490)
D 12 (#6efba1)
R 11 (#5996f0)
U 5 (#763861)
L 5 (#444cf0)
U 8 (#763863)
R 7 (#2e2c60)
U 7 (#543fa1)
L 7 (#95e230)
U 3 (#543fa3)
R 5 (#41fd20)
U 3 (#19bf61)
R 5 (#656540)
D 7 (#391283)
R 4 (#33ebc0)
D 13 (#391281)
R 9 (#709320)
D 6 (#498291)
R 3 (#03c942)
D 6 (#3391a1)
R 6 (#5a83e2)
D 5 (#4eaff1)
R 7 (#2ca112)
D 4 (#2de1c1)
L 6 (#8724f0)
D 9 (#4b7fc1)
L 5 (#005232)
U 9 (#322291)
L 7 (#6a7682)
D 4 (#5d2381)
L 5 (#6e5312)
U 13 (#5d2383)
L 8 (#4a5e52)
D 13 (#61a5a1)
L 3 (#2adb12)
D 6 (#1056e3)
L 3 (#74eb12)
U 10 (#1056e1)
L 12 (#4c3122)
D 9 (#02d251)
R 9 (#30a702)
D 7 (#7cd9f1)
R 10 (#56a522)
D 6 (#25e4f1)
R 7 (#720682)
D 3 (#11a711)
R 10 (#4810c0)
U 9 (#7233d1)
R 13 (#47d8b0)
D 5 (#222c51)
R 6 (#270630)
U 9 (#6c2991)
R 5 (#251ce0)
D 9 (#0ce373)
R 5 (#0f3af0)
D 4 (#234033)
L 13 (#399410)
D 3 (#1091f3)
L 11 (#12ab92)
D 3 (#2c05c3)
L 9 (#53cc00)
D 5 (#662eb3)
R 3 (#53cc02)
D 3 (#19fbf3)
R 8 (#12ab90)
D 11 (#13a3c3)
R 10 (#6b7ed0)
D 7 (#480071)
L 10 (#39ba10)
D 12 (#414181)
L 11 (#6be3c0)
D 4 (#308403)
L 4 (#5081d2)
U 3 (#4a1c33)
L 6 (#412360)
U 11 (#5cad03)
L 4 (#412362)
U 11 (#1670a3)
L 8 (#5081d0)
U 7 (#36b3f3)
L 8 (#4a86c0)
D 7 (#1903f1)
L 11 (#5aa690)
U 9 (#88cd01)
L 3 (#3843d0)
U 14 (#4c44d1)
L 8 (#92ea62)
D 5 (#205b31)
L 14 (#2d2130)
D 4 (#1600d1)
L 2 (#5eed20)
D 8 (#504601)
L 9 (#4238f2)
D 10 (#8a3821)
L 3 (#524dd2)
D 6 (#8a3823)
L 3 (#106f82)
U 8 (#3d0d81)
L 6 (#1ec032)
U 6 (#040993)
L 4 (#1ff1d2)
D 14 (#17b973)
L 3 (#3c2ae2)
D 7 (#7c2501)
L 7 (#633cd2)
D 4 (#6530d3)
L 3 (#082de2)
D 7 (#16f433)
L 13 (#89eb52)
D 5 (#17b971)
L 3 (#252512)
U 15 (#040991)
L 2 (#90d092)
U 10 (#0a1021)
L 8 (#1cd900)
U 6 (#4a13d1)
R 10 (#7a6bf2)
U 4 (#4683c1)
R 7 (#7a6bf0)
D 11 (#3a66f1)
R 8 (#488f20)
U 11 (#7135a1)
R 5 (#4cc380)
U 5 (#0bf121)
R 3 (#4c2e80)
U 2 (#7908a1)
R 3 (#259e00)
U 10 (#6bafe3)
L 5 (#52e6d0)
U 4 (#506603)
L 6 (#1fec10)
D 7 (#3a1983)
R 6 (#389e30)
D 2 (#2f7281)
L 6 (#55f170)
D 7 (#4cb8e1)
L 5 (#389e30)
U 6 (#2642e1)
L 10 (#7394e0)
U 3 (#642bf1)
R 10 (#7394e2)
U 7 (#132c01)
L 6 (#3c4a80)
D 4 (#3e4d21)
L 4 (#989ad0)
U 7 (#473211)
L 8 (#0aa900)
D 6 (#3a8a11)
L 12 (#4307a2)
D 9 (#13b0c1)
L 6 (#7e59a2)
D 11 (#00a041)
L 3 (#44b0d2)
D 6 (#0efc51)
L 6 (#8a1302)
D 9 (#160fa1)
L 4 (#4afa62)
D 2 (#68e871)
L 14 (#5ecd60)
D 5 (#6a51d1)
L 5 (#764000)
D 8 (#1a6d61)
L 4 (#713042)
D 14 (#0b92e1)
L 5 (#5b77e2)
D 3 (#0a0581)
R 10 (#212752)
D 3 (#0a0583)
R 14 (#3f0ca2)
D 8 (#13d911)
R 3 (#307832)
D 4 (#72d201)
R 6 (#133522)
U 13 (#6e4581)
R 4 (#70fe22)
D 13 (#082221)
R 7 (#44fff2)
D 4 (#731171)
R 3 (#10eda2)
D 9 (#0e5d31)
L 14 (#37bc32)
D 6 (#3852c3)
L 7 (#5f43c2)
U 13 (#8c7593)
L 9 (#2ff4f2)
U 10 (#1787b3)
L 13 (#68b4a2)
U 3 (#15fd23)
L 3 (#515622)
U 3 (#618313)
L 11 (#2d09d2)
U 10 (#6bb2f3)
L 5 (#1f22a2)
U 10 (#4d8e33)
L 6 (#1cb690)
U 3 (#09c3b3)
L 9 (#214c20)
U 9 (#5bfe23)
L 9 (#848910)
U 10 (#1a73e3)
L 10 (#3d9252)
U 3 (#089003)
R 11 (#7ddbb2)
U 8 (#20c473)
R 15 (#071dc2)
U 7 (#554823)
R 13 (#0cfb42)
U 7 (#1ccaa1)
L 15 (#847822)
U 8 (#5f0271)
L 4 (#03cdd2)
U 10 (#4f69b1)
L 3 (#4b1902)
U 8 (#8129b1)
L 4 (#5e69f2)
D 5 (#1f33b3)
L 5 (#2e2582)
D 13 (#67aea3)
L 4 (#54aba2)
U 3 (#08d7a3)
L 4 (#4eebe0)
D 8 (#030763)
L 9 (#2d4760)
D 14 (#79e223)
L 9 (#7c3342)
D 3 (#334c93)
L 4 (#2b0202)
D 9 (#04d053)
L 2 (#1475a2)
D 7 (#8aed93)
L 8 (#62b4f2)
D 5 (#14c931)
R 11 (#29bc82)
D 3 (#65a951)
R 12 (#656f62)
D 3 (#7a7283)
L 8 (#2bec52)
D 7 (#1a75a3)
L 8 (#988402)
D 4 (#1a75a1)
L 3 (#1aad22)
D 9 (#373923)
L 10 (#7e3ef0)
U 7 (#3e1c93)
L 11 (#3f89d0)
U 6 (#3e1c91)
L 3 (#652e40)
D 9 (#35acc3)
L 7 (#5b0fa0)
U 4 (#46ca63)
L 10 (#079fa0)
U 7 (#391523)
L 3 (#079fa2)
U 3 (#585573)
L 8 (#1f43e0)
D 2 (#403c21)
L 9 (#144b10)
D 5 (#8fa921)
L 5 (#144b12)
U 7 (#084fb1)
L 4 (#661600)
D 6 (#5e06f3)
L 13 (#3f87a0)
D 8 (#3ca8a1)
L 13 (#4214e0)
D 10 (#567b51)
R 4 (#7a3080)
D 8 (#17de11)
R 8 (#644090)
D 12 (#55ba83)
R 3 (#025e60)
D 8 (#554783)
R 6 (#0d2eb0)
D 10 (#552813)
L 6 (#61a7d0)
D 10 (#272cb3)
L 7 (#34d6a0)
D 3 (#36cf03)
R 11 (#14be00)
D 3 (#52b543)
R 4 (#1fa362)
D 11 (#713693)
L 3 (#652112)
D 8 (#5c8463)
L 12 (#4c1362)
D 4 (#66e201)
L 8 (#07caa2)
D 9 (#6ccbd1)
L 3 (#3b9ee2)
D 5 (#5798b1)
L 13 (#4fb342)
U 6 (#231223)
L 2 (#33e3b2)
U 5 (#022ea3)
L 6 (#3f1112)
U 6 (#3dde83)
L 6 (#2732a0)
U 8 (#1e6bc3)
L 8 (#10f4e0)
U 15 (#45e363)
L 3 (#10f4e2)
U 4 (#4c9523)
R 11 (#2732a2)
U 12 (#174303)
L 10 (#5b4532)
U 13 (#6195e1)
L 8 (#7fab60)
U 2 (#1e7dd1)
L 2 (#7fab62)
U 12 (#4da741)
L 4 (#09efc2)
D 5 (#3d0d83)
L 5 (#47d532)
U 6 (#1f7441)
L 12 (#558832)
D 6 (#24e093)
L 4 (#20bfc2)
U 6 (#606283)
L 11 (#639142)
U 2 (#854311)
L 5 (#318ff2)
D 8 (#7037c1)
L 12 (#1ee752)
U 5 (#6bad43)
L 5 (#662cd2)
U 6 (#23fec3)
L 6 (#11cec2)
U 9 (#0c5b23)
L 8 (#91c052)
U 3 (#62e783)
L 6 (#08ee02)
U 11 (#11a283)

14
2023/input/18/test-1 Normal file
View File

@@ -0,0 +1,14 @@
R 6 (#70c710)
D 5 (#0dc571)
L 2 (#5713f0)
D 2 (#d2c081)
R 2 (#59c680)
D 2 (#411b91)
L 5 (#8ceee2)
U 2 (#caa173)
L 1 (#1b58a2)
U 2 (#caa171)
R 2 (#7807d2)
U 3 (#a77fa3)
L 2 (#015232)
U 2 (#7a21e3)

744
2023/input/19/input Normal file
View File

@@ -0,0 +1,744 @@
btl{m>2179:hzd,a>965:js,x<3167:bc,crx}
ktc{x<2922:A,s<469:R,R}
ctl{m<420:A,s>2487:R,A}
mcm{x>3761:A,x>3654:A,a<829:A,R}
bj{x<1257:xc,sr}
mfq{x<3188:rr,x<3650:R,A}
tlh{a>738:R,A}
zn{x>3618:ph,hvb}
rb{s<892:R,a<2337:A,A}
ms{x<3783:A,x>3900:R,A}
prn{m>2248:R,A}
qtq{a>3468:A,m>2263:A,jt}
dx{a<3314:R,m<3567:R,a<3330:R,R}
vt{x>3136:tcz,x>2504:csv,x>2299:smz,kjt}
xt{x<2452:A,R}
xkc{x<2342:A,A}
st{s<3506:R,A}
zz{s<1239:lxb,s>1671:qgb,m>2346:ts,rbp}
lsh{m>2358:A,s>1491:R,R}
cq{m<2723:R,A}
xll{s<586:A,x<2806:A,x<2947:R,R}
csn{m<2108:R,s>714:A,a<760:R,A}
fr{a<1242:R,R}
dvh{m>1842:gt,s>3457:jhg,jgd}
gxq{a>2315:R,a<2256:A,m>3786:A,R}
vc{x<1484:zlf,x>1814:A,s<520:jsc,R}
hxh{a<3821:gpz,s>1853:mtg,mfq}
pbz{a>2928:xtm,x<2843:vz,m<1108:dv,zg}
xr{m>182:A,s>1810:A,x<3330:A,R}
ps{x>2127:hnp,dgb}
lqg{a<3277:zb,m<1525:mdd,qsz}
jn{x>683:A,m>1020:A,R}
fhk{a<543:R,R}
gvp{m>2630:A,m<1098:R,x>1224:A,A}
ptm{x>1764:A,tj}
sq{m>3289:A,a<312:xt,x>2449:A,fxr}
khp{m>3526:A,A}
dc{x<2210:A,m<1269:bqk,A}
qt{s>278:R,m>2866:R,s>172:R,R}
gm{x<363:A,m>3188:A,A}
shn{m<2469:R,s<3668:mbz,R}
vhg{x<608:A,m<1535:R,m<1981:R,R}
hds{s>2670:xv,blj}
ffr{a>2824:mk,s>3257:br,pl}
td{m<3587:R,s>3340:A,a<3441:zv,hdq}
sgx{s>2973:fm,cvm}
tbm{a<3447:R,x<2836:A,x>2953:A,R}
mk{m>2029:mls,s>3309:sx,tnr}
kfx{s>1999:R,s<1809:A,s<1887:A,A}
tl{s<3243:A,m>724:R,s>3595:A,A}
cdm{a<1934:R,x>1474:A,R}
ksc{x>2830:zj,R}
ngp{m<639:A,m<931:R,A}
jmb{a>414:A,R}
kb{a<3227:A,a<3254:R,s>1475:bvm,dd}
sm{x>1966:A,s>3208:A,fhk}
br{a>2604:zr,x<1844:nj,bn}
szc{x>2026:cmt,nl}
ptb{x>3345:A,A}
hfr{s>3267:R,s>3108:A,x>898:R,A}
qzt{a>452:A,A}
bvb{x>3335:A,m>726:R,R}
gh{s>2919:R,A}
frb{x<2808:A,s>2187:R,x>3086:A,R}
nj{s<3562:fj,zdd}
gfn{x>1559:lzh,a<3447:pj,s<2150:pcz,mm}
kpv{s>1913:A,A}
bd{x>3053:zn,s<719:pqb,a>2965:mkc,vr}
dv{s>1488:R,R}
vr{a<2767:rbh,a<2894:pb,m<2321:pbz,xd}
xff{a>3469:R,A}
rl{a<2707:R,x>1355:bpn,A}
nq{m<1201:mmc,m<1568:nmf,x<1120:dtq,sck}
xgx{m<574:R,x>1164:A,a>3805:R,A}
qcm{x>2564:A,x<2198:R,m>1241:R,A}
tb{m>551:R,m>206:R,m>71:A,A}
nrr{x<2955:A,m>2499:R,m<1664:R,A}
fv{s>3065:R,m>744:R,A}
mf{s>695:dls,a<3530:pp,cmk}
gp{m>1636:A,a>2986:A,A}
fdg{a<3799:A,R}
xjp{m<978:bjn,x>755:rx,dq}
dbc{s>340:R,a>3588:R,A}
qsz{s>1368:ch,m>2826:zd,dm}
bs{x>938:A,A}
pjs{s>3520:mh,s>3245:sg,m>2522:A,A}
mfm{m>687:A,m<414:A,a>815:R,R}
jkr{s>3843:R,mzq}
tlq{a>711:npd,qqk}
qq{a<3021:dmg,m<1998:R,a>3061:ln,frq}
mxm{s>2536:A,s<1125:tpx,fr}
dz{x>3321:A,a<3383:R,A}
sqn{m<1108:A,x<2454:R,A}
bbv{x>1695:R,A}
fzb{a>2748:R,m>727:A,A}
tj{x>994:A,x<569:R,A}
rd{m>3082:vx,a>2081:vn,xn}
tq{x>2808:tb,trq}
lp{s<651:A,m<1731:R,x>3723:R,R}
pb{a>2809:R,a<2785:R,x>2882:nrr,lxx}
ndx{x>3705:pkl,m<2521:R,m<3214:R,xjr}
khh{m>569:A,s>941:R,s<347:A,R}
xc{a>3210:A,m<987:R,s<1171:R,A}
vl{m<2436:R,m>2674:A,A}
mbr{a<376:A,R}
ffv{x>1742:R,a<3619:A,s<529:R,A}
lvr{x>331:R,m>3324:klk,s<3015:A,sgg}
sqp{s<3137:jqr,a>130:pgh,s<3505:A,frs}
lbd{a<2568:lsh,x<1405:A,ffs}
qh{a>3400:gfn,nh}
xj{x>2810:A,m<1464:R,qt}
jz{x>3349:R,x>2888:R,x>2581:R,R}
jgd{s>3243:zzg,R}
vbr{a<3686:R,R}
hk{m>1142:R,m>991:A,A}
vx{a<1949:R,s>1360:A,kc}
tnr{m<1182:A,x<2322:gp,a>3057:R,hr}
ffs{m<1701:A,a>2635:R,A}
klj{x<766:R,a<671:A,x>1199:R,A}
zb{s>2131:ffr,x<2574:kdf,bd}
jhg{m>629:gvv,A}
dj{m>789:A,a>3518:A,A}
krn{m>739:ntr,s>2564:bsz,hzs}
cmk{a<3817:jf,s<378:A,R}
xq{a>813:A,a<773:svl,mz}
mzq{s>3727:R,a>992:A,x<888:A,A}
vqn{x>2380:R,R}
mrf{x<3017:ksc,s<1043:rc,m<319:txc,kbk}
qd{x<859:R,a>3387:tx,A}
cnx{a<3613:A,R}
fgb{x>3100:R,R}
zjq{s<306:R,x>1811:A,R}
qjv{s>1035:qf,tn}
xg{s>2609:A,R}
xv{x<1079:tjh,s<2851:xl,sgx}
lzh{x<1978:ktb,m<937:A,A}
smz{a>534:zdt,x<2415:mv,m<2096:sqn,sq}
lxb{m<1590:mnn,s>488:R,x<3338:bpr,R}
szr{a>292:R,A}
nf{m>2081:R,a>3524:R,m>1915:R,A}
zxh{x<743:A,A}
bjn{s>1703:xgx,m>502:jjx,a>3863:bx,R}
ts{s<1467:A,A}
zfb{a>904:fsj,a>768:R,m<871:qpq,zxh}
tzl{m<2629:dlk,s>2581:R,m>3179:R,prb}
bzf{x>762:R,m<3473:R,R}
zm{x<3028:rzl,s>1458:dg,R}
gmq{m>981:xg,x>3655:A,A}
lbn{s<2515:A,A}
lh{a<504:A,a<885:A,A}
nl{x<1314:R,a>3420:hzr,a<3349:dx,R}
ksm{m<3204:R,A}
rpz{a>3225:ds,x<1030:gm,A}
xb{s<1673:R,s>2816:R,a>1439:A,A}
msc{x<3802:cc,hc}
vk{s>374:R,a>3515:A,A}
md{x<3062:tq,s>2920:ks,gmq}
ntr{s>2551:A,jn}
pl{a<2619:lt,m<1624:hgl,vmx}
cv{s>3403:R,x>3119:R,a<3335:A,A}
pc{a<3417:ptb,x<3314:vdk,s<2948:pv,R}
qhk{m>795:A,s>1386:R,x>1037:A,A}
sn{s<3526:R,a>1248:R,A}
mm{s>3019:st,x<576:A,mzt}
dd{x<2832:A,x<2929:R,A}
tqn{m<3439:A,s<964:R,A}
nkc{x<2397:R,A}
cb{x<1584:gfj,a>3337:nb,R}
bv{m<152:A,a<3361:R,m<260:R,A}
qmm{m>2633:ljk,s<1313:A,fpr}
sx{x<1719:chx,a>3124:qcm,m>770:R,A}
tx{m<2136:R,m>2482:R,a<3464:R,R}
pqb{s>462:jnh,xj}
nzc{a>654:A,s>780:R,R}
rx{s<2123:A,x>1457:A,R}
sls{a>3386:R,s<1305:A,x>3157:kh,A}
fvr{m<3311:A,A}
npd{x<2000:bfv,s>2894:qcz,a>981:tzl,xq}
kf{x<3407:R,x<3652:A,R}
ss{x>2893:R,x<2690:A,a>3086:R,kj}
qk{a>1375:jz,x>2829:lq,a<1229:R,pm}
fqr{s>3038:qtq,x<2313:qd,a<3435:rds,msz}
xd{x>2842:A,s>1412:R,m<3387:R,R}
dg{x>3300:A,x<3173:A,A}
mbz{x<1950:A,A}
zj{s<1270:R,x>2952:A,x>2894:A,A}
ztn{x<2399:vmm,a<666:zjj,btl}
dq{a>3833:R,m<1170:tp,x<323:R,cf}
kk{x>2848:plf,jmb}
cqc{m<1984:R,a<3746:R,m>2346:bbv,R}
cvm{x<1361:A,x>1476:A,R}
nmf{s<1827:sk,qqx}
vbc{a>517:ng,mnb}
kg{s<1832:A,a<3398:A,R}
trq{s<2938:A,R}
nbr{s<3428:A,R}
nb{s>1037:R,x>2105:A,s<410:A,R}
bzs{s>3439:klj,s>3231:A,hcn}
prb{m>2901:A,s<2356:A,m>2759:A,R}
gz{a<3504:qn,qmv}
sf{x>3584:R,a>673:drv,a>384:A,A}
sh{m>1711:A,A}
hr{x<3120:A,m>1725:R,s<2538:R,A}
mlz{x>1121:A,R}
zr{x>2228:ff,A}
bvx{m<3203:A,R}
dtq{x>669:lsk,A}
jf{s<434:R,x>2922:R,m<2086:R,R}
ff{a<2720:R,s>3716:A,s>3513:R,R}
mhh{s<731:prf,kgj}
ljt{a>3420:A,s<1675:A,A}
ktb{a>3433:R,a>3412:A,R}
mzl{m>2308:sz,x>505:vhg,m<1383:A,A}
pt{m<3534:jct,x>1132:R,a<3434:A,A}
pxs{a<888:jc,x<1590:R,s>630:A,R}
fxd{x>1746:R,s>2931:A,x<1473:A,R}
vz{m>1081:A,m<520:A,s<1514:R,R}
pqg{m<341:R,a>492:R,m<513:A,R}
jqr{s<2665:A,A}
mdq{m>1424:R,a<497:ngp,A}
fdn{s<506:rfj,s<789:qrg,A}
dmm{m<274:A,A}
fsx{m<1699:R,x<1215:lh,m>1802:R,lbn}
lc{x>842:bs,x<785:mmg,A}
jx{x>2421:R,a>3815:R,A}
lq{s>817:A,R}
qlj{a>904:A,R}
qrg{a>896:R,R}
tcz{s>648:sf,ndx}
jjp{s>1084:R,A}
hp{x<1315:nbq,s>596:cqc,m>2358:cnx,qns}
lm{a<1592:R,s<2691:A,x<2735:A,R}
rdr{x>1537:zmh,m>3053:dpb,qxp}
vbg{x<2936:nzq,m>2444:nmb,x>3372:dl,fgb}
xp{a<3416:A,tz}
pgh{x<1953:R,a<271:A,R}
rvv{s<3490:A,A}
zdt{a<879:csn,a>1039:R,A}
mx{s<602:kpq,nzc}
bq{m>3798:R,s>401:zpf,lsf}
tr{a>1619:A,x<1673:R,s>1749:A,R}
zzg{s>3380:A,R}
cgx{m<528:A,m>1173:R,x<1284:dj,A}
qxp{x>765:A,x>393:A,R}
nc{a>3563:A,s>1570:R,khh}
tbc{x>353:gqg,nbr}
njp{a>351:R,m>2453:ktc,x>2811:R,dht}
ds{x>883:A,A}
lfc{x>1832:R,s>3439:A,s>3169:R,R}
mt{m>1399:R,m>763:A,A}
vbt{s<3558:A,x<594:R,R}
fg{m>3746:R,a>2323:A,A}
ctp{m>2809:R,m<2504:R,a<1765:R,R}
vv{m>2151:R,A}
rh{s>3304:R,s<3095:A,m<140:R,A}
kdf{a<2917:mp,xsq}
qn{x<1183:R,a<3486:A,a>3496:R,A}
tz{x<3141:R,m>1397:R,s>937:A,R}
nls{m<2817:R,R}
xjl{s<1978:R,x>939:A,R}
lnz{s>3386:mlz,x<1526:vd,m>864:A,A}
mn{x>1476:td,x>743:pt,lvr}
hlm{x>3684:A,s>1106:R,m>1014:A,R}
mtg{m>565:zh,x<3078:R,rt}
hcn{m<3119:R,m>3624:A,A}
hzs{x<1009:R,s<2420:A,a>616:ctl,R}
rmc{m<3127:A,x>3366:R,A}
hzd{m>3173:R,m>2552:qlj,kf}
jbc{x<1179:A,m<647:A,a>3418:A,A}
nvr{m<1005:sls,a<3380:zm,m>1305:xp,jvd}
fpr{m<1187:A,a<472:A,a>860:A,A}
df{s>2631:A,A}
gqg{a>232:R,R}
qns{m>1809:nf,a>3526:zjq,m<1690:msm,R}
cp{m<755:A,a<1604:R,a<2017:R,A}
qmv{x<846:A,R}
bc{m>889:R,s<1465:R,hvg}
ht{a>685:pxs,vc}
hpt{x<2157:dbc,a<3716:vk,s>281:A,A}
xrh{x>3051:ld,x<2974:A,s<625:R,R}
tp{s<1858:A,A}
tcx{s<3127:R,x<705:A,m<1138:A,A}
vmx{x<2184:A,a>2696:zx,a<2659:A,R}
mg{m>2756:R,A}
zh{a<3910:R,A}
kbk{m>444:A,s<1576:R,m>387:dz,kfx}
nzq{a<2309:R,nkc}
pm{a<1302:A,A}
gfj{s>1127:A,m>840:R,m>406:A,A}
pq{s>2315:prd,x>3516:msc,m>638:nvr,mrf}
vg{a>92:A,A}
lsk{x>883:A,R}
xjr{m>3705:A,m<3445:A,A}
mdp{s>2716:R,m>2326:A,R}
ng{a<902:bzs,s>3611:jkr,m>3139:bzf,mxr}
mkc{a>3147:kb,ss}
vn{x>1404:A,m>2663:nls,s>2069:A,A}
mnb{x<657:tbc,x<1083:hzn,x<1315:rvv,bvx}
gr{a<2816:A,gvp}
kpt{x<2223:R,x>2355:R,m>826:A,R}
kq{m<686:A,x<1726:A,A}
krq{a>3559:R,A}
vrc{x>1988:kpt,x<1867:kq,A}
lr{a>877:R,a<672:R,s<1840:A,R}
kpq{x<2274:A,m<1226:A,R}
lz{m>410:A,s<3265:R,A}
gq{s<734:A,A}
kgj{s<940:R,R}
jzf{a<494:szr,dxx}
dxl{a<240:A,s<3664:R,a>393:A,R}
kj{m>1586:A,s<1432:A,A}
zv{s<2784:R,m<3845:A,R}
mmc{m<489:A,x>800:cp,x<492:A,lv}
rfj{x<2731:R,a<932:R,R}
gt{a>535:A,m>2660:R,dxl}
xz{s<919:A,a>3375:R,a<3323:R,R}
msm{x<1902:A,x>2051:R,R}
kv{x<3257:mdp,pz}
hc{m<981:R,m>1233:vcc,A}
svl{m>2596:R,m<1427:A,s<2457:R,R}
jbk{x>2665:R,fdg}
mnn{x>3181:R,a<2055:R,R}
pp{s>379:R,prn}
zd{s>838:qjv,vj}
bqk{a<659:A,R}
lxx{s>1514:R,s<1107:R,A}
rr{m>917:A,A}
qb{m<866:A,x<3264:A,A}
gpz{m<586:A,x<2959:vbr,psk}
nmb{m<3444:R,x<3463:gxq,fg}
dh{s>1463:R,m<1939:R,x<2802:A,R}
dl{x>3628:ms,a<2300:R,m>972:R,rb}
qqk{a>342:sm,m<1336:vrc,m>3048:sqp,xgf}
hl{a<1602:qk,hb}
bx{x>1180:R,x>778:A,a>3924:R,A}
zmh{a>426:A,a>282:A,s>1983:R,R}
zjp{s<2722:R,a<528:R,A}
tpx{m>3219:R,m<2950:A,a<1253:R,R}
klk{m>3694:A,x<183:R,A}
rz{a<3506:lnz,cgx}
bl{s<1061:A,R}
rzl{x>2887:A,s<1195:A,a>3315:A,R}
gjm{s>1424:A,R}
qvp{m<250:R,x<3365:cv,lz}
ll{m>1291:km,x>1101:R,tcx}
zdd{x>950:A,s<3747:R,s>3895:R,R}
pk{s>2497:R,A}
jbq{a>150:R,x<1869:A,s>3035:A,A}
jbg{m>1413:fpl,m>832:bgs,jxk}
xsq{a<3129:qq,m<1811:bj,rpz}
bk{m<801:R,s<1388:R,x>3521:A,A}
vh{m>1098:R,qb}
cf{x>588:R,m<1337:A,x>456:R,R}
cm{x<3470:R,a<767:R,a<841:R,R}
hgl{a<2694:A,x>2481:fzb,s<2721:nvl,R}
ln{s>1320:R,s>587:R,A}
fxr{x>2433:R,a<402:R,x>2425:R,R}
jxk{x>2962:A,A}
hjx{a<1824:A,a>2071:R,A}
ph{s>1228:R,x<3787:lp,m<1465:gq,tv}
gqt{m>3165:gjm,x>1383:xb,m>2542:R,pbs}
dht{a>227:A,A}
txc{x<3296:bv,x<3371:xr,kg}
prd{a>3385:pc,m<586:qvp,vh}
lv{s<2096:R,s>3093:R,a<1943:R,A}
in{a>2381:lqg,kt}
nnc{x<768:R,a<909:A,R}
jck{x>3539:R,A}
kmr{a<534:A,x>695:R,a>784:A,R}
km{x<1307:A,R}
lnb{x<1064:btd,ht}
fvf{x<1348:R,a>622:R,np}
nt{s<3461:R,s>3804:A,A}
rnf{m<3315:A,m>3648:R,R}
rbp{m>1386:dh,x<2829:A,a<2063:xbm,bk}
mh{a<3931:A,a<3977:A,R}
gxx{s>2790:A,m>3143:R,A}
mdd{a>3604:jhm,a>3476:lf,x<2639:qh,pq}
vnz{a>3562:gh,m<899:tc,ll}
hdq{s<2919:A,R}
czc{a<3340:R,A}
hsz{s>1716:R,m<3459:R,R}
sk{m<1435:A,m>1514:A,A}
rlm{s>2276:A,x<3215:R,A}
fm{s<3035:A,a<721:A,A}
qc{x>1032:R,s>3491:A,x<472:R,R}
ks{m>878:hxf,a>3523:xkl,m<331:rh,R}
pbs{a<1399:A,x>611:R,R}
pz{s>2498:zns,x>3535:R,m>2357:qzt,R}
kn{a<2476:R,a>2568:A,R}
jjx{s<1082:A,x>1394:R,a<3796:R,A}
bpr{x<2816:A,a<2100:R,a>2147:R,R}
nbq{s>827:R,x<811:A,R}
jvd{a<3414:A,x<3179:tbm,s<1179:rtb,A}
jfh{x>2953:jck,rf}
xbm{a<2003:R,m>805:R,A}
mxr{m<2849:A,s<3388:R,qc}
qf{s<1147:khp,m>3428:A,a<3755:A,cvb}
kc{x>1142:R,s>808:A,A}
mz{x>2329:A,A}
jtq{a>3533:nc,x<2279:gz,tmn}
xkl{s<3498:R,x<3655:R,m>579:A,R}
dk{m<2597:msd,s>3101:vbc,hds}
pmg{x<982:R,x<1279:A,x>1466:A,R}
sxq{x<522:R,R}
xtm{x<2736:A,m>1180:A,R}
jhm{x>2234:hxh,xjp}
dkd{a<3547:R,s>3418:R,m<205:A,A}
prf{x>104:R,s<361:R,a<175:R,R}
rtb{a>3441:A,x<3362:A,R}
xk{x<2496:tlq,dxt}
tmn{m<683:R,A}
ddg{s<3705:A,s>3809:R,A}
tn{a>3545:jx,x>1940:R,a<3426:xz,tqn}
jc{s>401:A,A}
zns{m>1441:A,R}
sd{x>1272:R,m>3566:R,A}
hvg{m<504:A,s>1752:A,A}
hzr{s<1668:A,R}
lk{a>356:vbt,s>3501:A,hfr}
dpb{m>3385:A,x>666:A,R}
hgt{a>433:jdh,sd}
rf{x>2598:lm,m<2430:xkc,hjx}
mls{a<3004:pr,a>3113:R,a>3043:A,A}
dmg{a>2964:R,s<1321:A,x>964:A,R}
dn{s>1740:A,m>3131:R,A}
js{m>950:cg,m<324:A,bvb}
np{m<3013:R,m>3155:R,R}
kp{s<3049:jbk,a<3841:shn,x>1423:cq,pjs}
vmm{s<1649:qmm,m<2417:gsr,rdr}
kh{s<1884:A,m>825:A,a>3341:A,A}
jnh{a>2750:R,a>2615:R,xll}
pj{x>623:jbc,x>325:R,x>190:zhz,ljt}
sr{m>754:R,R}
xgf{x<2091:jbq,m<2015:R,s>3106:A,R}
bfv{s<2825:R,m<2639:A,a<866:lfc,A}
cmt{x<3271:A,a>3416:hsz,s<1910:czc,A}
sz{m>2962:A,x<403:R,s<608:R,A}
mzt{x>1079:R,m>748:R,x<883:A,A}
mfx{s>2396:A,x<2183:R,R}
bpn{m<1985:A,A}
sgg{s>3658:A,A}
rt{s<3055:R,x<3432:A,x>3756:R,R}
mmg{a>437:R,x<716:R,a>227:R,A}
fsj{a<1063:R,m<1035:R,a>1107:A,A}
pv{m>746:A,x>3612:R,a>3447:A,R}
pkl{x>3867:A,x<3785:A,x>3823:A,A}
rds{m>2024:rlm,x<3330:frb,A}
frq{m<3236:A,R}
qgb{m<2650:A,s<1803:dn,s<1901:A,rmc}
tv{a<2788:R,s>752:A,x<3927:R,A}
dxt{s>3004:dvh,kv}
fj{x>1215:A,x>565:R,R}
vcc{m<1348:A,x<3921:R,A}
drv{s<819:R,A}
lf{s<2369:jtq,x>2551:md,a<3528:rz,vnz}
gsr{a<494:A,x>1443:lr,m>1606:nnc,xjl}
vdk{x<3083:A,A}
lsf{m<3737:A,s<141:A,A}
hb{m<2003:kbz,ctp}
cc{m>736:hlm,R}
xrk{m>425:R,s>2668:A,A}
sck{m>1720:R,s>2392:fxd,sb}
sb{x<1612:R,m<1648:R,R}
bsz{s<2798:xrk,x<559:pqg,dmm}
msd{s>2998:ljz,m<1357:krn,m<1917:kbn,jzf}
ljk{x>1194:R,x<662:R,R}
jsc{a<349:R,s>319:A,m>1497:A,A}
hnp{s>1977:jfh,a<1962:hl,a<2222:zz,vbg}
zx{m<2818:R,R}
zlf{a<446:R,x>1241:R,R}
vj{m<3222:hpt,m<3705:ffv,m<3883:bq,ptm}
cvb{m<3215:R,A}
hzn{m>3285:R,m<2851:mg,a>245:mbr,nt}
pr{m>2749:A,s<3353:R,R}
zjj{s<1735:jbg,a<236:kxv,s>1917:mdq,mt}
kbz{m>1072:R,R}
frs{m<3639:A,A}
qpq{s>3340:A,A}
zhz{s>2384:A,a<3425:A,R}
vp{a<1494:gqt,x<1390:xfs,bh}
xn{x>1056:cdm,A}
kxv{m>2357:A,s<1937:A,A}
jct{m<3233:A,a>3464:R,A}
pcz{a<3458:A,x>684:qhk,xff}
tfm{s<3188:R,s>3536:ddg,m<769:A,hk}
plf{s>603:A,a>529:A,m<873:R,R}
cl{a<672:A,m>3434:R,R}
dm{x>2258:mf,hp}
tc{m<571:dkd,x>1248:tl,a<3550:fv,R}
cg{s<1749:R,m>1649:A,R}
nh{s>2067:tfm,cb}
gd{m>2813:mxm,s<1973:clg,zlv}
zpf{s>611:A,x>2005:A,a>3586:R,R}
crx{m>1372:cm,x>3544:mcm,s<1761:mfm,R}
pvx{x>412:sxq,tlh}
hxf{m<1165:R,s<3478:R,x<3387:R,A}
ld{s<541:R,R}
hvb{m>2487:xf,R}
bgs{m>1139:A,s<1410:R,a<247:R,A}
csv{m<1406:kk,a<727:njp,x>2888:xrh,fdn}
vd{x<712:R,s>3036:R,R}
bvm{m<1633:A,a>3264:R,R}
xfs{s<1729:jjp,s>3009:R,a<1591:rnf,R}
lt{a<2497:df,s>2781:vv,m<1694:mfx,ct}
rbh{x<2891:A,s>1660:A,a<2615:kn,A}
mp{s<885:rl,a>2713:gr,lbd}
knn{s>1107:ztn,x<2166:lnb,vt}
dlk{x>2261:A,x>2129:R,x>2072:R,A}
dgb{m<1995:nq,a>1664:rd,a<1348:gd,vp}
mv{a<268:vg,x<2362:A,s>559:R,vqn}
kt{a>1146:ps,s<2172:knn,x>1653:xk,dk}
kjt{m>2495:cl,x<2239:dc,mx}
nvl{x>1280:R,s>2377:R,R}
bn{a>2486:R,x<2690:sh,A}
jdh{a>842:A,x>1214:A,m>3586:R,A}
qcz{s>3420:R,A}
clg{s<688:R,vl}
chx{m>848:A,A}
sg{x>651:A,A}
zlv{s<2655:A,s>3252:sn,s<2901:A,R}
bh{a>1576:tr,a<1546:R,x<1711:fvr,kpv}
fkf{x>546:A,ksm}
dxx{a>905:A,A}
jt{x>1660:R,R}
gvv{x<3220:A,A}
blj{s>2421:pmg,x<842:fkf,m<3248:fvf,hgt}
xf{x<3424:R,x<3546:A,s>839:R,A}
kbn{x<963:pk,fsx}
ljz{a>575:zfb,lk}
qqx{a<1756:R,s<2864:A,a<2156:A,R}
dls{a<3555:A,x<3232:A,m<1998:bl,R}
msz{a<3499:qnq,s>2353:krq,a>3546:A,A}
btd{x>678:lc,a>482:pvx,x<257:mhh,mzl}
tjh{s<2953:gxx,kmr}
psk{x<3637:R,R}
xl{s>2768:R,m>3161:R,zjp}
zg{a<2914:R,a<2920:A,R}
ch{a>3595:kp,m<2854:fqr,s<2250:szc,mn}
qnq{x<3299:A,m<1979:R,a>3470:R,R}
fpl{m<2606:R,a<272:A,x>3396:R,A}
ct{s>2351:A,R}
rc{s<587:A,R}
{x=30,m=1468,a=2095,s=832}
{x=291,m=42,a=1683,s=2618}
{x=304,m=174,a=1204,s=1552}
{x=519,m=19,a=8,s=2512}
{x=351,m=650,a=1814,s=479}
{x=1888,m=2669,a=304,s=1144}
{x=1577,m=787,a=449,s=2384}
{x=439,m=189,a=468,s=1163}
{x=1735,m=1839,a=514,s=978}
{x=677,m=2379,a=279,s=3588}
{x=2535,m=864,a=1,s=144}
{x=2201,m=13,a=384,s=184}
{x=661,m=609,a=223,s=1274}
{x=1253,m=2548,a=106,s=2549}
{x=357,m=184,a=491,s=828}
{x=288,m=1049,a=256,s=2296}
{x=1995,m=2523,a=1487,s=659}
{x=2028,m=445,a=1788,s=1788}
{x=1387,m=2372,a=273,s=22}
{x=48,m=2361,a=2070,s=2}
{x=2091,m=45,a=222,s=3005}
{x=1460,m=105,a=1024,s=1152}
{x=176,m=2650,a=462,s=320}
{x=2020,m=185,a=47,s=987}
{x=1624,m=564,a=252,s=42}
{x=2440,m=177,a=1593,s=445}
{x=78,m=504,a=3709,s=2}
{x=405,m=457,a=1543,s=732}
{x=1098,m=450,a=176,s=331}
{x=270,m=2383,a=1434,s=561}
{x=732,m=245,a=2194,s=157}
{x=437,m=1041,a=345,s=969}
{x=889,m=1480,a=2534,s=1197}
{x=1096,m=310,a=1996,s=18}
{x=1627,m=61,a=472,s=260}
{x=20,m=51,a=135,s=565}
{x=1800,m=894,a=194,s=708}
{x=12,m=2267,a=2116,s=299}
{x=3053,m=311,a=9,s=90}
{x=1139,m=1033,a=373,s=1042}
{x=873,m=997,a=1511,s=581}
{x=1888,m=435,a=325,s=1121}
{x=2255,m=634,a=1674,s=521}
{x=109,m=344,a=370,s=1376}
{x=37,m=1166,a=876,s=342}
{x=491,m=55,a=1324,s=313}
{x=435,m=125,a=1458,s=2500}
{x=270,m=1685,a=2144,s=133}
{x=2206,m=601,a=1892,s=2193}
{x=2000,m=33,a=1963,s=146}
{x=582,m=556,a=67,s=203}
{x=473,m=2514,a=1622,s=645}
{x=3233,m=100,a=301,s=1136}
{x=3125,m=1441,a=116,s=2545}
{x=60,m=1107,a=1346,s=120}
{x=1799,m=310,a=486,s=2576}
{x=614,m=3421,a=233,s=742}
{x=374,m=171,a=636,s=1310}
{x=1578,m=106,a=2625,s=2158}
{x=1584,m=3382,a=35,s=24}
{x=342,m=2716,a=639,s=107}
{x=1060,m=430,a=1286,s=857}
{x=21,m=1364,a=3339,s=505}
{x=94,m=733,a=1353,s=103}
{x=867,m=103,a=705,s=1848}
{x=1903,m=12,a=1022,s=690}
{x=656,m=1527,a=1847,s=400}
{x=1992,m=2053,a=188,s=1163}
{x=1499,m=122,a=575,s=799}
{x=132,m=556,a=1274,s=623}
{x=215,m=1,a=985,s=905}
{x=863,m=3,a=2174,s=588}
{x=483,m=40,a=1438,s=604}
{x=282,m=479,a=331,s=441}
{x=335,m=55,a=552,s=832}
{x=972,m=1415,a=2113,s=72}
{x=1218,m=1772,a=1019,s=3715}
{x=2111,m=1344,a=175,s=1745}
{x=1938,m=1538,a=846,s=2248}
{x=12,m=49,a=1178,s=256}
{x=3341,m=558,a=257,s=2343}
{x=1134,m=579,a=530,s=929}
{x=2490,m=3368,a=1767,s=2483}
{x=2770,m=2724,a=48,s=1316}
{x=404,m=81,a=2311,s=1219}
{x=3758,m=1010,a=247,s=2868}
{x=1036,m=818,a=34,s=1522}
{x=1567,m=916,a=3743,s=1340}
{x=56,m=197,a=2229,s=449}
{x=1362,m=933,a=399,s=168}
{x=64,m=1299,a=133,s=276}
{x=400,m=2046,a=2616,s=604}
{x=76,m=1689,a=1694,s=1157}
{x=3495,m=421,a=318,s=141}
{x=1946,m=1287,a=1537,s=781}
{x=3455,m=116,a=1096,s=2497}
{x=340,m=28,a=1653,s=756}
{x=835,m=1199,a=2735,s=3386}
{x=1360,m=331,a=1525,s=447}
{x=1897,m=54,a=1499,s=785}
{x=1397,m=137,a=3133,s=73}
{x=404,m=618,a=110,s=2929}
{x=2181,m=1486,a=200,s=267}
{x=1393,m=459,a=978,s=3242}
{x=20,m=732,a=717,s=901}
{x=122,m=1659,a=1380,s=1062}
{x=88,m=280,a=830,s=3223}
{x=1849,m=299,a=914,s=469}
{x=332,m=1083,a=69,s=101}
{x=29,m=73,a=294,s=122}
{x=643,m=50,a=1870,s=542}
{x=432,m=3087,a=1676,s=540}
{x=1076,m=133,a=488,s=75}
{x=928,m=590,a=41,s=1120}
{x=2118,m=433,a=15,s=108}
{x=503,m=850,a=936,s=454}
{x=1413,m=2695,a=2012,s=302}
{x=605,m=1234,a=3678,s=1865}
{x=486,m=265,a=1297,s=567}
{x=339,m=1762,a=2151,s=301}
{x=1791,m=1541,a=649,s=433}
{x=1544,m=232,a=168,s=1350}
{x=1341,m=727,a=333,s=2885}
{x=1886,m=193,a=1203,s=1036}
{x=68,m=82,a=429,s=2446}
{x=495,m=1587,a=677,s=859}
{x=1343,m=197,a=24,s=3101}
{x=349,m=292,a=711,s=1088}
{x=104,m=320,a=143,s=2128}
{x=963,m=771,a=69,s=668}
{x=1064,m=661,a=1968,s=1494}
{x=1014,m=678,a=2934,s=801}
{x=2602,m=347,a=1408,s=205}
{x=864,m=1564,a=1397,s=102}
{x=1619,m=1208,a=948,s=83}
{x=809,m=7,a=60,s=1191}
{x=2038,m=114,a=3360,s=1076}
{x=95,m=2987,a=426,s=6}
{x=381,m=1444,a=761,s=2737}
{x=1015,m=1787,a=234,s=1468}
{x=278,m=553,a=1181,s=560}
{x=320,m=1392,a=1290,s=477}
{x=319,m=2859,a=222,s=1168}
{x=1,m=877,a=1309,s=707}
{x=1955,m=1966,a=708,s=1380}
{x=73,m=57,a=395,s=130}
{x=1976,m=3300,a=1230,s=3208}
{x=1936,m=1835,a=189,s=1643}
{x=1870,m=23,a=105,s=3217}
{x=934,m=1711,a=356,s=1080}
{x=89,m=509,a=177,s=2545}
{x=1482,m=294,a=354,s=53}
{x=584,m=1489,a=473,s=2022}
{x=1763,m=41,a=868,s=540}
{x=41,m=1101,a=1061,s=1343}
{x=1482,m=497,a=1497,s=1471}
{x=2955,m=25,a=1569,s=1167}
{x=238,m=875,a=1452,s=169}
{x=228,m=1486,a=7,s=1355}
{x=803,m=3175,a=1845,s=882}
{x=2991,m=1441,a=1185,s=939}
{x=1005,m=2013,a=711,s=1203}
{x=759,m=548,a=1201,s=1640}
{x=1868,m=935,a=1333,s=1135}
{x=503,m=710,a=34,s=611}
{x=595,m=865,a=2702,s=2969}
{x=10,m=1488,a=616,s=341}
{x=2304,m=1845,a=72,s=1269}
{x=2233,m=804,a=2966,s=1606}
{x=30,m=803,a=353,s=937}
{x=313,m=1348,a=2274,s=648}
{x=1250,m=632,a=222,s=595}
{x=696,m=1498,a=314,s=497}
{x=910,m=602,a=3207,s=2059}
{x=1026,m=1378,a=355,s=910}
{x=2862,m=3299,a=1324,s=1437}
{x=136,m=10,a=7,s=1813}
{x=388,m=1008,a=583,s=1480}
{x=439,m=44,a=2516,s=427}
{x=242,m=1041,a=2178,s=408}
{x=2245,m=291,a=1358,s=694}
{x=198,m=2155,a=365,s=327}
{x=271,m=24,a=332,s=3150}
{x=3419,m=1641,a=48,s=2530}
{x=1248,m=166,a=2678,s=99}
{x=286,m=139,a=2293,s=356}
{x=1201,m=35,a=612,s=1236}
{x=549,m=115,a=175,s=241}
{x=991,m=1606,a=718,s=2651}
{x=93,m=2205,a=835,s=206}
{x=719,m=64,a=2252,s=2722}
{x=2468,m=1167,a=92,s=674}
{x=202,m=92,a=1905,s=1400}
{x=128,m=526,a=385,s=666}
{x=102,m=1285,a=166,s=687}
{x=650,m=2611,a=2686,s=10}
{x=1307,m=2221,a=489,s=884}
{x=902,m=961,a=9,s=309}
{x=629,m=1339,a=174,s=3762}
{x=282,m=69,a=3507,s=119}

17
2023/input/19/test-1 Normal file
View File

@@ -0,0 +1,17 @@
px{a<2006:qkq,m>2090:A,rfg}
pv{a>1716:R,A}
lnx{m>1548:A,A}
rfg{s<537:gd,x>2440:R,A}
qs{s>3448:A,lnx}
qkq{x<1416:A,crn}
crn{x>2662:A,R}
in{s<1351:px,qqz}
qqz{s>2770:qs,m<1801:hdj,R}
gd{a>3333:R,R}
hdj{m>838:A,pv}
{x=787,m=2655,a=1222,s=2876}
{x=1679,m=44,a=2067,s=496}
{x=2036,m=264,a=79,s=2244}
{x=2461,m=1339,a=466,s=291}
{x=2127,m=1623,a=2188,s=1013}

58
2023/input/20/input Normal file
View File

@@ -0,0 +1,58 @@
%rq -> ch, sj
%nf -> sm, rg
%pc -> rz, zp
%xt -> bc
%nt -> kq, sj
%hc -> kb, zp
%rd -> lk
%ml -> pp, xt
%sq -> kl, sj
%jg -> fl, rg
&xl -> df
%kl -> mb, sj
%nd -> rg, jg
&rg -> cs, zb, cp, vz, gp
%mf -> zp
%rz -> zp, fr
%kk -> rg, bj
%nb -> qj
%pr -> pp
&zp -> vl, lk, rd, kb, xl
%fl -> nf, rg
%tb -> pk, pp
%bh -> pp, pr
%nh -> sj, rq
%lk -> hc
%cp -> kk
&ln -> df
&xp -> df
%bc -> nb, pp
%lj -> rg
%vz -> nd
%vl -> lv, zp
&gp -> df
%hd -> pp, bq
%fq -> pp, bh
%pk -> fq, pp
%cs -> zb, rg
%sn -> fd
%kq -> sj, qq
%zb -> vz
%lv -> zp, rd
%qj -> pp, hd
%fd -> nt
&df -> rx
broadcaster -> vl, cs, cn, ml
%bq -> tb
%kb -> pc
%cn -> sn, sj
%qq -> sq
%mb -> sj, nh
%jd -> zp, mf
&sj -> xp, qq, cn, fd, sn
&pp -> ln, ml, xt, bq, nb
%sm -> rg, cp
%ch -> sj
%bj -> lj, rg
%fr -> zp, mr
%mr -> zp, jd

5
2023/input/20/test-1 Normal file
View File

@@ -0,0 +1,5 @@
broadcaster -> a, b, c
%a -> b
%b -> c
%c -> inv
&inv -> a

5
2023/input/20/test-2 Normal file
View File

@@ -0,0 +1,5 @@
broadcaster -> a
%a -> inv, con
&inv -> b
%b -> con
&con -> output

131
2023/input/21/input Normal file
View File

@@ -0,0 +1,131 @@
...................................................................................................................................
.#....#......#.#......#...#...##.....#.#.#....#.##....#...#.............#.#......##..#.......#.............#......#...#..#...##....
..#...#.#.#....####.....##.........................##.#..#...............##.......#....#.....#........#...#.....#.......#..........
.#.......#......#.#.#....#..............###...#................................................#....#.#..............#.............
................#....#....#..........#........#....................................##....##........#.....#.#....................#..
.................#..........#...........##...#......#.#.#..................#......#.........##....#...#.....#.#........#..#........
..##...#..........#...#..##..#.............#................................##......#.....#.........#..........#.#.....##.#.#......
.#.......##.....#....#...............#....##.......................#..................................#..#.........................
..#.#.....#........#.........................#................#..............#.................#.......#...#....#.#..#....#..#.....
.......##.........#..............#.........##..#..............#.....#....................#.#..........#..#.#.#....#.......#......#.
.#......##..............#..........#..........#.....................#.##..........##.....#...#...#......#...#......#..#..........#.
....#.........##......#.#.#...#................#.............#..........................#..............#...............#........#..
........##......#..##.....#..#..#.............##.........................#.......#.###....#..#................#....................
...#..#.#..........##...#..#....#...........#........................#...#...............#....#.....#......#....#....#....#........
.........#.......................#.....#..##............##.#.#.#...#.....#.#...........#.#............#..##...##..............#....
.#.#..#.#......#.........#...#..#.......#.#..............##.......##...................#....#........##....##..........#.........#.
...................#.....#..#.....#....###...............#........#......#..#.........#.##.#.#......##..#.....#.#...............##.
.#..#.........##....#...#..........##...#..............#...#........##...#...............#...............##.....#..................
....#.......#...................#...................................#..#...#..#..................#.##..###.......#..#........##....
.#.......................###.....#......................#.#.....#...#..##...#.#...........#.....###............####...........#.#..
...#.........#........................#..............#..#.#..............#................#......#..#.##...............##..........
.....#..........#......#....#....................#.#..........#.#...........#.#.##.............#..#......#..#......#...##...#......
...#..........#.............#.....................#......................#.......................#.............#.....#.............
..............................#..##...................#...#...............#.#....#....................#.......#..............##....
.#...##.....#.....#..#...#........#..............#.#...#.....#.......#..##..#.................#......................#..##.........
....#....................#......#...#...........#.........#.......#..#.#...........#......................................#...#....
..#.#.........##.....#........#...............#.##......##...........#........#.......................#..#.....#...............#...
..##............#........#.....#..#.......#......##...#.#......#......##.............#..........#..#........#..#...............#...
........#...##.......#....#...............##....#.....#.#...#....................#...#...........#...#.....##..........#...........
.#.#.....................##...#.........#............#..#.......#.#....#....#...#..#....#.............#.#.........#................
...........#..........#..#.#...#....................#.................#.##...#.......#.#......................#..#..#.....##.......
...#...#.......##.....#...##...........#............#..................#..#...#.#...#......................#....#...#..........#...
....#..#.....................#.......##.###......#............##....#..#.......##..........##...............##....#...#.........#..
.................#...#.....#..........#...........#..#............#..#...#..#..#....#.#.......#..............#.#......##...........
...#.....................#.........#.#..............#....#....###....##......#......##..................#...........#......#.......
..#..#............#.#..#..........#...#....#.............#......#......#...#........#.#.###..##..........#.#.........#...#..#....#.
.........#............................#.....#.....#...#...#...##......#.......#.#.#....##.#....#.#.......#...#..#.#.......###.#....
.#....#.#......#.......#........##....#....#..#..#.##........#....#.........##............#......#..............##...#..........#..
..#..#..#....#.......#.#.......#...........#..........#.......##..#..........#............#.......................#...#............
........#.#........#...............##..#....##...##....#..#....#........#.................#..................#.##.#.......##.......
..........#....###.##.............#.#.#......#........#........#....#.............#.##........#......................#.#.......##..
........#........#.#..........##..#.#....#.........##..........#..........#..........#....#.#.........#.......#.....#...##......#..
...............#..................#.#.##......#..#..##....#..........#...#......#..#..#.....#...##...............##............#...
............#.................#.........#....#......#.............#........#.......#.#...#........#..............##.........#....#.
...#....#..#...............#...........#.#.....#.......#.................#.#........#..#.#....#.......................###..........
............#.............#......#...#..#..#.......#.###..###...............#...........#...........##....................##.##..#.
........................#.#..#..#..##.#.#....#......#..#..#.....#.#..............#......#..........................................
.#.#.....................#..#...##..........##.#..#..#.##..#................#..##....#........#....#.#.#.........................#.
...#.....................#.....#...#...#....##....#...............................#...#.#................#..#...........#..........
...#....#............#.#.........#.......##.......#....................#.........#......#...........#....#...#.............#..##...
..#......................#.......#....#.#....##....#......#..........#....#.#.##..#.#.....#...##...#.##..###...........#...#....#..
..................#..........#.........#........................#.##...............#...#...#.#............#........................
........#.................#.....#..#.............#...#.#.##.......#.............#.#........#...#..#...........#..................#.
...#................#.#.#.........#.......#....#.........##........##...###.............#..#.#...#.................................
.....#.............##.##...##.............#.......#.#........##......#...#.......##.#.....................#......#.#.......#..##...
.........................#.............#...................##...#.......#.....#.........#..#......#.#.#........#.#..............##.
.............#......#..................#...............#...........#...#..........#.....#.....##....#.#...#...#.#.............#....
..............#....#............##...##....................#............#....#.##....#.##..#.#....#............#..#...........##...
........................#..................##..#.......#......#....#..............###........##.........#...#.....#.#............#.
..........#.............#..#.............#...........#..##........#........#..#................#......................#.........##.
.............#..#.....#..#....#...#.....#....#.#.....##...............#......................#.............#......#...#............
..........#...................#.......#............#....#.........#.............#..............#.#..........##.#........#..........
.............................#...........#...........##..#.#......#....#.....#....#..#...............##.#.....#...........#........
........................#.#.#.......#.##.....##......#....#..........##.........#...............#.#..#.##.....#....#..#............
......#....##...............#..#....#...#.....#......#....#.............#.#........#.#.....#.#.....###.#.........#...#...#...#.....
.................................................................S.................................................................
.....#.#...#...............#.....##......#..........#....#...............#.......#..............#.#.................#..............
................##.#..#..........#.#...#......................#..............#...........#...#..#.....##.........#.................
.......#.#........#.#...........#........#...........#..#.#.............#............#..........#.....#...................#........
..............#..#.................#..#........###..#.......................##.##..........#....#..#...#.##..#.#.###....#..........
.............#.....#.....#.........#..#.......#.......#......#..........#.........#............................#.....#.............
..#.......#....##.......#................#.#...........#...#..###.#........#........#.#...#............#.......#.#...#.............
............#.........#..#....#........#...#.........#...#............#............#....#..#.................#.#......#........#...
...#.............#....................#.............#..............#..#..................#...#...#.#....#...#.##....##..........#..
....#........#..##..........##.....#.....#....................#..........#...........#.#......##................##...........#.....
......#.......#..#..#...##...#................#.#.......#......##.#......#..#..............#....#.....#..#....#.#...#...........#..
.....#.......................#..#..........#..........#........#......#...#..#..#...........................#......#..........#..#.
.....##...........#....#.........#.........##...................#.#..##.#..#..##.#..##...........#......#....#...##.............#..
.#......................#.#..##..#...#.........#.........##.......##.....##.............#.........#.......#...................##.#.
...................#....#..###..#...#.....#......#..............#.........#..................##.##.................................
......#....#.............#..#...#..##.#...#...#......#....#...........#....#...........##....#..#...#.....#......................#.
...#...#............#....#..#.#....................................#..#.....................#....#.........................#.......
.......#.............................#............#......................#...#......#.......###.........#...................#.#....
.......#................##...#...........##........#..#..#..............#.....#..............#.....#......#..........#...#.........
......#.....#.................#....#...........#..........................#..#.##.#.##.............##.#............#....##..#......
....#.....#.......................#..............#......#..........#.....##..#.....#.........#..........................#.#..#...#.
...#...........#.........#......##...#......#......#....#....#..#......#..#........#..#......................................#.#...
.....#...##.....................#.............##..#....#.#..#...#...#....#.........#.......#.....#.............................#...
..............###.##...........#..#.##.....#.#..#....#..............#..#..........................#.##.#...........#...............
.......#.........................#................##.#.....##........#.....#.#......#..........................#...........#...#...
........##...#..#....#...........#....#.........#......#..##..#...........................#...#..............#........#......#.....
...#.....#...#.......#..................#.....#...........#................#......#........#.#.#.......................#...........
.#..#..#.............###........................#.......#....#.........#.....#........#..#.#....#..........#...#...................
......................#...........###........#........#...#.........#..................#...#.....##.........#.............#..#.#...
...#.##.............####.........##..#...#........................................#..........#...................#.##..............
......#...#.....#..................##........#...........#.#...#....##.......#......#.....#..#.............#..#.#.##....##.........
.......#..................#........#........#.........##.#............#.....#....#....#..##..............#.......#.#....#..#.......
..........#...........#..................#...........#.....#......##........##.......#.........................................##..
...#......#................#...........###..#.........#.....##..#.#...............#....#.##.#........#...................#.........
........#...#..##...#.................#......##.......##.....#..#.........#.#....#.......#...........#..#...................#...##.
........#...........#.##..............................................##...#..............##...........#..#...###........#.....#...
....#.......#....#......................#.#.#......................#....#.........#.......................#....#.#.##...........#..
.#................#.#.#.#.................#.......................##.#......#.....#..#..............#....#...#.#...#..#........#...
..#.........#.......#.....#.....##.............#.....................#...........#...#.................##.........#....#.........#.
....#..#..............#.#...................#...#......#.##..........#.........#..#.......................#..##....................
........#..#.#.........#...##.................#......#...#..............#.....................#...#.....#..........#....#...#.#....
.#.....#...#..##.......#...#.......#...............................#..#.....#................##..##.......#.......#..#..#........#.
..............................###..............................#....#..#....#.#..#.............#...#..........#.#.#.........##.....
.......#........#.#................#...#.........#.##.#....................#...................#..#....#...#.....###.....#.#.......
.........#.#............#......#......#.#.........###.#.#..#..#.#....#...###....#............#.....................#......#....#...
..##...#...#.#...........#.....#...#.......................................#..........................#.........#..##.........#.#..
.....#.....#..............#.......................#.........#...#..#.....##................#.#.......#..#...#.#.#..............#.#.
.........#....#.#...#.....#......#.#.................#...#...#.........................#..#....#...#.........#...#...#......###....
.....#.#..#........#.....##..#.##.....##............................#..#.....#.........#.....##.#..##...#.#.....#.............#....
.....#..................#....###.#.#.....#........................#...##....#.........#..........................#....##.#....#..#.
...###........##....#....#...#.......#....#..#.........##................#..........#........##.##.................#......#........
....#.......##..#.......##...#.........###....#........................#.#.#..................#...#.#.........................#....
..##..................#..#........##...#...#..#..............#.......#..............##.......#.........#..#.....................#..
.......#.................#....#.#........###..##..................#...............#......#.#............#...#.............#........
.#.#..........###.......##..#.#......#..#..#.#...#.............##.#.#...............##..#....#..#..............#.............#.....
.....#.#.....#..#..................###...............................................##............##..............................
...........#......#..##.#..#...#...#.#.....##.#.....#........##.................#..#..#....#.....#.....#......#.#..................
....#....................#...........#.......#..#.............#...#...................##............#..............##..............
.........#.#........#..#....#..........#.....#........................................#........#...#..#....#.......#.........#.....
...#............#.....#....#....#.....#....#....#..#................................#..#....#.........#.........#.#...........#....
.............#.......#...........#..#.....#.....................................#.#...#...#........#..##..#.....#.........#........
......#.......#.................#.................#.#.#.................................#........#...........#....#.#..............
.##.##....................#...#.#.............###........#.................#..#.....#..#.......#..............#..#.....#.##........
........#........#.............#..#...#.#........#..#.....#.............#.....#...#....#...###....##..#.....#..#.....#.............
..#.#...........##.....#.................#....#.....##....................#......#..........##....#..#..#...#..#.............#.....
...................................................................................................................................

11
2023/input/21/test-1 Normal file
View File

@@ -0,0 +1,11 @@
...........
.....###.#.
.###.##..#.
..#.#...#..
....#.#....
.##..S####.
.##..#...#.
.......##..
.##.#.####.
.##..##.##.
...........

1446
2023/input/22/input Normal file

File diff suppressed because it is too large Load Diff

7
2023/input/22/test-1 Normal file
View File

@@ -0,0 +1,7 @@
1,0,1~1,2,1
0,0,2~2,0,2
0,2,3~2,2,3
0,0,4~0,2,4
2,0,5~2,2,5
0,1,6~2,1,6
1,1,8~1,1,9

141
2023/input/23/input Normal file
View File

@@ -0,0 +1,141 @@
#.###########################################################################################################################################
#.#####...###...#####...#...###.......#.....#...#####...#...###...#.........###...#...#.......#...#...#...###.............###...###...###...#
#.#####.#.###.#.#####.#.#.#.###.#####.#.###.#.#.#####.#.#.#.###.#.#.#######.###.#.#.#.#.#####.#.#.#.#.#.#.###.###########.###.#.###.#.###.#.#
#...#...#...#.#.###...#...#...#.....#.#.#...#.#...#...#.#.#...#.#.#.......#...#.#.#.#.#.....#.#.#.#.#.#.#...#...........#.#...#.....#.#...#.#
###.#.#####.#.#v###.#########.#####.#.#.#.###.###.#.###.#.###.#.#.#######.###.#.#.#.#.#####.#.#.#.#.#.#.###.###########.#.#.#########.#.###.#
###.#...###.#.#.>.#.#.......#.....#.#.#.#.#...#...#...#...#...#.#.#.....#.#...#.#.#.#...###.#.#.#.#.#.#.#...#...#.....#.#...#.........#.#...#
###.###.###.#.#v#.#.#.#####.#####.#.#.#.#.#.###.#####.#####.###.#.#.###.#.#.###.#.#.###.###.#.#.#.#.#.#.#.###.#.#.###.#.#####.#########.#.###
###.#...#...#.#.#...#.#...#.#.....#.#.#.#.#.#...#...#.....#...#.#.#...#.#.#.#...#.#.#...#...#...#.#.#.#.#...#.#.#...#.#.#...#...........#...#
###.#.###.###.#.#####.#.#.#.#.#####.#.#.#.#.#.###.#.#####.###.#.#.###.#.#.#.#.###.#.#.###.#######.#.#.#.###.#.#.###.#.#.#.#.###############.#
###...###.....#...###.#.#.#...#...#.#.#.#...#...#.#.....#...#.#.#.###.#.#.#.#...#...#...#.......#.#.#.#.#...#.#...#.#.#...#.#.........#...#.#
#################.###.#.#.#####.#.#.#.#.#######.#.#####.###.#.#.#.###.#.#.#.###.#######.#######.#.#.#.#.#.###.###.#.#.#####.#.#######.#.#.#.#
#...#...#...#...#...#.#.#.#.>.>.#...#.#.#.......#.#.....###.#.#.#.###.#.#.#.###.....#...#...#...#.#.#.#.#...#.#...#.#.#...#.#.......#.#.#.#.#
#.#.#.#.#.#.#.#.###.#.#.#.#.#v#######.#.#.#######.#.#######.#.#.#.###.#.#.#.#######.#.###.#.#.###.#.#.#.###.#.#.###.#.#.#.#.#######.#.#.#.#.#
#.#...#...#...#.....#...#...#.......#.#.#.#.....#.#...>.>...#.#.#.#...#.#.#.#.>.>...#...#.#.#...#.#.#.#.#...#.#.....#...#...#.......#...#...#
#.#################################.#.#.#.#.###.#.#####v#####.#.#.#.###.#.#.#.#v#######.#.#.###.#.#.#.#.#.###.###############.###############
#.#.........#...#.........###.......#...#...#...#.#.....#...#...#.#...#.#.#.#.#.....#...#.#.###.#.#.#.#.#.###.........#...#...###...###...###
#.#.#######.#.#.#.#######.###.###############.###.#.#####.#.#####.###.#.#.#.#.#####.#.###.#.###.#.#.#.#.#.###########.#.#.#.#####.#.###.#.###
#...###...#...#...#.......#...#.......#.....#.#...#.......#.....#...#.#.#.#.#.#.....#...#.#.#...#.#.#.#.#...#...>.>.#.#.#...#.....#.....#...#
#######.#.#########.#######.###.#####.#.###.#.#.###############.###.#.#.#.#.#.#.#######.#.#.#.###.#.#.#.###.#.###v#.#.#.#####.#############.#
#.......#...#.......#...###...#.#.....#.#...#...###.............#...#.#.#.#.#.#.......#.#.#.#...#.#.#.#...#.#...#.#...#.......#...#...#...#.#
#.#########.#.#######.#.#####.#.#.#####.#.#########.#############.###.#.#.#.#.#######.#.#.#.###.#.#.#.###.#.###.#.#############.#.#.#.#.#.#.#
#.#...#...#...#.......#.#...#...#...#...#...#.....#.....#.....###.....#.#.#.#.#.......#.#.#.#...#.#.#.#...#.....#...#...........#...#.#.#...#
#.#.#.#.#.#####.#######.#.#.#######.#.#####.#.###.#####.#.###.#########.#.#.#.#.#######.#.#.#.###.#.#.#.###########.#.###############.#.#####
#...#...#...#...#.......#.#.###...#...#.....#.#...#.....#.#...#...#...#.#.#.#.#.......#.#.#.#.#...#.#.#.#...........#...............#.#.....#
###########.#.###.#######.#.###.#.#####.#####.#.###.#####.#.###.#.#.#.#.#.#.#.#######.#.#.#.#.#.###.#.#.#.#########################.#.#####.#
###...#...#...###.......#.#.#...#.#...#.....#.#...#.......#...#.#.#.#.#.#.#...#...#...#...#...#...#.#...#.........#.................#.......#
###.#.#.#.#############.#.#.#.###.#.#.#####.#.###.###########.#.#.#.#.#.#.#####.#.#.#############.#.#############.#.#########################
#...#...#.............#.#.#.#...#.#.#.#.....#.#...#...#.......#.#.#.#.#...#.....#...#...#...#...#...#...#.........#...#.....#...#...###...###
#.###################.#.#.#.###.#.#.#.#v#####.#.###.#.#.#######.#.#.#.#####.#########.#.#.#.#.#.#####.#.#.###########.#.###.#.#.#.#.###.#.###
#...................#...#.#...#.#.#.#.>.>.#...#...#.#.#.###...#.#.#.#.#...#.....###...#.#.#.#.#.#...#.#.#...........#...###...#...#.#...#...#
###################.#####.###.#.#.#.###v#.#.#####.#.#.#.###.#.#.#.#.#.#.#.#####v###.###.#.#.#.#.#.#.#.#.###########.###############.#.#####.#
#.................#.....#...#...#.#.#...#...#...#...#.#...#.#.#.#.#.#.#.#.#...>.>.#.#...#.#.#.#.#.#.#.#.#...#.......#.....#...#.....#...#...#
#.###############.#####.###.#####.#.#.#######.#.#####.###.#.#.#.#.#.#.#.#.#.###v#.#.#.###.#.#.#.#.#.#.#.#.#.#v#######.###.#.#.#.#######.#.###
#.#.....#...#...#.......#...#.....#.#.......#.#.......#...#.#...#.#.#...#.#.#...#.#.#...#.#.#.#.#.#.#.#.#.#.>.>.#...#.#...#.#...#.......#...#
#.#.###.#.#.#.#.#########.###.#####.#######.#.#########.###.#####.#.#####.#.#.###.#.###.#.#.#.#.#.#.#.#.#.###v#.#.#.#.#.###v#####.#########.#
#.#.###...#...#.....#.....###.....#.#.......#.#...#...#.###.....#.#.....#...#...#...###.#.#...#.#.#.#.#.#.#...#...#.#.#.#.>.#.....#.........#
#.#.###############.#.###########.#.#.#######.#.#.#.#.#v#######.#.#####.#######.#######.#.#####.#.#.#.#.#.#.#######.#.#.#.#v#.#####.#########
#.#.#...............#.........#...#.#...#...#...#...#.>.>.....#.#.#.....###...#.......#.#...#...#.#.#.#...#.......#.#.#.#.#.#.#.....#.......#
#.#.#.#######################.#.###.###.#.#.###########v#####.#.#.#.#######.#.#######.#.###.#.###.#.#.###########.#.#.#.#.#.#.#.#####.#####.#
#...#...........#...#.........#.....###...#...#...#...#.....#.#.#.#.....#...#.........#.....#...#.#...#...###...#.#.#.#...#.#.#.......#.....#
###############.#.#.#.#######################.#.#.#.#.#####.#.#.#.#####.#.#####################.#.#####.#.###.#.#.#.#.#####.#.#########.#####
###...#.........#.#.#.......#.................#.#...#.......#...#...#...#...#.........#...#...#.#...###.#.....#...#...#.....#.#.......#.....#
###.#.#.#########.#v#######.#.#################.###################.#.#####.#.#######.#.#.#.#.#.###.###.###############.#####.#.#####.#####.#
###.#.#...........#.>.#.....#.................#...#.......#.......#...#.....#.#.......#.#.#.#.#.#...#...#...........###.....#.#.....#.#...#.#
###.#.#############v#.#.#####################.###.#.#####.#.#####.#####.#####.#.#######.#.#.#.#.#.###.###.#########.#######.#.#####.#.#.#.#.#
###.#.###...#...#...#.#.......###.............###...#.....#.#.....#...#.......#...#...#.#...#.#.#...#...#...#.....#.....###...#...#.#.#.#.#.#
###.#.###.#.#.#.#.###.#######.###.###################.#####.#.#####.#.###########.#.#.#.#####.#.###.###.###.#.###.#####.#######.#.#.#.#.#.#.#
#...#.....#...#...#...#...#...#...#.............#...#...#...#...#...#...#####...#...#.#.#.....#...#.###...#.#...#.......#.......#...#...#...#
#.#################.###.#.#.###.###.###########.#.#.###.#.#####.#.#####.#####.#.#####.#.#.#######.#.#####.#.###.#########.###################
#.#...............#...#.#.#...#.....#.......#...#.#.#...#.#.....#.#.....#.....#.......#.#...#...#...#...#...###.........#...#...#...#...#...#
#.#.#############.###.#.#.###.#######.#####.#.###.#.#.###.#.#####.#.#####.#############.###.#.#.#####.#.###############.###.#.#.#.#.#.#.#.#.#
#...###.........#...#...#.....###...#.....#...#...#.#...#.#.#.....#.....#.............#.#...#.#.#...#.#.....###.........###...#...#...#...#.#
#######.#######.###.#############.#.#####.#####.###.###.#.#.#.#########.#############v#.#.###.#.#.#.#.#####.###.###########################.#
###...#.#.....#.....###...#...#...#.....#...###...#...#...#...#.......#.#...#.......>.>.#.###.#.#.#.#...#...#...#...#...###...#...#.......#.#
###.#.#.#.###.#########.#.#.#.#.#######.###.#####.###.#########.#####.#.#.#.#.#######v###.###.#.#.#.###.#.###.###.#.#.#.###.#.#v#.#.#####.#.#
#...#...#.###.......#...#.#.#.#.......#.....#...#.#...###...#...#...#...#.#.#...#.....#...#...#...#.#...#.###...#.#.#.#.#...#.>.#.#...###...#
#.#######.#########.#.###.#.#.#######.#######.#.#.#.#####.#.#.###.#.#####.#.###.#.#####.###.#######.#.###.#####.#.#.#.#.#.#####v#.###.#######
#...#.....###.......#...#.#.#.........#...###.#.#.#.#...#.#.#...#.#...#...#...#.#.....#...#...#.....#...#.#...#.#.#.#.#...###...#.....#...###
###.#.#######.#########.#.#.###########.#.###.#.#.#.#.#.#.#.###v#.###.#.#####.#.#####.###.###.#.#######.#.#.#.#v#.#.#.#######.#########.#.###
###.#.#.......#...#...#.#.#.............#...#.#...#.#.#...#.#.>.>.###...#...#...#.....###...#.#.#...#...#...#.>.>.#.#.#.......#...#...#.#.###
###.#.#.#######.#.#.#.#.#.#################.#.#####.#.#####.#.#v#########.#.#####.#########.#.#.#.#.#.#########v###.#.#.#######.#.#.#.#.#.###
#...#.#.#.....#.#.#.#.#.#.#...#...###...#...#.....#.#.....#...#...#...###.#.#...#.....#.....#.#.#.#.#.....#.....###.#.#.....#...#...#...#...#
#.###.#.#.###v#.#.#.#.#.#.#.#.#.#.###.#.#v#######.#.#####.#######.#.#.###.#.#.#.#####.#.#####.#.#.#.#####.#.#######.#.#####.#.#############.#
#.....#...###.>.#.#.#.#.#...#.#.#.#...#.>.>...#...#.......#...###...#...#.#...#.......#...#...#.#.#.#...#.#.#.....#...###...#.#.......#...#.#
#############v###.#.#.#.#####.#.#.#.#####v###.#.###########.#.#########.#.###############.#.###.#.#.#.#.#.#.#.###.#######.###.#.#####.#.#.#.#
#.........#...#...#.#.#...#...#.#.#.#.....###.#...........#.#...........#...............#...###.#.#.#.#.#.#...###.......#...#.#.....#.#.#.#.#
#.#######.#.###.###.#.###.#.###.#.#.#.#######.###########.#.###########################.#######.#.#.#.#.#.#############.###.#.#####.#.#.#.#.#
#...#...#...###.#...#.#...#...#.#.#.#.....###.....#...#...#.................###.........#.....#...#...#...#.............#...#.#.....#.#.#.#.#
###.#.#.#######.#.###.#.#####.#.#.#.#####.#######.#.#.#.###################.###.#########.###.#############.#############.###.#.#####.#.#.#.#
###...#.......#...###...#...#...#...#####.......#...#.#.#...................#...#...#...#...#.....###...###.............#.#...#...###...#.#.#
#############.###########.#.###################.#####.#.#.###################.###.#.#.#.###.#####.###.#.###############.#.#.#####.#######.#.#
#####...#.....#...#...#...#...#...#...#.......#...###...#.................###...#.#...#.....#.....#...#...#.............#...#####...#...#.#.#
#####.#.#.#####.#.#.#.#.#####.#.#.#.#.#.#####.###.#######################.#####.#.###########.#####.#####.#.#######################.#.#.#.#.#
#.....#...#.....#.#.#.#.#.....#.#.#.#.#.....#.....#...#...#.............#...###...#...#.....#...###...#...#.................#.......#.#.#...#
#.#########.#####.#.#.#.#.#####.#.#.#.#####v#######.#.#.#.#.###########.###.#######.#.#.###.###.#####.#.###################.#.#######.#.#####
#...#.....#.....#.#.#.#.#.....#.#.#.#.....>.>.###...#.#.#.#...#.......#.#...#...#...#...###.....#...#.#.###.................#.........#...###
###.#.###.#####.#.#.#.#.#####.#.#.#.#######v#.###.###.#.#.###.#.#####.#.#.###.#.#.###############.#.#.#.###.#############################.###
###...#...###...#.#.#.#.#.....#.#...#...#...#...#...#...#...#.#.#.....#...#...#.#.........###...#.#.#.#...#.......#.....#...#...#...#...#...#
#######.#####.###.#.#.#.#.#####.#####.#.#.#####.###.#######.#.#.#.#########.###.#########.###.#.#.#.#.###.#######.#.###.#.#.#.#.#v#.#.#.###.#
#.....#...#...###.#.#.#.#.#...#.#.....#.#.....#...#.#...#...#...#.........#...#...........#...#.#.#.#...#.#...###.#...#.#.#.#.#.>.#...#...#.#
#.###.###v#.#####.#.#.#.#.#.#.#.#.#####.#####.###.#.#.#.#.###############.###.#############.###.#.#.###.#.#.#.###v###.#.#.#.#.###v#######.#.#
#...#.###.>.#...#...#.#.#...#...#.....#.......#...#.#.#...#####...#.......###.........#...#...#.#.#...#.#.#.#...>.>.#.#.#.#.#...#.......#.#.#
###.#.###v###.#.#####.#.#############.#########.###.#.#########.#.#.#################.#.#.###.#.#.###.#.#.#.#####v#.#.#.#.#.###.#######.#.#.#
#...#.....###.#.....#...#...#.......#.........#.#...#.###...###.#.#.#.....#.....#.....#.#.#...#.#.###.#.#.#.#.....#...#...#.#...#.......#...#
#.###########.#####.#####.#.#.#####.#########.#.#.###.###.#.###.#.#v#.###.#.###.#.#####.#.#.###.#.###.#.#.#.#.#############.#.###.###########
#...#.........#...#.#.....#.#.....#.#...#...#.#...#...#...#...#.#.>.>.#...#.#...#...###.#.#...#.#...#.#.#.#.#.........#.....#.#...###...#...#
###.#.#########.#.#.#.#####.#####.#.#.#.#.#.#.#####.###.#####.#.###v###.###.#.#####v###.#.###.#.###.#.#.#.#.#########.#.#####.#.#####.#.#.#.#
###...#...#...#.#...#.....#...###.#.#.#...#.#...#...#...#####...###...#...#.#...#.>.>...#...#.#.....#.#.#...#.........#.#...#.#.......#...#.#
#######.#.#.#.#.#########.###.###.#.#.#####.###.#.###.###############.###.#.###.#.#v#######.#.#######.#.#####.#########.#.#.#.#############.#
#.......#...#...###.......#...#...#...#...#.....#.....#...#####...#...#...#.###...#...#.....#...#...#.#.#...#.........#.#.#...#...........#.#
#.#################.#######.###.#######.#.#############.#.#####.#.#.###.###.#########.#.#######.#.#.#.#.#.#.#########.#.#.#####.#########.#.#
#.............#...#.......#...#.........#...#.....#...#.#.###...#.#...#...#.#...###...#...#.....#.#.#...#.#.#.........#...#...#.........#.#.#
#############.#.#.#######.###.#############.#.###.#.#.#.#.###.###.###.###.#.#.#.###.#####.#.#####.#.#####.#.#.#############.#.#########.#.#.#
#####...#.....#.#.#...###...#...............#...#.#.#...#...#...#.....###...#.#...#.....#...#.....#.###...#...###...#...#...#.#.........#.#.#
#####.#.#.#####.#.#.#.#####.###################.#.#.#######.###.#############.###.#####.#####.#####.###.#########.#.#.#.#.###.#.#########.#.#
#.....#.#.....#.#...#.#...#...........###...#...#.#...#...#.....#...#.........###.#.....#...#.....#...#.......#...#...#.#...#.#.....#####...#
#.#####.#####.#.#####.#.#.###########.###.#.#.###.###.#.#.#######.#.#.###########.#.#####.#.#####.###.#######.#.#######.###.#.#####.#########
#.....#.......#.#.....#.#.............#...#.#...#.###.#.#.###.....#.#...........#...#...#.#.#...#.#...###...#.#...#.....#...#.....#.........#
#####.#########.#.#####.###############.###.###.#.###v#.#.###.#####.###########.#####.#.#.#.#.#.#.#.#####.#.#v###.#.#####.#######.#########.#
#.....#.........#.....#...............#...#.#...#...>.>.#...#.#.....#...........#...#.#.#.#.#.#.#.#.#...#.#.>.>.#.#.#...#.....#...#.........#
#.#####.#############.###############.###.#.#.#######v#####.#.#.#####.###########.#.#.#.#.#.#.#.#.#.#.#.#.###v#.#.#.#.#.#####.#.###v#########
#.......###...........###.............#...#.#.#.......#.....#.#.#...#...........#.#...#...#...#.#.#.#.#...###.#.#.#.#.#...#...#.#.>.#...#...#
###########.#############.#############.###.#.#.#######.#####.#.#.#.###########.#.#############.#.#.#.#######.#.#.#.#.###.#.###.#.#v#.#.#.#.#
###...#.....#.......#...#.........###...###.#.#...#...#.....#.#.#.#...#...#.....#...#.........#.#.#.#.#.......#...#.#.###.#.###...#.#.#.#.#.#
###.#.#.#####.#####.#.#.#########.###.#####.#.###.#.#.#####.#.#.#.###.#.#.#.#######.#.#######.#.#.#.#.#.###########.#.###.#.#######.#.#.#.#.#
###.#.#.......#.....#.#.#.........#...#.....#...#...#.....#.#.#.#.#...#.#.#...#...#...#.....#.#.#.#.#.#.....#...###...#...#...#.....#.#.#.#.#
###.#.#########.#####.#.#.#########.###.#######.#########.#.#.#.#.#.###.#.###.#.#.#####.###.#.#.#.#.#.#####.#.#.#######.#####.#.#####.#.#.#.#
#...#.........#.....#.#.#.......###...#.#...#...#.........#...#.#.#.###.#.#...#.#.#.....###...#.#.#...#...#...#.......#.#...#.#...#...#...#.#
#.###########.#####.#.#.#######.#####.#.#.#.#.###.#############.#.#.###.#.#.###.#.#.###########.#.#####.#.###########.#.#.#.#.###.#.#######.#
#...........#.......#.#.....#...#...#.#...#...###.............#.#.#...#.#.#...#.#.#.......#.....#...#...#...#.........#...#.#.#...#.#.....#.#
###########v#########.#####.#.###.#.#.#######################.#.#.###.#.#.###v#.#.#######.#.#######.#.#####.#.#############.#.#.###.#.###.#.#
#.......###.>...#...#.#.....#...#.#.#.........###.......#.....#.#.###...#.#.>.>.#.........#...#.....#.....#.#.#...........#.#.#...#.#...#.#.#
#.#####.###v###.#.#.#.#.#######v#.#.#########.###.#####.#.#####.#.#######.#.#v###############.#.#########.#.#.#.#########.#.#.###.#.###.#.#.#
#.....#.....###.#.#.#.#.#...#.>.>.#...#.......#...#...#...#...#...#.....#...#.#...#...#...###...###...#...#.#...#.....#...#...#...#.#...#...#
#####.#########.#.#.#.#.#.#.#.#v#####.#.#######.###.#.#####.#.#####.###.#####.#.#.#.#.#.#.#########.#.#.###.#####.###.#.#######.###.#.#######
#.....#.......#...#.#.#.#.#.#.#.#...#.#.......#...#.#...#...#.#...#.#...#.....#.#...#...#.....#...#.#.#...#.#.....###...#.....#.....#.......#
#.#####.#####.#####.#.#.#.#.#.#.#.#.#.#######.###.#.###.#.###.#.#.#.#.###.#####.#############.#.#.#.#.###.#.#.###########.###.#############.#
#.....#.#.....#...#.#.#...#...#...#.#.........###.#.#...#.#...#.#...#...#.......#.............#.#.#.#.....#.#...........#...#.#...........#.#
#####.#.#.#####.#.#.#.#############.#############.#.#.###.#.###.#######.#########.#############.#.#.#######.###########.###.#.#.#########.#.#
#.....#.#.......#.#...###...........###...###...#...#.#...#...#.#.......#.........#.........#...#.#.#.....#.....#.....#.#...#.#.........#...#
#.#####.#########.#######.#############.#.###.#.#####.#.#####.#.#.#######.#########.#######.#.###.#.#.###.#####.#.###.#.#.###.#########.#####
#.....#.#.........#.......#.......#.....#...#.#.#...#.#.#.....#.#.#...###...#.......#.......#...#.#...#...#...#...###...#.#...#.......#.....#
#####.#.#.#########.#######.#####.#.#######.#.#.#.#.#.#.#.#####.#.#.#.#####.#.#######.#########.#.#####.###.#.###########.#.###.#####.#####.#
#...#...#.....#...#.........#.....#...#.....#.#.#.#.#...#.......#...#.....#...#.......#...#...#.#.....#.#...#...........#.#.....#...#.......#
#.#.#########.#.#.###########.#######.#.#####.#.#.#.#####################.#####.#######.#.#.#.#.#####.#.#.#############.#.#######.#.#########
#.#...#.......#.#.....#...###.......#.#.###...#.#.#...###...#.............#...#.....#...#...#...#.....#...#.....#.......#.........#.........#
#.###.#.#######.#####.#.#.#########.#.#.###.###.#.###.###.#.#.#############.#.#####.#.###########.#########.###.#.#########################.#
#...#.#.......#.....#.#.#.#...#...#...#...#.#...#...#.#...#.#...........#...#.#...#...#.........#.....#...#...#.#.....#...###...#...###.....#
###.#.#######.#####.#.#.#.#.#.#.#.#######v#.#.#####.#.#.###.###########.#.###.#.#.#####.#######.#####.#.#.###.#.#####.#.#.###.#.#.#.###v#####
#...#.....#...#...#.#.#.#.#.#.#.#.#...#.>.>.#.....#.#.#...#...#...#...#.#...#.#.#.....#.......#.......#.#.....#.......#.#.#...#.#.#.#.>.#...#
#.#######.#.###.#.#.#.#.#.#.#.#.#.#.#.#.#########.#.#.###.###.#.#.#.#.#.###.#.#.#####.#######.#########.###############.#.#.###.#.#.#.#v#.#.#
#.......#.#...#.#.#.#.#.#.#.#.#.#...#.#.....#.....#.#.#...#...#.#.#.#...#...#...#.....#.......#...#...#...........#.....#.#...#.#.#.#.#.#.#.#
#######.#.###.#.#.#.#.#.#.#.#.#.#####.#####.#.#####.#.#.###.###.#.#v#####.#######.#####.#######.#.#.#.###########.#.#####.###.#.#.#.#.#.#.#.#
#.......#.....#.#...#...#...#.#...###.#.....#.#...#.#.#.#...#...#.>.>.###.......#.#...#...#...#.#.#.#.#...#...#...#.#.....#...#.#.#.#.#.#.#.#
#.#############.#############.###.###.#.#####.#.#.#.#.#.#.###.#######.#########.#.#.#.###v#.#.#.#.#.#.#.#.#.#.#.###.#.#####.###.#.#.#.#.#.#.#
#.#.......#...#...........#...#...#...#...###.#.#.#.#.#.#...#...#####...#.....#.#.#.#.#.>.>.#.#.#.#.#.#.#.#.#.#...#.#.#...#.#...#.#...#...#.#
#.#.#####.#.#.###########.#.###.###.#####.###.#.#.#.#.#.###.###.#######.#.###.#.#.#.#.#.#####.#.#.#.#.#.#.#.#.###v#.#.#.#.#.#.###.#########.#
#.#...#...#.#...#.....#...#...#...#...#...#...#.#.#.#.#...#...#...#.....#...#.#.#.#.#.#.#.....#.#.#.#.#.#.#.#.#.>.>.#.#.#.#.#...#.....#.....#
#.###.#.###.###.#.###.#.#####.###.###.#.###.###.#.#.#.###.###.###.#.#######.#.#.#.#.#.#.#.#####.#.#.#.#.#.#.#.#.#####.#.#.#.###.#####.#.#####
#.....#.....###...###...#####.....###...###.....#...#.....###.....#.........#...#...#...#.......#...#...#...#...#####...#...###.......#.....#
###########################################################################################################################################.#

23
2023/input/23/test-1 Normal file
View File

@@ -0,0 +1,23 @@
#.#####################
#.......#########...###
#######.#########.#.###
###.....#.>.>.###.#.###
###v#####.#v#.###.#.###
###.>...#.#.#.....#...#
###v###.#.#.#########.#
###...#.#.#.......#...#
#####.#.#.#######.#.###
#.....#.#.#.......#...#
#.#####.#.#.#########v#
#.#...#...#...###...>.#
#.#.#v#######v###.###v#
#...#.>.#...>.>.#.###.#
#####v#.#.###v#.#.###.#
#.....#...#...#.#.#...#
#.#########.###.#.#.###
#...###...#...#...#.###
###.###.#.###v#####v###
#...#...#.#.>.>.#.>.###
#.###.###.#.###.#.#v###
#.....###...###...#...#
#####################.#

300
2023/input/24/input Normal file
View File

@@ -0,0 +1,300 @@
225004689740965, 150875733412640, 116049940893518 @ 275, 389, 375
338282582546422, 191340608518886, 340003210160681 @ -162, 84, -46
276063330011297, 506267063607948, 451688278442130 @ -9, -360, -275
184895220833040, 346432574551322, 295370687370609 @ 190, -100, -32
191652244794317, 228752744289266, 232281189081226 @ -31, 21, 81
243836903069805, 200950090690864, 278486291904150 @ -28, 88, 22
99537538414359, 156839976263080, 330139497485318 @ 130, 130, -37
326389764039501, 504331313318919, 418345965619340 @ -131, -307, -163
148876210640065, 290152398181516, 301374612836089 @ 33, -38, 6
142515087922560, 255308120704690, 257170878718743 @ 68, 8, 52
295642841582982, 242101259588587, 104022418418097 @ -64, 55, 272
212300793229561, 261391853816696, 365490993544222 @ 18, 12, -93
165229346379582, 248276965460071, 161312784455361 @ 228, 79, 212
146531979069180, 97089275376773, 332003690930340 @ 22, 161, -23
120800899092132, 184913721524842, 473900231780358 @ 46, 68, -169
245193974976343, 210971062189687, 268026939360343 @ -33, 73, 36
442753793796843, 328612846899973, 283609914942486 @ -197, 51, -361
386255632768587, 458845472549101, 186183322563756 @ -53, -509, 253
31284818403777, 378560063574625, 130525938014247 @ 121, -131, 182
215792555249349, 255251601506749, 291132823173402 @ 53, 35, -5
440576428992381, 341794624061173, 283489603116870 @ -195, -71, -297
406821058032927, 358552748013016, 243495622599474 @ -84, -158, 37
333985935471117, 348387381803596, 196037336476056 @ 173, -110, 229
194315236713487, 480470439040782, 378290083309208 @ 51, -280, -115
423624567819357, 338961555301801, 243582531901236 @ 61, -23, -31
94275761968037, 416415875088596, 405203801734006 @ 101, -177, -111
182423650573104, 175953021338356, 485228050020492 @ 54, 122, -247
132946860128942, 343413209165262, 326300668034478 @ 36, -96, -17
372535536228591, 339775824243596, 291460134306860 @ -5, -78, -127
234895872588063, 62247228662200, 328601789968998 @ -48, 226, -29
219739080638176, 286527796435798, 280981600608968 @ 12, -20, 17
189527420319587, 44893660278076, 188459541975566 @ 71, 322, 143
380267121502632, 171933783462296, 62327709907551 @ -50, 486, 658
147002248372043, 129217307469322, 20610734515794 @ 72, 163, 337
378116309343993, 323069130988612, 248918730482046 @ 12, -7, 19
319333653031698, 278859269969079, 223866268814703 @ 52, 75, 106
236992756588085, 304463145397792, 340194522655246 @ -12, -44, -61
361033750565555, 283496102799226, 443655113595562 @ -186, -23, -175
235897203512717, 294114281232674, 253551760349992 @ -39, -37, 56
408102536955573, 333380318039952, 224743862672053 @ 133, 14, 168
293102890051939, 344678920502642, 319027665541226 @ -52, -97, -51
314560583563263, 247853680623604, 53638099642518 @ 168, 228, 683
358957968197762, 345732142415154, 247473914297280 @ 176, -100, 13
97749293379345, 58712595993126, 391620120825632 @ 43, 177, -72
322867629724035, 340590948643122, 203289896708124 @ 172, -81, 190
80125950337563, 291162150272609, 183137679036856 @ 67, -45, 129
258374458616771, 177916772961046, 144952832827550 @ -106, 67, 167
278357116203837, 305712540709126, 313477667351106 @ 25, -25, -67
264809045616867, 264739862065576, 262895162556366 @ 124, 82, 15
336748098976080, 273218710413310, 322060564461324 @ 30, 104, -167
429928385950838, 314414397421203, 244915322264740 @ -58, 209, -27
372274398572112, 231105491529412, 287140067936409 @ -124, 146, -34
300041946642210, 361805878294414, 348779219055194 @ 94, -140, -213
82333630198830, 239193100253797, 257911560955197 @ 188, 41, 48
226279166994495, 154940662484512, 108839076271560 @ -50, 110, 216
236988945746136, 219126354714877, 501245149354293 @ -46, 49, -232
290809399876260, 49865784333280, 261940365787665 @ 108, 638, 10
192479192269869, 89960784106480, 410601225475806 @ 72, 264, -171
154572048488187, 298722566659266, 216167781614996 @ 16, -49, 98
61402524224229, 314643942049666, 423478145912151 @ 85, -68, -106
358766524042277, 346694443835744, 276844061172806 @ -19, -102, -46
256397938412229, 266514037892864, 308510441425550 @ -38, 6, -19
111247170663991, 233159373163332, 468697849329816 @ 74, 24, -176
344810608922213, 303615399145216, 281518317463374 @ -63, -8, -23
362788311911379, 251466951828550, 193750060069434 @ -150, 55, 145
399463771643109, 390830800397568, 348214912693582 @ -56, -300, -427
410955878203009, 271492271760398, 451677568130560 @ -193, 83, -454
295197906839637, 437418987102341, 193165330189036 @ -59, -237, 141
154537540976799, 195927505433626, 181308919987650 @ 52, 77, 141
325985149258473, 250194915217672, 334102012662690 @ 108, 204, -238
124543315501773, 231620946800590, 338561758249206 @ 17, 11, -21
335269288780847, 561799450130906, 273598366143466 @ -160, -351, 33
406349536830357, 371696898098416, 244982099083326 @ -5, -260, 13
429820668866290, 271277644477337, 428343413274584 @ -246, 63, -343
285494082255787, 310483982523226, 238112394898756 @ 6, -35, 72
427654917316453, 283119550914376, 289816166586310 @ -171, 202, -189
183305780754531, 169697372808382, 507117795342356 @ -26, 79, -196
297993284172727, 148019247408016, 478413943821759 @ -109, 142, -218
448790421243093, 337156090194256, 245685544768734 @ -213, 32, -103
148786447967448, 318009921450292, 479155605119109 @ 14, -70, -172
179096144122083, 244536042632162, 235756205266522 @ 64, 35, 77
244534188760433, 150524896619640, 152520925860732 @ -45, 138, 178
292496348928869, 340309322862336, 330659178034254 @ -138, -93, -17
238428943280004, 398422698354598, 128738013198711 @ 18, -176, 234
313779278881410, 287246060199107, 290633760886106 @ -50, 5, -21
343288891378891, 429120523686379, 473870061316574 @ -25, -305, -513
446216226005587, 312289649316651, 248176797177231 @ -177, 407, -134
163307384848257, 225448720602800, 322389319780406 @ 31, 38, -21
311268063816389, 463933000929952, 394657123402262 @ -111, -254, -132
399765834273075, 254798002778062, 319132923186840 @ -106, 223, -222
349356303383841, 65751874037920, 238304141643426 @ 88, 934, 64
426197942876982, 275075125500838, 175524119141824 @ -134, 316, 425
244846911821769, 323674066198300, 382631479290586 @ -38, -71, -106
385903898932938, 293744669483637, 303997079396164 @ 28, 149, -255
122406691475152, 265274118970726, 228903355635336 @ 74, -8, 85
428147883934287, 336265506735295, 236428743456129 @ -49, -11, 58
155366097136407, 212516717519496, 138064536136086 @ 223, 134, 247
290272064856077, 53447685751876, 200629668873066 @ -21, 397, 136
289398699960341, 335225479948172, 258338577180554 @ -87, -85, 48
246644560074906, 346069755754627, 184752533814789 @ -18, -99, 146
325161489522083, 312478142191119, 272239125652590 @ 27, -15, -17
302526838060353, 250137788997644, 293451658437046 @ 34, 111, -51
381454405428627, 309591627716605, 247524198319020 @ -69, 15, 37
126242659748529, 415333404708478, 502742367002526 @ 43, -171, -201
391122049921137, 340901601859651, 268790805641181 @ 57, -73, -116
408757147462249, 380607987804743, 399264436774194 @ -223, -157, -197
447450951270780, 284852883292954, 255232938787050 @ -218, 628, -173
406627106978321, 345331129547776, 278775433455838 @ -252, -98, 35
102526860990768, 109719841541566, 426220057678866 @ 104, 172, -141
271417363832745, 226632607078180, 157778251273146 @ -48, 65, 184
380523128506570, 154723202351541, 260313283860234 @ 74, 867, -53
238921206316929, 132829025707360, 47904689664486 @ 244, 438, 549
307266763229071, 270719901259624, 186135881961708 @ 150, 130, 226
230319046492045, 395641124538336, 193363618743976 @ 57, -178, 144
392920766921985, 250496505188886, 306460703608653 @ -215, 32, -20
175231757780249, 44786823183916, 276624943135376 @ 63, 292, 24
313832948811675, 318445186003239, 306518285955873 @ 103, -21, -128
306551125497277, 524521381609762, 241622859608944 @ -79, -365, 68
400554436289624, 347460919638512, 297202409231189 @ 104, -114, -394
389736340819305, 335315093086228, 265059063401646 @ -48, -59, -41
59503995507231, 201984360420538, 424714963719588 @ 103, 48, -115
297143002633785, 96825557449276, 268699929004798 @ -62, 277, 27
390931858919397, 287914464138976, 302923821502446 @ -7, 167, -238
214729565570253, 278072872648670, 319237187952896 @ 25, -7, -36
96351544542113, 114755362054564, 394569159543638 @ 134, 181, -115
253200235356037, 258399369622746, 348809514314886 @ 101, 75, -149
382994713688163, 275642293727644, 356448448140994 @ -158, 40, -163
148649354883135, 340481142733222, 248790450117468 @ 142, -91, 58
134854692785701, 187209426614464, 175332404267278 @ 113, 106, 155
382031589203352, 338688148083646, 244506915572916 @ -60, -76, 45
369770189029605, 317508155457520, 250790362193010 @ 53, 18, 10
372683763999567, 414017337323254, 290899929550854 @ 6, -355, -133
147854567396103, 296200494966013, 360438786344609 @ 19, -47, -52
176792353279606, 312467680727934, 476850067726169 @ -12, -64, -172
302158177857665, 261529363847256, 256986683221090 @ -45, 42, 41
249078363310055, 282217233889320, 271610559471576 @ -52, -22, 34
221596566426841, 219861193819496, 360675578753842 @ -58, 32, -52
179819260650432, 199340653470439, 329496686830650 @ -34, 43, -13
276958462187159, 486380812406192, 159075856045308 @ -108, -250, 160
144557079593697, 131195974673911, 166883422178271 @ 9, 115, 146
490712615276709, 481688438412223, 460171428210714 @ -363, -337, -317
284673415638495, 320722646046907, 349991504659375 @ -113, -71, -48
184676509506952, 270068378274990, 290179021025201 @ -34, -24, 24
345990299479461, 297990031232524, 222968799598746 @ -107, -14, 99
233819171964981, 152061935722588, 108309431253774 @ -47, 123, 223
285477411975405, 291008044172421, 261721579922515 @ -35, -13, 36
407602868256117, 224700153604072, 183502997645982 @ -119, 368, 275
291327574782249, 286013931920310, 431294230944710 @ -137, -39, -117
443300983193571, 324683157114472, 251351540903257 @ -185, 118, -100
189572883657070, 462200497610916, 280153455698611 @ 18, -238, 24
308690692200416, 333877160265007, 236361595096541 @ 44, -71, 74
418654017001235, 348182837861720, 229046306673408 @ 50, -126, 130
378681238387569, 296901565820215, 156807910380587 @ -23, 79, 362
409371660135117, 326653269520726, 231465493326930 @ 121, 77, 105
426752119836365, 343370672093228, 244558686803006 @ -33, -79, -21
375852403443021, 293233964850016, 265899535913214 @ 92, 162, -79
326707607783589, 316318773568392, 309836065113046 @ 13, -27, -106
142911217221157, 261672665797202, 40658695646315 @ 21, -12, 278
244255603614037, 327276038377380, 279588160520382 @ 201, -55, -29
365680112763191, 94848689754348, 298094328264472 @ 24, 816, -154
330900038715639, 333095401980622, 263888598778833 @ -37, -72, 16
233128904088757, 257737506484816, 140807291739982 @ -34, 7, 191
296148164930181, 562101587574141, 250704068764416 @ -11, -493, 49
194944987544711, 293883929666758, 290731532680414 @ -42, -47, 23
322305098222037, 370061146918651, 477144215849956 @ -59, -143, -363
182728803240756, 281103277585801, 285622771243386 @ 18, -23, 19
383519700815905, 345082260451353, 403471475241446 @ -15, -97, -601
321303031096657, 382801663317526, 207761312476516 @ -33, -173, 132
82652246408061, 397368423356176, 12561618050022 @ 58, -148, 292
386132571381159, 290050051464719, 201828131188626 @ 79, 209, 259
179334089326071, 197614868629114, 332406359271651 @ -5, 60, -26
262093968892863, 107075329722362, 414807233851420 @ 34, 315, -234
229016437887321, 253800281514190, 442412418387360 @ -21, 15, -178
435464268415533, 304740242014684, 308396918820801 @ -83, 370, -776
434507208806365, 509232372383340, 444474239318010 @ -265, -381, -284
268752689610051, 291591481519324, 295468449312780 @ 122, 24, -60
388988596465428, 462487948867582, 429870272877633 @ -122, -416, -452
66784011152624, 361184408854064, 406644902129688 @ 92, -114, -95
417437370920109, 239344427883568, 200940613813092 @ 9, 790, 358
258122981051685, 455818141956768, 500343012517998 @ -47, -240, -263
428885056879621, 395958064188608, 336285404809233 @ -267, -162, -50
371904496065333, 505347295365256, 482265546690900 @ -83, -518, -572
268921212718412, 421249637667076, 105902059281656 @ -94, -182, 221
245666370615068, 296820628562753, 359611784427307 @ 32, -21, -120
266636285971089, 251550010433302, 261367259665596 @ -57, 23, 44
381991540551663, 283471564116926, 250211504748680 @ 22, 177, 8
107026635297788, 445380665254476, 456350458942680 @ 48, -198, -143
436947285540239, 350951442595312, 282325390191614 @ -78, -170, -537
145398660803727, 195609983658656, 242158434889096 @ 130, 110, 68
297475449394982, 131750381092515, 165719703479968 @ -84, 195, 173
382981082215082, 318082716962228, 217519872859947 @ -184, -54, 106
274508569926281, 337480597564942, 249069272308048 @ 113, -80, 45
409006873082037, 404306234256766, 306773089718196 @ 101, -620, -563
304326995325327, 252632813540085, 317502450159756 @ -29, 69, -71
335336102392062, 349032727458751, 147869871751056 @ -10, -107, 289
224490789327707, 138112263823786, 214964316118086 @ -13, 160, 103
257483144012212, 310616650691101, 220817557849225 @ 126, -23, 108
378616249658565, 487631090875856, 211845741661518 @ -137, -403, 127
256962996060820, 363038059754788, 382290100571323 @ 102, -134, -222
376113767407764, 419697564588036, 503311772819474 @ -68, -318, -717
411690063697784, 334901544443134, 250358939380980 @ -30, -32, -23
378730592174173, 292937924939892, 216595109883586 @ -21, 95, 144
386233907852537, 102017803023726, 148605073075956 @ -49, 797, 394
401023678402335, 326392143373252, 250508593182692 @ -80, -20, 12
187386788876757, 222440010076216, 5544716539566 @ 107, 89, 427
211506671096437, 295843684641176, 394227297865006 @ 59, -25, -157
170237159382989, 228511580730636, 335783635953320 @ 17, 32, -34
293589456751485, 294178241627518, 249641359155174 @ -7, -5, 51
439854842455119, 383935112515580, 293031876578902 @ -218, -316, -253
295518506383932, 200374788948199, 229951840543641 @ -114, 71, 84
394189872421409, 331448531001974, 256407864771135 @ -31, -36, -20
311925984995885, 332357949681136, 293917117060350 @ 30, -68, -59
389447608973881, 380513707763144, 244720406589022 @ -126, -192, 51
366016540138437, 277293281705376, 413687743953006 @ 130, 233, -794
298178291530224, 268217681216719, 304180593974067 @ -38, 31, -38
308018243676123, 296892693397840, 274894177156788 @ -130, -42, 32
60232254901961, 170686288518732, 262671045190162 @ 89, 74, 51
124745624448567, 151652758178730, 163358199121217 @ 31, 96, 150
321860786503481, 302448169248892, 261445808573098 @ -12, -5, 20
205692521446297, 89407037159596, 410049214010034 @ 36, 247, -158
239982788772333, 137286217774368, 174295345603502 @ -56, 138, 147
86731844681439, 259688488792764, 210340217835198 @ 70, -12, 103
170808423768189, 228588666791260, 293948466808818 @ 19, 33, 12
441057939686395, 343398690648711, 549228030221401 @ -265, -93, -736
302443946246812, 240143840858176, 379420862083931 @ -22, 94, -186
345088720716403, 315552253051151, 268545755397918 @ 159, 27, -65
423724795313077, 308659354107536, 180782338151766 @ -63, 186, 493
406798864217260, 293663253737166, 320278735045387 @ -88, 132, -304
195154781190237, 364862205409626, 254799516896806 @ -47, -117, 59
178932977335797, 251708835992206, 247843728908376 @ 45, 19, 62
253349271834117, 283691186580304, 303498852558606 @ -9, -9, -21
376761673051257, 285602705599686, 270257629743006 @ -41, 101, -41
300882491178039, 290243550583162, 189772203039720 @ -68, -15, 146
235369194657157, 421562658281976, 408227743490686 @ -55, -183, -115
188646633711105, 318918710332479, 369157982422215 @ 73, -61, -110
395512774201357, 315616825750976, 285497663723286 @ 96, 102, -266
421677117457729, 302462002478370, 260176983480688 @ -57, 221, -114
177175197731565, 341281080915196, 331441656855726 @ 43, -93, -41
325478665927397, 441871023252256, 224988749860460 @ 21, -338, 102
402136003642932, 333799366036756, 296817265196841 @ 8, -30, -290
182104997730129, 336028786762480, 74550271859558 @ 52, -86, 285
292043981673693, 259010054670568, 310880696340486 @ -98, 9, -16
327463887597202, 275386444030262, 281725872502210 @ 96, 120, -69
180350572694521, 204046517624548, 270869833505754 @ 15, 64, 37
261796476524925, 143723242270984, 124690998413814 @ -90, 121, 198
382022380467301, 363084132643328, 342504705272910 @ -51, -159, -293
359686755049611, 309851948068594, 254216163279732 @ 18, 21, 12
432383902550757, 325288945907500, 237103658765274 @ -139, 49, 58
199141995287962, 12205123960005, 135322914113123 @ 276, 653, 302
388209037680334, 326840502219633, 280212599819923 @ 90, 11, -192
398309490013959, 467459019065502, 435027019897864 @ -245, -216, -115
438077885264229, 338437435266016, 251421696960654 @ -147, -33, -83
142623030672997, 313922309635776, 172051026248046 @ 197, -48, 178
211793103082053, 258637524078497, 413519499042315 @ -11, 5, -134
316227539793914, 330807868031342, 320059762270916 @ -90, -76, -51
363745515105897, 308033947226491, 241876133298636 @ 9, 29, 53
229073101043463, 182441744874760, 375616182031518 @ -6, 114, -105
311663766702322, 293169473612442, 266993157354132 @ -64, -12, 25
165743821901955, 245775966807730, 293803407552466 @ 40, 19, 9
349142785799508, 280261145006550, 287389255673128 @ 124, 164, -135
299220074031339, 172470550513459, 207086145840829 @ -65, 163, 120
51599932704531, 110067755093612, 120750763264579 @ 187, 186, 216
362339688007455, 128526862135900, 213561367782111 @ 123, 898, 174
318235966547318, 236743583502987, 172190463362498 @ -150, 21, 147
243218064862137, 146112647037076, 312898709705706 @ -12, 173, -28
248532762868587, 127913038997386, 306713186523936 @ -89, 124, 5
356833591049452, 288318963368346, 175747488009196 @ -36, 56, 237
429258217460035, 281264286545936, 199918966637106 @ -81, 462, 379
288595615758281, 286112367984743, 301320148789454 @ 17, 15, -49
434137829300957, 385164566787576, 251517643175406 @ -90, -513, -101
226684015769909, 393228920796224, 237234101626834 @ 5, -162, 75
277608974085399, 484613028229744, 346163443971816 @ -86, -266, -56
439564663355742, 339477585210058, 360927913554417 @ -264, -84, -224
243540738730971, 359735080690960, 250444934709888 @ -65, -114, 61
414936626664123, 309300663907822, 216629185840824 @ -56, 125, 188
397872703252389, 212898395772056, 240610671804790 @ -131, 297, 60
123154693229737, 203455201989076, 290045021180228 @ 51, 52, 20
268437039198703, 312957758717668, 372983507517126 @ -58, -56, -101
290041101495914, 452525408726809, 261168521158394 @ 18, -305, 27
94022340218020, 214444823962799, 233285115180485 @ 78, 39, 80
187758784146701, 308231925236552, 42842321977264 @ 17, -54, 306
298993330355122, 276052686620461, 298685552862006 @ -10, 31, -41
332169842700025, 298970888104540, 302981537331018 @ -70, -11, -50
194328822595255, 76283873425353, 136668594275728 @ 239, 459, 281
120250832193905, 241032280181964, 229456138785466 @ 50, 11, 84
151422919814977, 301022504515816, 378981998111542 @ 111, -38, -117
96990387183037, 372867516983776, 14714289836806 @ 168, -134, 366
274942199061477, 481640626788556, 14527007819946 @ -11, -317, 432
224838145952262, 313821556817251, 263551720120806 @ 14, -55, 39
403167845873627, 244787413886076, 196299464895806 @ -30, 432, 279
423651938100112, 435225368641841, 336353363207841 @ -264, -201, -38
289166585859768, 74894176976193, 138452721266517 @ 130, 605, 328
431669875459573, 325370084156409, 252462190860946 @ -27, 143, -141
390448274978984, 338265610742420, 231189470189675 @ 98, -54, 98
237855310336712, 79275006966921, 512264534723696 @ -64, 191, -223
430777549022346, 301130642558299, 294289756858713 @ -166, 153, -262
222272412127973, 253877615323776, 267895382908238 @ 18, 27, 33
165432519670262, 95007658128776, 226194378092481 @ 24, 182, 88
281007118242885, 330242484331812, 296563154696266 @ -35, -75, -16
359290360054469, 394969290711776, 300557072988910 @ -60, -223, -88

5
2023/input/24/test-1 Normal file
View File

@@ -0,0 +1,5 @@
19, 13, 30 @ -2, 1, -2
18, 19, 22 @ -1, -1, -2
20, 25, 34 @ -2, -2, -4
12, 31, 28 @ -1, -2, -1
20, 19, 15 @ 1, -5, -3

1211
2023/input/25/input Normal file

File diff suppressed because it is too large Load Diff

13
2023/input/25/test-1 Normal file
View File

@@ -0,0 +1,13 @@
jqt: rhn xhk nvd
rsh: frs pzl lsr
xhk: hfx
cmg: qnr nvd lhk bvb
rhn: xhk bvb hfx
bvb: xhk hfx
pzl: lsr hfx nvd
qnr: nvd
ntq: jqt hfx bvb xhk
nvd: lhk
lsr: lhk
rzs: qnr cmg lsr rsh
frs: qnr lhk lsr

View File

@@ -4,13 +4,14 @@ type=$2
default=$3 default=$3
test=$4 test=$4
day_trimmed=$(echo $1 | sed 's/^0*//')
echo "Creating file from template..." echo "Creating file from template..."
sed -e "s/DAY/$day/g" -e "s/TYPE/$type/" -e "s/DEFAULT/$default/" -e "s/TEST/$test/" ./template.rs > ./src/bin/day${day}.rs sed -e "s/DAY/$day_trimmed/g" -e "s/TYPE/$type/" -e "s/DEFAULT/$default/" -e "s/TEST/$test/" ./template.rs > ./src/bin/day${day}.rs
echo "Downloading input..." echo "Downloading input..."
source ../.env source ../.env
mkdir -p input/$1 mkdir -p input/$1
day=$(echo $1 | sed 's/^0*//') curl -s "https://adventofcode.com/2023/day/$day_trimmed/input" -H "Cookie: session=${SESSION}" > input/$1/input
curl -s "https://adventofcode.com/2023/day/$day/input" -H "Cookie: session=${SESSION}" > input/$1/input
echo "Done!" echo "Done!"

View File

@@ -88,7 +88,7 @@ impl aoc::Solver for Day {
// If valid, get the id and add it to the sum // If valid, get the id and add it to the sum
if valid { if valid {
let (_, id) = game.split_once(' ').unwrap(); let id = game.split_once(' ').unwrap().1;
let id: usize = id.parse().unwrap(); let id: usize = id.parse().unwrap();
Some(id) Some(id)
} else { } else {
@@ -107,7 +107,7 @@ impl aoc::Solver for Day {
.lines() .lines()
.map(|line| { .map(|line| {
// Split the game id from the actual game played // Split the game id from the actual game played
let (_, line) = line.split_once(": ").unwrap(); let line = line.split_once(": ").unwrap().1;
// Get the required minimum amount for each color // Get the required minimum amount for each color
let required = line.split(", ").fold((0, 0, 0), |acc, entry| { let required = line.split(", ").fold((0, 0, 0), |acc, entry| {

View File

@@ -61,9 +61,10 @@ impl aoc::Solver for Day {
.lines() .lines()
.map(|line| { .map(|line| {
// Get rid of the first part // Get rid of the first part
let (_, line) = line let line = line
.split_once(": ") .split_once(": ")
.expect("Input should be formatted properly"); .expect("Input should be formatted properly")
.1;
// Seperate the winning numbers and numbers we have // Seperate the winning numbers and numbers we have
let (winning, numbers) = line let (winning, numbers) = line
@@ -96,9 +97,10 @@ impl aoc::Solver for Day {
input.lines().enumerate().for_each(|(i, line)| { input.lines().enumerate().for_each(|(i, line)| {
// Get rid of the first part // Get rid of the first part
let (_, line) = line let line = line
.split_once(": ") .split_once(": ")
.expect("Input should be formatted properly"); .expect("Input should be formatted properly")
.1;
// Seperate the winning numbers and numbers we have // Seperate the winning numbers and numbers we have
let (winning, numbers) = line let (winning, numbers) = line

View File

@@ -1,10 +1,6 @@
#![feature(iter_map_windows)] #![feature(iter_map_windows)]
#![feature(test)] #![feature(test)]
use std::{ use std::{cmp::max, collections::VecDeque};
cmp::max,
collections::VecDeque,
ops::{Add, BitAnd, BitOr},
};
use anyhow::Result; use anyhow::Result;
use aoc::Solver; use aoc::Solver;
@@ -29,7 +25,7 @@ mod tests {
} }
#[test] #[test]
fn part1_test2() -> Result<()> { fn part2_test1() -> Result<()> {
Day::test(Day::part2, "test-1", 46) Day::test(Day::part2, "test-1", 46)
} }
@@ -59,14 +55,17 @@ struct Range {
} }
impl Range { impl Range {
/// Create a new range
pub fn new(start: isize, length: isize) -> Self { pub fn new(start: isize, length: isize) -> Self {
Self { start, length } Self { start, length }
} }
/// Get the position of the first element after the range
pub fn end(&self) -> isize { pub fn end(&self) -> isize {
self.start + self.length self.start + self.length
} }
/// Apply an offset of the range
pub fn offset(&self, offset: isize) -> Self { pub fn offset(&self, offset: isize) -> Self {
Self { Self {
start: self.start + offset, start: self.start + offset,
@@ -74,6 +73,8 @@ impl Range {
} }
} }
/// Get the overlap between this range and another range.
/// Returns [None] if there is no overlap
pub fn overlap(&self, rhs: &Self) -> Option<Self> { pub fn overlap(&self, rhs: &Self) -> Option<Self> {
let start = max(self.start, rhs.start); let start = max(self.start, rhs.start);
let end = std::cmp::min(self.end(), rhs.end()); let end = std::cmp::min(self.end(), rhs.end());
@@ -88,30 +89,77 @@ impl Range {
} }
} }
pub fn exclude(&self, rhs: &Self) -> VecDeque<Self> { /// Exclude a different range from the current one.
/// This returns a vector containing all ranges that form after excluding the different range
/// from this range.
/// The vector can be of size 0 if this range is included entirely in the different one.
/// Size 2 if the different range is included entirely in this one.
/// And size 1 if there is a partial overlap between the two ranges.
pub fn exclude(&self, rhs: &Self) -> Vec<Self> {
if let Some(overlap) = self.overlap(rhs) { if let Some(overlap) = self.overlap(rhs) {
if rhs.start <= self.start && rhs.end() >= self.end() { if rhs.start <= self.start && rhs.end() >= self.end() {
vec![].into() vec![]
} else if rhs.start <= self.start { } else if rhs.start <= self.start {
let start = rhs.end(); let start = rhs.end();
let length = self.end() - start; let length = self.end() - start;
vec![Range::new(start, length)].into() vec![Range::new(start, length)]
} else if rhs.end() >= self.end() { } else if rhs.end() >= self.end() {
let start = self.start; let start = self.start;
let length = rhs.start - start; let length = rhs.start - start;
vec![Range::new(start, length)].into() vec![Range::new(start, length)]
} else { } else {
let a = Range::new(self.start, overlap.start - self.start); let a = Range::new(self.start, overlap.start - self.start);
let b = Range::new(overlap.end(), self.end() - overlap.end()); let b = Range::new(overlap.end(), self.end() - overlap.end());
vec![a, b].into() vec![a, b]
} }
} else { } else {
vec![*self].into() vec![*self]
} }
} }
/// Check if a value is contained in this range
pub fn contains(&self, entry: isize) -> bool {
entry >= self.start && entry < self.end()
}
}
/// Parse a mapping block into a vector containing the each mapping range and the value that needs
/// to be added to perform the remap
fn parse_mapping_block(block: &str) -> Vec<(Range, isize)> {
// Each line of the mapping block is formatted as
// dst src len
block
// Take each line of the block
.lines()
// Skip the first line giving the name of the map
.skip(1)
.map(|line| {
let mut split = line.splitn(3, ' ').map(|num| num.parse::<isize>().unwrap());
let destination = split.next().unwrap();
let source = split.next().unwrap();
let length = split.next().unwrap();
// To move an entry from the source to the destination subtract the source and add the
// destination, adding the remap value will do this
let remap = destination - source;
(Range::new(source, length), remap)
})
.collect()
}
/// Process the input containing the seeds into a interator of all seed numbers
fn process_seeds(seeds: &str) -> impl Iterator<Item = isize> + '_ {
seeds
// Split the string at the whitespace
.split_whitespace()
// The first part contains "seed: " which we can ignore
.skip(1)
// Parse the numbers
.map(|num| num.parse().unwrap())
} }
// -- Solution -- // -- Solution --
@@ -125,99 +173,87 @@ impl aoc::Solver for Day {
} }
fn part1(input: &str) -> Self::Output1 { fn part1(input: &str) -> Self::Output1 {
// Split all the input blocks
let mut split = input.split("\n\n"); let mut split = input.split("\n\n");
let mut seeds: Vec<_> = split
.next()
.unwrap()
.split_once(": ")
.unwrap()
.1
.split_whitespace()
.map(|seed| seed.parse::<isize>().unwrap())
.collect();
// Get a list of all seeds
let mut seeds: Vec<_> = process_seeds(split.next().unwrap()).collect();
// There are 7 mapping blocks, so loop 7 times
for _ in 0..7 { for _ in 0..7 {
let map = split let map = parse_mapping_block(split.next().unwrap());
.next()
.unwrap()
.lines()
.skip(1)
.map(|line| {
let mut split = line.splitn(3, ' ');
(
split.next().unwrap().parse::<isize>().unwrap(),
split.next().unwrap().parse::<isize>().unwrap(),
split.next().unwrap().parse::<isize>().unwrap(),
)
})
.collect::<Vec<_>>();
// Update the list of seeds
seeds = seeds seeds = seeds
.into_iter() .into_iter()
.map(|mut seed| { .map(|seed| {
// For each mapping check if the seed is in the mapping, if it is remap it
for mapping in map.iter() { for mapping in map.iter() {
if seed >= mapping.1 && seed < (mapping.1 + mapping.2) { if mapping.0.contains(seed) {
seed = seed - mapping.1 + mapping.0; return seed + mapping.1;
break;
} }
} }
// Otherwise keep the current value
seed seed
}) })
.collect(); .collect();
} }
// Get the minimum value
*seeds.iter().min().unwrap() *seeds.iter().min().unwrap()
} }
fn part2(input: &str) -> Self::Output2 { fn part2(input: &str) -> Self::Output2 {
// Split all the input blocks
let mut split = input.split("\n\n"); let mut split = input.split("\n\n");
let mut seeds: VecDeque<_> = split
.next() // Get a list of all seeds
.unwrap() let mut seeds: VecDeque<_> = process_seeds(split.next().unwrap())
.split_once(": ") // Take the entries pairwise and construct a range
.unwrap()
.1
.split_whitespace()
.map(|seed| seed.parse::<isize>().unwrap())
.map_windows(|range: &[isize; 2]| Range::new(range[0], range[1])) .map_windows(|range: &[isize; 2]| Range::new(range[0], range[1]))
// Make sure we move over 2 every time instead of only 1
.step_by(2) .step_by(2)
.collect(); .collect();
// There are 7 mapping blocks, so loop 7 times
for _ in 0..7 { for _ in 0..7 {
let map = split let map = parse_mapping_block(split.next().unwrap());
.next()
.unwrap()
.lines()
.skip(1)
.map(|line| {
let mut split = line.splitn(3, ' ');
let remap = split.next().unwrap().parse::<isize>().unwrap();
let start = split.next().unwrap().parse::<isize>().unwrap();
let length = split.next().unwrap().parse::<isize>().unwrap();
(Range::new(start, length), remap - start)
})
.collect::<Vec<_>>();
// Output list
let mut result = VecDeque::new(); let mut result = VecDeque::new();
// Keep processing the input list until it is empty
'outer: while let Some(seed) = seeds.pop_front() { 'outer: while let Some(seed) = seeds.pop_front() {
for mapping in map.iter() { for mapping in map.iter() {
// For each mapping check if there is overlap
if let Some(overlap) = seed.overlap(&mapping.0) { if let Some(overlap) = seed.overlap(&mapping.0) {
// Remap the overlapping part and add it to the output list
result.push_back(overlap.offset(mapping.1)); result.push_back(overlap.offset(mapping.1));
seeds.append(&mut seed.exclude(&mapping.0));
// Add the remainder back to the input list
seeds.append(&mut seed.exclude(&mapping.0).into());
// Continue with the next input
continue 'outer; continue 'outer;
} }
} }
// There was no overlap with any of the mappings, the current range can be added to the output list
result.push_back(seed); result.push_back(seed);
} }
// The input for the next iterator is the output of this iteration
seeds = result; seeds = result;
} }
seeds.iter().map(|range| range.start).min().unwrap() // Find the lowest seed value
seeds
.iter()
// The start of each range is the lowest value of that range
.map(|range| range.start)
// Get the minimum value
.min()
.unwrap()
} }
} }

122
2023/src/bin/day06.rs Normal file
View File

@@ -0,0 +1,122 @@
#![feature(test)]
use anyhow::Result;
use aoc::Solver;
// -- Runners --
fn main() -> Result<()> {
Day::solve()
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn part1_test1() -> Result<()> {
Day::test(Day::part1, "test-1", 288)
}
#[test]
fn part1_solution() -> Result<()> {
Day::test(Day::part1, "input", 440000)
}
#[test]
fn part2_test1() -> Result<()> {
Day::test(Day::part2, "test-1", 71503)
}
#[test]
fn part2_solution() -> Result<()> {
Day::test(Day::part2, "input", 26187338)
}
// Benchmarks
extern crate test;
#[bench]
#[ignore]
fn part1_bench(b: &mut test::Bencher) {
Day::benchmark(Day::part1, b)
}
#[bench]
#[ignore]
fn part2_bench(b: &mut test::Bencher) {
Day::benchmark(Day::part2, b)
}
}
// distance = x * (time - x) = -x^2 + x*time > record
// Solving for -x^2 + x*time - record = 0 gives times between which we win
// which we win
fn number_of_ways(time: f64, record: f64) -> usize {
let a = -1.0;
let b = time;
let c = -record;
let one = (-b + (b.powi(2) - 4.0 * a * c).sqrt()) / (2.0 * a);
let two = (-b - (b.powi(2) - 4.0 * a * c).sqrt()) / (2.0 * a);
(two.ceil() - one.floor() - 1.0) as usize
}
// -- Solution --
pub struct Day;
impl aoc::Solver for Day {
type Output1 = usize;
type Output2 = usize;
fn day() -> u8 {
6
}
fn part1(input: &str) -> Self::Output1 {
let mut lines = input.lines();
let times = lines
.next()
.unwrap()
.split_whitespace()
.skip(1)
.map(|num| num.parse().unwrap());
let records = lines
.next()
.unwrap()
.split_whitespace()
.skip(1)
.map(|num| num.parse().unwrap());
times
.zip(records)
.map(|(time, record)| number_of_ways(time, record))
.product()
}
fn part2(input: &str) -> Self::Output2 {
let mut lines = input.lines();
let time = lines
.next()
.unwrap()
.split_once(':')
.unwrap()
.1
.trim()
.replace(' ', "")
.parse()
.unwrap();
let record = lines
.next()
.unwrap()
.split_once(':')
.unwrap()
.1
.trim()
.replace(' ', "")
.parse()
.unwrap();
number_of_ways(time, record)
}
}

168
2023/src/bin/day07.rs Normal file
View File

@@ -0,0 +1,168 @@
#![feature(test)]
use anyhow::Result;
use aoc::Solver;
// -- Runners --
fn main() -> Result<()> {
Day::solve()
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn part1_test1() -> Result<()> {
Day::test(Day::part1, "test-1", 6440)
}
#[test]
fn part1_solution() -> Result<()> {
Day::test(Day::part1, "input", 247823654)
}
#[test]
fn part2_test1() -> Result<()> {
Day::test(Day::part2, "test-1", 5905)
}
#[test]
fn part2_solution() -> Result<()> {
Day::test(Day::part2, "input", 245461700)
}
// Benchmarks
extern crate test;
#[bench]
#[ignore]
fn part1_bench(b: &mut test::Bencher) {
Day::benchmark(Day::part1, b)
}
#[bench]
#[ignore]
fn part2_bench(b: &mut test::Bencher) {
Day::benchmark(Day::part2, b)
}
}
// Assign each card a value
fn card_value(card: &char, part2: bool) -> u64 {
match card {
'2' => 2,
'3' => 3,
'4' => 4,
'5' => 5,
'6' => 6,
'7' => 7,
'8' => 8,
'9' => 9,
'T' => 10,
'J' => {
if part2 {
1
} else {
11
}
}
'Q' => 12,
'K' => 13,
'A' => 14,
_ => unreachable!(),
}
}
fn hand_value(cards: &[u64], part2: bool) -> u64 {
// Partition the base into segments of four bits, where the first four represent the value of
// the right most card, the next four bits the second card from the right, etc
let base: u64 = cards
.iter()
.rev()
.enumerate()
.map(|(index, card)| card << (index * 4))
.sum();
// Count how many of each card we have
let mut counts: Vec<_> = (1..=14)
.map(|index| cards.iter().filter(|card| **card == index).count())
.collect();
if part2 {
// Find of which card we have the most
let index_most = counts
.iter()
.enumerate()
.skip(1)
.max_by_key(|(_, count)| **count)
.unwrap()
.0;
// Add the jokes to that count
counts[index_most] += counts[0];
counts[0] = 0;
};
// Partition the rank into segments of 3 bits, lowest three bits is amount of single cards,
// next three bits is amount of pairs, etc
let rank: u64 = counts
.iter()
.map(|count| {
if *count > 0 {
1 << ((count - 1) * 3)
} else {
0
}
})
.sum();
// Shift over the rank and add the base two it
// Sorting by this number should rank all the cards according to the rules
(rank << (5 * 4)) + base
}
fn solve(input: &str, part2: bool) -> u64 {
// Parse each hand
let mut hands: Vec<_> = input
.lines()
.map(|line| {
// Parse each line
let (cards, bid) = line.split_once(' ').unwrap();
let cards: Vec<_> = cards.chars().map(|card| card_value(&card, part2)).collect();
let bid: u64 = bid.parse().unwrap();
// Calculate the value of the hand
let value = hand_value(&cards, part2);
(value, bid)
})
.collect();
// Sort all the hands
hands.sort_by(|a, b| a.0.cmp(&b.0));
// Calculate the total winnings
hands
.iter()
.enumerate()
.map(|(index, (_, bid))| bid * (index as u64 + 1))
.sum()
}
// -- Solution --
pub struct Day;
impl aoc::Solver for Day {
type Output1 = u64;
type Output2 = u64;
fn day() -> u8 {
7
}
fn part1(input: &str) -> Self::Output1 {
solve(input, false)
}
fn part2(input: &str) -> Self::Output2 {
solve(input, true)
}
}

160
2023/src/bin/day08.rs Normal file
View File

@@ -0,0 +1,160 @@
#![feature(test)]
use std::collections::HashMap;
use anyhow::Result;
use aoc::Solver;
// -- Runners --
fn main() -> Result<()> {
Day::solve()
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn part1_test1() -> Result<()> {
Day::test(Day::part1, "test-1", 2)
}
#[test]
fn part1_test2() -> Result<()> {
Day::test(Day::part1, "test-2", 6)
}
#[test]
fn part2_test3() -> Result<()> {
Day::test(Day::part2, "test-3", 6)
}
// Benchmarks
extern crate test;
#[bench]
#[ignore]
fn part1_bench(b: &mut test::Bencher) {
Day::benchmark(Day::part1, b)
}
#[bench]
#[ignore]
fn part2_bench(b: &mut test::Bencher) {
Day::benchmark(Day::part2, b)
}
}
fn gcd(a: usize, b: usize) -> usize {
if b == 0 {
return a;
}
gcd(b, a % b)
}
fn lcm(a: usize, b: usize) -> usize {
if a > b {
(a / gcd(a, b)) * b
} else {
(b / gcd(a, b)) * a
}
}
enum Direction {
Left,
Right,
}
impl From<char> for Direction {
fn from(c: char) -> Self {
match c {
'L' => Self::Left,
'R' => Self::Right,
_ => unreachable!("Invalid input"),
}
}
}
// -- Solution --
pub struct Day;
impl aoc::Solver for Day {
type Output1 = usize;
type Output2 = usize;
fn day() -> u8 {
8
}
fn part1(input: &str) -> Self::Output1 {
let mut lines = input.lines();
let mut directions = lines.next().unwrap().chars().map(Direction::from).cycle();
let map: HashMap<String, (String, String)> = lines
.skip(1)
.map(|line| {
// chars is a mutable reference, this prevents take from taking ownership of chars
let chars = &mut line.chars();
let location = chars.take(3).collect();
let left = chars.skip(4).take(3).collect();
let right = chars.skip(2).take(3).collect();
(location, (left, right))
})
.collect();
let mut steps = 0;
let mut location = "AAA";
while location != "ZZZ" {
let next = map.get(location).unwrap();
location = match directions.next().unwrap() {
Direction::Left => &next.0,
Direction::Right => &next.1,
};
steps += 1;
}
steps
}
fn part2(input: &str) -> Self::Output2 {
let mut lines = input.lines();
let directions = lines.next().unwrap().chars().map(Direction::from).cycle();
let map: HashMap<String, (String, String)> = lines
.skip(1)
.map(|line| {
// chars is a mutable reference, this prevents take from taking ownership of chars
let chars = &mut line.chars();
let location = chars.take(3).collect();
let left = chars.skip(4).take(3).collect();
let right = chars.skip(2).take(3).collect();
(location, (left, right))
})
.collect();
map.iter()
.filter_map(|(key, _)| {
if key.ends_with('A') {
Some(key.as_str())
} else {
None
}
})
.map(|mut location| {
let mut steps = 0;
let mut directions = directions.clone();
while !location.ends_with('Z') {
let next = map.get(location).unwrap();
location = match directions.next().unwrap() {
Direction::Left => &next.0,
Direction::Right => &next.1,
};
steps += 1;
}
steps
})
.fold(1, lcm)
}
}

129
2023/src/bin/day09.rs Normal file
View File

@@ -0,0 +1,129 @@
#![feature(test)]
#![feature(iter_map_windows)]
use anyhow::Result;
use aoc::Solver;
// -- Runners --
fn main() -> Result<()> {
Day::solve()
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn part1_test1() -> Result<()> {
Day::test(Day::part1, "test-1", 114)
}
#[test]
fn part1_test2() -> Result<()> {
Day::test(Day::part1, "test-2", 18)
}
#[test]
fn part1_test3() -> Result<()> {
Day::test(Day::part1, "test-3", 28)
}
#[test]
fn part1_test4() -> Result<()> {
Day::test(Day::part1, "test-4", 68)
}
#[test]
fn part1_solution() -> Result<()> {
Day::test(Day::part1, "input", 1708206096)
}
#[test]
fn part2_test1() -> Result<()> {
Day::test(Day::part2, "test-1", 2)
}
#[test]
fn part2_test2() -> Result<()> {
Day::test(Day::part2, "test-2", -3)
}
#[test]
fn part2_test3() -> Result<()> {
Day::test(Day::part2, "test-3", 0)
}
#[test]
fn part2_test4() -> Result<()> {
Day::test(Day::part2, "test-4", 5)
}
#[test]
fn part2_solution() -> Result<()> {
Day::test(Day::part2, "input", 1050)
}
// Benchmarks
extern crate test;
#[bench]
#[ignore]
fn part1_bench(b: &mut test::Bencher) {
Day::benchmark(Day::part1, b)
}
#[bench]
#[ignore]
fn part2_bench(b: &mut test::Bencher) {
Day::benchmark(Day::part2, b)
}
}
// -- Solution --
pub struct Day;
impl aoc::Solver for Day {
type Output1 = isize;
type Output2 = isize;
fn day() -> u8 {
9
}
fn part1(input: &str) -> Self::Output1 {
input
.lines()
.map(|line| {
let mut nums: Vec<_> = line
.split_whitespace()
.map(|num| num.parse::<isize>().unwrap())
.collect();
let mut next = *nums.last().unwrap();
while nums.iter().any(|&num| num != 0) {
nums = nums.iter().map_windows(|[&a, &b]| b - a).collect();
next += nums.last().unwrap();
}
next
})
.sum()
}
fn part2(input: &str) -> Self::Output2 {
input
.lines()
.map(|line| {
let mut nums: Vec<_> = line
.split_whitespace()
.map(|num| num.parse::<isize>().unwrap())
.collect();
let mut firsts = vec![*nums.first().unwrap()];
while nums.iter().any(|&num| num != 0) {
nums = nums.iter().map_windows(|[&a, &b]| b - a).collect();
firsts.push(*nums.first().unwrap());
}
firsts.iter().rev().skip(1).fold(0, |diff, num| num - diff)
})
.sum()
}
}

515
2023/src/bin/day10.rs Normal file
View File

@@ -0,0 +1,515 @@
#![feature(test)]
use core::panic;
use std::collections::{HashMap, VecDeque};
use anyhow::Result;
use aoc::Solver;
// -- Runners --
fn main() -> Result<()> {
Day::solve()
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn part1_test1() -> Result<()> {
Day::test(Day::part1, "test-1", 4)
}
#[test]
fn part1_test2() -> Result<()> {
Day::test(Day::part1, "test-2", 8)
}
#[test]
fn part1_solution() -> Result<()> {
Day::test(Day::part1, "input", 6768)
}
#[test]
fn part2_test1() -> Result<()> {
Day::test(Day::part2, "test-1", 1)
}
#[test]
fn part2_test2() -> Result<()> {
Day::test(Day::part2, "test-2", 1)
}
#[test]
fn part2_test3() -> Result<()> {
Day::test(Day::part2, "test-3", 4)
}
#[test]
fn part2_test4() -> Result<()> {
Day::test(Day::part2, "test-4", 4)
}
#[test]
fn part2_test5() -> Result<()> {
Day::test(Day::part2, "test-5", 8)
}
#[test]
fn part2_test6() -> Result<()> {
Day::test(Day::part2, "test-6", 10)
}
#[test]
fn part2_solution() -> Result<()> {
Day::test(Day::part2, "input", 351)
}
// Benchmarks
extern crate test;
#[bench]
#[ignore]
fn part1_bench(b: &mut test::Bencher) {
Day::benchmark(Day::part1, b)
}
#[bench]
#[ignore]
fn part2_bench(b: &mut test::Bencher) {
Day::benchmark(Day::part2, b)
}
}
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
enum Maze {
Vertical,
Horizontal,
NorthEast,
NorthWest,
SouthWest,
SouthEast,
Start,
}
impl Maze {
fn from(c: char) -> Option<Self> {
match c {
'|' => Some(Self::Vertical),
'-' => Some(Self::Horizontal),
'L' => Some(Self::NorthEast),
'J' => Some(Self::NorthWest),
'7' => Some(Self::SouthWest),
'F' => Some(Self::SouthEast),
'S' => Some(Self::Start),
_ => None,
}
}
fn connects(&self, other: &Self, direction: (isize, isize)) -> bool {
match direction {
(0, -1) => match self {
Self::Vertical | Self::NorthEast | Self::NorthWest | Self::Start => {
*other == Self::Vertical
|| *other == Self::SouthWest
|| *other == Self::SouthEast
|| *other == Self::Start
}
_ => false,
},
(1, 0) => match self {
Self::Horizontal | Self::NorthEast | Self::SouthEast | Self::Start => {
*other == Self::Horizontal
|| *other == Self::NorthWest
|| *other == Self::SouthWest
|| *other == Self::Start
}
_ => false,
},
(0, 1) => match self {
Self::Vertical | Self::SouthWest | Self::SouthEast | Self::Start => {
*other == Self::Vertical
|| *other == Self::NorthEast
|| *other == Self::NorthWest
|| *other == Self::Start
}
_ => false,
},
(-1, 0) => match self {
Self::Horizontal | Self::NorthWest | Self::SouthWest | Self::Start => {
*other == Self::Horizontal
|| *other == Self::NorthEast
|| *other == Self::SouthEast
|| *other == Self::Start
}
_ => false,
},
_ => unreachable!("Invalid direction"),
}
}
fn sides(&self, direction: (isize, isize)) -> (usize, usize) {
match direction {
(0, -1) => match self {
Maze::Vertical => (1, 1),
Maze::NorthEast => (2, 0),
Maze::NorthWest => (0, 2),
Maze::Start => (0, 0),
_ => unreachable!("Invalid movement"),
},
(1, 0) => match self {
Maze::Horizontal => (1, 1),
Maze::NorthEast => (0, 2),
Maze::SouthEast => (2, 0),
Maze::Start => (0, 0),
_ => unreachable!("Invalid movement"),
},
(0, 1) => match self {
Maze::Vertical => (1, 1),
Maze::SouthWest => (2, 0),
Maze::SouthEast => (0, 2),
Maze::Start => (0, 0),
_ => unreachable!("Invalid movement"),
},
(-1, 0) => match self {
Maze::Horizontal => (1, 1),
Maze::NorthWest => (2, 0),
Maze::SouthWest => (0, 2),
Maze::Start => (0, 0),
_ => unreachable!("Invalid movement"),
},
_ => unreachable!("Invalid direction"),
}
}
}
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
enum Loop {
North,
East,
South,
West,
Inner,
}
impl Loop {
fn from(direction: (isize, isize)) -> Self {
match direction {
(0, -1) => Self::North,
(1, 0) => Self::East,
(0, 1) => Self::South,
(-1, 0) => Self::West,
_ => unreachable!("Invalid direction"),
}
}
fn offset(&self) -> (isize, isize) {
match self {
Loop::North => (0, -1),
Loop::East => (1, 0),
Loop::South => (0, 1),
Loop::West => (-1, 0),
Loop::Inner => (0, 0),
}
}
}
fn flood_fill(position: (isize, isize), map: &mut HashMap<(isize, isize), Loop>) {
let mut queue = VecDeque::new();
queue.push_back(position);
while let Some(position) = queue.pop_front() {
if map.get(&position).is_none() {
map.insert(position, Loop::Inner);
for direction in DIRECTIONS {
queue.push_back((position.0 + direction.0, position.1 + direction.1));
}
}
}
}
static DIRECTIONS: [(isize, isize); 4] = [(0, -1), (1, 0), (0, 1), (-1, 0)];
// -- Solution --
pub struct Day;
impl aoc::Solver for Day {
type Output1 = usize;
type Output2 = usize;
fn day() -> u8 {
10
}
fn part1(input: &str) -> Self::Output1 {
let mut position_start = (-1, -1);
let maze: HashMap<(isize, isize), Maze> = input
.lines()
.enumerate()
.flat_map(|(y, line)| {
line.chars()
.enumerate()
.filter_map(|(x, c)| Maze::from(c).map(|maze| ((x as isize, y as isize), maze)))
.inspect(|(position, maze)| {
if *maze == Maze::Start {
position_start = *position
}
})
.collect::<Vec<_>>()
})
.collect();
if position_start == (-1, -1) {
panic!("No valid start in input");
}
let mut position_current = position_start;
let mut position_previous = position_start;
let mut length = 0;
'outer: loop {
let tile_current = maze.get(&position_current).unwrap();
for direction in DIRECTIONS {
let position_next = (
position_current.0 + direction.0,
position_current.1 + direction.1,
);
// We are now allowed to go back to the previous position
if position_next == position_previous {
continue;
}
if let Some(tile_next) = maze.get(&position_next) {
if tile_current.connects(tile_next, direction) {
position_previous = position_current;
position_current = position_next;
length += 1;
if position_current == position_start {
return length / 2;
}
continue 'outer;
}
}
}
unreachable!("Unable to move forward...");
}
}
// Alternate solution that works for the examples and is off-by-one for the actual input
fn part2(input: &str) -> Self::Output2 {
let mut position_start = (-1, -1);
let end_direction;
let mut maze: HashMap<(isize, isize), Maze> = input
.lines()
.enumerate()
.flat_map(|(y, line)| {
line.chars()
.enumerate()
.filter_map(|(x, c)| Maze::from(c).map(|maze| ((x as isize, y as isize), maze)))
.inspect(|(position, maze)| {
if *maze == Maze::Start {
position_start = *position
}
})
.collect::<Vec<_>>()
})
.collect();
let mut map = HashMap::new();
if position_start == (-1, -1) {
panic!("No valid start in input");
}
let mut sides = (0, 0);
let mut position_current = position_start;
let mut position_previous = position_start;
'outer: loop {
let tile_current = maze.get(&position_current).unwrap();
for direction in DIRECTIONS {
let position_next = (
position_current.0 + direction.0,
position_current.1 + direction.1,
);
// We are now allowed to go back to the previous position
if position_next == position_previous {
continue;
}
if let Some(tile_next) = maze.get(&position_next) {
if tile_current.connects(tile_next, direction) {
map.insert(position_current, Loop::from(direction));
position_previous = position_current;
position_current = position_next;
let s = tile_current.sides(direction);
sides.0 += s.0;
sides.1 += s.1;
if position_current == position_start {
end_direction = Loop::from(direction);
break 'outer;
}
continue 'outer;
}
}
}
unreachable!("Unable to move forward...");
}
// Replace the start with the correct piece
let start = match (end_direction, map.get(&position_start).unwrap()) {
(Loop::North, Loop::North) | (Loop::South, Loop::South) => Maze::Vertical,
(Loop::East, Loop::East) | (Loop::West, Loop::West) => Maze::Horizontal,
(Loop::South, Loop::East) | (Loop::West, Loop::North) => Maze::NorthEast,
(Loop::South, Loop::West) | (Loop::East, Loop::North) => Maze::NorthWest,
(Loop::East, Loop::South) | (Loop::North, Loop::West) => Maze::SouthWest,
(Loop::North, Loop::East) | (Loop::West, Loop::South) => Maze::SouthEast,
_ => unreachable!(),
};
maze.insert(position_start, start);
// Add the sides of the start
let start_sides = start.sides(map.get(&position_start).unwrap().offset());
sides.0 += start_sides.0;
sides.1 += start_sides.1;
// Determine if the loop was travelled clockwise or anti clockwise
let clockwise = sides.0 > sides.1;
let mut position_current = position_start;
loop {
let &direction = map.get(&position_current).unwrap();
let tile = maze.get(&position_current).unwrap();
// Get neighbouring tiles that are inside of the loop
let checks = match direction {
Loop::North => match tile {
Maze::Vertical => {
if clockwise {
vec![(1, 0)]
} else {
vec![(-1, 0)]
}
}
Maze::NorthEast => {
if clockwise {
vec![]
} else {
vec![(-1, 0), (0, 1)]
}
}
Maze::NorthWest => {
if clockwise {
vec![(1, 0), (0, 1)]
} else {
vec![]
}
}
_ => unreachable!(),
},
Loop::East => match tile {
Maze::Horizontal => {
if clockwise {
vec![(0, 1)]
} else {
vec![(0, -1)]
}
}
Maze::NorthEast => {
if clockwise {
vec![(-1, 0), (0, 1)]
} else {
vec![]
}
}
Maze::SouthEast => {
if clockwise {
vec![]
} else {
vec![(-1, 0), (0, -1)]
}
}
_ => unreachable!(),
},
Loop::South => match tile {
Maze::Vertical => {
if clockwise {
vec![(-1, 0)]
} else {
vec![(1, 0)]
}
}
Maze::SouthWest => {
if clockwise {
vec![]
} else {
vec![(0, -1), (1, 0)]
}
}
Maze::SouthEast => {
if clockwise {
vec![(0, -1), (-1, 0)]
} else {
vec![]
}
}
_ => unreachable!(),
},
Loop::West => match tile {
Maze::Horizontal => {
if clockwise {
vec![(0, -1)]
} else {
vec![(0, 1)]
}
}
Maze::NorthWest => {
if clockwise {
vec![]
} else {
vec![(1, 0), (0, 1)]
}
}
Maze::SouthWest => {
if clockwise {
vec![(1, 0), (0, -1)]
} else {
vec![]
}
}
_ => unreachable!(),
},
Loop::Inner => unreachable!("Loop should not contain Inner"),
};
// Perform a floodfill from those neighbouring tiles
for check in checks {
let check = (position_current.0 + check.0, position_current.1 + check.1);
flood_fill(check, &mut map);
}
let direction = direction.offset();
position_current.0 += direction.0;
position_current.1 += direction.1;
if position_current == position_start {
break;
}
}
// Count how many tiles are marked as inner
map.iter()
.filter(|(_, &value)| value == Loop::Inner)
.count()
}
}

168
2023/src/bin/day11.rs Normal file
View File

@@ -0,0 +1,168 @@
#![feature(test)]
use anyhow::Result;
use aoc::Solver;
// -- Runners --
fn main() -> Result<()> {
Day::solve()
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn part1_test1() -> Result<()> {
Day::test(Day::part1, "test-1", 374)
}
#[test]
fn part1_solution() -> Result<()> {
Day::test(Day::part1, "input", 10490062)
}
// NOTE: The given example for part2 are only for 10x and 100x, while part2 uses 1000000x
// Therefore there are now part2 example test
#[test]
fn part2_solution() -> Result<()> {
Day::test(Day::part2, "input", 382979724122)
}
// Benchmarks
extern crate test;
#[bench]
#[ignore]
fn part1_bench(b: &mut test::Bencher) {
Day::benchmark(Day::part1, b)
}
#[bench]
#[ignore]
fn part2_bench(b: &mut test::Bencher) {
Day::benchmark(Day::part2, b)
}
}
#[derive(Debug)]
struct GridPoint {
galaxy: bool,
vertical_expansion: bool,
horizontal_expansion: bool,
}
fn distance(
a: (usize, usize),
b: (usize, usize),
grid: &[Vec<GridPoint>],
expansion: usize,
) -> usize {
let (range_x, x_end) = if a.0 > b.0 {
(b.0..a.0, a.0)
} else {
(a.0..b.0, b.0)
};
let (range_y, y_start) = if a.1 > b.1 {
(b.1..a.1, b.1)
} else {
(a.1..b.1, a.1)
};
let mut steps = 0;
for x in range_x {
if grid[y_start][x].horizontal_expansion {
steps += expansion;
} else {
steps += 1;
}
}
for y in range_y {
if grid[y][x_end].vertical_expansion {
steps += expansion;
} else {
steps += 1;
}
}
steps
}
fn solve(input: &str, expansion: usize) -> usize {
let mut galaxies = Vec::<(usize, usize)>::new();
let mut grid: Vec<Vec<_>> = input
.lines()
.enumerate()
.map(|(y, line)| {
line.chars()
.enumerate()
.map(|(x, c)| {
let has_galaxy = c == '#';
if has_galaxy {
galaxies.push((x, y));
}
GridPoint {
galaxy: has_galaxy,
vertical_expansion: false,
horizontal_expansion: false,
}
})
.collect()
})
.collect();
// The grid is square
let size = grid.len();
for row in &mut grid {
let has_galaxy = row.iter().any(|point| point.galaxy);
row.iter_mut()
.for_each(|point| point.vertical_expansion = !has_galaxy)
}
for x in 0..size {
let mut has_galaxy = false;
for row in &grid {
has_galaxy |= row[x].galaxy;
}
for row in &mut grid {
row[x].horizontal_expansion = !has_galaxy;
}
}
let mut sum = 0;
for a in &galaxies {
for b in &galaxies {
if a == b {
continue;
}
sum += distance(*a, *b, &grid, expansion);
}
}
// We are computing every pair twice, dividing by two is a simpler solution then keep keeping
// track of every pair, but it does require more computation
sum / 2
}
// -- Solution --
pub struct Day;
impl aoc::Solver for Day {
type Output1 = usize;
type Output2 = usize;
fn day() -> u8 {
11
}
fn part1(input: &str) -> Self::Output1 {
solve(input, 2)
}
fn part2(input: &str) -> Self::Output2 {
solve(input, 1000000)
}
}

238
2023/src/bin/day12.rs Normal file
View File

@@ -0,0 +1,238 @@
#![feature(test)]
use std::{
collections::{hash_map::DefaultHasher, HashMap},
hash::{Hash, Hasher},
};
use anyhow::Result;
use aoc::Solver;
// -- Runners --
fn main() -> Result<()> {
Day::solve()
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn part1_test1() -> Result<()> {
Day::test(Day::part1, "test-1", 21)
}
#[test]
fn part1_solution() -> Result<()> {
Day::test(Day::part1, "input", 7674)
}
#[test]
fn part2_test1() -> Result<()> {
Day::test(Day::part2, "test-1", 525152)
}
#[test]
fn part2_solution() -> Result<()> {
Day::test(Day::part2, "input", 4443895258186)
}
// Benchmarks
extern crate test;
#[bench]
#[ignore]
fn part1_bench(b: &mut test::Bencher) {
Day::benchmark(Day::part1, b)
}
#[bench]
#[ignore]
fn part2_bench(b: &mut test::Bencher) {
Day::benchmark(Day::part2, b)
}
}
#[derive(Debug, PartialEq, Eq, Copy, Clone, Hash)]
enum Spring {
Operational,
Damaged,
Unknown,
}
impl Spring {
fn convert(c: char) -> Self {
match c {
'.' => Self::Operational,
'#' => Self::Damaged,
'?' => Self::Unknown,
_ => unreachable!("Invalid input"),
}
}
}
impl std::fmt::Display for Spring {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Spring::Operational => write!(f, "."),
Spring::Damaged => write!(f, "#"),
Spring::Unknown => write!(f, "?"),
}
}
}
// The cache is optional as is slows down part1 by a lot
fn count_valid(
springs: &mut [Spring],
list: &[usize],
damaged_chain: usize,
cache: &mut Option<&mut Cache>,
) -> usize {
let hash = if let Some(cache) = cache {
// Calculate the hash manually, otherwise we end up with weird borrows or we have to clone
// (which is slow)
let mut hash = DefaultHasher::new();
springs.hash(&mut hash);
list.hash(&mut hash);
damaged_chain.hash(&mut hash);
let hash = hash.finish();
if let Some(&value) = cache.get(&hash) {
return value;
}
Some(hash)
} else {
None
};
// We reached the end of the list, no further processing is possible
let count = if list.is_empty() {
if springs
.iter()
.filter(|&spring| spring == &Spring::Damaged)
.count()
> 0
{
// There are still damaged springs remaining
0
} else {
// There are no damaged springs remaining
1
}
} else if springs.is_empty() {
// If there is one last entry in the list, check if it maches
if list.len() == 1 && damaged_chain == list[0] {
1
} else {
0
}
} else {
match springs[0] {
Spring::Operational => {
if damaged_chain == 0 {
// The previous entry was operation, skip over this entry
count_valid(&mut springs[1..], list, 0, cache)
} else if damaged_chain == list[0] {
// We reached the end of a chain and it has the expected length, start working on the next chain
count_valid(&mut springs[1..], &list[1..], 0, cache)
} else {
// We reached the end of a chain and it does not have the expected length
0
}
}
Spring::Unknown => {
// Replace unknown with operational
springs[0] = Spring::Operational;
let a = count_valid(springs, list, damaged_chain, cache);
// Replace unknown with damaged
springs[0] = Spring::Damaged;
let b = count_valid(springs, list, damaged_chain, cache);
// Reset spring back to unknown
springs[0] = Spring::Unknown;
// Return the sum of both branches
a + b
}
Spring::Damaged => {
if damaged_chain + 1 > list[0] {
// The chain is to long
0
} else {
// Add to the damaged chain
count_valid(&mut springs[1..], list, damaged_chain + 1, cache)
}
}
}
};
if let Some(cache) = cache {
cache.insert(hash.unwrap(), count);
}
count
}
type Cache = HashMap<u64, usize>;
// -- Solution --
pub struct Day;
impl aoc::Solver for Day {
type Output1 = usize;
type Output2 = usize;
fn day() -> u8 {
12
}
fn part1(input: &str) -> Self::Output1 {
input
.lines()
.map(|line| line.split_once(' ').unwrap())
.map(|(springs, list)| {
(
springs.chars().map(Spring::convert).collect::<Vec<_>>(),
list.split(',')
.map(|num| num.parse::<usize>().unwrap())
.collect::<Vec<_>>(),
)
})
.map(|(mut springs, list)| count_valid(&mut springs, &list, 0, &mut None))
.sum()
}
fn part2(input: &str) -> Self::Output2 {
input
.lines()
.map(|line| line.split_once(' ').unwrap())
.map(|(springs, list)| {
(
springs.chars().map(Spring::convert).collect::<Vec<_>>(),
list.split(',')
.map(|num| num.parse::<usize>().unwrap())
.collect::<Vec<_>>(),
)
})
.map(|(springs, list)| {
(
[
springs.clone(),
vec![Spring::Unknown],
springs.clone(),
vec![Spring::Unknown],
springs.clone(),
vec![Spring::Unknown],
springs.clone(),
vec![Spring::Unknown],
springs,
]
.concat(),
[list.clone(), list.clone(), list.clone(), list.clone(), list].concat(),
)
})
.map(|(mut springs, list)| {
let mut cache = HashMap::new();
count_valid(&mut springs, &list, 0, &mut Some(&mut cache))
})
.sum()
}
}

197
2023/src/bin/day13.rs Normal file
View File

@@ -0,0 +1,197 @@
#![feature(test)]
use anyhow::Result;
use aoc::Solver;
// -- Runners --
fn main() -> Result<()> {
Day::solve()
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn part1_test1() -> Result<()> {
Day::test(Day::part1, "test-1", 405)
}
#[test]
fn part1_solution() -> Result<()> {
Day::test(Day::part1, "input", 36448)
}
#[test]
fn part2_test1() -> Result<()> {
Day::test(Day::part2, "test-1", 400)
}
#[test]
fn part2_solution() -> Result<()> {
Day::test(Day::part2, "input", 35799)
}
// Benchmarks
extern crate test;
#[bench]
#[ignore]
fn part1_bench(b: &mut test::Bencher) {
Day::benchmark(Day::part1, b)
}
#[bench]
#[ignore]
fn part2_bench(b: &mut test::Bencher) {
Day::benchmark(Day::part2, b)
}
}
#[derive(Debug, PartialEq, Eq)]
enum Ground {
Ash,
Rocks,
}
impl Ground {
fn flip(&self) -> Self {
match self {
Ground::Ash => Ground::Rocks,
Ground::Rocks => Ground::Ash,
}
}
}
impl From<char> for Ground {
fn from(c: char) -> Self {
match c {
'.' => Self::Ash,
'#' => Self::Rocks,
_ => unreachable!("Invalid input"),
}
}
}
// -- Solution --
pub struct Day;
impl aoc::Solver for Day {
type Output1 = usize;
type Output2 = usize;
fn day() -> u8 {
13
}
fn part1(input: &str) -> Self::Output1 {
input
.split("\n\n")
.map(|block| {
block
.lines()
.map(|line| line.chars().map(|c| c.into()).collect::<Vec<Ground>>())
.collect::<Vec<Vec<_>>>()
})
.map(|block| {
let height = block.len();
let width = block[0].len();
if let Some(y) = (1..height).find(|&y| {
let top = block[0..y].iter().rev();
let bottom = block[y..height].iter();
top.zip(bottom).all(|(a, b)| a == b)
}) {
100 * y
} else if let Some(x) = (1..width).find(|&x| {
block.iter().all(|line| {
let left = line[0..x].iter().rev();
let right = line[x..width].iter();
left.zip(right).all(|(a, b)| a == b)
})
}) {
x
} else {
unreachable!("Their is always a mirror line")
}
})
.sum()
}
fn part2(input: &str) -> Self::Output2 {
input
.split("\n\n")
.map(|block| {
block
.lines()
.map(|line| line.chars().map(|c| c.into()).collect::<Vec<Ground>>())
.collect::<Vec<Vec<_>>>()
})
.map(|mut block| {
let height = block.len();
let width = block[0].len();
// Get the row/column of the old mirror line
let (x_old, y_old) = if let Some(y) = (1..height).find(|&y| {
let top = block[0..y].iter().rev();
let bottom = block[y..height].iter();
top.zip(bottom).all(|(a, b)| a == b)
}) {
(None, Some(y))
} else if let Some(x) = (1..width).find(|&x| {
block.iter().all(|line| {
let left = line[0..x].iter().rev();
let right = line[x..width].iter();
left.zip(right).all(|(a, b)| a == b)
})
}) {
(Some(x), None)
} else {
unreachable!("Their is always a mirror line")
};
// Try every possible smudge location
for j in 0..width {
for i in 0..height {
// Flip one
block[i][j] = block[i][j].flip();
if let Some(y) = (1..height).find(|&y| {
// The mirror line can not be the old one
if y_old == Some(y) {
return false;
}
let top = block[0..y].iter().rev();
let bottom = block[y..height].iter();
top.zip(bottom).all(|(a, b)| a == b)
}) {
return 100 * y;
} else if let Some(x) = (1..width).find(|&x| {
// The mirror line can not be the old one
if x_old == Some(x) {
return false;
}
block.iter().all(|line| {
let left = line[0..x].iter().rev();
let right = line[x..width].iter();
left.zip(right).all(|(a, b)| a == b)
})
}) {
return x;
} else {
// Revert flip
block[i][j] = block[i][j].flip();
continue;
}
}
}
unreachable!("Their should always be a mirror line")
})
.sum()
}
}

265
2023/src/bin/day14.rs Normal file
View File

@@ -0,0 +1,265 @@
#![feature(test)]
use std::{
collections::{hash_map::DefaultHasher, HashMap},
fmt::Display,
hash::{Hash, Hasher},
};
use anyhow::Result;
use aoc::Solver;
// -- Runners --
fn main() -> Result<()> {
Day::solve()
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn part1_test1() -> Result<()> {
Day::test(Day::part1, "test-1", 136)
}
#[test]
fn part1_solution() -> Result<()> {
Day::test(Day::part1, "input", 110407)
}
#[test]
fn part2_test1() -> Result<()> {
Day::test(Day::part2, "test-1", 64)
}
#[test]
fn part2_solution() -> Result<()> {
Day::test(Day::part2, "input", 87273)
}
// Benchmarks
extern crate test;
#[bench]
#[ignore]
fn part1_bench(b: &mut test::Bencher) {
Day::benchmark(Day::part1, b)
}
#[bench]
#[ignore]
fn part2_bench(b: &mut test::Bencher) {
Day::benchmark(Day::part2, b)
}
}
#[derive(Debug, PartialEq, Eq, Clone, Copy, Hash)]
enum Space {
Empty,
Cube,
Round,
}
impl Display for Space {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Space::Empty => write!(f, "."),
Space::Cube => write!(f, "#"),
Space::Round => write!(f, "O"),
}
}
}
impl From<char> for Space {
fn from(c: char) -> Self {
match c {
'.' => Self::Empty,
'#' => Self::Cube,
'O' => Self::Round,
_ => unreachable!("Invalid input"),
}
}
}
fn print_grid(grid: &[Vec<Space>]) {
for line in grid {
for space in line {
print!("{space}");
}
println!();
}
}
fn tilt_north(grid: &mut Vec<Vec<Space>>) {
let width = grid[0].len();
let height = grid.len();
for y in 0..height {
for x in 0..width {
if grid[y][x] == Space::Round {
let mut new_y = y;
for yy in (0..y).rev() {
if grid[yy][x] == Space::Empty {
new_y = yy
} else {
break;
}
}
if new_y < y {
grid[y][x] = Space::Empty;
grid[new_y][x] = Space::Round;
}
}
}
}
}
fn tilt_east(grid: &mut [Vec<Space>]) {
let width = grid[0].len();
for x in (0..width).rev() {
for line in grid.iter_mut() {
if line[x] == Space::Round {
let mut new_x = x;
for (xx, space) in line.iter().enumerate().skip(x + 1) {
if space == &Space::Empty {
new_x = xx
} else {
break;
}
}
if new_x > x {
line[x] = Space::Empty;
line[new_x] = Space::Round;
}
}
}
}
}
fn tilt_south(grid: &mut Vec<Vec<Space>>) {
let width = grid[0].len();
let height = grid.len();
for y in (0..height).rev() {
for x in 0..width {
if grid[y][x] == Space::Round {
let mut new_y = y;
for (yy, line) in grid.iter().enumerate().skip(y + 1) {
if line[x] == Space::Empty {
new_y = yy
} else {
break;
}
}
if new_y > y {
grid[y][x] = Space::Empty;
grid[new_y][x] = Space::Round;
}
}
}
}
}
fn tilt_west(grid: &mut [Vec<Space>]) {
let width = grid[0].len();
for x in 0..width {
for line in grid.iter_mut() {
if line[x] == Space::Round {
let mut new_x = x;
for xx in (0..x).rev() {
if line[xx] == Space::Empty {
new_x = xx
} else {
break;
}
}
if new_x < x {
line[x] = Space::Empty;
line[new_x] = Space::Round;
}
}
}
}
}
fn calculate_load(grid: &Vec<Vec<Space>>) -> usize {
grid.iter()
.enumerate()
.map(|(y, line)| {
line.iter()
.filter_map(|space| {
if space == &Space::Round {
Some(grid.len() - y)
} else {
None
}
})
.sum::<usize>()
})
.sum()
}
fn cycle(grid: &mut Vec<Vec<Space>>) {
tilt_north(grid);
tilt_west(grid);
tilt_south(grid);
tilt_east(grid);
}
// -- Solution --
pub struct Day;
impl aoc::Solver for Day {
type Output1 = usize;
type Output2 = usize;
fn day() -> u8 {
14
}
fn part1(input: &str) -> Self::Output1 {
let mut grid: Vec<Vec<Space>> = input
.lines()
.map(|line| line.chars().map(|c| c.into()).collect())
.collect();
tilt_north(&mut grid);
calculate_load(&grid)
}
fn part2(input: &str) -> Self::Output2 {
let mut grid: Vec<Vec<Space>> = input
.lines()
.map(|line| line.chars().map(|c| c.into()).collect())
.collect();
let mut cache = HashMap::new();
let mut cycles = 0;
let loop_length = loop {
cycle(&mut grid);
cycles += 1;
// Calculate the hash of the current state
let mut hash = DefaultHasher::new();
grid.hash(&mut hash);
let hash = hash.finish();
// Check if we have encountered this state before
if let Some(c) = cache.get(&hash) {
break cycles - c;
}
// Insert the state in the map
cache.insert(hash, cycles);
};
let remaining = (1000000000 - cycles) % loop_length;
for _ in 0..remaining {
cycle(&mut grid);
}
calculate_load(&grid)
}
}

159
2023/src/bin/day15.rs Normal file
View File

@@ -0,0 +1,159 @@
#![feature(test)]
use std::cmp::Ordering;
use anyhow::Result;
use aoc::Solver;
// -- Runners --
fn main() -> Result<()> {
Day::solve()
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn part1_test1() -> Result<()> {
Day::test(Day::part1, "test-1", 1320)
}
#[test]
fn part1_solution() -> Result<()> {
Day::test(Day::part1, "input", 511416)
}
#[test]
fn part2_test1() -> Result<()> {
Day::test(Day::part2, "test-1", 145)
}
#[test]
fn part2_solution() -> Result<()> {
Day::test(Day::part2, "input", 290779)
}
// Benchmarks
extern crate test;
#[bench]
#[ignore]
fn part1_bench(b: &mut test::Bencher) {
Day::benchmark(Day::part1, b)
}
#[bench]
#[ignore]
fn part2_bench(b: &mut test::Bencher) {
Day::benchmark(Day::part2, b)
}
}
#[derive(Debug, Clone, PartialEq, Eq)]
enum Action<'a> {
Add { label: &'a str, focal_length: usize },
Remove { label: &'a str },
}
impl<'a> Action<'a> {
fn index(&self) -> usize {
match self {
Action::Add { label, .. } | Action::Remove { label } => label
.chars()
.map(|c| c as usize)
.fold(0, |acc, num| ((acc + num) * 17) % 256),
}
}
}
// -- Solution --
pub struct Day;
impl aoc::Solver for Day {
type Output1 = usize;
type Output2 = usize;
fn day() -> u8 {
15
}
fn part1(input: &str) -> Self::Output1 {
input
.trim()
.split(',')
.map(|sequence| {
sequence
.chars()
.map(|c| c as usize)
.fold(0, |acc, num| ((acc + num) * 17) % 256)
})
.sum()
}
fn part2(input: &str) -> Self::Output2 {
let actions: Vec<_> = input
.trim()
.split(',')
.map(|sequence| {
if sequence.ends_with('-') {
let label = sequence.split_once('-').unwrap().0;
Action::Remove { label }
} else {
let (label, focal_length) = sequence.split_once('=').unwrap();
let focal_length = focal_length.parse().unwrap();
Action::Add {
label,
focal_length,
}
}
})
.collect();
let mut boxes: [Vec<(&str, usize)>; 256] = std::array::from_fn(|_| Vec::new());
for action in &actions {
let index = action.index();
match action {
Action::Add {
label,
focal_length,
} => {
// NOTE: Using a library like OrderedMap would make this trivially easy
if let Some(position) = boxes[index]
.iter()
.position(|lens| lens.0.cmp(label) == Ordering::Equal)
{
// If a lens with this label is already in the box, replace it
boxes[index][position].1 = *focal_length;
} else {
// Otherwise add it to the end of the box
boxes[index].push((label, *focal_length));
}
}
Action::Remove { label } => {
if let Some(position) = boxes[index]
.iter()
.position(|lens| lens.0.cmp(label) == Ordering::Equal)
{
// A lens with the label exists, remove it
boxes[index].remove(position);
}
}
}
}
boxes
.iter()
.enumerate()
.map(|(index, b)| {
b.iter()
.enumerate()
.map(|(position, (_, focal_length))| {
(1 + index) * (1 + position) * focal_length
})
.sum::<usize>()
})
.sum()
}
}

200
2023/src/bin/day16.rs Normal file
View File

@@ -0,0 +1,200 @@
#![feature(test)]
use std::collections::{HashMap, HashSet};
use anyhow::Result;
use aoc::Solver;
// -- Runners --
fn main() -> Result<()> {
Day::solve()
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn part1_test1() -> Result<()> {
Day::test(Day::part1, "test-1", 46)
}
#[test]
fn part1_solution() -> Result<()> {
Day::test(Day::part1, "input", 8021)
}
#[test]
fn part2_test1() -> Result<()> {
Day::test(Day::part2, "test-1", 51)
}
#[test]
fn part2_solution() -> Result<()> {
Day::test(Day::part2, "input", 8216)
}
// Benchmarks
extern crate test;
#[bench]
#[ignore]
fn part1_bench(b: &mut test::Bencher) {
Day::benchmark(Day::part1, b)
}
#[bench]
#[ignore]
fn part2_bench(b: &mut test::Bencher) {
Day::benchmark(Day::part2, b)
}
}
fn energize(
mut position: (isize, isize),
mut direction: (isize, isize),
size: (isize, isize),
map: &HashMap<(isize, isize), char>,
energized: &mut HashSet<((isize, isize), (isize, isize))>,
) {
while position.0 >= 0 && position.0 < size.0 && position.1 >= 0 && position.1 < size.1 {
if !energized.insert((position, direction)) {
// We already proccessed this path before
break;
}
if let Some(c) = map.get(&position) {
direction = match (c, direction) {
('\\', (1, 0)) => (0, 1),
('\\', (-1, 0)) => (0, -1),
('\\', (0, 1)) => (1, 0),
('\\', (0, -1)) => (-1, 0),
('/', (1, 0)) => (0, -1),
('/', (-1, 0)) => (0, 1),
('/', (0, 1)) => (-1, 0),
('/', (0, -1)) => (1, 0),
('-', (1 | -1, 0)) => direction,
('-', (0, 1 | -1)) => {
energize((position.0 - 1, position.1), (-1, 0), size, map, energized);
energize((position.0 + 1, position.1), (1, 0), size, map, energized);
break;
}
('|', (1 | -1, 0)) => {
energize((position.0, position.1 - 1), (0, -1), size, map, energized);
energize((position.0, position.1 + 1), (0, 1), size, map, energized);
break;
}
('|', (0, 1 | -1)) => direction,
_ => unreachable!("Invalid state"),
};
}
position.0 += direction.0;
position.1 += direction.1;
}
}
fn energized(
start: (isize, isize),
direction: (isize, isize),
size: (isize, isize),
map: &HashMap<(isize, isize), char>,
) -> usize {
let mut energized = HashSet::new();
energize(start, direction, size, &map, &mut energized);
energized
.iter()
.map(|(position, _)| position)
.collect::<HashSet<_>>()
.len()
}
// -- Solution --
pub struct Day;
impl aoc::Solver for Day {
type Output1 = usize;
type Output2 = usize;
fn day() -> u8 {
16
}
fn part1(input: &str) -> Self::Output1 {
let mut width = 0;
let mut height = 0;
let map = input
.lines()
.enumerate()
.flat_map(|(y, line)| {
let y = y as isize;
if y + 1 > height {
height = y + 1;
}
line.chars()
.enumerate()
.filter_map(|(x, c)| {
let x = x as isize;
if x + 1 > width {
width = x + 1;
}
match c {
'.' => None,
'\\' | '/' | '|' | '-' => Some(((x, y), c)),
_ => unreachable!(),
}
})
.collect::<Vec<_>>()
})
.collect::<HashMap<_, _>>();
energized((0, 0), (1, 0), (width, height), &map)
}
fn part2(input: &str) -> Self::Output2 {
let mut width = 0;
let mut height = 0;
let map = input
.lines()
.enumerate()
.flat_map(|(y, line)| {
let y = y as isize;
if y + 1 > height {
height = y + 1;
}
line.chars()
.enumerate()
.filter_map(|(x, c)| {
let x = x as isize;
if x + 1 > width {
width = x + 1;
}
match c {
'.' => None,
'\\' | '/' | '|' | '-' => Some(((x, y), c)),
_ => unreachable!(),
}
})
.collect::<Vec<_>>()
})
.collect::<HashMap<_, _>>();
let mut max = 0;
for x in 0..width {
let a = energized((x, 0), (0, 1), (width, height), &map);
let b = energized((x, height - 1), (0, -1), (width, height), &map);
max = std::cmp::max(max, std::cmp::max(a, b));
}
for y in 0..height {
let a = energized((0, y), (1, 0), (width, height), &map);
let b = energized((width - 1, y), (-1, 0), (width, height), &map);
max = std::cmp::max(max, std::cmp::max(a, b));
}
max
}
}

341
2023/src/bin/day17.rs Normal file
View File

@@ -0,0 +1,341 @@
#![feature(test)]
#![feature(let_chains)]
use std::collections::{HashMap, HashSet};
use anyhow::Result;
use aoc::Solver;
// -- Runners --
fn main() -> Result<()> {
Day::solve()
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn part1_test1() -> Result<()> {
Day::test(Day::part1, "test-1", 102)
}
#[test]
fn part1_solution() -> Result<()> {
Day::test(Day::part1, "input", 1256)
}
#[test]
fn part2_test1() -> Result<()> {
Day::test(Day::part2, "test-1", 94)
}
#[test]
fn part2_test2() -> Result<()> {
Day::test(Day::part2, "test-2", 71)
}
#[test]
fn part2_solution() -> Result<()> {
Day::test(Day::part2, "input", 1382)
}
// Benchmarks
extern crate test;
#[bench]
#[ignore]
fn part1_bench(b: &mut test::Bencher) {
Day::benchmark(Day::part1, b)
}
#[bench]
#[ignore]
fn part2_bench(b: &mut test::Bencher) {
Day::benchmark(Day::part2, b)
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
struct Key {
pos_x: usize,
pos_y: usize,
dir_x: isize,
dir_y: isize,
}
// -- Solution --
pub struct Day;
impl aoc::Solver for Day {
type Output1 = usize;
type Output2 = usize;
fn day() -> u8 {
17
}
fn part1(input: &str) -> Self::Output1 {
let map: Vec<Vec<_>> = input
.lines()
.map(|line| {
line.chars()
.map(|c| c.to_digit(10).unwrap() as usize)
.collect()
})
.collect();
let size = (map[0].len(), map.len());
let destination = (size.0 - 1, size.1 - 1);
let mut unvisited = HashMap::new();
unvisited.insert(
Key {
pos_x: 0,
pos_y: 0,
dir_x: 0,
dir_y: 0,
},
0,
);
let mut seen = HashSet::new();
loop {
let current = unvisited
.iter()
.min_by_key(|(_key, cost)| *cost)
.map(|(key, cost)| (*key, *cost))
.unwrap();
if current.0.pos_x == destination.0 && current.0.pos_y == destination.1 {
return current.1;
}
// Check above
if current.0.dir_y > -3
&& current.0.dir_y <= 0
&& let Some(y) = current.0.pos_y.checked_sub(1)
{
let x = current.0.pos_x;
let cost = current.1 + map[y][x];
let key = Key {
pos_x: x,
pos_y: y,
dir_x: 0,
dir_y: current.0.dir_y - 1,
};
if let Some(next) = unvisited.get_mut(&key) {
*next = std::cmp::min(*next, cost);
} else if !seen.contains(&key) {
unvisited.insert(key, cost);
}
}
// Check below
let y = current.0.pos_y + 1;
if current.0.dir_y < 3 && current.0.dir_y >= 0 && y < size.1 {
let x = current.0.pos_x;
let cost = current.1 + map[y][x];
let key = Key {
pos_x: x,
pos_y: y,
dir_x: 0,
dir_y: current.0.dir_y + 1,
};
if let Some(next) = unvisited.get_mut(&key) {
*next = std::cmp::min(*next, cost);
} else if !seen.contains(&key) {
unvisited.insert(key, cost);
}
}
// Check left
if current.0.dir_x > -3
&& current.0.dir_x <= 0
&& let Some(x) = current.0.pos_x.checked_sub(1)
{
let y = current.0.pos_y;
let cost = current.1 + map[y][x];
let key = Key {
pos_x: x,
pos_y: y,
dir_x: current.0.dir_x - 1,
dir_y: 0,
};
if let Some(next) = unvisited.get_mut(&key) {
*next = std::cmp::min(*next, cost);
} else if !seen.contains(&key) {
unvisited.insert(key, cost);
}
}
// Check right
let x = current.0.pos_x + 1;
if current.0.dir_x < 3 && current.0.dir_x >= 0 && x < size.0 {
let y = current.0.pos_y;
let cost = current.1 + map[y][x];
let key = Key {
pos_x: x,
pos_y: y,
dir_x: current.0.dir_x + 1,
dir_y: 0,
};
if let Some(next) = unvisited.get_mut(&key) {
*next = std::cmp::min(*next, cost);
} else if !seen.contains(&key) {
unvisited.insert(key, cost);
}
}
// Mark the current node as visited
unvisited.remove(&current.0);
seen.insert(current.0);
}
}
fn part2(input: &str) -> Self::Output2 {
let map: Vec<Vec<_>> = input
.lines()
.map(|line| {
line.chars()
.map(|c| c.to_digit(10).unwrap() as usize)
.collect()
})
.collect();
let size = (map[0].len(), map.len());
let destination = (size.0 - 1, size.1 - 1);
let mut unvisited = HashMap::new();
unvisited.insert(
Key {
pos_x: 0,
pos_y: 0,
dir_x: 0,
dir_y: 0,
},
0,
);
let mut seen = HashSet::new();
loop {
let current = unvisited
.iter()
.min_by_key(|(_key, cost)| *cost)
.map(|(key, cost)| (*key, *cost))
.unwrap();
if current.0.pos_x == destination.0
&& current.0.pos_y == destination.1
&& (current.0.dir_x >= 4 || current.0.dir_y >= 4)
{
return current.1;
}
// Check above
if current.0.dir_y > -10
&& current.0.dir_y <= 0
&& (current.0.dir_x == 0 || current.0.dir_x >= 4 || current.0.dir_x <= -4)
&& let Some(y) = current.0.pos_y.checked_sub(1)
{
let x = current.0.pos_x;
let cost = current.1 + map[y][x];
let key = Key {
pos_x: x,
pos_y: y,
dir_x: 0,
dir_y: current.0.dir_y - 1,
};
if let Some(next) = unvisited.get_mut(&key) {
*next = std::cmp::min(*next, cost);
} else if !seen.contains(&key) {
unvisited.insert(key, cost);
}
}
// Check below
let y = current.0.pos_y + 1;
if current.0.dir_y < 10
&& current.0.dir_y >= 0
&& (current.0.dir_x == 0 || current.0.dir_x >= 4 || current.0.dir_x <= -4)
&& y < size.1
{
let x = current.0.pos_x;
let cost = current.1 + map[y][x];
let key = Key {
pos_x: x,
pos_y: y,
dir_x: 0,
dir_y: current.0.dir_y + 1,
};
if let Some(next) = unvisited.get_mut(&key) {
*next = std::cmp::min(*next, cost);
} else if !seen.contains(&key) {
unvisited.insert(key, cost);
}
}
// Check left
if current.0.dir_x > -10
&& current.0.dir_x <= 0
&& (current.0.dir_y == 0 || current.0.dir_y >= 4 || current.0.dir_y <= -4)
&& let Some(x) = current.0.pos_x.checked_sub(1)
{
let y = current.0.pos_y;
let cost = current.1 + map[y][x];
let key = Key {
pos_x: x,
pos_y: y,
dir_x: current.0.dir_x - 1,
dir_y: 0,
};
if let Some(next) = unvisited.get_mut(&key) {
*next = std::cmp::min(*next, cost);
} else if !seen.contains(&key) {
unvisited.insert(key, cost);
}
}
// Check right
let x = current.0.pos_x + 1;
if current.0.dir_x < 10
&& current.0.dir_x >= 0
&& (current.0.dir_y == 0 || current.0.dir_y >= 4 || current.0.dir_y <= -4)
&& x < size.0
{
let y = current.0.pos_y;
let cost = current.1 + map[y][x];
let key = Key {
pos_x: x,
pos_y: y,
dir_x: current.0.dir_x + 1,
dir_y: 0,
};
if let Some(next) = unvisited.get_mut(&key) {
*next = std::cmp::min(*next, cost);
} else if !seen.contains(&key) {
unvisited.insert(key, cost);
}
}
// Mark the current node as visited
unvisited.remove(&current.0);
seen.insert(current.0);
}
}
}

151
2023/src/bin/day18.rs Normal file
View File

@@ -0,0 +1,151 @@
#![feature(test)]
use std::{
collections::{HashSet, VecDeque},
fmt::Pointer,
};
use anyhow::Result;
use aoc::Solver;
// -- Runners --
fn main() -> Result<()> {
Day::solve()
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn part1_test1() -> Result<()> {
Day::test(Day::part1, "test-1", 62)
}
#[test]
fn part1_solution() -> Result<()> {
Day::test(Day::part1, "input", 95356)
}
#[test]
fn part2_test1() -> Result<()> {
Day::test(Day::part2, "test-1", 952408144115)
}
#[test]
fn part2_solution() -> Result<()> {
Day::test(Day::part2, "input", 92291468914147)
}
// Benchmarks
extern crate test;
#[bench]
#[ignore]
fn part1_bench(b: &mut test::Bencher) {
Day::benchmark(Day::part1, b)
}
#[bench]
#[ignore]
fn part2_bench(b: &mut test::Bencher) {
Day::benchmark(Day::part2, b)
}
}
// -- Solution --
pub struct Day;
impl aoc::Solver for Day {
type Output1 = usize;
type Output2 = usize;
fn day() -> u8 {
18
}
fn part1(input: &str) -> Self::Output1 {
let instructions: Vec<_> = input
.lines()
.map(|line| {
let (direction, rest) = line.split_once(' ').unwrap();
let direction = direction.chars().next().unwrap();
let (distance, _) = rest.split_once(" (#").unwrap();
let distance: usize = distance.parse().unwrap();
(direction, distance)
})
.collect();
let mut location = (0_isize, 0_isize);
let mut points = Vec::new();
let mut boundary = 0;
for (direction, distance) in &instructions {
for _ in 0..*distance {
match direction {
'U' => location.1 -= 1,
'D' => location.1 += 1,
'L' => location.0 -= 1,
'R' => location.0 += 1,
_ => unreachable!("Invalid input"),
}
}
boundary += distance;
points.push(location);
}
let mut area = 0;
for i in 0..points.len() as isize {
let n_min = (i - 1).rem_euclid(points.len() as isize);
let n_plus = (i + 1).rem_euclid(points.len() as isize);
area += points[i as usize].1 * (points[n_min as usize].0 - points[n_plus as usize].0);
}
let area = area as usize / 2;
let interior = area - boundary / 2 + 1;
interior + boundary
}
fn part2(input: &str) -> Self::Output2 {
let instructions: Vec<_> = input
.lines()
.map(|line| {
let (_, rest) = line.split_once(' ').unwrap();
let (_, rest) = rest.split_once(" (#").unwrap();
let (distance, direction) = rest.split_at(5);
let distance = usize::from_str_radix(distance, 16).unwrap();
let direction = direction.chars().next().unwrap();
(direction, distance)
})
.collect();
let mut location = (0_isize, 0_isize);
let mut points = Vec::new();
let mut boundary = 0;
for (direction, distance) in &instructions {
for _ in 0..*distance {
match direction {
'3' => location.1 -= 1,
'1' => location.1 += 1,
'2' => location.0 -= 1,
'0' => location.0 += 1,
_ => unreachable!("Invalid input"),
}
}
boundary += distance;
points.push(location);
}
let mut area = 0;
for i in 0..points.len() as isize {
let n_min = (i - 1).rem_euclid(points.len() as isize);
let n_plus = (i + 1).rem_euclid(points.len() as isize);
area += points[i as usize].1 * (points[n_min as usize].0 - points[n_plus as usize].0);
}
let area = area as usize / 2;
area + boundary / 2 + 1
}
}

368
2023/src/bin/day19.rs Normal file
View File

@@ -0,0 +1,368 @@
#![feature(test)]
use std::collections::{HashMap, VecDeque};
use anyhow::Result;
use aoc::Solver;
// -- Runners --
fn main() -> Result<()> {
Day::solve()
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn part1_test1() -> Result<()> {
Day::test(Day::part1, "test-1", 19114)
}
#[test]
fn part1_solution() -> Result<()> {
Day::test(Day::part1, "input", 480738)
}
#[test]
fn part2_test1() -> Result<()> {
Day::test(Day::part2, "test-1", 167409079868000)
}
#[test]
fn part2_solution() -> Result<()> {
Day::test(Day::part2, "input", 131550418841958)
}
// Benchmarks
extern crate test;
#[bench]
#[ignore]
fn part1_bench(b: &mut test::Bencher) {
Day::benchmark(Day::part1, b)
}
#[bench]
#[ignore]
fn part2_bench(b: &mut test::Bencher) {
Day::benchmark(Day::part2, b)
}
}
#[derive(Debug, Clone, Copy)]
enum Next<'a> {
Step(&'a str),
Accept,
Reject,
}
#[derive(Debug, Clone, Copy)]
struct Part {
x: usize,
m: usize,
a: usize,
s: usize,
}
impl Part {
fn sum(&self) -> usize {
self.x + self.m + self.a + self.s
}
}
#[derive(Debug, Clone, Copy)]
struct Part2 {
x: (usize, usize),
m: (usize, usize),
a: (usize, usize),
s: (usize, usize),
}
impl Part2 {
fn split(&self, category: Category, value: usize) -> (Option<Part2>, Option<Part2>) {
let range = match category {
Category::Cool => self.x,
Category::Musical => self.m,
Category::Aerodynamic => self.a,
Category::Shiny => self.s,
};
let ranges = if range.0 > value {
(None, Some(range))
} else if range.1 < value {
(Some(range), None)
} else {
(Some((range.0, value - 1)), Some((value, range.1)))
};
(
self.replace(category, ranges.0),
self.replace(category, ranges.1),
)
}
fn replace(&self, category: Category, range: Option<(usize, usize)>) -> Option<Part2> {
range.map(|range| match category {
Category::Cool => Part2 {
x: range,
m: self.m,
a: self.a,
s: self.s,
},
Category::Musical => Part2 {
x: self.x,
m: range,
a: self.a,
s: self.s,
},
Category::Aerodynamic => Part2 {
x: self.x,
m: self.m,
a: range,
s: self.s,
},
Category::Shiny => Part2 {
x: self.x,
m: self.m,
a: self.a,
s: range,
},
})
}
fn combinations(&self) -> usize {
(self.x.1 - self.x.0 + 1)
* (self.m.1 - self.m.0 + 1)
* (self.a.1 - self.a.0 + 1)
* (self.s.1 - self.s.0 + 1)
}
}
#[derive(Debug, Clone, Copy)]
enum Operator {
GreaterThan(Category, usize),
LessThan(Category, usize),
Otherwise,
}
#[derive(Debug, Clone, Copy)]
enum Category {
Cool,
Musical,
Aerodynamic,
Shiny,
}
#[derive(Debug, Clone, Copy)]
struct Step<'a> {
op: Operator,
next: Next<'a>,
}
impl<'a> Step<'a> {
fn process(&self, part: &Part) -> Option<Next<'a>> {
let ok = match self.op {
Operator::GreaterThan(Category::Cool, value) => part.x > value,
Operator::GreaterThan(Category::Musical, value) => part.m > value,
Operator::GreaterThan(Category::Aerodynamic, value) => part.a > value,
Operator::GreaterThan(Category::Shiny, value) => part.s > value,
Operator::LessThan(Category::Cool, value) => part.x < value,
Operator::LessThan(Category::Musical, value) => part.m < value,
Operator::LessThan(Category::Aerodynamic, value) => part.a < value,
Operator::LessThan(Category::Shiny, value) => part.s < value,
Operator::Otherwise => true,
};
if ok {
Some(self.next)
} else {
None
}
}
}
fn process_step(step: &str) -> Step {
if let Some((instruction, next)) = step.split_once(':') {
let next = match next {
"A" => Next::Accept,
"R" => Next::Reject,
n => Next::Step(n),
};
let (category, value) = instruction.split_once(['<', '>']).unwrap();
let category = match category {
"x" => Category::Cool,
"m" => Category::Musical,
"a" => Category::Aerodynamic,
"s" => Category::Shiny,
_ => unreachable!("Invalid input"),
};
let value = value.parse().unwrap();
let op = if instruction.contains('<') {
Operator::LessThan(category, value)
} else {
Operator::GreaterThan(category, value)
};
Step { op, next }
} else {
let next = match step {
"A" => Next::Accept,
"R" => Next::Reject,
n => Next::Step(n),
};
Step {
op: Operator::Otherwise,
next,
}
}
}
// -- Solution --
pub struct Day;
impl aoc::Solver for Day {
type Output1 = usize;
type Output2 = usize;
fn day() -> u8 {
19
}
fn part1(input: &str) -> Self::Output1 {
let (workflows, parts) = input.split_once("\n\n").unwrap();
let workflows = workflows
.lines()
.map(|workflow| {
let (name, mut rest) = workflow.split_once('{').unwrap();
let mut steps = Vec::new();
while let Some((step, remaining)) = rest.split_once(',') {
rest = remaining;
steps.push(process_step(step));
}
steps.push(process_step(rest.split_once('}').unwrap().0));
(name, steps)
})
.collect::<HashMap<_, _>>();
let parts = parts
.lines()
.map(|part| {
let part: Vec<usize> = part
.split_once('{')
.unwrap()
.1
.split_once('}')
.unwrap()
.0
.splitn(4, ',')
.map(|category| category.split_once('=').unwrap().1.parse().unwrap())
.collect();
if let [x, m, a, s] = part.as_slice() {
Part {
x: *x,
m: *m,
a: *a,
s: *s,
}
} else {
unreachable!("Invalid input");
}
})
.collect::<Vec<_>>();
parts
.iter()
.map(|part| {
let mut workflow = workflows.get("in").unwrap();
while let Some(next) = workflow.iter().find_map(|step| step.process(part)) {
match next {
Next::Step(name) => workflow = workflows.get(name).unwrap(),
Next::Accept => return part.sum(),
Next::Reject => return 0,
}
}
0
})
.sum()
}
fn part2(input: &str) -> Self::Output2 {
let (workflows, _) = input.split_once("\n\n").unwrap();
let workflows = workflows
.lines()
.map(|workflow| {
let (name, mut rest) = workflow.split_once('{').unwrap();
let mut steps = Vec::new();
while let Some((step, remaining)) = rest.split_once(',') {
rest = remaining;
steps.push(process_step(step));
}
steps.push(process_step(rest.split_once('}').unwrap().0));
(name, steps)
})
.collect::<HashMap<_, _>>();
let part = Part2 {
x: (1, 4000),
m: (1, 4000),
a: (1, 4000),
s: (1, 4000),
};
let mut queue = VecDeque::new();
queue.push_back((part, "in"));
let mut combinations = 0;
while let Some((mut part, name)) = queue.pop_front() {
let workflow = workflows.get(name).unwrap();
for step in workflow {
let (ok, fail) = match step.op {
Operator::GreaterThan(category, value) => {
let (a, b) = part.split(category, value + 1);
(b, a)
}
Operator::LessThan(category, value) => {
let (a, b) = part.split(category, value);
(a, b)
}
Operator::Otherwise => (Some(part), None),
};
// The part that matches goes to the next workflow
if let Some(ok) = ok {
match step.next {
Next::Step(name) => queue.push_back((ok, name)),
Next::Accept => {
let a = ok.combinations();
combinations += a;
}
Next::Reject => {}
}
}
// The part that failed goes to the next step
if let Some(fail) = fail {
part = fail;
}
}
}
combinations
}
}

274
2023/src/bin/day20.rs Normal file
View File

@@ -0,0 +1,274 @@
#![feature(test)]
use std::collections::{HashMap, VecDeque};
use anyhow::Result;
use aoc::Solver;
// -- Runners --
fn main() -> Result<()> {
Day::solve()
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn part1_test1() -> Result<()> {
Day::test(Day::part1, "test-1", 32000000)
}
#[test]
fn part1_test2() -> Result<()> {
Day::test(Day::part1, "test-2", 11687500)
}
#[test]
fn part1_solution() -> Result<()> {
Day::test(Day::part1, "input", 666795063)
}
#[test]
fn part2_solution() -> Result<()> {
Day::test(Day::part2, "input", 253302889093151)
}
// Benchmarks
extern crate test;
#[bench]
#[ignore]
fn part1_bench(b: &mut test::Bencher) {
Day::benchmark(Day::part1, b)
}
#[bench]
#[ignore]
fn part2_bench(b: &mut test::Bencher) {
Day::benchmark(Day::part2, b)
}
}
#[derive(Debug, Clone)]
enum ModuleType<'a> {
Broadcaster,
FlipFlop(bool),
Conjunction(HashMap<&'a str, bool>),
}
#[derive(Debug, Clone)]
struct Module<'a> {
module_type: ModuleType<'a>,
destinations: Vec<&'a str>,
}
impl<'a> Module<'a> {
fn process(&mut self, source: &'a str, high: bool) -> Option<bool> {
match &mut self.module_type {
ModuleType::Broadcaster => Some(high),
ModuleType::FlipFlop(current) => {
if high {
None
} else {
*current = !*current;
Some(*current)
}
}
ModuleType::Conjunction(inputs) => {
let input = inputs.get_mut(source).unwrap();
*input = high;
Some(!inputs.iter().all(|(_, prev)| *prev))
}
}
}
}
#[derive(Debug, Clone)]
struct Pulse<'a> {
source: &'a str,
destination: &'a str,
high: bool,
}
// Copied from day 8
fn gcd(a: usize, b: usize) -> usize {
if b == 0 {
return a;
}
gcd(b, a % b)
}
// Copied from day 8
fn lcm(a: usize, b: usize) -> usize {
if a > b {
(a / gcd(a, b)) * b
} else {
(b / gcd(a, b)) * a
}
}
// -- Solution --
pub struct Day;
impl aoc::Solver for Day {
type Output1 = usize;
type Output2 = usize;
fn day() -> u8 {
20
}
fn part1(input: &str) -> Self::Output1 {
let mut modules: HashMap<_, _> = input
.lines()
.map(|line| {
let (name, destinations) = line.split_once(" -> ").unwrap();
let destinations: Vec<_> = destinations.split(", ").collect();
let (name, module_type) = if name.starts_with('%') {
(name.split_at(1).1, ModuleType::FlipFlop(false))
} else if name.starts_with('&') {
(name.split_at(1).1, ModuleType::Conjunction(HashMap::new()))
} else if name == "broadcaster" {
(name, ModuleType::Broadcaster)
} else {
unreachable!("Invalid input");
};
(
name,
Module {
module_type,
destinations,
},
)
})
.collect();
// TODO: Because of the borrow check we have to create a clone of modules here
for (name, module) in modules.clone() {
for destination in &module.destinations {
if let Some(module) = modules.get_mut(destination) {
if let ModuleType::Conjunction(inputs) = &mut module.module_type {
inputs.insert(name, false);
}
}
}
}
let mut count = (0, 0);
let mut pulses = VecDeque::new();
for _ in 0..1000 {
pulses.push_back(Pulse {
source: "button",
destination: "broadcaster",
high: false,
});
while let Some(pulse) = pulses.pop_front() {
if pulse.high {
count.1 += 1;
} else {
count.0 += 1;
}
if let Some(module) = modules.get_mut(pulse.destination) {
if let Some(high) = module.process(pulse.source, pulse.high) {
for destination in &module.destinations {
pulses.push_back(Pulse {
source: pulse.destination,
destination,
high,
});
}
}
}
}
}
count.0 * count.1
}
fn part2(input: &str) -> Self::Output2 {
let mut modules: HashMap<_, _> = input
.lines()
.map(|line| {
let (name, destinations) = line.split_once(" -> ").unwrap();
let destinations: Vec<_> = destinations.split(", ").collect();
let (name, module_type) = if name.starts_with('%') {
(name.split_at(1).1, ModuleType::FlipFlop(false))
} else if name.starts_with('&') {
(name.split_at(1).1, ModuleType::Conjunction(HashMap::new()))
} else if name == "broadcaster" {
(name, ModuleType::Broadcaster)
} else {
unreachable!("Invalid input");
};
(
name,
Module {
module_type,
destinations,
},
)
})
.collect();
// TODO: Because of the borrow check we have to create a clone of modules here
for (name, module) in modules.clone() {
for destination in &module.destinations {
if let Some(module) = modules.get_mut(destination) {
if let ModuleType::Conjunction(inputs) = &mut module.module_type {
inputs.insert(name, false);
}
}
}
}
let r#final = modules
.iter()
.find(|(_, module)| module.destinations.contains(&"rx"))
.unwrap();
let final_name = r#final.0.to_owned();
let final_module = r#final.1.clone();
let mut frequencies = HashMap::new();
println!("{final_name}: {final_module:?}");
let mut pulses = VecDeque::new();
for i in 0..10000 {
pulses.push_back(Pulse {
source: "button",
destination: "broadcaster",
high: false,
});
while let Some(pulse) = pulses.pop_front() {
if let Some(module) = modules.get_mut(pulse.destination) {
if pulse.destination == final_name && pulse.high {
frequencies.insert(pulse.source, i + 1);
if let ModuleType::Conjunction(ref inputs) = final_module.module_type {
if frequencies.len() == inputs.len() {
return frequencies.values().copied().fold(1, lcm);
}
}
}
if let Some(high) = module.process(pulse.source, pulse.high) {
for destination in &module.destinations {
pulses.push_back(Pulse {
source: pulse.destination,
destination,
high,
});
}
}
}
}
}
unreachable!("No solution found");
}
}

174
2023/src/bin/day21.rs Normal file
View File

@@ -0,0 +1,174 @@
#![feature(test)]
use std::collections::{HashMap, HashSet, VecDeque};
use anyhow::Result;
use aoc::Solver;
// -- Runners --
fn main() -> Result<()> {
Day::solve()
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn part1_test1() -> Result<()> {
// The example only provides an answer for 6 steps. (16)
// This should be the correct answer for running the example with 64 steps
Day::test(Day::part1, "test-1", 42)
}
#[test]
fn part1_solution() -> Result<()> {
Day::test(Day::part1, "input", 3642)
}
// There is no test case for part 2
#[test]
fn part2_solution() -> Result<()> {
Day::test(Day::part2, "input", 608603023105276)
}
// Benchmarks
extern crate test;
#[bench]
#[ignore]
fn part1_bench(b: &mut test::Bencher) {
Day::benchmark(Day::part1, b)
}
#[bench]
#[ignore]
fn part2_bench(b: &mut test::Bencher) {
Day::benchmark(Day::part2, b)
}
}
// -- Solution --
pub struct Day;
impl aoc::Solver for Day {
type Output1 = usize;
type Output2 = isize;
fn day() -> u8 {
21
}
fn part1(input: &str) -> Self::Output1 {
let mut queue = Vec::new();
let map: HashMap<(isize, isize), char> = input
.lines()
.enumerate()
.flat_map(|(y, line)| {
line.chars()
.enumerate()
.map(|(x, mut c)| {
if c == 'S' {
queue.push((x as isize, y as isize));
c = '.';
}
((x as isize, y as isize), c)
})
.collect::<Vec<_>>()
})
.collect();
let mut set = HashSet::new();
let directions = [(-1, 0), (1, 0), (0, -1), (0, 1)];
for _ in 0..64 {
while let Some(step) = queue.pop() {
for direction in directions {
let next = (step.0 + direction.0, step.1 + direction.1);
// If the tile is free add it to the queue
if let Some(&tile) = map.get(&next) {
if tile == '.' {
set.insert(next);
}
}
}
}
queue = set.into_iter().collect();
set = HashSet::new();
}
queue.len()
}
fn part2(input: &str) -> Self::Output2 {
// All maps are square
let size = input.lines().count();
// Map is square: 131 x 131 => size = 131
// !!! Others have observed 26501365 = 202300 * size + size/2 !!!
// Is there a pattern for i * size + size/2?
// i = 0 => 3776
// i = 1 => 33652
// i = 2 => 93270
// Is there a function of i that can fit to this?
// Yes => Quadratic equation will fit this
// 3642 - 14737 x + 14871 x^2
// i = 202300 => 608603023105276
// Could not have done this without a hint from Reddit...
let i: isize = 202300;
let mut queue = Vec::new();
let map: HashMap<(isize, isize), char> = input
.lines()
.enumerate()
.flat_map(|(y, line)| {
line.chars()
.enumerate()
.map(|(x, mut c)| {
if c == 'S' {
queue.push((x as isize, y as isize));
c = '.';
}
((x as isize, y as isize), c)
})
.collect::<Vec<_>>()
})
.collect();
let mut nums = Vec::new();
let mut set = HashSet::new();
let directions = [(-1, 0), (1, 0), (0, -1), (0, 1)];
for n in 0..(2 * size + size / 2) {
while let Some(step) = queue.pop() {
for direction in directions {
let next = (step.0 + direction.0, step.1 + direction.1);
let next_wrapped = (
next.0.rem_euclid(size as isize),
next.1.rem_euclid(size as isize),
);
// If the tile is free add it to the queue
if let Some(&tile) = map.get(&next_wrapped) {
if tile == '.' {
set.insert(next);
}
}
}
}
queue = set.into_iter().collect();
set = HashSet::new();
if n + 1 == nums.len() * size + size / 2 {
nums.push(queue.len() as isize);
}
}
// Using linear algebra these solutions can be found
let a = (nums[0] - 2 * nums[1] + nums[2]) / 2;
let b = (4 * nums[1] - 3 * nums[0] - nums[2]) / 2;
let c = nums[0];
a * i.pow(2) + b * i + c
}
}

229
2023/src/bin/day22.rs Normal file
View File

@@ -0,0 +1,229 @@
#![feature(test)]
use std::collections::{HashMap, HashSet};
use anyhow::Result;
use aoc::Solver;
// -- Runners --
fn main() -> Result<()> {
Day::solve()
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn part1_test1() -> Result<()> {
Day::test(Day::part1, "test-1", 5)
}
#[test]
fn part1_solution() -> Result<()> {
Day::test(Day::part1, "input", 488)
}
#[test]
fn part2_test1() -> Result<()> {
Day::test(Day::part2, "test-1", 7)
}
#[test]
fn part2_solution() -> Result<()> {
Day::test(Day::part2, "input", 79465)
}
// Benchmarks
extern crate test;
#[bench]
#[ignore]
fn part1_bench(b: &mut test::Bencher) {
Day::benchmark(Day::part1, b)
}
#[bench]
#[ignore]
fn part2_bench(b: &mut test::Bencher) {
Day::benchmark(Day::part2, b)
}
}
#[derive(Debug, Hash, Clone, Copy, PartialEq, Eq)]
struct Brick {
start: (isize, isize, isize),
end: (isize, isize, isize),
}
impl Brick {
fn fall(
&self,
index: usize,
grid: &mut HashMap<(isize, isize, isize), usize>,
) -> HashSet<usize> {
let mut down = 0;
// Keep track of all the unique bricks supporting the current brick
let mut supports = HashSet::new();
for o in 1..self.start.2 {
for x in self.start.0..=self.end.0 {
for y in self.start.1..=self.end.1 {
for z in self.start.2..=self.end.2 {
if let Some(&support) = grid.get(&(x, y, z - o)) {
supports.insert(support);
}
}
}
}
// We have landed on a support
if !supports.is_empty() {
break;
}
down += 1;
}
// Occupy the space in the grid
for x in self.start.0..=self.end.0 {
for y in self.start.1..=self.end.1 {
for z in self.start.2..=self.end.2 {
grid.insert((x, y, z - down), index);
}
}
}
// Return all the unique supports
supports
}
}
// -- Solution --
pub struct Day;
impl aoc::Solver for Day {
type Output1 = usize;
type Output2 = usize;
fn day() -> u8 {
22
}
fn part1(input: &str) -> Self::Output1 {
let mut bricks: Vec<_> = input
.lines()
.map(|line| {
let (start, end) = line.split_once('~').unwrap();
let start: Vec<_> = start
.splitn(3, ',')
.map(|num| num.parse::<isize>().unwrap())
.collect();
let start = (start[0], start[1], start[2]);
let end: Vec<_> = end
.splitn(3, ',')
.map(|num| num.parse::<isize>().unwrap())
.collect();
let end = (end[0], end[1], end[2]);
Brick { start, end }
})
.collect();
// Sort the bricks from top to bottom
bricks.sort_by(|a, b| a.start.2.cmp(&b.start.2));
// Figure out which bricks are essential and can not be disintegrated
let mut grid = HashMap::new();
let essential_bricks: HashSet<_> = bricks
.iter()
.enumerate()
// Drop down each brick and get all the supporting bricks
.map(|(index, brick)| brick.fall(index, &mut grid))
// Only keep bricks that are supported by one other brick
// If that other brick is disintegrated this brick will fall
.filter(|supports| supports.len() == 1)
// Flatten out and collect to take out duplicate entries
.flatten()
.collect();
bricks.len() - essential_bricks.len()
}
fn part2(input: &str) -> Self::Output2 {
let mut bricks: Vec<_> = input
.lines()
.map(|line| {
let (start, end) = line.split_once('~').unwrap();
let start: Vec<_> = start
.splitn(3, ',')
.map(|num| num.parse::<isize>().unwrap())
.collect();
let start = (start[0], start[1], start[2]);
let end: Vec<_> = end
.splitn(3, ',')
.map(|num| num.parse::<isize>().unwrap())
.collect();
let end = (end[0], end[1], end[2]);
Brick { start, end }
})
.collect();
// Sort the bricks from top to bottom
bricks.sort_by(|a, b| a.start.2.cmp(&b.start.2));
// Figure out which bricks are essential and can not be disintegrated
let mut grid = HashMap::new();
let supports: Vec<_> = bricks
.iter()
.enumerate()
// Drop down each brick and get all the supporting bricks
.map(|(index, brick)| brick.fall(index, &mut grid))
.collect();
let essential_bricks: HashSet<_> = supports
.iter()
.filter(|supports| supports.len() == 1)
// Flatten out and collect to take out duplicate entries
.flatten()
.collect();
let mut sum = 0;
for eliminate in essential_bricks {
let mut falling = HashSet::new();
falling.insert(*eliminate);
let mut previous = 0;
while previous != falling.len() {
previous = falling.len();
let new: HashSet<_> = supports
.iter()
.enumerate()
.filter(|(_, supports)| {
if supports.is_empty() {
return false;
}
for support in *supports {
if !falling.contains(support) {
return false;
}
}
true
})
.map(|(index, _)| index)
.collect();
falling.extend(new);
}
if !falling.is_empty() {
sum += falling.len() - 1;
}
}
sum
}
}

169
2023/src/bin/day23.rs Normal file
View File

@@ -0,0 +1,169 @@
#![feature(test)]
use std::collections::HashSet;
use anyhow::Result;
use aoc::Solver;
// -- Runners --
fn main() -> Result<()> {
Day::solve()
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn part1_test1() -> Result<()> {
Day::test(Day::part1, "test-1", 94)
}
#[test]
fn part1_solution() -> Result<()> {
Day::test(Day::part1, "input", 2130)
}
#[test]
fn part2_test1() -> Result<()> {
Day::test(Day::part2, "test-1", 154)
}
#[test]
fn part2_solution() -> Result<()> {
Day::test(Day::part2, "input", 6710)
}
// Benchmarks
extern crate test;
#[bench]
#[ignore]
fn part1_bench(b: &mut test::Bencher) {
Day::benchmark(Day::part1, b)
}
#[bench]
#[ignore]
fn part2_bench(b: &mut test::Bencher) {
Day::benchmark(Day::part2, b)
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
enum Tile {
Path,
Forest,
Up,
Down,
Left,
Right,
}
fn find_path(
position: (isize, isize),
end: (isize, isize),
map: &Vec<Vec<Tile>>,
visited: &mut Vec<Vec<bool>>,
slippery: bool,
) -> (usize, (isize, isize)) {
visited[position.1 as usize][position.0 as usize] = true;
let size = (map[0].len() as isize, map.len() as isize);
let mut final_position = position;
let directions = [(0, -1), (0, 1), (-1, 0), (1, 0)];
let mut steps = 0;
for direction in directions {
let next_position = (position.0 + direction.0, position.1 + direction.1);
if next_position.0 < 0
|| next_position.1 < 0
|| next_position.0 >= size.0
|| next_position.1 >= size.1
|| visited[next_position.1 as usize][next_position.0 as usize]
{
continue;
}
let tile = map[next_position.1 as usize][next_position.0 as usize];
if tile == Tile::Forest {
continue;
}
if slippery
&& (tile == Tile::Up && direction != (0, -1)
|| tile == Tile::Down && direction != (0, 1)
|| tile == Tile::Left && direction != (-1, 0)
|| tile == Tile::Right && direction != (1, 0))
{
continue;
}
let (mut a, b) = find_path(next_position, end, map, visited, slippery);
a += 1;
if a > steps && b == end {
steps = a;
final_position = b;
}
}
visited[position.1 as usize][position.0 as usize] = false;
(steps, final_position)
}
// -- Solution --
pub struct Day;
impl aoc::Solver for Day {
type Output1 = usize;
type Output2 = usize;
fn day() -> u8 {
23
}
fn part1(input: &str) -> Self::Output1 {
let map: Vec<Vec<_>> = input
.lines()
.map(|line| {
line.chars()
.map(|c| match c {
'.' => Tile::Path,
'#' => Tile::Forest,
'^' => Tile::Up,
'v' => Tile::Down,
'<' => Tile::Left,
'>' => Tile::Right,
_ => unreachable!("Invalid input"),
})
.collect()
})
.collect();
let size = (map[0].len() as isize, map.len() as isize);
let mut visited = vec![vec![false; size.0 as usize]; size.1 as usize];
find_path((1, 0), (size.0 - 2, size.1 - 1), &map, &mut visited, true).0
}
fn part2(input: &str) -> Self::Output2 {
let map: Vec<Vec<_>> = input
.lines()
.map(|line| {
line.chars()
.map(|c| match c {
'.' => Tile::Path,
'#' => Tile::Forest,
'^' => Tile::Up,
'v' => Tile::Down,
'<' => Tile::Left,
'>' => Tile::Right,
_ => unreachable!("Invalid input"),
})
.collect()
})
.collect();
let size = (map[0].len() as isize, map.len() as isize);
let mut visited = vec![vec![false; size.0 as usize]; size.1 as usize];
find_path((1, 0), (size.0 - 2, size.1 - 1), &map, &mut visited, false).0
}
}

235
2023/src/bin/day24.rs Normal file
View File

@@ -0,0 +1,235 @@
#![feature(test)]
extern crate nalgebra as na;
use std::{collections::HashMap, convert::Infallible, str::FromStr};
use anyhow::Result;
use aoc::Solver;
use na::{Matrix6, Vector6};
// -- Runners --
fn main() -> Result<()> {
Day::solve()
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn part1_test1() -> Result<()> {
Day::test(Day::part1, "test-1", 2)
}
#[test]
fn part1_solution() -> Result<()> {
Day::test(Day::part1, "input", 13149)
}
#[test]
fn part2_test1() -> Result<()> {
Day::test(Day::part2, "test-1", 47)
}
#[test]
fn part2_solution() -> Result<()> {
Day::test(Day::part2, "input", 1033770143421619)
}
// Benchmarks
extern crate test;
#[bench]
#[ignore]
fn part1_bench(b: &mut test::Bencher) {
Day::benchmark(Day::part1, b)
}
#[bench]
#[ignore]
fn part2_bench(b: &mut test::Bencher) {
Day::benchmark(Day::part2, b)
}
}
#[derive(Debug, Clone, Copy)]
struct Hailstone {
px: f64,
py: f64,
pz: f64,
vx: f64,
vy: f64,
vz: f64,
}
impl Hailstone {
fn intersect_2d(&self, other: &Hailstone) -> Option<(f64, f64)> {
let dx = self.px - other.px;
let dy = self.py - other.py;
let d = self.vy * other.vx - self.vx * other.vy;
let t1 = (other.vy * dx - other.vx * dy) / d;
let t2 = (self.vy * dx - self.vx * dy) / d;
if t1.is_sign_negative() || t2.is_sign_negative() {
// Intersection is in the past
return None;
}
let x = self.px + self.vx * t1;
let y = self.py + self.vy * t1;
if x.is_infinite() || y.is_infinite() {
// Paths are parallel
return None;
}
Some((x, y))
}
}
impl FromStr for Hailstone {
type Err = Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
let parts: Vec<f64> = s
.split([',', '@'])
.map(|part| part.trim().parse().unwrap())
.collect();
Ok(Hailstone {
px: parts[0],
py: parts[1],
pz: parts[2],
vx: parts[3],
vy: parts[4],
vz: parts[5],
})
}
}
fn mode(numbers: &[usize]) -> usize {
let mut occurrences = HashMap::<_, usize>::new();
for &value in numbers {
*occurrences.entry(value).or_insert(0) += 1;
}
occurrences
.into_iter()
.max_by_key(|&(_, count)| count)
.map(|(value, _)| value)
.unwrap()
}
// -- Solution --
pub struct Day;
impl aoc::Solver for Day {
type Output1 = usize;
type Output2 = usize;
fn day() -> u8 {
24
}
fn part1(input: &str) -> Self::Output1 {
let hailstones: Vec<_> = input.lines().flat_map(Hailstone::from_str).collect();
let range = if hailstones.len() == 5 {
7.0..=27.0
} else {
200000000000000.0..=400000000000000.0
};
hailstones
.iter()
.enumerate()
.flat_map(|(index_a, a)| {
hailstones
.iter()
.enumerate()
.filter(|(index_b, _)| index_b < &index_a)
.filter_map(|(_, b)| a.intersect_2d(b))
.collect::<Vec<_>>()
})
.filter(|&(x, y)| range.contains(&x) && range.contains(&y))
.count()
}
fn part2(input: &str) -> Self::Output2 {
let h: Vec<_> = input.lines().flat_map(Hailstone::from_str).collect();
// Key insight for part 2 is
// p_rock + v_rock * t_i = p_i + v_i * t_i
// for every hailstone i
//
// This can be rewritten as
// p_rock - p_i = t_i * (v_i - v_rock)
// and since t_i is a scalar this means that
// (p_rock - p_i) is parallel to (v_i - v_rock)
// and therefore
// c_i = (p_rock - p_i) x (v_i - v_rock) = 0
// This holds true for every hailstone i, so
// c_i = c_j
// c_i = c_k
// with i != j != k
// Writing out these equations leads to a set of six linear equations
// And can therefore be written in matrix form
// A * solution = constant
// And the solution can now be found using
// solution = A^-1 * constant
let i = 0;
let j = 1;
// Due to numerical instability we run this with several different options for the third
// hailstone
let solutions: Vec<_> = (2..h.len())
.map(|k| {
// Constant in the matrix
let c1 = h[i].vz - h[j].vz;
let c2 = h[i].py - h[j].py;
let c3 = h[j].vy - h[i].vy;
let c4 = h[j].pz - h[i].pz;
let c5 = h[i].vx - h[j].vx;
let c6 = h[j].px - h[i].px;
let c7 = h[i].vz - h[k].vz;
let c8 = h[i].py - h[k].py;
let c9 = h[k].vy - h[i].vy;
let c10 = h[k].pz - h[i].pz;
let c11 = h[i].vx - h[k].vx;
let c12 = h[k].px - h[i].px;
// Setup the matrix
let matrix = Matrix6::new(
0.0, c1, c3, 0.0, c4, c2, -c1, 0.0, c5, -c4, 0.0, c6, -c3, -c5, 0.0, -c2, -c6,
0.0, 0.0, c7, c9, 0.0, c10, c8, -c7, 0.0, c11, -c10, 0.0, c12, -c9, -c11, 0.0,
-c8, -c12, 0.0,
);
// Constant on the rhs
let k1 =
h[i].py * h[i].vz - h[j].py * h[j].vz + h[j].pz * h[j].vy - h[i].pz * h[i].vy;
let k2 =
h[i].pz * h[i].vx - h[j].pz * h[j].vx + h[j].px * h[j].vz - h[i].px * h[i].vz;
let k3 =
h[i].px * h[i].vy - h[j].px * h[j].vy + h[j].py * h[j].vx - h[i].py * h[i].vx;
let k4 =
h[i].py * h[i].vz - h[k].py * h[k].vz + h[k].pz * h[k].vy - h[i].pz * h[i].vy;
let k5 =
h[i].pz * h[i].vx - h[k].pz * h[k].vx + h[k].px * h[k].vz - h[i].px * h[i].vz;
let k6 =
h[i].px * h[i].vy - h[k].px * h[k].vy + h[k].py * h[k].vx - h[i].py * h[i].vx;
// Put them into a vector
let k = Vector6::new(k1, k2, k3, k4, k5, k6);
let solution = matrix.lu().solve(&k).unwrap();
// The sum of all elements of the starting position is the answer
(solution[0] + solution[1] + solution[2]).round() as usize
})
.collect();
// The most common solution is the actual solution
mode(&solutions)
}
}

172
2023/src/bin/day25.rs Normal file
View File

@@ -0,0 +1,172 @@
#![feature(test)]
#![feature(iter_map_windows)]
use std::collections::{HashMap, HashSet, VecDeque};
use anyhow::Result;
use aoc::Solver;
use petgraph::{
algo::{condensation, has_path_connecting},
graphmap::{GraphMap, UnGraphMap},
visit::IntoNodeReferences,
Undirected,
};
// -- Runners --
fn main() -> Result<()> {
Day::solve()
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn part1_test1() -> Result<()> {
Day::test(Day::part1, "test-1", 54)
}
#[test]
fn part1_solution() -> Result<()> {
Day::test(Day::part1, "input", 552695)
}
// Benchmarks
extern crate test;
#[bench]
#[ignore]
fn part1_bench(b: &mut test::Bencher) {
Day::benchmark(Day::part1, b)
}
#[bench]
#[ignore]
fn part2_bench(b: &mut test::Bencher) {
Day::benchmark(Day::part2, b)
}
}
// Totally copied this from: https://github.com/Zemogus/AOC-2023/blob/328dc6618f3a360c3d3851ad1b10513a6c133336/src/day25.rs
// For some reason the graph library has no dijkstra that returns the actual path
fn find_shortest_path<'a>(
graph: &GraphMap<&'a str, (), Undirected>,
start: &'a str,
end: &'a str,
) -> Option<Vec<&'a str>> {
let mut queue = VecDeque::new();
let mut visited = HashSet::new();
let mut parents = HashMap::new();
queue.push_back(start);
while let Some(node) = queue.pop_front() {
// Already visited this node
if !visited.insert(node) {
continue;
}
// Reached the destination
if node == end {
break;
}
for neighbour in graph.neighbors(node) {
if !visited.contains(neighbour) {
parents.insert(neighbour, node);
queue.push_back(neighbour);
}
}
}
let mut path = Vec::new();
let mut node = end;
while node != start {
path.push(node);
if let Some(parent) = parents.get(&node) {
node = parent;
} else {
return None;
}
}
path.push(start);
Some(path)
}
// -- Solution --
pub struct Day;
impl aoc::Solver for Day {
type Output1 = usize;
type Output2 = usize;
fn day() -> u8 {
25
}
fn part1(input: &str) -> Self::Output1 {
// Create a list of all edges
let edges: Vec<_> = input
.lines()
.flat_map(|line| {
let (a, rest) = line.split_once(": ").unwrap();
rest.split(' ').map(|b| (a, b)).collect::<Vec<_>>()
})
.collect();
// Create a graph from all the edges
let graph = UnGraphMap::<_, ()>::from_edges(edges);
// Take a node as the starting point
let start = graph.nodes().next().unwrap();
// Loop over all other nodes
for end in graph.nodes() {
// Make a copy of the graph so we can modify it and undo changes later
let mut graph = graph.clone();
if start == end {
continue;
}
// If the two nodes are on the same side there should be more then three paths
// connecting the nodes together
// At least I think???
// This solution worked, so ¯\_(ツ)_/¯
for _ in 0..3 {
// Find the current shortest path
let path = find_shortest_path(&graph, start, end).unwrap();
// Remove the path
for slice in path.windows(2) {
match slice {
[a, b] => graph.remove_edge(a, b),
_ => unreachable!(
"There should be three paths connecting all the nodes together"
),
};
}
}
// If there is no path connecting the two nodes we have removed the three edges
// connecting the two halves
if !has_path_connecting(&graph, start, end, None) {
// Condense the graph, creates a new graph where each node contains all nodes that
// where connected in the input node
let condensed = condensation(graph.into_graph::<usize>(), false);
// The should give us two nodes each containing all the nodes in their respective
// half if we split the graph
if condensed.node_count() != 2 {
continue;
}
// Multiply the size of each of the halves together giving the final solution
return condensed
.node_references()
.fold(1, |acc, (_, nodes)| acc * nodes.len());
}
}
unreachable!("No solution found");
}
fn part2(_input: &str) -> Self::Output2 {
0
}
}