QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#182436#6354. 4rniyaAC ✓108ms15244kbC++174.9kb2023-09-18 00:46:092023-09-18 00:46:09

Judging History

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

  • [2023-09-18 00:46:09]
  • 评测
  • 测评结果:AC
  • 用时:108ms
  • 内存:15244kb
  • [2023-09-18 00:46:09]
  • 提交

answer

#include <bits/stdc++.h>
#ifdef LOCAL
#include <debug.hpp>
#else
#define debug(...) void(0)
#endif

namespace count_graphs {

std::vector<std::tuple<int, int, int>> enumerate_C4(const std::vector<std::vector<int>>& G) {
    int n = G.size();
    std::vector<int> deg(n);
    for (int i = 0; i < n; i++) deg[i] = G[i].size();
    auto comp = [&](int u, int v) -> bool { return deg[u] != deg[v] ? deg[u] < deg[v] : u < v; };
    std::vector<std::vector<int>> H(n);
    for (int i = 0; i < n; i++) {
        for (const int& j : G[i]) {
            if (comp(i, j)) {
                H[i].emplace_back(j);
            }
        }
    }
    std::vector<bool> f(n, false);
    std::vector<std::tuple<int, int, int>> res;
    for (int i = 0; i < n; i++) {
        for (int& j : H[i]) f[j] = true;
        for (int& j : H[i]) {
            for (int& k : H[j]) {
                if (f[k]) {
                    res.emplace_back(i, j, k);
                }
            }
        }
        for (int& j : H[i]) f[j] = false;
    }
    return res;
}

long long count_C4(const std::vector<std::vector<int>>& G) {
    int n = G.size();
    std::vector<int> deg(n);
    for (int i = 0; i < n; i++) deg[i] = G[i].size();
    auto comp = [&](int u, int v) -> bool { return deg[u] != deg[v] ? deg[u] < deg[v] : u < v; };
    std::vector<std::vector<int>> H(n);
    for (int i = 0; i < n; i++) {
        for (const int& j : G[i]) {
            if (comp(i, j)) {
                H[i].emplace_back(j);
            }
        }
    }
    std::vector<int> f(n, 0);
    long long res = 0;
    for (int i = 0; i < n; i++) {
        for (const int& j : G[i]) {
            for (const int& k : H[j]) {
                if (comp(i, k)) {
                    res += f[k];
                    f[k]++;
                }
            }
        }
        for (const int& j : G[i]) {
            for (const int& k : H[j]) {
                f[k] = 0;
            }
        }
    }
    return res;
}

long long count_K4(const std::vector<std::vector<int>>& G) {
    int n = G.size();
    std::vector<int> deg(n);
    for (int i = 0; i < n; i++) deg[i] = G[i].size();
    auto comp = [&](int u, int v) -> bool { return deg[u] != deg[v] ? deg[u] < deg[v] : u < v; };
    std::vector<std::vector<int>> H(n);
    for (int i = 0; i < n; i++) {
        for (const int& j : G[i]) {
            if (comp(i, j)) {
                H[i].emplace_back(j);
            }
        }
    }
    long long res = 0;
    std::vector<int> idx(n, -1);
    constexpr int B = 64;
    for (int i = 0; i < n; i++) {
        int len = H[i].size();
        for (int j = 0; j < len; j++) idx[H[i][j]] = j;
        std::vector<std::vector<int>> I(len);
        for (int j = 0; j < len; j++) {
            for (int& u : H[H[i][j]]) {
                if (idx[u] == -1) continue;
                I[j].emplace_back(idx[u]);
            }
        }
        for (int b = 0; b < (len + B - 1) / B; b++) {
            int L = B * b, R = std::min(len, L + B);
            std::vector<unsigned long long> adj(len, 0);
            for (int j = L; j < R; j++) {
                for (const int& k : I[j]) {
                    adj[k] |= 1ULL << (j - L);
                }
            }
            for (int j = 0; j < len; j++) {
                for (const int& k : I[j]) {
                    res += __builtin_popcountll(adj[j] & adj[k]);
                }
            }
        }
        for (int j = 0; j < len; j++) idx[H[i][j]] = -1;
    }
    return res;
}

}  // namespace count_graphs

using namespace std;

typedef long long ll;
#define all(x) begin(x), end(x)
constexpr int INF = (1 << 30) - 1;
constexpr long long IINF = (1LL << 60) - 1;
constexpr int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

template <class T> istream& operator>>(istream& is, vector<T>& v) {
    for (auto& x : v) is >> x;
    return is;
}

template <class T> ostream& operator<<(ostream& os, const vector<T>& v) {
    auto sep = "";
    for (const auto& x : v) os << exchange(sep, " ") << x;
    return os;
}

template <class T, class U = T> bool chmin(T& x, U&& y) { return y < x and (x = forward<U>(y), true); }

template <class T, class U = T> bool chmax(T& x, U&& y) { return x < y and (x = forward<U>(y), true); }

template <class T> void mkuni(vector<T>& v) {
    sort(begin(v), end(v));
    v.erase(unique(begin(v), end(v)), end(v));
}

template <class T> int lwb(const vector<T>& v, const T& x) { return lower_bound(begin(v), end(v), x) - begin(v); }

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, m;
    cin >> n >> m;
    vector<vector<int>> G(n);
    for (; m--;) {
        int u, v;
        cin >> u >> v;
        u--, v--;
        G[u].emplace_back(v);
        G[v].emplace_back(u);
    }

    auto ans = count_graphs::count_K4(G);
    cout << ans << '\n';
    return 0;
}

詳細信息

Test #1:

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

input:

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

output:

2

result:

ok 1 number(s): "2"

Test #2:

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

input:

4 0

output:

0

result:

ok 1 number(s): "0"

Test #3:

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

input:

50 50
28 35
12 24
31 50
10 24
21 44
5 31
23 36
31 45
6 39
4 8
13 37
42 48
17 45
19 33
12 21
19 32
16 43
12 47
25 31
40 48
8 49
43 48
6 42
27 34
13 39
17 40
13 35
3 49
20 24
5 12
43 44
15 37
24 27
8 43
4 22
17 38
28 47
29 46
3 15
9 49
1 41
43 45
3 6
37 48
13 30
11 43
8 25
33 38
16 32
32 41

output:

0

result:

ok 1 number(s): "0"

Test #4:

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

input:

100 4900
64 78
3 13
93 96
48 64
34 64
5 76
66 74
44 78
17 20
30 73
5 34
24 100
23 65
4 70
22 95
47 70
6 89
15 70
70 82
88 90
29 80
27 64
16 59
28 99
67 68
85 99
37 85
8 46
71 78
40 95
6 21
27 66
16 89
11 83
17 57
19 36
21 70
27 86
27 45
5 56
10 64
23 33
87 91
37 40
21 55
75 79
54 96
3 77
70 78
36 93...

output:

3689634

result:

ok 1 number(s): "3689634"

Test #5:

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

input:

100 4000
73 78
38 98
9 65
43 72
20 47
6 37
49 60
48 87
48 77
23 100
57 59
42 99
40 88
20 96
19 44
35 80
12 93
34 44
63 75
3 49
32 99
47 61
3 13
54 81
55 96
16 74
28 77
43 45
25 92
5 82
3 83
9 55
64 78
39 89
19 64
58 75
1 18
22 76
16 55
18 60
14 55
29 96
37 97
26 97
11 53
24 79
7 35
53 54
31 74
31 32...

output:

1094294

result:

ok 1 number(s): "1094294"

Test #6:

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

input:

447 99681
346 391
18 307
271 438
50 436
84 215
64 104
291 325
278 355
152 228
7 117
174 410
61 386
7 204
264 327
366 409
291 405
42 131
89 203
1 175
229 292
225 320
1 310
89 185
161 340
401 406
265 377
119 313
253 403
190 383
305 367
334 424
88 327
77 357
25 334
56 62
68 245
1 13
290 336
94 354
10 3...

output:

1641247665

result:

ok 1 number(s): "1641247665"

Test #7:

score: 0
Accepted
time: 103ms
memory: 5608kb

input:

447 99680
18 328
31 202
168 227
55 255
105 321
262 407
38 140
13 65
288 302
26 337
106 358
7 157
237 343
56 410
217 263
62 392
314 345
1 166
96 376
138 410
98 424
202 251
229 429
160 197
175 238
125 312
32 93
281 291
67 99
32 156
33 65
377 445
56 293
64 170
236 423
246 400
61 356
194 430
243 381
205...

output:

1641148875

result:

ok 1 number(s): "1641148875"

Test #8:

score: 0
Accepted
time: 103ms
memory: 5888kb

input:

447 99679
123 230
116 120
218 291
84 132
158 204
31 75
390 395
140 379
34 285
12 67
325 409
24 349
282 342
68 380
81 269
6 55
35 192
314 358
68 438
159 281
118 324
157 211
7 198
376 400
262 335
226 348
305 380
65 434
157 164
111 303
183 338
11 77
44 212
267 279
132 300
145 171
313 416
97 201
50 422
...

output:

1641050086

result:

ok 1 number(s): "1641050086"

Test #9:

score: 0
Accepted
time: 102ms
memory: 5572kb

input:

447 99650
198 335
78 438
83 220
267 280
102 135
98 317
22 84
259 362
57 109
22 162
52 210
160 339
34 75
88 397
381 402
99 276
227 242
205 232
74 299
139 314
238 442
157 229
170 273
44 418
8 30
22 345
39 67
32 298
227 270
93 308
372 424
110 272
409 429
59 107
10 216
193 424
171 320
283 302
261 445
90...

output:

1638188297

result:

ok 1 number(s): "1638188297"

Test #10:

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

input:

447 99600
38 388
94 209
38 420
213 444
324 337
212 444
100 400
153 193
247 252
31 352
156 300
65 384
193 254
8 277
36 181
44 407
111 377
62 226
182 413
113 206
118 344
65 78
200 210
30 214
4 6
271 424
69 119
331 348
93 344
163 178
216 386
349 386
176 219
15 446
147 185
35 368
94 163
204 382
365 443
...

output:

1633262630

result:

ok 1 number(s): "1633262630"

Test #11:

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

input:

447 99500
269 280
220 396
23 62
82 361
384 437
210 358
235 421
194 280
23 293
27 355
36 401
10 329
400 430
148 402
96 301
269 319
259 325
367 427
39 298
263 273
245 369
56 112
71 264
256 323
27 199
323 429
177 209
413 431
108 158
9 98
17 378
182 339
26 414
60 349
73 296
235 357
52 145
333 411
145 14...

output:

1623449253

result:

ok 1 number(s): "1623449253"

Test #12:

score: 0
Accepted
time: 103ms
memory: 5604kb

input:

447 99000
206 301
201 223
266 337
150 435
13 383
136 378
207 225
199 385
107 230
114 400
354 396
158 238
253 319
34 367
293 352
246 398
329 374
86 107
45 442
239 315
230 403
343 387
153 169
178 436
14 235
219 394
261 371
92 381
245 358
10 79
295 370
159 257
324 439
323 411
113 123
195 414
159 186
13...

output:

1575114565

result:

ok 1 number(s): "1575114565"

Test #13:

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

input:

447 98000
143 381
232 430
143 310
52 106
218 311
208 333
256 407
114 228
3 173
82 129
45 78
22 242
42 442
370 371
40 447
205 329
23 281
119 125
265 430
259 365
57 409
160 349
21 339
120 137
44 332
10 93
257 261
191 439
16 144
57 62
34 337
159 308
121 163
1 8
9 233
147 233
295 414
62 143
220 234
28 1...

output:

1481993488

result:

ok 1 number(s): "1481993488"

Test #14:

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

input:

447 90000
111 237
68 388
20 135
42 68
265 326
174 215
192 278
32 418
293 296
164 206
255 296
101 215
93 422
213 257
122 310
367 393
146 165
24 48
121 214
392 400
6 14
166 360
118 267
343 352
336 350
391 424
64 381
207 302
119 379
78 435
248 317
310 385
198 227
105 410
93 220
5 116
214 304
283 432
59...

output:

889086208

result:

ok 1 number(s): "889086208"

Test #15:

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

input:

447 89000
14 240
211 327
221 367
226 346
224 288
20 426
54 412
8 404
77 89
109 330
180 260
373 377
212 315
162 329
9 308
286 301
46 202
52 117
107 412
220 376
50 427
49 138
20 432
153 206
61 280
195 378
25 45
90 114
335 441
191 284
299 365
350 422
203 214
1 311
17 337
55 400
52 262
104 296
261 309
6...

output:

831285099

result:

ok 1 number(s): "831285099"

Test #16:

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

input:

450 100000
83 266
69 103
101 443
43 156
223 271
85 398
99 124
170 400
337 449
206 306
50 59
83 382
52 289
58 332
43 117
299 378
241 273
126 435
353 370
6 439
14 42
19 212
28 198
37 412
227 443
13 204
194 296
108 253
4 354
27 64
13 154
40 102
67 173
106 148
366 425
105 108
155 179
194 372
282 389
249...

