QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#487182#4929. Longest Unfriendly SubsequenceZhaoZiLong34 1452ms5196kbC++111.3kb2024-07-22 17:31:192024-07-22 17:31:20

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 11ms
memory: 4256kb

input:

1
200000
259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 259021863 2...

output:


result:

wrong answer 1st lines differ - expected: '1', found: ''

Subtask #2:

score: 6
Accepted

Test #15:

score: 6
Accepted
time: 1ms
memory: 4764kb

input:

3
5
1 2 1 2 1
7
1 2 3 2 1 2 3
8
1 10 10 1 1 100 100 1

output:

2
6
4

result:

ok 3 lines

Test #16:

score: 6
Accepted
time: 522ms
memory: 4588kb

input:

28653
6
372076545 832760265 372076545 644300403 644300403 644300403
8
540046638 375129642 863244619 863244619 375129642 540046638 540046638 540046638
6
142783193 508154499 871683432 71368434 871683432 871683432
8
760894385 984189193 760894385 323542350 984189193 760894385 323542350 323542350
6
84093...

output:

3
4
4
6
4
4
3
4
5
4
5
4
2
4
5
5
4
3
5
5
4
4
4
5
6
4
2
3
4
3
2
3
4
3
8
4
5
5
4
6
4
5
5
5
4
6
6
4
3
3
7
5
3
7
3
4
6
6
5
4
3
3
6
3
6
4
3
4
4
7
3
4
5
4
5
1
3
6
4
4
4
4
2
3
4
2
5
3
4
2
2
3
4
3
6
3
5
3
4
5
3
3
4
4
5
3
5
4
4
6
5
6
6
4
5
4
5
5
3
4
3
4
4
2
4
4
6
5
4
3
3
2
3
5
4
5
3
3
4
7
4
5
5
2
5
2
4
4
5
4
...

result:

ok 28653 lines

Test #17:

score: 6
Accepted
time: 473ms
memory: 4576kb

input:

27269
6
959945170 761436985 26703386 942397980 959945170 26703386
8
547832867 143323747 65089190 143323747 768500236 65089190 143323747 768500236
5
858824238 403652496 456662012 403652496 361827479
7
434065011 434065011 434065011 217272832 959441476 434065011 441896572
7
436828348 383866500 43682834...

output:

6
7
4
5
3
4
6
4
4
4
6
6
4
5
4
5
5
5
4
4
2
5
5
4
5
3
5
4
7
2
4
7
7
6
3
6
4
6
6
4
5
5
5
4
2
3
6
4
4
5
4
5
5
2
4
5
4
5
5
4
5
7
5
3
4
4
6
4
6
3
4
6
3
5
5
5
5
3
6
6
4
2
5
5
7
5
4
6
4
5
3
3
3
4
5
3
5
4
4
4
4
4
5
5
3
5
5
8
5
4
4
3
3
4
6
3
7
6
2
8
5
4
5
5
3
4
4
6
3
5
5
3
6
6
5
5
5
6
7
5
6
4
4
5
5
3
2
6
6
4
...

result:

ok 27269 lines

Test #18:

score: 6
Accepted
time: 400ms
memory: 4704kb

input:

24412
6
37652408 37652408 731951637 684367047 944732733 37652408
6
699823488 800701256 800701256 168169055 800701256 699823488
7
198445595 198445595 25271422 198445595 61301798 198445595 432743062
6
942430095 168670839 942430095 570524923 942430095 570524923
6
500326576 65482727 500326576 809311072 ...

output:

5
4
5
4
4
5
5
5
4
4
6
3
4
5
6
3
5
5
6
5
5
4
6
6
7
5
6
6
5
4
7
4
5
2
5
4
4
6
5
6
6
4
6
5
4
6
6
4
5
7
5
6
5
4
4
5
6
5
4
3
5
5
4
3
5
5
5
6
2
3
5
4
3
5
5
6
3
4
6
5
5
6
5
6
5
4
3
7
6
5
4
3
5
3
6
5
6
4
5
5
7
5
5
4
5
4
7
6
6
4
4
3
4
4
4
4
5
5
4
5
5
2
5
5
5
4
4
6
6
3
6
4
4
6
6
6
5
3
4
4
4
5
4
5
3
4
4
4
7
6
...

result:

ok 24412 lines

Subtask #3:

score: 8
Accepted

Test #19:

score: 8
Accepted
time: 11ms
memory: 4584kb

input:

1
500
537076440 691668159 871942500 537076440 537076440 691668159 871942500 871942500 537076440 691668159 871942500 537076440 691668159 871942500 537076440 691668159 871942500 537076440 691668159 871942500 537076440 691668159 871942500 871942500 537076440 691668159 871942500 537076440 537076440 6916...

output:

361

result:

ok single line: '361'

Test #20:

score: 8
Accepted
time: 15ms
memory: 4712kb

input:

1
500
584142119 101442702 335815880 584142119 101442702 335815880 584142119 101442702 335815880 584142119 101442702 335815880 584142119 101442702 101442702 335815880 335815880 584142119 584142119 101442702 101442702 335815880 584142119 101442702 335815880 584142119 101442702 335815880 584142119 1014...

output:

394

result:

ok single line: '394'

Test #21:

score: 8
Accepted
time: 15ms
memory: 4764kb

input:

1
500
296341737 806184542 989331127 989331127 296341737 806184542 455929030 296341737 806184542 806184542 806184542 989331127 296341737 806184542 989331127 296341737 806184542 989331127 296341737 806184542 989331127 296341737 806184542 806184542 989331127 296341737 296341737 296341737 806184542 9893...

output:

339

result:

ok single line: '339'

Test #22:

score: 8
Accepted
time: 15ms
memory: 4536kb

input:

1
500
361183277 863317163 788070566 361183277 361183277 863317163 788070566 361183277 632739493 788070566 788070566 361183277 863317163 788070566 361183277 863317163 788070566 361183277 863317163 788070566 361183277 863317163 788070566 361183277 863317163 788070566 361183277 863317163 788070566 3611...

output:

353

result:

ok single line: '353'

Test #23:

score: 8
Accepted
time: 15ms
memory: 4704kb

input:

1
500
360892412 146618517 575516781 360892412 146618517 575516781 360892412 146618517 575516781 360892412 146618517 575516781 360892412 146618517 575516781 360892412 146618517 575516781 360892412 146618517 575516781 360892412 146618517 575516781 360892412 146618517 575516781 360892412 146618517 5755...

output:

423

result:

ok single line: '423'

Test #24:

score: 8
Accepted
time: 7ms
memory: 4768kb

input:

3
68
975239020 470667175 323925950 975239020 470667175 323925950 975239020 470667175 323925950 975239020 470667175 323925950 975239020 470667175 323925950 975239020 470667175 323925950 323925950 323925950 975239020 470667175 323925950 975239020 470667175 323925950 323925950 975239020 470667175 32392...

output:

48
386
3

result:

ok 3 lines

Test #25:

score: 8
Accepted
time: 3ms
memory: 4672kb

input:

3
118
150373656 793064947 635264518 635264518 709296672 793064947 635264518 709296672 709296672 709296672 793064947 635264518 709296672 793064947 635264518 709296672 793064947 793064947 635264518 709296672 793064947 793064947 635264518 709296672 793064947 635264518 709296672 793064947 635264518 7092...

output:

97
230
33

result:

ok 3 lines

Test #26:

score: 8
Accepted
time: 3ms
memory: 4592kb

input:

3
113
89789132 548906728 545868627 545868627 89789132 548906728 545868627 89789132 548906728 545868627 89789132 548906728 545868627 89789132 548906728 545868627 89789132 548906728 545868627 89789132 548906728 545868627 89789132 548906728 545868627 89789132 548906728 545868627 89789132 548906728 5458...

output:

101
127
137

result:

ok 3 lines

Test #27:

score: 8
Accepted
time: 4ms
memory: 4548kb

input:

3
108
794907019 802850140 730657927 730657927 794907019 794907019 802850140 730657927 794907019 802850140 730657927 794907019 794907019 802850140 802850140 730657927 794907019 802850140 730657927 730657927 794907019 802850140 802850140 802850140 802850140 730657927 794907019 802850140 730657927 7306...

output:

78
71
236

result:

ok 3 lines

Test #28:

score: 8
Accepted
time: 6ms
memory: 4592kb

input:

3
55
382906854 86510837 1801762 382906854 86510837 1801762 382906854 382906854 578362690 1801762 382906854 86510837 1801762 382906854 86510837 1801762 1801762 382906854 86510837 1801762 382906854 86510837 1801762 382906854 86510837 1801762 382906854 86510837 382906854 1801762 86510837 382906854 1801...

output:

43
81
289

result:

ok 3 lines

Test #29:

score: 8
Accepted
time: 1ms
memory: 4764kb

input:

20
38
68789463 462582466 279061055 68789463 536943437 279061055 68789463 536943437 279061055 68789463 536943437 279061055 68789463 536943437 279061055 68789463 536943437 279061055 68789463 536943437 279061055 68789463 536943437 279061055 68789463 536943437 279061055 536943437 68789463 279061055 5369...

output:

32
18
20
76
24
7
5
9
5
42
34
25
14
4
10
29
8
16
31
9

result:

ok 20 lines

Test #30:

score: 8
Accepted
time: 0ms
memory: 4588kb

input:

100
8
594931073 674884200 594931073 960542002 674884200 594931073 404937349 674884200
3
28762160 795234252 28762160
6
693736695 693736695 515596726 693736695 568079150 515596726
2
508417829 600345257
4
637967683 731409954 197653780 548314174
9
493559887 493559887 995798571 234632692 493559887 995798...

output:

7
2
4
2
4
7
3
3
3
1
8
1
5
3
1
1
2
5
3
10
3
1
3
6
4
5
5
1
6
2
2
6
9
9
2
7
3
5
8
1
7
11
3
4
3
12
1
1
5
2
4
8
1
1
9
4
1
4
3
14
3
2
1
2
2
3
2
5
4
6
2
9
3
2
5
1
2
9
1
10
3
19
7
2
2
5
1
15
1
1
6
11
1
1
2
1
2
5
8
4

result:

ok 100 lines

Test #31:

score: 8
Accepted
time: 16ms
memory: 4704kb

input:

1
500
3 2 2 3 1 1 1 2 3 2 2 1 3 1 3 3 1 1 3 1 1 2 3 1 1 1 2 2 1 2 1 3 3 2 3 3 2 2 1 2 3 1 2 2 3 3 1 3 3 3 3 3 2 1 2 3 1 3 1 2 1 3 3 1 1 1 1 3 3 1 1 3 3 1 1 1 3 3 2 3 1 1 1 1 1 1 2 1 1 3 1 3 2 1 3 3 1 3 1 1 1 2 3 3 2 1 3 3 3 2 1 3 3 3 1 3 3 1 3 2 2 2 1 1 1 1 3 3 1 2 1 2 2 2 3 3 1 1 1 3 2 3 1 3 3 2 1 ...

output:

162

result:

ok single line: '162'

Test #32:

score: 8
Accepted
time: 17ms
memory: 4716kb

input:

1
500
1 1 1 2 2 1 2 3 2 1 1 3 1 1 1 3 2 3 2 2 1 2 2 3 3 1 3 3 3 2 3 2 2 3 2 3 1 3 1 1 3 2 1 3 3 1 3 2 3 1 3 1 3 2 2 1 1 3 1 2 1 1 1 3 1 2 2 2 2 3 2 3 3 2 1 1 3 2 3 3 3 2 2 2 2 1 1 3 1 1 3 1 3 1 2 1 2 3 2 2 3 1 3 1 1 1 3 3 1 3 3 2 2 1 3 3 1 1 3 1 2 3 3 2 1 2 1 3 1 1 1 2 1 3 1 1 2 1 2 3 3 2 1 3 2 3 2 ...

output:

170

result:

ok single line: '170'

Test #33:

score: 8
Accepted
time: 17ms
memory: 4568kb

input:

1
500
1 3 1 3 1 1 3 1 2 2 1 1 1 1 1 3 3 2 2 3 2 2 1 2 3 1 2 1 3 1 1 1 1 1 3 3 1 3 3 1 1 3 3 3 1 3 1 3 1 2 1 1 2 2 2 1 3 3 2 2 3 3 1 2 3 1 2 3 1 1 1 2 2 1 1 1 2 3 1 3 2 1 1 1 3 3 1 1 1 1 3 2 2 3 3 1 2 2 2 1 3 3 3 1 2 2 1 3 3 2 2 2 1 3 1 2 3 1 2 1 3 3 2 2 2 3 2 1 1 2 1 1 1 1 3 1 3 1 2 1 2 2 2 3 2 1 3 ...

output:

171

result:

ok single line: '171'

Test #34:

score: 8
Accepted
time: 3ms
memory: 4540kb

input:

3
226
2 2 2 3 3 3 3 1 2 1 2 1 3 3 3 2 2 2 1 3 3 3 2 3 3 3 2 2 2 3 3 2 1 2 3 1 3 2 2 3 3 1 2 2 3 1 2 3 1 3 2 1 3 1 2 3 3 3 3 1 3 2 1 3 3 1 1 2 1 3 1 3 1 3 2 2 2 2 1 2 2 2 2 1 2 1 1 3 1 2 2 2 1 2 3 3 1 1 3 3 1 1 2 1 3 3 3 2 3 3 1 3 2 1 2 1 2 3 1 3 3 2 2 2 3 3 3 2 2 3 2 2 1 1 2 2 3 2 2 2 2 3 2 1 2 2 3 ...

output:

81
106
57

result:

ok 3 lines

Test #35:

score: 8
Accepted
time: 2ms
memory: 4508kb

input:

20
23
3 2 3 2 2 1 3 3 1 2 3 1 2 2 2 1 2 1 3 1 1 2 1
19
2 2 3 3 1 2 2 2 3 1 2 3 3 3 1 1 1 2 1
12
2 3 3 2 3 1 3 1 3 2 2 1
39
1 2 1 1 2 2 2 1 2 2 2 1 1 1 3 2 3 1 1 2 1 3 2 2 3 2 2 2 3 1 2 1 3 1 2 1 1 2 1
21
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
24
1 2 3 1 1 1 2 3 1 2 3 2 1 3 3 2 1 3 2 1 3 2 1 3
15
...

output:

10
10
6
11
1
17
6
35
4
2
5
4
3
19
79
22
2
2
5
22

result:

ok 20 lines

Test #36:

score: 8
Accepted
time: 0ms
memory: 4760kb

input:

100
2
1 2
2
1 3
4
2 3 1 2
3
1 1 2
1
3
3
1 2 2
1
3
6
1 2 1 1 3 2
2
3 3
3
3 3 1
5
3 1 3 3 1
1
1
4
3 1 3 3
15
2 3 2 3 2 3 1 3 1 2 2 1 1 1 2
2
3 2
4
2 3 3 3
6
2 2 2 2 1 3
15
1 3 2 1 3 3 1 1 3 3 3 1 2 1 2
4
1 2 3 3
3
2 1 1
9
3 3 3 1 1 2 3 2 1
4
1 1 1 3
11
2 2 3 1 3 2 2 2 2 2 2
5
1 2 1 3 2
4
3 1 3 3
9
3 2...

output:

2
2
4
2
1
2
1
4
1
2
2
1
2
6
2
2
3
7
3
2
5
2
4
4
2
5
4
2
6
5
2
5
2
2
5
5
3
7
6
2
3
2
2
2
1
2
5
2
3
5
2
3
5
7
4
2
2
1
1
15
3
2
3
1
3
1
5
3
2
4
1
2
6
2
5
1
2
4
1
1
1
2
7
2
3
6
1
3
2
4
5
1
2
3
5
1
3
4
2
3

result:

ok 100 lines

Test #37:

score: 8
Accepted
time: 42ms
memory: 4700kb

input:

1
500
455886399 626955833 421163133 892575355 805049331 975659748 741071093 875911704 113500223 113500223 661192282 597935861 597935861 262970158 495955172 153851712 234849549 887929988 887929988 887929988 887929988 542128740 727090845 727090845 685055701 224058754 37318791 519705695 83375459 722649...

output:

469

result:

ok single line: '469'

Test #38:

score: 8
Accepted
time: 42ms
memory: 4584kb

input:

1
500
29435243 925769090 446792611 21667712 789719595 410464435 789287785 96845859 690771702 190228530 64528308 200770249 815748901 521046227 312297467 316401902 401409002 745745759 124319941 371122503 512242376 34813204 305249842 744963641 43370519 348889633 348889633 47719027 937000032 168595842 1...

output:

477

result:

ok single line: '477'

Test #39:

score: 8
Accepted
time: 42ms
memory: 4540kb

input:

1
500
602984088 664773836 177454793 1016966 334198372 285460610 132471773 172555823 678108588 569521673 975831156 698378851 695351143 743016550 389745384 304682329 700880753 700880753 914143778 268616886 223218955 837422858 549920713 672348418 767277498 618713431 61983854 68335376 960714345 60895712...

output:

477

result:

ok single line: '477'

Test #40:

score: 8
Accepted
time: 26ms
memory: 4748kb

input:

1
500
271946887 695308006 271946887 271946887 294535481 695308006 294535481 271946887 271946887 294535481 271946887 695308006 294535481 294535481 271946887 294535481 271946887 695308006 271946887 695308006 294535481 695308006 294535481 271946887 294535481 695308006 294535481 695308006 271946887 6953...

output:

241

result:

ok single line: '241'

Test #41:

score: 8
Accepted
time: 18ms
memory: 4720kb

input:

1
500
720937483 17827429 720937483 971419328 720937483 17827429 971419328 720937483 17827429 720937483 971419328 17827429 720937483 971419328 17827429 971419328 17827429 971419328 720937483 971419328 17827429 720937483 17827429 720937483 971419328 720937483 971419328 720937483 17827429 971419328 178...

output:

232

result:

ok single line: '232'

Test #42:

score: 8
Accepted
time: 20ms
memory: 4544kb

input:

1
500
45706846 591376273 45706846 591376273 45706846 591376273 186758449 45706846 591376273 45706846 591376273 186758449 591376273 186758449 591376273 45706846 186758449 591376273 45706846 186758449 591376273 591376273 186758449 591376273 45706846 591376273 186758449 591376273 186758449 45706846 591...

output:

253

result:

ok single line: '253'

Test #43:

score: 8
Accepted
time: 19ms
memory: 4704kb

input:

1
500
282927666 282927666 484147677 484147677 282927666 484147677 282927666 484147677 282927666 484147677 484147677 282927666 484147677 282927666 484147677 282927666 484147677 282927666 484147677 282927666 484147677 282927666 484147677 484147677 282927666 282927666 484147677 282927666 484147677 2829...

output:

49

result:

ok single line: '49'

Test #44:

score: 8
Accepted
time: 15ms
memory: 4724kb

input:

1
500
151443807 223152423 151443807 223152423 151443807 223152423 151443807 223152423 223152423 151443807 223152423 151443807 223152423 151443807 223152423 151443807 223152423 151443807 223152423 151443807 223152423 151443807 223152423 151443807 223152423 151443807 223152423 151443807 223152423 1514...

output:

14

result:

ok single line: '14'

Test #45:

score: 8
Accepted
time: 28ms
memory: 4540kb

input:

1
500
579768459 816932976 579768459 816932976 579768459 816932976 579768459 579768459 816932976 579768459 327660977 579768459 327660977 327660977 579768459 327660977 579768459 327660977 579768459 327660977 579768459 327660977 579768459 327660977 579768459 327660977 579768459 327660977 327660977 5797...

output:

28

result:

ok single line: '28'

Test #46:

score: 8
Accepted
time: 40ms
memory: 4680kb

input:

1
500
414505640 887314173 414505640 205268028 414505640 887314173 414505640 827649339 887314173 827649339 348309219 827649339 887314173 827649339 348309219 827649339 887314173 827649339 348309219 827649339 887314173 827649339 144164301 887314173 144164301 155363834 144164301 887314173 144164301 7702...

output:

346

result:

ok single line: '346'

Test #47:

score: 8
Accepted
time: 41ms
memory: 4748kb

input:

1
500
671728328 441054685 671728328 645366031 671728328 441054685 671728328 803083316 441054685 803083316 490509277 803083316 441054685 803083316 252342793 441054685 252342793 304397499 252342793 441054685 252342793 211149108 441054685 211149108 83472025 211149108 441054685 211149108 969490582 44105...

output:

331

result:

ok single line: '331'

Test #48:

score: 8
Accepted
time: 35ms
memory: 4492kb

input:

1
500
10771846 877966861 10771846 737001418 10771846 877966861 10771846 737001418 10771846 877966861 10771846 737001418 10771846 877966861 10771846 737001418 10771846 877966861 10771846 737001418 10771846 877966861 10771846 737001418 10771846 877966861 10771846 762757376 877966861 762757376 38921535...

output:

359

result:

ok single line: '359'

Test #49:

score: 8
Accepted
time: 34ms
memory: 4680kb

input:

1
500
259712038 76498306 76498306 259712038 76498306 259712038 76498306 259712038 76498306 259712038 76498306 259712038 76498306 415413414 76498306 415413414 953033042 415413414 953033042 415413414 415413414 953033042 953033042 415413414 953033042 415413414 953033042 415413414 953033042 742889991 74...

output:

61

result:

ok single line: '61'

Test #50:

score: 8
Accepted
time: 38ms
memory: 4624kb

input:

1
500
833260882 375311563 833260882 375311563 833260882 375311563 833260882 375311563 375311563 833260882 833260882 375311563 833260882 375311563 833260882 375311563 833260882 375311563 375311563 833260882 375311563 433607285 375311563 433607285 375311563 433607285 375311563 267102281 375311563 6556...

output:

76

result:

ok single line: '76'

Test #51:

score: 8
Accepted
time: 34ms
memory: 4584kb

input:

1
500
701777023 114316309 701777023 114316309 701777023 114316309 701777023 114316309 701777023 114316309 701777023 701777023 114316309 4578253 114316309 4578253 114316309 114316309 4578253 114316309 4578253 114316309 4578253 114316309 4578253 114316309 4578253 114316309 4578253 114316309 4578253 11...

output:

72

result:

ok single line: '72'

Test #52:

score: 8
Accepted
time: 37ms
memory: 4752kb

input:

1
500
25469206 25469206 212543486 25469206 212543486 25469206 212543486 115107578 212543486 115107578 212543486 115107578 212543486 115107578 115107578 212543486 115107578 212543486 421158058 421158058 212543486 421158058 212543486 421158058 421158058 212543486 421158058 212543486 212543486 42115805...

output:

61

result:

ok single line: '61'

Test #53:

score: 8
Accepted
time: 32ms
memory: 4508kb

input:

1
500
682522770 508839869 682522770 508839869 682522770 508839869 165553515 508839869 165553515 508839869 810406081 508839869 810406081 508839869 165227240 508839869 165227240 508839869 165227240 508839869 165227240 508839869 165227240 508839869 165227240 508839869 165227240 508839869 165227240 5088...

output:

272

result:

ok single line: '272'

Test #54:

score: 8
Accepted
time: 36ms
memory: 4672kb

input:

1
500
409411658 340511656 409411658 340511656 409411658 340511656 409411658 340511656 806492284 885501368 806492284 885501368 806492284 885501368 806492284 885501368 806492284 885501368 806492284 885501368 806492284 885501368 806492284 885501368 806492284 885501368 806492284 885501368 806492284 8855...

output:

124

result:

ok single line: '124'

Test #55:

score: 8
Accepted
time: 11ms
memory: 4580kb

input:

3
94
1 4 3 5 3 4 3 1 7 3 4 1 5 6 4 1 7 6 3 7 5 1 7 6 2 6 5 6 7 5 3 4 7 4 7 4 6 7 2 1 2 2 5 5 1 4 1 6 2 3 1 2 7 4 2 1 2 1 4 7 1 6 2 1 4 3 4 2 3 7 2 7 2 4 1 4 7 1 3 4 6 1 7 1 5 2 5 7 3 7 4 6 2 1
52
1 6 7 7 5 1 7 3 7 3 5 6 7 7 3 6 4 1 6 4 2 2 4 6 5 5 5 6 2 7 5 2 3 1 1 1 3 7 6 4 6 3 2 5 5 7 4 3 7 2 4 2
...

output:

76
37
294

result:

ok 3 lines

Test #56:

score: 8
Accepted
time: 4ms
memory: 4512kb

input:

3
50
1 1 7 5 5 2 7 5 2 7 2 7 5 7 5 3 7 3 3 5 7 5 7 3 7 5 7 3 7 5 7 3 7 3 5 3 5 3 1 1 7 1 1 1 7 3 3 1 7 3
94
7 6 6 7 5 7 6 7 5 5 6 5 7 6 5 6 5 6 5 6 5 6 7 6 7 6 7 6 7 5 7 6 7 5 7 6 7 5 7 5 7 5 6 7 6 5 7 6 5 7 6 6 5 6 5 5 6 7 5 7 6 7 5 6 7 5 6 5 6 7 5 6 5 6 6 5 7 5 6 7 5 7 7 5 7 5 5 7 6 7 6 7 7 6
356
...

output:

28
44
179

result:

ok 3 lines

Test #57:

score: 8
Accepted
time: 4ms
memory: 4724kb

input:

3
139
6 5 6 5 6 5 6 5 5 6 5 6 5 6 5 6 5 6 5 6 6 5 6 5 6 5 6 5 6 5 6 7 6 5 7 5 7 5 7 5 7 5 7 7 5 7 5 7 5 7 5 7 5 7 5 7 7 5 7 7 5 7 5 7 5 7 5 5 7 5 5 5 7 5 7 5 7 5 7 7 5 7 7 5 7 5 7 5 7 5 7 5 5 7 5 7 5 7 5 7 5 7 5 7 5 7 5 7 5 7 5 5 7 5 7 5 7 7 5 7 5 7 5 7 5 7 5 7 5 7 5 5 7 5 7 5 7 5 7
313
1 5 1 5 1 5 ...

output:

6
8
7

result:

ok 3 lines

Test #58:

score: 8
Accepted
time: 4ms
memory: 4540kb

input:

3
190
3 5 3 1 3 5 3 1 3 5 3 1 3 5 3 1 3 5 3 1 3 5 3 1 3 5 3 2 5 2 7 2 5 2 7 2 5 2 7 2 5 2 7 2 5 2 3 5 3 1 3 5 3 1 3 5 3 1 3 5 3 1 3 5 3 1 3 5 3 1 3 5 3 1 3 5 3 2 5 2 7 2 5 2 7 2 5 2 7 2 5 2 4 5 4 6 4 5 4 6 4 5 4 6 4 5 4 6 4 5 4 6 4 5 4 6 4 5 4 6 4 5 4 6 4 5 4 6 4 5 4 6 4 5 4 6 4 5 4 6 4 5 4 6 4 5 4 ...

output:

139
118
101

result:

ok 3 lines

Test #59:

score: 8
Accepted
time: 7ms
memory: 4584kb

input:

3
130
3 2 3 2 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 2 5 2 5 2 5 1 5 1 5 1 5 1 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 6 2 6 2 6 2 6 2 6 2 6 2 2 1 2 1 2 1 2 1 4 1 4 1 4 1 4 1 4 6 4 6 4 6 4 6 5 6 5 6 5 6 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5
74
4 6 6 6 4 6 4 6 4 6 6 4 6 4 4 6...

output:

20
9
51

result:

ok 3 lines

Test #60:

score: 8
Accepted
time: 4ms
memory: 4636kb

input:

3
107
6 7 6 2 6 7 6 2 6 7 6 2 6 7 6 2 6 7 6 2 6 7 6 4 7 4 3 4 7 4 1 7 1 5 1 7 1 5 1 7 1 4 7 4 6 4 7 4 7 3 5 3 4 3 4 3 4 3 4 3 4 3 4 3 4 3 4 3 4 3 4 4 3 4 3 4 3 4 3 4 5 7 5 7 7 3 7 5 7 5 3 5 7 3 5 7 6 1 1 6 7 1 6 1 7 6 1
73
2 3 2 6 2 2 1 2 1 2 1 2 1 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 2 1 6 7 5 6...

output:

57
17
92

result:

ok 3 lines

Test #61:

score: 8
Accepted
time: 2ms
memory: 4712kb

input:

3
146
905971758 240705216 290005132 536589372 460138502 563090429 725778480 26169743 637578914 392036242 235133216 533603958 883176441 883176441 42792325 656076467 933696550 673478376 835737951 748712810 194445723 891601325 555381933 985608038 597901844 939157103 718305152 566848749 594357652 652864...

output:

140
178
158

result:

ok 3 lines

Test #62:

score: 8
Accepted
time: 7ms
memory: 4716kb

input:

3
49
74830278 539516613 74830278 539516613 784024584 74830278 784024584 74830278 784024584 74830278 784024584 539516613 784024584 539516613 784024584 539516613 74830278 539516613 784024584 74830278 784024584 539516613 784024584 539516613 784024584 539516613 784024584 539516613 74830278 784024584 748...

output:

20
143
98

result:

ok 3 lines

Test #63:

score: 8
Accepted
time: 5ms
memory: 4748kb

input:

3
320
662263417 662263417 759212235 662263417 759212235 759212235 662263417 759212235 662263417 759212235 662263417 759212235 662263417 759212235 662263417 759212235 662263417 759212235 662263417 759212235 662263417 759212235 757302985 757302985 662263417 759212235 757302985 662263417 757302985 7573...

output:

42
9
6

result:

ok 3 lines

Test #64:

score: 8
Accepted
time: 10ms
memory: 4512kb

input:

3
66
635958303 572691027 635958303 753983766 635958303 572691027 635958303 753983766 635958303 572691027 635958303 910469217 572691027 910469217 459355619 910469217 572691027 910469217 965777089 572691027 965777089 888016580 965777089 572691027 965777089 888016580 965777089 572691027 965777089 88801...

output:

47
199
90

result:

ok 3 lines

Test #65:

score: 8
Accepted
time: 11ms
memory: 4672kb

input:

3
365
563779268 572686550 746125689 572686550 746125689 572686550 746125689 572686550 746125689 572686550 746125689 572686550 746125689 746125689 572686550 746125689 572686550 84079729 84079729 572686550 84079729 572686550 84079729 406080738 84079729 406080738 84079729 406080738 84079729 406080738 4...

output:

56
12
9

result:

ok 3 lines

Test #66:

score: 8
Accepted
time: 15ms
memory: 4684kb

input:

3
361
595120737 491102101 595120737 491102101 595120737 832860755 595120737 832860755 595120737 832860755 736132025 832860755 832860755 736132025 832860755 736132025 736132025 832860755 736132025 4935212 96717202 336300849 96717202 336300849 501484470 336300849 501484470 336300849 501484470 78987245...

output:

147
4
66

result:

ok 3 lines

Test #67:

score: 8
Accepted
time: 4ms
memory: 4716kb

input:

10
61
26262500 240243187 237605778 28465702 102474829 431061606 310285858 101698003 596018567 698370876 852860590 318488204 489778201 843922819 706993266 409247144 444122524 785662333 54507781 220155124 463482685 415924514 967953100 443774257 534915647 760684187 312341892 294928021 958814839 4706823...

output:

60
5
7
6
47
5
11
33
131
155

result:

ok 10 lines

Test #68:

score: 8
Accepted
time: 2ms
memory: 4592kb

input:

10
6
700522940 296770226 700522940 700522940 738757773 700522940
13
180402080 105717690 979369373 180402080 979369373 105717690 180402080 979369373 105717690 374355075 656232386 656232386 374355075
67
697908824 792580337 697908824 542154874 792580337 697908824 792580337 697908824 235065059 697908824...

output:

4
9
37
24
10
63
83
19
13
10

result:

ok 10 lines

Test #69:

score: 8
Accepted
time: 1ms
memory: 4680kb

input:

10
56
934591892 58329970 934591892 58329970 934591892 58329970 934591892 58329970 934591892 58329970 934591892 58329970 934591892 58329970 52828378 58329970 934591892 52828378 794728475 934591892 52828378 934591892 794728475 52828378 794728475 934591892 52828378 794728475 934591892 52828378 79472847...

output:

23
2
4
11
5
5
5
13
2
2

result:

ok 10 lines

Test #70:

score: 8
Accepted
time: 2ms
memory: 4708kb

input:

10
36
107463914 913609990 107463914 368438061 107463914 913609990 107463914 368438061 107463914 913609990 107463914 511278029 414697574 511278029 575972110 511278029 414697574 511278029 33707345 414697574 33707345 889876537 33707345 414697574 33707345 889876537 33707345 414697574 33707345 285018984 ...

output:

26
50
85
43
15
3
48
4
35
45

result:

ok 10 lines

Test #71:

score: 8
Accepted
time: 3ms
memory: 4568kb

input:

10
18
283112771 436225265 283112771 436225265 283112771 436225265 283112771 436225265 283112771 436225265 283112771 436225265 283112771 436225265 283112771 591466704 283112771 591466704
1
861163789
28
349333071 926730064 349333071 926730064 86207441 926730064 86207441 926730064 86207441 926730064 86...

output:

4
1
7
2
16
2
2
24
2
20

result:

ok 10 lines

Test #72:

score: 8
Accepted
time: 2ms
memory: 4580kb

input:

10
40
583660420 128778708 583660420 418338271 797588694 418338271 418338271 36416458 797588694 418338271 36416458 418338271 609195672 547273127 88921181 915282122 252885739 915282122 915282122 252885739 915282122 252885739 915282122 845921357 315576577 845921357 74770157 79216870 866919853 129145613...

output:

25
30
46
15
3
12
39
11
14
17

result:

ok 10 lines

Test #73:

score: 8
Accepted
time: 3ms
memory: 4672kb

input:

100
1
13230502
6
613065989 209589809 209589809 27485586 951264264 410243397
11
712826200 128754523 499514641 619949545 304091114 595574683 898865435 521720060 115391977 409473053 10001963
11
843849239 576984692 99319972 428828222 290932762 98181009 890551489 185106247 116388923 376464259 964668849
1...

output:

1
5
11
11
10
7
2
3
8
1
1
5
2
2
1
1
5
3
6
2
6
2
4
4
5
9
7
3
1
13
5
6
4
2
1
1
2
3
1
3
1
3
2
3
8
10
3
2
4
4
4
2
2
7
2
1
8
3
2
1
6
11
3
2
6
3
2
5
2
8
1
2
5
20
10
5
5
1
8
13
7
1
10
4
9
2
5
13
7
16
6
3
8
2
4
1
6
2
1
5

result:

ok 100 lines

Test #74:

score: 8
Accepted
time: 3ms
memory: 4704kb

input:

