QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#360294#1092. Burnished Security UpdatesSolitaryDream#AC ✓111ms43520kbC++17807b2024-03-21 17:02:292024-03-21 17:02:29

Judging History

你现在查看的是最新测评结果

  • [2024-03-21 17:02:29]
  • 评测
  • 测评结果:AC
  • 用时:111ms
  • 内存:43520kb
  • [2024-03-21 17:02:29]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;

const int N=1e6+1e3+7;

int n,m;

vector<int> g[N];

int c[N],cnt[3];

void dfs(int x)
{
    ++cnt[c[x]];
    for(auto v:g[x])
    {
        if(!c[v])
            c[v]=c[x]^3,dfs(v);
        else if(c[v]!=(c[x]^3))
        {
            cout<<"-1\n";
            exit(0);
        }
    }
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>n>>m;
    for(int i=1;i<=m;i++)
    {
        int u,v;
        cin>>u>>v;
        g[u].push_back(v);
        g[v].push_back(u);
    }
    int ans=0;
    for(int i=1;i<=n;i++)
        if(!c[i])
        {
            memset(cnt,0,sizeof(cnt));
            c[i]=1;
            dfs(i);
            ans+=min(cnt[1],cnt[2]);
        }
    cout<<ans<<"\n";
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 8ms
memory: 27748kb

input:

4 2
1 2
3 4

output:

2

result:

ok 1 number(s): "2"

Test #2:

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

input:

4 4
1 2
2 3
3 4
1 4

output:

2

result:

ok 1 number(s): "2"

Test #3:

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

input:

4 3
1 2
2 3
1 3

output:

-1

result:

ok 1 number(s): "-1"

Test #4:

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

input:

300000 49525
14 7
8 10
25 22
33 32
33 36
33 38
35 34
36 34
34 40
35 41
39 36
40 38
53 52
53 57
54 55
56 54
59 61
59 64
64 61
71 73
71 74
77 71
71 79
77 72
74 73
77 78
80 84
80 85
96 100
100 103
126 125
149 150
153 154
154 159
157 155
156 160
158 160
164 162
169 167
169 168
168 173
173 169
171 170
17...

output:

-1

result:

ok 1 number(s): "-1"

Test #5:

score: 0
Accepted
time: 13ms
memory: 30648kb

input:

299996 49689
7 10
20 19
27 26
49 44
47 48
63 57
63 58
61 59
59 62
62 60
60 64
65 74
71 66
77 76
88 84
98 99
115 118
121 115
121 116
130 126
135 141
141 139
142 143
178 174
182 180
185 189
187 193
191 190
222 227
231 235
238 239
243 240
247 240
247 246
257 254
258 256
264 266
271 267
274 268
282 279
...

output:

-1

result:

ok 1 number(s): "-1"

Test #6:

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

input:

299993 49815
10 12
15 18
19 21
28 31
47 52
53 52
59 55
65 62
62 66
73 72
72 76
90 85
92 85
93 85
90 92
97 94
96 100
100 99
101 103
105 104
104 107
111 105
107 112
117 115
121 117
117 124
119 121
122 120
122 123
137 133
152 151
163 161
168 169
173 172
200 201
212 215
217 215
231 224
228 229
243 241
2...

output:

-1

result:

ok 1 number(s): "-1"

Test #7:

score: 0
Accepted
time: 12ms
memory: 31396kb

input:

299991 49386
15 12
26 19
22 23
24 22
24 23
25 27
32 36
36 34
35 38
55 54
57 54
59 62
61 60
61 64
63 62
72 71
76 74
83 78
85 81
85 82
86 87
92 86
93 95
107 110
112 108
114 115
115 119
121 115
120 116
121 120
133 131
156 160
160 164
162 161
162 163
180 178
184 186
187 184
188 186
188 189
221 220
227 2...

output:

-1

result:

ok 1 number(s): "-1"

Test #8:

score: 0
Accepted
time: 12ms
memory: 31556kb

input:

299993 48776
5 2
3 4
9 7
11 12
14 12
26 28
35 38
47 49
60 57
57 64
62 58
65 60
65 62
76 68
81 79
80 83
80 84
83 82
83 85
89 90
99 98
104 102
111 107
111 108
112 114
120 122
140 135
150 143
144 149
157 158
159 162
164 167
169 165
172 166
171 170
190 188
195 194
195 198
209 210
230 229
239 240
261 257...

output:

-1

result:

ok 1 number(s): "-1"

Test #9:

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

input:

299997 50016
4 2
6 2
8 9
22 21
24 21
23 22
34 38
35 37
45 44
53 56
61 53
54 57
58 54
54 61
60 56
57 58
60 58
61 58
70 75
79 81
79 84
85 79
79 87
80 81
82 81
85 83
95 93
102 98
99 102
112 111
137 136
138 141
151 152
159 157
177 171
172 174
181 178
188 183
186 190
189 188
194 195
198 202
205 198
199 2...

output:

-1

result:

ok 1 number(s): "-1"

Test #10:

score: 0
Accepted
time: 14ms
memory: 30056kb

input:

299991 49337
22 30
31 29
37 35
47 42
62 71
63 66
66 68
74 75
79 86
80 83
91 90
104 102
102 108
118 120
139 135
139 140
150 146
154 152
155 154
164 159
166 169
166 170
171 177
174 180
189 192
217 213
232 234
240 242
247 244
246 248
247 249
254 251
270 272
272 273
283 282
286 284
289 284
284 290
287 2...

output:

-1

result:

ok 1 number(s): "-1"

Test #11:

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

input:

299991 18824
7 3
13 8
12 10
36 30
34 37
46 44
48 44
73 67
106 102
104 108
139 134
135 139
145 141
144 142
175 177
189 194
190 193
210 206
214 213
253 249
253 250
283 286
302 294
309 304
311 305
345 349
381 382
393 391
391 398
408 406
417 412
427 421
463 459
517 520
531 527
542 541
559 560
574 576
60...

output:

15705

result:

ok 1 number(s): "15705"

Test #12:

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

input:

299998 18891
16 10
16 11
27 22
34 31
43 36
61 58
68 72
85 86
89 88
120 119
236 238
258 255
292 299
293 299
347 348
347 351
461 467
468 461
461 470
466 462
493 488
507 505
536 534
548 552
590 592
594 597
652 654
671 667
673 668
680 678
720 722
738 734
736 738
736 741
772 779
796 802
802 800
810 815
8...

output:

15777

result:

ok 1 number(s): "15777"

Test #13:

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

input:

299993 18696
9 2
3 9
17 22
29 31
40 34
69 66
85 83
86 91
109 101
110 117
118 110
117 111
117 113
114 117
114 119
119 115
125 124
132 127
138 133
141 143
142 144
159 156
170 172
178 181
209 216
210 217
283 277
290 285
302 298
309 312
329 327
361 363
362 366
420 415
431 427
427 432
428 431
429 432
437...

output:

15541

result:

ok 1 number(s): "15541"

Test #14:

score: 0
Accepted
time: 3ms
memory: 31112kb

input:

299995 18861
4 1
4 3
21 16
75 72
86 92
94 87
104 97
101 103
102 103
163 164
192 190
213 210
213 211
213 212
228 226
239 237
255 257
264 267
302 305
312 307
308 313
316 320
363 360
390 384
389 385
386 389
402 396
404 407
409 412
423 430
437 442
437 443
442 438
443 438
456 457
473 477
474 478
490 495
...

output:

15768

result:

ok 1 number(s): "15768"

Test #15:

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

input:

299994 18797
24 23
73 76
85 90
91 89
100 97
130 123
128 124
138 143
143 140
153 151
153 152
170 177
178 174
186 184
211 214
249 248
262 258
280 282
294 300
295 302
301 296
318 323
322 321
371 365
385 388
427 422
448 439
440 448
446 448
449 451
457 453
467 462
476 471
482 477
478 482
480 479
521 517
...

output:

15654

result:

ok 1 number(s): "15654"

Test #16:

score: 0
Accepted
time: 26ms
memory: 34316kb

input:

299992 180175
3 2
4 2
3 4
3 7
4 6
11 12
11 15
17 12
12 18
13 14
16 13
19 13
14 18
15 16
17 16
16 19
23 24
30 25
25 32
25 34
27 26
28 26
26 33
27 28
28 31
32 28
30 29
32 29
30 31
33 30
36 35
47 46
48 46
46 51
53 46
47 51
47 55
48 49
54 49
51 53
51 54
52 54
52 55
57 56
60 59
66 61
64 63
70 69
70 72
77...

output:

-1

result:

ok 1 number(s): "-1"

Test #17:

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

input:

299994 180568
5 3
4 5
7 8
9 10
11 9
10 15
11 15
13 12
12 14
12 15
15 13
17 20
18 19
25 24
30 24
25 30
31 25
31 26
27 29
29 30
33 37
40 37
41 38
39 41
49 44
45 49
48 49
58 60
58 63
65 58
64 59
59 66
64 60
61 62
64 61
66 61
62 64
62 65
65 64
66 65
70 67
69 68
68 72
70 69
71 70
76 75
78 77
82 77
79 78
...

output:

-1

result:

ok 1 number(s): "-1"

Test #18:

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

input:

299995 180225
5 3
4 8
4 11
10 5
5 11
8 7
7 12
10 8
12 8
9 12
13 14
13 15
14 16
26 19
27 19
28 19
24 20
25 21
21 27
22 26
22 27
22 28
25 24
34 30
31 33
31 34
34 33
35 41
39 38
42 43
44 42
46 42
48 51
51 50
51 52
51 57
53 54
59 62
63 60
66 60
64 61
69 70
73 71
71 76
77 73
82 78
82 79
79 86
80 81
80 83...

output:

-1

result:

ok 1 number(s): "-1"

Test #19:

score: 0
Accepted
time: 29ms
memory: 35328kb

input:

299997 179320
1 4
6 1
2 6
4 3
4 5
7 4
10 9
11 14
16 11
12 17
14 13
15 13
17 13
16 15
27 18
20 21
22 20
21 23
24 22
22 26
22 27
25 23
27 24
28 32
34 28
34 29
29 36
30 31
30 33
31 32
31 36
35 32
36 32
36 34
38 37
51 43
46 44
49 44
45 50
46 47
47 49
50 47
51 48
49 51
52 53
58 56
59 61
61 62
65 66
66 67...

output:

-1

result:

ok 1 number(s): "-1"

Test #20:

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

input:

299993 179255
2 7
3 5
10 12
15 14
17 14
32 28
28 34
30 31
33 30
40 37
43 39
44 45
44 47
45 47
52 53
59 54
60 61
64 62
65 64
67 66
66 71
71 67
74 67
68 69
72 69
73 69
75 71
75 72
74 73
76 80
83 76
80 77
81 78
78 83
86 88
89 86
86 91
92 99
96 97
100 97
100 98
109 102
104 103
109 106
109 108
112 110
11...

output:

-1

result:

ok 1 number(s): "-1"

Test #21:

score: 0
Accepted
time: 18ms
memory: 31952kb

input:

299991 68464
8 1
9 1
7 3
9 3
4 7
4 8
9 4
5 9
7 6
18 15
25 30
31 25
32 25
30 27
33 27
30 28
33 28
38 35
37 36
38 36
40 46
42 45
46 42
43 47
43 48
44 48
50 52
55 51
65 59
60 64
61 68
70 71
70 74
82 81
87 88
89 91
93 96
94 96
100 97
98 99
103 106
108 103
115 111
112 115
127 129
127 130
145 143
146 144
...

output:

42205

result:

ok 1 number(s): "42205"

Test #22:

score: 0
Accepted
time: 19ms
memory: 31464kb

input:

299992 68142
9 5
6 11
12 14
19 24
24 20
25 20
26 22
27 32
33 34
42 45
46 42
42 48
55 59
61 64
75 81
75 84
76 80
76 84
77 81
81 78
78 83
80 79
79 81
79 82
96 91
96 92
104 97
103 104
111 110
112 110
114 118
120 119
124 119
127 133
129 132
137 146
146 139
140 146
155 153
159 157
163 167
164 165
172 174...

output:

42031

result:

ok 1 number(s): "42031"

Test #23:

score: 0
Accepted
time: 19ms
memory: 32216kb

input:

299992 68205
12 14
18 21
19 22
26 28
32 26
26 33
44 47
52 49
52 50
51 52
62 55
62 56
69 73
76 69
75 72
77 81
78 84
87 91
92 87
106 102
118 117
117 120
121 117
126 124
128 134
131 135
154 150
154 151
155 151
151 157
151 159
157 152
159 152
153 156
166 160
160 167
162 161
168 176
169 172
174 169
171 1...

output:

42016

result:

ok 1 number(s): "42016"

Test #24:

score: 0
Accepted
time: 16ms
memory: 31540kb

input:

299998 68406
15 10
12 16
16 13
13 19
21 26
30 22
26 23
30 23
24 29
36 35
46 43
57 53
55 57
70 76
86 94
87 92
87 94
89 93
94 90
117 115
117 116
124 127
134 131
136 131
132 136
153 151
155 157
156 159
164 160
161 165
168 175
173 175
176 174
184 181
185 181
182 184
183 184
187 190
189 188
188 190
204 1...

output:

42237

result:

ok 1 number(s): "42237"

Test #25:

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

input:

299994 67984
8 3
7 8
10 9
11 15
12 14
23 21
34 27
28 35
35 31
53 46
51 52
53 51
70 63
70 64
69 65
71 66
73 74
83 80
84 86
89 94
89 96
102 97
107 110
116 122
121 117
117 122
123 118
119 122
123 119
119 124
136 137
138 136
153 151
154 151
160 162
165 168
166 169
180 186
183 185
195 189
201 196
200 201...

output:

42057

result:

ok 1 number(s): "42057"

Test #26:

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

input:

222627 299956
3 1
1 5
9 1
2 3
4 2
7 2
8 2
9 2
2 10
4 3
3 6
8 3
3 9
10 3
4 5
7 4
4 9
5 6
5 10
7 10
10 8
10 9
11 12
14 11
11 16
11 17
13 12
17 12
15 16
18 19
20 18
21 18
25 18
20 19
21 19
25 19
26 19
20 21
22 21
21 23
21 25
23 22
22 24
22 25
24 23
32 30
33 30
30 35
32 31
33 31
36 37
38 36
40 39
39 42
...

output:

-1

result:

ok 1 number(s): "-1"

Test #27:

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

input:

221790 299948
1 3
1 4
6 1
1 8
2 4
2 8
8 3
4 5
5 7
8 5
7 8
14 11
13 12
15 19
21 15
15 22
16 17
16 21
18 19
21 18
19 20
19 21
19 23
20 23
22 23
24 25
24 27
24 28
24 29
24 31
32 24
27 25
25 29
27 26
26 28
31 26
29 27
27 32
29 28
31 28
32 28
29 30
31 30
32 31
36 37
36 39
36 43
38 37
37 41
42 37
37 43
37...

output:

-1

result:

ok 1 number(s): "-1"

Test #28:

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

input:

222263 299954
1 2
1 3
5 1
1 7
8 2
3 4
5 3
7 3
4 5
4 10
5 8
6 7
7 8
7 9
8 9
8 10
12 11
16 17
18 16
23 19
19 26
21 24
25 21
25 22
22 26
27 22
23 24
25 24
24 26
27 25
28 34
30 29
29 31
35 29
30 32
33 30
30 35
31 32
34 31
31 35
33 32
34 33
37 36
38 36
41 42
46 45
49 45
50 45
46 50
47 49
49 48
51 52
51 5...

output:

-1

result:

ok 1 number(s): "-1"

Test #29:

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

input:

221568 299960
2 3
7 2
6 3
4 6
7 4
11 8
13 8
9 10
11 9
12 9
13 9
10 11
11 12
12 13
14 16
14 17
18 14
14 20
15 18
15 20
17 16
16 18
17 20
19 18
20 18
23 22
22 25
22 27
23 24
23 27
24 25
24 26
24 27
29 28
30 28
31 28
32 28
34 28
28 36
31 29
32 29
33 29
29 34
29 35
36 29
30 31
34 30
36 30
31 32
31 33
35...

output:

-1

result:

ok 1 number(s): "-1"

Test #30:

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

input:

221748 299946
2 1
4 5
6 4
4 8
6 5
8 6
11 10
12 13
15 17
19 21
20 22
28 23
32 23
25 24
27 24
25 26
25 28
25 29
25 30
32 25
26 27
26 29
27 28
27 29
27 31
28 30
28 31
30 29
32 29
34 33
33 36
38 33
33 40
34 36
34 39
40 34
35 37
35 39
35 40
36 38
39 38
40 39
43 41
46 41
42 43
45 42
46 42
42 47
43 45
46 4...

output:

-1

result:

ok 1 number(s): "-1"

Test #31:

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

input:

299996 153719
1 3
1 4
1 5
1 6
2 3
5 2
2 7
2 8
2 10
11 16
11 17
11 20
16 12
12 18
20 12
16 13
13 17
17 14
14 18
14 19
15 16
19 15
21 23
39 35
35 40
36 37
36 38
39 36
55 50
54 51
51 55
57 51
52 54
52 56
53 55
56 53
53 57
58 66
64 66
66 65
75 68
75 70
72 75
74 75
85 79
87 79
80 84
80 86
87 80
81 85
81 ...

output:

63112

result:

ok 1 number(s): "63112"

Test #32:

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

input:

299993 153285
3 1
1 4
1 6
9 1
1 10
4 2
5 2
6 2
8 2
2 9
14 18
15 18
16 18
19 23
29 32
29 33
29 34
35 42
39 36
40 36
36 42
37 41
37 42
42 38
58 62
59 67
60 64
67 60
61 62
64 61
66 61
67 61
77 74
74 78
77 75
75 78
77 76
78 76
79 81
79 86
99 103
99 104
99 105
100 105
101 105
103 102
102 104
109 111
111 ...

output:

62860

result:

ok 1 number(s): "62860"

Test #33:

score: 0
Accepted
time: 35ms
memory: 34664kb

input:

299997 153320
3 1
1 4
6 1
10 7
7 11
7 14
7 16
8 12
13 8
14 8
8 15
16 8
10 9
11 9
9 12
13 9
15 9
18 17
17 19
20 25
27 20
28 20
29 20
21 28
21 29
22 25
22 26
22 29
26 23
27 23
23 28
23 29
30 31
30 32
30 33
34 38
35 37
43 41
46 41
47 51
48 49
50 48
48 51
61 67
61 70
62 67
62 69
64 69
65 67
70 65
66 70
...

output:

62955

result:

ok 1 number(s): "62955"

Test #34:

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

input:

299996 154604
5 1
7 1
9 2
3 5
8 3
3 9
10 3
5 4
4 6
8 4
4 10
20 11
17 12
12 19
12 20
13 20
14 19
15 20
18 16
22 23
25 24
24 26
29 33
29 34
35 29
37 29
43 45
46 53
47 53
53 48
49 53
57 54
54 58
57 55
57 56
59 64
65 59
66 59
67 59
60 64
66 60
68 60
61 66
61 67
62 64
65 62
62 66
68 62
63 64
65 63
66 63
...

output:

63322

result:

ok 1 number(s): "63322"

Test #35:

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

input:

299991 153557
6 11
6 13
7 11
7 12
7 13
12 8
10 13
15 16
17 20
20 18
20 19
19 21
22 26
22 27
28 22
26 23
28 23
26 24
24 29
34 36
34 37
34 38
41 34
34 42
35 36
38 35
35 40
35 43
44 47
54 51
51 55
51 56
52 54
52 56
52 58
53 54
55 53
56 53
53 57
68 75
68 76
69 70
72 69
80 77
78 81
83 78
78 85
95 90
91 9...

output:

63127

result:

ok 1 number(s): "63127"

Test #36:

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

input:

132622 299977
3 2
4 2
2 5
2 7
3 4
3 5
6 3
3 7
8 3
4 5
6 4
4 7
8 4
5 8
7 6
6 8
8 7
10 9
11 9
13 12
12 14
12 16
19 12
12 20
21 12
13 16
13 17
19 13
17 14
18 14
14 19
21 14
16 15
17 15
15 18
15 20
17 16
18 16
16 19
16 20
16 21
18 17
17 19
21 17
18 19
18 20
21 18
20 19
19 21
21 20
22 23
22 24
24 23
25 2...

output:

-1

result:

ok 1 number(s): "-1"

Test #37:

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

input:

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

output:

-1

result:

ok 1 number(s): "-1"

Test #38:

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

input:

134084 299956
2 4
3 4
3 5
4 5
6 7
6 8
6 9
6 10
6 11
12 6
7 8
7 9
10 7
11 7
7 12
9 8
10 8
8 11
12 8
9 10
11 9
9 12
11 10
10 12
11 12
14 13
15 13
17 16
16 18
16 19
20 16
21 16
22 16
16 23
19 17
17 20
17 21
17 22
17 23
18 19
18 20
18 21
22 18
23 18
20 19
19 22
19 23
20 21
20 22
20 23
22 21
23 22
25 24
...

output:

-1

result:

ok 1 number(s): "-1"

Test #39:

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

input:

133148 299946
1 3
4 1
5 1
6 1
1 7
1 8
1 9
10 1
2 5
7 2
8 2
9 2
2 10
4 3
3 6
3 7
3 10
4 5
7 4
4 8
4 9
10 4
5 7
5 8
9 5
10 5
6 8
6 9
6 10
8 7
7 9
10 7
8 9
10 8
9 10
11 12
13 11
12 13
16 17
21 16
16 22
16 24
25 16
17 22
23 17
17 24
17 25
20 18
21 18
23 18
24 18
18 25
19 20
21 19
19 24
19 25
20 22
24 20...

output:

-1

result:

ok 1 number(s): "-1"

Test #40:

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

input:

133402 299966
2 1
3 1
5 1
2 3
2 5
4 3
5 3
5 4
8 7
9 10
11 9
12 9
13 9
14 9
15 9
11 10
10 12
13 10
10 14
10 15
12 11
13 11
14 11
15 11
12 13
14 12
15 12
13 14
15 14
16 17
16 19
20 16
17 18
17 19
18 20
19 20
21 22
23 21
25 21
26 21
21 27
28 21
29 21
24 22
25 22
22 26
22 27
28 22
22 29
24 23
23 25
23 2...

output:

-1

result:

ok 1 number(s): "-1"

Test #41:

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

input:

299991 257344
7 1
1 8
1 9
1 10
3 6
7 3
8 3
3 9
8 4
9 4
10 4
8 5
9 5
17 24
24 18
24 20
22 24
24 23
25 28
25 29
30 25
31 25
32 25
27 26
26 28
26 29
26 31
26 32
33 26
43 50
50 46
50 47
48 50
50 49
59 51
60 51
59 52
60 52
54 60
59 55
55 60
56 59
56 60
61 67
68 61
62 67
68 62
63 67
68 63
67 64
68 64
67 6...

output:

71300

result:

ok 1 number(s): "71300"

Test #42:

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

input:

299997 256129
8 5
9 5
10 5
11 5
5 12
13 5
6 8
6 10
12 6
6 13
8 7
7 9
10 7
11 7
7 13
14 16
16 15
22 23
24 22
22 25
26 22
22 28
29 32
29 33
34 29
35 29
29 36
37 29
29 38
30 32
30 34
30 35
30 36
30 38
31 32
31 33
31 35
36 31
37 31
38 31
39 42
39 43
44 39
45 39
39 46
41 40
42 40
40 43
40 44
40 45
40 46
...

output:

70973

result:

ok 1 number(s): "70973"

Test #43:

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

input:

299993 255688
9 5
10 5
8 6
10 6
7 9
12 14
14 13
20 16
16 21
20 17
17 22
17 23
18 19
21 18
22 18
23 18
24 18
34 25
26 34
34 28
29 34
30 34
31 34
32 34
33 34
38 36
38 37
39 41
44 39
39 45
39 46
39 47
40 42
43 40
44 40
46 40
47 40
52 50
50 53
50 54
55 50
56 61
56 62
63 56
64 56
57 61
62 57
63 57
57 64
...

output:

70975

result:

ok 1 number(s): "70975"

Test #44:

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

input:

299994 255432
5 1
6 1
5 2
6 2
3 5
3 6
5 4
4 6
8 7
10 9
9 12
14 15
16 21
16 22
23 16
21 17
22 17
18 22
23 18
21 19
19 22
19 23
20 21
22 20
20 23
24 28
29 24
27 25
25 28
29 25
27 26
28 26
29 26
37 30
30 38
37 31
31 38
32 37
33 37
33 38
34 38
35 37
37 36
38 36
49 50
49 51
52 49
49 53
54 49
55 49
56 49
...

output:

70872

result:

ok 1 number(s): "70872"

Test #45:

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

input:

299991 256111
3 1
4 1
4 2
6 7
6 8
25 18
20 24
20 25
21 24
22 24
25 22
23 25
30 26
32 26
26 33
33 27
30 28
28 34
32 29
33 29
34 29
37 36
38 36
36 40
41 36
42 36
36 43
36 44
45 46
45 47
45 48
49 51
52 49
50 51
50 52
55 53
56 53
57 53
59 58
62 61
70 65
71 65
72 65
66 70
71 66
72 66
71 67
72 67
70 68
68...

output:

70857

result:

ok 1 number(s): "70857"

Test #46:

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

input:

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

output:

-1

result:

ok 1 number(s): "-1"

Test #47:

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

input:

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

output:

-1

result:

ok 1 number(s): "-1"

Test #48:

score: 0
Accepted
time: 35ms
memory: 32848kb

input:

104983 299964
2 1
3 1
3 2
5 4
6 4
4 7
6 5
5 7
6 7
9 8
10 8
11 8
12 8
13 8
14 8
10 9
9 11
9 12
9 13
14 9
10 11
10 12
10 13
10 14
12 11
14 11
12 13
14 12
13 14
15 16
15 17
16 17
21 20
20 22
23 20
24 20
20 25
20 26
27 20
20 28
29 20
22 21
21 23
24 21
25 21
21 26
27 21
21 28
29 21
23 22
22 24
22 25
26 2...

output:

-1

result:

ok 1 number(s): "-1"

Test #49:

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

input:

104853 299955
2 3
4 2
5 2
2 6
7 2
3 4
5 3
7 3
4 5
6 4
7 4
6 5
7 5
7 6
8 9
8 10
8 11
12 8
9 10
9 11
12 9
10 11
10 12
12 11
13 14
16 13
13 17
14 15
16 14
14 17
15 16
17 16
19 18
20 21
20 22
20 23
24 20
20 25
23 21
21 24
21 25
22 23
22 24
22 25
23 24
23 25
24 25
26 27
28 26
26 29
30 26
26 31
28 27
27 2...

output:

-1

result:

ok 1 number(s): "-1"

Test #50:

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

input:

105457 299948
3 1
1 4
5 1
3 2
4 2
2 5
3 4
3 5
7 6
8 6
7 8
10 11
12 13
12 14
15 12
16 12
12 17
13 14
13 15
13 16
13 17
14 15
14 16
14 17
16 15
17 15
17 16
19 18
18 20
21 18
19 20
19 21
20 21
24 23
23 25
23 26
23 27
28 23
29 23
23 30
23 31
25 24
26 24
24 27
28 24
24 29
24 31
25 26
27 25
28 25
29 25
25...

output:

-1

result:

ok 1 number(s): "-1"

Test #51:

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

input:

276362 299955
3 1
1 4
1 5
6 1
3 2
2 4
5 2
2 6
16 8
16 9
16 10
11 16
16 12
16 13
14 16
16 15
21 17
21 18
19 21
24 22
26 22
27 22
24 23
23 25
23 26
23 27
28 30
31 28
29 30
31 29
32 34
35 32
36 32
37 32
38 32
33 34
35 33
36 33
37 33
38 33
39 42
43 39
39 44
39 45
40 42
40 43
40 44
40 45
41 42
43 41
44 4...

output:

66782

result:

ok 1 number(s): "66782"

Test #52:

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

input:

278142 299950
17 15
18 15
19 15
20 15
15 21
17 16
18 16
16 19
20 16
16 21
35 36
35 37
38 35
35 39
40 35
41 35
35 42
51 47
47 52
47 53
47 54
55 47
47 56
51 48
52 48
48 53
54 48
55 48
56 48
49 51
52 49
49 53
49 54
49 55
56 49
51 50
50 52
53 50
54 50
55 50
56 50
59 57
57 60
57 61
58 59
58 60
58 61
64 6...

output:

66866

result:

ok 1 number(s): "66866"

Test #53:

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

input:

278506 299956
3 1
1 4
2 3
2 4
5 11
13 5
11 6
6 12
13 6
7 11
7 12
7 13
11 8
12 8
8 13
9 11
13 9
11 10
12 10
10 13
14 16
14 18
16 15
17 15
15 18
19 20
22 26
27 22
22 28
23 26
27 23
28 23
24 26
24 27
28 24
25 26
25 27
28 25
36 34
34 37
34 38
39 34
40 34
35 36
35 37
35 38
39 35
40 35
44 43
58 62
58 63
5...

output:

67144

result:

ok 1 number(s): "67144"

Test #54:

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

input:

279605 299959
5 1
5 2
3 5
5 4
9 6
7 9
8 9
10 14
15 10
14 11
11 15
16 11
14 12
15 12
16 12
14 13
13 15
13 16
22 19
23 19
24 19
20 21
22 20
23 20
20 24
25 26
25 27
28 32
29 32
32 30
32 31
33 35
34 35
36 43
44 36
37 43
37 44
38 43
43 39
44 39
40 43
44 40
41 44
42 44
47 48
49 47
50 47
47 51
52 47
53 47
...

output:

67227

result:

ok 1 number(s): "67227"

Test #55:

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

input:

278911 299953
10 9
9 11
12 9
13 9
24 26
27 24
25 26
25 27
28 29
30 28
28 31
32 28
33 28
28 34
28 35
28 36
37 28
44 51
44 52
45 51
45 52
46 51
52 46
51 47
47 52
51 48
52 48
49 51
49 52
50 52
53 54
61 56
62 56
56 63
56 64
56 65
57 61
57 62
57 63
64 57
57 65
58 61
62 58
63 58
64 58
58 65
59 61
59 62
63...

output:

66901

result:

ok 1 number(s): "66901"

Test #56:

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

input:

1562 18939
1 83
90 1
99 1
109 1
153 1
1 163
1 166
1 181
1 183
1 207
1 211
1 217
1 383
1 426
1 431
1 446
505 1
3 2
5 2
2 16
2 66
67 2
2 125
2 145
2 155
2 160
195 2
270 2
377 2
2 383
393 2
419 2
462 2
2 465
2 484
495 2
3 31
42 3
3 74
91 3
114 3
135 3
177 3
3 204
3 214
257 3
334 3
3 364
3 373
376 3
433...

output:

-1

result:

ok 1 number(s): "-1"

Test #57:

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

input:

1503 24247
1 8
1 24
1 25
1 27
36 1
1 42
51 1
59 1
62 1
67 1
1 73
100 1
1 102
108 1
1 115
139 1
140 1
150 1
1 180
1 182
188 1
1 254
1 289
1 292
297 1
298 1
305 1
312 1
1 316
343 1
1 393
1 399
1 419
484 1
490 1
491 1
493 1
501 1
1 508
1 519
536 1
540 1
562 1
8 2
2 12
18 2
48 2
2 68
77 2
83 2
103 2
2 1...

output:

-1

result:

ok 1 number(s): "-1"

Test #58:

score: 0
Accepted
time: 4ms
memory: 29096kb

input:

2802 19897
100 1
105 3
3 107
4 104
5 99
6 104
6 118
8 116
10 98
10 120
99 11
107 12
14 114
14 122
115 15
16 113
18 118
21 107
111 22
25 103
112 26
27 101
103 28
30 106
108 32
98 33
121 33
103 35
116 36
109 37
121 37
101 38
107 39
113 41
41 116
100 43
43 102
122 43
44 101
101 45
101 46
121 46
47 105
...

output:

970

result:

ok 1 number(s): "970"

Test #59:

score: 0
Accepted
time: 4ms
memory: 27584kb

input:

6055 19260
390 3
3 401
390 5
394 7
397 8
398 9
12 392
392 15
16 396
394 17
397 17
18 402
392 20
388 21
21 400
22 398
25 392
400 26
397 28
28 399
397 31
32 389
394 33
33 396
394 35
36 390
37 392
37 393
401 40
401 45
394 46
46 398
46 399
392 49
397 50
396 52
400 53
389 58
401 61
64 398
402 64
389 65
6...

output:

1474

result:

ok 1 number(s): "1474"

Test #60:

score: 0
Accepted
time: 3ms
memory: 29168kb

input:

996 70612
1 15
20 1
1 26
1 32
1 45
54 1
1 56
59 1
66 1
79 1
80 1
1 86
1 105
1 109
1 112
113 1
119 1
120 1
1 126
1 137
4 2
9 2
2 13
2 17
2 21
38 2
2 48
50 2
57 2
67 2
2 68
97 2
101 2
115 2
2 118
129 2
2 132
136 2
140 2
3 7
12 3
26 3
45 3
73 3
3 78
3 85
3 100
101 3
103 3
3 113
3 117
125 3
132 3
13 4
2...

output:

-1

result:

ok 1 number(s): "-1"

Test #61:

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

input:

1063 22156
1 2
5 1
11 1
1 17
22 1
23 1
26 1
27 1
40 1
1 49
1 60
76 1
82 1
1 84
88 1
90 1
99 1
102 1
1 103
1 105
1 106
123 1
1 138
145 1
150 1
1 156
170 1
1 176
1 178
197 1
1 205
210 1
215 1
223 1
229 1
236 1
237 1
241 1
2 7
23 2
27 2
2 46
2 68
71 2
2 83
2 88
96 2
2 97
2 112
115 2
118 2
2 128
2 129
1...

output:

-1

result:

ok 1 number(s): "-1"

Test #62:

score: 0
Accepted
time: 4ms
memory: 28448kb

input:

1262 24201
79 1
82 1
83 1
86 1
93 1
103 1
106 1
1 111
1 113
1 114
115 1
1 120
1 121
1 122
124 1
127 1
134 1
137 1
138 1
140 1
1 144
148 1
156 1
1 157
162 1
163 1
1 173
1 177
1 181
182 1
1 191
1 194
196 1
199 1
1 200
204 1
1 205
1 206
210 1
1 212
214 1
1 215
218 1
1 219
1 221
225 1
227 1
228 1
235 1
...

output:

246

result:

ok 1 number(s): "246"

Test #63:

score: 0
Accepted
time: 3ms
memory: 28432kb

input:

839 23370
1 308
312 1
314 1
317 1
320 1
1 321
322 1
1 323
324 1
325 1
330 1
336 1
1 337
338 1
340 1
1 344
1 346
347 1
1 350
353 1
1 354
1 355
356 1
1 361
363 1
373 1
377 1
1 378
1 386
1 387
401 1
403 1
406 1
1 408
413 1
417 1
1 419
420 1
1 424
426 1
1 428
1 429
1 431
1 435
436 1
1 437
445 1
1 447
44...

output:

299

result:

ok 1 number(s): "299"

Test #64:

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

input:

639 46597
1 3
1 6
10 1
12 1
18 1
1 20
21 1
1 23
25 1
30 1
34 1
1 36
1 40
1 41
44 1
1 45
1 46
1 50
1 54
57 1
60 1
71 1
73 1
74 1
1 75
77 1
1 78
80 1
1 81
1 89
95 1
96 1
1 97
1 100
1 105
1 108
109 1
1 113
1 117
118 1
120 1
122 1
123 1
1 131
1 133
1 137
1 140
1 142
1 145
1 153
154 1
1 155
157 1
158 1
1...

output:

-1

result:

ok 1 number(s): "-1"

Test #65:

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

input:

402 42790
1 2
5 1
1 6
8 1
9 1
1 13
1 14
1 16
1 17
18 1
20 1
1 21
22 1
1 23
1 24
1 28
1 31
1 32
35 1
1 36
39 1
1 41
1 42
1 45
46 1
1 51
52 1
53 1
54 1
57 1
1 59
62 1
1 65
66 1
68 1
70 1
71 1
1 72
1 73
1 75
1 79
80 1
82 1
83 1
84 1
1 85
1 86
1 87
88 1
1 90
1 92
1 93
94 1
98 1
99 1
1 100
1 101
1 102
1 ...

output:

-1

result:

ok 1 number(s): "-1"

Test #66:

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

input:

428 21674
1 265
1 269
1 271
272 1
274 1
1 276
1 277
278 1
1 279
280 1
281 1
282 1
1 284
1 285
1 286
1 287
1 288
290 1
293 1
294 1
1 295
1 296
1 297
299 1
1 302
304 1
306 1
308 1
1 314
315 1
1 318
321 1
1 322
323 1
1 324
1 325
327 1
328 1
1 329
335 1
339 1
1 340
342 1
345 1
347 1
348 1
349 1
1 351
35...

output:

164

result:

ok 1 number(s): "164"

Test #67:

score: 0
Accepted
time: 4ms
memory: 29360kb

input:

873 23096
530 1
537 1
1 538
539 1
1 545
547 1
1 555
558 1
559 1
1 569
1 570
1 571
573 1
1 574
1 575
576 1
1 577
1 593
1 594
595 1
598 1
599 1
601 1
1 603
1 604
1 606
1 608
1 612
614 1
530 2
2 531
2 532
2 534
2 538
2 540
542 2
2 544
2 548
2 549
551 2
553 2
2 557
2 558
562 2
2 565
568 2
570 2
574 2
2 ...

output:

163

result:

ok 1 number(s): "163"

Test #68:

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

input:

451 76030
1 4
5 1
1 6
1 7
8 1
9 1
10 1
11 1
1 12
13 1
1 14
15 1
1 16
18 1
1 19
1 20
21 1
1 22
23 1
25 1
26 1
27 1
28 1
1 29
1 30
1 31
1 32
1 34
1 35
1 37
38 1
39 1
1 40
41 1
42 1
1 43
44 1
1 45
48 1
49 1
1 50
1 51
1 52
53 1
54 1
1 55
56 1
1 57
59 1
60 1
1 61
1 62
1 63
65 1
66 1
1 68
1 69
1 70
1 72
7...

output:

-1

result:

ok 1 number(s): "-1"

Test #69:

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

input:

677 136507
2 1
1 5
7 1
1 8
10 1
1 11
1 12
14 1
1 15
1 16
19 1
1 20
21 1
1 22
1 23
24 1
1 25
1 26
27 1
1 28
1 29
30 1
1 31
1 32
1 33
34 1
35 1
1 36
38 1
39 1
40 1
1 42
1 43
1 44
45 1
1 46
47 1
48 1
1 49
1 50
1 51
1 52
53 1
54 1
55 1
1 56
1 57
1 58
59 1
1 62
63 1
64 1
1 65
66 1
1 67
1 68
1 69
1 70
1 7...

output:

-1

result:

ok 1 number(s): "-1"

Test #70:

score: 0
Accepted
time: 4ms
memory: 29276kb

input:

443 30865
325 1
1 326
1 327
328 1
1 329
330 1
331 1
332 1
1 333
1 334
335 1
336 1
337 1
1 338
339 1
340 1
1 342
1 343
344 1
345 1
1 346
347 1
348 1
349 1
1 350
1 351
352 1
354 1
1 355
356 1
1 358
1 359
360 1
1 362
1 363
1 364
365 1
1 367
368 1
369 1
370 1
1 371
372 1
1 373
376 1
377 1
379 1
380 1
1 ...

output:

119

result:

ok 1 number(s): "119"

Test #71:

score: 0
Accepted
time: 4ms
memory: 29360kb

input:

654 54549
1 480
1 481
1 482
483 1
484 1
485 1
1 486
1 487
494 1
1 495
496 1
1 498
499 1
1 500
501 1
503 1
505 1
506 1
507 1
508 1
509 1
510 1
511 1
1 512
513 1
515 1
516 1
517 1
518 1
519 1
520 1
1 521
1 523
1 524
525 1
526 1
531 1
532 1
1 537
1 539
540 1
541 1
1 542
543 1
544 1
545 1
546 1
547 1
1 ...

output:

175

result:

ok 1 number(s): "175"

Test #72:

score: 0
Accepted
time: 3ms
memory: 27900kb

input:

501 75714
1 3
1 4
1 5
1 6
7 1
1 8
1 9
10 1
1 11
1 12
13 1
14 1
1 15
16 1
1 17
1 18
19 1
20 1
21 1
22 1
23 1
24 1
25 1
26 1
1 27
28 1
1 29
1 30
1 31
32 1
33 1
1 34
35 1
1 36
37 1
38 1
1 39
1 40
1 41
42 1
44 1
1 45
46 1
1 47
48 1
49 1
1 50
51 1
52 1
1 53
1 54
55 1
56 1
1 57
1 58
1 59
1 60
1 61
62 1
63...

output:

-1

result:

ok 1 number(s): "-1"

Test #73:

score: 0
Accepted
time: 17ms
memory: 29248kb

input:

513 122120
1 2
3 1
4 1
5 1
7 1
8 1
9 1
10 1
1 11
1 12
1 13
14 1
15 1
16 1
17 1
1 18
1 19
20 1
21 1
1 22
23 1
24 1
25 1
26 1
27 1
1 28
1 29
1 30
1 31
32 1
33 1
1 34
35 1
1 36
37 1
39 1
40 1
41 1
42 1
1 43
44 1
45 1
1 46
47 1
48 1
49 1
50 1
1 51
52 1
1 53
1 54
1 56
57 1
1 59
60 1
1 61
62 1
1 63
64 1
1...

output:

-1

result:

ok 1 number(s): "-1"

Test #74:

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

input:

596 57698
473 1
1 474
1 475
476 1
1 477
478 1
1 479
480 1
481 1
482 1
1 483
1 484
485 1
1 486
487 1
488 1
489 1
490 1
1 491
492 1
493 1
1 494
495 1
1 496
497 1
498 1
499 1
500 1
1 501
1 502
503 1
504 1
505 1
1 506
1 507
1 508
509 1
1 510
511 1
1 512
1 513
514 1
1 515
516 1
517 1
1 518
1 519
1 520
1 ...

output:

125

result:

ok 1 number(s): "125"

Test #75:

score: 0
Accepted
time: 3ms
memory: 27808kb

input:

447 32518
95 1
96 1
97 1
98 1
99 1
100 1
101 1
102 1
1 104
1 105
1 106
1 107
108 1
1 109
1 110
111 1
112 1
113 1
1 114
115 1
116 1
1 117
118 1
1 119
120 1
1 121
122 1
123 1
1 124
125 1
1 126
127 1
128 1
1 129
130 1
1 131
1 133
1 134
1 135
1 136
1 137
1 138
1 139
140 1
141 1
142 1
143 1
144 1
1 145
1...

output:

94

result:

ok 1 number(s): "94"

Test #76:

score: 0
Accepted
time: 3ms
memory: 28940kb

input:

3 1
1 2

output:

1

result:

ok 1 number(s): "1"

Test #77:

score: 0
Accepted
time: 3ms
memory: 28200kb

input:

3 1
2 3

output:

1

result:

ok 1 number(s): "1"

Test #78:

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

input:

3 2
1 2
2 3

output:

1

result:

ok 1 number(s): "1"

Test #79:

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

input:

3 1
1 3

output:

1

result:

ok 1 number(s): "1"

Test #80:

score: 0
Accepted
time: 3ms
memory: 28664kb

input:

3 2
1 2
1 3

output:

1

result:

ok 1 number(s): "1"

Test #81:

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

input:

3 2
2 3
1 3

output:

1

result:

ok 1 number(s): "1"

Test #82:

score: 0
Accepted
time: 4ms
memory: 29140kb

input:

3 3
1 2
2 3
1 3

output:

-1

result:

ok 1 number(s): "-1"

Test #83:

score: 0
Accepted
time: 85ms
memory: 37096kb

input:

300000 300000
122129 13026
205810 102249
179037 16259
126838 259309
246101 33465
240741 107179
16020 299625
257536 81128
202836 206491
25538 176854
80588 195300
46917 171646
264703 266561
80053 35955
45640 248244
186452 10245
109473 165538
17112 125524
27445 97631
332 67265
137263 98858
133000 19277...

output:

-1

result:

ok 1 number(s): "-1"

Test #84:

score: 0
Accepted
time: 90ms
memory: 38664kb

input:

300000 300000
95492 27773
228959 34368
280258 60427
289262 131857
266617 296906
70311 63208
292687 123323
105159 260729
284769 99065
270790 128653
198809 257978
219884 128136
218870 42341
3648 128106
46411 183015
21080 154236
140562 57172
39512 99617
182849 57050
285422 266153
273441 94304
9491 1088...

output:

-1

result:

ok 1 number(s): "-1"

Test #85:

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

input:

300000 300000
136676 35172
17139 157174
239033 72357
212576 36426
242129 269063
45958 97763
189075 106369
16858 140653
83454 136313
267028 80266
189334 291020
213417 274538
279147 94216
295065 60331
180210 211486
86768 24555
279267 38797
52868 191923
192419 65940
88205 140807
127294 35071
185093 256...

output:

-1

result:

ok 1 number(s): "-1"

Test #86:

score: 0
Accepted
time: 63ms
memory: 33440kb

input:

100000 300000
37795 50145
36752 50950
60323 38314
54375 11700
35886 79420
34526 30385
58689 26374
89409 49571
48089 76156
30069 39021
63523 62424
94306 64145
42448 47711
94017 20366
74548 75705
34794 21891
93969 10638
26467 47604
5220 48701
75340 52085
71982 7916
52318 89784
14127 88148
7463 44009
8...

output:

-1

result:

ok 1 number(s): "-1"

Test #87:

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

input:

100000 300000
77079 70337
57415 51475
25679 14730
10033 71707
32332 27340
47490 98874
98625 45283
21470 95477
53547 26636
96146 48192
55980 6204
82752 38677
92896 92550
57534 10159
24360 36862
28734 17696
65321 14066
74202 23516
99118 33814
66552 62533
27343 742
85385 50497
36958 41627
73785 55558
4...

output:

-1

result:

ok 1 number(s): "-1"

Test #88:

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

input:

100000 300000
16549 19146
60753 34040
92658 14849
7130 37222
21691 82849
13639 92797
51848 30448
35906 37624
84403 42721
34432 95278
1369 70087
68650 65653
898 31704
56335 2806
68676 13585
85223 14364
1002 19498
81720 63283
14189 62549
49125 98709
87680 3003
36464 79625
4274 64580
29128 29734
81020 ...

output:

-1

result:

ok 1 number(s): "-1"

Test #89:

score: 0
Accepted
time: 58ms
memory: 34888kb

input:

100000 300000
16630 7043
65314 21002
29697 59037
37898 96521
16555 92355
60134 38598
92762 50842
68144 61999
84968 6969
70179 34548
18477 44372
59930 2624
83201 81284
35771 58068
24822 61032
10984 53367
89188 84694
45281 84263
16288 72478
93040 48538
88509 39589
72907 14574
66561 56521
9781 89590
97...

output:

-1

result:

ok 1 number(s): "-1"

Test #90:

score: 0
Accepted
time: 64ms
memory: 34936kb

input:

100000 300000
60450 44814
39943 71128
99747 86387
78245 10392
27427 30135
54243 62195
55219 48427
3251 48061
22986 66489
70061 96389
76944 89176
30572 74360
77976 3697
24325 58979
16521 71006
59769 54915
30558 5281
57707 94052
32703 2421
79504 96859
71684 38276
34572 14916
79678 12028
53601 27932
16...

output:

-1

result:

ok 1 number(s): "-1"

Test #91:

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

input:

300000 300000
239334 178593
74523 258543
174873 57387
299290 538
30656 239876
13086 77182
234413 233486
182661 57857
290758 141851
85023 219888
282162 43401
103917 88356
188631 54235
109625 282042
224351 42311
165205 167327
134158 216684
94282 20962
116469 52917
104941 223769
164877 185295
206949 83...

output:

127761

result:

ok 1 number(s): "127761"

Test #92:

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

input:

300000 300000
205686 108322
68375 77990
149332 278142
266617 101423
28125 177445
149585 234432
208211 102093
274977 295249
223958 76665
2818 195135
258150 179132
33934 163715
47301 97939
153058 285886
162785 241766
124355 179761
77145 16534
261018 42246
265779 18159
21377 134850
16329 20947
272756 2...

output:

126788

result:

ok 1 number(s): "126788"

Test #93:

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

input:

300000 300000
225040 174742
213218 172584
181273 150194
87687 208838
39695 13575
187847 196124
13535 188393
296187 207047
185971 130863
232055 75399
60317 221937
175110 114465
136377 215361
128707 80506
136563 5090
77644 67196
196101 185298
91025 30460
16863 176356
169640 213761
110887 68777
22180 1...

output:

126434

result:

ok 1 number(s): "126434"

Test #94:

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

input:

100000 300000
62729 40334
789 70007
94172 54678
16460 89583
12823 64269
45126 83711
43687 35147
22425 13338
37720 32493
93558 27925
43547 63227
11811 6643
21858 6292
83288 15139
89319 46100
54227 78836
5267 98095
56322 22759
47287 28263
97302 33575
68004 96006
60741 82670
41523 92898
60190 8362
8424...

output:

45975

result:

ok 1 number(s): "45975"

Test #95:

score: 0
Accepted
time: 66ms
memory: 38012kb

input:

100000 300000
29042 62932
61719 1171
56338 628
49534 54308
72699 31002
87691 63237
8645 24210
79027 41006
66273 22549
63294 14227
4134 60319
32135 22761
92424 40778
7662 93083
72699 67326
59114 12102
68090 63624
45324 11192
95369 33309
82207 31540
89608 80110
13143 82240
56191 14500
61784 40141
3895...

output:

45761

result:

ok 1 number(s): "45761"

Test #96:

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

input:

100000 300000
83283 4003
50589 34943
20743 97198
55603 23392
15537 97486
85510 81880
51806 2597
49287 13607
39661 2931
12880 56644
18914 63581
48535 91025
32844 19587
14522 58148
44926 44203
60549 21436
66303 33819
3245 74486
8895 51434
21513 51686
6487 23861
77664 3087
17008 90804
34087 49302
87906...

output:

47338

result:

ok 1 number(s): "47338"

Test #97:

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

input:

100000 300000
99041 44660
77700 1604
7549 12618
94797 11698
99183 75845
13256 99024
63517 66225
25174 71155
32151 27453
86865 89865
54877 45461
60993 10202
63241 20445
5364 95685
15647 64620
67070 47387
70007 75492
68028 74468
14443 52453
19561 6907
59075 33712
49993 91408
24477 99066
30365 12479
64...

output:

47119

result:

ok 1 number(s): "47119"

Test #98:

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

input:

100000 300000
9523 86484
65961 27480
14466 59824
89139 34412
33449 98845
31768 64616
35032 96095
79230 59502
14799 19272
68014 49091
11862 97664
41413 94574
26990 78721
79023 10370
43960 63048
67394 26125
83781 30156
75294 86091
5029 502
32683 15607
80018 68226
10326 62502
98784 31309
51703 67388
98...

output:

44955

result:

ok 1 number(s): "44955"

Test #99:

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

input:

100000 300000
12430 66465
4811 64309
61042 94952
83628 4240
57937 10587
82010 41567
49759 67305
11410 23064
41403 51054
25608 43860
98594 93936
63250 43602
94007 32748
69723 99995
16028 72241
85153 85474
40412 47376
97426 7275
65767 6160
15253 18633
97776 39428
5323 65521
21843 27323
54925 35805
481...

output:

46194

result:

ok 1 number(s): "46194"

Test #100:

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

input:

100000 300000
46852 77608
25880 78585
11654 28692
19177 41517
43555 80009
88856 57911
1674 59210
29956 43550
80525 12100
53921 68069
94696 78662
13355 11207
31744 36541
5781 5819
83808 11276
11358 47527
11417 44136
19193 92614
49318 76720
31988 90522
6802 86872
16023 32898
83645 36522
10361 18117
73...

output:

45501

result:

ok 1 number(s): "45501"

Test #101:

score: 0
Accepted
time: 3ms
memory: 28420kb

input:

2 1
1 2

output:

1

result:

ok 1 number(s): "1"