QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#576083#7785. Three Rectanglesucup-team4543WA 112ms3888kbC++203.7kb2024-09-19 18:18:392024-09-19 18:18:39

詳細信息

Test #1:

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

input:

5
2 2
1 1
1 1
1 1
2 2
1 1
1 2
1 2
2 2
1 1
1 2
2 1
2 2
1 2
1 2
1 2
2 2
1 2
1 2
2 1

output:

0
8
4
6
4

result:

ok 5 number(s): "0 8 4 6 4"

Test #2:

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

input:

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

output:

6
12
14
6

result:

ok 4 number(s): "6 12 14 6"

Test #3:

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

input:

1
1000000000 1000000000
1 1
1 1
1000000000 1000000000

output:

2401

result:

ok 1 number(s): "2401"

Test #4:

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

input:

729
999999999 111111111
111111111 111111111
111111111 111111111
111111111 111111111
999999999 111111111
111111111 111111111
222222222 111111111
111111111 111111111
999999999 111111111
111111111 111111111
111111111 111111111
333333333 111111111
999999999 111111111
111111111 111111111
444444444 111111...

output:

0
0
0
0
0
0
6
777777753
456790164
0
0
0
0
0
6
222222208
555555531
135802502
0
0
0
0
6
222222208
222222208
333333309
814814847
0
0
0
6
222222208
222222208
222222208
111111087
493827185
0
0
6
222222208
222222208
222222208
222222208
888888872
172839523
0
6
222222208
222222208
222222208
222222208
222222...

result:

ok 729 numbers

Test #5:

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

input:

5832
999999999 222222222
111111111 111111111
111111111 111111111
111111111 111111111
222222222 999999999
111111111 111111111
111111111 111111111
111111111 222222222
222222222 999999999
111111111 111111111
111111111 111111111
111111111 333333333
999999999 222222222
111111111 111111111
111111111 11111...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
4
413046795
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
4
989330902
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
4
565615002
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
4
141899102
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
4
718183209
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
4
294467309
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
4
87...

result:

ok 5832 numbers

Test #6:

score: 0
Accepted
time: 21ms
memory: 3536kb

input:

19683
999999999 333333333
111111111 111111111
111111111 111111111
111111111 111111111
999999999 333333333
111111111 111111111
111111111 111111111
222222222 111111111
999999999 333333333
333333333 111111111
111111111 111111111
111111111 111111111
999999999 333333333
111111111 111111111
444444444 1111...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
239292815
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
477213862
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
715134909
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
953055956
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 19683 numbers

Test #7:

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

input:

46656
999999999 444444444
111111111 111111111
111111111 111111111
111111111 111111111
999999999 444444444
111111111 111111111
111111111 111111111
222222222 111111111
444444444 999999999
111111111 333333333
111111111 111111111
111111111 111111111
999999999 444444444
444444444 111111111
111111111 1111...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
935528231
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
599451396
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
263374561
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 46656 numbers

Test #8:

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

input:

91125
999999999 555555555
111111111 111111111
111111111 111111111
111111111 111111111
555555555 999999999
111111111 222222222
111111111 111111111
111111111 111111111
555555555 999999999
111111111 111111111
111111111 111111111
111111111 333333333
999999999 555555555
111111111 111111111
444444444 1111...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
501753029
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
356043497
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
210333965
0
0
0
...

result:

ok 91125 numbers

Test #9:

score: 0
Accepted
time: 110ms
memory: 3636kb

input:

100000
666666666 999999999
111111111 111111111
111111111 111111111
111111111 111111111
999999999 666666666
222222222 111111111
111111111 111111111
111111111 111111111
666666666 999999999
111111111 111111111
111111111 111111111
111111111 333333333
999999999 666666666
111111111 111111111
444444444 111...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
937967223
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
746990172
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 100000 numbers

Test #10:

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

input:

57464
666666666 999999999
444444444 888888888
222222222 777777777
666666666 222222222
999999999 666666666
333333333 666666666
888888888 444444444
777777777 222222222
999999999 666666666
444444444 666666666
777777777 222222222
888888888 444444444
666666666 999999999
666666666 555555555
222222222 7777...

output:

4
4
4
4
4
4
4
232891329
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
4
0
0
0
0
0
0
0
0
4
4
4
4
4
4
4
4
4
109586954
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
4
4
4
4
4
4
4
4
271604940
4
4
4
4
4
4
4
4
271604940
4
4
4
4
4
4
4
4
986282586
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 57464 numbers

Test #11:

score: 0
Accepted
time: 109ms
memory: 3576kb

input:

100000
777777777 999999999
111111111 111111111
111111111 111111111
111111111 111111111
999999999 777777777
222222222 111111111
111111111 111111111
111111111 111111111
777777777 999999999
111111111 111111111
111111111 111111111
111111111 333333333
777777777 999999999
111111111 111111111
111111111 111...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
244170799
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
772291414
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 100000 numbers

