QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#864782#2717. Shopping PlansGrain_Depot0815 175ms45684kbC++233.2kb2025-01-21 07:27:212025-01-21 07:27:21

Judging History

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

  • [2025-01-21 07:27:21]
  • 评测
  • 测评结果:15
  • 用时:175ms
  • 内存:45684kb
  • [2025-01-21 07:27:21]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define N 200005
typedef long long ll;
const ll inf=1e18;
int n,m,k,p[N];
ll sum;
struct Node{
    vector<ll>ans;
    vector<int>a;
    int l,r;
    ll sum;
    struct node{
        int a,b,c,type;
        ll w;
        bool operator<(const node&x)const{return w>x.w;}
    };
    priority_queue<node>q;
    void put(node u){
        if(u.a==u.b&&u.c==(int)a.size()&&u.a<u.c&&u.a+1<r)//(i,i,n+1)->(i+1,i+1,n+1) (i+1<r)
            q.push({u.a+1,u.b+1,u.c,1,u.w+a[u.b+1]});
        if(u.b+1<u.c)q.push({u.a,u.b+1,u.c,1,u.w+a[u.b+1]-a[u.b]});//(i,j,k)->(i,j+1,k);
        if(u.a>0&&u.b>u.a+1)q.push({u.a-1,u.a-1,u.b,0,u.w});//(i,j,k)->(i-1,i-1,j);
    }
    ll get(int x){
        if((int)ans.size()>x)return ans[x];
        node u;
        while((int)ans.size()<=x){
            while(!q.empty()&&q.top().type==0)
                u=q.top(),q.pop(),put(u);
            if(q.empty())return inf;
            u=q.top();q.pop();put(u);
            ans.push_back(u.w);
        }
        return u.w;
    }
    void init(){
        if(!l)ans.push_back(0),l=1;///
        if((int)a.size()<l||l>r){
            ans.push_back(inf);
            ans.push_back(inf);
            return;
        }
        sort(a.begin(),a.end());
        for(int i=0;i<l;++i)sum+=a[i];
        q.push({max(l-1,0),max(l-1,0),(int)a.size(),1,sum});
    }
}a[N];
bool cmp(int i,int j){
    return a[i].get(1)-a[i].get(0)<a[j].get(1)-a[j].get(0);
}
struct node{
    int a,b;
    ll w;
    bool operator<(const node&x)const{return w>x.w;}
};
priority_queue<node>q;
int main(){
    int x,y;
    scanf("%d%d%d",&n,&m,&k);
    for(int i=1;i<=n;++i){
        scanf("%d%d",&x,&y);
        a[x].a.push_back(y);
    }
    for(int i=1;i<=m;++i){
        scanf("%d%d",&a[i].l,&a[i].r);
        a[p[i]=i].init();
    }
    sort(p+1,p+m+1,cmp);
    for(int i=1;i<=m;++i){
        sum+=a[i].get(0);
        if(sum>=inf){
            while(k--)printf("-1\n");
            return 0;
        }
    }
    q.push({1,0,sum});
    while(k--){
        if(q.empty()||q.top().w>=inf){
            printf("-1\n");
            while(k--)printf("-1\n");
            return 0;
        }
        auto u=q.top();q.pop();
        x=u.a;y=u.b;
        printf("%lld\n",u.w);
        q.push({x,y+1,u.w+a[p[x]].get(y+1)-a[p[x]].get(y)});//(i,j)->(i,j+1)
        if(x<m&&y==1)q.push({x+1,1,u.w+a[p[x+1]].get(1)-a[p[x+1]].get(0)-(a[p[x]].get(1)-a[p[x]].get(0))});
        if(x<m&&y>0)q.push({x+1,1,u.w+a[p[x+1]].get(1)-a[p[x+1]].get(0)});
    }
    return 0;
}
/*
22 22 199709
12 52
5 69
5 3
5 292
12 29
5 129
20 134
12 9
14 1
12 218
12 111
12 37
22 41
11 71
5 54
5 208
12 112
5 242
2 64
22 146
5 134
22 61
0 0
0 1
0 0
0 0
0 6
0 0
0 0
0 0
0 0
0 0
0 0
0 6
0 0
0 1
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 3

*/
/*
26 26 200000
1 174
1 156
2 5
19 38
5 51
15 283
15 222
5 16
16 277
1 114
1 3
1 17
2 139
1 51
5 160
1 78
1 233
1 17
1 201
5 99
1 51
17 15
1 122
17 33
17 241
1 6
6 9
0 1
0 0
0 0
0 4
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
1 12
0 2
0 0
1 1
0 0
0 0
0 0
0 0
0 0
0 0
0 0

*/

详细

Subtask #1:

score: 5
Accepted

Test #1:

score: 5
Accepted
time: 5ms
memory: 23252kb

input:

3955 2529 3960
2020 178181351
273 538826941
2210 676511304
864 133303976
1422 97869159
1347 649252430
1398 496208545
684 534057577
866 291511178
842 433713988
1114 846088853
578 761523300
501 110995133
2395 796537204
1942 567365992
301 873331279
280 61833249
2268 336331376
1151 417374725
632 3498474...

output:

1069562744567
1069564035087
1069564852964
1069565762898
1069565962340
1069566003610
1069566143484
1069566428855
1069566911151
1069567053418
1069567134421
1069567252860
1069567294130
1069567522964
1069567621587
1069567719375
1069567871295
1069568070737
1069568112007
1069568201671
1069568207855
106956...

result:

ok 3960 lines

Test #2:

score: 5
Accepted
time: 4ms
memory: 23072kb

input:

4000 1611 4000
434 123917819
886 445799554
1455 418490796
15 468370972
1094 976430362
794 502494738
1438 807249113
265 723814120
163 883744673
110 554900207
1353 862824298
571 341552831
1147 242636856
1409 951744609
125 387791305
575 564379710
898 430211010
110 774043352
118 173580552
125 912219919
...

output:

615043277800
615044415594
615045426105
615045698860
615045881456
615046139438
615046163001
615046551688
615046563899
615046592521
615046836654
615046865665
615047019250
615047117595
615047277232
615047300795
615047507660
615047682509
615047689482
615047730315
615047847165
615048003459
615048029761
6...

result:

ok 4000 lines

Test #3:

score: 5
Accepted
time: 4ms
memory: 23592kb

input:

4000 2013 4000
1395 937628071
706 604550156
675 541877842
688 901085999
492 203317103
323 53814265
883 122879882
1751 913993227
2000 413560198
982 22967364
1614 589313402
1891 481771369
551 259581660
783 13384767
317 249203699
1160 917985754
1221 691507384
615 131170818
1884 40961781
1912 70234262
4...

output:

762363949055
762364217155
762364256077
762364436024
762364524177
762364704124
762364743046
762364771605
762365011146
762365039705
762365078627
762365258574
762365346727
762365449840
762365526674
762365565596
762365717940
762365756862
762365832097
762365833696
762365936809
762366024962
762366100197
7...

result:

ok 4000 lines

Test #4:

score: 5
Accepted
time: 3ms
memory: 23084kb

input:

3937 909 4000
346 54334933
505 447681196
608 275297989
261 712080003
21 90713508
280 232353752
357 192705970
179 380657645
345 812779408
779 365136327
515 543438101
38 28458276
224 648653059
901 317516788
790 357880660
590 936506121
182 320349605
590 889013618
70 652600178
88 5045363
21 599716848
57...

output:

400150991323
400151026472
400151715594
400151750743
400152021813
400152056962
400152440357
400152475506
400152475852
400152511001
400152608928
400152644077
400152746084
400152781233
400153139934
400153164628
400153175083
400153199777
400153200123
400153201851
400153235272
400153237000
400153333199
4...

result:

ok 4000 lines

Test #5:

score: 5
Accepted
time: 5ms
memory: 22980kb

input:

3973 2648 3961
210 37094304
2234 608940983
329 27271306
2386 552576119
1774 987209723
759 235045315
2187 933407617
2076 420220448
2517 735613446
685 733645529
2378 533552758
1958 108470529
213 194147510
1298 592913810
2263 340737510
859 70183692
855 375077158
1570 806331056
2644 7007539
2007 2086881...

output:

1127967971182
1127968090415
1127968106283
1127968225516
1127968573512
1127968692745
1127968708613
1127968761574
1127968827846
1127968880807
1127968896675
1127969015908
1127969363904
1127969483137
1127969499005
1127969618238
1127969813694
1127969932927
1127969948795
1127970068028
1127970416024
112797...

result:

ok 3961 lines

Test #6:

score: 5
Accepted
time: 2ms
memory: 23088kb

input:

3946 1753 4000
57 950093122
1038 542622865
1697 890570153
1134 715022457
1748 648525924
556 601898152
685 116503581
86 749365225
719 841758607
1122 261582110
212 231027638
1278 675595083
475 976830520
1730 475626326
1403 50332210
1237 849904750
391 843955742
490 699396330
19 10794501
1419 223932280
...

output:

