QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#744119#2886. 区间众数TheZoneAC ✓2930ms246180kbC++2010.6kb2024-11-13 20:55:282024-11-13 20:55:35

Judging History

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

  • [2024-11-13 20:55:35]
  • 评测
  • 测评结果:AC
  • 用时:2930ms
  • 内存:246180kb
  • [2024-11-13 20:55:28]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int MAXN = 5e5 + 5;
const int MAXQ = 1e6 + 5;
const int B = 2e2;
const int inf = 0x3f3f3f3f;

inline int read(void) {
    int res = 0;
    char c = getchar();

    while (c < '0' && c >= '9')
        c = getchar();

    while (c >= '0' && c <= '9')
        res = res * 10 + c - '0', c = getchar();

    return res;
}

struct BIT {
    int n;
    vector<ll> tree;
#define lowbit(x) ((x)&-(x))
    BIT(int _n = 0): n(_n), tree(n + 1, 0) {}
    void update(int x, ll k) {
        while (x <= n)
            tree[x] += k,
                       x += lowbit(x);
    }
    ll query(int x) {
        ll res = 0;

        while (x)
            res += tree[x],
                   x ^= lowbit(x);

        return res;
    }
};

struct Counter_2D {
    vector< pair<pii, int>> pt, qs;
    void insert(int x, int y, int k) {
        pt.emplace_back(make_pair(x, y), k);
    }
    int addquery(int x, int y) {
        qs.emplace_back(make_pair(x, y), qs.size());
        return (int)qs.size() - 1;
    }

    vector<ll> res;
    void build(void) {
        vector<int> dsc(pt.size());

        for (int i = 0; i < (int)pt.size(); ++i)
            dsc[i] = pt[i].first.second;

        sort(dsc.begin(), dsc.end());
        dsc.erase(unique(dsc.begin(), dsc.end()), dsc.end());
        auto get = [&](int x) {
            return upper_bound(dsc.begin(), dsc.end(), x) - dsc.begin();
        };

        sort(pt.begin(), pt.end());
        sort(qs.begin(), qs.end());

        res.resize(qs.size());
        BIT tree(dsc.size());

        for (int i = 0, j = 0; i < (int)qs.size(); ++i) {
            while (j < (int)pt.size() && pt[j].first.first <= qs[i].first.first)
                tree.update(get(pt[j].first.second), pt[j].second),
                            ++j;

            res[qs[i].second] = tree.query(get(qs[i].first.second));
        }
    }
};

/*
ans = sum min(min(A - l', B - r'), len')
    = sum min(A - l, B - r) * k

solve l <= A, r <= B, A - l <= B - r
->    l <= A, r - l <= B - A

solve l <= A, r <= B, A - l > B - r
->    r <= B, l - r < A - B

ans = sum (A - l) * k
    = sum (A * k - l * k)
    = A * sum (k) + sum (-l * k)
*/
struct Half_Solver {
    Counter_2D sumK, sumB;
    vector<int> qs;
    void _insert(int l, int r, int k) {
        sumK.insert(r - l, l, k);
        sumB.insert(r - l, l, -l * k);
    }
    void insert(int l, int r, int len) {
        _insert(l, r, 1);
        _insert(l + len, r + len, -1);
    }
    int addquery(int x, int y) {
        sumK.addquery(x, y);
        sumB.addquery(x, y);
        qs.push_back(y);
        return (int)qs.size() - 1;
    }

    vector<ll> res;
    void build(void) {
        sumK.build();
        sumB.build();
        res.resize(qs.size());

        for (int i = 0; i < (int)qs.size(); ++i)
            res[i] = (ll)sumK.res[i] * qs[i] + sumB.res[i];
    }
};

int n, Q;
int a[MAXN];
vector<int> apos[MAXN], keys[MAXN];
int rnk[MAXN];

int main(void) {
    n = read();
    Q = read();

    for (int i = 1; i <= n; ++i)
        a[i] = read();

    for (int i = 1; i <= n; ++i) {
        rnk[i] = apos[a[i]].size();
        apos[a[i]].push_back(i);
    }

    for (int i = 1; i <= n; ++i) {
        for (int x : apos[i])
            keys[i].push_back(abs(x - i));

        sort(keys[i].begin(), keys[i].end());
    }

    static vector<int> seg[MAXN];

    for (int i = 1; i <= n; ++i) {
        seg[i].resize(apos[i].size(), inf);

        for (int k = 0; k < (int)keys[i].size(); ++k) {
            if (k + 1 < (int)keys[i].size())
                seg[i][k] = min(seg[i][k], keys[i][k + 1] - 1);

            seg[i][k] = min(seg[i][k], i - 1);
            seg[i][k] = min(seg[i][k], n - i);
        }
    }

    vector<int> alive(n);
    iota(alive.begin(), alive.end(), 1);
    sort(alive.begin(), alive.end(), [&](int x, int y) {
        return apos[x].size() > apos[y].size();
    });

    for (int k = 0; k < B && alive.size(); ++k) {
        while (alive.size() && (int)apos[alive.back()].size() <= k)
            alive.pop_back();

        static int mxlef[MAXN];
        memset(mxlef, 0xc0, (n + 1) << 2);

        for (int i = 1; i <= n; ++i) {
            if (rnk[i] >= k + 1)
                mxlef[i] = apos[a[i]][rnk[i] - (k + 1)];

            mxlef[i] = max(mxlef[i], mxlef[i - 1]);
        }

        for (int i : alive) {
            auto chk = [&](int t) {
                return mxlef[i + t] < i - t;
            };

            int l = keys[i][k], r = min(i - 1, n - i);

            if (k + 1 < (int)apos[i].size())
                r = min(r, keys[i][k + 1] - 1);

            if (l > r || !chk(l)) {
                seg[i][k] = -inf;
                continue;
            }

            while (l < r) {
                int mid = (l + r + 1) >> 1;

                if (chk(mid))
                    l = mid;
                else
                    r = mid - 1;
            }

            seg[i][k] = l;
        }
    }

    sort(alive.begin(), alive.end());

    for (int j : alive) {
        const vector<int> &pos = apos[j];
        const int siz = (int)apos[j].size();
        int currnk = -1;

        for (int i : alive)
            if (i != j) {
                while (currnk + 1 < siz && pos[currnk + 1] < i)
                    ++currnk;

                int jl = currnk + 1, jr = currnk;
                auto onestep = [&](void) {
                    if (jl - 1 < 0 && jr + 1 >= siz)
                        return false;

                    if (jl - 1 < 0)
                        ++jr;
                    else if (jr + 1 >= siz)
                        --jl;
                    else {
                        if (i - pos[jl - 1] <= pos[jr + 1] - i)
                            --jl;
                        else
                            ++jr;
                    }

                    return true;
                };

                bool ok = 1;

                for (int k = -1; k < B && ok; ++k)
                    ok &= onestep();

                if (!ok)
                    continue;

                for (int k = B; k < (int)apos[i].size(); ++k) {
                    if (!onestep())
                        break;

                    int far = max(i - pos[jl], pos[jr] - i);
                    seg[i][k] = min(seg[i][k], far - 1);
                }
            }
    }

    Half_Solver slv1, slv2;

    for (int i = 1; i <= n; ++i)
        for (int k = 0; k < (int)apos[i].size(); ++k) {
            if (seg[i][k] < keys[i][k])
                continue;

            int l = i - keys[i][k], r = i + keys[i][k], len = seg[i][k] - keys[i][k] + 1;

            l = n - l + 1;
            slv1.insert(l, r, len);
            slv2.insert(r, l, len);
        }

    for (int i = 1; i <= Q; ++i) {
        int l = read(), r = read();

        int qA = (n - l + 1) + 1, qB = r + 1;
        slv1.addquery(qB - qA, qA);
        slv2.addquery(qA - qB - 1, qB);
    }

    slv1.build();
    slv2.build();

    for (int i = 1; i <= Q; ++i)
        printf("%lld\n", slv1.res[i - 1] + slv2.res[i - 1]);

    return 0;
}





















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 597ms
memory: 127592kb

input:

500000 1000000
14132 25983 26872 28403 14716 23396 27725 9249 4525 19425 3820 16970 32353 9333 19551 19103 24728 21617 24522 12422 12205 16660 30587 3810 27017 17652 18115 17044 21270 16031 27140 3650 7414 29315 20748 11094 16502 17419 9121 27722 10429 2571 21597 21540 31818 606 21949 18236 6813 104...

output:

0
65641
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
32061
8365
0
0
46074
0
0
0
0
0
0
0
0
0
0
12584
0
0
0
0
0
0
56948
0
0
0
0
0
0
0
0
0
0
73703
0
0
0
0
0
0
0
0
19531
0
0
0
0
0
0
0
0
0
0
0
49681
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
37079
0
0
0
0
0
0
0
0
0
0
0
66459
0
0
0
0...

result:

ok 1000000 lines

Test #2:

score: 0
Accepted
time: 858ms
memory: 178208kb

input:

500000 1000000
239357 273935 236368 40060 311052 173670 51485 388076 424362 478960 48123 485962 392761 107116 367757 457339 89673 173857 492665 107197 135760 176951 421663 479107 385962 4731 41606 304867 230402 176915 3659 310114 13953 275371 331368 371189 320703 49559 389847 463068 269057 193657 23...

output:

27822
18104
37630
74514
29406
532
4749
76643
69952
13718
58850
45264
19395
52110
96646
13895
37395
161780
17134
40485
176002
1059
14057
36787
33572
34401
39093
143917
42897
2768
31748
7475
5908
19740
32342
39516
40021
132703
56
36613
3177
13010
2038
94955
9527
35003
100105
5789
16136
36600
68886
679...

result:

ok 1000000 lines

Test #3:

score: 0
Accepted
time: 999ms
memory: 176236kb

input:

500000 1000000
219484 121530 40986 473774 494303 346082 221221 302414 406453 45610 61533 32659 66218 77929 386389 396644 458364 170783 370846 99818 496564 242303 260854 14866 454574 120740 255731 487089 94629 297033 439555 308651 185193 208645 326101 483667 368572 374356 338774 360884 263123 282993 ...

output:

31754
5470
87096
4924
58011
13509
14608
28983
25288
0
2969
2496
3273
6599
19914
21810
837
40647
15891
4751
925
22451
64868
323
94851
2436
30550
24305
49781
1628
14347
14100
39370
23694
18684
6834
67000
31510
3901
32776
24514
21349
23931
45379
393
69560
49499
1569
49360
26167
32762
5507
6996
37130
92...

result:

ok 1000000 lines

Test #4:

score: 0
Accepted
time: 975ms
memory: 170200kb

input:

500000 1000000
335015 325349 196052 262265 145910 302498 145961 254125 140609 422283 66552 8978 217632 292078 45265 462525 199184 349380 272851 305919 378759 414868 408025 458133 317482 348867 430385 203496 9527 197097 307320 7209 476513 120166 312035 191340 2055 469336 484418 397960 411330 185816 5...

output:

1192
56538
37822
12037
5430
15477
28568
892
1773
17086
4283
2
22888
2198
20510
351
44272
7177
30771
167
2198
28450
54555
8803
58725
2288
612
50283
7662
54555
23546
12055
2329
16940
55608
39709
127
32003
16380
39121
61
53509
47712
58234
7411
379
268
23120
5564
1972
40931
7000
14015
3121
19161
30335
1...

result:

ok 1000000 lines

Test #5:

score: 0
Accepted
time: 1972ms
memory: 164768kb

input:

500000 1000000
428126 307314 133687 146272 169808 196503 140478 90743 452277 34838 145763 68962 273163 23024 262119 455073 232602 351002 43204 499674 104886 425620 395714 830 427655 141667 351639 481644 160637 305282 323680 141667 152925 243463 13913 279884 145763 203783 386216 347214 141667 82578 4...

output:

49
27269
53608
2430
19539
44056
361
53495
553
8219
57850
81166
79518
1941
26405
9730
4997
99
62128
3275
26685
26684
2608
74741
2805
24599
11
10570
906
2090
7731
8718
28475
2854
77
9854
2829
1017
0
7193
3942
24570
29574
4432
3275
91215
7837
3597
4004
35372
3545
2304
14400
1941
9315
89615
96388
5719
6...

result:

ok 1000000 lines

Test #6:

score: 0
Accepted
time: 1672ms
memory: 175584kb

input:

500000 1000000
307576 216901 121591 121408 55894 265063 397832 127708 13314 408285 150189 169966 49998 355342 403927 175133 127569 471643 433665 179757 493683 314480 471107 389002 377234 119430 407144 124164 38470 45782 355675 84129 403009 262767 251827 393087 290025 234013 218488 184410 424304 2462...

output:

8100
4569
11443
22648
1984
121865
1322
63515
133141
79088
7896
302
129612
1503
2747
10573
157684
4319
1710
11037
149536
371
6870
3871
53
68698
8863
153702
156776
265
1685
145463
9179
4437
13270
127100
1191
137652
44404
244
9699
10413
154492
7386
110023
1547
51399
9488
448
1738
872
4356
23222
1481
29...

result:

ok 1000000 lines

Test #7:

score: 0
Accepted
time: 1017ms
memory: 180720kb

input:

500000 1000000
198361 15190 262295 339186 244486 306572 207093 32793 9467 169466 272756 297203 297858 237271 351439 203841 254687 77113 154713 275580 11562 100260 489969 197914 286818 354828 217967 46740 150874 323245 300504 340618 174655 82782 45996 384510 229272 227328 203125 480291 56143 450518 2...

output:

80425
18855
2805
52646
98149
695
566
215920
54347
48263
9357
68788
5266
93615
69340
1955
132338
80892
3083
1248
9799
107872
47056
126929
15775
0
117356
10107
2395
40646
37657
173964
18008
3418
59957
220624
8202
7539
46612
4919
150303
22588
178613
11446
11060
367
10631
169708
1384
14589
10687
9802
13...

result:

ok 1000000 lines

Test #8:

score: 0
Accepted
time: 1028ms
memory: 179416kb

input:

500000 1000000
314378 98255 5910 422271 162344 489978 443168 132918 115010 436541 337412 7439 99062 135586 139613 499342 465896 144897 400200 348039 160285 47546 43647 87307 182335 378982 354476 401581 499475 277041 433491 129586 150463 103234 480962 47903 34309 260764 374421 326512 74035 494491 397...

output:

117
1324
61413
3103
3384
456
1254
127
30575
1236
2877
56865
46699
36144
5109
43
53477
1568
44827
1573
49485
4210
2790
4208
2779
29692
1945
6995
3574
2108
19363
853
1778
536
5119
4018
34312
26054
5444
5742
55630
55663
56371
2715
37457
1621
59831
6230
2864
61484
1983
4440
4
24107
3117
1159
2676
43332
...

result:

ok 1000000 lines

Test #9:

score: 0
Accepted
time: 1347ms
memory: 172592kb

input:

500000 1000000
326580 437582 54592 94212 487027 106543 198370 291742 53204 462250 260587 444184 438440 200393 387944 405417 44740 35343 245884 406445 368732 33903 47840 144176 37307 147583 447570 312186 232607 158734 437582 66032 405050 155679 218880 396443 73525 471002 95654 250467 335914 47840 886...

output:

616
10716
7614
5085
12314
12197
16052
6703
6722
15162
2452
20508
7061
5179
124
12213
7788
7687
7779
25977
3002
19215
20377
549
29462
0
2489
3391
101
4859
32397
6487
9908
0
2782
2600
7186
12257
12162
123
4043
7861
8
13420
2525
3501
37025
5101
12104
4444
3639
20284
17547
7245
4051
25654
9488
6545
7887...

result:

ok 1000000 lines

Test #10:

score: 0
Accepted
time: 1327ms
memory: 170048kb

input:

500000 1000000
282733 56245 483828 348792 461938 381328 287033 280200 406359 25403 68137 368915 152114 184579 244583 440905 138961 106132 290016 368611 223957 459070 448524 69366 67244 56245 64116 495957 152282 134721 115378 416762 219148 138990 178994 207210 345721 253942 366633 137712 374098 41792...

output:

271
27519
3052
25
16
17154
56
701
78407
75068
7929
820
6587
1
9527
80057
1960
8384
39445
20
10945
3834
10284
73264
7541
0
16430
533
0
63
6628
16736
80993
74042
95077
2200
6754
7487
12256
91484
11768
63
38199
0
93552
329
31498
1206
9170
73708
5
30543
10935
6867
0
84611
18708
18
11112
81
28198
6056
61...

result:

ok 1000000 lines

Test #11:

score: 0
Accepted
time: 1061ms
memory: 166692kb

input:

500000 1000000
139854 327348 311270 154315 127160 98311 22543 455943 367365 451096 248622 4376 22543 51467 43931 294842 4376 365389 122399 364818 197325 285657 36641 402109 63205 255346 311270 127160 490971 248622 193788 160814 245077 197325 415639 173558 54111 168657 119504 344347 39768 358089 2450...

output:

0
2
15187
15668
209
4126
11561
4726
4716
15187
491
15312
17224
209
15613
75
14970
436
1285
0
14978
4726
14968
4734
8348
1118
4716
15187
11233
17251
10897
41538
19205
17224
12774
12863
11997
1118
9440
645
3626
6470
12768
27
40621
209
12768
12024
1100
17251
5872
4558
15188
435
0
1435
436
17408
7123
14...

result:

ok 1000000 lines

Test #12:

score: 0
Accepted
time: 1478ms
memory: 243212kb

input:

500000 1000000
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 ...

output:

6859235220
25351008400
11844186561
40106871289
13532668900
142301041
2264332225
7802895556
315027001
7618583940
10278208542
11614157361
70132250
2595321
1824870242
1707838276
1062271056
2431821282
2626511250
9212928256
4157283529
7853593020
25090081
116402521
20100575952
26084511049
11248511481
5934...

result:

ok 1000000 lines

Test #13:

score: 0
Accepted
time: 1229ms
memory: 173132kb

input:

500000 1000000
56578 54798 471811 103744 367115 150555 36106 143648 262620 36212 36454 272177 465885 304133 14599 423893 162662 271095 232418 351747 304133 270740 479592 107797 190363 490637 331418 144082 190363 460746 173800 365022 114664 299228 262620 88176 139703 110016 439678 482346 332045 2718 ...

output:

3674
0
2879
2464
6252
10710
10880
15435
294
3348
4593
8723
11125
2872
3153
384
3583
11011
2743
3181
440
0
2072
3344
513
8526
454
3960
4159
12850
13
3971
16
480
1162
2739
722
12901
1077
15530
541
0
839
294
3299
12853
12051
11095
3329
811
19840
8004
12361
45
261
2943
7491
3344
1634
480
2879
15709
1549...

result:

ok 1000000 lines

Test #14:

score: 0
Accepted
time: 978ms
memory: 177960kb

input:

500000 1000000
477142 56111 92903 31757 216144 365672 276207 185175 69414 286961 396720 405412 123969 22090 188522 499783 119230 430941 261431 313549 203831 32050 177940 110831 405907 24178 484019 350402 347807 116848 194427 420541 96806 356712 403565 20101 287973 110831 383592 485277 313587 385042 ...

output:

28826
8244
340
69
1240
8521
10005
415
22797
10911
22318
224
4279
22331
2394
19991
4220
8264
126
24246
630
2617
32765
18268
31558
2528
3674
2787
28832
24721
22738
24408
1220
13866
8528
24102
7
22671
1512
5814
8529
37774
18341
4267
168
41804
22439
2494
18054
375
990
1906
0
4662
9725
22771
601
22318
70...

result:

ok 1000000 lines

Test #15:

score: 0
Accepted
time: 1008ms
memory: 181396kb

input:

500000 1000000
169277 336295 76436 377021 135063 265848 228513 388308 135261 343921 467974 123538 186087 450445 343309 392044 373582 53523 247493 379322 339957 245277 494162 305127 480492 309157 352745 479021 142335 297410 299908 297410 405660 90402 111652 373402 392908 244218 490086 297410 381599 2...

output:

3541
2767
5282
45
1465
6092
0
2020
42486
10890
116
8279
6430
3239
3222
1144
2544
3
45587
4795
4432
2563
816
185
1036
5820
188
4519
1031
5707
743
2
28699
45
45
3269
1561
6016
7250
1109
1106
1109
546
28
2208
1280
6014
1277
6007
22727
125
81
9503
12
48
3258
5993
294
37097
1158
1609
32084
1426
2530
9325...

result:

ok 1000000 lines

Test #16:

score: 0
Accepted
time: 1290ms
memory: 176196kb

input:

500000 1000000
58322 288976 327397 458124 211086 15570 366836 186801 298033 388876 327397 106110 206885 76101 198941 206816 125776 235739 11597 354171 78045 144610 402294 307565 199395 407694 297170 282433 103086 298911 89880 485582 288976 189924 46309 282433 51160 93355 401064 291148 402294 363368 ...

output:

0
43202
209730
90150
122495
87117
33970
6306
6
234
477
31119
0
91527
85269
58864
95749
145962
80480
120634
84796
1703
28504
75
0
0
47916
72
11677
253
4342
64978
681
89969
77442
184729
58900
79195
66
10
77964
681
46001
27222
43512
89818
72
0
52487
3860
477
174
80077
115022
48907
66605
477
6
243879
12...

result:

ok 1000000 lines

Test #17:

score: 0
Accepted
time: 943ms
memory: 164756kb

input:

500000 1000000
300703 437893 439719 44574 79732 360856 67557 389816 360856 246836 359460 128022 30383 186935 198461 437893 466152 343148 68324 186935 323475 128022 45761 128022 381624 45948 439719 381624 128022 437893 381624 302517 322876 440269 116689 498228 45948 79732 128022 360856 447881 360856 ...

output:

77
39757
39799
35067
90
1
40946
13
0
10751
12326
1546
0
5
41083
0
40946
558
32463
0
4817
5190
18370
53
15953
23
137
46095
0
36115
27499
39810
105
46151
1506
46153
40218
1
5207
56
0
6320
39758
34
5200
1507
0
40912
460
46153
0
43237
39536
40946
2
0
0
3457
46096
5273
57
46136
35067
36115
39334
6360
347...

result:

ok 1000000 lines

Test #18:

score: 0
Accepted
time: 1046ms
memory: 168796kb

input:

500000 1000000
104393 372186 322486 372186 39570 447161 39570 39570 372186 447161 22844 454849 447161 209702 447161 454849 372186 481436 242803 454849 39570 209702 372186 39570 354902 39570 104393 279070 454849 39570 104393 444751 447161 444751 209702 343701 219973 372186 39570 354902 372186 88576 4...

output:

118271
15732
24
19960
7433
0
32392
3
20985
3
3
0
6486
57914
3
2
0
24093
18959
30972
0
0
7308
3
0
93544
36941
4328
0
44853
2
13979
215
0
7563
0
0
0
0
107751
0
0
0
508
3
21009
8963
21009
26
28585
71024
48406
26
6075
24132
0
26
23952
74488
20985
0
59884
24108
10533
0
1229
3
4358
3293
19937
508
30705
0
...

result:

ok 1000000 lines

Test #19:

score: 0
Accepted
time: 1174ms
memory: 176756kb

input:

500000 1000000
4418 264753 224133 157616 360234 224133 155809 117284 197835 197835 143473 362608 295978 73781 147989 58536 224133 472450 276157 332059 328230 408865 424628 58536 322193 424628 376427 199390 197835 384739 294498 238823 328230 437080 437080 262716 85172 437080 424628 424628 224133 1090...

output:

0
0
65789
65066
10
169
66062
19689
1057
7
18649
41085
1050
3
65066
0
3
3658
24886
57298
1219
8547
66245
46118
65069
46781
51177
10
10
65066
3
65792
10
148
18646
54903
3567
1057
0
18639
1057
65160
0
387
3136
54145
65128
387
0
179
66169
18220
65877
0
12878
101
65789
3
1057
65446
8917
10
18649
10
163
7...

result:

ok 1000000 lines

Test #20:

score: 0
Accepted
time: 1023ms
memory: 178396kb

input:

500000 1000000
61953 215949 29078 426291 37599 378139 238256 297911 217172 488256 25300 210228 366987 102427 130569 425989 18623 35783 401128 244184 150116 155611 4348 193234 146223 4348 168737 338819 4348 113102 412162 284304 369143 350995 292509 415357 448327 266387 359900 297911 334252 236392 107...

output:

0
0
3450
6237
16419
29
3461
101530
6248
16
3456
90
0
51823
10738
84195
66
55
27
42151
0
5249
25
24542
24733
5
9638
27442
54
16
5
4916
0
0
24
51
0
3390
838
55189
3414
7023
11
100599
5584
63
32567
924
12675
70023
48516
878
9657
2214
35939
30
46
33717
94217
6215
65657
5575
3388
60421
25036
7
5
6188
341...

result:

ok 1000000 lines

Test #21:

score: 0
Accepted
time: 1104ms
memory: 182508kb

input:

500000 1000000
498000 371511 254132 250623 416346 423725 238224 178409 160931 162883 358250 316607 385694 245475 367889 338769 463338 251970 181621 20340 344865 336757 251970 236316 290036 214659 474987 115570 310325 369464 443826 178409 251970 88913 178409 430701 451184 251970 178409 443960 412745 ...

output:

151674
3
172353
17
3537
3
17
5744
132790
118533
3537
140514
3
3548
170246
27124
129296
0
69723
122705
146579
0
3
144476
76289
190482
112387
15
17
0
3530
43508
3
3547
77029
23397
103854
0
3552
2
16
138244
3554
15
7
96149
0
3
17
115763
39268
0
3537
194226
0
0
67213
3
120340
3526
35432
3530
0
0
177887
...

result:

ok 1000000 lines

Test #22:

score: 0
Accepted
time: 1222ms
memory: 179128kb

input:

500000 1000000
275351 448211 273139 224806 448211 448211 58866 244883 239764 489774 58866 27047 239650 459945 356596 55815 273139 273139 58866 161080 448211 273139 273139 448211 448211 109084 392239 273139 431603 58866 434706 58866 273139 185256 273139 58866 273139 448211 273139 333982 273139 225936...

output:

0
124271
64679
29440
57042
3428
16965
27118
16965
69634
3424
0
81511
4
0
0
0
85972
16965
45502
46601
81511
34689
0
65358
45238
81349
98133
64550
77780
0
0
0
0
13336
23835
0
64546
123759
81511
64424
33753
3081
16965
22718
5560
35738
31565
20825
26289
26122
81511
96335
0
81515
0
28976
3428
74649
0
0
4...

result:

ok 1000000 lines

Test #23:

score: 0
Accepted
time: 1465ms
memory: 243524kb

input:

500000 1000000
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 ...

output:

4343334485
166500312
13033228974
2968397289
1593885852
1725737764
204618720
2243585322
6058720817
8865512920
13883826138
1506720672
9425497225
5960860230
3983503225
196756729
269813476
4185766506
19543846353
3727130538
15508647579
11113563077
11576634228
9355510161
940035600
17361316385
2133854348
9...

result:

ok 1000000 lines

Test #24:

score: 0
Accepted
time: 1006ms
memory: 170148kb

input:

500000 1000000
151151 224787 151151 288362 316089 351623 316089 57376 316089 151151 236654 151151 417968 316089 236654 236654 288222 236654 89925 236654 207935 316089 151151 236654 316089 151151 316089 236654 316089 316089 316089 316089 16396 236654 459538 316089 316089 151151 394017 151151 151151 2...

output:

60256
1924
60327
2196
28027
0
321
60327
23308
60327
9263
392
392
58452
17421
60327
321
71
0
2431
0
3779
0
0
0
392
0
60327
321
0
58452
0
0
0
71
0
2125
321
71
34163
2196
0
1252
71
60327
58841
392
26333
37762
52941
0
71
0
392
13221
0
0
2196
9350
321
60327
0
71
0
321
0
42287
24650
60327
2196
0
37135
219...

result:

ok 1000000 lines

Test #25:

score: 0
Accepted
time: 1188ms
memory: 208044kb

input:

500000 1000000
2 4 4 6 6 8 8 10 10 12 12 14 14 16 16 18 18 20 20 22 22 24 24 26 26 28 28 30 30 32 32 34 34 36 36 38 38 40 40 42 42 44 44 46 46 48 48 50 50 52 52 54 54 56 56 58 58 60 60 62 62 64 64 66 66 68 68 70 70 72 72 74 74 76 76 78 78 80 80 82 82 84 84 86 86 88 88 90 90 92 92 94 94 96 96 98 98 1...

output:

8889312598
185310126
4685107076
3883216923
2443494324
4461015196
4823914580
10900504736
667037813
8368145637
164439112
85778802
1441415432
210791778
3964217860
1624144417
5033808378
6013848254
87225632
2179353210
1525949768
4114696328
3316305609
234556140
5020430499
6250236063
5783380204
1295870938
...

result:

ok 1000000 lines

Test #26:

score: 0
Accepted
time: 1188ms
memory: 205668kb

input:

500000 1000000
2 4 4 6 6 8 8 10 10 12 12 14 14 16 16 18 18 20 20 22 22 24 24 26 26 28 28 30 30 32 32 34 34 36 36 38 38 40 40 42 42 44 44 46 46 48 48 50 50 52 52 54 54 56 56 58 58 60 60 62 62 64 64 66 66 68 68 70 70 72 72 74 74 76 76 78 78 80 80 82 82 84 84 86 86 88 88 90 90 92 92 94 94 96 96 98 98 1...

output:

8816606687
1684349820
19369088
1584253905
9333214286
2231736739
15125000
589343112
10103629810
2649873423
1996885044
2867970848
3481580862
34652813
2306952
13930179514
927854855
107699826
2106718960
421689841
223872800
5462703151
4342536327
1756034911
9168686190
623751200
4395717117
6389666252
63884...

result:

ok 1000000 lines

Test #27:

score: 0
Accepted
time: 1093ms
memory: 198696kb

input:

500000 1000000
3 3 6 6 6 9 9 9 12 12 12 15 15 15 18 18 18 21 21 21 24 24 24 27 27 27 30 30 30 33 33 33 36 36 36 39 39 39 42 42 42 45 45 45 48 48 48 51 51 51 54 54 54 57 57 57 60 60 60 63 63 63 66 66 66 69 69 69 72 72 72 75 75 75 78 78 78 81 81 81 84 84 84 87 87 87 90 90 90 93 93 93 96 96 96 99 99 99...

output:

1997514376
921149064
762269615
565978145
491020926
5633265710
97820867
991119104
3722491123
98045030
4774147
29053632
8274720962
879501324
2125686864
5045330
1784020873
39436377
5555602
7139471267
2077884962
213262145
1388685675
14333602
1872275990
6234630788
5333320844
1472864419
1090416833
2516121...

result:

ok 1000000 lines

Test #28:

score: 0
Accepted
time: 1035ms
memory: 176236kb

input:

500000 1000000
4 4 4 8 8 8 8 12 12 12 12 16 16 16 16 20 20 20 20 24 24 24 24 28 28 28 28 32 32 32 32 36 36 36 36 40 40 40 40 44 44 44 44 48 48 48 48 52 52 52 52 56 56 56 56 60 60 60 60 64 64 64 64 68 68 68 68 72 72 72 72 76 76 76 76 80 80 80 80 84 84 84 84 88 88 88 88 92 92 92 92 96 96 96 96 100 100...

output:

323667086
1916725036
518848673
494663413
2869171641
2814522368
1634772348
429131940
428614209
447502293
624204773
5149729976
360857514
2057395859
911994637
106120902
3676846386
730566841
1665394886
3627145450
2449333900
1374003919
3456665073
1198251673
483868010
146222510
4435404287
3432262406
16096...

result:

ok 1000000 lines

Test #29:

score: 0
Accepted
time: 1028ms
memory: 174656kb

input:

500000 1000000
5 5 5 5 10 10 10 10 10 15 15 15 15 15 20 20 20 20 20 25 25 25 25 25 30 30 30 30 30 35 35 35 35 35 40 40 40 40 40 45 45 45 45 45 50 50 50 50 50 55 55 55 55 55 60 60 60 60 60 65 65 65 65 65 70 70 70 70 70 75 75 75 75 75 80 80 80 80 80 85 85 85 85 85 90 90 90 90 90 95 95 95 95 95 100 100...

output:

2207083807
928175876
3107389042
1791534614
2017553511
2194081152
1021951798
2383630555
1997726918
19193579
848732691
23164129
216937420
1446821917
1757493321
526912717
99373278
906127220
423623305
113435608
4502191527
1790047227
2444422279
178443380
2279150758
76730114
600279245
420009832
4509502667...

result:

ok 1000000 lines

Test #30:

score: 0
Accepted
time: 1007ms
memory: 173632kb

input:

500000 1000000
6 6 6 6 6 12 12 12 12 12 12 18 18 18 18 18 18 24 24 24 24 24 24 30 30 30 30 30 30 36 36 36 36 36 36 42 42 42 42 42 42 48 48 48 48 48 48 54 54 54 54 54 54 60 60 60 60 60 60 66 66 66 66 66 66 72 72 72 72 72 72 78 78 78 78 78 78 84 84 84 84 84 84 90 90 90 90 90 90 96 96 96 96 96 96 102 1...

output:

736376816
1459988405
1265304996
152016734
2162391420
3175720781
719056170
2021491215
8053891
447811204
4165446346
896558010
529389480
476578113
434027160
4781820119
4632870398
549150227
1651710476
1490992146
2297115536
1865060073
1000994833
28853301
47844208
28351921
863041447
15291278
450751295
116...

result:

ok 1000000 lines

Test #31:

score: 0
Accepted
time: 1004ms
memory: 170012kb

input:

500000 1000000
7 7 7 7 7 7 14 14 14 14 14 14 14 21 21 21 21 21 21 21 28 28 28 28 28 28 28 35 35 35 35 35 35 35 42 42 42 42 42 42 42 49 49 49 49 49 49 49 56 56 56 56 56 56 56 63 63 63 63 63 63 63 70 70 70 70 70 70 70 77 77 77 77 77 77 77 84 84 84 84 84 84 84 91 91 91 91 91 91 91 98 98 98 98 98 98 98 ...

output:

572391557
472695746
618938827
699571551
2435662199
2488519962
1984354513
1475237357
1954769966
3378028149
1605173143
11253500
839441840
1895550760
3531961877
738143768
427136727
298094628
981494033
903107707
29835123
834062167
6059882
290250804
1148570222
664661635
3163040758
699540076
606963554
112...

result:

ok 1000000 lines

Test #32:

score: 0
Accepted
time: 995ms
memory: 164968kb

input:

500000 1000000
8 8 8 8 8 8 8 16 16 16 16 16 16 16 16 24 24 24 24 24 24 24 24 32 32 32 32 32 32 32 32 40 40 40 40 40 40 40 40 48 48 48 48 48 48 48 48 56 56 56 56 56 56 56 56 64 64 64 64 64 64 64 64 72 72 72 72 72 72 72 72 80 80 80 80 80 80 80 80 88 88 88 88 88 88 88 88 96 96 96 96 96 96 96 96 104 104...

output:

1889034579
1028950794
9005768
12020930
2129668953
9732872
256273480
31656924
40042301
1100984421
1568302331
709344337
1658407227
253749760
1544800825
771947921
863450568
955122212
225054737
501518202
1914185056
117864982
13451189
1151304107
1687530092
1038711209
693628837
1560359787
1285221848
30854...

result:

ok 1000000 lines

Test #33:

score: 0
Accepted
time: 942ms
memory: 166676kb

input:

500000 1000000
9 9 9 9 9 9 9 9 18 18 18 18 18 18 18 18 18 27 27 27 27 27 27 27 27 27 36 36 36 36 36 36 36 36 36 45 45 45 45 45 45 45 45 45 54 54 54 54 54 54 54 54 54 63 63 63 63 63 63 63 63 63 72 72 72 72 72 72 72 72 72 81 81 81 81 81 81 81 81 81 90 90 90 90 90 90 90 90 90 99 99 99 99 99 99 99 99 99...

output:

1202927140
1006792900
7252
636921427
2908339962
926543925
428724633
1046171950
1685653593
404184218
266179225
1170578278
14466612
48735857
650777108
40003517
2068670903
280976922
2155797675
821630707
1226729260
105383594
835566471
1869508509
1178563163
133718388
163451963
636309033
62241582
88814186...

result:

ok 1000000 lines

Test #34:

score: 0
Accepted
time: 803ms
memory: 181892kb

input:

500000 1000000
250544 370276 490026 57159 154284 16606 132764 68168 37123 284979 88248 275922 6720 443593 264435 320673 330778 165118 203047 4835 496429 263626 221177 99814 254159 181855 67044 127098 209265 399895 394945 442670 464831 430073 28397 351849 486125 496873 488119 8557 219085 312700 16397...

