QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#504800#1353. Non-Decreasing Subarray GameToboTL 627ms6688kbC++202.3kb2024-08-04 16:05:262024-08-04 16:05:26

Judging History

你现在查看的是最新测评结果

  • [2024-08-04 16:05:26]
  • 评测
  • 测评结果:TL
  • 用时:627ms
  • 内存:6688kb
  • [2024-08-04 16:05:26]
  • 提交

answer

#include <bits/stdc++.h>
using i64 = long long;
using namespace std;

const int N = 5e5 + 5;
int n, q, a[N], b[N];
vector<int> pos;
vector<i64> sum;
i64 cal(int len) { return 1ll * len * (len + 1) / 2; }
i64 query(int l, int r)
{
    if (l > r)
        return 1e18;
    i64 ret = 0;
    if (r - l + 1 <= 20)
    {
        for (int i = l, pre = l - 1; i <= r; i++)
        {
            if (i != r && b[i])
                continue;
            ret += cal(i - pre);
            pre = i;
        }
        return ret;
    }
    auto it1 = lower_bound(pos.begin(), pos.end(), l);
    if (it1 == pos.end() || *it1 > r)
        return cal(r - l + 1);
    ret = cal(*it1 - l + 1);
    int disl = it1 - pos.begin();
    auto itr = upper_bound(pos.begin(), pos.end(), r);
    assert(itr != pos.begin());
    itr = prev(itr);
    int disr = itr - pos.begin();
    assert(disl <= disr);
    ret += sum[disr] - sum[disl];
    if (*itr < r)
        ret += cal(r - *itr);
    return ret;
}
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    cin >> n >> q;
    for (int i = 1; i <= n; i++)
        cin >> a[i];
    for (int i = 1; i < n; i++)
        if (a[i] <= a[i + 1])
            b[i] = 1;
    for (int i = 1, pre = 0; i <= n; i++)
    {
        if (b[i])
            continue;
        pos.push_back(i);
        sum.push_back(cal(i - pre));
        pre = i;
    }
    for (int j = 1; j < pos.size(); j++)
        sum[j] += sum[j - 1];

    while (q--)
    {
        int L, R;
        cin >> L >> R;
        if (L == R)
        {
            cout << 1 << '\n';
            continue;
        }
        int l = L, r = R, mid;
        while (l + 1 < r)
        {
            mid = l + r >> 1;
            i64 v = max(query(L, mid), query(mid, R));
            i64 v1 = max(query(L, mid + 1), query(mid + 1, R));
            if (v < v1)
                r = mid;
            else
                l = mid + 1;
        }
        // i64 ans = 1e9;
        // for (int i = L; i <= R; i++)
        //     ans = min(ans, max(query(L, i), query(i, R)));
        // cout << ans << '\n';
        cout << min(max(query(L, l), query(l, R)),
                    max(query(L, r), query(r, R)))
             << '\n';
    }
}
/*
 8 1
 7 10 3 1 9 5 5 2
 3 5
*/

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 5732kb

input:

8 5
7 10 3 1 9 5 5 2
1 5
2 2
5 8
1 8
3 5

output:

4
1
4
7
3

result:

ok 5 lines

Test #2:

score: 0
Accepted
time: 1ms
memory: 5560kb

input:

1 1
576560149
1 1

output:

1

result:

ok single line: '1'

Test #3:

score: 0
Accepted
time: 1ms
memory: 5672kb

input:

2 2
110051200 958819970
1 1
2 2

output:

1
1

result:

ok 2 lines

Test #4:

score: 0
Accepted
time: 0ms
memory: 3628kb

input:

3 3
378701035 815728296 448999007
1 1
1 3
2 3

output:

1
3
2

result:

ok 3 lines

Test #5:

score: 0
Accepted
time: 1ms
memory: 5600kb

input:

4 4
57416277 82702030 911566971 462119789
1 3
2 3
4 4
2 3

output:

3
3
1
3

result:

ok 4 lines

Test #6:

score: 0
Accepted
time: 1ms
memory: 5684kb

input:

5 5
31098816 644643061 79167639 202085627 809615007
4 5
1 2
1 5
2 2
1 5

output:

3
3
6
1
6

result:

ok 5 lines

Test #7:

score: 0
Accepted
time: 1ms
memory: 5752kb

input:

6 6
859557163 206584091 246768306 942051465 438562653 558694110
4 6
1 5
2 6
3 6
1 3
3 6

output:

3
4
6
4
3
4

result:

ok 6 lines

Test #8:

score: 0
Accepted
time: 1ms
memory: 5624kb

input:

7 7
833239702 768525121 269144782 536793111 217253404 155626880 247129100
4 7
4 7
1 3
6 6
4 4
4 4
5 7

output:

3
3
2
1
1
1
3

result:

ok 7 lines

Test #9:

score: 0
Accepted
time: 1ms
memory: 5656kb

input:

8 8
806922241 625433447 731712746 276758949 141168346 192751137 389024342 611402069
6 7
5 6
6 7
2 8
1 5
2 8
2 8
6 8

output:

3
3
3
7
4
7
7
3

result:

ok 8 lines

Test #10:

score: 0
Accepted
time: 1ms
memory: 5604kb

input:

9 9
780604779 892407181 604346118 16724787 770115992 789683907 235952288 431684896 850397988
4 8
3 9
1 4
1 2
7 8
6 8
4 9
7 8
5 7

output:

6
7
3
3
3
3
7
3
3

result:

ok 9 lines

Test #11:

score: 0
Accepted
time: 1ms
memory: 5624kb

input:

10 10
522312461 931001459 598654597 488228616 544064902 21923894 329635457 980089248 988262691 654502493
10 10
3 5
6 7
1 10
6 6
3 3
6 7
2 2
4 9
1 9

output:

1
3
3
10
1
1
3
1
6
10

result:

ok 10 lines

Test #12:

score: 0
Accepted
time: 3ms
memory: 5700kb

input:

1000 1000
687868213 124118480 755230811 334720134 99990745 761164274 545865681 916984345 640550524 400879267 421486929 431743642 742450015 336444016 171906046 609862726 963730598 136563307 48635166 85386274 875354584 761179304 442959515 14564980 217530210 794401984 911319428 48314184 336469268 58098...

output:

105
6
397
106
201
9
82
174
286
694
285
557
532
52
126
131
335
131
238
197
394
338
260
623
700
10
141
579
11
156
191
3
301
320
806
249
11
308
540
38
589
98
238
419
723
166
402
100
120
103
533
591
166
93
237
293
341
245
306
527
326
228
7
61
307
461
148
735
286
23
331
353
204
162
392
597
506
762
490
44...

result:

ok 1000 lines

Test #13:

score: 0
Accepted
time: 3ms
memory: 5644kb

input:

1000 1000
865951637 697667324 54044069 360349612 79339998 450867243 275637664 965201037 861484680 683183449 800780072 488270681 385282810 511013554 244133265 687310643 657043728 141067761 217033184 379426323 22418333 381327081 663099728 236439363 944876771 519488000 624413649 333771749 360183580 473...

output:

46
39
579
265
599
103
277
409
380
311
59
222
126
180
220
103
338
326
115
528
392
145
250
378
10
451
106
253
169
86
248
317
314
108
173
166
554
205
55
157
149
498
129
540
220
309
672
178
89
398
7
62
191
280
96
156
135
167
219
159
321
93
359
131
184
566
91
306
652
1
175
722
288
446
2
178
573
418
133
1...

result:

ok 1000 lines

Test #14:

score: 0
Accepted
time: 0ms
memory: 5712kb

input:

1000 1000
44035061 566183464 647824623 385979089 353656548 290313316 150633839 308385025 82418835 965487632 329816320 104606233 177858708 535839987 761070884 764758560 85515643 295315319 90463906 523723267 169482081 1474859 32983045 753281042 967190628 389798208 337507870 59420801 383897893 36558772...

output:

95
80
499
214
76
217
535
671
215
211
78
175
262
575
347
348
145
57
365
22
90
307
401
215
394
156
72
36
243
85
319
231
430
259
298
643
463
133
453
475
65
598
702
217
383
286
435
397
442
122
322
49
456
27
507
222
134
2
351
155
125
432
278
70
160
12
113
93
43
105
12
37
71
84
29
36
229
645
331
549
276
3...

