QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#863922#9982. Staircase Museumucup-team253#AC ✓108ms35416kbC++233.0kb2025-01-20 02:51:232025-01-20 02:51:24

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3584kb

input:

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

output:

2
3
3
4

result:

ok 4 number(s): "2 3 3 4"

Test #2:

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

input:

1
1
1 1000000000

output:

1

result:

ok 1 number(s): "1"

Test #3:

score: 0
Accepted
time: 6ms
memory: 3584kb

input:

9653
1
1 1
2
1 1
1 1
3
1 1
1 1
1 1
4
1 1
1 1
1 1
1 1
5
1 1
1 1
1 1
1 1
1 1
6
1 1
1 1
1 1
1 1
1 1
1 1
6
1 2
1 2
1 2
1 2
1 2
2 2
6
1 1
1 1
1 1
1 1
1 1
1 2
6
1 2
1 2
1 2
1 2
1 2
2 3
5
1 2
1 2
1 2
1 2
2 2
6
1 2
1 2
1 2
1 2
2 2
2 2
6
1 3
1 3
1 3
1 3
2 3
3 3
6
1 2
1 2
1 2
1 2
2 2
2 3
6
1 3
1 3
1 3
1 3
2 3...

output:

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

result:

ok 9653 numbers

Test #4:

score: 0
Accepted
time: 30ms
memory: 3584kb

input:

40000
7
1 1
1 1
1 1
1 1
1 1
1 1
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6
6
6
6
6
6
6
6
6
6
5
6
6
6
6
6
6
6
6
6
6
6
6
6
7
7
6
6
7
7
6
6
7
7
6
7
6
6
7
7
6
6
7
7
6
6
7
7
6
7
5
6
6
6
6
6
6
6
5
6
6
6
6
6
6
6
6
6
7
7
6
6
7
7
6
7
6
6
7
7
6
6
7
7
6
7
5
6
6
6
6
6
7
7
6
7
4
5
5
5
...

result:

ok 35412 numbers

Test #6:

score: 0
Accepted
time: 49ms
memory: 3712kb

input:

62500
8
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
8
1 2
1 2
1 2
1 2
1 2
1 2
1 2
2 2
8
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 2
8
1 2
1 2
1 2
1 2
1 2
1 2
1 2
2 3
8
1 2
1 2
1 2
1 2
1 2
1 2
2 2
2 2
8
1 3
1 3
1 3
1 3
1 3
1 3
2 3
3 3
8
1 2
1 2
1 2
1 2
1 2
1 2
2 2
2 3
8
1 3
1 3
1 3
1 3
1 3
1 3
2 3
3 4
8
1 1
1 1
1 1
1 1
1 1
...

output:

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

result:

ok 62500 numbers

Test #7:

score: 0
Accepted
time: 50ms
memory: 3584kb

input:

62500
8
1 3
1 3
2 5
3 6
3 6
3 6
5 7
6 8
8
1 3
1 3
2 5
3 7
3 7
3 7
5 8
7 9
8
1 3
1 3
2 5
3 6
3 6
3 6
5 7
7 7
8
1 3
1 3
2 5
3 6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6
6
6
6
6
6
7
7
6
6
7
7
6
6
7
7
6
7
6
6
7
7
6
6
7
7
6
6
7
7
6
7
5
6
6
6
6
6
6
6
5
6
6
6
6
6
6
6
6
6
7
7
6
6
...

result:

ok 62500 numbers

Test #9:

score: 0
Accepted
time: 50ms
memory: 3584kb

input:

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

output:

6
6
6
6
6
6
6
6
6
6
5
5
6
6
5
5
6
6
5
5
6
6
5
6
5
6
6
6
6
6
6
6
6
6
6
6
6
6
5
6
6
6
6
6
6
6
5
6
6
6
6
6
6
6
5
6
6
6
6
6
6
6
6
6
5
6
6
6
6
6
6
6
6
6
5
6
6
6
5
6
6
6
6
6
4
5
5
5
5
6
6
6
5
5
6
6
5
6
5
6
6
6
6
6
4
5
5
5
5
5
5
5
5
6
6
6
6
6
6
6
5
5
6
6
5
5
6
6
5
6
5
6
6
6
6
6
6
6
6
6
5
6
6
6
5
6
6
6
6
6
...

result:

ok 62500 numbers

Test #10:

score: 0
Accepted
time: 50ms
memory: 3712kb

input:

62500
8
1 1
1 4
1 5
1 7
3 8
4 8
7 8
8 9
8
1 1
1 4
1 5
1 7
3 9
4 9
7 9
9 10
8
1 1
1 4
1 5
1 6
3 7
4 7
6 8
6 8
8
1 1
1 4
1 5
1 7
3 8
4 8
6 9
7 9
8
1 1
1 4
1 5
1 6
3 7
4 7
6 8
6 9
8
1 1
1 4
1 5
1 7
3 8
4 8
6 9
7 10
8
1 1
1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
6
6
6
5
6
6
6
...

result:

ok 62500 numbers

Test #12:

score: 0
Accepted
time: 50ms
memory: 3712kb

input:

62500
8
1 2
1 5
2 7
4 8
5 8
5 8
7 9
8 10
8
1 2
1 5
2 7
4 9
5 9
5 9
7 10
9 11
8
1 2
1 5
2 7
4 8
5 8
5 8
7 9
9 9
8
1 2
1 5
2 7
4 8
5 8
5 8
7 9
9 10
8
1 2
1 5
2 6
4 7
5 7
5 7
7 7
7 7
8
1 2
1 5
2 6
4 8
5 8
5 8
7 8
8 8
8
1 2
1 5
2 6
4 7
5 7
5 7
7 7
7 8
8
1 2
1 5
2 6
4 8
5 8
5 8
7 8
8 9
8
1 2
1 5
2 6
4 8
...

output:

6
6
6
6
5
6
6
6
5
6
6
6
5
6
6
6
6
6
5
6
6
6
6
6
5
6
6
6
6
6
6
6
6
6
6
6
6
7
7
7
7
7
7
7
7
7
7
7
6
6
7
7
6
6
7
7
6
6
7
7
6
7
6
7
7
7
7
7
7
7
7
7
7
7
7
7
6
7
7
7
7
7
7
7
6
7
7
7
7
7
7
7
6
7
7
7
7
7
7
7
7
7
6
7
7
7
7
7
7
7
7
7
6
7
7
7
6
7
7
7
6
7
7
7
7
7
6
7
7
7
7
7
5
5
6
6
5
5
6
6
5
5
6
6
5
6
6
6
5
6
...

result:

ok 62500 numbers

Test #13:

score: 0
Accepted
time: 52ms
memory: 3584kb

input:

62500
8
1 3
2 4
2 4
2 7
3 8
6 9
7 10
7 10
8
1 3
2 4
2 4
2 8
3 9
6 10
7 11
8 11
8
1 3
2 4
2 4
2 7
3 8
6 9
7 10
7 11
8
1 3
2 4
2 4
2 8
3 9
6 10
7 11
8 12
8
1 3
2 4
2 4
2 7
3 8
6 9
7 10
8 10
8
1 3
2 4
2 4
2 7
3 9
6 10
7 11
9 11
8
1 3
2 4
2 4
2 7
3 8
6 9
7 10
8 11
8
1 3
2 4
2 4
2 7
3 9
6 10
7 11
9 12
8
...

output:

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

result:

ok 62500 numbers

Test #14:

score: 0
Accepted
time: 50ms
memory: 3712kb

input:

62500
8
1 2
2 3
2 5
2 5
5 5
5 6
5 7
6 8
8
1 2
2 3
2 5
2 5
5 5
5 7
5 8
7 9
8
1 2
2 3
2 5
2 5
5 5
5 6
5 7
7 7
8
1 2
2 3
2 5
2 5
5 5
5 6
5 7
7 8
8
1 2
2 3
2 6
2 6
5 6
5 7
6 8
6 8
8
1 2
2 3
2 7
2 7
5 7
5 8
6 9
7 9
8
1 2
2 3
2 6
2 6
5 6
5 7
6 8
6 9
8
1 2
2 3
2 7
2 7
5 7
5 8
6 9
7 10
8
1 2
2 3
2 6
2 6
5 6...

output:

7
7
6
7
6
6
7
7
6
6
7
7
6
7
5
6
6
6
6
6
7
7
6
7
5
6
6
6
6
6
6
6
6
7
7
7
7
7
7
7
6
6
7
7
6
6
7
7
6
7
6
7
7
7
7
7
7
7
7
7
6
7
7
7
6
7
7
7
7
7
4
4
5
5
4
5
5
5
4
5
5
5
5
5
5
5
5
5
6
6
5
5
6
6
5
6
5
5
6
6
5
5
6
6
5
6
4
5
5
5
5
6
6
6
5
5
6
6
5
6
5
6
6
6
6
6
4
5
5
5
5
5
5
5
5
6
6
6
6
6
6
6
5
5
6
6
5
5
6
6
...

result:

ok 62500 numbers

Test #15:

score: 0
Accepted
time: 52ms
memory: 3712kb

input:

62500
8
1 2
2 3
2 5
3 8
5 9
7 10
8 10
10 11
8
1 2
2 3
2 5
3 8
5 9
7 11
8 11
11 12
8
1 2
2 3
2 5
3 7
5 8
7 9
7 10
7 10
8
1 2
2 3
2 5
3 8
5 9
7 10
7 11
8 11
8
1 2
2 3
2 5
3 7
5 8
7 9
7 10
7 11
8
1 2
2 3
2 5
3 8
5 9
7 10
7 11
8 12
8
1 2
2 3
2 5
3 7
5 8
7 9
7 10
8 10
8
1 2
2 3
2 5
3 7
5 9
7 10
7 11
9 11...

output:

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

result:

ok 62500 numbers

Test #16:

score: 0
Accepted
time: 53ms
memory: 3712kb

input:

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

output:

8
8
8
8
8
8
8
8
8
8
8
8
7
8
8
8
8
8
8
8
8
8
8
8
8
8
7
8
8
8
8
8
8
8
7
8
8
8
8
8
8
8
7
8
8
8
8
8
8
8
8
8
7
8
8
8
8
8
8
8
8
8
7
8
8
8
7
8
8
8
7
8
8
8
8
8
7
8
8
8
8
8
6
6
7
7
6
6
7
7
6
6
7
7
6
6
7
7
6
7
7
7
6
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
8
8
7
7
8
8
7
7
8
8
7
7
8
8
7
7
8
8
7
8
7
7
8
8
7
7
...

result:

ok 62500 numbers

Test #17:

score: 0
Accepted
time: 10ms
memory: 3712kb

input:

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

output:

6
6
6
6
6
6
6
6
6
6
7
7
6
6
7
7
6
6
7
7
6
7
6
6
7
7
6
6
7
7
6
6
7
7
6
7
5
6
6
6
6
6
6
6
5
6
6
6
6
6
6
6
6
6
7
7
6
6
7
7
6
7
6
6
7
7
6
6
7
7
6
7
5
6
6
6
6
7
7
7
6
6
7
7
6
7
6
7
7
7
7
7
5
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
6
6
7
7
6
6
7
7
6
6
7
7
6
6
7
7
6
7
6
7
7
7
7
7
7
7
...

result:

ok 10936 numbers

Test #18:

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

input:

9653
1
30015435 30015435
2
560111483 560111483
560111483 560111483
3
671161719 671161719
671161719 671161719
671161719 671161719
4
164070441 164070441
164070441 164070441
164070441 164070441
164070441 164070441
5
131260535 131260535
131260535 131260535
131260535 131260535
131260535 131260535
1312605...

output:

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

result:

ok 9653 numbers

Test #19:

score: 0
Accepted
time: 40ms
memory: 3712kb

input:

40000
7
678310982 678310982
678310982 678310982
678310982 678310982
678310982 678310982
678310982 678310982
678310982 678310982
678310982 678310982
7
210257381 485183246
210257381 485183246
210257381 485183246
210257381 485183246
210257381 485183246
210257381 485183246
485183246 485183246
7
26133619...

output:

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

result:

ok 40000 numbers

Test #20:

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

input:

35412
7
137686946 139179432
137686946 388616911
139179432 465280990
184972976 606619589
227442399 843832933
388616911 843832933
465280990 843832933
7
173446650 301063237
173446650 473272425
301063237 759102539
378957531 780576289
465003986 953192750
473272425 953192750
759102539 953192750
7
5731930 ...

output:

6
6
6
6
6
6
6
6
6
6
6
6
6
6
7
7
6
6
7
7
6
6
7
7
6
6
7
7
7
7
6
6
7
7
6
6
7
7
6
6
7
7
6
6
7
7
7
7
5
6
6
6
6
6
6
6
6
6
6
6
5
6
6
6
6
6
6
6
6
6
6
6
6
6
7
7
6
6
7
7
6
6
7
7
7
7
6
6
7
7
6
6
7
7
6
6
7
7
7
7
5
6
6
6
6
6
6
6
5
6
6
6
6
6
6
6
6
6
7
7
6
6
7
7
7
7
6
6
7
7
6
6
7
7
7
7
6
7
7
7
6
7
7
7
7
7
4
5
5
5
...

result:

ok 35412 numbers

Test #21:

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

input:

62500
8
202793139 202793139
202793139 202793139
202793139 202793139
202793139 202793139
202793139 202793139
202793139 202793139
202793139 202793139
202793139 202793139
8
967302241 982889607
967302241 982889607
967302241 982889607
967302241 982889607
967302241 982889607
967302241 982889607
967302241 ...

output:

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

result:

ok 62500 numbers

Test #22:

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

input:

62500
8
22334282 347814460
22334282 347814460
109879832 501554044
347814460 667483008
347814460 667483008
347814460 667483008
501554044 931484764
667483008 990701760
8
320421451 385561436
320421451 385561436
365223027 633520867
385561436 822725378
385561436 822725378
385561436 822725378
633520867 96...

output:

5
5
5
5
4
5
5
5
4
5
5
5
4
5
5
5
5
5
4
5
5
5
5
5
4
5
5
5
5
5
5
5
5
5
5
5
5
6
6
6
6
6
6
6
6
6
6
6
5
5
6
6
5
5
6
6
5
5
6
6
6
6
5
6
6
6
6
6
6
6
6
6
6
6
6
6
5
6
6
6
6
6
6
6
5
6
6
6
6
6
6
6
5
6
6
6
6
6
6
6
6
6
5
6
6
6
6
6
6
6
6
6
5
6
6
6
5
6
6
6
5
6
6
6
6
6
5
6
6
6
6
6
4
4
5
5
4
4
5
5
4
4
5
5
5
5
5
5
4
5
...

result:

ok 62500 numbers

Test #23:

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

input:

62500
8
136296443 672006606
521890415 672006606
672006606 763936940
672006606 763936940
763936940 829600368
763936940 829600368
829600368 829600368
829600368 829600368
8
179993721 247626669
239875367 247626669
247626669 794889746
247626669 794889746
794889746 856719032
794889746 856719032
817917681 ...

output:

5
6
6
6
5
6
6
6
5
6
6
6
6
6
5
6
6
6
6
6
5
6
6
6
6
6
6
6
6
7
7
7
7
7
7
7
6
6
7
7
6
6
7
7
7
7
6
7
7
7
7
7
7
7
7
7
6
7
7
7
6
7
7
7
6
7
7
7
7
7
6
7
7
7
7
7
5
5
6
6
5
5
6
6
6
6
6
6
5
6
6
6
6
6
6
6
6
6
6
6
6
6
7
7
6
6
7
7
6
6
7
7
7
7
6
6
7
7
6
6
7
7
6
6
7
7
7
7
5
6
6
6
6
6
6
6
5
6
6
6
6
6
6
6
6
6
7
7
6
6
...

result:

ok 62500 numbers

Test #24:

score: 0
Accepted
time: 71ms
memory: 3712kb

input:

62500
8
82637807 177317970
82637807 759506568
177317970 759506568
177317970 759506568
308720952 871662647
362073769 938545155
759506568 938545155
759506568 983796393
8
17244055 157185811
17244055 722766053
157185811 722766053
157185811 722766053
341336744 951761695
538606813 975708436
603573774 9757...

output:

6
6
6
6
6
6
6
6
6
6
5
5
6
6
5
5
6
6
5
5
6
6
6
6
5
6
6
6
6
6
6
6
6
6
6
6
6
6
5
6
6
6
6
6
6
6
5
6
6
6
6
6
6
6
5
6
6
6
6
6
6
6
6
6
5
6
6
6
6
6
6
6
6
6
5
6
6
6
5
6
6
6
6
6
4
5
5
5
5
6
6
6
5
5
6
6
6
6
5
6
6
6
6
6
4
5
5
5
5
5
5
5
5
6
6
6
6
6
6
6
5
5
6
6
5
5
6
6
6
6
5
6
6
6
6
6
6
6
6
6
5
6
6
6
5
6
6
6
6
6
...

result:

ok 62500 numbers

Test #25:

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

input:

62500
8
50599731 50599731
50599731 464418159
50599731 472105082
50599731 848680988
271125068 864135025
464418159 864135025
848680988 864135025
864135025 972531431
8
169956245 169956245
169956245 288174701
169956245 335938621
169956245 489026065
273189396 561562626
288174701 561562626
489026065 56156...

output:

6
6
6
6
7
7
6
6
7
7
7
7
6
6
7
7
6
6
7
7
7
7
6
7
7
7
6
7
7
7
6
7
7
7
7
7
6
7
7
7
7
7
6
6
7
7
6
6
7
7
6
6
7
7
6
6
7
7
7
7
7
7
6
6
7
7
6
6
7
7
6
6
7
7
6
6
7
7
7
7
7
7
7
7
8
8
7
7
8
8
7
7
8
8
7
7
8
8
7
7
8
8
8
8
7
7
8
8
7
7
8
8
7
7
8
8
7
7
8
8
7
7
8
8
8
8
6
6
7
7
6
6
7
7
6
6
7
7
7
7
7
7
6
6
7
7
6
6
7
7
...

result:

ok 62500 numbers

Test #26:

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

input:

62500
8
47532282 422409085
47532282 581987562
181396855 592496471
422409085 592496471
422409085 592496471
592496471 669593591
592496471 669593591
669593591 686472613
8
34501394 126838972
34501394 365123131
71437905 406918708
126838972 406918708
126838972 406918708
406918708 464855989
406918708 46485...

output:

5
5
5
6
6
6
6
6
6
6
5
5
6
6
5
5
6
6
6
6
5
6
6
6
6
6
6
6
6
6
5
6
6
6
5
6
6
6
6
6
4
5
5
5
5
5
5
5
5
6
6
6
6
6
6
6
5
5
6
6
5
5
6
6
6
6
5
6
6
6
6
6
6
6
6
6
5
6
6
6
5
6
6
6
6
6
4
5
5
5
5
5
5
5
5
5
5
5
5
6
6
6
6
6
6
6
6
6
6
6
5
5
6
6
5
5
6
6
5
5
6
6
6
6
5
6
6
6
6
6
6
6
6
6
6
6
6
6
5
6
6
6
6
6
6
6
5
6
6
6
...

result:

ok 62500 numbers

Test #27:

score: 0
Accepted
time: 72ms
memory: 3712kb

input:

62500
8
22588317 537285214
22588317 653092928
537285214 897413825
631725704 935542245
653092928 935542245
653092928 935542245
897413825 966901716
935542245 988554116
8
18864112 151873442
18864112 590950372
151873442 631654505
473454245 840448648
590950372 840448648
590950372 840448648
631654505 8680...

output:

6
6
6
6
5
6
6
6
5
6
6
6
5
6
6
6
6
6
5
6
6
6
6
6
5
6
6
6
6
6
6
6
6
6
6
6
6
7
7
7
7
7
7
7
7
7
7
7
6
6
7
7
6
6
7
7
6
6
7
7
7
7
6
7
7
7
7
7
7
7
7
7
7
7
7
7
6
7
7
7
7
7
7
7
6
7
7
7
7
7
7
7
6
7
7
7
7
7
7
7
7
7
6
7
7
7
7
7
7
7
7
7
6
7
7
7
6
7
7
7
6
7
7
7
7
7
6
7
7
7
7
7
5
5
6
6
5
5
6
6
5
5
6
6
6
6
6
6
5
6
...

