QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#38259#840. Just CountingZhangYiDeAC ✓151ms26404kbC++172.2kb2022-07-04 21:52:202022-07-04 21:52:21

详细

Test #1:

score: 100
Accepted
time: 2ms
memory: 10632kb

input:

3
1 0
3 3
1 2
2 3
3 1
4 4
1 2
2 3
3 4
4 1

output:

1
1
5

result:

ok 3 number(s): "1 1 5"

Test #2:

score: 0
Accepted
time: 89ms
memory: 10448kb

input:

500000
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

ok 500000 numbers

Test #3:

score: 0
Accepted
time: 45ms
memory: 10256kb

input:

250000
2 0
2 0
2 0
2 0
2 0
2 0
2 0
2 0
2 0
2 0
2 0
2 0
2 0
2 0
2 0
2 0
2 0
2 0
2 0
2 0
2 0
2 0
2 0
2 0
2 0
2 0
2 0
2 0
2 0
2 0
2 0
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
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

ok 166666 numbers

Test #5:

score: 0
Accepted
time: 34ms
memory: 10220kb

input:

166666
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

ok 166666 numbers

Test #6:

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

input:

125000
3 1
1 2
3 1
2 3
3 1
1 2
3 1
1 2
3 1
2 3
3 1
1 2
3 1
2 3
3 1
1 3
3 1
1 2
3 1
1 2
3 1
1 2
3 1
1 3
3 1
1 3
3 1
2 3
3 1
1 2
3 1
2 3
3 1
1 2
3 1
1 3
3 1
1 3
3 1
1 3
3 1
1 2
3 1
1 2
3 1
1 2
3 1
1 3
3 1
1 3
3 1
1 2
3 1
2 3
3 1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1
1
1
...

result:

ok 100000 numbers

Test #8:

score: 0
Accepted
time: 44ms
memory: 9732kb

input:

83333
3 3
1 3
2 3
1 2
3 3
1 3
1 2
2 3
3 3
2 3
1 2
1 3
3 3
1 3
2 3
1 2
3 3
1 2
2 3
1 3
3 3
1 3
2 3
1 2
3 3
2 3
1 2
1 3
3 3
2 3
1 2
1 3
3 3
2 3
1 2
1 3
3 3
2 3
1 2
1 3
3 3
1 2
1 3
2 3
3 3
2 3
1 2
1 3
3 3
2 3
1 3
1 2
3 3
1 3
2 3
1 2
3 3
2 3
1 2
1 3
3 3
1 3
2 3
1 2
3 3
1 3
1 2
2 3
3 3
1 3
2 3
1 2
3 3
1 ...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

ok 83333 numbers

Test #9:

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

input:

125000
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

ok 125000 numbers

Test #10:

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

input:

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

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

ok 100000 numbers

Test #11:

score: 0
Accepted
time: 34ms
memory: 10032kb

input:

83333
4 2
1 2
1 3
4 2
1 4
2 4
4 2
3 4
1 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
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

ok 71428 numbers

Test #13:

score: 0
Accepted
time: 39ms
memory: 10428kb

input:

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

output:

1
1
5
1
5
1
1
1
5
5
1
1
5
1
1
1
5
1
1
1
1
1
1
5
1
1
5
1
1
1
5
1
1
5
1
1
1
5
1
1
1
1
1
1
1
1
1
1
1
5
1
1
1
1
1
1
1
5
5
1
1
5
1
5
5
1
1
1
5
1
5
1
1
1
1
1
1
1
5
5
5
1
1
5
5
1
1
1
1
5
1
5
5
1
1
1
1
1
1
1
1
1
1
1
1
1
1
5
1
1
1
1
1
5
1
5
1
1
5
5
1
1
1
5
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
5
1
1
1
1
1
1
5
5
1
1
...

result:

ok 62500 numbers

Test #14:

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

input:

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

output:

5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
...

result:

ok 55555 numbers

Test #15:

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

input:

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

output:

25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
...

result:

ok 50000 numbers

Test #16:

score: 0
Accepted
time: 28ms
memory: 8884kb

input:

100000
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5 0
5...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

ok 100000 numbers

Test #17:

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

input:

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

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

ok 83333 numbers

Test #18:

score: 0
Accepted
time: 34ms
memory: 10588kb

input:

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

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

ok 71428 numbers

Test #19:

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