result:

ok 1000 lines

Test #15:

score: 0
Accepted
time: 3ms
memory: 5716kb

input:

1000 1000
222118485 994508117 386829368 411608567 187781609 834792092 585438526 651569013 303352991 247791814 4076759 161133273 115658798 710409524 688073911 547239181 368763365 299819773 258861924 962987508 166802726 181431149 548090555 975155426 989504485 260108417 345569387 639845662 262388013 55...

output:

156
50
143
718
282
335
425
347
45
380
718
79
12
30
603
457
134
181
37
277
160
378
415
354
90
51
33
311
250
509
146
561
49
258
512
130
361
495
130
555
472
447
288
8
43
586
217
536
66
93
19
115
154
597
331
189
363
325
167
174
667
729
241
13
179
131
160
463
574
372
605
39
177
219
556
382
478
133
631
32...

result:

ok 1000 lines

Test #16:

score: 0
Accepted
time: 3ms
memory: 5720kb

input:

1000 1000
105234613 863024257 685642626 287494941 167130863 819462357 755401998 994753001 84095658 530095996 383369903 627725720 758491592 735235957 350235722 769911291 797235280 454067332 132292646 257027557 313866474 801578926 63198064 637221297 716851046 540484033 58663608 220270523 286102325 445...

output:

119
72
124
481
52
22
465
166
493
423
447
196
390
220
348
26
231
238
758
62
113
336
436
712
385
621
264
152
169
353
224
661
290
6
44
25
3
436
654
552
396
203
193
168
486
636
151
147
363
194
37
341
69
594
552
429
701
517
433
531
722
462
609
164
410
365
472
373
372
121
117
740
182
90
538
650
310
65
164...

result:

ok 1000 lines

Test #17:

score: 0
Accepted
time: 3ms
memory: 5616kb

input:

1000 1000
988350741 141605806 424647372 313124418 1255925 363941134 485173981 42969693 305029814 812400178 57630343 684252760 696291683 909805495 277238749 847359208 785515706 753539082 300690664 106357206 460930223 421726704 578305573 859095680 444197607 265570049 771757829 945919576 459559742 3374...

output:

73
233
133
280
408
121
817
341
377
628
219
559
321
208
592
182
88
493
110
52
137
99
179
421
671
377
405
161
263
77
123
812
346
179
97
160
100
519
25
779
816
235
84
129
312
384
15
392
51
126
133
75
129
807
320
401
592
589
371
602
491
104
105
247
215
318
677
21
396
97
297
583
156
642
206
367
54
175
54...

result:

ok 1000 lines

Test #18:

score: 0
Accepted
time: 0ms
memory: 5648kb

input:

1000 1000
461401461 715154650 18427925 43786600 980605178 908419911 919978668 681120977 525963969 94704361 731890782 445812504 634091773 934631928 939400560 924807125 213987621 907786640 174121386 545621446 607993971 191617586 243156187 375937359 466511464 135880257 925043538 526344437 483274054 524...

output:

330
114
265
16
77
83
184
9
62
283
190
167
541
258
652
159
161
383
364
96
132
372
100
123
120
90
389
235
701
95
103
607
478
24
596
350
679
387
197
351
150
50
262
208
492
471
95
497
383
465
55
235
161
183
318
82
485
339
505
450
172
409
490
392
283
27
649
42
164
546
235
259
472
69
503
536
438
387
35
52...

result:

ok 1000 lines

Test #19:

score: 0
Accepted
time: 3ms
memory: 5708kb

input:

1000 1000
344517589 583670790 462465375 69416077 254921728 598122880 89942140 24304965 156963533 377008543 406151222 357115351 571891863 814234169 866403587 2255042 202268047 912291094 47552108 544694199 605314616 811765364 758263696 597811742 193858025 6190466 343170464 106769298 66796878 566764773...

output:

635
13
3
327
352
354
181
510
189
423
24
505
382
247
118
469
293
287
162
12
59
318
99
385
103
42
319
52
419
263
170
406
371
565
437
561
190
38
409
128
230
204
501
336
41
425
61
705
657
104
19
132
507
45
27
705
370
112
308
267
224
70
661
374
341
496
66
586
65
198
124
429
49
139
410
262
173
554
433
580...

result:

ok 1000 lines

Test #20:

score: 0
Accepted
time: 3ms
memory: 5624kb

input:

1000 1000
522601013 157219635 761278633 800078259 89046789 142601656 524746827 367488953 377897688 659312725 80411661 118675095 509691953 839060602 528565398 79702959 485515769 66538653 215950126 983958440 752378364 136945845 273371205 114653422 361396074 436309186 351231981 832418351 385478487 4590...

output:

77
289
349
94
434
472
546
75
439
112
107
103
138
224
614
71
58
669
342
130
176
114
98
60
219
82
564
17
15
266
600
347
136
446
445
290
341
551
258
361
275
619
614
308
370
320
388
232
224
629
91
311
138
401
237
67
313
211
154
76
390
606
88
15
695
224
113
480
450
711
560
180
460
395
355
278
167
222
42
...

result:

ok 1000 lines

Test #21:

score: 0
Accepted
time: 3ms
memory: 5724kb

input:

1000 1000
936360140 593478713 711390561 943416101 366211223 428714264 737784819 739628605 822811907 538140427 290411189 265088954 850034661 112685298 629296439 785772485 849018406 189995231 908012381 598905084 200811077 66477209 309461470 814519022 690850002 3051034 625045191 213418144 596348660 165...

output:

38
183
426
221
44
473
385
85
292
191
154
260
524
184
517
353
79
11
137
477
106
145
435
180
369
78
253
276
370
341
482
50
471
740
188
449
365
195
44
122
166
191
461
47
371
406
388
289
253
54
38
379
78
453
262
123
152
67
232
153
482
137
52
521
264
127
471
544
325
245
394
539
536
194
6
126
30
362
307
3...

result:

ok 1000 lines

Test #22:

score: 0
Accepted
time: 594ms
memory: 6388kb

input:

100000 100000
304863256 602102863 428581297 635961043 517042686 930742857 511459974 548233271 310676710 438997140 406491162 16443055 641114107 416028240 193442056 675851036 34331752 381769277 52514351 312369730 193008608 737428803 393525554 285495112 47849751 961938154 412787449 129068602 717850694 ...

output:

11439
52111
28256
10324
792
49497
64337
14311
22597
3524
38945
10904
32975
40444
40328
8072
6538
28697
36025
72055
9460
46726
35596
46507
38311
913
16019
24799
23115
26814
954
34367
41540
28302
6771
15385
3324
3285
18741
69056
9880
17808
10173
27849
7862
13605
10237
6447
60761
32857
51097
40121
3883...

result:

ok 100000 lines

Test #23:

score: 0
Accepted
time: 587ms
memory: 6300kb

input:

100000 100000
482946680 880684411 22361850 511847416 351167748 770188930 536199253 596449963 941676274 426334027 785784305 72970095 578914197 440854673 415412379 458331657 22612179 976208323 71169265 751633970 485296548 357576580 908633064 947560983 70163608 832248363 420848966 414526167 596340814 7...

output:

28115
71152
26794
7238
4384
14720
31579
68641
77383
21233
76693
20737
71103
7944
10399
57700
5885
13910
5398
7964
45847
36600
16604
28703
40280
14696
17347
31740
45080
50982
6236
17173
62157
34495
29451
39561
56029
43888
5844
55616
29075
7783
11049
51548
4208
8839
64244
24250
9750
14249
31809
70914
...

result:

ok 100000 lines

Test #24:

score: 0
Accepted
time: 593ms
memory: 6284kb

input:

100000 100000
366062808 603976360 616142404 537476894 330517001 164924602 116228132 234601247 162610429 3605505 460044745 834529839 516714287 320456914 782606894 681003766 451084093 835488586 239567283 45674019 632360297 977724358 423740573 169435366 797510169 407591275 133943187 435142516 325087831...

output:

12667
22481
10152
30392
45018
20820
44403
3870
18273
32625
7709
2395
9975
52602
45677
48130
14166
27281
61907
9024
21736
54615
25750
29921
6780
15988
39392
2408
39839
38071
52019
17089
38397
74583
23999
71053
30094
22301
28377
13892
10444
40873
24847
40020
49376
20217
32368
40277
44706
5984
22830
30...

result:

ok 100000 lines

Test #25:

score: 0
Accepted
time: 591ms
memory: 6256kb

input:

100000 100000
544146233 177525204 60179854 268139075 309866255 709403379 846000116 282817939 383544585 285909687 839337889 745832686 454514377 345283347 4577217 758451683 734331815 134960336 112998005 189970964 779424045 597872136 88591186 391309749 819824026 132677291 847037408 15567377 498545247 7...

output:

52904
10904
2646
17054
78190
7702
23166
34708
16839
20243
13555
32988
34716
13103
15762
36768
13620
44915
15510
67791
24218
81652
31354
11927
19256
25679
12639
51551
66681
62306
46712
34568
24850
39996
9352
3373
60875
18152
42090
18316
36306
68060
2877
32551
32645
5341
57230
55784
1215
10787
43958
1...

result:

ok 100000 lines

Test #26:

score: 0
Accepted
time: 587ms
memory: 6168kb

input:

100000 100000
722229657 46041344 358993111 293768553 143991316 548849452 575772099 920969223 164287252 273246573 808565624 507392430 392314468 519852885 226547540 835899600 867836434 994240598 986428727 484011013 631520498 777828426 603698695 908151428 842137883 2987499 855098926 301024942 522259559...

output:

12059
37730
41110
49876
52758
43675
33206
27378
14087
37710
73726
22379
59471
28260
50982
58390
15227
52298
11842
53868
5973
14124
36683
15107
68471
4885
34760
14694
7838
58459
20794
57410
4107
1716
6012
21490
29060
58643
19613
54072
18084
35150
67543
26693
73192
6046
10595
10895
36054
48288
4092
43...

result:

ok 100000 lines

Test #27:

score: 0
Accepted
time: 592ms
memory: 6272kb

input:

100000 100000
900313081 619590189 97997857 169654927 418307866 238552421 450768274 264153211 385221408 850518052 482826064 268952174 889923070 839646614 593742055 913347518 856116860 293712348 154826745 628307957 923808438 692943499 118806205 275250004 569484444 873297708 568193147 26673995 84094116...

output:

28855
36460
12959
16423
19718
8142
14888
3591
40651
4672
17462
8069
56343
25342
27552
1460
42188
18161
30356
4847
8427
3918
71583
34740
43469
8710
29104
14333
34881
3181
14082
35486
59712
34568
79250
2651
34160
7318
31020
12819
36880
76500
53702
7180
57833
47578
15291
1196
41430
65078
43158
3705
170...

result:

ok 100000 lines

Test #28:

score: 0
Accepted
time: 592ms
memory: 6240kb

input:

100000 100000
783429209 898171737 691778411 490251700 397657119 783031198 180540258 312369903 606155563 132822234 862119207 30511917 827723160 719248855 110679674 990795435 284588775 152992610 28257467 67572198 70872187 313091277 633913714 792091683 296831005 303416428 576254664 902066152 424463992 ...

output:

49000
12167
6466
4374
71375
29979
52849
891
18410
28267
46005
10107
32896
43824
56464
79151
41361
2737
29747
26651
67453
6204
47764
32003
44387
35879
2009
5140
40982
43963
45665
69743
80520
69194
8874
29414
46433
5118
39540
28622
23015
2955
60714
65607
26086
15348
11598
16632
30041
11261
23443
36369...

result:

ok 100000 lines

Test #29:

score: 0
Accepted
time: 583ms
memory: 4656kb

input:

100000 100000
256479929 766687878 430783156 515881178 231782181 622477270 55536433 950521187 532122423 120159120 536379647 941814765 765523251 39042584 182906893 918500248 567836497 452464361 196655486 771677655 217935935 788014863 708829735 13966066 319144862 173726636 289348885 187523717 448178304...

output:

4110
25182
13940
57631
60028
52193
51466
27898
36682
3610
16522
20426
33705
76579
22335
22291
12826
11959
46652
27889
20946
74272
53596
80135
39354
8246
24822
31667
47571
40828
68942
68060
19977
11926
31669
59965
154
45847
75153
15907
23977
589
39845
10974
14561
16858
58522
62686
12316
33841
62525
1...

result:

ok 100000 lines

Test #30:

score: 0
Accepted
time: 594ms
memory: 4640kb

input:

100000 100000
139596057 195012530 729596414 246543360 211131434 312180239 785308416 998737879 753056578 697430598 770448599 703374509 408356045 918644826 699844512 995948165 996308412 311744623 70086208 210941896 215256580 408162640 223937245 530807745 341458719 749069548 852700002 913172770 6216357...

output:

12769
13413
12457
75842
26339
8810
41201
23892
50684
49146
70600
22789
57985
5465
4099
34626
21014
47158
7035
49506
25496
76357
10096
20765
15129
18872
2578
60653
46028
16289
22450
61372
878
1973
59542
30124
80360
20480
26276
46334
43280
15219
25772
2299
38663
8826
1771
14612
10541
5737
14881
23292
...

result:

ok 100000 lines

Test #31:

score: 0
Accepted
time: 594ms
memory: 6168kb

input:

100000 100000
453613202 706214678 461545343 205753910 478034297 541896330 497324175 869145117 561225650 566055090 12141992 280003539 689371974 782337066 96866014 482633230 559033077 943787360 43663417 744565400 531990193 231799066 467687990 868746446 658126369 319370479 174657093 436759073 435777823...

output:

25728
19008
38815
65701
16860
7093
30681
18057
37871
5897
15500
10011
79633
65903
29177
14943
5720
13778
31130
53033
50391
50025
41492
67946
48587
10357
14319
7543
5027
42338
31906
29682
23832
4206
36953
43456
37403
12110
28650
19515
8719
28535
45774
46846
45877
49056
44868
14844
15914
57643
51902
1...

result:

ok 100000 lines

Test #32:

score: 0
Accepted
time: 583ms
memory: 6392kb

input:

100000 100000
631696626 429506626 55325896 936416092 457383551 381342403 522063455 917361809 782159805 553391976 391435136 336530579 332204769 661939307 464060529 560081147 842280800 98034919 212061435 183829641 384086646 706722652 982795499 90620829 680440226 44456495 887751314 162408126 314267944 ...

output:

77018
55337
9320
28881
1339
13295
7268
8853
9657
1958
16879
20569
23741
31591
21492
34943
34421
64883
21434
31849
32120
3744
64124
1733
53916
31436
77499
7885
53883
25400
31147
6099
26584
20131
15509
10458
32224
37409
42048
50055
18049
3506
38848
5102
14153
60494
5698
6010
10701
11460
53203
20568
37...

result:

ok 100000 lines

Test #33:

score: 0
Accepted
time: 593ms
memory: 6304kb

input:

100000 100000
514812754 708088175 794330642 962045570 436732804 925821180 251835438 555513093 708126665 130663454 360662872 98090323 270004859 981733036 686030852 782753256 680818122 102539373 380459453 328126585 676374586 326870430 497903008 607462508 407786787 914766703 600845535 447865691 6329495...

output:

36190
6688
7815
11403
81110
49116
38958
14978
21408
63088
39429
6771
20529
35699
16022
35746
22848
7619
19064
55158
34674
14357
30463
56787
5874
27439
9708
701
59022
26803
28605
23162
17701
43402
10221
13683
27097
20101
17721
1782
56849
66585
31744
19960
26387
34770
1880
11835
3543
1997
35383
45971
...

result:

ok 100000 lines

Test #34:

score: 0
Accepted
time: 589ms
memory: 6260kb

input:

100000 100000
692896178 576604315 388111195 692707751 565825162 320556852 831864317 603729785 634093524 412967637 739956015 714425874 207804949 861335277 908001175 860201174 964065845 961819635 958922879 622166634 823438335 947018207 572819030 974561083 430100644 490109615 313939757 28290552 2164723...

output:

15927
23134
945
14677
10713
58866
29134
40151
15503
10201
17220
53626
45290
38710
12022
517
1365
5917
48507
8902
44599
81782
12124
46576
7831
72450
11039
18825
99
51236
6244
9633
25496
19385
25647
37870
64137
25308
3182
18133
38565
6423
45784
44097
1990
18920
27901
21051
40061
14888
33749
71159
4615...

result:

ok 100000 lines

Test #35:

score: 0
Accepted
time: 588ms
memory: 6276kb

input:

100000 100000
870979602 150153159 832148645 718337229 545174415 160002925 856603597 241881069 855027680 400304523 414216455 475985618 850637743 886161711 275195690 642681795 392537759 556258681 127320897 766463579 970502083 126974497 87926539 491402763 302671397 920228336 322001274 48906901 24018668...

output:

60934
53723
30428
22138
50874
43758
19318
23737
25801
42743
12516
26215
70009
30852
38653
28335
30540
1446
29885
7833
67065
5694
10515
19560
55439
16259
5099
17759
6303
47289
32166
61297
46253
53851
12901
44965
80863
5593
18380
4749
49496
9433
19059
38098
22560
16394
4083
40366
2337
52407
80941
3105...

result:

ok 100000 lines

Test #36:

score: 0
Accepted
time: 587ms
memory: 6388kb

input:

100000 100000
49063026 723702004 425929199 594223603 524523669 704481702 436632476 290097761 75961835 977576001 88476894 532512658 788437834 910988144 497166013 720129712 675785481 415538944 295718915 205727820 822598536 747122275 898001344 713277146 324985254 790538544 35095495 334364466 413644105 ...

output:

45437
41644
63207
10855
22772
16833
9420
30041
1059
46792
13980
45255
1649
2124
17535
515
49062
12068
18287
14150
564
8464
23062
29673
62586
2460
79791
38980
5221
34628
76834
6320
26238
48288
29728
29889
190
6896
41247
49454
30949
13460
60173
4173
67303
73959
7870
5562
28651
62186
43904
56297
68268
...

result:

ok 100000 lines

Test #37:

score: 0
Accepted
time: 593ms
memory: 6296kb

input:

100000 100000
932179154 592218144 869966648 619853080 63681435 689151967 166404459 633281749 1928695 259880184 467770038 294072401 726237924 85557681 864360528 797577629 104257396 715010694 169149637 204800573 114886476 367270053 413108854 230118825 52331815 660848752 748189716 914789327 142391121 6...

output:

183
28161
3653
34927
75460
1707
27556
1140
58287
6318
8169
68417
1710
18870
12509
282
66506
81368
64970
13002
54928
67702
20347
2635
36269
24693
20410
9378
11529
27242
50617
20918
52569
14744
51176
4853
5345
54870
50588
13029
49138
8408
15936
9013
64388
57135
18144
23300
42759
7244
24486
44098
10754...

result:

ok 100000 lines

Test #38:

score: 0
Accepted
time: 599ms
memory: 6292kb

input:

100000 100000
110262578 725575501 168779906 940449854 43030688 233630744 896176443 271433033 222862850 247217070 996806286 205375249 223846526 110384114 86330851 20249738 797570526 574290956 337547656 349097517 261950225 282385126 782992171 597217400 74645672 90967472 756251233 935405676 315848538 5...

output:

41142
18869
33173
15400
34646
23633
17723
24774
31385
31092
9553
65728
13899
35364
2022
28663
48211
74889
51593
36962
12803
348
63704
16989
19717
19486
26251
55450
38420
62111
73331
14824
20039
19511
8718
28924
54593
9401
21003
54467
51064
26160
66729
14755
23580
31345
21123
16829
895
27448
15485
68...

result:

ok 100000 lines

Test #39:

score: 0
Accepted
time: 595ms
memory: 6288kb

input:

100000 100000
288346002 299124345 762560460 671112035 172123046 778109520 771172618 319649725 443797006 824488548 376099429 671967697 456613912 284953651 453525366 97697655 80818249 728538514 916011082 643137566 409013973 757308712 298099680 114059079 96959529 961277681 469345454 220863241 339562850...

output:

61376
67647
23140
12205
56531
45703
15024
27631
23668
29994
67670
35341
40503
4333
231
36708
48927
31806
5034
9888
12688
38558
37475
14420
16086
7756
24960
29285
37253
430
75554
12236
62826
54114
54001
3253
49639
35935
43750
10023
4250
59383
5306
29844
37832
22497
25013
49897
51778
10642
4926
28836
...

result:

ok 100000 lines

Test #40:

score: 0
Accepted
time: 594ms
memory: 6380kb

input:

100000 100000
466429426 167640485 501565205 841965705 151472299 762779785 205977305 662833713 664731161 106792730 345327165 728494736 394414003 309780085 675495689 175145572 509290163 733042969 229633292 787434511 406334618 82489194 813207190 40966167 824306090 831587889 182439676 801288102 36327716...

output:

41562
34858
21729
8892
25860
60309
2129
6473
50298
43712
19817
4248
65382
19566
7358
35925
8326
45224
13450
54191
2921
20479
25914
33919
71662
8369
54974
7486
6493
68630
73585
25718
21162
30842
48473
79
23718
69817
58905
6414
14526
863
43835
24005
13372
9813
1009
9876
67344
21960
3383
32129
60330
27...

result:

ok 100000 lines

Test #41:

score: 0
Accepted
time: 579ms
memory: 6268kb

input:

100000 100000
249212317 694606864 185108561 774866079 567824178 594350323 764223242 51276661 737354491 242534208 996972995 13386504 741732673 223330871 661126712 748251736 26558033 445027512 570244710 36489290 613821693 795664331 100946706 621531173 378343193 114696984 215851074 314216983 419489278 ...

output:

29139
27746
6526
57091
4002
9931
1078
7666
38909
74729
11721
48725
77490
53423
26090
16012
60002
47659
32171
34324
2778
49195
55413
55928
21293
13799
31923
55723
403
45204
21315
19509
20179
6345
33690
6929
18436
21394
39183
28586
6338
4600
50855
23194
37793
3683
5112
40278
46080
30607
15563
17624
75...

result:

ok 100000 lines

Test #42:

score: 0
Accepted
time: 593ms
memory: 6308kb

input:

100000 100000
427295741 268155708 924113306 800495556 106981944 138829099 493995225 99493353 958288647 229871094 376266139 69913543 679532764 248157304 883097035 825699653 455029948 744499262 443675432 475753531 760885441 270587916 321086919 843405557 400657050 839783001 928945295 599674548 44320359...

output:

12294
41471
35958
61503
57156
8763
8722
31218
8633
35757
10499
58164
31699
8675
3856
40882
3100
30981
29640
50317
15466
30802
12728
17670
66293
78211
2246
31336
27233
144
4738
4770
30108
11110
8698
10944
13192
40934
3428
69644
32616
355
19223
67502
20574
42896
30811
161
3717
19336
31491
1430
73108
1...

result:

ok 100000 lines

Test #43:

score: 0
Accepted
time: 609ms
memory: 6304kb

input:

100000 100000
310411869 696480361 517893860 531157738 86331197 828532068 74024105 737644637 884255506 807142573 905302387 831473287 177141366 127759545 105067358 753404466 738277670 603779525 612073450 915017771 758206086 890735694 131161724 360247236 422970907 710093209 82231004 475066705 616661006...

output:

25195
32557
69273
4677
15939
13139
9311
23681
35481
25147
40177
45858
7081
12762
54592
73876
18302
23840
37640
57217
73011
16815
7310
41181
40555
30730
906
17793
26357
3290
18145
46959
14059
40294
43744
13117
8152
4244
46084
11587
6750
5318
36620
44781
24306
10579
27351
66908
38705
21729
27891
16295...

result:

ok 100000 lines

Test #44:

score: 0
Accepted
time: 591ms
memory: 6324kb

input:

100000 100000
488495293 564996501 961931310 702011408 920456259 667978141 98763384 785861329 810222366 89446755 874530122 888000327 114941456 447553274 472261873 830852383 726558097 903251275 485504172 914090524 905269834 215916176 501045042 582121619 150317468 285436121 795325225 905748462 34540802...

