QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#472644#3101. Event Hopping 2egypt_ioi2024_11#32 188ms28216kbC++231.7kb2024-07-11 17:56:112024-07-11 17:56:12

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Time Limit Exceeded

Test #1:

score: 7
Accepted
time: 1ms
memory: 4320kb

input:

1 1
1 3

output:

1

result:

ok single line: '1'

Test #2:

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

input:

2 1
2 4
3 7

output:

1

result:

ok single line: '1'

Test #3:

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

input:

3 1
2 5
3 5
4 7

output:

1

result:

ok single line: '1'

Test #4:

score: -7
Time Limit Exceeded

input:

99999 93097
40044 40749
44538 45365
46530 47401
52845 53481
59519 60065
86226 87059
88353 88992
95665 96502
95669 96575
100446 100968
121870 122544
130836 131540
146294 147230
151177 151970
160381 161376
164174 165119
166582 167438
169062 169687
173200 173849
177329 178217
189213 189811
249372 25029...

output:


result:


Subtask #2:

score: 1
Accepted

Test #47:

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

input:

1 1
134842099 137944073

output:

1

result:

ok single line: '1'

Test #48:

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

input:

2 2
4015595 884953730
519508315 726912949

output:

-1

result:

ok single line: '-1'

Test #49:

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

input:

3 2
551691302 800582045
14063803 52897269
153641504 567834643

output:

1
2

result:

ok 2 lines

Test #50:

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

input:

18 3
157893686 958635898
790021767 976682032
534783017 706987897
216566011 510148270
288661613 856715472
81126924 420966670
9734253 823219818
77427078 241270378
182953794 928971032
65710916 937359407
159217847 343023570
266169092 635952191
94867522 407392584
298640819 490028599
281580042 514089998
6...

output:

2
3
4

result:

ok 3 lines

Test #51:

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

input:

19 3
345121760 363569961
369142474 697961114
204455374 777512357
278051598 780834857
119744682 610142516
112692534 284271720
530820418 613805256
666599238 970772442
684066330 747151742
52464000 153949333
361766230 921325388
34600363 168745634
119418778 738281466
828841976 976561834
257913352 2579536...

output:

1
2
6

result:

ok 3 lines

Test #52:

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

input:

20 3
226617517 417144410
401110226 504506272
204308913 972565478
100780114 930332684
473716139 730386187
327436800 871728821
662616072 881801440
469971234 769277127
437331467 913865677
641546412 700063729
82089639 830256714
384651823 502387376
558881974 905373190
468189379 998408858
9103683 60217281...

output:

1
7
18

result:

ok 3 lines

Test #53:

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

input:

20 5
715591101 817706977
777008847 930020190
379125190 717746290
308826535 651449374
799848635 899870053
173402733 393191194
565584335 789226348
291163241 758381981
249473019 374801668
294956234 880404922
451362750 913870571
98855617 246302398
339866606 382702111
293058132 409201146
478015003 708631...

output:

1
9
12
15
19

result:

ok 5 lines

Test #54:

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

input:

20 4
95564966 475651640
544140915 921414489
36636943 545028649
269212181 518161723
368415853 600482753
416749483 825099524
704848425 946709199
145082659 465308089
751497619 765279722
452763328 557958381
643817392 876292284
353226095 933184330
466610247 590597228
29324927 65589713
155598093 306733984...

output:

5
7
14
15

result:

ok 4 lines

Test #55:

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

input:

20 2
341059917 968468550
619575412 657744605
362725213 784431788
79002877 857963719
636336680 943339572
282572479 300370019
213849085 706084423
315706132 851874320
740367416 998763448
113510482 521411850
198080835 487564765
29193064 86493364
488295690 701227663
351650597 899167999
437802529 73566590...

output:

1
6

result:

ok 2 lines

Test #56:

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

input:

20 1
827468447 879951302
735432164 759558988
269959865 944012171
67243577 84278317
805433568 936534843
171608293 591686301
112362102 822334845
410116008 619648090
306041507 327894522
360193096 488922828
417005225 834550228
872712520 873151446
472785468 800113380
39268216 894210474
600856133 91169444...

output:

1

result:

ok single line: '1'

Test #57:

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

input:

20 9
18246520 289037312
223590378 904221984
158468076 685664873
661343077 978347160
435186112 640627800
559466880 559927584
45242916 566596015
130290765 300200349
175183463 434730463
75064355 595211002
333621902 449961207
28044312 78011568
267319532 981800089
579543582 623250773
501315035 549454467
...

output:

-1

result:

ok single line: '-1'

Test #58:

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

input:

20 4
282915225 425599000
46844071 877724908
331562754 774194013
454952275 729482745
26829711 957331160
627282472 841455868
100114358 781547255
150014807 274089000
534690006 980470663
541821180 599376720
84150518 232318480
4457533 168338098
28542916 343576455
94961278 964757965
1021672 802156769
1412...

output:

1
6
8
10

result:

ok 4 lines

Test #59:

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

input:

20 3
568423024 732950395
30698730 953476873
240194350 760469817
571506747 960258324
142530756 898809811
502816961 572446466
63299466 595327108
441383100 954106794
401449920 893452390
131382436 615911903
103318462 704161744
17001604 744184311
355982562 921938859
277739118 448466769
852604059 87135217...

output:

1
14
15

result:

ok 3 lines

Test #60:

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

input:

20 4
729581552 843936903
595777889 662269624
434082235 904888330
189209392 706890360
122057607 566242764
12655119 862773552
253295242 267145374
514009091 646726110
699170128 892329802
139765740 798881549
465088674 483212263
438274771 843531949
551372681 969365825
370571050 441985295
369851925 695022...

output:

1
2
7
11

result:

ok 4 lines

Test #61:

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

input:

20 3
52680030 171567270
562416436 932178589
180457200 874534710
57962547 619926504
514034951 735903893
569357027 949556658
96546655 769067522
156273105 550639233
102800728 342367246
341675981 994824681
12457939 294153271
13450385 307425366
90257349 383467364
29966544 411684432
69951674 186314264
223...