input:

62500
5 3
2 4
3 5
2 5
5 3
1 2
1 4
1 5
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
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
5
1
1
1
1
1
1
1
1
1
1
1
1
1
5
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
5
1
1
1
5
1
1
1
1
1
1
1
1
5
1
1
...

result:

ok 55555 numbers

Test #21:

score: 0
Accepted
time: 51ms
memory: 10600kb

input:

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

output:

5
1
1
1
5
1
1
1
1
5
1
5
1
1
1
1
5
1
1
1
1
5
1
1
1
5
5
1
5
1
1
5
5
1
1
5
5
5
1
5
5
1
1
5
1
5
5
5
1
1
1
1
1
1
5
1
1
1
5
5
5
1
5
1
1
1
1
1
1
5
1
1
5
5
5
5
1
1
1
5
1
1
1
1
1
1
5
5
5
1
1
1
1
5
5
1
1
5
1
5
1
1
5
1
5
5
1
1
1
5
5
5
5
5
1
5
1
1
1
1
5
5
5
5
1
1
1
1
1
5
5
1
5
5
1
1
5
5
1
5
1
1
1
5
5
5
5
1
1
1
...

result:

ok 50000 numbers

Test #22:

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

input:

45454
5 6
2 4
1 3
1 4
2 3
2 5
1 2
5 6
1 4
1 2
1 5
2 5
1 3
3 4
5 6
4 5
1 4
2 4
2 3
3 5
1 2
5 6
2 4
2 3
1 4
1 3
2 5
3 4
5 6
2 3
1 3
1 5
3 4
2 4
4 5
5 6
2 3
1 3
1 2
3 4
4 5
1 4
5 6
1 4
1 2
1 5
3 4
3 5
2 3
5 6
4 5
2 3
1 4
1 5
1 2
1 3
5 6
3 4
2 5
1 3
1 2
2 4
2 3
5 6
3 4
4 5
1 5
1 3
2 4
3 5
5 6
2 5
1 3
2 ...

output:

5
5
5
5
5
5
25
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
25
5
5
5
5
25
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
25
5
5
5
25
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
25
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
25
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
25
5
5
5
5
5
5
5
5
5
5
5
5
5
25
5
5
5
5
5
5
25
5
25
5
25
5
5
5
5
25...

result:

ok 45454 numbers

Test #23:

score: 0
Accepted
time: 46ms
memory: 9152kb

input:

41666
5 7
3 4
2 3
2 4
1 3
4 5
1 4
3 5
5 7
1 4
4 5
1 3
2 3
2 5
1 2
3 4
5 7
4 5
2 3
1 2
1 3
1 5
2 5
3 4
5 7
1 2
1 4
3 5
1 5
4 5
2 4
1 3
5 7
1 3
1 2
3 5
2 5
2 4
4 5
1 5
5 7
3 5
4 5
1 5
1 3
2 3
1 4
2 4
5 7
1 3
1 5
3 4
3 5
2 4
2 3
1 2
5 7
2 3
4 5
2 5
3 5
3 4
1 5
2 4
5 7
2 5
2 4
1 2
3 5
1 3
2 3
1 4
5 7
1 ...

output:

25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
...

result:

ok 41666 numbers

Test #24:

score: 0
Accepted
time: 45ms
memory: 10064kb

input:

38461
5 8
2 3
1 5
2 4
1 3
3 5
1 2
3 4
2 5
5 8
3 5
2 4
4 5
3 4
1 4
1 2
2 5
1 5
5 8
1 3
1 5
2 3
3 5
4 5
3 4
2 4
2 5
5 8
2 5
3 4
1 5
2 4
4 5
1 3
3 5
2 3
5 8
3 4
4 5
1 3
2 4
1 2
2 5
1 5
2 3
5 8
1 3
3 5
1 5
1 2
2 4
4 5
2 3
1 4
5 8
2 5
4 5
1 2
3 4
1 3
2 3
1 4
2 4
5 8
1 2
2 5
3 5
1 4
3 4
2 4
1 3
4 5
5 8
4 ...

output:

125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
...

result:

ok 38461 numbers

Test #25:

score: 0
Accepted
time: 46ms
memory: 8760kb

input:

35714
5 9
2 5
1 4
3 5
1 5
2 3
4 5
2 4
1 3
3 4
5 9
1 3
2 5
3 4
1 2
2 4
1 4
1 5
4 5
2 3
5 9
3 5
1 5
1 4
1 3
3 4
1 2
2 4
2 5
4 5
5 9
1 3
1 5
3 5
4 5
3 4
2 4
2 5
2 3
1 4
5 9
4 5
1 3
2 5
2 3
3 4
2 4
1 2
1 4
1 5
5 9
2 3
3 5
1 2
1 4
2 4
4 5
1 3
3 4
1 5
5 9
2 3
2 5
1 4
2 4
1 2
1 3
3 4
4 5
1 5
5 9
1 2
2 5
3 ...

output:

625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
...

result:

ok 35714 numbers

Test #26:

score: 0
Accepted
time: 47ms
memory: 9292kb

input:

33333
5 10
2 3
3 4
2 5
4 5
1 3
2 4
3 5
1 2
1 5
1 4
5 10
1 4
1 2
2 3
3 5
2 4
1 5
1 3
4 5
3 4
2 5
5 10
2 5
2 4
4 5
1 4
2 3
1 3
1 5
3 4
3 5
1 2
5 10
1 2
2 5
2 3
3 5
4 5
1 4
1 5
2 4
1 3
3 4
5 10
1 3
2 3
1 2
2 4
1 5
3 5
1 4
3 4
4 5
2 5
5 10
2 3
3 5
3 4
1 2
4 5
2 4
1 5
1 4
1 3
2 5
5 10
1 2
2 3
1 4
1 3
2 4...

output:

3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
...

result:

ok 33333 numbers

Test #27:

score: 0
Accepted
time: 20ms
memory: 10152kb

input:

83333
6 0
6 0
6 0
6 0
6 0
6 0
6 0
6 0
6 0
6 0
6 0
6 0
6 0
6 0
6 0
6 0
6 0
6 0
6 0
6 0
6 0
6 0
6 0
6 0
6 0
6 0
6 0
6 0
6 0
6 0
6 0
6 0
6 0
6 0
6 0
6 0
6 0
6 0
6 0
6 0
6 0
6 0
6 0
6 0
6 0
6 0
6 0
6 0
6 0
6 0
6 0
6 0
6 0
6 0
6 0
6 0
6 0
6 0
6 0
6 0
6 0
6 0
6 0
6 0
6 0
6 0
6 0
6 0
6 0
6 0
6 0
6 0
6 0
6 ...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

ok 83333 numbers

Test #28:

score: 0
Accepted
time: 22ms
memory: 9360kb

input:

71428
6 1
4 5
6 1
2 6
6 1
2 3
6 1
1 4
6 1
1 2
6 1
3 6
6 1
3 5
6 1
3 4
6 1
3 6
6 1
4 5
6 1
2 6
6 1
1 5
6 1
2 5
6 1
3 4
6 1
2 3
6 1
1 5
6 1
1 4
6 1
1 3
6 1
1 5
6 1
4 6
6 1
3 4
6 1
4 5
6 1
4 6
6 1
1 2
6 1
1 3
6 1
1 3
6 1
2 5
6 1
4 6
6 1
5 6
6 1
1 3
6 1
1 2
6 1
2 6
6 1
2 4
6 1
2 6
6 1
2 3
6 1
2 3
6 1
4 ...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

ok 71428 numbers

Test #29:

score: 0
Accepted
time: 34ms
memory: 10716kb

input:

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

result:

ok 55555 numbers

Test #31:

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

input:

50000
6 4
2 3
1 6
5 6
1 4
6 4
1 5
2 4
3 4
1 3
6 4
1 4
1 3
1 2
3 4
6 4
2 6
1 3
3 4
2 3
6 4
4 5
1 3
1 6
5 6
6 4
1 3
3 6
4 5
5 6
6 4
2 6
1 4
2 4
4 5
6 4
1 4
3 5
2 3
5 6
6 4
3 4
3 5
1 5
5 6
6 4
1 4
2 4
3 5
3 4
6 4
4 5
5 6
1 6
2 5
6 4
1 4
1 3
3 6
2 3
6 4
1 3
3 4
2 5
3 5
6 4
3 4
4 6
1 3
2 3
6 4
2 6
5 6
1 ...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
5
1
5
5
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
5
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
5
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
5
1
1
1
1
1
1
...

result:

ok 50000 numbers

