aboutsummaryrefslogtreecommitdiff
path: root/2022
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2022-12-01 06:14:45 +0100
committerThomas Voss <mail@thomasvoss.com> 2022-12-01 06:14:45 +0100
commitfaba8123fea6f386a9f1654056c3693e5acd521f (patch)
treecbe1f66024dd13763b1fe57f420fac198bce28b6 /2022
parentf3e3e3e354b87f4ce27bd74bf14cec05d06974b6 (diff)
Add 2022 day 1 solutions
Diffstat (limited to '2022')
-rw-r--r--2022/01/input2245
-rwxr-xr-x2022/01/puzzle-1.awk5
-rwxr-xr-x2022/01/puzzle-2.awk17
3 files changed, 2267 insertions, 0 deletions
diff --git a/2022/01/input b/2022/01/input
new file mode 100644
index 0000000..646120f
--- /dev/null
+++ b/2022/01/input
@@ -0,0 +1,2245 @@
+2832
+2108
+3082
+4328
+6843
+5121
+2869
+1366
+2358
+1680
+4980
+1161
+
+8026
+2154
+4242
+1023
+2744
+3162
+4093
+1150
+5397
+2738
+5657
+
+10954
+11208
+8034
+1636
+9430
+9421
+5025
+
+3837
+5938
+3967
+2942
+2727
+3623
+4070
+1748
+1795
+1687
+4023
+6068
+2558
+2570
+4214
+
+9679
+2986
+5168
+16463
+
+5912
+6008
+1259
+5378
+10740
+1642
+2617
+7821
+
+3840
+5265
+2104
+1510
+5477
+2636
+5920
+5939
+5430
+4482
+5603
+4915
+5416
+5897
+
+3932
+9344
+7536
+4925
+10088
+5253
+5625
+6800
+
+3928
+13714
+18995
+3569
+
+2424
+5188
+11199
+6078
+11525
+5155
+3142
+
+2595
+5893
+5590
+6270
+6095
+5279
+3726
+6015
+3985
+5455
+5190
+4897
+6632
+
+5046
+1424
+3629
+6204
+6187
+1149
+4145
+6953
+2958
+6312
+1592
+4614
+2859
+
+5750
+9606
+11706
+2629
+13635
+5611
+
+2162
+6014
+3168
+8052
+10781
+3762
+5653
+
+21918
+14739
+
+2431
+5955
+4810
+7476
+2529
+7985
+6040
+5864
+3459
+3347
+4853
+
+4695
+3911
+5590
+4439
+4874
+2251
+3967
+6895
+5801
+2720
+5125
+5575
+2057
+
+5642
+3714
+5127
+5083
+2925
+5048
+6368
+5883
+2287
+3276
+3326
+2207
+3377
+
+18373
+7075
+12254
+18539
+
+13758
+19556
+23565
+
+6463
+5076
+5429
+3105
+6201
+5959
+6474
+5740
+6997
+7567
+1883
+
+2316
+10793
+2985
+10596
+6910
+11957
+5984
+
+18521
+7234
+7943
+
+8774
+7905
+4375
+1788
+9244
+2259
+4842
+6313
+
+4496
+10446
+6917
+1113
+2509
+1229
+2999
+
+2158
+3221
+1412
+1484
+1768
+2621
+1087
+1152
+3625
+3767
+4859
+1220
+3745
+4374
+3712
+
+4072
+8998
+5778
+4361
+6138
+
+11068
+15488
+17001
+16349
+
+3493
+15148
+14490
+9502
+11101
+
+8952
+2731
+10734
+7581
+4799
+9379
+5405
+10345
+
+5008
+4456
+3824
+3025
+4493
+2369
+1050
+3368
+3266
+4641
+5932
+5774
+1287
+3001
+2934
+
+16879
+20950
+11598
+
+11948
+2932
+1672
+11100
+
+24636
+12299
+18577
+
+14198
+24466
+25429
+
+3539
+5867
+2303
+1372
+3757
+3255
+4606
+4703
+4477
+3515
+5287
+7330
+
+2673
+5936
+6292
+4183
+4963
+6462
+4193
+5588
+5140
+2825
+4784
+3210
+1682
+3746
+
+12296
+15184
+9500
+16390
+
+2816
+6984
+6514
+8120
+8000
+9203
+3716
+
+24745
+15138
+
+4456
+4546
+4903
+2885
+4578
+2588
+2946
+6634
+1414
+1239
+6070
+4651
+2749
+
+3755
+3424
+3633
+2325
+2730
+5526
+6877
+4528
+6567
+2626
+6429
+2464
+
+2159
+6338
+2919
+4039
+3091
+7916
+2833
+4192
+5486
+2220
+5616
+
+1025
+10572
+6790
+3174
+5986
+2465
+9046
+1559
+
+4652
+9609
+4804
+5109
+5301
+9886
+7094
+
+1888
+9582
+9566
+2777
+1234
+
+6231
+7939
+4757
+3026
+11324
+4069
+6366
+
+5078
+6127
+1616
+5894
+3707
+1031
+5544
+4880
+6766
+6411
+2767
+2642
+1197
+
+2954
+1929
+8070
+6836
+7396
+7779
+5059
+5299
+3101
+1108
+3408
+
+23715
+34978
+
+5986
+8393
+3943
+9746
+8118
+6464
+4882
+
+66377
+
+2291
+6079
+3131
+2006
+6250
+3864
+5167
+3150
+3909
+3435
+2679
+6801
+6361
+
+12399
+2412
+2223
+2628
+7269
+
+6446
+2771
+6190
+5186
+5672
+5414
+4361
+1204
+1306
+2448
+1425
+2860
+3235
+2123
+
+6648
+5782
+2695
+6432
+5396
+5628
+5713
+5889
+5862
+1082
+4800
+6132
+
+1804
+6681
+3451
+6039
+6573
+3927
+5420
+1443
+3711
+1906
+5490
+4212
+2221
+
+4960
+3469
+3779
+1215
+3665
+6336
+5876
+6523
+1211
+1051
+6900
+2665
+6116
+
+5650
+7059
+1520
+3284
+10604
+5219
+6087
+
+1385
+3922
+6315
+3317
+2532
+1591
+2191
+6198
+1667
+2358
+4424
+3384
+1452
+1878
+
+8968
+6735
+12578
+11709
+7573
+1140
+
+8445
+2956
+8682
+8315
+3698
+7811
+6875
+2514
+2348
+
+19576
+3115
+13589
+15609
+
+43635
+
+8805
+24653
+4664
+
+6088
+5967
+5407
+3638
+9220
+1047
+2792
+7947
+9559
+
+9635
+5762
+7826
+4419
+12047
+8603
+6995
+
+6103
+7299
+7646
+4602
+5535
+7703
+6427
+6826
+1506
+5826
+8019
+
+5341
+3445
+2020
+4685
+1068
+4974
+5251
+2968
+4358
+4057
+2686
+1122
+2914
+3998
+1247
+
+3096
+1152
+4346
+3685
+1365
+4059
+2774
+4958
+3561
+1036
+4612
+4404
+3419
+4733
+3484
+
+5167
+1180
+1172
+5057
+3974
+6226
+1309
+4009
+5230
+1105
+4158
+2016
+3786
+2513
+
+2940
+1134
+6443
+7340
+5325
+3750
+3839
+7379
+4766
+4173
+
+4547
+11948
+7129
+6433
+7101
+2361
+8366
+
+1507
+6017
+3115
+6258
+6404
+6000
+1869
+5286
+1623
+1410
+3739
+1632
+2433
+
+5846
+6515
+2172
+6728
+6626
+2611
+1583
+2759
+3192
+3197
+1057
+5425
+2712
+
+7224
+2884
+2611
+1784
+3902
+7393
+5299
+2389
+1941
+4128
+5461
+1015
+
+1743
+9456
+8535
+6753
+7773
+10241
+5969
+8666
+
+19734
+2085
+9467
+12261
+
+1778
+7318
+2654
+3489
+3276
+4511
+2533
+3292
+4718
+5173
+2267
+5451
+
+5567
+5103
+1888
+2210
+4582
+1260
+1264
+4326
+5352
+3549
+5226
+1875
+3156
+3571
+
+1380
+7048
+2322
+1694
+4611
+6541
+8334
+2071
+1390
+7593
+
+5343
+4878
+1115
+1400
+8760
+4952
+5444
+4012
+
+3021
+2193
+6671
+1502
+7320
+7557
+4150
+3959
+1818
+8798
+
+19469
+23032
+11831
+
+8257
+5493
+5583
+7627
+3801
+3468
+1742
+
+9306
+4711
+6825
+8310
+2782
+2447
+10195
+4287
+
+10790
+6505
+15999
+15093
+14116
+
+1469
+2435
+4534
+8314
+7762
+2064
+5315
+1109
+4439
+
+28459
+29638
+
+1530
+1274
+5799
+7684
+2594
+6179
+1450
+4017
+5336
+2397
+7630
+
+1467
+5771
+5730
+2600
+3958
+4481
+4994
+2718
+6763
+4521
+6496
+
+3638
+7722
+6498
+3612
+7521
+1310
+6183
+1850
+6394
+4763
+2657
+
+7537
+4591
+2179
+9064
+6970
+2782
+9339
+1265
+7281
+
+3380
+12388
+5521
+1191
+8912
+
+2776
+3427
+3206
+2075
+2589
+3545
+1806
+2603
+4079
+2700
+3430
+1185
+5708
+1322
+
+1466
+4217
+3529
+1232
+5654
+2061
+5435
+5875
+4521
+4841
+6114
+5252
+1185
+5842
+
+21001
+8876
+
+5131
+5556
+6014
+7791
+3957
+8731
+8053
+8015
+
+10379
+3070
+21154
+
+3012
+5818
+1144
+6315
+4495
+1846
+7923
+1340
+2675
+4955
+3654
+
+5014
+1838
+1302
+4994
+1105
+4055
+3542
+6260
+1219
+1737
+1191
+6069
+5293
+4765
+
+18556
+13230
+15065
+18284
+
+48135
+
+9070
+7739
+6829
+7932
+8713
+4312
+8262
+4925
+2769
+
+13528
+4077
+21766
+
+6782
+20020
+15396
+
+15610
+4166
+5153
+14554
+6008
+
+5875
+4131
+2371
+1381
+1793
+5487
+5816
+6051
+5595
+5412
+4800
+3069
+2332
+4360
+2380
+
+3310
+5210
+13776
+3665
+2335
+6094
+
+2728
+4544
+6050
+8616
+8297
+5501
+1544
+5770
+3807
+5388
+
+10758
+7573
+7170
+4945
+8868
+8074
+8055
+
+6053
+6804
+6870
+9779
+9992
+7935
+
+25222
+8776
+10549
+
+2785
+37443
+
+7055
+7876
+6587
+6322
+6447
+
+2403
+3529
+1514
+2202
+2622
+4484
+3216
+7798
+1135
+2120
+1624
+
+12169
+8212
+13127
+11115
+7072
+3080
+
+5017
+6458
+5226
+1287
+6413
+7938
+4211
+6724
+4862
+1242
+7481
+
+47712
+
+8432
+3562
+5349
+2961
+1171
+5888
+10533
+6771
+
+31566
+13234
+
+52095
+
+11601
+2394
+1084
+4909
+5592
+5718
+3912
+
+10963
+12196
+15697
+3599
+8635
+
+22503
+4376
+
+9918
+8408
+1882
+6546
+7045
+3395
+6931
+9059
+
+4664
+3815
+3110
+1676
+5396
+
+9459
+2435
+9466
+8929
+2587
+8181
+5385
+1703
+7383
+
+1271
+6006
+4250
+2558
+4734
+1817
+4695
+5683
+6119
+5150
+1060
+3814
+6012
+3977
+
+2690
+1343
+3990
+2648
+5829
+5590
+5609
+1718
+2148
+5400
+1130
+4659
+3463
+
+3287
+2098
+5050
+6246
+6901
+2001
+2289
+1892
+7836
+1358
+5224
+
+7024
+3331
+2742
+6134
+4850
+6971
+4798
+6270
+3375
+3678
+2791
+
+2968
+7186
+7213
+1818
+3735
+6366
+1138
+5386
+2479
+3978
+6926
+
+10692
+9805
+18086
+13749
+
+9566
+1552
+7121
+2410
+8839
+1581
+7143
+5682
+4454
+
+2580
+5217
+5391
+3347
+3384
+5377
+2047
+2465
+4622
+5743
+3015
+1305
+1960
+
+15710
+1936
+
+2012
+1530
+4286
+3519
+4311
+5820
+2446
+5807
+4890
+1242
+4685
+
+28724
+
+1094
+1190
+2500
+3617
+1286
+2430
+8633
+6728
+7392
+6037
+
+7997
+8802
+4988
+6780
+5537
+7377
+1238
+5501
+
+3131
+8597
+7966
+6157
+4817
+2327
+4515
+7983
+3165
+6785
+
+6203
+2841
+5423
+2632
+7410
+4532
+2012
+8719
+7507
+1449
+
+37282
+
+3012
+2285
+4191
+2242
+2014
+3836
+1261
+1951
+4484
+5194
+1328
+1295
+5970
+5030
+3604
+
+6092
+2930
+1517
+1064
+6648
+6112
+1392
+6746
+4490
+1785
+3352
+2248
+4975
+
+1774
+2925
+5667
+4315
+2228
+4088
+2936
+6062
+4679
+5220
+3173
+2961
+3431
+1907
+3213
+
+11417
+6055
+10378
+11585
+11495
+3286
+
+4242
+2198
+1453
+2454
+2088
+1068
+3263
+2082
+4262
+3684
+3614
+1624
+1772
+3144
+2264
+
+6044
+5100
+1281
+4829
+5966
+5878
+
+1648
+3848
+2167
+1269
+2907
+5569
+2338
+3106
+3710
+2819
+3167
+6767
+1247
+
+11542
+5319
+7390
+10247
+5825
+3701
+5173
+
+24038
+13030
+12703
+
+21677
+13326
+
+7060
+1796
+1544
+5340
+2291
+3485
+3469
+4839
+1484
+
+5894
+1537
+11507
+6994
+8819
+9523
+1286
+
+2034
+6244
+4109
+1153
+3516
+1981
+5427
+6918
+5572
+6415
+6618
+
+7353
+11049
+9629
+9086
+6160
+10827
+
+4833
+4240
+5281
+2985
+5001
+8689
+5876
+7358
+3057
+1477
+
+64086
+
+5607
+
+3536
+10591
+7185
+8614
+1048
+4488
+8893
+
+20808
+3764
+4172
+
+11061
+3485
+
+2184
+4986
+6147
+1483
+4170
+7920
+3623
+4908
+2433
+8087
+5981
+
+4145
+5088
+3079
+2696
+1069
+6533
+6205
+4633
+3393
+1875
+6734
+4047
+4783
+
+16756
+30731
+
+27320
+12665
+
+2342
+1130
+2482
+1540
+7263
+6251
+3244
+7960
+7255
+5031
+5540
+
+6945
+10279
+5400
+3868
+4448
+1159
+7190
+1858
+
+7499
+7600
+3816
+6417
+11374
+
+53260
+
+10436
+7554
+7263
+7794
+2222
+10687
+3170
+
+9157
+3146
+1723
+6066
+9016
+7758
+2885
+4938
+
+4079
+1302
+5794
+4695
+3859
+2063
+1108
+2669
+4541
+2125
+3846
+6019
+5780
+5048
+
+11772
+3333
+8185
+3786
+7493
+10737
+2954
+
+5412
+4386
+2105
+4871
+1621
+2588
+6143
+1314
+4979
+3222
+1918
+4300
+
+3598
+3198
+4102
+8638
+3899
+8204
+2209
+
+3851
+5188
+5494
+4102
+2427
+2568
+5264
+3951
+5236
+4779
+2152
+2163
+4852
+1866
+
+4900
+4865
+1946
+1585
+2073
+6066
+3482
+1118
+1250
+2125
+6795
+4522
+3602
+
+1352
+6115
+7150
+6257
+7255
+3150
+3372
+4024
+3744
+1436
+4558
+5741
+
+5330
+7428
+6493
+4217
+9133
+2001
+2117
+8205
+4679
+
+1039
+5446
+1385
+6914
+2516
+1703
+3439
+5279
+5214
+3995
+2455
+2006
+4653
+
+11735
+6890
+18785
+11174
+
+6361
+4088
+8048
+2118
+6994
+3985
+7492
+2137
+7852
+7743
+5795
+
+1399
+5322
+7254
+
+2887
+3842
+2467
+7211
+5307
+6887
+3368
+4678
+1254
+1202
+
+4740
+5746
+1742
+2749
+6503
+2949
+1161
+5671
+6057
+5157
+1619
+5947
+6338
+4537
+
+1448
+1427
+15871
+4776
+10021
+
+7272
+5789
+6013
+3511
+2392
+8082
+9583
+6188
+
+42302
+
+1943
+3178
+7626
+7150
+2064
+1486
+7344
+1988
+6079
+
+7075
+1400
+4314
+5688
+4630
+6478
+1247
+5885
+6741
+6403
+3825
+
+5186
+2077
+3021
+4983
+4907
+3529
+3227
+4448
+1144
+
+4816
+1427
+8101
+6482
+8208
+9606
+5595
+5328
+7792
+
+6090
+2627
+1141
+2740
+4856
+5727
+2102
+2985
+5365
+1041
+1036
+1636
+2345
+2379
+4654
+
+7437
+9144
+4579
+1225
+7821
+6909
+1844
+6643
+5680
+
+9820
+20439
+
+10177
+1834
+5160
+6476
+8352
+6981
+6495
+4232
+
+19764
+2091
+13751
+
+9408
+21846
+23438
+
+36692
+
+2312
+23451
+21444
+
+8577
+16088
+6638
+3195
+
+8178
+2765
+5564
+3191
+4604
+1430
+4034
+6644
+4469
+3445
+
+17210
+34046
+
+8370
+5176
+1309
+6288
+7944
+1098
+7113
+
+1468
+3241
+4149
+7521
+5759
+4483
+2993
+6307
+7456
+2687
+1646
+
+5728
+1132
+6223
+4918
+5095
+4815
+5589
+4549
+1827
+2757
+2134
+3079
+4709
+
+3905
+4016
+2848
+1499
+2841
+4670
+4478
+3694
+2334
+3019
+3761
+3986
+5486
+
+1096
+3760
+4569
+4388
+2661
+6027
+7493
+5582
+6502
+2966
+
+7501
+1109
+8955
+3136
+6744
+6849
+1916
+3971
+3396
+
+1865
+1631
+1981
+1333
+1431
+5516
+7613
+1926
+3224
+4058
+
+9732
+9318
+1299
+7300
+9826
+6425
+7878
+10546
+
+10269
+17150
+1771
+10243
+
+17664
+19265
+1710
+18754
+
+3695
+4063
+1571
+6002
+3421
+2712
+5175
+3987
+2780
+5452
+2383
+4207
+6162
+5926
+
+5918
+2169
+5996
+3842
+5338
+1061
+1221
+3034
+1357
+1447
+2178
+5486
+2861
+4633
+1822
+
+9053
+9367
+2796
+13702
+10292
+2461
+
+20214
+25924
+5012
+
+6229
+3670
+9939
+6177
+5980
+9907
+9698
+
+3846
+6923
+9058
+9689
+7405
+3684
+9010
+5705
+2877
+
+13046
+8583
+2706
+1403
+4918
+10851
+
+1349
+11562
+14857
+2260
+8315
+
+1375
+3094
+3849
+8763
+7189
+2550
+5346
+1905
+3498
+1416
+
+34144
+11430
+
+11590
+4032
+7238
+2641
+4778
+4260
+6007
+
+1226
+1934
+6034
+3159
+2234
+3509
+4759
+5837
+1789
+4726
+1075
+5543
+2774
+3144
+
+8556
+1675
+12135
+10831
+10837
+
+3087
+1977
+3832
+6304
+4023
+4219
+1594
+4685
+2650
+1652
+3029
+3913
+3970
+2311
+
+1088
+15228
+3891
+9920
+7675
+
+4758
+2544
+3198
+7038
+4561
+5105
+7469
+6070
+4917
+1288
+2099
+2257
+
+10202
+1478
+1355
+10235
+9177
+7656
+10315
+5359
+
+1336
+4004
+2306
+1358
+2831
+2861
+6211
+1492
+5542
+6370
+2111
+4289
+5037
+3784
+
+3083
+3535
+2551
+4519
+2305
+5878
+2102
+1477
+5529
+2048
+5068
+5816
+2887
+2567
+3309
+
+11079
+4417
+19925
+
+3159
+14561
+24535
+
+4712
+2595
+2996
+2035
+3697
+2792
+1377
+1002
+4955
+1728
+5072
+5754
+2671
+1267
+5035
+
+7438
+2343
+6421
+3441
+6451
+3448
+3853
+7268
+5461
+4265
+5232
+
+4224
+1229
+2945
+2152
+2899
+1055
+4692
+2627
+5771
+5807
+4868
+2069
+
+7271
+1691
+1945
+1814
+8487
+7836
+11053
+
+4542
+6055
+9464
+1919
+6973
+1526
+3408
+5265
+7587
+
+26489
+25984
+
+13254
+34865
+
+3338
+2313
+1854
+1232
+4036
+2156
+3203
+3959
+4643
+4045
+2097
+5726
+3509
+3801
+
+1530
+5956
+5236
+6895
+2136
+8084
+1550
+6776
+1042
+5389
+4815
+
+1479
+2337
+5443
+5880
+8131
+9774
+4225
+5564
+
+9111
+3248
+5761
+8147
+3285
+11468
+
diff --git a/2022/01/puzzle-1.awk b/2022/01/puzzle-1.awk
new file mode 100755
index 0000000..406a663
--- /dev/null
+++ b/2022/01/puzzle-1.awk
@@ -0,0 +1,5 @@
+#!/usr/bin/awk -f
+
+/[0-9]+/ { acc += $1; next }
+ { if (acc > max) max = acc; acc = 0 }
+END { print max }
diff --git a/2022/01/puzzle-2.awk b/2022/01/puzzle-2.awk
new file mode 100755
index 0000000..d8bbaaa
--- /dev/null
+++ b/2022/01/puzzle-2.awk
@@ -0,0 +1,17 @@
+#!/usr/bin/awk -f
+
+/[0-9]+/ { acc += $1; next }
+{
+ if (acc > max[1]) {
+ max[3] = max[2];
+ max[2] = max[1];
+ max[1] = acc;
+ } else if (acc > max[2]) {
+ max[3] = max[2];
+ max[2] = acc;
+ } else if (acc > max[3])
+ max[3] = acc;
+ acc = 0
+}
+
+END { print max[1] + max[2] + max[3] }