output:

-1

result:

ok single line: '-1'

Test #62:

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

input:

20 9
18 22
2 5
28 31
21 25
25 27
3 6
36 39
22 26
8 12
27 31
27 29
32 36
14 18
16 20
22 26
10 14
17 21
13 17
15 19
37 40

output:

2
3
4
5
7
9
12
17
18

result:

ok 9 lines

Test #63:

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

input:

20 8
14 16
32 36
12 16
11 13
32 36
11 15
8 11
27 31
17 21
11 14
10 12
32 35
14 16
10 12
27 30
8 12
36 39
13 15
4 7
8 11

output:

1
2
4
7
8
9
17
19

result:

ok 8 lines

Test #64:

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

input:

20 5
8 10
16 20
14 17
26 30
26 29
16 20
8 12
7 9
21 25
31 34
16 20
14 18
22 24
26 29
12 16
6 9
7 9
26 30
17 21
27 30

output:

1
2
4
9
10

result:

ok 5 lines

Test #65:

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

input:

19 9
7 10
14 17
17 20
19 21
37 40
19 23
21 24
17 20
26 28
14 17
26 30
36 40
23 25
27 29
3 7
22 25
6 9
22 25
10 13

output:

-1

result:

ok single line: '-1'

Test #66:

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

input:

20 9
22 25
29 31
15 17
21 25
14 18
21 25
37 40
24 28
5 9
31 35
37 40
5 9
17 21
5 7
15 18
34 37
16 19
6 10
7 11
33 35

output:

-1

result:

ok single line: '-1'

Test #67:

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

input:

20 17
845269015 850357565
231570833 238492480
112075343 117449946
332830039 342056906
888759754 896832046
12792516 19353665
142051900 147667172
535996252 545054726
746039922 755668317
14144485 23611147
478226018 488214529
566689172 574405398
203948947 210298368
289137613 296782362
492823093 50197134...

output:

1
2
3
4
5
6
7
8
9
11
12
13
14
15
16
17
19

result:

ok 17 lines

Test #68:

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

input:

20 15
14188856 19236114
98742802 106752117
24269095 29763729
643363334 650430602
640667308 647978576
977081895 982348536
745449811 751115078
498241588 506936783
527053854 533674727
491394449 500443949
173465864 181340285
697167305 702838894
494029651 501636657
356910520 365788783
450134494 457312713...

output:

1
2
3
4
6
7
8
9
11
12
14
15
16
17
18

result:

ok 15 lines

Test #69:

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

input:

20 12
563046220 568800423
199343954 205146700
914428529 921389051
770854212 778944781
293251360 301031517
752099979 757638337
414657306 422232787
418601435 427149870
720794559 729165510
977858157 984913657
140764201 146705765
31266372 40564939
160980681 169658134
856117526 862237237
140519584 147162...

output:

1
2
3
4
5
6
7
9
10
11
12
13

result:

ok 12 lines

Test #70:

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

input:

20 17
889180138 897645327
738509954 745477991
528540397 538119158
378206912 383476822
79879358 86001857
98066197 103959366
640908142 649924188
524017315 531755079
979262559 988488803
789090356 797993258
782717536 789923836
267087164 272268465
28139018 33712559
379981686 387166408
400347925 406679332...

output:

-1

result:

ok single line: '-1'

Test #71:

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

input:

20 18
561486485 569818195
630359186 636475010
742947739 748730836
366786866 372238382
741166510 746356459
980930968 989331451
907461849 915230070
5726074 14451679
866818884 872405363
819511837 827958204
712517924 722136545
870083014 876845261
35270659 40840598
711697632 718619034
85840159 92347641
1...

output:

-1

result:

ok single line: '-1'

Test #72:

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

input:

20 20
58260057 75328425
75328425 93791372
93791372 93883091
93883091 152718294
152718294 186033899
186033899 207919883
207919883 270240750
270240750 288647403
288647403 357864905
357864905 381181754
381181754 386254557
386254557 432675450
432675450 446987413
446987413 451012965
451012965 492937493
4...

output:

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

result:

ok 20 lines

Test #73:

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

input:

20 19
57471590 160037396
160037396 194076047
194076047 261241448
261241448 311172263
311172263 403739986
403739986 426302161
426302161 455690634
455690634 482534841
482534841 516724753
516724753 533199987
533199987 574790581
574790581 579061246
579061246 579834662
579834662 585842666
585842666 59903...

output:

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

result:

ok 19 lines

Subtask #3:

score: 31
Accepted

Test #74:

score: 31
Accepted
time: 3ms
memory: 6360kb

input:

3000 57
226083340 261990234
392684356 462929590
468018811 841719892
495096853 606046097
196983814 256423598
331199122 967656486
802593662 931108452
74501453 679054962
294344294 752837262
295708332 547261648
265421699 652708933
272959087 727136240
165667761 846917534
61770748 157663302
608516043 8492...

output:

50
85
104
139
173
189
257
273
297
327
347
374
411
543
600
665
686
750
766
850
971
977
990
1040
1069
1074
1109
1183
1226
1231
1316
1440
1508
1597
1611
1670
1676
1774
1811
1822
1885
1968
2005
2103
2153
2271
2304
2416
2445
2562
2593
2608
2690
2798
2873
2884
2952

result:

ok 57 lines

Test #75:

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

input:

3000 52
515391161 611274809
241579177 794330740
10171859 421070901
191803444 462515964
789307312 942558211
168283015 749632607
741578406 748242944
727114778 888235899
285915154 538783207
740946890 927609854
511153062 526293212
202320202 315438522
60716314 641460650
4714115 322423665
680445730 761796...

output:

1
7
192
299
300
315
336
345
359
372
452
465
492
510
527
562
584
760
800
901
931
956
1075
1130
1170
1252
1281
1302
1363
1390
1427
1451
1474
1483
1555
1579
1635
1668
1788
1926
1971
2031
2052
2075
2121
2219
2226
2241
2421
2541
2682
2859

result:

ok 52 lines

Test #76:

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

input:

3000 50
164570698 977045956
184755663 365443392
603003602 688612912
69841518 845988325
124418966 495851703
92585079 221534905
66139125 492051425
11421559 470042732
353246878 519346251
394298743 656627500
91775697 487156113
216248411 680156936
102411138 118357679
310656407 421025471
226521211 7328919...

output:

2
13
31
63
71
73
107
171
204
212
235
242
282
315
338
363
385
498
513
533
597
602
741
1005
1366
1370
1400
1437
1453
1620
1631
1641
1660
1677
1753
2013
2052
2095
2188
2193
2208
2273
2384
2403
2532
2536
2540
2617
2727
2882

result:

ok 50 lines

Test #77:

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

input:

3000 26
420404814 607862506
424467321 435523425
441190777 977565387
171426323 268399128
98674944 937744436
65655455 205658000
102598650 388620400
594769046 940080999
63712781 445910235
378752716 930132171
428633245 659202337
232544464 994494247
6080714 60362625
221134868 345936051
808753899 83968712...

output:

1
4
13
15
26
27
30
42
81
105
114
149
301
558
806
822
843
904
1050
1169
1342
1373
1381
1930
2233
2421

result:

ok 26 lines

Test #78:

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

input:

3000 13
102826206 602027329
434931994 772339872
413413031 694464267
314395105 702742251
503992096 615714991
524571226 706613683
435807387 612902646
578112010 649125385
844903761 848000998
341521417 363587344
97482358 959069283
521677223 694511265
640709856 675605818
42442983 875334044
857624837 9646...

output:

1
9
13
15
43
152
165
309
333
547
977
1141
1657

result:

ok 13 lines

Test #79:

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

input:

3000 70
198876171 633452260
354684172 825494360
176550414 579846248
37743187 608475834
450639405 902539433
280219847 870211150
464249200 742260813
41925939 766325361
97120779 711013020
574107337 735065952
246344901 762902043
672906006 685387866
244479077 865874730
648084393 685613914
158950527 67355...

output:

-1

result:

ok single line: '-1'

Test #80:

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

input:

3000 61
288199641 988839430
555844621 886872865
528143584 789134190
562722637 879682817
56509608 381493312
229625999 946569378
54106433 199826523
26672970 471173920
182843886 848260651
146884261 191667110
696155489 947691429
228312645 368033961
423044046 764707825
271023642 485950519
153931729 96748...

output:

-1

result:

ok single line: '-1'

Test #81:

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

input:

3000 2931
717499499 717506267
392679825 392686341
694444934 694453409
780438871 780445478
338800501 338810163
932318897 932326372
571463112 571469934
657811272 657818137
853170401 853177063
980130048 980136614
470824555 470829577
586203411 586209503
56106755 56114626
830789358 830795307
790344400 79...

output:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
...

result:

ok 2931 lines

Test #82:

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

input:

3000 2628
241730947 241740288
658483880 658490240
807041193 807049477
842592817 842600016
987698454 987704778
731407174 731414105
645086761 645095059
384663701 384670491
782262851 782268893
459848253 459858000
274935402 274944725
825636713 825642267
436165777 436173314
875901828 875911426
878615751 ...

output:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
...

result:

ok 2628 lines

Test #83:

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

input:

3000 1960
367683881 367761448
215927495 215996140
123327945 123399581
517814503 517905591
445638988 445733217
474509686 474567834
835839513 835923838
196178279 196228647
716259021 716336050
686584694 686683895
703996530 704060207
160293571 160373918
589183152 589240014
582673713 582753879
332295166 ...

output:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
...

result:

ok 1960 lines

Test #84:

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

input:

3000 2461
453531793 453621247
558539257 558594171
731739897 731806619
975060474 975133124
612632248 612702460
746803150 746876746
309037653 309111171
158550993 158628126
91959293 92023150
682539837 682632482
78195454 78293782
448833562 448893692
406764747 406838753
439840691 439925982
463920530 4639...

output:

-1

result:

ok single line: '-1'

Test #85:

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

input:

3000 2461
448202517 448273218
597685396 597738816
898391908 898487853
551203413 551292049
538903715 538967314
960936285 961004894
317177569 317272788
227411137 227497567
50871215 50945345
780540596 780598452
997296850 997387679
813579782 813657678
494940859 494999468
133765968 133849544
715564610 71...

output:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
62
63
64
65
66
67
68
69
70
71
72
73
74
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
103
104
10...

result:

ok 2461 lines

Test #86:

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

input:

3000 2219
416620215 416702150
68241497 68295074
199770863 199825326
509726913 509815489
779096757 779176346
50301373 50395109
680442068 680513838
10672027 10753946
419155554 419225228
27993477 28074613
202777466 202848428
898431046 898501606
855439662 855516089
49972085 50058137
132037605 132105941
...

output:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
...

result:

ok 2219 lines

Test #87:

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

input:

3000 1971
273289960 273356035
645494918 645563363
294116810 294199291
654712464 654787915
325898403 325952171
900639603 900728124
214507936 214579081
891135731 891193900
184697938 184797874
513603004 513656867
547883255 547961511
5123630 5222722
402930073 402994785
781538375 781602407
110940514 1109...

output:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
87
88
89
90
91
92
93
95
96
97
98
99
100
101
102
103
10...

result:

ok 1971 lines

Test #88:

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

input:

3000 2436
530935185 530988618
580187755 580240329
716942726 717012471
678190163 678283109
867364235 867425954
769776432 769859020
785270305 785322268
546531856 546591590
506863712 506938474
776239055 776326129
587366299 587464235
657153809 657240082
864540308 864638331
722990726 723046932
680337120 ...

output:

-1

result:

ok single line: '-1'

Test #89:

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

input:

3000 949
194920414 195903000
644679751 645454019
497467216 498253834
405122431 405961817
218320386 219078779
322523221 323031550
36276543 36798937
461861332 462815590
898761987 899501902
105276665 105978705
135929137 136486543
498864424 499613435
15581270 16269350
101987601 102536809
904757589 90571...

output:

2
4
5
6
7
8
10
11
12
13
14
15
16
17
18
20
21
22
23
24
26
27
29
30
31
33
34
35
36
37
40
41
42
43
44
45
46
49
50
51
53
54
55
56
58
59
60
61
62
64
65
68
69
70
71
72
73
76
78
79
80
81
83
85
87
88
89
91
95
96
97
98
102
103
104
105
106
107
110
111
116
117
118
120
121
124
126
127
128
129
130
131
132
133
13...

result:

ok 949 lines

Test #90:

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

input:

3000 852
8369209 8978440
26311257 27082715
933705072 934380857
827878226 828562378
366742358 367583321
68546569 69105189
971561637 972399204
765332686 766287459
773153255 774015481
61810651 62574804
918056514 918570559
140263391 141090102
52520069 53372496
884179770 884741439
956753275 957746050
226...

output:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
31
32
33
35
36
37
38
39
40
42
43
45
46
47
48
49
50
51
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
70
71
72
73
74
75
76
77
79
80
81
82
83
85
86
87
88
89
90
91
92
94
95
96
97
98
99
101
103
105
107
108
109
110
112
113
114...

result:

ok 852 lines

Test #91:

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

input:

3000 739
497750401 498441996
267013399 267807392
918205023 919057677
326829272 327494027
753580445 754547251
35771377 36578633
808830658 809513795
56904078 57682462
887893164 888453875
329471353 330094906
100045968 100620573
896750067 897291941
283453808 284236716
324367485 325131611
770084423 77091...

output:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
42
43
44
45
46
47
48
49
50
51
53
54
55
57
58
59
60
61
62
63
64
65
67
68
69
70
72
73
74
75
76
77
78
79
80
82
83
84
85
86
87
88
89
90
91
92
93
96
97
98
101
102
103
104
106
107
108
109
110
111...

result:

ok 739 lines

Test #92:

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

input:

3000 925
420932447 421626010
904558008 905537878
655974505 656877253
514778277 515477813
199954685 200575289
293749166 294729902
179658408 180211242
326172243 326963713
527623498 528591366
65623235 66554247
399423541 400202725
520524243 521395427
283044209 284022490
179452315 180250519
505572370 506...

output:

-1

result:

ok single line: '-1'

Test #93:

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

input:

3000 153
587095114 596864273
670972487 676705997
191989357 198259167
673812587 683735533
245531196 254685257
225530225 234668988
452202357 458499572
272497340 280081758
87784636 93103291
670723843 678834868
50697649 60313556
951622145 958709103
382858098 389205982
676506551 681615487
384746612 39319...

output:

2
3
7
8
9
12
16
18
28
29
34
36
51
52
61
64
83
89
113
121
133
135
151
159
169
171
179
183
189
199
205
207
213
216
220
225
226
232
236
240
248
274
278
315
318
325
329
350
367
368
378
379
392
416
417
440
455
458
473
474
482
527
542
547
551
557
560
598
613
663
698
734
755
756
771
775
784
798
812
827
829...

result:

ok 153 lines

Test #94:

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

input:

3000 135
66885624 74104557
821414044 829087206
540699843 549726223
555899692 561078438
398755672 406020478
205882941 215435650
466732518 472842610
300990520 307907728
682356575 690744695
108052241 113305743
272402701 281220339
615723139 624160467
511470164 520171163
237176338 246766146
126512397 133...

output:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
19
21
22
23
24
25
26
27
28
36
37
38
42
44
47
48
52
53
55
64
70
79
81
87
91
99
104
108
119
120
129
139
141
153
161
178
188
200
206
208
229
232
242
255
270
276
298
315
335
347
364
417
429
432
450
467
480
483
496
518
539
553
556
577
578
589
619
634
640
661
672
...

result:

ok 135 lines

Test #95:

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

input:

3000 119
14458542 21844057
164839444 174229019
15409606 22270150
32376420 37743308
991477752 997728876
721021697 727700796
139296352 149247886
52968349 59742380
634812813 642348291
912839693 918945516
574242833 580891995
846393269 852631229
108377676 118035426
751791593 758482235
192318217 201297956...

output:

1
2
4
5
6
7
8
9
10
11
12
13
14
15
16
19
20
21
22
23
24
25
26
29
30
31
32
35
36
38
39
40
41
42
43
45
46
47
48
49
50
56
59
61
63
64
69
70
71
72
73
76
82
84
86
87
89
90
95
101
102
104
106
110
112
118
123
128
131
149
151
155
164
168
174
175
177
186
205
222
242
260
291
296
298
300
317
325
360
376
436
481...

result:

ok 119 lines

Test #96:

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

input:

3000 151
476273765 485191811
728245332 737058902
289976217 298935950
663781569 673172371
748035322 753155742
63821194 69483396
193742953 201456928
308574266 314977699
883471433 890660435
32480997 41062430
913665000 920375502
582916096 590506484
502473679 507842105
770519594 779951926
868534486 87708...

output:

-1

result:

ok single line: '-1'

Test #97:

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

input:

3000 18
626228169 725462861
407984604 469727724
496462860 581426714
349402534 444725282
851576033 926964137
122559079 198333690
10516020 62745202
487022010 559792623
855212149 947900038
215521874 276667908
784521821 880702641
780738618 858450229
359331303 415600606
595034666 678823310
287408528 3419...

output:

7
15
24
198
246
497
765
1056
1065
1093
1761
2235
2280
2374
2612
2733
2772
2942

result:

ok 18 lines

Test #98:

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

input:

3000 17
51724110 123484345
576592988 636428271
600018459 658996800
238522792 311046511
78712172 169948003
481839811 554918345
883289292 974508498
817459393 869470842
8164804 93319273
13757914 110340582
539312692 621165605
583764195 669814808
603091776 670342368
215171402 269702052
900841098 97569590...

output:

2
8
9
93
205
242
348
540
1009
1535
1572
1663
1734
1854
1919
2360
2409

result:

ok 17 lines

Test #99:

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

input:

3000 14
338309257 391881083
731139079 830007360
869727747 929678461
390955786 444907914
267414436 319380458
868898573 955892832
483074302 571864191
366044466 419314941
83724165 159912013
412776485 488069098
427381885 484866879
257163375 350857004
257343424 311754437
157224579 221603757
582175530 638...