output:

40448
41609
18833
7454
40449
1872
28511
38
33917
321
14569
15282
75374
33352
19175
37403
38855
48516
47145
389
26512
34703
22545
62641
42309
61468
467
18833
32446
27441
37596
8177
49323
7258
26715
46021
17840
49450
4689
1760
25001
47379
42259
29771
262
21618
39939
1339
12331
12176
12128
61931
18708
...

result:

ok 100000 lines

Test #45:

score: 0
Accepted
time: 589ms
memory: 6208kb

input:

100000 100000
666578717 138545345 260744567 432673589 194772808 212456918 973759559 424012613 31156521 76783641 253823266 209368582 52741546 327155516 694232196 908300300 155030011 57498833 358934894 58387469 52333583 690839762 16152551 98963298 172631325 860779033 508419446 486173323 223898143 7343...

output:

21029
6910
10662
10621
28091
49824
3131
54945
54831
24406
50144
12815
43440
35958
20937
70041
10243
35186
36231
22151
686
32179
45128
33643
16283
75796
5530
65765
38723
51800
14920
6431
36044
6510
16783
23104
71828
56074
65978
14574
34483
8000
56191
34006
45538
32014
42118
13227
50832
32450
1573
285...

result:

ok 100000 lines

Test #46:

score: 0
Accepted
time: 586ms
memory: 6304kb

input:

100000 100000
844662141 417126894 854525121 458303067 174122062 197127183 408564247 767196601 252090676 654055120 928083705 265895622 695574341 646949245 61426711 985748217 143310438 62003287 527332913 202684414 344621523 605954835 531260060 466061874 194945182 585865050 516480964 66598184 542579751...

output:

41193
18479
38198
26083
63008
13873
20350
3168
57720
8544
37214
3046
39167
12020
14224
9309
9641
49711
54678
62450
38725
22135
18865
23477
18333
44533
4131
56723
37543
18846
45046
307
42593
53604
16647
19705
8918
10775
6344
6043
73350
20110
49051
9035
15785
135
10168
32513
35283
50888
50350
54155
68...

result:

ok 100000 lines

Test #47:

score: 0
Accepted
time: 592ms
memory: 6340kb

input:

100000 100000
727778269 285643034 298562571 188965249 8247123 741605960 433303526 815413293 178057536 936359302 307376849 27455366 633374431 526551486 578364330 63196134 571782352 216250845 695730931 496724462 491685272 226102613 46367570 982903553 217259039 456175258 229575185 792247236 421069872 3...

output:

3718
2057
41626
34976
10308
35935
2092
314
19514
41598
19068
30343
29185
34269
15699
19489
19126
56940
40748
24304
44514
40209
34104
35427
35912
49406
2789
48658
79254
35022
11761
5906
56089
19213
1287
81681
24234
55440
48970
19537
26693
39965
15585
24973
59149
39671
29005
14869
15514
6100
25231
718...

result:

ok 100000 lines

Test #48:

score: 0
Accepted
time: 590ms
memory: 6368kb

input:

100000 100000
200828989 859191878 892343124 359818918 987596377 286084736 13332405 453564577 398991691 923696188 981637289 83982405 866141817 846345215 650591549 285868244 855030075 220755300 569161653 641021407 343781725 701026199 711218183 204777936 649638304 31518170 647702110 372672097 444784184...

output:

20630
35189
7381
10768
34828
57864
12029
34493
53564
44878
17660
29984
74176
35086
19641
30041
38198
5272
15003
39654
30319
30328
56837
45467
5905
30232
8743
8851
52132
59368
44050
40224
16378
43571
79285
283
35798
14868
33721
23843
7972
58273
1708
66231
2260
14123
25614
10323
26817
10741
6131
18650...

result:

ok 100000 lines

Test #49:

score: 0
Accepted
time: 586ms
memory: 6300kb

input:

100000 100000
83945117 582483827 631347870 90481100 966945630 125530809 743104389 501781269 619925847 500967666 655897728 700317957 508974611 430980161 167529168 68348865 283501989 375002858 737559671 80285648 636069665 26206680 226325692 721619615 671952161 756604186 655763627 953096958 468498497 4...

output:

28419
41607
22118
1397
1505
14777
6218
10828
52212
7871
53031
2668
44726
18470
38320
26836
69065
2092
61113
19172
52932
20186
34668
2232
25743
32356
7413
66230
4530
39415
64727
76634
30924
27527
29545
61300
30547
25627
11079
48651
59557
55863
8612
6818
35587
46072
27589
19015
44860
20183
48464
58675...

result:

ok 100000 lines

Test #50:

score: 0
Accepted
time: 592ms
memory: 6368kb

input:

100000 100000
262028541 156032671 225128424 411077873 96037988 520266482 618100564 990189449 545892706 783271849 35190872 461877700 301550510 750773890 534723683 145796782 976815120 234283120 316023097 79358401 783133414 646354458 446465905 943493998 694266018 626914395 368857848 678746011 641955913...

output:

12490
25186
62467
41831
11084
44069
24445
45067
13865
25056
34339
42318
19961
35273
4265
2045
46040
11628
30948
16801
13555
17480
19420
35958
13103
38820
6061
11119
59763
43435
47314
5366
17564
4373
61848
57495
4630
45493
11495
20877
7550
25117
33404
8059
9728
7472
38902
21014
18882
49091
18279
5234...

result:

ok 100000 lines

Test #51:

score: 0
Accepted
time: 593ms
memory: 6172kb

input:

100000 100000
44811431 682999050 53895971 343978247 922455275 646804315 736155013 378632396 913483333 64237519 836579806 746769468 943836476 664324676 80163217 423935650 789050286 91491856 656634515 768604668 695653192 214305403 734205422 524059005 543270416 910023490 697236542 46450700 548424924 61...

output:

25383
53775
51864
52382
4114
3728
452
2723
38658
64845
32415
48212
19100
18434
5253
3875
11653
11891
8266
42377
7793
9551
53785
34718
41447
5277
28575
16315
4216
19872
68447
11694
48691
20278
9326
35635
602
2971
12552
55774
36554
57011
33331
49032
14840
41737
62821
26069
39162
10911
37232
47267
1322...

result:

ok 100000 lines

Test #52:

score: 0
Accepted
time: 594ms
memory: 6216kb

input:

100000 100000
222894855 256547894 647676525 219864621 51547632 191283092 906118484 426849088 134417488 641508997 510840246 508329211 586669271 689151109 742325028 501383567 217522200 950772118 825032533 472710125 987941133 834453181 249312931 745933388 270616977 780333698 410330763 626875561 4269150...

output:

66303
42126
4472
24856
36607
32223
75579
27858
20410
45863
23862
10413
5696
13768
35036
23911
17171
2735
17874
13224
80630
6823
19240
35797
42500
18078
22517
20459
59726
4292
42409
54340
23790
42546
81916
11525
5722
16893
55864
11294
47515
3069
40242
31198
2402
2235
56420
47913
4151
48510
10780
2657...

result:

ok 100000 lines

Test #53:

score: 0
Accepted
time: 593ms
memory: 6256kb

input:

100000 100000
106010983 830096738 946489782 540461394 30896886 175953357 340923171 65000372 765417051 628845883 890133390 564856251 524469361 863720646 669328055 724055676 205802627 545211164 698463255 911974365 135004881 454600958 764420440 407999260 292930834 505419715 123424985 57557318 745596653...

output:

21347
6606
25019
28075
16176
17632
41030
16507
6257
12794
22464
35908
34598
2742
78722
25771
68252
10008
532
8664
4489
17500
13920
45885
10827
69479
23902
77777
19917
452
78418
7930
10288
19211
8552
43621
10815
28558
13344
5075
56886
38919
1655
17931
26804
35166
40670
12854
8516
37270
49389
6225
256...

result:

ok 100000 lines

Test #54:

score: 0
Accepted
time: 593ms
memory: 6364kb

input:

100000 100000
579061704 258421391 390527232 271123576 865021947 720432134 215919347 113217064 986351207 911150065 564393829 326415995 462269451 888547079 186265674 801503593 634274541 404491426 571893977 911047118 282068630 74748736 279527950 629873643 315244691 80762627 836519206 637982179 62408677...