result:

ok 62500 numbers

Test #28:

score: 0
Accepted
time: 70ms
memory: 3584kb

input:

62500
8
223192637 259851125
241512338 287101470
241512338 287101470
241512338 467061872
259851125 531197478
460558236 621260983
467061872 735205450
467061872 735205450
8
105108560 164991251
134055989 183467777
134055989 183467777
134055989 694034396
164991251 774298126
508031256 774570362
611044086 ...

output:

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

result:

ok 62500 numbers

Test #29:

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

input:

62500
8
80173769 178482926
178482926 253931855
178482926 623292690
178482926 623292690
623292690 623292690
623292690 672340741
623292690 678410880
672340741 824379870
8
214800774 222088815
222088815 303835327
222088815 335724546
222088815 335724546
335724546 335724546
335724546 533613298
335724546 8...

output:

7
7
7
7
6
6
7
7
6
6
7
7
7
7
6
7
7
7
6
7
7
7
7
7
5
6
6
6
6
6
6
6
6
7
7
7
7
7
7
7
6
6
7
7
6
6
7
7
7
7
6
7
7
7
7
7
7
7
7
7
6
7
7
7
6
7
7
7
7
7
4
5
5
5
5
5
5
5
5
6
6
6
6
6
6
6
5
5
6
6
5
5
6
6
6
6
5
6
6
6
6
6
6
6
6
6
5
6
6
6
5
6
6
6
5
6
6
6
6
6
5
6
6
6
6
6
5
6
6
6
6
6
6
6
6
7
7
7
7
7
7
7
6
6
7
7
6
6
7
7
...

result:

ok 62500 numbers

Test #30:

score: 0
Accepted
time: 70ms
memory: 3584kb

input:

62500
8
91865542 149316580
149316580 177354792
149316580 289402953
177354792 636393484
289402953 782449527
519783521 789430881
636393484 789430881
789430881 911879832
8
33529002 47716180
47716180 71316119
47716180 173269912
71316119 194001818
173269912 233791290
190193892 585717609
194001818 5857176...

output:

7
7
7
7
8
8
7
7
8
8
7
7
8
8
8
8
7
7
8
8
7
7
8
8
7
7
8
8
8
8
6
7
7
7
7
7
7
7
6
7
7
7
7
7
7
7
7
7
8
8
7
7
8
8
8
8
7
7
8
8
7
7
8
8
8
8
7
8
8
8
7
8
8
8
8
8
6
7
7
7
7
8
8
8
7
7
8
8
8
8
7
8
8
8
8
8
6
7
7
7
7
7
7
7
7
8
8
8
8
8
8
8
7
7
8
8
7
7
8
8
8
8
7
8
8
8
8
8
8
8
8
8
7
8
8
8
7
8
8
8
8
8
5
6
6
6
6
7
7
7
...

result:

ok 62500 numbers

Test #31:

score: 0
Accepted
time: 71ms
memory: 3712kb

input:

62500
8
59765682 147428647
75824438 261932244
82266823 386837628
147428647 668476160
225920440 822216637
261932244 822216637
386837628 873112707
386837628 974222998
8
61527723 423261185
84169283 542268712
185568324 693321260
423261185 822510488
475487954 840803824
542268712 840803824
668894502 88503...

output:

8
8
8
8
8
8
8
8
8
8
8
8
7
8
8
8
8
8
8
8
8
8
8
8
8
8
7
8
8
8
8
8
8
8
7
8
8
8
8
8
8
8
7
8
8
8
8
8
8
8
8
8
7
8
8
8
8
8
8
8
8
8
7
8
8
8
7
8
8
8
7
8
8
8
8
8
7
8
8
8
8
8
6
6
7
7
6
6
7
7
6
6
7
7
6
6
7
7
7
7
7
7
6
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
8
8
7
7
8
8
7
7
8
8
7
7
8
8
7
7
8
8
8
8
7
7
8
8
7
7
...

result:

ok 62500 numbers

Test #32:

score: 0
Accepted
time: 11ms
memory: 3712kb

input:

10936
8
189992530 488954270
488954270 584812126
491772106 813538910
584812126 821722949
584812126 960612669
584812126 960612669
813538910 960612669
821722949 960612669
8
183550650 264093697
264093697 394026441
266291931 686830157
394026441 843555749
394026441 986497257
394026441 986497257
686830157 ...

output:

6
6
6
6
6
6
6
6
6
6
7
7
6
6
7
7
6
6
7
7
7
7
6
6
7
7
6
6
7
7
6
6
7
7
7
7
5
6
6
6
6
6
6
6
5
6
6
6
6
6
6
6
6
6
7
7
6
6
7
7
7
7
6
6
7
7
6
6
7
7
7
7
6
7
7
7
6
7
7
7
6
7
7
7
7
7
6
7
7
7
7
7
5
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
6
6
7
7
6
6
7
7
6
6
7
7
6
6
7
7
7
7
6
7
7
7
7
7
7
7
...

result:

ok 10936 numbers

