QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#461631#3101. Event Hopping 2egypt_ioi2024_09#0 20ms7244kbC++231.6kb2024-07-02 21:01:062024-07-02 21:01:07

详细

Subtask #1:

score: 0
Wrong Answer

Test #1:

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

input:

1 1
1 3

output:

1

result:

ok single line: '1'

Test #2:

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

input:

2 1
2 4
3 7

output:

1

result:

ok single line: '1'

Test #3:

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

input:

3 1
2 5
3 5
4 7

output:

1

result:

ok single line: '1'

Test #4:

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

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:

1
2
3
4
5
6
7
8
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
48
49
50
51
52
53
54
55
56
57
59
60
61
62
64
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
103
104
105
106
1...

result:

ok 93097 lines

Test #5:

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

input:

99999 88403
2150 2736
19195 20022
27727 28620
35862 36457
60973 61718
80791 81690
86082 86984
106677 107346
108139 108915
110531 111303
115660 116605
122015 122980
123932 124908
134353 135199
134501 135222
155517 156054
159779 160302
160367 161281
160417 161149
164477 165443
176902 177695
188399 189...

output:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
16
17
18
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
101
102
103
105
106
107
108...

result:

ok 88403 lines

Test #6:

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

input:

99999 83610
13054 13952
35115 35859
40425 41389
47089 47725
59574 60420
70210 71056
73047 73747
78599 79251
84786 85465
96167 97165
118120 118862
122717 123442
139557 140446
140442 140948
167280 168099
172791 173512
175238 175890
179283 180010
188674 189600
192740 193434
197040 197739
206126 206742
...

output:

1
2
3
4
5
6
7
8
9
10
11
12
13
15
16
17
18
19
20
21
22
23
24
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
51
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
102
103
104
105
106
...

result:

ok 83610 lines

Test #7:

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

input:

99999 74350
13130 13773
26195 26982
41474 42296
50556 51176
52028 52952
61800 62451
64260 64787
77433 78243
79862 80477
104820 105424
119745 120717
124071 124902
137929 138510
155031 155946
156225 156935
156558 157403
186203 186953
190155 190856
202887 203601
219505 220031
224776 225447
225343 22601...

output:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
17
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
54
55
56
57
58
59
60
61
62
63
64
65
66
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
103
104
105
106...

result:

ok 74350 lines

Test #8:

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

input:

100000 93001
8963 9929
13535 14469
13715 14543
62424 63376
64988 65554
66126 66943
80525 81309
81865 82540
82113 82814
83753 84473
91289 91956
93976 94815
123004 123792
137032 137701
145506 146047
154391 155306
163907 164811
173352 174335
207897 208525
216768 217487
224290 225235
247075 247627
25288...

output:

1
2
4
5
6
7
8
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
38
39
41
43
44
45
46
47
48
49
50
51
52
54
55
57
58
59
60
61
62
63
64
65
66
68
69
70
71
72
73
74
75
76
77
78
79
80
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
98
99
100
101
102
103
104
105
107
108
109
110
111...

result:

ok 93001 lines

Test #9:

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

input:

100000 88358
548 1465
4599 5115
17400 18217
20126 21091
24033 24624
31908 32485
35051 36014
36278 36911
52827 53811
58821 59329
64125 64906
96889 97505
112354 113069
123259 124017
134029 134704
144556 145471
170781 171364
186208 186898
187848 188781
188857 189400
207006 207911
221835 222742
229559 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
66
67
68
69
70
71
72
73
74
75
77
78
79
80
81
82
83
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
105
1...

result:

ok 88358 lines

Test #10:

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

input:

100000 83736
6162 6948
47528 48088
51581 52406
54252 55179
59136 60123
74088 74789
85966 86478
97745 98486
105645 106507
109178 110065
119123 119948
131090 132059
134054 135027
158930 159457
161639 162627
162886 163459
171585 172115
173959 174537
189725 190461
192362 193084
206375 207310
215518 2162...

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
27
28
29
30
31
32
33
34
36
37
38
39
40
41
42
43
44
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
79
81
82
83
84
85
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
106
107
10...

result:

ok 83736 lines

Test #11:

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

input:

100000 74537
1240 2045
45619 46191
47541 48308
60964 61831
66245 67022
97465 98412
100671 101637
101356 101891
106041 106847
107695 108471
130232 130957
142492 143049
144495 145192
152230 152795
176811 177714
178845 179825
181023 181667
186532 187200
213378 214004
223268 224065
237222 238060
252278 ...

output:

1
2
3
4
5
6
7
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
25
27
28
30
31
32
33
34
35
36
37
38
39
40
41
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
100
101
102
104
106
107
108
109
...

result:

ok 74537 lines

Test #12:

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

input:

100000 57378
288 9909
3927 11152
20084 28964
30571 39126
38628 45300
41935 47457
48699 55269
55106 61254
77890 83130
85054 93921
88571 96480
91031 99813
93263 100777
101052 107389
123891 133202
136899 144986
166399 172157
172062 180451
175185 181470
178642 185679
186035 191294
193000 202232
210529 2...

output:

1
3
4
6
7
9
10
14
15
16
17
19
21
22
23
24
28
31
33
35
38
41
42
43
45
47
49
51
52
54
55
56
57
59
61
62
63
64
65
66
67
68
69
70
71
73
74
75
76
77
78
80
81
82
84
86
88
89
91
93
94
96
97
98
101
103
104
106
107
109
111
112
114
117
119
121
123
124
125
126
128
129
131
133
135
137
139
141
142
144
146
148
15...

result:

ok 57378 lines

Test #13:

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

input:

100000 54689
635 6242
13982 22182
22661 30718
24154 30227
30660 36548
33924 42990
44017 50030
60973 66351
64489 72778
102975 110314
109192 117764
115739 121380
118596 126708
132734 139073
137862 143602
140007 147771
145000 151039
153742 162901
154064 161969
155008 162999
161339 166755
164906 173628
...

output:

1
2
3
6
7
8
10
12
14
16
18
22
23
24
25
27
31
32
34
35
36
38
39
41
43
46
47
48
49
52
56
57
58
59
60
63
65
67
70
72
73
75
76
79
80
82
83
84
86
87
89
90
91
93
94
95
96
100
101
104
105
107
110
113
114
119
121
126
127
128
130
131
133
134
135
137
138
141
143
144
148
149
151
152
156
158
160
161
163
164
165...

result:

ok 54689 lines

Test #14:

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

input:

100000 51899
12721 22028
16145 23647
28093 34105
31291 36638
44047 52326
55488 64995
56157 62217
66418 71755
68687 74835
69342 74935
70374 78347
71160 78293
98866 104712
106829 115593
123303 132506
127977 136686
131387 140227
143951 153377
151420 158533
153814 159285
159241 169053
167504 175345
2280...

output:

1
3
5
6
8
13
14
15
18
20
22
23
24
25
28
29
31
32
35
38
40
41
44
46
48
50
51
54
56
59
62
64
66
68
70
73
75
76
78
80
81
82
84
87
88
90
91
92
95
97
100
103
104
105
107
109
110
111
113
114
116
117
118
120
121
122
123
124
125
128
130
131
132
135
138
140
141
143
146
148
149
151
155
157
159
160
161
162
164...

result:

ok 51899 lines

Test #15:

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

input:

100000 45970
2875 10006
6962 14904
8232 13847
39406 45823
40169 48870
65197 71238
65771 73553
70120 79190
93112 101501
120131 129654
138254 143706
140305 147707
152704 161454
157287 166457
165588 173813
176164 184901
179803 186708
186911 196877
203774 212710
208535 217456
227845 234554
229061 236126...

output:

1
4
6
9
10
11
13
15
16
18
19
21
23
27
28
29
30
31
32
34
37
39
41
42
43
44
45
47
49
50
52
53
54
56
57
59
61
64
65
68
69
71
74
75
76
78
79
80
82
84
85
86
87
88
90
93
94
96
98
101
103
106
108
111
113
114
116
118
119
120
122
123
124
126
127
128
131
133
137
139
141
144
147
149
150
151
152
155
157
159
160...

result:

ok 45970 lines

Test #16:

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

input:

100000 12813
1033 81070
12954 81500
13156 68815
35338 111064
35506 119065
45225 124391
59060 117337
82625 160515
87693 157948
93135 171962
98548 149280
98885 184397
119996 172867
121551 204333
130795 181820
151221 223534
163612 238764
191948 268094
192810 249321
201147 280094
209164 272596
217258 28...

output:

1
8
17
27
34
43
51
57
62
70
77
86
91
98
104
110
119
128
136
142
150
157
169
177
182
189
201
206
215
222
228
234
244
251
258
266
275
285
296
306
315
321
327
332
340
351
358
370
376
387
395
404
408
415
421
427
431
441
450
455
462
466
474
476
482
487
493
500
507
515
520
528
537
545
551
557
566
577
585
...

result:

ok 12813 lines

Test #17:

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

input:

100000 11486
9958 109537
10290 105884
11646 98237
13442 105194
15629 88293
20778 93420
21509 86475
34164 89416
42240 109910
57255 128711
57391 155451
64212 135574
75341 158468
89926 183847
109410 200713
115234 179765
122402 209776
128743 205641
141578 222667
147296 215047
150895 216677
152208 248228...

output:

1
16
24
29
39
46
57
69
76
89
96
106
114
122
127
133
142
149
159
174
182
187
195
204
214
223
236
242
253
257
267
276
283
289
292
296
306
312
321
332
334
344
352
364
371
386
395
404
409
421
433
443
447
456
462
467
471
479
496
505
511
513
519
534
540
547
559
565
568
573
586
593
595
606
613
617
620
630
...

result:

ok 11486 lines

Test #18:

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

input:

100000 10243
20686 118188
28362 109019
29665 112454
42086 128002
47854 100516
69351 143086
80462 141232
82765 148621
85924 148841
85970 159110
109511 188316
112760 167213
126746 181139
126751 189646
139340 226463
141613 229658
142113 236962
142337 217316
192209 270843
201105 257365
240041 328724
244...

output:

1
13
19
27
34
40
48
60
69
73
82
95
98
104
114
123
131
135
140
147
159
170
178
188
200
211
220
230
233
241
247
259
266
275
281
285
294
301
312
316
335
341
351
356
366
376
388
397
405
415
422
430
441
451
455
460
474
480
488
498
504
513
523
531
541
546
557
566
575
584
592
596
607
612
620
636
642
650
66...

result:

ok 10243 lines

Test #19:

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

input:

100000 1692
1761 562188
8018 654677
12329 961589
21217 810688
21850 726916
26301 994382
28685 582608
32421 747755
39099 581374
47897 912559
54394 659595
56476 675836
60014 1008714
72795 994742
75196 843153
88489 828045
90004 1024886
100124 781515
106686 734628
107999 959025
110160 1066569
122777 730...

output:

1
74
151
213
267
332
383
442
509
574
624
693
759
817
874
936
992
1048
1101
1158
1230
1267
1317
1380
1451
1502
1567
1631
1694
1743
1812
1881
1931
1988
2034
2109
2159
2202
2258
2312
2367
2418
2485
2538
2610
2670
2724
2776
2830
2889
2949
3005
3045
3086
3159
3214
3278
3338
3394
3433
3497
3554
3618
3676
...

result:

ok 1692 lines

Test #20:

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

input:

100000 1532
11110 578739
15827 900884
20209 693425
20787 1005821
30145 907459
30992 780446
34235 729985
79035 651546
85599 832995
113134 652298
121940 1100169
135680 828786
141312 898191
143767 931673
177769 805753
181414 924082
191854 795021
201070 701360
211465 826185
217164 1154581
223164 1222889...

output:

1
59
141
198
298
373
433
509
588
657
726
787
853
914
997
1097
1186
1250
1338
1405
1484
1568
1648
1725
1785
1858
1941
2022
2074
2169
2239
2316
2367
2422
2493
2547
2629
2726
2814
2870
2928
2990
3081
3184
3250
3323
3412
3471
3526
3583
3648
3743
3820
3885
3975
4067
4166
4235
4300
4397
4446
4508
4573
463...

result:

ok 1532 lines

Test #21:

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

input:

100000 1359
6234 861238
9126 603680
11750 603711
24871 794005
43119 653921
44111 990217
50268 968692
68132 986854
68579 797843
72248 721632
91367 827206
98456 693310
116298 822182
124847 960194
126999 1008775
131415 872868
135286 662199
150820 781868
183837 915832
184357 1161197
185711 1042124
18840...

output:

1
100
175
228
303
383
436
546
659
729
784
857
927
966
1059
1156
1267
1331
1403
1452
1519
1610
1698
1764
1843
1914
1992
2086
2168
2244
2315
2381
2480
2550
2646
2716
2802
2900
2951
3023
3115
3195
3277
3358
3431
3522
3608
3697
3774
3847
3955
4024
4113
4195
4269
4368
4424
4538
4584
4637
4705
4808
4884
4...

result:

ok 1359 lines

Test #22:

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

input:

100000 189
11871 5366857
12597 9358750
14009 5205039
18514 9736021
20792 7819695
23493 6457961
25878 9701971
30227 9271987
37129 6458756
43408 9430450
45981 5848267
50021 6061887
57665 6870713
60542 9297323
64683 8507199
67331 6852620
69935 6350577
73053 9746131
112740 7267403
116273 9213900
137641 ...

output:

1
572
1043
1541
2077
2591
3133
3715
4226
4768
5321
5909
6431
6993
7524
8000
8521
9038
9591
10111
10656
11186
11721
12267
12750
13309
13841
14438
15054
15576
16105
16697
17307
17855
18411
18942
19467
19991
20485
21025
21572
22101
22621
23131
23638
24197
24754
25237
25768
26307
26801
27319
27835
28421...

result:

ok 189 lines

Test #23:

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

input:

100000 170
15020 9542401
19499 9392647
19904 7646218
22983 6941656
32667 6484681
46653 6933539
56208 5473471
60717 6361757
81926 5641147
91980 8928336
94894 5631653
120394 6671365
130890 7917964
132476 5985347
137771 7575277
148174 6984429
177899 9467333
180823 8727173
181899 7786849
206091 6801597
...

output:

1
986
1611
2322
3025
3902
4717
5286
6049
6896
7642
8175
8859
9822
10414
11247
11759
12574
13439
14178
15164
15737
16360
17016
17831
18383
19410
19995
20645
21598
22138
22804
23458
24118
24749
25491
26304
26897
27614
28482
29458
30044
30564
31404
32199
32801
33679
34575
35103
36012
36490
37092
37619
...

result:

ok 170 lines

Test #24:

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

input:

100000 151
3579 9118430
9447 9032933
14340 7691467
22723 5499192
34606 9834536
47116 6238057
50317 8013445
61242 5447275
69720 7351131
71026 5525709
99210 8453046
99742 5998151
126894 7899026
137262 5299483
147751 7757492
158431 9076647
196594 8459875
208689 8979881
217587 6422716
219034 6165744
228...

output:

1
892
1416
2260
3051
3627
4384
4969
5918
6702
7693
8359
8962
9766
10319
10963
11875
12671
13555
14324
15214
15851
16476
17083
18059
19031
19657
20336
21334
22133
22699
23417
24281
25024
25984
26940
27587
28388
29396
30246
31009
31969
32500
33250
34152
34913
35611
36580
37230
37880
38504
39134
39749
...

result:

ok 151 lines

Test #25:

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

input:

100000 18
8109 56775703
11232 74757212
15872 74507021
30195 57394492
45875 70393643
47551 74279114
49350 98896516
51429 80228938
53821 74959851
81875 67009083
93968 90825457
98446 68959198
125292 76509949
126753 73919168
150175 91319742
151324 97878794
157896 52805171
162328 81425517
162635 61803343...

output:

1
6137
13176
20323
26077
31648
37228
42943
48628
54162
59974
65670
71447
77199
82887
88502
94300
99914

result:

ok 18 lines

Test #26:

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

input:

100000 17
5751 56778827
15135 63974156
15673 63824206
22694 78041150
43956 56138887
53848 75522379
79685 88688017
82640 58184217
88386 82120905
98588 63275168
98929 72529330
100002 52940837
126875 50480059
130623 81125021
145677 83657256
152240 69367414
168620 93644452
175295 69686460
180229 9877236...

output:

1
6418
17109
25909
31937
37723
43378
49116
54774
60467
66115
71675
77321
83212
88901
94442
99985

result:

ok 17 lines

Test #27:

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

input:

100000 15
3561 66111120
9802 93321355
10933 78907631
20110 70956938
34371 94948134
77905 57173394
83776 91987357
90064 93855771
90222 84732759
91345 64200241
94774 94219049
100059 96434167
105668 93971823
107556 69555569
112624 59052396
114267 81539543
119384 55088679
120482 63806436
153401 78359176...

output:

1
7272
16593
25490
35385
44485
50708
59374
65768
71282
76945
82646
88442
94040
99963

result:

ok 15 lines

Test #28:

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

input:

100000 92832
3904 4676
17152 18031
45308 45968
52035 53028
65993 66781
70630 71224
93527 94490
103809 104329
110889 111438
121174 122156
136806 137731
151126 151674
155381 155886
174217 175136
179951 180923
186771 187721
196450 197416
233337 233891
235748 236671
239022 240011
250329 251110
274824 27...

output:

-1

result:

ok single line: '-1'

Test #29:

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

input:

100000 57559
9811 19660
39039 45034
51646 58360
77780 86559
88545 94426
92332 99376
95958 102734
98170 107323
99186 108855
115004 123561
118333 125003
131494 139616
150582 156372
160367 168741
169108 176437
169730 178826
188042 195536
198497 207252
205598 212689
209988 215705
215270 222264
248660 25...

output:

-1

result:

ok single line: '-1'

Test #30:

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

input:

100000 12816
10705 81228
24794 112425
26012 94365
33798 115157
50355 120380
65359 161028
65530 132290
76244 158981
86155 166344
91749 145380
107269 170103
108577 191966
121561 177732
139959 220843
140635 222426
163553 241075
173063 232632
173144 271194
177165 239814
178297 233885
207355 285290
21101...

output:

-1

result:

ok single line: '-1'

Test #31:

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

input:

100000 1697
4905 859654
6037 963822
18599 881164
19144 720042
24799 889785
39319 770870
40326 1013932
40964 680543
41319 734642
52952 1046566
73626 746287
74034 697292
82999 830672
88378 594384
97312 600480
117186 1045625
117665 838820
131440 725034
133455 938219
143307 691741
160872 839582
172998 9...

output:

-1

result:

ok single line: '-1'

Test #32:

score: -7
Wrong Answer
time: 15ms
memory: 7044kb

input:

100000 188
6538 5750489
35295 8856905
36949 9632685
56936 5192568
57114 9654737
61953 7613350
63339 7586928
85730 8146324
87048 5432388
92541 5822993
114576 8399838
120763 8890670
139789 6933072
143129 6489022
152417 9469113
153109 7432894
167187 5629094
167690 9087360
170065 5959807
177657 8158375
...

output:

162
865
1380
1896
2392
2945
3509
4076
4615
5173
5680
6210
6710
7269
7793
8294
8776
9289
9766
10357
10912
11434
11962
12510
12975
13518
14038
14557
15130
15725
16245
16755
17341
17863
18381
18914
19423
19961
20491
21009
21569
22112
22669
23233
23853
24425
24918
25416
25925
26433
27016
27549
28096
285...

result:

wrong answer 1st lines differ - expected: '-1', found: '162'

Subtask #2:

score: 0
Wrong Answer

Test #47:

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

input:

1 1
134842099 137944073

output:

1

result:

ok single line: '1'

Test #48:

score: -1
Wrong Answer
time: 0ms
memory: 3604kb

input:

2 2
4015595 884953730
519508315 726912949

output:

1

result:

wrong answer 1st lines differ - expected: '-1', found: '1'

Subtask #3:

score: 0
Wrong Answer

Test #74:

score: 0
Wrong Answer
time: 1ms
memory: 3692kb

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:

-1

result:

wrong answer 1st lines differ - expected: '50', found: '-1'

Subtask #4:

score: 0
Wrong Answer

Test #111:

score: 0
Wrong Answer
time: 15ms
memory: 7020kb

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:

2
102
3095
4226
-1

result:

wrong answer 1st lines differ - expected: '42', found: '2'