QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#526152#7245. Frank SinatrafryingducWA 937ms27728kbC++142.3kb2024-08-21 11:32:192024-08-21 11:32:19

詳細信息

Test #1:

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

input:

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

output:

0
1
2
2
3
3

result:

ok 6 numbers

Test #2:

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

input:

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

output:

0
1
1
0

result:

ok 4 number(s): "0 1 1 0"

Test #3:

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

input:

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

output:

0
2
2
0
0
2
1
2
0
0
2
2
2
2
0
2
0
2
2
1
2
0
2
0
0
2
1
0
2
0
2
2
0
2
0
0
2
2
2
2
2
0
1
2
2
2
2
2
0
2
2
0
2
2
0
2
0
2
0
2
2
2
2
2
1
2
2
1
2
0
0
2
2
0
0
2
2
2
2
0
2
0
2
0
2
0
0
0
0
1
2
0
2
0
1
2
2
2
2
2

result:

ok 100 numbers

Test #4:

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

input:

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

output:

0
0
0
1
1
0
0
0
2
0
2
0
2
0
2
2
2
2
0
0
0
0
0
0
0
0
2
0
0
0
2
1
2
0
0
0
0
1
1
0
2
0
0
2
0
0
1
2
0
2
0
0
0
0
0
2
0
2
1
2
2
2
0
2
0
2
2
2
0
2
0
2
1
2
0
1
2
0
0
2
0
2
0
2
0
0
2
0
0
1
0
1
0
2
1
2
2
2
2
0

result:

ok 100 numbers

Test #5:

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

input:

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

output:

2
0
1
2
2
2
1
2
2
1
1
1
1
2
1
0
2
2
2
1
1
2
1
0
1
0
1
1
1
2
1
0
1
2
1
1
1
2
1
2
2
1
1
2
1
2
0
1
2
2
2
0
2
1
2
2
1
2
1
2
2
1
2
2
0
1
2
1
2
0
2
1
1
2
2
2
0
1
1
1
1
2
2
1
1
1
2
2
2
0
1
0
2
1
2
2
2
2
1
2

result:

ok 100 numbers

Test #6:

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

input:

316 99856
173 102 0
290 81 1
209 299 0
96 16 0
254 48 1
107 173 0
288 102 1
130 94 1
280 152 0
293 187 1
270 76 1
18 301 0
33 136 1
179 212 1
181 60 1
134 129 0
81 240 1
180 132 1
33 296 1
81 14 0
240 184 0
235 42 0
200 70 0
4 259 1
230 244 0
284 252 1
230 236 0
187 216 1
177 305 1
70 28 1
21 279 0
...

output:

2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
0
...

result:

ok 99856 numbers

Test #7:

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

input:

316 99856
15 21 1
152 21 0
58 21 0
200 21 0
21 267 0
227 21 1
21 72 1
21 270 1
21 28 0
172 21 1
26 21 1
21 257 0
90 21 1
21 134 0
21 46 1
53 21 1
21 31 0
124 21 1
21 312 0
110 21 0
189 21 1
21 150 1
178 21 0
265 21 1
21 165 0
54 21 0
21 35 0
97 21 1
102 21 0
21 96 1
161 21 1
66 21 1
21 127 1
16 21 0...

output:

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

result:

ok 99856 numbers

Test #8:

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

input:

316 99856
192 178 1
279 42 0
304 261 0
47 100 0
282 142 0
122 238 1
295 236 1
128 265 1
124 291 0
299 19 1
144 164 1
113 131 0
206 50 0
242 294 1
7 258 0
22 220 1
5 239 0
270 263 1
156 14 1
66 22 0
254 271 1
295 12 0
69 87 0
302 33 0
4 56 1
34 204 0
168 285 1
98 116 1
50 223 1
205 154 1
145 73 0
84 ...

output:

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

result:

ok 99856 numbers

Test #9:

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

input:

316 99856
173 234 1
290 158 2
143 299 2
74 16 0
254 88 0
107 187 1
288 68 2
234 94 0
280 39 0
293 219 0
270 63 0
286 301 0
181 136 1
179 199 2
221 60 1
9 129 1
143 240 1
206 132 2
33 81 1
81 79 0
313 184 2
235 187 1
200 163 2
148 259 1
230 223 0
189 252 2
204 236 1
284 216 0
259 305 0
124 28 2
21 29...

output:

3
3
3
3
3
1
3
3
3
0
3
3
3
3
3
3
2
3
3
3
3
3
3
1
3
3
3
3
2
3
3
3
3
1
3
0
3
3
3
3
3
3
3
3
0
3
3
3
3
3
3
3
0
2
1
1
3
3
3
1
3
1
0
3
1
3
3
3
3
3
3
3
1
3
3
3
3
3
0
3
3
1
3
3
3
1
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
0
3
3
3
3
3
0
3
3
3
3
3
3
3
3
1
1
3
3
3
0
0
0
3
3
3
3
3
1
0
3
0
3
3
3
3
3
2
3
0
...

result:

ok 99856 numbers

Test #10:

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

input:

316 99856
15 21 1
152 21 1
58 21 1
200 21 1
21 267 1
227 21 1
21 72 0
21 270 1
21 28 1
172 21 2
26 21 2
21 257 2
90 21 0
21 134 0
21 46 1
53 21 2
21 31 2
124 21 2
21 312 1
110 21 2
189 21 2
21 150 1
178 21 1
265 21 0
21 165 2
54 21 2
21 35 2
97 21 1
102 21 2
21 96 0
161 21 1
66 21 2
21 127 0
16 21 0...

output:

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

result:

ok 99856 numbers

Test #11:

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

input:

316 99856
192 178 1
279 42 0
304 261 0
47 100 2
282 142 1
122 238 2
295 236 0
128 265 2
124 291 0
299 19 2
144 164 1
113 131 1
206 50 0
242 294 2
7 258 0
22 220 2
5 239 2
270 263 2
156 14 0
66 22 1
254 271 2
295 12 2
69 87 2
302 33 1
4 56 1
34 204 1
168 285 1
98 116 0
50 223 2
205 154 2
145 73 1
84 ...

output:

3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
1
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
1
3
3
3
3
0
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
2
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
0
3
3
3
3
3
3
3
3
3
3
3
3
3
3
0
3
3
0
3
3
3
3
3
3
3
3
1
3
3
3
3
3
3
3
0
3
3
3
3
3
3
3
...

result:

ok 99856 numbers

Test #12:

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

input:

316 99856
173 193 2
290 193 3
249 299 3
91 16 2
254 306 3
107 6 1
288 63 3
75 94 3
280 1 0
293 105 1
270 42 0
255 301 2
188 136 0
179 234 3
288 60 2
48 129 0
76 240 3
186 132 1
33 1 2
81 187 3
77 184 0
235 48 3
200 11 2
211 259 0
230 24 2
36 252 3
306 236 0
310 216 0
68 305 2
43 28 3
21 192 3
196 16...

output:

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

result:

ok 99856 numbers

Test #13:

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

input:

316 99856
15 21 2
152 21 0
58 21 3
200 21 3
21 267 2
227 21 1
21 72 1
21 270 1
21 28 0
172 21 0
26 21 2
21 257 3
90 21 0
21 134 2
21 46 0
53 21 3
21 31 1
124 21 3
21 312 3
110 21 1
189 21 2
21 150 3
178 21 1
265 21 0
21 165 0
54 21 1
21 35 0
97 21 0
102 21 0
21 96 3
161 21 0
66 21 0
21 127 0
16 21 2...

output:

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

result:

ok 99856 numbers

Test #14:

score: 0
Accepted
time: 36ms
memory: 11196kb

input:

316 99856
192 178 1
279 42 0
304 261 2
47 100 2
282 142 2
122 238 0
295 236 0
128 265 0
124 291 2
299 19 1
144 164 3
113 131 1
206 50 2
242 294 3
7 258 0
22 220 2
5 239 3
270 263 2
156 14 1
66 22 2
254 271 1
295 12 1
69 87 3
302 33 1
4 56 2
34 204 2
168 285 3
98 116 0
50 223 3
205 154 3
145 73 3
84 ...

output:

4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
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
0
4
4
4
4
0
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
0
4
4
4
4
4
4
4
4
4
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
0
4
4
1
4
4
4
4
4
4
4
4
0
4
4
4
4
4
4
4
1
4
4
4
4
4
4
4
...

result:

ok 99856 numbers

Test #15:

score: 0
Accepted
time: 849ms
memory: 21528kb

input:

100000 100000
16002 62285 0
94338 15156 0
16232 69491 0
78830 42791 0
42291 79934 0
25280 42281 0
43246 84026 0
81015 59152 0
26228 85524 0
77807 16621 0
87239 27802 0
45572 68749 0
46470 21413 0
91385 31600 0
39840 65919 0
63409 52046 0
61637 45889 0
96346 70771 0
21432 11753 0
38616 69335 0
32943 ...

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 #16:

score: 0
Accepted
time: 847ms
memory: 21228kb

input:

100000 100000
18058 1882 1
77635 23818 0
9851 91935 0
16218 67969 0
45198 25980 1
34560 43159 1
1776 39890 0
98660 22738 1
26971 8570 1
2179 17775 0
62019 51220 0
62891 66989 0
16522 90763 1
18870 64357 0
87537 98200 0
77096 4652 1
23186 24016 0
75961 12188 0
93342 52219 0
92566 95797 0
93844 1045 1...

output:

2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
...

result:

ok 100000 numbers

Test #17:

score: 0
Accepted
time: 795ms
memory: 21232kb

input:

100000 100000
28219 35524 1
28219 53586 0
64427 28219 0
28219 42140 0
45389 28219 0
28219 52860 0
28219 35426 1
28219 90684 1
80876 28219 0
82716 28219 1
28219 3235 1
28219 71380 0
91782 28219 1
81272 28219 1
36766 28219 0
28219 98110 0
82939 28219 0
28219 38431 0
28219 10730 0
26093 28219 1
28219 1...

output:

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

result:

ok 100000 numbers

Test #18:

score: 0
Accepted
time: 177ms
memory: 26484kb

input:

100000 100000
6196 12153 0
41017 63946 1
50788 1093 0
73450 8393 0
39953 43098 1
79223 31673 0
52002 80524 0
17987 71772 1
30033 94926 1
71307 89317 0
54060 27606 1
19745 34037 0
41237 8207 1
63416 54551 1
53426 80067 1
53006 8664 0
48006 34930 0
80417 39489 1
20067 80710 1
6662 17711 1
30332 56310 ...

output:

2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
...

result:

ok 100000 numbers

Test #19:

score: 0
Accepted
time: 844ms
memory: 21440kb

input:

100000 100000
7760 13303 1
82993 83715 2
62730 56484 0
83039 50548 2
78786 87514 2
10559 10618 1
66287 67668 0
41493 8689 0
57586 13866 2
30300 26277 1
80847 82736 1
78087 44949 1
56814 18488 0
3770 25564 0
92765 44117 1
51973 57772 0
4986 3551 0
48055 89097 1
93264 84315 2
8010 19209 0
14291 53007 ...

output:

3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
0
3
3
3
3
3
3
3
3
3
3
3
3
...

result:

ok 100000 numbers

Test #20:

score: 0
Accepted
time: 903ms
memory: 21252kb

input:

100000 100000
47746 88433 0
59039 47746 0
47746 20905 2
85710 47746 1
44992 47746 1
79653 47746 2
47746 14548 0
31210 47746 0
47746 89755 2
47746 73218 0
22700 47746 0
47746 35494 1
47746 49441 2
11681 47746 0
53229 47746 2
47746 44731 0
47746 95088 1
99629 47746 0
47746 96352 1
47746 54190 0
11523 ...

output:

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

result:

ok 100000 numbers

Test #21:

score: 0
Accepted
time: 167ms
memory: 26872kb

input:

100000 100000
48973 53883 0
12063 14772 2
6775 32451 0
66201 77174 0
65550 77996 2
98741 34355 1
77638 13750 2
3352 77664 0
59883 33050 1
17186 14578 2
69513 82629 0
1006 42174 1
18820 60006 1
66415 65700 1
44740 71182 1
71950 13297 1
89729 50426 2
63573 67261 1
98428 25648 0
45987 53708 0
29113 418...

output:

3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
...

result:

ok 100000 numbers

Test #22:

score: 0
Accepted
time: 937ms
memory: 21076kb

input:

100000 100000
17024 36523 84
26573 32514 116
6731 63527 277
63675 63578 182
71445 49677 83
93835 37340 98
12434 61092 239
80203 96847 68
39780 56175 178
74379 71676 309
11723 41464 194
80813 7960 202
46447 85185 108
92345 34067 298
24118 386 276
76948 48980 2
81038 16844 152
18924 48647 162
67518 96...

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
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
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 #23:

score: 0
Accepted
time: 388ms
memory: 21148kb

input:

100000 100000
56477 56831 270
98074 56831 256
56831 4716 244
56831 93132 278
56831 55319 278
56831 45061 10
56831 82924 297
56831 89764 133
56831 24375 134
56831 93793 143
99474 56831 60
56831 91587 316
3678 56831 217
57831 56831 63
56831 36997 34
71852 56831 191
56831 17774 146
28274 56831 23
56831...

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
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
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 #24:

score: 0
Accepted
time: 180ms
memory: 26980kb

input:

100000 100000
59093 75611 137
581 51203 162
54074 97112 126
10865 36786 69
48055 95244 116
7450 56728 259
92624 69291 173
47563 55140 31
5600 93920 299
78509 28861 31
36582 32778 12
32218 12904 274
22103 41376 264
70187 41753 92
68731 46857 59
19576 17703 87
38244 38734 261
86217 25250 142
51486 750...

