aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Dessaux2022-12-31 01:15:20 +0100
committerJulien Dessaux2022-12-31 01:15:20 +0100
commitb7a31cc6887bd15769bfdf75f36003869b2561a5 (patch)
tree46f551bc7e3631aa49f10b8518297fcd1f20a099
parent2022-19 in js (diff)
downloadadvent-of-code-b7a31cc6887bd15769bfdf75f36003869b2561a5.tar.gz
advent-of-code-b7a31cc6887bd15769bfdf75f36003869b2561a5.tar.bz2
advent-of-code-b7a31cc6887bd15769bfdf75f36003869b2561a5.zip
2022-20 in js
-rw-r--r--2022/20-Grove-Positioning-System/.eslintrc.json44
-rw-r--r--2022/20-Grove-Positioning-System/example7
-rw-r--r--2022/20-Grove-Positioning-System/first.js88
-rw-r--r--2022/20-Grove-Positioning-System/input5000
-rw-r--r--2022/20-Grove-Positioning-System/package.json11
-rw-r--r--2022/20-Grove-Positioning-System/second.js90
6 files changed, 5240 insertions, 0 deletions
diff --git a/2022/20-Grove-Positioning-System/.eslintrc.json b/2022/20-Grove-Positioning-System/.eslintrc.json
new file mode 100644
index 0000000..81e57d1
--- /dev/null
+++ b/2022/20-Grove-Positioning-System/.eslintrc.json
@@ -0,0 +1,44 @@
+{
+ "env": {
+ "es2021": true,
+ "node": true
+ },
+ "extends": [
+ "eslint:recommended",
+ "plugin:node/recommended"
+ ],
+ "overrides": [
+ {
+ "files": ["*.js"],
+ "rules": {
+ "no-constant-condition": "off"
+ }
+ }
+ ],
+ "parserOptions": {
+ "ecmaVersion": "latest",
+ "sourceType": "module"
+ },
+ "rules": {
+ "indent": [
+ "error",
+ "tab"
+ ],
+ "linebreak-style": [
+ "error",
+ "unix"
+ ],
+ "quotes": [
+ "error",
+ "double"
+ ],
+ "semi": [
+ "error",
+ "always"
+ ],
+ "node/no-unsupported-features/es-syntax": [
+ "error",
+ { "ignores": ["modules"] }
+ ]
+ }
+}
diff --git a/2022/20-Grove-Positioning-System/example b/2022/20-Grove-Positioning-System/example
new file mode 100644
index 0000000..52c68ff
--- /dev/null
+++ b/2022/20-Grove-Positioning-System/example
@@ -0,0 +1,7 @@
+1
+2
+-3
+3
+-2
+0
+4
diff --git a/2022/20-Grove-Positioning-System/first.js b/2022/20-Grove-Positioning-System/first.js
new file mode 100644
index 0000000..7a49d57
--- /dev/null
+++ b/2022/20-Grove-Positioning-System/first.js
@@ -0,0 +1,88 @@
+import * as fs from "fs";
+
+class File {
+ constructor(line) {
+ this.length = line.length;
+ this.data = line.map(v => ({value: v})); // index in data
+ this.data[0].left = this.data[this.length-1];
+ this.data[0].right = this.data[1];
+ this.data[this.length-1].left = this.data[this.length-2];
+ this.data[this.length-1].right = this.data[0];
+ for (let i=1; i<this.length-1; ++i) {
+ this.data[i].left = this.data[i-1];
+ this.data[i].right = this.data[i+1];
+ }
+ this.data.forEach(v => { if (v.value === 0) this.head = v; });
+ }
+ get(i) {
+ let it = this.head;
+ for (let offset = i % this.length; offset > 0; --offset) {
+ it = it.right;
+ }
+ return it.value;
+ }
+ mix() {
+ this.data.forEach(v => {
+ if (v.value !== 0) {
+ let it = v;
+ let offset; // javascript and modulo... what a nightmare!
+ if (v.value > 0) offset = v.value % (this.length - 1);
+ if (v.value < 0) offset = ((v.value * -1) % (this.length - 1)) * -1;
+ if (offset !==0) {
+ v.right.left = v.left;
+ v.left.right = v.right;
+ if (offset < 0) {
+ for (; offset < 0; ++offset) {
+ it = it.left;
+ }
+ v.right = it;
+ v.left = it.left;
+ v.left.right = v;
+ v.right.left = v;
+ } else {
+ for (; offset > 0; --offset) {
+ it = it.right;
+ }
+ v.right = it.right;
+ v.left = it;
+ v.left.right = v;
+ v.right.left = v;
+ }
+ }
+ }
+ });
+ }
+ print() {
+ let it = this.head;
+ for (let offset = this.length; offset > 0; --offset) {
+ console.log(it.value);
+ it = it.right;
+ }
+ console.log("---");
+ }
+}
+
+function load(filename) {
+ return new File(
+ fs.readFileSync(filename, "utf8")
+ .trim()
+ .split("\n")
+ .map(line => parseInt(line))
+ );
+}
+
+let example = load("example");
+let input = load("input");
+
+function solve(input) {
+ input.mix();
+ return input.get(1000) + input.get(2000) + input.get(3000);
+}
+
+const exampleOutput = solve(example);
+if (exampleOutput !== 3) {
+ console.log("Example failed with " + exampleOutput);
+ process.exit(1); // eslint-disable-line
+}
+
+console.log(solve(input));
diff --git a/2022/20-Grove-Positioning-System/input b/2022/20-Grove-Positioning-System/input
new file mode 100644
index 0000000..701ca66
--- /dev/null
+++ b/2022/20-Grove-Positioning-System/input
@@ -0,0 +1,5000 @@
+7144
+1439
+96
+-7988
+236
+3250
+6584
+-3301
+-2546
+-6223
+8471
+3104
+-7196
+-341
+9545
+-5592
+-6267
+-596
+6093
+-3814
+3891
+8844
+1407
+-1810
+9684
+-7217
+9292
+-9950
+-1498
+-3633
+2467
+-6819
+7210
+2176
+-7148
+3291
+-1281
+5165
+-1630
+-8474
+-386
+2551
+-7344
+779
+-7196
+4326
+-3658
+2319
+-2604
+-5416
+1679
+4378
+-3192
+-5126
+8863
+-6097
+1378
+4107
+1822
+-4910
+-8449
+-5869
+7054
+-5786
+1459
+9104
+-743
+-1142
+-3086
+4623
+2045
+222
+-4267
+595
+-1156
+-8025
+-2420
+-1905
+-2676
+2950
+-7787
+4505
+9460
+-3661
+-6824
+5543
+2373
+-7116
+4358
+9693
+-4798
+8773
+3231
+715
+3046
+-6116
+8814
+7060
+-2605
+851
+3869
+-6778
+-8968
+-6692
+9611
+-2006
+6980
+5260
+-2047
+-3705
+-9950
+-4902
+-9142
+5188
+-7596
+-7980
+2961
+613
+-6146
+2082
+9801
+-6299
+7654
+1749
+6211
+-8434
+-2885
+3809
+4556
+-2040
+-8449
+764
+860
+1147
+-1049
+1165
+-8585
+4989
+8366
+-630
+8338
+-7266
+4407
+8026
+-6359
+-2575
+-7568
+-9430
+9653
+-5410
+-384
+-2770
+4227
+-7207
+-3675
+4553
+-1329
+2323
+3309
+-9174
+-3359
+-3440
+3538
+7688
+-7266
+8482
+9697
+-5648
+-1786
+-6414
+-7642
+-3083
+-8022
+8759
+9962
+118
+-1222
+-2957
+8803
+89
+-411
+-5279
+1571
+8847
+-7998
+-5955
+-4546
+4782
+-4339
+2841
+4115
+-3065
+7237
+3399
+-9015
+-2299
+-2707
+-2701
+69
+8093
+2626
+724
+2558
+-8388
+-5842
+-7911
+5528
+9239
+-3208
+-7880
+4074
+4238
+-3742
+6883
+7151
+9588
+1455
+1693
+-3726
+5299
+-1633
+6695
+-8520
+-1477
+8988
+-4605
+-5682
+-9531
+-9252
+7020
+9812
+790
+-5273
+-4289
+5092
+-1791
+2644
+-5801
+-9554
+1628
+-4175
+4882
+-4076
+8990
+3532
+5999
+-5384
+2785
+7620
+7232
+2609
+4651
+-4347
+-4146
+247
+-5370
+-5319
+2045
+5710
+-4622
+-293
+5579
+-4285
+-3402
+-8315
+3700
+-2102
+5677
+-9896
+0
+7124
+-5447
+-9870
+7815
+-9327
+9022
+-5564
+-2931
+-8728
+-6567
+-1903
+-6591
+-3217
+6390
+676
+-155
+-1385
+8213
+6949
+9907
+-1127
+-8904
+6243
+5579
+-9819
+-8974
+-4173
+-2559
+4764
+-8654
+5586
+-148
+-4096
+-58
+-4514
+-7758
+-6206
+9636
+2615
+1797
+-195
+-6816
+-6243
+-8721
+-3305
+-1847
+-8749
+2708
+4466
+-8048
+-3705
+1219
+-1504
+-6457
+3616
+-6987
+-6639
+6509
+325
+4660
+-783
+-7176
+-7116
+7916
+-3820
+-3517
+3836
+1982
+1272
+-3371
+-7916
+-5838
+3732
+-4529
+6529
+9510
+-4998
+3874
+2801
+8080
+-3886
+5115
+-2143
+-7314
+-4540
+-2665
+5412
+-5532
+3507
+6718
+4800
+6742
+665
+3641
+3016
+-6891
+325
+-7311
+8033
+1953
+-1581
+4737
+-4163
+-5132
+6451
+-101
+-9365
+-5219
+8609
+-899
+-8475
+-3107
+5417
+-764
+6162
+5567
+-6026
+1658
+9616
+6366
+7994
+1430
+-9064
+-1431
+-7267
+207
+-783
+-1434
+-8566
+667
+-9486
+8666
+-6502
+-3730
+-9129
+4986
+8415
+8098
+-7112
+-7241
+-6675
+-1698
+-3358
+440
+-8665
+5808
+8307
+2835
+8989
+-8875
+-5660
+-1329
+7426
+5666
+4478
+-7252
+-5658
+9170
+7535
+3545
+-4329
+-6349
+-7788
+8093
+9275
+3542
+5748
+7103
+1355
+-102
+-731
+5456
+8773
+7550
+-8302
+5960
+3136
+-9594
+4314
+-6572
+-483
+7863
+8327
+-69
+-8508
+-2905
+6541
+9653
+5941
+3779
+4140
+-3654
+-2282
+-4534
+1405
+-1885
+-5064
+-1905
+5941
+9949
+8440
+4469
+-5220
+6708
+3016
+2769
+-9486
+-189
+8308
+-2786
+1888
+-5884
+-5090
+-2348
+358
+-4946
+-8036
+9617
+9707
+-1167
+3362
+-8663
+-3697
+-315
+6066
+9320
+1815
+-2267
+4509
+-9760
+6057
+9683
+-2031
+7257
+-6170
+-743
+-5809
+-3058
+-9154
+-4339
+-8238
+-6132
+3082
+2836
+-2266
+604
+6542
+-6868
+-8347
+-4840
+-1717
+-9442
+1332
+-8926
+2229
+-9050
+8218
+-2291
+-1375
+3751
+-6691
+-3736
+8173
+-5932
+2923
+-2838
+-6033
+-7405
+970
+-994
+-3966
+4080
+-9950
+6890
+-8611
+9666
+-4226
+-4215
+247
+-1884
+-9400
+958
+4084
+5247
+-1651
+554
+-6080
+-1715
+-3194
+-8374
+8529
+-9372
+391
+-5095
+1047
+9194
+1613
+-6070
+3096
+-8311
+-192
+-9950
+8917
+-3871
+686
+-5065
+-2381
+-8127
+-6816
+7711
+-512
+-5806
+-591
+4029
+-6778
+4299
+-8589
+3869
+-5263
+1501
+-6921
+-2465
+-7252
+-9459
+-7156
+-5234
+-4250
+-7995
+-6376
+8845
+-7046
+-9931
+-9482
+1932
+9884
+4278
+5532
+-8622
+-907
+4270
+9147
+-8359
+-194
+4621
+790
+-7207
+3159
+-2783
+-7041
+6167
+5353
+-2989
+-993
+1922
+-2708
+-8277
+1390
+3470
+-1081
+-9005
+4340
+-5592
+5545
+1702
+3282
+7368
+7470
+-2354
+2808
+-4259
+-1124
+1987
+4517
+-7899
+-1254
+-6778
+-443
+-6653
+7336
+573
+1804
+8322
+-6957
+7633
+-8849
+-9570
+-8968
+-2604
+6575
+-4209
+-7086
+-7765
+547
+-5299
+1330
+3950
+7696
+9854
+5550
+-9877
+4234
+9233
+-5020
+7580
+9869
+8273
+2407
+-789
+-356
+-1367
+7577
+3548
+7473
+-7164
+7252
+777
+-267
+4347
+89
+-2975
+7223
+6390
+-9268
+8021
+362
+7963
+-3140
+-6262
+-5319
+-128
+5397
+8606
+89
+-2262
+-5454
+3654
+-8844
+2903
+-5676
+9444
+3227
+-878
+45
+5993
+4653
+9726
+6692
+7142
+1211
+-7916
+2502
+-1085
+-7601
+-6631
+-7022
+3410
+-5454
+-9644
+-383
+6604
+3879
+-8388
+-8151
+5873
+3669
+4456
+-8725
+2271
+9153
+8276
+5544
+4874
+4036
+-7565
+-3720
+-7232
+-1716
+-5036
+5052
+1229
+-538
+-6088
+5839
+3166
+-5007
+-8397
+-2525
+1685
+-9864
+-9692
+-4743
+-1847
+8093
+1112
+-4490
+-5450
+3113
+689
+2004
+7265
+-5564
+1494
+-3867
+7812
+-3532
+9022
+2288
+-3127
+3836
+-3795
+-6044
+65
+-8048
+1506
+-3305
+3336
+-8520
+-296
+-6389
+-1094
+-5462
+-9585
+-781
+-9790
+436
+-4451
+-849
+9175
+-4102
+-3577
+-976
+4320
+-3217
+-5648
+-6838
+3576
+2995
+218
+-2575
+-4193
+7763
+8500
+6964
+-9745
+-6839
+-849
+-8960
+5145
+7520
+7560
+2019
+4817
+9151
+4024
+2315
+-1559
+-102
+2597
+8784
+-2263
+-1796
+5756
+6159
+396
+4471
+2702
+6682
+9874
+3756
+2984
+1025
+7915
+2462
+7287
+9949
+-9424
+-9135
+-1678
+38
+9784
+9063
+-9525
+5022
+-8616
+8895
+1956
+5197
+-6434
+2765
+-7636
+6058
+613
+-1797
+-9193
+-2231
+-7441
+-4036
+-5677
+-6852
+-3601
+9961
+5003
+-6924
+-8815
+5059
+-5279
+967
+-6289
+7529
+-6873
+-2565
+860
+-5666
+-5398
+-562
+-3487
+-1025
+-6072
+2843
+170
+-793
+9656
+-8376
+9773
+2574
+-3217
+3845
+8507
+-83
+4856
+314
+4505
+-5281
+-1815
+3773
+6235
+-2114
+3462
+-369
+428
+1971
+-8982
+5412
+282
+9581
+-4591
+212
+-38
+-4560
+-5965
+-6206
+-7594
+-8311
+-2689
+6365
+6104
+8739
+-3519
+3254
+7361
+-4865
+-6080
+3094
+7403
+9714
+2284
+-5401
+9971
+7743
+6895
+-447
+-6223
+-4173
+-210
+-179
+-7505
+-1762
+-2883
+3356
+851
+2364
+8599
+492
+-7738
+-3795
+3643
+8983
+3830
+-640
+5357
+4901
+-1995
+-8277
+5767
+2181
+3552
+-7434
+-3260
+1194
+2224
+-8977
+-7103
+4938
+9170
+-250
+9760
+-5077
+6587
+-1873
+-2955
+-1850
+-6048
+8050
+-3593
+-166
+4602
+2755
+5941
+6648
+-5409
+4938
+5065
+4737
+7574
+946
+9666
+8514
+9478
+7771
+6958
+-8520
+-6740
+5962
+3048
+6709
+1225
+5284
+-3837
+2086
+7504
+8625
+-7745
+-6630
+-4301
+-5454
+5317
+-6958
+-249
+3353
+-7787
+8244
+7838
+3296
+-6448
+-852
+-315
+-1343
+119
+4547
+3538
+-3952
+9125
+-2763
+5395
+5145
+-9327
+-8459
+-2361
+6811
+9502
+-5328
+-8622
+-4854
+4547
+-3436
+-108
+-2763
+1849
+8559
+7974
+440
+254
+-8178
+7524
+6099
+4637
+-6349
+-4339
+-7156
+1786
+1352
+8277
+-6715
+9630
+3521
+8912
+-2729
+8127
+9306
+2587
+-465
+-6374
+8530
+-841
+-6999
+-8173
+-918
+623
+5111
+-9723
+6365
+7672
+-7988
+-4911
+736
+4819
+5896
+-4079
+4679
+-8644
+-8816
+6081
+-8277
+8757
+1897
+-8139
+-5713
+9756
+4791
+8017
+-3633
+2344
+-7411
+6222
+9873
+5240
+-6398
+-4172
+7853
+8467
+-7549
+7758
+-8379
+-3705
+-8747
+-4549
+-7837
+8735
+2206
+69
+7187
+-4602
+-5811
+3686
+-3321
+-4220
+3459
+-5801
+4906
+-341
+5953
+-4227
+-5847
+-6715
+4541
+-3313
+4151
+8844
+-4175
+8444
+-3713
+-7288
+-2561
+1089
+-3734
+1157
+-2649
+-2954
+3895
+-8646
+7645
+-5462
+-4483
+-3121
+669
+2602
+3578
+742
+-1253
+2870
+-3407
+9637
+-5173
+-4719
+3922
+-4939
+2792
+2718
+-145
+-9016
+7395
+-8015
+-8036
+-3198
+-1705
+-1705
+6485
+1922
+-372
+6776
+-8199
+-9710
+-7395
+8068
+9997
+8338
+-2668
+-369
+-116
+-6375
+8601
+8088
+6742
+9273
+1822
+2162
+5069
+-4601
+-666
+-2108
+-5806
+-4764
+7211
+6412
+9338
+961
+5417
+-6059
+2334
+7697
+2638
+6883
+3043
+-7781
+9587
+2939
+4312
+1849
+7169
+-4006
+-9787
+-1161
+-1344
+9182
+1956
+-7109
+-9497
+-812
+-8542
+-4160
+1390
+8501
+-4493
+-7524
+937
+-3850
+-8524
+-4489
+4550
+1097
+-4134
+-3879
+6965
+8208
+-2546
+-2964
+-7545
+-3607
+-683
+1658
+2009
+-217
+6287
+-3614
+-5614
+9672
+-4096
+-3260
+8083
+-596
+9925
+8173
+7240
+-2668
+8283
+-8933
+-1038
+-3437
+3108
+-5075
+-60
+-9086
+-2698
+-5512
+2254
+-2676
+8835
+-1253
+715
+-1088
+4958
+-8323
+-3025
+2284
+-5556
+-6283
+-588
+-338
+676
+391
+-5962
+4456
+4553
+-2686
+-5801
+4915
+-5197
+-315
+-9088
+6208
+-5039
+8306
+7426
+2973
+9666
+-1040
+7574
+-9510
+-6181
+8762
+3311
+-4382
+4407
+-1238
+302
+-300
+-1504
+-8700
+7272
+7407
+-7041
+9716
+1025
+3451
+-5448
+-6065
+7139
+-1632
+-5923
+-3500
+5550
+-2648
+6484
+-9219
+-949
+7626
+2363
+3641
+-7227
+6271
+437
+-4236
+-9942
+772
+-7182
+-9537
+7306
+-5996
+1350
+5652
+-3127
+-5700
+-1831
+-2150
+-4159
+-2550
+1721
+1239
+5052
+-7931
+-3823
+8762
+-5401
+-9642
+5822
+-6901
+-2017
+-2629
+8845
+5556
+-4492
+-8900
+-1450
+-363
+4814
+2181
+-2838
+1591
+3968
+396
+7581
+8209
+3892
+7053
+-7138
+4377
+-473
+-2892
+3896
+-6201
+-5293
+-163
+9662
+-8165
+1636
+-8123
+328
+2502
+-8116
+1574
+3935
+-7411
+7197
+3311
+5748
+-6120
+-5933
+-1460
+-7186
+-4197
+-8238
+5242
+-6443
+-2593
+-5114
+-4061
+-7434
+-5328
+-779
+5860
+2362
+755
+4430
+244
+-6799
+5618
+-1831
+-3790
+-6184
+7475
+-8651
+7586
+-9710
+9983
+-2870
+2713
+-3751
+-1876
+6787
+-7020
+3968
+2703
+-2284
+5586
+2420
+-217
+-4949
+-4036
+-415
+-4280
+6456
+9539
+-6201
+-200
+6972
+7009
+7153
+227
+8579
+8396
+-592
+-8142
+8623
+-5353
+1147
+-1168
+-7916
+8792
+3602
+254
+-5393
+7687
+-1894
+8072
+9568
+59
+-4489
+2045
+-8910
+425
+1229
+-7493
+4884
+9424
+9219
+-3871
+-2665
+-1176
+-4858
+-1934
+6196
+-7682
+8589
+-9685
+2584
+-815
+1815
+6026
+4280
+-6292
+2497
+7237
+4271
+3642
+6228
+506
+4407
+-2403
+2163
+1384
+-8707
+988
+6742
+7553
+5733
+3985
+8206
+-7378
+1373
+2007
+7758
+6818
+-5259
+-8672
+-9642
+9502
+-8388
+-7041
+-3736
+-7354
+22
+5397
+1654
+8683
+9794
+6270
+-6948
+6238
+1152
+-7341
+-5119
+7805
+-3701
+1575
+-2723
+6946
+2939
+-1617
+8321
+6262
+-7547
+-7411
+-6193
+1874
+-6536
+1847
+-2989
+3728
+-386
+1964
+-997
+6142
+3978
+2315
+8650
+-8799
+3010
+5034
+-1121
+-7609
+-4865
+8707
+573
+9194
+7639
+-6350
+-1633
+-6592
+-1828
+6883
+4473
+1457
+2676
+3350
+-3792
+-1053
+5808
+1290
+-1006
+7543
+1296
+1260
+4352
+7294
+-6832
+8180
+-4313
+9662
+-3315
+-1238
+2371
+-6835
+3523
+3664
+6061
+-9518
+6938
+9050
+4876
+-3845
+-1632
+9073
+5346
+-3672
+-8459
+-3740
+-5197
+2888
+-9547
+7412
+-1633
+3819
+-1585
+-7333
+-1636
+4718
+-5015
+2882
+4607
+7274
+8461
+-9495
+-8929
+-5336
+5147
+-7652
+8387
+8625
+-844
+-1668
+-8198
+-723
+-577
+6299
+9307
+-1153
+-9423
+4280
+4740
+1565
+5272
+2119
+-1934
+962
+-2276
+-9085
+1745
+993
+8903
+-510
+-5780
+-844
+-3227
+-412
+6411
+-3422
+-3592
+1303
+5038
+6895
+5397
+-3592
+-9064
+8592
+2101
+8680
+7687
+-7652
+3291
+-5236
+7737
+799
+-1548
+713
+2829
+6300
+891
+9130
+3836
+1407
+3215
+-4459
+-9379
+-5947
+-7306
+-2475
+2319
+4841
+-4809
+-7371
+-3270
+1994
+1293
+2223
+-2384
+-7594
+-9658
+2875
+-4498
+-2709
+4952
+-5279
+1471
+3392
+7907
+-5525
+-8649
+7221
+9785
+6652
+-4073
+5748
+-3778
+-6214
+-6692
+4925
+-485
+-7462
+-4496
+4078
+-6835
+-6059
+-2937
+144
+-9196
+-6244
+-8001
+-443
+-6935
+8424
+-6954
+7497
+8073
+-538
+-638
+1821
+-4264
+3680
+-5566
+4518
+-2224
+1824
+9812
+3807
+5072
+-679
+-3658
+-3340
+-1288
+3938
+2125
+6215
+4853
+302
+-7274
+-2330
+-7422
+7153
+-6026
+5768
+-2376
+-1730
+2308
+-2301
+-6778
+879
+-4370
+-1698
+4171
+8530
+-1306
+5382
+-9419
+4974
+-649
+-4319
+-5411
+2197
+6765
+-3576
+8581
+-4939
+-7998
+603
+-1409
+9745
+-4037
+-8903
+3650
+821
+-2584
+-9341
+4483
+-630
+-4225
+-9715
+2960
+-1535
+-5067
+-6935
+-9423
+-4172
+9093
+-5353
+-1905
+-2827
+-7835
+2191
+3544
+5038
+4024
+-1332
+-7449
+4428
+6478
+-7875
+-5520
+-886
+-273
+-8224
+958
+-7147
+6313
+8770
+5069
+1577
+-7111
+933
+4073
+-4054
+-2989
+-1772
+-1
+2802
+2816
+4873
+7349
+6639
+-5664
+-1666
+-3713
+8972
+-7372
+-4025
+2232
+-376
+2816
+94
+2403
+-843
+-5639
+4514
+-5047
+8179
+-1572
+6830
+-8602
+-754
+8201
+-5876
+-4840
+1637
+-2725
+-2250
+2009
+-1176
+8298
+-5019
+-4886
+1350
+1055
+3937
+-7264
+8330
+-9290
+-7482
+1821
+5471
+-1959
+983
+4522
+-7143
+5904
+-933
+9704
+2753
+2580
+-5749
+-728
+-7636
+4911
+3648
+-7301
+2834
+8849
+4446
+-2328
+-9241
+9187
+1742
+5537
+7068
+-9241
+4057
+1618
+8894
+-4291
+-5232
+1097
+-3909
+-3570
+-4444
+789
+-6033
+-2053
+-203
+-6888
+5550
+-918
+-1656
+7304
+-4464
+3291
+-1743
+-5889
+-7929
+-3814
+69
+-7902
+-649
+-9208
+-8814
+5514
+-9372
+4475
+5100
+-1715
+8576
+-9288
+4974
+-7818
+-3614
+6089
+-5459
+7462
+2897
+-24
+-511
+-9503
+3951
+-7927
+72
+-4230
+3353
+-7310
+-2968
+9075
+24
+3919
+-1959
+-6566
+-4490
+1293
+1048
+7974
+-5806
+2704
+-8511
+2500
+1221
+-5579
+-7320
+-3549
+9704
+-7308
+-8023
+-3416
+-5809
+-8828
+9611
+-8527
+-5281
+-4601
+-6551
+6797
+-8434
+9490
+7023
+-3737
+9675
+-2207
+-6873
+4147
+724
+7598
+879
+9354
+552
+-6921
+-6016
+9144
+-399
+7399
+6701
+-2883
+674
+3356
+-9350
+-2964
+7577
+244
+-1063
+-9864
+6635
+-8483
+7815
+2271
+3507
+1003
+-2030
+-7632
+-8204
+3470
+2021
+2879
+-469
+-7909
+-5133
+-1439
+473
+-3561
+-2224
+4710
+-6927
+3932
+6958
+-2547
+4516
+-5868
+5989
+2676
+-9769
+1637
+-3351
+-7044
+4559
+4734
+-5566
+-3850
+4175
+4952
+-7788
+-8232
+5647
+-5473
+5443
+4495
+-7850
+-1786
+-4590
+5436
+-6471
+5562
+-4839
+-3390
+962
+2509
+-9461
+1555
+1583
+-7030
+9470
+4739
+-6074
+-8281
+-3436
+-2882
+5941
+-8030
+-9159
+6499
+-5569
+-8417
+-743
+-8589
+-8921
+8172
+-6112
+1986
+8651
+9161
+2598
+-519
+-5732
+2551
+2821
+-1195
+-185
+8319
+-7434
+2090
+9936
+9182
+9973
+-849
+7009
+5515
+-6253
+-1293
+-2154
+-8499
+102
+4071
+-774
+2661
+-6618
+664
+9352
+-4660
+-9661
+3978
+-9360
+-5450
+-7770
+-1376
+-221
+-2387
+-9206
+8650
+7617
+8360
+4988
+-102
+8300
+-6268
+-4855
+-6696
+-6790
+5095
+-6432
+-3836
+9847
+-6216
+2002
+-265
+9571
+-2723
+-7200
+511
+-1293
+7720
+-9802
+-7156
+4555
+6342
+-5259
+2385
+-9299
+-2968
+8829
+-3629
+-4048
+5256
+7907
+946
+-4444
+3661
+-9273
+6275
+-9903
+-3827
+-2553
+-6650
+-3335
+7642
+4817
+-8231
+792
+-6021
+3579
+-2905
+-2424
+8302
+-1676
+-7112
+3349
+-2786
+-9985
+-3067
+-7879
+6637
+7773
+-7919
+-6182
+9075
+4376
+-3118
+3581
+3556
+9954
+59
+-6064
+-194
+3937
+-7835
+-8749
+-9005
+6596
+-9581
+5060
+-2387
+-2661
+-4432
+-1894
+-4958
+-5602
+-9047
+-7041
+-8590
+-7020
+-9311
+1575
+2073
+1989
+-7164
+-6935
+-1785
+-411
+6161
+-2150
+8098
+-6985
+-3665
+7124
+9324
+-3762
+-7482
+-4173
+6634
+7192
+3542
+6221
+-8449
+-9142
+4217
+-3064
+-9897
+-6502
+-2783
+-4565
+4522
+5338
+2202
+-1529
+3711
+-2224
+1796
+-8398
+-744
+-7254
+-1689
+-8707
+-1604
+-9840
+6481
+522
+4447
+-1450
+1308
+4565
+-4076
+8058
+-4277
+959
+9510
+6230
+7793
+-8529
+2467
+-1576
+8759
+7156
+1687
+-1064
+8093
+-3670
+1113
+-2989
+6478
+-5157
+7696
+2769
+7038
+-7165
+9219
+9254
+5098
+-1872
+-7794
+6781
+7863
+-1669
+-2934
+8936
+-113
+-5790
+-4475
+1272
+-3976
+6361
+3850
+-1231
+-2417
+-7165
+3025
+-8101
+6635
+4497
+130
+-6675
+1318
+1854
+-4335
+2745
+7336
+3472
+2302
+4772
+-9901
+-9170
+9587
+1637
+705
+6066
+-9702
+-733
+6575
+-8816
+5802
+3282
+1868
+-2071
+-2293
+-1315
+-4441
+-377
+3551
+6642
+-4050
+2102
+9821
+1047
+-6893
+-6816
+4494
+-1385
+-8090
+4935
+-773
+926
+623
+8625
+9120
+689
+7500
+-8219
+3161
+5695
+-1959
+-3574
+-3255
+9372
+-1885
+7591
+-1431
+179
+-4910
+7288
+3748
+-7745
+1311
+5303
+9557
+-8079
+-1715
+-8511
+5158
+-8926
+-774
+1411
+-7812
+3615
+-7044
+6360
+-2594
+4217
+3963
+2231
+-9179
+4958
+-5287
+6492
+-7186
+8018
+-2269
+-9040
+-8039
+-6816
+8739
+-7830
+9392
+2356
+-3356
+-7896
+-918
+-3577
+-4580
+6642
+4636
+-2047
+1906
+598
+7771
+-4493
+5148
+9274
+-5064
+-2915
+3096
+3284
+-8921
+-3298
+1635
+4669
+-3013
+-2784
+-8728
+-6566
+-8990
+4222
+-8982
+-9492
+8038
+3914
+-8374
+5049
+5040
+5336
+2802
+-6364
+-1413
+4929
+-2523
+-1224
+-3827
+-6087
+1702
+5304
+5232
+-5053
+66
+7151
+-4848
+5668
+-6007
+1390
+-5252
+-5753
+-3067
+5903
+-4452
+-5993
+-2942
+-2976
+-9998
+6945
+-6243
+-4664
+-2480
+-708
+-472
+-8151
+7678
+-7659
+5950
+-3431
+5248
+3872
+774
+3336
+-3293
+-8858
+-1612
+-4135
+-6964
+-2404
+-2139
+5824
+8300
+-9114
+-674
+-4280
+7943
+9695
+-1762
+8217
+9618
+6148
+5666
+3116
+-7931
+6811
+-754
+45
+2559
+4398
+-2786
+4390
+9813
+-4227
+4029
+-5382
+-7268
+6466
+528
+4492
+2670
+-7247
+-3270
+-8792
+8890
+8271
+3523
+-7902
+-1709
+-8138
+1139
+6382
+-1580
+7708
+-3713
+-2110
+-5263
+-7567
+8404
+451
+1540
+7759
+-4043
+7191
+-9452
+-5512
+9221
+-9196
+5856
+1971
+7937
+9357
+233
+-1860
+-4601
+-8957
+2086
+3179
+110
+-2469
+573
+2969
+-6959
+1869
+-3929
+-6563
+3157
+9018
+2623
+-7179
+5271
+7232
+-2827
+2677
+-9572
+5685
+-9204
+1534
+-514
+-8372
+6945
+-4258
+691
+-4858
+7555
+1990
+-3592
+-369
+-3500
+8844
+-7344
+7279
+1218
+-411
+5712
+7038
+3684
+-3085
+3312
+2149
+3459
+865
+9813
+4378
+6451
+1310
+-6083
+9700
+-3165
+-4432
+-9380
+8702
+-8817
+6683
+-7067
+-5602
+9698
+9671
+-1007
+-4946
+-5011
+-1047
+5514
+-7330
+7143
+-2119
+-8215
+-7700
+-4549
+-4939
+5091
+-5648
+2373
+1693
+-3351
+1134
+3556
+-4493
+-9985
+3530
+-2398
+-6210
+-743
+-886
+6045
+-9969
+-7781
+3279
+-2304
+1005
+6838
+-7996
+-9989
+-6248
+-7602
+3362
+-9327
+2996
+-4620
+-8897
+5232
+-8726
+1187
+3523
+3059
+6842
+-2529
+4101
+-7996
+2284
+6260
+-2709
+590
+8847
+1247
+-3989
+6895
+-6873
+1494
+1814
+6098
+8024
+3542
+-3762
+-4422
+6742
+-6616
+-3827
+9951
+4033
+4500
+-5599
+4335
+-3935
+-3383
+-9906
+-2685
+5319
+3375
+-6118
+-2919
+8969
+-3768
+-8759
+-2564
+3172
+-400
+-6360
+-6792
+5596
+-3585
+2064
+1879
+2546
+-9219
+4793
+3727
+4320
+1884
+-8597
+-7395
+7151
+-5234
+-5218
+3271
+7661
+-852
+-8398
+5627
+-148
+6265
+3392
+2802
+-6251
+3349
+7226
+-9677
+4587
+9923
+-9555
+440
+-559
+3582
+-8910
+-5096
+5232
+8656
+1122
+-2973
+2142
+3271
+9816
+-3437
+-6451
+902
+4038
+-5796
+5867
+-1462
+-1697
+-262
+-6928
+1884
+-2483
+2865
+5201
+-3561
+-9017
+-5163
+2842
+6369
+5226
+-3359
+9198
+-7147
+-6935
+-5560
+-3243
+9705
+4210
+-2594
+-1257
+4312
+-9535
+-8608
+-6286
+1923
+626
+-821
+9485
+-6117
+-5147
+3351
+8985
+5036
+-7268
+-4911
+983
+2428
+1485
+5456
+-2443
+4312
+7845
+-6374
+-9845
+-7226
+4151
+4562
+6319
+1249
+9833
+-8565
+-9729
+-9372
+-4749
+9418
+-2287
+-8048
+5973
+777
+5599
+4375
+-4791
+-9845
+-7604
+3300
+-1035
+5599
+-4432
+5747
+-4579
+8707
+-1934
+-2324
+7238
+2231
+6997
+-7808
+3398
+6470
+-1822
+5813
+4339
+-6710
+6764
+-9952
+8922
+-7069
+-3938
+-7183
+-9662
+6545
+9503
+-8566
+-9406
+-2249
+5866
+-7700
+1624
+-8353
+-9615
+9907
+-4796
+-7320
+6538
+-1873
+-3661
+6250
+8356
+-2350
+8665
+2149
+-3043
+4209
+5568
+4456
+8698
+6626
+4166
+6124
+1815
+6499
+-9132
+63
+1875
+-4580
+-4593
+9884
+-5383
+6378
+-7129
+2308
+1893
+-7789
+5516
+638
+3919
+-4296
+-5923
+-9039
+-2293
+5866
+-4824
+-7815
+-5461
+1010
+3351
+9481
+8933
+-6868
+-1665
+-500
+-1194
+-2709
+8217
+3225
+-6834
+4500
+-9170
+9417
+8320
+-3098
+1897
+4926
+7475
+4532
+1759
+1457
+4500
+-357
+8635
+4813
+-5138
+-789
+3375
+5550
+-3751
+3240
+-7263
+9728
+9624
+7406
+3950
+-223
+4149
+6965
+-8286
+-7902
+-8511
+-2649
+8983
+724
+-1274
+6165
+-7086
+4527
+-2335
+-7584
+-4175
+5382
+-675
+8170
+7589
+-8224
+-3118
+-2919
+-8124
+-1789
+-1876
+8157
+-728
+-5670
+7338
+6088
+2843
+-2705
+3553
+-9203
+2118
+-5064
+9281
+793
+-3325
+3296
+4511
+7669
+-1344
+-1379
+8924
+-6623
+2775
+8351
+-4418
+-267
+9653
+5724
+-6948
+-5586
+-1192
+-1208
+4986
+-4567
+-7439
+5862
+-1530
+8332
+-7431
+6753
+7211
+9364
+7203
+-515
+-1142
+-1828
+-7424
+-7226
+-7303
+5523
+3290
+-7682
+4408
+-5124
+-170
+8298
+-2159
+1815
+-8684
+-8105
+65
+-4408
+-7872
+-3463
+3650
+170
+-6847
+5471
+-7074
+-1656
+891
+9153
+7655
+-3335
+7105
+-5353
+7706
+-8891
+8589
+-5966
+472
+9219
+-4980
+-5095
+-4620
+-6912
+-6118
+1349
+119
+8432
+-7592
+9133
+1302
+-5936
+-6736
+6447
+6406
+-2243
+2683
+-7631
+9311
+-5273
+-5334
+5094
+8182
+-3498
+-4339
+-1004
+1363
+-8392
+-3795
+4395
+3244
+6066
+-9874
+-2907
+-6948
+-4730
+8606
+-6944
+1194
+8036
+-1686
+1865
+-9802
+8369
+-7361
+-9088
+7198
+4258
+-3390
+3596
+-2977
+-9497
+-6735
+-3613
+8714
+3354
+715
+5754
+-1876
+7912
+4446
+-1399
+7799
+7197
+-4597
+-9844
+-7621
+-369
+-2686
+2676
+4266
+958
+-5401
+8044
+-5036
+-2921
+3892
+1274
+-5297
+3410
+3654
+3286
+-4266
+-8050
+-6427
+-8311
+-364
+5684
+-7405
+-9201
+5303
+-8396
+1330
+-4916
+-3867
+-9034
+-5256
+-5281
+248
+59
+6922
+-7077
+8906
+2947
+6313
+3293
+464
+1718
+2191
+1869
+5017
+6499
+3472
+5779
+-439
+-9931
+8730
+4914
+3399
+-9059
+-5416
+6081
+6458
+-4277
+1062
+6922
+-2617
+-398
+416
+-6117
+-2159
+-3530
+-6048
+1114
+-3384
+664
+2971
+6648
+1369
+-8968
+9851
+-7675
+1505
+-1948
+-6958
+1339
+4737
+8183
+9565
+4319
+2536
+-3384
+5034
+9262
+7892
+-8059
+8072
+-3274
+-1499
+-7020
+-6543
+6814
+536
+-8177
+6642
+-4239
+440
+-3640
+-8346
+-9110
+-4188
+-2756
+3707
+8105
+-4597
+-8469
+7151
+-6500
+2758
+3190
+2137
+6959
+-4146
+2806
+469
+3064
+3485
+-9930
+-9750
+-9240
+-3906
+5377
+6920
+-2662
+5382
+-5924
+-2575
+-9476
+-7223
+-5353
+9364
+-6146
+-700
+-2889
+6458
+8340
+1573
+-8569
+-841
+2308
+2070
+-5997
+-941
+6701
+6922
+-398
+-8682
+1143
+-4498
+7696
+8723
+-2573
+-1190
+-9362
+-5830
+2206
+529
+-42
+-6794
+-9014
+-2994
+6986
+-5700
+-4131
+-1439
+421
+9675
+6964
+-751
+3525
+-4403
+5486
+2055
+-9299
+-2454
+629
+3016
+8770
+-4718
+-2272
+-7626
+-8392
+5668
+2158
+-2015
+1048
+-640
+1047
+-6375
+-9113
+5487
+-7080
+-8069
+-3748
+688
+9960
+5241
+1902
+-6901
+9532
+7434
+7367
+-6912
+5861
+-8359
+6906
+-1903
+-9186
+-2418
+-5711
+2980
+8483
+-6751
+-4858
+-4504
+-7794
+7106
+9047
+-7112
+-4036
+-613
+9774
+7373
+-8869
+4547
+1628
+-2298
+3504
+9503
+-4544
+-6249
+7007
+4226
+-6353
+9039
+855
+-2818
+6461
+-761
+-8665
+-1205
+-9985
+2318
+6881
+8800
+-315
+-9194
+-7797
+-8303
+-6999
+3809
+9502
+8201
+7918
+-1862
+3322
+2167
+-8509
+-4445
+-1382
+-9776
+-9108
+-2605
+3051
+-9023
+-6803
+-9585
+851
+-7929
+-5675
+8415
+3928
+4479
+-3219
+-5563
+-2921
+-7857
+1121
+7256
+2300
+-8176
+492
+7424
+2073
+-3614
+2176
+3399
+-955
+9936
+-5287
+-8947
+-9608
+212
+-6322
+-6957
+691
+-8904
+4941
+1306
+-8101
+1731
+8146
+-5569
+3162
+8277
+-9877
+1545
+-6262
+2073
+2314
+1327
+-4335
+6701
+8853
+7278
+3773
+40
+-1300
+5559
+-1035
+-6612
+-525
+-102
+5502
+-6819
+-7536
+7031
+1160
+9361
+-1681
+5393
+2294
+-1009
+-7450
+2354
+58
+6167
+7001
+-2978
+-3678
+-6812
+-5630
+-917
+5417
+8906
+1045
+9519
+7497
+6753
+3317
+1847
+-4076
+134
+-7619
+-2390
+2844
+-4117
+-9208
+-4549
+-9008
+4347
+3641
+4525
+7453
+-5703
+5615
+-5057
+5878
+8723
+-6193
+-4787
+-7544
+5472
+-1265
+5018
+3696
+-8085
+7115
+6194
+6980
+-6001
+-1845
+-3622
+-8180
+-7699
+2456
+9768
+-3132
+1038
+6626
+-6244
+-9734
+-4200
+-4660
+-1177
+-6097
+8556
+2888
+-7931
+-3058
+-3235
+-9113
+-3294
+-5908
+-8317
+6302
+-2364
+4135
+-2012
+9973
+1691
+227
+6368
+-1107
+-5236
+4147
+5762
+-2838
+-2117
+-5236
+-4635
+-214
+2677
+4798
+-4935
+-3984
+8762
+4200
+-9450
+-3355
+-7659
+-6914
+5432
+-7493
+4036
+1754
+-9248
+-2975
+6686
+-9463
+-8575
+-8088
+6692
+5748
+9793
+5302
+2758
+8170
+5841
+2240
+-4590
+6489
+7523
+4401
+5568
+8263
+1765
+-9214
+7610
+5754
+8458
+-1797
+-4015
+1399
+-2830
+-4270
+-9710
+-6249
+-7111
+5501
+-5755
+-6067
+5941
+-6220
+-1685
+3064
+-6159
+6164
+-7765
+1995
+4313
+-2223
+5733
+2479
+-9524
+-2663
+110
+-5565
+7341
+-9985
+-3677
+5099
+-9242
+-8029
+9553
+6959
+3097
+-6937
+642
+-9875
+103
+6208
+-333
+-4312
+-8729
+-1847
+9223
+7137
+4495
+1000
+-5622
+515
+-8392
+5678
+-743
+-5648
+9298
+8070
+-6237
+8320
+8390
+1797
+8845
+-2262
+-1618
+7128
+-5566
+-6921
+1785
+5069
+851
+5027
+-68
+-962
+-2774
+-6223
+8910
+-1876
+-5965
+4553
+4450
+-9933
+-3430
+5116
+-6087
+838
+9896
+-6630
+-2931
+-4163
+-4329
+3786
+-9608
+3932
+-1085
+8500
+-9798
+-7808
+-3407
+-3071
+-5345
+6368
+7733
+-6705
+1369
+-1492
+-9492
+5946
+2975
+-7383
+-8180
+-124
+-5618
+2947
+7845
+4043
+-2422
+-6227
+5945
+-1344
+5342
+-5341
+3773
+9937
+1390
+8603
+4858
+103
+5582
+-2497
+2215
+5561
+4958
+9298
+-1167
+2070
+-1772
+-1624
+-4847
+-7540
+-4996
+6752
+-7228
+-9181
+-9067
+-3082
+8847
+1575
+-7923
+-9759
+-8614
+-7770
+-2293
+3361
+-5801
+-7268
+2142
+-4932
+4097
+5706
+7959
+7231
+2772
+2176
+1693
+1420
+2980
+-9156
+-510
+-1085
+-1595
+1452
+2971
+-5711
+1331
+-2455
+1281
+5726
+6427
+-9248
+9243
+7702
+9949
+1152
+7093
+-9276
+-7116
+6361
+6275
+-5726
+-9928
+-5548
+9201
+3108
+2198
+-4468
+-4493
+-5077
+-1817
+-3130
+-6837
+3566
+9153
+-8028
+3621
+-4445
+-2159
+-1697
+-4654
+-8728
+-7916
+9671
+4033
+6345
+-3440
+-4299
+-565
+-6543
+-2210
+-6996
+6342
+650
+1210
+2907
+7152
+-9337
+-3792
+-5101
+4307
+9541
+8771
+-4492
+-2335
+-9274
+-5236
+-4126
+3120
+-6471
+-917
+-1225
+-1306
+8686
+-917
+-6479
+-4073
+3261
+1932
+9208
+9447
+3550
+-4489
+-4484
+-2430
+6519
+-1278
+-4787
+9125
+-6827
+4893
+-2489
+-5603
+-6696
+-3827
+-2235
+-8827
+-3545
+-1705
+-9108
+-3007
+-3690
+8717
+-5383
+-2783
+-6579
+-3127
+-7645
+-2119
+-5809
+5782
+-6374
+-6450
+6489
+-9300
+8830
+-7626
+-8020
+6990
+6138
+7543
+-2718
+4014
+7563
+-1383
+-3972
+-267
+6398
+-8316
+-1222
+2586
+-4923
+-7259
+66
+-9090
+-6571
+1612
+-5027
+9354
+-9822
+1379
+-5277
+-8286
+-820
+-8651
+4532
+-9976
+-1772
+-8434
+8809
+7360
+-3796
+-3341
+7845
+5111
+-3672
+-4699
+7054
+4636
+3522
+-925
+-8034
+-7112
+3320
+-3952
+1264
+-4050
+-7831
+8514
+8514
+9155
+-9503
+-9852
+4258
+-5231
+4770
+7988
+-3258
+-1873
+-794
+-1037
+-4529
+-7925
+7520
+7264
+3895
+7145
+4416
+739
+-4105
+-3487
+7339
+9737
+2631
+7540
+-3601
+-2420
+-3850
+4474
+1831
+-3999
+4471
+-9529
+-2836
+4033
+-4777
+9120
+2294
+2011
+-5008
+-4860
+1086
+9745
+7211
+-849
+6066
+7758
+-578
+3447
+7983
+-5563
+-4639
+6304
+-16
+-5905
+2004
+7470
+-6794
+-1223
+3872
+3154
+-9692
+7771
+-1009
+-58
+-4939
+899
+-8417
+-5640
+-1053
+1634
+-9273
+318
+8036
+152
+-2025
+-1685
+-6551
+6059
+3179
+664
+-9608
+-497
+-2270
+-6032
+-335
+686
+8070
+6726
+-6551
+-1142
+5596
+-267
+7557
+-5926
+7736
+-3298
+-1945
+9907
+6889
+-2285
+6047
+9572
+-1086
+-1678
+9627
+-2123
+-7183
+-5700
+9963
+-5676
+-8720
+-5135
+1459
+-505
+7183
+5443
+-519
+-1085
+-7468
+2252
+-4270
+-6207
+-8562
+8005
+8899
+7550
+6015
+-9446
+3082
+3459
+676
+1834
+3974
+5726
+2181
+-9437
+-4749
+2319
+6279
+9028
+2124
+-9771
+-1107
+6945
+2815
+3353
+6159
+5009
+5272
+9960
+1303
+3650
+-7885
+9535
+227
+-5842
+1408
+3180
+7415
+8185
+8170
+6031
+-825
+-8286
+-4840
+-9962
+1478
+-5097
+-5648
+-5268
+6981
+-2659
+243
+4289
+5456
+3184
+3240
+9949
+-5416
+8313
+2787
+7214
+9210
+-9685
+8001
+-4264
+-7023
+-3592
+1311
+4144
+9473
+4692
+-6834
+6058
+2576
+2524
+-6408
+5407
+-369
+9627
+-9347
+3259
+5860
+-2975
+2682
+4326
+-6788
+-6517
+5556
+-6535
+7699
+7223
+6154
+2623
+7456
+9706
+6692
+-4511
+4319
+-8347
+-1807
+8875
+-8907
+-9248
+3387
+2522
+-4568
+7523
+-6837
+-9289
+-9166
+1046
+8735
+9990
+4558
+-1814
+813
+9854
+-5914
+2124
+554
+-894
+3807
+-1061
+2659
+3531
+7936
+-3898
+-4395
+7262
+-2536
+-3633
+-2957
+-6816
+231
+6346
+-2455
+2137
+5641
+953
+-3246
+-5619
+-8090
+-719
+-9225
+-8621
+1736
+6801
+5331
+-6537
+-5319
+7579
+-9306
+2045
+-3369
+-8050
+7093
+-8311
+5033
+4497
+6890
+1231
+4456
+8818
+1729
+3816
+9627
+-1477
+-4384
+8088
+7285
+-7173
+-1373
+-5333
+-8838
+-8842
+-8665
+-1548
+6838
+5704
+4500
+-5036
+-1547
+-9535
+4734
+-9363
+7758
+9467
+1989
+-6760
+3553
+8471
+2314
+-69
+-5279
+8059
+4270
+-3192
+-1668
+807
+-6884
+-8378
+642
+559
+-9151
+6114
+-9050
+-7110
+2149
+-9811
+994
+1308
+-8239
+7210
+2242
+7700
+7168
+-69
+1469
+-172
+156
+8483
+7360
+-6735
+-9502
+-6182
+-9091
+1636
+2896
+-5972
+1107
+5105
+8835
+-4910
+-7154
+-2033
+8208
+5338
+-2275
+3282
+-4010
+-5814
+-4889
+3096
+5362
+-8760
+-8297
+3830
+-3069
+-8128
+-9891
+1808
+-8454
+-4800
+1986
+-1253
+9212
+-3945
+-9128
+-4285
+933
+-5013
+-630
+6527
+8583
+-9059
+-4973
+-9867
+9194
+241
+7870
+-123
+-6751
+-66
+390
+9813
+-5127
+1586
+-7847
+-6067
+-537
+-4743
+6108
+3850
+3388
+-2233
+-4258
+5925
+6751
+1559
+-8721
+4378
+1204
+4734
+835
+1165
+-7703
+-4268
+5397
+8735
+1324
+-1605
+-2424
+7493
+8978
+4894
+5159
+-422
+3028
+3545
+-1786
+-2577
+-4010
+-7425
+1018
+516
+-3984
+8521
+-1862
+8717
+8265
+5873
+-5496
+3497
+-7687
+2676
+3215
+-9425
+-1492
+8281
+-3335
+3542
+843
+5432
+7376
+8272
+-39
+-3233
+2661
+9352
+5125
+-5336
+4541
+-1274
+-7070
+-4276
+-814
+-4892
+-3335
+-1945
+-2801
+2502
+6219
+9717
+6294
+-5690
+6942
+7708
+8901
+8092
+-4071
+-5997
+5927
+-4854
+2485
+-2417
+7427
+8449
+5871
+7524
+-1166
+-9409
+-9676
+-3967
+6959
+5303
+1666
+8739
+7455
+-3255
+-9624
+9395
+9756
+229
+-736
+813
+-5664
+2181
+-5327
+-9181
+1795
+9118
+8718
+2197
+-7737
+5038
+-4840
+-9088
+-4444
+-8709
+6093
+6495
+5726
+-4084
+2971
+-1151
+-8330
+-8932
+-5822
+-4175
+6435
+8312
+-1709
+2712
+1527
+-7217
+-5241
+-3820
+-1022
+-9179
+-4504
+-8904
+-9875
+1591
+-8566
+-2230
+1790
+-2104
+8064
+4858
+-5077
+7571
+-5736
+6069
+4033
+3608
+1408
+-3381
+1888
+-8139
+5557
+645
+-6834
+-7344
+-4382
+645
+6546
+2829
+-1314
+-9807
+-9233
+-4620
+646
+-3273
+8084
+3657
+2536
+-5464
+-5245
+113
+2949
+9372
+-9537
+-300
+9317
+-9585
+-843
+292
+4846
+2994
+-7217
+1279
+-6614
+-4799
+-5251
+7084
+8034
+236
+3080
+6329
+-6901
+5332
+-7547
+-1431
+-1958
+-7110
+-333
+-1903
+6316
+-4030
+1956
+-5255
+-3922
+4731
+-7837
+2995
+755
+-4301
+9182
+1843
+2181
+6948
+-5262
+103
+6121
+-9677
+4237
+-1831
+3831
+-6646
+2598
+-6395
+8784
+-925
+-3264
+5768
+5780
+-6171
+9607
+3250
+3794
+-9729
+-1212
+2004
+4033
+-6712
+1494
+3845
+-1253
+6180
+-7392
+-8960
+5704
+4033
+-7186
+-5025
+-2417
+2531
+-8818
+-6457
+-4533
+-5948
+-4464
+6349
+7490
+-2887
+2149
+-5998
+-6364
+1293
+-2574
+2002
+-1057
+9326
+-3076
+-6532
+-1021
+4083
+5726
+-225
+-7176
+-8239
+-424
+-2838
+-5583
+-6523
+-7176
+-6775
+2288
+-5325
+-6734
+4833
+-9788
+8523
+5768
+-8428
+1306
+8033
+453
+-3737
+-8444
+-6626
+8970
+-8232
+-6497
+-2169
+-1007
+7580
+-4094
+-2489
+-9874
+8135
+-6932
+-5048
+-295
+2385
+-7659
+5641
+-6664
+-7279
+8329
+-4666
+-2438
+-384
+-2999
+5691
+-4355
+-7524
+-8611
+1238
+889
+-9474
+-7744
+1765
+2167
+-3750
+-6323
+6105
+1260
+-4644
+7924
+-1720
+-1431
+2300
+-1665
+9033
+-2202
+2455
+6739
+-580
+-8679
+-4248
+2471
+8523
+-9658
+8263
+8502
+-2665
+9434
+6741
+9550
+4800
+9338
+1786
+-2033
+6685
+5397
+-8378
+-553
+-8838
+1354
+8955
+7194
+7579
+-4719
+4814
+552
+4692
+-9955
+-1786
+-1872
+-683
+8723
+1327
+-6322
+-2207
+-7282
+-5520
+-9964
+4407
+-2915
+-8435
+-8133
+-2708
+-3660
+-3436
+3302
+6964
+6110
+-3617
+-7998
+-228
+-5998
+-1484
+2531
+5116
+9297
+6338
+275
+6634
+-757
+8036
+843
+2133
+-179
+-5121
+7702
+-6927
+9173
+3686
+9962
+-4510
+-2364
+-6784
+840
+5927
+-1179
+-1585
+-4274
+-7929
+9616
+6470
+-9406
+-7266
+-9940
+-3273
+-8550
+182
+-3996
+8672
+1148
+-1503
+-7916
+-2354
+8437
+772
+-9702
+-7944
+9500
+9813
+9502
+5420
+9588
+2221
+-9081
+1822
+-7084
+-925
+9355
+6906
+171
+-9527
+-4814
+-2905
+4347
+774
+8605
+-252
+-7213
+-7596
+7699
+-2604
+-927
+528
+-5601
+-4432
+-5792
+6763
+-5996
+8529
+-4225
+6945
+4234
+-424
+-1409
+6881
+692
+-4238
+-6374
+1422
+-5029
+865
+9781
+-917
+176
+3552
+7743
+9931
+-5114
+4754
+8916
+-9674
+-8277
+-1394
+3320
+-3383
+2021
+-7024
+-6476
+-3517
+-2424
+4834
+-5450
+9395
+7520
+-559
+-7946
+5190
+8644
+-5473
+5549
+-524
+-9403
+-9614
+-9855
+-3381
+7672
+5284
+9883
+-2282
+-414
+2598
+2252
+8500
+8319
+1204
+8415
+314
+-8458
+4033
+-3130
+-4719
+-4212
+-5204
+2584
+34
+-5928
+4377
+2877
+1399
+6887
+-315
+9223
+2801
+7386
+-935
+-730
+2402
+6753
+8536
+7210
+2009
+-5401
+-8183
+5197
+-345
+3023
+-318
+-9356
+8068
+-3313
+242
+-5729
+5824
+-8538
+4110
+-6715
+-8904
+8445
+5109
+-8720
+2391
+-4096
+6634
+-2299
+8516
+3748
+-5019
+-7138
+9447
+6793
+-8051
+2362
+-7732
+3977
+-4610
+714
+-3845
+5183
+-297
+-6286
+1884
+-2143
+6841
+1745
+4166
+-5093
+2235
+-7640
+-3525
+2796
+9330
+3880
+-8863
+-9496
+-5284
+-4840
+-8276
+-2437
+8891
+-1786
+5040
+-7288
+9125
+7278
+7496
+-7279
+-7526
+9075
+2870
+-1369
+-3726
+-8760
+-4339
+-1977
+-7302
+-5341
+5945
+5876
+7845
+2138
+4591
+2314
+9150
+-5811
+9760
+-6656
+2785
+179
+5652
+7720
+-7411
+-341
+8907
+7278
+-9859
+2210
+8743
+-435
+-517
+6776
+6906
+-1612
+8274
diff --git a/2022/20-Grove-Positioning-System/package.json b/2022/20-Grove-Positioning-System/package.json
new file mode 100644
index 0000000..23be024
--- /dev/null
+++ b/2022/20-Grove-Positioning-System/package.json
@@ -0,0 +1,11 @@
+{
+ "type": "module",
+ "engines": {
+ "node": ">=18.10.0"
+ },
+ "dependencies": {
+ "eslint": "^8.30.0",
+ "eslint-plugin-node": "^11.1.0",
+ "jslint": "^0.12.1"
+ }
+}
diff --git a/2022/20-Grove-Positioning-System/second.js b/2022/20-Grove-Positioning-System/second.js
new file mode 100644
index 0000000..a01acc4
--- /dev/null
+++ b/2022/20-Grove-Positioning-System/second.js
@@ -0,0 +1,90 @@
+import * as fs from "fs";
+
+class File {
+ constructor(line) {
+ this.length = line.length;
+ this.data = line.map(v => ({value: v * 811589153})); // index in data
+ this.data[0].left = this.data[this.length-1];
+ this.data[0].right = this.data[1];
+ this.data[this.length-1].left = this.data[this.length-2];
+ this.data[this.length-1].right = this.data[0];
+ for (let i=1; i<this.length-1; ++i) {
+ this.data[i].left = this.data[i-1];
+ this.data[i].right = this.data[i+1];
+ }
+ this.data.forEach(v => { if (v.value === 0) this.head = v; });
+ }
+ get(i) {
+ let it = this.head;
+ for (let offset = i % this.length; offset > 0; --offset) {
+ it = it.right;
+ }
+ return it.value;
+ }
+ mix() {
+ this.data.forEach(v => {
+ if (v.value !== 0) {
+ let it = v;
+ let offset; // javascript and modulo... what a nightmare!
+ if (v.value > 0) offset = v.value % (this.length - 1);
+ if (v.value < 0) offset = ((v.value * -1) % (this.length - 1)) * -1;
+ if (offset !==0) {
+ v.right.left = v.left;
+ v.left.right = v.right;
+ if (offset < 0) {
+ for (; offset < 0; ++offset) {
+ it = it.left;
+ }
+ v.right = it;
+ v.left = it.left;
+ v.left.right = v;
+ v.right.left = v;
+ } else {
+ for (; offset > 0; --offset) {
+ it = it.right;
+ }
+ v.right = it.right;
+ v.left = it;
+ v.left.right = v;
+ v.right.left = v;
+ }
+ }
+ }
+ });
+ }
+ print() {
+ let it = this.head;
+ for (let offset = this.length; offset > 0; --offset) {
+ console.log(it.value);
+ it = it.right;
+ }
+ console.log("---");
+ }
+}
+
+function load(filename) {
+ return new File(
+ fs.readFileSync(filename, "utf8")
+ .trim()
+ .split("\n")
+ .map(line => parseInt(line))
+ );
+}
+
+let example = load("example");
+let input = load("input");
+
+function solve(input) {
+ for (let i=0; i<10; ++i) {
+ input.mix();
+ }
+ return input.get(1000) + input.get(2000) + input.get(3000);
+}
+
+const exampleOutput = solve(example);
+if (exampleOutput !== 1623178306) {
+ console.log("Example failed with " + exampleOutput);
+ process.exit(1); // eslint-disable-line
+}
+
+console.log(solve(input));