Done day 20
authorNeil Smith <NeilNjae@users.noreply.github.com>
Wed, 21 Dec 2022 12:30:31 +0000 (12:30 +0000)
committerNeil Smith <NeilNjae@users.noreply.github.com>
Wed, 21 Dec 2022 12:30:31 +0000 (12:30 +0000)
advent20/Main.hs [new file with mode: 0644]
data/advent20.txt [new file with mode: 0644]
data/advent20a.txt [new file with mode: 0644]
problems/day20.html [new file with mode: 0644]

diff --git a/advent20/Main.hs b/advent20/Main.hs
new file mode 100644 (file)
index 0000000..2b6b507
--- /dev/null
@@ -0,0 +1,58 @@
+-- Writeup at https://work.njae.me.uk/2022/12/21/advent-of-code-2022-day-20/
+
+import Debug.Trace
+
+import AoC
+import Data.List
+import Data.Maybe
+import Data.CircularList
+import Control.Lens
+
+data IndexedElem = IndexedElem { _idx :: Int, _shift :: Int, _value :: Int}
+    deriving (Show, Eq, Ord)
+makeLenses ''IndexedElem
+
+type MixList = CList IndexedElem
+
+key :: Int
+key = 811589153
+
+main :: IO ()
+main = 
+  do  dataFileName <- getDataFileName
+      text <- readFile dataFileName
+      let mixlist = successfulParse text
+      -- print mixlist
+      print $ part1 mixlist
+      print $ part2 mixlist
+
+part1, part2 :: [IndexedElem] -> Int
+part1 mixlist = findGrove $ mixRound $ fromList mixlist
+
+part2 mixlist = findGrove $ (!!10) $ iterate mixRound cMixlist
+    where cMixlist = fromList $ fmap scaleElem mixlist
+          scaleElem e = e & value %~ (* key) & shift .~ (((e ^. value) * key) `mod` (scale - 1))
+          scale = length mixlist
+
+mixRound :: MixList -> MixList
+mixRound mixlist = foldl' mixOne mixlist [1..(size mixlist)]
+
+mixOne :: MixList -> Int -> MixList
+mixOne mixlist elemIndex = insertL element $ rotN (element ^. shift) $ removeL elementFocused
+    where elementFocused = fromJust $ findRotateTo (\e -> e ^. idx == elemIndex) mixlist
+          element = fromJust $ focus elementFocused
+
+findGrove :: MixList -> Int
+findGrove mixlist = focus1 + focus2 + focus3
+    where mixlist0 = fromJust $ findRotateTo (\ep -> ep ^. value == 0) mixlist
+          focus1 = (fromJust $ focus $ rotN 1000 mixlist0) ^. value
+          focus2 = (fromJust $ focus $ rotN 2000 mixlist0) ^. value
+          focus3 = (fromJust $ focus $ rotN 3000 mixlist0) ^. value
+
+successfulParse :: String -> [IndexedElem]
+successfulParse text = fmap mkElem $ zip [1..] tns
+    where tns =  fmap read $ lines text
+          mkElem (i, n) = 
+                IndexedElem {_idx = i, _value = n, 
+                    _shift = n `mod` (l - 1) }
+          l = length tns
diff --git a/data/advent20.txt b/data/advent20.txt
new file mode 100644 (file)
index 0000000..3586d54
--- /dev/null
@@ -0,0 +1,5000 @@
+9562
+5730
+2261
+2720
+5413
+8411
+2090
+-122
+-4256
+8109
+6924
+-6692
+2965
+1885
+5550
+4257
+-3964
+1447
+-1173
+-3362
+-2671
+-4582
+7311
+2532
+3959
+8708
+-8299
+1001
+-4521
+1976
+-3916
+9768
+-822
+2106
+5815
+2106
+-6247
+5858
+455
+7303
+8451
+8642
+6817
+-9126
+-2953
+881
+-5057
+-9397
+1287
+4155
+-8832
+-8908
+-2896
+-925
+5852
+4040
+-6774
+7758
+1016
+-2979
+4774
+1151
+-2323
+6107
+-7866
+-2122
+-6473
+-6932
+2898
+-6717
+-1565
+4008
+-6658
+-4347
+7341
+3244
+-3343
+-851
+-7334
+6279
+-4198
+3143
+-7555
+-691
+3918
+-6448
+-2585
+831
+-6258
+-1842
+-8400
+-432
+-1501
+-4644
+-3142
+9149
+-9811
+5624
+-8852
+-8689
+-7368
+2533
+7808
+-4359
+-4393
+5524
+1703
+-4285
+-9011
+-2704
+4237
+8705
+-933
+1195
+-235
+3867
+2197
+4985
+9914
+-3118
+-4310
+2065
+-9886
+-5811
+1774
+-5547
+-7535
+1220
+-7485
+-7520
+3034
+-7748
+6206
+-3521
+4778
+-544
+2789
+-2936
+-6097
+1524
+-2836
+2593
+2315
+-3122
+7430
+-4568
+-7716
+-8244
+-2727
+2067
+4256
+4377
+6487
+737
+8056
+-2153
+-2864
+-2776
+7782
+9357
+7189
+594
+4126
+4774
+812
+-849
+1893
+-9488
+6004
+7263
+5610
+-9701
+8592
+6309
+5902
+6852
+904
+5211
+4493
+4684
+-4455
+8708
+-2601
+2451
+-9193
+-4568
+8906
+-4406
+4187
+2026
+-5188
+7760
+5435
+8239
+661
+812
+-4407
+8553
+3652
+3698
+9672
+-2323
+-9432
+8532
+-458
+8688
+-4842
+-2298
+4719
+4043
+5301
+4399
+4481
+2197
+5144
+5783
+-8585
+7239
+-2114
+2497
+-5878
+-211
+-429
+6533
+5991
+-2172
+-4582
+3048
+-4126
+8201
+8206
+-6461
+-32
+2984
+-172
+-1649
+-3708
+5463
+-1347
+-4662
+7998
+1982
+663
+-8453
+-6383
+-8070
+-6111
+-6103
+-4607
+6305
+-5833
+7093
+4299
+-3131
+-2631
+2641
+-872
+-6063
+8784
+72
+962
+2629
+9371
+-2754
+9588
+-6710
+-4245
+-4460
+9352
+-6002
+8937
+5596
+1393
+-1520
+-2385
+-589
+-7209
+6678
+9290
+-5209
+-5401
+7639
+-13
+8450
+8219
+-1517
+5592
+-5043
+-8310
+2090
+2055
+1903
+-3225
+-9264
+-4736
+1364
+-6546
+-253
+6840
+72
+-204
+6946
+-8299
+6123
+-5160
+-3233
+8601
+-2406
+-1323
+1519
+-6581
+-4440
+9654
+-7394
+7553
+7216
+4082
+751
+6086
+-6467
+2265
+5270
+-1357
+5698
+-3257
+-3662
+-3131
+1501
+-1286
+-9250
+4766
+9535
+-2907
+5048
+4475
+8986
+-7851
+3550
+-9087
+-2188
+8957
+3219
+-8643
+2265
+3063
+2924
+1953
+3144
+9518
+-9412
+5042
+3632
+-2570
+9862
+9941
+-8192
+-5999
+2162
+3027
+-1194
+4524
+6891
+6697
+918
+9631
+-379
+-3073
+2943
+5362
+-6948
+7548
+7554
+6163
+-7387
+-1524
+-2719
+1772
+-4895
+3115
+-3986
+7819
+-8154
+-687
+6661
+9147
+-6180
+9914
+3849
+43
+-9033
+6779
+4975
+-2564
+-6611
+-66
+-2859
+-1733
+3786
+-2920
+-3385
+-5655
+6090
+8623
+-6793
+7285
+-9432
+7470
+-4457
+-4451
+-7806
+5867
+-161
+969
+-1914
+9202
+2809
+6614
+-4393
+-4470
+-869
+9455
+6359
+-8986
+-8610
+124
+7736
+4498
+-3416
+6262
+-8545
+2650
+2426
+7790
+-5863
+-633
+-6187
+2769
+4020
+9988
+-937
+-3284
+9320
+6111
+3347
+-1966
+1550
+6796
+8998
+-8714
+4206
+9290
+8261
+2498
+-880
+2261
+-6458
+8786
+-8789
+-653
+-713
+3249
+-6744
+-6759
+-958
+-7266
+6726
+1928
+9914
+9183
+8589
+-7494
+3065
+5756
+-3165
+-2679
+-4152
+4841
+3515
+-9737
+8059
+1723
+9910
+-58
+-5225
+5362
+4425
+-2145
+-8201
+-5089
+-2398
+-2727
+-4913
+-9705
+6518
+-8734
+-6163
+304
+6520
+-3837
+-1490
+9691
+8463
+7474
+-3462
+-1467
+-1053
+-2370
+-6794
+8582
+-1791
+6489
+-5566
+7096
+-842
+9171
+-172
+-7473
+2364
+91
+-8279
+6086
+5819
+482
+-4652
+-8378
+-5371
+-4979
+9558
+849
+9047
+-921
+-2373
+4314
+7159
+-1419
+-4614
+3652
+-5282
+6960
+3648
+-4455
+-7131
+-1395
+-3478
+-1332
+8055
+-2340
+5102
+-869
+2714
+-3141
+-8232
+6129
+-7956
+7417
+-5400
+-9800
+762
+4526
+2067
+6215
+256
+457
+-5280
+-1261
+-993
+-5743
+453
+-4472
+-3939
+1388
+-9114
+6075
+1553
+-3548
+-4517
+-7129
+9777
+-9155
+-8901
+-986
+1456
+3550
+-6053
+9634
+4332
+9324
+-3184
+-3546
+-4521
+-2825
+4521
+9605
+-733
+-3711
+6238
+-8250
+9558
+9718
+-2378
+-7457
+-9633
+9113
+-691
+-1229
+-6774
+-7837
+8767
+401
+-1865
+2265
+787
+7661
+5465
+-3972
+7490
+9763
+-1548
+6485
+9371
+-9213
+727
+-421
+-6401
+7267
+-4092
+-1870
+9824
+-711
+3339
+-7476
+3034
+-1244
+2353
+8248
+1820
+-9206
+-775
+7522
+9374
+-3219
+161
+-9312
+-7993
+-3752
+1784
+-5761
+-2562
+-3041
+1211
+-6112
+-5002
+2474
+4268
+2626
+8022
+-1637
+2009
+-6001
+4223
+8385
+-842
+-2737
+6215
+9838
+6665
+8048
+-421
+-7189
+1596
+1903
+4268
+-2756
+5086
+7972
+-7258
+-1287
+-6836
+3104
+79
+628
+-4638
+-4755
+-5722
+-793
+2186
+8059
+-7001
+2356
+-5345
+4600
+-9388
+3909
+-8363
+2090
+-406
+-6125
+7544
+6504
+-1701
+-739
+9914
+-196
+7790
+2965
+-4198
+3900
+1035
+2588
+4367
+4816
+3531
+1129
+-1079
+7394
+-5807
+-744
+-4317
+-2826
+-5202
+7096
+-9668
+-6946
+7882
+-7907
+-7999
+-806
+4126
+-2394
+6375
+9578
+-5514
+7254
+-4440
+6904
+-4235
+-5705
+1224
+-3324
+-8527
+7984
+-5750
+-3599
+3098
+-6625
+-3486
+-6528
+1903
+7740
+-171
+4240
+-9743
+3578
+-2915
+2421
+-1823
+42
+-7723
+9997
+-8054
+-425
+-1110
+-1569
+2092
+571
+-9584
+-5109
+4625
+8465
+-4735
+6834
+-2562
+257
+-2321
+4347
+4970
+-6859
+-4407
+7972
+9000
+-309
+8785
+-9633
+-891
+-6829
+5874
+284
+5236
+-4120
+-5616
+-6070
+-8467
+-8011
+-7159
+6262
+3091
+-9167
+1994
+4495
+-8269
+-6978
+-3711
+-6735
+-3060
+-9426
+-4302
+6779
+3568
+7541
+-5793
+4137
+7539
+7239
+-8160
+-7582
+-5793
+5309
+-5994
+4785
+5218
+-3141
+-6523
+-4905
+-5358
+4833
+8862
+-2445
+5301
+-3949
+-9488
+-2984
+1953
+-9232
+-9505
+5793
+-3411
+-2236
+-8444
+369
+3099
+995
+7496
+3095
+1494
+-3746
+3625
+-6050
+-3233
+-3010
+-4051
+-8775
+2532
+-9743
+3541
+7010
+98
+-9126
+-4905
+8852
+43
+7735
+7580
+9171
+4256
+4921
+2550
+4541
+6650
+8223
+770
+2724
+1723
+-7520
+-8777
+-1021
+8002
+1657
+-2390
+439
+-6669
+5587
+-8511
+-4557
+-8511
+812
+139
+8527
+-194
+835
+4595
+6250
+4565
+3483
+9929
+-304
+-3673
+6576
+-3233
+-9171
+1933
+-5967
+5624
+1897
+7898
+5201
+-2711
+-6719
+-1833
+9698
+-1063
+-1155
+3549
+-8704
+-6015
+-7079
+-2984
+-6473
+-3449
+3263
+7406
+-2779
+6504
+6626
+-1244
+-4852
+-7787
+9937
+-1127
+-9505
+-494
+-646
+4126
+7161
+-6990
+2064
+8228
+8450
+5445
+4826
+-850
+2257
+3827
+2125
+7256
+7271
+1488
+-5548
+6946
+2424
+-694
+-9923
+-3907
+-1226
+-7866
+-4285
+4346
+-8091
+-5952
+2623
+1309
+-1078
+-8857
+-9704
+-5787
+-1899
+-7171
+9998
+9468
+-7409
+872
+-9227
+-3140
+5447
+-1291
+-1478
+4658
+-7160
+9993
+-6917
+-6177
+4946
+-8378
+8327
+-9917
+4595
+3829
+-8867
+-9369
+-1872
+3255
+6052
+-8947
+5012
+8974
+-1462
+4859
+-1543
+-888
+2488
+3968
+3283
+2820
+-8444
+-4244
+4863
+-8944
+7754
+-1021
+-929
+-5085
+1287
+3862
+4085
+9952
+3889
+8341
+9864
+5585
+-2676
+6140
+-2264
+-9034
+7323
+-3296
+-3151
+-5004
+3340
+-8814
+-3462
+-3727
+6746
+3263
+-3685
+-6923
+-4136
+-4516
+-9832
+-7913
+-6498
+1348
+-8378
+8868
+-1452
+-6801
+7297
+9468
+-5099
+-3916
+848
+-277
+9562
+-9878
+-3047
+3104
+696
+5473
+8957
+-4986
+-5527
+-749
+-3949
+-9818
+-7611
+-9636
+-8030
+5139
+7959
+-2302
+-6976
+-5447
+-7812
+-7732
+8258
+-903
+1818
+1638
+-561
+-2994
+-1291
+211
+-6964
+8621
+-2156
+2611
+6380
+3625
+-142
+6498
+-9491
+1713
+7938
+-8067
+-3739
+-8055
+-3073
+-2562
+403
+2633
+-7063
+9739
+-2313
+-2925
+9592
+-7231
+-6132
+5132
+8929
+-4150
+-2622
+-2117
+-5847
+4037
+-4258
+-7295
+9896
+6868
+8093
+4592
+1446
+-3866
+-4816
+-8496
+-2431
+4092
+-5936
+8220
+-2055
+7639
+7008
+5096
+2644
+8741
+5842
+-4627
+-3650
+-5485
+-9155
+-354
+4114
+-4825
+7960
+3194
+-5632
+2369
+505
+5941
+3867
+3600
+6546
+-4534
+6905
+4889
+-9859
+5827
+4126
+-9837
+-2563
+8022
+-2807
+1106
+-1551
+1093
+-8501
+-2324
+272
+5472
+1742
+5851
+-5589
+2019
+-8762
+-2126
+-4791
+-9363
+3531
+-8125
+5371
+-1080
+5100
+2700
+4972
+-9260
+5802
+-1067
+128
+3865
+-3122
+-5471
+7330
+-3375
+-9526
+344
+-2645
+7189
+-5508
+9573
+-9199
+244
+6089
+-5953
+8841
+6664
+-6960
+-7075
+9105
+-1693
+-3045
+-3231
+-3991
+-9025
+4383
+3088
+-9347
+6175
+8750
+8091
+-1619
+4136
+4092
+-7127
+-8593
+-8154
+3320
+5768
+-7108
+-4627
+-2126
+2517
+-2157
+2977
+2872
+7096
+-6211
+3091
+-9260
+-8462
+-5566
+-4298
+-1842
+-1490
+5637
+6668
+4203
+4134
+2537
+-1385
+3139
+6554
+-7952
+8495
+-1548
+9586
+3216
+-3911
+-3831
+8446
+599
+9265
+-4388
+8531
+2768
+3829
+8796
+3475
+3870
+437
+-5946
+-587
+8309
+4126
+3299
+-320
+-9834
+154
+5128
+8162
+8705
+-9940
+8322
+-9790
+8091
+-7632
+-503
+8254
+2394
+272
+6966
+345
+5873
+-6977
+3601
+-6375
+2356
+1496
+6155
+-686
+8424
+3586
+-4135
+-9286
+9815
+3358
+4600
+6535
+-615
+3760
+3415
+545
+-1127
+2562
+3277
+6129
+-4592
+-3345
+2809
+6653
+-6467
+131
+-6283
+-3581
+7156
+6996
+-1517
+-4317
+-8102
+7972
+438
+-3725
+-3145
+-5470
+3084
+-4956
+-2589
+6785
+-8637
+1950
+9687
+3017
+-1781
+-4442
+2299
+2624
+-6186
+5733
+2792
+-339
+8143
+-9007
+-3014
+-494
+-962
+-8259
+2768
+-3296
+-6438
+-2728
+7116
+-4656
+-5972
+-3489
+2454
+-1339
+2463
+5747
+3593
+-1566
+7363
+-235
+-4611
+-5430
+-315
+3301
+-1223
+6067
+5396
+-8146
+-673
+9958
+-122
+-8022
+-2135
+9880
+5564
+1552
+-7549
+4433
+-6008
+5428
+-5277
+-4736
+-3684
+-8091
+6802
+629
+-9173
+220
+7055
+2789
+7718
+3219
+-4665
+-5827
+8807
+-4568
+3104
+-1000
+6052
+-4070
+1067
+-1918
+2136
+3224
+5638
+8734
+-9848
+-9634
+1999
+-1688
+-8139
+-4711
+-8820
+4778
+-6410
+5738
+7776
+2701
+-96
+-6313
+1117
+7863
+1731
+5413
+9460
+4181
+3166
+2831
+-1049
+3302
+-9257
+-5968
+5807
+-6253
+-1209
+5724
+-423
+3369
+-2445
+8201
+-4288
+3163
+-6204
+8206
+-9189
+-3727
+8229
+4826
+4074
+5212
+-2562
+1281
+-9257
+1028
+131
+-5401
+-7342
+-4800
+3252
+5829
+7166
+963
+4769
+4614
+7083
+1824
+3675
+-4933
+3666
+5922
+-1712
+1257
+266
+-4224
+312
+0
+7811
+6450
+3870
+-799
+2223
+7668
+1496
+3339
+-596
+-9173
+1519
+-545
+-6460
+-5133
+1482
+-5202
+-1704
+-2733
+-8076
+-737
+690
+-3440
+9687
+2910
+2266
+3760
+3548
+-597
+9824
+5722
+-9218
+1151
+527
+-3256
+9739
+-9974
+-5202
+5624
+-9016
+-7357
+-8295
+2116
+-1765
+9107
+8280
+-2429
+6012
+1973
+-655
+-1063
+6924
+2463
+-1733
+-4865
+-9729
+824
+9459
+7904
+-5275
+1013
+5075
+-7925
+9843
+-3772
+-6268
+-1094
+-4098
+-8810
+9419
+-5345
+-2310
+2311
+8904
+7080
+5807
+-7064
+-1321
+9492
+1907
+1571
+5614
+479
+-4587
+4383
+4475
+-6824
+-4979
+6554
+-7998
+-2431
+6624
+5851
+-8821
+5579
+-9367
+-6250
+7181
+-8207
+1982
+8688
+-160
+-7421
+9975
+-2269
+6606
+6419
+5420
+4899
+-6744
+4037
+7122
+7489
+7288
+3710
+3593
+-4480
+4579
+3462
+6249
+-4485
+5190
+2720
+-3130
+2040
+-3525
+6823
+-5949
+7610
+7955
+-9231
+-1972
+-5972
+-9155
+-6067
+-80
+6327
+-3021
+7806
+4938
+3072
+-4982
+-3687
+-7970
+2327
+-5180
+2356
+7149
+-6025
+7477
+-1439
+3962
+5991
+5134
+5925
+-5767
+2396
+-4382
+1591
+-2487
+4931
+-1161
+-254
+2802
+-5152
+424
+-6113
+9081
+-3063
+809
+2424
+-4951
+7790
+-3921
+7197
+-6960
+6960
+2970
+6371
+7321
+-2687
+9323
+-1848
+-9799
+6913
+8549
+9586
+-8528
+1744
+-9957
+-2348
+8424
+2143
+-4895
+8243
+9587
+-5527
+-9848
+3666
+8450
+9404
+3644
+6941
+86
+-924
+-3293
+9767
+8673
+-5613
+3252
+5804
+5964
+6546
+-5073
+-7356
+5971
+-4526
+7298
+-2069
+-7295
+2878
+-9826
+8504
+6175
+3070
+-7177
+7059
+5492
+2081
+5514
+-3725
+849
+-7662
+-4791
+6371
+-4925
+-2591
+5435
+4938
+-865
+-9940
+2792
+-2984
+72
+-5968
+-3863
+-1766
+-6703
+-5492
+5971
+-4926
+-128
+-5003
+-9390
+6436
+-4973
+-1681
+8790
+-6756
+5469
+3423
+-1052
+2637
+3240
+2403
+6554
+-4803
+4860
+7909
+7075
+8689
+-7433
+-1327
+-8624
+995
+-5343
+-2474
+-8927
+8202
+-1322
+-2364
+8848
+-4274
+-9016
+-1045
+3068
+4614
+-3572
+2014
+-6531
+-7065
+5547
+7213
+6167
+9054
+5063
+-4214
+4304
+6955
+2077
+1258
+-5604
+-7312
+-1328
+3923
+844
+4525
+798
+2522
+9941
+849
+-7499
+7987
+-6647
+-8928
+-161
+5205
+3609
+-9848
+-4985
+-76
+1742
+-6359
+-8064
+-3130
+9046
+-7465
+6052
+-9605
+-1925
+9605
+4831
+1973
+708
+-2807
+-8073
+-3805
+-7510
+-1332
+6086
+323
+-5852
+-686
+-3508
+3893
+-5530
+7297
+7385
+-2878
+-7047
+-8153
+1780
+5146
+-1664
+-5303
+-2059
+-1436
+6919
+1371
+-2622
+-6189
+6941
+3543
+-4126
+-7538
+-3059
+-2830
+-7063
+-5180
+476
+8385
+8855
+2537
+593
+-339
+9668
+-7150
+9125
+1488
+2131
+5793
+-2379
+7692
+4088
+-9842
+-887
+-4722
+8323
+-414
+2849
+4770
+6055
+6618
+2218
+1496
+-9284
+983
+-1568
+6633
+9269
+4111
+5227
+2136
+-6034
+2941
+7341
+9608
+6446
+-5531
+-9325
+7716
+9914
+3232
+-9432
+-7391
+9464
+-5409
+-4407
+8497
+-122
+-196
+-4774
+-4457
+6904
+7822
+3965
+-2323
+-5215
+992
+-9235
+8990
+-7793
+-8201
+-8566
+-3975
+9690
+-4561
+7096
+-8930
+3165
+-8789
+-7691
+7046
+5659
+1577
+9439
+757
+4938
+-3254
+5224
+-1520
+9024
+-1206
+8350
+-6299
+7988
+-4666
+-840
+8426
+-7105
+2910
+6411
+-764
+-7956
+3324
+-5432
+4181
+-8799
+820
+-4464
+-6801
+4929
+1475
+-9723
+-5209
+8201
+-3931
+404
+1715
+6327
+7433
+-3004
+5214
+4441
+1870
+1889
+4976
+-6661
+-8411
+7330
+2474
+-2953
+-4690
+-5558
+-9120
+-2587
+-8303
+-3060
+-9634
+-8714
+527
+-4030
+-5536
+-3748
+5161
+-7511
+-9001
+-1147
+4454
+-8324
+-153
+-121
+7785
+7201
+-8262
+-4901
+8220
+7283
+7271
+1057
+2300
+-110
+1224
+-2728
+7096
+-2395
+-6680
+5012
+-6468
+9829
+-6126
+-4198
+-8471
+-8373
+9515
+3846
+-3641
+7859
+439
+1780
+-4266
+72
+2941
+6476
+-2164
+-2425
+4524
+-325
+2327
+2440
+1455
+-5470
+-6996
+-3778
+6061
+-8832
+-380
+468
+-3716
+3594
+6663
+9697
+660
+-2723
+-2722
+-5535
+8427
+1519
+-7657
+3967
+-9173
+9957
+4566
+986
+5382
+-6862
+2056
+3297
+9964
+1895
+-2689
+-7257
+8549
+-4403
+5887
+-4535
+-6395
+4441
+6798
+-54
+-4602
+-7782
+5301
+-5871
+-3546
+6615
+7856
+8094
+4592
+6421
+1138
+-1403
+-4986
+-6045
+4772
+-9388
+-7582
+-2114
+842
+-7851
+4046
+-9211
+547
+-171
+-9269
+131
+-6799
+1596
+-8850
+9844
+-2261
+-1517
+-9958
+-8739
+1655
+-5535
+9180
+2023
+3547
+-7391
+-254
+-7278
+9075
+-3405
+-8881
+4020
+-3293
+7978
+-1735
+8945
+-6627
+-1194
+5424
+7965
+34
+3153
+487
+-673
+1943
+4726
+8290
+-3662
+-785
+-6117
+-7632
+-6284
+-2839
+8712
+-1051
+5214
+8961
+-8384
+-3536
+-3097
+-6453
+-2058
+6155
+-8881
+-2559
+-7960
+2365
+-4169
+2839
+4795
+-4265
+5435
+3095
+4020
+1839
+-4051
+9027
+4299
+-5200
+-9494
+6330
+3891
+-5277
+5681
+-4541
+660
+1519
+-2920
+-1521
+-9155
+-3019
+8788
+-9976
+-1847
+-3708
+-9940
+-1909
+-3941
+9518
+4970
+-640
+3034
+3531
+2871
+-9120
+639
+-8015
+-4263
+-5667
+941
+-7729
+5463
+2404
+-7456
+-3941
+2934
+-6467
+-7490
+-2353
+6248
+-3212
+-4666
+5286
+-6829
+9829
+-5743
+-9173
+2624
+-3663
+9968
+-5592
+2142
+-3459
+-4611
+9195
+-6462
+-8153
+-6323
+3375
+-3778
+6803
+3145
+-4249
+-1565
+-5306
+-9022
+-557
+5940
+-5853
+8348
+-8867
+-3213
+-8775
+-3631
+6052
+4740
+-5376
+6565
+-1158
+-7589
+-3151
+-6816
+-5400
+-1909
+1322
+2735
+-7587
+830
+6353
+-2380
+8426
+-4235
+2382
+6773
+-5722
+-7955
+9815
+-1765
+-8207
+-3165
+-7306
+-8387
+-6441
+1595
+1781
+-9624
+1667
+676
+6965
+-575
+7351
+3099
+-9526
+-3594
+-5968
+328
+-4407
+8406
+434
+-5823
+8749
+3367
+-5280
+8458
+-5514
+-3651
+-737
+3153
+-5152
+-1735
+-315
+-462
+6458
+5295
+-7220
+1678
+6421
+292
+-9470
+9394
+-4533
+-9917
+-9505
+2472
+-563
+-6534
+5301
+2164
+2191
+-8437
+1070
+1955
+3119
+7988
+-6274
+-2617
+5301
+-5962
+-2269
+1908
+-5961
+-5065
+3685
+-4321
+-9668
+7655
+-4727
+6518
+-8170
+-2648
+-4888
+8465
+-2869
+-1864
+-7128
+-7014
+-101
+8323
+7096
+4641
+-8066
+7809
+-1323
+5077
+-4314
+-8306
+8207
+-4918
+-7144
+-424
+-572
+-4898
+-2878
+8153
+-4472
+9776
+-4986
+-7129
+522
+8138
+-8831
+2162
+2999
+-1501
+7422
+-6127
+-6789
+-8542
+-309
+1222
+-2023
+61
+8462
+-474
+3894
+2223
+-7756
+-6658
+-1237
+9133
+2984
+5977
+8626
+-2915
+-2373
+2335
+-5816
+6265
+-7765
+-7452
+9527
+-5109
+3747
+8132
+5924
+7727
+7714
+599
+-9842
+-8156
+5193
+2950
+3143
+198
+9143
+1920
+-1010
+297
+-8307
+842
+8935
+-2515
+274
+-4970
+-8263
+-5199
+-3346
+-6865
+-257
+4337
+-1319
+-7549
+3698
+4495
+7364
+7504
+844
+-8580
+1732
+7867
+-152
+-836
+2680
+-8129
+2056
+-1385
+-1127
+2346
+-4852
+-9206
+-5124
+9578
+7550
+5688
+6243
+-3155
+-8826
+788
+7023
+-10000
+612
+669
+545
+-8680
+-5127
+8245
+-5396
+-7824
+-468
+7973
+4778
+-3546
+6115
+2177
+9510
+3223
+4972
+5867
+1303
+8551
+-7409
+-6027
+663
+9578
+8990
+618
+-6806
+4276
+-755
+-7056
+7170
+9295
+-8392
+6596
+9200
+-3975
+-3831
+7060
+318
+-7302
+-6904
+-3127
+-1323
+-2541
+-5558
+-1173
+-5690
+7246
+2522
+-654
+-4551
+6539
+-4134
+-2532
+4111
+-9173
+9730
+-4557
+-822
+6068
+-9701
+-1925
+-3698
+5240
+9523
+8353
+7576
+8290
+-4440
+-4576
+3250
+5598
+368
+6779
+812
+-906
+-8233
+5042
+2025
+8373
+3495
+-9623
+5552
+2859
+4853
+-7421
+-4510
+9826
+-6001
+4673
+313
+-8714
+-4725
+-9620
+9908
+-2429
+6250
+-5351
+-4533
+-1291
+6441
+-1592
+-4307
+-4728
+-3062
+4498
+5962
+-3573
+-971
+3271
+-730
+7550
+2486
+-7967
+423
+4166
+4008
+-8637
+8621
+-4318
+-255
+9510
+3656
+-738
+532
+9244
+752
+-5913
+-9346
+4312
+-9374
+-7916
+254
+-5471
+2615
+-7120
+5259
+-6034
+-4869
+6937
+-1548
+-5015
+-7807
+-9601
+-9923
+-7986
+-8996
+-2723
+-7177
+-1436
+-6460
+6851
+7363
+7955
+-1755
+4504
+6644
+-3158
+4968
+9496
+7981
+-8506
+7323
+-9833
+-987
+-8846
+-8496
+-1212
+-7161
+-8789
+-7231
+-8881
+3571
+-3843
+-5253
+5964
+-8844
+-5520
+-8215
+4111
+-6187
+8373
+-4198
+-7309
+8911
+3698
+8228
+7187
+-1092
+3910
+5271
+-2539
+6141
+7705
+-1433
+4438
+-7120
+4712
+3655
+4164
+-5991
+-6261
+9311
+2126
+-3292
+8440
+-9397
+3451
+7345
+-8028
+3436
+-7384
+-3886
+-4086
+-8444
+7518
+-3156
+3327
+-1849
+9787
+-7170
+554
+-879
+8360
+-7119
+-1075
+-1079
+-746
+-6619
+1284
+9081
+4403
+9209
+3415
+5348
+9079
+7375
+-4656
+941
+-474
+-5859
+-4551
+3017
+6107
+-3834
+6261
+5396
+-3136
+-7384
+-5464
+1784
+-1517
+9702
+-700
+-4593
+499
+7153
+9294
+2523
+6141
+9680
+-6889
+6708
+7209
+-3938
+9717
+4795
+-7401
+2796
+-5683
+1744
+-1962
+9345
+3502
+8542
+-8151
+-8684
+-6528
+5952
+9166
+1552
+1454
+5227
+556
+-1769
+-8026
+-737
+-5953
+367
+-1209
+-8331
+-560
+-2679
+-1021
+8385
+4908
+9451
+7145
+1951
+5281
+2936
+-211
+-6271
+1742
+-5939
+-9325
+-4986
+2580
+9515
+-2905
+1442
+-5873
+990
+-5514
+-685
+-6345
+-8799
+-6923
+8362
+5297
+5634
+-2824
+-6317
+5309
+2264
+4839
+-8015
+7705
+8343
+6385
+-1053
+-3785
+2327
+4010
+-2522
+880
+-6178
+-6809
+8586
+-4696
+-9507
+28
+257
+-7330
+4890
+4020
+-6027
+7137
+-3367
+2090
+7657
+4141
+-7589
+-7079
+-6260
+7285
+-1615
+-6510
+8634
+-355
+8333
+-4808
+7617
+5975
+7692
+1757
+1640
+4126
+4020
+6884
+8936
+3392
+-637
+-4652
+3648
+-915
+737
+8567
+1816
+-8528
+9876
+2140
+-3537
+4223
+-4310
+-796
+-2378
+1935
+-8453
+2972
+-7952
+-7180
+4276
+250
+-2395
+6717
+2708
+-8500
+7873
+8717
+-1537
+-3927
+7176
+-7952
+4332
+-62
+3612
+-9334
+-620
+9060
+6748
+1611
+1893
+-3773
+-3664
+3288
+-9293
+4587
+-822
+118
+-8518
+-2589
+-4092
+-4587
+2292
+560
+-5992
+9896
+9801
+-7470
+-762
+8688
+-358
+1496
+139
+6582
+2134
+-2953
+7551
+-7667
+-4592
+5520
+-8682
+-8477
+2676
+6342
+-9363
+-6936
+-3414
+1225
+1715
+-5821
+-7851
+7656
+6215
+-6283
+-6272
+2311
+5845
+4292
+-1870
+6593
+72
+2411
+-186
+274
+9294
+46
+5831
+1245
+6965
+-1206
+-4722
+8634
+-2379
+9998
+-3602
+1179
+1255
+-1008
+-121
+-7793
+7394
+-4491
+-4274
+-4661
+-6793
+-4586
+-3595
+2622
+-3062
+-3772
+2802
+9209
+-5823
+-7659
+-3244
+-7421
+6664
+-2576
+-3166
+6968
+8720
+918
+-7658
+-2121
+1110
+6482
+-254
+5423
+-2776
+-8390
+-2917
+8509
+-161
+-6411
+-1826
+3302
+-7282
+5501
+-5406
+8694
+9790
+-9570
+-2232
+7928
+-7394
+-2175
+3054
+1253
+-1753
+4136
+868
+9853
+-7582
+4441
+-2704
+6458
+7522
+-6125
+4257
+5999
+6113
+-255
+-1796
+1861
+-8340
+9719
+-6767
+5554
+-34
+-2845
+4609
+505
+-4535
+-9483
+-2055
+7239
+1606
+2065
+6531
+-2699
+-9100
+-9623
+7961
+1609
+-122
+-8844
+-8838
+5214
+-6472
+9098
+-2725
+7972
+7929
+6891
+6535
+-4205
+6326
+-3449
+7484
+-9943
+-2183
+3531
+7281
+3112
+-5784
+-8102
+-3623
+-5194
+2342
+62
+1862
+3415
+-2555
+3207
+-2073
+-2723
+1026
+-7302
+7290
+752
+-5420
+-3127
+6724
+-5517
+-9128
+-8129
+-4694
+3894
+2166
+495
+-5517
+-3060
+-6705
+-2622
+-9037
+3959
+9213
+1645
+9548
+1793
+9893
+-9284
+-6026
+-6273
+-2193
+7096
+-9507
+-5833
+-6846
+-9700
+616
+6664
+592
+834
+-7485
+-9447
+-4482
+7640
+-9284
+2796
+-4132
+5528
+1871
+2004
+9371
+638
+2859
+9680
+97
+2720
+-5070
+2383
+6640
+-6607
+-5690
+32
+-4916
+-2984
+7984
+-924
+-1107
+6874
+2528
+-7249
+-6492
+-5448
+-8534
+-9643
+6029
+1780
+9081
+7252
+-1897
+-7987
+5652
+9777
+3858
+-4293
+7576
+-7804
+-8067
+-3235
+-1933
+9492
+3023
+-7970
+-5179
+-5337
+7686
+-3459
+212
+6738
+912
+5218
+8577
+9357
+-7368
+8823
+-9428
+-4321
+5531
+-9898
+-3021
+-2695
+1165
+-8767
+-5851
+9044
+-7465
+-8690
+8330
+-6793
+8823
+1408
+-5156
+6259
+-5684
+4171
+-3568
+6867
+-2373
+8039
+401
+-8767
+8671
+9203
+-375
+6402
+-4985
+6851
+9004
+7988
+3034
+6941
+2564
+8673
+6408
+124
+-7431
+3891
+9516
+-4405
+6937
+-9719
+-6964
+5504
+-8091
+9324
+7157
+3624
+-5953
+-1806
+-3820
+7233
+-2379
+5382
+5538
+344
+8514
+4729
+-2790
+-4285
+-6653
+-5400
+-8049
+1732
+9233
+-9360
+7670
+-7797
+579
+4291
+-4404
+-8263
+9667
+-8737
+7166
+-5010
+2182
+-5430
+-2327
+8963
+-4520
+-7160
+-5102
+7814
+826
+8831
+-4218
+472
+3438
+3139
+-7015
+8983
+848
+5411
+-9193
+9602
+33
+-2774
+-8093
+3263
+-8563
+-7864
+762
+7077
+5624
+2155
+-4571
+6249
+9543
+3447
+3754
+-3083
+5685
+-4675
+-6756
+8069
+1551
+1772
+-3814
+-1322
+-4170
+4650
+-9381
+-5534
+2518
+-6260
+9385
+2698
+-4198
+-3076
+-9463
+5219
+168
+8026
+-7657
+465
+-9971
+-3209
+-8500
+6494
+448
+6051
+-2694
+973
+7740
+8624
+-4281
+97
+3071
+-9325
+-6741
+2362
+-2849
+-5369
+7939
+-2807
+-3449
+-1736
+9058
+-9923
+-4010
+-9903
+7311
+-8879
+-6297
+3026
+-4228
+1132
+41
+4188
+-8206
+7253
+837
+-4813
+5617
+-9678
+5156
+-6353
+1658
+-5437
+6758
+-9262
+-5051
+4383
+3065
+-6833
+2961
+5907
+-1999
+184
+7430
+7992
+-3244
+-7239
+-3510
+-3698
+4399
+-4556
+-8396
+3500
+-8922
+-7368
+1816
+-8077
+8987
+8014
+-4668
+-8839
+-2243
+9118
+687
+-8065
+4717
+-9022
+9941
+1257
+5717
+-5187
+-6709
+1595
+6278
+1903
+-2744
+6339
+9166
+-453
+3810
+-2142
+1169
+5520
+-6971
+-1183
+-1526
+-639
+1379
+8395
+3704
+-6777
+-6893
+-2061
+-7967
+-3010
+-9331
+-6324
+-2617
+7297
+9823
+2405
+4024
+3840
+1645
+5423
+-2437
+-4249
+6167
+9107
+1703
+-2642
+-8931
+-6890
+2456
+8201
+-836
+-7851
+-1737
+-1841
+1684
+8801
+-9412
+-5536
+-4311
+6538
+5615
+-6462
+9442
+-1704
+-4033
+144
+4166
+-4413
+3622
+9654
+-1842
+-5520
+-6237
+8338
+-8387
+1039
+4611
+4117
+-8567
+-5316
+7826
+6919
+1999
+7546
+8741
+-6670
+3654
+4512
+2264
+-4918
+-9878
+6535
+9351
+-7982
+8236
+5888
+-1395
+-3292
+-2895
+2822
+-1266
+5890
+81
+-7465
+2186
+5957
+-6619
+2200
+6478
+1900
+8998
+9024
+9434
+-988
+-1906
+-3165
+-3722
+-3830
+-3196
+6014
+-2471
+-4790
+2628
+-3989
+-8814
+-3629
+-9213
+-8711
+3331
+-8518
+-5446
+-4584
+5309
+-4727
+257
+-7148
+-851
+5729
+-7666
+-5874
+-172
+1523
+-3739
+-9140
+1527
+7541
+-6411
+3449
+-4297
+-2182
+-6231
+-3663
+1383
+3313
+3923
+4256
+-7476
+7229
+-1762
+4106
+1753
+4587
+5404
+-4727
+3388
+-8273
+-5961
+2442
+4785
+-4699
+-3359
+2896
+-6867
+2817
+1898
+1715
+7288
+-8154
+4186
+-1716
+-7659
+8487
+-5650
+6562
+-3470
+-6685
+1351
+2720
+6191
+7385
+4314
+-5913
+-5324
+9578
+6052
+2831
+1017
+1938
+-7448
+4948
+2917
+3063
+-3066
+6384
+3531
+-2339
+-5043
+1014
+8936
+-5483
+-6924
+7612
+-1668
+-6211
+2360
+2424
+-327
+8708
+-673
+-7808
+9637
+-7499
+-8982
+-3155
+2281
+-5566
+2319
+1264
+2673
+366
+-8901
+-2779
+4375
+3470
+2327
+-8522
+-1001
+3432
+-7801
+2223
+-5455
+-5679
+7311
+2850
+1446
+-9878
+8792
+8725
+788
+-6062
+4725
+751
+-4652
+8884
+-1008
+1655
+8387
+-1103
+-6801
+5339
+-946
+-4241
+-6261
+-1282
+9079
+4682
+-7405
+2643
+2535
+-7760
+747
+6362
+7937
+-7131
+-8033
+7411
+1895
+223
+-1704
+9434
+-3834
+4956
+1111
+8868
+-9065
+5759
+1516
+758
+-1129
+96
+6144
+4298
+9311
+-2896
+-1473
+-685
+6924
+-4986
+6698
+8105
+6514
+-3634
+-6434
+-8244
+-2568
+-4489
+-4888
+4520
+-3615
+7669
+-764
+8088
+4769
+5915
+-350
+124
+880
+-3196
+-3337
+3996
+3531
+1378
+-1352
+5812
+-968
+1674
+-1161
+-5710
+-6084
+8072
+9929
+-525
+-1273
+-4980
+-9570
+-9840
+7972
+-6205
+8333
+5813
+-7236
+7377
+-8913
+4063
+-2855
+-2155
+-6971
+-8761
+478
+-4247
+3846
+2166
+5339
+-455
+-2981
+269
+-9484
+320
+7046
+1790
+-5564
+-1464
+-5310
+4794
+-4053
+2131
+-3457
+5295
+4209
+-6918
+-8168
+-568
+-3095
+7153
+-5565
+2587
+4504
+4156
+-2953
+-7497
+-390
+-3650
+-2323
+6531
+-7564
+1306
+-1287
+-3293
+-264
+2325
+9644
+7648
+-5007
+-1294
+-1520
+-3244
+1379
+-6960
+8704
+-1291
+6888
+7873
+8705
+2583
+-1421
+-5403
+-8833
+2060
+-8195
+8855
+-5540
+356
+5382
+6330
+662
+-8441
+-4030
+-3913
+-7487
+5603
+-5470
+4237
+5024
+-5099
+-3584
+4020
+5307
+6061
+-1889
+5563
+1845
+-9038
+-2776
+9390
+-8941
+7550
+-961
+5094
+-623
+-7421
+-2077
+-8626
+-1433
+6257
+-6222
+-2992
+-1762
+1301
+-9244
+-2106
+6998
+-352
+9973
+-7873
+-1223
+-2391
+3117
+-7148
+6256
+4453
+4793
+8614
+5086
+5289
+-5836
+-3714
+3876
+8478
+-3949
+5552
+-7047
+3765
+-8850
+-7027
+4314
+7330
+2988
+-4477
+2143
+-7889
+1127
+1283
+-3916
+2497
+7867
+6894
+7192
+-5379
+6375
+-6892
+5221
+-5727
+437
+7433
+5746
+-1221
+4530
+5164
+-54
+2730
+4769
+9362
+9446
+5542
+-6906
+-9494
+-3200
+1839
+8069
+8211
+5435
+-7716
+3096
+424
+-9089
+-5526
+-2774
+9811
+9914
+-1567
+220
+-1584
+8140
+1650
+-9313
+2381
+2530
+-5592
+8572
+9914
+-4287
+-2574
+4838
+9935
+1540
+7235
+-6649
+1776
+491
+-9356
+1784
+-8893
+-8630
+754
+5297
+8320
+515
+-747
+-673
+9107
+-8527
+6607
+-6378
+-7001
+1943
+-5126
+161
+433
+-5099
+-7451
+-5437
+1849
+3936
+2932
+-1078
+9838
+-987
+453
+-4553
+-41
+7669
+-1046
+9272
+-778
+9308
+6671
+437
+-7473
+-385
+2865
+6573
+-5270
+2827
+983
+9498
+1214
+-1626
+5501
+-453
+1454
+2290
+2680
+-6715
+-6882
+-1246
+-9337
+-1931
+3907
+6535
+-4045
+-8250
+-4484
+-4385
+7705
+-8979
+-6085
+8734
+-6455
+3253
+-9128
+-3009
+-7353
+2648
+-4403
+-6175
+-7744
+-9366
+6911
+4999
+7467
+5227
+4860
+72
+328
+-679
+9439
+-8102
+3845
+6081
+-8506
+9081
+-4798
+8422
+3130
+6081
+663
+223
+-6300
+2377
+4034
+4471
+-4633
+-1139
+-4103
+-8200
+2197
+-8714
+-3141
+7164
+2049
+-1841
+8749
+7740
+-8998
+2940
+1548
+9527
+-8901
+6545
+2311
+-6893
+-822
+9614
+4537
+-4156
+-7939
+2999
+9578
+-1447
+-4984
+-7581
+9390
+7972
+4424
+7513
+-9155
+6618
+-8739
+-3563
+-6299
+-6085
+-8215
+-7120
+-8185
+2486
+-2325
+6582
+-6067
+-4320
+554
+4263
+2206
+-1661
+6937
+1270
+-7480
+8185
+4648
+7644
+-1262
+9962
+-4165
+-8533
+6700
+-125
+3328
+9988
+-797
+-631
+9434
+-5930
+-8606
+5122
+4972
+-7448
+-120
+3883
+-9828
+-5169
+1551
+4256
+8893
+6401
+6330
+6228
+-289
+-9121
+-9828
+2126
+-1284
+8450
+-8357
+4026
+-7075
+5094
+364
+8823
+7578
+-876
+3762
+7251
+-5520
+8201
+-5406
+-3345
+8683
+3997
+-9037
+4719
+-5025
+-1781
+4625
+-9643
+1120
+-9027
+5382
+764
+3057
+-5588
+-3151
+-1394
+5573
+837
+2188
+-3059
+-6445
+-5378
+1454
+-9735
+4453
+-9634
+-1729
+-1273
+2530
+-404
+-9607
+-16
+1077
+2212
+8105
+-1453
+-9140
+-4026
+-1079
+8378
+2064
+5563
+-5163
+-6001
+7596
+9415
+-5989
+-3650
+7992
+-4792
+7031
+9725
+-4776
+-1856
+-6302
+9079
+2639
+4086
+-2306
+941
+2364
+-653
+-5713
+-2596
+-7511
+3495
+-5391
+-8617
+-1433
+-8545
+-3260
+-4956
+-6427
+5324
+1337
+6059
+1132
+5867
+4053
+-3073
+-7201
+-1856
+2684
+-5967
+9414
+-6034
+-8344
+1364
+-1925
+5542
+4143
+9221
+3862
+4795
+-4928
+5514
+-8101
+2961
+-850
+-3339
+-125
+-6986
+1110
+937
+5681
+7096
+-8704
+6351
+1818
+4020
+9791
+-8409
+2708
+-277
+7822
+-9780
+8742
+-5308
+2566
+-3561
+8509
+4843
+-8280
+-9751
+-800
+-4323
+-1388
+-8567
+2947
+7973
+-8789
+-5776
+-424
+-5160
+-3885
+-1672
+-1954
+-416
+-8734
+7929
+-9687
+5404
+1233
+9060
+7066
+5554
+7958
+-100
+-8019
+-1462
+-3975
+-3778
+-793
+7038
+-880
+6720
+5875
+-8930
+-5724
+-6217
+1673
+5851
+-235
+2611
+-8734
+2658
+7621
+2606
+-8330
+2209
+2539
+8055
+2637
+3488
+-1784
+6061
+-6524
+9586
+7213
+8756
+2849
+6816
+5351
+-3963
+4298
+4074
+5523
+5947
+-5206
+7469
+-3470
+-9970
+-5949
+-2591
+8097
+-2139
+7050
+-5852
+6366
+-2116
+-8028
+-178
+5219
+-9343
+-4615
+4010
+-4711
+8450
+-1068
+-7025
+-6647
+7429
+1945
+-9760
+-5385
+-8508
+398
+-5823
+6279
+3863
+4288
+-9149
+-793
+-5847
+437
+8290
+-4726
+-5514
+2111
+-5643
+-3546
+-4551
+-6816
+4399
+9726
+-5743
+-2799
+7417
+-4929
+-6399
+4716
+5079
+4010
+9941
+-2625
+257
+-3239
+2913
+5804
+-7271
+-8501
+4184
+-9818
+1645
+-8295
+7747
+5525
+2244
+-6556
+-6295
+-2626
+3253
+212
+-5483
+-2604
+6061
+-6690
+-5073
+-3557
+1884
+-5770
+7732
+812
+-9255
+6462
+-5871
+4802
+-9884
+8655
+9230
+-3209
+3600
+-8973
+-9008
+5681
+3358
+-4202
+-3469
+7791
+-673
+1540
+-4425
+8785
+4155
+-5548
+4219
+-7658
+3621
+-551
+-134
+-7298
+-2840
+4219
+-9840
+-6146
+4972
+6545
+-6014
+-9325
+7694
+6075
+7225
+1655
+-9065
+-9374
+-9568
+-5289
+-497
+-7555
+-8618
+1818
+-760
+7928
+-5770
+7216
+-7808
+6582
+5892
+599
+-8273
+-7292
+-6977
+-3917
+124
+4292
+3531
+4387
+-6279
+8784
+4892
+-4636
+5598
+-3546
+-6669
+-369
+2223
+-549
+-4690
+-9153
+8064
+-5327
+-3907
+6680
+-7659
+-4267
+1812
+-1949
+7028
+9739
+8893
+4043
+-711
+4798
+-1464
+-7324
+-7081
+1725
+-7131
+5733
+6517
+124
+3565
+-4235
+-2471
+9717
+3070
+-9473
+6140
+-107
+-8324
+-1282
+549
+-8688
+5362
+-9717
+-9639
+-2571
+-6719
+-32
+9929
+2340
+-685
+-1769
+-3474
+-8350
+-6426
+-3889
+-6453
+9120
+-589
+6689
+-7120
+-5430
+-4668
+7790
+7028
+-8805
+2078
+-5042
+7731
+-6034
+5095
+5307
+7035
+-9886
+8218
+8520
+49
+2300
+-8495
+9310
+2896
+9814
+-6284
+4374
+-8930
+1496
+-4568
+9310
+-8542
+-1268
+-2799
+-6426
+9345
+-7535
+7100
+3143
+-4920
+-7956
+-8637
+97
+-9282
+-9349
+-8762
+8754
+-1309
+2789
+2133
+-5401
+-3209
+-4747
+-9713
+-4440
+-6218
+-9780
+-5604
+1898
+2792
+-8715
+9204
+2019
+6737
+-9940
+8736
+5294
+-3601
+2658
+1281
+3845
+4123
+-9512
+1179
+-6361
+6052
+5368
+2917
+9321
+-9063
+2568
+531
+-2395
+3111
+4283
+8450
+-1133
+3253
+-426
+-1791
+963
+-2142
+-5571
+5714
+8661
+-5079
+-6405
+-9170
+-9680
+-380
+692
+8008
+-3172
+9154
+-8680
+-94
+4020
+9620
+-2587
+-6808
+-941
+-5202
+-8013
+-2827
+-2353
+-5992
+5955
+2407
+739
+3223
+-4302
+2265
+4347
+8707
+-3748
+2472
+574
+9693
+4919
+-5926
+3993
+-27
+826
+-796
+6215
+-2825
+545
+2145
+8300
+939
+-1584
+3533
+-4860
+3263
+8611
+-5604
+1871
+-7427
+-3196
+-2755
+-2645
+-9735
+-3480
+6019
+4380
+6941
+-8716
+-9705
+1340
+-2256
+-8676
+-8692
+-6164
+-1520
+3630
+9149
+-9848
+9807
+2249
+837
+-755
+-8533
+-5871
+1920
+-1804
+2537
+7492
+-4460
+8343
+-8444
+-5769
+-2387
+2522
+-3450
+-9255
+8945
+2673
+7714
+5103
+2894
+8988
+7484
+-642
+72
+3102
+4833
+8624
+7344
+-4721
+5616
+788
+7277
+-9989
+-4127
+5618
+7019
+-8337
+-7343
+-8298
+-1716
+5747
+5984
+6214
+-4475
+-5782
+8170
+5874
+8623
+-5708
+-8782
+-6827
+-2992
+5447
+-7889
+-4258
+7665
+-9374
+6580
+-9605
+724
+-396
+8133
+-9828
+3246
+2797
+7145
+-8606
+4155
+-2017
+-7632
+880
+6629
+9807
+594
+5146
+-2345
+6740
+9898
+-9427
+2643
+5628
+2268
+-252
+2134
+7672
+1994
+8427
+-4165
+2105
+2377
+1117
+5212
+-8076
+-1503
+-4614
+-9025
+9255
+-1075
+-3340
+-5684
+-7177
+6943
+7752
+-869
+-7267
+8491
+-7140
+-7392
+-9244
+-6982
+8619
+-4860
+3034
+1920
+-4376
+295
+-4440
+6373
+-700
+-4266
+4972
+-8881
+1284
+-971
+-1506
+5637
+-3089
+-4047
+4800
+-8013
+-4011
+4287
+-237
+1385
+-3062
+2315
+-7547
+2060
+-1323
+3099
+-9099
+9143
+424
+872
+4851
+7055
+-5770
+9408
+9405
+-7212
+-9244
+-2767
+-2994
+2265
+-8066
+-3750
+7682
+-6027
+-3216
+5733
+8267
+-9235
+3894
+-2748
+-2582
+-587
+-4146
+-9779
+1106
+2092
+-5833
+-1373
+-8483
+8530
+8708
+4427
+9994
+1126
+-4694
+983
+-8146
+-6986
+7457
+-2608
+7099
+-3913
+662
+-879
+6256
+3224
+-142
+633
+7208
+4288
+-4732
+1762
+-8123
+-1086
+-1883
+6566
+5508
+-8684
+6591
+-8102
+3335
+-3487
+-5548
+3914
+-4750
+4561
+6965
+9439
+5720
+-5722
+-3682
+3329
+7263
+-2172
+6531
+5960
+2265
+7544
+-4571
+3108
+-3910
+6911
+-8835
+-315
+-5621
+-7000
+305
+7271
+7344
+4077
+3597
+5313
+6874
+-2131
+-9958
+9978
+8677
+-8575
+-4980
+9378
+8742
+1949
+-3956
+-9507
+-9842
+-693
+-5736
+2042
+4413
+5554
+-3206
+-8569
+9517
+-7342
+-8899
+-6047
+2669
+9754
+8550
+7929
+2801
+-1839
+-7002
+1442
+-8337
+854
+-8129
+6163
+8749
+-21
+864
+190
+-5094
+-9835
+-283
+5932
+6146
+-3157
+-2395
+3112
+6545
+6572
+-5278
+3863
+-1983
+6681
+33
+6107
+-2450
+8458
+-8112
+9896
+-6531
+-2431
+-6427
+-2852
+2984
+-4956
+110
+-9507
+4425
+-6570
+-3292
+3104
+5599
+2713
+579
+-6153
+8333
+3475
\ No newline at end of file
diff --git a/data/advent20a.txt b/data/advent20a.txt
new file mode 100644 (file)
index 0000000..5cbf3d9
--- /dev/null
@@ -0,0 +1,7 @@
+1
+2
+-3
+3
+-2
+0
+4
\ No newline at end of file
diff --git a/problems/day20.html b/problems/day20.html
new file mode 100644 (file)
index 0000000..de79425
--- /dev/null
@@ -0,0 +1,204 @@
+<!DOCTYPE html>
+<html lang="en-us">
+<head>
+<meta charset="utf-8"/>
+<title>Day 20 - Advent of Code 2022</title>
+<!--[if lt IE 9]><script src="/static/html5.js"></script><![endif]-->
+<link href='//fonts.googleapis.com/css?family=Source+Code+Pro:300&subset=latin,latin-ext' rel='stylesheet' type='text/css'/>
+<link rel="stylesheet" type="text/css" href="/static/style.css?30"/>
+<link rel="stylesheet alternate" type="text/css" href="/static/highcontrast.css?0" title="High Contrast"/>
+<link rel="shortcut icon" href="/favicon.png"/>
+<script>window.addEventListener('click', function(e,s,r){if(e.target.nodeName==='CODE'&&e.detail===3){s=window.getSelection();s.removeAllRanges();r=document.createRange();r.selectNodeContents(e.target);s.addRange(r);}});</script>
+</head><!--
+
+
+
+
+Oh, hello!  Funny seeing you here.
+
+I appreciate your enthusiasm, but you aren't going to find much down here.
+There certainly aren't clues to any of the puzzles.  The best surprises don't
+even appear in the source until you unlock them for real.
+
+Please be careful with automated requests; I'm not a massive company, and I can
+only take so much traffic.  Please be considerate so that everyone gets to play.
+
+If you're curious about how Advent of Code works, it's running on some custom
+Perl code. Other than a few integrations (auth, analytics, social media), I
+built the whole thing myself, including the design, animations, prose, and all
+of the puzzles.
+
+The puzzles are most of the work; preparing a new calendar and a new set of
+puzzles each year takes all of my free time for 4-5 months. A lot of effort
+went into building this thing - I hope you're enjoying playing it as much as I
+enjoyed making it for you!
+
+If you'd like to hang out, I'm @ericwastl on Twitter.
+
+- Eric Wastl
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+-->
+<body>
+<header><div><h1 class="title-global"><a href="/">Advent of Code</a></h1><nav><ul><li><a href="/2022/about">[About]</a></li><li><a href="/2022/events">[Events]</a></li><li><a href="https://teespring.com/stores/advent-of-code" target="_blank">[Shop]</a></li><li><a href="/2022/settings">[Settings]</a></li><li><a href="/2022/auth/logout">[Log Out]</a></li></ul></nav><div class="user">Neil Smith <a href="/2022/support" class="supporter-badge" title="Advent of Code Supporter">(AoC++)</a> <span class="star-count">40*</span></div></div><div><h1 class="title-event">&nbsp;&nbsp;<span class="title-event-wrap">0.0.0.0:</span><a href="/2022">2022</a><span class="title-event-wrap"></span></h1><nav><ul><li><a href="/2022">[Calendar]</a></li><li><a href="/2022/support">[AoC++]</a></li><li><a href="/2022/sponsors">[Sponsors]</a></li><li><a href="/2022/leaderboard">[Leaderboard]</a></li><li><a href="/2022/stats">[Stats]</a></li></ul></nav></div></header>
+
+<div id="sidebar">
+<div id="sponsor"><div class="quiet">Our <a href="/2022/sponsors">sponsors</a> help make Advent of Code possible:</div><div class="sponsor"><a href="https://www.accenture.com/us-en/industries/afs-index" target="_blank" onclick="if(ga)ga('send','event','sponsor','sidebar',this.href);" rel="noopener">Accenture Federal Services</a> - Technology &amp; ingenuity moving missions forward – come solve problems with us. Hiring software engineers, developers, and more now. Refer someone to earn up to $20K.</div></div>
+</div><!--/sidebar-->
+
+<main>
+<article class="day-desc"><h2>--- Day 20: Grove Positioning System ---</h2><p>It's finally time to meet back up with the Elves. When you try to contact them, however, you get no reply. Perhaps you're out of range?</p>
+<p>You know they're headed to the grove where the <em class="star">star</em> fruit grows, so if you can figure out where that is, you should be able to meet back up with them.</p>
+<p>Fortunately, your handheld device has a file (your puzzle input) that contains the grove's coordinates! Unfortunately, the file is <em>encrypted</em> - just in case the device were to fall into the wrong hands.</p>
+<p>Maybe you can <span title="You once again make a mental note to remind the Elves later not to invent their own cryptographic functions.">decrypt</span> it?</p>
+<p>When you were still back at the camp, you overheard some Elves talking about coordinate file encryption. The main operation involved in decrypting the file is called <em>mixing</em>.</p>
+<p>The encrypted file is a list of numbers. To <em>mix</em> the file, move each number forward or backward in the file a number of positions equal to the value of the number being moved. The list is <em>circular</em>, so moving a number off one end of the list wraps back around to the other end as if the ends were connected.</p>
+<p>For example, to move the <code>1</code> in a sequence like <code>4, 5, 6, <em>1</em>, 7, 8, 9</code>, the <code>1</code> moves one position forward: <code>4, 5, 6, 7, <em>1</em>, 8, 9</code>. To move the <code>-2</code> in a sequence like <code>4, <em>-2</em>, 5, 6, 7, 8, 9</code>, the <code>-2</code> moves two positions backward, wrapping around: <code>4, 5, 6, 7, 8, <em>-2</em>, 9</code>.</p>
+<p>The numbers should be moved <em>in the order they originally appear</em> in the encrypted file. Numbers moving around during the mixing process do not change the order in which the numbers are moved.</p>
+<p>Consider this encrypted file:</p>
+<pre><code>1
+2
+-3
+3
+-2
+0
+4
+</code></pre>
+<p>Mixing this file proceeds as follows:</p>
+<pre><code>Initial arrangement:
+1, 2, -3, 3, -2, 0, 4
+
+1 moves between 2 and -3:
+2, 1, -3, 3, -2, 0, 4
+
+2 moves between -3 and 3:
+1, -3, 2, 3, -2, 0, 4
+
+-3 moves between -2 and 0:
+1, 2, 3, -2, -3, 0, 4
+
+3 moves between 0 and 4:
+1, 2, -2, -3, 0, 3, 4
+
+-2 moves between 4 and 1:
+1, 2, -3, 0, 3, 4, -2
+
+0 does not move:
+1, 2, -3, 0, 3, 4, -2
+
+4 moves between -3 and 0:
+1, 2, -3, 4, 0, 3, -2
+</code></pre>
+<p>Then, the grove coordinates can be found by looking at the 1000th, 2000th, and 3000th numbers after the value <code>0</code>, wrapping around the list as necessary. In the above example, the 1000th number after <code>0</code> is <code><em>4</em></code>, the 2000th is <code><em>-3</em></code>, and the 3000th is <code><em>2</em></code>; adding these together produces <code><em>3</em></code>.</p>
+<p>Mix your encrypted file exactly once. <em>What is the sum of the three numbers that form the grove coordinates?</em></p>
+</article>
+<p>Your puzzle answer was <code>8721</code>.</p><article class="day-desc"><h2 id="part2">--- Part Two ---</h2><p>The grove coordinate values seem nonsensical. While you ponder the mysteries of Elf encryption, you suddenly remember the rest of the decryption routine you overheard back at camp.</p>
+<p>First, you need to apply the <em>decryption key</em>, <code>811589153</code>. Multiply each number by the decryption key before you begin; this will produce the actual list of numbers to mix.</p>
+<p>Second, you need to mix the list of numbers <em>ten times</em>. The order in which the numbers are mixed does not change during mixing; the numbers are still moved in the order they appeared in the original, pre-mixed list. (So, if -3 appears fourth in the original list of numbers to mix, -3 will be the fourth number to move during each round of mixing.)</p>
+<p>Using the same example as above:</p>
+<pre><code>Initial arrangement:
+811589153, 1623178306, -2434767459, 2434767459, -1623178306, 0, 3246356612
+
+After 1 round of mixing:
+0, -2434767459, 3246356612, -1623178306, 2434767459, 1623178306, 811589153
+
+After 2 rounds of mixing:
+0, 2434767459, 1623178306, 3246356612, -2434767459, -1623178306, 811589153
+
+After 3 rounds of mixing:
+0, 811589153, 2434767459, 3246356612, 1623178306, -1623178306, -2434767459
+
+After 4 rounds of mixing:
+0, 1623178306, -2434767459, 811589153, 2434767459, 3246356612, -1623178306
+
+After 5 rounds of mixing:
+0, 811589153, -1623178306, 1623178306, -2434767459, 3246356612, 2434767459
+
+After 6 rounds of mixing:
+0, 811589153, -1623178306, 3246356612, -2434767459, 1623178306, 2434767459
+
+After 7 rounds of mixing:
+0, -2434767459, 2434767459, 1623178306, -1623178306, 811589153, 3246356612
+
+After 8 rounds of mixing:
+0, 1623178306, 3246356612, 811589153, -2434767459, 2434767459, -1623178306
+
+After 9 rounds of mixing:
+0, 811589153, 1623178306, -2434767459, 3246356612, 2434767459, -1623178306
+
+After 10 rounds of mixing:
+0, -2434767459, 1623178306, 3246356612, -1623178306, 2434767459, 811589153
+</code></pre>
+<p>The grove coordinates can still be found in the same way. Here, the 1000th number after <code>0</code> is <code><em>811589153</em></code>, the 2000th is <code><em>2434767459</em></code>, and the 3000th is <code><em>-1623178306</em></code>; adding these together produces <code><em>1623178306</em></code>.</p>
+<p>Apply the decryption key and mix your encrypted file ten times. <em>What is the sum of the three numbers that form the grove coordinates?</em></p>
+</article>
+<p>Your puzzle answer was <code>831878881825</code>.</p><p class="day-success">Both parts of this puzzle are complete! They provide two gold stars: **</p>
+<p>At this point, you should <a href="/2022">return to your Advent calendar</a> and try another puzzle.</p>
+<p>If you still want to see it, you can <a href="20/input" target="_blank">get your puzzle input</a>.</p>
+<p>You can also <span class="share">[Share<span class="share-content">on
+  <a href="https://twitter.com/intent/tweet?text=I%27ve+completed+%22Grove+Positioning+System%22+%2D+Day+20+%2D+Advent+of+Code+2022&amp;url=https%3A%2F%2Fadventofcode%2Ecom%2F2022%2Fday%2F20&amp;related=ericwastl&amp;hashtags=AdventOfCode" target="_blank">Twitter</a>
+  <a href="javascript:void(0);" onclick="var mastodon_instance=prompt('Mastodon Instance / Server Name?'); if(typeof mastodon_instance==='string' && mastodon_instance.length){this.href='https://'+mastodon_instance+'/share?text=I%27ve+completed+%22Grove+Positioning+System%22+%2D+Day+20+%2D+Advent+of+Code+2022+%23AdventOfCode+https%3A%2F%2Fadventofcode%2Ecom%2F2022%2Fday%2F20'}else{return false;}" target="_blank">Mastodon</a
+></span>]</span> this puzzle.</p>
+</main>
+
+<!-- ga -->
+<script>
+(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
+(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
+m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
+})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
+ga('create', 'UA-69522494-1', 'auto');
+ga('set', 'anonymizeIp', true);
+ga('send', 'pageview');
+</script>
+<!-- /ga -->
+</body>
+</html>
\ No newline at end of file