output:

1585848605

result:

ok 1 number(s): "1585848605"

Test #17:

score: 0
Accepted
time: 103ms
memory: 5716kb

input:

455 100000
83 297
349 436
200 238
100 403
140 204
111 180
185 380
140 356
213 257
79 409
36 376
221 253
108 218
113 385
270 438
264 355
156 451
387 449
70 96
112 398
40 358
43 160
126 354
9 81
204 277
27 209
35 397
356 389
106 359
245 320
384 406
40 403
107 296
177 206
65 256
261 325
125 369
377 424...

output:

1451687918

result:

ok 1 number(s): "1451687918"

Test #18:

score: 0
Accepted
time: 103ms
memory: 5776kb

input:

500 100000
191 311
182 488
75 292
255 478
2 303
23 70
241 272
104 183
205 292
15 360
385 460
30 49
86 90
278 346
435 444
207 479
106 493
191 226
97 429
123 284
141 498
245 469
195 418
162 261
314 393
428 494
49 247
178 397
375 492
41 83
161 464
60 340
16 223
20 331
62 334
91 244
446 456
374 451
32 1...

output:

682545705

result:

ok 1 number(s): "682545705"

Test #19:

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

input:

550 100000
103 549
183 219
188 502
35 62
26 97
189 213
100 478
338 540
87 504
458 490
241 440
33 477
119 385
160 265
92 182
181 309
110 532
357 383
252 460
152 205
125 466
444 543
52 334
219 302
8 488
48 461
102 252
126 427
185 320
244 417
183 257
216 250
35 127
223 358
64 159
34 441
289 425
308 414...

output:

318745782

result:

ok 1 number(s): "318745782"

Test #20:

score: 0
Accepted
time: 103ms
memory: 5652kb

input:

600 100000
233 309
98 416
259 338
356 539
360 554
364 367
27 256
28 381
107 600
369 424
40 444
533 597
384 588
306 532
98 248
484 574
113 347
273 447
131 369
119 176
328 358
30 460
32 278
388 415
313 423
52 94
475 533
80 351
213 344
37 175
73 129
47 596
171 294
313 436
295 495
183 189
486 547
87 146...

output:

158555444

result:

ok 1 number(s): "158555444"

Test #21:

score: 0
Accepted
time: 96ms
memory: 5888kb

input:

650 100000
105 412
198 265
123 593
94 515
201 403
463 603
51 382
114 281
440 614
193 461
372 499
130 333
312 371
276 421
83 543
299 540
60 354
402 522
175 190
95 373
72 285
482 536
382 507
419 595
383 599
98 379
101 584
272 326
69 455
361 583
331 595
541 552
77 514
163 623
228 235
232 239
241 381
32...

output:

83601361

result:

ok 1 number(s): "83601361"

Test #22:

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

input:

700 100000
300 467
95 626
137 167
85 441
44 308
99 601
52 550
448 504
127 352
133 584
192 239
230 687
407 604
106 398
215 491
103 203
330 690
450 460
251 264
291 521
38 296
347 406
17 577
337 700
30 375
238 659
230 476
77 163
87 474
296 384
202 624
22 474
34 682
105 194
307 349
415 492
548 596
333 5...

output:

46181798

result:

ok 1 number(s): "46181798"

Test #23:

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

input:

750 100000
133 309
210 581
101 409
279 540
291 579
150 187
390 615
107 729
266 438
71 644
589 645
683 716
79 508
100 101
177 377
310 400
46 245
468 728
481 702
509 511
67 268
192 224
116 308
284 588
429 672
303 387
371 380
503 624
161 631
223 409
315 750
138 293
26 78
448 450
483 536
95 391
399 455
...

output:

26665209

result:

ok 1 number(s): "26665209"

Test #24:

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

input:

800 100000
596 779
65 391
266 531
3 429
409 428
386 525
235 274
182 189
610 620
338 623
209 455
408 534
173 762
145 761
347 771
25 796
240 703
299 577
567 672
678 777
390 577
405 693
470 610
456 659
124 595
153 533
416 700
121 673
161 417
315 513
20 444
129 448
120 737
178 195
94 758
91 651
10 264
1...

output:

15871497

result:

ok 1 number(s): "15871497"

Test #25:

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

input:

850 100000
168 401
190 479
479 654
298 365
19 389
395 721
486 641
586 812
148 820
501 772
143 536
17 746
201 722
190 590
250 690
456 458
391 847
608 723
718 800
7 684
243 771
131 608
299 706
225 391
311 619
228 486
419 725
245 262
303 349
604 758
283 533
72 91
528 687
261 545
418 707
55 730
439 500
...

output:

9738714

result:

ok 1 number(s): "9738714"

Test #26:

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

input:

900 100000
230 313
384 846
107 330
715 832
24 474
6 234
146 210
399 517
131 471
353 732
109 218
363 829
108 165
350 705
155 549
618 657
826 847
649 740
224 858
132 586
194 745
420 622
215 516
422 436
43 339
471 857
214 477
469 661
232 881
79 615
138 537
352 466
66 441
636 803
740 802
205 248
235 400...

output:

6178526

result:

ok 1 number(s): "6178526"

Test #27:

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

input:

950 100000
870 880
831 846
695 706
482 826
147 483
316 867
148 853
57 435
328 435
207 535
136 393
710 801
230 684
59 569
698 717
170 289
218 879
84 168
216 793
161 718
227 728
24 594
40 583
304 829
247 932
254 778
266 855
203 502
381 806
93 149
829 934
760 890
417 757
391 940
397 530
195 669
72 278
...

output:

4007438

result:

ok 1 number(s): "4007438"

Test #28:

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

input:

1000 100000
151 908
468 726
148 744
360 767
335 500
29 147
510 572
173 872
190 221
505 703
559 828
245 493
531 975
155 526
31 927
506 589
268 641
195 285
462 774
347 964
495 838
139 920
149 667
932 984
385 696
336 415
150 634
97 204
318 498
430 436
426 637
399 845
219 419
530 968
147 497
41 654
377 ...

output:

2663248

result:

ok 1 number(s): "2663248"

Test #29:

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

input:

1200 100000
1062 1129
179 345
580 735
440 1169
27 869
345 689
742 1069
786 973
822 831
231 998
202 586
95 150
317 834
494 927
431 685
38 144
662 1001
204 537
912 962
128 753
627 670
158 175
531 980
836 895
370 1095
61 999
939 1025
268 494
244 612
608 701
378 1180
182 1047
165 656
355 922
262 1055
44...

output:

620725

result:

ok 1 number(s): "620725"

Test #30:

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

input:

1500 100000
134 1417
166 340
168 685
1028 1152
360 401
304 1312
383 1271
952 1313
228 1285
1142 1209
199 630
551 1450
34 612
1215 1287
1303 1359
654 1455
548 828
158 1244
154 699
344 478
1107 1288
14 34
213 342
450 1387
390 855
150 1373
864 1368
437 773
775 917
399 759
7 404
504 1083
1018 1116
1087 ...

output:

103169

result:

ok 1 number(s): "103169"

Test #31:

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

input:

2000 100000
293 774
432 1543
41 1141
886 958
849 1173
413 1564
1230 1393
1267 1735
1050 1097
170 442
515 807
1372 1799
583 723
221 1277
363 1668
39 1600
1215 1663
51 1861
254 1813
1397 1563
1090 1205
42 214
101 742
1682 1714
846 1321
480 820
524 1925
942 1161
749 1443
957 1651
1011 1827
411 1583
298...

output:

10492

result:

ok 1 number(s): "10492"

Test #32:

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

input:

4000 100000
312 660
371 2160
2846 3208
231 599
3282 3670
670 3822
649 1836
2302 2487
880 3548
250 3435
2850 3222
3297 3806
87 203
573 2073
1152 1617
1458 3254
1039 2669
1750 2452
230 433
1634 2462
263 3969
2182 3233
779 3440
2360 3247
52 3051
1876 3481
187 1125
2391 2559
1434 2120
830 3575
186 2738
...

output:

28

result:

ok 1 number(s): "28"

Test #33:

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

input:

5000 100000
2274 3651
2477 3599
3918 3972
2918 3912
2111 4134
2171 4230
312 3009
2078 4938
2886 4282
2101 3295
1213 1420
1834 3289
2389 3817
4411 4536
3269 4685
2989 4628
4298 4380
715 2013
1121 1909
2110 4232
428 1063
818 2709
168 446
1133 4182
2291 3799
3298 4558
172 1829
487 4243
2252 3744
1615 1...

output:

10

result:

ok 1 number(s): "10"

Test #34:

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

input:

7000 100000
1 1348
1 1515
1 1679
1 2152
1 2628
1 2834
1 3090
1 3199
1 3605
1 3733
1 3770
1 4162
1 4293
1 4328
1 4610
1 4660
1 4729
1 4749
1 4937
1 5023
1 5761
1 5957
1 6018
1 6027
1 6374
1 6429
1 6533
1 6717
1 6755
1 6899
2 428
2 704
2 794
2 1153
2 1338
2 1383
2 1544
2 1636
2 1674
2 1887
2 2507
2 28...

output:

1

result:

ok 1 number(s): "1"

Test #35:

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

input:

10000 100000
1 599
1 631
1 748
1 1328
1 1448
1 1537
1 1550
1 2002
1 3744
1 3946
1 5152
1 5171
1 6203
1 6390
1 6494
1 7243
1 7575
1 7721
1 8982
1 9550
2 433
2 601
2 1764
2 2043
2 2072
2 2431
2 2551
2 3911
2 4083
2 4167
2 4647
2 5315
2 5964
2 6704
2 7216
2 7426
2 8338
2 8475
2 8856
2 9758
3 22
3 501
3...

output:

0

result:

ok 1 number(s): "0"

Test #36:

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

input:

15000 100000
1 65
1 2527
1 2746
1 3303
1 3787
1 4152
1 5174
1 5527
1 5592
1 7593
1 8008
1 10468
1 12196
1 12497
2 1118
2 3411
2 5578
2 7535
2 9993
2 13529
2 14170
3 379
3 1834
3 2224
3 3963
3 4463
3 6263
3 7627
3 9859
3 14540
4 202
4 931
4 3140
4 3500
4 7443
4 8516
4 8924
4 9011
4 9161
4 9305
4 9806...

output:

0

result:

ok 1 number(s): "0"

Test #37:

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

input:

20000 100000
1 494
1 3337
1 5325
1 6842
1 8285
1 9909
1 15624
1 16511
1 19010
2 473
2 5509
2 6781
2 7657
2 11080
2 13540
2 14056
2 14100
3 519
3 610
3 769
3 1520
3 4714
3 6023
3 10084
3 11846
3 12525
3 13207
3 13278
3 14269
3 16105
3 17724
3 17730
4 651
4 3950
4 7055
4 7109
4 7189
4 7943
4 9843
4 12...

output:

0

result:

ok 1 number(s): "0"

Test #38:

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

input:

25000 100000
1 2780
1 3697
1 4022
1 9754
1 15416
1 22314
2 1261
2 4159
2 10565
2 14313
2 20192
3 4057
3 5300
3 9652
3 10257
3 12853
3 16487
3 18000
3 19268
3 21416
3 21519
4 4200
4 5341
4 5821
4 11263
4 12131
4 15166
4 15604
4 17008
4 19379
5 2911
5 8394
5 14484
5 17755
5 19720
5 21274
5 23969
6 132...

output:

0

result:

ok 1 number(s): "0"

Test #39:

score: 0
Accepted
time: 25ms
memory: 8164kb

input:

40000 100000
1 18832
1 23370
1 39609
2 15571
2 18467
2 36754
3 11010
3 14192
3 15145
3 15578
3 36218
4 12106
4 23253
4 23466
4 33546
5 13311
5 15745
5 17967
5 31542
6 283
6 18389
6 26147
6 29648
6 31464
6 34198
7 32076
7 33322
8 2291
8 14836
8 16243
8 24255
8 25111
9 25205
9 26413
9 30298
9 38831
10...

output:

0

result:

ok 1 number(s): "0"

Test #40:

score: 0
Accepted
time: 27ms
memory: 9184kb

input:

50000 100000
1 4043
1 14428
1 18057
2 2993
3 1610
3 20686
3 34815
3 48596
4 3643
4 12818
4 29914
4 38523
4 42686
4 45377
5 176
5 1043
5 6978
5 14511
5 27838
5 43263
5 48479
5 49929
6 21277
6 31727
7 15783
7 17756
7 25342
7 29217
7 45506
8 4969
8 27606
8 33704
8 38694
8 46189
8 48762
9 12617
9 16555
...

output:

0

result:

ok 1 number(s): "0"

Test #41:

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

