QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#227574#2717. Shopping PlansDJ200625 ✓126ms51960kbC++142.6kb2023-10-27 18:54:582023-10-27 18:54:59

Judging History

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

  • [2023-10-27 18:54:59]
  • 评测
  • 测评结果:25
  • 用时:126ms
  • 内存:51960kb
  • [2023-10-27 18:54:58]
  • 提交

answer

#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>

#include <queue>
#include <cstdlib>

using i64 = long long;
using u64 = unsigned long long;

const i64 INF = 1e18;

const int N = 2e5;

int n, m, k;
int a[N + 5];
int c[N + 5];

void print() {
	while (k--) {
		std::cout << "-1\n";
	}
	exit(0);
}

struct info {
	int L, R;
	i64 sum = 0;
	
	std::vector<int> cost;
	std::vector<i64> ans;
	
	struct node {
		int id, x, y; i64 sum;
		bool operator <	(const node &rhs) const { return sum > rhs.sum; }
	};
	
	std::priority_queue<node> q;
	
	void insert(int x) {
		cost.emplace_back(x);
	}
	
	void init() {
		if ((int)cost.size() < L) {
			print();
		}
		std::sort(cost.begin(), cost.end());
		if (L == 0) ans.emplace_back(0);
		i64 sum = 0;
		for (int i = 0; i < std::min(R, (int)cost.size()); i++) {
			sum += cost[i];
			if (i + 1 >= L) {
				q.push({i, i, (int)cost.size() - 1, sum});
			}
		}
	}
	
	i64 kth(int k) {
		while (k > (int)ans.size() && !q.empty()) {
			node now = q.top(); q.pop();
			ans.emplace_back(now.sum);
			if (now.x + 1 <= now.y) q.push({now.id, now.x + 1, now.y, now.sum + cost[now.x + 1] - cost[now.x]});
			if (now.id && now.id < now.x) q.push({now.id - 1, now.id, now.x - 1, now.sum + cost[now.id] - cost[now.id - 1]});
		}
		return k > (int)ans.size() ? INF : ans[k - 1];
	}
} g[N + 5];

std::pair<i64, int> v[N + 5];
	
struct node {
	int id, x; i64 sum;
	bool operator <	(const node &rhs) const { return sum > rhs.sum; }
};

std::priority_queue<node> q;

void solve() {
	std::cin >> n >> m >> k;
	for (int i = 1; i <= n; i++)
		std::cin >> a[i] >> c[i];
	for (int i = 1; i <= n; i++)
		g[a[i]].insert(c[i]);
	for (int i = 1; i <= m; i++)
		std::cin >> g[i].L >> g[i].R;
	for (int i = 1; i <= m; i++)
		g[i].init();
	i64 sum = 0;
	for (int i = 1; i <= m; i++) {
		sum += g[i].kth(1);
		v[i] = {g[i].kth(2) - g[i].kth(1), i};
	}
	std::sort(v + 1, v + m + 1);
	q.push({1, 2, sum + v[1].first});
	k--;
	std::cout << sum << "\n";
	while (k--) {
		node now = q.top(); q.pop();
		if (now.sum >= INF) k++, print();
		std::cout << now.sum << "\n";
		int i = v[now.id].second;
		q.push({now.id, now.x + 1, now.sum + g[i].kth(now.x + 1) - g[i].kth(now.x)});
		if (now.id < m) {
			q.push({now.id + 1, 2, now.sum + v[now.id + 1].first});
			if (now.x == 2) q.push({now.id + 1, 2, now.sum + v[now.id + 1].first - v[now.id].first});
		}
	}
}

int main() {
	std::ios::sync_with_stdio(false);
	
	std::cin.tie(nullptr);
	std::cout.tie(nullptr);
	std::cerr.tie(nullptr);
	
	int t = 1;
//	std::cin >> t;
	
	while (t--) {
		solve();
	}
	
	return 0;
}

詳細信息

Subtask #1:

score: 5
Accepted

Test #1:

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

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: 0
Accepted
time: 3ms
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: 0
Accepted
time: 7ms
memory: 24476kb

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

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: 0
Accepted
time: 6ms
memory: 24540kb

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

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: 0
Accepted
time: 3ms
memory: 23992kb

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

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

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

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: 0
Accepted
time: 4ms
memory: 22520kb

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: 0
Accepted
time: 5ms
memory: 24576kb

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

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

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: 0
Accepted
time: 6ms
memory: 24212kb

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

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: 0
Accepted
time: 6ms
memory: 23820kb

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

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

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: 0
Accepted
time: 3ms
memory: 24476kb

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: 0
Accepted
time: 2ms
memory: 23220kb

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

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: 0
Accepted
time: 3ms
memory: 24656kb

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: 0
Accepted
time: 2ms
memory: 24344kb

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

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: 0
Accepted
time: 2ms
memory: 24588kb

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

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: 0
Accepted
time: 5ms
memory: 24316kb

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: 39ms
memory: 32464kb

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: 0
Accepted
time: 30ms
memory: 33280kb

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: 0
Accepted
time: 38ms
memory: 33136kb

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: 0
Accepted
time: 31ms
memory: 31976kb

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: 0
Accepted
time: 35ms
memory: 32204kb

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: 0
Accepted
time: 39ms
memory: 33184kb

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: 0
Accepted
time: 33ms
memory: 33684kb

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: 0
Accepted
time: 36ms
memory: 32336kb

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: 0
Accepted
time: 4ms
memory: 24300kb

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: 0
Accepted
time: 31ms
memory: 32396kb

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: 0
Accepted
time: 4ms
memory: 24208kb

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: 0
Accepted
time: 21ms
memory: 28312kb

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: 0
Accepted
time: 33ms
memory: 32400kb

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: 0
Accepted
time: 29ms
memory: 33968kb

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: 0
Accepted
time: 4ms
memory: 24316kb

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: 0
Accepted
time: 38ms
memory: 33496kb

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: 0
Accepted
time: 38ms
memory: 32460kb

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

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: 0
Accepted
time: 42ms
memory: 30408kb

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: 0
Accepted
time: 36ms
memory: 32080kb

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

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: 0
Accepted
time: 42ms
memory: 30416kb

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: 0
Accepted
time: 33ms
memory: 32048kb

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: 0
Accepted
time: 9ms
memory: 24280kb

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: 0
Accepted
time: 4ms
memory: 24136kb

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: 0
Accepted
time: 35ms
memory: 32336kb

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: 0
Accepted
time: 32ms
memory: 32320kb

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

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: 0
Accepted
time: 85ms
memory: 43332kb

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: 0
Accepted
time: 84ms
memory: 44656kb

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: 0
Accepted
time: 79ms
memory: 40296kb

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: 0
Accepted
time: 99ms
memory: 49456kb

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: 0
Accepted
time: 101ms
memory: 44780kb

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: 0
Accepted
time: 74ms
memory: 36620kb

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: 0
Accepted
time: 68ms
memory: 35304kb

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: 0
Accepted
time: 45ms
memory: 26852kb

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: 0
Accepted
time: 93ms
memory: 43540kb

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: 0
Accepted
time: 34ms
memory: 27928kb

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: 0
Accepted
time: 36ms
memory: 32192kb

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: 0
Accepted
time: 39ms
memory: 33968kb

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: 0
Accepted
time: 97ms
memory: 45200kb

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: 0
Accepted
time: 9ms
memory: 24408kb

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: 0
Accepted
time: 44ms
memory: 32796kb

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: 0
Accepted
time: 71ms
memory: 38748kb

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: 0
Accepted
time: 4ms
memory: 22552kb

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: 0
Accepted
time: 48ms
memory: 33276kb

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: 0
Accepted
time: 107ms
memory: 48960kb

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: 0
Accepted
time: 4ms
memory: 22612kb

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: 0
Accepted
time: 35ms
memory: 32120kb

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: 0
Accepted
time: 71ms
memory: 34060kb

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

