QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#870031#8618. Have You Seen This Subarray?ucup-team4478#AC ✓655ms14128kbC++202.5kb2025-01-25 14:30:402025-01-25 14:30:49

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3584kb

input:

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

output:

1
3
0
2
3

result:

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

Test #2:

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

input:

50 50 16
21 30
14 39
5 32
31 48
38 50
40 49
14 33
32 42
7 15
5 25
24 28
8 10
18 24
5 39
4 37
9 28
29 39
2 35
11 32
48 49
12 17
38 44
26 33
12 40
19 49
40 41
17 18
20 30
11 15
21 36
37 38
7 48
17 21
8 38
30 34
3 31
7 12
31 47
2 37
20 41
13 40
33 39
10 49
19 40
12 30
23 28
9 45
27 32
4 37
27 29
2 44 4...

output:

0
29
44
22
23
18
1
37
3
16
0
16
0
13
0
0

result:

ok 16 numbers

Test #3:

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

input:

500 500 165
5 424
246 385
355 428
43 338
214 378
286 469
6 467
149 333
203 411
7 111
395 483
256 288
69 414
33 429
159 425
22 470
13 425
235 292
291 412
76 224
64 207
198 365
268 314
116 366
338 386
58 265
328 330
146 493
89 288
120 465
187 201
336 499
406 485
195 406
56 485
410 424
125 149
154 216
...

output:

68
77
385
0
391
119
0
443
216
0
0
420
0
136
434
0
163
77
410
122
0
0
436
474
285
0
109
89
13
0
38
0
0
133
48
390
0
0
157
25
402
0
232
272
0
0
374
294
226
0
16
0
151
295
80
17
184
379
333
199
431
0
0
0
10
0
0
0
357
431
165
0
0
408
296
0
0
0
191
0
275
233
184
284
0
107
0
213
193
317
0
0
349
311
82
0
1...

result:

ok 165 numbers

Test #4:

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

input:

5000 5000 188
121 3352
1927 3462
1474 2956
818 3688
2965 3432
2063 2891
946 2028
2270 3486
1809 2413
108 4387
920 4467
198 2766
2950 4940
1447 1580
4703 4722
1285 1768
94 1205
1863 4496
908 4980
2181 3000
1508 3798
2161 4451
952 3285
339 1166
291 3872
3014 4857
1999 2809
2892 4392
1994 3280
557 3600...

output:

619
2857
3580
3942
3094
189
0
3024
3750
3954
51
3815
1731
150
3082
4683
4303
2289
153
629
1512
1245
1028
4033
1158
1279
3758
1929
3077
2317
4291
632
2855
1513
526
1047
675
278
498
1535
2549
2361
3393
4438
458
1618
158
3991
2120
3290
2469
2357
3152
3166
206
2279
2352
3077
4786
0
2682
2822
2598
3157
4...

result:

ok 188 numbers

Test #5:

score: 0
Accepted
time: 119ms
memory: 12092kb

input:

100000 100000 33297
71020 88781
73567 91865
28411 98582
30528 55399
32377 88782
5464 33315
16441 21471
13984 59425
4953 40519
24887 54173
42736 94259
36960 89613
25476 27783
95468 96479
72650 76406
8812 58175
71657 81205
24702 49487
50388 67643
6272 23503
25087 72725
48821 81737
30758 71554
55829 82...

output:

27228
22301
7931
0
75416
1215
0
25576
22641
0
0
17383
24756
30126
15021
32805
65792
88809
22668
0
0
0
0
9889
0
53443
65387
0
80361
74814
86721
0
0
63844
0
33458
19889
75869
79460
33108
72549
68381
3025
0
0
25883
20179
55587
47021
84515
0
33494
15631
0
62931
0
53663
44093
21837
40160
26104
55703
0
0
...

result:

ok 33297 numbers

Test #6:

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

input:

100000 100000 100000
36004 87861
86753 97164
50337 64104
57483 58920
50782 94040
66749 76405
46667 79515
1545 97049
54733 71517
7919 97284
18761 54240
26599 48474
5122 10540
21254 35983
81511 98419
30413 67662
38448 47203
25866 55510
85602 98353
62852 77724
27306 66940
35955 53948
4223 91729
90149 9...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 100000 numbers

Test #7:

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

input:

100000 100000 66652
22994 71513
10658 88662
1807 55418
66243 90922
42557 51157
47642 82097
523 1973
904 95794
3610 35213
47230 91500
20542 36216
33892 71053
29813 84930
16027 99750
15436 93166
90680 93515
36466 89585
15141 69056
81445 88916
9101 96490
13087 52198
21584 55609
32214 99179
72280 75437
...

output:

20955
0
0
45077
0
0
0
0
29096
0
76005
0
0
0
11328
36753
0
41674
36156
446
65729
73462
19985
80899
0
0
0
0
0
60255
8012
0
0
0
0
0
0
28968
0
0
0
0
72218
21749
21058
0
0
0
0
0
0
0
0
24280
0
70613
14938
706
0
0
0
0
0
50017
0
0
0
0
32881
0
32413
0
0
0
0
0
0
52263
47541
0
0
0
6900
0
25846
0
91075
0
0
0
31...

result:

ok 66652 numbers

Test #8:

score: 0
Accepted
time: 118ms
memory: 12748kb

input:

100000 100000 49963
43461 76126
47999 69477
44427 55721
59597 99283
39193 60450
22213 29867
2229 68597
9589 71446
40976 68247
22820 50975
7041 44604
3521 4699
7165 34683
4692 53860
9816 36375
48431 75451
81851 83086
46691 98255
18820 28625
24245 25659
41073 41314
3832 27757
311 49980
8518 88906
1357...

output:

0
5213
0
0
8053
0
0
45209
0
0
44776
40506
46845
0
0
5860
70896
53576
0
854
82107
64134
0
14000
74001
75741
0
11040
688
86138
0
32383
2853
0
50735
0
9101
60076
0
71516
16291
0
0
0
0
0
9763
0
66272
68734
55387
0
0
78727
74088
39997
77565
27790
1605
23307
0
14682
4028
0
50364
43525
0
55936
49424
0
0
18...

result:

ok 49963 numbers

Test #9:

score: 0
Accepted
time: 137ms
memory: 11944kb

input:

100000 100000 18171
29975 72983
27998 93792
31466 82309
25911 66592
20873 50102
20462 54015
24423 32334
5133 50011
43400 83486
16333 32326
19998 49819
71405 85315
23961 31574
10103 82146
72621 84128
385 61995
310 52367
48257 96081
809 62537
19925 32177
64047 67534
11395 56798
58344 84094
31549 41454...

output:

83824
51294
42396
92956
35315
67672
47179
343
68909
36368
46810
0
33146
25662
20050
23849
0
80208
32083
24689
32840
31079
0
22672
72093
58449
71720
66396
0
71934
20351
91870
93940
41146
24156
68412
68143
0
0
87635
13275
25041
76654
273
81223
0
48926
85929
20349
0
0
3580
2644
0
0
75015
0
0
79336
1681...

result:

ok 18171 numbers

Test #10:

score: 0
Accepted
time: 136ms
memory: 11268kb

input:

100000 100000 6487
93520 95421
30400 62615
1951 83044
41508 90660
1054 38886
4410 70952
23586 96134
83162 99696
26056 47278
17385 61522
13151 87077
9702 90491
55848 82789
15155 33232
45308 89328
54038 61545
9064 26596
20886 86998
19381 65034
54688 79551
11399 77613
17246 82848
44061 65570
9277 73507...

output:

64646
30752
91838
37452
23440
12218
69492
9116
75189
47656
95622
41319
81011
89043
3241
0
1655
33466
81215
85138
78911
92874
89477
73931
26452
21062
65934
36286
59326
28218
29161
25810
66231
39536
6230
33282
20653
39301
8073
25201
56576
27448
73012
58079
66056
20236
2206
87061
47518
67303
47739
3582...

result:

ok 6487 numbers

Test #11:

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

input:

100000 100000 3889
6824 44272
7953 41679
29247 64748
5425 73326
32362 88465
14595 70806
84748 97666
69225 77398
23271 89456
18658 33389
26780 83361
35947 83442
6060 78512
50609 57165
31689 79799
7399 71009
15270 40950
7430 92031
17748 48465
20574 54533
1288 78339
77760 88430
36507 74792
31913 88932
...

output:

65300
75771
19231
34178
40370
72287
90877
42868
21467
31341
51475
21343
52313
91168
33439
89080
72625
15933
51344
40373
34077
9127
29975
13775
69999
33074
66730
98063
8899
73371
32439
31006
17512
57102
75372
19924
20162
21255
69600
60251
63709
48469
13325
55157
90346
14062
10948
88667
36935
10701
77...

result:

ok 3889 numbers

Test #12:

score: 0
Accepted
time: 131ms
memory: 11112kb

input:

100000 100000 400
71199 87490
36484 68533
37117 96109
8848 11256
35636 71230
57301 89083
20202 46774
1507 34537
9117 19504
27635 29289
26556 44606
33824 43277
5345 73653
37056 62505
75807 92210
18624 33223
47357 63627
87341 90506
39869 80288
5008 38702
88801 92572
54411 59816
1793 49615
71877 97192
...

output:

99141
74030
16619
70001
122
35866
70327
37180
99948
44225
33741
14762
20348
17090
88645
89807
16903
50325
54567
54552
94568
61923
90159
26930
87056
97065
74629
38296
19856
29905
46778
81118
81348
10596
75198
70997
17924
26919
66336
53096
1591
22405
2662
60054
48584
61277
18796
5556
53414
81701
10433...

result:

ok 400 numbers

Test #13:

score: 0
Accepted
time: 135ms
memory: 10988kb

input:

100000 100000 40
33812 48349
15097 43656
11978 68493
249 51825
43291 91166
34578 58910
31288 67968
41380 56661
57983 89330
16836 66476
39948 42282
65903 96817
10348 67447
26333 96853
72576 98956
35688 85978
49893 79139
16834 70393
47175 84119
1447 69694
13724 14867
24711 26687
27980 63923
8319 99848...

output:

78906
85062
14765
9789
79202
44840
62646
62651
7566
56152
89337
56379
92388
26469
25562
13601
59429
90892
49043
8594
19156
19762
58826
69226
51258
86571
61661
30687
36329
87695
76536
70333
98284
6598
59312
37819
29386
71881
51876
99729

result:

ok 40 numbers

Test #14:

score: 0
Accepted
time: 124ms
memory: 10472kb

input:

100000 100000 2
28131 28197
25868 68332
78570 86410
77755 90610
12794 89014
46353 51255
30636 64496
68207 88651
17370 20173
22246 32963
23578 51745
11675 93581
49024 95047
1413 72087
9613 93622
40678 89451
34298 87112
8737 53341
25639 41997
17205 75200
67586 74870
453 36247
51730 94593
23501 83101
5...

output:

16948
11551

result:

ok 2 number(s): "16948 11551"

Test #15:

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

input:

2 100000 66664
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1...

output:

0
0
1
0
0
0
0
0
1
0
0
1
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
1
0
0
1
0
0
1
0
1
0
1
0
0
1
1
0
0
1
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
0
0
0
0
0
0
0
1
0
0
0
0
1
1
0
0
0
1
0
0
0
0
0
0
0
0
0
0
1
1
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
1
0
0
0
0
0
1
0
1
0
1
1
0
...

result:

ok 66664 numbers

Test #16:

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

input:

3 100000 49970
2 3
2 3
2 3
1 3
2 3
2 3
1 3
1 3
1 3
1 2
2 3
1 3
1 3
2 3
2 3
1 3
2 3
2 3
1 3
1 2
2 3
1 3
2 3
2 3
1 3
1 3
1 2
1 3
2 3
1 2
1 2
1 3
1 2
1 3
1 3
1 3
1 3
2 3
2 3
1 3
1 3
1 2
1 3
2 3
1 3
1 3
1 2
1 2
1 3
1 2
2 3
1 2
1 2
2 3
1 2
2 3
1 3
2 3
2 3
2 3
1 2
1 2
1 2
2 3
1 2
2 3
2 3
2 3
2 3
1 2
1 2
1...

output:

10
0
0
4
0
10
5
0
0
1
0
4
5
10
0
0
1
5
0
5
4
4
5
10
0
0
5
0
1
0
0
1
11
5
0
1
1
1
5
1
5
0
5
0
1
0
1
0
4
4
4
0
4
0
0
5
1
0
0
0
1
0
0
11
1
0
0
0
0
0
0
1
5
5
5
0
0
1
0
0
1
0
0
0
0
1
5
1
11
0
1
1
0
1
5
0
11
0
4
5
10
0
0
0
0
5
1
0
10
0
10
4
0
0
0
11
5
1
0
0
4
10
1
4
4
0
1
4
0
0
5
4
10
4
1
4
0
0
10
11
0
4
...

result:

ok 49970 numbers

Test #17:

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

input:

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

output:

0
0
3
0
27
2
0
0
27
48
0
48
2
0
0
3
0
0
6
0
3
10
4
10
0
15
2
0
23
16
2
1
16
2
5
35
16
10
0
0
3
6
4
1
0
2
1
0
16
4
3
0
0
0
4
23
10
0
1
2
3
15
3
16
0
16
1
23
1
35
0
2
5
2
0
0
16
46
35
101
0
1
0
0
1
0
17
0
0
0
2
11
1
15
1
4
0
10
23
0
0
0
2
4
0
2
0
2
1
1
4
1
3
3
0
2
1
0
56
0
16
0
60
10
0
1
2
47
47
4
1
0...

result:

ok 40176 numbers

Test #18:

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

input:

5 100000 33362
2 5
3 5
2 5
3 5
1 5
2 5
1 4
2 3
1 4
1 2
2 3
1 3
2 3
2 3
1 5
1 3
1 4
4 5
3 5
2 3
3 4
3 4
1 4
1 2
3 5
1 4
1 3
4 5
2 5
2 5
1 4
1 2
2 4
1 2
2 3
4 5
4 5
3 4
2 4
2 5
3 4
1 4
1 4
3 4
3 4
1 4
2 4
2 4
1 2
2 4
2 4
3 4
2 3
1 3
1 5
4 5
1 5
1 3
2 3
4 5
2 4
3 5
2 5
1 5
1 2
2 5
1 3
4 5
1 5
1 5
3 5
3...

output:

0
0
0
0
0
195
102
132
8
78
0
0
17
0
0
101
9
3
0
182
0
0
0
0
9
21
0
47
0
84
6
0
16
0
15
0
0
11
0
29
102
1
1
9
153
6
11
0
155
0
9
81
3
170
210
4
47
0
31
0
36
5
103
3
68
38
0
1
0
15
11
128
89
25
57
94
1
121
3
1
1
0
3
4
94
9
0
89
28
130
121
25
0
17
2
187
57
3
0
0
336
53
9
47
210
17
25
0
3
2
15
0
0
3
0
1...

result:

ok 33362 numbers

Test #19:

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

input:

6 100000 28674
3 5
2 3
2 5
1 4
2 5
2 5
1 2
1 3
1 5
4 6
1 6
3 4
3 6
3 5
5 6
2 4
1 5
2 6
3 6
4 5
4 6
5 6
4 6
5 6
5 6
1 5
5 6
1 4
4 5
3 4
1 2
3 4
1 3
3 4
4 5
4 5
2 5
1 5
2 4
3 6
3 6
1 2
4 6
2 6
1 3
1 4
2 5
2 6
2 5
1 6
1 4
1 6
1 4
2 5
2 4
4 6
5 6
2 6
2 5
1 6
4 5
1 3
4 6
5 6
3 6
1 2
5 6
4 6
1 3
1 3
3 5
5...

output:

1595
0
206
61
0
0
15
345
0
0
7
176
364
30
22
0
0
1
0
7
0
826
0
14
0
111
1
179
310
0
617
64
1
0
5
14
0
81
44
8
12
94
53
0
11
248
340
80
9
29
40
483
0
106
5
626
9
0
0
244
43
0
884
0
390
46
2
594
125
310
145
344
268
1807
544
126
1075
256
1413
1476
10
581
3646
263
45
0
0
840
75
216
2
8
705
162
2
0
1568
...

result:

ok 28674 numbers

Test #20:

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

input:

7 100000 24903
2 6
2 4
1 5
6 7
4 6
3 4
2 6
1 5
2 3
1 3
3 6
3 7
1 2
3 5
1 2
2 3
1 2
1 2
4 6
5 6
2 7
3 7
4 5
2 5
2 6
1 6
5 6
5 7
4 7
1 6
1 5
2 6
1 7
1 5
4 6
5 7
1 4
1 7
2 4
4 5
2 3
3 7
5 6
1 3
2 3
5 6
4 6
2 5
1 4
1 7
5 6
1 5
2 7
1 5
1 7
3 5
2 6
4 6
2 7
4 6
4 7
5 6
2 5
5 7
2 5
2 5
3 4
2 5
4 7
1 5
1 3
1...

output:

4
90
1
0
339
257
85
208
0
293
86
426
21
6549
1289
9
769
4593
5
232
71
6
1423
2
690
52
299
4022
72
27
4017
2261
15
4798
9726
801
380
1733
289
35
0
1
427
386
1778
359
0
24
0
152
3
3239
820
528
35
1613
159
77
235
3
1180
257
4460
1116
107
3
1538
23
0
48
20
94
0
1444
199
1508
8611
1
585
9252
86
707
2539
...

result:

ok 24903 numbers

Test #21:

score: 0
Accepted
time: 325ms
memory: 8344kb

input:

8 100000 22189
3 7
1 4
1 2
5 7
3 4
2 5
6 7
2 4
4 8
7 8
3 4
2 8
1 4
4 8
6 7
4 5
1 4
3 5
1 3
2 5
1 5
3 8
7 8
5 6
4 6
1 2
3 8
5 7
5 6
1 4
1 8
6 7
2 6
4 8
1 4
2 7
3 4
3 5
5 6
4 7
4 6
5 6
1 5
3 6
3 5
6 7
2 8
2 8
6 8
2 4
5 6
1 7
1 8
1 4
3 8
3 7
3 6
2 5
6 7
2 6
3 7
1 5
4 7
3 4
1 3
1 3
2 6
5 7
3 8
3 6
3 8
1...

output:

2165
354
27879
16617
0
0
2
1112
13859
22
13681
12676
27
1942
8954
5651
0
11
3833
4379
146
0
54123
46302
214
526
0
2218
498
13114
42412
0
172
17541
5798
20
255
80
9683
490
1612
326
1939
1846
161
31255
2963
6479
15
26689
124
223
45
22
7848
0
5
16182
2813
125
16588
5694
18
15
1340
27344
10651
4019
4918...

result:

ok 22189 numbers

Test #22:

score: 0
Accepted
time: 598ms
memory: 8096kb

input:

9 100000 19914
2 7
4 6
1 8
3 9
2 3
1 9
3 6
3 4
6 8
4 9
2 4
4 8
3 5
3 9
6 9
6 8
4 9
6 8
3 4
2 6
3 4
1 4
5 8
5 6
2 9
4 9
1 8
7 8
2 6
1 9
1 6
3 9
4 5
2 3
2 6
6 9
1 6
1 4
1 3
6 8
8 9
2 8
2 3
3 8
1 7
1 5
1 5
2 8
3 6
4 5
3 7
4 6
3 9
2 9
1 6
5 8
6 9
6 7
1 8
2 8
1 4
1 2
1 3
1 9
3 5
4 7
6 7
4 5
3 8
3 6
1 7
4...

output:

6537
51166
0
31871
81318
0
0
42
68269
462
28510
0
21597
385
10
1569
19425
30875
92390
3280
6630
7
14
1203
54522
3037
36
0
80092
23581
4438
112
9926
40735
0
19230
12135
30944
15
4504
79878
54298
110
4979
30613
6
1224
9753
5042
22
846
425
2767
0
65975
7283
42
143
0
0
23053
98603
465
3666
36
9919
232
1...

result:

ok 19914 numbers

Test #23:

score: 0
Accepted
time: 655ms
memory: 8112kb

input:

10 100000 18183
3 8
6 8
5 6
9 10
1 3
4 5
4 10
5 7
4 9
5 10
3 8
2 7
4 8
2 5
1 10
2 10
4 5
2 6
1 3
2 4
7 9
1 3
1 7
5 9
5 9
4 6
2 8
1 4
1 2
2 5
4 7
1 5
5 6
7 9
3 5
4 10
4 9
3 7
3 6
1 9
5 10
2 4
6 10
4 9
7 9
8 9
7 8
1 7
8 10
1 3
4 8
8 9
2 8
3 6
5 7
6 9
8 10
1 4
8 9
2 4
1 2
8 10
4 7
5 8
1 4
2 9
5 9
6 7
3...

output:

52116
54043
0
44676
70167
95
32694
24362
39
1604
279
95730
13362
83914
8037
89202
32
34
25619
688
2812
39639
703
13517
3404
69216
69801
59832
74835
9755
4004
87
128
40676
116
44313
0
0
24143
276
1215
18932
11407
129
17
8
324
18811
66
60401
99647
3520
1841
1209
17488
218
734
71976
0
0
64209
2589
363
...

result:

ok 18183 numbers

Test #24:

score: 0
Accepted
time: 637ms
memory: 8156kb

input:

11 100000 16679
6 7
8 10
7 8
6 11
2 3
6 8
3 6
3 5
1 6
3 9
1 10
1 9
3 8
3 9
6 8
3 5
2 11
3 11
1 5
4 8
9 10
10 11
3 10
1 7
2 7
4 6
1 3
6 11
3 5
2 3
5 10
1 6
3 6
1 10
1 9
4 9
5 9
2 10
4 9
3 4
8 10
8 9
2 7
1 2
1 6
2 11
4 11
2 7
1 10
1 5
3 8
9 11
8 9
7 11
1 2
10 11
3 5
4 10
5 7
8 9
7 9
8 10
7 8
7 9
2 3
3...

output:

9235
3897
49565
349
27467
7050
84832
0
3
9856
46
1804
67600
14508
97806
18285
2773
11474
16977
10178
4846
10416
18
2826
163
48902
72961
74672
7728
23104
61208
74381
36649
38740
85601
79943
22843
59620
44146
80437
30968
89350
80600
0
890
67476
4
50584
10673
50
67850
82334
332
32230
594
41478
79411
13...

result:

ok 16679 numbers

Test #25:

score: 0
Accepted
time: 595ms
memory: 7716kb

input:

12 100000 15444
2 4
4 12
7 10
8 9
2 12
8 12
9 10
5 11
6 11
1 3
4 8
3 4
4 5
3 7
6 12
2 6
10 12
4 11
5 6
3 4
3 8
1 4
1 9
2 11
3 11
8 11
4 8
10 11
1 11
6 12
6 11
9 11
2 7
3 9
6 7
1 7
4 11
11 12
4 11
2 11
2 11
2 8
6 8
1 6
1 7
5 9
4 11
10 11
1 6
8 10
5 6
1 8
3 10
1 6
4 11
6 11
7 8
6 12
1 12
3 7
9 10
7 10...

output:

1390
24796
28505
71150
71039
55476
68705
18717
6335
11
28803
0
48132
23755
22406
35401
28966
18262
59539
9389
1175
0
27144
0
64121
81978
46081
53302
20875
235
36551
728
0
40551
86352
5663
22534
0
0
20630
252
9620
99736
79777
6326
23267
35076
88039
138
3722
268
104
49747
88
0
0
12
52284
54069
33257
8...

result:

ok 15444 numbers

Test #26:

score: 0
Accepted
time: 554ms
memory: 7716kb

input:

13 100000 14252
5 11
4 12
10 13
4 6
6 8
7 9
2 13
6 8
1 13
1 3
1 10
6 7
1 12
1 3
1 5
6 9
7 9
5 12
7 12
7 13
10 13
1 8
7 12
7 9
8 10
3 9
6 12
2 8
5 11
5 10
7 9
4 8
7 12
6 9
1 9
10 11
7 10
6 13
1 10
1 5
8 13
11 12
2 9
8 12
2 8
2 12
4 6
1 2
2 13
3 5
7 13
5 9
1 11
2 8
4 8
7 9
3 5
9 12
2 13
4 5
7 9
2 4
3 ...

output:

81519
60750
40469
33999
30851
87838
36252
23554
0
1
11386
0
27521
35
0
44146
97710
31335
59690
98473
52811
61087
568
0
76849
0
22719
37830
59360
407
97
6743
2027
60615
36379
88597
9
23
53562
98593
48478
335
1
72389
20232
25834
59989
68
0
142
6800
61978
7627
539
51680
48362
591
63118
86654
76151
300
...

