about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2021-12-02 12:43:18 +0100
committerLeah Neukirchen <leah@vuxu.org>2021-12-02 12:43:18 +0100
commit9a76ba31c25d5adfacc41d5c7282fc48fe1113a6 (patch)
tree4e6568c4ef526a71370e6b9c47101e78f193418a
parent51f7210420ca4d6b9e6da1c058340fc871885ca9 (diff)
downloadadventofcode2021-9a76ba31c25d5adfacc41d5c7282fc48fe1113a6.tar.gz
adventofcode2021-9a76ba31c25d5adfacc41d5c7282fc48fe1113a6.tar.xz
adventofcode2021-9a76ba31c25d5adfacc41d5c7282fc48fe1113a6.zip
day01
-rw-r--r--day012000
-rw-r--r--day01.bqn3
-rw-r--r--day01.clj22
3 files changed, 2025 insertions, 0 deletions
diff --git a/day01 b/day01
new file mode 100644
index 0000000..530b9fb
--- /dev/null
+++ b/day01
@@ -0,0 +1,2000 @@
+173
+178
+179
+187
+196
+199
+200
+201
+210
+209
+210
+211
+221
+223
+235
+236
+237
+238
+242
+249
+247
+246
+256
+257
+258
+257
+258
+265
+293
+303
+304
+317
+322
+330
+336
+337
+340
+339
+350
+351
+352
+353
+349
+353
+342
+339
+341
+342
+348
+349
+350
+355
+362
+392
+388
+393
+404
+402
+401
+402
+405
+410
+411
+424
+425
+432
+434
+433
+435
+441
+420
+439
+461
+463
+464
+468
+469
+473
+485
+494
+493
+489
+490
+491
+497
+490
+491
+493
+519
+520
+553
+554
+560
+565
+574
+586
+599
+600
+601
+604
+578
+574
+578
+597
+598
+597
+607
+606
+608
+616
+613
+615
+618
+617
+619
+626
+638
+639
+650
+682
+686
+693
+696
+709
+715
+745
+747
+750
+751
+753
+760
+763
+764
+772
+776
+779
+791
+794
+795
+800
+799
+808
+814
+825
+826
+831
+830
+837
+853
+854
+863
+872
+873
+881
+885
+895
+896
+897
+895
+905
+909
+912
+916
+921
+919
+927
+929
+935
+936
+937
+948
+947
+948
+922
+926
+932
+931
+938
+958
+975
+977
+982
+985
+986
+987
+988
+1007
+1005
+1007
+1008
+1010
+1013
+1015
+1016
+1019
+1025
+1026
+1027
+1029
+1039
+1047
+1054
+1055
+1063
+1066
+1087
+1095
+1096
+1097
+1093
+1114
+1123
+1131
+1137
+1142
+1140
+1154
+1157
+1158
+1159
+1160
+1170
+1174
+1182
+1184
+1191
+1200
+1211
+1214
+1231
+1241
+1250
+1246
+1260
+1287
+1311
+1313
+1318
+1327
+1325
+1324
+1325
+1326
+1339
+1350
+1355
+1358
+1368
+1380
+1422
+1423
+1442
+1466
+1450
+1451
+1457
+1464
+1474
+1490
+1494
+1507
+1508
+1509
+1511
+1524
+1521
+1528
+1529
+1533
+1538
+1542
+1544
+1543
+1560
+1579
+1585
+1589
+1591
+1598
+1599
+1600
+1610
+1614
+1615
+1629
+1624
+1629
+1632
+1627
+1641
+1638
+1639
+1641
+1644
+1645
+1646
+1647
+1659
+1661
+1658
+1661
+1664
+1665
+1669
+1671
+1673
+1674
+1675
+1672
+1677
+1687
+1688
+1696
+1697
+1711
+1715
+1720
+1721
+1724
+1725
+1726
+1731
+1740
+1737
+1746
+1745
+1758
+1760
+1758
+1771
+1777
+1773
+1777
+1778
+1788
+1794
+1804
+1809
+1814
+1837
+1839
+1838
+1837
+1842
+1851
+1857
+1843
+1844
+1845
+1860
+1863
+1888
+1887
+1888
+1889
+1897
+1895
+1903
+1906
+1907
+1913
+1917
+1916
+1917
+1926
+1927
+1935
+1933
+1934
+1939
+1940
+1942
+1944
+1941
+1946
+1967
+1969
+1975
+1976
+1979
+1981
+1982
+1987
+1981
+1982
+1981
+1982
+1992
+2027
+2028
+2029
+2036
+2037
+2038
+2042
+2044
+2048
+2047
+2054
+2055
+2062
+2065
+2066
+2091
+2103
+2093
+2094
+2089
+2091
+2093
+2098
+2108
+2086
+2087
+2118
+2123
+2127
+2132
+2148
+2149
+2147
+2148
+2149
+2150
+2152
+2151
+2152
+2149
+2156
+2167
+2177
+2179
+2180
+2159
+2167
+2158
+2156
+2174
+2169
+2170
+2180
+2183
+2187
+2191
+2192
+2200
+2202
+2206
+2240
+2251
+2247
+2259
+2273
+2274
+2276
+2255
+2256
+2263
+2265
+2269
+2270
+2272
+2273
+2275
+2276
+2281
+2290
+2292
+2293
+2287
+2291
+2289
+2287
+2290
+2306
+2307
+2310
+2315
+2329
+2337
+2370
+2375
+2373
+2376
+2362
+2397
+2400
+2401
+2419
+2429
+2435
+2438
+2450
+2451
+2481
+2482
+2487
+2491
+2492
+2496
+2501
+2502
+2499
+2501
+2467
+2469
+2468
+2470
+2473
+2480
+2481
+2488
+2500
+2506
+2509
+2512
+2513
+2515
+2516
+2512
+2506
+2511
+2513
+2514
+2519
+2547
+2580
+2584
+2585
+2582
+2599
+2600
+2599
+2600
+2599
+2600
+2613
+2612
+2610
+2612
+2608
+2615
+2622
+2610
+2613
+2608
+2619
+2640
+2620
+2612
+2608
+2609
+2625
+2626
+2634
+2638
+2670
+2674
+2675
+2674
+2678
+2685
+2686
+2678
+2692
+2693
+2716
+2718
+2705
+2709
+2713
+2714
+2715
+2722
+2712
+2714
+2719
+2720
+2740
+2741
+2734
+2738
+2764
+2765
+2768
+2773
+2777
+2810
+2789
+2808
+2807
+2813
+2828
+2841
+2853
+2854
+2842
+2843
+2846
+2848
+2860
+2861
+2862
+2864
+2865
+2866
+2880
+2851
+2853
+2858
+2865
+2866
+2873
+2885
+2886
+2887
+2893
+2914
+2916
+2924
+2925
+2927
+2929
+2949
+2967
+2968
+2976
+2965
+2983
+2985
+2984
+2991
+2993
+3007
+3005
+3012
+3015
+3019
+3025
+3030
+3034
+3043
+3044
+3085
+3094
+3124
+3139
+3146
+3147
+3176
+3196
+3199
+3200
+3246
+3251
+3254
+3286
+3280
+3287
+3289
+3288
+3290
+3294
+3306
+3307
+3309
+3312
+3327
+3325
+3334
+3333
+3335
+3357
+3374
+3380
+3392
+3393
+3406
+3416
+3417
+3431
+3418
+3439
+3452
+3468
+3469
+3474
+3490
+3489
+3490
+3491
+3513
+3512
+3513
+3514
+3515
+3516
+3517
+3513
+3514
+3508
+3520
+3522
+3521
+3520
+3531
+3533
+3545
+3546
+3554
+3558
+3559
+3560
+3565
+3578
+3570
+3573
+3574
+3580
+3592
+3593
+3594
+3595
+3596
+3617
+3625
+3624
+3626
+3629
+3635
+3634
+3640
+3661
+3668
+3671
+3674
+3675
+3679
+3688
+3692
+3698
+3700
+3696
+3697
+3701
+3707
+3697
+3699
+3703
+3702
+3700
+3711
+3714
+3715
+3716
+3722
+3741
+3751
+3752
+3759
+3782
+3785
+3786
+3787
+3799
+3807
+3810
+3809
+3816
+3794
+3796
+3800
+3804
+3810
+3812
+3813
+3821
+3822
+3840
+3851
+3866
+3867
+3875
+3895
+3913
+3905
+3917
+3918
+3913
+3921
+3927
+3931
+3936
+3957
+3956
+3958
+3959
+3980
+3979
+3986
+3997
+3988
+3989
+3990
+3994
+3995
+3999
+3993
+4024
+4022
+4018
+4019
+4031
+4032
+4033
+4043
+4045
+4047
+4048
+4058
+4067
+4077
+4069
+4070
+4080
+4087
+4113
+4118
+4123
+4128
+4132
+4144
+4149
+4152
+4131
+4160
+4175
+4176
+4177
+4176
+4179
+4191
+4196
+4201
+4202
+4205
+4214
+4216
+4217
+4210
+4212
+4216
+4217
+4220
+4219
+4220
+4225
+4244
+4245
+4247
+4257
+4249
+4250
+4245
+4246
+4249
+4258
+4259
+4260
+4268
+4245
+4258
+4263
+4275
+4276
+4275
+4265
+4274
+4273
+4274
+4291
+4292
+4298
+4295
+4297
+4283
+4284
+4285
+4293
+4294
+4323
+4325
+4334
+4335
+4337
+4342
+4346
+4349
+4346
+4341
+4342
+4344
+4351
+4352
+4367
+4372
+4378
+4388
+4389
+4396
+4414
+4416
+4419
+4420
+4421
+4423
+4428
+4430
+4456
+4460
+4469
+4468
+4499
+4488
+4491
+4496
+4497
+4500
+4511
+4497
+4498
+4499
+4505
+4508
+4510
+4522
+4523
+4533
+4540
+4553
+4554
+4561
+4562
+4594
+4607
+4617
+4620
+4619
+4620
+4621
+4626
+4640
+4658
+4657
+4658
+4661
+4664
+4665
+4667
+4675
+4686
+4687
+4711
+4714
+4719
+4720
+4736
+4750
+4753
+4761
+4749
+4766
+4775
+4776
+4803
+4804
+4820
+4835
+4836
+4839
+4816
+4818
+4817
+4821
+4855
+4880
+4881
+4887
+4891
+4902
+4906
+4922
+4929
+4934
+4962
+4965
+4976
+4975
+4974
+4977
+4975
+4983
+4985
+4990
+4978
+4971
+4987
+4990
+4991
+4997
+4998
+5001
+5007
+5015
+5017
+5020
+5025
+5026
+5029
+5030
+5032
+5033
+5042
+5043
+5045
+5055
+5056
+5051
+5058
+5060
+5054
+5058
+5053
+5070
+5069
+5070
+5073
+5076
+5083
+5093
+5095
+5101
+5096
+5099
+5100
+5078
+5077
+5078
+5077
+5094
+5098
+5100
+5101
+5082
+5087
+5101
+5095
+5096
+5112
+5124
+5111
+5112
+5113
+5120
+5131
+5132
+5139
+5133
+5137
+5139
+5141
+5143
+5142
+5150
+5131
+5136
+5138
+5137
+5144
+5145
+5152
+5154
+5169
+5170
+5171
+5172
+5174
+5188
+5191
+5202
+5203
+5204
+5197
+5202
+5204
+5209
+5210
+5207
+5206
+5208
+5207
+5209
+5213
+5214
+5215
+5216
+5215
+5221
+5225
+5227
+5224
+5216
+5223
+5217
+5223
+5234
+5235
+5236
+5239
+5245
+5249
+5248
+5270
+5275
+5276
+5280
+5282
+5283
+5285
+5295
+5317
+5316
+5303
+5304
+5307
+5311
+5315
+5319
+5336
+5344
+5348
+5365
+5368
+5373
+5365
+5368
+5381
+5379
+5384
+5398
+5396
+5408
+5439
+5455
+5458
+5453
+5457
+5459
+5467
+5485
+5468
+5469
+5470
+5469
+5476
+5477
+5488
+5504
+5501
+5504
+5508
+5521
+5524
+5526
+5527
+5545
+5543
+5549
+5551
+5552
+5554
+5582
+5591
+5593
+5583
+5584
+5590
+5595
+5596
+5600
+5605
+5610
+5621
+5622
+5633
+5637
+5645
+5647
+5679
+5680
+5681
+5720
+5722
+5724
+5731
+5734
+5746
+5744
+5745
+5751
+5755
+5758
+5759
+5790
+5791
+5796
+5798
+5803
+5806
+5808
+5818
+5820
+5815
+5825
+5827
+5832
+5833
+5839
+5845
+5850
+5846
+5848
+5856
+5858
+5867
+5866
+5872
+5862
+5866
+5872
+5880
+5881
+5882
+5889
+5915
+5938
+5955
+5958
+5959
+5960
+5961
+5962
+5986
+5989
+5992
+5989
+6005
+6004
+6008
+6004
+6006
+6007
+6011
+6012
+6014
+6028
+6046
+6047
+6050
+6052
+6062
+6075
+6076
+6081
+6093
+6099
+6102
+6106
+6109
+6110
+6115
+6116
+6117
+6118
+6122
+6123
+6124
+6136
+6127
+6128
+6131
+6132
+6150
+6151
+6153
+6156
+6159
+6157
+6169
+6178
+6176
+6177
+6197
+6222
+6224
+6252
+6248
+6263
+6262
+6264
+6265
+6282
+6288
+6293
+6297
+6298
+6299
+6303
+6329
+6338
+6349
+6348
+6353
+6372
+6376
+6384
+6385
+6386
+6376
+6381
+6383
+6384
+6396
+6397
+6398
+6401
+6406
+6409
+6411
+6413
+6424
+6428
+6431
+6429
+6439
+6443
+6446
+6449
+6452
+6460
+6445
+6446
+6455
+6454
+6467
+6490
+6499
+6519
+6520
+6525
+6526
+6559
+6560
+6561
+6565
+6566
+6575
+6577
+6578
+6579
+6584
+6585
+6596
+6598
+6599
+6600
+6607
+6606
+6607
+6619
+6620
+6621
+6632
+6635
+6639
+6643
+6644
+6658
+6652
+6653
+6666
+6668
+6665
+6667
+6676
+6680
+6681
+6680
+6683
+6686
+6688
+6691
+6673
+6689
+6690
+6698
+6700
+6701
+6699
+6691
+6688
+6687
+6689
+6687
+6688
+6700
+6718
+6722
+6727
+6739
+6737
+6746
+6758
+6739
+6747
+6749
+6761
+6764
+6769
+6768
+6769
+6773
+6751
+6758
+6761
+6770
+6789
+6774
+6780
+6785
+6820
+6814
+6811
+6812
+6818
+6816
+6817
+6832
+6836
+6841
+6853
+6868
+6869
+6872
+6873
+6875
+6899
+6906
+6915
+6927
+6939
+6942
+6943
+6939
+6942
+6950
+6953
+6961
+6956
+6982
+7020
+7036
+7042
+7055
+7064
+7070
+7085
+7100
+7101
+7102
+7103
+7085
+7099
+7103
+7106
+7117
+7123
+7147
+7151
+7149
+7150
+7154
+7162
+7165
+7166
+7167
+7171
+7181
+7193
+7195
+7196
+7199
+7200
+7180
+7187
+7185
+7180
+7184
+7188
+7191
+7193
+7199
+7201
+7208
+7210
+7211
+7212
+7216
+7217
+7227
+7243
+7261
+7273
+7285
+7293
+7296
+7297
+7300
+7299
+7309
+7311
+7314
+7316
+7336
+7342
+7343
+7354
+7372
+7374
+7378
+7398
+7403
+7407
+7429
+7446
+7448
+7481
+7487
+7486
+7492
+7496
+7497
+7498
+7496
+7497
+7499
+7500
+7499
+7502
+7503
+7509
+7512
+7511
+7510
+7512
+7500
+7502
+7503
+7506
+7513
+7514
+7526
+7527
+7537
+7539
+7538
+7543
+7524
+7533
+7534
+7557
+7567
+7568
+7569
+7561
+7562
+7568
+7569
+7586
+7594
+7598
+7613
+7615
+7618
+7619
+7612
+7625
+7626
+7632
+7633
+7631
+7650
+7664
+7665
+7666
+7674
+7685
+7686
+7700
+7704
+7700
+7682
+7684
+7685
+7686
+7688
+7686
+7682
+7695
+7700
+7701
+7717
+7719
+7717
+7718
+7728
+7732
+7734
+7738
+7739
+7742
+7757
+7758
+7765
+7766
+7763
+7769
+7766
+7771
+7774
+7786
+7790
+7793
+7783
+7789
+7790
+7801
+7822
+7829
+7836
+7837
+7838
+7854
+7855
+7868
+7872
+7876
+7877
+7878
+7880
+7894
+7905
+7907
+7926
+7942
+7948
+7949
+7950
+7951
+7953
+7956
+7967
+7968
+7969
+7986
+7988
+7990
+7989
+7980
+7978
+7980
+7992
+7993
+7990
+7994
+7995
+8000
+8009
+8010
+8012
+8009
+8024
+8026
+8037
+8038
+8029
+8028
+8031
+8033
+8048
+8059
+8057
+8062
+8077
+8078
+8087
+8086
+8094
+8113
+8115
+8124
+8123
+8124
+8125
+8123
+8125
+8126
+8155
+8156
+8154
+8155
+8161
+8162
+8170
+8178
+8179
+8191
+8193
+8196
+8206
+8208
+8200
+8204
+8205
+8217
+8225
+8226
+8240
+8242
+8269
+8281
+8288
+8316
+8341
+8358
+8366
+8364
+8369
+8360
+8361
+8369
+8386
+8387
+8393
+8414
+8408
+8409
+8410
+8411
+8412
+8416
+8423
+8434
+8437
+8436
+8439
+8441
+8437
+8400
+8410
+8411
+8412
+8419
+8414
+8415
+8417
+8419
+8421
+8420
+8404
+8419
+8409
+8412
+8417
+8420
+8427
+8428
+8442
+8449
+8450
+8452
+8453
+8448
+8449
+8444
+8449
+8450
+8448
+8468
+8476
+8475
+8478
+8500
+8501
+8507
+8508
+8532
+8540
+8544
+8542
+8548
+8550
+8554
+8565
+8581
+8598
+8601
+8592
+8595
+8598
+8599
+8600
+8597
+8598
+8602
+8603
+8620
+8623
+8628
+8644
+8620
+8610
+8611
+8614
+8615
+8622
+8633
+8636
+8632
+8640
+8639
+8643
+8646
+8641
+8681
+8682
+8683
+8691
+8693
+8691
+8693
+8705
+8704
+8705
+8711
+8712
+8715
+8716
+8717
+8719
+8720
+8721
+8728
+8729
+8731
+8717
+8725
+8726
+8730
+8734
+8752
+8758
+8761
+8764
+8727
+8759
+8760
+8761
+8762
+8770
+8780
+8782
+8785
+8755
+8758
+8759
+8766
+8769
+8780
+8781
+8785
+8811
+8813
+8818
+8845
+8846
+8864
+8869
+8873
+8875
+8879
+8884
+8886
+8887
+8890
+8891
+8892
+8893
+8900
+8925
+8927
+8929
+8932
+8936
+8919
+8924
+8916
+8923
+8924
+8926
+8937
+8938
+8945
+8948
+8951
+8957
+8960
+8950
+8980
+9004
+9007
+9008
+9009
+9010
+9011
+9012
+9015
+9011
+9008
+9009
+9008
+9018
+9017
+9038
+9047
+9048
+9055
+9061
+9062
+9074
+9075
+9078
+9064
+9081
+9091
+9090
+9103
+9079
+9080
+9105
+9113
+9115
+9116
+9117
+9144
+9148
+9149
+9160
+9163
+9165
+9166
+9167
+9169
+9171
+9173
+9175
+9196
+9201
+9206
+9211
+9216
+9217
+9218
+9224
+9243
+9248
+9238
+9244
+9256
+9260
+9253
+9261
+9263
+9262
+9260
+9267
+9274
+9279
+9298
+9299
diff --git a/day01.bqn b/day01.bqn
new file mode 100644
index 0000000..21c0f54
--- /dev/null
+++ b/day01.bqn
@@ -0,0 +1,3 @@
+d←•BQN¨•FLines"day01"
+•Out +´d<«d
+•Out +´d<«««d
diff --git a/day01.clj b/day01.clj
new file mode 100644
index 0000000..c9751f3
--- /dev/null
+++ b/day01.clj
@@ -0,0 +1,22 @@
+(ns org.vuxu.aoc2021.day01
+  (:require [clojure.string :as str]))
+
+(def data
+  (->> (slurp "day01")
+       (str/split-lines)
+       (map parse-long)))
+
+(def part1
+  (->> data
+       (partition 2 1)
+       (filter (partial apply <))
+       count))
+
+part1 ;; => 1688
+
+(def part2
+  (->> (map vector data (drop 3 data))      ; a+b+c < b+c+d <==> a < d
+       (filter (partial apply <))
+       count))
+
+part2 ;; => 1728