Test #12:

score: 0
Accepted
time: 111ms
memory: 3620kb

input:

100000
999999999 777777777
222222222 333333333
444444444 222222222
888888888 333333333
999999999 777777777
444444444 222222222
888888888 333333333
333333333 333333333
999999999 777777777
888888888 333333333
444444444 222222222
444444444 333333333
999999999 777777777
888888888 333333333
444444444 222...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
4
0
0
0
0
0
0
0
0
4
0
0
0
0
0
0
0
0
669562568
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
4
0
0
0
0
0
0
0
0
4
0
0
0
0
0
0
0
0
980643199
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 100000 numbers

Test #13:

score: 0
Accepted
time: 54ms
memory: 3656kb

input:

50047
777777777 999999999
555555555 333333333
333333333 777777777
666666666 666666666
999999999 777777777
777777777 333333333
666666666 666666666
444444444 555555555
777777777 999999999
666666666 666666666
333333333 777777777
555555555 555555555
777777777 999999999
555555555 666666666
333333333 7777...

output:

0
0
0
0
0
0
4
0
0
0
0
0
0
0
0
4
0
0
4
4
4
4
4
4
356195704
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
4
0
0
0
0
0
0
0
0
4
0
0
0
0
0
0
0
0
4
0
0
4
4
4
4
4
4
377686331
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
4
4
4
4
4
4
296296298
0
0
4
4
4
4
4
4
296296298
0
...

result:

ok 50047 numbers

Test #14:

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

input:

100000
888888888 999999999
111111111 111111111
111111111 111111111
111111111 111111111
888888888 999999999
111111111 222222222
111111111 111111111
111111111 111111111
999999999 888888888
333333333 111111111
111111111 111111111
111111111 111111111
999999999 888888888
111111111 111111111
111111111 111...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
420363771
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
431947...

result:

ok 100000 numbers

Test #15:

score: 0
Accepted
time: 105ms
memory: 3588kb

input:

100000
888888888 999999999
888888888 222222222
333333333 333333333
333333333 222222222
888888888 999999999
333333333 222222222
333333333 333333333
888888888 333333333
999999999 888888888
333333333 333333333
444444444 888888888
222222222 333333333
999999999 888888888
222222222 333333333
333333333 333...

output:

0
0
0
0
0
0
0
638774850
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
584667189
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 100000 numbers

Test #16:

score: 0
Accepted
time: 112ms
memory: 3644kb

input:

100000
999999999 888888888
333333333 777777777
333333333 555555555
666666666 555555555
999999999 888888888
444444444 777777777
666666666 555555555
333333333 555555555
888888888 999999999
555555555 666666666
777777777 555555555
555555555 333333333
888888888 999999999
777777777 666666666
555555555 666...

output:

0
0
0
0
0
0
4
0
0
0
0
0
4
4
4
617283975
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
4
0
0
0
0
0
0
0
0
4
0
0
0
0
0
0
0
0
4
0
0
0
0
0
0
0
0
4
0
0
0
0
0
0
0
0
4
0
0
0
0
0
4
4
4
288065855
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
4
0
0
0
0
0
0
0
0
4
0
0
0
0
0
0
0
0
4
0
0
0
0
0
0
0
0
4
...

result:

ok 100000 numbers

Test #17:

score: 0
Accepted
time: 78ms
memory: 3812kb

input:

73248
888888888 999999999
777777777 444444444
666666666 444444444
777777777 999999999
888888888 999999999
666666666 555555555
777777777 999999999
777777777 444444444
999999999 888888888
666666666 666666666
444444444 777777777
999999999 777777777
999999999 888888888
444444444 777777777
999999999 7777...

output:

0
4
4
4
4
345679014
0
0
0
0
4
4
4
4
345679014
0
0
0
0
4
4
4
4
685871061
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
345679014
277091911
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 73248 numbers

Test #18:

score: 0
Accepted
time: 110ms
memory: 3600kb

input:

100000
999999999 999999999
111111111 111111111
111111111 111111111
111111111 111111111
999999999 999999999
111111111 222222222
111111111 111111111
111111111 111111111
999999999 999999999
111111111 333333333
111111111 111111111
111111111 111111111
999999999 999999999
111111111 111111111
111111111 111...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
466546132
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 100000 numbers

Test #19:

score: 0
Accepted
time: 105ms
memory: 3644kb

input:

100000
999999999 999999999
333333333 222222222
666666666 222222222
222222222 777777777
999999999 999999999
333333333 666666666
222222222 333333333
777777777 222222222
999999999 999999999
222222222 777777777
333333333 222222222
666666666 444444444
999999999 999999999
222222222 333333333
555555555 666...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
4
0
0
0
0
0
0
0
0
4
0
0
0
0
0
0
0
0
783722091
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
4
0
0
0
0
0
0
0
0
4
0
0
0
0
0
0
0
0
480109819
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 100000 numbers