result:

ok 14252 numbers

Test #27:

score: 0
Accepted
time: 519ms
memory: 7452kb

input:

14 100000 13258
2 8
5 12
3 12
2 7
9 12
2 8
3 7
1 7
10 11
1 8
1 11
7 11
3 10
10 14
8 10
3 4
4 10
7 9
11 13
4 5
1 12
1 13
6 12
12 14
3 4
7 12
5 13
8 12
9 10
2 14
9 13
2 13
2 8
2 3
1 5
4 14
1 14
2 14
4 7
10 12
7 9
2 5
4 14
2 13
5 6
8 11
9 10
11 14
5 14
1 10
10 14
2 7
3 7
5 9
12 13
2 7
7 9
5 12
2 8
1 7
...

output:

62573
64077
16966
97806
82625
6158
68534
56831
63046
0
82481
63661
25291
3129
5648
19707
16210
27039
15803
35013
0
90707
43817
0
0
73893
914
64193
16047
0
1726
795
45914
12
7789
30
42101
15291
3660
65617
28654
119
71969
64739
69877
0
33
94411
93166
44054
77696
15253
52782
6620
84539
84723
42077
4583...

result:

ok 13258 numbers

Test #28:

score: 0
Accepted
time: 484ms
memory: 7448kb

input:

15 100000 12417
2 8
10 13
6 8
2 13
8 12
5 7
13 15
1 6
3 12
13 14
11 12
8 10
10 11
4 7
4 5
1 12
6 7
2 3
1 10
1 11
2 5
4 7
1 4
1 2
2 9
11 12
6 11
1 12
4 11
3 10
5 7
4 14
13 14
4 6
10 11
7 8
4 13
5 9
2 5
3 6
10 13
5 6
1 7
2 13
3 10
11 14
2 7
4 13
13 15
3 13
5 6
9 13
2 7
6 14
3 11
9 13
2 14
3 14
2 12
9 ...

output:

58520
65356
24790
21187
0
60
51712
1579
39851
5935
65421
17237
16355
42274
60064
12319
0
288
1154
13919
84606
0
90980
23597
1509
53631
15666
50315
63484
12
782
94012
73035
37103
14788
69747
54442
91137
21488
91068
13299
49980
26337
36104
665
32291
30087
64480
1646
1266
91224
30822
48070
35205
95139
...

result:

ok 12417 numbers

Test #29:

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

input:

2 100000 66667
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1...

output:

1
1
1
0
0
0
0
0
0
0
0
0
0
1
1
0
0
1
1
1
0
1
0
0
1
0
0
0
0
0
0
1
0
0
1
0
0
1
1
1
1
0
0
1
0
0
0
1
0
0
1
0
0
0
0
0
0
1
0
0
0
1
0
0
1
0
0
0
0
0
1
0
0
1
0
0
1
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
1
1
0
0
0
0
1
0
0
0
0
0
0
1
0
0
0
0
0
1
1
1
0
0
0
1
0
0
0
0
0
0
1
0
0
0
1
0
0
0
1
1
0
0
0
0
1
0
0
0
1
1
1
1
0
0
0
0
...

result:

ok 66667 numbers

Test #30:

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

input:

3 100000 66665
2 3
1 3
1 3
1 2
1 2
2 3
1 3
2 3
1 2
1 3
2 3
1 3
2 3
1 2
1 3
1 3
1 2
1 3
1 3
1 2
1 2
1 2
2 3
2 3
1 3
1 3
2 3
1 3
1 3
1 3
2 3
1 2
1 2
2 3
2 3
1 3
1 2
1 3
1 2
2 3
1 2
2 3
2 3
1 2
2 3
1 3
1 3
1 2
1 2
2 3
2 3
1 2
1 3
1 3
1 2
1 2
1 2
1 3
1 2
1 3
1 2
1 2
1 3
1 3
1 2
2 3
2 3
2 3
2 3
1 2
2 3
1...

output:

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

result:

ok 66665 numbers

Test #31:

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

input:

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

output:

4
5
0
0
5
1
0
0
5
1
7
8
1
3
1
0
0
0
0
0
8
0
7
3
0
0
0
0
0
3
5
0
0
4
0
0
1
0
0
0
0
4
0
0
0
0
0
4
0
4
1
0
0
0
4
0
0
0
0
1
0
0
1
0
3
0
3
0
0
0
0
0
0
0
7
0
0
0
1
8
0
1
0
1
7
0
0
0
3
0
0
0
3
0
0
0
1
0
3
7
0
3
0
0
0
0
0
4
0
0
8
0
0
0
8
0
0
0
0
0
0
0
0
3
4
8
0
0
3
5
5
0
0
0
0
8
1
0
0
3
0
0
3
1
0
0
0
0
4
3
...

result:

ok 66658 numbers

Test #32:

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

input:

5 100000 66669
1 2
1 5
3 5
3 5
1 4
2 3
1 3
2 4
1 4
1 3
2 5
1 3
4 5
3 4
4 5
3 4
3 5
1 2
3 5
1 5
3 4
2 5
3 5
3 5
1 3
2 3
3 5
1 2
3 4
2 5
1 5
1 4
1 4
2 3
3 5
3 4
3 5
3 5
2 5
2 4
1 4
1 4
1 4
1 4
3 4
4 5
1 5
2 4
1 3
2 4
4 5
2 3
2 4
2 3
1 2
4 5
3 4
1 4
1 2
2 5
1 5
1 5
4 5
2 5
2 3
3 4
1 3
2 5
3 5
1 4
2 3
3...

output:

0
0
0
8
1
0
3
1
0
0
0
0
0
14
1
0
0
10
0
0
0
0
0
0
0
15
14
1
0
0
0
0
2
0
0
0
2
6
0
0
3
0
0
5
0
0
3
0
0
8
1
1
0
0
0
0
0
2
0
0
0
0
0
0
2
2
1
0
2
0
8
2
8
0
2
0
0
0
14
0
0
0
1
14
0
0
0
0
0
0
0
1
8
0
0
0
0
15
0
1
5
0
3
0
2
5
0
0
0
0
0
0
2
0
0
0
6
0
0
0
0
0
0
0
0
5
0
0
0
0
1
0
0
0
5
8
6
3
0
1
1
1
8
1
0
0
0...

result:

ok 66669 numbers

Test #33:

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

input:

6 100000 66664
4 6
1 2
3 5
1 4
2 4
1 3
2 4
2 4
2 5
4 5
3 5
1 2
1 4
1 6
1 6
4 6
2 5
1 2
1 6
3 5
1 5
2 6
3 5
2 6
2 6
2 4
1 4
3 4
1 2
5 6
1 5
1 3
3 6
1 2
2 5
3 6
3 6
1 4
1 5
1 5
3 6
3 5
3 5
2 5
5 6
4 5
1 6
4 5
1 4
1 6
1 2
1 3
2 3
2 5
1 6
3 5
1 2
3 4
2 3
1 2
1 2
3 4
4 5
4 5
3 6
2 5
1 3
4 6
3 5
2 5
5 6
4...

output:

20
5
0
4
9
0
0
0
0
2
0
0
2
0
1
0
5
0
0
0
20
0
0
0
0
0
9
0
16
0
2
0
19
0
0
19
0
0
9
0
0
0
19
3
0
0
0
0
2
0
0
0
0
4
0
0
1
5
0
0
2
0
0
5
2
2
0
1
0
4
0
0
3
0
0
3
6
0
0
0
0
33
0
11
33
4
0
0
9
1
0
0
0
0
0
7
10
5
0
12
0
0
0
0
19
0
0
19
0
0
0
2
5
0
20
0
0
0
0
0
0
1
0
2
0
0
0
0
0
0
0
0
19
5
0
0
5
10
20
0
0
2...

result:

ok 66664 numbers

Test #34:

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

input:

7 100000 66670
2 5
2 3
1 7
1 7
4 6
2 4
4 7
2 4
4 7
2 3
4 7
3 7
4 6
3 7
6 7
5 6
5 7
3 5
2 3
2 6
6 7
4 6
5 7
5 6
1 6
3 4
1 6
1 5
6 7
1 5
3 5
5 7
2 4
5 6
5 7
3 4
1 2
1 2
4 5
1 2
5 6
1 5
4 7
2 4
1 3
5 7
3 5
6 7
1 7
2 4
4 5
2 7
6 7
1 7
3 5
3 5
2 7
2 5
1 3
1 7
2 4
1 3
2 7
1 3
1 6
1 4
4 7
1 7
2 5
5 6
1 5
2...

output:

0
12
0
0
5
6
0
0
0
0
5
0
14
5
0
0
28
0
0
18
0
1
0
7
1
0
5
0
0
0
5
0
0
0
11
0
7
0
0
0
0
0
0
0
0
1
0
0
0
25
0
14
0
8
0
0
6
54
22
0
0
0
54
6
0
34
0
0
0
0
0
0
0
2
36
22
0
0
0
2
0
1
14
0
0
0
6
6
11
0
0
0
7
0
1
0
1
0
8
8
54
0
0
6
8
0
5
6
0
0
12
0
0
8
14
7
0
0
0
0
3
0
0
2
0
6
0
1
20
0
36
0
1
0
0
14
53
0
1
...

result:

ok 66670 numbers

Test #35:

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

input:

8 100000 66650
3 8
4 8
3 8
2 3
6 7
3 5
3 5
5 6
2 7
1 5
2 7
3 5
4 7
6 7
1 6
5 8
6 8
4 8
5 7
3 5
1 6
4 6
3 8
4 5
3 5
4 7
2 5
2 7
3 5
3 8
1 3
2 5
3 4
1 5
3 7
2 3
5 6
4 8
1 4
4 7
2 3
1 7
3 8
4 6
3 6
6 8
6 7
1 3
1 4
6 8
1 7
5 7
5 7
6 8
2 8
5 6
4 8
4 6
2 5
6 8
3 7
4 8
4 8
5 8
6 7
4 7
3 4
3 5
2 5
1 5
4 6
1...

output:

6
16
0
12
0
0
0
0
1
0
0
0
13
3
8
0
0
0
0
1
9
0
0
9
0
0
0
18
0
0
49
4
28
4
0
0
6
17
0
12
0
8
0
0
0
0
10
0
0
9
12
0
5
0
4
0
0
0
13
17
14
5
0
0
24
0
0
9
9
0
0
0
30
0
28
2
12
0
16
31
6
6
5
0
0
8
0
24
0
0
0
0
0
32
0
14
9
1
0
32
0
0
0
0
0
8
23
3
27
0
0
19
0
16
0
10
0
0
30
0
24
9
0
0
17
0
0
45
0
0
0
10
6
9...

result:

ok 66650 numbers

Test #36:

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

input:

9 100000 66668
3 4
1 5
4 9
2 6
3 7
4 7
1 6
4 8
6 9
3 7
3 7
2 3
5 8
8 9
3 5
4 5
1 9
2 5
2 4
4 6
1 3
6 7
1 3
3 8
1 4
3 5
3 8
5 6
1 9
2 5
5 7
7 9
7 8
1 9
1 4
2 6
1 2
6 8
6 9
4 5
3 6
1 5
4 8
4 8
3 5
2 5
3 5
1 9
1 2
4 5
1 3
5 7
5 9
4 5
2 9
1 8
5 7
3 7
4 8
2 7
2 7
1 9
5 8
2 7
2 9
1 3
4 9
2 6
3 5
3 6
2 7
8...

output:

2
0
7
0
0
8
47
0
46
0
0
0
10
0
24
0
0
38
36
0
0
6
0
0
18
36
0
0
0
0
24
18
3
0
34
0
41
0
14
0
38
0
9
0
18
34
4
0
37
0
24
84
0
41
0
0
0
0
0
6
12
0
0
0
0
0
0
5
0
0
0
7
0
16
0
0
0
7
0
2
0
0
14
0
0
3
0
9
16
34
0
0
0
39
0
0
0
0
19
0
0
10
0
0
0
0
2
6
0
19
5
0
0
0
0
26
10
36
22
0
3
1
15
16
0
0
2
10
0
12
12
...

result:

ok 66668 numbers

Test #37:

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

input:

10 100000 66668
2 10
3 5
5 7
3 6
3 6
1 10
2 7
1 10
1 7
1 6
2 3
1 6
1 2
5 8
1 6
5 8
1 3
4 8
1 10
5 6
6 8
1 8
2 5
1 10
1 3
5 6
7 10
2 9
1 3
2 5
1 4
7 10
5 7
3 9
2 6
7 8
2 9
7 8
2 10
1 5
1 2
2 5
5 7
3 7
6 7
5 8
3 4
2 8
3 9
2 5
1 6
4 7
4 8
5 9
2 10
1 10
5 6
3 7
2 3
2 4
1 3
1 5
1 8
1 5
9 10
2 6
4 9
4 10
...

output:

20
0
7
0
50
54
15
0
0
2
2
23
0
23
0
78
0
18
20
0
0
0
0
34
0
14
0
23
0
0
19
27
50
8
0
2
0
6
15
18
4
29
0
0
19
33
18
3
3
36
0
34
0
3
3
2
0
3
0
4
0
0
3
0
45
0
51
0
41
78
0
0
0
0
34
0
14
0
4
2
14
0
0
2
59
0
0
45
45
9
7
34
0
0
0
10
0
0
0
4
0
3
10
17
4
0
60
0
0
0
0
0
4
0
0
0
0
3
0
20
0
0
57
0
0
0
0
18
19
...

result:

ok 66668 numbers

Test #38:

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

input:

11 100000 66665
8 11
5 8
2 6
2 5
3 6
8 10
5 11
2 10
5 8
1 9
1 10
2 3
4 8
7 10
3 10
5 11
5 9
7 9
3 8
2 6
9 11
5 8
3 11
4 7
6 10
9 10
2 9
8 10
6 10
4 11
2 3
3 9
8 10
1 3
7 11
9 11
1 5
2 8
2 3
5 10
1 3
8 11
8 10
10 11
3 9
9 11
6 11
2 5
1 8
1 4
5 9
1 9
9 10
9 11
4 11
2 10
5 10
2 9
3 8
3 4
1 3
1 5
7 9
1 ...

output:

6
13
0
0
0
0
16
0
22
0
12
0
22
59
0
14
69
0
14
0
20
0
54
54
0
0
0
0
13
4
0
0
11
28
33
11
0
17
3
0
0
16
0
0
0
6
0
0
4
0
6
0
0
0
6
43
20
40
0
0
82
0
26
0
52
13
0
82
0
0
0
11
0
0
0
0
0
0
69
58
0
45
0
0
0
25
22
0
0
2
113
0
54
40
0
0
8
41
0
30
22
0
0
125
0
14
0
3
22
20
38
7
9
41
26
45
0
0
52
0
0
18
13
6
...

result:

ok 66665 numbers

Test #39:

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

input:

12 100000 66669
3 8
7 11
6 11
2 11
1 12
9 10
6 11
6 8
1 4
6 7
10 12
4 7
8 11
4 12
5 6
2 10
6 10
4 9
3 7
1 7
1 2
8 10
3 5
8 10
4 6
5 9
2 8
4 10
2 6
7 10
2 9
2 12
8 12
4 7
4 9
7 9
3 11
2 3
5 8
2 11
4 5
8 12
4 5
4 9
1 9
2 5
2 9
5 6
2 8
2 11
7 10
8 9
5 8
1 2
9 12
10 11
1 9
5 6
1 11
2 7
1 11
4 11
7 9
6 1...

output:

0
0
16
20
0
0
0
4
3
0
2
20
12
0
30
0
16
0
29
2
1
80
0
0
6
8
0
0
0
0
0
40
0
0
42
0
98
13
0
0
114
7
0
0
68
0
0
0
0
42
100
0
0
0
0
40
0
59
0
0
0
303
129
2
1
98
4
0
0
0
69
52
0
17
0
52
0
19
303
129
0
18
0
0
0
12
6
16
17
0
0
75
54
0
0
11
0
0
10
0
0
46
0
25
19
0
80
26
0
11
0
0
0
3
15
0
19
0
52
0
0
0
7
34
...

result:

ok 66669 numbers

Test #40:

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

input:

13 100000 66678
2 3
7 10
1 10
6 12
2 6
3 12
1 13
3 11
5 11
2 8
3 13
4 11
5 7
11 13
3 9
9 13
8 13
9 10
5 11
1 10
6 12
2 8
7 9
4 5
3 13
6 8
7 8
2 3
5 7
2 5
5 12
8 12
2 9
1 11
3 10
3 6
3 6
3 11
4 13
1 5
2 4
3 10
1 5
5 8
10 12
8 13
8 13
6 8
7 10
4 11
1 4
4 5
2 13
4 10
9 11
6 12
12 13
2 4
10 12
7 13
12 1...

output:

0
22
59
30
102
8
74
89
0
0
0
182
0
23
49
43
19
0
10
0
20
24
0
0
0
0
0
32
71
0
0
28
0
2
0
60
0
31
0
0
48
0
19
80
89
0
0
24
0
163
0
0
0
0
0
0
69
89
0
1
0
0
0
12
11
69
7
0
0
5
0
0
57
0
71
0
82
0
0
8
22
0
0
0
0
0
0
59
0
0
7
0
0
0
20
89
0
63
0
59
0
58
0
0
5
13
24
0
0
0
10
0
0
32
146
0
17
0
3
64
0
38
16
0...

result:

ok 66678 numbers

Test #41:

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

input:

14 100000 66676
6 10
4 11
8 14
7 10
10 11
2 7
9 12
8 14
7 14
4 10
5 8
4 5
2 11
10 13
12 14
2 4
2 5
2 13
5 11
2 5
12 13
6 9
3 8
1 13
6 12
10 13
1 5
3 4
8 12
2 9
9 11
3 13
10 11
9 10
4 8
3 5
1 11
2 5
4 13
9 12
5 9
9 13
8 10
8 13
7 10
6 11
10 12
4 10
1 5
10 12
8 10
2 9
1 9
2 6
3 10
1 11
2 3
6 8
11 13
1...

output:

0
0
8
4
61
0
0
0
25
0
0
0
0
0
0
34
0
16
87
19
0
0
48
67
48
0
7
0
0
0
23
0
0
0
15
2
15
0
46
0
0
0
4
0
28
0
4
26
8
22
0
35
0
25
119
0
0
0
0
0
0
5
0
0
121
0
0
0
0
11
0
4
40
0
0
127
28
15
0
0
0
92
0
59
52
13
0
0
0
0
0
0
5
0
0
0
0
40
0
61
33
13
0
0
0
0
0
8
0
23
0
0
23
0
10
13
95
0
62
5
6
58
19
0
0
0
0
64...

result:

ok 66676 numbers

Test #42:

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

input:

15 100000 66655
11 14
10 11
3 8
13 15
6 12
4 7
6 7
5 12
4 12
4 15
4 8
3 14
3 12
3 9
7 15
10 14
1 8
9 15
6 9
7 10
6 8
2 13
11 15
2 10
2 15
2 4
4 7
3 11
9 11
9 14
10 15
1 12
6 12
7 14
5 9
5 12
10 14
4 9
3 6
6 7
3 6
5 8
9 13
12 15
9 14
5 9
10 12
1 13
4 13
3 11
12 15
8 12
6 8
4 14
9 12
3 15
5 8
7 9
6 7
...

output:

40
0
6
0
0
0
0
0
64
0
0
41
0
56
0
11
0
36
67
0
158
0
63
0
5
0
99
0
17
0
51
89
66
24
0
0
45
0
0
0
25
0
28
0
25
0
0
0
42
32
14
0
0
0
0
40
0
25
0
80
0
0
21
8
0
0
25
136
0
118
0
76
0
0
149
0
17
0
34
0
2
242
0
7
0
0
0
0
0
88
169
0
0
0
12
0
8
0
0
105
3
0
0
43
0
29
24
0
0
0
56
17
127
0
53
40
11
0
0
0
65
0
...

result:

ok 66655 numbers

Test #43:

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

input:

2 100000 66655
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1 2
1...

output:

0
1
0
1
1
0
0
0
0
0
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
1
1
0
0
1
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
1
1
1
0
0
0
0
1
1
0
0
0
0
0
1
0
0
0
1
1
0
0
1
0
0
1
0
0
0
0
0
0
1
0
0
1
0
0
1
0
0
0
1
0
0
0
1
0
1
0
0
0
0
1
0
0
0
0
1
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
1
1
0
1
0
0
0
0
0
0
0
1
0
1
0
1
...

result:

ok 66655 numbers

Test #44:

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

input:

3 100000 49935
1 2
2 3
2 3
1 3
1 2
1 2
1 3
1 3
1 2
1 2
1 2
1 2
2 3
2 3
1 3
1 2
1 3
1 3
1 3
1 3
2 3
2 3
1 3
2 3
2 3
1 2
1 3
1 3
1 2
2 3
2 3
1 2
2 3
2 3
1 3
2 3
2 3
1 2
2 3
2 3
1 2
1 2
1 3
1 3
1 2
1 3
1 2
1 3
2 3
2 3
1 2
1 3
1 2
1 2
2 3
1 3
1 2
1 2
1 2
1 3
1 3
2 3
2 3
1 2
1 2
1 2
2 3
1 3
1 2
2 3
1 2
1...

output:

0
0
0
0
5
2
0
2
1
0
5
0
0
0
0
0
0
2
0
0
2
13
2
0
0
2
5
4
0
0
0
0
13
0
1
2
1
1
2
2
1
0
1
5
0
0
0
0
0
13
0
0
0
1
0
5
0
2
1
0
1
0
0
0
0
4
2
2
0
13
0
0
0
2
5
0
1
5
13
0
0
1
2
0
0
0
0
1
0
1
13
0
0
1
0
5
13
5
0
2
1
0
5
0
0
0
0
13
2
5
1
0
1
0
4
0
1
1
0
1
0
5
0
0
0
0
5
0
2
1
0
0
5
0
1
4
5
4
0
0
0
1
0
5
0
0
...

result:

ok 49935 numbers

Test #45:

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

input:

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

output:

6
0
3
6
0
6
33
0
9
0
35
0
0
1
0
33
0
0
10
1
35
0
0
0
0
0
10
14
58
3
1
0
0
0
0
0
1
0
3
8
1
0
10
6
0
3
8
0
0
0
1
0
3
3
1
0
0
0
0
24
1
1
0
6
3
3
6
0
1
23
11
0
0
0
9
24
0
3
0
10
6
0
0
0
10
3
0
0
3
0
35
10
1
0
9
0
0
35
23
11
14
0
0
9
11
0
0
8
17
17
22
58
6
0
0
1
6
0
0
0
11
11
1
1
0
0
3
8
3
3
9
0
6
0
24
1...

result:

ok 49965 numbers

Test #46:

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

input:

5 100000 49935
1 3
1 4
2 4
1 2
1 2
4 5
1 2
1 2
2 3
1 2
3 4
2 5
3 4
4 5
2 3
4 5
2 4
1 5
1 4
1 3
2 5
2 3
2 3
1 2
1 3
2 3
2 4
2 3
2 4
4 5
2 3
1 2
2 5
1 2
4 5
1 5
4 5
1 2
1 5
1 2
1 3
1 5
1 3
4 5
2 4
4 5
3 5
4 5
1 5
2 3
2 5
2 5
3 5
1 2
3 5
4 5
1 2
2 3
2 5
3 5
3 4
2 4
1 4
2 5
1 4
1 3
2 5
1 4
1 2
3 4
3 4
1...

output:

12
1
0
3
2
15
0
0
2
83
6
11
0
42
3
29
0
0
0
0
10
1
0
12
62
0
9
38
0
1
2
3
0
0
16
0
2
0
17
3
1
0
1
0
0
2
4
0
0
2
2
3
0
1
0
0
0
2
0
0
0
15
1
4
0
0
2
38
0
11
0
4
15
38
3
0
11
1
36
19
38
59
11
26
40
11
2
15
0
38
27
0
3
15
6
1
0
46
29
62
1
29
15
0
0
1
3
38
0
38
10
1
0
1
17
6
45
19
3
0
0
6
19
0
0
1
56
0
0...

result:

ok 49935 numbers

Test #47:

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

input:

6 100000 49895
4 5
3 6
3 4
5 6
5 6
2 5
3 5
2 4
5 6
4 5
1 3
3 6
3 6
1 6
5 6
4 6
4 5
2 4
2 5
3 6
1 6
1 2
2 6
3 5
2 4
2 4
2 6
1 3
2 4
1 6
3 4
1 4
1 4
5 6
1 5
1 3
5 6
5 6
2 3
4 5
1 5
5 6
2 3
4 5
1 2
5 6
1 3
2 3
2 4
2 4
1 6
2 5
5 6
4 6
2 4
1 6
3 4
1 5
4 6
1 2
2 6
1 5
3 4
4 6
3 5
3 4
1 5
1 2
4 6
4 5
2 4
1...

output:

3
0
0
18
1
20
24
2
15
0
2
1
7
65
0
7
0
2
0
2
41
101
12
1
4
79
3
32
2
57
0
6
69
21
15
7
20
12
19
8
0
0
0
6
7
0
2
18
0
1
63
0
20
67
0
1
0
22
7
0
3
8
8
4
3
0
0
0
0
17
102
25
0
0
7
0
0
48
69
0
0
32
20
2
0
21
41
125
0
2
20
41
0
6
21
11
12
4
24
15
0
1
0
0
0
41
2
20
24
0
0
0
0
6
212
11
3
8
4
1
2
21
2
22
2
...

result:

ok 49895 numbers

Test #48:

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

input:

7 100000 50082
4 5
1 2
2 4
1 6
1 3
5 6
4 7
6 7
2 6
1 7
1 2
1 4
1 7
1 6
2 5
4 5
4 5
3 4
2 6
1 6
2 7
4 6
3 6
2 7
2 7
1 6
1 5
4 6
3 4
5 7
2 6
3 5
2 4
4 7
1 3
2 7
3 4
3 6
3 4
3 4
1 7
4 5
4 7
1 5
1 6
4 5
3 7
1 3
5 7
2 7
2 4
2 5
2 6
2 4
3 4
4 5
6 7
3 5
2 4
3 7
3 5
2 4
1 4
5 6
4 7
2 4
1 6
4 6
1 4
1 6
1 4
4...

output:

16
7
0
0
0
0
165
24
0
208
29
0
21
64
2
3
15
0
0
3
15
0
72
0
0
43
21
0
43
0
0
4
0
68
15
0
4
23
0
1
0
32
24
38
0
0
2
27
0
0
0
0
96
3
0
74
170
60
0
0
0
41
9
43
7
0
84
151
9
99
0
38
0
0
1
1
0
70
14
0
0
3
0
0
0
26
0
1
0
0
42
15
24
0
21
0
0
0
38
0
28
0
90
0
20
35
43
3
74
0
3
3
3
0
0
0
0
0
0
0
0
93
78
3
0
...

result:

ok 50082 numbers

Test #49:

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

input:

8 100000 49898
1 3
7 8
2 3
4 5
2 7
2 7
1 4
4 6
3 5
2 8
2 5
1 5
4 7
4 6
6 7
1 2
3 7
1 4
1 3
4 6
3 4
1 4
2 5
2 3
3 4
7 8
2 5
2 5
3 4
5 7
2 6
1 8
1 4
7 8
2 5
4 6
5 8
1 6
5 6
5 7
2 5
2 6
2 7
5 8
2 7
3 7
2 6
6 7
2 8
4 5
3 5
2 3
4 8
1 8
2 3
4 6
2 8
2 4
3 8
6 8
1 4
1 5
5 8
3 8
2 8
2 8
2 3
1 7
3 5
5 8
3 7
1...

output:

149
9
147
2
13
1
0
364
9
67
0
0
22
0
0
7
10
0
1
56
2
10
0
0
0
53
0
8
8
72
0
1
14
4
44
17
4
11
198
17
56
21
12
0
0
49
190
21
31
11
49
0
0
289
0
0
0
0
0
50
12
8
18
1
1
197
8
186
0
36
5
200
0
14
21
10
64
200
13
0
21
0
0
105
14
35
1
0
5
64
1
201
10
0
0
0
13
0
74
0
0
0
10
35
8
0
42
262
32
5
148
5
0
10
49...

result:

ok 49898 numbers

Test #50:

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

input:

9 100000 50046
2 7
1 7
3 9
1 8
1 7
3 5
5 7
2 5
6 8
3 4
2 9
5 7
3 6
3 6
2 6
6 7
6 8
3 7
6 9
2 7
1 5
1 3
8 9
5 9
4 8
4 9
3 4
4 7
8 9
5 6
1 4
1 6
6 9
1 2
3 5
5 7
3 5
2 7
3 6
6 7
1 8
4 9
1 6
4 5
4 5
4 5
2 4
4 5
6 7
1 6
1 3
2 9
4 6
2 5
3 4
1 3
1 9
3 5
7 8
5 8
4 5
4 8
2 8
6 7
1 3
3 8
1 7
2 7
2 4
5 8
1 5
8...

output:

41
0
7
0
18
66
8
1
8
43
0
0
54
5
0
301
0
166
18
0
6
0
0
0
0
240
363
44
23
20
18
132
0
214
12
0
7
0
9
0
0
0
44
44
20
0
0
52
142
0
0
75
0
12
0
0
19
42
7
0
0
0
196
0
0
0
0
38
82
0
3
240
0
0
68
12
0
0
0
0
2
0
10
0
0
20
132
9
31
6
0
279
0
7
27
7
0
74
0
0
0
12
0
13
39
19
188
0
27
0
15
0
2
0
0
24
0
0
2
42
...

result:

ok 50046 numbers

Test #51:

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

input:

10 100000 50006
5 10
1 8
2 6
7 9
1 9
4 9
3 9
2 10
3 4
2 9
1 2
3 8
1 7
5 8
4 8
6 8
5 8
2 8
1 3
2 4
2 6
2 7
5 7
3 7
4 8
1 8
8 9
2 10
7 9
3 10
8 9
6 7
8 10
2 8
5 8
5 8
2 10
7 10
2 9
3 6
2 7
3 5
4 9
3 5
7 10
4 6
3 4
7 8
4 7
2 6
3 9
3 7
1 7
9 10
7 8
1 9
3 7
4 6
1 5
6 8
6 8
3 4
5 6
2 4
1 8
2 4
4 6
3 7
5 6...

output:

355
1
6
8
40
217
17
0
0
14
27
177
30
0
53
0
0
0
135
167
278
53
5
15
211
60
367
0
10
896
55
43
32
0
0
0
27
58
288
0
37
142
34
17
11
0
48
0
3
1
52
1
52
21
86
0
0
81
127
0
9
0
0
183
0
29
2
12
152
10
440
0
0
44
68
0
5
398
7
50
20
6
0
74
0
23
0
118
0
48
0
50
0
25
0
1
39
0
20
48
18
37
349
160
0
27
6
0
0
2...

result:

ok 50006 numbers

Test #52:

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

input:

11 100000 50085
1 2
5 9
6 7
3 8
6 8
3 9
5 8
2 6
9 11
4 11
6 10
7 9
3 4
4 6
9 11
1 10
2 4
2 8
5 11
2 10
7 9
1 10
6 8
1 4
1 11
4 8
8 10
4 11
2 10
7 10
1 5
4 8
8 10
4 8
4 10
5 9
10 11
7 10
9 11
1 11
2 6
1 8
2 7
8 9
2 7
1 7
3 6
5 10
2 3
1 5
4 8
5 10
5 7
6 11
4 10
4 11
5 7
5 8
5 8
2 3
2 11
3 9
7 9
4 7
4 ...

output:

448
875
2
108
0
55
0
12
7
570
220
0
25
62
47
0
0
157
46
47
0
0
191
0
27
0
0
71
62
0
17
33
2
372
0
20
16
98
29
22
396
622
0
549
18
0
0
0
120
228
29
29
0
0
11
0
5
0
28
1
308
157
219
50
8
0
336
50
460
422
19
0
0
0
213
30
1043
12
356
41
341
174
309
81
2
76
63
0
0
0
412
3
386
10
52
0
32
0
414
0
460
56
0
...

result:

ok 50085 numbers

Test #53:

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

input:

12 100000 49927
11 12
4 6
4 10
2 5
3 12
2 12
2 7
5 7
2 4
2 6
5 8
4 9
1 7
3 8
11 12
6 7
2 4
4 10
3 4
10 11
2 8
6 11
2 8
9 12
6 12
1 7
4 8
1 2
3 11
4 9
7 9
4 9
1 11
2 8
5 11
2 11
4 8
2 11
5 8
1 11
2 12
6 11
5 10
4 12
5 12
3 8
1 7
4 5
2 10
8 12
1 9
5 8
1 3
1 12
3 10
11 12
3 5
5 12
11 12
1 11
3 8
2 9
8 ...

output:

0
248
0
0
19
41
0
0
25
750
9
47
44
57
0
777
936
0
0
50
0
4
0
43
5
0
456
0
499
46
21
0
135
18
0
44
65
4
340
0
0
171
228
440
1127
0
317
2
348
253
633
0
210
22
0
0
1033
0
616
9
27
148
294
63
5
187
0
430
1245
69
22
0
28
35
50
0
0
204
0
69
123
27
19
3
91
0
81
0
20
0
294
14
50
201
57
0
0
0
300
277
49
21
4...

result:

ok 49927 numbers

Test #54:

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

input:

13 100000 49938
6 7
2 4
8 11
7 13
4 8
4 8
6 9
3 7
12 13
1 4
9 13
3 9
6 12
1 12
4 6
2 10
11 13
7 9
6 8
5 11
5 10
3 13
3 8
7 13
4 12
5 7
11 13
7 11
12 13
6 11
7 12
10 13
4 13
4 7
5 12
3 13
3 13
1 9
3 7
2 5
8 13
8 10
9 10
4 5
1 2
1 3
6 10
5 10
5 12
4 6
2 8
2 13
4 12
1 3
4 11
9 11
1 3
2 13
11 12
3 11
1 ...

output:

170
66
32
664
353
0
28
1
27
221
0
19
0
205
304
33
3
139
643
46
1127
70
84
0
0
85
21
215
0
25
0
0
113
0
11
243
24
20
94
0
17
38
103
92
22
5
0
0
167
165
0
0
0
0
0
8
0
27
17
1
76
0
0
0
84
70
15
0
98
23
66
1002
0
0
22
9
164
44
518
133
0
0
28
0
0
101
2
0
31
99
12
155
17
0
1231
69
26
176
84
382
0
0
113
50...

result:

ok 49938 numbers

Test #55:

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

input:

14 100000 49974
2 9
7 13
4 11
3 9
2 11
11 12
11 13
8 12
3 11
1 14
6 14
2 4
4 14
3 10
8 14
1 3
3 6
6 10
3 7
5 8
5 10
5 7
8 11
1 11
8 14
12 13
10 11
8 11
8 9
3 12
1 12
4 6
9 10
4 12
11 14
10 12
5 12
4 11
4 6
5 7
5 11
3 10
3 4
3 12
8 12
6 10
8 9
7 9
1 4
1 11
3 7
7 11
2 9
1 13
7 12
4 9
13 14
4 10
3 13
4...

output:

189
0
31
498
890
0
67
1238
37
1582
81
7
2255
31
47
144
13
0
873
0
0
104
5
0
182
0
0
1540
0
144
119
2083
127
0
69
305
164
134
1621
632
386
406
0
23
0
5
0
37
0
82
2
0
85
0
1034
65
0
0
71
576
904
0
0
14
0
0
0
621
699
78
0
265
0
81
301
17
2
0
0
65
93
24
101
61
86
93
18
119
0
40
18
0
44
0
0
18
356
0
461
...

result:

ok 49974 numbers

Test #56:

score: 0
Accepted
time: 61ms
memory: 10188kb

input:

15 100000 50087
6 12
7 14
2 13
10 14
3 14
11 15
1 14
1 2
4 12
14 15
4 11
8 14
7 14
1 12
2 15
2 10
2 7
12 15
1 7
14 15
5 11
12 13
3 8
1 3
8 9
3 12
4 10
11 12
2 4
6 7
1 3
7 15
10 14
7 15
2 13
4 11
1 4
11 14
1 7
8 10
2 3
9 10
6 10
7 14
10 12
10 15
3 6
13 15
7 14
1 2
7 9
5 9
8 13
1 15
14 15
6 8
6 15
4 1...

output:

2261
191
148
17
0
202
0
112
0
1154
525
0
44
561
40
431
131
12
0
202
29
0
110
28
0
0
54
0
1652
0
51
621
12
264
11
150
0
69
516
1
0
0
0
0
0
661
84
56
1034
58
7
0
275
620
0
9
57
0
2
202
633
90
1370
0
44
0
0
94
1
0
37
21
81
0
9
376
77
115
0
1202
0
0
0
7
0
455
191
0
547
202
968
100
131
30
30
0
1610
0
26
...

result:

ok 50087 numbers

Test #57:

score: 0
Accepted
time: 61ms
memory: 12416kb

input:

20 100000 66661
17 19
3 10
1 17
4 16
1 20
5 16
6 7
3 10
13 14
1 3
9 13
13 17
8 13
6 12
2 10
3 8
9 15
11 18
3 11
1 9
12 20
3 12
3 15
11 19
8 18
9 10
9 18
6 8
14 18
9 17
1 8
8 19
8 18
3 18
6 20
2 10
10 11
1 18
3 20
1 12
1 18
9 10
15 17
11 16
10 20
3 12
9 12
1 19
13 14
4 12
2 12
1 15
5 6
9 20
15 17
5 9...

output:

19
0
0
0
58
0
134
0
0
47
2
36
46
0
0
0
10
0
0
0
213
0
0
0
15
0
102
50
55
90
0
120
76
214
0
48
1
0
0
0
0
0
0
0
73
50
77
65
0
0
80
214
0
1
0
0
0
58
40
0
79
0
47
76
0
0
0
0
0
0
84
0
64
0
0
0
0
175
19
305
0
0
0
164
0
206
46
0
289
0
301
55
134
120
89
81
0
0
0
162
102
76
142
0
42
275
0
0
0
96
1
28
0
0
28
...

result:

ok 66661 numbers

Test #58:

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

input:

20 100000 50058
13 18
4 13
4 16
1 15
3 4
12 14
13 15
2 12
1 16
9 12
1 13
8 16
4 17
2 4
2 19
1 3
9 10
7 15
8 14
2 18
9 19
2 16
3 19
3 8
14 20
5 18
6 16
6 10
3 20
9 20
9 16
9 16
5 17
13 20
7 15
16 19
1 16
5 7
17 19
1 5
3 14
7 15
1 7
1 16
4 13
7 20
2 19
9 18
7 11
3 13
5 11
17 19
4 8
9 10
7 15
10 14
13 ...

output:

1503
130
0
159
103
2038
0
338
360
46
153
1303
1695
0
0
0
0
0
25
805
529
30
0
690
103
366
2206
1353
2085
10
2718
3922
0
1335
33
1213
245
1
0
0
0
91
0
1686
22
0
3160
2601
76
0
0
0
770
430
0
2425
4
973
3320
0
249
428
0
0
146
0
0
1255
60
4623
200
59
0
41
0
971
0
264
37
66
812
296
0
15
0
24
1608
0
197
0
...

result:

ok 50058 numbers

Test #59:

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

input:

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

output:

0
0
0
33
124
350
438
0
0
0
0
0
728
0
0
74
648
253
151
23
50
0
0
0
161
186
173
42
0
277
287
82
0
0
328
0
292
16
27
0
0
221
24
0
0
86
0
206
0
0
0
170
0
0
0
0
685
0
0
0
0
0
0
21
0
0
0
79
0
0
229
0
0
33
0
52
361
0
59
0
0
0
0
0
0
0
0
369
0
63
27
238
0
35
0
84
77
43
471
45
24
115
0
0
254
0
305
0
0
0
6
0
1...

result:

ok 66687 numbers

Test #60:

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

input:

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

output:

5723
0
0
86
0
5134
0
852
2582
135
155
97
478
130
1641
95
0
305
676
2354
9967
7146
0
19
6685
38
0
364
530
409
276
111
0
15
244
0
88
3353
103
1140
122
2376
408
5769
0
30
9803
141
276
10205
271
0
0
436
399
2530
280
0
226
136
0
271
98
1010
4510
0
759
0
217
0
0
0
0
54
0
327
4847
2806
0
148
0
0
0
0
6554
1...

result:

ok 50007 numbers

Test #61:

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

input:

50 100000 66666
36 48
35 44
5 19
6 8
34 35
27 37
21 41
6 44
6 42
29 50
7 26
10 42
9 12
15 38
22 49
20 28
36 40
2 34
33 50
17 40
10 33
33 40
4 45
15 24
30 35
16 34
15 45
7 29
9 29
42 46
24 28
2 32
5 47
12 42
15 30
10 16
13 16
1 50
9 39
18 24
5 48
7 24
30 38
18 32
24 46
26 33
19 43
5 31
17 36
16 38
18...

output:

592
0
44
0
328
1076
273
49
0
397
0
0
0
253
0
332
0
906
401
122
689
772
543
0
0
0
1021
64
836
268
636
814
0
0
122
1005
59
0
143
338
2041
0
0
141
0
0
0
0
0
363
0
0
64
340
109
43
512
432
0
0
0
0
102
435
0
0
617
0
0
480
509
1091
0
0
701
646
307
0
0
1343
105
74
162
396
1763
0
0
702
0
124
0
590
1483
943
0...

result:

ok 66666 numbers

Test #62:

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

input:

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

output:

710
0
0
115
20
0
0
88
236
0
4164
442
31
0
0
0
304
0
17166
0
0
535
7862
7454
0
0
451
156
900
63822
0
1541
0
358
3689
0
0
3013
0
0
0
246
805
1112
0
0
24979
331
130
0
0
681
0
144
15655
7610
416
0
0
20
0
0
0
0
0
712
1052
0
0
1153
7923
0
378
4394
1277
2343
0
220
592
18347
14
16670
22422
624
40843
49427
0...

result:

ok 49916 numbers

Test #63:

score: 0
Accepted
time: 95ms
memory: 12676kb

input:

100 100000 66677
24 59
47 81
57 79
80 85
33 96
23 49
46 87
32 41
44 47
21 47
4 15
71 91
42 59
32 77
10 39
30 43
6 94
35 61
22 89
91 100
48 70
27 86
53 76
92 95
27 47
23 33
42 63
75 99
49 52
70 78
9 34
32 55
55 98
55 72
46 90
11 86
2 50
16 63
63 95
11 75
41 97
34 38
1 18
45 73
74 88
49 69
89 97
33 88...

output:

48
505
2290
0
0
2461
0
0
0
0
105
559
170
0
0
0
1116
0
0
0
2146
0
8070
2927
0
0
1383
3788
5211
1629
0
0
1546
1466
3645
0
570
2723
3255
4871
0
0
1763
0
0
1156
1982
0
3531
0
0
9403
1318
377
0
0
1410
1813
0
667
8867
0
0
0
0
0
3753
0
0
76
3461
0
2662
3992
0
436
366
5104
0
1435
1139
0
0
0
0
84
4141
3960
2...

result:

ok 66677 numbers

Test #64:

score: 0
Accepted
time: 123ms
memory: 10624kb

input:

100 100000 50034
45 71
41 50
36 48
20 73
19 96
4 94
33 90
15 57
3 95
30 85
46 98
36 46
2 74
2 48
21 47
61 77
10 24
47 85
34 52
5 70
55 73
33 70
62 69
26 85
32 87
18 83
63 88
40 57
2 35
18 32
54 91
73 78
42 80
53 98
23 54
2 8
3 19
14 70
1 13
23 68
2 79
9 50
5 21
33 71
55 85
69 90
34 48
12 67
11 32
32...

output:

0
8042
4791
0
0
0
23693
4069
433
5344
64460
0
1123
4631
39559
2257
46314
39147
37201
30033
2872
0
0
0
98984
35469
29808
88030
0
1020
0
302
4827
61371
0
0
20655
0
0
20938
2235
315
0
0
0
11717
0
63857
33
320
36710
57972
0
0
78683
3232
1230
15545
55615
9490
0
20064
192
0
433
1412
0
18920
11222
2883
0
1...

result:

ok 50034 numbers

Test #65:

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

input:

130 100000 66659
43 107
63 71
60 96
14 66
54 117
32 54
104 115
15 120
38 117
24 88
45 127
3 13
41 116
21 122
56 87
27 125
2 10
47 120
57 94
86 116
27 47
4 99
20 68
79 127
11 108
32 102
33 42
35 101
13 49
9 49
14 20
79 107
9 127
65 121
9 66
22 91
56 126
52 72
16 68
110 126
11 64
15 104
14 58
67 110
8...

output:

723
0
8523
0
0
0
0
809
1376
9423
0
1372
0
3783
4493
0
0
12882
59
1566
187
0
4490
0
3736
0
0
0
8439
0
0
0
0
0
0
0
0
0
0
2895
0
0
0
1933
0
2755
173
1004
2985
0
13328
0
0
0
97
4237
5071
3809
0
0
0
12705
0
0
0
7177
8083
0
3221
0
0
0
1796
975
0
2710
0
0
0
1054
0
0
1075
531
10862
0
1420
1410
4663
6151
0
0...

result:

ok 66659 numbers

Test #66:

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

input:

160 100000 66649
40 148
3 119
154 157
68 96
20 125
11 38
88 98
59 90
23 90
43 85
29 95
85 145
22 62
30 104
37 111
43 85
78 112
105 109
47 111
51 156
72 136
5 141
27 150
23 97
38 101
64 146
66 88
80 124
5 100
2 157
6 18
34 74
1 20
93 97
4 129
81 114
25 126
61 64
129 155
8 21
2 105
76 131
17 20
64 151...

output:

0
4719
10771
0
0
1391
868
820
10041
0
0
0
0
0
5185
15503
5904
49924
1427
0
10318
1258
2486
4542
0
0
17923
0
0
0
0
0
0
0
16458
0
0
0
0
0
0
0
0
0
471
0
5538
2685
0
222
0
0
0
0
4277
0
4303
7200
0
6099
0
0
2332
0
0
0
0
1122
0
0
1582
0
1110
0
2615
2742
4336
10507
2600
6703
2119
7873
0
0
6429
0
7510
8684
...

result:

ok 66649 numbers

Test #67:

score: 0
Accepted
time: 106ms
memory: 13320kb

input:

190 100000 66673
21 187
103 162
50 117
27 125
67 146
13 103
67 184
23 159
82 108
31 141
129 172
113 130
95 173
87 151
7 177
55 186
125 177
35 180
134 190
98 104
126 143
29 94
172 176
15 114
50 137
47 48
97 158
111 166
36 108
126 187
3 155
26 75
25 153
132 180
90 100
62 91
101 153
60 81
59 183
17 136...

output:

0
0
9314
0
8307
0
7469
489
0
0
0
0
118
0
10385
2988
0
4516
0
2990
0
8047
0
0
1773
0
2292
0
22383
0
2963
0
794
1620
5474
0
0
8448
11748
0
0
0
3231
0
9895
876
4039
0
27523
9797
0
0
0
0
14625
0
1981
9619
0
281
14
15080
0
0
0
4544
21072
0
5622
0
319
12620
0
6178
0
0
1132
1516
36260
0
10500
4647
1211
100...

result:

ok 66673 numbers

Test #68:

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

input:

210 100000 66673
42 114
73 75
85 195
44 108
136 148
36 146
137 143
26 177
198 203
52 142
45 170
27 133
132 157
94 114
64 109
57 60
37 139
51 115
145 199
25 88
3 34
119 141
18 85
41 127
8 28
67 108
162 195
85 110
21 87
171 197
152 158
4 170
3 41
11 117
27 37
169 186
76 84
19 192
86 156
71 181
107 191...

output:

19819
0
4109
2438
0
12165
0
19542
0
11677
12562
9127
14020
0
0
13434
14572
3515
0
0
0
539
0
3264
17232
8694
0
0
0
7369
0
475
15022
0
8828
3163
35350
12832
4868
0
1246
0
0
0
0
0
4736
0
0
0
22019
0
0
0
0
1337
27928
0
0
0
7544
0
0
39537
0
6533
0
13791
9739
0
4804
15070
0
0
53901
0
2658
7199
0
5400
6201...

result:

ok 66673 numbers

Test #69:

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

input:

240 100000 66655
89 122
134 203
86 182
18 239
118 202
139 227
149 197
23 85
58 221
75 151
33 136
80 111
21 128
128 146
128 133
84 111
209 233
84 157
7 173
196 200
99 216
24 162
1 219
96 215
82 206
36 198
111 112
40 96
72 210
99 205
12 42
47 240
174 235
99 220
28 132
62 112
90 188
19 217
110 141
119 ...