output:

1
2
3
5
9
10
18
41
97
461
839
1458
1750
1758

result:

ok 14 lines

Test #100:

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

input:

3000 19
814425216 892029587
337824132 411852724
731518837 829919458
123115390 194055950
627387987 685141124
310040043 373995220
408842867 496081307
905952989 998467966
728582451 803543185
369461294 461312810
125788557 201661655
59055678 111939661
381783704 470266639
870969920 942464280
7088303 78994...

output:

-1

result:

ok single line: '-1'

Test #101:

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

input:

3000 3000
285375 361742
361742 1107858
1107858 1255748
1255748 3857978
3857978 4249535
4249535 4273015
4273015 4510876
4510876 4673623
4673623 5291542
5291542 5296509
5296509 5352452
5352452 5437629
5437629 6167983
6167983 6367767
6367767 6409548
6409548 6543578
6543578 6655685
6655685 6803906
68039...

output:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
...

result:

ok 3000 lines

Test #102:

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

input:

3000 2999
336072 629690
629690 738675
738675 1058078
1058078 1148116
1148116 1281217
1281217 1560365
1560365 2068319
2068319 2191153
2191153 2964384
2964384 3431080
3431080 3439452
3439452 3874384
3874384 3929919
3929919 4340843
4340843 4642499
4642499 5821660
5821660 6082017
6082017 6208666
6208666...

output:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
...

result:

ok 2999 lines

Test #103:

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

input:

3000 2966
881439 1659176
1659176 1835459
1835459 2140867
2140867 2297845
2297845 2606845
2606845 2609166
2609166 2810935
2810935 3195899
3195899 3972603
3972603 4014901
4014901 4428975
4428975 4533556
4533556 4587460
4587460 5388358
5388358 5393800
5393800 5476594
5476594 6086859
6086859 6844551
684...

output:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
...

result:

ok 2966 lines

Test #104:

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

input:

3000 2905
35556 86988
86987 467608
467608 817105
817105 1780295
1780295 2753753
2753753 3047565
3047565 3297187
3297187 3410856
3410856 3459929
3459929 3542637
3542637 3896915
3896915 4936654
4936654 5039919
5039919 5614735
5614735 5914320
5914320 6142936
6142936 6502585
6502585 6688477
6688477 7439...

output:

1
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
10...

result:

ok 2905 lines

Test #105:

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

input:

3000 2856
349205 517059
517059 1453540
1453540 1638500
1638500 2395041
2395041 2728810
2728810 2821103
2821103 3035276
3035276 3251608
3251608 3962856
3962856 4389756
4389756 4553820
4553820 4825910
4825910 5443575
6384774 6387166
5443575 6384774
6387166 6564665
6564665 6651061
6651061 7140027
71400...

output:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
...

result:

ok 2856 lines

Test #106:

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

input:

3000 2800
412394 662505
662505 1061638
1061638 1308775
1308775 1412317
2026845 2107180
1412317 2026845
2107180 2346086
2346086 2641994
2641994 2642056
2642056 3207689
3207689 3275120
3275120 3338186
3338186 3716783
3716783 3800432
3800432 4021953
4021953 4383326
4383326 4455668
4455668 4496646
44966...

output:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103...

result:

ok 2800 lines

Test #107:

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

input:

3000 2739
165373 830542
830542 1561705
1561705 1713447
1713447 1942206
1942206 1992895
1992895 2276270
2276270 2488781
2488781 2584956
2584956 3327200
3327200 3360165
3360165 4118551
4118551 4399856
4399856 4486655
4486655 4561731
4561731 4698291
4698291 5108617
5108617 5655350
5655350 5682998
56829...

output:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
...

result:

ok 2739 lines

Test #108:

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

input:

3000 2673
535542 909360
909360 1022340
1022340 1266542
1266542 1312267
1312267 1627143
1627143 1629778
1629778 2065004
2065004 2759215
2759215 3492939
3492939 3566207
3566207 3633393
3633393 3691801
3691801 3903192
3903192 3913523
3913523 4475637
4475637 4826581
4826581 5090379
5090379 5278803
52788...

output:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
...

result:

ok 2673 lines

Test #109:

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

input:

3000 2384
774212 872908
872908 939310
939310 1197289
1197289 1991234
1991234 2256835
2256835 2321951
2321951 2839820
2839820 3313144
3313144 4350840
4350840 4442173
4442173 4558814
4558814 4721246
4721246 5072159
5072159 5769307
5769307 5980021
5980021 6731712
6731712 6854996
6854996 7076879
7076879...

output:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
...

result:

ok 2384 lines

Test #110:

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

input:

3000 2971
114064 956241
956241 1773935
1773935 2628603
2628603 2714112
2714112 2894415
2894415 2989744
2989744 3071872
3071872 3335828
3335828 3601789
3601789 3758760
3758760 4619067
4619067 5344028
5344028 5594827
5594827 5781971
5781971 6884695
6884695 7513902
7513902 7843120
7843120 7910064
79100...

output:

-1

result:

ok single line: '-1'

Subtask #4:

score: 0
Time Limit Exceeded

Test #111:

score: 61
Accepted
time: 164ms
memory: 23876kb

input:

100000 361
136798318 785362988
255943758 535488232
175203444 266819907
766993466 893575347
67274251 589651108
662289594 883406317
830803801 849703610
729398668 798198453
202605534 677648797
66407931 925909114
174421361 601553812
522629146 701284080
136544340 295925673
299796891 499869765
736583725 8...

output:

42
102
185
215
660
950
1006
1623
1980
2396
2561
3016
3096
3729
3924
4119
4471
4619
4677
5229
5380
5400
5430
5681
5889
5901
5924
6013
6031
6043
6049
6316
6365
6483
6510
6575
7327
7492
7798
7833
7867
7954
7984
8089
8092
8237
8885
9212
9714
9971
10114
10190
10242
10260
10265
10321
10533
11184
11295
115...