556566260664
556566744043
556566878309
556566969708
556567019040
556567119438
556567253359
556567361688
556567453087
556567502419
556567587353
556567602817
556567625880
556567636685
556567699917
556567728084
556567736738
556567737083
556567828482
556567871004
556567877814
556567938059
556567962403
5...

result:

ok 4000 lines

Test #7:

score: 5
Accepted
time: 2ms
memory: 22888kb

input:

4000 370 4000
64 242552389
119 55508786
106 549003862
113 438433161
221 617745650
266 655017761
366 615531317
164 485219606
61 763340734
73 162808445
113 750162530
127 127938838
194 545908135
31 804047666
255 778903163
196 104767466
156 878601952
113 588741160
292 826114540
267 168420736
113 1474051...

output:

90070626813
90071145397
90071571292
90072027310
90072089876
90072308736
90072481299
90072545894
90072592318
90072693660
90072827320
90072971789
90072999883
90073110902
90073212244
90073253215
90073425778
90073490373
90073536797
90073638139
90073767502
90073771799
90073881796
90073944362
90073992815
...

result:

ok 4000 lines

Test #8:

score: 5
Accepted
time: 3ms
memory: 22892kb

input:

4000 10 4000
8 600560811
8 810433759
7 421428951
8 253974826
1 659795990
7 78141662
1 798159162
7 265476292
8 325403131
1 189576050
7 650821181
7 916673269
1 134197077
7 152435044
1 938181940
8 307287802
7 651185900
8 537971798
3 619323447
7 25468556
1 116498484
1 952084260
7 595720290
1 288394682
1...

output:

379019686
379234246
379301242
379302619
379325781
379515802
379559739
379584175
379607337
379841295
379966491
380180155
380181051
380248047
380249424
380272586
380394715
380462607
380463088
380486250
380506544
380530980
380554142
380591867
380631694
380720208
380788100
380806427
380874800
380897962
...

result:

ok 4000 lines

Test #9:

score: 5
Accepted
time: 3ms
memory: 22644kb

input:

3991 1 3980
1 759417513
1 947143665
1 709510113
1 280100701
1 532397917
1 45258141
1 422613130
1 154005952
1 821897408
1 595417519
1 64590540
1 643512715
1 218495637
1 240938750
1 35326103
1 769161240
1 852297660
1 260979752
1 300424047
1 12263957
1 874832319
1 586622101
1 164679400
1 128392342
1 59...

output:

190297
552735
694966
737157
898154
966055
1476429
1839001
1880728
1925844
2104090
2267028
2399282
2531551
2927203
3911479
4034479
4085696
4291070
4758939
4762246
4859247
5447371
5722486
5898509
6150497
6881541
6936896
7143481
7725017
8149316
8624113
8660314
9209058
10617067
10654619
10657153
1074844...

result:

ok 3980 lines

Test #10:

score: 5
Accepted
time: 4ms
memory: 23016kb

input:

4000 1583 3987
499 273124485
1559 358882823
1252 241337454
1559 739348252
782 513923835
324 481907987
1215 718165013
1260 264663275
165 460598078
892 196114892
1500 163929792
911 237165170
39 338900224
1262 311334472
883 404440146
1126 550048683
924 277600096
107 601162756
1193 681078433
1500 376043...

output:

614836543038
614836992096
614837144890
614837157751
614837435043
614837593948
614837606809
614837646523
614837666252
614837759603
614837884101
614837919490
614838036895
614838049756
614838095581
614838115310
614838147965
614838208661
614838248375
614838261236
614838268104
614838271245
614838280965
6...

result:

ok 3987 lines

Test #11:

score: 5
Accepted
time: 2ms
memory: 22652kb

input:

4000 1641 3957
704 795579765
1537 714425764
1093 258798919
408 343655663
1403 329347448
1538 728566353
1523 57143205
1013 377011305
1606 801096192
134 546666544
66 114578939
1003 675784816
1068 571178376
721 79543120
632 603121882
668 710278218
644 181744201
579 505393801
906 436731604
56 380073614
...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok 3957 lines

Test #12:

score: 5
Accepted
time: 3ms
memory: 23144kb

input:

43 20 3975
15 341351291
11 119397085
15 340419716
1 171459742
6 33849126
3 440811896
15 485034624
20 688283760
1 370543781
13 93715671
10 20694667
7 906460764
11 235317502
16 918715657
18 64767760
1 218028069
13 413426035
3 804628619
3 67016014
8 430241121
3 126894345
3 110945228
18 67779804
2 83261...

output:

5989939062
5992951106
5993980986
5996993030
5999232249
6002244293
6003274173
6006286217
6025986441
6028998485
6030028365
6033040409
6035279628
6036507389
6038291672
6039321552
6039519433
6040549313
6042333596
6043161463
6043561357
6045800576
6046173507
6047203387
6048812620
6049842500
6050215431
605...

result:

ok 3975 lines

Test #13:

score: 5
Accepted
time: 2ms
memory: 23072kb

input:

196 96 3972
60 20834319
74 468994233
55 101937738
50 464910401
16 17029957
4 394497451
76 248083770
71 927513240
11 761695036
24 40543650
31 739207378
19 103228455
46 66335159
61 865273035
9 227439683
4 951164209
9 596757964
53 72882437
39 59193173
12 176674993
96 955104544
38 75818858
5 290141588
4...

output:

22900847162
22901959736
22903964478
22904801586
22905077052
22905914160
22907918902
22909031476
22914393270
22915505844
22917510586
22918019900
22918347694
22918623160
22919132474
22919460268
22919998104
22921137216
22921465010
22921974324
22922249790
22922577584
22923086898
22923115420
22923952528
...

result:

ok 3972 lines

Test #14:

score: 5
Accepted
time: 5ms
memory: 23392kb

input:

3962 1953 3986
864 256970017
1436 937399934
1550 233039429
241 901853782
119 141986670
640 446513766
912 40076731
1510 308858513
87 154767292
398 28015702
736 840794487
1458 272915201
745 366619726
1339 74580853
1122 25840659
249 99427070
643 790961482
170 111220886
814 517761272
466 87294399
1116 9...

output:

447312850980
447312865901
447312896422
447312911343
447312927768
447312942689
447312973210
447312988131
447313286108
447313289511
447313301029
447313304432
447313331550
447313334953
447313346471
447313349874
447313362896
447313366299
447313377817
447313381220
447313408338
447313411741
447313423259
4...

result:

ok 3986 lines

Test #15:

score: 5
Accepted
time: 2ms
memory: 22780kb

input:

47 14 3990
2 73026808
14 257341647
7 62538559
11 966205577
7 26259408
14 157658190
11 365462386
13 453347507
14 82143208
3 27768813
1 172294600
11 506241397
5 490495044
11 21067322
14 735925422
14 223435375
8 232214931
12 921907789
14 257137873
13 422600451
14 641142932
3 218178261
14 485177869
3 21...

output:

1998622527
2003838704
2009745544
2017796416
2018756802
2023012593
2023972979
2028919433
2029879819
2037930691
2043146868
2046933939
2049053708
2052150116
2055035953
2058056956
2060252130
2066107828
2066158970
2067068214
2071324005
2072284391
2074137509
2074209842
2077230845
2078191231
2079353686
207...

result:

ok 3990 lines

Test #16:

score: 5
Accepted
time: 2ms
memory: 22764kb

input:

200 57 4000
36 34408432
55 499332765
7 131388184
44 20136564
47 13464663
8 220250021
35 260404643
49 92102493
35 250862177
34 920476654
5 524304898
49 329183072
14 558703965
50 512257681
38 118464829
5 718583534
5 420906466
27 117862178
1 187514067
44 499673338
36 997005772
55 139873582
9 868351
5 2...

output:

14829128673
14831374366
14834002864
14836248557
14837734202
14839690316
14839845088
14839979895
14841936009
14842090781
14842608393
14842699582
14842724042
14844564507
14844719279
14844854086
14844945275
14846586486
14846810200
14846964972
14847573773
14847598233
14848295845
14848450617
14848589505
...

result:

ok 4000 lines

Test #17:

score: 5
Accepted
time: 4ms
memory: 22868kb

input:

4000 922 3971
373 316326521
98 85223542
18 185043216
663 91512953
513 338693673
174 362220205
10 658998680
439 498340267
178 107845119
81 18197691
14 353945301
174 498386068
481 20834079
98 42026645
58 209235901
550 160967801
894 540150651
759 264340093
306 438454520
607 838847347
762 62069211
104 3...

output:

273042342179
273042758129
273042816611
273042843193
273042872547
273042885787
273042909678
273043052220
273043099504
273043109079
273043143518
273043232561
273043259143
273043287918
273043288497
273043301737
273043317625
273043325628
273043360219
273043370588
273043373561
273043384110
273043410692
2...

result:

ok 3971 lines

Test #18:

score: 5
Accepted
time: 3ms
memory: 22872kb

input:

44 29 3945
17 853268176
2 174508987
1 17029592
6 852631804
10 51180621
25 524655614
16 282879993
14 168221386
6 905308041
28 104893646
15 846773738
20 415665110
3 693838288
7 61920337
22 848766453
12 405774604
13 92590366
7 4933605
10 144334460
18 826736385
3 59735553
24 102183666
12 675228996
15 89...