Test #32:

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

input:

45454
6 5
2 3
3 5
3 4
2 5
1 4
6 5
2 4
3 5
1 2
5 6
3 6
6 5
2 5
5 6
3 4
1 3
4 5
6 5
1 6
2 6
3 5
5 6
1 2
6 5
1 6
3 4
3 6
1 5
2 3
6 5
4 6
1 5
2 5
5 6
1 6
6 5
1 6
1 3
3 4
2 3
1 2
6 5
1 4
2 5
3 5
2 6
4 6
6 5
4 5
1 3
2 6
3 5
3 4
6 5
1 6
2 4
1 5
1 4
4 6
6 5
2 5
1 4
3 4
1 2
3 6
6 5
5 6
4 6
1 6
2 4
3 5
6 5
1 ...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
5
1
1
1
1
1
1
1
1
1
1
5
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
5
1
1
5
1
1
5
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
5
1
1
1
1
1
1
1
1
1
1
1
1
1
5
1
5
1
1
1
1
1
1
1
5
1
1
1
1
1
1
1
1
1
5
1
1
5
1
1
1
1
1
1
1
1
1
1
1
5
1
1
1
5
1
1
5
1
1
1
1
5
5
1
1
1
1
1
5
1
5
1
1
1
1
1
...

result:

ok 45454 numbers

Test #33:

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

input:

41666
6 6
1 3
3 4
4 5
4 6
1 5
2 6
6 6
3 6
1 3
5 6
4 6
1 2
2 5
6 6
5 6
4 6
3 4
2 3
1 5
2 5
6 6
4 6
1 5
3 4
1 2
1 6
3 5
6 6
1 2
3 5
1 4
1 3
4 5
4 6
6 6
2 6
1 4
3 4
1 3
2 5
4 6
6 6
1 3
4 6
1 4
3 5
3 6
3 4
6 6
3 4
1 5
1 4
1 3
4 6
3 5
6 6
1 6
1 2
1 5
4 6
3 4
1 3
6 6
1 6
1 2
1 4
3 5
2 6
2 4
6 6
1 5
1 3
1 ...

output:

5
1
1
1
5
1
5
5
5
5
1
5
1
1
1
5
5
1
1
1
1
5
1
5
1
1
1
1
5
1
5
5
1
5
1
5
1
5
1
5
1
5
5
5
1
1
1
5
5
1
5
5
5
1
5
5
1
1
1
5
1
1
1
5
5
1
5
1
5
5
1
5
1
5
5
5
5
1
5
1
5
5
1
1
1
1
5
1
1
1
1
5
1
5
5
1
1
1
1
1
25
1
5
5
5
5
5
1
1
5
5
1
5
25
5
5
1
1
1
1
5
1
1
5
5
1
1
5
1
1
5
1
5
1
1
5
5
1
1
1
1
1
5
5
5
5
1
1
25...

result:

ok 41666 numbers

Test #34:

score: 0
Accepted
time: 42ms
memory: 9780kb

input:

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

output:

5
5
5
5
5
5
25
5
5
5
5
5
5
5
5
25
25
5
5
5
5
5
5
5
5
5
25
5
25
5
5
5
25
5
5
5
25
5
5
5
5
5
5
25
5
5
5
5
5
5
5
5
5
5
5
5
25
25
5
5
5
5
25
5
25
25
5
25
5
5
5
5
5
25
25
25
5
5
5
5
5
5
25
5
5
25
5
5
5
25
5
5
5
5
5
5
25
5
5
5
25
5
25
5
5
25
5
25
5
5
5
5
5
5
5
5
5
25
5
5
5
25
25
5
5
5
25
25
5
5
5
25
5
5
5...

result:

ok 38461 numbers

Test #35:

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

input:

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

output:

25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
125
25
25
25
25
25
25
125
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
25
125
25
25
25
25
25
25
25
25
125
25
25
25
25
25
25
25
25
25
25
25
25
25
125
25
25
125
25
25
25
25
25
25
...

result:

ok 35714 numbers

Test #36:

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

input:

33333
6 9
1 4
3 4
4 6
2 4
3 5
2 6
2 5
1 5
2 3
6 9
1 3
2 5
4 6
3 4
4 5
2 4
1 5
5 6
1 4
6 9
2 5
5 6
1 5
3 6
1 6
4 6
3 5
2 3
2 4
6 9
5 6
1 3
1 2
3 6
3 4
2 6
1 4
3 5
2 5
6 9
2 5
3 5
1 2
4 6
2 6
4 5
2 3
1 6
2 4
6 9
3 4
1 2
5 6
4 5
2 6
1 5
3 6
4 6
1 3
6 9
4 5
3 6
2 5
3 4
5 6
1 5
1 6
2 3
2 6
6 9
2 6
1 5
4 ...

output:

125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
625
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
125
...

result:

ok 33333 numbers

Test #37:

score: 0
Accepted
time: 45ms
memory: 8904kb

input:

31250
6 10
3 5
3 4
2 3
1 6
5 6
2 6
1 5
1 4
3 6
1 3
6 10
4 6
3 4
2 6
5 6
3 5
2 4
1 4
2 5
1 5
2 3
6 10
1 2
2 4
2 6
1 3
2 5
4 5
4 6
3 4
1 5
2 3
6 10
1 6
1 4
1 3
1 2
3 4
4 6
5 6
3 5
1 5
2 3
6 10
1 6
2 4
1 3
2 3
5 6
1 4
1 2
4 5
4 6
3 5
6 10
2 5
2 4
1 6
3 5
2 3
4 6
1 5
2 6
5 6
1 2
6 10
2 5
3 5
2 3
1 3
3 6...

output:

625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
625
...

result:

ok 31250 numbers

Test #38:

score: 0
Accepted
time: 47ms
memory: 10460kb

input:

29411
6 11
1 3
4 5
4 6
1 4
5 6
3 5
1 5
2 3
3 6
1 2
3 4
6 11
2 6
1 3
5 6
4 5
1 5
3 5
2 5
1 4
3 4
2 3
1 2
6 11
4 5
1 6
1 4
1 3
3 4
5 6
3 5
2 4
1 2
1 5
2 6
6 11
1 4
1 3
1 6
4 5
2 3
1 5
3 4
2 5
1 2
2 4
5 6
6 11
1 6
2 5
5 6
1 2
4 5
3 4
1 3
1 4
2 4
2 6
2 3
6 11
1 3
3 6
1 5
3 5
5 6
1 2
2 3
1 4
1 6
2 5
2 4
...

output:

3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
3125
...

result:

ok 29411 numbers

Test #39:

score: 0
Accepted
time: 45ms
memory: 8708kb

input:

27777
6 12
1 5
2 3
1 3
4 5
3 4
4 6
2 5
1 2
2 4
2 6
1 6
1 4
6 12
2 6
1 6
2 4
4 5
1 2
2 3
4 6
3 4
2 5
3 5
5 6
1 3
6 12
1 2
2 4
4 5
3 5
1 6
3 4
1 5
1 3
5 6
3 6
1 4
4 6
6 12
1 2
1 5
5 6
4 5
1 4
1 3
2 4
1 6
4 6
2 6
2 3
3 4
6 12
5 6
3 6
3 5
1 6
2 3
1 3
2 5
2 4
3 4
4 6
1 5
2 6
6 12
2 3
2 4
1 5
4 6
1 2
3 5
...

output:

15625
15625
15625
15625
15625
15625
15625
15625
15625
15625
15625
15625
15625
15625
15625
15625
15625
15625
15625
15625
15625
15625
15625
15625
15625
15625
15625
15625
15625
15625
15625
15625
15625
15625
15625
15625
15625
15625
15625
15625
15625
15625
15625
15625
15625
15625
15625
15625
15625
15625
...

result:

ok 27777 numbers

Test #40:

score: 0
Accepted
time: 39ms
memory: 9432kb

input:

26315
6 13
3 4
4 5
2 4
2 6
1 2
1 5
2 3
1 4
1 6
3 5
2 5
3 6
4 6
6 13
3 5
3 6
1 6
1 4
3 4
5 6
2 3
1 2
2 5
2 4
4 5
1 5
2 6
6 13
3 5
2 3
1 5
3 6
1 3
5 6
1 6
2 6
2 4
4 5
2 5
4 6
3 4
6 13
3 5
1 6
4 5
2 4
1 4
1 5
4 6
2 5
3 6
5 6
2 3
1 2
1 3
6 13
3 5
1 4
2 5
1 2
4 5
2 3
3 4
3 6
4 6
1 5
2 6
5 6
1 6
6 13
1 4
...