input:

70000 100000
1 25694
2 14492
4 36031
4 64864
5 4072
5 25190
5 31575
5 36499
5 42151
5 42596
6 8304
6 18635
7 26784
8 762
8 2818
8 36118
9 23944
9 52648
9 54476
10 33767
10 56764
10 59611
11 11122
11 18228
11 19633
11 47708
11 48615
11 53470
11 62196
12 1338
12 37912
13 19298
13 27012
13 57898
14 217...

output:

0

result:

ok 1 number(s): "0"

Test #42:

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

input:

80000 100000
2 40649
2 44511
3 24145
3 77315
4 70783
4 79703
5 10153
5 50388
5 51238
5 53351
6 21307
6 30141
6 78641
7 45643
8 62122
8 62184
9 16594
9 24707
9 35733
9 57853
9 61664
10 35930
11 26489
11 37394
11 40169
11 43996
11 46621
11 51435
12 60880
13 38401
14 10923
14 26017
14 69387
15 40102
15...

output:

0

result:

ok 1 number(s): "0"

Test #43:

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

input:

90000 100000
1 7758
2 23240
2 44585
3 67259
4 32682
4 74314
5 1334
5 28554
5 31772
5 45382
6 10294
6 27016
7 34840
8 44702
8 49588
8 58770
8 61715
9 31047
9 71411
9 88812
10 35794
11 18302
11 55957
11 68059
11 83504
12 55794
13 4547
14 42989
14 77051
14 81398
15 46299
15 57450
15 83007
16 3497
16 26...

output:

0

result:

ok 1 number(s): "0"

Test #44:

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

input:

100000 100000
1 35463
1 52351
1 73363
3 52602
4 32077
5 52838
7 51875
8 65214
9 47531
9 56124
9 76397
9 99892
11 26040
12 75242
15 4494
15 18304
15 46456
17 41744
17 98025
18 39701
19 1630
19 32723
19 93132
21 13797
21 66440
21 83965
21 90469
21 98188
22 44105
23 61769
23 74835
23 81396
24 15303
24 ...

output:

0

result:

ok 1 number(s): "0"

Test #45:

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

input:

100000 100000
2 51083
2 57389
2 80822
2 92500
3 5669
3 47288
3 52561
3 60713
8 57245
8 71696
8 78696
8 92338
10 10080
10 47936
10 60553
10 79654
11 50476
11 50591
11 52706
11 65502
11 73473
11 75995
12 20407
12 28324
12 74681
12 87377
13 142
13 57230
16 61902
16 73380
17 31986
17 57308
17 95368
17 9...

output:

0

result:

ok 1 number(s): "0"

Test #46:

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

input:

100000 100000
1 2470
1 26745
1 37210
1 46813
1 52437
1 57234
4 7030
4 41824
4 43831
6 19039
6 23011
6 26119
6 39371
6 48602
6 54425
8 15507
8 61114
8 82231
9 19717
9 44172
9 47859
10 1891
10 36112
10 92059
13 12375
13 14822
13 66878
15 88
15 27839
15 40051
15 70872
15 72712
15 90351
16 45486
16 9101...

output:

16666

result:

ok 1 number(s): "16666"

Test #47:

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

input:

100000 100000
1 17753
1 41422
1 55376
1 79978
5 1714
5 12741
5 28365
5 47182
5 69707
5 89258
5 98741
5 99800
6 6340
6 12937
6 19948
6 33358
6 46453
6 51515
6 63917
6 79078
7 4160
7 12660
7 19626
7 38797
7 40530
7 48935
7 57910
7 96051
10 22486
10 22734
10 70228
10 98961
12 22086
12 58405
12 74106
12...

output:

50000

result:

ok 1 number(s): "50000"

Test #48:

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

input:

100000 100000
1 2900
1 12310
1 44546
1 49882
1 90614
5 25446
5 54895
5 84931
5 91392
5 99714
8 13001
8 18330
8 33453
8 50173
8 57583
9 20963
9 39497
9 49025
9 72376
9 96867
10 26635
10 50209
10 73395
10 88106
10 95225
11 33567
11 60659
11 75980
11 81222
11 83197
14 7182
14 14067
14 25898
14 44389
14...

output:

99996

result:

ok 1 number(s): "99996"

Test #49:

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

input:

100000 100000
5 31661
5 40948
5 44501
5 48388
5 48598
5 56995
5 67174
5 72393
5 95320
10 19408
10 41368
10 51767
10 61678
10 75078
10 90582
10 91350
10 93779
10 94641
20 6640
20 10683
20 18778
20 24200
20 44666
20 53542
20 71048
20 71330
20 71556
32 11098
32 36851
32 49134
32 49918
32 66447
32 83865...

output:

466620

result:

ok 1 number(s): "466620"

Test #50:

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

input:

100000 100000
7 10608
7 15499
7 18748
7 22983
7 25622
7 26230
7 28555
7 41024
7 44320
7 44581
7 50743
7 69470
7 69493
7 70067
7 84734
7 86011
7 96183
7 98720
7 99603
29 5017
29 6256
29 10181
29 23744
29 28393
29 30276
29 31844
29 34781
29 35996
29 37221
29 46287
29 49705
29 53989
29 56834
29 81577
2...

output:

2548515

result:

ok 1 number(s): "2548515"

Test #51:

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

input:

100000 100000
69 1099
69 4224
69 4236
69 6526
69 11513
69 11566
69 11582
69 12166
69 13391
69 13889
69 16032
69 17379
69 25817
69 26543
69 30951
69 31314
69 37375
69 42112
69 43735
69 46031
69 46073
69 47733
69 48730
69 56096
69 65403
69 68414
69 72033
69 72224
69 73651
69 74911
69 76163
69 77646
69...

output:

11698131

result:

ok 1 number(s): "11698131"

Test #52:

score: 0
Accepted
time: 25ms
memory: 10176kb

input:

100000 100000
10 3510
10 4252
10 5754
10 9210
10 11275
10 11861
10 12129
10 13106
10 19448
10 19702
10 19951
10 25059
10 25186
10 31199
10 33124
10 33678
10 33943
10 36739
10 38804
10 39298
10 41871
10 43305
10 46292
10 48409
10 49123
10 51988
10 52704
10 54508
10 56760
10 58809
10 61161
10 62364
10...

output:

27341084

result:

ok 1 number(s): "27341084"

Test #53:

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

input:

100000 100000
13 602
13 1014
13 1839
13 2650
13 5381
13 8479
13 10209
13 11447
13 11536
13 14744
13 17899
13 18520
13 18960
13 19043
13 20598
13 22073
13 25550
13 25764
13 27564
13 27803
13 28009
13 29667
13 29898
13 32537
13 32689
13 33072
13 34861
13 34894
13 36092
13 36301
13 37051
13 39563
13 40...

output:

49307484

result:

ok 1 number(s): "49307484"

Test #54:

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

input:

100000 100000
148 1022
148 1513
148 3149
148 3354
148 6647
148 6787
148 7676
148 9375
148 11271
148 12641
148 13119
148 13543
148 13681
148 14259
148 15652
148 18499
148 18605
148 19941
148 21491
148 22273
148 22553
148 32484
148 32806
148 34888
148 35853
148 35903
148 36386
148 37978
148 39071
148 ...

output:

78437985

result:

ok 1 number(s): "78437985"

Test #55:

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

input:

100000 100000
144 1245
144 1670
144 2056
144 2087
144 2575
144 3145
144 4697
144 4995
144 6163
144 6816
144 7060
144 7673
144 7811
144 9642
144 11937
144 12226
144 12454
144 12931
144 13281
144 13613
144 15293
144 15758
144 16032
144 17927
144 18573
144 18949
144 19154
144 19751
144 20804
144 21038
...

output:

177781425

result:

ok 1 number(s): "177781425"

Test #56:

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

input:

100000 100000
58 92
58 1454
58 2079
58 2990
58 3942
58 4636
58 4920
58 5719
58 5741
58 5781
58 5841
58 6195
58 6258
58 6579
58 6635
58 7470
58 7518
58 7712
58 8090
58 8515
58 8682
58 9187
58 9220
58 9958
58 10999
58 11277
58 11285
58 11405
58 11585
58 13800
58 13875
58 14461
58 14676
58 14849
58 152...

output:

323424853

result:

ok 1 number(s): "323424853"

Test #57:

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

input:

100000 100000
27 209
27 2507
27 7658
27 13876
27 15245
27 17580
27 25893
27 27434
27 31507
27 32201
27 33383
27 37324
27 38985
27 43365
27 45485
27 55393
27 56014
27 57679
27 62073
27 64367
27 66134
27 68569
27 70189
27 70263
27 88458
27 89033
27 96084
27 98442
182 408
182 816
182 1038
182 1288
182 ...

output:

477409255

result:

ok 1 number(s): "477409255"

Test #58:

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

input:

100000 100000
81 872
81 1030
81 1479
81 1491
81 1861
81 1917
81 2035
81 2482
81 2631
81 3008
81 3941
81 4061
81 4459
81 4667
81 4809
81 5251
81 5503
81 5535
81 5570
81 5862
81 5881
81 6211
81 6283
81 6576
81 6582
81 6985
81 7152
81 7349
81 8264
81 8561
81 9378
81 9897
81 10237
81 10503
81 10556
81 1...

output:

663630795

result:

ok 1 number(s): "663630795"

Test #59:

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

input:

100000 100000
67 611
67 785
67 1258
67 1472
67 1510
67 1734
67 2236
67 2273
67 2354
67 2872
67 2950
67 3191
67 3205
67 3620
67 3669
67 3923
67 4169
67 4636
67 5207
67 5211
67 5416
67 5815
67 6095
67 6154
67 6415
67 6614
67 7452
67 7500
67 8218
67 9071
67 9156
67 9346
67 9427
67 9620
67 9643
67 9962
...

output:

721952985

result:

ok 1 number(s): "721952985"

Test #60:

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

input:

100000 100000
264 417
264 644
264 900
264 1458
264 1491
264 1539
264 1563
264 2081
264 2215
264 2502
264 3165
264 3298
264 4422
264 4606
264 4826
264 5023
264 5024
264 5127
264 5141
264 5213
264 5492
264 6121
264 6171
264 6283
264 6896
264 7034
264 7102
264 7523
264 7752
264 8221
264 9453
264 9680
2...

output:

1059759970

result:

ok 1 number(s): "1059759970"

Test #61:

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

input:

100000 100000
224 397
224 458
224 511
224 682
224 1222
224 1389
224 1445
224 1670
224 1817
224 1915
224 2001
224 2004
224 2054
224 2262
224 2360
224 2564
224 2645
224 2657
224 2704
224 3209
224 3453
224 3648
224 3664
224 3680
224 4498
224 4572
224 4721
224 4840
224 5038
224 5223
224 5235
224 5318
22...

output:

1596168145

result:

ok 1 number(s): "1596168145"

Test #62:

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

input:

100000 100000
141 162
141 177
141 286
141 293
141 343
141 556
141 736
141 759
141 893
141 1013
141 1038
141 1077
141 2346
141 2524
141 2615
141 2877
141 2994
141 3172
141 3252
141 3284
141 3595
141 3641
141 3811
141 4053
141 4071
141 4610
141 5289
141 5782
141 6028
141 6046
141 6225
141 6565
141 671...

output:

1021545253

result:

ok 1 number(s): "1021545253"

Test #63:

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

input:

100000 100000
235 281
235 553
235 1076
235 1826
235 1920
235 1921
235 2083
235 2230
235 2565
235 2679
235 2722
235 2776
235 3038
235 3240
235 3493
235 3598
235 3681
235 4019
235 4522
235 4567
235 4789
235 4822
235 4977
235 5024
235 5282
235 5566
235 5610
235 5984
235 6033
235 6081
235 6145
235 6211
...

output:

755761830

result:

ok 1 number(s): "755761830"

Test #64:

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

input:

100000 100000
87 1252
87 1783
87 2839
87 2884
87 3620
87 3773
87 4652
87 5014
87 5034
87 5071
87 5334
87 6378
87 6475
87 7890
87 9519
87 9560
87 9959
87 10339
87 12393
87 12752
87 12772
87 12796
87 13360
87 13809
87 13944
87 14545
87 14639
87 15618
87 15620
87 15928
87 16009
87 16117
87 17468
87 187...

output:

592034950

result:

ok 1 number(s): "592034950"

Test #65:

score: 0
Accepted
time: 62ms
memory: 10508kb

input:

100000 100000
213 284
213 378
213 415
213 761
213 791
213 897
213 926
213 1042
213 1235
213 1281
213 1334
213 1566
213 1711
213 1795
213 1834
213 1863
213 2180
213 2382
213 2498
213 2800
213 2834
213 2924
213 3084
213 3181
213 3201
213 3300
213 3678
213 3820
213 3918
213 3997
213 4032
213 4256
213 4...