output:

44420
67695
26458
66502
61436
4291
30197
10342
32951
48344
27998
5430
9883
8734
1588
3110
39473
24691
47033
37887
6987
13184
15539
1861
8954
30171
25375
447
64890
24603
67426
62930
45743
4012
6764
17474
36817
19293
43247
29047
67808
6817
5320
69912
62640
23770
14770
25567
63178
17060
18648
60438
185...

result:

ok 100000 lines

Test #55:

score: 0
Accepted
time: 591ms
memory: 6324kb

input:

100000 100000
462177832 831970235 984307786 296753054 844371201 559878207 240658626 751368348 207285362 488421544 943686973 87975738 959878053 63116617 258492893 878951510 622554968 703963177 740291996 350311359 279389275 549672322 944378563 146715322 747623956 656105539 549613427 513374336 64780108...

output:

3587
9165
1813
24357
1610
17383
45959
13353
1924
62532
29369
2981
7696
13044
31509
18527
27119
17005
48515
54418
39405
23216
55021
8209
6906
27525
40092
29814
5950
11861
69448
20276
32230
27320
1456
34271
4904
31723
676
12618
28375
11816
15835
1059
47780
8471
18521
13688
20737
1552
37853
519
16876
7...

result:

ok 100000 lines

Test #56:

score: 0
Accepted
time: 590ms
memory: 6304kb

input:

100000 100000
640261256 700486375 723312531 172639427 823720455 954613879 820687505 94552336 133252222 475758430 767690516 704311290 897678144 792975754 775430512 661432131 905802690 563243439 613722718 789575600 426453023 169820100 459486072 368589705 769937813 381191555 262707648 944056093 5262912...

output:

44742
57597
368
21295
15554
9570
15105
13531
57157
29353
26884
30235
32383
61384
16939
10422
54374
55373
58147
32526
19393
22984
60386
67010
24797
44526
41334
47480
4869
7964
6299
31284
46229
63346
40923
9402
10051
13589
15964
31768
9624
16846
8847
62943
7173
37838
28159
54320
50802
43228
851
40637
...

result:

ok 100000 lines

Test #57:

score: 0
Accepted
time: 591ms
memory: 6304kb

input:

100000 100000
523377384 274035220 22125789 198268905 952812812 499092656 550459489 142769028 354186377 758062612 441950956 760838330 130445530 967545291 847657731 738880048 334274604 862715189 782120736 788648352 573516772 789967877 974593581 885431384 792251670 251501764 270769165 524480954 5500055...

output:

57590
16500
8320
1938
10307
12299
54403
68040
18570
3599
4666
16713
28583
7915
46883
18608
2263
23306
32487
26424
58996
20292
17138
19399
26866
10647
13369
10828
25997
2522
77598
81528
26240
73898
32453
15525
36173
51891
47429
9575
11764
36031
59848
17036
33612
5729
54261
38523
66573
23142
18698
124...

result:

ok 100000 lines

Test #58:

score: 0
Accepted
time: 590ms
memory: 6332kb

input:

100000 100000
996428104 847584064 761130535 928931087 932162066 338538729 280231472 780920312 575120533 40366794 821244100 522398073 773278324 992371724 364595350 961552157 322555031 721995451 655551458 227912593 720580520 969924167 194733795 252529960 814565527 121811972 983863386 104905815 5737198...

output:

73105
53576
30437
30930
34825
30701
23497
70552
3704
7000
24878
46984
31927
12154
11587
39940
2812
57291
43721
58339
24434
54672
5405
78089
36249
61515
19246
18426
1007
1369
54466
9005
33330
24217
1170
56349
44681
46500
52784
22861
22673
17740
80667
16950
27920
38577
7453
27707
3311
11822
20316
2748...

result:

ok 100000 lines

Test #59:

score: 0
Accepted
time: 594ms
memory: 6300kb

input:

100000 100000
879544232 421132908 354911088 954560564 911511319 28241698 155227647 829137004 501087392 322670977 495504539 578925113 711078414 166941262 436822570 39000074 751026945 21467202 823949476 372209538 717901165 590071945 564617112 474404343 541912088 551930692 696957608 830554868 452209951...

output:

52970
15678
18338
13391
63366
19095
23330
21174
62715
39853
26294
49408
13605
69320
13256
11008
31567
49898
4463
21194
42823
264
20707
2447
4710
6370
17899
30585
64793
70183
26040
15181
27031
55039
6522
4665
9211
26626
27477
666
31844
1873
48757
6866
12484
856
39080
17842
10850
36363
26863
55042
115...

result:

ok 100000 lines

Test #60:

score: 0
Accepted
time: 587ms
memory: 4640kb

input:

100000 100000
57627656 849457561 653724346 685222746 745636381 867687771 590032335 172320992 722021548 604975159 874797683 900293369 648878505 191767695 953760189 116447991 34274668 880747464 697380198 666249587 864964913 210219723 374691917 991246022 709450137 422240900 705019125 410979729 77089155...

output:

15861
6492
11064
55395
46874
13085
24469
18432
12760
13010
58019
5859
47494
29925
42729
25230
25647
43063
25873
50388
12242
67674
22492
3594
30828
35372
16670
63741
14653
18070
48873
42117
13731
35578
29670
65713
71661
7008
15191
68830
43087
27720
55905
35955
11882
52803
65272
6020
11872
47836
11709...

result:

ok 100000 lines

Test #61:

score: 0
Accepted
time: 594ms
memory: 6272kb

input:

100000 100000
135377842 671391235 777459189 58314608 867020964 404291012 148278272 560763939 89612174 885940829 676186617 625376624 850972983 105318481 939391211 689554155 256575242 592732007 37991616 765561262 512643476 778170667 662431434 571811029 118263048 317292 588687419 483717122 827103675 66...

output:

691
72482
11342
17467
34059
28946
6944
16694
48382
54958
26057
10350
67464
14865
5169
14811
8555
43369
21003
5039
6522
10408
19106
18520
30602
22628
18041
21551
29722
5362
48982
22329
52469
3833
22197
21740
21221
27323
42188
40090
21624
4811
49252
20939
19801
6089
48526
36457
11571
12083
6423
88
266...

result:

ok 100000 lines

Test #62:

score: 0
Accepted
time: 592ms
memory: 6264kb

input:

100000 100000
18493970 949972784 781305151 788976789 701146025 243737085 878050255 608980631 15579033 463212307 350447057 241712176 788773074 425112210 866394238 767002072 685047156 892203758 911422338 59601311 364739929 693285741 177538943 793685412 140576905 575660204 596748936 209366175 555850691...

output:

13490
2876
44986
56151
28651
22624
45820
17537
21476
2032
9498
49921
21763
1754
19537
34796
263
49325
11282
53753
60963
20352
61144
8227
29043
28722
12022
57961
34272
29517
5248
8460
20010
36618
37480
17603
54284
7481
49123
26588
74084
795
22713
65502
4613
10148
37272
38984
58834
28814
53469
24874
8...

result:

ok 100000 lines

Test #63:

score: 0
Accepted
time: 592ms
memory: 6192kb

input:

100000 100000
196577394 818488924 520309897 814606267 975462575 933440054 753046430 247131915 941545893 450549193 729740201 298239215 431605868 9747155 383331857 694706885 968294879 46451316 79820356 203898255 216836381 18466223 692646452 310527091 867923466 300746220 309843157 84758332 729308107 74...

output:

24126
12120
43585
41681
11791
13132
7860
42814
5225
50750
7950
1967
23845
67469
68009
5938
853
43714
19090
17900
14729
55498
2090
35219
31159
52082
72447
10395
33217
25612
31309
34652
30464
71195
53627
7034
26363
4950
33926
14836
6992
5745
56211
2002
29133
22671
5502
62973
36102
66410
13129
15146
46...

result:

ok 100000 lines

Test #64:

score: 0
Accepted
time: 595ms
memory: 6260kb

input:

100000 100000
374660818 392037768 114090450 280427233 954811828 772886126 482818413 295348607 162480048 732853376 404000640 59798959 369405958 329540885 750526372 772154802 396766793 50955770 953251079 643162496 509124322 493389809 207753961 532401475 890237323 876089133 22937378 370215897 753022420...

output:

65913
28680
13989
32026
69147
77356
33670
20879
25838
10409
64634
16364
74695
42314
24970
6796
28402
30547
691
19087
45352
12485
7605
2902
5048
45879
13510
18105
60434
50063
8436
45128
42061
30656
40346
17006
58385
33208
11470
56401
33315
10723
12236
11283
11517
69409
31459
81004
13503
30917
31137
2...

result:

ok 100000 lines

Test #65:

score: 0
Accepted
time: 595ms
memory: 6152kb

input:

100000 100000
257776946 820362421 853095196 11089414 788936890 317364903 62847293 933499891 88446908 310124854 78261080 116325999 307206048 209143126 972496695 849602720 680014516 205203328 971905993 642235249 656188070 113537586 577637279 899500050 912551179 451432045 30998895 95864949 71704028 382...

output:

20674
20124
15378
49558
7454
51528
44305
39939
64153
14493
43813
71724
37828
39585
23151
1335
451
16821
40027
73090
26887
63522
20365
4003
20389
3966
8715
46396
1307
19099
21661
38033
49231
3964
22753
70703
32308
7411
31923
25238
34017
36436
33293
8052
15078
20817
27628
17146
55612
27683
16250
18604...

result:

ok 100000 lines

Test #66:

score: 0
Accepted
time: 585ms
memory: 4680kb

input:

100000 100000
435860370 688878561 151908453 36718892 768286143 7067872 87586572 276683879 309381063 297461740 457554223 582918446 245006139 528936855 339691210 927050637 813519134 209707783 140304011 81499490 508284523 733685364 92744788 121374433 785121932 321742253 744093117 676289810 655226852 27...

output:

45051
10979
33543
48407
43817
52556
14417
22287
30245
18657
12504
41119
23203
1587
6690
27509
1062
61754
12591
13742
1436
60820
2193
14141
22254
34549
10066
9771
20581
33225
11649
23515
50045
19374
29727
8847
27258
19874
3316
16183
45078
37168
1734
13887
30132
2573
60395
64488
15900
72520
63485
4224...

result:

ok 100000 lines

Test #67:

score: 0
Accepted
time: 591ms
memory: 6364kb

input:

100000 100000
613943794 967460109 745689007 767381073 307443909 846513945 817358555 324900571 530315219 579765922 426781959 494221294 182806229 408539096 561661533 4498554 801799561 363955341 13734733 375539538 655348271 208608950 607852297 343248816 807435789 46828269 457187338 256714671 973908461 ...

output:

32328
5464
46674
2804
68659
48514
24497
28576
47396
6293
11136
38996
26722
5885
29447
36940
29833
10605
34089
50534
11278
6945
17538
41271
31970
21100
16747
8596
6364
65085
18834
28248
22492
50984
37942
15939
1256
18911
8864
155
33965
11553
40486
27042
31353
30577
21936
47078
39023
53021
4084
3562
1...

result:

ok 100000 lines

Test #68:

score: 0
Accepted
time: 595ms
memory: 6336kb

input:

100000 100000
792027218 835976250 484693753 793010551 581760458 390992722 397387435 963051855 456282078 157037401 806075103 255781038 975382127 728332826 928856048 227170663 230271475 368459795 182132751 519836483 947636212 533789431 122959807 860090495 534782350 917138478 465248855 982363724 852398...

output:

36894
72483
2658
14895
55740
54429
42818
52999
12150
30920
9615
29058
26386
17349
79900
20184
34689
17895
61632
21109
44201
40759
8853
23576
1791
6205
15466
54
33440
23955
13274
56455
48858
58363
25460
48084
3879
1591
34481
7597
44591
51393
33152
60945
50952
76764
10566
27165
24456
15144
13815
57258...

result:

ok 100000 lines

Test #69:

score: 0
Accepted
time: 594ms
memory: 6360kb

input:

100000 100000
675143346 409525094 783507010 668896925 561109712 375662986 422126714 11268547 677216234 144374287 335111350 312308077 618214921 607935067 150826371 9651284 513519198 522707353 55563473 664133428 94699960 153937209 492843124 81964879 557096207 492481390 178343076 267821289 581145597 54...

output:

56711
2974
58715
26885
5505
4331
15924
26196
21886
2014
15304
26364
43695
28764
44365
36608
21946
11712
21723
58284
25252
58614
14296
50290
55700
37700
58092
36566
11383
19918
15292
41721
23339
4248
54845
23807
27954
14015
8066
5748
25798
29507
5481
11644
10374
72306
49151
40723
46999
26354
22618
16...

result:

ok 100000 lines

Test #70:

score: 0
Accepted
time: 595ms
memory: 6220kb

input:

100000 100000
853226771 983073939 522511756 694526402 395234774 920141763 2155593 354452535 898150389 426678469 9371790 73867821 556015012 632761500 667763990 87099201 796766920 822179103 928994195 663206181 946796413 923828091 7950633 744030750 284442768 217567406 596470001 143213446 754603014 4336...

output:

12030
17586
49059
67251
18025
10485
22924
35988
16288
59753
14219
24008
24464
12287
69180
7910
22608
19014
24804
1811
5200
48829
56755
40487
3778
10709
779
12508
66496
41614
17466
18391
2756
9093
15387
57890
2115
5685
72321
17885
78630
3430
77138
79945
34943
45369
25316
32947
12266
46644
52516
44341...

result:

ok 100000 lines

Test #71:

score: 0
Accepted
time: 590ms
memory: 6288kb

input:

100000 100000
785752765 364816125 911087815 627426776 811586652 751712301 415177338 742895483 115997911 857387243 366050324 653726884 198300978 546312286 358427717 365238069 459258982 239196351 269605613 352452448 594474976 637003228 440914341 179371565 988222975 795643798 924848695 656142327 956039...

output:

3192
73510
36739
59270
62215
30070
59676
21935
8467
16905
17398
64674
25310
57003
26192
23200
955
18638
1271
62145
17046
37711
5313
13681
4064
66634
35534
2967
2748
30659
38786
36746
56092
5340
2051
55886
40100
13586
15485
12718
8113
28360
38694
30428
3138
18563
19408
29863
62420
14919
42647
29819
5...

result:

ok 100000 lines

Test #72:

score: 0
Accepted
time: 37ms
memory: 4476kb

input:

100000 100000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 9...

output:

49476378
63365653
21644910
102094905
548185716
71934015
19647046
94318245
342578400
7502001
135984786
208763961
46981971
81810
657049375
842284446
47956321
942452820
24566545
864427410
10010575
12253725
35208636
261438411
590218903
594142156
286903
342578400
219453
498727153
121812636
603485911
2108...

result:

ok 100000 lines

Test #73:

score: 0
Accepted
time: 624ms
memory: 6640kb

input:

100000 100000
100000 99999 99998 99997 99996 99995 99994 99993 99992 99991 99990 99989 99988 99987 99986 99985 99984 99983 99982 99981 99980 99979 99978 99977 99976 99975 99974 99973 99972 99971 99970 99969 99968 99967 99966 99965 99964 99963 99962 99961 99960 99959 99958 99957 99956 99955 99954 999...

output:

10783
42718
3928
2079
37774
17366
15086
18479
21429
13172
4650
16563
42756
12434
9292
943
4812
2417
6799
15782
27818
36202
28439
536
4235
8335
16363
8708
24832
15727
17981
1883
2155
28
27411
32569
2033
2119
11020
4758
2876
19467
4992
35676
980
23827
44827
14217
16518
26960
26261
40490
34092
35066
18...

result:

ok 100000 lines

Test #74:

score: 0
Accepted
time: 36ms
memory: 6084kb

input:

100000 100000
500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 50...

output:

800900253
1788886
192717528
98862891
312737545
47040150
296254311
1002377925
654152535
96084453
822820461
246051
94167226
48634453
166176
3974790
235955226
18522741
1003408003
267741370
501130311
604450
388633260
97377990
103341876
937423350
291116385
802501953
403095421
229504600
361334403
38785302...

