QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#133062#6630. Triangle Collectiontatyam#25 ✓92ms19904kbC++171.5kb2023-08-01 14:18:472024-07-04 01:05:06

Judging History

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

  • [2024-07-04 01:05:06]
  • 评测
  • 测评结果:25
  • 用时:92ms
  • 内存:19904kb
  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-08-01 14:18:47]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define all(a) begin(a), end(a)
using ll = long long;

/*
    l no nagai hou ga 3 honme no jouken ga yurui
    l no nagai hou kara, kisuu de amatteiru bou wo hirotteiku
    kore de hiroenai bou ha zettai ni tukaenai
    nokori ha pair ni natteru kara, l no mijikai pair kara kuzusu
    mod 3 dake nokotte, hoka ha zenbu tukaeru
    zettai ni tukaenai bou no kazu wo kazoeru
    segtree ni noru?
    
    l=1, l<=1, l=2, l=3, l<=3, ...
    zougen ga atte, ruisekiwa sita toki no minimum ga kotae
*/
struct T {
    ll add = 0, min = 0;
};
T operator+(T a, T b) {
    return {a.add + b.add, min(b.min, b.add + a.min)};
}
#ifdef DEBUG
const ll MAX = 1 << 3;
#else
const ll MAX = 1 << 19;
#endif
T seg[MAX * 2];
void add(ll i, ll x) {
    i += MAX;
    seg[i].min = min(0LL, seg[i].add += x);
    while(i >>= 1) seg[i] = seg[i << 1] + seg[i << 1 | 1];
}
ll get() {
    return seg[1].min;
}
int main() {
    cin.tie(0)->sync_with_stdio(0);
    ll N, Q;
    cin >> N >> Q;
    vector<ll> C(N);
    for(ll& c : C) cin >> c;
    ll num_edge = 0;
    C.insert(C.begin(), 0);
    for(ll l = 1; l <= N; l++) {
        ll& c = C[l];
        add(l, -(c % 2));
        add(l * 2 - 1, c / 2);
        num_edge += c;
    }
    
    while(Q--) {
        ll l, d;
        cin >> l >> d;
        ll& c = C[l];
        add(l, c % 2 - (c + d) % 2);
        add(l * 2 - 1, (c + d) / 2 - (c / 2));
        c += d;
        num_edge += d;
        cout << (num_edge + get()) / 3 << '\n';
    }
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 5
Accepted

Test #1:

score: 5
Accepted
time: 1ms
memory: 7612kb

input:

1 23
1485
1 -12
1 -30
1 -20
1 6
1 24
1 5
1 31
1 14
1 -34
1 -22
1 -45
1 37
1 46
1 9
1 22
1 -9
1 9
1 -46
1 -47
1 39
1 36
1 -36
1 50

output:

491
481
474
476
484
486
496
501
489
482
467
479
495
498
505
502
505
490
474
487
499
487
504

result:

ok 23 numbers

Test #2:

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

input:

12 1
13 79 59 21 32 13 85 40 74 15 49 56
3 31

output:

189

result:

ok 1 number(s): "189"

Test #3:

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

input:

50 1995
3 2 3 0 3 0 5 2 2 2 3 0 4 5 4 4 3 0 1 0 5 5 3 4 3 3 1 1 4 5 5 4 1 1 3 1 4 2 1 3 4 1 5 5 0 3 0 3 4 3
49 1
48 -2
45 3
49 0
31 -4
13 0
15 -2
48 0
38 -2
8 0
48 3
12 1
22 -4
7 -5
5 -1
3 1
15 -2
37 -4
39 -1
24 -2
11 2
35 -2
17 -1
41 -2
20 5
8 0
18 0
26 -3
25 -3
49 -5
31 4
46 -2
38 0
42 3
16 -4
5 3...

output:

44
44
45
45
43
43
43
43
42
42
43
43
42
40
40
40
40
38
38
37
38
37
37
36
38
38
38
37
36
34
36
35
35
36
35
36
36
37
36
37
37
38
38
38
39
38
37
36
36
35
36
36
36
36
35
35
35
35
33
35
35
34
34
33
34
35
36
36
35
35
37
36
36
36
35
35
35
35
35
36
37
37
37
36
37
36
38
38
38
39
39
38
38
38
37
39
39
41
40
40
...

result:

ok 1995 numbers

Test #4:

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

input:

50 1996
0 1 0 1 2 2 4 1 3 2 5 3 4 1 5 5 1 2 0 2 1 2 5 4 3 1 4 5 1 2 3 5 5 1 4 4 2 3 5 3 1 3 2 3 3 0 4 2 5 0
29 4
50 3
30 2
6 0
26 -1
13 -2
34 1
5 2
23 -5
45 1
30 -4
17 3
40 1
49 -5
24 -1
35 -2
12 -2
30 1
3 0
5 -3
38 0
14 -1
38 2
25 -3
25 0
26 2
20 1
24 2
43 1
27 -2
38 -2
12 3
43 1
4 3
13 1
25 2
26 -...

output:

44
45
46
46
46
45
45
46
44
45
43
44
45
43
43
42
41
42
42
41
41
40
41
40
40
41
41
42
42
41
41
42
42
43
43
44
44
44
44
45
45
46
47
47
47
46
46
44
44
44
44
44
44
44
43
43
42
41
41
42
43
43
45
45
45
45
45
45
45
44
43
44
44
44
45
44
45
46
45
44
43
43
43
43
43
44
44
44
46
45
43
44
44
44
43
44
45
44
44
44
...

result:

ok 1996 numbers

Test #5:

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

input:

50 1997
39 35 37 37 36 36 38 37 36 36 37 40 37 39 40 37 38 35 36 36 37 36 40 36 40 37 40 37 37 38 39 35 40 36 38 40 35 36 39 38 38 37 35 37 36 37 36 36 36 37
3 0
13 3
33 -3
24 2
25 0
9 3
18 2
11 0
28 2
39 -2
9 -2
5 -1
2 0
25 -3
25 3
47 1
10 4
34 2
8 -1
32 0
47 -2
17 -2
20 0
3 3
39 3
1 -4
18 2
35 0
3...

output:

620
621
620
621
621
622
622
622
623
622
622
621
621
620
621
622
623
624
623
623
623
622
622
623
624
623
623
623
622
622
623
623
624
624
624
625
624
623
622
621
620
619
618
617
615
616
617
617
618
616
616
617
616
616
616
617
619
618
617
617
617
618
619
618
619
618
619
620
619
619
620
621
620
620
621
...

result:

ok 1997 numbers

Test #6:

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

input:

2000 2000
2 1 2 1 4 1 5 1 0 0 1 2 0 2 2 0 2 1 0 0 1 0 1 1 1 0 4 1 0 0 5 2 1 0 1 6 0 0 1 1 1 0 0 0 0 1 1 0 0 2 0 0 1 1 0 1 1 1 0 0 1 0 3 0 0 0 2 1 0 1 2 0 0 3 2 1 0 0 0 0 1 1 0 1 2 0 0 0 0 0 2 3 0 2 0 4 0 1 2 0 0 0 1 0 1 5 0 0 0 4 0 0 1 2 3 0 1 0 1 0 1 0 2 0 1 0 1 2 1 1 2 1 0 2 0 0 0 2 3 6 1 0 0 0 1 ...

output:

649
649
649
649
649
649
649
649
648
648
649
649
649
649
649
649
649
650
650
650
650
650
650
650
650
649
650
650
649
650
650
650
650
650
650
650
650
649
649
649
649
648
650
650
650
650
650
650
649
649
649
649
650
650
650
650
650
650
650
650
650
651
651
651
651
651
651
651
651
651
651
651
650
652
652
...

result:

ok 2000 numbers

Test #7:

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

input:

2000 2000
0 1 3 1 1 4 0 0 1 0 1 0 0 0 1 0 0 1 0 2 1 0 0 4 0 0 1 0 0 2 0 0 0 0 1 0 2 1 0 1 0 2 0 5 0 0 1 0 2 0 0 0 1 1 1 0 0 0 1 0 0 0 0 0 4 3 0 0 1 1 0 0 3 0 0 0 0 1 8 0 0 0 0 2 0 0 0 0 0 0 0 0 2 0 0 2 0 0 0 0 3 2 0 1 1 4 2 4 2 2 0 3 0 1 0 0 3 0 3 0 0 0 5 1 0 0 0 0 2 1 1 0 1 1 1 0 0 5 2 4 0 0 0 1 0 ...

output:

666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
665
664
666
666
666
666
666
666
666
666
665
665
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
665
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
...

result:

ok 2000 numbers

Test #8:

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

input:

1000 2000
2 8 1 1 4 1 1 1 2 1 1 2 1 2 1 3 1 1 3 2 1 2 2 1 2 2 2 3 5 1 1 2 1 5 4 1 1 1 2 1 1 1 1 2 2 1 1 2 1 1 2 2 4 2 1 4 2 1 1 2 5 1 4 2 3 1 4 4 1 1 2 1 1 2 2 1 1 1 2 1 1 2 3 2 1 1 2 1 1 1 1 1 1 1 1 3 1 2 1 2 1 1 1 1 2 1 4 3 2 1 3 1 6 4 1 2 2 3 1 2 5 1 1 3 3 2 2 1 2 1 1 2 3 6 1 1 3 2 2 1 2 3 1 2 1 ...

output:

660
660
660
660
659
659
658
659
659
659
659
659
659
659
660
660
660
659
658
658
659
659
659
659
657
658
659
659
658
657
656
657
658
658
658
657
656
656
657
657
657
657
657
657
656
657
656
655
656
656
656
657
657
657
655
655
656
656
657
657
657
657
657
657
656
657
655
653
655
654
655
656
655
654
655
...

result:

ok 2000 numbers

Test #9:

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

input:

2000 2000
1 2 0 2 2 0 2 0 2 0 1 1 1 0 1 1 1 1 1 2 0 1 0 2 0 1 2 1 1 2 0 2 2 1 1 0 0 2 0 1 1 1 2 2 2 2 2 0 2 2 1 0 1 2 2 0 1 2 2 2 0 0 0 1 0 0 1 1 1 1 1 1 1 2 0 0 0 0 2 1 1 1 2 0 1 2 1 2 0 1 0 2 2 1 2 1 0 2 2 1 0 0 0 2 0 1 0 1 1 1 0 0 1 0 0 2 2 2 0 2 2 0 0 1 2 2 0 1 0 1 1 1 1 1 0 2 2 1 1 0 1 0 1 2 1 ...

output:

652
652
652
652
652
652
653
653
653
653
653
653
653
653
654
655
655
655
654
655
654
653
653
654
653
654
655
654
654
653
653
652
653
654
654
655
656
656
655
654
654
654
655
655
655
656
657
657
657
657
657
657
658
659
659
660
661
660
661
660
660
660
659
659
658
657
656
657
657
657
656
656
656
656
657
...

result:

ok 2000 numbers

Test #10:

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

input:

2000 2000
0 3 0 0 2 1 0 0 0 0 1 0 1 0 5 0 0 0 2 5 2 0 0 3 1 0 3 2 0 0 3 0 1 0 4 0 1 0 0 2 2 0 0 0 3 0 0 0 0 2 3 1 0 1 1 0 7 3 1 1 2 0 0 0 0 0 2 0 1 0 0 0 1 0 0 1 2 0 2 1 1 0 2 0 0 0 1 0 0 0 0 0 1 0 0 2 0 0 0 0 1 1 1 1 1 0 0 2 0 5 2 0 1 0 5 1 2 3 2 1 0 0 0 1 1 0 0 0 1 2 1 0 1 1 0 0 0 0 2 0 3 0 1 2 0 ...

output:

666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
665
665
664
665
665
665
664
664
664
664
664
663
664
663
663
662
662
662
662
662
662
662
662
662
662
662
662
661
661
661
661
661
661
660
660
660
660
660
661
661
661
661
661
661
662
662
662
661
660
660
...

result:

ok 2000 numbers

Test #11:

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

input:

2000 2000
0 2 0 1 0 2 1 0 0 0 0 0 2 1 2 0 0 0 0 0 0 0 0 1 0 0 1 1 4 2 0 0 2 0 1 0 3 1 2 1 0 1 1 2 0 2 0 1 0 0 0 1 0 1 0 1 2 0 0 0 0 0 0 2 2 0 0 0 2 0 1 2 4 0 0 0 0 5 0 1 3 1 2 1 3 0 2 4 0 2 1 2 1 0 0 1 0 1 6 0 0 1 0 4 0 0 2 0 0 3 0 1 1 0 0 3 3 0 0 3 4 0 0 0 0 0 0 0 0 1 2 2 0 0 1 0 0 0 1 2 0 0 7 0 0 ...

output:

658
658
658
658
658
657
656
656
656
655
655
654
654
654
654
654
654
654
654
654
654
654
654
654
654
654
653
652
652
652
651
651
650
650
650
650
650
650
650
650
650
650
650
650
650
650
650
650
650
650
649
649
649
649
648
648
648
648
648
648
648
648
647
646
646
645
645
645
645
645
645
645
645
645
645
...

result:

ok 2000 numbers

Test #12:

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

input:

2000 2000
1 0 1 1 0 0 1 0 1 0 1 1 0 1 0 1 0 0 0 1 1 0 1 1 1 0 1 0 0 1 0 0 1 1 1 0 1 0 0 0 0 1 0 1 0 1 0 1 1 0 1 0 1 1 1 1 1 1 1 0 0 1 1 0 1 1 0 0 0 1 1 0 1 1 1 1 0 1 0 1 0 1 0 0 0 0 1 1 1 1 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 1 1 0 0 1 0 0 1 1 0 1 1 0 1 0 1 1 1 1 1 0 0 1 1 1 1 1 1 0 1 0 1 0 0 0 ...

output:

152
0
185
0
404
1
402
1
366
2
27
2
179
3
459
3
423
3
389
3
285
3
324
4
167
4
99
5
379
5
395
5
412
5
360
5
222
6
341
7
31
7
10
8
101
8
202
9
262
9
211
9
118
9
274
9
71
10
102
11
61
11
329
12
106
12
236
13
226
13
441
14
87
15
416
15
502
15
188
16
409
16
276
16
413
17
324
17
213
18
437
18
164
18
364
18...

result:

ok 2000 numbers

Test #13:

score: 0
Accepted
time: 2ms
memory: 7764kb

input:

2000 2000
1 0 1 0 0 0 1 1 0 1 1 1 0 1 0 0 1 0 1 0 0 0 0 0 0 0 1 1 1 0 0 0 1 0 0 0 1 0 0 1 0 1 1 1 1 0 0 0 1 0 0 0 0 1 1 1 0 1 1 1 1 0 0 1 1 1 1 1 1 1 1 1 0 1 1 0 1 1 0 1 0 1 1 0 0 1 0 1 1 0 1 0 1 0 0 0 0 1 0 1 0 1 0 0 1 0 1 0 0 1 0 1 1 0 1 1 1 1 1 0 1 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 1 0 1 0 0 1 0 0 ...

output:

331
1
422
1
340
1
452
1
303
1
456
0
432
1
1
1
278
2
186
2
404
2
400
2
365
2
462
2
330
3
435
3
74
4
409
3
261
4
413
3
405
3
244
2
316
2
126
2
73
3
5
3
59
4
204
3
190
4
54
3
135
4
258
4
92
4
115
3
90
4
131
4
375
4
6
4
276
4
61
4
278
5
269
5
232
6
319
5
270
5
455
5
368
5
31
5
381
6
224
5
58
5
222
5
395...

result:

ok 2000 numbers

Test #14:

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

input:

1000 2000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

355
1
485
0
199
0
49
0
146
0
226
0
99
0
373
0
200
0
318
0
226
0
69
0
65
0
163
0
249
0
365
0
427
0
400
0
116
0
50
0
71
0
326
0
319
0
132
0
480
0
177
0
381
0
145
0
209
0
161
0
276
0
463
0
113
0
292
0
255
0
320
0
192
0
385
0
343
0
454
0
295
0
469
0
181
0
403
0
209
0
335
0
103
0
135
0
143
0
27
0
407
0
3...

result:

ok 2000 numbers

Subtask #2:

score: 5
Accepted

Dependency #1:

100%
Accepted

Test #15:

score: 5
Accepted
time: 1ms
memory: 7672kb

input:

1 31
90776133
1 5009167
1 4129242
1 400355
1 -7556806
1 -4958489
1 -281120
1 -5292169
1 1337751
1 -38693
1 706169
1 470842
1 -8936304
1 7512180
1 733496
1 -9987641
1 1994575
1 8431617
1 2232187
1 2299272
1 1321472
1 2043728
1 -2916688
1 2050656
1 7149635
1 515185
1 -4759482
1 3482860
1 9529438
1 363...

output:

31928433
33304847
33438299
30919363
29266534
29172827
27408771
27854688
27841790
28077180
28234127
25255359
27759419
28003918
24674704
25339562
28150101
28894164
29660588
30101078
30782321
29810092
30493644
32876855
33048584
31462090
32623043
35799522
37012262
38169488
36655505

result:

ok 31 numbers

Test #16:

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

input:

19 1
659060262 95878602 966370867 69420814 493217564 31019702 461451241 835666046 588474103 531368017 62183603 510896424 685443424 404947330 132329458 479633598 891034001 535806232 372317811
17 9490412

output:

2938669837

result:

ok 1 number(s): "2938669837"

Test #17:

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

input:

2000 2000
162084344 436843710 358173252 310905875 968306406 211711300 943259830 502430816 441258186 320301877 565532170 371180862 752084851 699196925 421680932 869901714 326935295 660084722 302629624 757255318 239149948 473974651 436774671 874686026 686399549 973895056 208607203 740619591 423203577 ...

output:

368073964995
368073964150
368073949113
368073919532
368073890158
368073858425
368073830401
368073821861
368073789295
368073780661
368073747338
368073714948
368073694869
368073671899
368073649376
368073644437
368073633562
368073606838
368073577252
368073552008
368073550565
368073547320
368073538507
3...

result:

ok 2000 numbers

Test #18:

score: 0
Accepted
time: 2ms
memory: 7832kb

input:

2000 2000
753846532 993373170 280436647 438688198 983630837 485734113 792368876 624354806 839252029 14196549 735759057 746776996 265882427 602483537 765795294 768750291 173708522 922574422 139667451 382797044 670996254 595041826 199708608 725814062 884918448 49693869 392604651 471535513 942006443 37...

output:

333141617145
333152087183
333325370421
333172970289
333103172526
333322804363
333417773269
333674421026
333722689668
333453356312
333212746799
333120866161
333240156648
333170337561
333178746648
333026045451
333134007511
333120153109
332941790789
333108872219
333294704365
333431894052
333463526719
3...

result:

ok 2000 numbers

Test #19:

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

input:

2000 2000
407789153 70662581 219526632 437836682 807275480 690467956 159710313 563216540 895284937 857159912 734772097 721636729 271193351 469519333 895572047 795354433 921523055 151056026 518265568 504080214 357649039 743474690 526710399 478175178 152196994 552905228 110801168 366587052 501986801 2...

output:

336803501189
336803501188
336803501188
336803501188
336803501187
336803501187
336803501187
336803501187
336803501187
336803501187
336803501187
336803501187
336803501187
336803501187
336803501187
336803501187
336803501187
336803501186
336803501186
336803501186
336803501187
336803501187
336803501187
3...

result:

ok 2000 numbers

Test #20:

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

input:

2000 2000
987707620 975396966 961408793 973694008 969484823 958083923 999050608 902341565 978785145 925024411 921955741 906724730 916228330 925866950 945857652 902986236 944659374 923830390 982903839 972903745 970791528 900504335 962090391 912896249 974500305 963863983 940428127 968335088 915697310 ...

output:

634100415554
634100415554
634100415554
634100415554
634100415555
634100415554
634100415555
634100415554
634100415555
634100415555
634100415555
634100415556
634100415555
634100415556
634100415556
634100415556
634100415557
634100415557
634100415557
634100415558
634100415558
634100415558
634100415558
6...

result:

ok 2000 numbers

Test #21:

score: 0
Accepted
time: 2ms
memory: 7776kb

input:

2000 2000
2 5 2 1 1 4 5 2 5 4 0 3 4 1 2 1 1 0 1 2 4 3 1 2 2 0 3 5 2 3 5 4 0 0 1 1 3 2 4 4 5 0 3 2 3 5 5 5 3 5 5 1 1 5 1 4 2 2 0 5 3 3 2 0 0 1 5 0 4 0 3 4 3 3 0 3 3 4 4 1 3 0 5 2 0 0 0 0 0 4 3 0 2 1 0 2 1 2 4 2 2 2 4 4 0 0 2 5 5 2 4 5 3 3 2 4 4 4 1 1 4 3 0 2 0 4 4 2 5 5 2 4 4 3 3 0 2 1 1 2 2 4 5 0 1 ...

output:

1668
1668
1668
1668
1669
1669
1669
1669
1669
1668
1669
1669
1669
1669
1669
1669
1669
1669
1669
1670
1669
1670
1670
1670
1670
1670
1671
1671
1671
1671
1671
1670
1671
1670
1670
1670
1670
1670
1670
1670
1670
1670
1671
1670
1670
1670
1669
1669
1669
1668
1669
1669
1669
1670
1670
1670
1670
1670
1670
1670
...

result:

ok 2000 numbers

Test #22:

score: 0
Accepted
time: 2ms
memory: 7748kb

input:

2000 2000
1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000...

output:

666666666666
666666666666
666666666666
666666666666
666666666666
666666666666
666666666666
666666666666
666666666666
666666666666
666666666666
666666666666
666666666666
666666666666
666666666666
666666666666
666666666666
666666666666
666666666666
666666666666
666666666666
666666666666
666666666666
6...

result:

ok 2000 numbers

Test #23:

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

input:

2000 2000
1 5 2 0 4 2 5 1 1 1 2 5 4 1 3 3 3 0 0 5 3 3 1 3 3 0 1 4 2 4 2 2 1 0 3 3 1 3 0 4 3 5 2 5 1 2 3 1 3 0 5 4 4 4 2 2 5 2 2 1 1 5 2 1 2 3 2 3 2 4 2 4 4 4 3 4 0 5 5 2 2 1 3 5 0 5 4 5 3 4 3 5 1 4 0 5 1 1 1 4 4 5 4 0 4 4 3 1 5 5 4 3 2 2 0 1 3 0 5 1 3 1 5 2 2 1 0 0 0 1 0 1 5 4 4 2 0 0 1 0 0 2 5 5 3 ...

output:

5960477
1674
32967072
1674
95580382
1674
165099937
1675
203136522
1674
244676241
1674
225378646
1674
88890353
1675
177918789
1675
37710670
1675
38972464
1675
224743266
1675
88266668
1675
113565728
1675
39668716
1675
246490359
1675
14272340
1675
309948771
1675
117140885
1675
69710182
1675
173150398
1...

result:

ok 2000 numbers

Test #24:

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

input:

2000 2000
3 3 4 4 4 5 0 3 4 4 2 4 2 3 3 1 0 4 4 3 0 5 2 0 0 1 3 0 2 4 4 5 5 0 5 5 1 1 2 0 2 5 0 5 3 2 4 5 5 3 4 0 4 1 1 1 3 5 4 5 2 0 4 3 5 5 3 4 3 0 3 5 2 0 5 5 1 2 1 1 5 1 4 0 2 2 5 2 3 2 2 5 1 0 1 4 5 3 3 3 4 1 0 0 5 5 4 2 3 4 1 2 0 3 4 1 4 1 2 1 3 4 3 2 5 0 0 1 3 0 1 4 1 5 3 3 5 0 2 1 0 4 0 0 1 ...

output:

215459153
1667
166786009
1668
266965833
1667
315507911
1668
109555372
1668
274991551
1668
53978420
1668
181434140
1668
253924886
1667
86801451
1667
13384350
1667
253129798
1667
205705483
1667
156283845
1667
41882845
1667
39473707
1667
142619529
1667
95644230
1667
158829972
1667
272289015
1667
155932...

result:

ok 2000 numbers

Test #25:

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

input:

2000 2000
354846426 290995266 423217081 784021468 480884766 566434453 751275347 136274310 859799176 705341228 636898037 956347222 929147842 999260938 166882560 651735273 706918515 489985471 165721293 949254328 194205333 905305149 323339911 278525642 731461577 87065051 260283466 728965785 31386322 82...

output:

338762965967
338759342386
338804576203
338759342387
338818803605
338759342386
338764156034
338759342387
338837461649
338759342387
338876806347
338759342387
338760302159
338759342387
338782138373
338759342387
338992334506
338759342386
339013866231
338759342386
339036680780
338759342386
338784602760
3...

result:

ok 2000 numbers

Test #26:

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

input:

2000 2000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

220341399
0
253932463
0
58138452
0
116222513
0
104199078
0
6489552
0
137738905
0
169117449
0
22432156
0
308938037
0
269275751
0
27900591
0
145317543
0
39351277
0
197471629
0
317234733
0
103274227
0
233986626
0
212574352
0
256023605
0
271406410
0
289063963
0
25098472
0
50283092
0
47697134
0
255469262...

result:

ok 2000 numbers

Test #27:

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

input:

2000 2000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

904
1
536
2
517
3
209
4
1391
5
1426
6
893
7
1031
8
276
9
268
9
790
10
788
11
475
12
379
12
784
13
1381
14
154
14
1122
14
458
15
825
16
823
17
449
18
881
18
736
19
1316
20
418
20
186
20
240
20
932
20
1047
20
1109
20
661
20
231
21
699
22
329
22
545
22
1459
22
1354
22
275
22
1514
22
1242
23
615
23
1220...

result:

ok 2000 numbers

Subtask #3:

score: 5
Accepted

Test #28:

score: 5
Accepted
time: 0ms
memory: 7852kb

input:

1999 2000
1 1 1 1 0 2 0 2 1 0 2 1 2 2 2 1 2 0 0 1 2 2 0 1 0 1 0 2 0 0 2 1 1 1 1 0 1 2 1 2 1 1 1 1 1 0 2 2 0 2 1 1 2 0 0 2 0 0 2 1 2 0 0 1 1 2 0 2 2 2 1 2 0 2 1 2 0 1 2 2 2 1 1 2 1 1 1 1 0 0 1 1 0 1 2 1 0 0 2 0 2 2 2 0 1 1 2 0 0 1 0 0 2 1 2 1 2 0 1 1 2 2 0 0 1 2 2 1 2 1 2 2 2 0 0 1 1 2 1 1 2 2 2 2 2 ...

output:

660
660
660
661
661
661
661
660
660
660
660
661
662
662
663
663
662
661
662
662
661
660
661
660
660
660
661
661
661
661
662
661
661
660
661
660
659
658
658
659
659
658
659
660
660
660
660
660
660
659
659
659
659
659
659
659
659
660
659
658
658
658
658
657
657
657
658
657
656
657
657
657
656
656
655
...

result:

ok 2000 numbers

Test #29:

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

input:

2000 2000
0 1 1 0 0 0 0 1 1 2 0 2 1 2 0 0 0 0 1 0 0 1 2 0 1 1 0 0 1 2 1 1 2 2 2 1 1 2 0 2 2 0 1 0 1 2 2 0 2 0 0 2 0 1 2 2 0 1 0 1 0 1 0 2 0 2 1 2 1 1 0 1 2 0 1 1 1 2 0 2 1 1 2 1 2 0 1 0 0 0 0 2 2 0 2 2 0 2 2 1 0 1 2 1 0 2 0 1 1 2 2 0 0 0 0 2 0 2 2 1 1 1 2 2 0 1 2 0 2 1 0 1 1 2 2 2 0 0 0 0 1 0 0 2 1 ...

output:

679
679
679
679
679
679
679
678
679
678
678
678
679
678
679
678
678
678
678
678
677
678
677
678
678
678
679
678
678
678
678
678
677
677
677
678
677
678
678
678
678
678
678
678
679
678
679
679
679
680
680
680
680
680
680
679
678
677
676
677
676
676
677
676
675
674
674
674
674
674
674
673
673
672
672
...

result:

ok 2000 numbers

Test #30:

score: 0
Accepted
time: 31ms
memory: 7732kb

input:

10 200000
1 2 2 2 2 1 0 2 2 2
10 -1
3 0
5 0
10 -1
10 0
3 0
5 0
7 1
9 -2
10 2
2 -2
6 -1
6 0
8 -1
4 -2
2 0
5 -1
8 1
1 1
4 1
1 -2
3 0
4 1
9 0
9 0
6 1
7 -1
4 -2
2 1
6 0
8 0
3 0
5 -1
10 -1
5 2
9 1
1 0
6 -1
2 0
9 1
2 1
4 2
5 -2
7 1
3 0
1 2
9 0
5 1
1 -1
6 2
6 -2
9 -1
8 -2
6 1
2 -2
1 -1
10 -1
2 0
8 2
6 -1
2...

output:

5
5
5
4
4
4
4
5
4
5
4
4
4
3
3
3
2
3
3
3
3
3
3
3
3
3
3
2
3
3
3
3
2
2
3
3
3
3
3
3
3
4
3
4
4
4
4
5
4
5
4
4
3
3
2
2
2
2
3
3
3
3
2
3
2
2
2
2
2
2
2
3
3
3
2
2
2
1
1
1
1
0
0
0
0
0
0
0
1
1
1
1
2
2
2
2
2
2
2
2
2
2
1
1
1
0
0
0
0
0
0
0
0
1
1
1
1
2
2
2
2
2
3
3
3
2
2
3
3
2
2
2
2
2
2
2
2
2
2
2
2
3
3
3
4
4
4
3
3
4
...

result:

ok 200000 numbers

Test #31:

score: 0
Accepted
time: 69ms
memory: 18588kb

input:

200000 200000
2 0 1 2 2 0 2 0 1 1 1 2 0 1 1 0 1 2 2 1 1 0 0 1 0 1 0 1 0 2 1 1 2 0 2 2 2 2 2 0 0 1 1 0 1 1 0 1 0 1 0 0 0 0 1 1 0 0 2 1 2 1 0 1 1 2 0 2 2 0 0 0 1 2 1 2 0 0 0 0 2 2 2 0 2 1 1 1 0 0 0 2 1 1 0 1 0 1 1 2 2 1 1 1 0 2 2 2 2 0 2 1 1 0 0 1 2 0 2 0 2 1 0 2 0 0 1 1 0 1 0 2 0 1 2 0 2 0 1 2 0 2 1 ...

output:

66738
66738
66738
66738
66738
66739
66739
66739
66740
66739
66739
66739
66738
66739
66740
66739
66738
66739
66738
66738
66738
66739
66739
66739
66738
66739
66739
66738
66738
66737
66736
66736
66736
66737
66736
66735
66736
66735
66735
66736
66736
66736
66736
66735
66734
66733
66733
66733
66732
66732
...

result:

ok 200000 numbers

Test #32:

score: 0
Accepted
time: 65ms
memory: 18280kb

input:

200000 200000
2 1 1 1 1 2 0 0 1 2 1 0 0 2 2 1 0 0 1 1 0 1 2 0 1 0 2 0 1 2 2 2 2 0 0 1 2 2 1 2 1 2 1 2 0 0 0 0 2 0 2 2 0 2 2 1 2 2 1 1 2 0 0 0 0 1 0 0 2 1 1 2 2 1 1 0 1 0 0 2 2 0 0 2 1 2 1 1 2 1 0 1 2 1 2 1 1 2 1 1 1 1 2 2 2 1 1 2 0 1 0 2 0 2 2 2 2 1 0 1 1 0 0 0 2 2 2 2 2 0 1 0 0 2 1 0 2 2 2 2 2 2 2 ...

output:

66650
66650
66650
66650
66650
66650
66650
66650
66651
66650
66649
66649
66649
66648
66648
66648
66648
66648
66648
66648
66647
66646
66647
66647
66648
66648
66648
66648
66649
66649
66649
66649
66649
66649
66648
66648
66648
66649
66649
66648
66648
66648
66648
66648
66648
66647
66647
66647
66648
66647
...

result:

ok 200000 numbers

Test #33:

score: 0
Accepted
time: 76ms
memory: 18592kb

input:

200000 200000
0 1 2 1 1 1 1 0 2 2 2 1 0 2 2 1 0 1 0 1 1 2 0 0 0 2 0 0 2 0 2 0 0 1 0 2 0 1 0 2 1 0 2 2 1 0 0 1 2 0 1 0 1 2 0 0 2 0 2 1 2 2 2 1 1 2 1 0 2 1 0 0 1 2 1 1 0 1 0 0 2 0 0 0 2 1 0 1 0 2 0 1 1 0 2 0 0 0 1 2 2 0 2 0 0 0 2 1 1 1 2 1 2 2 2 1 0 1 1 2 0 2 2 2 1 1 0 0 1 1 2 0 2 1 1 0 2 2 1 0 2 2 1 ...

output:

66621
66621
66621
66621
66621
66621
66621
66621
66622
66622
66622
66622
66621
66621
66621
66621
66621
66621
66621
66621
66621
66621
66621
66621
66621
66621
66621
66621
66621
66621
66621
66621
66621
66622
66622
66623
66623
66622
66622
66623
66623
66623
66622
66622
66622
66622
66622
66622
66622
66622
...

result:

ok 200000 numbers

Test #34:

score: 0
Accepted
time: 67ms
memory: 19904kb

input:

200000 200000
2 0 0 2 2 0 2 0 2 0 0 0 2 2 0 0 1 0 0 2 1 2 1 2 0 0 2 0 2 0 0 0 0 1 2 0 2 0 1 2 0 2 0 0 0 0 0 1 0 1 0 0 1 0 0 1 0 1 2 2 0 1 1 0 0 0 1 1 2 0 2 0 1 0 2 2 0 0 2 1 2 0 2 0 1 0 2 2 0 0 2 1 0 0 2 1 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 2 0 2 1 0 0 0 0 0 2 1 1 0 1 0 0 2 2 0 2 0 0 2 0 1 0 0 2 0 0 1 1 ...

output:

49939
49939
49939
49938
49938
49939
49939
49939
49939
49939
49939
49939
49940
49940
49940
49940
49940
49940
49941
49940
49940
49940
49941
49940
49941
49941
49941
49941
49941
49941
49942
49941
49942
49942
49942
49942
49943
49943
49943
49943
49943
49943
49943
49943
49943
49944
49945
49945
49945
49945
...

result:

ok 200000 numbers

Subtask #4:

score: 5
Accepted

Test #35:

score: 5
Accepted
time: 0ms
memory: 7848kb

input:

2000 1999
0 1 0 3 0 1 0 0 0 0 0 0 0 2 0 0 0 0 3 1 1 0 2 0 0 3 0 0 0 0 0 4 0 0 1 0 1 0 0 0 0 1 2 1 0 0 0 0 7 0 1 3 1 0 1 1 0 3 2 1 0 1 1 3 3 1 0 2 0 0 0 0 0 0 0 0 1 0 0 0 2 0 0 0 0 0 1 2 3 0 1 0 3 3 0 0 0 0 1 0 1 2 0 0 2 2 0 1 2 1 2 0 0 0 1 1 0 1 2 0 0 0 0 2 0 5 0 0 0 0 0 1 0 0 2 0 1 2 0 1 0 0 0 2 0 ...

output:

666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
666
665
665
665
665
665
665
665
665
665
665
665
665
665
665
665
665
665
666
666
666
666
666
666
666
666
666
666
666
666
666
665
...

result:

ok 1999 numbers

Test #36:

score: 0
Accepted
time: 2ms
memory: 7844kb

input:

1999 2000
938865181 635701131 720186551 12098533 888342577 819466162 677119886 695501777 87063160 544120940 280740814 953384275 462378756 394423771 769842478 563100233 988726627 938258387 941725041 202877851 608668845 507891555 488072389 600920090 738211573 440041095 584208199 334345340 587249363 60...

output:

334310744804
334310744804
334310744805
334310744805
334310744805
334310744805
334310744805
334310744806
334310744805
334310744805
334310744805
334310744805
334310744805
334310744805
334310744805
334310744805
334310744805
334310744805
334310744805
334310744804
334310744805
334310744804
334310744805
3...

result:

ok 2000 numbers

Test #37:

score: 0
Accepted
time: 2ms
memory: 7780kb

input:

1998 2000
953983734 995770518 938631730 961951570 959332856 972648102 943061680 904445058 924304353 960622114 906426330 931936027 957313612 965894280 965137632 988149861 916855162 928712995 923621242 962852409 971372933 948162818 943268160 970351693 997138667 985041992 953192885 954772005 986919660 ...

output:

632914970666
632914970667
632914970666
632914970666
632914970666
632914970665
632914970666
632914970666
632914970666
632914970667
632914970667
632914970667
632914970666
632914970667
632914970666
632914970667
632914970667
632914970667
632914970668
632914970667
632914970668
632914970667
632914970667
6...

result:

ok 2000 numbers

Test #38:

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

input:

2000 1999
0 5 4 1 3 4 1 3 1 0 0 1 4 0 3 5 5 2 3 0 5 3 3 4 5 3 5 5 0 3 4 5 4 0 2 0 0 4 0 5 5 2 2 3 5 5 4 0 3 2 2 2 0 4 5 4 2 2 5 1 5 5 1 4 5 2 0 4 3 1 5 4 5 1 0 3 0 5 2 4 3 0 4 1 2 5 4 1 4 4 1 0 4 1 0 3 5 5 5 3 4 5 5 1 5 5 5 0 0 2 5 0 3 3 2 4 2 1 3 5 3 4 2 5 2 3 2 3 4 5 1 1 2 3 4 3 3 4 2 0 4 0 0 2 1 ...

output:

1655
1655
1656
1656
1656
1655
1655
1655
1656
1656
1656
1655
1656
1656
1656
1657
1657
1657
1657
1657
1658
1657
1658
1657
1657
1657
1657
1657
1657
1657
1656
1657
1656
1656
1656
1655
1656
1656
1656
1656
1656
1657
1657
1657
1657
1657
1658
1657
1657
1657
1657
1657
1657
1657
1657
1657
1657
1657
1657
1657
...

result:

ok 1999 numbers

Test #39:

score: 0
Accepted
time: 73ms
memory: 18520kb

input:

200000 200000
1 4 9 4 6 9 5 8 4 7 8 5 8 4 5 0 10 1 2 5 5 6 2 1 2 5 7 7 5 9 6 6 1 4 6 6 4 2 10 9 6 0 9 10 1 5 7 4 7 5 9 10 0 2 6 10 4 3 7 2 7 7 10 0 5 1 2 2 0 8 10 6 7 4 4 10 0 7 0 8 8 8 6 5 6 5 1 5 10 5 9 3 9 3 6 6 7 7 9 7 5 7 0 7 1 3 7 9 5 0 0 9 10 3 5 3 2 1 8 4 1 0 8 5 7 6 1 1 4 5 1 6 5 3 6 1 5 5 ...

output:

332845
332845
332846
332845
332845
332845
332844
332844
332844
332845
332844
332845
332844
332844
332844
332843
332843
332843
332842
332842
332842
332842
332842
332843
332843
332843
332844
332843
332843
332843
332844
332843
332843
332843
332842
332843
332842
332842
332842
332842
332842
332841
332842...

result:

ok 200000 numbers

Test #40:

score: 0
Accepted
time: 84ms
memory: 18916kb

input:

200000 200000
85713646 336686856 538585247 278110438 233218655 716436104 837912968 251689084 911446322 701433421 627692917 334396123 413292301 8832435 188412011 689794769 286917079 209754313 519445483 105763643 27705054 168552468 752722351 829700685 747331109 706042730 418755558 614136831 2655911 80...

output:

33341754832470
33341754832470
33341754832471
33341754832470
33341754832471
33341754832470
33341754832470
33341754832470
33341754832470
33341754832470
33341754832470
33341754832470
33341754832471
33341754832470
33341754832471
33341754832470
33341754832471
33341754832471
33341754832471
33341754832472
...

result:

ok 200000 numbers

Test #41:

score: 0
Accepted
time: 80ms
memory: 18024kb

input:

200000 200000
635910513 530707612 43308926 653927427 953772413 886338816 149455282 24772774 715587632 555119024 702589377 349422399 13059257 305480192 768707679 77455076 588537505 275449414 881106189 997605463 699449988 579049544 439144233 339940611 677203754 952180230 954696649 608213997 944927273 ...

output:

33346597165806
33346597165806
33346597165806
33346597165805
33346597165805
33346597165805
33346597165804
33346597165804
33346597165804
33346597165803
33346597165803
33346597165803
33346597165802
33346597165802
33346597165802
33346597165801
33346597165801
33346597165801
33346597165800
33346597165800
...

result:

ok 200000 numbers

Test #42:

score: 0
Accepted
time: 83ms
memory: 18684kb

input:

200000 200000
323842684 404575711 975846485 26692339 484624497 479820673 79145839 690422479 435950749 721344329 55972947 946532807 537527876 632207792 134109985 92150997 282767325 50309244 942832532 291033288 394196176 355961510 210549616 639079458 254823064 129598231 941770957 38138695 661229827 98...

output:

33357361283426
33357361283426
33357361283427
33357361283427
33357361283427
33357361283428
33357361283428
33357361283428
33357361283429
33357361283429
33357361283429
33357361283430
33357361283430
33357361283430
33357361283431
33357361283431
33357361283431
33357361283432
33357361283432
33357361283432
...

result:

ok 200000 numbers

Test #43:

score: 0
Accepted
time: 81ms
memory: 19004kb

input:

200000 200000
1000000000 1000000000 1000000000 999999999 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 999999999 1000000000 999999999 1000000000 1000000000 999999999 999999999 1000000000 1000000000 999999999 1000000000 999999999 1000000000 1000000000 1000000000 1000000000 1000000...

output:

66666666633339
66666666633339
66666666633339
66666666633338
66666666633338
66666666633338
66666666633339
66666666633339
66666666633339
66666666633339
66666666633339
66666666633339
66666666633339
66666666633339
66666666633339
66666666633339
66666666633339
66666666633339
66666666633339
66666666633338
...

result:

ok 200000 numbers

Subtask #5:

score: 5
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Test #44:

score: 5
Accepted
time: 92ms
memory: 18732kb

input:

200000 200000
736468657 538679635 706379823 169689054 366866199 805610438 103497552 132191825 363576629 921923236 877858007 876024682 263755100 791891165 131189319 827448577 543484657 524257851 883352395 102842115 528411986 946567333 426246502 173918855 192872838 592210940 556837273 14702444 9116715...

output:

33336269301690
33336354577302
33336381623868
33336094705808
33336024166998
33336238217007
33335965404581
33335775366153
33336025368020
33336051227581
33335881737163
33336070114059
33336104294810
33336002741562
33335880248663
33335977481331
33335862341382
33336032828398
33336305423784
33336408262909
...

result:

ok 200000 numbers

Test #45:

score: 0
Accepted
time: 84ms
memory: 18016kb

input:

200000 200000
548020696 517218344 129616063 436134369 279240519 800560229 636517404 197218464 546709432 174933349 541583481 388863197 728374615 969410535 566480902 744057755 557050232 379581984 914463502 121554919 863279160 898853130 821130328 492587335 663518797 655322934 920119338 626938902 447548...

output:

33381159547131
33381159547131
33381159547134
33381159547131
33381159547134
33381159547137
33381159547135
33381159547136
33381159547132
33381159547134
33381159547134
33381159547133
33381159547130
33381159547130
33381159547132
33381159547130
33381159547130
33381159547132
33381159547130
33381159547133
...

result:

ok 200000 numbers

Test #46:

score: 0
Accepted
time: 91ms
memory: 19704kb

input:

200000 200000
919142416 969842650 969486090 983816113 923441397 955083893 924562337 914833117 945950381 968631043 950055993 953683802 972892921 959826433 916116770 927598445 958933265 995994238 916493422 950940100 904148725 930485690 909772746 968481675 999124431 947882051 949348762 933861007 906882...

output:

63337193511755
63337199284691
63337219943934
63337241136027
63337237673613
63337259732098
63337256811772
63337249188578
63337247651605
63337253700259
63337251196907
63337268755222
63337279862099
63337280516793
63337267815590
63337284887688
63337279600145
63337281828474
63337290049550
63337297758281
...

result:

ok 200000 numbers

Test #47:

score: 0
Accepted
time: 69ms
memory: 19404kb

input:

200000 200000
2 2 5 1 4 1 1 2 0 5 2 2 3 5 1 0 1 2 2 0 5 3 5 4 1 0 1 1 1 5 4 1 3 3 4 4 4 2 2 0 2 5 2 3 1 0 0 4 2 1 5 5 1 4 4 0 2 5 2 4 3 5 1 3 4 5 4 1 5 5 5 1 5 3 5 4 2 3 0 5 2 4 2 1 2 4 3 2 1 3 5 2 5 1 1 1 1 5 0 5 1 0 1 5 2 0 1 3 1 5 4 0 5 5 2 0 0 3 4 0 1 1 1 4 0 3 0 4 2 2 4 3 5 4 2 4 1 0 0 1 3 5 1 ...

output:

166996
166997
166998
166999
166999
166999
166999
166998
166997
166998
166998
167000
166998
166999
167000
167000
167000
166999
166999
166999
166999
167000
167000
167000
167001
167000
166999
166998
166997
166997
166997
166997
166996
166995
166996
166997
166996
166997
166995
166994
166994
166995
166995...

result:

ok 200000 numbers

Test #48:

score: 0
Accepted
time: 62ms
memory: 18028kb

input:

200000 200000
1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 ...

output:

66666666666666
66666666666666
66666666666666
66666666666666
66666666666666
66666666666666
66666666666666
66666666666666
66666666666666
66666666666666
66666666666666
66666666666666
66666666666666
66666666666666
66666666666666
66666666666666
66666666666666
66666666666666
66666666666666
66666666666666
...

result:

ok 200000 numbers

Test #49:

score: 0
Accepted
time: 80ms
memory: 19044kb

input:

200000 200000
4 0 3 3 2 2 0 5 2 5 3 4 0 4 0 2 2 1 1 0 2 0 4 3 1 5 1 4 1 1 2 2 2 2 2 3 4 3 0 0 2 2 1 1 2 4 1 1 5 4 1 5 5 0 2 1 3 1 1 2 5 0 0 3 3 4 3 2 2 2 1 1 4 0 0 0 1 0 3 0 5 0 5 5 1 4 2 5 1 3 3 4 2 4 2 5 3 2 3 2 4 0 4 2 0 4 2 1 5 4 4 4 2 3 3 1 1 4 0 1 3 2 4 4 5 4 1 3 3 4 2 1 2 3 0 5 3 1 2 0 2 3 4 ...

output:

187453252
166427
118225830
166427
214946801
166427
210888946
166428
186550250
166427
319366205
166428
124592015
166427
111979933
166427
26682736
166428
202557335
166428
68449100
166428
59305535
166429
118749083
166429
96598834
166429
176915252
166428
145524053
166428
187663282
166429
260561951
16642...

result:

ok 200000 numbers

Test #50:

score: 0
Accepted
time: 66ms
memory: 18836kb

input:

200000 200000
0 1 5 5 3 1 1 4 3 1 4 0 2 0 2 1 2 5 0 4 1 3 0 4 0 4 3 5 3 3 4 4 4 3 2 5 1 2 3 5 4 2 5 4 2 1 2 2 5 0 0 4 1 1 2 3 2 0 4 0 2 5 3 2 3 2 1 4 1 1 3 2 2 2 1 5 5 0 3 5 2 3 0 4 0 3 0 3 1 4 5 1 0 3 3 4 4 1 1 3 2 2 3 4 0 3 2 1 5 5 5 0 0 5 0 2 1 4 4 2 5 3 3 5 3 1 4 0 1 1 5 4 1 5 5 5 5 0 3 0 1 4 1 ...

output:

299285663
166455
303933351
166455
16022681
166455
210957218
166455
20723933
166455
322452292
166455
107560998
166455
88535312
166455
252876669
166455
278986480
166455
92729034
166455
173216707
166455
49879596
166455
261724717
166455
325786963
166455
245834718
166455
312693933
166455
220247679
166455...

result:

ok 200000 numbers

Test #51:

score: 0
Accepted
time: 86ms
memory: 19516kb

input:

200000 200000
792793254 632265398 486182026 220674650 822559982 958594145 18707095 714623363 656006028 643635232 863217086 756781493 369986705 76491634 397874839 691558583 604101317 403221021 25267523 228799276 537599869 135217641 303153150 183092979 280664259 988637580 572601309 538988913 460665963...

output:

33373914380882
33373653353935
33373890064401
33373653353935
33373683972879
33373653353935
33373653669970
33373653353934
33373726544585
33373653353934
33373818952655
33373653353934
33373797262634
33373653353934
33373670500427
33373653353934
33373667557178
33373653353934
33373684103867
33373653353934
...

result:

ok 200000 numbers

Test #52:

score: 0
Accepted
time: 68ms
memory: 18028kb

input:

200000 200000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

302191216
0
223546219
0
83861385
0
81075895
0
200185061
0
244340611
0
236967715
0
190883307
0
118476464
0
89553146
0
74224326
0
78482450
0
230120066
0
13540746
0
331158672
0
135336947
0
1006082
0
292229837
0
10126662
0
179697240
0
177229464
0
104882346
0
40338016
0
210879210
0
188715514
0
63556747
0...

result:

ok 200000 numbers

Test #53:

score: 0
Accepted
time: 66ms
memory: 19016kb

input:

200000 200000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

118333
1
83911
2
104525
3
40211
3
102538
3
20167
3
58030
3
76535
4
25445
5
110839
5
35472
6
124060
6
2493
7
24370
7
27067
7
10416
8
111133
9
40656
10
93807
10
2123
10
34812
10
69881
10
27779
11
48039
12
134248
13
79713
13
149439
13
21893
13
21575
14
50377
15
126199
16
85636
17
96227
17
76781
17
1913...

result:

ok 200000 numbers

Extra Test:

score: 0
Extra Test Passed