output:

480282715

result:

ok 1 number(s): "480282715"

Test #66:

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

input:

100000 100000
83 786
83 1280
83 3798
83 4980
83 5719
83 5774
83 8744
83 10648
83 10706
83 14070
83 14309
83 14791
83 15472
83 15603
83 18356
83 18572
83 20121
83 23366
83 27860
83 28586
83 30458
83 30719
83 31389
83 32604
83 33036
83 33398
83 33604
83 34118
83 35531
83 36622
83 37062
83 37490
83 378...

output:

175641830

result:

ok 1 number(s): "175641830"

Test #67:

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

input:

100000 100000
29 7273
29 10070
29 10524
29 10906
29 15147
29 16454
29 17672
29 21888
29 22219
29 23563
29 26180
29 26325
29 27125
29 27556
29 28254
29 28639
29 29190
29 32144
29 32405
29 34630
29 38478
29 43207
29 45856
29 46906
29 48792
29 49015
29 50068
29 50455
29 66095
29 66564
29 66766
29 66992...

output:

40012175

result:

ok 1 number(s): "40012175"

Test #68:

score: 0
Accepted
time: 24ms
memory: 10364kb

input:

100000 100000
7 14049
7 16583
7 17862
7 19391
7 19494
7 21982
7 23166
7 30185
7 31075
7 34226
7 38245
7 45004
7 45940
7 53071
7 61964
7 62545
7 66972
7 71187
7 82543
7 86256
10 14049
10 16583
10 17862
10 19391
10 19494
10 21982
10 23166
10 30185
10 31075
10 34226
10 38245
10 45004
10 45940
10 53071
...

output:

5721945

result:

ok 1 number(s): "5721945"

Test #69:

score: 0
Accepted
time: 23ms
memory: 10844kb

input:

100000 100000
5 9565
5 18769
5 20672
5 27739
5 27941
5 31550
5 60684
5 62587
5 86276
5 95630
11 9565
11 18769
11 20672
11 27739
11 27941
11 31550
11 60684
11 62587
11 86276
11 95630
38 9565
38 18769
38 20672
38 27739
38 27941
38 31550
38 60684
38 62587
38 86276
38 95630
50 9565
50 18769
50 20672
50 ...

output:

1201485

result:

ok 1 number(s): "1201485"

Test #70:

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

input:

100000 100000
1 20332
1 52960
1 61387
1 61691
1 90479
4 20332
4 52960
4 61387
4 61691
4 90479
12 20332
12 52960
12 61387
12 61691
12 90479
14 20332
14 52960
14 61387
14 61691
14 90479
15 20332
15 52960
15 61387
15 61691
15 90479
17 20332
17 52960
17 61387
17 61691
17 90479
20 20332
20 52960
20 61387...

output:

200105

result:

ok 1 number(s): "200105"

Test #71:

score: 0
Accepted
time: 23ms
memory: 12048kb

input:

100000 100000
2 18418
2 96187
3 18418
3 96187
6 18418
6 96187
7 18418
7 96187
8 18418
8 96187
9 18418
9 96187
10 18418
10 96187
15 18418
15 96187
16 18418
16 96187
18 18418
18 96187
19 18418
19 96187
20 18418
20 96187
21 18418
21 96187
25 18418
25 96187
29 18418
29 96187
31 18418
31 96187
33 18418
3...

output:

3

result:

ok 1 number(s): "3"

Test #72:

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

input:

100000 100000
3 12631
3 36783
5 12631
5 36783
6 12631
6 36783
8 12631
8 36783
9 36783
10 12631
10 36783
11 36783
12 36783
13 36783
14 12631
14 36783
15 12631
15 36783
16 36783
17 36783
18 36783
19 36783
21 36783
22 12631
22 36783
24 36783
25 36783
26 36783
27 36783
28 12631
28 36783
29 36783
31 3678...

output:

0

result:

ok 1 number(s): "0"

Test #73:

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

input:

100000 100000
1 46688
2 46688
3 46688
4 46688
5 46688
6 46688
7 46688
8 46688
9 46688
10 46688
11 46688
12 46688
13 46688
14 46688
15 46688
16 46688
17 46688
18 46688
19 46688
20 46688
21 46688
22 46688
23 46688
24 46688
25 46688
26 46688
27 46688
28 46688
29 46688
30 46688
31 46688
32 46688
33 4668...

output:

0

result:

ok 1 number(s): "0"

Test #74:

score: 0
Accepted
time: 101ms
memory: 5548kb

input:

500 100000
1 2
1 3
1 5
1 7
1 8
1 9
1 10
1 13
1 14
1 15
1 16
1 17
1 20
1 21
1 22
1 23
1 24
1 26
1 27
1 28
1 29
1 30
1 31
1 32
1 33
1 34
1 35
1 36
1 37
1 39
1 41
1 42
1 43
1 44
1 45
1 47
1 48
1 50
1 51
1 52
1 53
1 54
1 55
1 56
1 57
1 59
1 60
1 61
1 62
1 63
1 65
1 66
1 67
1 68
1 71
1 72
1 73
1 74
1 75
...

output:

684264912

result:

ok 1 number(s): "684264912"

Test #75:

score: 0
Accepted
time: 103ms
memory: 5636kb

input:

500 100000
1 3
1 4
1 5
1 6
1 8
1 9
1 11
1 12
1 13
1 14
1 15
1 17
1 18
1 19
1 20
1 21
1 23
1 24
1 25
1 29
1 30
1 31
1 32
1 34
1 35
1 36
1 37
1 39
1 40
1 41
1 42
1 43
1 44
1 45
1 46
1 47
1 49
1 51
1 54
1 55
1 58
1 59
1 60
1 62
1 63
1 64
1 65
1 66
1 67
1 68
1 69
1 71
1 72
1 73
1 74
1 75
1 76
1 77
1 78
...

output:

685963712

result:

ok 1 number(s): "685963712"

Test #76:

score: 0
Accepted
time: 101ms
memory: 5788kb

input:

500 100000
1 2
1 4
1 5
1 8
1 9
1 10
1 11
1 12
1 13
1 16
1 17
1 18
1 19
1 20
1 22
1 23
1 25
1 26
1 28
1 29
1 30
1 31
1 32
1 33
1 34
1 35
1 36
1 37
1 38
1 39
1 40
1 41
1 43
1 45
1 46
1 47
1 48
1 50
1 52
1 54
1 55
1 56
1 58
1 59
1 60
1 63
1 64
1 65
1 66
1 67
1 69
1 70
1 71
1 72
1 73
1 74
1 75
1 76
1 77...

output:

687152021

result:

ok 1 number(s): "687152021"

Test #77:

score: 0
Accepted
time: 101ms
memory: 5632kb

input:

500 100000
1 3
1 4
1 5
1 7
1 8
1 9
1 12
1 13
1 14
1 16
1 17
1 18
1 20
1 22
1 23
1 24
1 25
1 26
1 27
1 28
1 29
1 32
1 33
1 34
1 36
1 37
1 39
1 40
1 41
1 42
1 45
1 46
1 47
1 48
1 49
1 50
1 51
1 52
1 53
1 54
1 55
1 56
1 57
1 59
1 61
1 62
1 63
1 64
1 66
1 67
1 68
1 69
1 70
1 72
1 73
1 74
1 75
1 77
1 78
...

output:

690464941

result:

ok 1 number(s): "690464941"

Test #78:

score: 0
Accepted
time: 102ms
memory: 5612kb

input:

500 100000
1 2
1 4
1 5
1 6
1 7
1 8
1 9
1 10
1 11
1 12
1 13
1 14
1 15
1 16
1 17
1 19
1 20
1 21
1 22
1 23
1 24
1 25
1 26
1 27
1 28
1 29
1 30
1 31
1 32
1 33
1 34
1 35
1 36
1 37
1 38
1 39
1 40
1 41
1 42
1 44
1 45
1 46
1 47
1 48
1 49
1 51
1 53
1 54
1 56
1 57
1 58
1 59
1 63
1 64
1 65
1 66
1 67
1 68
1 70
1...

output:

692172151

result:

ok 1 number(s): "692172151"

Test #79:

score: 0
Accepted
time: 101ms
memory: 5456kb

input:

500 100000
1 2
1 3
1 6
1 8
1 9
1 10
1 11
1 12
1 14
1 15
1 16
1 17
1 18
1 19
1 20
1 21
1 22
1 23
1 24
1 26
1 27
1 28
1 29
1 31
1 32
1 33
1 34
1 35
1 36
1 39
1 40
1 41
1 42
1 43
1 44
1 45
1 46
1 48
1 49
1 50
1 51
1 52
1 53
1 54
1 55
1 56
1 57
1 59
1 60
1 62
1 63
1 64
1 65
1 66
1 67
1 68
1 69
1 70
1 71...

output:

704770934

result:

ok 1 number(s): "704770934"

Test #80:

score: 0
Accepted
time: 101ms
memory: 5564kb

input:

500 100000
1 2
1 4
1 5
1 6
1 7
1 9
1 10
1 11
1 13
1 14
1 15
1 16
1 17
1 18
1 19
1 20
1 21
1 22
1 23
1 25
1 26
1 27
1 28
1 29
1 30
1 32
1 33
1 34
1 35
1 36
1 37
1 38
1 39
1 40
1 41
1 42
1 43
1 44
1 46
1 49
1 50
1 51
1 52
1 55
1 56
1 57
1 59
1 60
1 62
1 63
1 65
1 66
1 67
1 68
1 69
1 70
1 72
1 73
1 74
...

output:

720502202

result:

ok 1 number(s): "720502202"

Test #81:

score: 0
Accepted
time: 99ms
memory: 5504kb

input:

500 100000
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
1 10
1 11
1 12
1 13
1 14
1 15
1 16
1 17
1 20
1 21
1 22
1 26
1 27
1 28
1 30
1 31
1 32
1 33
1 34
1 35
1 36
1 37
1 39
1 40
1 41
1 42
1 45
1 47
1 48
1 49
1 51
1 52
1 53
1 54
1 56
1 57
1 58
1 61
1 62
1 63
1 64
1 66
1 67
1 70
1 71
1 72
1 73
1 74
1 75
1 76
1 78
1 ...

output:

776880399

result:

ok 1 number(s): "776880399"

Test #82:

score: 0
Accepted
time: 98ms
memory: 5520kb

input:

500 100000
1 2
1 5
1 6
1 8
1 10
1 11
1 12
1 13
1 14
1 15
1 16
1 17
1 19
1 20
1 21
1 23
1 24
1 25
1 26
1 27
1 30
1 31
1 32
1 33
1 34
1 35
1 36
1 37
1 38
1 39
1 40
1 41
1 42
1 43
1 44
1 45
1 47
1 49
1 50
1 54
1 56
1 57
1 58
1 59
1 66
1 67
1 69
1 70
1 72
1 73
1 74
1 80
1 83
1 84
1 85
1 88
1 89
1 91
1 9...

output:

851955827

result:

ok 1 number(s): "851955827"

Test #83:

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

input:

500 100000
1 4
1 7
1 10
1 11
1 12
1 13
1 18
1 19
1 20
1 21
1 22
1 24
1 25
1 27
1 28
1 30
1 31
1 36
1 37
1 38
1 46
1 47
1 48
1 52
1 54
1 55
1 57
1 58
1 59
1 61
1 62
1 64
1 65
1 66
1 69
1 78
1 81
1 83
1 84
1 87
1 90
1 91
1 92
1 93
1 94
1 96
1 97
1 102
1 103
1 105
1 107
1 108
1 109
1 110
1 114
1 115
1 ...

output:

1040572321

result:

ok 1 number(s): "1040572321"

Test #84:

score: 0
Accepted
time: 102ms
memory: 5828kb

input:

600 100000
1 2
1 3
1 5
1 6
1 7
1 8
1 10
1 12
1 13
1 14
1 15
1 16
1 17
1 18
1 19
1 20
1 22
1 23
1 24
1 25
1 27
1 28
1 31
1 32
1 33
1 34
1 36
1 37
1 38
1 39
1 41
1 43
1 44
1 46
1 47
1 48
1 49
1 50
1 57
1 58
1 60
1 61
1 62
1 63
1 68
1 69
1 72
1 73
1 74
1 76
1 77
1 78
1 79
1 80
1 81
1 82
1 83
1 88
1 89
...

output:

160374127

result:

ok 1 number(s): "160374127"

Test #85:

score: 0
Accepted
time: 101ms
memory: 5576kb

input:

600 100000
1 2
1 4
1 6
1 7
1 9
1 10
1 11
1 12
1 15
1 16
1 21
1 24
1 26
1 27
1 30
1 31
1 32
1 35
1 36
1 37
1 39
1 40
1 41
1 44
1 48
1 50
1 51
1 52
1 53
1 57
1 58
1 62
1 63
1 64
1 65
1 67
1 68
1 69
1 70
1 72
1 73
1 74
1 75
1 76
1 77
1 85
1 88
1 91
1 92
1 95
1 100
1 104
1 106
1 107
1 108
1 111
1 115
1 ...

