QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#410507#3101. Event Hopping 2Rafi22100 ✓216ms45600kbC++141.9kb2024-05-14 05:52:152024-05-14 05:52:16

Judging History

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

  • [2024-05-14 05:52:16]
  • 评测
  • 测评结果:100
  • 用时:216ms
  • 内存:45600kb
  • [2024-05-14 05:52:15]
  • 提交

answer

#include <bits/stdc++.h>

#define ll long long
#define ld long double
#define endl '\n'
#define st first
#define nd second
#define pb push_back
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
using namespace std;
int inf=1000000007;
ll infl=1000000000000000007;
int mod=998244353;

const int N=200007,L=18;

int l[N],r[N];
map<int,int>M;

int skok[2*N][L];

int cnt(int l,int r)
{
    int ans=0;
    for(int j=L-1;j>=0;j--)
    {
        if(skok[l][j]<=r)
        {
            ans+=(1<<j);
            l=skok[l][j];
        }
    }
    return ans;
}

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n,k;
    cin>>n>>k;
    set<int>S;
    for(int i=1;i<=n;i++)
    {
        cin>>l[i]>>r[i];
        S.insert(l[i]);
        S.insert(r[i]);
    }
    int it=0;
    for(auto x:S) M[x]=++it;
    for(int i=1;i<=it+1;i++) skok[i][0]=it+1;
    for(int i=1;i<=n;i++)
    {
        l[i]=M[l[i]];
        r[i]=M[r[i]];
        skok[l[i]][0]=min(skok[l[i]][0],r[i]);
    }
    for(int i=it;i>0;i--) skok[i][0]=min(skok[i][0],skok[i+1][0]);
    for(int j=1;j<L;j++) for(int i=1;i<=it+1;i++) skok[i][j]=skok[skok[i][j-1]][j-1];
    int ile=cnt(1,it);
    if(ile<k)
    {
        cout<<-1;
        return 0;
    }
    set<pair<int,int>>X;
    X.insert({-inf,-inf});
    X.insert({1,it});
    int c=0;
    for(int i=1;i<=n&&c<k;i++)
    {
        pair<int,int>p=*--X.upper_bound({l[i],inf});
       // cout<<p.st<<" "<<p.nd<<" "<<l[i]<<" "<<r[i]<<endl;
        if(p.nd<r[i]) continue;
        int nile=ile-cnt(p.st,p.nd)+1+cnt(p.st,l[i])+cnt(r[i],p.nd);
        if(nile>=k)
        {
            cout<<i<<endl;
            c++;
            ile=nile;
            X.erase(p);
            X.insert({p.st,l[i]});
            X.insert({r[i],p.nd});
        }
    }


    return 0;
}

詳細信息

Subtask #1:

score: 7
Accepted

Test #1:

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

input:

1 1
1 3

output:

1

result:

ok single line: '1'

Test #2:

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

input:

2 1
2 4
3 7

output:

1

result:

ok single line: '1'

Test #3:

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

input:

3 1
2 5
3 5
4 7

output:

1

result:

ok single line: '1'

Test #4:

score: 0
Accepted
time: 146ms
memory: 43396kb

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: 135ms
memory: 43500kb

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: 145ms
memory: 43276kb

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: 138ms
memory: 42140kb

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: 144ms
memory: 43392kb

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: 134ms
memory: 43520kb

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: 142ms
memory: 44892kb

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: 141ms
memory: 42704kb

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: 122ms
memory: 41668kb

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: 115ms
memory: 41508kb

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: 112ms
memory: 41748kb

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: 122ms
memory: 41036kb

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: 106ms
memory: 39696kb

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: 106ms
memory: 39392kb

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: 96ms
memory: 39104kb

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: 93ms
memory: 39372kb

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: 94ms
memory: 41248kb

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: 101ms
memory: 39440kb

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: 103ms
memory: 39340kb

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: 105ms
memory: 38840kb

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: 103ms
memory: 41016kb

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: 117ms
memory: 40948kb

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: 105ms
memory: 39080kb

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: 114ms
memory: 38772kb

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: 100ms
memory: 39284kb

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: 90ms
memory: 38544kb

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: 89ms
memory: 38964kb

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: 90ms
memory: 38976kb

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: 0
Accepted
time: 108ms
memory: 40948kb

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:

-1

result:

ok single line: '-1'

Test #33:

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

input:

100000 19
11696 86394771
15030 83193673
21618 98424422
22595 77878508
22735 86392647
57110 94832421
60929 80830109
75471 89004994
79095 85788873
96996 87641109
114341 94738620
124516 54384823
135830 69674965
137162 52868775
149489 90413528
154708 59929605
158576 58522310
165944 55363464
199794 60460...

output:

-1

result:

ok single line: '-1'

Test #34:

score: 0
Accepted
time: 104ms
memory: 40928kb

input:

100000 34512
4001 10178
16727 26432
19853 28114
23766 32478
30904 38359
44152 52631
45308 50981
65993 72726
70035 76387
70630 80277
93527 101277
119889 125005
130174 135535
130809 140777
145806 153240
151126 157221
155381 162706
179951 187096
183217 192764
186771 195896
223450 230464
235748 242621
2...

output:

1
2
5
6
8
11
12
13
15
17
18
21
22
23
25
26
28
30
31
32
34
36
39
43
44
45
48
50
52
53
54
55
57
59
61
63
65
66
67
70
73
75
76
78
80
82
84
85
87
88
90
92
93
95
97
102
105
106
107
108
109
110
111
113
114
115
116
119
123
127
128
130
132
134
135
137
140
141
142
143
145
147
148
149
150
152
153
155
159
161
...

result:

ok 34512 lines

Test #35:

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

input:

100000 23024
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
2
3
4
5
7
10
12
13
14
15
17
18
20
22
27
29
30
31
32
34
36
38
41
44
45
47
48
49
51
54
56
57
58
60
63
65
66
69
71
73
74
77
79
80
81
84
87
89
90
91
93
96
97
98
100
101
104
105
106
107
109
110
111
112
115
116
117
118
123
125
127
129
130
131
132
133
135
139
140
142
145
146
147
149
152
155
158
160
162
1...

result:

ok 23024 lines

Test #36:

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

input:

100000 11469
1749 9673
24794 33141
31015 39543
31561 39131
73553 80366
100042 107436
100746 107380
103683 109419
121616 129753
146270 153353
168277 174235
172338 179442
173056 178254
180700 190697
180878 186178
204655 214273
225196 234024
229485 238120
231513 239770
241919 250375
260338 265971
27329...

output:

1
2
5
6
9
10
11
14
16
17
20
21
22
23
24
25
26
27
29
30
34
36
38
40
41
42
43
44
45
47
48
52
54
57
60
61
64
65
68
70
72
74
75
78
79
80
81
82
84
85
86
87
91
92
94
96
97
98
101
103
105
106
107
112
114
116
119
121
123
124
125
127
129
132
133
134
135
137
139
143
144
145
147
148
149
151
152
153
154
155
156...

result:

ok 11469 lines

Test #37:

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

input:

100000 50000
3385 22602
15118 17374
25918 36726
25983 30341
38262 60763
50908 54723
71193 90454
77723 84223
96157 121101
97502 113730
124067 136828
131197 132858
144072 152682
149026 150819
153227 170907
158212 169128
175048 182925
180847 180992
189127 200462
192369 194079
207707 216404
207976 21429...

output:

1
3
5
7
9
11
13
15
17
19
21
23
25
27
29
31
33
35
37
39
41
43
45
47
49
51
53
55
57
59
61
63
65
67
69
71
73
75
77
79
81
83
85
87
89
91
93
95
97
99
101
103
105
107
109
111
113
115
117
119
121
123
125
127
129
131
133
135
137
139
141
143
145
147
149
151
153
155
157
159
161
163
165
167
169
171
173
175
177...

result:

ok 50000 lines

Test #38:

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

input:

100000 48000
3919 19928
6894 19295
26011 37935
30149 32523
46359 60844
48369 53998
62841 82568
70617 76333
86782 99607
93507 96845
109927 118141
111357 111996
118198 124460
120365 122508
135217 147445
136431 138035
148529 177957
148704 152131
196706 205108
198880 203741
208372 229413
211287 216823
2...

output:

1
3
5
7
9
11
13
15
17
19
21
23
25
27
29
31
33
35
37
39
41
43
45
47
49
51
53
55
57
59
61
63
65
67
69
71
73
75
77
79
81
83
85
87
89
91
93
95
97
99
101
103
105
107
109
111
113
115
117
119
121
123
125
127
129
131
133
135
137
139
141
143
145
147
149
151
153
155
157
159
161
163
165
167
169
171
173
175
177...

result:

ok 48000 lines

Test #39:

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

input:

100000 46000
7861 32751
22760 26494
39684 45851
40904 42267
51634 54991
51964 52209
56358 76070
67961 70798
77254 94033
78951 94032
98974 105914
99051 99360
110232 130179
120381 127849
132057 156356
133077 149316
160834 186236
161096 170777
198236 202006
201494 201958
204118 211402
207491 209514
214...

output:

1
3
5
7
9
11
13
15
17
19
21
23
25
27
29
31
33
35
37
39
41
43
45
47
49
51
53
55
57
59
61
63
65
67
69
71
73
75
77
79
81
83
85
87
89
91
93
95
97
99
101
103
105
107
109
111
113
115
117
119
121
123
125
127
129
131
133
135
137
139
141
143
145
147
149
151
153
155
157
159
161
163
165
167
169
171
173
175
177...

result:

ok 46000 lines

Test #40:

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

input:

100000 44000
354 15072
5536 14710
19678 32180
24230 27035
35679 49748
39329 41843
55851 66113
57846 62517
70107 82556
78170 81316
93880 106334
94742 101602
111770 140322
116978 123594
148941 157393
151851 154147
162583 191208
175952 186995
193692 209083
197078 207122
216756 226820
220611 221173
2355...

output:

1
3
5
7
9
11
13
15
17
19
21
23
25
27
29
31
33
35
37
39
41
43
45
47
49
51
53
55
57
59
61
63
65
67
69
71
73
75
77
79
81
83
85
87
89
91
93
95
97
99
101
103
105
107
109
111
113
115
117
119
121
123
125
127
129
131
133
135
137
139
141
143
145
147
149
151
153
155
157
159
161
163
165
167
169
171
173
175
177...

result:

ok 44000 lines

Test #41:

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

input:

100000 42000
134 25412
10249 13603
30598 45694
31946 40951
48198 63861
54201 57603
65107 91885
67263 75648
94096 106664
100707 102011
108972 123744
111181 123208
124630 135088
130963 133544
140847 153932
151528 153069
154469 165953
160640 160969
166427 183054
166990 173221
187899 206409
193568 19497...

output:

1
3
5
7
9
11
13
15
17
19
21
23
25
27
29
31
33
35
37
39
41
43
45
47
49
51
53
55
57
59
61
63
65
67
69
71
73
75
77
79
81
83
85
87
89
91
93
95
97
99
101
103
105
107
109
111
113
115
117
119
121
123
125
127
129
131
133
135
137
139
141
143
145
147
149
151
153
155
157
159
161
163
165
167
169
171
173
175
177...

result:

ok 42000 lines

Test #42:

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

input:

100000 50000
1009 11588
3172 7775
19428 37428
22241 27726
51939 57615
53942 56298
58145 60885
58411 60432
61299 76501
63967 71739
85978 91923
87118 88018
94158 118616
97458 98978
118969 145953
134410 143683
156177 175586
158124 168302
177242 200968
184735 195759
201230 229057
204144 209556
231440 23...

output:

-1

result:

ok single line: '-1'

Test #43:

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

input:

100000 48000
8719 22716
12838 18758
25031 34662
27255 29644
36275 45579
37805 44405
46705 65627
48769 55749
67561 94228
69548 92389
96929 126085
102443 123805
141386 149872
142704 147965
152130 158469
155481 157837
163047 172760
164879 169722
175291 191106
176879 189992
191715 193629
193209 193221
1...

output:

1
3
5
7
9
11
13
15
17
19
21
23
25
27
29
31
33
35
37
39
41
43
45
47
49
51
53
55
57
59
61
64
65
67
69
71
73
75
77
79
81
83
85
87
89
91
93
95
97
99
101
103
105
107
109
111
113
115
117
119
121
123
125
127
129
131
133
135
137
139
141
143
145
147
149
151
153
155
157
159
161
163
165
167
169
171
173
175
177...

result:

ok 48000 lines

Test #44:

score: 0
Accepted
time: 121ms
memory: 41260kb

input:

100000 46000
4460 18592
14940 15931
31036 48231
38312 46712
48549 56979
51101 52256
58530 73717
61786 65665
89578 93845
90505 92793
102521 112267
103610 110594
114127 132083
115095 116697
134272 141258
138519 138645
142837 147164
145006 145017
151170 153207
151299 151553
153410 165257
155394 155740
...

output:

1
3
5
7
9
11
13
15
17
19
21
23
25
27
29
31
33
35
37
39
41
43
45
47
49
51
53
55
57
59
61
63
65
67
69
71
73
75
77
79
81
83
85
87
89
91
93
95
97
99
101
103
105
107
109
111
113
115
117
119
121
123
125
127
129
131
133
135
137
139
141
143
145
147
149
151
154
155
157
159
161
163
165
167
169
171
173
175
177...

result:

ok 46000 lines

Test #45:

score: 0
Accepted
time: 112ms
memory: 41440kb

input:

100000 44000
1047 5029
3626 4711
8739 32789
13236 27827
35097 53905
38010 43949
53954 64670
60471 63932
67978 92650
78404 82803
95080 106127
97178 101387
121249 146770
131414 145489
148027 367100172
152489 155554
166771 171189
170302 170389
173847 186597
178831 180847
191175 196111
193676 195691
212...

output:

1
3
5
7
9
11
13
16
17
19
21
23
25
27
29
31
33
35
37
39
41
43
45
47
49
51
53
55
57
59
61
63
65
67
69
71
73
75
77
79
81
83
85
87
89
91
93
95
97
99
101
103
105
107
109
111
113
115
117
119
121
123
125
127
129
131
133
135
137
139
141
143
145
147
149
151
153
155
157
159
161
163
165
167
169
171
173
175
177...

result:

ok 44000 lines

Test #46:

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

input:

100000 42000
1129 26113
5530 8666
37885 56441
40648 42782
56710 64141
60057 60371
66227 72683
67207 68536
73560 104493
81024 463266735
105434 122451
109036 110088
128545 141007
130926 132762
142010 152970
142381 149757
159141 165577
159602 161127
167019 181155
173282 176180
193158 227989
215594 2267...

output:

1
3
5
7
9
11
13
15
17
19
21
23
25
27
29
31
33
35
37
39
41
43
45
47
49
51
53
55
57
59
61
63
65
67
69
71
73
75
77
79
81
83
85
87
89
91
93
95
97
99
101
103
105
107
109
111
113
115
117
119
121
123
125
127
129
131
133
135
137
139
141
143
145
147
149
151
153
155
157
159
161
163
165
167
169
171
173
175
177...

result:

ok 42000 lines

Subtask #2:

score: 1
Accepted

Test #47:

score: 1
Accepted
time: 1ms
memory: 5596kb

input:

1 1
134842099 137944073

output:

1

result:

ok single line: '1'

Test #48:

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

input:

2 2
4015595 884953730
519508315 726912949

output:

-1

result:

ok single line: '-1'

Test #49:

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

input:

3 2
551691302 800582045
14063803 52897269
153641504 567834643

output:

1
2

result:

ok 2 lines

Test #50:

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

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: 3564kb

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: 5804kb

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: 5664kb

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: 5828kb

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: 0ms
memory: 3568kb

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: 1ms
memory: 5588kb

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: 5860kb

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: 5592kb

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: 5664kb

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: 5864kb

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: 0ms
memory: 5540kb

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: 0ms
memory: 3604kb

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: 1ms
memory: 5600kb

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: 1ms
memory: 5596kb

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: 0ms
memory: 5532kb

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: 0ms
memory: 3608kb

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: 0ms
memory: 3544kb

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: 0ms
memory: 3760kb

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: 5588kb

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: 5640kb

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: 0ms
memory: 3592kb

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: 5644kb

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: 0ms
memory: 3556kb

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: 4500kb

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: 3ms
memory: 4804kb

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: 6816kb

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: 6632kb

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: 6812kb

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: 4540kb

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: 8532kb

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: 4636kb

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: 6704kb

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: 8624kb

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: 2ms
memory: 4600kb

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: 0ms
memory: 6632kb

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: 4ms
memory: 6956kb

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: 4ms
memory: 8384kb

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: 6656kb

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: 0ms
memory: 6844kb

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: 6664kb

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: 4800kb

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: 0ms
memory: 6636kb

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: 0ms
memory: 6608kb

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: 4612kb

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: 6524kb

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: 3ms
memory: 6840kb

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: 6812kb

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: 0ms
memory: 8728kb

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: 3ms
memory: 6644kb

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: 0ms
memory: 6780kb

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: 3ms
memory: 6296kb

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: 3ms
memory: 6276kb

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: 3ms
memory: 6300kb

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: 3ms
memory: 6456kb

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: 0ms
memory: 4280kb

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: 0ms
memory: 6296kb

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: 3ms
memory: 6296kb

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: 2ms
memory: 4268kb

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: 0ms
memory: 6208kb

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: 8048kb

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: 61
Accepted

Test #111:

score: 61
Accepted
time: 180ms
memory: 38604kb

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: 173ms
memory: 39692kb

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: 172ms
memory: 39048kb

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: 179ms
memory: 39560kb

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: 168ms
memory: 38972kb

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: 169ms
memory: 38588kb

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: 169ms
memory: 38876kb

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: 216ms
memory: 45600kb

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: 200ms
memory: 43296kb

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: 179ms
memory: 41636kb

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: 133ms
memory: 41044kb

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: 197ms
memory: 43600kb

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: 188ms
memory: 42028kb

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: 185ms
memory: 41400kb

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: 137ms
memory: 40968kb

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: 39948kb

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: 153ms
memory: 41788kb

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: 167ms
memory: 39680kb

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: 142ms
memory: 38968kb

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: 159ms
memory: 39624kb

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: 177ms
memory: 38568kb

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: 165ms
memory: 38964kb

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: 165ms
memory: 39360kb

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: 175ms
memory: 39516kb

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: 172ms
memory: 39004kb

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: 163ms
memory: 39688kb

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: 157ms
memory: 39592kb

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: 172ms
memory: 38912kb

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: 168ms
memory: 38520kb

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: 177ms
memory: 38532kb

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: 166ms
memory: 39288kb

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: 0
Accepted
time: 128ms
memory: 28708kb

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:

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 100000 lines

Test #143:

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

input:

100000 99999
17981 19740
19740 25262
25262 31700
31700 34160
34160 43647
43647 69299
69299 92692
92692 101900
101900 114038
114038 129816
129816 141977
141977 143457
143457 148311
148311 159973
159973 167348
167348 189413
189413 201673
201673 201919
201919 210622
210622 216381
216381 226981
226981 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 99999 lines

Test #144:

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

input:

100000 99998
1156 1448
1448 2514
2514 2719
2719 2754
2754 41304
41304 41830
41830 61830
61830 63753
63753 69386
69386 85824
85824 96918
96918 109225
109225 109782
109782 120983
120983 121638
121638 139007
139007 160309
160309 162065
162065 164418
164418 211555
211555 213398
213398 242454
242454 2446...

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 99998 lines

Test #145:

score: 0
Accepted
time: 112ms
memory: 28436kb

input:

100000 99028
18362 18986
18986 40280
40280 47191
47191 51860
51860 72816
72816 82327
82327 94741
94741 95896
95896 109654
109654 133774
133774 147209
147209 158035
158035 162164
162164 162878
162878 170664
170664 176695
176695 187667
187667 190136
190136 212250
212250 217910
217910 222668
222668 240...

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
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
103...

result:

ok 99028 lines

Test #146:

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

input:

100000 97024
30607 32410
32410 35556
35556 39315
39315 53765
53765 70888
70888 86987
86987 134307
134307 156469
156469 163902
163902 166025
166025 166436
166436 178418
178418 187309
187309 195712
195712 209411
209411 221296
221296 231483
231483 243497
243497 252298
252298 260439
260439 262447
262447...

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
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
103...

result:

ok 97024 lines

Test #147:

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

input:

100000 95048
15715 18432
18432 27500
27500 33941
33941 59700
59700 68403
68403 73751
73751 75271
75271 105433
105433 107549
107549 125757
125757 127296
127296 129382
129382 148206
148206 157880
157880 189241
189241 212866
212866 216728
216728 223321
223321 260970
260970 277323
277323 292273
292273 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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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
103
10...

result:

ok 95048 lines

Test #148:

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

input:

100000 93063
7237 15322
15322 36159
36159 56752
56752 57902
57902 62214
62214 75946
75946 81772
81772 84186
84186 87875
87875 131565
131565 140280
140280 177743
177743 184582
184582 190821
190821 191269
191269 206841
206841 227740
227740 232502
232502 253123
253123 256692
256692 267027
267027 269899...

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 93063 lines

Test #149:

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

input:

100000 91096
2571 16198
16198 18793
18793 23892
23892 28513
28513 30365
30365 32429
32429 39915
39915 44674
44674 51158
51158 51574
51574 87477
87477 92321
92321 119529
119529 121096
121096 150630
150630 156430
156430 158028
158028 165373
165373 181260
181260 182966
182966 192614
192614 196030
19603...

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 91096 lines

Test #150:

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

input:

100000 89114
25844 37225
37225 39318
39318 43377
43377 45838
45838 58377
58377 68261
68261 80562
106455 135880
80562 106455
135880 150033
150033 166394
166394 181982
192806 203959
181982 192806
203959 215034
215034 233306
233306 242899
242899 245962
245962 260539
260539 264190
264190 265089
265089 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
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
103...

result:

ok 89114 lines

Test #151:

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

input:

100000 79219
3354 17469
17469 22334
22334 32247
32247 34510
34510 38099
38099 45252
45252 49995
49995 52397
52397 52747
52747 72689
72689 78098
78098 81153
81153 107685
107685 115783
115783 126536
126536 131885
131885 140194
140194 148206
148206 171281
171281 180607
180607 189852
189852 194187
19418...

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 79219 lines

Test #152:

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

input:

100000 98992
2539 5630
5630 11990
11990 13820
13820 16585
16585 44220
44220 66847
66847 85690
85690 90023
90023 93953
93953 103232
103232 114064
121734 147715
114064 121735
147715 147790
147790 158672
158672 159992
159992 173830
173830 174348
174348 197507
197507 200858
200858 206956
206956 223533
2...

output:

-1

result:

ok single line: '-1'

Test #153:

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

input:

100000 99495
2037 8155
8155 22670
22670 26461
26461 36175
36175 45428
45428 56367
56367 58901
58901 73000
73000 99841
99841 124369
124369 135976
135976 136779
136779 137089
137089 156183
156183 157567
157567 159976
159976 180322
180322 182681
182681 189228
189228 210278
210278 226847
226847 231539
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
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...

result:

ok 99495 lines

Test #154:

score: 0
Accepted
time: 112ms
memory: 27940kb

input:

100000 97522
19521 56437
56437 59961
59961 70182
70182 129417
129417 149558
149558 160152
160152 175674
175674 178437
178437 178815
178815 180703
180703 188644
188644 199260
199260 225973
225973 232382
232382 241564
241564 249799
249799 264091
264091 267427
267427 272950
272950 281367
281367 283664
...

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 97522 lines

Test #155:

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

input:

100000 95470
13705 30562
30562 39438
39438 40471
40471 49712
49712 53042
53042 73738
73738 79431
79431 81895
81895 99905
99905 111623
111623 123061
123061 132911
132911 138507
138507 160565
160565 164625
164625 166638
166638 173752
173752 186199
186199 187198
187198 206385
206385 210617
210617 21153...

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 95470 lines

Test #156:

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

input:

100000 93562
7970 13452
13452 43399
43399 66149
66149 66744
66744 77132
77132 88397
88397 96942
96942 109237
109237 110312
110312 115975
115975 125072
125072 135626
135626 137870
137870 138387
138387 144382
144382 145970
145970 157308
157308 168677
168677 178343
178343 185109
185109 221108
221108 22...

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
96
97
98
99
100
101
102
103...

result:

ok 93562 lines

Test #157:

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

input:

100000 91548
25198 27975
27975 32981
32981 35391
35391 37140
37140 50778
50778 84254
84254 85426
85426 96499
96499 100057
100057 107072
107072 109106
109106 109158
109158 111479
111479 128342
128342 135981
135981 142847
142847 186443
186443 201097
201097 201715
201715 211737
211737 225663
225663 236...

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
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
103...

result:

ok 91548 lines

Test #158:

score: 0
Accepted
time: 115ms
memory: 27704kb

input:

100000 89571
2496 14593
14593 28297
29757 46186
28297 29757
46186 57780
57780 83723
83723 84751
84751 88656
88656 88747
88747 104002
104002 106329
106329 134606
134606 144760
144760 145316
145316 150850
150850 159382
159382 164438
164438 176896
176896 203033
203033 203366
203366 208841
208841 245505...

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 89571 lines

Test #159:

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

input:

100000 79588
8132 9538
9538 16528
16528 47624
47624 58814
58814 59004
59004 72337
72337 78741
100288 106627
78741 100288
106627 117712
117712 137238
137238 154266
154266 176961
176961 196064
196064 196407
196407 203845
203845 205038
205038 210632
210632 223389
223389 258316
258316 261066
261066 2630...

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 79588 lines

Test #160:

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

input:

100000 99501
15877 22864
22864 25447
25447 28865
28865 30918
30918 50080
50080 50148
50148 67974
67974 85091
85091 94960
94960 99284
99284 102084
102084 130125
130125 140507
140507 143067
143067 145456
145456 151705
151705 168819
168819 173662
173662 181221
181221 196930
196930 197411
197411 203561
...

output:

-1

result:

ok single line: '-1'

Test #161:

score: 0
Accepted
time: 170ms
memory: 34836kb

input:

100000 50000
583040503 583048967
596293243 596309507
354291138 354307241
872666968 872684914
676895692 676913382
849100270 849138286
428984455 428999425
719041599 719053708
352675412 352695573
391460018 391471846
146465498 146475866
652015116 652025784
170505147 170513190
498920724 498931519
4671331...

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
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
103...

result:

ok 50000 lines

Test #162:

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

input:

100000 48000
223545896 223554416
173392717 173413395
491454811 491481050
461829091 461834529
938058190 938063187
169109301 169132320
330411509 330414424
555667661 555684482
652921855 652940858
854528222 854536991
250259148 250269769
965455947 965483047
642257100 642260009
412051387 412071589
4186432...

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 48000 lines

Test #163:

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

input:

100000 46000
793310679 793317837
790176953 790185156
855278729 855306893
728568188 728570365
655259190 655269950
970157235 970202591
516307972 516320987
877394097 877416143
742196340 742209998
1341438 1346096
942085906 942102959
780679970 780684015
380158824 380171740
817436234 817446811
906042840 9...

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 46000 lines

Test #164:

score: 0
Accepted
time: 163ms
memory: 32052kb

input:

100000 44000
797135465 797148503
164929696 164941754
168516766 168519347
484813632 484831077
226105715 226113460
469504287 469509494
54263550 54273312
77303104 77322621
804818592 804832511
848106255 848111318
265094829 265100690
771503599 771505992
138820954 138825107
731788618 731796653
225555216 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 44000 lines

Test #165:

score: 0
Accepted
time: 146ms
memory: 32700kb

input:

100000 42000
332307073 332315347
225207782 225213047
668010823 668019866
851341500 851349130
777445803 777454540
415601045 415620025
869411931 869439396
467046812 467052591
525181054 525183216
699022450 699034952
278120353 278138566
596357694 596373491
292846483 292854505
588600458 588602221
9800520...

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 42000 lines

Test #166:

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

input:

100000 50000
10377 32822
18143 21218
33123 47021
33432 36905
54736 70348
61033 61728
88890 108108
105559 107378
114527 130310
117242 128636
134097 147997
141275 144884
160149 166656
163233 163475
169255 191052
176703 182636
194585 204462
197574 200321
206375 239790
226025 226466
241871 264477
258943...

output:

-1

result:

ok single line: '-1'

Test #167:

score: 0
Accepted
time: 130ms
memory: 41452kb

input:

100000 48000
4403 18411
5140 122998971
28800 66140
42693 56337
66211 75817
68937 69645
90478 97435
90976 91902
103731 116689
105067 115222
120155 143857
125059 139812
155241 166807
83429 163725
168870 182244
170723 177136
182950 211107
197092 200456
213284 226993
217474 224106
229189 237306
230423 2...

output:

1
3
5
7
9
11
13
15
17
19
21
23
25
27
29
31
33
35
37
39
41
43
45
47
49
51
53
55
57
59
61
63
65
67
69
71
73
75
77
79
81
83
85
87
89
91
93
95
97
99
101
103
105
107
109
111
113
115
117
119
121
123
125
127
129
131
133
135
137
139
141
143
145
147
149
151
153
155
157
159
161
163
165
167
169
171
173
175
177...

result:

ok 48000 lines

Test #168:

score: 0
Accepted
time: 122ms
memory: 41440kb

input:

100000 46000
4802 9317
5524 7595
9361 13994
11993 13741
20119 27006
25751 26097
28356 39740
31756 33603
48602 51697
51005 51602
54842 69102
63234 68998
73493 83037
74306 82475
83173 101705
95196 100726
105677 131802
124192 127312
133707 140861
138408 138626
143443 149381
144459 149139
162565 186049
...

output:

1
3
5
7
9
11
13
15
17
19
21
23
25
27
29
31
33
35
37
39
41
43
45
47
49
51
53
55
57
59
61
63
65
67
69
71
73
75
77
79
81
83
85
87
89
91
93
95
97
99
101
103
105
107
109
111
113
115
117
119
121
123
125
127
129
131
133
135
137
139
141
143
145
147
149
151
153
155
157
159
161
163
165
167
169
171
173
175
177...

result:

ok 46000 lines

Test #169:

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

input:

100000 44000
7306 14609
10981 13531
19913 33130
8768 24689
44083 49633
46872 47299
51381 74930
57272 71066
75001 92173
78757 83237
99981 107717
101975 103558
107788 111209
108191 110044
114003 130826
114787 125847
136641 142153
138902 140767
142850 148220
143527 146142
154228 182142
161490 166280
19...

output:

1
3
5
7
9
11
13
15
17
19
21
23
25
27
29
31
33
35
37
39
41
43
45
47
49
51
53
55
57
59
61
63
65
67
69
71
73
75
77
79
81
83
85
87
89
91
93
95
97
99
101
103
105
107
109
111
113
115
117
119
121
123
125
127
129
131
134
135
137
139
141
143
145
147
149
151
153
155
157
159
161
163
165
167
169
171
173
175
177...

result:

ok 44000 lines

Test #170:

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

input:

100000 42000
3540 7503
4526 6181
8680 22404
12021 19428
35635 44102
38244 40765
45530 56480
52239 55584
59032 71503
65372 69196
73484 102077
92072 97279
107611 137022
128504 136958
142700 160651
150381 156230
161766 173135
163496 172897
174414 214471
181369 198711
214843 235181
220120 224583
256470 ...

output:

1
3
5
7
9
11
13
15
17
19
21
23
25
27
29
31
33
35
38
39
41
43
45
47
49
51
53
55
57
59
61
63
65
67
69
71
73
75
77
79
81
83
85
87
89
91
93
95
97
99
101
103
105
107
109
111
113
115
117
119
121
123
125
127
129
131
133
135
137
139
141
143
145
147
149
151
153
155
157
159
161
163
165
167
169
171
173
175
177...

result:

ok 42000 lines

Test #171:

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

input:

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

output:

1
3
5
7
9
11
13
15
17
19
21
23
25
27
29
31
33
35
37
39
41
43
45
47
49
51
53
55
57
59
61
63
65
67
69
71
73
75
77
79
81
83
85
87
89
91
93
95
97
99
101
103
105
107
109
111
113
115
117
119
121
123
125
127
129
131
133
135
137
139
141
143
145
147
149
151
153
155
157
159
161
163
165
167
169
171
173
175
177...

result:

ok 50000 lines

Test #172:

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

input:

100000 50000
999999997 999999999
999999998 1000000000
999999993 999999995
999999994 999999996
999999989 999999991
999999990 999999992
999999985 999999987
999999986 999999988
999999981 999999983
999999982 999999984
999999977 999999979
999999978 999999980
999999973 999999975
999999974 999999976
999999...

output:

1
3
5
7
9
11
13
15
17
19
21
23
25
27
29
31
33
35
37
39
41
43
45
47
49
51
53
55
57
59
61
63
65
67
69
71
73
75
77
79
81
83
85
87
89
91
93
95
97
99
101
103
105
107
109
111
113
115
117
119
121
123
125
127
129
131
133
135
137
139
141
143
145
147
149
151
153
155
157
159
161
163
165
167
169
171
173
175
177...

result:

ok 50000 lines

Test #173:

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

input:

100000 49990
354124224 354131628
922006372 922009538
660767904 660783818
711325873 711359378
366042863 366074197
232212977 232312304
158059097 158080209
333064394 333065959
106759083 106775352
552439205 552459906
127167420 127185809
309650280 309673322
43369132 43376687
394060717 394073947
399042358...

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
43
44
45
46
48
49
50
51
52
54
55
56
59
60
61
62
63
66
67
68
69
71
72
73
74
76
79
81
82
83
84
85
86
87
88
89
90
93
94
96
97
99
102
103
105
111
112
115
116
119
120
124
125
126
127
129
130
...

result:

ok 49990 lines

Test #174:

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

input:

100000 49900
439249180 439257052
975522989 975541875
263577013 263578393
293502290 293515367
96545177 96557131
304810041 304817310
724614330 724636923
375356957 375392560
933237294 933269473
459562812 459571198
502014131 502025506
904008532 904016579
600841150 600858208
995144887 995157219
880229098...

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 49900 lines

Test #175:

score: 0
Accepted
time: 148ms
memory: 25688kb

input:

100000 49000
837452729 837460625
903147650 903203409
688618141 688644470
101052634 101060390
437099526 437103191
967749133 967772477
950914914 950918045
649011223 649017134
758943570 758961373
332844218 332855155
786501565 786506735
115005949 115024080
774942837 774957256
776851229 776857228
6446999...

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 49000 lines

Test #176:

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

input:

100000 40000
280552170 280596297
48233658 48267686
582006060 582028355
188006177 188015891
564654698 564675759
304563561 304570946
94430062 94446404
936516024 936538110
813203425 813221334
610286943 610323555
153057038 153079336
539438475 539447041
415248114 415261252
138390244 138431239
706373804 7...

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 40000 lines

Extra Test:

score: 0
Extra Test Passed