output:

317
317
317
317
317
317
317
317
317
317
317
317
317
317
317
317
317
317
317
317
317
317
317
317
317
317
317
317
317
317
317
317
317
176
317
317
317
317
317
317
317
317
317
317
317
317
317
317
317
0
317
317
317
317
317
317
317
317
317
317
317
317
317
317
317
317
317
317
317
317
317
317
317
317
317
31...

result:

ok 100000 numbers

Test #25:

score: 0
Accepted
time: 917ms
memory: 21540kb

input:

100000 100000
29817 84458 99033
53836 73640 55741
85871 77126 61666
9307 90386 93376
27860 95044 41557
44965 31261 54827
43096 31875 8808
80483 5330 46039
43765 53043 74867
20184 92680 35161
97963 1663 63541
44742 37678 74162
39039 85798 62232
26111 88918 91944
72075 65425 80469
81160 17251 3282
661...

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
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
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 #26:

score: 0
Accepted
time: 379ms
memory: 21252kb

input:

100000 100000
29382 88834 53974
29382 57274 94233
10731 29382 1925
86336 29382 41723
29382 47685 67161
29382 86187 46850
29382 49401 75461
29382 52775 463
29382 52512 94610
29382 2198 51328
29382 66408 85039
29382 20966 65595
7677 29382 79698
29382 56627 90013
29382 47420 35452
29382 49571 35199
293...

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
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
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 #27:

score: 0
Accepted
time: 232ms
memory: 27188kb

input:

100000 100000
11208 90864 41319
69713 36976 82808
5673 82820 88653
90771 86971 16656
44320 31482 69488
90842 27639 69183
97064 18787 81145
95572 84656 69616
62816 99192 43797
28980 71465 38685
98312 71846 71935
3920 14594 18922
55938 56713 95626
92446 97247 25224
63877 56068 72051
600 41372 40806
99...

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
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
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 #28:

score: 0
Accepted
time: 246ms
memory: 26424kb

input:

100000 100000
31487 91825 80102
14052 39724 70104
60913 65623 53858
52759 45279 12555
26508 38599 58675
24857 32040 22919
90422 18212 91938
8556 79194 83731
92901 7879 26910
19646 91008 17362
37867 97263 79821
80509 83200 85420
61946 86430 28972
46276 21482 3115
40418 27917 38733
76576 63520 55605
3...

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
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
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 #29:

score: 0
Accepted
time: 261ms
memory: 26120kb

input:

100000 100000
46081 56728 87434
41721 57709 39847
47289 57325 82863
71592 56671 56190
50629 26161 72715
68091 23434 13167
33555 83693 9854
93132 92350 93506
95820 62321 13005
29465 8569 52834
90455 66279 28764
6303 23873 85796
12953 57014 91264
34385 1967 6788
22819 55248 94095
65734 55510 66134
273...

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
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
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 #30:

score: 0
Accepted
time: 247ms
memory: 27008kb

input:

100000 100000
61993 32628 566
90306 18856 41965
82394 97521 58280
15339 14513 77634
97256 58919 20919
49273 6329 15161
71532 11414 34889
91564 35619 7820
93082 1266 38003
28949 4752 87191
73214 26829 50244
57161 6738 95579
84608 63054 10555
41446 59389 37703
40931 53939 33640
82657 54304 13173
72330...

output:

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

result:

ok 100000 numbers

Test #31:

score: 0
Accepted
time: 245ms
memory: 27728kb

input:

100000 100000
2847 38872 9696
51923 68347 29536
97953 1131 63398
77267 26389 52045
26036 62687 25961
34138 89576 69171
41044 16083 72298
29706 15566 27225
80235 79053 79302
7200 7169 67224
10694 49135 36384
19336 57256 31963
75795 51711 19573
22691 87786 10001
25755 64830 91333
72199 21420 28026
720...

output:

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

result:

ok 100000 numbers

Test #32:

score: -100
Wrong Answer
time: 918ms
memory: 21512kb

input:

100000 100000
78016 31373 6273
25172 69767 98366
41726 7757 38984
29804 84793 190736
23976 87714 166838
30967 38411 113203
14107 95938 167542
20350 55263 65934
49016 29504 64497
13256 95353 28103
43901 42349 56304
78967 65066 34190
44284 75517 111454
80968 6309 184111
34535 38116 21107
52842 47532 1...

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
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
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:

wrong answer 1823rd numbers differ - expected: '0', found: '1'