output:

1978
0
2629
39621
20889
7687
0
2423
1080
0
643
0
0
8670
0
18810
16694
0
0
0
0
663
1616
0
0
14957
0
21285
44762
0
6593
19
327
0
0
0
0
0
4030
0
8237
0
23323
0
6188
0
2244
0
24527
0
0
0
5385
0
3884
0
0
0
0
0
1051
13626
3330
5508
20530
0
0
0
29248
9178
2856
24661
0
0
5913
0
4467
0
0
0
3044
0
3736
5822
0...

result:

ok 66655 numbers

Test #70:

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

input:

280 100000 66669
5 132
134 270
68 162
164 280
73 280
28 61
48 248
22 68
90 227
41 111
78 162
73 252
212 244
172 206
71 224
55 192
117 172
83 163
62 151
50 176
5 80
49 89
52 75
86 223
189 206
122 192
143 215
84 89
101 127
214 238
19 230
249 257
41 148
63 251
47 248
88 256
38 107
91 246
44 237
161 240...

output:

6517
0
30952
1206
19652
0
9231
34037
29896
0
19936
0
342
30418
3090
0
31440
20481
0
16963
3115
0
54452
3245
10773
28478
0
43275
0
837
0
53262
3927
8571
3847
1674
26316
0
17459
0
7477
0
210
0
0
0
65494
2639
0
0
16774
0
0
3073
409
12768
8494
0
3357
78904
4809
9678
4720
8511
0
3240
26198
3046
0
0
0
256...

result:

ok 66669 numbers

Test #71:

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

input:

310 100000 66670
59 185
128 271
30 269
2 60
130 151
51 200
132 232
37 86
125 294
215 305
61 234
158 305
175 302
117 303
123 143
2 115
233 273
9 127
144 269
101 127
20 71
6 307
31 292
170 179
156 237
61 173
148 190
67 143
28 193
49 90
235 246
32 178
35 259
133 299
37 171
134 293
58 238
105 308
74 292...

output:

22697
0
0
26688
0
16256
0
3275
0
0
15167
1226
6305
214
0
20337
24168
41845
0
18335
8073
0
10754
17033
0
0
11871
0
17871
0
0
25529
0
20175
34426
21823
5215
2426
0
0
0
0
13963
0
4572
5037
0
0
0
0
0
0
9327
8394
18994
0
0
0
0
5163
18928
0
3281
0
7193
4515
9154
11389
0
0
1389
0
0
20594
20840
5852
43145
5...

result:

ok 66670 numbers

Test #72:

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

input:

351 100000 66669
142 300
1 207
273 308
29 246
228 339
85 87
133 338
310 348
136 198
97 126
176 241
302 325
175 260
12 24
181 206
119 131
10 158
140 196
2 140
17 306
44 86
13 299
130 292
192 288
37 107
49 294
179 293
112 280
143 341
139 270
132 347
239 330
246 300
45 220
102 201
102 292
56 336
159 30...

output:

3294
0
0
0
34363
7106
0
0
11373
13268
6143
0
0
43490
2766
0
0
2781
3599
0
0
55210
26422
0
0
42304
0
0
4574
0
0
0
0
46794
1187
22748
0
35046
0
23577
4720
0
21792
0
2632
15635
0
43646
59
22873
13370
48615
66821
0
178
47864
0
24872
0
13046
14132
5403
53030
0
32454
11962
0
48016
0
0
0
0
0
42908
0
20732
...

result:

ok 66669 numbers

Test #73:

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

input:

399 100000 66674
143 152
17 84
1 191
81 266
86 399
60 390
315 361
86 135
190 202
110 269
80 347
207 386
238 367
76 280
174 250
346 352
90 245
127 202
233 373
75 272
211 272
178 225
27 340
23 378
348 397
4 276
286 349
32 221
159 335
60 155
186 263
68 348
23 221
204 297
128 278
64 329
320 367
230 275
...

output:

12398
53343
27102
7565
48147
0
49817
64612
59059
0
0
40689
0
8075
0
0
4998
0
38689
25501
545
16796
0
38257
25538
0
0
17921
0
0
64925
8925
45590
0
0
0
0
24117
23101
9704
0
36495
21551
9700
0
0
0
0
0
0
41521
30971
3702
64533
75274
2071
0
13573
17064
0
0
43223
0
67042
14954
2939
75764
53714
0
49199
364...

result:

ok 66674 numbers

Test #74:

score: 0
Accepted
time: 124ms
memory: 10780kb

input:

130 100000 50165
18 68
10 77
18 28
59 127
35 43
116 124
72 86
23 76
52 72
14 121
38 108
49 68
83 85
58 112
33 66
3 100
98 130
15 89
33 100
4 79
68 92
9 28
41 104
14 37
70 101
1 7
55 117
6 45
5 74
102 106
78 85
59 97
23 83
35 70
53 121
31 115
4 114
46 76
34 88
71 98
38 116
39 56
39 68
62 75
4 90
75 9...

output:

0
64473
70966
119
80859
0
843
554
0
87307
27545
12714
0
0
2837
45
0
963
70291
14006
5477
47726
4465
4058
16246
798
3027
0
96835
3718
0
52252
0
14837
8557
4985
8754
0
57091
2890
2145
0
45411
9639
0
5907
58129
2007
465
0
3544
9792
2257
0
0
76429
1975
1335
10737
0
0
0
2116
0
0
10835
16229
74019
269
490...

result:

ok 50165 numbers

Test #75:

score: 0
Accepted
time: 123ms
memory: 11080kb

input:

160 100000 50099
74 139
66 87
44 52
111 129
59 99
42 146
92 131
49 56
18 109
17 53
24 70
32 113
142 145
79 80
34 108
14 74
3 81
37 64
5 30
54 151
39 59
19 99
49 151
132 147
47 120
15 24
66 134
85 101
109 121
92 98
35 93
75 123
149 154
1 3
87 129
10 135
39 73
134 138
79 150
41 67
43 68
34 100
36 154
...

output:

10120
218
8491
0
0
61494
14019
43059
0
4519
0
242
2771
0
86148
95566
688
81160
12081
0
1125
53995
0
0
74319
58255
12007
17021
0
13142
1796
0
0
9161
61208
0
8583
1239
0
7864
0
125
72294
57344
0
0
0
24610
0
79026
0
1055
12078
20609
5353
6441
0
31212
97751
62642
0
58893
11050
20151
0
40933
65942
79811
...

result:

ok 50099 numbers

Test #76:

score: 0
Accepted
time: 120ms
memory: 11396kb

input:

190 100000 50023
36 99
4 23
93 105
40 161
141 156
131 145
106 133
4 142
78 123
52 178
147 170
83 135
111 180
70 174
42 112
19 75
8 146
110 171
7 26
108 183
14 42
80 152
141 152
153 154
110 176
57 121
42 99
27 124
107 136
154 188
65 137
65 114
19 99
98 129
32 59
12 46
92 105
11 73
11 12
25 110
53 110...

output:

0
8041
0
4314
0
0
4485
0
0
50934
0
0
0
1624
0
15854
8744
0
3248
0
1122
88437
5301
0
0
0
0
1535
73876
34792
0
0
0
89079
16539
7558
3087
0
10818
0
34286
96042
0
89145
0
6194
73663
0
0
64449
15156
571
91244
5503
65488
0
827
0
0
0
0
87553
0
33919
0
0
0
11218
0
21366
0
61353
0
18299
13745
6387
43524
0
73...

result:

ok 50023 numbers

Test #77:

score: 0
Accepted
time: 126ms
memory: 11368kb

input:

210 100000 50068
179 186
86 101
34 109
93 105
91 115
9 42
155 174
52 187
143 153
70 164
61 151
64 196
41 163
78 132
109 116
89 149
41 118
126 127
138 179
16 35
2 155
21 134
70 179
25 80
32 33
7 104
79 167
6 90
134 193
197 206
77 111
104 146
118 140
108 173
64 136
82 189
63 194
89 197
16 113
14 141
1...

output:

0
0
0
16823
73823
24116
53754
70846
0
38658
74990
0
0
7107
7368
0
0
0
53793
5315
0
6218
0
0
3009
0
8076
27339
81867
0
1891
9197
0
0
0
90583
0
5738
0
3940
0
0
6640
0
10172
0
25993
1702
5173
8132
7576
93912
0
412
9851
0
17047
0
31329
22734
5972
0
0
17569
0
0
11908
2968
0
12730
5649
0
0
11911
27878
479...

result:

ok 50068 numbers

Test #78:

score: 0
Accepted
time: 127ms
memory: 11492kb

input:

240 100000 49940
52 101
3 202
8 237
162 192
6 124
114 186
93 120
108 129
11 148
26 76
1 224
113 195
205 224
90 121
65 82
153 229
136 187
77 136
111 191
80 165
103 235
181 235
130 168
70 152
90 217
36 171
126 237
191 234
3 182
189 203
19 161
147 224
68 210
63 186
45 84
9 90
167 232
179 190
86 187
142...

output:

9190
19084
42697
0
19456
0
847
24020
93140
0
21246
37941
16153
0
402
25350
0
0
8496
0
68480
28934
0
261
1472
0
0
14886
0
15457
0
73448
0
0
50578
75417
0
50410
30096
1795
44932
11136
2960
0
0
39987
62239
90830
12805
20659
0
24702
5923
0
10497
62791
18468
0
56419
46393
0
17438
8462
32986
8169
11144
34...

result:

ok 49940 numbers

Test #79:

score: 0
Accepted
time: 127ms
memory: 11928kb

input:

280 100000 49897
47 103
15 160
143 208
31 265
54 114
94 182
66 208
3 198
178 223
208 247
229 268
17 174
157 173
81 196
185 241
95 237
173 248
95 172
74 125
14 28
75 223
87 243
39 91
28 190
168 248
45 252
60 169
76 89
118 143
96 189
89 229
86 200
162 275
83 209
233 274
18 79
77 262
188 225
38 39
34 1...

output:

56
9195
2350
14415
96495
54825
0
19502
0
43217
60108
0
19977
22317
52259
93981
1176
0
7159
6492
2875
0
2006
0
0
8530
189
1220
10567
0
5634
2139
65914
53336
845
39776
725
0
79222
90914
32512
0
14295
0
7782
22336
0
6363
19298
0
71462
3876
43888
70590
0
84888
80750
29693
0
3227
61607
17149
10232
0
0
7
...

result:

ok 49897 numbers

Test #80:

score: 0
Accepted
time: 125ms
memory: 11832kb

input:

310 100000 50102
241 284
40 61
217 246
45 253
33 85
195 258
10 87
190 205
138 195
56 147
97 116
150 233
14 184
74 183
114 302
87 266
51 199
266 310
164 227
135 253
230 249
147 216
8 288
83 256
53 196
125 127
95 101
78 180
9 20
57 134
118 123
106 227
33 268
17 200
95 305
122 157
145 308
34 231
93 97
...

output:

1399
12393
53731
28888
65153
18093
0
1571
5117
94911
13949
0
4508
39443
1114
32195
99096
0
812
3118
6303
47478
0
21757
0
34727
6207
0
54524
75727
46843
9459
0
41576
7596
0
6526
55668
35180
0
23165
9724
43368
12040
19457
25838
0
25847
69333
11430
85575
22598
0
0
0
21107
77
9538
0
19337
0
0
14525
0
18...

result:

ok 50102 numbers

Test #81:

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

input:

351 100000 50073
159 170
144 326
220 324
115 306
32 48
41 304
102 322
61 245
34 341
34 286
170 274
8 142
144 321
181 209
242 294
82 260
173 178
211 258
15 111
128 250
96 235
89 232
231 319
21 302
216 240
122 319
226 320
202 316
77 111
92 274
189 280
158 195
20 201
203 289
31 245
89 338
58 245
175 27...

output:

5161
0
35799
19780
39445
89400
16792
55169
17377
0
28067
0
3835
3291
2224
53116
0
0
2784
2147
0
1948
0
90241
98316
90069
0
0
0
65837
0
36821
0
56809
70025
64592
0
66946
5211
29136
2990
60523
53432
0
55467
47949
93318
0
80717
0
0
0
0
0
0
41031
88155
15180
69209
0
28452
23384
19829
31173
20662
42236
3...