output:

78125
78125
78125
78125
78125
78125
78125
78125
78125
78125
78125
78125
78125
78125
78125
78125
78125
78125
78125
78125
78125
78125
78125
78125
78125
78125
78125
78125
78125
78125
78125
78125
78125
78125
78125
78125
78125
78125
78125
78125
78125
78125
78125
78125
78125
78125
78125
78125
78125
78125
...

result:

ok 26315 numbers

Test #41:

score: 0
Accepted
time: 56ms
memory: 10776kb

input:

25000
6 14
2 5
2 6
3 4
4 6
1 2
1 3
1 5
5 6
2 4
2 3
1 6
3 6
1 4
4 5
6 14
4 6
2 5
2 6
1 5
1 4
3 6
1 2
2 4
1 3
5 6
2 3
1 6
4 5
3 5
6 14
3 6
4 5
2 5
5 6
3 4
2 4
1 4
2 3
1 3
3 5
1 5
1 6
4 6
1 2
6 14
2 4
1 3
2 5
3 6
1 6
1 4
4 5
5 6
2 6
1 5
4 6
3 4
1 2
2 3
6 14
1 5
2 5
5 6
1 2
4 5
2 6
3 5
4 6
1 4
2 3
2 4
3...

output:

390625
390625
390625
390625
390625
390625
390625
390625
390625
390625
390625
390625
390625
390625
390625
390625
390625
390625
390625
390625
390625
390625
390625
390625
390625
390625
390625
390625
390625
390625
390625
390625
390625
390625
390625
390625
390625
390625
390625
390625
390625
390625
390625...

result:

ok 25000 numbers

Test #42:

score: 0
Accepted
time: 45ms
memory: 9144kb

input:

23809
6 15
1 4
1 6
1 5
1 2
4 6
1 3
5 6
2 5
3 6
3 4
2 3
2 6
3 5
2 4
4 5
6 15
1 6
2 6
5 6
4 6
1 4
2 5
3 4
1 3
2 3
2 4
1 5
1 2
4 5
3 6
3 5
6 15
1 6
2 3
2 6
4 6
1 3
1 5
4 5
1 4
3 4
2 4
3 6
3 5
2 5
1 2
5 6
6 15
4 6
2 5
1 3
4 5
3 6
1 5
3 5
2 3
2 6
1 2
1 4
1 6
2 4
5 6
3 4
6 15
2 5
2 4
5 6
1 4
4 6
4 5
1 6
1...

output:

1953125
1953125
1953125
1953125
1953125
1953125
1953125
1953125
1953125
1953125
1953125
1953125
1953125
1953125
1953125
1953125
1953125
1953125
1953125
1953125
1953125
1953125
1953125
1953125
1953125
1953125
1953125
1953125
1953125
1953125
1953125
1953125
1953125
1953125
1953125
1953125
1953125
1953...

result:

ok 23809 numbers

Test #43:

score: 0
Accepted
time: 89ms
memory: 21116kb

input:

1
200000 200000
192033 197543
68698 92316
101105 108314
42287 167424
96873 198103
90054 181007
44902 63014
13121 39886
922 100673
101400 163828
48349 72261
114526 119401
103065 113604
154652 183011
109138 126652
30269 94974
94410 145851
40539 199281
36305 85891
125138 175226
47940 79444
33199 37866
...

output:

444537953

result:

ok 1 number(s): "444537953"

Test #44:

score: 0
Accepted
time: 15ms
memory: 12828kb

input:

2
200000 20000
108321 180879
88904 193133
78349 167588
48793 176386
9337 14282
169326 183430
137976 183852
34693 67086
2908 140446
33207 62711
35015 94218
82149 158789
17344 142174
58161 123804
5398 197609
6280 104514
53777 137961
46724 160630
108948 173352
94757 191929
143703 177026
12102 23130
198...

output:

1
1

result:

ok 2 number(s): "1 1"

Test #45:

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

input:

2
200000 2000
99975 102824
68832 189203
3397 33768
1098 41286
130361 138457
94896 133312
88985 179041
132023 173596
53560 130317
16262 191928
121283 151325
188637 194148
50778 71264
76896 103887
62513 161056
7812 46245
25552 132309
49693 61432
26898 86893
104423 140282
70883 74322
56148 108398
10431...

output:

1
1

result:

ok 2 number(s): "1 1"

Test #46:

score: 0
Accepted
time: 7ms
memory: 10816kb

input:

2
200000 200
10753 74336
43457 64846
10651 80022
3837 82952
1858 141595
26529 105831
6250 25609
61730 159223
93332 151889
180773 193914
20166 197193
57091 156902
175005 180822
44680 116006
64565 150984
62222 157695
133478 173850
69052 157331
110144 147063
177065 189688
11238 143072
87301 120407
7114...

output:

1
1

result:

ok 2 number(s): "1 1"

Test #47:

score: 0
Accepted
time: 7ms
memory: 10792kb

input:

2
200000 20
5257 148677
162553 197850
111868 155721
107664 126552
62203 137455
14497 166801
55827 183883
65733 166863
59012 81923
85782 139494
24258 173717
73211 92450
8439 144206
30476 45096
114430 142995
14810 159083
77148 179306
46394 156643
27901 124852
102182 127720
200000 20
64561 89467
39075 ...

output:

1
1

result:

ok 2 number(s): "1 1"

Test #48:

score: 0
Accepted
time: 151ms
memory: 26404kb

input:

1
200000 300000
71498 193465
3204 34387
39857 57067
96266 121405
37618 79837
83859 117514
48704 146927
20568 164842
114670 116300
29092 157092
24284 107065
13203 74454
136782 164480
118657 148674
89928 123474
18573 39638
20957 88248
41717 88067
13865 48733
69137 159434
78642 156327
15690 119237
1373...

output:

297733283

result:

ok 1 number(s): "297733283"

Test #49:

score: 0
Accepted
time: 117ms
memory: 22816kb

input:

1
100000 300000
39472 39727
2843 50171
53757 65750
13301 84898
11109 43332
90497 91607
8552 32930
21773 40952
49406 66096
39660 69165
38816 80559
40736 42964
37754 55993
49267 64940
13781 80559
92026 92110
25411 88917
1996 71998
47141 72773
2643 44239
7660 94291
37378 78169
35245 50455
58265 83500
2...

output:

256525314

result:

ok 1 number(s): "256525314"

Test #50:

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

input:

1
50000 300000
11693 27473
19091 46309
9131 21671
21985 30483
681 20087
41980 45400
512 12806
15306 40975
20142 49898
1789 8047
34758 37470
13491 17819
5016 29848
12040 32659
2368 12152
11302 12090
17138 23024
14575 26363
11789 27646
12171 36700
36015 40296
30549 48429
801 21813
40514 41420
13855 16...

output:

996064616

result:

ok 1 number(s): "996064616"

Test #51:

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

input:

1
20000 300000
13875 14627
5331 7127
6585 17648
1700 12754
7683 12816
7457 17725
3344 8237
11368 12833
4910 18053
1068 4448
4799 15630
8938 9045
5405 7977
12062 16040
6442 16447
11694 15197
9617 11311
7888 15631
198 15934
3400 13622
5581 7045
9279 13225
6664 7017
4338 17368
11423 17871
1357 8872
347...

output:

679447790

result:

ok 1 number(s): "679447790"

Test #52:

score: 0
Accepted
time: 56ms
memory: 15516kb

input:

1
10000 300000
906 2644
1176 3139
2402 7208
8906 9907
5197 8146
6836 7298
2622 6487
7127 9085
1593 4467
2768 7211
577 5421
7330 9992
4559 8239
2475 9961
1629 5719
3989 8979
1370 9542
1787 9712
4788 7449
5433 6241
1473 9066
1685 5557
846 8550
4124 7053
2603 4975
5610 7281
3070 3430
1159 5543
43 5882
...

output:

270042667

result:

ok 1 number(s): "270042667"

Test #53:

score: 0
Accepted
time: 45ms
memory: 14048kb

input:

1
5000 300000
558 4376
1854 4828
1662 2879
587 1285
117 3159
1974 2990
3472 4882
1691 3478
1664 4941
2427 4192
646 3903
1774 4484
1153 1542
3535 4522
1878 4858
1753 3689
1714 3342
3000 4545
112 4653
810 1660
3643 4298
716 4720
624 3206
752 3966
2011 4676
1581 4816
626 4315
234 2962
1650 4349
2523 41...

output:

525650726

result:

ok 1 number(s): "525650726"