Test #79:

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

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
66
67
67
67
68
69
69
70
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...

result:

ok 199709 lines

Test #80:

score: 0
Accepted
time: 28ms
memory: 33752kb

input:

22 22 199589
21 196
18 277
15 36
18 155
17 114
2 100
2 103
2 103
18 149
13 19
2 100
2 202
5 57
2 129
18 2
21 2
2 222
2 94
2 5
3 30
18 17
2 23
0 0
0 6
0 1
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 1
0 0
0 0
0 0
0 1
0 3
0 0
0 0
0 0
0 0

output:

0
2
5
7
17
19
19
21
22
23
24
24
25
26
28
30
30
32
35
36
37
38
40
41
42
42
43
44
45
47
47
47
49
49
49
51
52
53
54
54
55
56
58
59
60
61
64
66
66
68
70
71
72
72
73
74
75
77
77
79
89
91
94
94
96
96
99
100
100
101
102
102
103
103
105
105
105
105
107
107
108
108
110
110
111
113
113
114
115
116
116
117
117...

result:

ok 199589 lines

Test #81:

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

input:

21 21 200000
15 29
20 218
9 183
15 29
19 87
8 222
8 129
19 282
8 6
20 102
20 233
8 274
15 140
8 11
9 35
10 88
8 56
15 47
8 11
15 6
7 47
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 7
0 1
0 0
0 0
0 0
0 0
0 0
0 5
0 0
0 0
0 0
0 0
0 0
0 0

output:

0
6
6
11
11
12
17
17
17
17
22
23
23
28
28
29
29
34
35
35
35
35
35
40
40
40
40
41
41
41
41
46
46
46
46
46
46
46
46
46
46
47
47
51
51
52
52
52
52
52
52
52
52
53
53
56
57
57
57
57
57
58
58
58
58
58
59
62
62
63
63
63
63
64
64
64
64
64
64
64
64
67
67
68
69
69
69
69
70
70
70
70
70
70
70
73
73
73
73
75
75
...

result:

ok 200000 lines

Test #82:

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

input:

26 26 200000
3 8
3 162
26 24
23 93
23 36
23 68
13 8
3 151
23 47
1 180
2 252
13 119
23 111
1 252
20 2
13 42
13 37
7 245
3 134
3 296
23 136
20 48
3 158
23 14
3 3
22 300
0 1
0 1
0 1
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 4
0 0
0 0
0 1

output:

0
3
8
14
17
22
24
27
32
36
38
39
41
44
46
47
50
50
53
55
58
60
61
63
64
68
68
69
71
71
74
74
76
77
79
82
82
83
85
85
86
88
90
91
92
93
93
95
96
97
100
100
101
104
105
106
107
107
107
109
110
110
111
112
114
114
115
115
115
117
118
118
119
120
121
121
123
124
125
125
126
128
128
129
129
129
131
131
1...

result:

ok 200000 lines

Test #83:

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

input:

199657 199657 200000
140294 145961677
48054 568977838
20098 205460237
95313 878317897
196626 190480711
109445 544011601
52170 658249312
189967 537059644
129173 172703950
93639 58647751
124886 372114709
107641 455645304
186301 793723257
169636 707969403
148668 37130890
196735 418795317
647 509410111
...

output:

0
5457
6488
11945
12071
14510
16771
17085
17528
18559
19698
19967
20998
22228
22542
22551
23259
23573
24016
25155
26186
26455
26581
28008
28452
28716
28842
29030
29039
29156
30966
31281
31595
31643
31769
32038
32621
33069
33856
33909
34208
34299
34496
34613
34622
34940
35330
35644
36423
36469
36738
...

result:

ok 200000 lines

Test #84:

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

input:

200000 200000 199759
147539 777675116
51487 33128283
101521 339078621
179919 476371507
16682 898704323
96226 294538998
67880 318753831
58139 665754599
190957 365830517
22878 7434376
64691 793542821
199880 308020276
17181 230768309
88175 230065120
38315 207053183
33551 140731491
2372 719509495
88039 ...

output:

0
29252
37199
49069
55394
58880
62735
66451
71050
76753
78321
78692
81162
84172
84646
86268
88132
90753
91987
92593
96079
99934
100302
104463
104895
105899
106005
107944
107949
108249
110414
111804
113424
113952
114274
115520
115891
118129
118361
118956
120005
120119
121371
121615
121845
125331
1258...

result:

ok 199759 lines

Test #85:

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

input:

200000 200000 199831
16905 566636312
175374 76624632
66178 564738965
17389 649846697
82715 542064194
74111 150968363
65054 221986075
144253 693882628
135092 593125662
1172 362686031
175390 296220636
128556 284594354
29571 349421733
99351 955149303
185231 955176591
195262 335793232
18671 378297911
79...

output:

0
147
3416
3563
4582
4729
7998
8145
9249
9396
12665
12812
13831
13978
17247
17394
37439
37586
38222
38369
38625
38772
40855
41002
41638
41785
42021
42041
42168
42188
42804
42951
43207
43354
44957
45104
45437
45584
46220
46367
46623
46688
46770
46835
47471
47618
47874
48021
48373
48520
49539
49686
50...

result:

ok 199831 lines

Test #86:

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

input:

200000 200000 200000
183098 631745947
101689 491234380
167576 970308949
97168 494005277
128934 436106600
85431 572482795
154857 469386613
127844 585248991
63987 46612631
140055 644960201
94023 397374800
179029 572858774
96052 755245631
106381 862675085
191008 916846291
146918 156652005
18989 1545301...

output:

0
8752
12703
18792
21455
27489
27544
31495
35390
36241
40192
40247
42241
44142
44979
46281
48093
48944
50993
53731
54182
54944
55033
56845
57682
58984
61033
62879
62934
63696
63771
66434
66885
67736
69730
69785
71631
71793
72468
72523
73424
73736
75582
75637
76474
77631
78482
79043
80369
80430
80545...

result:

ok 200000 lines

Test #87:

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

input:

199783 199783 200000
71635 832630449
147092 39897734
152025 221124987
100371 694149126
87760 431747791
9264 617664975
95037 236503219
173103 204044007
166484 337369790
71789 138804596
182394 198323227
20139 71960214
163587 129741244
132963 741323508
14013 931739042
6759 71343050
169922 531464000
477...

output:

0
1746
5532
7278
9042
10788
12089
13835
14574
16320
17621
19367
21131
22877
26663
28409
50471
52217
53977
55723
56003
57749
59509
59513
61255
61259
62560
63019
64306
64765
65045
66066
66791
67718
67812
68092
68551
69464
69838
70297
71598
71602
72919
73250
73344
73348
74665
74996
75108
76760
76854
77...

result:

ok 200000 lines

Test #88:

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

input:

199591 199591 199589
174304 944842046
147295 511797535
4918 625502814
123639 36127991
28587 70182212
73754 583102017
140413 151366449
22872 811374957
94675 603098240
196278 908743036
88535 316841384
107191 465996980
165373 69002050
17430 410637584
96820 3659699
173411 780133607
168213 327381148
1779...

output:

0
1182
1713
2895
6665
7847
8378
9560
13046
14228
14759
15667
15941
16849
17380
18562
19711
20893
21424
22332
22606
22874
23514
24045
24056
24587
25227
25769
28713
29539
29895
30426
30721
31252
31608
32434
34312
35378
35494
35920
36025
36128
36560
37091
37102
37207
37310
37633
37841
38273
38541
38815...

result:

ok 199589 lines

Test #89:

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

input:

200000 200000 199964
87409 557798230
76722 930617629
76722 483832039
121659 865005823
76722 736873828
77429 557967534
76722 729691717
87409 396344883
121659 819540149
76722 841218724
76722 115276512
135019 434881014
145695 868488450
49872 177138514
76722 495023892
144386 350560690
144386 118010072
7...

output:

0
2080
2457
4537
10038
12118
12495
14575
16428
17423
18508
18885
19503
19880
20500
20965
21960
22580
22957
23837
25037
25917
26294
26302
26466
27461
28374
28382
28546
28759
28923
29541
29918
30538
30839
31003
31998
32618
32995
33851
33875
35075
35931
35955
36308
36332
36340
36928
37923
38388
38412
3...

result:

ok 199964 lines

Test #90:

score: 0
Accepted
time: 91ms
memory: 43688kb

input:

200000 200000 200000
146924 6152477
50206 368522120
50206 984644144
146924 445451057
146924 944124289
146924 830283259
50206 580199957
1421 769144738
146924 135291154
1421 370176950
50206 687291711
146924 794700828
1421 6123938
50206 512214074
50206 225073906
146924 96313808
146924 518361947
146924 ...

output:

0
17979
19776
23064
23333
25739
26781
30633
31817
37755
37959
41043
41312
42837
42840
43109
43425
43718
44760
45515
46397
46557
46611
48612
48803
49072
49735
49796
49845
50114
50409
51593
52520
53525
53697
53966
54881
55150
55938
56372
57414
57556
57735
58598
60318
60816
60819
61023
61088
61292
6140...

result:

ok 200000 lines

Test #91:

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

input:

200000 200000 199869
36846 679598229
36846 118594743
36846 668465140
36846 62500238
36846 732019641
36846 57720197
36846 949707055
36846 481269843
36846 958322374
36846 762238411
36846 537579491
36846 584250374
36846 88066094
36846 71732476
36846 361781681
36846 829288632
36846 991839808
36846 39779...

output:

0
3310
15339
18649
25514
27270
28824
30580
30695
34005
40853
42609
44163
45919
46034
49344
50981
52784
54002
54291
56094
56209
57312
57965
59519
61275
63692
66320
67002
68123
69341
69630
71433
71548
72651
73304
74858
76495
76614
78251
79031
79516
79805
80010
81272
81561
81676
82262
82341
82826
83320...

result:

ok 199869 lines

Test #92:

score: 0
Accepted
time: 113ms
memory: 47224kb

input:

200000 200000 199906
96386 886056324
17342 703212323
148605 2716404
33928 419803116
118233 256249372
31823 562056442
14029 998562933
127182 373166882
174771 764645095
94895 257271805
127454 994286422
137681 852833990
101247 737235237
90186 839539860
18113 836681859
178946 255446515
145950 538087165
...

output:

0
24005
27883
29862
38795
44208
50288
51005
51467
51888
53867
57745
60287
61869
62800
66678
68213
68657
72091
74070
74293
75010
75269
75472
78171
78888
79350
80150
80867
81329
81750
83003
84292
85874
88170
89083
89752
89800
90149
90262
90683
91731
92662
94496
95213
95675
96096
96540
98075
99082
9927...