Test #20:

score: 0
Accepted
time: 109ms
memory: 3648kb

input:

100000
999999999 999999999
444444444 555555555
444444444 444444444
333333333 222222222
999999999 999999999
222222222 444444444
444444444 444444444
555555555 444444444
999999999 999999999
222222222 555555555
444444444 444444444
555555555 444444444
999999999 999999999
555555555 444444444
222222222 666...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
4
4
4
4
243560539
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
4
0
0
0
0
0
0
0
0
4
0
0
0
0
0
0
0
0
4
0
0
0
0
0
0
0
0
4
0
0
0
0
...

result:

ok 100000 numbers

Test #21:

score: 0
Accepted
time: 110ms
memory: 3816kb

input:

100000
999999999 999999999
666666666 111111111
777777777 444444444
777777777 555555555
999999999 999999999
111111111 666666666
555555555 777777777
555555555 777777777
999999999 999999999
555555555 777777777
111111111 666666666
666666666 777777777
999999999 999999999
777777777 777777777
111111111 666...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
4
409236420
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
4
919067235
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 100000 numbers

Test #22:

score: 0
Accepted
time: 110ms
memory: 3656kb

input:

100000
999999999 999999999
777777777 999999999
555555555 333333333
777777777 777777777
999999999 999999999
333333333 666666666
999999999 777777777
777777777 777777777
999999999 999999999
999999999 777777777
777777777 777777777
333333333 777777777
999999999 999999999
333333333 888888888
999999999 777...

output:

4
4
4
4
4
0
4
4
4
4
4
4
4
4
0
4
4
4
4
4
4
4
4
0
4
4
4
4
4
4
4
4
0
4
4
4
4
4
4
4
4
0
4
4
4
4
4
4
4
4
0
98765434
98765434
98765434
98765434
98765434
98765434
98765434
72702332
0
0
0
0
0
0
0
0
0
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
...

result:

ok 100000 numbers

Test #23:

score: 0
Accepted
time: 32ms
memory: 3852kb

input:

31441
999999999 999999999
888888888 666666666
999999999 555555555
222222222 888888888
999999999 999999999
555555555 999999999
777777777 888888888
888888888 222222222
999999999 999999999
888888888 888888888
888888888 222222222
555555555 999999999
999999999 999999999
999999999 888888888
888888888 2222...

output:

4
4
4
4
0
0
0
395061730
395061730
395061730
395061730
395061730
50754460
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
4
4
4
4
4
888888890
0
0
0
4
4
4
4
4
888888890
0
0
0
555555549
555555549
555555549
555555549
555555549
456790140
0...

result:

ok 31441 numbers

Test #24:

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

input:

1000
1000000000 100000000
100000000 100000000
100000000 100000000
100000000 100000000
1000000000 100000000
100000000 100000000
100000000 100000000
200000000 100000000
1000000000 100000000
100000000 100000000
100000000 100000000
300000000 100000000
100000000 1000000000
100000000 100000000
100000000 4...

output:

0
0
0
0
0
0
0
6
799999979
130000029
0
0
0
0
0
0
6
199999988
599999979
660000029
0
0
0
0
0
6
199999988
199999988
399999979
190000022
0
0
0
0
6
199999988
199999988
199999988
199999979
720000022
0
0
0
6
199999988
199999988
199999988
199999988
999999986
250000015
0
0
6
199999988
199999988
199999988
1999...

result:

ok 1000 numbers

Test #25:

score: 0
Accepted
time: 9ms
memory: 3880kb

input:

8000
200000000 1000000000
100000000 100000000
100000000 100000000
100000000 100000000
1000000000 200000000
100000000 100000000
100000000 100000000
200000000 100000000
1000000000 200000000
100000000 100000000
300000000 100000000
100000000 100000000
1000000000 200000000
400000000 100000000
100000000 1...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
4
781700008
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
4
829400008
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
4
877100008
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
4
924800008
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
4
972500008
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
4
20200001
0
0
0
0
0
0
0...

result:

ok 8000 numbers

Test #26:

score: -100
Wrong Answer
time: 30ms
memory: 3580kb

input:

27000
300000000 1000000000
100000000 100000000
100000000 100000000
100000000 100000000
300000000 1000000000
100000000 100000000
100000000 200000000
100000000 100000000
1000000000 300000000
300000000 100000000
100000000 100000000
100000000 100000000
1000000000 300000000
100000000 100000000
100000000 ...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
500800008
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
585600008
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
670400008
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
755200008
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

wrong answer 3890th numbers differ - expected: '2', found: '1000000009'