output:

103623
147809
213252
286821
124462
204039
462399
44418
120723
127874
202707
60533
8053
161417
86284
289462
205533
342471
57229
39355
401470
171979
14402
329317
469953
78274
199129
39352
113066
8569
72314
408465
498664
459122
107925
3981
186079
46
307759
20117
108112
237798
328114
13363
76290
1015
13...

result:

ok 1000000 lines

Test #35:

score: 0
Accepted
time: 954ms
memory: 164848kb

input:

500000 1000000
10 10 10 10 10 10 10 10 10 20 20 20 20 20 20 20 20 20 20 30 30 30 30 30 30 30 30 30 30 40 40 40 40 40 40 40 40 40 40 50 50 50 50 50 50 50 50 50 50 60 60 60 60 60 60 60 60 60 60 70 70 70 70 70 70 70 70 70 70 80 80 80 80 80 80 80 80 80 80 90 90 90 90 90 90 90 90 90 90 100 100 100 100 10...

output:

263066410
2603713568
885443360
1293769153
4603623
1501376863
1369531873
650593118
539446657
628067818
1108862534
147693255
31885461
873890043
49963427
1322215556
522403700
2729542
1586215677
2433815403
1509660428
1237059687
425299622
1257785078
70476977
1501236108
102688201
950625000
198137042
11249...

result:

ok 1000000 lines

Test #36:

score: 0
Accepted
time: 881ms
memory: 158940kb

input:

500000 1000000
30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 120 120 120 120 12...

output:

403948189
158189808
280764235
75228918
425747766
67134923
628949370
310874897
298157140
195459444
472503754
35954327
189983166
553052175
263705005
482006561
27937715
133807155
13138052
40564281
2943452
508979102
231810201
668763408
392246503
590736657
170060390
9743580
479187
226398084
363327639
563...

result:

ok 1000000 lines

Test #37:

score: 0
Accepted
time: 881ms
memory: 159304kb

input:

500000 1000000
100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 1...

output:

32744149
92625217
5621171
176500598
189925140
43743680
1563750
2345
11958564
883036
76464405
23631264
94888054
6104152
10794849
26907579
44606368
169622048
66854435
69427525
60285978
10869564
220817390
13771520
125605336
56611963
26937138
79528936
121651425
59623695
498576
12307858
3247072
28883
272...

result:

ok 1000000 lines

Test #38:

score: 0
Accepted
time: 1825ms
memory: 146552kb

input:

500000 1000000
300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 3...

output:

27764846
3883980
18126549
271050
208858
91790
5357096
50404462
56498
24748010
73915129
73529214
42728112
11991000
25979310
12913316
10532121
182232
32278808
8007545
35492200
22508004
4406699
656000
11876121
6336
1700100
85905516
45858267
1212674
96234988
526309
45683067
36724537
13983409
96534
37089...

result:

ok 1000000 lines

Test #39:

score: 0
Accepted
time: 1203ms
memory: 130896kb

input:

500000 1000000
1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 ...

output:

6707928
505384
1554189
13211286
1744960
1244075
16528850
4761621
3086869
253184
17636172
3075299
4414355
3562751
1500649
492275
22150594
147586
2417172
10374647
8390426
2217263
1436846
8869587
3781602
12764857
552477
48146
18919929
122540
12939955
17030497
4172942
1772733
21815404
8807770
7073865
21...

result:

ok 1000000 lines

Test #40:

score: 0
Accepted
time: 959ms
memory: 125912kb

input:

500000 1000000
3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 3000 ...

output:

3564734
287657
178816
138266
2495088
61120
2561665
3213924
252432
4195745
5046733
2462975
4000
3274821
521251
940109
115026
313680
3788097
3014920
1929613
131530
28629
2149902
1861941
2786414
5979678
5602348
722
2795787
3553529
1540409
3702335
88115
2566393
4281147
11484
5121100
2892856
15274
8126
2...

result:

ok 1000000 lines

Test #41:

score: 0
Accepted
time: 895ms
memory: 126660kb

input:

500000 1000000
10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 100...

output:

0
315335
106803
0
926321
282456
151272
0
386939
1238283
1028313
395013
145477
2682
884356
1577332
305104
321036
37978
2508900
1402775
80703
2529592
168623
32168
238240
216017
979089
523494
106488
851283
641138
1747839
732600
278380
771337
1155494
833588
90060
1310032
774103
1573110
71199
1627505
646...

result:

ok 1000000 lines

Test #42:

score: 0
Accepted
time: 1510ms
memory: 227680kb

input:

500000 1000000
1 2 3 3 5 6 6 8 9 9 11 12 12 14 15 15 17 18 18 20 21 21 23 24 24 26 27 27 29 30 30 32 33 33 35 36 36 38 39 39 41 42 42 44 45 45 47 48 48 50 51 51 53 54 54 56 57 57 59 60 60 62 63 63 65 66 66 68 69 69 71 72 72 74 75 75 77 78 78 80 81 81 83 84 84 86 87 87 89 90 90 92 93 93 95 96 96 98 9...

output:

1843731459
1469542666
2872871908
6179213134
7314906299
1763169144
8939712994
10012118697
17917599851
406922884
3317917862
7046132494
3972805468
375939294
3942114997
7101975727
431340250
3074453
4058525881
102538838
3123671470
7116337
935379573
1160254666
808044817
571209602
10308795957
8279305864
25...

result:

ok 1000000 lines

Test #43:

score: 0
Accepted
time: 1572ms
memory: 238664kb

input:

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

output:

2897484752
2354383271
35843864
276528652
559391717
258536569
3298891108
3206069213
1738916855
14757298
297248404
10735980
409676716
617214407
197362417
4203094432
1308941844
825962789
2068879398
2086695723
74512535
3615525
107764392
26910675
1311162312
2256694882
1747512054
629055105
55396596
220664...

result:

ok 1000000 lines

Test #44:

score: 0
Accepted
time: 1614ms
memory: 243092kb

input:

500000 1000000
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 30 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 60 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 90 92 93 94 95 96 97 98 ...

output:

5241455
1306600018
420512848
357987885
458480754
306727840
178271908
516880546
467824177
117109641
57774916
37557268
1444052510
336706534
23064849
1514371950
26106157
303961776
170115741
148590187
964039835
474768356
20625204
126335582
127966078
617869432
180762139
83990989
3766
102294124
856016145
...

result:

ok 1000000 lines

Test #45:

score: 0
Accepted
time: 813ms
memory: 177460kb

input:

500000 1000000
214680 45200 64033 373612 60310 221272 363530 498787 41081 129065 357717 119500 61029 256102 478098 270544 164110 476858 214397 252698 269067 389989 468277 432031 76164 257179 472760 435174 408712 174973 83198 372153 132850 224527 199966 92319 313316 446 365623 475678 155612 283328 31...

output:

41158
2794
55892
475349
306080
146375
142818
20114
23791
8675
157931
205144
76187
5401
176273
179325
238923
79714
327646
107527
212771
82098
72054
623216
305047
11802
212255
190668
18162
372812
155447
244647
435391
84095
1115
10800
477367
36593
543402
10663
352780
80088
155547
12570
338
302587
5597
...

result:

ok 1000000 lines

Test #46:

score: 0
Accepted
time: 1665ms
memory: 242996kb

input:

500000 1000000
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 ...

output:

66693189
15198277
3474710
266752090
52925656
462231325
16610167
40481957
43064891
26939553
171317646
729347
406073717
88869988
944818
88834445
138773404
141561264
38243133
224923346
184172443
370929875
155411285
8065789
15419692
177376585
38405895
690959
57991553
26259330
39924303
347469491
81015689...

result:

ok 1000000 lines

Test #47:

score: 0
Accepted
time: 1655ms
memory: 243048kb

input:

500000 1000000
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 ...

output:

63911010
133483699
132266865
68515755
27922001
42008008
43203532
52646478
4352633
4020335
60018826
25989439
75883277
49507068
32977766
30194381
13054959
37399054
113714951
124796919
19584596
63642644
671355
452198
30717122
16512179
73132010
33309774
48353279
228368725
11223033
5895562
197173822
6974...

result:

ok 1000000 lines

Test #48:

score: 0
Accepted
time: 1534ms
memory: 243164kb

input:

500000 1000000
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 ...

output:

40380519
141515367
19333287
45622495
80516264
165182648
7878990
21956194
16246163
4729131
83576247
7102663
51272067
2031800
24716072
46310466
19660195
21579951
10726329
95615555
108710714
37020603
28434533
33914621
99676025
139917825
70561658
14199667
77839598
88415955
7966031
4925362
6697751
154509...

result:

ok 1000000 lines

Test #49:

score: 0
Accepted
time: 1489ms
memory: 243352kb

input:

500000 1000000
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 ...

output:

29481068
129442480
237217805
143533219
182784612
104756223
204280938
10268525
198803359
85811184
19670410
175085650
252710884
126633022
163746757
147748998
16490474
87165822
5669014
1418845
21990555
52287687
227476158
45869343
175758249
38890475
163912973
535470
154453559
360825171
318572393
2776229...

result:

ok 1000000 lines

Test #50:

score: 0
Accepted
time: 1489ms
memory: 246096kb

input:

500000 1000000
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 ...

output:

433410961
254724952
332418668
76921143
565478904
656308315
111130460
302576904
56340958
377662932
215771267
184594574
933035107
370469468
1128388604
501898524
577058664
113319057
652621647
165958030
504559041
761464255
699061079
356114126
402375799
568216418
261815268
285454214
501046398
402939264
1...

result:

ok 1000000 lines

Test #51:

score: 0
Accepted
time: 1492ms
memory: 245568kb

input:

500000 1000000
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 ...

output:

2817107034
455822755
1588495898
714661384
626011986
1061347403
836341273
2266313913
368262911
772188870
1038962746
238903559
2202720095
1026152263
1354840428
1229190578
1706212992
683933214
2700649087
1551690528
17144289
937804376
527240255
255948559
491003826
1144380592
1151456759
887076363
2915716...

result:

ok 1000000 lines

Test #52:

score: 0
Accepted
time: 1480ms
memory: 243520kb

input:

500000 1000000
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 ...

output:

2020323247
5027218630
1070763050
3092361828
5721044515
11309034195
1566318719
3453345579
3817166733
2414847149
8251318293
8309617832
138011277
2010635858
5591317098
64625521
9017830353
4212477950
11088900
1541556968
7117333635
67354849
9053116731
129629610
6374999533
5835104910
2762266628
2398314079...

result:

ok 1000000 lines

Test #53:

score: 0
Accepted
time: 1473ms
memory: 246180kb

input:

500000 1000000
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 ...

output:

8021978790
10084034467
1756448100
7989639228
24375954651
12668628025
13994356198
4741569852
10197148501
383924836
33217932
14802940164
2033763771
17959369903
92131202
2513518225
5174572290
1981187168
1626347584
3463793316
2117025
11229743303
15606450
28343193098
14907674726
1451532245
10697868330
20...

result:

ok 1000000 lines

Test #54:

score: 0
Accepted
time: 1509ms
memory: 221856kb

input:

500000 1000000
1 1 3 3 5 5 7 7 9 9 11 11 13 13 15 15 17 17 19 19 21 21 23 23 25 25 27 27 29 29 31 31 33 33 35 35 37 37 39 39 41 41 43 43 45 45 47 47 49 49 51 51 53 53 55 55 57 57 59 59 61 61 63 63 65 65 67 67 69 69 71 71 73 73 75 75 77 77 79 79 81 81 83 83 85 85 87 87 89 89 91 91 93 93 95 95 97 97 9...

output:

2103020658
597991945
978987000
1906362670
32240450
1489621132
13449271613
4694984590
58034151
7354720876
6760751762
158883138
668168
8591125692
5712201613
3280229612
411959808
4214160887
474951610
1247410
4970827813
7587834518
3511913998
2144530946
2889593722
5287749669
11117979225
1254278655
105705...

result:

ok 1000000 lines

Test #55:

score: 0
Accepted
time: 1488ms
memory: 220224kb

input:

500000 1000000
1 1 3 3 5 5 7 7 9 9 11 11 13 13 15 15 17 17 19 19 21 21 23 23 25 25 27 27 29 29 31 31 33 33 35 35 37 37 39 39 41 41 43 43 45 45 47 47 49 49 51 51 53 53 55 55 57 57 59 59 61 61 63 63 65 65 67 67 69 69 71 71 73 73 75 75 77 77 79 79 81 81 83 83 85 85 87 87 89 89 91 91 93 93 95 95 97 97 9...

output:

2051363749
381533607
4823177097
5429626495
1627366161
4083698072
2537945087
2912595784
378042505
1756084911
186979122
2450622595
1588933564
131269977
2314197959
1064045404
966090887
502302360
2550228289
1918742059
535326316
864724720
3900016788
100054658
3235810497
1048662249
4760748374
2067756618
1...

result:

ok 1000000 lines

Test #56:

score: 0
Accepted
time: 808ms
memory: 171132kb

input:

500000 1000000
445180 455215 327214 420325 22274 455699 354651 399791 366260 226865 268623 248659 403371 193158 499136 438756 348260 267038 350018 420231 202092 407225 270259 357341 170979 164383 14621 92641 422706 295796 348850 198082 248054 261707 415820 45918 70486 427651 490005 124088 62166 1474...

output:

15772
87455
246114
254626
6623
385
2531
256938
7666
209900
43915
67191
134695
211388
25126
25118
110810
55917
257724
109603
20353
135012
153756
19482
34035
7685
6435
42695
4969
827
265967
140010
58373
0
211403
40521
117739
135974
20845
17207
6826
165878
254862
77939
229438
141008
159169
17575
7772
5...

result:

ok 1000000 lines

Test #57:

score: 0
Accepted
time: 1483ms
memory: 219892kb

input:

500000 1000000
1 1 3 3 5 5 7 7 9 9 11 11 13 13 15 15 17 17 19 19 21 21 23 23 25 25 27 27 29 29 31 31 33 33 35 35 37 37 39 39 41 41 43 43 45 45 47 47 49 49 51 51 53 53 55 55 57 57 59 59 61 61 63 63 65 65 67 67 69 69 71 71 73 73 75 75 77 77 79 79 81 81 83 83 85 85 87 87 89 89 91 91 93 93 95 95 97 97 9...

output:

1180294068
1479200
436001456
592251819
1098043481
906375452
21760205
232308440
349826716
648167477
4825171
202256048
924639386
267752788
643772079
381888950
412936910
264
559202404
1132875563
1051133478
1721052928
234588129
1017530549
230415533
1154897892
803649402
1555108435
956167198
1293960851
93...

result:

ok 1000000 lines

Test #58:

score: 0
Accepted
time: 1500ms
memory: 222252kb

input:

500000 1000000
1 1 3 3 5 5 7 7 9 9 11 11 13 13 15 15 17 17 19 19 21 21 23 23 25 25 27 27 29 29 31 31 33 33 35 35 37 37 39 39 41 41 43 43 45 45 47 47 49 49 51 51 53 53 55 55 57 57 59 59 61 61 63 63 65 65 67 67 69 69 71 71 73 73 75 75 77 77 79 79 81 81 83 83 85 85 87 87 89 89 91 91 93 93 95 95 97 97 9...

output:

296399194
73777539
218402034
211294
138119678
217747166
212125986
361323824
274101111
230325678
28482118
469426248
313228651
58104394
485235615
19981294
130879951
392798188
311603940
416752937
38388758
97682
83898092
276772769
233537159
414662219
102064567
264191620
511102364
269881318
261992970
830...

result:

ok 1000000 lines

Test #59:

score: 0
Accepted
time: 1471ms
memory: 222620kb

input:

500000 1000000
1 1 3 3 5 5 7 7 9 9 11 11 13 13 15 15 17 17 19 19 21 21 23 23 25 25 27 27 29 29 31 31 33 33 35 35 37 37 39 39 41 41 43 43 45 45 47 47 49 49 51 51 53 53 55 55 57 57 59 59 61 61 63 63 65 65 67 67 69 69 71 71 73 73 75 75 77 77 79 79 81 81 83 83 85 85 87 87 89 89 91 91 93 93 95 95 97 97 9...

output:

11987305
73775956
91103411
4547604
16315995
115630760
168066150
156434988
178766442
9012080
62559984
1899130
80411052
150921848
28730759
155816266
137408428
63138241
171700179
52408927
22187596
23901870
4099812
140229564
66635604
84666614
167443156
46832112
144317934
18418711
20575333
5435697
128385...

result:

ok 1000000 lines

Test #60:

score: 0
Accepted
time: 1517ms
memory: 219808kb

input:

500000 1000000
1 1 3 3 5 5 7 7 9 9 11 11 13 13 15 15 17 17 19 19 21 21 23 23 25 25 27 27 29 29 31 31 33 33 35 35 37 37 39 39 41 41 43 43 45 45 47 47 49 49 51 51 53 53 55 55 57 57 59 59 61 61 63 63 65 65 67 67 69 69 71 71 73 73 75 75 77 77 79 79 81 81 83 83 85 85 87 87 89 89 91 91 93 93 95 95 97 97 9...

output:

20640052
41820479
51060910
69383907
58870538
32711175
14955557
10773176
61256001
15133081
38671739
16259678
15801013
5867050
22944210
73945796
16363298
55867048
64738206
295896
101050113
3564615
31691156
30760794
30245494
15896140
58161450
36786636
24160546
71735968
33825744
20114507
2672387
434940
...

result:

ok 1000000 lines

Test #61:

score: 0
Accepted
time: 1662ms
memory: 220736kb

input:

500000 1000000
1 1 3 3 5 5 7 7 9 9 11 11 13 13 15 15 17 17 19 19 21 21 23 23 25 25 27 27 29 29 31 31 33 33 35 35 37 37 39 39 41 41 43 43 45 45 47 47 49 49 51 51 53 53 55 55 57 57 59 59 61 61 63 63 65 65 67 67 69 69 71 71 73 73 75 75 77 77 79 79 81 81 83 83 85 85 87 87 89 89 91 91 93 93 95 95 97 97 9...

output:

3992004
9529959
56099968
9575564
74514902
64528264
22132097
141267539
20779618
14866204
385586
4833172
45644868
36360300
98245266
46310481
170768
2521017
1232350
4202099
214538348
2343650
77309835
5760912
79493
1675243
9584164
24517578
21095328
6448167
4776405
9036794
23931475
105945722
35517175
356...

result:

ok 1000000 lines

Test #62:

score: 0
Accepted
time: 1674ms
memory: 219508kb

input:

500000 1000000
1 1 3 3 5 5 7 7 9 9 11 11 13 13 15 15 17 17 19 19 21 21 23 23 25 25 27 27 29 29 31 31 33 33 35 35 37 37 39 39 41 41 43 43 45 45 47 47 49 49 51 51 53 53 55 55 57 57 59 59 61 61 63 63 65 65 67 67 69 69 71 71 73 73 75 75 77 77 79 79 81 81 83 83 85 85 87 87 89 89 91 91 93 93 95 95 97 97 9...

output:

179699721
3619192
1232187
2400920
68496456
3796858
3458212
11208110
150803110
17076271
20661975
31798804
148011312
193997265
24042670
403578
11138842
201692356
238561678
151202652
110364
394285283
6919108
838580
74588276
6707689
406827827
72293862
86832394
50973790
60453489
8160734
135888304
1364331...

result:

ok 1000000 lines

Test #63:

score: 0
Accepted
time: 1563ms
memory: 226000kb

input:

500000 1000000
1 1 3 3 5 5 7 7 9 9 11 11 13 13 15 15 17 17 19 19 21 21 23 23 25 25 27 27 29 29 29 31 33 33 35 35 37 37 39 39 41 41 43 43 45 45 47 47 49 49 51 51 53 53 55 55 57 57 59 59 59 61 63 63 65 65 67 67 69 69 71 71 73 73 75 75 77 77 79 79 81 81 83 83 85 85 87 87 89 89 89 91 93 93 95 95 97 97 9...

output:

192378264
1347825286
110389931
403868280
109893670
679932128
26065600
943389
25168378
62820937
31134977
115125946
65353778
616306123
885540397
273406122
27150492
152028
264454227
204903071
2114424
20116537
539107009
360307495
280216306
758764892
82362290
652521020
904372641
533584889
1717322546
8366...

result:

ok 1000000 lines

Test #64:

score: 0
Accepted
time: 1466ms
memory: 224076kb

input:

500000 1000000
1 1 3 3 5 5 7 7 9 9 9 11 13 13 15 15 17 17 19 19 19 21 23 23 25 25 27 27 29 29 29 31 33 33 35 35 37 37 39 39 39 41 43 43 45 45 47 47 49 49 49 51 53 53 55 55 57 57 59 59 59 61 63 63 65 65 67 67 69 69 69 71 73 73 75 75 77 77 79 79 79 81 83 83 85 85 87 87 89 89 89 91 93 93 95 95 97 97 99...

output:

3765132728
1543371380
10562675
1211474424
2522013943
116032174
494173826
1361713928
169439232
370320906
1948439072
448946872
528071061
5427242
4197622390
43745786
208807845
174231082
1163205364
3530377916
124076511
5138495556
1549502118
4135162894
30849382
7244537
1631728
2907042024
455017674
486841...

result:

ok 1000000 lines

Test #65:

score: 0
Accepted
time: 1220ms
memory: 206168kb

input:

500000 1000000
1 1 3 3 3 5 5 7 9 9 9 11 11 13 15 15 15 17 17 19 21 21 21 23 23 25 27 27 27 29 29 31 33 33 33 35 35 37 39 39 39 41 41 43 45 45 45 47 47 49 51 51 51 53 53 55 57 57 57 59 59 61 63 63 63 65 65 67 69 69 69 71 71 73 75 75 75 77 77 79 81 81 81 83 83 85 87 87 87 89 89 91 93 93 93 95 95 97 99...

output:

5266762166
7863002004
2900217232
6407992440
3855811050
1319899680
544677648
2044075837
3517495149
513116034
2318051738
135199307
781881841
1186228143
125254566
163903041
1180372056
8398117
96196100
5556609312
8564566
314824240
8070627152
1973595793
3007380041
4612144
3278647632
314867704
132168961
2...

result:

ok 1000000 lines

Test #66:

score: 0
Accepted
time: 1548ms
memory: 231696kb

input:

500000 1000000
1 2 3 4 4 6 7 8 8 10 11 12 12 14 15 16 16 18 19 20 20 22 23 24 24 26 27 28 28 30 31 32 32 34 35 36 36 38 39 40 40 42 43 44 44 46 47 48 48 50 51 52 52 54 55 56 56 58 59 60 60 62 63 64 64 66 67 68 68 70 71 72 72 74 75 76 76 78 79 80 80 82 83 84 84 86 87 88 88 90 91 92 92 94 95 96 96 98 ...

output:

32197107
4728143877
7467897884
4121158508
271508001
2619366804
2596717757
8872274147
18192352
2367917245
3221243529
2393851324
399949995
137663284
109956191
579689884
5499446037
798161372
1729977643
117288893
380864492
622939196
711902436
3205060070
922073
626851363
8941499035
3399064897
5836959993
...

result:

ok 1000000 lines

Test #67:

score: 0
Accepted
time: 851ms
memory: 168372kb

input:

500000 1000000
133884 24785 360217 217671 278862 472439 170831 170942 125323 445814 233587 105535 269832 180218 190470 240129 142870 388559 798 55171 55790 315422 360291 208114 278266 313142 249104 175417 105950 301163 110382 225996 206319 263098 176457 171101 362857 35618 301872 384272 266842 30822...

output:

39603
41402
24118
3290
19818
11297
11892
22974
48781
17114
6657
3290
6151
76516
1611
9401
9311
25777
22628
5135
572
195053
34266
33026
600
5690
10652
144653
19044
5733
12573
4628
8543
2958
2822
4139
1213
6736
11856
21618
7118
2609
129428
146
77271
7
88775
9737
777
2053
1850
13697
50366
19159
12675
6...

result:

ok 1000000 lines

Test #68:

score: 0
Accepted
time: 1512ms
memory: 233820kb

input:

500000 1000000
1 2 3 4 5 5 7 8 9 10 10 12 13 14 15 15 17 18 19 20 20 22 23 24 25 25 27 28 29 30 30 32 33 34 35 35 37 38 39 40 40 42 43 44 45 45 47 48 49 50 50 52 53 54 55 55 57 58 59 60 60 62 63 64 65 65 67 68 69 70 70 72 73 74 75 75 77 78 79 80 80 82 83 84 85 85 87 88 89 90 90 92 93 94 95 95 97 98 ...

output:

7559710615
5616410171
8328219142
5775410898
288086028
397484183
9550722523
2352605847
2972433989
3434217683
46375340
1394500086
346511463
4111077390
126871942
93091797
5495408117
2931322618
399984611
2759440784
875998174
588818656
1540732120
722690494
1524118310
935766706
6091899828
196332564
512203...

result:

ok 1000000 lines

Test #69:

score: 0
Accepted
time: 1560ms
memory: 236664kb

input:

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

output:

4629445721
2265282780
5785592471
4472562901
1425577
4450649186
380896607
4647336088
140241998
36997776
1892178214
1285935717
2454622774
31809406
36190677
615468739
1072120470
3414098032
5771743681
2769941074
3219923864
1717056349
3289809897
829632914
156827921
1288905709
1071687361
2631067899
354300...

result:

ok 1000000 lines

Test #70:

score: 0
Accepted
time: 1430ms
memory: 155628kb

input:

500000 1000000
250000 250001 250000 250001 250000 250001 250000 250001 250000 250001 250000 250001 250000 250001 250000 250001 250000 250001 250000 250001 250000 250001 250000 250001 250000 250001 250000 250001 250000 250001 250000 250001 250000 250001 250000 250001 250000 250001 250000 250001 25000...

output:

24789
91908
130205
5514
101102
44731
67854
0
101781
0
85572
49470
0
0
0
0
0
81273
92264
0
0
0
0
457
29047
0
0
0
0
0
153232
0
51138
0
28113
0
0
0
0
46992
0
0
0
28966
0
0
159706
0
0
63808
0
0
0
51490
0
51411
0
0
0
0
165040
28583
0
0
84064
76745
0
107208
35639
164906
35913
0
18490
52473
0
0
0
2244
0
11...

result:

ok 1000000 lines

Test #71:

score: 0
Accepted
time: 1424ms
memory: 155568kb

input:

500000 1000000
250000 250001 250002 250000 250001 250002 250000 250001 250002 250000 250001 250002 250000 250001 250002 250000 250001 250002 250000 250001 250002 250000 250001 250002 250000 250001 250002 250000 250001 250002 250000 250001 250002 250000 250001 250002 250000 250001 250002 250000 25000...

output:

0
130519
0
0
0
0
0
0
228085
0
0
0
268967
0
93017
230561
249405
0
0
53771
0
43387
0
0
0
170455
228689
116879
0
0
193809
0
135951
10233
51253
58579
6999
0
0
0
0
0
0
0
39361
237079
9533
268459
0
0
115137
0
0
151091
138675
47675
0
0
76605
0
0
0
0
26209
75727
287509
0
404517
0
67551
0
0
46893
121555
3011...

result:

ok 1000000 lines

Test #72:

score: 0
Accepted
time: 1773ms
memory: 185812kb

input:

500000 1000000
250000 250001 250002 250003 250004 250000 250001 250002 250003 250004 250000 250001 250002 250003 250004 250000 250001 250002 250003 250004 250000 250001 250002 250003 250004 250000 250001 250002 250003 250004 250000 250001 250002 250003 250004 250000 250001 250002 250003 250004 25000...

output:

0
0
119447
74363
316457
0
0
0
0
251912
431882
0
0
46808
102302
208541
413807
0
115886
547607
0
461000
0
190055
0
574664
35420
210863
4994
49841
431597
0
290882
191864
0
0
592790
0
0
0
553847
0
174623
239138
155192
409460
0
268523
0
319727
177416
12425
0
0
2582
0
139802
322793
0
321944
83852
71174
0
...

result:

ok 1000000 lines

Test #73:

score: 0
Accepted
time: 1737ms
memory: 186076kb

input:

500000 1000000
250000 250001 250002 250003 250004 250005 250006 250007 250008 250009 250000 250001 250002 250003 250004 250005 250006 250007 250008 250009 250000 250001 250002 250003 250004 250005 250006 250007 250008 250009 250000 250001 250002 250003 250004 250005 250006 250007 250008 250009 25000...

output:

321821
329476
0
706666
291231
1104426
282531
0
968691
0
813656
0
104291
0
244041
0
0
0
204761
0
0
0
0
141116
0
0
540221
0
0
0
0
0
0
0
15406
76441
0
0
35716
0
0
994366
0
0
0
0
1066051
278586
545001
115386
0
304771
0
198266
0
0
391101
422321
376706
0
0
0
640566
524591
0
18
479101
312926
0
25586
746581...

result:

ok 1000000 lines

Test #74:

score: 0
Accepted
time: 1775ms
memory: 179520kb

input:

500000 1000000
250000 250001 250002 250003 250004 250005 250006 250007 250008 250009 250010 250011 250012 250013 250014 250015 250016 250017 250018 250019 250020 250021 250022 250023 250024 250025 250026 250027 250028 250029 250000 250001 250002 250003 250004 250005 250006 250007 250008 250009 25001...

output:

2487786
161646
0
835851
0
0
1573776
992706
0
0
0
2118336
1320831
0
0
0
0
0
2116596
1267656
1382511
1383051
210951
0
866811
1285896
0
0
593496
0
172251
2842536
0
3201171
0
0
0
248631
433221
0
0
0
1846686
951246
0
0
650931
2561511
954201
0
1981881
248481
0
0
1093056
0
300636
1016211
1261416
0
0
0
0
71...

result:

ok 1000000 lines

Test #75:

score: 0
Accepted
time: 1842ms
memory: 176512kb

input:

500000 1000000
250000 250001 250002 250003 250004 250005 250006 250007 250008 250009 250010 250011 250012 250013 250014 250015 250016 250017 250018 250019 250020 250021 250022 250023 250024 250025 250026 250027 250028 250029 250030 250031 250032 250033 250034 250035 250036 250037 250038 250039 25004...

output:

5034976
0
1933326
6840226
0
188676
8913726
0
9922776
0
0
0
0
10770376
0
8288876
475176
3701126
0
9048576
6204326
0
3952076
3297826
0
3486676
0
0
0
0
1192426
0
8075426
1810626
0
0
0
0
5440376
0
836276
0
2181626
0
10399676
11084976
0
4846326
0
0
0
0
0
0
8674076
0
0
0
1362976
9971126
5442876
4713326
0
...

result:

ok 1000000 lines

Test #76:

score: 0
Accepted
time: 2093ms
memory: 178372kb

input:

500000 1000000
250000 250001 250002 250003 250004 250005 250006 250007 250008 250009 250010 250011 250012 250013 250014 250015 250016 250017 250018 250019 250020 250021 250022 250023 250024 250025 250026 250027 250028 250029 250030 250031 250032 250033 250034 250035 250036 250037 250038 250039 25004...

output:

26941626
17881176
30252576
0
0
0
0
0
13533126
0
11056926
0
0
10563276
19384176
0
4484676
0
2241276
0
0
0
0
15033126
22409376
6638076
0
8244126
10715676
13161126
0
0
14324976
0
1542726
0
23770926
0
25521126
0
0
0
4009026
19273926
0
0
0
0
0
27586026
4748226
0
22770426
2760426
0
3487776
6142776
6447876...

result:

ok 1000000 lines

Test #77:

score: 0
Accepted
time: 2930ms
memory: 177988kb

input:

500000 1000000
250000 250001 250002 250003 250004 250005 250006 250007 250008 250009 250010 250011 250012 250013 250014 250015 250016 250017 250018 250019 250020 250021 250022 250023 250024 250025 250026 250027 250028 250029 250030 250031 250032 250033 250034 250035 250036 250037 250038 250039 25004...

output:

0
75290251
0
0
0
17983251
0
21675251
0
45164751
61632751
0
0
1318751
84080251
0
0
3807751
0
17498751
0
59577751
0
63221751
0
0
24310751
0
17467251
66337751
75179251
37446751
0
0
0
0
0
90530251
0
0
36505251
9669251
0
30291251
26179751
77468751
0
36109251
77173751
24629751
51430251
114251251
12726251
...

result:

ok 1000000 lines

Test #78:

score: 0
Accepted
time: 851ms
memory: 174568kb

input:

500000 1000000
179273 424133 272660 64305 55721 147031 182723 94526 377579 108625 448000 448170 54981 114929 453837 431602 314092 196694 175846 296928 499382 341227 417455 257888 231798 423544 484685 187065 329215 65193 487883 162580 451310 423367 435151 452827 188923 388688 248145 472755 18526 2493...

output:

95024
157922
35045
49147
115478
15584
30
30684
3264
170752
27759
4187
108692
84144
6292
22967
58118
162270
48831
4500
9885
21921
156014
19650
32474
34528
50087
24618
62471
19701
70976
117470
3910
53766
29735
24534
130061
76273
22257
1114
67847
3625
21705
145031
658
2692
20673
912
13558
141848
134031...

result:

ok 1000000 lines

Test #79:

score: 0
Accepted
time: 1829ms
memory: 175948kb

input:

500000 1000000
250000 250001 250002 250003 250004 250005 250006 250007 250008 250009 250010 250011 250012 250013 250014 250015 250016 250017 250018 250019 250020 250021 250022 250023 250024 250025 250026 250027 250028 250029 250030 250031 250032 250033 250034 250035 250036 250037 250038 250039 25004...

output:

193585251
57739251
288436251
0
8932251
166088751
161989251
272243751
0
0
87451251
0
238751751
91081251
0
0
62770251
0
132313251
0
261755751
214217751
0
0
0
0
0
214771251
8233251
0
0
0
0
0
0
0
22249251
107515251
0
0
234383751
24530751
42004251
0
0
0
163502751
0
42775251
0
29362251
0
94885251
24339725...

result:

ok 1000000 lines

Test #80:

score: 0
Accepted
time: 1578ms
memory: 181192kb

input:

500000 1000000
250000 250001 250002 250003 250004 250005 250006 250007 250008 250009 250010 250011 250012 250013 250014 250015 250016 250017 250018 250019 250020 250021 250022 250023 250024 250025 250026 250027 250028 250029 250030 250031 250032 250033 250034 250035 250036 250037 250038 250039 25004...

output:

1021342501
916912501
0
209772501
842507501
53077501
0
56042501
0
0
0
0
0
0
311641984
0
361282501
481427501
0
978652501
232082501
0
0
0
0
410342501
0
217357501
0
511272501
0
0
716302501
0
352747501
0
0
0
0
0
0
401222501
0
0
85542501
985932501
0
214947501
174462501
468817501
0
0
530367501
0
255012501
...

result:

ok 1000000 lines

Test #81:

score: 0
Accepted
time: 1271ms
memory: 183588kb

input:

500000 1000000
250000 250001 250002 250003 250004 250005 250006 250007 250008 250009 250010 250011 250012 250013 250014 250015 250016 250017 250018 250019 250020 250021 250022 250023 250024 250025 250026 250027 250028 250029 250030 250031 250032 250033 250034 250035 250036 250037 250038 250039 25004...

output:

0
0
1267633147
0
0
0
0
0
4564411475
0
0
4522826722
1171643029
0
0
0
0
1760425001
0
0
0
1912916176
6622425001
0
0
1005200704
0
0
0
0
0
0
3032226163
0
0
269894703
0
47087046
0
0
0
0
0
1328725001
0
0
0
3021425001
283827226
0
0
156613503
0
0
5495825001
0
0
4861839143
0
4051313654
0
225176032
3632165222
...

result:

ok 1000000 lines

Test #82:

score: 0
Accepted
time: 809ms
memory: 181312kb

input:

500000 1000000
398739 438280 334713 18541 165774 119825 219318 158605 168414 126953 416929 415488 10850 220479 467944 367016 207168 426176 199705 331536 161815 196426 300982 418343 391254 337667 173326 415287 360657 370638 310098 231249 254687 463497 182236 356294 455022 136310 388031 25493 78442 18...

output:

17186
86977
283
16292
16531
47745
2434
5257
102744
58071
409352
99820
169349
68330
34635
13046
24106
55350
171719
365102
269988
125251
238305
179282
56959
27901
69361
14151
92225
91287
96168
31471
58024
30794
27896
271321
16148
170131
78965
6509
118975
63354
29465
128706
46338
127737
16091
378
36578...

result:

ok 1000000 lines