result:

ok 199906 lines

Test #93:

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

input:

200000 200000 200000
183328 272664165
135801 363680878
142017 344177433
65582 82677733
165766 263648977
88864 863513906
57575 174670459
191298 445750404
122692 136571217
100216 202102710
178513 249112199
187301 465167410
195112 529809351
72024 762501840
106012 471928335
124123 433632978
39599 526899...

output:

0
13357
16348
28882
29704
29705
33692
35281
36122
41006
42239
43061
43254
45230
46052
47049
48638
49479
50040
51629
52470
54363
56611
57354
58586
58587
58980
59409
59602
62574
63396
63397
64163
64985
64986
65004
65826
65827
68973
69305
69814
69888
70710
70711
70810
71403
71943
72136
72337
72958
7295...

result:

ok 200000 lines

Test #94:

score: 0
Accepted
time: 51ms
memory: 33732kb

input:

48 48 200000
42 336827896
6 81943054
12 318961009
34 454863776
37 727024161
20 72456387
35 597446856
45 98928551
18 285260279
37 14290887
28 388111690
14 81491297
28 8618744
29 55932788
24 26606543
2 21093249
6 59124081
37 545968072
28 6520159
30 91251350
28 473867615
18 918722708
30 65325701
28 251...

output:

0
6520159
6753852
8618744
13274011
14290887
15138903
15372596
20811046
21044739
21093249
21892755
22909631
26606543
27564898
27613408
27847101
29429790
29663483
29711993
30686331
33126702
33360395
34367260
35225287
35384136
36183642
36232152
36465845
37206490
37440183
39305075
39880554
40746209
4089...

result:

ok 200000 lines

Test #95:

score: 0
Accepted
time: 43ms
memory: 33448kb

input:

283 283 199899
15 992584214
272 274597749
19 7584240
165 289068450
164 17227372
266 460688660
239 767942030
29 384652405
180 931639120
238 501853293
109 471459653
58 265336836
218 36465922
175 24196626
59 217021756
84 28006327
45 237016989
180 459478267
272 3571643
7 82653901
212 863302244
205 90341...

output:

0
335981
755584
1044533
1091565
1380514
1632181
1800117
1968162
2109911
2136098
2387765
2445892
2676714
2687405
2723746
2865495
3012695
3023386
3099088
3154444
3201476
3432298
3435069
3442989
3490425
3571643
3731938
3742092
3768279
3778970
3854672
3907624
3910028
4067919
4078073
4143621
4190653
4246...

result:

ok 199899 lines

Test #96:

score: 0
Accepted
time: 117ms
memory: 51000kb

input:

199707 199707 200000
30037 277108862
110053 1065781
13706 192427098
51550 66701157
83134 162041463
12087 116370417
29053 36666248
99337 15616520
33517 805433903
108919 514929493
85120 444518303
136216 417836528
40117 695008248
29703 778616872
97436 944241632
22376 114561058
56965 249661099
122990 65...

output:

0
673
1116
1213
1283
1527
1789
1886
1956
2065
2200
2329
2399
2496
2643
2738
2740
2810
3002
3072
3169
3181
3278
3316
3348
3413
3441
3483
3592
3612
3612
3854
3856
3926
3951
4021
4023
4114
4139
4265
4285
4285
4394
4464
4529
4557
4561
4599
4654
4696
4708
4724
4728
4805
4808
4812
4825
4875
4895
4968
5067...

result:

ok 200000 lines

Test #97:

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

input:

45 45 199741
22 670476366
8 810888839
6 422899207
24 366676800
20 125744553
40 341327527
19 382602191
28 22236436
19 203171550
19 382176716
8 70237457
8 598062539
23 19409742
8 72676044
19 640194550
8 221176791
8 321270549
20 135313784
23 458235609
20 270240377
38 101848821
22 172138062
8 485476041
...

output:

0
2411694
19036038
19409742
20210842
21447732
21821436
22622536
24818663
27230357
32454754
34866448
38445780
39246880
39620584
40857474
41658574
42032278
43854701
44228405
45029505
46266395
46640099
47441199
51490792
51864496
52665596
53902486
54276190
55077290
57273417
58656622
59685111
61068316
63...

result:

ok 199741 lines

Test #98:

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

input:

293 293 200000
121 199667972
142 224856899
198 744623384
68 29415355
123 443295310
26 239080422
148 51880578
142 178660664
161 242778549
274 858958427
74 320934856
113 773625299
105 628555128
74 93251648
88 178100227
227 289173204
74 287308625
105 584152379
74 23093617
207 308410595
41 60698772
148 ...

output:

0
192604
304890
328295
497494
520899
633185
825789
1192248
1384852
1497138
1520543
1689742
1713147
1825433
2018037
2756827
2949431
3061717
3085122
3254321
3277726
3287541
3390012
3472628
3480145
3582616
3592431
3615836
3665232
3777518
3785035
3800923
3808440
3919611
3920726
3949075
3970122
3993527
4...

result:

ok 200000 lines

Test #99:

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

input:

200000 200000 199863
52352 613198395
85977 13144495
124514 618961269
99438 478813501
81043 110675471
28221 745747840
91336 17330992
106733 255398268
139135 175927217
57776 153968276
160669 355616475
147234 27917362
171903 886979537
98052 299293737
56973 139644048
169277 143598822
199658 743142472
38...

output:

0
21
420
441
463
484
565
586
883
904
912
933
985
1006
1028
1049
1332
1353
1375
1396
1418
1439
1448
1469
1477
1498
1795
1816
1838
1859
1881
1897
1902
1918
1940
1961
1983
2004
2237
2256
2258
2277
2301
2322
2330
2351
2360
2361
2381
2382
2403
2424
2443
2446
2464
2467
2657
2676
2678
2697
2700
2702
2719
2...

result:

ok 199863 lines

Test #100:

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

input:

50 50 200000
2 42480988
20 352968477
30 97275039
14 3855502
49 618255888
4 568338795
4 164716873
8 792456040
32 2892329
36 471678544
24 14020778
30 204070869
46 62872217
47 44895710
10 49050402
26 10346293
24 601883113
22 171062323
6 690443357
4 690719997
43 185559894
9 178169894
26 274238472
25 122...

output:

0
558744
2892329
3451073
3855502
4414246
6747831
7306575
10346293
10905037
11890732
12418108
12449476
12500014
12976852
13058758
13238622
13797366
14020778
14201795
14579522
14760539
14783061
15310437
15341805
15392343
15746234
15869181
15951087
16273610
16304978
16355516
16832354
16913107
16914260
...

result:

ok 200000 lines

Test #101:

score: 0
Accepted
time: 47ms
memory: 31972kb

input:

286 286 199995
129 88091226
194 22476437
208 379676643
240 680152702
107 163884993
28 259614015
132 989846777
284 49713880
44 146393584
55 158565085
250 594834509
210 162093539
79 898343366
121 499485971
192 563706241
179 406178576
65 777522901
49 19890223
147 103199686
105 186344282
87 133803350
14...

output:

0
575480
611910
972545
1147345
1187390
1548025
1584455
1666417
1722825
1759255
1788508
2119890
2159935
2241897
2278327
2334735
2363988
2400418
2638962
2695370
2731800
2761053
2813762
2853807
2935853
2975898
3051909
3214442
3250872
3307280
3336533
3372963
3389242
3425672
3454925
3511333
3547763
36273...

result:

ok 199995 lines

Test #102:

score: 0
Accepted
time: 114ms
memory: 50228kb

input:

200000 200000 199986
45220 342447261
33181 4391528
140124 166168244
103014 403776012
43790 87542334
48230 333807671
168141 471399360
74983 14457726
179744 76761145
168309 44248036
52900 112099780
189265 244808220
84985 504383042
169754 607718055
185020 62996301
90386 158287684
10302 854302363
95768 ...

output:

0
353
585
848
938
1021
1201
1374
1433
1557
1606
1723
1786
1869
1910
1959
2076
2142
2222
2308
2405
2454
2495
2571
2578
2661
2744
2758
2807
2924
2931
2990
3031
3097
3156
3163
3280
3329
3343
3384
3426
3509
3516
3592
3616
3633
3682
3779
3865
3879
3945
3969
4011
4052
4128
4177
4218
4232
4301
4364
4405
44...

result:

ok 199986 lines

Test #103:

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

input:

47 47 199662
44 226082167
13 144925224
13 253514381
13 132822913
24 141363431
7 909710903
7 350825488
7 37414473
24 106286670
13 115754604
24 872428434
7 126008848
7 183652121
13 732617570
13 162186470
13 932422583
13 223413081
7 511460
7 525373401
13 160262643
7 482331322
24 54066026
13 651937531
1...

output:

0
511460
19961894
20473354
37414473
37925933
41206924
41718384
54066026
54577486
57376367
57887827
61168818
61680278
74027920
74539380
78621397
79132857
79493463
80004923
86432393
86943853
91480499
91991959
95272950
95784410
98583291
99094751
99455357
99966817
106286670
106394287
106798130
106905747...

result:

ok 199662 lines

Test #104:

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

input:

300 300 199756
253 10829400
253 80264092
66 189135410
35 140786378
35 154778561
253 25543892
66 29143870
253 953967716
253 157561705
207 37405486
66 477976533
253 568379457
253 993499344
253 320033249
66 40986625
35 250411415
253 444853528
35 63247339
66 283992538
253 114663785
253 911872680
66 1321...

output:

0
258030
370028
437255
628058
695285
807283
1065313
2710365
2968395
3080393
3147620
3210328
3234344
3338423
3381851
3405650
3468358
3492374
3517648
3530115
3580356
3604372
3639881
3647583
3671599
3751879
3760778
3775678
3788145
3819106
3838386
3862402
3872061
3900143
3905613
3929629
3967370
4009909
...

result:

ok 199756 lines

Test #105:

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

input:

199640 199640 199813
89355 359505623
89355 344560666
25847 229833399
25847 370647377
17543 673222639
89355 198832603
89355 226645607
25847 26354794
25847 389729949
25847 182139282
25847 189964262
25847 24833037
25847 583137676
17543 29275114
89355 396892140
89355 994490093
89355 468277382
25847 1584...

output:

0
212
1129
1341
1840
2052
2487
2699
2941
2969
3017
3044
3145
3153
3181
3229
3256
3357
3451
3616
3663
3828
4070
4146
4173
4182
4274
4282
4327
4358
4385
4394
4486
4539
4580
4781
4792
4857
4884
4985
4993
5069
5096
5197
5291
5311
5428
5456
5503
5504
5523
5531
5632
5640
5668
5716
5743
5844
5910
5938
5958...

result:

ok 199813 lines

Subtask #5:

score: 5
Accepted

Test #106:

score: 5
Accepted
time: 33ms
memory: 29392kb

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
475
476
480
481
487
487
491
492
492
493
496
498
502
502
503
503
507
507
508
508
508
509
511
513
514
516
518
518
520
520
521
521
523
523
523
523
524
525
525
526
526
526
527
528
528
529
531
531
531
532
532
535
535
535
536
536
536
536
536
536
537
537
537
538
538
538
538
538
539
539
540
540
540
...

result:

ok 200000 lines

Test #107:

score: 0
Accepted
time: 31ms
memory: 32308kb

input:

26 26 199708
11 115
16 18
12 3
25 23
12 32
25 74
7 94
16 14
25 210
16 29
25 60
12 23
16 131
16 255
11 141
6 279
16 67
16 70
16 165
19 39
16 296
11 3
13 73
16 89
12 74
13 116
0 0
0 0
0 0
0 0
0 0
0 0
0 1
0 0
0 0
0 0
1 2
1 2
1 1
0 0
0 0
0 8
0 0
0 0
1 1
0 0
0 0
0 0
0 0
0 0
2 3
0 0

output:

201
215
215
219
221
224
229
230
230
233
233
233
235
235
238
238
239
242
244
244
244
244
244
247
247
247
248
248
249
250
251
252
252
253
253
253
253
256
256
258
258
258
258
259
261
262
262
262
262
262
262
264
264
264
265
265
266
267
267
267
267
267
267
268
268
270
270
271
271
271
272
272
272
273
273
...

result:

ok 199708 lines

Test #108:

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

input:

25 25 199575
18 61
18 8
19 38
19 193
6 138
20 17
6 11
19 275
18 295
19 96
23 186
18 6
20 192
6 60
19 44
23 58
20 69
19 172
20 19
6 71
18 85
18 37
1 14
19 23
18 78
0 0
0 0
0 0
0 0
0 0
1 3
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
1 6
0 4
0 1
0 0
0 0
0 0
0 0
0 0

output:

17
19
25
34
36
36
38
40
42
42
44
48
48
54
55
56
57
57
59
59
61
61
62
63
63
65
65
66
67
67
68
69
71
71
72
72
73
73
74
74
74
75
76
77
77
77
78
78
78
79
79
79
79
80
80
80
80
80
81
82
82
83
84
85
85
85
85
85
86
86
86
86
86
86
87
88
88
88
88
89
89
89
90
90
91
91
91
92
92
92
93
94
94
94
94
94
95
95
95
95
...

result:

ok 199575 lines

Test #109:

score: 0
Accepted
time: 29ms
memory: 33108kb

input:

24 24 199691
9 115
1 79
20 21
1 30
4 93
20 14
1 107
1 189
21 28
4 127
1 1
4 112
24 281
1 17
1 97
1 82
4 274
1 256
17 247
1 14
20 179
7 134
4 98
4 97
6 8
0 0
0 0
2 4
0 0
0 0
1 1
0 0
1 17
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 1
0 0
0 0
1 2
0 0
0 0
0 0
0 0

output:

676
677
681
683
684
688
691
691
692
694
695
695
696
696
697
698
698
698
699
699
701
701
702
702
702
702
703
703
704
705
706
706
706
706
708
709
709
709
710
710
711
711
711
712
712
712
713
713
713
713
713
714
715
716
716
716
716
716
717
717
717
717
718
718
719
719
720
720
720
720
721
721
721
722
723
...

result:

ok 199691 lines

Test #110:

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

input:

200000 200000 199884
68454 778264599
53245 862804560
91792 262275229
65986 478029274
154652 428563045
194300 617100111
128316 322113650
138883 661979994
119504 662480802
189731 550399381
129271 590760309
152699 308049092
5991 824118737
21039 271235067
30867 159233700
147138 456554118
129413 18193395...

output:

23007494813088
23007494826281
23007494838113
23007494848716
23007494851306
23007494855986
23007494860852
23007494861025
23007494861909
23007494869179
23007494873741
23007494874045
23007494874218
23007494881011
23007494885877
23007494886050
23007494886934
23007494891614
23007494894204
23007494895584
...

result:

ok 199884 lines

Test #111:

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

input:

200000 200000 200000
78935 173126118
6362 915280368
150863 657436531
38635 207803116
17098 353216622
160728 244526252
169978 555628421
38009 845774853
91500 756122704
154977 236002563
184026 296084704
187882 570174361
5908 684373134
152100 214358753
29245 797415159
142994 722654648
168088 487831786
...

output:

20862642249727
20862642251337
20862642257316
20862642258926
20862642267199
20862642268809
20862642273387
20862642274788
20862642274997
20862642276398
20862642278076
20862642279686
20862642280976
20862642282586
20862642285665
20862642287275
20862642289298
20862642290853
20862642290859
20862642290908
...

result:

ok 200000 lines

Test #112:

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

input:

199598 199598 200000
101285 905782524
132914 113840462
32749 203051233
6368 162498018
54881 778433422
102437 418507374
140508 718600945
32824 739695183
33939 958815899
41909 884317193
128908 420898797
173476 20971935
150010 615750222
62896 253621339
56924 295467990
45041 830301549
170350 402906731
1...

output:

21720057799653
21720057799750
21720057800931
21720057801028
21720057801565
21720057801662
21720057802843
21720057802940
21720057808323
21720057808420
21720057809601
21720057809698
21720057810235
21720057810332
21720057811513
21720057811610
21720057817051
21720057817131
21720057817148
21720057817228
...

result:

ok 200000 lines

Test #113:

score: 0
Accepted
time: 110ms
memory: 46588kb

input:

199853 199853 200000
197195 909016781
146982 39255658
105902 469349044
154285 286828457
178626 495311719
151574 61132307
167369 382448133
7847 766924922
52692 704086421
155439 550376838
178069 152387461
102706 517535427
133821 581665118
55867 841336082
112816 335240910
100662 973769207
131280 935792...

output:

19656389457351
19656389460305
19656389462041
19656389464061
19656389464995
19656389466355
19656389467015
19656389468751
19656389469309
19656389469950
19656389471045
19656389471705
19656389472904
19656389473065
19656389473999
19656389474640
19656389476019
19656389476660
19656389477594
19656389477755
...

result:

ok 200000 lines

Test #114:

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

input:

200000 200000 200000
10906 311202352
120992 233664835
29692 176438479
164295 954952463
87766 115699733
85276 400111448
25709 559973012
130963 761683950
145576 985183979
168771 838847875
117222 919899101
143482 822481521
118939 754934996
57646 700789161
70060 692687876
118131 530641634
94238 71333269...

output:

23223946252876
23223946253494
23223946264695
23223946265313
23223946266147
23223946266765
23223946277966
23223946278584
23223946295319
23223946295937
23223946298825
23223946299381
23223946299443
23223946299999
23223946305869
23223946306487
23223946307138
23223946307756
23223946308590
23223946309208
...

result:

ok 200000 lines

Test #115:

score: 0
Accepted
time: 116ms
memory: 49648kb

input:

200000 200000 199614
31362 486426210
162129 968081646
25835 40108084
29613 817789932
191725 489953809
3247 415300100
29991 208723030
127772 121486822
110240 908678504
100114 663896926
101109 690836659
158097 870448756
194057 413445423
157459 131847580
192516 736403542
172392 901717851
190294 2711542...

output:

21760933878464
21760933879014
21760933881884
21760933882434
21760933885214
21760933885764
21760933888033
21760933888583
21760933888634
21760933889184
21760933891453
21760933892003
21760933894783
21760933895333
21760933898203
21760933898753
21760933899159
21760933899709
21760933902504
21760933902579
...

result:

ok 199614 lines

Test #116:

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

input:

200000 200000 200000
199345 218150969
6196 855610675
181937 695368628
61462 546819972
44875 646252905
44945 983600746
23029 529719557
155521 378322496
132922 302110261
73317 357326748
44875 40396965
197183 167889237
23656 265331039
44945 573323499
50756 359945708
16942 605022562
129517 52304258
4683...

output:

16599653698958
16599653699699
16599653701603
16599653701761
16599653702502
16599653704406
16599653704469
16599653706373
16599653707114
16599653707272
16599653708425
16599653709166
16599653709176
16599653709917
16599653710330
16599653711070
16599653711228
16599653711969
16599653713133
16599653713873
...

result:

ok 200000 lines

Test #117:

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

input:

199979 199979 199658
58404 647029381
58404 270322336
184441 353235891
182118 487466813
58404 905546510
58404 242483568
184441 63475995
182118 154077245
58404 984014279
184441 197074954
190615 208811543
182118 180442590
184441 219619120
58404 536806951
182118 882368205
184441 462435099
184441 3251990...

output:

12608759419972
12608759421036
12608759423151
12608759423610
12608759424215
12608759424674
12608759426789
12608759427853
12608759428554
12608759429618
12608759429817
12608759429826
12608759430501
12608759430802
12608759430881
12608759430936
12608759431143
12608759431565
12608759431636
12608759431733
...

result:

ok 199658 lines

Test #118:

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

input:

199787 199787 200000
196745 970137744
196745 283956917
196745 360504142
196745 498762665
196745 377357826
196745 714158053
196745 280839128
196745 308330145
196745 103208766
196745 768243722
196745 197368070
196745 764038846
196745 198218221
196745 57575957
196745 73784178
196745 403129541
196745 13...

output:

26133691030900
26133691035151
26133691038311
26133691041754
26133691044599
26133691044914
26133691046611
26133691049165
26133691049771
26133691051202
26133691052464
26133691054022
26133691055453
26133691055624
26133691056059
26133691056972
26133691058613
26133691059111
26133691059450
26133691059875
...

result:

ok 200000 lines

Test #119:

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

input:

200000 200000 199785
113803 700934378
18932 909873286
110056 520149825
171083 644380582
41657 733508451
49351 990422131
152511 283682059
149812 35240739
127190 498450232
194393 948690182
141082 633926545
148795 628335554
52214 810609593
146140 769311290
116277 668725434
95699 582349253
9417 83236119...

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

Test #120:

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

input:

200000 200000 200000
194739 242215986
63956 79698804
46737 806372279
23702 178257300
158253 469705051
7335 671434059
88032 717734293
134753 162647737
42184 499945633
118618 17842144
24379 817824514
32613 125380338
47524 480520885
145370 550417713
171191 699095734
47826 848524150
90480 67529037
11140...

output:

20893655576674
20893655578723
20893655579480
20893655579580
20893655580091
20893655580888
20893655581529
20893655581629
20893655582140
20893655582386
20893655582897
20893655582907
20893655582937
20893655582997
20893655583694
20893655583794
20893655584305
20893655584435
20893655584946
20893655584956
...

result:

ok 200000 lines

Test #121:

score: 0
Accepted
time: 36ms
memory: 32912kb

input:

50 50 199696
2 991321954
1 54070357
40 225988919
38 27554078
3 193664169
41 14919607
36 222979059
43 186497768
19 5510848
29 613686945
27 31881072
40 5431321
19 312441791
38 22933049
41 810157660
17 214936707
19 872710566
12 989895117
12 253860136
40 788948819
3 83053118
9 252676295
37 98110059
41 6...

output:

4179208316
4183314353
4193037504
4197143541
4197658533
4201764570
4202141365
4206247402
4206762394
4210868431
4211089388
4215195425
4215957165
4220063202
4220591582
4224697619
4224918576
4229024613
4229539605
4229695443
4229786353
4233278673
4233645642
4233801480
4233892390
4234022437
4234407382
423...

result:

ok 199696 lines

Test #122:

score: 0
Accepted
time: 43ms
memory: 31756kb

input:

296 296 199605
67 380313386
19 308415498
30 689423652
27 207259148
207 214524592
212 149840335
155 45863662
98 412173856
66 479471437
246 922833615
161 905210443
27 150286003
183 134246210
35 104858960
278 22972269
165 794365124
238 10421085
34 256012728
201 526370738
135 270554763
135 36650416
211 ...

output:

41848164060
41849901736
41850776259
41852396711
41852513935
41852585550
41854134387
41854323226
41855008910
41855197749
41855681441
41856218236
41856746586
41856818201
41856935425
41857419117
41857955912
41858293640
41858555877
41858585145
41858759670
41858830435
41859430400
41859914092
41860031316
...

result:

ok 199605 lines

Test #123:

score: 0
Accepted
time: 110ms
memory: 49208kb

input:

200000 200000 199616
108757 489455422
38872 302582017
3671 528544727
65992 762182815
95892 836450591
2543 93082676
152511 222514249
72978 48864621
116803 15451060
135320 535911167
84629 69671887
10453 180496386
4671 953956947
120085 199609108
2760 249406469
92642 962475571
114400 240710297
11644 953...

output:

28721951976256
28721951978268
28721951983127
28721951983306
28721951984913
28721951985139
28721951985318
28721951986717
28721951986925
28721951988729
28721951989634
28721951990177
28721951991646
28721951991784
28721951991963
28721951992189
28721951993588
28721951993767
28721951993796
28721951993975
...

result:

ok 199616 lines

Test #124:

score: 0
Accepted
time: 46ms
memory: 32836kb

input:

50 50 199899
32 78025160
36 160344694
42 213231347
34 624998247
34 81586059
32 132602107
41 56893603
32 322680314
32 261541187
37 125590684
34 929823361
48 945085399
21 430113676
21 309289901
21 917851981
21 65047387
32 148509678
34 103392452
34 34658491
32 198841859
11 492593067
32 20905092
43 1382...

output:

2657366087
2679172480
2714486155
2726100048
2735391247
2736292548
2744065499
2749053636
2756848746
2757160952
2757197640
2760758539
2765871892
2769063102
2775998617
2778066044
2778655139
2778967345
2782956771
2783220116
2784970673
2789968194
2790869495
2795644168
2797805010
2799872437
2801185567
280...

result:

ok 199899 lines

Test #125:

score: 0
Accepted
time: 43ms
memory: 32156kb

input:

300 300 200000
29 6449996
259 160172846
92 496071063
8 362323942
220 290455256
280 154805928
164 623235941
102 61218602
258 95469412
147 347535404
162 750806618
196 405393675
57 384655872
259 126851318
199 2356505
173 401223803
259 217049428
34 557026295
8 327406824
113 349298571
148 106054468
147 1...

output:

35772108138
35773285254
35773323000
35774278266
35774500116
35775455382
35775493128
35776670244
35777797868
35778524920
35778558134
35778974984
35779012730
35779702036
35779735250
35779739782
35779772996
35779967996
35780189846
35780210701
35780695048
35780728262
35780916898
35780950112
35781145112
...

result:

ok 200000 lines

Test #126:

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

input:

200000 200000 199947
160821 189526357
21975 364073039
19747 225247529
190772 437581874
81687 433105164
158772 291786917
90905 39144310
119150 247671535
87292 19758990
70540 464372671
140329 89410822
18663 725505870
189342 42702078
170457 476735486
89545 47283932
91720 52144833
36667 318104089
7676 1...

output:

20753103272407
20753103273337
20753103273801
20753103274495
20753103274731
20753103274771
20753103275405
20753103275425
20753103275447
20753103275552
20753103275701
20753103275889
20753103276097
20753103276165
20753103276335
20753103276377
20753103276482
20753103276799
20753103276819
20753103276841
...

result:

ok 199947 lines

Test #127:

score: 0
Accepted
time: 34ms
memory: 33048kb

input:

48 48 200000
44 253425643
43 5320823
12 420179661
26 97469141
10 686992437
46 463695383
33 429048951
32 300601316
38 321827253
36 12473227
6 47631957
20 32424960
10 305470030
20 96839004
30 143183303
5 273536860
8 299249934
34 464924819
36 575698891
9 278043999
19 77360394
14 532776220
29 181611379
...

output:

7339899921
7345220744
7359312037
7364632860
7382786901
7388107724
7402199017
7404313965
7407519840
7409634788
7420657972
7423726081
7425978795
7429046904
7436738925
7440070088
7442059748
7445390911
7447200945
7447950025
7452521768
7453270848
7456151041
7461471864
7463544952
7466613061
7468865775
747...

result:

ok 200000 lines

Test #128:

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

input:

300 300 199613
94 49855745
175 402243713
69 435644127
92 198099400
184 331966845
101 490035977
117 233178821
95 2304729
284 263335999
247 2136659
296 651020493
234 43013041
232 699426879
258 416437168
48 104965723
122 4496304
175 172194740
142 927733669
98 105579237
49 13864024
128 708229001
9 63829...

output:

40680483168
40683837167
40686675859
40688037742
40689492367
40690029858
40691391741
40692846366
40694230433
40694347192
40695685058
40695865297
40696038453
40697046941
40697584432
40697701191
40699039057
40699219296
40699392452
40700195073
40700400940
40700539883
40701901766
40702057988
40702231144
...

result:

ok 199613 lines

Test #129:

score: 0
Accepted
time: 117ms
memory: 51960kb

input:

199648 199648 200000
119316 11868631
36125 480843219
133584 133118876
81904 230876295
52384 498886485
34148 790049835
162280 796082472
120867 304333866
94627 77822430
71590 15370951
176079 38398587
96325 22369368
183294 21603770
51008 179423472
154286 85250960
197522 331873108
108962 277876618
17364...

output:

31716833880454
31716833880536
31716833881077
31716833881159
31716833881378
31716833881460
31716833882001
31716833882083
31716833888673
31716833888755
31716833889296
31716833889378
31716833889557
31716833889597
31716833889639
31716833889679
31716833890180
31716833890220
31716833890262
31716833890302
...

result:

ok 200000 lines

Test #130:

score: 0
Accepted
time: 34ms
memory: 33392kb

input:

50 50 199698
44 178450987
23 220774646
44 25022299
44 47762320
44 47987254
44 354823137
30 771174469
23 947479903
30 458545240
44 98620301
23 957746068
30 207712213
23 407039095
44 429645677
23 77938959
30 842178194
23 182815005
23 42387831
30 143479190
23 30510029
44 898589719
23 795515726
44 11997...

output:

1063712442
1065639857
1067363579
1069290994
1073216459
1075143874
1076867596
1078795011
1081458401
1083445026
1085109538
1085161521
1087096163
1088715914
1088812658
1090643329
1090962418
1092949043
1093336203
1094613555
1094665538
1096600180
1096987340
1098219931
1098316675
1099263570
1099702256
110...

result:

ok 199698 lines

Test #131:

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

input:

293 293 200000
236 659035533
157 736170339
157 158147156
236 51135714
157 606836092
9 182740111
9 225027001
157 5216766
157 21323632
236 10437355
59 302328340
157 662844773
9 25662921
236 31082586
9 113889447
157 475495885
9 98890278
9 348336953
157 82218146
9 14716994
236 410785303
157 16137165
9 4...

output:

25952751288
25956247731
25956692106
25957110228
25959607163
25960188549
25960469660
25961051046
25963547981
25963966103
25963977512
25964410478
25965405556
25965504885
25966268053
25966344109
25966367382
25966428784
25967206606
25967235018
25967291281
25967473955
25967906921
25967918330
25968097515
...

result:

ok 200000 lines

Test #132:

score: 0
Accepted
time: 91ms
memory: 40424kb

input:

200000 200000 200000
76042 929791771
27701 49042461
22971 477253
27701 869862338
22971 156491360
22971 74473093
175618 9437520
175618 233614830
27701 19390539
22971 450005232
22971 382596627
175618 767271317
692 34130839
27701 378959651
22971 108197892
175618 73447874
175618 353529476
22971 88542221...

output:

35632248457380
35632248465355
35632248472705
35632248480680
35632248481814
35632248483200
35632248484251
35632248489789
35632248498525
35632248499576
35632248500436
35632248503874
35632248505420
35632248507634
35632248508685
35632248511849
35632248513395
35632248515761
35632248518723
35632248522656
...

result:

ok 200000 lines

Extra Test:

score: 0
Extra Test Passed