output:

162932815

result:

ok 1 number(s): "162932815"

Test #86:

score: 0
Accepted
time: 102ms
memory: 5672kb

input:

600 100000
1 5
1 6
1 10
1 12
1 13
1 14
1 15
1 16
1 17
1 18
1 19
1 21
1 25
1 26
1 27
1 28
1 29
1 30
1 31
1 32
1 33
1 34
1 35
1 37
1 38
1 39
1 40
1 45
1 47
1 49
1 50
1 51
1 55
1 56
1 58
1 59
1 60
1 61
1 62
1 63
1 64
1 65
1 66
1 68
1 71
1 72
1 73
1 74
1 77
1 78
1 79
1 85
1 89
1 90
1 94
1 95
1 99
1 100
...

output:

165420959

result:

ok 1 number(s): "165420959"

Test #87:

score: 0
Accepted
time: 101ms
memory: 5520kb

input:

600 100000
1 2
1 3
1 5
1 6
1 8
1 9
1 11
1 16
1 18
1 20
1 22
1 23
1 24
1 26
1 28
1 30
1 32
1 33
1 35
1 36
1 37
1 40
1 41
1 42
1 44
1 47
1 48
1 49
1 50
1 51
1 52
1 53
1 54
1 55
1 58
1 60
1 61
1 62
1 63
1 64
1 65
1 66
1 68
1 69
1 70
1 71
1 72
1 74
1 75
1 76
1 77
1 78
1 79
1 81
1 82
1 84
1 85
1 86
1 90
...

output:

167166857

result:

ok 1 number(s): "167166857"

Test #88:

score: 0
Accepted
time: 102ms
memory: 5868kb

input:

600 100000
1 2
1 3
1 5
1 6
1 7
1 8
1 9
1 10
1 13
1 14
1 15
1 17
1 18
1 19
1 21
1 23
1 24
1 25
1 26
1 29
1 31
1 32
1 36
1 37
1 38
1 40
1 41
1 43
1 44
1 45
1 46
1 48
1 49
1 50
1 52
1 55
1 59
1 61
1 62
1 63
1 65
1 66
1 68
1 70
1 71
1 72
1 73
1 75
1 76
1 77
1 78
1 80
1 81
1 82
1 83
1 84
1 85
1 86
1 94
1...

output:

169803652

result:

ok 1 number(s): "169803652"

Test #89:

score: 0
Accepted
time: 99ms
memory: 5556kb

input:

600 100000
1 2
1 3
1 6
1 7
1 13
1 16
1 18
1 19
1 20
1 21
1 22
1 26
1 27
1 29
1 32
1 34
1 35
1 36
1 37
1 39
1 40
1 41
1 43
1 47
1 48
1 49
1 50
1 51
1 52
1 59
1 60
1 61
1 62
1 63
1 64
1 65
1 66
1 70
1 71
1 72
1 74
1 76
1 77
1 78
1 80
1 83
1 84
1 85
1 86
1 87
1 88
1 89
1 92
1 93
1 94
1 96
1 97
1 98
1 9...

output:

183149390

result:

ok 1 number(s): "183149390"

Test #90:

score: 0
Accepted
time: 99ms
memory: 5500kb

input:

600 100000
1 2
1 3
1 5
1 7
1 8
1 10
1 13
1 15
1 16
1 17
1 18
1 19
1 20
1 21
1 22
1 23
1 24
1 27
1 28
1 29
1 30
1 32
1 33
1 35
1 36
1 37
1 38
1 39
1 40
1 41
1 42
1 43
1 45
1 47
1 50
1 52
1 54
1 55
1 57
1 63
1 65
1 73
1 75
1 77
1 78
1 80
1 84
1 86
1 87
1 88
1 92
1 93
1 94
1 95
1 96
1 97
1 98
1 99
1 10...

output:

211499301

result:

ok 1 number(s): "211499301"

Test #91:

score: 0
Accepted
time: 96ms
memory: 5484kb

input:

600 100000
1 3
1 4
1 6
1 7
1 8
1 9
1 10
1 11
1 12
1 17
1 21
1 23
1 25
1 27
1 28
1 36
1 37
1 39
1 40
1 42
1 44
1 48
1 51
1 52
1 54
1 55
1 59
1 71
1 72
1 73
1 74
1 76
1 79
1 80
1 81
1 82
1 89
1 91
1 93
1 96
1 97
1 98
1 100
1 102
1 103
1 104
1 106
1 107
1 112
1 115
1 116
1 120
1 121
1 123
1 127
1 132
1...

output:

274326296

result:

ok 1 number(s): "274326296"

Test #92:

score: 0
Accepted
time: 97ms
memory: 5408kb

input:

600 100000
1 2
1 3
1 5
1 9
1 11
1 12
1 15
1 17
1 20
1 21
1 22
1 24
1 25
1 27
1 28
1 29
1 31
1 32
1 33
1 34
1 35
1 36
1 38
1 39
1 41
1 42
1 43
1 44
1 45
1 46
1 47
1 48
1 49
1 50
1 51
1 54
1 55
1 58
1 59
1 60
1 61
1 63
1 65
1 66
1 67
1 68
1 69
1 70
1 71
1 74
1 75
1 76
1 78
1 80
1 81
1 83
1 84
1 86
1 8...

output:

399531115

result:

ok 1 number(s): "399531115"

Test #93:

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

input:

600 100000
1 2
1 3
1 4
1 10
1 11
1 12
1 20
1 26
1 29
1 31
1 36
1 37
1 39
1 46
1 48
1 52
1 56
1 60
1 63
1 65
1 67
1 68
1 69
1 70
1 71
1 74
1 77
1 81
1 84
1 87
1 88
1 89
1 91
1 94
1 95
1 96
1 107
1 112
1 113
1 114
1 119
1 121
1 122
1 127
1 131
1 132
1 133
1 134
1 135
1 141
1 143
1 145
1 146
1 151
1 16...

output:

679877940

result:

ok 1 number(s): "679877940"

Test #94:

score: 0
Accepted
time: 97ms
memory: 5716kb

input:

600 100000
1 2
1 3
1 5
1 6
1 7
1 8
1 9
1 11
1 12
1 14
1 16
1 17
1 18
1 19
1 20
1 21
1 22
1 23
1 24
1 25
1 26
1 28
1 29
1 33
1 34
1 37
1 39
1 40
1 41
1 42
1 43
1 44
1 45
1 50
1 51
1 52
1 54
1 57
1 58
1 60
1 61
1 64
1 65
1 66
1 67
1 68
1 69
1 71
1 72
1 73
1 74
1 75
1 76
1 77
1 78
1 79
1 80
1 81
1 82
1...

output:

1643877100

result:

ok 1 number(s): "1643877100"

Test #95:

score: 0
Accepted
time: 65ms
memory: 5312kb

input:

800 100000
1 9
1 11
1 12
1 13
1 15
1 18
1 19
1 21
1 23
1 24
1 34
1 38
1 46
1 48
1 55
1 61
1 72
1 73
1 74
1 76
1 79
1 82
1 83
1 84
1 88
1 90
1 91
1 93
1 95
1 102
1 105
1 109
1 111
1 117
1 118
1 122
1 123
1 125
1 129
1 131
1 135
1 136
1 137
1 141
1 147
1 149
1 150
1 155
1 156
1 157
1 161
1 163
1 166
1...

output:

16617949

result:

ok 1 number(s): "16617949"

Test #96:

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

input:

800 100000
1 2
1 3
1 8
1 10
1 11
1 13
1 15
1 22
1 25
1 30
1 34
1 35
1 40
1 42
1 43
1 44
1 45
1 46
1 48
1 50
1 51
1 53
1 56
1 58
1 60
1 64
1 68
1 69
1 71
1 72
1 73
1 77
1 78
1 82
1 85
1 88
1 99
1 103
1 108
1 109
1 112
1 115
1 117
1 121
1 122
1 127
1 134
1 135
1 137
1 141
1 142
1 146
1 148
1 149
1 152...

output:

17403577

result:

ok 1 number(s): "17403577"

Test #97:

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

input:

800 100000
1 3
1 7
1 10
1 14
1 16
1 17
1 24
1 25
1 28
1 29
1 31
1 36
1 40
1 42
1 54
1 57
1 61
1 70
1 72
1 80
1 81
1 83
1 84
1 85
1 86
1 92
1 93
1 94
1 95
1 96
1 98
1 101
1 103
1 104
1 106
1 110
1 112
1 120
1 127
1 133
1 134
1 138
1 145
1 150
1 153
1 154
1 159
1 160
1 162
1 168
1 169
1 170
1 172
1 17...

output:

18210577

result:

ok 1 number(s): "18210577"

Test #98:

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

input:

800 100000
1 4
1 7
1 8
1 9
1 10
1 14
1 25
1 26
1 27
1 29
1 30
1 31
1 32
1 37
1 38
1 40
1 45
1 46
1 51
1 53
1 54
1 57
1 64
1 65
1 66
1 75
1 76
1 79
1 80
1 91
1 95
1 100
1 105
1 117
1 118
1 120
1 123
1 125
1 126
1 128
1 138
1 142
1 158
1 161
1 163
1 165
1 167
1 168
1 174
1 178
1 183
1 188
1 189
1 192
...

output:

18981058

result:

ok 1 number(s): "18981058"

Test #99:

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

input:

800 100000
1 5
1 6
1 8
1 10
1 20
1 22
1 24
1 28
1 29
1 31
1 36
1 42
1 46
1 47
1 49
1 51
1 54
1 59
1 73
1 74
1 77
1 83
1 84
1 85
1 91
1 94
1 100
1 101
1 103
1 105
1 113
1 116
1 118
1 133
1 138
1 142
1 153
1 155
1 156
1 157
1 158
1 159
1 169
1 170
1 172
1 174
1 183
1 184
1 193
1 207
1 209
1 210
1 216
...

output:

20085449

result:

ok 1 number(s): "20085449"

Test #100:

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

input:

800 100000
1 2
1 3
1 4
1 8
1 9
1 12
1 13
1 14
1 15
1 21
1 22
1 24
1 26
1 39
1 40
1 42
1 46
1 49
1 50
1 51
1 52
1 55
1 56
1 59
1 62
1 63
1 64
1 68
1 69
1 70
1 73
1 74
1 77
1 78
1 79
1 84
1 85
1 96
1 98
1 102
1 104
1 105
1 107
1 108
1 110
1 111
1 114
1 117
1 120
1 121
1 122
1 123
1 125
1 129
1 131
1 1...

output:

26322130

result:

ok 1 number(s): "26322130"

Test #101:

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

input:

800 100000
1 8
1 12
1 13
1 14
1 18
1 19
1 22
1 27
1 29
1 33
1 34
1 35
1 40
1 41
1 43
1 50
1 51
1 55
1 59
1 60
1 66
1 67
1 70
1 74
1 77
1 79
1 80
1 82
1 89
1 94
1 98
1 100
1 101
1 102
1 109
1 110
1 112
1 115
1 120
1 121
1 123
1 125
1 127
1 131
1 134
1 138
1 140
1 142
1 146
1 147
1 151
1 152
1 158
1 1...

output:

40627469

result:

ok 1 number(s): "40627469"

Test #102:

score: 0
Accepted
time: 84ms
memory: 5680kb

input:

800 100000
1 2
1 3
1 8
1 11
1 15
1 25
1 26
1 33
1 36
1 37
1 38
1 39
1 42
1 48
1 49
1 62
1 63
1 67
1 76
1 82
1 85
1 88
1 93
1 98
1 100
1 101
1 104
1 108
1 112
1 126
1 130
1 135
1 136
1 138
1 139
1 141
1 147
1 155
1 156
1 163
1 165
1 175
1 181
1 184
1 188
1 192
1 194
1 208
1 210
1 214
1 221
1 224
1 22...

output:

82200894

result:

ok 1 number(s): "82200894"

Test #103:

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

input:

800 100000
1 6
1 20
1 23
1 31
1 36
1 43
1 49
1 52
1 54
1 62
1 67
1 76
1 78
1 89
1 91
1 92
1 102
1 122
1 123
1 125
1 132
1 133
1 150
1 154
1 157
1 162
1 167
1 173
1 174
1 187
1 189
1 194
1 206
1 207
1 217
1 235
1 237
1 238
1 241
1 242
1 245
1 249
1 252
1 256
1 260
1 268
1 286
1 291
1 296
1 307
1 308
...

output:

190082811

result:

ok 1 number(s): "190082811"

Test #104:

score: 0
Accepted
time: 81ms
memory: 5344kb

input:

800 100000
1 17
1 31
1 37
1 38
1 39
1 44
1 48
1 54
1 56
1 72
1 76
1 77
1 81
1 87
1 89
1 91
1 96
1 101
1 102
1 106
1 107
1 113
1 114
1 116
1 117
1 120
1 121
1 122
1 124
1 128
1 131
1 133
1 136
1 142
1 145
1 146
1 148
1 157
1 159
1 160
1 164
1 168
1 170
1 173
1 175
1 180
1 185
1 188
1 192
1 194
1 197
...

output:

490177131

result:

ok 1 number(s): "490177131"

Test #105:

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

input:

800 100000
1 2
1 5
1 6
1 7
1 8
1 10
1 15
1 19
1 20
1 26
1 27
1 28
1 31
1 32
1 33
1 35
1 36
1 37
1 40
1 42
1 43
1 44
1 47
1 48
1 50
1 52
1 53
1 56
1 58
1 61
1 62
1 63
1 65
1 66
1 68
1 71
1 72
1 73
1 74
1 76
1 79
1 80
1 82
1 83
1 85
1 86
1 87
1 88
1 89
1 90
1 94
1 95
1 96
1 97
1 100
1 101
1 102
1 106
...

output:

1643877100

result:

ok 1 number(s): "1643877100"

Test #106:

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

input:

1000 100000
1 6
1 14
1 19
1 40
1 50
1 53
1 55
1 62
1 66
1 71
1 78
1 84
1 86
1 87
1 90
1 94
1 103
1 104
1 115
1 117
1 127
1 131
1 141
1 148
1 156
1 157
1 167
1 170
1 177
1 178
1 179
1 183
1 188
1 189
1 203
1 206
1 209
1 210
1 214
1 215
1 217
1 239
1 242
1 243
1 246
1 249
1 251
1 256
1 258
1 263
1 267...

output:

2938269

result:

ok 1 number(s): "2938269"

Test #107:

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

input:

1000 100000
1 4
1 16
1 17
1 19
1 23
1 28
1 31
1 34
1 37
1 45
1 52
1 57
1 58
1 65
1 72
1 73
1 78
1 80
1 86
1 93
1 94
1 99
1 103
1 105
1 108
1 111
1 112
1 120
1 121
1 125
1 126
1 130
1 146
1 148
1 151
1 152
1 153
1 161
1 163
1 172
1 182
1 184
1 186
1 193
1 198
1 202
1 209
1 216
1 227
1 230
1 236
1 241...

output:

3211626

result:

ok 1 number(s): "3211626"

Test #108:

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

input:

1000 100000
1 5
1 8
1 14
1 16
1 17
1 18
1 27
1 28
1 36
1 43
1 44
1 56
1 57
1 59
1 64
1 66
1 73
1 75
1 80
1 81
1 82
1 100
1 104
1 105
1 106
1 111
1 122
1 133
1 163
1 169
1 172
1 179
1 182
1 183
1 194
1 195
1 197
1 207
1 215
1 229
1 238
1 244
1 247
1 273
1 289
1 292
1 300
1 311
1 316
1 326
1 330
1 338...

output:

3498752

result:

ok 1 number(s): "3498752"

Test #109:

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

input:

1000 100000
1 2
1 13
1 19
1 22
1 26
1 30
1 34
1 35
1 37
1 40
1 60
1 63
1 76
1 77
1 78
1 88
1 89
1 92
1 105
1 111
1 117
1 139
1 145
1 147
1 148
1 150
1 160
1 161
1 169
1 173
1 174
1 185
1 186
1 187
1 193
1 195
1 202
1 206
1 208
1 211
1 218
1 225
1 227
1 231
1 246
1 252
1 253
1 260
1 270
1 272
1 276
1...

output:

3859059

result:

ok 1 number(s): "3859059"

Test #110:

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

input:

1000 100000
1 8
1 9
1 10
1 16
1 19
1 21
1 23
1 36
1 38
1 40
1 60
1 62
1 64
1 75
1 78
1 80
1 87
1 90
1 94
1 99
1 102
1 106
1 115
1 117
1 120
1 143
1 149
1 150
1 160
1 164
1 169
1 172
1 174
1 181
1 189
1 190
1 191
1 204
1 210
1 216
1 226
1 228
1 230
1 233
1 240
1 242
1 243
1 247
1 250
1 252
1 253
1 26...

output:

4175038

result:

ok 1 number(s): "4175038"

Test #111:

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

input:

1000 100000
1 7
1 8
1 13
1 17
1 22
1 26
1 28
1 29
1 32
1 34
1 40
1 47
1 50
1 53
1 61
1 67
1 70
1 71
1 78
1 80
1 83
1 96
1 98
1 107
1 112
1 115
1 121
1 123
1 125
1 128
1 130
1 131
1 136
1 140
1 153
1 157
1 159
1 168
1 173
1 175
1 180
1 185
1 188
1 198
1 201
1 207
1 209
1 213
1 215
1 219
1 223
1 227
1...

output:

7273750

result:

ok 1 number(s): "7273750"

Test #112:

score: 0
Accepted
time: 62ms
memory: 5400kb

input:

1000 100000
1 3
1 7
1 17
1 20
1 27
1 28
1 32
1 33
1 37
1 38
1 40
1 43
1 44
1 45
1 46
1 47
1 56
1 58
1 60
1 65
1 72
1 77
1 80
1 82
1 83
1 90
1 94
1 95
1 104
1 110
1 114
1 117
1 119
1 129
1 134
1 141
1 144
1 146
1 147
1 149
1 156
1 163
1 166
1 168
1 169
1 176
1 180
1 181
1 204
1 212
1 221
1 225
1 232
...

output:

15391251

result:

ok 1 number(s): "15391251"

Test #113:

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

input:

1000 100000
1 11
1 18
1 19
1 22
1 29
1 32
1 35
1 42
1 43
1 67
1 68
1 71
1 76
1 88
1 95
1 96
1 105
1 107
1 109
1 110
1 115
1 116
1 118
1 124
1 130
1 134
1 141
1 143
1 145
1 152
1 155
1 156
1 158
1 162
1 164
1 181
1 184
1 185
1 186
1 187
1 194
1 197
1 198
1 200
1 201
1 210
1 211
1 213
1 218
1 229
1 23...

output:

42620541

result:

ok 1 number(s): "42620541"

Test #114:

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

input:

1000 100000
2 4
2 5
2 7
2 10
2 11
2 13
2 14
2 18
2 20
2 26
2 46
2 51
2 57
2 64
2 66
2 78
2 79
2 88
2 90
2 91
2 96
2 102
2 114
2 118
2 119
2 120
2 123
2 127
2 129
2 133
2 134
2 140
2 146
2 149
2 163
2 167
2 172
2 173
2 177
2 178
2 181
2 189
2 196
2 197
2 198
2 200
2 212
2 213
2 216
2 223
2 225
2 231
...

output:

134751113

result:

ok 1 number(s): "134751113"

Test #115:

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

input:

1000 100000
2 5
2 6
2 8
2 10
2 11
2 12
2 13
2 14
2 16
2 17
2 23
2 27
2 28
2 30
2 31
2 34
2 36
2 37
2 39
2 41
2 43
2 44
2 46
2 47
2 49
2 52
2 56
2 60
2 61
2 62
2 63
2 68
2 69
2 71
2 74
2 75
2 77
2 79
2 81
2 82
2 83
2 85
2 87
2 89
2 91
2 92
2 96
2 100
2 101
2 103
2 104
2 107
2 109
2 110
2 112
2 113
2 ...

output:

437318793

result:

ok 1 number(s): "437318793"

Test #116:

score: 0
Accepted
time: 96ms
memory: 5896kb

input:

1000 100000
6 7
6 8
6 10
6 12
6 13
6 18
6 23
6 25
6 27
6 33
6 34
6 39
6 41
6 42
6 45
6 49
6 52
6 53
6 55
6 58
6 59
6 60
6 61
6 63
6 67
6 68
6 69
6 70
6 71
6 72
6 74
6 75
6 79
6 80
6 86
6 87
6 89
6 91
6 93
6 94
6 95
6 100
6 102
6 103
6 108
6 110
6 112
6 116
6 117
6 118
6 119
6 124
6 126
6 127
6 129
6...

output:

1643877100

result:

ok 1 number(s): "1643877100"

Test #117:

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

input:

1000 100000
1 14
1 19
1 21
1 25
1 67
1 69
1 87
1 105
1 113
1 129
1 132
1 135
1 136
1 141
1 160
1 178
1 184
1 190
1 194
1 196
1 198
1 202
1 215
1 217
1 218
1 233
1 238
1 239
1 241
1 248
1 267
1 268
1 277
1 282
1 286
1 295
1 310
1 313
1 319
1 328
1 332
1 336
1 347
1 358
1 359
1 374
1 377
1 389
1 428
1...

output:

224320950

result:

ok 1 number(s): "224320950"

Test #118:

score: 0
Accepted
time: 27ms
memory: 5464kb

input:

2000 100000
1 10
1 82
1 106
1 113
1 144
1 158
1 159
1 171
1 191
1 222
1 258
1 292
1 303
1 315
1 403
1 409
1 417
1 427
1 437
1 458
1 461
1 486
1 513
1 557
1 680
1 710
1 724
1 742
1 753
1 774
1 798
1 799
1 840
1 878
1 886
1 890
1 900
1 903
1 907
1 925
1 926
1 936
1 957
1 971
1 1002
1 1054
1 1057
1 107...

output:

19256

result:

ok 1 number(s): "19256"

Test #119:

score: 0
Accepted
time: 23ms
memory: 5476kb

input:

2000 100000
1 3
1 31
1 47
1 52
1 58
1 60
1 65
1 104
1 123
1 155
1 186
1 194
1 211
1 240
1 241
1 251
1 264
1 334
1 338
1 364
1 397
1 418
1 507
1 535
1 558
1 569
1 586
1 595
1 602
1 606
1 615
1 617
1 641
1 655
1 665
1 670
1 701
1 707
1 725
1 731
1 758
1 762
1 773
1 801
1 804
1 817
1 826
1 842
1 861
1 ...

output:

44926

result:

ok 1 number(s): "44926"

Test #120:

score: 0
Accepted
time: 27ms
memory: 5668kb

input:

2000 100000
1 20
1 56
1 61
1 67
1 70
1 130
1 138
1 200
1 216
1 221
1 263
1 279
1 334
1 348
1 350
1 366
1 416
1 420
1 432
1 433
1 450
1 486
1 487
1 514
1 547
1 552
1 564
1 576
1 632
1 660
1 696
1 769
1 820
1 839
1 857
1 924
1 988
1 1018
1 1036
1 1109
1 1146
1 1150
1 1153
1 1238
1 1252
1 1280
1 1326
1...

output:

87930

result:

ok 1 number(s): "87930"

Test #121:

score: 0
Accepted
time: 27ms
memory: 5428kb

input:

2000 100000
1 8
1 21
1 28
1 72
1 76
1 102
1 107
1 116
1 128
1 130
1 134
1 199
1 222
1 230
1 252
1 257
1 259
1 263
1 284
1 286
1 311
1 315
1 333
1 355
1 359
1 360
1 368
1 373
1 419
1 435
1 452
1 470
1 481
1 508
1 510
1 525
1 529
1 542
1 547
1 575
1 622
1 636
1 685
1 692
1 693
1 734
1 752
1 762
1 818
...

output:

147698

result:

ok 1 number(s): "147698"

Test #122:

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

input:

2000 100000
1 64
1 75
1 77
1 79
1 89
1 91
1 101
1 114
1 117
1 123
1 142
1 152
1 154
1 172
1 178
1 188
1 197
1 199
1 200
1 241
1 254
1 268
1 291
1 322
1 342
1 353
1 354
1 362
1 371
1 376
1 379
1 407
1 432
1 446
1 448
1 460
1 466
1 474
1 502
1 513
1 517
1 524
1 531
1 538
1 542
1 607
1 629
1 640
1 656
...

output:

226428

result:

ok 1 number(s): "226428"

Test #123:

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

input:

2000 100000
1 27
1 28
1 29
1 95
1 109
1 124
1 156
1 205
1 299
1 304
1 335
1 341
1 364
1 373
1 412
1 428
1 467
1 513
1 570
1 660
1 715
1 716
1 727
1 738
1 742
1 752
1 759
1 764
1 789
1 924
1 928
1 936
1 985
1 1017
1 1046
1 1067
1 1086
1 1093
1 1186
1 1268
1 1374
1 1382
1 1393
1 1416
1 1470
1 1523
1 1...

output:

1253258

result:

ok 1 number(s): "1253258"

Test #124:

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

input:

2000 100000
1 23
1 38
1 41
1 42
1 76
1 91
1 96
1 111
1 124
1 172
1 200
1 225
1 228
1 248
1 268
1 289
1 304
1 310
1 315
1 317
1 375
1 418
1 455
1 491
1 513
1 525
1 611
1 658
1 663
1 690
1 787
1 797
1 863
1 901
1 975
1 978
1 984
1 986
1 1005
1 1028
1 1072
1 1075
1 1107
1 1128
1 1135
1 1151
1 1152
1 11...

output:

5826286

result:

ok 1 number(s): "5826286"

Test #125:

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

input:

2000 100000
1 3
1 56
1 71
1 94
1 110
1 147
1 182
1 396
1 411
1 452
1 481
1 517
1 527
1 550
1 558
1 605
1 625
1 665
1 720
1 753
1 758
1 875
1 899
1 930
1 1038
1 1096
1 1151
1 1171
1 1179
1 1185
1 1210
1 1212
1 1246
1 1254
1 1329
1 1342
1 1370
1 1431
1 1440
1 1508
1 1527
1 1555
1 1584
1 1625
1 1657
1 ...

output:

24942932

result:

ok 1 number(s): "24942932"

Test #126:

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

input:

2000 100000
1 5
1 7
1 20
1 36
1 43
1 52
1 89
1 100
1 153
1 170
1 186
1 227
1 247
1 257
1 309
1 330
1 332
1 339
1 343
1 363
1 369
1 403
1 419
1 423
1 425
1 433
1 437
1 459
1 465
1 472
1 488
1 504
1 523
1 558
1 569
1 571
1 573
1 579
1 585
1 586
1 596
1 617
1 626
1 631
1 640
1 671
1 715
1 720
1 726
1 7...

output:

101297598

result:

ok 1 number(s): "101297598"

Test #127:

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

input:

2000 100000
1 25
1 46
1 64
1 95
1 114
1 125
1 131
1 136
1 155
1 162
1 165
1 171
1 183
1 208
1 216
1 218
1 226
1 227
1 249
1 259
1 260
1 268
1 293
1 294
1 297
1 304
1 311
1 312
1 316
1 325
1 333
1 341
1 343
1 347
1 351
1 365
1 371
1 372
1 376
1 382
1 390
1 393
1 400
1 405
1 419
1 421
1 422
1 441
1 44...

output:

410054667

result:

ok 1 number(s): "410054667"

Test #128:

score: 0
Accepted
time: 93ms
memory: 5788kb

input:

2000 100000
13 14
13 16
13 20
13 21
13 24
13 46
13 49
13 50
13 59
13 60
13 61
13 63
13 65
13 73
13 75
13 85
13 87
13 89
13 90
13 91
13 93
13 94
13 99
13 107
13 119
13 128
13 129
13 140
13 141
13 142
13 143
13 144
13 145
13 156
13 158
13 163
13 169
13 171
13 172
13 187
13 188
13 189
13 198
13 200
13 ...

output:

1643877100

result:

ok 1 number(s): "1643877100"

Test #129:

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

input:

2000 100000
2 11
2 20
2 42
2 47
2 62
2 101
2 113
2 124
2 150
2 165
2 178
2 194
2 214
2 247
2 275
2 294
2 339
2 343
2 365
2 377
2 387
2 393
2 402
2 432
2 465
2 470
2 479
2 484
2 558
2 565
2 579
2 582
2 585
2 599
2 648
2 654
2 687
2 690
2 731
2 776
2 782
2 783
2 793
2 848
2 892
2 901
2 931
2 951
2 954...

output:

224320950

result:

ok 1 number(s): "224320950"

Test #130:

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

input:

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

output:

50404970

result:

ok 1 number(s): "50404970"

Test #131:

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

input:

4000 100000
1 36
1 191
1 243
1 250
1 359
1 438
1 443
1 502
1 617
1 845
1 1041
1 1065
1 1247
1 1334
1 1469
1 1588
1 1830
1 1843
1 2029
1 2065
1 2088
1 2139
1 2149
1 2189
1 2396
1 2520
1 2680
1 2727
1 2821
1 2856
1 2872
1 2888
1 2947
1 3107
1 3141
1 3148
1 3182
1 3234
1 3248
1 3439
1 3756
1 3871
1 388...

output:

313

result:

ok 1 number(s): "313"

Test #132:

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

input:

4000 100000
1 30
1 59
1 69
1 77
1 157
1 187
1 400
1 402
1 455
1 715
1 793
1 816
1 817
1 860
1 947
1 995
1 1005
1 1015
1 1044
1 1178
1 1199
1 1206
1 1544
1 1879
1 1907
1 1929
1 1991
1 2023
1 2033
1 2200
1 2206
1 2235
1 2307
1 2308
1 2605
1 2674
1 2879
1 2944
1 3223
1 3277
1 3329
1 3342
1 3451
1 3480
...

output:

17353

result:

ok 1 number(s): "17353"

Test #133:

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

input:

4000 100000
1 52
1 74
1 239
1 292
1 322
1 344
1 451
1 504
1 527
1 593
1 643
1 658
1 680
1 769
1 771
1 877
1 1023
1 1042
1 1391
1 1413
1 1424
1 1478
1 1505
1 1577
1 1579
1 1748
1 1916
1 2029
1 2051
1 2071
1 2118
1 2444
1 2514
1 2590
1 2612
1 2706
1 2823
1 2863
1 2906
1 2959
1 3074
1 3246
1 3313
1 341...

output:

51165

result:

ok 1 number(s): "51165"

Test #134:

score: 0
Accepted
time: 23ms
memory: 5860kb

input:

4000 100000
1 6
1 198
1 218
1 296
1 346
1 565
1 576
1 733
1 735
1 819
1 827
1 868
1 976
1 1023
1 1108
1 1109
1 1119
1 1166
1 1179
1 1183
1 1203
1 1239
1 1242
1 1261
1 1353
1 1361
1 1387
1 1433
1 1461
1 1524
1 1573
1 1584
1 1593
1 1629
1 1722
1 1890
1 1985
1 2038
1 2049
1 2100
1 2184
1 2195
1 2256
1 ...

output:

101930

result:

ok 1 number(s): "101930"

Test #135:

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

input:

4000 100000
1 39
1 87
1 157
1 347
1 389
1 401
1 462
1 481
1 538
1 560
1 574
1 584
1 680
1 808
1 844
1 899
1 1039
1 1056
1 1226
1 1631
1 1825
1 1841
1 1965
1 2037
1 2146
1 2179
1 2298
1 2482
1 2516
1 2678
1 2724
1 2835
1 2925
1 3007
1 3168
1 3180
1 3223
1 3250
1 3279
1 3298
1 3320
1 3389
1 3477
1 369...

output:

169258

result:

ok 1 number(s): "169258"

Test #136:

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

input:

4000 100000
1 54
1 151
1 208
1 267
1 322
1 406
1 443
1 631
1 853
1 1089
1 1099
1 1172
1 1247
1 1261
1 1314
1 1350
1 1367
1 1428
1 1517
1 1570
1 1581
1 1717
1 1787
1 1878
1 1888
1 1925
1 2063
1 2076
1 2136
1 2179
1 2244
1 2252
1 2269
1 2323
1 2324
1 2438
1 2546
1 2556
1 2564
1 2579
1 2633
1 2686
1 27...

output:

1111561

result:

ok 1 number(s): "1111561"

Test #137:

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

input:

4000 100000
1 134
1 261
1 265
1 287
1 361
1 384
1 424
1 447
1 526
1 608
1 827
1 881
1 896
1 897
1 906
1 939
1 945
1 1009
1 1279
1 1281
1 1294
1 1367
1 1408
1 1427
1 1439
1 1642
1 2032
1 2127
1 2142
1 2164
1 2225
1 2452
1 2464
1 2588
1 2641
1 2707
1 2729
1 2734
1 2835
1 2852
1 2941
1 3113
1 3119
1 32...

output:

5456626

result:

ok 1 number(s): "5456626"

Test #138:

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

input:

4000 100000
2 60
2 63
2 74
2 82
2 155
2 274
2 388
2 415
2 452
2 485
2 620
2 623
2 630
2 682
2 722
2 727
2 946
2 1009
2 1015
2 1063
2 1162
2 1166
2 1318
2 1340
2 1464
2 1489
2 1546
2 1548
2 1594
2 1614
2 1830
2 1974
2 2155
2 2238
2 2261
2 2284
2 2362
2 2386
2 2524
2 2548
2 2661
2 2773
2 2971
2 3023
2...

output:

23910221

result:

ok 1 number(s): "23910221"

Test #139:

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

input:

4000 100000
4 7
4 10
4 22
4 30
4 37
4 41
4 51
4 55
4 65
4 69
4 70
4 82
4 102
4 103
4 129
4 156
4 209
4 210
4 225
4 273
4 277
4 295
4 296
4 298
4 313
4 335
4 338
4 407
4 412
4 422
4 460
4 490
4 505
4 523
4 532
4 536
4 566
4 575
4 584
4 590
4 606
4 613
4 629
4 665
4 666
4 668
4 672
4 698
4 748
4 763
4...

output:

99485726

result:

ok 1 number(s): "99485726"

Test #140:

score: 0
Accepted
time: 57ms
memory: 5412kb

input:

4000 100000
1 20
1 44
1 46
1 51
1 63
1 90
1 104
1 108
1 149
1 151
1 178
1 195
1 227
1 232
1 235
1 291
1 301
1 303
1 329
1 342
1 343
1 367
1 488
1 495
1 515
1 528
1 537
1 574
1 585
1 621
1 688
1 699
1 752
1 802
1 807
1 852
1 872
1 896
1 897
1 898
1 921
1 943
1 989
1 997
1 1003
1 1008
1 1037
1 1060
1 ...

output:

408518099

result:

ok 1 number(s): "408518099"

Test #141:

score: 0
Accepted
time: 93ms
memory: 6100kb

input:

4000 100000
11 28
11 31
11 35
11 42
11 63
11 84
11 87
11 92
11 113
11 157
11 159
11 165
11 171
11 191
11 196
11 206
11 213
11 219
11 221
11 257
11 261
11 272
11 282
11 286
11 291
11 308
11 310
11 311
11 313
11 317
11 324
11 353
11 369
11 373
11 390
11 397
11 410
11 412
11 414
11 430
11 436
11 437
11...

output:

1643877100

result:

ok 1 number(s): "1643877100"

Test #142:

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

input:

4000 100000
3 38
3 41
3 44
3 111
3 119
3 154
3 181
3 204
3 210
3 248
3 267
3 301
3 374
3 504
3 551
3 601
3 658
3 673
3 685
3 827
3 943
3 954
3 963
3 981
3 1036
3 1080
3 1084
3 1230
3 1240
3 1300
3 1382
3 1413
3 1438
3 1460
3 1538
3 1571
3 1609
3 1650
3 1651
3 1690
3 1731
3 1737
3 1848
3 1862
3 1868
...

output:

224320950

result:

ok 1 number(s): "224320950"

Test #143:

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

input:

4000 100000
1 32
1 86
1 135
1 222
1 320
1 883
1 886
1 1138
1 1257
1 1423
1 1484
1 1492
1 1648
1 1670
1 1719
1 2014
1 2191
1 2678
1 2913
1 3002
1 3146
1 3159
1 3222
1 3497
1 3537
1 3756
1 3855
1 3994
2 32
2 86
2 135
2 222
2 320
2 883
2 886
2 1138
2 1257
2 1423
2 1484
2 1492
2 1648
2 1670
2 1719
2 201...

output:

11690343

result:

ok 1 number(s): "11690343"

Test #144:

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

input:

8000 100000
1 873
1 981
1 1190
1 1253
1 3125
1 3243
1 3324
1 3339
1 3584
1 3820
1 4567
1 4797
1 5169
1 5463
1 6305
1 6386
1 6857
1 7366
2 283
2 594
2 1003
2 1025
2 1315
2 1954
2 2047
2 2084
2 2193
2 2744
2 3362
2 3414
2 3929
2 3996
2 5002
2 5242
2 5641
2 6532
3 155
3 426
3 551
3 755
3 828
3 1248
3 1...

output:

12

result:

ok 1 number(s): "12"

Test #145:

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

input:

8000 100000
1 789
1 870
1 1092
1 1235
1 1251
1 1646
1 1996
1 2296
1 2635
1 2831
1 3041
1 3094
1 3508
1 3574
1 3579
1 3786
1 3990
1 4025
1 4270
1 4353
1 6005
1 6090
1 6178
1 6226
1 6973
1 7574
1 7629
2 268
2 507
2 627
2 799
2 1246
2 1269
2 1933
2 1934
2 2066
2 2406
2 3287
2 3399
2 3400
2 3571
2 3605
...

output:

16707

result:

ok 1 number(s): "16707"

Test #146:

score: 0
Accepted
time: 23ms
memory: 5444kb

input:

8000 100000
1 20
1 64
1 325
1 894
1 1016
1 1281
1 1302
1 1442
1 2206
1 2422
1 3030
1 3964
1 4135
1 4775
1 5506
1 5753
1 6786
1 6963
1 7490
1 7938
2 56
2 83
2 538
2 796
2 1034
2 1105
2 1554
2 1635
2 1948
2 2102
2 2471
2 2538
2 2604
2 2680
2 3029
2 3080
2 3111
2 3160
2 3405
2 3525
2 3580
2 3619
2 3864...

output:

50126

result:

ok 1 number(s): "50126"

Test #147:

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

input:

8000 100000
1 727
1 1552
1 1752
1 4388
1 4436
2 156
2 301
2 398
2 402
2 680
2 737
2 772
2 936
2 954
2 1334
2 1346
2 1446
2 1470
2 1581
2 1837
2 1886
2 1924
2 2995
2 3159
2 3228
2 3238
2 3254
2 3362
2 3421
2 3549
2 3744
2 3825
2 3846
2 4094
2 4264
2 4597
2 5097
2 5397
2 5488
2 5664
2 5843
2 6071
2 61...

output:

100193

result:

ok 1 number(s): "100193"

Test #148:

score: 0
Accepted
time: 25ms
memory: 5832kb

input:

8000 100000
1 30
1 85
1 107
1 150
1 736
1 1058
1 1198
1 1239
1 1758
1 1806
1 1979
1 2098
1 2851
1 3020
1 3099
1 3368
1 3494
1 4076
1 4319
1 4381
1 4593
1 4696
1 4797
1 5179
1 5510
1 5994
1 6300
1 6358
1 6387
1 6690
1 6896
1 7051
1 7195
1 7432
1 7586
1 7681
2 649
2 719
2 741
2 1616
2 1786
2 2183
2 28...

output:

166996

result:

ok 1 number(s): "166996"

Test #149:

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

input:

8000 100000
1 15
1 105
1 576
1 1148
1 1321
1 1518
1 1569
1 1710
1 2138
1 2347
1 3779
1 4686
1 4881
1 4982
1 5120
1 5125
1 5258
1 5439
1 6024
1 6147
1 6313
1 7115
1 7163
1 7468
1 7542
1 7926
3 229
3 396
3 436
3 471
3 888
3 928
3 1155
3 1178
3 1975
3 2436
3 2610
3 2660
3 3153
3 3309
3 3457
3 3963
3 40...

output:

1101478

result:

ok 1 number(s): "1101478"

Test #150:

score: 0
Accepted
time: 23ms
memory: 6024kb

input:

16000 100000
1 57
1 1218
1 2343
1 3164
1 3390
1 4946
1 5261
1 5405
1 5968
1 7832
1 7837
1 8703
1 8916
1 9289
1 11412
1 13338
1 14351
1 14679
2 3248
2 3869
2 4340
2 6359
2 11163
2 11618
2 12240
2 12689
2 13171
2 14013
2 14724
2 15052
3 1046
3 2323
3 3426
3 4103
3 4311
3 4323
3 4387
3 12328
4 1123
4 1...

output:

0

result:

ok 1 number(s): "0"

Test #151:

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

input:

16000 100000
1 579
1 4574
1 8168
1 9777
1 13027
1 13146
2 4016
2 9414
2 14076
3 1900
3 1973
3 2829
3 5089
3 6438
3 9127
3 10386
3 11822
3 12048
3 12091
3 14079
3 15965
4 3649
4 5157
4 9452
4 9716
4 12062
4 13581
5 3300
5 3311
5 4642
5 5388
5 9141
5 9323
5 10705
5 10992
5 12485
5 14801
5 14889
5 1595...

output:

16672

result:

ok 1 number(s): "16672"

Test #152:

score: 0
Accepted
time: 25ms
memory: 6020kb

input:

16000 100000
1 494
1 521
1 657
1 1481
1 1614
1 3566
1 3825
1 4761
1 4980
1 12393
1 12929
1 13790
2 713
2 875
2 2456
2 3880
2 4029
2 4837
2 7362
2 9736
2 12596
2 13701
2 14075
2 14726
3 540
3 5010
3 5958
3 6028
3 7455
3 9726
3 10688
3 10962
3 13300
3 13906
3 14266
3 15091
4 1242
4 1364
4 3163
4 3754
...

output:

50020

result:

ok 1 number(s): "50020"

Test #153:

score: 0
Accepted
time: 27ms
memory: 6276kb

input:

16000 100000
1 126
1 1977
1 2127
1 2565
1 4425
1 7418
1 7902
1 9077
1 9469
1 14680
2 1085
2 2096
2 3024
2 3558
2 5447
2 5534
2 5624
2 5915
2 5979
2 9277
2 12039
2 12522
2 14673
2 15303
2 15599
3 1967
3 3399
3 4200
3 4516
3 4908
3 5169
3 5429
3 7703
3 10327
3 11501
3 11799
3 12142
3 12542
3 14455
3 1...

output:

100037

result:

ok 1 number(s): "100037"

Test #154:

score: 0
Accepted
time: 25ms
memory: 6332kb

input:

16000 100000
1 1440
1 2185
1 2358
1 2412
1 2666
1 5633
1 7066
1 7384
1 7397
1 8748
1 13445
1 14429
2 96
2 754
2 4330
2 4441
2 5017
2 5351
2 7768
2 9316
2 11009
2 13852
2 14103
2 15925
3 813
3 1537
3 2134
3 2294
3 3926
3 5736
3 6124
3 6335
3 6981
3 8008
3 8960
3 9178
3 9375
3 9468
3 10270
3 13369
3 1...

output:

166741

result:

ok 1 number(s): "166741"

Test #155:

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

input:

16000 100000
4 25
4 1830
4 2447
4 2702
4 4344
4 5853
4 6258
4 6620
4 8170
4 9214
4 9233
4 10131
4 12620
6 40
6 262
6 1497
6 1631
6 1786
6 2044
6 2603
6 2690
6 3249
6 3610
6 3918
6 6213
6 6600
6 6680
6 7151
6 8074
6 8112
6 9159
6 9209
6 9719
6 10758
6 14116
6 15299
6 15305
6 15359
6 15508
7 4466
7 48...

output:

1100111

result:

ok 1 number(s): "1100111"

Test #156:

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

input:

32000 100000
1 12383
1 12617
1 13984
1 19935
1 22327
1 30081
3 16741
3 28276
5 114
5 452
5 2513
5 5025
5 8940
5 10880
5 14215
5 16608
5 19105
5 20219
5 21686
5 25452
5 26606
5 27945
6 16149
6 29644
7 4260
7 4669
7 12016
7 12524
7 16259
7 17116
7 18225
7 19034
7 21451
7 22415
7 23165
7 27427
8 898
8 ...

output:

0

result:

ok 1 number(s): "0"

Test #157:

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

input:

32000 100000
2 1686
2 5861
2 15694
2 20041
2 23190
2 25582
3 1929
3 9989
3 17965
3 19183
3 24775
3 28149
3 28377
3 29636
3 30812
4 914
4 1123
4 12454
6 354
6 6548
6 9095
6 15642
6 24888
6 31404
7 7348
7 9514
7 9823
7 9991
7 10581
7 12301
7 18396
7 25243
7 30269
8 6324
8 24027
8 29804
9 119
9 1970
9 ...

output:

16669

result:

ok 1 number(s): "16669"

Test #158:

score: 0
Accepted
time: 24ms
memory: 7140kb

input:

32000 100000
2 1516
2 4080
2 4210
2 5550
2 6857
2 8667
2 12236
2 13997
2 14050
2 17870
2 20112
2 20374
2 22092
2 22446
2 22739
2 23664
2 26763
2 27850
2 29247
2 30217
3 2947
3 8744
3 10304
3 12269
3 13907
3 17918
3 20067
3 22629
3 23327
3 25583
3 26878
3 27189
4 1497
4 1741
4 5229
4 11024
4 11971
4 ...

output:

50000

result:

ok 1 number(s): "50000"

Test #159:

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

input:

32000 100000
1 196
1 371
1 2422
1 4579
1 10031
1 14753
1 18406
1 19582
1 19717
1 20759
1 21177
1 24565
1 26713
1 26726
1 31501
2 1877
2 2841
2 3122
2 4871
2 6216
2 16283
2 16987
2 17746
2 21478
2 21675
2 24845
2 24964
2 25030
2 30397
2 31855
4 532
4 1607
4 9521
4 14391
4 18020
5 8928
5 9182
5 14348
...

output:

100005

result:

ok 1 number(s): "100005"

Test #160:

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

input:

32000 100000
2 3507
2 10093
2 10128
2 16619
2 18621
2 24071
3 429
3 1717
3 2143
3 10261
3 11305
3 11528
3 11670
3 13246
3 17290
3 17768
3 17873
3 18458
3 19212
3 20141
3 20148
3 20901
3 21169
3 21342
3 21477
3 25741
3 26963
3 29665
3 30431
3 31162
4 2430
4 2588
4 8396
4 13648
4 24348
4 26500
8 785
8...

output:

166670

result:

ok 1 number(s): "166670"

Test #161:

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

input:

32000 100000
1 289
1 6694
1 11508
1 15788
1 16785
1 17875
1 18462
1 18576
1 18842
1 22412
1 23130
1 24744
1 25249
2 4211
2 5507
2 8873
2 9169
2 11481
2 12792
2 21165
2 21452
2 23126
2 25855
2 29412
2 30528
2 31450
3 259
3 3851
3 10861
3 12391
3 15460
3 16698
3 17838
3 21618
3 22619
3 25287
3 27123
3...

output:

1100099

result:

ok 1 number(s): "1100099"

Test #162:

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

input:

64000 100000
1 4639
1 30731
1 41686
1 62420
2 24118
2 59235
4 8269
4 33298
4 35474
4 46890
4 56843
4 62978
5 44828
5 57595
6 36311
6 40727
9 13569
9 25257
9 37823
9 54748
10 7524
10 18760
12 17592
12 18962
12 52196
12 55964
13 51267
13 54774
14 1151
14 5473
14 11234
14 19532
14 39356
14 44088
14 493...

output:

0

result:

ok 1 number(s): "0"

Test #163:

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

input:

64000 100000
1 99
1 25114
1 29301
4 232
4 19041
4 24474
4 26322
4 35032
4 60317
5 5490
5 6630
5 12650
5 20160
5 20484
5 38087
5 41929
5 45713
5 62201
7 15280
7 39347
7 44266
8 7642
8 9193
8 19918
8 27998
8 46250
8 51237
11 15143
11 42093
11 52985
12 2590
12 48321
12 57386
13 2060
13 13507
13 27675
1...

output:

16667

result:

ok 1 number(s): "16667"

Test #164:

score: 0
Accepted
time: 27ms
memory: 9120kb

input:

64000 100000
4 16727
4 18979
4 22459
4 27814
6 19178
6 29574
6 34910
6 42603
6 47083
6 51309
6 54820
6 55173
8 9993
8 14307
8 25536
8 32220
8 39692
8 41868
8 42431
8 42873
8 44998
8 45899
8 46232
8 48775
8 59397
8 60879
8 62047
8 63419
9 1213
9 4087
9 49600
9 62258
10 1299
10 48759
10 57053
10 58262...

output:

50000

result:

ok 1 number(s): "50000"

Test #165:

score: 0
Accepted
time: 27ms
memory: 9424kb

input:

64000 100000
2 34789
2 41347
2 45073
2 46955
2 50468
3 13220
3 20270
3 25515
3 36777
3 60340
5 13520
5 38096
5 40723
5 53722
5 61948
7 328
7 10475
7 11674
7 42764
7 46206
7 46728
7 52644
7 56116
7 57248
7 61069
9 19368
9 26354
9 32563
9 54714
9 59361
10 14240
10 26655
10 37136
10 48920
10 60407
11 7...

output:

99991

result:

ok 1 number(s): "99991"

Test #166:

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

input:

64000 100000
6 3294
6 14985
6 32574
6 37379
6 43598
6 49402
11 1692
11 6459
11 7217
11 9515
11 17643
11 24104
11 25426
11 28101
11 28354
11 38894
11 49190
11 62271
12 7262
12 7354
12 8838
12 13048
12 30027
12 58562
13 10262
13 18000
13 26294
13 35885
13 59055
13 63791
14 33
14 4792
14 5069
14 15610
...

output:

166670

result:

ok 1 number(s): "166670"

Test #167:

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

input:

64000 100000
4 15650
4 18147
4 25070
4 28459
4 29820
4 30225
4 38392
4 39069
4 42064
4 42078
4 43242
4 46342
4 53171
8 92
8 669
8 15406
8 19527
8 20009
8 27811
8 35898
8 35907
8 46088
8 47484
8 48817
8 53442
8 59221
15 5007
15 10255
15 12122
15 22927
15 42003
15 44569
15 47384
15 48550
15 52760
15 5...

output:

1099788

result:

ok 1 number(s): "1099788"