diff options
Diffstat (limited to '2022/day3')
-rw-r--r-- | 2022/day3/example | 6 | ||||
-rw-r--r-- | 2022/day3/input | 300 | ||||
-rw-r--r-- | 2022/day3/part1/Cargo.toml | 9 | ||||
-rw-r--r-- | 2022/day3/part1/src/main.rs | 24 | ||||
-rw-r--r-- | 2022/day3/part2/Cargo.toml | 9 | ||||
-rw-r--r-- | 2022/day3/part2/src/main.rs | 31 |
6 files changed, 379 insertions, 0 deletions
diff --git a/2022/day3/example b/2022/day3/example new file mode 100644 index 0000000..f17e726 --- /dev/null +++ b/2022/day3/example | |||
@@ -0,0 +1,6 @@ | |||
1 | vJrwpWtwJgWrhcsFMMfFFhFp | ||
2 | jqHRNqRjqzjGDLGLrsFMfFZSrLrFZsSL | ||
3 | PmmdzqPrVvPwwTWBwg | ||
4 | wMqvLMZHhHMvwLHjbvcjnnSBnvTQFn | ||
5 | ttgJtRGJQctTZtZT | ||
6 | CrZsJsPPZsGzwwsLwLmpwMDw | ||
diff --git a/2022/day3/input b/2022/day3/input new file mode 100644 index 0000000..e5e3940 --- /dev/null +++ b/2022/day3/input | |||
@@ -0,0 +1,300 @@ | |||
1 | DPstqDdrsqdDtqrFDJDDrmtsJHflSJCLgCphgHHgRHJCRRff | ||
2 | BcBGcQzVBVZcvznTTTvZcGTpCRRRfRCggLflHlhhCZpZCj | ||
3 | vGQnQvnzTzNTTbVnzGBqMqwqDLdPtMmbwqqLLM | ||
4 | wLRFRqvFsFRjfrHddbdbjzdH | ||
5 | lcsnSJPSSVVlGmGrHzbbrGNrdzbz | ||
6 | mSmlnnPlmJmncVDSlSZSlmLBCvtwBvtLCqqswsDBCTWW | ||
7 | pfqPrPgmmhvqdlsdWq | ||
8 | nfjHLJfZcLbVtQWWtndhls | ||
9 | CzJJFLzRzfDwrmggpC | ||
10 | CWfllmlCDFlZZqMfmFBWmWLJVRLVwNNtRVGPpwtGpqbJ | ||
11 | jHndndndcjhscnhHNtRbVtLbGpJbRRcb | ||
12 | HSrvnQzQSMDlLzBCfg | ||
13 | BQRVbgQQBJBbBtVBSSSRWMQbdNvvRPjZjCCdPLNZNNsNCCzd | ||
14 | HwpFpnlGpGZWGvjzPd | ||
15 | FTDmFrrwDpFMtmQVQQcWgc | ||
16 | VhbPshVDPDFWhWsgDNMMbVtmBjwBffpwBntnmnqfnswt | ||
17 | QzzGrTZZdrdlTcCLpRBnmBRRjBCqtptt | ||
18 | rJdGlmLTJdJrvZDbSbDSWDNbFJgD | ||
19 | qrcqTBHTcHgwWWdHRjdWBglBbGPpGvvPbszGzsbPpQfPLwPz | ||
20 | nFVmjhMjFJCSJsQQPQLbLpzCPQ | ||
21 | SnMSVVZSJMNMZNDVFtJtNRBdqBrWrRHWZTllrrjgHq | ||
22 | ZqdqcrPqqrwnQqnrZqjVcqrQwwmNbzNzwbNLzvFbHLbNmBLF | ||
23 | LCDsCsRTfLTDszzNbsbNNHbs | ||
24 | gLfCgShfCgMPlPrVcqrQgn | ||
25 | QSNSLDQDLfqqPwwBNLqgqJMMmmRRCTzHnCHhRzHmfCmh | ||
26 | lGvdbdWdVvsVszpDhHmmlnMpTC | ||
27 | ctbdtVsbbvvsbWZFdVQJqPtgLQBDBwBQPJwJ | ||
28 | dggSSDCPddRWPnSSPWRDgdSrTDsDQDTzQGGTMbsMMVsQfTfV | ||
29 | jmBvtFpBcBhhjljZHphztMsCbsTTCbzsqGqsfz | ||
30 | hccpLmhFlcwCrPLrCPnL | ||
31 | MMHZnGrCfJnfCPggSSGGSSSgLW | ||
32 | qhFhRlDFDlqFsgdvJdWdDdcSvp | ||
33 | wVlhqTbbRNFqswlVVRNbZfHCrntMBrTTZnJMCfnn | ||
34 | sHGZscVGHJMtmRrqzRqqqTqt | ||
35 | SjvvNgjLShWWhhSQNWqmrBzlRllTTgBqnRmq | ||
36 | LNQWLfWhSQvLdCddWWPHMcbHHrJcDGFZCJssFM | ||
37 | mSDjSVQbVGbmqDVbHmqqJTZzPHTHhhRJhwsRPcRJ | ||
38 | tFfFFttFdsNntfpMMppJWwZTzJczJcZPzwWcdJ | ||
39 | vNtgCrpgNptptgCCbbmjbSbvsVjSsjGG | ||
40 | VCQlZJCTPRWsBsjTTT | ||
41 | wvNrnbbvnhdNhLMfGsrGpRFpGpjp | ||
42 | dwndHbHbbLqwwhNcLsqSHSCHJClQtJSttQDPSJ | ||
43 | ZlrvrdvpGBBhlDrshdqJHRPHqPTJzRPPqw | ||
44 | tcftfSgFFgcgLPmPmpnqFwJRHP | ||
45 | pWLCcWNNNNttMNgZvlsvrBrsrjWDjB | ||
46 | wgdCJgDMDwMCwDMCMJsJJfpffVpVfbfrrrrgjgllZp | ||
47 | QFRhvttRthtQzzmpBWbWzWZSVpbSpl | ||
48 | btRttRLttGNqvbFHLwCdDcMwnPPJDnDD | ||
49 | VhmMNllLqGLJQNhRfZHgSPfgSPTqZj | ||
50 | sBwDcwBtsdzvvHZRlPRjDZTgPZ | ||
51 | pWvvBBcBCdzNLVQVWQlNlW | ||
52 | NsSppvSjSPNBNLJJLh | ||
53 | fCGtqQbZZGZQZTbtzbqbCZThddcMBddlJGhdlBMcddgLlJ | ||
54 | zZFTqwLtTRFqTQwvmprnRVSsDrnvVR | ||
55 | FttFTzzvlVHFzTjpbvzbFSDDdVGhdqLGWGJdVDDfsLqG | ||
56 | cmBNCRnwsCcBPMfLLfJGcWhWqfdh | ||
57 | BwPmZZMmZMCsnrwMrmbHHbjbSvSbjvrlHpzj | ||
58 | sZQHCBFHQQQPGQCCHCHwsHFshhtSnnqjbRSSPngnhbRjqVPn | ||
59 | mzLvmDvNNWvNvrzzrMTzJNjqndqbnSnnRgTdtjdbjhTt | ||
60 | WzzWDlJLzLDvMWJJlMzmLJWcpHFQBpBgBHGQGBHfwwBfQQlG | ||
61 | gdpFrdrmrDsqqswdtccgWWCMlChSbhqSlCzBlSqh | ||
62 | TTvjrfjNJPnRQNTQjvNnCSWBVBVbClPSVSbSVhSh | ||
63 | HRvnfTfvjjHZTDsmcHDsrDsdmp | ||
64 | bFChjhbpbjqsntjtns | ||
65 | vdWcfMHfddvrlNMNdWWTNgBqDngBBZBBQZshgSfgnD | ||
66 | JlwrlrlhlcJWcWMwhWNVFpLzwPbbLRFPppVLzm | ||
67 | DtBtgLvgcHzllsTwzSTg | ||
68 | vhhjZrCrZdVdZVSwPMwwTTMGwT | ||
69 | nmpfqrnZJbqBBvRc | ||
70 | nMvSLvWSWPVPvWnSLShFLBjVbpNVGGbVQbbNcBcBBc | ||
71 | sTzJsJszbbQbdQJb | ||
72 | DsDrwTtsCTFhLQSShRwh | ||
73 | RNFQhTQqHNNGRsNqQFNsHhFCwwPLwPqwzfPrrPBwpJSJJw | ||
74 | vMMMblZjddlvWbjbBBfbwCrPPLJppwCL | ||
75 | jDmvcDBlBdjVglgddmvDQRNFtFRGtQhstHNsGFHV | ||
76 | rhLHmZnMrRsZSstZLLtZnhSCNbbmPJVcblTNNTlccpNTjJTj | ||
77 | WFgGddGFFgFDddMblpJjlTJTPc | ||
78 | QGWqBBfWgBqWwFwzMGvzDqSSrHnCHsrssCRZrfRhHLfH | ||
79 | HHzcWqNPmZcqFHPZGBdMRBMDlllWpRDJMl | ||
80 | tTgSvPhbMDJlbJQb | ||
81 | SCTtvtSPftswjvPhTgffVqmGZLmqmCCcqZzZHFNznF | ||
82 | QNpppRrdZvdgzpQZNpgRRgbSwmDDvFGGqwJSsvSGSqGG | ||
83 | HchWBMcBVnnWcHPjHhWcjHTqJFDGMSSqDMwJJbGwSsGGSb | ||
84 | tcCVcBjPjhnWlFrCFNZflQNr | ||
85 | HsVMrqrPqvvgprSrLG | ||
86 | THJWBJDwRFvBgGSzgF | ||
87 | DmhfHnmQncMNVMqPqbcd | ||
88 | SqZmMJqvHJBhHJLp | ||
89 | wsgTVTSsPssjjFVrTrFlhLhCFlBBnHplHLLHfF | ||
90 | zgggdwPrRrsrjjgRwVwdwdQTmvMvZqDZbWqqMSNWNbGQbGZN | ||
91 | fBDBfLZnTLZVVmmDcQMDDV | ||
92 | jPFtJFpHpJqfJFrptwrJdRWRWNpQVmQRMWNVVVNVvQ | ||
93 | zHwJgtFrTlslfghf | ||
94 | wMwTttCCTTSTfBmPzPVZnPZLVVtbnN | ||
95 | ldRRRlRHggGcvcRbZsNzvBVWnnPBWv | ||
96 | hdlJHgpcJccJhQdJrcrhwFMpDqCwCMBqjSqjqpTC | ||
97 | fJfnwJJnnHJgJHTgjsjDccNjcbgNjm | ||
98 | VdLqRRqGVqpRrPpppMBjDNmDctdsBlNjmZdZ | ||
99 | PDQvPQSvpGDrTwfJzzfFnTnS | ||
100 | MnHvnHHMRMzPTlDLPPRGcl | ||
101 | dFnfhFVwhdBPBfGWlPcP | ||
102 | JNrQFsnVtwsgvNzvmMjpzS | ||
103 | BZVPFpNpcNZpmRRPpzcVNhLLnssDjjDGnqjjLDFDjq | ||
104 | mMJbJvtJQQHlJDGCDnjvChDSsv | ||
105 | MQwWJHdQwWrJltQrgfNPmfBcBrpBpZ | ||
106 | ZWZqDsZZqWsWvWLPwPbpHjdtSbSjSCSPPSCp | ||
107 | MFVNMLmFmNzcTTrFrLbjdjbpCdCSbTCShRSd | ||
108 | czNzLrznlGNNrMzMwDlJwJWDwJwqJDvW | ||
109 | GlgchGGVShlQcQfDhzZrNFnFNFNjFzNFcn | ||
110 | dwCtpwHTtPTWpdFNfJJzRzvJNR | ||
111 | tLBBmWHftBttPbLwCHWTsSSQVglqgMsMBDSMGlQS | ||
112 | RDDDGhGfvPPTTPTThn | ||
113 | ZFLMmjpCpfMZzFqmqsCmPjdVBlVBVnWBPNTVbnTV | ||
114 | zHqJMCzLvftRQQHG | ||
115 | nTcbnvPsvdvFzpczVZmMGg | ||
116 | BCCJwSDqhQLJmMMpzGZVFVFB | ||
117 | qhrwJwrJrrzJNqwWLsTTnlTlbnsvbstWsW | ||
118 | vHRbqPJZvRPZhShJvTZllZtgzwlfBGBlsm | ||
119 | VdQjVVCssQVrWrQmTBgBzglmgCBGml | ||
120 | NnpQNpcFpNWshPRLsbSFsH | ||
121 | cVGmVZVwVVMLdvcRttTdbB | ||
122 | ppCQrwzHBtLrttLb | ||
123 | hsFJQzFWCpCqjZGVwlhlPP | ||
124 | HDGRzgWhgfzVWfRpspwRwbwStSwt | ||
125 | ZBPPPmmmTMQMPcZrBmSptSbbQCwtlsNqCwjC | ||
126 | TTLMMmZvPTrMZvFMmcmvrTccDDnfGHJgJhHhnhnLfVhSWDJz | ||
127 | pNrpjzthZPnGrzzWbJLLLbbJZwgSvZCV | ||
128 | MQsFFFDTfMNfRFfBFMdBdwLSvgbSTVCqTgVbbTLvwV | ||
129 | BQlQDMFccQsNmWpPGhpcjr | ||
130 | CTgGRCRglLlLTllL | ||
131 | vMJmhPJcmPBMvhqPDnNNqlWnwDWqsRQs | ||
132 | hcBfcJRPFfvvRvJZBrfMPZdpbSSGtSdtdgtzzSZzbV | ||
133 | NQLzNzzJcrLrSgZSSGgZrR | ||
134 | bTsjqHvcmTHvjgZGDvDpGZRfpg | ||
135 | WqTVPbdnMlLJncQC | ||
136 | hZLBrqLGLMbzLLBhfMMrnnNJlnNnlnJJNNdCJdzN | ||
137 | TWTsWqvtvpTSgRHpVFdjgjCPdgJlCFCFnF | ||
138 | swSTsTwpTVRmVRRRqMDMfqfDwLfbrhLr | ||
139 | NTQHWNQWrQwSTDWlcPPBHZBZbPgZJZ | ||
140 | nmfjCRCfRhndJcjBbcbcbg | ||
141 | nsppRfssfzCnqgzTzrwTwQVTWM | ||
142 | mFjQmDGmbbGjmChrCwdQBHCHWh | ||
143 | qvZZnPvvnngMpnlqpMZnpsTgWHTRCWrVdVDBWRhHBrhHDHhd | ||
144 | vqZgnnqgLvqlPllpnjGDjmNjNLfftftLFD | ||
145 | rfGsjsMNnFMMFddMsttDMgLHGlmJLCPPmHHGmHPlmm | ||
146 | vZcbhQbrRbVZPJLwPTgCLlgb | ||
147 | hchzSBqzQvphnWnrjFdWMqff | ||
148 | WmfPWfVsfqszRDqPqgpvHhvdwddGMmGghM | ||
149 | QtTrtTcSBjtQCctStrTrzhpwjGvGHhngwMHGHvMv | ||
150 | TtTQlQFcSSJlcccBbltQQTTRsPZDsWzRFzWFzPNfsssLPs | ||
151 | QpNNMrjcNMccGNdvLBBlBsBjnsnF | ||
152 | tTSqbbbqCtWWCTWSVTmmCJPwVwnwvFPnsPVnnPfddlvf | ||
153 | HmhJTZWqHqCJJJltqpNGRgzZDcQNrgzDGM | ||
154 | HcLVRhhTRsLRRVjslTscqNQmVNQQgQttqNwNZtmw | ||
155 | nJdBJJhfFPSCbJBJBMbzFbFgmNmtgmvgNgnntNwZQQNNmw | ||
156 | bMbPzJbzCBPrJfdfbBbdCrGHlLTTpWjsGhGTTRTRlc | ||
157 | sJCCpQJQCrfCfnSCrT | ||
158 | vmqgNggzgmZqmPShqBhThfhDhjDhhB | ||
159 | RZNzHRzZSQwHwHVVWc | ||
160 | jtVtvVHgvjJbHjjQPMZdCcwlMdNbdFlNlc | ||
161 | WppSBDzGfBzTBqQWwCFMlwZMwMcZ | ||
162 | zBfnqpRGnSSqTfqpTpSnnHQsjJgQvPJshHtHVh | ||
163 | qJMRMcPPVzVhmsDWfhWT | ||
164 | BglQBNlgZtQBHLHHBnTjWSWmFmwDmWjSsnmF | ||
165 | BdHvgHBvBtZbTpJRPCdcdpGrGJ | ||
166 | pcGcWGWlvQZpzmDbgFmz | ||
167 | HqqnddDdddjzTTggjZgFtT | ||
168 | sHqRwrRsJswLHrMLLRJdqNVVrGffPGWcvSSWlDfGfc | ||
169 | lttTbgRvqvtQRhjLzGjLVh | ||
170 | JJfrHfrdffZJQmZhLLZVVwFj | ||
171 | sBjCfSNNTTqnCnqD | ||
172 | qMtWjSrHftGfjqrJGMqzVzFmBBrzQQwzgBVQVQ | ||
173 | LDChPbThbTcTpCTcnPPQPQzVPvvzQBBWgVBQ | ||
174 | ZLspppLpdZZttdHttqdWMf | ||
175 | htJcJhpMQQWjhNWdJQSCFCTvFBPCTDlMmDCFlM | ||
176 | jjbbsfjwZbLGVVqHCFPvmvDmClTfmP | ||
177 | zjVVRwZwnRJtnNQt | ||
178 | PCPVSzLMMRqGwgMmHmQmDQ | ||
179 | slrrbZZgsfcdsgdhrHFGQHQFwvfwFwDGTv | ||
180 | NclhgpctrrNjllcZdcrpZnPPqzLLSSLqJLtJWCWzCn | ||
181 | PBLSBPVBwpTVppfT | ||
182 | lZCqQQtCQGPJJPtPHHwTwZTTZpwHsfRH | ||
183 | mCtGFDqFGDGQjPGqjJMMlqPgdWgSSgBWWcWzLdgvMzgBMg | ||
184 | cLBrfchhFBcnrgvqvPGvvwSS | ||
185 | QpzpstDDZMwDZqwh | ||
186 | WzpbWTjsbhpQtjThsjJFRNLnfLbfRLRBLlFB | ||
187 | ngnWWqnfgqtfsrWftqsrFWPSdSSdRCTHRSwpRGTfGmSG | ||
188 | VhJhVczJQcvbvvlhBpvlPdmlwHRTGHSRPTSCRGTd | ||
189 | zVcBcMhzcVcvMJJJDpWrsqrtrWLWsgZZFtFD | ||
190 | fbccrJlrffTwJDJTtBtB | ||
191 | hRNNFddsgsFPLLRVVwthMCQTtBwrtT | ||
192 | jrsPGLNjsqPlvGbZbcvScz | ||
193 | HFPmmgQrQzFgrLVPPrLFPNDJNJzzcGbJTbsSzbGGNc | ||
194 | MtvCMhJBdnMhwfhlwnfBfMDCDSjGbqDNGNGqGjDDjsDC | ||
195 | wwnhhdtBBptwdlhlRntRldJFVWRFPmWZFmHRZZmFQPRWmm | ||
196 | WrHNNTBNTTTBwHHcSTrBnSzJPFnpJfpLVfpDVdJLFJLFdD | ||
197 | hRthQvhRQlQmDpfVJFdLlLLj | ||
198 | hMZZbCMvgQgBTBGNGDcWbr | ||
199 | HvQjMRMTzjsCQzHTCFfVVZLPVvfLfPVpZg | ||
200 | GtlbBtSGlSbDdStrhSFCPVDgZgLLgPpPJWPF | ||
201 | rmwSbcbcdbrbGljQjCzCCwnHRqQT | ||
202 | bbgNSHPPgnmMMZtNcMpp | ||
203 | VFzFDFVtCBFDCVFdMlhZMhdhmhmplwZL | ||
204 | JVtBjGRFRttFCGDFGJJDQQgSgTWPPfSSfWbQnHvPWW | ||
205 | NvdBpwNvGNFvpBGGBmLFblrtVTwDttlhtlblfQbQ | ||
206 | SCMMsWCMSRZCqsmWcRWgRRsVtlrtrQbtQftThrQTQtqrtQ | ||
207 | WRscMgZJJCJWzZgSWNLFdBNHGzpFGmBFFG | ||
208 | qghqRVzhLNRLqzLhVztgQdLFdrccCnSpcZdSZcTS | ||
209 | DwvmHDJDsmvDGmHbQBlslMDDCrTCnppTndrdBrFnFTSdCCnZ | ||
210 | GGwJHlGwwvMHJljwwDMVtfhtWWhzqVPPjfQRqz | ||
211 | BsDMPrqPzsDwwCLGmqjpjm | ||
212 | VfFJQlVQcvfwJLJCJppLNp | ||
213 | vfcSHCglCgbgbbbFvSlvQfPsrsZrPzZzDWWStPhtZPDP | ||
214 | gjMsnFgbnllbjMfSZBHHtpHvvvFwhv | ||
215 | DDRZDLdVCLNLJwBCShQHHwwBzv | ||
216 | DNJNTLJRTqWmjWZnjrlmjW | ||
217 | ZTSVSFZCLTnvzfzqvnNL | ||
218 | PfPcJljfMpvtlnztvQtw | ||
219 | PsJMMMWpGcgMHMfjRBThrgrTbBSBFdVSTF | ||
220 | GccBRWjgtQqsTcVQcw | ||
221 | JhJCMJHPLffMChlfLCLHMMrDQsQqDVQsqTDbVvGqDhhzqD | ||
222 | dHGlfnCHlJrNmtdptggpmW | ||
223 | wnDDSBCSBSDLzLLmHLrlwlmpTTqzGJJfpjfjNpfqbpbdpG | ||
224 | MMRhFWWRvZPZRZQhFZMVhVSNqjqpNQffJjbjfbjdTJbp | ||
225 | VMMsWcZRWgMPvRSrSHmsrrtwSHnr | ||
226 | TQchPTgjBcNgPHhhThtNzQdzdsCmRDJnzCCmCdCm | ||
227 | vllVwrfvbSBVFSbVGwlrFGlqRCDzRJCJdzvJRzsdLDDLsdCm | ||
228 | VrMrqSWbfqWbBhhpWjNTttpjjP | ||
229 | rsfvSHHcvwrMPtcQZgnDhGdvJzngLzzJLJ | ||
230 | lWmVlfbCCNFCpBCmTpFFJgzhDLGhmRGhLhmGdgGR | ||
231 | pNBfflVTNpfWTWbWWbjNVqBsscqsqrZSwMwZrMPZSZrZrs | ||
232 | PJPHPJmhhHhlHPQgCndngTbWnqCWDGTD | ||
233 | tSwccFpFqwMcFbGFWvnnWvCW | ||
234 | MwLwLMSwpNBBtctSctfhZHJQhhqmlRlZRNPH | ||
235 | GNzdZhVGvtGZVVgGgtfHHWhpLPPpLWpWWnHf | ||
236 | RjwqRcDTvCrWJWWnlLnnqn | ||
237 | DbrDDwwBwjjsrbDTRTBmwgZmgGgmdttvQvQFSQGFtg | ||
238 | jRgcZRfhmHfZjPZRgHffLFTzzddBTBBFzLDZzBTF | ||
239 | VtsJwSbcStlwMqbtwbvWBWddGGdrFDDWJWrzTT | ||
240 | VwsQQvlbVbVlbNllVwbMmmpnjpfChfQpnhfcCCnH | ||
241 | dFnFjWjTQTFzFWPWPgqhRQRqgVhRqfRqQJ | ||
242 | bStrbpmNGHSrBDmrNBtHBhMVLLqLqVVglrllPVLgPg | ||
243 | tSsbBDmBbbGmmSHDbtmHbtNCjnzscZccjnPcTcdzWcvjswFz | ||
244 | lFCjDhqggMlDvMhFDgqFFzHHwHwwwTpLBwmwqmmpBpwT | ||
245 | GPdPnStGncQGNStZPpBmVZmRmfzTRmVVfL | ||
246 | tWtNdPWzsbtMDCbrCbrjrv | ||
247 | BJHMgLlcMTBLCtbqmMDGppmmMM | ||
248 | ZFPsrrdvwrNvrdNZsvhrrzzRSmJRbJSmbztsmpRSSm | ||
249 | NwhfPZFNdFQPVQdvZFNgjglJLTCQngQWllBcTT | ||
250 | jGlQQvQvpRQRGfnPLfcfGTnP | ||
251 | BMqmdBVBwmFdVMFZdcTPqgLnnggTTLSzPS | ||
252 | FVtMMVcbZVrcZMQCHjHWJJCJDvrW | ||
253 | rPPwVwbpRbbVlllTLCTRqTLL | ||
254 | dNdZssBBCBszHsjhDTQgqLDvlTgDZgll | ||
255 | dSsCNNHMdsdWWWmpGfmPFS | ||
256 | rzCLrsjgZjwcwSZc | ||
257 | wNBNRJpRltHNWWRHBlGlJtRcTZSVBmZDVqZTfBVVTDTVTD | ||
258 | NWPtGJPNGWHvpvtwvWgzQvdvQQzhnsnCvCLM | ||
259 | HHbJhzddMPbPgnDWbZ | ||
260 | BLnjLNvBrrcvvvwnwLrnqrgpPRgRNCWgZDPPpDgRpRWp | ||
261 | jtsBqScStfJQnnVF | ||
262 | QVFSVgQFZZQlQqQSlgQpRppSbRTSTppJJbRpLb | ||
263 | cGwCDwjrnrGvzBzGnwwvDBjnpLbsLTTqRPbsJPMJMWpPns | ||
264 | tcGzrCdtGdQmVZqVNQ | ||
265 | RtTRhncVMTVccShRTctLdfPdJpLPqJhZphHpJs | ||
266 | BzssCmFNWWqWwqwPLH | ||
267 | svzvvsmmFBmsggrGlGMVSMtMRRncSQScRRRl | ||
268 | rmmqrQQwLbbGrrGr | ||
269 | cNJzzzWtWmLCGGbLWWbv | ||
270 | cVtMppchzMBVMcNJcMsRwqZFMlgmggmRgg | ||
271 | mQsQBHFMrbddbRqH | ||
272 | NzhcQNfNNtzvWwZdSrgbrprPrwLbgb | ||
273 | zcJVhTtNNcvcfVZmBmQMGMMljTCmlB | ||
274 | FlldqjSlCgfvPFfvFF | ||
275 | rbnDtVBMbprTsbVVcTDTrpMcmNwgHPgghTmNfLwvfPNLwhdT | ||
276 | drMppdnbbtQDBtbnsBbcrrtbSqSSRCjlQZWllllSRlWRGCCC | ||
277 | nqdCsqbbwdsrHFVJHcwFTc | ||
278 | jPPjtWjPWgRltRLsBRrNpHFDHVFWVVJNNHrD | ||
279 | fgllPGQjBffLjtzSsqvbSSzGvnhS | ||
280 | zsVBzMfHHnzlwwVlqcJJFT | ||
281 | ZzRLvLDzQzTmlWlqWRWF | ||
282 | GbQQvpGvSSpjdQjSQZpQZGLfrgBCsHzrdtCsnfCBHsBgdH | ||
283 | zBLbLWzqqwLMnMZTnHlnsHTvFlFHNT | ||
284 | fjhdcrjjdVdrGSmmdfccGclPvlvPTlGHTFgNvNgqFFvg | ||
285 | pmmcrcRrjSVJchqVccjpRwZMDwCJQBbLDCCbwBWLzL | ||
286 | TDMBgBgLlcjBfMfcVJVmGnnJjvPVCPVv | ||
287 | zzptqHstJqFzzdJJZNvNpvNpnNvGnNZm | ||
288 | dHszrWQhdzHQqdztwQBLSfglfDbfJlJTLg | ||
289 | VTmvrldtGGwmlvmGDHlLnFDCCplFQHLH | ||
290 | ssgjzSzzJCQSSFVVQF | ||
291 | WsRWhgVqRtfvwcddhc | ||
292 | bdlDwznhnNlffMcPTPfzzQ | ||
293 | srCRGRrZCmVTBfBBfTQcZb | ||
294 | brSrrGvRVvWmRsrHrWSbjNJwdDFhnNlwtlnSdnhN | ||
295 | QQqqRfdQQSdjgPmZfBmmPgRhphphJtLmJhTJJhVbTtLhTb | ||
296 | vvlNGzDDDcslcsGDlWHtCFVpcCbThFTtbJFtCh | ||
297 | DrMGlzMVwNGWsWMHDMvlzlMfZdQdQPZfSZRfdrPBfqRZgj | ||
298 | qVHfHNJCHVvvFFbfFlHHnCQQDhLnhhhPZrZnPZPn | ||
299 | mSMszWRMQmhqrnZL | ||
300 | GjtzjSSdRGSjsRtdRMttgGgsqqFNfFcGVvVVvlbHFFGFVFwb | ||
diff --git a/2022/day3/part1/Cargo.toml b/2022/day3/part1/Cargo.toml new file mode 100644 index 0000000..f14fe90 --- /dev/null +++ b/2022/day3/part1/Cargo.toml | |||
@@ -0,0 +1,9 @@ | |||
1 | [package] | ||
2 | name = "part1" | ||
3 | version = "0.1.0" | ||
4 | edition = "2021" | ||
5 | |||
6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
7 | |||
8 | [dependencies] | ||
9 | itertools = "0.10.5" | ||
diff --git a/2022/day3/part1/src/main.rs b/2022/day3/part1/src/main.rs new file mode 100644 index 0000000..2de2ce8 --- /dev/null +++ b/2022/day3/part1/src/main.rs | |||
@@ -0,0 +1,24 @@ | |||
1 | use std::collections::HashSet; | ||
2 | |||
3 | fn main() { | ||
4 | let rucksacks: Vec<(&str, &str)> = include_str!("../../input") | ||
5 | .lines() | ||
6 | .map(|line| line.split_at(line.len() / 2)) | ||
7 | .collect(); | ||
8 | |||
9 | let mut sum = 0; | ||
10 | for (f, s) in rucksacks { | ||
11 | let first: HashSet<char> = HashSet::from_iter(f.chars()); | ||
12 | let second: HashSet<char> = HashSet::from_iter(s.chars()); | ||
13 | |||
14 | for x in first.intersection(&second) { | ||
15 | if x.is_lowercase() { | ||
16 | sum += *x as i16 - 96; | ||
17 | } else { | ||
18 | sum += *x as i16 - 38; | ||
19 | } | ||
20 | } | ||
21 | } | ||
22 | |||
23 | println!("{}", sum); | ||
24 | } | ||
diff --git a/2022/day3/part2/Cargo.toml b/2022/day3/part2/Cargo.toml new file mode 100644 index 0000000..69fa504 --- /dev/null +++ b/2022/day3/part2/Cargo.toml | |||
@@ -0,0 +1,9 @@ | |||
1 | [package] | ||
2 | name = "part2" | ||
3 | version = "0.1.0" | ||
4 | edition = "2021" | ||
5 | |||
6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
7 | |||
8 | [dependencies] | ||
9 | itertools = "0.10.5" | ||
diff --git a/2022/day3/part2/src/main.rs b/2022/day3/part2/src/main.rs new file mode 100644 index 0000000..7139eb0 --- /dev/null +++ b/2022/day3/part2/src/main.rs | |||
@@ -0,0 +1,31 @@ | |||
1 | use itertools::Itertools; | ||
2 | use std::collections::HashMap; | ||
3 | use std::collections::HashSet; | ||
4 | |||
5 | fn main() { | ||
6 | let mut sum = 0; | ||
7 | for group in &include_str!("../../input").lines().chunks(3) { | ||
8 | let mut membership: HashMap<char, usize> = HashMap::new(); | ||
9 | for rucksack in group { | ||
10 | let mut items: HashSet<char> = HashSet::new(); | ||
11 | for item in &rucksack.chars().chunks(2) { | ||
12 | for c in item { | ||
13 | items.insert(c); | ||
14 | } | ||
15 | } | ||
16 | for c in &items { | ||
17 | *membership.entry(c.to_owned()).or_default() += 1; | ||
18 | } | ||
19 | } | ||
20 | for (item, value) in membership { | ||
21 | if value == 3 { | ||
22 | if item.is_lowercase() { | ||
23 | sum += item as i16 - 96; | ||
24 | } else { | ||
25 | sum += item as i16 - 38; | ||
26 | } | ||
27 | } | ||
28 | } | ||
29 | } | ||
30 | println!("{}", sum); | ||
31 | } | ||