output:

10150640553
10197156494
10203316790
10203729251
10207627285
10243794392
10249832731
10250245192
10254143226
10256405488
10260303522
10260715983
10290310333
10296470629
10300781124
10300802637
10302921429
10306819463
10307231924
10313392220
10342986570
10347297065
10347318578
10353457361
10353478874
...

result:

ok 3945 lines

Test #19:

score: 5
Accepted
time: 3ms
memory: 22872kb

input:

200 133 4000
15 53662902
60 33186746
72 262998642
101 106535628
66 37646310
37 288192726
33 41861357
113 107759625
114 757281648
84 265271458
6 246105377
131 6891008
82 96648713
25 548540311
125 630305110
83 431994809
94 146496477
108 127883819
97 280597714
129 727256211
4 20422929
112 114720942
49 ...

output:

35567134192
35571443156
35572751484
35574025822
35577060448
35578334786
35578352313
35579643114
35582661277
35583952078
35583969605
35585243943
35586424168
35587231886
35588278569
35589543856
35589552907
35590733132
35590861235
35591540850
35592041460
35592849178
35593315798
35593852820
35594112071
...

result:

ok 4000 lines

Test #20:

score: 5
Accepted
time: 4ms
memory: 23088kb

input:

4000 2666 3972
654 609375635
537 147243984
1300 137617763
1291 64623103
1491 357779178
1100 170590599
8 223257029
2213 57704885
272 897780886
2575 22486287
813 575948873
743 846785159
1525 283931420
445 126829750
68 278663485
2159 872585108
1147 95725065
1440 483902763
965 657670090
2461 259166798
2...

output:

700681141740
700681837392
700681956837
700682011561
700682221731
700682507541
700682652489
700682707213
700682748874
700682826658
700682852850
700682917383
700683036828
700683091552
700683203193
700683322638
700683377362
700683411197
700683444526
700683522310
700683548502
700683563971
700683587532
7...

result:

ok 3972 lines

Test #21:

score: 5
Accepted
time: 2ms
memory: 22776kb

input:

50 5 4000
3 88526074
3 343538475
5 162550508
3 157175202
3 906032856
5 365888457
5 116164025
3 463344551
4 308010923
4 44638014
5 89170602
3 52851787
4 622194577
4 7699209
4 923740906
4 45172889
5 367011429
3 852993233
5 602219004
4 24768466
3 198818288
4 328940121
5 76927994
4 170204461
5 671160829...

output:

416431424
416443816
421684433
421696825
425474993
425487385
426743887
430728002
430740394
431996896
433500681
433513073
435787456
441040465
442544250
442556642
443813144
452105711
452118103
452856713
453370229
453382621
453905104
453917496
457358720
457371112
462413798
462418174
462426190
462948673
...

result:

ok 4000 lines

Test #22:

score: 5
Accepted
time: 2ms
memory: 22856kb

input:

194 7 4000
1 780217722
1 912208468
2 217272285
2 377323817
7 117789122
1 42964248
1 197700445
1 360757878
1 7423734
1 29963895
2 153283359
7 476521260
2 87644446
1 223363185
7 195058978
2 469360102
2 211813590
1 776816701
1 7093429
1 687790922
2 251934261
2 778561805
7 331379090
2 249131731
7 646077...

output:

1478996814
1479327119
1486606675
1487761314
1488091619
1488255719
1489257469
1489587774
1490177093
1490507398
1491382293
1492531963
1492862268
1492879603
1492922538
1493209908
1495371175
1496867330
1497020219
1497786954
1498021969
1498352274
1498516374
1498941593
1499271898
1499435998
1500039888
150...

result:

ok 4000 lines

Test #23:

score: 5
Accepted
time: 4ms
memory: 23532kb

input:

3953 10 4000
4 184348855
6 81476796
6 406715578
6 107201406
4 387602232
8 672518038
8 14451326
6 470916386
8 832058137
8 138766149
4 585059738
6 863427191
6 40040587
8 79755870
6 44574118
6 987797043
8 987318336
8 405798284
4 37226715
8 143134329
4 99450429
4 79004180
4 45152220
8 119878595
8 732000...

output:

160493066
160536450
160556082
160561634
160599466
160624650
160639350
160675282
160683335
160687198
160695302
160701233
160702366
160703341
160726719
160738298
160738686
160744617
160746351
160746725
160750214
160751903
160758318
160763870
160769801
160771909
160789735
160799923
160801702
160814919
...

result:

ok 4000 lines

Test #24:

score: 5
Accepted
time: 3ms
memory: 23256kb

input:

4000 5 3953
2 507909020
2 704459723
2 95969603
3 645712703
1 609975909
3 337981087
5 490033265
2 413229403
3 30106693
2 580512221
4 28028217
2 419314489
5 132240112
1 345187111
4 223086657
5 188539144
4 118565225
4 206363372
1 698931718
1 458102142
2 575188649
3 775767603
3 254604865
1 818264359
4 5...

output:

6790052
6922756
6948502
6949224
7081206
7081928
7107674
7240378
7284609
7417313
7443781
7506963
7576485
7596696
7665413
7666135
7712037
7729400
7755146
7755868
7824585
7833991
7844741
7870487
7871209
7887850
7888572
7914318
7930757
7966695
7992441
8001520
8003191
8003913
8029659
8047022
8063461
8089...

result:

ok 3953 lines

Test #25:

score: 5
Accepted
time: 3ms
memory: 23036kb

input:

4000 5 3948
3 255058381
2 698732988
2 40667588
2 704307165
2 208798665
3 716431541
4 470246360
1 229535859
5 504702163
4 377020084
3 692746844
4 383718930
4 375392228
3 808025912
4 697134045
4 303268447
2 131544903
2 112950345
2 393868193
3 716672158
3 856476024
4 489198235
3 273592715
5 216432690
5...

output:

4702514
5234611
5375639
5406911
5883776
5907736
5939008
6372340
6556901
6588173
6632930
6904437
7045465
7076737
7165027
7306055
7337327
7553602
7577562
7608834
7756769
7814192
7838152
7869424
7977970
8120999
8187661
8226727
8257999
8302756
8429894
8461166
8487317
8510067
8518589
8653096
8719758
8794...

result:

ok 3948 lines

Test #26:

score: 5
Accepted
time: 3ms
memory: 23488kb

input:

3991 1996 3977
1529 1039
226 768
120 882
1218 2807
1421 2018
1632 146
1026 2039
173 929
1464 365
43 1870
648 3513
1496 339
813 1930
1794 3382
1881 32
194 1370
1777 1149
899 2980
1472 158
197 286
749 3976
1735 2999
1855 3252
209 545
194 1584
65 3711
729 3324
116 2702
1809 2963
1626 878
580 1160
1487 ...

output:

3056665
3056665
3056665
3056665
3056668
3056668
3056668
3056668
3056669
3056669
3056669
3056669
3056669
3056669
3056669
3056669
3056669
3056669
3056669
3056669
3056670
3056670
3056670
3056670
3056672
3056672
3056672
3056672
3056672
3056672
3056672
3056672
3056672
3056672
3056672
3056672
3056673
3056...

result:

ok 3977 lines

Test #27:

score: 5
Accepted
time: 4ms
memory: 23020kb

input:

3964 940 4000
408 3091
246 3368
606 1385
737 2983
471 1342
166 452
390 1556
141 2436
908 2039
516 3498
330 403
118 1730
593 2889
348 3485
460 2198
123 3391
635 2251
893 3020
77 3795
477 1961
565 2427
868 992
669 1964
496 1634
780 2800
491 2596
348 2412
593 1605
631 181
367 1957
491 3654
471 853
387 ...

output:

1706010
1706011
1706012
1706013
1706016
1706017
1706017
1706017
1706018
1706018
1706018
1706019
1706019
1706019
1706019
1706019
1706020
1706020
1706020
1706020
1706021
1706021
1706022
1706022
1706022
1706022
1706023
1706023
1706023
1706024
1706024
1706024
1706024
1706024
1706025
1706025
1706025
1706...

result:

ok 4000 lines

Test #28:

score: 5
Accepted
time: 1ms
memory: 22876kb

input:

3982 10 3948
3 3678
1 1411
5 2643
5 1695
7 2695
3 560
3 2845
3 1557
5 3726
1 1059
3 820
5 2395
3 1804
3 3849
3 2865
3 906
3 1646
1 1214
3 1456
3 970
1 67
1 2986
1 1369
8 623
1 3016
1 2518
1 1838
1 1216
1 771
5 2936
5 2619
3 1797
3 1564
1 1972
1 1236
3 474
5 3122
5 2546
1 3225
3 2080
5 1298
1 1296
5 ...

output:

1254
1255
1256
1256
1257
1257
1257
1258
1258
1258
1258
1258
1259
1259
1259
1259
1259
1260
1260
1260
1260
1260
1261
1261
1261
1261
1261
1262
1262
1262
1262
1262
1262
1262
1263
1263
1263
1263
1263
1263
1263
1263
1264
1264
1264
1264
1264
1264
1264
1264
1265
1265
1265
1265
1265
1265
1265
1265
1265
1265
...