result:

ok 50073 numbers

Test #82:

score: 0
Accepted
time: 126ms
memory: 11980kb

input:

399 100000 50094
164 310
242 246
317 369
232 371
46 340
99 170
68 220
2 57
142 194
355 375
170 239
79 183
188 399
304 377
87 355
255 341
82 205
161 349
241 388
65 199
66 189
189 222
3 205
66 195
81 231
85 154
225 380
233 329
56 197
25 331
114 118
126 217
342 379
105 289
140 249
3 163
258 327
151 152...

output:

0
54682
10557
40994
1066
9460
0
56458
0
38351
19912
39384
0
65367
0
11649
22836
31602
34890
11466
9951
0
12706
76640
29182
82610
0
0
11250
31796
0
4845
0
0
12625
17545
8557
0
2723
72172
15788
14318
69225
2968
26520
27501
0
4240
11540
24267
33538
0
0
13297
0
0
0
0
15671
34230
0
57198
80630
4162
60647...

result:

ok 50094 numbers

Test #83:

score: 0
Accepted
time: 149ms
memory: 9676kb

input:

150 100000 33343
9 77
39 110
89 105
11 52
58 72
27 40
10 25
122 146
120 131
101 126
2 91
46 133
20 139
113 120
48 53
36 50
21 131
59 106
62 106
56 146
56 131
18 110
6 46
47 102
37 47
25 145
112 114
113 148
3 42
104 118
145 147
32 97
51 109
41 86
38 127
77 124
14 87
79 111
70 113
123 134
57 105
38 79...

output:

0
0
0
0
14172
3764
3511
3065
0
14637
4923
22921
30883
1577
81015
2612
2963
0
67661
50534
90719
0
0
73291
2987
83344
24767
0
2635
57198
0
61010
12124
17118
2652
17624
322
29815
35056
94191
12811
9860
4495
4727
72065
52464
36230
0
81982
782
35620
79623
938
2277
0
93764
57280
27805
1321
0
91261
0
13818...

result:

ok 33343 numbers

Test #84:

score: 0
Accepted
time: 140ms
memory: 10472kb

input:

250 100000 33225
67 245
116 189
2 216
124 193
92 107
130 199
94 141
2 229
54 173
107 225
19 27
28 46
113 156
62 159
45 133
109 184
141 230
67 232
41 101
92 203
80 207
219 234
110 209
12 160
49 204
220 234
1 164
130 174
76 91
89 173
82 98
5 67
100 131
34 149
116 124
44 242
144 236
8 42
192 214
13 244...

output:

31120
65747
85873
0
1009
0
50413
49453
85528
492
28831
20277
64663
0
1416
53535
0
0
45702
99567
50725
81428
40426
0
86621
0
43485
21759
61889
12483
0
17625
0
1801
0
26314
46135
21078
48103
93311
40377
347
20633
42635
4301
55505
11850
93741
4027
95504
94328
57289
0
0
60684
84010
718
23427
11412
25306...

result:

ok 33225 numbers

Test #85:

score: 0
Accepted
time: 133ms
memory: 11156kb

input:

444 100000 33281
67 116
196 244
178 360
161 183
169 355
164 330
54 341
77 178
95 201
78 110
215 266
47 89
84 93
250 418
45 266
221 422
68 439
235 258
83 157
349 363
348 366
35 402
378 427
93 263
152 248
119 172
105 236
223 245
83 275
315 444
149 181
176 221
61 391
121 373
168 266
17 174
97 347
113 1...

output:

0
50240
69062
46017
70045
39022
20365
40284
95735
90294
91531
88498
82644
80465
10023
0
12078
9671
38500
0
70066
6645
30716
76932
92961
58395
33744
24738
81126
0
89937
23415
29659
7755
87082
47604
42935
34115
99649
0
6121
6253
8412
24309
8234
0
0
25897
23341
7348
18950
85652
19175
91381
23768
26438
...

result:

ok 33281 numbers

Test #86:

score: 0
Accepted
time: 131ms
memory: 11400kb

input:

787 100000 33262
565 617
508 512
66 610
247 344
122 753
80 404
209 667
261 301
224 381
136 757
57 354
130 583
384 507
339 593
232 408
171 706
80 385
386 468
162 255
280 378
555 749
12 417
200 569
412 622
188 231
116 333
585 734
666 759
127 468
18 253
525 733
502 783
20 601
437 618
88 397
250 313
158...

output:

61634
27575
81753
3104
55123
41706
20512
83332
71484
0
52097
17397
0
0
0
91220
41761
46335
7740
54751
75502
7522
41278
31763
67430
46558
41767
30961
920
0
15461
0
0
0
18015
74784
47773
0
91696
53816
45864
52040
1333
86131
52135
14909
65706
3907
4349
18612
34099
4532
0
17752
83490
80776
28402
58355
7...

result:

ok 33262 numbers

Test #87:

score: 0
Accepted
time: 156ms
memory: 9388kb

input:

150 100000 28583
86 147
87 92
58 138
13 43
51 107
14 149
61 86
5 126
13 69
15 94
40 73
41 115
15 34
8 43
23 94
18 49
5 111
14 24
34 70
42 52
4 102
48 142
74 98
11 82
59 89
1 15
123 140
1 3
15 29
115 122
58 79
19 117
57 126
80 128
103 131
113 136
36 44
13 94
5 68
33 94
43 103
88 116
42 55
35 141
3 12...

output:

10747
8304
2385
47367
65152
18135
0
35674
34436
0
0
7674
73894
91865
20546
26800
34867
0
9611
2770
2409
72554
57384
28872
46447
6494
28062
94690
2960
528
69018
11606
16417
46689
65226
7466
4381
31645
23937
0
45343
13286
62020
17882
0
8642
0
4696
2695
74293
295
0
34837
68953
492
50291
81548
65739
320...

result:

ok 28583 numbers

Test #88:

score: 0
Accepted
time: 140ms
memory: 10328kb

input:

250 100000 28546
7 124
124 234
87 90
140 181
219 248
62 164
216 244
100 125
105 242
166 226
116 139
121 178
180 199
22 210
160 169
106 115
59 163
33 39
114 248
87 97
19 53
166 230
76 78
43 234
210 212
37 174
22 64
31 245
177 225
185 241
96 178
7 127
131 192
108 128
108 166
63 180
21 116
118 138
82 1...

output:

39386
6422
50914
0
0
86183
52704
0
5938
23043
45025
0
24573
4445
17135
27065
44708
29778
25893
50280
0
77710
27308
7390
79002
32984
5928
0
46041
86938
66339
42815
84084
89843
0
37250
62903
21074
19057
67985
0
1051
99754
31501
1180
49765
10809
0
57455
33695
4045
64494
0
12729
42776
30920
38799
3552
1...

result:

ok 28546 numbers

Test #89:

score: 0
Accepted
time: 140ms
memory: 11096kb

input:

444 100000 28574
356 375
46 254
396 415
67 323
291 348
14 202
82 317
107 183
68 287
171 346
377 410
344 364
157 401
104 112
119 262
19 131
120 204
95 125
172 388
245 251
84 369
192 417
384 427
236 289
136 327
156 190
73 438
81 431
177 397
76 430
187 252
122 241
336 419
193 315
18 36
82 406
143 331
1...

output:

66737
9480
27067
61692
0
35974
48768
62291
0
36854
22763
72218
0
34897
36651
6749
18731
89197
47190
18224
93858
50177
90235
98222
0
0
37417
60265
3584
4980
39511
94329
31037
77079
37308
0
0
43790
3551
44025
15955
20380
79549
0
19971
17384
81069
69132
45210
0
14175
0
71037
82560
12020
8570
43170
3412...

result:

ok 28574 numbers

Test #90:

score: 0
Accepted
time: 131ms
memory: 11348kb

input:

787 100000 28595
482 746
309 536
484 544
511 590
114 736
477 705
69 359
230 291
394 414
94 450
439 652
20 213
108 646
3 756
107 673
15 629
450 523
524 672
424 595
80 539
239 290
367 503
166 340
280 426
642 721
474 665
42 600
62 768
104 342
24 264
37 324
331 374
271 387
439 576
132 380
305 447
339 40...

output:

27108
0
13487
0
17830
0
33563
46829
85725
41282
23373
0
88465
44568
20874
69108
0
82231
93823
26345
92985
0
44166
85503
50665
79315
0
0
21999
3076
0
6379
22941
43981
25088
0
17663
0
0
8447
30765
43067
37070
96767
0
46744
0
25711
12989
68174
32721
354
17854
123
29148
0
37427
89326
92178
28095
39649
9...

result:

ok 28595 numbers

Test #91:

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

input:

150 100000 24918
41 71
115 146
74 106
30 76
12 54
56 139
30 114
38 147
80 108
7 12
40 129
30 134
49 52
59 111
122 126
20 132
34 126
96 101
32 91
106 141
17 41
36 98
34 103
96 110
2 127
51 133
22 124
114 142
49 127
22 126
7 81
97 135
7 12
55 82
76 78
66 99
38 101
26 146
36 39
117 118
18 149
2 142
45 ...

output:

0
953
97719
59948
71701
72452
96201
76694
0
96088
0
3304
22719
4605
59023
851
83233
45027
84452
12826
0
2298
2584
5149
52530
1164
0
96743
5128
0
73262
90976
15229
21965
1933
1807
55385
90071
27571
97984
99179
0
3829
19818
27374
50526
148
28847
81646
58944
2396
1690
70898
7440
19127
6445
80081
37350
...

result:

ok 24918 numbers

Test #92:

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

input:

250 100000 24913
39 113
149 228
93 176
130 200
178 199
74 85
54 75
33 65
18 150
59 226
200 241
61 63
115 176
146 248
14 81
40 215
6 17
126 226
111 226
57 216
49 164
29 174
154 208
225 230
12 228
2 226
18 235
172 177
104 224
57 115
2 169
24 168
34 181
131 249
174 237
19 34
18 44
57 190
75 226
15 155
...

output:

0
0
92965
83407
91122
1734
0
30694
81694
2284
1323
0
20511
23029
37519
25056
7476
32664
52713
53390
27154
86240
66189
15211
18808
0
0
2779
0
17160
3447
60755
13425
3319
1444
14117
92902
69262
74094
3067
47413
70789
0
28082
53666
76506
51960
10877
87579
53240
77540
46173
0
14918
42044
62715
0
40243
8...

result:

ok 24913 numbers

Test #93:

score: 0
Accepted
time: 136ms
memory: 10800kb

input:

444 100000 25077
372 435
141 325
163 404
31 107
106 387
32 143
31 288
116 124
233 386
90 148
69 416
39 322
356 409
41 272
166 256
430 444
5 249
42 296
281 426
158 269
157 381
210 410
114 175
184 347
107 139
178 396
262 290
128 292
17 21
66 73
348 384
35 198
110 226
33 325
19 292
1 219
264 373
23 314...

output:

76901
70904
58424
0
5940
69809
90240
0
91667
34480
57633
94778
39884
92505
74974
3939
20929
0
0
9293
48029
80688
28809
0
35639
79851
3460
5623
64850
42346
0
16087
14030
4210
34887
70747
64596
0
75362
58019
94272
70575
23054
8110
0
13412
0
0
30336
20008
28688
0
6882
4485
0
81746
89003
21068
2587
0
82...

result:

ok 25077 numbers

Test #94:

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

input:

787 100000 24964
44 707
233 785
607 680
232 532
154 406
256 780
436 638
267 348
77 354
46 316
469 597
286 731
249 728
213 455
152 438
116 142
150 704
112 288
375 561
505 675
71 423
120 544
5 512
342 783
207 612
92 260
5 385
90 173
513 596
38 316
521 618
219 243
91 342
269 497
305 411
544 637
217 374...

output:

0
0
73998
13441
76956
21872
0
27097
0
46274
20860
92957
88256
28825
0
57681
0
0
0
7089
40500
75994
58014
87259
45764
57375
1785
0
82044
97956
35415
42154
16925
80507
0
80728
43560
97914
61737
25352
82880
63799
83413
85597
69894
31664
41093
59492
72857
0
13697
44660
2590
33022
18005
75793
68806
0
954...

result:

ok 24964 numbers

Extra Test:

score: 0
Extra Test Passed