result:

ok 100000 lines

Test #75:

score: 0
Accepted
time: 33ms
memory: 6060kb

input:

100000 100000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 9...

output:

259156761
279058500
33501205
33583110
2769481
141212415
4766328
84103965
69791205
83069605
4276350
522242721
388382385
65763246
48250576
32955021
25436278
271666395
826882111
172821936
121111266
30721041
342997336
125666731
431313135
188325528
687704241
40549515
190700685
279696726
156884041
2224045...

result:

ok 100000 lines

Test #76:

score: 0
Accepted
time: 625ms
memory: 6680kb

input:

100000 100000
100000 99999 99998 99997 99996 99995 99994 99993 99992 99991 99990 99989 99988 99987 99986 99985 99984 99983 99982 99981 99980 99979 99978 99977 99976 99975 99974 99973 99972 99971 99970 99969 99968 99967 99966 99965 99964 99963 99962 99961 99960 99959 99958 99957 99956 99955 99954 999...

output:

2254
1904
31313
24434
22788
16632
18267
29682
16312
3719
18216
33127
21774
14410
31463
21773
28465
19639
11883
17218
28074
4187
8020
4534
10491
27656
6947
25877
22656
35250
12574
12911
18180
30805
11972
20052
6869
4437
8957
26278
1429
4220
28923
16691
31594
268
10054
36721
10652
7167
19739
18316
413...

result:

ok 100000 lines

Test #77:

score: 0
Accepted
time: 36ms
memory: 6148kb

input:

100000 100000
500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 50...

output:

49745325
117558111
36863991
43538446
50225253
24531510
270665011
382911301
96806655
88784475
1053426
7104565
63748986
726615
364594506
1380291
146110965
48427561
2722611
204555651
31059021
84255
213758826
479864710
10609921
866882341
1347261
899811
110090541
436704681
220846636
110685
290802786
4753...

result:

ok 100000 lines

Test #78:

score: 0
Accepted
time: 38ms
memory: 4404kb

input:

100000 100000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 9...

output:

370777296
632452395
973710
641016915
533452116
136100251
4656
1163379966
29180980
32896
364432503
741298260
440881665
23553816
65054121
317331028
653465476
39573856
344360646
322003
924693510
30642706
52721046
218854581
510161653
234112341
64054221
7732278
390838861
322008753
271177116
124307028
100...

result:

ok 100000 lines

Test #79:

score: 0
Accepted
time: 627ms
memory: 6688kb

input:

100000 100000
100000 99999 99998 99997 99996 99995 99994 99993 99992 99991 99990 99989 99988 99987 99986 99985 99984 99983 99982 99981 99980 99979 99978 99977 99976 99975 99974 99973 99972 99971 99970 99969 99968 99967 99966 99965 99964 99963 99962 99961 99960 99959 99958 99957 99956 99955 99954 999...

output:

2247
6209
29195
26180
41449
20926
17191
41822
37946
17298
10231
16042
12757
913
9408
443
12684
15885
18466
23855
22811
11479
10828
6752
29471
7281
2732
24252
3789
2576
26775
9711
7233
23732
29800
1119
29978
11012
6893
14300
10623
11029
28663
27098
21443
18093
24722
32266
17383
3173
32089
18628
19745...

result:

ok 100000 lines

Test #80:

score: 0
Accepted
time: 33ms
memory: 6072kb

input:

100000 100000
500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 50...

output:

16316328
186621540
355284496
459727003
411400270
222594450
25959615
428556726
2781261
239778
367570941
88704540
307309236
299925
652851045
97713210
522889291
713947578
220762578
110432091
269758378
7910253
12333061
313388130
186834115
64224111
117251641
1078246
8126496
115816590
335210778
16788115
1...

result:

ok 100000 lines

Test #81:

score: 0
Accepted
time: 37ms
memory: 5896kb

input:

100000 100000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 9...

output:

238372695
54616926
70822851
204030100
877150
21115
5367726
180718566
9581253
556695028
480236536
1009644516
20406466
35790030
8759205
37684221
4723201
80030226
900555580
450885435
209029681
51617880
28376811
55994653
36915528
941878
51984306
1055402596
77669416
991936
77719278
23492085
70834753
6674...

result:

ok 100000 lines

Test #82:

score: 0
Accepted
time: 625ms
memory: 6664kb

input:

100000 100000
100000 99999 99998 99997 99996 99995 99994 99993 99992 99991 99990 99989 99988 99987 99986 99985 99984 99983 99982 99981 99980 99979 99978 99977 99976 99975 99974 99973 99972 99971 99970 99969 99968 99967 99966 99965 99964 99963 99962 99961 99960 99959 99958 99957 99956 99955 99954 999...

output:

30465
2980
22405
13564
11444
12128
20371
14267
11974
410
9853
4157
14581
28329
4534
11434
8300
16320
4441
25292
16102
1309
6973
740
17904
4312
5412
7083
15081
20643
7328
1321
36900
20915
14470
3738
470
15120
45173
9131
15234
8980
2594
8112
24478
29555
9495
6592
7511
10685
364
40178
40032
3078
2101
1...

result:

ok 100000 lines

Test #83:

score: 0
Accepted
time: 36ms
memory: 6132kb

input:

100000 100000
500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 50...

output:

364540501
13243231
573029731
659734650
1120798185
29648850
34283340
233701390
99102081
235629486
12834711
28151256
21875805
105843975
417995241
605815836
441330
35806953
24419566
568030365
123048828
647766021
950022255
334072476
343600005
102280753
5048253
123315660
21428331
26721705
49109005
150242...

result:

ok 100000 lines

Test #84:

score: 0
Accepted
time: 37ms
memory: 6148kb

input:

100000 100000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 9...

output:

69743955
802011
925166620
2527876
199730091
66649285
100174935
213056403
890398900
135786960
151824025
72258231
218749986
643561626
188015136
678758590
93222685
44241121
61821640
187608135
170542746
942235755
222130503
384934131
356111328
451426128
47858436
210914991
2692360
615531241
13089286
21073...

result:

ok 100000 lines

Test #85:

score: 0
Accepted
time: 626ms
memory: 6660kb

input:

100000 100000
100000 99999 99998 99997 99996 99995 99994 99993 99992 99991 99990 99989 99988 99987 99986 99985 99984 99983 99982 99981 99980 99979 99978 99977 99976 99975 99974 99973 99972 99971 99970 99969 99968 99967 99966 99965 99964 99963 99962 99961 99960 99959 99958 99957 99956 99955 99954 999...

output:

19531
28518
29188
23914
7220
12476
11456
30586
28245
16482
29934
8674
37853
10000
23850
43047
8625
20074
39473
44024
27694
19293
7934
12023
1078
1343
32454
26441
17596
30334
28473
4005
11883
36161
3361
5742
8432
37201
2766
3963
2017
13680
1925
22775
22490
14184
22087
16999
1896
348
38015
13118
5397
...

result:

ok 100000 lines

Test #86:

score: 0
Accepted
time: 32ms
memory: 6052kb

input:

100000 100000
500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 50...

output:

47156616
130241730
57357405
195475878
523536261
327769606
13007550
1415403
642342403
11613790
85183878
45940905
838717446
34590403
400742205
955653
1140805
281876896
31868136
771753828
10573101
1371996
293146791
272459496
41091645
30541020
551136600
64088181
838103211
303503203
9221365
402215703
524...

result:

ok 100000 lines

Test #87:

score: -100
Time Limit Exceeded

input:

500000 500000
257638063 229051493 46687892 550530064 889778638 224544887 640676703 950307733 506658789 895230205 510315807 489740027 96129967 249532922 805913377 464541220 761262635 820281167 92913974 522542871 815664925 676941127 434574899 873030780 219806090 61314316 571921522 344369699 305443392 ...

output:

73039
130485
97232
32381
136699
148961
320047
104669
79108
292380
194711
128701
299019
280651
39548
228510
12696
338718
116342
313807
109883
52150
271871
115280
229713
114106
57957
39994
86531
202977
175122
89729
190532
73949
292310
250830
141591
38560
69437
3143
110055
155373
220171
97986
358918
13...

result: