diff --git a/.gitignore b/.gitignore
index 3ca43ae..40d9aca 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,16 +1,2 @@
-# ---> Rust
-# Generated by Cargo
-# will have compiled files and executables
-debug/
-target/
-
-# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
-# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
-Cargo.lock
-
-# These are backup files generated by rustfmt
-**/*.rs.bk
-
-# MSVC Windows builds of rustc generate these, which store debugging information
-*.pdb
-
+/target
+/.idea
\ No newline at end of file
diff --git a/.run-bench/Run-aoc2022-bench.run.xml b/.run-bench/Run-aoc2022-bench.run.xml
new file mode 100644
index 0000000..d9937ad
--- /dev/null
+++ b/.run-bench/Run-aoc2022-bench.run.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Cargo.lock b/Cargo.lock
new file mode 100644
index 0000000..51b788e
--- /dev/null
+++ b/Cargo.lock
@@ -0,0 +1,49 @@
+# This file is automatically @generated by Cargo.
+# It is not intended for manual editing.
+version = 3
+
+[[package]]
+name = "advent-of-code-2022-rust"
+version = "0.1.0"
+dependencies = [
+ "lazy_static",
+ "regex",
+]
+
+[[package]]
+name = "aho-corasick"
+version = "0.7.20"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac"
+dependencies = [
+ "memchr",
+]
+
+[[package]]
+name = "lazy_static"
+version = "1.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
+
+[[package]]
+name = "memchr"
+version = "2.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
+
+[[package]]
+name = "regex"
+version = "1.7.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e076559ef8e241f2ae3479e36f97bd5741c0330689e217ad51ce2c76808b868a"
+dependencies = [
+ "aho-corasick",
+ "memchr",
+ "regex-syntax",
+]
+
+[[package]]
+name = "regex-syntax"
+version = "0.6.28"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848"
diff --git a/Cargo.toml b/Cargo.toml
new file mode 100644
index 0000000..e76b11f
--- /dev/null
+++ b/Cargo.toml
@@ -0,0 +1,11 @@
+[package]
+name = "advent-of-code-2022-rust"
+version = "0.1.0"
+authors = ["Bas Dado "]
+edition = "2021"
+
+# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
+
+[dependencies]
+regex = "1"
+lazy_static = "1.4.0"
\ No newline at end of file
diff --git a/input/day1.txt b/input/day1.txt
new file mode 100644
index 0000000..f2d8ab2
--- /dev/null
+++ b/input/day1.txt
@@ -0,0 +1,2259 @@
+22243
+11899
+
+1696
+2595
+5331
+6092
+5274
+5641
+1345
+6626
+2005
+6260
+6410
+2092
+3501
+
+3982
+4505
+5836
+6059
+6513
+1151
+
+7002
+6597
+7174
+3618
+4734
+5107
+1388
+6493
+6541
+6440
+5291
+4492
+
+1341
+6520
+8531
+3483
+9221
+2847
+3930
+4012
+
+4074
+2101
+2200
+1333
+2991
+3186
+6711
+2248
+6655
+
+5102
+2672
+2842
+2274
+6828
+3765
+5290
+6004
+7237
+1509
+3128
+1593
+
+8404
+7548
+4075
+8246
+5590
+2107
+1204
+6374
+1865
+5657
+
+62852
+
+10643
+5981
+9631
+1574
+2962
+1021
+9811
+1566
+
+2027
+1193
+1487
+4493
+6215
+3315
+1353
+3703
+3987
+8158
+
+5969
+3824
+4696
+6948
+5098
+1364
+5943
+2489
+3523
+2585
+3242
+5724
+
+2113
+1381
+4067
+2344
+4778
+2645
+3968
+6599
+6451
+4462
+3882
+2312
+3843
+
+2948
+9364
+1281
+5411
+6477
+1119
+8986
+1218
+4448
+
+4938
+5597
+19725
+18053
+
+10621
+2556
+14794
+
+15944
+
+2490
+3883
+8604
+4310
+7188
+2634
+2126
+4386
+4007
+
+18117
+3564
+3723
+16013
+
+1729
+7521
+7155
+5464
+10189
+11378
+2892
+
+1919
+3726
+6573
+5328
+7056
+2626
+7135
+5337
+3952
+4568
+2493
+
+8540
+9992
+4330
+6118
+1028
+6987
+6841
+10336
+
+7166
+5976
+2075
+1938
+4219
+5535
+2927
+7792
+6763
+8069
+4214
+
+4726
+2359
+6414
+1727
+1987
+2112
+2093
+1071
+6170
+3010
+1891
+3025
+6416
+2534
+
+3818
+3761
+2326
+3260
+9384
+3033
+9065
+9128
+7062
+
+9666
+4769
+2548
+2907
+8618
+3484
+3962
+10736
+
+1496
+5465
+2062
+5094
+4678
+4135
+2419
+3851
+5853
+1230
+4807
+4323
+3978
+2932
+1398
+
+4046
+4017
+5785
+4317
+5874
+2880
+3889
+4548
+3184
+3736
+5525
+1244
+5151
+
+59604
+
+6245
+3810
+3601
+5107
+1130
+5397
+3908
+5786
+7065
+
+5957
+1971
+
+65880
+
+1195
+2467
+2681
+5646
+1369
+4188
+2319
+6356
+5519
+6535
+4368
+5542
+3013
+
+7724
+4856
+7693
+3723
+10718
+4944
+9471
+
+69102
+
+7561
+1144
+7132
+1051
+7124
+6166
+3965
+
+4108
+3486
+2171
+3884
+6322
+4794
+7097
+2907
+4538
+1603
+2786
+5061
+
+5564
+3164
+5398
+1859
+1207
+9374
+4975
+9037
+9603
+
+4570
+10797
+14210
+8624
+
+5511
+1351
+3529
+8490
+2362
+2252
+8908
+4353
+2878
+
+1083
+4451
+5884
+7413
+6905
+4155
+4305
+7601
+2054
+1251
+5509
+
+40729
+
+20688
+8455
+10468
+
+1374
+10889
+8751
+3095
+6061
+8209
+10286
+
+5587
+22294
+18064
+
+57291
+
+5883
+13276
+4902
+3441
+11757
+
+5741
+4622
+1694
+1405
+3925
+2385
+5057
+3622
+5847
+4269
+5832
+5054
+4519
+3870
+
+4647
+1867
+7897
+3384
+3663
+8740
+1930
+2687
+8175
+
+6060
+14296
+15930
+
+10623
+4760
+1532
+1959
+1430
+
+29630
+
+4456
+6843
+5338
+5422
+6122
+7464
+5023
+7344
+
+3528
+9171
+11019
+7072
+3648
+3852
+8586
+
+3508
+1384
+4146
+4978
+2119
+5363
+1017
+2651
+6336
+4525
+1116
+2196
+2199
+
+3052
+2026
+4975
+7092
+6609
+5956
+5176
+3198
+7527
+7267
+7406
+
+5041
+8034
+8288
+3213
+2460
+9129
+7780
+1084
+
+5052
+9286
+3529
+5980
+1388
+2654
+1480
+7399
+
+2802
+2868
+19533
+20096
+
+3879
+2938
+2717
+1423
+3863
+4516
+3903
+4274
+2774
+2079
+5709
+2909
+2188
+6054
+5298
+
+6781
+4829
+8850
+8731
+1401
+4401
+5448
+2356
+2969
+
+1723
+4194
+6029
+1330
+2547
+4981
+3501
+3125
+1530
+4650
+2377
+1268
+2097
+6486
+
+49278
+
+6264
+6407
+1850
+3918
+1741
+2194
+3474
+6587
+3442
+5321
+6038
+2305
+6503
+
+1082
+5358
+3613
+5720
+3008
+3660
+6045
+4323
+7433
+5023
+6447
+5817
+
+5854
+7555
+5433
+4345
+5302
+7689
+1330
+6917
+6863
+6696
+
+5737
+2769
+6760
+4761
+3711
+7699
+3698
+7727
+4267
+1154
+
+4383
+4214
+1513
+2792
+3496
+1332
+2740
+7249
+1555
+6305
+2790
+
+1429
+3006
+5278
+5780
+3037
+3221
+6405
+4281
+3935
+6627
+3330
+1367
+2183
+
+2141
+22468
+9206
+
+1547
+2946
+6113
+3465
+1206
+3086
+5122
+3789
+3125
+5713
+5978
+1266
+2429
+1261
+3957
+
+2407
+3597
+9855
+9830
+4827
+6245
+4082
+10501
+
+4709
+3463
+3268
+1432
+4508
+3814
+6020
+1054
+3652
+4151
+6189
+1758
+4079
+1286
+
+4219
+11621
+11315
+5162
+2106
+5317
+8577
+
+2924
+4263
+8298
+7889
+8779
+7463
+5078
+3106
+4854
+3479
+
+4773
+2109
+5230
+4159
+5044
+6346
+4727
+6450
+5486
+5918
+4303
+5628
+3195
+
+13208
+
+1259
+3867
+6425
+2480
+4013
+3771
+4489
+1829
+3594
+6280
+6213
+1725
+6265
+3430
+
+4195
+7715
+20947
+
+8495
+10638
+1446
+5279
+2580
+1407
+9964
+3960
+
+3841
+2838
+2259
+2190
+5446
+2261
+3724
+6595
+6273
+2137
+4344
+3703
+5458
+
+4268
+5924
+9640
+5253
+10814
+11160
+8199
+
+4179
+5425
+11417
+7572
+13604
+
+8692
+15323
+14207
+2909
+7076
+
+8420
+8836
+6367
+11145
+3686
+7162
+10446
+
+1922
+2476
+4880
+5324
+3240
+5930
+2373
+6114
+2737
+5315
+3657
+5234
+5326
+4444
+3280
+
+6402
+9360
+10714
+8033
+7912
+8313
+
+13905
+9965
+8927
+4835
+14581
+
+4661
+6016
+5709
+3679
+2869
+7515
+5681
+6567
+2086
+5064
+
+11351
+12095
+12808
+
+9842
+8550
+8562
+7697
+9630
+7082
+3513
+8112
+
+6348
+8109
+8370
+2784
+8580
+7375
+1972
+8635
+8244
+4431
+
+2583
+2782
+4531
+4600
+4112
+2795
+6085
+1616
+3051
+4373
+4660
+4924
+4357
+5346
+3692
+
+8704
+19646
+6683
+
+1326
+2594
+5155
+4116
+4986
+5361
+1829
+5394
+4062
+1503
+2437
+4250
+4927
+4345
+5002
+
+4033
+5578
+7105
+6410
+4626
+6104
+6092
+1594
+2939
+5196
+6085
+1855
+
+10974
+1508
+1769
+10071
+6253
+7462
+11771
+
+3467
+1795
+12191
+13593
+5454
+
+1989
+10394
+6048
+5893
+9321
+11997
+2320
+
+4639
+2398
+2365
+4485
+5566
+4046
+5791
+3112
+4573
+1614
+4570
+5038
+2502
+1566
+
+2716
+4779
+6041
+1002
+2686
+2756
+5562
+6227
+6071
+4766
+4863
+6098
+
+9164
+1056
+4080
+16371
+
+6342
+18445
+15991
+
+2826
+7207
+8171
+9776
+5964
+1615
+11184
+
+3324
+7165
+5530
+2871
+1760
+1429
+7113
+2171
+1029
+7441
+4057
+2370
+
+7335
+3914
+3980
+2002
+3137
+1636
+10641
+5000
+
+5106
+5767
+5340
+5542
+5209
+2410
+2248
+3048
+5148
+3092
+1686
+4274
+1688
+1969
+3620
+
+13378
+15409
+14557
+18378
+
+2085
+4009
+3663
+4058
+2320
+4323
+3683
+3579
+2183
+1256
+4471
+3633
+
+2985
+12411
+10954
+8642
+3065
+6544
+
+2715
+4839
+4770
+5618
+3458
+6182
+5118
+4038
+1953
+6387
+2155
+2647
+
+5132
+6862
+5783
+4770
+5793
+5926
+4610
+3528
+1772
+3237
+2716
+1207
+5477
+
+3722
+2333
+1838
+6337
+8044
+10192
+1457
+1772
+
+13998
+13869
+3152
+14169
+14289
+
+3974
+6117
+1539
+2446
+2097
+6228
+4232
+6300
+3925
+6906
+5192
+2463
+5606
+
+4616
+6663
+7411
+6817
+9687
+3526
+5347
+4215
+7980
+
+41654
+
+1196
+1949
+1063
+3771
+6047
+2445
+2602
+4069
+4755
+3079
+5295
+1517
+5925
+5221
+4504
+
+6687
+5898
+4175
+5260
+5332
+6038
+6559
+1295
+5499
+5685
+1121
+1760
+2354
+
+9253
+3790
+7810
+8060
+10709
+2616
+7895
+1690
+
+4071
+30519
+
+1812
+2676
+1113
+8120
+8811
+5130
+1932
+5693
+6558
+1801
+
+7805
+2829
+7273
+7637
+4422
+8344
+7011
+4805
+4459
+1019
+
+2826
+4477
+6427
+7330
+4514
+7178
+1152
+4521
+1389
+4515
+4280
+4754
+
+4570
+5161
+4590
+1940
+5084
+2016
+4261
+1364
+5819
+2776
+5630
+1288
+2864
+
+1485
+13016
+10668
+6130
+3888
+
+6823
+8658
+2810
+7793
+6147
+6984
+7356
+5543
+2024
+2661
+
+5678
+5456
+6531
+4786
+4207
+5582
+4086
+2953
+4722
+2291
+7254
+5395
+
+9515
+10600
+9238
+10661
+11661
+11439
+6982
+
+7352
+8791
+7946
+2645
+3077
+2472
+8540
+3899
+
+1213
+10474
+7930
+5316
+11096
+10787
+
+7751
+8218
+7879
+8170
+5336
+4773
+2971
+
+7557
+7474
+9296
+8558
+7641
+1068
+3347
+6756
+7617
+
+5566
+3789
+5784
+5881
+4738
+4895
+5831
+3817
+4629
+6010
+2793
+2218
+3865
+5528
+3665
+
+4320
+10546
+16280
+15648
+
+18779
+18602
+7520
+13356
+
+6565
+1954
+4598
+6625
+2463
+4273
+3043
+8790
+5762
+1503
+
+13009
+4498
+4393
+5336
+3138
+
+15543
+2341
+6304
+5639
+6256
+
+6331
+4454
+2345
+1124
+6006
+5813
+2886
+3073
+3293
+5063
+1354
+2393
+1716
+5859
+
+4042
+11448
+4722
+4065
+2564
+4680
+7137
+
+3041
+4125
+13893
+11770
+2732
+12694
+
+28615
+26674
+
+3977
+5632
+3242
+6609
+2500
+2217
+4261
+5931
+4534
+5477
+2006
+4116
+
+3313
+9570
+9939
+11281
+
+7451
+7347
+12397
+3187
+
+3831
+5409
+6612
+4038
+5429
+7220
+3213
+5834
+1043
+
+13216
+6789
+9845
+14985
+8636
+
+1946
+2753
+4663
+8403
+9734
+8544
+6543
+
+34337
+26042
+
+36556
+
+2547
+4825
+7135
+3044
+7208
+2944
+7833
+4862
+6173
+8071
+4761
+
+5873
+3682
+7244
+1730
+1772
+7769
+2918
+4218
+1023
+2455
+6080
+
+3570
+5980
+4490
+1981
+2436
+1112
+6550
+2961
+
+9143
+2994
+16445
+7019
+
+8694
+5668
+9695
+12470
+3378
+1507
+
+5635
+1416
+6259
+4973
+2380
+5967
+5318
+1458
+3716
+4120
+5052
+5109
+
+4340
+8037
+6849
+2338
+3244
+6606
+7927
+3730
+5845
+6104
+
+6308
+4794
+2554
+6888
+2421
+6111
+3138
+1378
+2900
+4605
+6238
+5406
+2247
+
+11418
+7701
+11495
+11885
+10029
+11641
+11332
+
+5508
+5347
+7547
+4952
+2723
+8328
+4798
+6021
+8483
+
+5055
+6257
+4018
+6346
+3311
+3627
+6342
+6584
+3424
+3992
+7528
+
+5342
+8694
+7019
+8284
+2334
+1171
+2779
+8541
+1702
+
+1749
+20019
+10614
+18044
+
+20394
+
+10207
+4933
+1638
+9497
+12225
+4544
+
+3368
+6864
+9065
+9185
+9227
+7255
+2637
+1060
+
+52998
+
+23595
+
+1170
+4926
+9829
+3766
+7174
+9097
+12032
+
+36364
+5780
+
+1625
+9224
+2238
+5754
+6376
+5034
+8479
+5567
+
+4619
+5442
+6888
+4575
+3045
+6504
+7238
+8719
+4287
+3369
+
+4910
+2276
+3373
+2427
+
+4744
+4440
+4882
+1654
+1383
+4050
+2655
+5017
+5017
+4406
+6165
+3485
+6644
+
+12298
+19934
+20799
+
+6035
+7465
+1320
+2841
+5323
+6593
+3844
+2566
+3581
+2277
+7000
+3446
+
+10100
+6221
+7154
+10715
+5403
+5817
+5493
+10765
+
+9840
+17836
+23719
+
+69997
+
+5868
+4308
+5646
+2780
+3380
+4430
+1866
+2576
+4112
+7519
+
+3016
+6396
+1049
+2504
+5407
+5096
+5774
+3075
+3882
+6391
+1265
+3090
+2011
+3854
+
+4805
+5343
+2348
+5703
+6845
+9201
+
+2257
+2191
+5766
+2367
+5266
+4557
+4775
+5002
+2852
+2762
+5583
+2346
+5498
+5229
+3284
+
+2600
+2550
+5165
+5058
+1024
+6091
+2110
+5217
+2214
+5005
+2508
+3289
+4065
+6085
+3940
+
+4881
+5936
+4255
+5793
+4214
+4542
+4409
+4953
+5407
+4425
+5316
+1327
+5725
+5034
+3402
+
+5093
+2531
+5251
+7342
+3235
+1383
+2164
+3121
+1979
+7601
+
+5867
+9293
+3015
+8686
+11529
+10826
+5501
+
+8326
+10945
+4822
+4701
+5311
+10242
+7515
+
+7078
+3981
+1848
+4816
+2583
+2110
+4625
+5009
+6140
+5201
+4130
+
+20665
+1178
+23165
+
+33789
+25174
+
+3801
+2592
+3001
+4180
+9212
+1027
+9317
+6684
+7877
+
+6636
+1386
+3450
+6574
+4763
+1887
+3690
+3244
+2140
+5516
+1689
+3070
+6309
+
+5778
+3825
+2954
+4036
+3178
+1517
+5303
+2880
+5378
+6008
+4958
+4113
+3747
+5410
+5939
+
+36915
+
+8201
+4720
+7448
+2232
+8264
+1116
+5885
+
+3694
+1735
+1887
+4584
+1623
+3816
+2410
+5185
+5460
+4713
+2138
+5037
+3677
+
+8046
+11638
+5355
+13513
+12550
+13192
+
+4306
+2133
+4641
+4964
+6134
+2952
+3821
+5786
+3487
+4899
+4864
+2327
+5445
+
+1973
+3574
+6476
+1079
+3646
+2793
+3977
+3001
+5621
+2019
+1672
+5380
+5697
+3515
+
+8390
+3681
+2195
+9077
+1089
+12868
+
+62103
+
+8787
+1646
+3958
+5096
+6812
+6145
+2429
+
+6643
+1496
+5878
+3337
+7204
+
+6255
+10369
+4881
+4935
+7007
+4768
+9885
+1814
+
+6913
+12459
+4547
+2402
+2865
+
+1949
+5860
+3815
+3056
+6115
+3908
+2710
+1829
+1578
+2009
+3563
+3932
+5331
+3646
+4126
+
+3501
+3328
+1715
+1473
+1160
+1747
+1684
+4764
+4452
+1783
+2620
+3930
+5486
+5243
+
+4432
+2616
+9355
+5382
+1429
+8084
+2964
+8552
+8865
+
+36073
+
+1105
+8022
+24991
+
+13418
+9148
+5812
+2972
+9812
+10902
+
+5410
+5806
+9323
+7922
+4277
+7621
+2253
+6668
+
+9702
+5504
+4030
+2157
+11223
+10259
+2402
+
+9556
+34592
+
+6526
+1994
+
+16897
+
+2689
+2831
+7780
+6615
+3969
+1464
+5460
+4424
+2175
+1885
+1685
+
+37834
+
+7453
+3193
+5091
+3141
+2922
+1241
+5245
+1501
+1512
+7675
+5692
+
+17587
+35323
+
+2648
+4990
+2970
+2305
+6237
+7660
+4916
+2616
+3972
+4909
+8065
+
+5371
+5794
+7604
+3364
+1694
+7020
+9315
+1820
+3968
+
+49341
+
+4162
+1462
+2689
+5095
+9156
+2742
+1658
+1309
+4020
+
+11687
+16684
+5447
+
+4845
+4163
+6133
+8180
+12086
+2243
+
+10812
+20831
+10266
+
+4483
+4639
+2488
+2726
+2648
+4743
+2504
+3434
+2712
+3162
+5216
+3527
+5253
+4209
+2490
+
+10741
+
+4587
+7550
+3473
+8369
+2352
+10693
+8240
+4686
+
+28089
+12007
+
+20237
+5117
+
+8327
+9836
+9731
+1072
+7756
+5369
+9698
+
+6278
+5004
+4430
+1886
+5311
+1739
+6286
+1430
+3231
+2418
+5417
+6422
+3206
+5088
+
+1272
+1919
+1895
+6589
+4355
+6502
+4267
+5637
+4307
+4477
+5225
+5227
+
+9966
+4409
+10449
+7412
+7075
+4594
+2119
+9726
+
+16916
+6721
+9944
+15432
+
+17592
+18004
+5225
+10016
+
+9213
+19610
+20162
+
+3918
+6797
+3787
+7041
+3630
+5849
+3430
+2203
+4366
+6376
+2992
+
+3082
+10765
+5785
+12703
+13868
+
+2201
+4102
+6221
+5830
+1028
+3113
+4494
+6513
+1377
+7266
+1681
+7344
+
+6257
+6737
+3007
+5806
+6944
+3859
+4179
+3941
+1326
+2612
+5409
+2487
+5770
+
+2226
+1299
+1175
+2495
+4616
+4634
+4813
+2513
+4087
+2923
+6696
+4685
+4534
+
+15449
+11718
+
+1555
+5733
+4221
+2184
+3542
+5589
+1625
+1967
+5404
+4791
+5652
+1699
+4204
+2262
+5576
+
+6748
+12465
+12449
+4204
+12854
+13248
+
+19689
+6415
+5903
+3186
+
+5453
+5106
+4496
+5847
+6612
+4040
+1680
+2593
+6368
+3120
+3529
+4363
+1230
+
+67021
+
+1065
+7500
+8384
+3594
+4812
+2121
+1678
+5464
+2908
+1094
+
+4501
+2791
+5861
+3318
+3082
+6421
+5518
+8761
+9142
+
+2390
+4112
+4584
+1655
+3641
+1485
+4486
+3442
+6506
+2663
+3253
+2123
+4825
\ No newline at end of file
diff --git a/input/day1_example.txt b/input/day1_example.txt
new file mode 100644
index 0000000..444e241
--- /dev/null
+++ b/input/day1_example.txt
@@ -0,0 +1,14 @@
+1000
+2000
+3000
+
+4000
+
+5000
+6000
+
+7000
+8000
+9000
+
+10000
\ No newline at end of file
diff --git a/src/day1.rs b/src/day1.rs
new file mode 100644
index 0000000..4ff32f6
--- /dev/null
+++ b/src/day1.rs
@@ -0,0 +1,38 @@
+use std::cmp::Reverse;
+use crate::day_solver::{DaySolver};
+use super::util;
+
+pub struct Day1 {
+ elfs: Vec>
+}
+
+impl Day1 {
+
+ pub fn create() -> Self {
+ // let lines = util::read_file("input/day1_example.txt");
+ let lines = util::read_file("input/day1.txt");
+
+ // Parse the input into a nice data structure
+ let elfs = lines.split(|s| s.is_empty())
+ .map(|s| s.iter().map(|i| i.parse::().unwrap()).collect::>())
+ .collect();
+
+ return Day1 { elfs }
+ }
+}
+
+impl DaySolver for Day1 {
+
+
+ fn solve_part1(&mut self) -> String {
+ return self.elfs.iter().map(|e| e.iter().sum::()).max().unwrap().to_string();
+ }
+
+ fn solve_part2(&mut self) -> String {
+ let mut calories_per_elf: Vec = self.elfs.iter().map(|e| e.iter().sum()).collect();
+ calories_per_elf.sort_by_key(|&c| Reverse(c));
+ let part2 = calories_per_elf.iter().take(3).sum::();
+
+ return part2.to_string()
+ }
+}
diff --git a/src/day2.rs b/src/day2.rs
new file mode 100644
index 0000000..3df008d
--- /dev/null
+++ b/src/day2.rs
@@ -0,0 +1,31 @@
+use std::cmp::Reverse;
+
+use crate::day_solver::DaySolver;
+
+use super::util;
+
+pub struct Day2 {
+}
+
+impl Day2 {
+
+ pub fn create() -> Self {
+ // let lines = util::read_file("input/dayX_example.txt");
+ let lines = util::read_file("input/dayX.txt");
+
+ // Put the input into the day struct
+ return Day2 {}
+ }
+}
+
+impl DaySolver for Day2 {
+
+
+ fn solve_part1(&mut self) -> String {
+ return 0.to_string();
+ }
+
+ fn solve_part2(&mut self) -> String {
+ return 0.to_string();
+ }
+}
diff --git a/src/dayX.rs b/src/dayX.rs
new file mode 100644
index 0000000..ec5b955
--- /dev/null
+++ b/src/dayX.rs
@@ -0,0 +1,29 @@
+use crate::day_solver::DaySolver;
+
+use super::util;
+
+pub struct DayX {
+}
+
+impl DayX {
+
+ pub fn create() -> Self {
+ // let lines = util::read_file("input/dayX_example.txt");
+ let lines = util::read_file("input/dayX.txt");
+
+ // Put the input into the day struct
+ return Day2 {}
+ }
+}
+
+impl DaySolver for DayX {
+
+
+ fn solve_part1(&mut self) -> String {
+ return 0.to_string();
+ }
+
+ fn solve_part2(&mut self) -> String {
+ return 0.to_string();
+ }
+}
diff --git a/src/day_solver.rs b/src/day_solver.rs
new file mode 100644
index 0000000..bfac4f2
--- /dev/null
+++ b/src/day_solver.rs
@@ -0,0 +1,6 @@
+
+pub trait DaySolver {
+ // fn create() -> Self;
+ fn solve_part1(&mut self) -> String;
+ fn solve_part2(&mut self) -> String;
+}
diff --git a/src/main.rs b/src/main.rs
new file mode 100644
index 0000000..0c661c9
--- /dev/null
+++ b/src/main.rs
@@ -0,0 +1,97 @@
+use std::time::Instant;
+use crate::day1::Day1;
+use crate::day2::Day2;
+use crate::day_solver::DaySolver;
+
+#[macro_use] extern crate lazy_static;
+
+mod util;
+mod day1;
+mod day_solver;
+mod day2;
+
+
+const MAX_DAY: u8 = 1;
+const BENCHMARK_AMOUNT: u32 = 100;
+
+fn build_day_solver(day: u8) -> Option> {
+ match day {
+ 1 => Some(Box::new(Day1::create())),
+ 2 => Some(Box::new(Day2::create())),
+ _ => None
+ }
+}
+
+fn solve(day: u8, silent: bool) {
+
+ let solver = build_day_solver(day);
+
+ match solver {
+ Some(mut s) => {
+ let part1 = s.solve_part1();
+
+ if !silent {
+ println!("Day {} Part 1: {}", day, part1);
+ }
+ let part2 = s.solve_part2();
+ if !silent {
+ println!("Day {} Part 1: {}", day, part2);
+ }
+ },
+ None => println!("This day is not yet implemented")
+ }
+}
+fn main() {
+
+ let args: Vec = std::env::args().collect();
+
+ let day_arg_idx = args.iter().position(|a| a == "-d");
+ let single_day = day_arg_idx.is_some();
+ let day = if single_day { args[day_arg_idx.unwrap() + 1].parse::().unwrap() } else { 0 };
+
+ let benchmark = args.contains(&String::from("--bench")) || args.contains(&String::from("-b"));
+
+ let mut bench_results: Vec = Vec::new();
+
+ // This is essentially the warmup for the benchmark:
+ run_once(single_day, day, false, &mut bench_results);
+ let first_run_time = bench_results[0];
+
+ if benchmark {
+ // Ignore the warmup run in the rest of the benchmark:
+ bench_results.clear();
+ for _ in 0..BENCHMARK_AMOUNT {
+ run_once(single_day, day, true,&mut bench_results);
+ }
+ }
+
+ let avg_runtime: u128 = bench_results.iter().sum::() / (bench_results.len() as u128);
+
+ println!("Executed {} rounds; Execution took {} μs {}", BENCHMARK_AMOUNT, avg_runtime, if benchmark { "on average" } else { "" });
+ if benchmark {
+ bench_results.sort();
+ println!("Min: {} μs, Max: {} μs, Median: {} μs",
+ bench_results[0],
+ bench_results[bench_results.len() - 1],
+ bench_results[bench_results.len() / 2]
+ );
+ println!("First time took {} μs", first_run_time);
+ }
+}
+
+fn run_once(single_day: bool, day: u8, silent: bool, bench_results: &mut Vec) {
+
+ let now = Instant::now();
+ if single_day {
+ solve(day, silent);
+ } else {
+ solve_all(silent);
+ }
+ bench_results.push(now.elapsed().as_micros());
+}
+
+fn solve_all(silent: bool) {
+ for day in 1..(MAX_DAY + 1) {
+ solve(day, silent);
+ }
+}
\ No newline at end of file
diff --git a/src/util.rs b/src/util.rs
new file mode 100644
index 0000000..61414af
--- /dev/null
+++ b/src/util.rs
@@ -0,0 +1,13 @@
+use std::fs;
+
+pub fn read_file(filename: &str) -> Vec {
+
+ let contents = fs::read_to_string(filename)
+ .expect("Couldn't read file!");
+
+ let mut res: Vec = Vec::new();
+ contents.lines().for_each(|l| res.push(String::from(l)));
+
+ res
+
+}
\ No newline at end of file