Test #33:

score: 0
Accepted
time: 55ms
memory: 3584kb

input:

100000
10
1 1
1 2
1 2
2 3
2 3
3 4
4 4
4 4
4 5
5 5
3
1 2
2 3
2 5
2
2 5
3 5
6
2 2
2 3
3 5
4 5
5 5
5 5
2
2 5
5 5
13
1 1
1 1
1 2
1 2
2 3
3 3
3 3
3 4
3 4
4 4
4 5
5 5
5 5
8
1 3
2 3
2 4
3 4
4 5
4 5
5 5
5 5
3
1 3
1 4
2 5
4
1 2
2 4
3 4
4 5
4
1 3
2 4
3 5
5 5
1
4 4
1
2 5
1
2 4
2
2 4
4 5
5
1 2
2 3
2 4
2 5
2 5
3...

output:

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

result:

ok 100000 numbers

Test #34:

score: 0
Accepted
time: 74ms
memory: 8040kb

input:

10
2991
20 30
23 43
32 52
37 70
48 85
54 91
74 116
98 150
102 243
126 247
135 247
140 277
166 280
173 303
177 314
184 372
246 386
268 396
274 402
302 417
307 417
309 420
377 423
392 429
426 445
427 479
443 484
483 504
485 517
513 529
522 544
543 575
547 598
564 608
565 626
573 628
584 636
620 650
64...

output:

2930
14474
41911
17073
24522
41275
32256
23631
32803
45637

result:

ok 10 numbers

Test #35:

score: 0
Accepted
time: 108ms
memory: 10940kb

input:

10
102520
1851 15493
5340 18694
6527 27722
22838 37137
31626 51201
38030 65798
61184 78073
68636 80483
80262 84436
82607 121271
90688 143122
99500 154714
102256 161895
109403 164250
112421 166978
116270 189423
120877 191889
137567 229352
154131 231338
174191 243499
178884 243841
188710 249563
195073...

output:

102519
20633
63027
70704
106228
37772
7927
22371
17803
51011

result:

ok 10 numbers

Test #36:

score: 0
Accepted
time: 59ms
memory: 9116kb

input:

10
75560
1 25
3 29
4 35
4 41
4 88
5 94
6 96
6 97
7 97
7 99
10 112
11 116
12 119
14 128
14 153
16 153
16 156
17 157
18 158
18 162
19 182
24 183
25 197
25 198
27 206
29 208
29 214
30 217
31 218
35 222
35 227
35 231
35 233
36 252
37 271
37 278
38 283
38 296
42 296
43 298
44 300
46 303
48 304
49 305
49 ...

output:

22654
18314
8113
20779
16070
15147
36557
6469
3952
17143

result:

ok 10 numbers

Test #37:

score: 0
Accepted
time: 100ms
memory: 11124kb

input:

10
7609
221087 9135880
438934 11526508
591941 13993875
788049 15917786
1026475 18283069
1056009 18357407
1346581 19410281
1375172 19412508
1606705 20585315
1927020 22517334
2286127 23187035
2549683 24862153
2896923 25148913
3067441 30725153
3220153 30867610
3399760 31500948
3409789 32974178
3510344 ...

output:

7608
22904
105455
92689
16335
18488
49698
56475
30641
99554

result:

ok 10 numbers

Test #38:

score: 0
Accepted
time: 43ms
memory: 6476kb

input:

10
18251
1 122
2 123
3 123
4 132
6 133
6 135
6 139
8 139
9 143
11 144
12 145
12 145
13 151
14 152
14 152
16 153
17 154
21 155
23 156
37 157
39 160
158 244
160 252
160 258
160 263
161 266
161 269
162 270
162 271
162 272
162 274
162 275
162 277
162 278
162 279
162 279
162 279
162 279
162 280
163 281
1...

output:

6774
4724
13940
9816
6829
12556
7200
3283
11950
5074

result:

ok 10 numbers

Test #39:

score: 0
Accepted
time: 87ms
memory: 10952kb

input:

10
111445
21 2443312
906 2505602
1188 2549868
1413 2651671
1733 2790099
2487 2794678
2924 2927570
3006 2959532
3997 2986633
4020 3040010
4183 3042806
5309 3052093
8135 3076206
8602 3077112
9086 3108074
9134 3136491
11573 3157923
12378 3162737
13685 3188006
16217 3213435
16411 3222520
16772 3229672
1...

output:

111051
941
64538
70305
79846
116339
20226
7475
19724
8363

result:

ok 10 numbers

Test #40:

score: 0
Accepted
time: 40ms
memory: 5496kb

input:

10
8316
1 76
1 77
1 80
1 80
1 80
1 80
1 81
2 81
2 81
2 81
2 81
3 81
3 81
3 81
3 81
3 81
3 81
4 81
4 81
5 81
6 82
81 150
82 152
82 153
82 153
82 154
82 155
82 155
82 155
82 155
82 155
82 155
83 156
83 156
83 156
83 156
83 156
83 156
84 156
84 156
84 156
84 156
86 157
156 162
157 163
162 170
163 170
1...

output:

2586
4398
4106
2695
4428
4396
2671
4421
4952
2022

result:

ok 10 numbers

Test #41:

score: 0
Accepted
time: 88ms
memory: 10836kb

input:

10
6499
6331 1091264
13205 1102640
15654 1113665
21671 1118565
86155 1119460
1119404 1344788
1119756 1351487
1120017 1351571
1120141 1353390
1120440 1353485
1120780 1353500
1120889 1354224
1120913 1354593
1120933 1355647
1121427 1355759
1122219 1356007
1122386 1356050
1123108 1356353
1123169 1356371...

output:

6499
20213
53421
55723
31723
4433
77653
101274
94973
50178

result:

ok 10 numbers

Test #42:

score: 0
Accepted
time: 79ms
memory: 12912kb

input:

5
32436
1 3
2 5
4 8
7 11
8 11
10 17
15 18
18 21
18 29
18 29
20 29
22 30
24 30
30 31
30 32
30 34
32 35
34 37
37 39
37 40
39 45
45 49
46 53
48 55
50 56
54 59
55 62
56 63
57 74
62 74
66 80
78 84
81 89
88 100
89 103
92 104
94 107
94 109
96 110
97 111
99 115
109 117
112 120
116 127
122 130
122 132
123 13...

output:

27875
49468
71388
56494
86011

result:

ok 5 number(s): "27875 49468 71388 56494 86011"

Test #43:

score: 0
Accepted
time: 107ms
memory: 28748kb

input:

5
41091
7799 8977
8349 24868
17512 88551
56903 98288
90457 108554
105712 121016
120317 173528
123257 210801
176949 254460
196995 301670
217438 302062
219386 347286
222736 355112
241453 395789
249842 409789
273352 412176
275825 415605
280426 445742
353178 457905
356247 502060
369921 538618
373101 547...

output:

41091
352625
21950
14616
69689

result:

ok 5 number(s): "41091 352625 21950 14616 69689"

Test #44:

score: 0
Accepted
time: 60ms
memory: 8080kb

input:

5
68197
1 36
1 39
1 66
1 83
1 100
1 105
1 110
2 115
2 123
2 124
3 126
3 129
3 129
3 137
3 177
3 181
3 186
3 190
3 214
4 220
4 225
4 230
4 231
4 236
4 240
5 246
5 248
5 257
5 265
5 274
5 276
5 278
5 287
6 288
6 293
7 293
7 295
7 298
7 300
7 301
7 306
7 310
7 314
7 315
8 316
8 322
8 323
8 324
8 326
9 ...

output:

27353
28684
41964
41493
38514

result:

ok 5 number(s): "27353 28684 41964 41493 38514"

Test #45:

score: 0
Accepted
time: 104ms
memory: 17280kb

input:

5
43118
451 479646
4800 592406
5381 638701
8165 654274
8388 731217
12402 731461
14083 829975
15787 886763
21097 890650
25997 941743
28214 974845
29143 1073048
33039 1189924
33143 1213034
37378 1309933
40379 1354000
40435 1357275
40636 1365143
42701 1428349
44352 1432459
47345 1446827
47654 1482149
4...

output:

43108
83637
136540
175009
61089

result:

ok 5 number(s): "43108 83637 136540 175009 61089"

Test #46:

score: 0
Accepted
time: 43ms
memory: 10072kb

input:

5
48516
1 776
1 807
1 819
3 870
3 941
4 942
7 944
8 950
8 958
8 1007
9 1010
10 1011
11 1013
11 1014
12 1015
13 1025
13 1025
14 1030
14 1035
16 1036
17 1038
17 1043
22 1060
23 1061
23 1063
23 1066
23 1073
23 1074
24 1080
24 1085
25 1086
25 1086
26 1088
26 1089
27 1089
30 1091
32 1106
34 1113
34 1116
...

output:

13834
7925
26560
12824
15962

result:

ok 5 number(s): "13834 7925 26560 12824 15962"

Test #47:

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

input:

5
172630
176 1564021
498 1627039
985 1649330
1102 1668364
1506 1671601
1620 1675327
1635 1685922
1771 1689200
1803 1695160
1836 1720369
1860 1760653
2236 1768853
2612 1774865
2656 1781739
2884 1784673
2939 1786442
3422 1792762
3881 1793343
4041 1804370
4435 1808826
4864 1842565
4881 1846956
5485 185...

output:

172172
82870
42379
82403
119122

result:

ok 5 number(s): "172172 82870 42379 82403 119122"

Test #48:

score: 0
Accepted
time: 41ms
memory: 7784kb

input:

5
185475
1 275
1 277
1 279
1 287
1 287
1 287
1 287
1 289
1 289
1 289
1 290
1 290
1 291
1 292
1 292
1 292
1 293
1 293
1 294
1 294
1 294
1 294
1 294
1 294
1 295
1 295
1 295
1 295
1 296
1 296
1 296
2 296
2 296
2 297
2 297
2 297
2 297
2 297
2 297
2 297
2 297
2 297
2 297
2 298
2 298
2 298
2 298
2 298
2 2...

output:

8612
5832
4532
6549
9090

result:

ok 5 number(s): "8612 5832 4532 6549 9090"

Test #49:

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

input:

5
144187
1330 1939860
4145 1943165
4346 1945343
4905 1949583
5747 1954640
5882 1955977
7394 1958034
8099 1959270
8396 1965270
9140 1967029
10368 1974631
13435 1984540
13503 1989270
14314 1993611
14471 2009938
15297 2020981
15840 2021319
16753 2028473
17722 2035327
20411 2043077
20877 2044263
22589 2...

output:

141625
58515
17972
232997
37343

result:

ok 5 number(s): "141625 58515 17972 232997 37343"

Test #50:

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

input:

1
500000
1 4
1 5
2 8
2 10
4 13
4 13
5 13
7 14
7 14
8 16
8 17
10 22
12 24
13 25
14 26
15 26
15 26
16 26
17 27
19 27
19 27
19 27
20 28
20 28
21 29
21 30
21 32
21 32
22 34
22 34
23 37
24 38
27 40
27 41
28 41
34 42
35 42
35 43
38 44
40 44
40 45
44 45
44 47
46 47
46 48
48 48
48 49
48 49
49 49
49 49
49 50...

output:

317014

result:

ok 1 number(s): "317014"

Test #51:

score: 0
Accepted
time: 108ms
memory: 35364kb

input:

1
500000
1517 4325
3178 5365
5020 6547
5602 6916
6589 7490
7404 8659
7671 12489
9654 15687
15501 17845
15977 19923
19615 24233
21742 27622
26529 29789
29363 32034
31831 32136
32118 33749
33551 37873
36307 39363
38826 44063
39886 45795
40166 50256
40420 50916
40433 52235
41645 52286
41726 56346
41938...

output:

499908

result:

ok 1 number(s): "499908"

Test #52:

score: 0
Accepted
time: 59ms
memory: 22216kb

input:

1
500000
1 231
3 232
3 280
4 372
5 385
8 397
9 404
10 454
11 487
11 561
14 615
14 628
14 649
16 670
19 675
19 698
21 741
23 743
24 750
27 759
27 781
28 812
28 843
29 852
29 853
30 894
31 907
33 942
33 946
36 974
37 981
37 996
40 1001
40 1002
40 1005
40 1020
40 1023
41 1031
41 1034
42 1041
43 1082
45...

output:

182298

result:

ok 1 number(s): "182298"

Test #53:

score: 0
Accepted
time: 107ms
memory: 35416kb

input:

1
500000
22 21208
24 28463
157 38607
170 39030
208 39438
249 47353
267 51959
282 55809
362 57278
376 57638
404 59406
405 60290
421 65157
431 65840
472 66457
479 66551
484 66621
486 66697
501 67810
519 69383
522 69756
552 71490
574 71847
577 72489
588 76587
607 77487
615 78668
711 79743
720 83334
733...

output:

498746

result:

ok 1 number(s): "498746"

Test #54:

score: 0
Accepted
time: 48ms
memory: 16480kb

input:

1
500000
1 4168
2 5297
3 5567
3 5594
4 5638
4 5732
4 6085
5 6124
7 6194
8 6248
11 6438
14 6455
14 6645
14 6649
14 6673
15 6674
15 6690
15 6710
17 6753
18 6764
19 6764
20 6776
21 6847
22 6875
22 6882
23 6884
24 6897
25 6943
28 6954
28 6964
29 6965
31 6976
32 7017
32 7017
33 7055
34 7061
35 7068
37 71...

output:

85298

result:

ok 1 number(s): "85298"

Test #55:

score: 0
Accepted
time: 92ms
memory: 35320kb

input:

1
500000
268 3415809
283 3688662
903 3836392
928 3917857
1273 4136982
1613 4156876
1745 4164229
3397 4323458
3573 4379884
3822 4415488
4765 4421486
5611 4422881
5688 4449321
5716 4464455
6060 4469608
6251 4471822
6331 4473279
6460 4509345
6694 4509672
8028 4516755
8655 4527026
8710 4561434
9305 4604...

output:

497177

result:

ok 1 number(s): "497177"

Test #56:

score: 0
Accepted
time: 43ms
memory: 12876kb

input:

1
500000
1 282
1 286
1 289
1 289
1 290
1 290
1 291
1 292
1 293
1 293
1 294
1 294
1 294
1 294
1 295
1 295
1 295
1 295
1 295
1 296
1 296
1 296
1 296
1 296
1 297
1 297
1 297
1 298
1 298
1 298
1 298
1 298
1 298
1 298
1 298
1 298
1 299
1 299
1 299
1 299
1 299
1 299
1 299
1 300
1 300
1 300
1 300
1 300
1 3...

output:

35541

result:

ok 1 number(s): "35541"

Test #57:

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

input:

1
500000
94 4266859
96 4290317
142 4296990
337 4300987
413 4324921
429 4325282
565 4327946
622 4350641
745 4371141
768 4371383
869 4375033
971 4382592
1115 4385822
1147 4413587
1197 4417165
1211 4417999
1275 4423703
1325 4433867
1435 4441404
1471 4441787
1527 4446485
1603 4448162
1629 4451072
1689 4...

output:

475911

result:

ok 1 number(s): "475911"

Extra Test:

score: 0
Extra Test Passed