result:

ok 361 lines

Test #112:

score: 0
Accepted
time: 155ms
memory: 23864kb

input:

100000 328
269692358 997698065
516351186 607170799
899165316 935984256
231654824 951113023
397634275 844276634
272944023 356674362
331036300 591789552
534270410 758375903
257707030 473980095
317825664 516882620
610579169 989404143
101902362 760414607
698174500 729348168
91656793 503436924
534091914 ...

output:

2
41
110
127
301
353
368
542
632
984
1394
1776
1932
2009
2051
2284
2584
2910
3083
3223
3445
3641
3715
4307
4467
4551
4602
4653
4900
5174
5601
5642
5748
5905
5910
6444
6547
7011
7070
7477
7713
7954
7965
8034
8066
8161
8235
8362
8527
8582
8807
8947
9051
9053
9329
9647
9689
9712
9807
9851
9916
10022
10...

result:

ok 328 lines

Test #113:

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

input:

100000 292
473961621 864888449
190522959 820646665
9492513 22301217
37064228 860062372
391795076 902791815
197180141 731578247
474804419 869235660
337420840 436563026
11453242 873644167
75360028 186126449
31699663 787244799
767030400 822993892
109557343 876905381
31823632 671368043
747618025 7999011...

output:

3
8
12
18
25
68
258
271
431
671
746
759
958
1130
1230
1847
2037
2193
2205
2448
2594
2746
3130
3188
3824
3896
4053
4208
4356
4551
4673
4790
4836
5178
5205
5231
5382
5565
5613
5814
5916
5980
6338
6440
6821
7045
7378
7553
7584
7615
7703
8766
8839
9191
9224
9749
9796
9800
9972
9988
10285
10296
10395
104...

result:

ok 292 lines

Test #114:

score: 0
Accepted
time: 159ms
memory: 24480kb

input:

100000 146
175643977 458162947
122110004 727270078
24786112 260954842
378646915 422692851
377845733 473430752
468331006 663764144
327593225 737427150
115723835 155636492
269251393 797888967
389252318 897957255
294924161 560923471
178959541 409597437
220814553 509182863
77416516 651426679
447529688 6...

output:

1
6
8
27
42
99
139
282
593
638
1498
1954
2189
2288
4171
4305
4554
4856
4868
5213
5937
6482
6599
7492
7533
7702
7724
7835
7990
8151
8501
9545
10202
11614
12938
13407
13837
14131
14484
15053
15176
15606
15895
16102
16185
16796
16976
17542
17882
18864
19357
19477
19478
20381
20680
20848
22319
24436
245...

result:

ok 146 lines

Test #115:

score: 0
Accepted
time: 155ms
memory: 23800kb

input:

100000 73
471315639 579688376
73440809 909550586
759672613 860952046
499195004 718627966
236201261 770008372
100210626 445253931
416166676 960255314
616242371 848806264
137142775 925433124
125434924 236893487
333557018 512133009
855283884 890613490
554762441 630311858
61488866 231607852
424705519 48...

output:

1
3
6
20
29
44
60
79
96
297
434
698
883
904
1549
4376
6599
7205
7681
8413
9369
11066
11578
14161
15267
17040
18750
20414
23432
24491
24836
26136
27044
28237
28824
29434
30047
32389
34359
36857
38954
39156
39268
41554
47253
48535
48950
49012
49889
51613
51764
52209
52747
54204
54511
56706
57029
57065...

result:

ok 73 lines

Test #116:

score: 0
Accepted
time: 155ms
memory: 24072kb

input:

100000 449
644158539 748655897
114191306 880648021
134735903 823826742
464626595 851003711
495548403 882519143
671995246 859736434
215469445 398614608
363408156 397305983
101857521 925632267
82075442 522481883
252114434 722683422
116631698 349587141
128286913 202260986
261266779 958361998
465162344 ...

output:

-1

result:

ok single line: '-1'

Test #117:

score: 0
Accepted
time: 165ms
memory: 24148kb

input:

100000 371
774872778 931145029
267285222 920663858
684750067 729615011
377126545 702601394
68070687 874096271
235493727 979169182
806547543 955959860
226247531 498179834
311248753 651142094
347633948 449123654
114029276 328842964
464871458 720251716
349016088 482553137
36050695 173717890
416596441 4...

output:

-1

result:

ok single line: '-1'

Test #118:

score: 0
Accepted
time: 188ms
memory: 28216kb

input:

100000 93061
749089229 749090162
783721839 783722741
768123599 768124224
560078948 560079752
931037286 931037914
965510348 965510970
18421852 18422696
923870904 923871862
999039055 999039970
677283195 677283783
983315670 983316240
365325621 365326568
916687170 916687703
373584284 373585109
526888647...

output:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
...

result:

ok 93061 lines

Test #119:

score: 0
Accepted
time: 174ms
memory: 27844kb

input:

100000 83744
19178865 19179653
9015384 9016201
506903327 506903979
200533028 200533843
149735195 149736108
715060567 715061475
88374339 88375257
567203771 567204582
895468614 895469225
905248537 905249280
654498098 654498915
730902050 730902800
417781654 417782273
928787595 928788467
645610509 64561...

output:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
...

result:

ok 83744 lines

Test #120:

score: 0
Accepted
time: 168ms
memory: 26300kb

input:

100000 45983
749152702 749158615
807922099 807928615
72241792 72251315
138545065 138551157
219256036 219264756
80486596 80496013
959601148 959606940
204373638 204383400
63708737 63716527
380870060 380879250
24149541 24157523
384766809 384772536
627961268 627966533
117770608 117777806
928263347 92827...

output:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
...

result:

ok 45983 lines

Test #121:

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

input:

100000 57483
431203500 431213341
554012700 554017922
480137140 480147000
307159624 307168541
501137976 501146218
363462545 363468037
461611588 461619401
265555346 265561265
498965519 498971062
50124954 50133437
769683488 769690046
577335140 577340212
267558856 267564534
359224581 359229752
129993031...

output:

-1

result:

ok single line: '-1'

Test #122:

score: 0
Accepted
time: 171ms
memory: 26628kb

input:

100000 57452
338623847 338633061
96688572 96697358
90090529 90096857
880490365 880497584
889837925 889847487
904572821 904582662
137362993 137368037
125025452 125032576
941954494 941962833
493641913 493648916
93768178 93776780
520215112 520223718
288505251 288511383
504167624 504173006
67977072 6798...

output:

3
5
6
7
8
10
11
14
15
16
18
19
20
21
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
78
79
80
82
83
85
86
87
88
89
90
91
92
93
94
97
98
99
100
101
102
103
104
105
106
107
110
111
112
113
11...

result:

ok 57452 lines

Test #123:

score: 0
Accepted
time: 174ms
memory: 26228kb

input:

100000 51706
980880797 980888818
542441861 542449585
807408115 807417153
83067424 83075672
671327822 671335399
685252550 685260206
571938316 571944454
929067202 929073123
901471980 901477033
880381919 880387442
93244679 93251993
289736838 289744088
841200135 841207764
514605330 514611638
246995306 2...

output:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
...

result:

ok 51706 lines

Test #124:

score: 0
Accepted
time: 155ms
memory: 26744kb

input:

100000 45924
247572949 247579351
273816812 273826491
884429452 884436161
174091945 174097015
753522429 753529594
733916254 733923447
395465079 395471160
816293639 816300659
985145553 985153045
657606615 657615209
79034361 79040363
174849847 174856900
541769195 541777775
586096127 586106029
94769205 ...

output:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
...

result:

ok 45924 lines

Test #125:

score: 0
Accepted
time: 132ms
memory: 23944kb

input:

100000 57495
374618816 374625816
80355079 80361840
316834993 316841056
124585030 124590453
115682212 115692129
28216956 28223735
224716503 224725727
850156627 850165518
994904564 994911940
83300598 83307183
563132486 563137848
749842441 749852417
143706158 143715269
931012152 931019756
30867180 3087...

output:

-1

result:

ok single line: '-1'

Test #126:

score: 0
Accepted
time: 161ms
memory: 24452kb

input:

100000 12819
309891306 309954870
905554879 905605300
947300136 947373085
2720626 2778510
908191887 908248144
865913582 865985992
100351476 100432277
125960688 126024290
553461576 553520273
376779116 376845529
708954582 709038476
490092382 490182404
38214497 38296731
245478503 245570664
666913475 667...

output:

2
4
5
6
9
10
11
13
14
17
18
19
20
21
22
23
25
26
27
32
34
35
37
38
40
41
44
46
49
51
53
54
55
57
58
59
61
62
64
65
66
69
70
71
72
73
75
76
77
79
80
81
83
85
87
88
100
103
104
106
108
109
111
112
113
118
119
121
122
124
126
127
129
132
133
134
137
138
139
141
143
144
146
147
148
149
151
152
153
155
1...

result:

ok 12819 lines

Test #127:

score: 0
Accepted
time: 159ms
memory: 24440kb

input:

100000 11531
430599135 430649770
21509067 21576894
249106890 249173274
965197512 965266904
436897466 436972819
959194520 959254646
442526353 442618005
904093001 904150953
949409916 949474574
57147598 57200238
553223412 553311011
823620855 823718004
83883015 83937026
626610175 626680350
959554998 959...

output:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
98
99
100
101
102
104
10...

result:

ok 11531 lines

Test #128:

score: 0
Accepted
time: 150ms
memory: 24424kb

input:

100000 10234
590342067 590439717
151360588 151446476
704379965 704468250
244881754 244981380
699214351 699274418
919695887 919784366
937652880 937726315
498382557 498433757
126304748 126392853
321340730 321431559
848852992 848914627
655433677 655530060
595492862 595572356
868777065 868832919
1612040...

output:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
...

result:

ok 10234 lines

Test #129:

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

input:

100000 12763
851206159 851297015
755750327 755848436
548549131 548634245
463255673 463307537
918314019 918369663
254949084 255036696
892712688 892773789
424999661 425078604
387085257 387147050
831548708 831602723
790981553 791044454
677538401 677622226
641157362 641232987
151098418 151183133
8802434...

output:

-1

result:

ok single line: '-1'

Test #130:

score: 0
Accepted
time: 158ms
memory: 23940kb

input:

100000 1700
17219741 18117599
907379612 907997748
190940647 191586769
642998799 643771014
921874090 922699098
397479029 398121110
640664954 641356411
888067143 889038036
785102144 785948463
755208183 755993219
478074194 478794187
893495833 894456286
883569957 884129187
69103556 70018943
956856881 95...

output:

11
13
19
20
22
25
28
32
37
48
49
54
59
62
85
89
96
105
108
113
133
134
151
160
167
169
185
194
196
210
221
233
240
245
249
253
254
256
265
275
278
285
287
296
317
323
327
331
338
339
343
361
366
370
377
383
399
408
409
449
453
460
465
471
480
489
518
532
544
545
547
548
556
557
565
573
577
585
595
6...

result:

ok 1700 lines

Test #131:

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

input:

100000 1530
262831392 263744276
888093170 889052762
118159208 119058161
862702062 863542647
179445340 180297246
633155348 633657043
500167821 500821708
18646025 19533619
120256204 121077349
106600994 107600237
747184980 748063673
251962857 252463614
964613023 965272526
272181867 272716675
762289359 ...

output:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
35
36
37
38
40
42
43
44
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
86
87
88
89
90
91
92
93
95
96
97
98
99
101
102
103
104
105
106
107
108
1...

result:

ok 1530 lines

Test #132:

score: 0
Accepted
time: 158ms
memory: 23872kb

input:

100000 1361
532659677 533319861
915037599 915876594
955109531 955778400
576000657 576992268
152958850 153459908
810090999 810821575
715660458 716200514
946502984 947197936
733599424 734420635
268788632 269414691
429412050 430008449
39595552 40309379
950596664 951355446
221337174 222166856
81998265 8...

output:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
40
41
42
43
44
45
46
48
49
50
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
83
84
85
87
88
89
90
91
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
1...