100
2
800872870 982239765
24
59122782 536038598 59122782 59122782 268124857 247528547 59122782 247528547 268124857 59122782 268124857 268124857 210119477 247528547 268124857 247528547 268124857 268124857 268124857 210119477 247528547 210119477 247528547 268124857
3
924271158 328390958 670114185
4
69...

output:

2
13
3
3
6
5
4
1
2
2
2
4
1
2
2
6
3
1
2
1
3
4
1
2
4
2
2
2
2
2
1
7
2
2
1
3
8
4
5
5
4
8
10
17
3
4
4
2
4
4
3
3
3
2
1
1
1
6
4
1
1
6
6
5
9
8
2
1
2
3
2
2
2
2
2
2
6
3
6
2
4
2
2
1
5
1
6
2
2
1
1
4
2
4
2
2
3
2
3
5

result:

ok 100 lines

Test #75:

score: 8
Accepted
time: 3ms
memory: 4588kb

input:

100
4
783340795 310809792 783340795 310809792
5
119722408 47065596 119722408 47065596 119722408
3
880830920 535205516 880830920
1
248474769
14
653960744 455546860 653960744 455546860 653960744 455546860 653960744 653960744 455546860 653960744 455546860 653960744 653960744 455546860
2
103385893 71602...

output:

2
2
2
1
2
2
2
2
2
2
2
2
4
1
2
2
2
4
2
2
2
1
1
2
1
2
2
2
2
2
2
2
2
2
2
1
1
2
2
2
2
4
2
1
2
2
2
5
2
2
5
2
2
2
2
2
2
2
2
1
2
2
2
1
2
2
1
2
2
2
2
1
2
3
2
2
1
5
2
2
2
2
2
1
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2

result:

ok 100 lines

Test #76:

score: 8
Accepted
time: 3ms
memory: 4668kb

input:

100
8
653040023 272349230 566423990 821901787 977088214 977088214 585105781 182463393
2
138672826 237919522
2
478558926 312699166
6
472471053 194597476 739853989 739853989 466984027 544388286
4
96354375 968990285 741582104 786470599
3
582931827 597819817 951992025
6
300035070 757113713 712710617 601...

output:

7
2
2
5
4
3
5
2
6
2
2
2
4
6
4
2
4
5
2
3
1
7
10
7
3
1
5
4
2
4
6
5
2
1
1
5
3
16
3
3
15
4
3
6
12
1
4
3
6
1
1
1
1
1
3
1
3
7
5
1
14
14
5
14
8
5
11
3
4
12
13
3
1
2
6
1
10
6
6
4
8
8
7
5
5
2
3
2
3
4
1
5
3
1
4
4
4
4
1
3

result:

ok 100 lines

Test #77:

score: 8
Accepted
time: 3ms
memory: 4764kb

input:

100
1
653986630
7
78293455 81369374 78293455 140941205 78293455 78293455 140941205
1
353165852
8
217304646 79414 217304646 79414 217304646 79414 217304646 312122830
3
230131296 814455042 230131296
3
278976992 410137720 278976992
9
456114454 655155254 456114454 655155254 220030737 655155254 220030737...

output:

1
4
1
3
2
2
4
2
2
2
1
3
3
2
2
2
3
3
1
2
3
1
2
2
1
2
2
1
2
2
2
2
2
2
1
4
2
2
2
2
2
2
2
2
4
1
2
1
3
2
2
2
2
2
2
2
2
2
5
2
11
2
1
2
2
4
2
2
2
2
1
2
2
2
2
2
2
3
2
2
2
2
2
4
2
2
2
2
1
2
2
8
3
2
1
2
1
2
2
6

result:

ok 100 lines

Test #78:

score: 8
Accepted
time: 3ms
memory: 4716kb

input:

100
5
887163735 579534916 530441529 430846330 923345818
1
810929256
6
890875426 890875426 657094919 890875426 657094919 890875426
6
546280728 232809358 687997147 232809358 687997147 232809358
8
763532350 892527595 787186795 539587226 963903850 175053045 692102911 159230362
3
116924919 841116202 7753...

output:

5
1
2
3
8
3
3
6
2
5
5
1
3
1
1
1
7
1
3
2
1
5
5
2
6
2
2
2
9
1
15
2
1
2
8
1
1
1
4
1
7
8
5
2
3
3
6
1
3
5
3
5
2
8
4
7
11
13
4
2
5
6
6
3
3
1
3
4
12
5
2
1
3
1
2
2
3
1
5
5
2
6
11
4
9
2
5
5
2
3
5
2
2
2
11
2
10
6
1
5

result:

ok 100 lines

Subtask #4:

score: 10
Accepted

Test #79:

score: 10
Accepted
time: 15ms
memory: 4636kb

input:

1
200000
1 3 3 2 2 3 3 1 2 3 1 1 3 3 3 2 1 1 2 3 2 1 3 3 3 1 2 2 1 3 1 2 1 2 3 2 3 3 2 2 3 2 3 2 3 1 1 1 1 1 3 1 3 2 3 3 3 3 1 3 2 1 3 2 3 2 3 1 1 1 1 3 3 2 3 2 1 2 2 3 2 3 2 2 2 2 2 2 3 2 1 2 2 1 1 3 2 1 2 1 1 3 3 3 2 1 2 2 2 1 3 3 2 3 2 1 3 3 2 2 1 3 1 3 2 1 2 3 2 1 2 3 2 2 3 2 1 2 1 1 1 1 1 1 1 3...

output:

66691

result:

ok single line: '66691'

Test #80:

score: 10
Accepted
time: 15ms
memory: 4564kb

input:

1
200000
2 2 3 3 3 2 1 2 1 1 1 3 3 2 3 3 1 3 2 3 3 3 2 1 2 2 2 2 1 1 2 2 1 3 1 3 1 3 3 1 2 1 1 2 1 1 2 1 1 1 1 2 2 1 3 2 3 3 2 3 2 3 1 1 1 1 2 3 1 2 1 1 2 3 2 3 3 2 1 2 1 1 3 3 3 1 2 3 1 3 1 3 1 1 2 1 3 2 1 1 3 2 1 1 3 2 3 2 3 2 1 3 2 2 2 1 2 2 1 3 3 1 3 1 2 3 1 1 2 2 2 1 3 1 1 3 3 2 3 2 1 3 1 1 1 3...

output:

66403

result:

ok single line: '66403'

Test #81:

score: 10
Accepted
time: 14ms
memory: 4560kb

input:

1
200000
1 2 3 3 1 2 3 3 1 2 3 1 1 2 3 1 2 3 1 2 2 3 1 2 2 3 3 3 1 2 3 3 1 2 3 3 1 1 2 2 3 3 1 2 3 3 1 1 2 3 1 2 2 3 3 1 2 3 1 1 1 1 2 3 3 1 2 2 3 1 1 1 2 2 3 3 1 1 1 2 2 3 1 1 2 3 3 1 1 2 3 1 2 3 1 2 3 3 1 1 2 3 1 1 1 1 2 3 1 2 3 3 1 2 2 2 2 2 3 1 1 2 3 1 2 2 3 1 2 3 3 1 2 2 3 1 2 3 1 1 1 2 2 3 1 2...

output:

113082

result:

ok single line: '113082'

Test #82:

score: 10
Accepted
time: 14ms
memory: 4588kb

input:

1
200000
2 3 3 1 2 2 2 3 1 1 2 3 1 2 2 3 3 1 2 3 3 3 3 3 3 1 2 3 1 2 3 3 1 2 2 3 3 1 2 3 3 3 1 2 2 3 3 3 1 2 2 3 3 3 3 3 1 1 2 3 1 2 3 3 1 1 2 2 3 1 1 1 1 2 3 1 2 2 3 3 3 1 2 3 1 1 2 2 3 1 1 1 1 2 2 3 3 3 3 1 1 2 3 1 2 3 1 1 1 2 3 3 1 1 2 3 1 1 2 3 1 2 3 1 2 3 1 2 2 3 3 1 2 2 3 3 1 1 1 2 2 3 1 1 1 2...

output:

98984

result:

ok single line: '98984'

Test #83:

score: 10
Accepted
time: 15ms
memory: 4548kb

input:

1
200000
3 2 2 2 1 1 2 2 2 1 3 2 3 3 3 1 3 1 3 3 2 1 1 2 1 2 3 2 2 3 1 3 3 2 3 2 3 3 3 2 3 2 3 3 3 3 1 2 3 2 2 1 1 2 3 1 3 1 1 2 1 2 1 1 1 3 3 1 3 2 2 2 1 1 2 3 3 3 1 3 3 3 1 3 2 2 1 3 3 1 3 3 1 3 3 1 3 1 1 1 3 2 3 1 3 1 3 3 3 2 2 2 3 3 2 1 2 1 3 3 2 1 1 3 1 2 2 1 3 1 2 2 3 2 1 2 2 1 3 2 3 3 3 1 1 2...

output:

66809

result:

ok single line: '66809'

Test #84:

score: 10
Accepted
time: 15ms
memory: 4532kb

input:

1
200000
3 1 3 1 3 1 2 1 2 2 3 1 3 2 3 1 1 3 1 3 2 3 3 3 3 1 1 1 2 2 1 1 3 1 2 2 2 1 2 1 1 2 3 2 2 1 3 2 2 2 3 1 1 2 3 1 3 2 1 1 3 1 1 3 1 2 3 1 2 1 2 1 1 1 3 1 1 1 1 3 2 1 2 3 3 2 2 3 1 1 2 1 1 2 1 3 1 3 3 1 1 1 1 1 3 2 3 2 3 1 3 2 1 3 1 3 2 1 1 1 3 2 1 1 3 1 3 3 3 2 2 3 1 3 1 1 3 3 3 2 1 3 3 1 1 1...

output:

66929

result:

ok single line: '66929'

Test #85:

score: 10
Accepted
time: 14ms
memory: 4484kb

input:

1
200000
1 2 2 3 1 2 3 1 2 3 1 2 3 1 1 2 3 1 2 3 1 1 2 3 1 2 3 1 2 3 1 2 3 3 1 2 2 3 1 1 2 3 1 2 3 1 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 3 3 3 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 2 3 1 2 3 1 2 3 1 1 2 2 3 1 2 3 1 2 3 1 2 3 1 1...

output:

165153

result:

ok single line: '165153'

Test #86:

score: 10
Accepted
time: 14ms
memory: 4444kb

input:

1
200000
3 1 2 3 1 2 3 1 2 3 3 1 2 2 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 1 2 3 1 2 3 1 2 3 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 2...

output:

161302

result:

ok single line: '161302'

Test #87:

score: 10
Accepted
time: 10ms
memory: 4388kb

input:

3
14732
1 3 2 1 3 3 1 1 3 2 1 2 1 1 1 3 1 3 1 1 3 2 1 1 3 2 3 3 2 1 3 3 3 3 1 1 1 2 3 2 1 3 3 3 1 2 1 1 3 1 1 2 2 1 3 3 3 2 3 2 1 2 2 3 1 3 3 2 2 3 1 2 1 1 3 2 2 2 1 2 3 3 1 3 3 2 1 1 1 1 2 1 3 1 2 3 3 2 2 1 3 3 3 2 2 2 1 1 1 1 1 2 1 2 1 3 2 2 1 3 2 3 2 3 3 1 3 1 1 2 1 1 2 1 1 3 2 1 2 3 2 1 3 1 3 3 ...

output:

4957
130118
23430

result:

ok 3 lines

Test #88:

score: 10
Accepted
time: 14ms
memory: 4284kb

input:

3
46973
1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 3 1 2 3 1 2 3 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 ...

output:

35431
19615
37542

result:

ok 3 lines

Test #89:

score: 10
Accepted
time: 14ms
memory: 4192kb

input:

3
19336
2 3 1 2 2 3 1 1 2 3 3 1 2 2 2 3 3 3 1 2 3 1 2 2 3 3 3 1 1 1 1 1 2 2 3 3 3 3 1 1 1 2 2 2 2 3 1 1 1 1 2 2 2 3 3 3 3 1 1 2 2 2 3 1 2 3 1 2 2 3 3 3 1 2 3 1 2 3 1 2 3 3 1 1 2 3 3 1 2 2 2 2 2 2 3 3 1 2 3 1 2 2 3 3 1 1 1 1 2 3 1 1 1 1 1 2 2 2 2 2 2 3 3 3 1 2 3 1 2 3 3 1 2 3 3 3 3 3 3 1 2 2 2 2 2 2 ...

output:

8087
53502
40182

result:

ok 3 lines

Test #90:

score: 10
Accepted
time: 14ms
memory: 4248kb

input:

3
111453
2 3 2 2 3 2 2 2 1 1 1 2 2 2 3 2 2 1 3 1 3 3 1 3 2 2 1 3 1 2 2 2 3 1 3 2 1 2 1 1 3 3 1 1 3 1 1 2 1 2 1 1 1 3 3 3 1 1 1 3 2 2 1 3 2 1 1 3 1 2 3 3 1 2 2 2 1 3 2 2 2 2 2 2 2 3 2 1 3 1 2 1 3 1 1 1 2 3 3 1 3 2 1 3 2 2 2 3 1 3 3 3 2 1 3 2 1 3 2 1 3 3 3 1 1 2 1 2 1 3 2 2 2 3 3 1 2 1 2 2 3 3 2 2 2 2...

output:

37432
9380
2

result:

ok 3 lines

Test #91:

score: 10
Accepted
time: 13ms
memory: 4636kb

input:

1
200000
1 2 3 1 2 3 1 2 3 3 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2...

output:

161232

result:

ok single line: '161232'

Test #92:

score: 10
Accepted
time: 14ms
memory: 4484kb

input:

1
200000
2 1 3 2 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2...

output:

177380

result:

ok single line: '177380'

Test #93:

score: 10
Accepted
time: 14ms
memory: 4484kb

input:

1
200000
3 2 1 3 2 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 2 1 3 2 1 3 2 1 3 2 2 1 3 2 1 3 3 2 2 1 3 2 1 3 2 1 1 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 2 1 3 2 1 3 2 1 1 3 2 1 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 1 3 3 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 1 3 2 1 1 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 1 3 2 1...

output:

152945

result:

ok single line: '152945'

Test #94:

score: 10
Accepted
time: 14ms
memory: 4584kb

input:

1
200000
3 2 1 3 1 1 1 3 2 1 3 2 1 3 2 1 3 2 1 3 3 2 1 3 2 1 3 3 3 3 3 2 2 1 3 2 1 3 3 2 1 3 2 2 1 3 2 1 3 2 1 3 3 2 1 3 2 1 1 3 2 1 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 3 2 1 3 2 2 1 3 2 1 3 2 1 3 2 1 3 3 2 1 3 2 1 1 3 2 2 1 3 2 2 1 1 3 2 1 3 2 1 3 2 1 3 2 1 3 3 2 1 3 2 2 1 3 2 1 3 2...

output:

139711

result:

ok single line: '139711'

Test #95:

score: 10
Accepted
time: 14ms
memory: 4500kb

input:

1
200000
2 3 3 1 2 3 1 2 2 1 1 2 3 3 1 2 3 1 2 3 1 2 3 1 2 3 3 1 2 3 1 2 3 1 2 3 1 2 3 1 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 1 2 3 1 2 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 1 2 3 1 2 2 3 1 2 3 1 2 3 3 1 2 3 1 2 2 3 1 2 3 1 2 3 1 2 3 1 1 2 3 1 2 3 1 2 3 1 2 3 3 1 2 3 1 2 3 1 2 3 1 1 2 3 1 1 2 3...

output:

159913

result:

ok single line: '159913'

Test #96:

score: 10
Accepted
time: 14ms
memory: 4580kb

input:

1
200000
3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 3 1 2 2 3 1 2 3 1 2 3 1 2 2 3 1 2 3 1 1 2 2 3 1 2 3 1 2 3 1 2 3 1 1 1 2 3 1 2 3 1 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 3 1 2 3 1 2 3 1 2 3 1 2 3 1 1 2 3 1 1 2 3 1 2 3 1 2 3 1 2 3 3 1 2 3 3 1 2 2 3 1 2 3 1 2 2 3 1 2 2 3 1 2 3 1 2 3 1 2 3 1 2 2 3 1 2 3 1 2 2 3 1...

output:

164070

result:

ok single line: '164070'

Test #97:

score: 10
Accepted
time: 14ms
memory: 4492kb

input:

1
200000
1 3 2 1 3 2 1 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 1 3 2 1 3 2 1 3 2 2 1 3 3 2 2 1 3 2 1 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 2 2 2 1 3 2 1 1 3 3 2 1 3 2 1 3 2 1 3 2 1 3 3 2 1 3 2 1 3 2 1 3 3 2 1 1 3 2 1 3 2 1 1 3 2 1 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 1 3 2 1 1 3...

output:

141972

result:

ok single line: '141972'

Test #98:

score: 10
Accepted
time: 14ms
memory: 4612kb

input:

1
200000
1 3 2 1 3 2 1 3 2 1 3 2 2 1 3 3 2 2 1 3 2 1 3 2 1 3 2 1 3 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 3 2 2 1 3 2 1 3 2 1 3 2 1 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2...

output:

180569

result:

ok single line: '180569'

Test #99:

score: 10
Accepted
time: 13ms
memory: 4260kb

input:

3
67258
1 3 2 1 3 3 2 1 3 2 1 1 3 2 1 3 2 1 3 2 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 2 1 3 2 2 1 3 2 1 3 2 1 3 2 2 1 3 2 1 3 3 2 1 3 2 1 3 2 1 3 2 1 1 3 2 1 3 2 1 3 2 1 3 2 1 1 3 2 2 1 3 2 1 ...

output:

55713
10294
102575

result:

ok 3 lines

Test #100:

score: 10
Accepted
time: 10ms
memory: 4264kb

input:

3
110746
2 3 1 2 3 1 2 2 3 1 2 3 1 2 3 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 3 1 2 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 1 2 3 1 2 3 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 1 2 3 1 2 3 1 1 2 3 3 3 1 2 3 1 2 3 1 2 2 3 1 2 3 1 1 2 3 3 1 2 3 1 2 3 1 2 3 1 1 1 2 3 1 2 3 1 2 3 1 1 2 3 1 2 3 1 2 3 1 2...

output:

78787
56073
17413

result:

ok 3 lines

Test #101:

score: 10
Accepted
time: 13ms
memory: 4152kb

input:

3
88522
1 2 2 1 2 3 1 2 3 1 2 3 1 2 3 1 1 2 3 3 3 1 2 3 1 2 3 1 2 2 3 1 2 3 1 2 3 1 2 3 3 1 2 2 3 1 2 3 1 2 3 1 1 2 3 1 2 2 3 1 2 3 3 1 2 3 3 1 2 3 3 1 2 2 3 1 2 3 1 2 3 1 2 2 3 1 2 3 1 1 2 3 1 2 3 1 2 3 1 1 2 3 1 2 3 3 1 2 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 3 1 2 3 1 2 3 1 1 2 3 3 1 1 1 2 3 1 2 3 1 ...

output:

72954
15040
67627

result:

ok 3 lines

Test #102:

score: 10
Accepted
time: 14ms
memory: 4144kb

input:

3
38399
2 1 1 3 2 1 3 2 1 3 3 3 2 1 3 2 1 3 3 2 2 1 3 2 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 1 3 2 1 3 2 1 3 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 3 2 1 1 1 3 2 1 3 2 1 3 3 3 2 2 2 1 3 2 1 3 3 2 1 1 1 3 2 1 3 2 1 3 2 2 1 3 2 2 1 3 2 1 3 2 1 3 2 ...

output:

27852
58832
74901

result:

ok 3 lines

Test #103:

score: 10
Accepted
time: 14ms
memory: 3924kb

input:

10
23759
3 2 1 2 1 2 1 2 2 2 2 1 1 1 3 1 3 1 3 3 2 1 1 3 3 2 3 2 2 1 3 2 3 3 2 1 3 1 2 3 3 3 2 1 1 3 3 1 2 3 3 2 3 3 1 2 3 3 2 2 1 2 3 2 3 1 1 3 3 3 2 3 3 3 1 1 3 2 3 2 2 3 2 1 1 1 1 2 1 3 3 1 3 2 3 3 1 3 3 1 1 2 3 1 3 2 3 3 2 2 3 1 3 3 2 3 1 3 2 3 3 3 1 2 3 2 3 1 3 1 3 2 2 3 3 2 1 2 2 2 3 1 2 2 2 2...

output:

8049
15976
3898
1817
4647
15431
43707
2827
2372
17780

result:

ok 10 lines

Test #104:

score: 10
Accepted
time: 10ms
memory: 3820kb

input:

15
3978
2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 3 3 1 2 2 2 3 3 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 2 3 1 2 3 3 1 2 3 1 2 3 1 2 3 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 2 3 1 2 3 1 1 1 1 2 3 3 1 2 3 1 2 3 1 2 3 1 2 3 1 1 2 3 1 2 2 2 3 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 1 2 3 1 2 3 1 1 1 2 3 3 3 1 2 3 1 ...

output:

2648
2
12485
3542
2427
2686
13541
17826
1973
10284
16751
13183
2992
4312
643

result:

ok 15 lines

Test #105:

score: 10
Accepted
time: 16ms
memory: 4884kb

input:

20
2162
3 2 3 1 2 2 3 3 1 1 1 2 2 2 3 3 2 2 1 3 2 1 3 3 3 3 2 1 2 1 1 1 3 1 1 2 2 1 2 3 3 2 3 1 1 1 1 3 3 1 3 3 1 1 2 3 3 1 2 2 3 3 2 3 2 3 3 2 2 2 1 1 3 3 2 2 1 3 3 2 3 3 1 1 3 2 2 2 1 2 3 1 3 3 3 1 2 2 2 1 1 1 2 2 3 1 1 3 3 1 3 2 3 1 1 1 2 1 3 1 3 3 2 1 1 2 1 1 3 1 1 2 2 3 2 2 2 1 3 3 3 3 3 2 1 1 ...

output:

754
605
5276
265
12917
210
69
4263
11833
610
2550
5415
3601
12242
4287
5965
1729
16708
1764
1028

result:

ok 20 lines

Test #106:

score: 10
Accepted
time: 25ms
memory: 4900kb

input:

50
3286
2 3 1 2 2 1 2 1 2 2 1 1 2 3 2 3 3 1 3 1 1 1 1 3 3 1 3 3 3 1 2 2 2 2 1 1 1 2 3 1 2 1 2 1 2 3 1 3 1 1 1 1 2 1 3 1 2 2 1 2 1 2 3 3 1 2 1 2 1 2 1 2 2 2 2 2 1 2 3 1 2 1 1 3 2 3 1 1 3 2 1 2 1 1 1 2 2 3 1 1 3 1 1 2 2 3 1 2 2 3 2 3 3 2 1 2 3 3 2 3 1 3 2 2 2 3 3 3 1 2 3 3 3 3 2 3 2 1 2 1 2 1 3 1 2 3 ...

output:

1094
2039
1266
311
3566
734
3452
921
6366
1785
1886
46
250
1156
2209
480
856
891
1475
1903
98
1610
6239
2069
1169
4200
1325
2769
31
956
206
4259
6816
2833
474
3248
818
2818
1
398
160
54
1866
4308
3127
5468
1697
282
1209
1567

result:

ok 50 lines

Test #107:

score: 10
Accepted
time: 78ms
memory: 4852kb

input:

100
1
2
8738
3 3 3 2 2 3 2 1 1 2 2 2 3 2 2 1 1 3 2 2 3 2 3 1 3 3 1 3 2 2 1 1 3 2 1 1 3 1 1 1 1 2 2 2 2 1 3 3 2 2 1 2 1 2 1 1 2 2 1 1 2 2 1 2 3 1 1 3 2 2 1 1 3 1 2 3 2 1 3 1 1 1 3 2 1 3 3 3 2 3 3 3 1 2 1 3 3 1 2 3 2 1 3 3 3 3 1 1 3 2 1 1 2 2 2 2 2 1 3 1 2 3 3 3 2 1 3 3 1 3 2 3 2 1 2 3 1 1 2 2 3 3 2 2...

output:

1
2913
447
199
486
258
178
1822
6779
5048
3183
250
179
1857
719
194
98
510
6409
137
388
186
2
85
705
90
155
2627
766
203
413
550
1863
1
515
97
475
1
21
1282
1064
2382
471
276
557
137
112
225
185
921
1869
4
1877
84
353
1369
1175
717
2
507
1358
328
762
525
239
223
49
189
621
1229
427
911
830
2306
3726...

result:

ok 100 lines

Test #108:

score: 10
Accepted
time: 270ms
memory: 4836kb

input:

200
799
2 2 1 1 2 3 3 2 2 2 2 2 1 2 3 3 2 3 3 3 1 3 1 1 2 3 1 3 1 1 3 2 1 3 3 1 3 2 1 1 3 3 1 3 2 1 2 3 3 2 3 3 2 1 2 1 2 2 3 2 1 1 2 1 1 1 1 3 1 2 2 1 3 3 3 3 3 3 2 1 1 3 2 1 2 1 3 1 1 2 3 1 1 1 2 1 1 1 1 1 2 2 3 2 1 2 2 2 2 1 1 3 2 3 2 2 2 2 2 3 2 3 2 2 2 3 2 1 3 3 2 2 3 1 2 2 1 1 1 2 3 1 2 1 3 2 ...

output:

272
219
2
866
1052
234
752
479
66
608
263
503
2073
36
231
1498
315
29
116
514
589
168
905
15
985
18
148
657
2668
1219
580
210
1025
6
41
552
565
181
1702
386
371
154
25
268
2
466
75
151
26
1010
92
700
2157
594
2
1081
168
801
197
157
41
211
902
499
1177
465
101
95
142
500
616
200
51
244
172
630
83
918...

result:

ok 200 lines

Test #109:

score: 10
Accepted
time: 953ms
memory: 4848kb

input:

500
34
2 2 2 2 2 3 3 3 1 2 3 3 1 1 1 2 1 1 3 3 3 3 2 1 3 2 2 2 1 1 3 3 2 1
7
2 1 2 1 1 2 2
333
3 2 1 2 1 1 3 1 1 2 1 2 3 3 3 2 2 1 1 1 1 2 1 3 1 3 1 2 2 2 2 1 3 1 3 3 1 2 3 2 3 1 3 3 3 2 3 1 2 2 1 1 2 3 2 2 3 2 1 3 1 2 1 1 3 1 3 1 2 1 2 2 3 1 1 3 2 2 2 3 2 1 3 1 2 1 3 3 1 3 3 2 2 2 3 2 1 1 3 2 2 3 1...

output:

14
2
124
74
641
27
298
259
91
99
36
568
75
34
164
52
380
59
264
168
88
218
31
89
123
277
23
178
52
439
189
2
162
411
68
1733
348
2
52
354
38
265
10
179
2
80
222
46
298
207
69
547
83
77
117
110
19
414
237
97
111
88
89
36
139
214
266
429
37
629
129
169
42
22
4
84
91
32
231
43
141
168
336
49
40
248
6
4...

result:

ok 500 lines

Test #110:

score: 10
Accepted
time: 1340ms
memory: 4836kb

input:

1000
294
3 3 1 1 1 2 3 1 2 3 1 2 3 1 2 3 1 1 2 3 1 2 3 1 2 3 1 2 3 1 1 2 3 1 1 2 2 3 1 2 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 1 2 3 3 1 2 3 1 2 3 3 1 2 3 1 2 3 1 2 3 1 1 2 3 1 2 3 1 2 3 3 1 2 3 1 1 2 3 1 1 2 3 1 1 2 3 1 2 3 1 2 3 1 2 3 3 1 2 3 1 2 3 1 2 3 1 2 3 3 1 2 3 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3...

output:

259
87
166
81
32
102
157
101
53
79
126
39
20
50
17
82
23
41
21
70
95
1
14
38
4
116
52
243
21
136
55
1
1
127
12
59
86
52
106
223
12
6
223
23
12
166
50
11
2
152
51
220
13
59
53
10
174
94
14
333
11
70
89
7
111
5
178
31
89
81
44
25
70
449
7
180
45
122
134
113
138
41
2
1
93
59
21
11
113
55
43
100
12
103
...

result:

ok 1000 lines

Test #111:

score: 10
Accepted
time: 246ms
memory: 4712kb

input:

10000
99
2 3 3 1 2 3 3 3 1 2 3 1 2 3 3 3 1 2 2 2 3 1 2 3 1 1 2 3 1 2 2 3 1 2 3 3 1 2 2 2 2 3 1 2 3 3 3 1 2 2 3 1 2 3 3 3 3 1 2 3 1 2 2 2 3 1 1 2 3 1 2 3 3 3 1 2 3 1 2 2 3 3 3 3 1 1 1 1 1 1 2 2 2 3 3 3 1 1 2
9
3 1 2 3 3 1 2 1 3
50
3 3 1 2 3 2 1 3 2 1 3 2 1 3 3 2 2 1 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 2 2 ...

output:

61
7
40
60
3
5
1
1
6
2
6
6
1
16
2
14
1
4
3
1
15
5
14
15
3
26
2
5
12
23
5
3
2
9
4
4
2
40
8
25
8
14
5
11
4
11
8
7
2
12
3
4
10
22
16
4
40
2
8
32
24
8
27
22
37
1
2
3
7
15
2
8
6
12
22
4
9
7
12
8
12
3
25
12
5
6
7
6
17
8
6
8
13
2
22
32
5
16
2
4
5
1
5
2
19
2
6
19
28
3
2
2
10
25
17
10
8
4
2
12
7
15
5
5
32
14...

result:

ok 10000 lines

Test #112:

score: 10
Accepted
time: 371ms
memory: 4672kb

input:

20000
9
3 3 2 3 2 2 3 1 2
9
1 1 1 2 2 3 3 2 3
5
2 3 2 1 1
6
2 2 1 2 3 1
7
2 2 2 2 1 3 3
1
1
8
2 1 3 2 2 1 3 2
14
3 3 1 3 2 3 3 1 3 1 3 3 2 3
5
1 2 1 1 1
5
3 2 1 1 2
9
3 2 1 1 1 2 3 1 3
7
1 1 2 3 1 1 1
1
2
5
3 2 1 1 2
29
3 1 1 2 2 1 1 2 3 3 3 1 1 3 2 1 2 3 3 1 3 3 2 3 1 3 3 1 2
6
3 3 1 2 3 1
12
2 3 1...

output:

4
3
3
4
3
1
7
7
2
3
5
4
1
3
12
5
5
8
17
2
2
27
8
10
51
11
4
14
2
3
7
10
6
2
2
4
4
5
5
18
7
1
6
3
2
2
3
2
7
3
5
4
9
1
3
2
1
25
5
9
2
4
4
5
6
2
3
1
2
2
8
2
4
1
20
5
6
1
2
5
2
7
1
3
2
1
6
9
10
4
2
6
16
2
2
1
1
5
11
4
5
4
1
11
1
6
6
14
2
3
8
2
11
12
4
3
14
25
18
2
2
4
16
6
4
3
9
3
1
3
2
5
9
15
5
18
5
6
...

result:

ok 20000 lines

Test #113:

score: 10
Accepted
time: 840ms
memory: 4724kb

input:

50000
5
3 1 3 2 2
1
1
1
3
6
2 1 1 3 3 2
9
3 3 1 1 2 1 3 2 3
1
2
8
2 2 2 2 3 3 2 1
2
1 2
2
3 2
2
2 1
1
1
2
1 3
3
1 3 2
6
3 1 1 1 1 3
4
2 2 2 3
6
1 1 1 2 1 1
3
3 3 1
15
2 3 1 2 3 1 2 3 1 3 2 1 3 2 2
1
3
4
2 1 3 2
2
1 2
4
1 1 2 1
2
2 1
2
1 3
1
2
5
3 3 2 2 1
5
2 3 3 2 3
3
2 2 1
1
2
6
2 3 3 3 3 2
3
2 1 3...

output:

3
1
1
4
5
1
3
2
2
2
1
2
3
2
2
2
2
11
1
4
2
2
2
2
1
3
2
2
1
2
3
1
2
2
1
3
2
5
3
2
2
3
3
4
3
4
1
6
2
4
2
5
3
3
1
1
2
9
3
1
2
3
2
5
2
2
2
3
8
2
2
9
2
1
1
1
3
3
8
2
2
1
2
9
3
1
2
1
7
2
2
2
2
2
1
7
1
2
2
5
2
6
8
3
4
2
1
4
3
9
1
4
1
4
2
3
4
1
1
5
2
2
2
2
1
5
2
7
3
5
5
1
1
2
1
1
2
1
1
1
5
3
1
3
2
1
4
1
1
4...

result:

ok 50000 lines

Test #114:

score: 10
Accepted
time: 1ms
memory: 3896kb

input:

1
10000
2 3 3 1 2 2 2 3 1 1 2 2 3 3 3 1 2 3 3 1 2 3 3 1 1 2 3 1 1 1 1 2 2 3 3 1 2 2 3 1 1 2 3 1 1 1 1 2 2 2 3 3 3 1 1 2 3 1 2 3 1 1 1 2 3 1 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 3 1 1 1 1 1 1 2 3 1 2 2 2 3 3 1 2 3 3 3 1 1 1 2 3 1 2 3 1 2 2 2 3 1 2 3 1 2 3 1 1 1 2 3 3 1 2 2 2 3 3 1 2 3 3 3 3 3 1 2 2 2 3 1 2 ...

output:

4765

result:

ok single line: '4765'

Test #115:

score: 10
Accepted
time: 1ms
memory: 3708kb

input:

1
10000
1 1 2 2 1 2 1 3 1 3 3 3 3 1 3 1 1 1 1 2 1 3 3 1 2 3 2 3 2 3 1 3 1 3 1 1 1 2 1 1 1 3 3 3 2 1 2 1 3 2 1 3 2 2 1 3 1 2 2 2 2 1 2 2 3 2 2 3 3 2 2 3 2 1 3 3 1 3 3 3 3 1 3 1 1 3 1 3 2 3 3 3 3 3 2 3 3 1 1 3 1 2 2 2 3 1 1 1 2 1 3 2 2 1 1 2 1 3 2 1 2 3 3 2 2 3 3 3 3 1 2 1 3 2 3 2 2 1 1 1 2 2 2 1 1 2 ...

output:

3368

result:

ok single line: '3368'

Test #116:

score: 10
Accepted
time: 1ms
memory: 3836kb

input:

3
2025
1 3 3 1 2 3 1 1 1 2 2 1 2 2 1 2 3 3 2 1 2 3 1 1 2 1 1 1 2 2 2 1 3 1 1 2 3 1 1 3 3 3 2 2 2 2 2 2 1 2 3 1 3 3 2 2 2 3 1 3 3 3 3 3 2 3 1 2 1 3 3 1 3 3 3 1 2 3 2 3 2 2 3 1 1 1 1 3 2 2 3 3 1 1 2 1 3 1 1 3 1 2 2 1 1 2 1 3 2 2 3 1 1 2 1 3 1 2 3 1 3 2 2 3 3 1 3 2 3 2 1 2 2 3 1 3 2 2 1 3 1 1 3 1 2 2 2...

output:

694
953
2972

result:

ok 3 lines

Test #117:

score: 10
Accepted
time: 44ms
memory: 4676kb

input:

20
518
3 3 2 1 1 1 3 1 3 2 1 3 1 2 1 1 3 3 2 3 1 3 1 1 2 1 3 3 2 1 3 2 2 1 3 1 2 3 3 1 2 1 3 1 2 3 3 1 1 2 2 1 3 1 3 2 2 1 2 2 3 1 2 2 2 1 3 3 3 3 1 1 3 3 3 3 1 1 1 2 2 2 3 3 1 3 3 1 1 3 3 2 2 3 3 3 2 3 2 1 1 3 1 3 2 3 2 2 2 1 2 2 1 1 3 2 1 1 3 1 2 3 2 1 3 2 2 1 3 2 1 2 3 2 1 2 2 2 3 1 1 2 2 3 2 3 3...

output:

175
118
279
482
208
59
2
210
44
352
188
87
364
62
155
134
10
1860
418
227

result:

ok 20 lines

Test #118:

score: 10
Accepted
time: 56ms
memory: 4540kb

input:

100
75
2 1 1 3 3 3 2 1 2 3 1 3 1 2 3 1 1 3 2 2 2 3 1 3 2 1 2 3 2 2 1 1 3 1 1 3 3 2 1 2 3 3 1 1 2 2 3 2 1 2 3 3 1 3 1 3 1 2 3 1 3 2 2 2 2 3 1 2 3 3 3 3 1 2 2
130
3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3...

output:

34
114
22
85
85
8
102
19
93
18
30
41
60
17
2
91
204
35
35
16
64
3
2
20
18
27
17
29
47
31
13
11
10
13
36
4
117
22
1
65
13
2
6
24
106
67
1
64
33
206
1
45
14
2
32
304
74
2
21
5
68
25
53
18
93
55
2
54
109
20
25
163
130
35
35
23
9
113
30
77
108
203
18
9
33
47
9
1
44
33
3
204
98
158
3
173
254
3
59
20

result:

ok 100 lines

Test #119:

score: 10
Accepted
time: 1ms
memory: 3860kb

input:

1
10000
2 2 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 ...

output:

7601

result:

ok single line: '7601'

Test #120:

score: 10
Accepted
time: 1ms
memory: 3720kb

input:

1
10000
1 2 3 1 2 2 1 2 2 3 1 1 2 3 3 1 2 3 1 2 3 3 1 1 2 3 1 2 3 1 2 2 3 1 2 3 1 2 3 1 2 3 1 1 2 3 1 2 3 1 2 2 3 1 2 3 1 2 3 1 1 2 3 1 2 3 1 2 3 1 2 3 3 1 2 3 3 1 2 3 1 2 3 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 2 3 1 2 3 1 2 2 3 1 2 3 1 2 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 2 3 1 2 2 3 1 2 3 ...

output:

7746

result:

ok single line: '7746'

Test #121:

score: 10
Accepted
time: 1ms
memory: 3732kb

input:

1
10000
3 2 3 3 2 1 3 2 1 3 2 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 1 3 2 1 3 2 1 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 1 3 2 1 3 2 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 1 3 2 ...

output:

8313

result:

ok single line: '8313'

Subtask #5:

score: 10
Accepted

Dependency #4:

100%
Accepted

Test #122:

score: 10
Accepted
time: 28ms
memory: 4628kb

input:

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

output:

166092

result:

ok single line: '166092'

Test #123:

score: 10
Accepted
time: 28ms
memory: 4616kb

input:

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

output:

150827

result:

ok single line: '150827'

Test #124:

score: 10
Accepted
time: 28ms
memory: 4556kb

input:

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

output:

178728

result:

ok single line: '178728'

Test #125:

score: 10
Accepted
time: 23ms
memory: 4548kb

input:

1
200000
4 7 1 7 1 1 7 4 7 4 1 7 4 1 7 1 4 7 1 7 7 1 1 7 4 4 7 4 7 1 4 7 4 1 7 7 1 4 1 7 1 7 7 4 1 4 4 4 1 4 7 4 7 1 7 1 7 1 7 4 1 7 4 7 4 7 4 7 1 4 1 4 7 7 4 7 1 7 7 1 4 1 7 1 4 7 1 4 7 7 4 1 1 7 4 7 1 7 1 7 1 1 7 1 7 4 7 7 1 7 4 1 7 1 4 7 4 7 1 4 7 1 4 1 4 1 7 1 1 7 4 7 4 1 7 4 1 7 1 4 7 1 7 1 7 4...

output:

95820

result:

ok single line: '95820'

Test #126:

score: 10
Accepted
time: 27ms
memory: 4608kb

input:

1
200000
10 7 2 10 2 10 2 7 10 2 2 10 10 10 2 10 2 7 7 7 2 10 7 2 10 7 2 7 10 7 10 7 10 2 10 7 2 2 7 2 10 7 2 7 2 7 2 7 2 10 7 10 2 7 2 10 7 10 7 2 2 10 2 10 7 10 2 2 7 10 7 2 2 10 2 7 10 7 10 2 10 2 7 10 7 2 2 2 10 7 2 7 2 10 2 7 10 7 2 10 2 10 7 2 7 10 7 2 10 7 10 2 2 10 2 10 2 10 2 10 2 7 2 7 10 ...

output:

87271

result:

ok single line: '87271'

Test #127:

score: 10
Accepted
time: 27ms
memory: 4480kb

input:

1
200000
1 6 1 6 1 6 10 1 10 1 10 1 1 6 1 10 6 10 1 6 1 10 6 1 6 10 6 10 10 1 10 10 6 1 10 1 6 10 6 10 6 10 6 10 6 10 1 10 6 10 6 1 10 6 10 6 10 6 6 10 6 10 1 1 6 10 1 10 6 10 6 1 10 1 6 10 6 1 6 1 10 1 10 6 1 10 1 6 10 6 1 6 6 10 6 1 1 6 1 6 10 1 6 1 10 1 1 6 1 10 1 1 10 6 10 10 6 10 1 10 1 10 6 10...

output:

95918

result:

ok single line: '95918'

Test #128:

score: 10
Accepted
time: 27ms
memory: 4552kb

input:

1
200000
10 9 10 9 10 9 10 9 10 9 10 9 10 9 10 3 9 3 9 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 6 3 6 3 6 3 6 3 6 3 6 3 6 3 6 3 6 3 6 3 6 3 3 6 3 6 3 6 3 6 3 6 3 6 3 6 3 6 3 6 3 6 3 6 10 6 3 10 3 10 3 10 3 10 3 3 10 3 10 3 10 3 10 3 10 3 10 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 ...

output:

16019

result:

ok single line: '16019'

Test #129:

score: 10
Accepted
time: 27ms
memory: 4488kb

input:

1
200000
4 5 4 5 4 5 4 4 5 6 5 4 5 6 4 6 4 6 4 6 4 6 6 4 6 4 6 4 6 4 6 4 6 4 6 4 6 4 6 6 4 6 4 6 4 6 4 4 6 4 6 4 6 6 8 6 6 4 4 8 6 4 8 6 4 8 4 8 4 4 8 8 4 8 4 8 4 8 8 4 8 4 8 4 8 4 8 4 8 4 8 4 8 4 8 4 8 4 8 4 4 8 4 8 4 8 4 8 4 8 4 8 4 8 8 4 8 4 8 4 8 4 8 8 4 8 4 8 4 8 4 8 4 8 4 8 4 8 4 8 4 8 4 8 4 4...

output:

14313

result:

ok single line: '14313'

Test #130:

score: 10
Accepted
time: 27ms
memory: 4444kb

input:

1
200000
5 3 5 3 5 3 5 1 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 3 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 6 5 3 5 6 3 5 6 3 6 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 10 3 5 3 10 3 10 3 10 3 10 3 10 3 10 3 10 3 10 3 10 3 10 10 3 10 10 3 10 3 10 3 10 3 10 3 3 10 3 10 3 10 3 10 3 10 3 10 3 10 3 10 3 10 ...

output:

15513

result:

ok single line: '15513'

Test #131:

score: 10
Accepted
time: 27ms
memory: 4548kb

input:

1
200000
7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 1 7 3 7 10 3 10 9 10 3 10 9 10 3 10 9 10 3 10 9 10 3 ...

output:

149344

result:

ok single line: '149344'

Test #132:

score: 10
Accepted
time: 26ms
memory: 4600kb

input:

1
200000
8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 10 8 4 8 1...

output:

149377

result:

ok single line: '149377'

Test #133:

score: 10
Accepted
time: 19ms
memory: 4548kb

input:

1
200000
2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 8 2 9 2 3 9 3 1 3 9 3 1 3 9 3...

output:

149345

result:

ok single line: '149345'

Test #134:

score: 10
Accepted
time: 27ms
memory: 4584kb

input:

1
200000
8 2 8 2 8 2 8 2 8 2 8 2 8 2 8 2 2 8 2 8 2 8 2 8 2 8 2 8 8 2 2 8 2 8 2 10 2 10 2 10 2 10 2 10 4 10 4 10 3 2 3 2 3 2 3 2 3 2 3 8 3 8 3 8 3 8 3 8 3 8 3 8 3 8 3 8 3 8 3 8 3 8 3 8 3 8 3 8 3 8 3 8 3 8 6 8 6 8 1 8 1 8 8 1 8 1 8 1 8 1 8 1 8 1 8 1 8 1 8 1 8 7 8 7 8 7 8 10 8 10 8 10 10 8 10 8 8 10 8 ...

output:

25620

result:

ok single line: '25620'

Test #135:

score: 10
Accepted
time: 24ms
memory: 4548kb

input:

1
200000
6 5 6 6 1 6 1 6 10 4 10 6 10 6 10 6 10 6 10 6 10 6 10 6 10 6 10 6 1 6 7 6 7 6 7 6 7 6 7 6 7 6 6 7 6 7 6 7 6 7 6 7 6 7 6 7 6 7 6 7 7 6 7 6 7 6 7 6 7 6 7 6 9 10 9 10 9 10 9 10 9 10 9 10 9 10 10 9 10 9 10 9 10 3 10 3 10 3 10 3 10 4 10 4 10 4 10 4 9 4 9 4 9 4 9 7 9 7 9 7 9 7 9 7 9 7 9 7 9 7 9 7...

output:

25827

result:

ok single line: '25827'

Test #136:

score: 10
Accepted
time: 27ms
memory: 4500kb

input:

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

output:

25640

result:

ok single line: '25640'

Test #137:

score: 10
Accepted
time: 27ms
memory: 4556kb

input:

1
200000
5 6 4 6 4 4 5 6 5 6 5 4 5 6 6 5 4 6 4 5 4 5 5 4 5 4 6 4 6 4 6 5 4 6 4 6 5 6 4 5 6 4 5 6 5 6 5 4 5 4 6 4 5 5 5 4 5 4 5 4 5 4 6 4 6 5 6 5 5 4 6 5 6 5 5 6 5 8 4 6 8 4 6 4 4 8 4 6 8 6 4 8 4 6 6 8 6 8 4 8 4 8 4 6 4 6 8 4 8 4 8 6 6 8 6 8 6 4 8 8 6 8 8 4 6 4 8 4 6 8 4 8 4 8 6 4 8 6 8 6 4 6 4 8 4 4...

output:

54939

result:

ok single line: '54939'

Test #138:

score: 10
Accepted
time: 27ms
memory: 4600kb

input:

1
200000
4 3 4 3 4 3 4 3 4 3 4 4 3 4 4 3 9 3 9 3 9 3 9 3 9 3 10 9 3 10 3 9 3 10 3 9 3 10 3 10 3 10 3 10 3 10 3 10 3 10 3 10 3 3 10 3 10 3 10 3 10 3 10 3 10 10 3 3 8 3 10 3 8 3 10 3 8 10 10 8 10 8 10 8 10 8 10 8 10 8 10 8 10 8 10 8 10 8 10 8 10 8 10 8 10 8 10 8 10 8 10 8 8 10 8 10 8 10 8 10 8 10 8 10...

output:

50710

result:

ok single line: '50710'

Test #139:

score: 10
Accepted
time: 30ms
memory: 4480kb

input:

1
200000
6 10 2 10 2 10 6 2 2 10 10 2 10 6 2 6 2 10 6 2 6 10 6 10 6 2 6 2 6 10 2 6 10 6 2 10 2 2 10 2 10 6 10 6 2 10 6 2 6 10 6 2 10 6 6 2 6 10 10 6 10 10 6 10 6 2 10 2 6 2 10 2 10 6 10 2 10 6 10 6 2 6 10 2 10 2 6 10 2 6 2 10 2 10 2 6 10 2 6 10 6 10 4 10 4 4 2 10 4 10 4 10 2 10 4 2 2 10 4 10 2 4 10 ...

output:

51364

result:

ok single line: '51364'

Test #140:

score: 10
Accepted
time: 49ms
memory: 5196kb

input:

5
31438
7 5 5 3 5 3 3 7 5 1 7 4 4 4 4 2 2 7 3 3 1 2 2 7 2 4 7 3 4 6 7 1 1 4 3 4 4 3 3 3 1 4 3 1 3 7 3 6 1 4 4 7 4 6 6 6 7 4 6 4 1 1 2 7 6 2 3 4 3 4 2 2 3 4 6 3 2 2 1 3 6 2 4 4 7 2 5 5 3 5 3 5 6 5 5 4 5 5 4 2 5 5 7 2 5 6 2 6 6 6 6 6 2 7 7 5 1 1 5 3 6 5 7 6 1 4 3 5 4 4 6 7 7 4 7 1 6 7 6 2 2 3 4 1 6 1 ...

output:

22591
34465
68516
25897
380

result:

ok 5 lines

Test #141:

score: 10
Accepted
time: 21ms
memory: 4092kb

input:

5
80502
3 1 7 1 3 1 3 7 3 7 1 3 1 3 1 7 3 1 3 1 1 7 3 7 3 1 3 1 3 7 3 1 7 1 3 1 7 1 7 1 7 1 7 1 7 1 3 7 3 1 3 7 1 3 7 3 1 3 7 3 7 3 7 3 7 1 3 7 3 1 7 1 3 7 3 7 1 7 1 3 1 7 3 1 3 7 3 7 3 3 7 3 1 7 1 7 3 3 7 1 7 1 3 1 3 1 1 7 1 3 7 1 3 7 1 7 3 1 7 3 1 7 3 7 3 7 1 7 3 7 3 7 1 3 1 3 7 1 3 1 7 3 1 7 1 7 ...

output:

39267
6856
16735
26256
6758

result:

ok 5 lines

Test #142:

score: 10
Accepted
time: 21ms
memory: 4132kb

input:

5
39449
3 5 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 3 3 3 5 3 5 3 5 3 3 5 3 3 5 1 5 5 3 3 5 3 5 5 5 3 5 3 5 3 5 3 5 5 3 5 3 5 5 3 3 3 5 3 5 3 5 3 5 3 5 3 5 3 5 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 ...

output:

2639
3386
4659
334
2110

result:

ok 5 lines

Test #143:

score: 10
Accepted
time: 21ms
memory: 4224kb

input:

5
5953
1 5 1 4 1 5 1 4 1 5 1 4 1 5 1 4 1 5 1 4 1 5 1 4 1 5 1 4 1 5 1 3 5 3 2 3 5 3 2 3 5 3 7 5 7 6 7 5 7 6 7 5 7 1 5 1 2 1 5 1 2 1 5 1 2 1 5 1 6 5 6 7 6 5 6 2 5 2 4 2 5 2 4 2 5 2 4 2 5 2 4 2 5 2 4 2 5 2 4 2 5 2 4 2 5 2 4 2 5 2 4 2 5 2 4 2 5 2 1 5 1 7 1 5 1 7 1 5 1 4 5 4 3 4 5 4 3 4 5 4 7 5 7 2 7 5 7...

output:

4159
17937
96620
8083
21726

result:

ok 5 lines

Test #144:

score: 10
Accepted
time: 18ms
memory: 4040kb

input:

5
26964
2 5 2 5 2 5 2 2 5 5 2 5 2 5 2 5 2 5 2 5 2 6 6 2 6 2 2 6 2 6 2 6 2 6 2 2 1 2 3 2 3 2 3 2 7 7 2 7 2 2 7 7 2 7 2 7 2 7 2 7 7 2 7 7 2 7 1 7 4 4 7 6 6 7 6 6 7 6 7 6 7 7 6 6 6 6 7 6 7 6 7 6 7 6 7 7 6 7 6 2 6 2 6 2 6 2 2 6 6 2 6 2 2 6 2 6 2 6 2 6 2 6 2 6 2 6 2 2 6 2 6 2 6 2 2 6 2 6 2 6 2 6 6 2 6 2 ...

output:

3054
7918
8088
1992
2731

result:

ok 5 lines

Test #145:

score: 10
Accepted
time: 21ms
memory: 4320kb

input:

5
10441
5 6 5 6 5 6 5 6 5 6 1 6 1 6 1 6 1 6 1 6 1 6 1 6 1 6 1 6 1 6 1 6 1 6 1 6 1 6 1 6 1 6 1 6 1 6 1 6 1 6 1 6 1 6 1 6 1 6 1 6 1 6 1 6 1 6 4 6 4 6 4 6 4 6 4 6 4 6 4 6 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 7 7 7 6 7 6 7 6 6 7 6 7 6 7 6 7 6 7 6 7 6 7 6 7 6 7 6 7 4 7 4 7 4 7 ...

output:

2228
2939
7794
2791
17974

result:

ok 5 lines

Test #146:

score: 10
Accepted
time: 28ms
memory: 4064kb

input:

5
63586
3 4 7 8 2 9 8 7 3 6 5 5 1 7 2 4 7 2 10 3 1 8 6 10 1 7 6 5 4 10 10 1 2 4 6 10 8 8 7 7 1 3 7 2 6 1 10 4 4 3 10 4 5 4 4 3 1 7 5 3 7 10 3 10 8 5 10 4 6 9 6 7 5 7 3 3 9 2 6 7 5 9 6 2 3 10 6 4 6 8 10 6 8 5 1 3 6 2 3 6 5 4 3 7 2 4 9 3 9 4 7 1 7 7 10 1 6 5 4 8 3 3 8 8 10 4 2 8 4 1 6 1 8 2 9 3 3 10 2...

output:

51801
44778
7029
3998
50014

result:

ok 5 lines

Test #147:

score: 10
Accepted
time: 27ms
memory: 4488kb

input:

5
165460
6 7 4 7 4 7 4 7 7 6 7 7 4 7 6 7 4 7 7 4 6 6 4 6 7 6 4 6 4 6 7 6 4 7 6 4 7 4 6 7 4 6 6 4 7 6 7 4 7 6 4 6 7 4 7 4 6 6 4 4 6 7 7 4 6 4 7 4 4 4 7 4 7 4 4 6 7 4 7 4 4 7 7 6 4 7 6 7 4 8 6 8 4 6 6 8 8 8 4 8 4 4 6 4 6 4 8 4 8 6 4 8 6 4 6 8 4 6 8 6 4 6 8 4 8 4 6 8 6 8 4 8 6 4 6 8 4 6 4 6 4 6 4 4 6 4...

output:

71565
12332
1267
1638
987

result:

ok 5 lines

Test #148:

score: 10
Accepted
time: 26ms
memory: 4028kb

input:

5
21146
9 3 9 9 9 3 8 3 3 9 3 8 3 9 3 3 3 9 3 9 3 9 3 9 5 3 9 5 9 3 9 5 5 9 5 9 5 9 5 9 5 9 5 9 5 9 5 9 5 5 9 5 9 5 9 5 9 5 5 9 5 9 5 9 5 9 5 5 9 5 9 9 9 5 9 5 9 9 5 9 5 5 9 5 9 5 9 5 9 5 9 9 5 9 5 9 9 5 9 5 9 5 9 5 9 9 5 9 5 9 5 5 9 5 9 5 5 9 5 9 5 9 5 9 5 9 5 9 5 9 5 9 5 9 5 9 5 9 5 9 5 5 9 5 9 5 ...

output:

1582
4002
3180
2214
3804

result:

ok 5 lines

Test #149:

score: 10
Accepted
time: 27ms
memory: 4096kb

input:

5
27833
8 3 8 7 8 3 8 7 8 3 8 7 8 3 8 7 8 3 8 7 8 3 8 7 8 3 8 7 8 3 8 7 8 3 8 7 8 3 8 7 8 3 8 7 8 3 8 7 8 3 8 10 3 10 1 10 3 10 1 10 3 10 1 10 3 10 1 10 3 10 1 10 3 10 1 10 3 10 1 10 3 10 6 3 6 7 6 3 6 1 3 1 10 1 3 1 10 1 3 1 10 1 3 1 10 1 3 1 10 1 3 1 10 1 3 1 7 3 7 6 7 3 7 6 7 3 7 6 7 3 7 6 7 3 7 ...

output:

20420
5045
74592
21902
26524

result:

ok 5 lines

Test #150:

score: 10
Accepted
time: 21ms
memory: 3968kb

input:

5
62875
2 5 2 2 5 2 5 2 5 2 2 5 2 2 2 5 5 2 5 3 5 3 5 3 8 3 3 8 3 8 3 8 3 3 8 3 8 8 3 8 3 8 3 8 3 7 3 7 3 7 1 1 7 1 7 1 7 1 7 1 4 1 1 4 1 4 1 4 1 8 1 1 8 1 8 1 8 1 8 1 8 8 1 8 1 1 1 4 1 4 4 1 4 1 4 1 4 1 4 1 4 4 1 4 4 1 4 1 4 1 1 4 1 4 6 5 6 5 6 10 6 6 10 6 10 10 6 10 6 10 5 5 9 9 6 9 6 9 6 9 6 6 9 ...

output:

7432
3252
8288
5140
448

result:

ok 5 lines

Test #151:

score: 10
Accepted
time: 26ms
memory: 4052kb

input:

5
17501
3 1 3 7 3 1 3 7 1 7 1 3 7 3 7 3 7 1 1 7 1 3 1 3 1 7 1 7 3 1 3 7 3 7 1 7 3 7 1 3 1 7 1 3 7 3 7 1 3 7 3 7 3 1 3 1 3 7 1 7 1 7 3 7 3 1 3 7 3 7 1 3 7 3 1 3 7 3 7 1 7 1 7 1 7 3 1 7 3 1 7 1 7 1 3 7 7 3 1 3 7 1 7 1 3 1 3 3 7 1 3 7 1 7 3 1 3 1 7 3 7 1 3 1 7 3 7 3 7 1 7 7 3 7 3 7 3 1 7 3 7 1 3 7 1 3 ...

output:

9594
22507
2017
9617
53924

result:

ok 5 lines

Test #152:

score: 10
Accepted
time: 28ms
memory: 3868kb

input:

10
19971
2 4 9 3 9 1 10 2 10 2 5 8 3 3 2 7 5 3 2 5 8 6 2 5 3 5 6 2 8 10 9 5 7 10 2 2 9 7 4 9 10 2 3 2 2 10 6 1 5 3 8 8 1 7 6 6 2 8 10 6 2 1 3 6 1 5 3 7 6 1 4 3 2 2 3 5 3 2 9 4 3 1 1 10 6 8 6 6 10 4 3 3 8 1 5 8 3 10 5 9 4 10 6 8 6 2 5 2 2 6 8 3 2 2 9 4 8 1 2 9 5 6 7 10 10 3 6 5 6 4 8 6 5 1 6 7 2 2 1 ...

output:

15570
5273
1147
2125
9270
22092
29594
32800
7667
35158

result:

ok 10 lines

Test #153:

score: 10
Accepted
time: 25ms
memory: 4120kb

input:

10
1409
5 7 5 7 5 7 5 7 4 4 5 4 5 7 4 5 5 7 5 5 7 4 7 5 7 5 4 7 4 4 5 7 4 5 4 5 4 5 4 5 4 5 7 5 4 7 7 5 7 5 7 5 4 5 7 5 7 5 4 5 4 7 4 7 5 4 5 4 7 5 4 7 5 4 4 7 5 4 5 4 5 4 7 5 4 5 7 5 7 7 5 4 7 4 4 7 5 4 4 7 4 7 5 7 4 7 5 7 4 5 7 4 7 5 4 5 4 7 4 7 5 7 4 7 5 7 5 7 4 7 5 4 5 4 5 4 5 7 4 5 4 5 7 4 5 7 ...

output:

650
35953
5072
9541
12804
3615
2850
2157
6906
13231

result:

ok 10 lines

Test #154:

score: 10
Accepted
time: 26ms
memory: 3920kb

input:

10
3068
5 9 5 9 5 9 5 5 9 5 9 5 9 5 9 5 9 5 9 5 9 5 9 5 9 5 9 5 9 7 5 3 7 3 5 3 3 7 3 7 3 7 3 7 3 7 3 7 7 3 7 3 7 3 7 3 7 3 7 3 7 3 7 3 3 7 3 7 3 7 7 3 7 3 7 3 7 3 7 3 10 7 10 7 10 7 10 7 10 7 10 7 10 7 10 7 10 7 10 7 10 5 10 5 10 5 10 5 10 5 10 5 10 5 10 5 5 10 5 10 5 10 5 10 5 10 5 10 5 10 5 10 5 ...

output:

204
2149
1155
1115
991
3692
1579
2168
678
1240

result:

ok 10 lines

Test #155:

score: 10
Accepted
time: 26ms
memory: 3884kb

input:

10
1920
10 6 10 3 10 6 10 4 6 4 2 4 6 4 9 6 9 5 9 6 9 10 6 10 3 10 6 10 3 10 6 10 5 6 5 8 5 6 5 4 6 4 2 4 6 4 8 6 8 7 8 6 8 7 8 6 8 7 8 6 8 1 6 1 4 1 6 1 4 1 6 1 5 6 5 9 5 6 5 1 6 1 4 1 6 1 7 6 7 5 7 6 7 9 6 9 2 9 6 9 10 6 10 8 10 6 10 8 10 6 10 8 10 6 10 2 6 2 7 2 6 2 7 2 6 2 9 6 9 1 9 6 9 7 6 7 8 ...

output:

1282
2046
23379
6663
35969
40360
8461
620
3104
24727

result:

ok 10 lines

Test #156:

score: 10
Accepted
time: 27ms
memory: 4112kb

input:

10
35798
4 2 4 2 5 2 5 2 2 5 2 5 2 5 2 2 5 2 5 2 2 5 5 2 5 2 2 6 2 6 2 6 2 6 6 6 2 6 8 6 8 6 8 6 8 8 6 8 6 10 10 6 10 6 10 1 10 10 1 1 10 1 10 10 10 10 1 10 1 10 1 1 10 1 10 3 10 3 10 3 3 10 8 10 8 10 8 10 3 3 9 3 9 3 9 9 3 9 3 9 3 9 2 9 7 9 7 9 7 9 7 9 7 9 7 9 7 9 7 9 7 9 7 9 7 9 7 9 7 9 7 9 7 7 9 ...

output:

4227
1111
981
2894
1608
4548
8530
144
851
759

result:

ok 10 lines

Test #157:

score: 10
Accepted
time: 23ms
memory: 3864kb

input:

10
19664
8 3 8 3 8 3 8 3 8 3 6 3 6 3 6 3 6 3 6 3 6 10 6 10 6 10 10 6 10 6 1 2 10 2 10 1 6 1 1 6 1 6 1 4 4 1 4 1 4 1 4 1 4 1 1 4 2 4 2 4 2 4 2 4 2 4 2 4 3 4 3 4 3 4 4 3 4 3 4 3 4 3 4 4 3 4 3 8 3 8 3 8 3 3 8 8 3 8 3 8 3 8 3 8 3 8 8 3 8 3 8 3 8 3 8 3 8 3 8 8 3 8 3 8 8 3 10 3 10 10 3 10 3 10 3 10 3 10 3...

output:

7234
1736
6467
9165
5296
3407
1844
9426
2596
7120

result:

ok 10 lines

Test #158:

score: 10
Accepted
time: 59ms
memory: 4924kb

input:

40
4659
1 5 5 5 5 9 7 10 9 6 9 9 1 8 6 3 7 5 1 3 3 5 6 4 1 3 8 9 7 3 4 3 3 4 5 6 1 2 4 6 6 10 8 10 6 2 1 8 8 3 10 9 9 8 2 1 7 10 2 5 7 5 4 9 6 3 1 1 9 3 2 3 9 1 6 6 10 1 4 2 8 5 3 5 8 2 9 1 8 7 9 1 7 5 2 4 1 7 9 4 7 4 8 4 2 10 1 4 6 9 7 3 4 1 5 1 5 5 6 2 4 5 7 5 9 5 6 3 8 6 4 2 6 8 7 1 7 5 1 1 10 5 ...

output:

3618
1638
4366
1145
5820
3172
3021
558
4339
396
2287
10199
3959
38
7014
4576
2299
19022
1055
7055
7479
1830
1052
163
5597
722
8599
4688
1579
2200
917
5032
11201
6255
11268
1614
3637
1408
3632
1630

result:

ok 40 lines

Test #159:

score: 10
Accepted
time: 50ms
memory: 4784kb

input:

40
2659
3 4 2 4 3 2 3 4 3 2 4 3 2 3 4 4 4 3 2 4 2 3 2 4 3 2 3 2 3 2 4 2 3 4 3 4 2 4 2 3 2 3 4 2 4 2 4 3 2 3 2 4 2 4 3 2 4 4 2 4 3 2 3 2 3 4 3 2 3 4 3 2 3 2 4 3 4 3 2 3 4 2 4 3 2 4 3 4 3 2 4 3 4 2 3 4 3 4 4 3 4 3 2 4 2 3 2 3 4 2 3 4 2 3 4 2 3 4 2 3 2 3 2 4 3 4 3 4 2 2 2 4 2 3 2 4 4 2 4 2 4 2 3 2 4 3 ...

output:

1299
3684
2696
1494
153
400
2888
1651
4821
1622
3710
2502
377
2776
4960
457
1825
789
3808
1993
799
454
209
2305
1958
3720
8738
4637
2076
1025
2831
2262
5457
2709
3114
2917
1749
1823
1335
158

result:

ok 40 lines

Test #160:

score: 10
Accepted
time: 35ms
memory: 4736kb

input:

40
5834
8 9 8 9 8 9 8 9 8 9 8 9 8 9 8 9 8 9 6 8 6 8 6 8 6 8 6 8 6 8 6 8 6 8 6 8 6 8 6 8 6 8 6 8 6 8 6 8 6 8 6 8 6 8 8 1 6 1 8 1 8 1 8 1 8 1 8 1 8 1 8 1 8 8 1 8 1 8 1 8 1 8 1 1 8 7 8 7 8 7 7 8 7 8 7 8 7 8 7 8 7 8 7 8 7 8 7 8 8 8 7 8 7 8 7 8 7 8 7 8 7 8 7 8 7 8 7 8 7 8 7 8 7 8 7 8 7 8 7 8 7 8 7 8 7 8 ...

output:

434
106
610
887
283
258
55
456
285
983
110
427
119
241
496
93
1178
702
31
102
24
168
222
305
556
779
423
469
24
10
339
302
266
230
114
850
1263
15
179
282

result:

ok 40 lines

Test #161:

score: 10
Accepted
time: 47ms
memory: 4776kb

input:

40
18191
8 3 8 2 8 3 8 2 8 3 8 4 3 4 7 4 3 4 7 4 3 4 7 4 3 4 7 4 3 4 6 3 6 5 6 3 6 2 3 2 4 2 3 2 4 2 3 2 4 2 3 2 4 2 3 2 4 2 3 2 4 2 3 2 7 3 7 5 7 3 7 5 7 3 7 5 7 3 7 5 7 3 7 5 7 3 7 5 7 3 7 5 7 3 7 5 7 3 7 1 3 1 9 1 3 1 9 1 3 1 2 3 2 7 2 3 2 7 2 3 2 7 2 3 2 7 2 3 2 4 3 4 10 4 3 4 10 4 3 4 10 4 3 4 ...

output:

13161
538
5394
20556
822
3427
5646
4931
6727
794
3928
370
5593
12003
2195
1924
62
440
245
9001
84
2626
2679
147
2330
6373
482
1514
1161
877
2247
10013
2381
1737
1489
4311
251
1927
610
1601

result:

ok 40 lines

Test #162:

score: 10
Accepted
time: 27ms
memory: 4840kb

input:

40
3170
6 1 7 1 7 1 7 1 7 1 7 1 7 1 7 1 7 1 7 1 7 1 7 1 7 1 7 1 7 1 7 1 7 7 1 4 1 4 1 4 3 4 3 4 3 4 3 4 3 4 3 4 3 3 4 3 4 3 4 3 4 3 4 4 3 4 3 4 3 4 3 4 3 4 4 3 4 3 4 3 10 10 3 10 3 6 6 3 6 3 6 3 6 7 6 7 6 7 6 5 7 5 7 5 7 5 7 5 7 5 7 5 7 5 7 5 7 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 5 2 9 2 9 2...

output:

450
402
1042
824
242
747
659
874
174
890
834
502
38
916
538
754
96
823
161
116
748
712
707
2174
1107
1914
600
504
988
285
887
945
868
18
493
242
641
100
145
283

result:

ok 40 lines

Test #163:

score: 10
Accepted
time: 55ms
memory: 4884kb

input:

40
2690
1 9 9 8 10 9 8 9 8 9 10 8 1 9 1 9 1 9 1 10 9 1 9 10 1 10 9 10 9 10 9 10 1 9 10 9 1 9 10 9 1 9 10 9 6 1 6 9 1 9 6 9 1 6 1 6 1 6 1 6 9 1 6 9 1 6 1 9 1 6 1 9 1 6 9 1 6 9 6 1 6 1 1 6 9 6 9 6 9 6 1 6 9 6 1 6 9 6 9 1 9 6 1 6 7 4 3 4 3 7 3 4 4 7 3 7 4 6 10 6 10 6 10 6 10 6 10 6 6 10 6 10 6 10 6 10 ...

output:

923
1464
95
322
671
239
3698
18558
762
9990
2549
423
916
1475
315
373
12
885
73
720
3876
5412
520
1052
288
2425
2074
2425
144
5855
672
3722
2242
1376
784
3824
494
1019
244
4872

result:

ok 40 lines

Test #164:

score: 10
Accepted
time: 1452ms
memory: 4780kb

input:

400
791
10 10 8 9 10 10 7 1 2 8 1 7 3 6 3 6 6 5 2 6 8 1 1 3 8 7 1 9 2 1 2 6 10 4 1 1 10 5 10 4 7 9 7 8 10 10 10 2 4 3 8 1 10 3 4 7 10 6 6 5 4 4 1 1 2 6 7 9 5 1 5 3 3 1 9 6 4 1 3 1 1 8 4 6 9 8 5 9 5 6 9 3 5 8 7 1 5 6 3 8 3 5 5 10 5 4 8 10 8 7 6 10 6 1 6 1 10 7 10 4 1 8 1 10 2 8 9 6 10 5 4 5 4 9 4 1 4...

output:

643
289
134
1604
167
111
466
676
2108
795
146
313
232
7
191
192
473
228
2
74
99
1514
489
6
161
654
631
20
539
380
89
201
370
24
469
267
1287
401
834
473
558
495
463
330
193
29
114
248
669
358
637
1113
15
2852
1159
179
90
168
74
761
120
312
810
15
1568
63
417
73
688
232
280
75
29
1917
496
33
113
163
...

result:

ok 400 lines

Test #165:

score: 10
Accepted
time: 937ms
memory: 4808kb

input:

400
523
1 3 6 1 6 3 1 1 6 3 6 3 1 3 1 3 8 3 1 8 1 3 8 1 3 8 1 3 8 3 8 4 8 3 6 8 6 6 3 8 6 8 3 6 8 8 6 8 3 2 6 2 6 6 3 6 3 2 3 2 3 6 2 6 2 6 3 2 3 2 6 4 3 4 6 4 4 3 4 6 4 3 6 6 3 6 4 3 6 4 3 4 3 6 4 3 4 6 3 4 6 3 4 3 3 6 8 3 8 4 3 4 3 4 10 3 4 3 10 10 4 4 10 4 10 6 10 3 6 3 10 6 3 10 3 10 3 10 6 10 6...

output:

255
9
390
100
25
233
183
264
43
523
430
90
61
56
176
16
727
117
312
81
142
14
19
173
60
172
6
430
169
623
44
107
222
1
238
694
73
82
246
586
42
436
544
11
155
121
140
706
94
122
421
8
245
161
441
169
167
461
200
416
728
192
18
95
16
158
450
477
78
327
37
782
465
252
394
1034
55
227
343
128
555
901
4...

result:

ok 400 lines

Test #166:

score: 10
Accepted
time: 746ms
memory: 4812kb

input:

400
5
8 1 8 1 8
374
5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 1 1 5 1 5 1 1 5 5 1 5 5 5 1 5 1 5 1 1 5 5 1 5 1 1 5 1 5 5 1 1 5 1 5 1 5 1 5 1 5 5 1 5 1 5 1 5 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 5 1 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 1 1 5 1 5 1 5 1 5 1 5 1 5 1 ...

output:

2
22
80
11
4
24
84
65
80
70
26
143
80
149
74
79
29
4
2
23
22
76
57
19
84
19
12
87
31
8
62
2
15
101
25
99
18
9
16
20
31
9
10
12
2
48
19
36
68
8
53
12
4
66
57
30
41
4
22
27
10
40
113
59
9
19
31
2
19
93
13
6
11
28
54
67
10
105
6
7
28
28
4
91
142
12
49
11
24
2
4
2
32
2
4
21
2
51
6
7
7
37
53
4
36
24
10
8...

result:

ok 400 lines

Test #167:

score: 10
Accepted
time: 1024ms
memory: 4840kb

input:

400
709
1 4 1 2 1 4 1 2 1 4 1 2 1 4 1 2 1 4 1 2 1 4 1 2 1 4 1 2 1 4 1 2 1 4 1 2 1 4 1 2 1 4 1 2 1 4 1 5 4 5 8 5 4 5 8 5 4 5 8 5 4 5 8 5 4 5 3 4 3 10 3 4 3 10 3 4 3 10 3 4 3 10 3 4 3 10 3 4 3 10 3 4 3 10 3 4 3 10 3 4 3 10 3 4 3 10 3 4 3 10 3 4 3 10 3 4 3 10 3 4 3 10 3 4 3 10 3 4 3 10 3 4 3 6 4 6 1 6 ...

output:

516
572
72
375
376
83
167
383
97
622
11
148
1178
957
538
81
9
49
386
677
364
735
225
320
807
233
34
216
1991
135
702
17
7
76
12
531
656
1024
662
474
98
674
62
100
296
618
123
1438
307
622
214
529
135
684
101
1100
84
378
42
275
61
1417
138
716
1166
388
72
45
479
604
335
2
965
142
89
216
72
480
821
63...

result:

ok 400 lines

Test #168:

score: 10
Accepted
time: 1406ms
memory: 4680kb

input:

400
699
8 2 8 2 8 2 8 2 8 2 8 2 8 2 8 2 8 2 8 2 4 2 4 2 4 2 4 2 9 2 9 10 9 10 9 10 5 10 5 10 5 10 5 10 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 8 1 8 1 8 1 8 1 8 1 8 1 8 1 8 1 8 1 8 6 8 6 9 6 9 6 9 6 9 4 9 4 9 4 9 4 9 4 9 4 9 4 9 4 9 4 9 4 9 4 9 4 3 4 3 4 3 3 4 9 4 9 4 9 4 8 4 8 4...

output:

90
225
83
19
24
69
33
159
62
41
43
23
59
52
8
16
17
62
35
231
88
14
42
54
40
86
25
93
158
24
21
34
33
57
20
42
241
206
60
17
87
3
205
28
33
113
70
25
13
58
4
31
165
52
56
7
20
34
27
26
94
41
32
52
22
69
33
11
122
21
7
20
4
124
6
85
39
47
38
1
61
66
34
122
219
34
47
9
48
60
29
24
68
45
49
30
32
11
63...

result:

ok 400 lines

Test #169:

score: 10
Accepted
time: 1139ms
memory: 4856kb

input:

400
801
10 3 10 3 10 3 10 10 3 3 10 3 10 3 10 3 10 3 10 7 6 7 6 7 6 6 7 6 7 6 7 6 7 7 4 6 7 7 6 7 6 7 6 7 6 7 6 7 6 7 6 7 6 6 7 6 7 6 7 6 6 7 6 7 6 7 6 7 6 7 6 7 6 7 6 7 6 1 7 4 6 1 7 1 6 7 6 1 7 6 1 6 7 7 6 6 6 7 6 7 6 7 6 7 6 4 6 4 4 6 4 6 4 6 4 4 6 6 4 6 4 3 9 4 9 4 9 4 9 4 9 4 9 4 9 4 9 4 9 4 9 ...

output:

118
413
269
126
612
16
243
73
57
221
165
223
201
16
35
77
758
46
198
52
89
188
8
9
51
89
14
30
152
103
4
6
230
263
47
251
241
159
60
22
47
18
25
203
83
73
116
16
306
357
71
338
149
38
49
33
598
95
36
376
290
990
307
56
29
58
174
69
56
251
62
94
12
209
103
129
199
220
7
497
77
220
152
44
24
21
33
379...

result:

ok 400 lines

Test #170:

score: 10
Accepted
time: 549ms
memory: 4704kb

input:

5000
5
6 4 9 6 1
86
6 7 7 6 6 8 3 6 5 7 4 2 10 3 4 5 4 10 5 7 4 4 6 5 1 3 8 8 7 8 7 8 7 1 3 4 5 6 4 9 3 1 2 1 5 9 2 3 9 6 8 5 5 10 1 8 1 4 5 9 9 3 5 8 5 8 7 10 8 4 8 9 9 5 4 9 6 4 6 6 3 4 5 5 7 4
136
4 7 1 1 3 2 1 10 6 8 4 8 1 2 1 8 7 8 1 3 1 8 6 1 6 8 7 9 8 3 2 7 10 7 9 6 7 3 10 7 9 10 9 2 9 4 9 4 ...

output:

5
64
117
18
34
56
16
44
28
31
38
16
49
31
71
16
17
57
87
9
5
6
148
26
9
17
24
70
6
1
6
88
29
3
82
76
30
91
24
44
29
14
22
14
13
11
5
15
14
23
2
31
17
12
29
12
111
18
19
19
18
12
32
25
7
19
12
68
32
14
10
10
28
9
54
23
14
22
25
10
11
15
36
25
41
6
25
50
25
8
23
39
34
30
20
9
9
39
46
22
3
8
15
8
7
17
...

result:

ok 5000 lines

Test #171:

score: 10
Accepted
time: 375ms
memory: 4676kb

input:

5000
77
4 3 4 2 3 4 2 3 2 10 10 3 2 3 3 10 2 10 2 10 2 10 3 10 2 3 2 10 3 2 10 2 3 10 7 2 10 2 7 2 10 2 7 2 10 2 7 10 2 10 7 1 10 1 10 1 1 7 1 7 10 1 10 1 10 7 1 7 1 7 8 1 2 1 5 2 1
6
2 3 5 5 2 3
15
1 4 4 1 4 9 4 9 4 9 4 9 9 4 9
29
1 8 3 3 8 8 9 3 9 8 3 8 9 9 3 9 3 9 8 3 8 9 3 9 3 9 8 8 9
89
10 7 2 ...

output:

46
5
4
13
60
73
1
24
16
18
29
28
22
7
60
14
8
6
68
58
8
25
42
42
7
63
65
3
5
27
24
77
40
59
13
33
40
1
3
30
8
28
41
30
30
16
49
7
50
15
18
31
11
18
6
8
13
8
3
21
22
19
13
5
11
8
11
6
6
33
37
20
1
10
5
19
36
52
13
14
40
27
11
26
6
73
25
5
1
15
13
2
13
23
14
25
11
2
5
11
9
2
41
10
41
3
35
41
6
10
9
18...

result:

ok 5000 lines

Test #172:

score: 10
Accepted
time: 315ms
memory: 4684kb

input:

5000
9
5 8 5 8 5 8 5 8 5
9
7 2 7 2 7 2 7 2 7
81
6 7 6 7 6 7 7 6 7 6 7 6 7 6 7 6 7 6 7 6 7 6 7 6 7 6 7 6 7 6 7 6 7 6 7 6 7 7 6 7 6 7 6 7 6 7 6 7 6 7 6 7 6 7 6 7 6 7 7 6 7 6 7 6 7 6 7 6 7 6 7 6 7 6 7 6 7 6 7 6 7
76
3 5 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 5 3 5 3 5 3 5 5 3 5 3 5 3 5 3...

output:

2
2
2
2
2
2
8
2
2
2
7
11
2
2
2
10
2
4
2
9
9
18
6
1
2
5
5
7
6
2
2
2
2
2
9
2
2
2
14
2
2
25
1
19
10
13
11
11
2
2
23
2
1
2
2
4
6
2
1
1
20
2
14
2
2
2
14
7
2
2
7
2
2
2
2
2
7
2
2
16
14
2
6
2
9
2
21
4
2
5
2
2
5
4
6
2
1
13
2
2
24
9
2
2
13
2
2
6
2
4
2
1
10
5
2
2
5
5
2
11
2
2
2
2
1
2
6
12
4
13
5
8
2
2
12
10
2
...

result:

ok 5000 lines

Test #173:

score: 10
Accepted
time: 504ms
memory: 4676kb

input:

5000
109
9 6 9 1 9 6 9 2 6 2 10 2 6 2 5 6 5 9 5 6 5 9 5 6 5 3 10 3 2 3 10 3 2 3 10 3 2 3 10 3 2 3 10 3 9 10 9 7 9 10 9 7 9 10 9 7 9 10 9 7 9 10 9 7 9 10 9 7 9 10 9 7 9 10 9 7 9 10 9 7 9 10 9 3 10 3 4 3 10 3 4 3 10 3 1 10 1 6 1 10 1 6 1 10 1 6 1 10 1
20
9 2 5 7 10 10 2 3 2 2 8 4 9 7 2 6 6 5 1 2
35
10...

output:

78
16
25
6
3
19
48
15
7
13
28
7
5
36
48
8
10
85
49
44
2
3
16
21
25
65
26
91
23
2
81
34
17
28
19
16
15
4
15
79
6
18
5
27
44
10
30
35
54
13
26
35
143
19
27
27
2
22
11
31
32
63
4
14
55
59
28
16
31
7
43
46
34
2
45
41
10
53
18
64
11
50
49
14
52
28
50
2
36
8
42
12
39
8
25
1
176
6
9
47
48
17
5
21
35
5
23
1...

result:

ok 5000 lines

Test #174:

score: 10
Accepted
time: 426ms
memory: 4748kb

input:

5000
8
8 5 8 2 3 2 3 2
11
4 9 4 9 4 9 4 9 4 6 4
68
6 1 6 1 6 1 6 1 6 1 6 2 6 2 6 2 6 6 6 2 6 2 6 2 6 5 6 5 5 6 5 6 5 6 5 6 5 6 6 5 6 5 6 5 6 2 6 2 6 2 6 6 2 6 6 2 6 2 6 2 6 2 6 2 6 2 1 2
42
9 10 9 10 9 10 9 10 9 5 9 5 9 5 9 5 5 5 5 9 5 9 5 9 5 9 5 9 5 9 5 4 5 4 5 4 5 5 4 5 4 4
8
6 10 6 10 1 10 1 10
...

output:

4
4
9
6
4
9
10
9
3
3
1
1
6
2
2
5
10
9
4
7
4
2
6
10
4
2
18
3
3
2
4
2
6
13
6
11
4
19
9
4
4
14
10
2
2
2
6
4
3
2
4
6
2
12
1
5
16
24
16
5
6
2
6
2
3
4
3
2
2
2
8
9
2
2
8
2
2
10
2
11
7
2
9
2
13
3
4
9
14
11
6
15
5
7
4
24
21
7
17
6
2
2
2
10
4
8
4
4
17
9
3
2
2
4
2
3
7
4
2
2
3
2
2
4
10
7
2
12
20
15
2
2
6
11
4
4...

result:

ok 5000 lines

Test #175:

score: 10
Accepted
time: 465ms
memory: 4572kb

input:

5000
1
6
68
5 9 9 5 9 5 9 5 5 7 1 7 1 7 6 1 6 7 6 7 6 2 7 6 2 7 10 2 7 2 4 2 4 2 5 4 5 1 9 1 9 1 9 1 9 1 9 1 7 2 2 1 2 7 2 1 1 7 9 7 5 6 7 5 6 10 3 10
3
7 1 7
1
9
18
3 2 7 1 4 7 9 7 4 7 4 7 4 7 4 7 4 7
18
2 10 2 4 9 10 9 10 9 1 6 1 6 1 5 6 5 5
96
10 6 10 1 10 4 2 4 2 4 2 4 2 4 2 3 1 7 3 6 10 6 10 6 ...

output:

1
37
2
1
9
9
39
27
31
9
9
42
11
13
14
22
10
22
4
39
20
26
26
33
38
15
3
7
12
10
30
18
24
13
1
13
2
1
12
16
7
2
6
13
11
40
14
7
15
17
6
4
2
18
82
7
5
8
29
14
7
15
1
76
2
1
8
52
9
62
26
13
51
10
14
32
35
16
11
47
18
6
19
13
6
39
19
5
22
12
3
9
9
11
60
9
17
10
6
7
31
33
7
60
4
42
7
8
6
8
15
6
9
13
4
10...

result:

ok 5000 lines

Test #176:

score: 10
Accepted
time: 781ms
memory: 4744kb

input:

40000
3
4 7 4
10
9 5 6 8 3 10 7 2 4 2
3
2 9 2
2
4 6
3
9 3 1
3
2 1 10
1
3
2
1 5
4
10 8 7 10
7
5 5 4 8 9 2 3
6
2 4 10 6 4 10
1
8
3
2 9 8
2
10 4
1
8
7
1 9 8 7 4 2 5
7
9 9 3 2 1 8 2
1
7
7
3 8 6 7 2 1 5
4
1 8 3 5
4
3 8 5 4
2
2 1
7
3 6 4 1 7 1 2
9
1 8 6 4 3 10 4 6 2
1
6
5
3 9 3 5 2
1
10
3
6 1 8
4
8 9 5 7
...

output:

2
9
2
2
3
3
1
2
4
6
6
1
3
2
1
7
6
1
7
4
4
2
6
9
1
4
1
3
4
2
4
1
5
6
1
1
3
10
2
23
3
3
4
10
1
9
1
4
4
4
4
4
1
13
2
1
11
1
3
2
4
5
1
3
7
2
5
7
3
1
3
1
6
1
7
1
2
2
2
7
4
8
4
2
3
1
4
12
3
3
1
1
1
4
8
1
20
15
3
1
20
1
2
4
2
4
3
1
2
10
10
5
10
1
1
5
3
8
5
8
1
5
1
8
5
5
11
3
2
4
1
2
8
9
2
3
4
4
3
1
4
4
5
3...

result:

ok 40000 lines

Test #177:

score: 10
Accepted
time: 686ms
memory: 4676kb

input:

40000
1
6
6
7 9 7 5 9 5
11
10 3 10 7 10 7 7 8 5 8 10
2
7 5
2
9 10
3
8 2 1
10
10 6 10 6 10 3 6 8 6 9
1
2
2
7 9
5
5 8 2 5 2
11
10 1 10 9 1 9 4 5 9 4 5
3
7 2 7
12
6 10 6 10 8 6 8 10 6 8 10 6
26
1 10 1 9 9 10 1 9 10 2 1 9 1 9 2 1 2 2 2 1 2 9 2 9 2 2
4
8 2 3 9
3
7 9 1
2
5 8
3
5 7 5
17
8 10 8 10 6 8 10 6 ...

output:

1
4
7
2
2
3
6
1
2
4
9
2
8
14
4
3
2
2
11
2
1
1
4
1
2
1
3
8
1
2
1
3
3
3
4
6
3
1
17
3
1
2
3
2
3
2
2
1
4
2
2
1
3
1
2
3
7
3
1
3
5
8
3
2
9
1
4
2
3
2
2
4
5
2
1
13
2
4
3
2
1
4
3
4
2
3
1
2
2
2
1
6
1
1
1
9
1
7
9
10
9
4
5
3
2
2
6
5
5
1
3
1
2
3
1
1
3
1
7
1
1
6
5
1
1
7
2
1
7
6
2
2
10
1
5
5
1
3
2
1
2
1
1
2
2
10
1...

result:

ok 40000 lines

Test #178:

score: 10
Accepted
time: 746ms
memory: 4584kb

input:

40000
8
5 5 3 5 3 5 3 5
9
1 6 1 6 1 1 6 1 6
1
2
8
3 4 3 4 3 3 4 3
2
4 5
1
1
2
4 7
1
3
1
2
2
4 5
1
3
2
5 3
3
3 5 3
2
7 5
2
7 2
3
6 1 6
8
1 5 1 7 5 7 5 7
1
9
6
3 5 3 5 3 5
1
10
4
9 8 9 8
9
9 8 9 8 9 8 9 8 9
2
9 2
2
1 10
4
9 8 9 8
10
7 7 5 7 5 7 5 7 5 7
9
1 7 1 7 1 7 1 7 1
11
1 4 1 4 1 4 1 4 4 1 4
2
1 ...

output:

2
2
1
2
2
1
2
1
1
2
1
2
2
2
2
2
4
1
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
1
2
2
3
3
2
2
1
2
2
1
2
2
2
2
2
2
2
1
2
2
1
2
2
2
2
2
1
2
2
2
2
2
2
2
2
6
2
1
2
2
1
1
2
1
2
1
2
2
2
2
2
2
1
2
2
2
1
2
2
2
1
2
1
2
1
2
2
2
2
1
2
2
1
2
2
1
2
2
1
2
2
2
1
2
2
2
2
2
1
2
1
2
2
2
2
2
2
2
2
1
1
2
2
2
2
1
1
2
2
2
...

result:

ok 40000 lines

Test #179:

score: 10
Accepted
time: 666ms
memory: 4536kb

input:

40000
18
5 4 3 8 1 5 8 8 5 2 8 4 5 7 1 3 5 3
2
4 10
4
5 7 5 10
5
1 5 6 3 2
1
4
7
8 1 1 3 4 3 4
2
4 3
7
7 1 9 2 4 8 3
2
5 8
18
2 10 9 8 2 5 4 8 10 5 3 1 8 4 10 6 5 2
3
8 6 9
5
7 5 8 2 9
2
9 3
1
3
4
2 7 1 6
16
5 2 4 1 7 2 6 8 9 3 10 8 10 3 2 6
1
4
11
7 4 9 9 7 2 4 5 9 3 4
2
3 8
6
5 10 6 5 4 10
7
1 8 2...

output:

14
2
3
5
1
4
2
7
2
18
3
5
2
1
4
15
1
10
2
6
6
1
2
3
4
1
1
8
1
1
4
7
2
3
2
14
3
1
1
5
15
3
1
6
2
2
1
5
3
4
2
3
5
1
1
11
5
5
7
2
6
1
1
8
2
10
6
2
1
6
4
2
4
5
2
5
1
3
1
3
7
2
4
10
14
2
2
3
7
5
9
2
5
5
2
2
3
1
5
11
1
2
4
2
7
6
1
3
2
1
4
3
4
2
7
3
5
6
7
3
5
3
1
4
3
1
3
9
1
1
2
2
2
1
3
4
2
1
4
18
1
3
5
1
...

result:

ok 40000 lines

Test #180:

score: 10
Accepted
time: 685ms
memory: 4572kb

input:

40000
6
6 3 6 3 6 3
1
1
2
1 5
3
1 6 1
2
3 4
2
2 3
2
4 5
2
1 8
1
6
5
1 8 1 8 1
13
2 10 2 10 2 10 10 2 10 2 10 2 10
2
7 3
6
7 6 7 1 7 1
3
8 7 8
3
10 9 10
1
9
8
9 4 9 4 9 4 9 9
4
10 5 10 5
5
6 4 6 4 6
15
4 10 4 10 4 4 10 4 10 4 4 10 4 10 4
10
7 1 7 1 7 1 7 1 7 7
6
3 8 3 8 3 3
10
4 4 3 4 10 4 10 4 10 4
...

output:

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

result:

ok 40000 lines

Test #181:

score: 10
Accepted
time: 653ms
memory: 4584kb

input:

40000
1
9
1
5
1
9
12
6 9 10 4 5 7 8 1 5 3 5 5
1
7
1
3
2
6 10
3
2 3 6
10
8 10 1 10 10 4 3 10 6 10
1
3
8
10 6 4 3 6 6 10 7
22
1 1 5 9 9 1 9 1 5 5 1 5 9 5 1 9 5 1 7 6 10 1
4
8 1 8 7
4
5 6 5 6
7
7 1 7 1 8 10 7
1
8
2
5 9
2
8 3
9
3 5 3 5 5 3 5 3 5
5
10 6 6 5 3
1
8
2
6 4
12
10 4 9 7 8 8 7 8 7 8 7 8
9
9 6 3...

output:

1
1
1
10
1
1
2
3
7
1
7
15
3
2
5
1
2
2
2
4
1
2
5
8
7
2
4
2
2
2
1
1
5
1
3
2
3
1
2
3
1
9
4
5
3
2
1
3
8
9
1
3
2
10
2
4
2
4
2
1
1
4
3
5
18
2
4
1
2
5
3
2
4
1
7
1
5
6
6
3
1
3
1
1
10
6
2
1
2
2
2
18
3
1
2
1
6
12
1
3
14
2
8
6
3
2
3
1
2
2
2
3
3
4
2
2
4
3
5
3
4
5
1
1
8
3
1
11
1
2
2
2
9
2
3
7
2
4
4
4
8
5
3
9
3
1...

result:

ok 40000 lines

Test #182:

score: 10
Accepted
time: 2ms
memory: 3872kb

input:

3
2397
5 1 7 7 5 5 5 2 6 1 6 2 5 2 2 7 7 2 1 3 5 7 5 3 4 2 5 2 5 6 5 1 7 5 3 7 2 6 7 3 3 1 2 3 4 7 2 7 3 6 6 6 5 2 6 7 4 7 5 3 6 5 7 6 2 1 1 1 4 1 6 7 3 4 1 7 7 2 7 7 2 6 1 1 7 6 6 2 1 3 2 3 3 4 1 6 7 2 3 2 2 2 5 3 1 7 4 5 7 4 2 3 4 7 3 3 5 7 3 6 7 3 4 7 4 6 1 6 2 6 2 6 2 4 6 6 3 6 2 5 5 7 4 5 1 3 6...

output:

1754
2724
3230

result:

ok 3 lines

Test #183:

score: 10
Accepted
time: 4ms
memory: 4864kb

input:

3
174
7 7 7 7 3 6 7 6 3 6 6 3 6 3 7 3 7 3 7 6 3 6 7 6 7 6 6 7 7 6 3 6 7 3 6 7 3 7 3 3 6 7 6 7 3 7 6 3 7 7 3 7 6 7 6 6 3 3 6 7 3 7 6 7 6 3 7 3 6 7 3 3 6 7 3 7 6 3 7 7 3 6 3 6 7 6 7 6 7 7 3 6 6 3 7 3 6 3 3 7 6 3 7 3 6 7 6 7 6 7 3 6 3 5 3 5 6 5 6 3 6 3 6 5 5 5 6 3 5 3 3 6 5 3 6 3 6 3 5 6 6 3 6 3 6 3 5 ...

output:

83
62
4581

result:

ok 3 lines

Test #184:

score: 10
Accepted
time: 1ms
memory: 3808kb

input:

3
2001
7 5 7 5 7 5 7 7 5 7 5 7 5 5 7 5 7 5 7 5 7 5 7 5 7 5 7 5 7 5 7 5 7 5 7 7 5 5 7 5 7 5 7 5 5 7 5 7 7 5 7 7 5 7 5 7 5 5 7 5 7 5 7 7 5 7 5 7 5 7 5 7 5 7 5 5 5 7 5 7 5 7 5 5 7 5 7 5 7 5 7 7 5 7 5 5 7 7 5 7 5 7 5 7 7 5 7 5 7 7 5 7 7 5 7 5 7 7 7 5 7 5 7 5 5 7 5 5 7 5 7 5 5 7 5 7 7 5 7 5 7 5 7 7 7 5 7...

output:

138
291
136

result:

ok 3 lines

Test #185:

score: 10
Accepted
time: 1ms
memory: 3796kb

input:

3
664
7 2 7 3 7 2 7 6 2 6 4 6 2 6 4 6 2 6 4 6 2 6 4 6 2 6 3 2 3 5 3 2 3 5 3 2 3 5 3 2 3 4 2 4 7 4 2 4 5 2 5 6 5 2 5 1 2 1 7 1 2 1 7 1 2 1 4 2 4 6 4 2 4 7 2 7 1 7 2 7 4 2 4 6 4 2 4 7 2 7 5 7 2 7 4 2 4 6 4 2 4 6 4 2 4 6 4 2 4 6 4 2 4 7 2 7 3 7 2 7 6 2 6 1 6 2 6 7 2 7 5 7 2 7 4 2 4 3 4 2 4 1 2 1 7 1 2 ...

output:

445
1161
5526

result:

ok 3 lines

Test #186:

score: 10
Accepted
time: 1ms
memory: 3788kb

input:

3
2492
5 6 5 6 5 6 5 6 5 2 5 2 5 2 7 2 7 7 2 7 2 7 2 7 2 7 2 7 2 7 2 2 7 6 7 6 7 6 7 6 7 5 7 5 5 7 5 7 5 7 5 7 5 7 3 3 3 7 2 7 2 6 1 6 1 6 1 6 1 6 6 1 1 6 1 6 1 6 1 6 1 2 1 1 2 1 1 2 1 2 1 2 1 2 1 1 1 5 1 5 4 5 4 5 4 1 4 1 4 1 4 1 2 1 2 1 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 5 2 5 2 5 2 6 2 6 7 6 7 6 6 7...

output:

294
521
359

result:

ok 3 lines

Test #187:

score: 10
Accepted
time: 2ms
memory: 3824kb

input:

3
1415
7 2 7 2 2 7 3 7 3 3 7 3 7 3 7 4 2 4 3 4 2 4 3 4 2 4 6 2 6 7 6 2 6 7 6 2 6 7 6 2 6 7 6 2 6 7 6 2 6 7 6 2 6 7 6 2 6 7 6 2 6 7 6 2 6 7 6 2 6 7 6 2 6 7 6 2 6 7 6 2 6 7 6 2 6 7 6 2 6 7 6 2 6 3 2 3 4 3 2 3 4 3 2 3 4 3 2 3 4 3 2 3 4 3 2 3 4 3 2 3 5 2 5 1 5 2 5 1 5 2 5 1 5 2 5 1 5 2 5 1 5 2 5 1 5 2 5...

output:

625
1436
596

result:

ok 3 lines

Test #188:

score: 10
Accepted
time: 22ms
memory: 4424kb

input:

3
17898
1 5 6 1 4 5 1 6 6 1 7 5 5 6 1 7 6 3 5 5 4 7 5 4 1 1 3 7 3 4 3 7 4 7 4 7 5 1 7 1 4 5 2 5 6 1 1 6 5 4 5 6 7 4 6 3 6 4 3 5 1 7 4 2 4 3 6 1 7 4 4 6 6 7 1 4 5 2 7 1 4 6 5 2 4 6 4 3 6 5 2 1 5 3 5 2 7 1 7 1 2 7 4 5 6 3 3 7 1 3 5 1 7 6 5 3 1 3 2 4 4 2 7 7 2 4 7 2 7 1 3 3 4 1 6 3 4 3 1 3 4 4 4 6 4 5 ...

output:

13568
148675
2837

result:

ok 3 lines

Test #189:

score: 10
Accepted
time: 19ms
memory: 4188kb

input:

3
38910
1 6 1 4 1 6 1 4 1 6 1 4 1 6 6 4 6 1 6 4 6 1 4 6 1 6 4 1 6 6 1 4 1 4 6 4 1 4 6 1 4 6 1 4 1 4 6 1 4 6 4 1 6 6 1 4 1 6 4 6 1 6 1 4 1 4 6 6 4 6 1 6 1 4 1 4 1 6 4 1 6 1 4 4 1 4 1 4 6 1 6 1 4 6 1 6 1 4 1 4 1 6 1 4 1 4 6 1 4 1 6 1 6 1 6 4 4 1 6 4 1 4 6 1 1 4 6 4 6 4 1 6 6 1 4 6 6 4 6 4 1 4 1 6 1 1 ...

output:

16989
42639
32426

result:

ok 3 lines

Test #190:

score: 10
Accepted
time: 21ms
memory: 4268kb

input:

3
47211
7 2 7 2 7 2 7 2 7 2 7 2 7 2 7 2 7 2 7 2 7 2 7 2 7 2 7 2 7 2 7 2 7 3 7 3 7 3 7 5 7 5 7 5 7 5 7 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 4 5 3 5 3 5 3 5 3 5 3 5 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 5 3 6 3 6 3 6 3 6 3 6 3 6 3 6 3 6 3 6 3 6 3 6 3 6 3 5 3 5 3 5 3 ...

output:

3525
1703
8644

result:

ok 3 lines

Test #191:

score: 10
Accepted
time: 21ms
memory: 4116kb

input:

3
92161
4 7 4 3 4 7 4 3 4 7 4 1 7 1 2 1 7 1 2 1 7 1 2 1 7 1 2 1 7 1 6 4 6 3 6 4 6 3 6 4 6 3 6 4 6 3 6 4 6 3 6 4 6 3 6 4 6 3 6 4 6 3 6 4 6 3 6 4 6 3 6 4 6 3 6 4 6 3 6 4 6 3 6 4 6 3 6 4 6 3 6 4 6 3 6 4 6 3 6 4 6 3 6 4 6 3 6 4 6 3 6 4 6 3 6 4 6 3 6 4 6 3 6 4 6 3 6 4 6 3 6 4 6 3 6 4 6 3 6 4 6 3 6 4 6 3 ...

output:

68687
56160
24330

result:

ok 3 lines

Test #192:

score: 10
Accepted
time: 21ms
memory: 4068kb

input:

3
81167
1 6 6 1 3 1 3 1 1 3 1 3 1 3 1 3 1 5 5 1 5 3 5 3 5 3 5 3 5 3 5 5 3 5 5 3 3 3 5 3 5 3 5 3 5 5 3 5 5 3 5 3 5 3 5 3 4 4 3 4 3 4 3 4 3 4 3 4 3 4 3 1 1 3 1 1 1 3 1 3 1 3 1 3 3 1 1 3 1 3 1 1 3 1 3 1 3 1 3 1 3 1 5 5 6 5 6 5 6 1 6 1 6 1 6 1 1 6 1 6 1 6 1 6 1 6 1 6 1 6 1 6 1 6 1 7 1 7 7 1 7 2 7 2 5 5 ...

output:

9129
1840
11031

result:

ok 3 lines

Test #193:

score: 10
Accepted
time: 18ms
memory: 4132kb

input:

3
7124
3 6 5 6 5 2 5 5 2 5 2 5 2 5 5 2 5 2 5 2 5 4 2 2 6 2 3 2 3 2 3 2 3 2 3 3 2 2 2 3 2 3 2 2 3 2 6 2 2 6 6 2 6 3 6 6 3 6 3 6 3 6 3 6 2 2 6 2 6 2 6 2 6 2 6 2 6 2 6 2 6 6 2 6 2 6 2 6 2 6 2 3 2 3 2 4 2 4 2 4 2 4 2 4 2 4 5 4 5 4 5 4 5 4 5 4 3 4 4 3 4 4 3 4 3 6 6 3 3 6 3 3 6 3 6 3 3 6 3 4 3 4 3 4 3 7 7...

output:

3675
19486
16811

result:

ok 3 lines

Subtask #6:

score: 0
Wrong Answer

Dependency #3:

100%
Accepted

Test #194:

score: 0
Wrong Answer
time: 1ms
memory: 3740kb

input:

3
2446
75658187 571962292 710943961 75658187 571962292 710943961 75658187 571962292 710943961 75658187 571962292 710943961 75658187 571962292 710943961 75658187 75658187 571962292 710943961 75658187 571962292 710943961 75658187 571962292 710943961 75658187 571962292 710943961 75658187 571962292 7109...

output:


result:

wrong answer 1st lines differ - expected: '1976', found: ''

Subtask #7:

score: 0
Skipped

Dependency #1:

0%