result:

ok 3948 lines

Subtask #2:

score: 5
Accepted

Test #29:

score: 5
Accepted
time: 40ms
memory: 33336kb

input:

3969 2490 200000
2206 107
469 2614
1836 2472
1312 2547
2234 497
2135 3819
1882 365
2122 991
1195 1836
1071 13
131 945
2159 3232
2348 1402
505 1630
1893 3718
1642 2786
1058 3347
78 2605
375 387
974 1127
929 1811
1313 2370
1626 286
1682 112
1055 88
1996 949
1220 2886
1515 3640
175 3236
1332 1861
725 7...

output:

4188358
4188360
4188360
4188360
4188361
4188362
4188362
4188362
4188362
4188362
4188363
4188363
4188363
4188364
4188364
4188364
4188364
4188364
4188364
4188364
4188365
4188365
4188365
4188365
4188365
4188366
4188366
4188366
4188366
4188366
4188366
4188366
4188366
4188367
4188367
4188367
4188367
4188...

result:

ok 200000 lines

Test #30:

score: 5
Accepted
time: 39ms
memory: 32824kb

input:

3942 1525 199806
1148 77
1351 3897
303 3303
264 1607
1246 2268
839 1157
102 570
942 1078
869 763
1423 3933
120 196
416 1539
712 772
1075 3713
1177 3292
30 598
939 2734
651 1455
199 3668
223 3165
608 1412
48 1188
1071 3416
286 3239
970 288
1078 900
1392 2506
753 998
981 3776
613 1201
433 481
595 2581...

output:

2246907
2246909
2246910
2246910
2246910
2246911
2246911
2246912
2246912
2246912
2246912
2246912
2246913
2246913
2246913
2246913
2246913
2246913
2246913
2246913
2246914
2246914
2246914
2246914
2246914
2246914
2246914
2246914
2246914
2246915
2246915
2246915
2246915
2246915
2246915
2246915
2246915
2246...

result:

ok 199806 lines

Test #31:

score: 5
Accepted
time: 39ms
memory: 33080kb

input:

4000 2020 199857
616 233
1448 2519
1527 844
634 3273
126 345
879 353
754 1695
37 451
1092 983
1855 3307
1646 3158
209 2297
1360 3467
1859 3293
1722 3521
1073 2841
1703 1828
374 3478
1137 1544
1134 1454
2007 3027
13 525
607 3278
954 3183
1959 431
1543 1028
1619 1692
393 3603
1622 1865
1559 2141
166 2...

output:

3189541
3189542
3189542
3189543
3189547
3189547
3189548
3189548
3189548
3189548
3189548
3189549
3189549
3189549
3189549
3189550
3189551
3189552
3189552
3189553
3189553
3189553
3189553
3189554
3189554
3189554
3189554
3189554
3189554
3189554
3189554
3189555
3189555
3189555
3189555
3189555
3189555
3189...

result:

ok 199857 lines

Test #32:

score: 5
Accepted
time: 38ms
memory: 33132kb

input:

4000 930 200000
325 3246
97 3276
326 3326
291 2679
150 2078
925 3020
812 3641
879 549
645 1410
316 3312
89 83
746 3855
186 3387
194 2643
629 2569
812 3022
390 2929
150 3783
97 3516
496 2061
250 2678
746 3411
916 2383
399 453
291 2164
663 2320
65 2168
921 1814
363 1786
446 535
237 2906
194 3930
258 1...

output:

1607956
1607957
1607957
1607957
1607958
1607958
1607958
1607958
1607959
1607959
1607959
1607959
1607959
1607960
1607960
1607960
1607960
1607960
1607960
1607960
1607961
1607961
1607961
1607961
1607961
1607961
1607961
1607961
1607962
1607962
1607962
1607962
1607962
1607962
1607962
1607962
1607962
1607...

result:

ok 200000 lines

Test #33:

score: 5
Accepted
time: 38ms
memory: 32880kb

input:

3987 2658 199956
1361 1534
25 1406
659 3975
2189 3275
2056 3336
1214 70
501 788
269 3984
6 965
2323 2373
1260 861
2285 3305
456 2713
160 2172
942 427
1350 1821
823 2595
2581 142
2193 1397
1582 1871
1478 561
1770 3283
1957 2876
36 2802
981 1572
733 3548
1289 711
2275 445
775 3120
147 621
698 1137
178...

output:

4542505
4542506
4542509
4542510
4542511
4542512
4542513
4542514
4542515
4542515
4542515
4542516
4542516
4542516
4542516
4542517
4542517
4542518
4542519
4542519
4542519
4542520
4542520
4542520
4542520
4542521
4542521
4542521
4542521
4542521
4542522
4542522
4542522
4542522
4542522
4542522
4542523
4542...

result:

ok 199956 lines

Test #34:

score: 5
Accepted
time: 40ms
memory: 32828kb

input:

3960 1760 199773
1221 3160
845 3492
413 1971
73 1064
788 1369
259 2898
524 1892
1320 2086
1645 792
805 2848
741 1072
1424 1760
216 3953
6 2180
105 3382
447 2753
1328 1989
1663 2292
1083 3567
1201 331
952 1461
1598 3974
816 2684
108 450
199 1431
1116 3853
638 337
275 3390
1056 780
46 1538
728 237
120...

output:

2240270
2240272
2240275
2240275
2240275
2240276
2240277
2240277
2240277
2240278
2240280
2240280
2240280
2240280
2240281
2240281
2240281
2240281
2240281
2240282
2240282
2240282
2240282
2240282
2240283
2240283
2240283
2240283
2240283
2240283
2240284
2240284
2240285
2240285
2240285
2240285
2240285
2240...

result:

ok 199773 lines

Test #35:

score: 5
Accepted
time: 37ms
memory: 33424kb

input:

3996 370 199653
286 1399
282 404
12 2687
136 1429
46 1739
152 2559
247 3635
163 3644
12 3062
192 2617
12 1317
12 3953
47 1284
225 1770
135 1385
12 2958
104 1155
184 2321
155 2126
27 3194
12 89
5 2475
46 2559
12 754
12 2419
46 801
225 2414
64 3233
192 364
12 1567
264 473
27 3701
12 1345
12 2840
363 6...

output:

402849
402851
402851
402853
402853
402854
402854
402855
402855
402855
402856
402856
402856
402856
402856
402857
402857
402857
402858
402858
402858
402858
402858
402858
402859
402859
402859
402859
402859
402859
402860
402860
402860
402860
402860
402860
402860
402860
402860
402860
402861
402861
402861...

result:

ok 199653 lines

Test #36:

score: 5
Accepted
time: 37ms
memory: 32696kb

input:

4000 10 200000
3 2242
8 953
3 898
2 2281
8 2596
8 2803
8 1075
3 2950
3 2964
8 2207
2 98
8 3258
2 461
3 632
3 3700
2 3126
3 2741
2 3093
8 643
2 3069
8 1766
4 1345
3 2916
2 659
3 173
3 1802
3 2930
1 3865
8 759
8 1219
3 982
3 1516
2 865
3 2462
3 1328
3 95
3 1061
3 456
4 2419
3 1163
3 319
8 275
3 1490
3...

output:

1641
1642
1644
1645
1645
1646
1646
1646
1646
1647
1647
1648
1648
1648
1649
1649
1649
1649
1649
1650
1650
1650
1650
1651
1651
1651
1651
1652
1652
1652
1652
1652
1652
1652
1653
1653
1653
1653
1653
1653
1653
1653
1653
1653
1653
1654
1654
1654
1654
1654
1654
1654
1654
1654
1654
1655
1655
1655
1655
1655
...

result:

ok 200000 lines

Test #37:

score: 5
Accepted
time: 6ms
memory: 22716kb

input:

4000 1 199797
1 2615
1 3083
1 3634
1 2480
1 3015
1 1376
1 852
1 3683
1 245
1 1115
1 2
1 1019
1 3096
1 3154
1 1782
1 2092
1 2678
1 1628
1 1620
1 59
1 3001
1 2203
1 253
1 125
1 1898
1 3842
1 109
1 2740
1 2604
1 3820
1 1427
1 2351
1 1563
1 1838
1 1719
1 2935
1 227
1 3284
1 2579
1 2938
1 786
1 1771
1 31...

output:

1
2
2
2
3
5
5
7
8
8
9
9
10
11
12
15
18
20
20
24
25
26
28
29
29
29
31
35
38
40
40
40
40
41
43
44
44
44
46
46
47
48
49
50
50
50
50
51
51
56
57
58
59
59
60
61
63
64
65
65
65
66
67
67
67
68
69
70
71
72
77
77
77
77
84
87
87
89
90
91
92
92
94
94
97
97
98
100
101
101
102
103
104
104
104
106
106
106
107
107...

result:

ok 199797 lines

Test #38:

score: 5
Accepted
time: 38ms
memory: 32816kb

input:

3959 1563 200000
835 801
1291 1193
1451 2708
857 3683
125 3139
177 808
43 2693
419 2167
1506 2261
1454 2846
966 3451
1090 2403
461 3861
1070 1369
400 3792
1191 1610
864 1752
135 3863
486 555
511 613
1508 1014
1048 1995
622 3157
11 3636
1323 1715
857 1501
1503 1587
1106 1969
36 659
1547 1347
315 645
...

output:

2414622
2414623
2414624
2414625
2414625
2414626
2414626
2414627
2414627
2414628
2414628
2414629
2414629
2414629
2414630
2414630
2414630
2414631
2414631
2414631
2414632
2414632
2414632
2414632
2414632
2414633
2414633
2414633
2414633
2414633
2414634
2414634
2414634
2414634
2414634
2414634
2414635
2414...

result:

ok 200000 lines

Test #39:

score: 5
Accepted
time: 6ms
memory: 22772kb

input:

3976 1595 200000
454 3387
993 1052
974 3676
1590 1499
1260 2734
477 1839
570 2111
1283 3277
19 1692
56 238
1433 373
358 774
1222 1438
176 3670
982 3165
1128 789
572 1756
1098 1693
516 888
205 3852
604 1394
1104 1267
1456 1203
1352 2403
1346 516
553 345
333 1561
235 3194
671 795
620 1452
767 3799
556...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok 200000 lines

Test #40:

score: 5
Accepted
time: 21ms
memory: 28568kb

input:

43 21 199985
11 3878
8 341
19 1378
21 2009
19 1195
4 3261
10 1106
15 1791
18 427
9 1158
8 1634
12 897
11 8
21 3488
3 2566
21 838
6 1847
10 1080
21 859
8 3975
18 524
3 1259
2 16
1 2042
16 1222
18 1250
11 2703
12 1447
11 1376
9 1491
7 2439
20 842
10 754
12 2449
15 1184
20 994
21 362
3 76
17 770
13 389...

output:

23784
23881
23936
23967
24033
24064
24110
24117
24119
24136
24207
24214
24216
24233
24260
24262
24269
24281
24288
24293
24300
24319
24334
24357
24359
24366
24378
24385
24390
24391
24397
24412
24416
24431
24433
24443
24443
24445
24452
24464
24469
24471
24486
24488
24494
24509
24517
24530
24540
24540
...

result:

ok 199985 lines

Test #41:

score: 5
Accepted
time: 40ms
memory: 33144kb

input:

187 86 199946
85 65
78 1953
63 954
69 603
6 1616
57 1129
55 898
9 134
72 1071
78 79
56 2797
47 3173
2 1911
76 1550
52 35
57 3729
5 778
66 363
11 1001
47 3712
37 708
69 37
34 2240
6 1998
14 775
9 267
10 2839
36 848
21 2581
16 1540
14 3036
7 3639
86 1345
23 1686
8 1002
16 2966
7 107
64 510
80 516
21 3...

output:

75703
75739
75749
75773
75785
75806
75809
75819
75820
75829
75836
75842
75852
75855
75856
75865
75866
75872
75875
75876
75882
75888
75888
75890
75892
75899
75899
75902
75906
75911
75912
75918
75922
75923
75924
75926
75928
75932
75934
75935
75935
75936
75938
75939
75942
75945
75945
75946
75952
75953
...

result:

ok 199946 lines

Test #42:

score: 5
Accepted
time: 36ms
memory: 33200kb

input:

3976 1996 199835
1964 2619
630 2737
1444 1597
1859 522
697 1724
194 34
782 606
1846 2765
781 810
1376 943
1451 626
330 788
198 485
612 2693
1824 2768
351 3056
180 95
328 3342
1232 477
115 104
1097 363
1306 919
604 1644
534 1629
23 114
1579 995
510 373
22 1187
1103 28
1270 1856
1023 264
898 433
1296 ...

output:

1893742
1893742
1893743
1893743
1893744
1893744
1893744
1893744
1893744
1893744
1893745
1893745
1893745
1893745
1893745
1893745
1893745
1893745
1893745
1893745
1893745
1893745
1893745
1893745
1893745
1893745
1893746
1893746
1893746
1893746
1893746
1893746
1893746
1893746
1893746
1893746
1893746
1893...

result:

ok 199835 lines

Test #43:

score: 5
Accepted
time: 6ms
memory: 22672kb

input:

47 14 199630
9 282
12 3057
13 2170
3 105
9 2473
9 2763
12 619
5 737
9 41
2 3831
12 19
9 1927
12 1030
9 3681
10 1029
9 96
12 1044
8 979
2 822
10 3954
9 219
7 732
12 3153
2 622
6 118
12 3355
5 1193
12 1071
12 3833
9 771
4 2383
9 26
9 996
5 3828
12 95
12 1128
12 1592
1 1702
2 527
5 1896
9 11
12 2247
14...

output:

13442
13457
13472
13518
13527
13533
13537
13548
13552
13567
13590
13603
13613
13622
13628
13643
13650
13666
13685
13698
13713
13726
13737
13745
13752
13761
13767
13789
13805
13808
13813
13820
13821
13822
13828
13835
13843
13884
13885
13890
13898
13898
13900
13913
13915
13928
13930
13945
13953
13961
...

result:

ok 199630 lines

Test #44:

score: 5
Accepted
time: 39ms
memory: 32664kb

input:

196 56 199654
3 838
35 43
18 484
35 3305
35 3191
19 1656
4 2153
31 13
12 98
55 798
3 3730
14 24
30 747
47 363
11 1384
3 470
19 161
16 174
1 51
47 967
35 2654
14 352
37 1154
35 357
12 927
35 1398
4 1621
7 263
4 725
12 15
54 684
19 1576
19 3642
28 7
47 2699
18 3350
42 1768
35 281
35 702
7 3797
23 796
...

output:

48662
48663
48668
48669
48677
48677
48678
48678
48682
48683
48683
48683
48684
48684
48688
48689
48692
48693
48696
48697
48697
48698
48698
48698
48699
48700
48701
48702
48703
48703
48704
48704
48706
48707
48711
48711
48712
48713
48715
48715
48716
48716
48716
48717
48717
48717
48718
48718
48719
48720
...

result:

ok 199654 lines

Test #45:

score: 5
Accepted
time: 40ms
memory: 33128kb

input:

3949 927 199803
231 2888
536 1974
490 2946
660 394
457 2089
251 805
373 3
167 542
319 43
447 880
5 231
235 133
422 2912
634 2215
589 178
113 1922
584 1155
618 281
490 49
618 2096
786 220
252 9
38 420
422 505
132 3904
183 1227
398 412
927 841
505 927
422 2923
668 505
129 2350
140 1349
668 234
517 115...

output:

1034856
1034857
1034857
1034858
1034858
1034858
1034858
1034859
1034859
1034859
1034859
1034859
1034859
1034859
1034859
1034859
1034859
1034859
1034859
1034860
1034860
1034860
1034860
1034860
1034860
1034860
1034860
1034860
1034860
1034860
1034860
1034860
1034860
1034860
1034860
1034860
1034860
1034...

result:

ok 199803 lines

Test #46:

score: 5
Accepted
time: 16ms
memory: 25496kb

input:

50 33 199556
12 614
2 2221
12 3435
4 467
24 2259
3 2064
10 393
3 954
9 3997
32 533
22 3637
30 1711
14 326
11 3025
13 14
14 2967
22 1001
29 1721
16 10
4 586
30 306
23 3541
7 3926
31 891
10 676
23 2749
6 1801
3 3926
5 322
25 591
33 1070
26 3296
15 342
9 752
11 1469
1 1097
15 3624
1 124
21 295
20 923
1...

output:

34806
34925
35087
35089
35097
35206
35208
35216
35326
35370
35378
35380
35445
35489
35497
35499
35598
35607
35609
35617
35659
35661
35717
35726
35728
35736
35778
35779
35780
35879
35881
35889
35890
35898
35898
35900
35916
35940
35942
35950
35998
36000
36008
36009
36017
36019
36035
36059
36060
36061
...

result:

ok 199556 lines

Test #47:

score: 5
Accepted
time: 43ms
memory: 32540kb

input:

189 126 199894
45 1211
100 147
87 780
109 98
48 310
111 346
121 1284
7 59
6 531
22 1558
66 3862
33 1391
89 1147
119 1542
53 3
21 427
121 1545
115 1871
65 2516
116 1936
45 1814
94 1342
103 956
4 686
86 591
61 359
38 1431
25 887
68 1667
24 2630
81 214
86 1827
32 554
98 35
83 104
105 947
95 88
8 3080
1...

output:

129725
129731
129773
129779
129786
129792
129795
129801
129820
129821
129826
129827
129834
129840
129843
129849
129856
129862
129868
129868
129869
129874
129874
129875
129881
129882
129886
129887
129887
129888
129890
129891
129892
129893
129896
129897
129904
129910
129916
129916
129922
129922
129925...

result:

ok 199894 lines

Test #48:

score: 5
Accepted
time: 40ms
memory: 32924kb

input:

4000 2666 199774
1455 220
46 3106
525 417
2199 131
691 408
514 165
2052 3951
2511 1020
588 1441
1589 663
1502 680
183 240
2346 385
1745 272
1302 135
762 125
151 1984
2635 81
689 927
710 3326
1331 3319
2278 63
2488 2082
1868 2707
1897 1236
1216 627
2435 791
722 818
1425 1902
454 1468
1630 1302
574 18...

output:

2774607
2774608
2774609
2774610
2774611
2774612
2774613
2774614
2774614
2774615
2774615
2774616
2774616
2774616
2774617
2774617
2774617
2774618
2774618
2774618
2774619
2774619
2774619
2774620
2774620
2774620
2774620
2774621
2774621
2774621
2774621
2774622
2774622
2774622
2774622
2774622
2774623
2774...

result:

ok 199774 lines

Test #49:

score: 5
Accepted
time: 7ms
memory: 22800kb

input:

49 5 200000
5 931
5 2439
4 315
5 393
1 3278
5 1048
4 2525
2 429
3 892
2 2169
2 903
5 666
5 526
2 886
2 1925
5 2644
1 2951
2 896
4 3918
2 1571
1 1753
5 936
4 363
2 3818
5 74
4 325
2 237
4 2083
5 1723
2 2160
2 1573
5 1651
2 1732
2 3024
4 1572
2 138
2 1708
5 196
2 3618
4 37
4 506
2 59
5 2033
4 67
4 249...

output:

2815
2845
2894
2924
2937
2961
2967
2991
2993
3016
3023
3027
3040
3046
3070
3093
3103
3106
3115
3134
3139
3141
3145
3149
3164
3169
3172
3173
3182
3185
3205
3213
3215
3215
3220
3225
3228
3239
3243
3249
3252
3263
3267
3271
3281
3284
3287
3294
3297
3304
3307
3312
3318
3319
3327
3328
3331
3337
3342
3342
...

result:

ok 200000 lines

Test #50:

score: 5
Accepted
time: 40ms
memory: 32824kb

input:

185 8 200000
1 1966
1 2362
1 3652
3 3198
8 1640
8 3373
1 1168
3 1825
1 157
2 5
1 2338
6 902
1 573
1 489
8 2788
8 650
3 1445
8 2766
3 2000
8 2395
1 3794
1 2329
8 1347
1 1019
7 133
8 2351
1 3264
8 3581
1 606
3 1630
1 214
1 434
8 722
3 81
4 1
1 13
1 1596
3 976
3 1991
3 177
8 2
8 3313
8 20
8 2792
3 1462...

output:

1076
1089
1094
1094
1095
1098
1098
1107
1107
1108
1111
1112
1113
1116
1116
1116
1117
1118
1118
1120
1125
1125
1125
1126
1129
1129
1131
1131
1131
1134
1135
1136
1136
1137
1138
1138
1138
1138
1140
1140
1143
1143
1144
1144
1147
1147
1147
1147
1147
1147
1148
1149
1149
1149
1150
1151
1151
1153
1155
1156
...

result:

ok 200000 lines

Test #51:

score: 5
Accepted
time: 36ms
memory: 32608kb

input:

3967 10 200000
1 1123
3 1775
2 3413
1 101
1 19
1 864
1 117
2 1796
3 1070
3 949
1 3665
3 1799
3 294
3 615
3 989
1 505
1 2892
1 94
3 825
2 1078
10 167
1 849
3 1721
3 3202
2 768
1 1911
1 798
1 837
1 2087
1 1204
3 2027
1 555
1 71
2 32
3 2394
3 738
1 116
8 1294
2 3467
2 1350
2 2693
1 22
1 165
2 1343
3 32...

output:

642
642
642
642
642
642
642
642
642
642
642
642
642
642
642
642
642
642
642
642
642
642
642
642
642
642
642
642
642
642
642
642
642
642
642
642
643
643
643
643
643
643
643
643
643
643
643
643
643
643
643
643
643
643
643
643
643
643
643
643
643
643
643
643
643
643
643
643
643
643
643
643
643
643
643
...

result:

ok 200000 lines

Test #52:

score: 5
Accepted
time: 8ms
memory: 23680kb

input:

4000 4000 199933
3079 5
2007 2518
2228 3
2367 781
1914 1646
1063 2
127 1
404 4
2557 1943
2603 3
901 1641
2576 5
1823 2
1837 1
3098 2209
2745 9
3332 5
2460 1938
482 1320
787 3721
2893 5
1137 3895
2536 5
2614 511
3639 829
3841 2004
2600 1891
3572 1038
2256 4
958 814
1011 3885
352 9
1093 4
1778 2446
32...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok 199933 lines

Test #53:

score: 5
Accepted
time: 4ms
memory: 22828kb

input:

4000 4000 199610
223 2063
2013 2
117 5
2854 929
488 2465
1095 1022
3608 3417
1944 6
1779 2886
740 1
369 9
1519 69
3 2240
2987 5
1969 8
2960 4
1785 1
2054 10
1155 1159
1844 6
2971 697
3488 3
3438 506
3682 6
865 4
1646 6
1732 7
1950 2
864 2762
3382 3
2090 1336
513 10
3474 7
2485 1601
194 6
3503 2
3797...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok 199610 lines

Test #54:

score: 5
Accepted
time: 39ms
memory: 33348kb

input:

4000 2000 199904
965 3524
802 3474
183 3827
1032 2880
1425 3797
974 3425
492 3820
1283 3682
481 3531
514 3684
406 3781
1305 3610
1308 3995
536 3820
1165 3706
589 3806
1822 2918
1949 3350
1411 3838
1924 3973
1858 3478
382 3961
563 3940
286 3906
110 3158
549 3554
254 3972
477 3391
479 3984
1535 3945
4...

output:

7165606
7165606
7165606
7165606
7165606
7165606
7165606
7165606
7165607
7165607
7165607
7165607
7165607
7165607
7165607
7165607
7165607
7165607
7165607
7165607
7165607
7165607
7165607
7165607
7165607
7165607
7165607
7165607
7165607
7165607
7165607
7165607
7165607
7165607
7165607
7165607
7165607
7165...

result:

ok 199904 lines

Test #55:

score: 5
Accepted
time: 38ms
memory: 32856kb

input:

4000 2000 200000
736 3715
1368 3737
1501 3593
1476 3798
1916 3909
1941 3941
564 3937
381 3884
960 3730
1003 3187
1017 3964
892 3822
828 3703
1946 3986
232 3409
379 3709
1824 3990
1084 3791
1330 3207
1425 3878
648 3531
340 3975
827 3446
1138 3219
1751 3726
452 3362
94 3072
772 3341
1247 3971
97 3471
...

output:

7145387
7145387
7145387
7145387
7145387
7145387
7145387
7145387
7145387
7145387
7145387
7145387
7145387
7145387
7145387
7145387
7145388
7145388
7145388
7145388
7145388
7145388
7145388
7145388
7145388
7145388
7145388
7145388
7145388
7145388
7145388
7145388
7145388
7145388
7145388
7145388
7145388
7145...

result:

ok 200000 lines

Subtask #3:

score: 5
Accepted

Test #56:

score: 5
Accepted
time: 169ms
memory: 45216kb

input:

200000 126305 200000
53956 361430094
123046 93237953
102023 492182270
20967 731879823
59446 235230244
93775 918846298
6560 339063273
123391 284020516
38832 656735021
59982 736197369
36073 594090142
91754 312693418
69681 672203510
110793 84200666
28729 629600101
52602 304022555
20598 461758369
56178 ...

output:

52700573569137
52700573569908
52700573574378
52700573575149
52700573612317
52700573613088
52700573617558
52700573618200
52700573618329
52700573618971
52700573623441
52700573624212
52700573634925
52700573635696
52700573640166
52700573640937
52700573661380
52700573662151
52700573663154
52700573663277
...

result:

ok 200000 lines

Test #57:

score: 5
Accepted
time: 127ms
memory: 40616kb

input:

199587 78542 199617
5823 384642737
22453 732568084
57968 497602496
3591 68776662
69017 677814015
25611 4074662
75305 898052651
34225 766256922
52708 996081983
6147 615732998
28649 337107075
49271 266096581
21799 654662021
36720 179662677
3639 780329250
34052 307723184
25949 102265477
69218 947633693...

output:

29675878075538
29675878081004
29675878100840
29675878103728
29675878106306
29675878109194
29675878109764
29675878111988
29675878115230
29675878116071
29675878116888
29675878117454
29675878121506
29675878121537
29675878122354
29675878126972
29675878129030
29675878134496
29675878135066
29675878137290
...

result:

ok 199617 lines

Test #58:

score: 5
Accepted
time: 153ms
memory: 42524kb

input:

199842 99844 199905
61315 954645884
66380 229245136
97775 235666014
22145 673843582
60639 884835653
9229 347603763
49653 503266890
91169 538510372
74086 23107334
65447 57086583
715 973604462
379 327875023
31897 859390575
66491 837417196
87605 874614848
73501 603700705
37669 745312986
47925 463061648...

output:

38511580373130
38511580382126
38511580382413
38511580383738
38511580384199
38511580384204
38511580391409
38511580392734
38511580393021
38511580393195
38511580393200
38511580393482
38511580393487
38511580394807
38511580394812
38511580395273
38511580401381
38511580402017
38511580402478
38511580402483
...

result:

ok 199905 lines

Test #59:

score: 5
Accepted
time: 106ms
memory: 38536kb

input:

200000 44528 200000
27166 51081827
28535 582401848
4794 905018189
37435 104231793
1407 762821064
6958 12622077
39710 470188596
6559 457041957
10048 551048848
26241 321576390
41248 46222426
21857 895933975
6541 748382600
6958 86709281
10117 356475635
3027 160239731
25264 692682710
25775 148102265
303...

output:

20941310487531
20941310493876
20941310494736
20941310498891
20941310501081
20941310505236
20941310506096
20941310507036
20941310512441
20941310512613
20941310513381
20941310514241
20941310518396
20941310518958
20941310519221
20941310519818
20941310520586
20941310521050
20941310523452
20941310523973
...

result:

ok 200000 lines

Test #60:

score: 5
Accepted
time: 175ms
memory: 45684kb

input:

200000 133333 199712
71263 398100552
32021 199029763
55321 303914191
111006 3274484
45852 800772679
42806 596594715
131647 584329141
54004 731214242
18816 661712590
2755 704487556
54226 774344663
127069 589528392
122298 971160675
38933 277250056
82298 589643412
79211 626584491
47894 789922124
97724 ...

output:

56951658693240
56951658700200
56951658737732
56951658741252
56951658744692
56951658748212
56951658759805
56951658762625
56951658766765
56951658767355
56951658769585
56951658774315
56951658778612
56951658785572
56951658785744
56951658786862
56951658788356
56951658792704
56951658792825
56951658792834
...

result:

ok 199712 lines

Test #61:

score: 5
Accepted
time: 139ms
memory: 41344kb

input:

200000 88888 200000
56141 177181743
2228 536941865
11742 951949966
1918 94545272
72111 316004241
14027 221324768
42730 593922519
57126 936560272
14443 510797755
14170 473319252
55373 1379112
58763 210350202
55511 313346596
87056 725807653
37272 422322158
27866 231902562
3227 100100950
51438 56435107...

output:

27910080889354
27910080892781
27910080893401
27910080896443
27910080896828
27910080899870
27910080900490
27910080903917
27910080906355
27910080909782
27910080910402
27910080910926
27910080913444
27910080913829
27910080914353
27910080914973
27910080916871
27910080917491
27910080918015
27910080918400
...

result:

ok 200000 lines

Test #62:

score: 5
Accepted
time: 89ms
memory: 35196kb

input:

199968 18386 199769
272 549751270
16428 705309929
10384 542161072
7153 549503166
9414 402963795
9557 900056323
7153 119133225
795 693887875
4766 787610881
272 857864998
4867 446692277
272 897514177
15647 863192191
7847 983412243
17155 380805566
272 637647812
272 989636975
12490 895805861
795 4523454...

output:

5589609888421
5589609889951
5589609891008
5589609892538
5589609894726
5589609896256
5589609897313
5589609898843
5589609903341
5589609903353
5589609904427
5589609904871
5589609904883
5589609905928
5589609905940
5589609905957
5589609907458
5589609907470
5589609909646
5589609909658
5589609910107
558960...

result:

ok 199769 lines

Test #63:

score: 5
Accepted
time: 73ms
memory: 33500kb

input:

199776 10 200000
8 743148886
1 397751097
1 334975177
3 19934154
8 268061847
1 260923565
3 459572056
8 349727989
1 680056783
1 81090841
8 84073864
5 495422038
1 209193263
8 167424733
8 120928878
1 868248166
8 374612219
8 48139840
5 156283115
3 439559916
8 791972013
8 667089269
8 751787512
3 594857266...

output:

4232825
4234339
4236988
4238502
4243828
4244196
4246414
4247928
4247991
4248359
4248610
4250124
4250717
4252231
4252773
4254287
4254880
4256394
4257417
4257785
4259613
4259981
4261720
4261774
4262088
4262199
4263288
4263336
4263713
4263776
4264144
4264306
4264850
4265820
4265883
4265937
4266251
4267...

result:

ok 200000 lines

Test #64:

score: 5
Accepted
time: 47ms
memory: 26416kb

input:

200000 1 199894
1 867627920
1 86788848
1 220687737
1 812695392
1 714848763
1 289502177
1 362087944
1 815838346
1 740064469
1 539115541
1 945815098
1 972908612
1 887270354
1 388332817
1 980470262
1 180314408
1 615010172
1 721859713
1 253409191
1 823502636
1 460005656
1 510473146
1 399420559
1 6051397...

output:

1086
4007
20427
30641
35666
44148
50578
51060
53447
57093
58900
60556
62303
64527
74002
76331
84837
87106
93818
103786
104390
109498
119229
124185
124500
125325
140639
143133
145505
165943
170248
171048
172937
174821
182287
193842
195512
200892
201879
202858
204925
231611
239505
246352
246577
252164...

result:

ok 199894 lines

Test #65:

score: 5
Accepted
time: 133ms
memory: 40756kb

input:

199707 78565 200000
25943 842779097
47153 119098012
37135 613345468
45838 942562711
11324 454153140
2873 213306465
70464 78754083
56593 335581741
49550 168472716
64130 748081237
78231 694490799
37567 520573563
12343 471112090
53073 432268769
67969 730730831
38048 931825115
78000 832616008
36128 1419...

output:

29769354671812
29769354672334
29769354675646
29769354676168
29769354676342
29769354676552
29769354676864
29769354677074
29769354678004
29769354678526
29769354679637
29769354680159
29769354680176
29769354680386
29769354680698
29769354680908
29769354681082
29769354681604
29769354681838
29769354682360
...

result:

ok 200000 lines

Test #66:

score: 5
Accepted
time: 85ms
memory: 30628kb

input:

199828 79745 199772
8312 84600169
68749 411742355
67834 186662392
45957 262638796
12864 635508541
78203 171994
31448 402580080
38026 896980521
23324 778098487
29066 258499121
62607 693926824
10306 953913681
1607 340846791
8236 870667325
18075 310869574
17761 930281677
33691 590328392
6125 630104639
...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok 199772 lines

Test #67:

score: 5
Accepted
time: 46ms
memory: 32660kb

input:

50 25 200000
1 29220231
10 60022490
16 24419314
5 180293741
1 53264247
12 932376078
11 17318616
18 292810096
7 56851901
23 244783759
6 829304570
22 135959333
16 898004492
15 246285867
25 746422821
17 550419040
8 995043476
13 628298742
6 75354848
20 367204182
17 17578775
6 301533670
1 615107533
6 942...

output:

5463483352
5466569364
5476609676
5479695688
5487527368
5490613380
5500653692
5503739704
5510494724
5513580736
5514096042
5517182054
5520871987
5523957999
5527222366
5530308378
5533998311
5534538740
5537084323
5537624752
5538140058
5541226070
5544916003
5548002015
5551266382
5554352394
5558042327
556...

result:

ok 200000 lines

Test #68:

score: 5
Accepted
time: 50ms
memory: 32672kb

input:

300 147 200000
59 262966576
145 709128046
133 130387747
73 731659981
117 154734606
140 53375279
128 122510486
103 285030958
144 62378676
100 771307578
77 110272867
77 8510448
82 357592637
136 3440029
52 316602671
75 56550619
33 482424586
100 93939731
61 296137492
116 82170839
3 7413543
67 56392155
6...

output:

31044957452
31045361384
31049551686
31049955618
31050269365
31050561020
31050673297
31050964952
31054863599
31055155254
31055267531
31055559186
31055872933
31055877373
31056276865
31060467167
31060471607
31060871099
31061189286
31061480941
31061734821
31062138753
31065783520
31066075175
31066329055
...

result:

ok 200000 lines

Test #69:

score: 5
Accepted
time: 152ms
memory: 42376kb

input:

200000 100309 200000
57188 534504751
34772 404427154
88743 117280426
98873 501480725
26418 227819190
58586 399765398
43125 423733931
39161 556789003
24950 613606505
89182 514628208
57623 236753055
52510 16457275
58142 465995572
34629 23334784
78233 441925438
59983 8852110
63967 146734507
68177 15494...

output:

23436093608448
23436093608604
23436093613496
23436093613652
23436093613858
23436093614014
23436093614486
23436093614642
23436093615339
23436093615495
23436093616076
23436093616232
23436093618613
23436093618769
23436093618906
23436093619062
23436093619534
23436093619690
23436093619733
23436093619889
...

result:

ok 200000 lines

Test #70:

score: 5
Accepted
time: 7ms
memory: 22920kb

input:

50 15 200000
2 388323421
15 94107086
11 845302896
2 393419433
7 477826356
2 52511295
9 452232871
2 461487928
8 107429665
2 462636358
2 923291899
6 985221618
2 323477686
2 453149121
15 200911963
2 89334089
2 235055659
9 681424721
13 142117838
2 11734815
2 168092518
2 292192718
13 190652530
1 10028117...

output:

3788456371
3789267134
3798342951
3799153714
3806715484
3807526247
3816602064
3817412827
3825152273
3825963036
3830478931
3830865453
3831289694
3831676216
3835355524
3836166287
3836991063
3837801826
3839119431
3839930194
3843411386
3844222149
3844443956
3846877643
3847688406
3848738044
3849063738
384...

result:

ok 200000 lines

Test #71:

score: 5
Accepted
time: 47ms
memory: 33304kb

input:

300 81 200000
47 110964283
7 116988618
47 956974465
12 53481170
7 204510216
15 61096613
4 813508244
48 23787722
15 180714523
7 8878043
4 484820752
59 136625270
3 487367344
40 76403673
55 126611046
72 62772046
76 374783008
6 645414825
17 54971902
61 994746536
63 739942727
75 970175614
15 127384065
4 ...

output:

19688827636
19689279928
19690999329
19691451621
19692941161
19694717384
19694809889
19694827972
19695112854
19695169676
19695280264
19696889077
19696981582
19696999665
19697341369
19697451957
19697666061
19698118353
19698401679
19698631343
19698830909
19698853971
19698941497
19699027186
19699083635
...

result:

ok 200000 lines

Test #72:

score: 5
Accepted
time: 108ms
memory: 37932kb

input:

199637 44523 200000
25591 52272779
12180 309841095
21907 165879871
23301 339739475
14047 110626043
29436 67561493
31843 10406953
12069 243662358
30084 22394984
13525 25158834
2750 236073380
32465 61508289
6846 978753897
44224 210417629
43933 159850075
7458 174461937
43390 529598230
16397 37162201
24...

output:

13849039960477
13849039960724
13849039960869
13849039961010
13849039961116
13849039961257
13849039961402
13849039961649
13849039962548
13849039962795
13849039962940
13849039963081
13849039963187
13849039963328
13849039963473
13849039963720
13849039963766
13849039964013
13849039964158
13849039964299
...

result:

ok 200000 lines

Test #73:

score: 5
Accepted
time: 6ms
memory: 22996kb

input:

44 29 199989
11 107935157
23 241070421
13 166039563
12 346420911
3 628469688
27 50677262
29 556885934
18 240936339
5 287943635
1 41183363
5 627940777
4 242538682
24 58155364
17 347658055
22 455025025
23 716350260
10 465494201
11 81217705
27 192512209
2 546598435
7 122699077
28 467172176
13 952468207...

output:

9448496557
9475214009
9486475072
9513192524
9542312925
9561866041
9569030377
9576641343
9580291440
9588583493
9590604644
9599844556
9603358795
9607008892
9608400022
9614619858
9617322096
9626562008
9628310019
9628583159
9634370366
9635117474
9641337310
9655027471
9655300611
9655682409
9661087818
966...

result:

ok 199989 lines

Test #74:

score: 5
Accepted
time: 48ms
memory: 32676kb

input:

300 200 199869
124 775769506
26 406763815
38 206107
21 70385336
145 123992656
108 433881466
71 134223435
9 405023347
159 51934835
24 1822312
95 280696194
158 593338440
82 52311510
107 27538744
169 459175834
185 61091906
68 218096022
132 918639819
99 6388254
170 97491880
69 836014968
145 512165335
10...

output:

51596088263
51597730956
51597801416
51599179314
51599444109
51600822007
51600892467
51600892659
51601544178
51602535160
51602535352
51602605812
51603186871
51603257331
51603983710
51604248505
51604635229
51604900024
51605626403
51605696863
51606277922
51606348382
51606348574
51607339556
51607991075
...

result:

ok 199869 lines

Test #75:

score: 5
Accepted
time: 172ms
memory: 45676kb

input:

199892 133261 200000
96597 694498290
19010 10796658
40714 308555303
85623 35926541
84950 987291448
90762 323329080
93321 478521198
38083 242312535
26503 297781849
36055 594858198
32639 981878541
121917 609556352
48149 674445918
131085 232001250
51890 29790327
127089 100927559
29042 89802641
107235 1...

output:

35429512622430
35429512631378
35429512636878
35429512642483
35429512645826
35429512648921
35429512651431
35429512656931
35429512657869
35429512663369
35429512664036
35429512665879
35429512668974
35429512671305
35429512672317
35429512672984
35429512673590
35429512675839
35429512677922
35429512678484
...

result:

ok 200000 lines

Test #76:

score: 5
Accepted
time: 8ms
memory: 23188kb

input:

50 4 199972
1 420209764
2 281957723
1 661786157
4 349888482
1 794333933
2 66514896
4 7364498
2 348777702
2 697154005
4 7767626
1 605452
1 228559254
2 368784029
4 347065697
4 804605699
4 247790884
2 121054110
1 25262236
1 261681505
2 12218244
2 343418851
4 466691495
2 25748581
2 665570485
1 376784416...

output:

850763904
851167032
859443087
859846215
864294241
864697369
872973424
873376552
875420688
875823816
881748008
888951025
889354153
890427191
895278345
899338929
899742057
903957528
905060556
905463684
906404792
908018112
908421240
913739739
914142867
919935129
923995713
924398841
929177721
929580849
...

result:

ok 199972 lines

Test #77:

score: 5
Accepted
time: 46ms
memory: 32680kb

input:

300 8 199580
2 413315944
5 435325682
7 626009041
7 96987774
2 857533418
7 416597045
2 46064968
2 82570976
5 21541336
5 375136699
5 229809799
2 625323850
7 776015842
2 10943127
2 46481780
2 803472444
2 105031499
5 42492385
2 776879137
2 903911752
5 10823092
7 441651450
5 2862091
2 122765960
5 4220639...

output:

780355856
781787709
781982343
782284372
783414196
783475900
783716225
783910859
784539932
784575922
784907753
785102387
785342712
785685863
785971785
786202409
786329946
786384353
786468448
786504438
786534240
787117716
787174636
787312350
787659976
787695966
787816206
787900301
787956433
788010840
...

result:

ok 199580 lines

Test #78:

score: 5
Accepted
time: 73ms
memory: 33980kb

input:

200000 10 199627
10 30898795
7 599257314
4 82886427
10 299894104
4 39922551
4 222235728
4 434929908
10 916430304
10 25017372
7 50914525
10 199490437
10 515157077
7 20612812
4 531034660
3 346569793
4 114123908
10 266540920
10 756850589
10 999549018
7 137526176
7 378246858
7 342161812
7 345786409
10 3...

output:

612175
613009
613145
613433
613979
614267
614403
614696
614888
615237
615666
615722
615954
616146
616224
616924
616980
617058
617194
617409
617517
617622
618028
618351
618456
618667
618745
618775
618880
618937
619157
619206
619322
619609
619714
619715
619771
619991
620038
620040
620127
620143
620164...

result:

ok 199627 lines

Subtask #4:

score: 0
Wrong Answer

Test #79:

score: 0
Wrong Answer
time: 36ms
memory: 32688kb

input:

22 22 199709
12 52
5 69
5 3
5 292
12 29
5 129
20 134
12 9
14 1
12 218
12 111
12 37
22 41
11 71
5 54
5 208
12 112
5 242
2 64
22 146
5 134
22 61
0 0
0 1
0 0
0 0
0 6
0 0
0 0
0 0
0 0
0 0
0 0
0 6
0 0
0 1
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 3

output:

0
1
3
4
9
10
12
13
29
30
32
33
37
38
38
39
40
41
41
41
42
42
44
45
46
47
49
50
50
51
52
53
53
54
54
55
55
56
57
58
61
61
62
62
63
64
64
64
64
65
65
65
66
67
67
68
69
70
70
70
71
71
72
73
73
73
73
74
74
74
75
76
76
77
78
78
78
79
79
79
79
80
81
81
81
82
82
82
82
83
83
84
84
85
86
87
87
88
89
90
90
90...

result:

wrong answer 54th lines differ - expected: '66', found: '67'

Subtask #5:

score: 0
Wrong Answer

Test #106:

score: 0
Wrong Answer
time: 30ms
memory: 28864kb

input:

26 26 200000
1 174
1 156
2 5
19 38
5 51
15 283
15 222
5 16
16 277
1 114
1 3
1 17
2 139
1 51
5 160
1 78
1 233
1 17
1 201
5 99
1 51
17 15
1 122
17 33
17 241
1 6
6 9
0 1
0 0
0 0
0 4
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
1 12
0 2
0 0
1 1
0 0
0 0
0 0
0 0
0 0
0 0
0 0

output:

460
465
465
470
475
476
480
480
481
481
485
486
487
491
492
492
493
496
496
497
498
498
501
502
503
503
507
507
508
508
508
509
511
512
513
513
513
514
514
516
516
518
518
519
520
521
523
523
523
523
524
525
525
526
527
528
528
528
528
528
529
529
530
531
531
531
531
532
532
533
533
534
535
536
536
...

result:

wrong answer 3rd lines differ - expected: '475', found: '465'