result:

ok 1361 lines

Test #133:

score: 0
Accepted
time: 139ms
memory: 23912kb

input:

100000 1694
561252882 561928795
475058071 475674819
923967308 924602409
293772848 294533044
780966972 781503640
117104591 117835259
844893636 845571587
459872065 460613409
987855351 988448503
747089341 747954466
151784389 152488833
352162258 352778987
972651209 973520929
434165600 434679323
64353253...

output:

-1

result:

ok single line: '-1'

Test #134:

score: 0
Accepted
time: 164ms
memory: 23944kb

input:

100000 189
262782636 269121865
507121279 515570626
604988426 611076110
335689025 344482847
572480832 581473159
541896126 551818835
405976753 412867032
378054300 385092662
659834307 666774012
82573711 89823665
628606272 636953327
701634964 709821180
815239249 820424223
421311848 430914500
603744743 6...

output:

10
62
76
119
124
133
152
244
338
455
494
574
1150
1509
1571
1737
1760
2117
2302
2370
2372
2594
2673
2746
2938
3101
3217
3445
3488
3513
4601
4764
5534
5835
6149
6230
6298
6344
6730
6745
6846
7167
7425
8133
8762
9312
9644
10069
10522
10747
10889
11508
12329
12371
12543
12617
12645
12806
13036
13105
13...

result:

ok 189 lines

Test #135:

score: 0
Accepted
time: 153ms
memory: 23948kb

input:

100000 171
837641780 844020278
357353831 365647214
599098550 607526974
845671640 853112341
299541938 305277684
510567287 517621444
199653908 206728936
655497253 661269592
692158423 701482117
154006030 163225004
835874013 843919349
167032367 173460036
946032421 955521464
259723400 264744094
821310449...

output:

1
2
3
4
5
6
7
8
9
10
12
13
14
15
17
18
21
22
24
28
33
62
91
96
108
114
119
120
130
133
143
156
158
170
229
245
249
268
295
326
332
354
399
403
415
448
449
549
653
776
794
1017
1206
1250
1401
1447
1523
1649
1689
1749
1795
1938
2113
2377
2674
2782
2829
3232
3535
3675
3719
3848
4319
4347
4622
4980
5291...

result:

ok 171 lines

Test #136:

score: 0
Accepted
time: 157ms
memory: 23876kb

input:

100000 152
816912616 823377256
247203184 254025619
116864990 124789256
694598360 701033365
540348725 547257127
872138899 878978240
650092788 659933224
917342590 925962881
235709663 243990940
525025038 534046762
424391982 433359126
784151729 793197352
951972682 958433178
526518608 534600951
840722585...

output:

1
2
3
4
5
6
7
8
9
10
11
12
13
15
16
17
18
19
21
22
23
24
25
26
30
31
32
33
34
38
39
40
43
45
47
49
53
54
55
57
59
62
65
66
68
69
95
116
146
151
162
177
178
180
184
205
227
228
242
287
320
404
426
469
501
528
532
556
563
565
602
671
717
734
785
799
900
931
934
996
1033
1099
1249
1350
1372
1457
1478
1...

result:

ok 152 lines

Test #137:

score: 0
Accepted
time: 159ms
memory: 23932kb

input:

100000 190
870445335 878554595
569957215 575078663
509818332 518159241
127736498 136603345
563950368 569910285
461758763 468720314
216052486 222033983
567438496 573374070
361912750 368683923
233164080 242420997
612807780 621163987
457688599 466040981
479173746 484305595
187026319 193757521
800091427...

output:

-1

result:

ok single line: '-1'

Test #138:

score: 0
Accepted
time: 159ms
memory: 23920kb

input:

100000 19
744848765 834854476
718215532 808530475
253637926 311760459
74336532 132333059
784419363 849637785
25606976 96401545
883911335 939593474
509717084 609077994
755957047 812277733
443858421 541052036
409969029 470325433
198920121 292259214
943752203 998908956
677824063 771868258
657832894 729...

output:

3
7
13
68
139
1867
3845
4679
5824
15402
15661
24631
27310
37849
41264
41505
45403
62642
92871

result:

ok 19 lines

Test #139:

score: 0
Accepted
time: 153ms
memory: 23796kb

input:

100000 18
309710664 403132522
168103174 258555915
803800065 873847419
332983219 415005123
298949107 387006725
335887058 435082731
542758096 607592499
58079345 143434861
417417465 501707303
185540354 283658464
532594852 596211500
628333356 687317714
854474819 936288610
532869723 626842552
823035794 8...

output:

1
12
16
49
138
246
371
3482
4495
4746
6405
10814
17777
42110
65337
72332
77472
92353

result:

ok 18 lines

Test #140:

score: 0
Accepted
time: 155ms
memory: 24128kb

input:

100000 16
291620202 377359774
312632988 408941588
438544826 503277578
109464239 170114781
645944581 718979069
212831054 270536779
670672289 765199368
655876889 716471380
220294546 286999251
256414353 337917038
153688670 225717192
844009255 938012183
434954766 530215734
752164213 841336075
405880986 ...

output:

1
3
4
5
32
36
40
78
93
633
735
5174
7598
8943
9570
20172

result:

ok 16 lines

Test #141:

score: 0
Accepted
time: 160ms
memory: 23864kb

input:

100000 20
428372177 492750720
163887906 263497806
89005841 186000725
303620914 392174686
809104405 860966386
295895239 372116036
108059732 176644803
820810913 890804990
58439276 155571070
32692752 127161606
591997459 660019618
268054311 337569639
388669780 486602730
747367479 811866722
201506002 256...

output:

-1

result:

ok single line: '-1'

Test #142:

score: -61
Time Limit Exceeded

input:

100000 100000
10083 10952
10952 24768
24768 25821
25821 42698
42698 45065
45065 61562
61562 89572
89572 92741
92741 93106
93106 95103
95103 97508
97508 107073
107073 110252
110252 128000
128000 135964
135964 142265
142265 144732
144732 147159
147159 148846
148846 160256
160256 172282
172282 180092
1...

output:


result: