summary refs log tree commit diff stats
path: root/2022/day-01
diff options
context:
space:
mode:
authorAndinus <andinus@nand.sh>2022-12-01 13:53:24 +0530
committerAndinus <andinus@nand.sh>2022-12-01 13:53:24 +0530
commit2cb4ddc5393f67ff53d991c76f938dd06fc7bf93 (patch)
tree87a75c69f4bdfb47e6ffd5cffeba0f396a0a9e1c /2022/day-01
parent72984202e1da518ee4b3201369ed50699bb840b0 (diff)
downloadaoc-master.tar.gz
Add 2022/day-01 solution HEAD master
I'll add readme later.
Diffstat (limited to '2022/day-01')
-rw-r--r--2022/day-01/day-01.raku7
-rw-r--r--2022/day-01/input2231
2 files changed, 2238 insertions, 0 deletions
diff --git a/2022/day-01/day-01.raku b/2022/day-01/day-01.raku
new file mode 100644
index 0000000..cbe8b92
--- /dev/null
+++ b/2022/day-01/day-01.raku
@@ -0,0 +1,7 @@
+#!/usr/bin/env raku
+
+# @calories records calories carried by each Elf, sorted.
+my Int @calories = "input".IO.split("\n\n").map(*.lines.sum).sort;
+
+put "Part 1: " ~ @calories.tail;
+put "Part 2: " ~ @calories.tail(3).sum;
diff --git a/2022/day-01/input b/2022/day-01/input
new file mode 100644
index 0000000..c624c99
--- /dev/null
+++ b/2022/day-01/input
@@ -0,0 +1,2231 @@
+8417
+8501
+5429
+2112
+6482
+7971
+9636
+4003
+
+4697
+2941
+3275
+6060
+4879
+7158
+5066
+3196
+5780
+3143
+2510
+7073
+
+3820
+6710
+4781
+6241
+3975
+6308
+5289
+6575
+2662
+4804
+5352
+4610
+
+18980
+3731
+16643
+
+6500
+2810
+13252
+5288
+2110
+12393
+
+5354
+5521
+6015
+2501
+6067
+2465
+2201
+3864
+2661
+4078
+2399
+3212
+2831
+3268
+2726
+
+4701
+4530
+1699
+3015
+3682
+2537
+4554
+2826
+1895
+2652
+4074
+
+3650
+2113
+4750
+6639
+5177
+3823
+1529
+5671
+3679
+7061
+
+1984
+3240
+7139
+1931
+6740
+5695
+6572
+3264
+2904
+7199
+
+4982
+3483
+3358
+2762
+3983
+1341
+7420
+5830
+5709
+6140
+5363
+2636
+
+8943
+9452
+14560
+11685
+9792
+
+51549
+
+4032
+3303
+6291
+2010
+1099
+4304
+3308
+3226
+7038
+5911
+
+3627
+4414
+3217
+3388
+5294
+1914
+4938
+1120
+3825
+4163
+5549
+1712
+2589
+1550
+
+3683
+5829
+3937
+6935
+8588
+2765
+9142
+6662
+
+2440
+1029
+5550
+4674
+3176
+1791
+3867
+2779
+5259
+4676
+5868
+2371
+4557
+1058
+
+5431
+7001
+1789
+7292
+2550
+6087
+6538
+3913
+6977
+2262
+5710
+2555
+
+10586
+1560
+9521
+6677
+7222
+7567
+9516
+
+2974
+4438
+5184
+1797
+3472
+3685
+4252
+3512
+6003
+3274
+6482
+5545
+6207
+3442
+
+2542
+2128
+3556
+3399
+2355
+2355
+2887
+5069
+6026
+2508
+1716
+1556
+2295
+3955
+
+25725
+15128
+7375
+
+14056
+1829
+18860
+
+55324
+
+6072
+6692
+4264
+6261
+1588
+1143
+7373
+6603
+5488
+3320
+2545
+5954
+
+18062
+29180
+
+3677
+6522
+4883
+7097
+5284
+2549
+
+48546
+
+3552
+4460
+1059
+2662
+4123
+4032
+4430
+3578
+3441
+3895
+3487
+1717
+5564
+2195
+5687
+
+3760
+3157
+2112
+5937
+5018
+4986
+1568
+7508
+2288
+4252
+4226
+
+8943
+35829
+
+3615
+4087
+16628
+9725
+
+18133
+3552
+19658
+8840
+
+5401
+2506
+2988
+4760
+5149
+2556
+1375
+2458
+1349
+6012
+3101
+1719
+4705
+
+1915
+4351
+4834
+6064
+1864
+6366
+1081
+4066
+4200
+6982
+1148
+6685
+
+6497
+19940
+5418
+19755
+
+6763
+4697
+4844
+6105
+7080
+7110
+3403
+1635
+2373
+4737
+1538
+4517
+
+55242
+
+5390
+4892
+9004
+6322
+2309
+
+14406
+2408
+3189
+13705
+15881
+
+8001
+4336
+7789
+3403
+7771
+5339
+3603
+2882
+2789
+5457
+
+5291
+1004
+4796
+5162
+3295
+5628
+6048
+8055
+2805
+2979
+6347
+
+4342
+2131
+3900
+9516
+9941
+10085
+9855
+4946
+
+3766
+12591
+6027
+7521
+2532
+2965
+
+6640
+8130
+2235
+3616
+1513
+4982
+5757
+6450
+7833
+2535
+
+11114
+9350
+5189
+7416
+2510
+12480
+
+2161
+1329
+6055
+5304
+1213
+5987
+1021
+1484
+2736
+1594
+3897
+1298
+3701
+3500
+5264
+
+1393
+8359
+7732
+1479
+1367
+9665
+4956
+8989
+2423
+
+14947
+26722
+
+4382
+1257
+4970
+3681
+4299
+2421
+3996
+4978
+3178
+5039
+3989
+5297
+1322
+1941
+
+2901
+5088
+5876
+5770
+4000
+5408
+5932
+3787
+4428
+3649
+3000
+4528
+3172
+5852
+4803
+
+3841
+6352
+7104
+3285
+8693
+7082
+8890
+10598
+
+32634
+
+5064
+4469
+2675
+5662
+1483
+5918
+3117
+4976
+3964
+2474
+5210
+1632
+4618
+2106
+3214
+
+1940
+5559
+2138
+6436
+1860
+5369
+5147
+2794
+1714
+3409
+1892
+5806
+3899
+2305
+
+4500
+2147
+4251
+4609
+3619
+2567
+5201
+3390
+1319
+4424
+3005
+1397
+1693
+4714
+
+2415
+4424
+3809
+3615
+3269
+1986
+2018
+4848
+5122
+1968
+3075
+2470
+5922
+1937
+4125
+
+6317
+6637
+4533
+5743
+4806
+3129
+1306
+3957
+4663
+7623
+
+14487
+
+34032
+11976
+
+5839
+5692
+6716
+1473
+1572
+6622
+7735
+2335
+5670
+6461
+2705
+
+5643
+1721
+3150
+6460
+5134
+1124
+3925
+1463
+1951
+6910
+6680
+3038
+2685
+
+3205
+2335
+4418
+2358
+5683
+2334
+1910
+4780
+1315
+1613
+1523
+2882
+
+3266
+12924
+8477
+7172
+13876
+9290
+
+18737
+7661
+5950
+
+61407
+
+24968
+23181
+
+4341
+5288
+9306
+10062
+9350
+4045
+
+4607
+2565
+2507
+4183
+3101
+5356
+3384
+4707
+2040
+5622
+2513
+2429
+2496
+1069
+
+3590
+5290
+5371
+6878
+6657
+8246
+4479
+4906
+3830
+
+7894
+7018
+5222
+7556
+7754
+3433
+4862
+9010
+6891
+
+6337
+21986
+2791
+
+1075
+5278
+3373
+3820
+1277
+3217
+1349
+1758
+2934
+1298
+5885
+1544
+4560
+4384
+4804
+
+6345
+1952
+1082
+5949
+3946
+5991
+6474
+6288
+4526
+5059
+6081
+1155
+1388
+5735
+
+1166
+6023
+6465
+2215
+7056
+7369
+6983
+1051
+6578
+6131
+6334
+6491
+
+4486
+5666
+5937
+5460
+2587
+1803
+3938
+1771
+4157
+5144
+2624
+4098
+5403
+2063
+2746
+
+6953
+11646
+2940
+6280
+4667
+1413
+
+5913
+2811
+1258
+5507
+6685
+1464
+3137
+6716
+4217
+3656
+6306
+4198
+4557
+
+5846
+2427
+3635
+6365
+5987
+5964
+4458
+4119
+4522
+3972
+6216
+5551
+1705
+
+2125
+5680
+1450
+1701
+5256
+4673
+5045
+5515
+1432
+3565
+3246
+6050
+5755
+3390
+5847
+
+1655
+5405
+6132
+3714
+1627
+7477
+10344
+6058
+
+4914
+4975
+4158
+2466
+5685
+2484
+3594
+1037
+3369
+1022
+3917
+3185
+5233
+5571
+5222
+
+6996
+4804
+1923
+3688
+4808
+1448
+2836
+5346
+5266
+4603
+2173
+1082
+
+5730
+9574
+5903
+6668
+5482
+5088
+8905
+5333
+7135
+
+5377
+2192
+6250
+1581
+5354
+3088
+1125
+2676
+3780
+3977
+4634
+3810
+4168
+
+3173
+4961
+1384
+5868
+4666
+2902
+7158
+8275
+5856
+6056
+
+7098
+12466
+4255
+10181
+13726
+4866
+
+1681
+1910
+5175
+4773
+7702
+5183
+5759
+2788
+2596
+5676
+5361
+
+6560
+5352
+5182
+13627
+7612
+10355
+
+4780
+1702
+5111
+1101
+6959
+4120
+5441
+4818
+8091
+6480
+
+8332
+5999
+6744
+9027
+7948
+3470
+9144
+6675
+2996
+
+6961
+19157
+1485
+19127
+
+22926
+
+17211
+14166
+1463
+
+5074
+9836
+4387
+10138
+10072
+5791
+3683
+9806
+
+5623
+3668
+4324
+9990
+4865
+1793
+10752
+
+9739
+18699
+14526
+4157
+
+2785
+1804
+4527
+4430
+3373
+10323
+6855
+
+2075
+4828
+2026
+3909
+6410
+4035
+3709
+5177
+3259
+6033
+5534
+6097
+2578
+
+2246
+6146
+5899
+1864
+2881
+4628
+3176
+5663
+3088
+3834
+2935
+
+16262
+11795
+14098
+15140
+13228
+
+4323
+8674
+5497
+8305
+6261
+7846
+2593
+10156
+
+5309
+3112
+4563
+1434
+1107
+7130
+5727
+4950
+7466
+6218
+3641
+
+6379
+1200
+2050
+6235
+4257
+2532
+3132
+6179
+4883
+6282
+6576
+
+11097
+12482
+7593
+3300
+3342
+2184
+
+1950
+2753
+4277
+8130
+5451
+7991
+4993
+7978
+8004
+
+20042
+19430
+5442
+
+7059
+6666
+5832
+6485
+2405
+2744
+4710
+1726
+1121
+
+2277
+1842
+1575
+1955
+1906
+4176
+4114
+5040
+5552
+4857
+2775
+5033
+3488
+3971
+3550
+
+11844
+9703
+6549
+7779
+9117
+1536
+
+8861
+25738
+
+3649
+10095
+4132
+1888
+6453
+7269
+5898
+9769
+
+5465
+8855
+12706
+6698
+3456
+4949
+
+3093
+8425
+8580
+8693
+1401
+6281
+8069
+7607
+6368
+7467
+
+6885
+1469
+1315
+2335
+6669
+3226
+5261
+2477
+1931
+6691
+2575
+1377
+5029
+
+5220
+4639
+5985
+1669
+1162
+4269
+6532
+4630
+4169
+3164
+6896
+6432
+
+12705
+4248
+5011
+7544
+2040
+7767
+
+60119
+
+58181
+
+69195
+
+10643
+5605
+3433
+3275
+4741
+2858
+8151
+10582
+
+4299
+10093
+12455
+2583
+2604
+11520
+
+4609
+8245
+1989
+17043
+
+4998
+8893
+3978
+4961
+2847
+8109
+9266
+1034
+4808
+
+6593
+3208
+3966
+1649
+5952
+1961
+4517
+3911
+4239
+3255
+4144
+
+3721
+2249
+3195
+1827
+3942
+2713
+4481
+2475
+3566
+2701
+2832
+2372
+5281
+3315
+6029
+
+5817
+6495
+8621
+7101
+3936
+1675
+3309
+1873
+8737
+4558
+
+6533
+4655
+4205
+6051
+2902
+2566
+2173
+1535
+5827
+2807
+6391
+7194
+
+5844
+2233
+4210
+2293
+2529
+3081
+1524
+5844
+5931
+6456
+6427
+4873
+3195
+
+3101
+3627
+9503
+1451
+9148
+1990
+2748
+5949
+
+1357
+
+4305
+4183
+8665
+9225
+5169
+8711
+7360
+4352
+8762
+
+19297
+6700
+3922
+13161
+
+7177
+5207
+12649
+10712
+3766
+
+3197
+11717
+4128
+14139
+
+5844
+4035
+9789
+5874
+6510
+6863
+9172
+3398
+
+3289
+3003
+7463
+5109
+6382
+5082
+2587
+5094
+7545
+2487
+2585
+
+15763
+18524
+4143
+8602
+
+4828
+2314
+3592
+3742
+4802
+3369
+3590
+5778
+5439
+4261
+4063
+3117
+3004
+2803
+4503
+
+3356
+1306
+6227
+5953
+1962
+1596
+1031
+6259
+1314
+5303
+4053
+6606
+6141
+
+23367
+13468
+
+7561
+3664
+10113
+11060
+7173
+6770
+
+14496
+3114
+2958
+10451
+12975
+
+2779
+8809
+7880
+9646
+5169
+11946
+10951
+
+1808
+8038
+4003
+2639
+4307
+2437
+3374
+6114
+3179
+2414
+6346
+
+3683
+4271
+5347
+4651
+4209
+3216
+4860
+5151
+3676
+3964
+5855
+5537
+2334
+2847
+
+3036
+4491
+2992
+5222
+1007
+3398
+4412
+5978
+4514
+5111
+2173
+4115
+3297
+3917
+4087
+
+1120
+9199
+13194
+8285
+12725
+2925
+
+4647
+8917
+5082
+2858
+7782
+3193
+7282
+2432
+6432
+
+8143
+1337
+7526
+4612
+3111
+2914
+2283
+7143
+
+13219
+11724
+11762
+13753
+11229
+9784
+
+2649
+8191
+6390
+2745
+7430
+6038
+7916
+7448
+2535
+
+16115
+13575
+13440
+12313
+7022
+
+3839
+5604
+3500
+1413
+4189
+2483
+4394
+4244
+5173
+4677
+2620
+3916
+2756
+3345
+5480
+
+3136
+4946
+2793
+3039
+4646
+6070
+4631
+1187
+1349
+5338
+3411
+2576
+3330
+
+1836
+11177
+12819
+12092
+11081
+5211
+
+3380
+3522
+6853
+4943
+3560
+6687
+2925
+1849
+7189
+2430
+4195
+4027
+
+17162
+17251
+
+12148
+6285
+8465
+9842
+2740
+9321
+
+5968
+1099
+5670
+12712
+4090
+10669
+
+5599
+11408
+2321
+8643
+7657
+3127
+
+5527
+5415
+3154
+7523
+7113
+7944
+1210
+4328
+2435
+7446
+
+9572
+2600
+4927
+7038
+2863
+8806
+6209
+5458
+6332
+
+14202
+11728
+4854
+
+2445
+4571
+5676
+4766
+6356
+3013
+7160
+4432
+4641
+5337
+2949
+7099
+
+5446
+5189
+2921
+4698
+4187
+2921
+3446
+4539
+3540
+5492
+2071
+1449
+1923
+4901
+5579
+
+13333
+5770
+5180
+9001
+7376
+8291
+
+3865
+4909
+3073
+1720
+1261
+5913
+1136
+2052
+5530
+5411
+1702
+1550
+2913
+5178
+2584
+
+10717
+2353
+1830
+5310
+8508
+10132
+10255
+
+9848
+11390
+1490
+8553
+4819
+2115
+
+2023
+1214
+1606
+9515
+5918
+1391
+
+32192
+31035
+
+6595
+5614
+7624
+8271
+4408
+5528
+1851
+1879
+7449
+6260
+
+6197
+7995
+9114
+
+1713
+5615
+1103
+6443
+4641
+4952
+6313
+1337
+6825
+3202
+5031
+4031
+4673
+
+17667
+14248
+18603
+7973
+
+4832
+5010
+1017
+2983
+1808
+6429
+5847
+5974
+2629
+2190
+5018
+5594
+3316
+2445
+
+8857
+1902
+6649
+5100
+2108
+2331
+7523
+9370
+2149
+
+4877
+2080
+3225
+1529
+6630
+3562
+2262
+2460
+3366
+5855
+1527
+2721
+5946
+
+32414
+14299
+
+6015
+2017
+6133
+9382
+3482
+7670
+1090
+4911
+4220
+
+4475
+5519
+2909
+1638
+5199
+3699
+3179
+1962
+4396
+1750
+2375
+5751
+3907
+2693
+3037
+
+2510
+6869
+3477
+4511
+1178
+4193
+6442
+5839
+3640
+4681
+4547
+4390
+4146
+
+4965
+3818
+1807
+1184
+2238
+5347
+3971
+5439
+5111
+6372
+2632
+2137
+1616
+
+5784
+6903
+3123
+5558
+6147
+3532
+4366
+2303
+6913
+1180
+6775
+2658
+5388
+
+3315
+4958
+3185
+2507
+4022
+3424
+1123
+3518
+5329
+5409
+5895
+4483
+5391
+3281
+1485
+
+5753
+2212
+6587
+4668
+1712
+6688
+1846
+3009
+3829
+5361
+6819
+1247
+
+3500
+23879
+
+3471
+4339
+3831
+4004
+5783
+5540
+5242
+5588
+4065
+5878
+1615
+1441
+4345
+3932
+3752
+
+4206
+5411
+8355
+5696
+1314
+1549
+8447
+10241
+
+4882
+4973
+3042
+7802
+5574
+4666
+2738
+7655
+7766
+
+2498
+2714
+2695
+4724
+4075
+5588
+6234
+5988
+5455
+4229
+4890
+3590
+1722
+5413
+
+1034
+2896
+4742
+4024
+5667
+6076
+5041
+8378
+3271
+8737
+
+1411
+23272
+6602
+
+3363
+12044
+11777
+7395
+4856
+2881
+12001
+
+2064
+4239
+2992
+6806
+6814
+3037
+3173
+3336
+5565
+
+2053
+2518
+5120
+4318
+1240
+3674
+7302
+1160
+3537
+4288
+2983
+
+5826
+5926
+7843
+2996
+6079
+7832
+2716
+8027
+1470
+8005
+
+10435
+24340
+11044
+
+7277
+4053
+1588
+2648
+5715
+3133
+5720
+6702
+7375
+2244
+7196
+2918
+
+20699
+12028
+
+11053
+11400
+3604
+7989
+7666
+7379
+10696
+
+5916
+13989
+
+6510
+4784
+2679
+11144
+
+5017
+3999
+6453
+1013
+3002
+4568
+6255
+6327
+5108
+2654
+1390
+3828
+5913
+2765
+
+1242
+8316
+3256
+1006
+6026
+10319
+3552
+6538
+
+2266
+2011
+7466
+2302
+5729
+1468
+1527
+6297
+7443
+3490
+6348
+
+2767
+5816
+5452
+2946
+3461
+1647
+5520
+5237
+3193
+6009
+5393
+5583
+2746
+4326
+3446
+
+2147
+1913
+3254
+5992
+7458
+4791
+7670
+3815
+2950
+6429
+1796
+
+17982
+7519
+
+33743
+
+2744
+8866
+15440
+10433
+15680
+
+1710
+3609
+1849
+4343
+5780
+4180
+3584
+2376
+4885
+4627
+1885
+3348
+2099
+1006
+2550
+
+22016
+29227
+
+22422
+12606
+11998
+
+5357
+2121
+2744
+4713
+6531
+5164
+5774
+3553
+4974
+2279
+3932
+2702
+
+4518
+3189
+3337
+1722
+2096
+5583
+2532
+1486
+2548
+2643
+5666
+6102
+4889
+5184
+
+4730
+6382
+3208
+6277
+2724
+5944
+2098
+5082
+1984
+5999
+
+6747
+7644
+8933
+2013
+7112
+3608
+7377
+5398
+1166
+
+9919
+6479
+7831
+6544
+5801
+10986
+10245
+
+9314
+10790
+5728
+3835
+9597
+7245
+
+12744
+1502
+11126
+8626
+13645
+8998
+
+5883
+2823
+2589
+5695
+6506
+2769
+4070
+4731
+5193
+2890
+2243
+
+5437
+6241
+1398
+3651
+7865
+1854
+4169
+2921
+5701
+2839
+2277
+
+4279
+4987
+5933
+1476
+2572
+1320
+2304
+1148
+4617
+4571
+1202
+3799
+3033
+2079
+5217
+
+4247
+3918
+7174
+7333
+2215
+8351
+1339
+7229
+5266
+
+1357
+3298
+3348
+6580
+1364
+6996
+6527
+3579
+4631
+1355
+7165
+4424
+
+19948
+18739
+15360
+
+2666
+3271
+1581
+6748
+3957
+6221
+1543
+2058
+5185
+1264
+2211
+1826
+
+9309
+5622
+9303
+2516
+12117
+4126
+2700
+
+9949
+16352
+18404
+
+3351
+10708
+10017
+2594
+4711
+1749
+9432
+
+8877
+7738
+10940
+6554
+6358
+
+4961
+7610
+1594
+5133
+5937
+2581
+5131
+4044
+9096
+
+2157
+6653
+5601
+1394
+5724
+6487
+4100
+3519
+2273
+5199
+6924
+6953
+4903
+
+26443
+31228
+
+2953
+10062
+5321
+4145
+2668
+2525
+4886
+2965