QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#331905#71. Cake 3Kevin5307100 ✓742ms84428kbC++202.4kb2024-02-18 22:08:062024-02-18 22:08:07

Judging History

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

  • [2024-02-18 22:08:07]
  • 评测
  • 测评结果:100
  • 用时:742ms
  • 内存:84428kb
  • [2024-02-18 22:08:06]
  • 提交

answer

//Author: Kevin
#include<bits/stdc++.h>
//#pragma GCC optimize("O2")
using namespace std;
#define ll long long
#define ull unsigned ll
#define pb emplace_back
#define mp make_pair
#define ALL(x) (x).begin(),(x).end()
#define rALL(x) (x).rbegin(),(x).rend()
#define srt(x) sort(ALL(x))
#define rev(x) reverse(ALL(x))
#define rsrt(x) sort(rALL(x))
#define sz(x) (int)(x.size())
#define inf 0x3f3f3f3f
#define pii pair<int,int>
#define lb(v,x) (int)(lower_bound(ALL(v),x)-v.begin())
#define ub(v,x) (int)(upper_bound(ALL(v),x)-v.begin())
#define uni(v) v.resize(unique(ALL(v))-v.begin())
#define longer __int128_t
void die(string S){puts(S.c_str());exit(0);}
int n,m;
vector<pii> vec;
vector<int> pool;
int cnt[200200*30],ls[200200*30],rs[200200*30],tot;
ll sum[200200*30];
int rt[200200];
int build(int l,int r)
{
	int ret=++tot;
	if(l!=r)
	{
		int mid=(l+r)/2;
		ls[ret]=build(l,mid);
		rs[ret]=build(mid+1,r);
	}
	return ret;
}
int update(int x,int l,int r,int p)
{
	int ret=++tot;
	if(l==r)
	{
		cnt[ret]=cnt[x]+1;
		sum[ret]=sum[x]+pool[p];
		return ret;
	}
	int mid=(l+r)/2;
	ls[ret]=ls[x];
	rs[ret]=rs[x];
	cnt[ret]=cnt[x]+1;
	sum[ret]=sum[x]+pool[p];
	if(p<=mid)
		ls[ret]=update(ls[x],l,mid,p);
	else
		rs[ret]=update(rs[x],mid+1,r,p);
	return ret;
}
ll query(int x1,int x2,int l,int r,int c)
{
	if(!c) return 0;
	if(l==r) return (sum[x2]-sum[x1])/(cnt[x2]-cnt[x1])*c;
	int mid=(l+r)/2;
	if(cnt[rs[x2]]-cnt[rs[x1]]>=c)
		return query(rs[x1],rs[x2],mid+1,r,c);
	return query(ls[x1],ls[x2],l,mid,c-(cnt[rs[x2]]-cnt[rs[x1]]))+sum[rs[x2]]-sum[rs[x1]];
}
ll calc(int l,int r)
{
	if(r-l+1<m) return -1ll*inf*inf;
	return -2*vec[r-1].first+2*vec[l-1].first+query(rt[l-1],rt[r],0,sz(pool)-1,m);
}
ll ans=-1ll*inf*inf;
void solve(int l,int r,int L,int R)
{
	if(l>r) return ;
	int mid=(l+r)/2;
	int p=R;
	for(int i=max(L,l+m-1);i<=R;i++)
		if(calc(mid,i)>calc(mid,p))
			p=i;
	ans=max(ans,calc(mid,p));
	solve(l,mid-1,L,p);
	solve(mid+1,r,p,R);
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin>>n>>m;
	for(int i=0;i<n;i++)
	{
		int v,c;
		cin>>v>>c;
		pool.pb(v);
		vec.pb(c,v);
	}
	srt(vec);
	srt(pool);
	uni(pool);
	for(auto &pr:vec)
		pr.second=lb(pool,pr.second);
	rt[0]=build(0,sz(pool)-1);
	for(int i=0;i<n;i++)
		rt[i+1]=update(rt[i],0,sz(pool)-1,vec[i].second);
	solve(1,n,1,n);
	cout<<ans<<endl;
	return 0;
}

詳細信息

Subtask #1:

score: 5
Accepted

Test #1:

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

input:

100 32
671208774 266481733
115497791 342597239
326245300 76223942
528973483 754205900
437996819 995535247
100582194 42402057
771100621 351934207
89058009 81951602
768935397 186435060
842907845 376386254
187943947 59424920
997369107 493642356
455078419 68850493
542835555 938351581
970171972 611243076...

output:

25580474644

result:

ok single line: '25580474644'

Test #2:

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

input:

96 26
654901552 458347153
165510759 938829925
195217130 507375330
505924632 413472221
654752848 711653336
843934470 721570198
773665886 401710037
234904469 980379861
955790468 908963841
767941919 649831102
551860594 482287589
445315312 465411688
121261567 38031091
85608696 831434175
898543690 533481...

output:

20912597347

result:

ok single line: '20912597347'

Test #3:

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

input:

97 50
601727246 586947184
629061466 495053188
908476392 789027930
127214423 866336725
518731382 132785533
113489768 827723755
985313205 850125600
651615014 585565934
7844301 974793551
821451342 503266415
191392244 172018292
811053096 980886405
414007158 116164410
749815864 858185057
809840877 654635...

output:

35572528711

result:

ok single line: '35572528711'

Test #4:

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

input:

95 53
149550762 262774006
70645562 988470529
951317142 587455395
640797744 881023050
152099375 109591790
42073955 240106850
787394186 32306392
690229700 154829125
612427906 799230609
529294971 846139787
399369072 840851479
258683206 624167919
933584741 989196725
928112368 809131208
742906726 7228213...

output:

38104623964

result:

ok single line: '38104623964'

Test #5:

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

input:

95 67
219655106 209971230
684228500 55963835
376681839 957451928
44063570 464399636
244459351 255445846
926539875 699539831
624720901 149661354
268068448 124041530
391618918 196971593
259894666 522352998
72651673 750483217
418558834 288939175
987660441 756241680
290013706 540390088
672554190 1595528...

output:

42726885227

result:

ok single line: '42726885227'

Test #6:

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

input:

98 83
144189007 599184430
955720138 430137031
46813950 337012077
284624496 923370172
585878255 277696686
458874123 25220195
65996741 918738892
536999214 420249860
124871436 785740035
524616035 321557657
377122912 363899088
800060966 799482628
704695498 739563311
385588901 543586072
594428502 6483895...

output:

47720376527

result:

ok single line: '47720376527'

Test #7:

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

input:

96 38
37921502 265183642
30462271 269145614
51895518 29824956
44764507 681512686
47724467 815499441
6427327 591731270
46504734 436644698
2223048 132007665
40380520 511674250
43917077 653531209
17511337 975498424
1931641 115779401
16884852 128795730
14731353 429591965
5850509 790146440
15255306 77070...

output:

399264493

result:

ok single line: '399264493'

Test #8:

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

input:

96 25
57401007 493943697
29527957 714663679
29545307 647011203
41025179 566266756
58441740 117870293
27412280 422916085
33052858 310233747
9411800 715114198
15661682 773129023
49930623 903197292
4733526 653650922
36089642 500031319
1389486 444206729
19886177 397683562
2903725 764846753
84795 2145521...

output:

719815801

result:

ok single line: '719815801'

Test #9:

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

input:

99 21
59657805 652963568
80731103 249217474
67765017 136600735
30669693 235796790
38336275 333697289
9339946 754166690
69051138 182211402
93041255 259466527
71372493 445676674
67165121 840321934
33766102 430254036
18248715 148433501
38354832 282537749
64069877 131281615
39361263 592884334
18160924 9...

output:

888797889

result:

ok single line: '888797889'

Test #10:

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

input:

93 28
19252348 834865987
35189109 821648351
47848765 934801179
33900007 907328375
45481720 478428955
4292036 880931858
36991135 956842947
49181931 583677473
36889879 714660270
20737289 866325358
65602596 635999283
70856516 855441876
54559432 319956854
47217522 132918942
55127890 62037126
53412038 84...

output:

597761343

result:

ok single line: '597761343'

Test #11:

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

input:

92 18
17034692 311412535
75067760 700238328
85371763 32662981
90417142 594066624
34625146 420051930
46026136 298353430
71930456 679253686
94901612 553915166
10855990 339449028
10327620 444733804
51133091 802733614
95838938 276886845
22327317 53898064
29910663 881733161
74599342 280465633
8898777 221...

output:

963264484

result:

ok single line: '963264484'

Test #12:

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

input:

96 46
3613091 48226953
17333738 315657491
33499557 905024
21585984 973060800
42148202 275277748
25892629 489251559
31604703 888333915
13970358 799610574
33246317 54304803
7114447 61375639
5669373 697687696
1575366 350398758
16667098 747366614
7839377 799378407
18868553 430864652
41883674 476142622
1...

output:

217389025

result:

ok single line: '217389025'

Test #13:

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

input:

100 45
43924230 212784715
43573365 390630448
36356410 302155896
8834549 369231487
23914662 209393152
8961292 339488011
11770598 98213199
41391432 553642288
33929359 654885451
15834215 243511760
32889505 785116193
40157572 806063390
41729010 657312356
24502770 98898149
33168308 379445567
25788178 737...

output:

284124804

result:

ok single line: '284124804'

Test #14:

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

input:

94 44
18278964 59117371
1121774 674793869
44776633 866596597
3672456 43798662
18327992 258671822
26820827 436747027
10741961 269663794
4454544 235521073
2959148 111403543
17994812 431349737
44808537 631076314
1072950 366206930
37219572 987766907
33824148 367550034
18542970 307178475
1386716 33940913...

output:

308368925

result:

ok single line: '308368925'

Test #15:

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

input:

96 41
36332583 8569405
20284590 704164692
26169208 400229170
32850340 485895095
44691003 149746532
5684161 537586304
3545889 108210000
26693523 480026681
38944140 61394964
34125662 576589094
10604727 179814783
12192083 364751818
37385170 791694556
20134304 90024835
19149660 168146967
11032310 183184...

output:

344295172

result:

ok single line: '344295172'

Test #16:

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

input:

90 38
8869730 76738045
32276119 757676479
5091410 369590827
35491028 689930909
20025995 127998287
49111097 975894312
16776797 690236150
14603906 430533164
6638017 768678637
583367 277491929
43583227 197845857
19225748 735413656
39437324 641580882
43275662 785441666
50322818 734853329
35990613 997504...

output:

418654054

result:

ok single line: '418654054'

Test #17:

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

input:

97 63
17888788 608002691
16142900 885752870
1364666 365868015
4878248 624150124
18576418 704242346
17020617 375882628
21749764 987510302
23736619 444353886
19722113 954714013
9275566 579405076
31641382 557924314
28779133 996785377
24059182 892591765
26116965 249236656
15958669 36018002
12783153 4066...

output:

-324021706

result:

ok single line: '-324021706'

Test #18:

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

input:

100 71
14246084 541505816
9994802 994431615
1482902 185840951
26468202 241171629
17716658 549877382
25340166 772809756
18151090 18915661
10164740 748716089
12552723 56489026
6069755 574352885
23096929 778200711
24642227 384490457
4716312 797733167
23906409 557004993
197262 5593534
27176008 844798422...

output:

-276543166

result:

ok single line: '-276543166'

Test #19:

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

input:

97 65
4386932 310542657
23651846 24902512
17872222 432076283
12688150 320458048
13294064 783055998
24489246 667018801
26933633 303216574
20987206 894751368
6946734 18906053
4725483 816674619
11278516 963601520
1714355 137847174
16817734 79470468
7807193 972225264
15832623 861238054
11363869 91575309...

output:

-174786613

result:

ok single line: '-174786613'

Test #20:

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

input:

100 76
19363945 999230932
6565531 340746079
17098814 481571520
15063962 562888079
16400153 379641015
22687207 473072780
13205572 315563624
4971425 266006726
25882141 800667318
16425184 781371894
10021910 67574149
19963913 96397646
26310382 585714937
7145348 578506544
4794238 790460340
7285540 645057...

output:

-310560206

result:

ok single line: '-310560206'

Test #21:

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

input:

95 66
12740392 44322988
23072578 479866996
28690034 991246669
23341774 816240165
5356957 510095701
6993836 351625358
16797983 601213241
16864568 335398045
13997193 909507175
27087288 982552754
26886506 169380803
3047418 849902451
1896289 226928494
1306707 244984996
13019901 587922276
11247618 716796...

output:

-28999886

result:

ok single line: '-28999886'

Test #22:

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

input:

94 22
17729830 195028137
17729832 195028150
17729830 195028178
17729832 195028140
17729832 195028118
17729836 195028176
17729835 195028180
17729829 195028198
17729829 195028141
17729835 195028132
17729834 195028115
17729829 195028197
17729829 195028160
17729829 195028137
17729834 195028161
17729836 ...

output:

390056298

result:

ok single line: '390056298'

Test #23:

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

input:

100 25
15180379 189754751
15180379 189754772
15180385 189754771
15180385 189754771
15180379 189754773
15180385 189754781
15180383 189754741
15180381 189754720
15180381 189754791
15180385 189754788
15180381 189754771
15180384 189754718
15180379 189754738
15180384 189754779
15180386 189754788
15180379...

output:

379509524

result:

ok single line: '379509524'

Test #24:

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

input:

92 37
6917252 127969112
6917251 127969122
6917248 127969158
6917252 127969121
6917249 127969098
6917249 127969063
6917252 127969064
6917251 127969071
6917250 127969096
6917249 127969144
6917250 127969080
6917251 127969129
6917248 127969134
6917248 127969134
6917251 127969112
6917248 127969112
691724...

output:

255938190

result:

ok single line: '255938190'

Test #25:

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

input:

100 42
8947720 187902126
8947719 187902145
8947719 187902174
8947722 187902111
8947720 187902164
8947722 187902148
8947723 187902141
8947721 187902138
8947719 187902143
8947720 187902154
8947722 187902170
8947721 187902162
8947721 187902079
8947719 187902111
8947719 187902094
8947721 187902129
89477...

output:

375804228

result:

ok single line: '375804228'

Test #26:

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

input:

93 42
5450766 114466000
5450765 114466073
5450765 114466092
5450763 114466006
5450765 114466065
5450764 114466073
5450764 114466016
5450764 114466092
5450765 114466060
5450764 114466069
5450765 114466002
5450763 114466020
5450766 114466040
5450766 114466051
5450767 114466080
5450763 114466002
545076...

output:

228932048

result:

ok single line: '228932048'

Test #27:

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

input:

96 42
6481674 136115141
6481674 136115143
6481674 136115200
6481677 136115104
6481674 136115173
6481673 136115198
6481672 136115171
6481674 136115171
6481674 136115198
6481676 136115115
6481674 136115159
6481673 136115179
6481674 136115123
6481674 136115116
6481676 136115173
6481673 136115132
648167...

output:

272230243

result:

ok single line: '272230243'

Test #28:

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

input:

91 35
7078729 127852986
6976330 199120225
7918266 101649053
9886390 174239569
8680498 181231369
10147698 178133237
6550286 188440017
10998842 176674437
11338474 163404734
9928237 144614674
10813308 119730850
8490207 177630658
7666339 125985790
8842506 161567810
7545945 172836768
7244339 151363289
88...

output:

257081558

result:

ok single line: '257081558'

Test #29:

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

input:

90 22
14286146 154004991
16643150 170148576
14468260 179044873
11596207 178516095
16788739 193967231
12440449 168662547
14797798 174924503
11195707 136243477
12044575 129447384
9432188 100337673
17144187 104480992
11072522 110866789
13775415 155063112
17184094 100533600
12446867 176287486
11478110 1...

output:

281555721

result:

ok single line: '281555721'

Test #30:

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

input:

100 29
9531137 158342198
10547622 178461072
11919343 157206544
9587137 162255834
8112842 138118096
7650771 117964254
7497546 137803698
9171970 168188367
13214044 159075986
13332882 177627982
13251626 191514575
8195217 135984932
10266960 188825369
8135290 153570161
12177239 158413233
10303999 1774730...

output:

281996167

result:

ok single line: '281996167'

Test #31:

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

input:

95 49
5324636 179288160
5409006 130652095
6846457 160463725
4338673 104140314
5324593 179288197
5322187 185899122
6179346 148685923
7003579 184887841
6834578 172632756
5094797 186909136
6317848 135586449
5356447 183268322
5803751 184007780
6846531 160463782
5414770 141547042
5398293 191301500
631790...

output:

231995752

result:

ok single line: '231995752'

Test #32:

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

input:

92 47
8061822 136846833
6642446 166843406
4261250 160921666
4489059 151015120
4601597 135229263
4824447 154004434
6525893 153559993
7417252 146176344
6153011 191410359
4464747 159984984
8343467 111098444
4504883 137911904
5927740 185005343
8351538 181377851
4489006 151015089
4824407 154004364
842467...

output:

218822483

result:

ok single line: '218822483'

Test #33:

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

input:

92 39
9027696 183506931
5961251 142108073
7720700 110598847
5648540 196652092
6501150 189219306
5746162 187475921
8410833 143213540
9004401 141124014
7671741 174085402
9961580 141717536
8226371 157513143
9747707 179135409
9740001 118326279
9281457 126779638
9945648 114139725
9747637 179135416
722782...

output:

274033436

result:

ok single line: '274033436'

Test #34:

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

input:

92 55
1 1
10 490
6 979
2 1468
4 1957
2 2446
6 2935
7 3424
9 3913
3 4402
3 4891
5 5380
1 5869
2 6358
8 6847
1 7336
5 7825
9 8314
1 8803
10 9292
8 9781
1 10270
6 10759
7 11248
4 11737
4 12226
3 12715
5 13204
10 13693
3 14182
8 14671
8 15160
5 15649
2 16138
9 16627
4 17116
2 17605
6 18094
7 18583
10 19...

output:

-52489

result:

ok single line: '-52489'

Test #35:

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

input:

90 27
2 1
5 466
2 931
7 1396
10 1861
10 2326
4 2791
1 3256
10 3721
4 4186
2 4651
4 5116
10 5581
9 6046
5 6511
10 6976
4 7441
6 7906
9 8371
4 8836
10 9301
8 9766
10 10231
2 10696
9 11161
1 11626
5 12091
6 12556
3 13021
7 13486
4 13951
10 14416
8 14881
4 15346
6 15811
5 16276
3 16741
4 17206
10 17671
...

output:

-24008

result:

ok single line: '-24008'

Test #36:

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

input:

96 23
466703636 1
685964430 1
94138746 1
260865796 1
671061690 1
342965956 1
70077955 1
353576592 1
647102711 1
381407841 1
160479125 1
532426710 1
606287881 1
815834411 1
154155710 1
173295822 1
79893082 1
977723022 1
449558013 1
697003683 1
409420108 1
18515297 1
663646483 1
396590913 1
184119427 ...

output:

20219731188

result:

ok single line: '20219731188'

Test #37:

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

input:

100 100
865613444 566253861
658651559 846380264
825752153 192037838
448174355 534315715
739996438 168524064
81511958 137624584
852893078 662698922
719896249 803133529
562555332 7146132
266184989 611936568
885582195 736804493
521264825 67715872
474677299 497782030
224795664 930773965
613758079 961250...

output:

45696374824

result:

ok single line: '45696374824'

Subtask #2:

score: 19
Accepted

Dependency #1:

100%
Accepted

Test #38:

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

input:

1855 501
338527451 578733742
703170142 682868070
16985949 852452962
662029309 680590695
717678423 220285590
961443168 146607690
278716170 683348763
238103085 414255420
332431596 320585514
501489988 647737182
293979999 420745717
402085021 831124117
569170680 735252719
136204202 448222008
296743227 74...

output:

428322190418

result:

ok single line: '428322190418'

Test #39:

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

input:

1964 645
686547414 723477566
963686617 50764327
111556192 186211733
899272728 802880430
153008970 843446090
930194466 133178740
575628133 334745573
286939234 115658401
857618618 677208982
204399846 852814117
726963800 48889210
75520118 940965095
216538172 226333728
37484464 257822964
176963532 40551...

output:

534497281344

result:

ok single line: '534497281344'

Test #40:

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

input:

1903 1081
136321384 177045011
796640569 963025423
624771025 56754376
88434181 928784397
570746021 944498906
881777377 676053540
974447206 743357317
185663511 568296411
165819206 475544857
27684915 536242166
937720091 887394471
174150162 908997153
844162016 650974548
877504388 964018292
216747329 982...

output:

780675823641

result:

ok single line: '780675823641'

Test #41:

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

input:

1844 934
674645872 767487197
149534365 477619004
842528138 909954194
896404992 296469563
599914334 163247581
344198027 548638994
831681272 389074144
433448521 853794142
571381395 791261992
329908759 34258628
784706958 622618804
7318097 200476931
718785037 616606604
790881514 567196599
658959476 9328...

output:

709878567556

result:

ok single line: '709878567556'

Test #42:

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

input:

1918 1422
296006954 746513821
505229061 478343420
816970753 985873192
381104413 782261712
471363589 120004333
796344005 697597569
425984727 488945205
704137911 391352166
250134053 384691207
269081918 129598416
283118797 880704946
981186898 343618893
310003762 491065265
616486801 353515771
27394709 3...

output:

892524947093

result:

ok single line: '892524947093'

Test #43:

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

input:

1800 1134
201231552 596778623
284377510 620146533
765426627 995350461
311396636 132073344
880523480 146156505
688353895 166547491
318553146 315219568
118852858 301065346
345751180 869953283
758437960 32184247
156204811 456017850
78106750 835201682
765369391 485175572
799617556 709947652
266786224 27...

output:

776535582089

result:

ok single line: '776535582089'

Test #44:

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

input:

1830 634
2969316 607026352
2691383 575132298
1571535 231920412
3029351 600807014
1051982 828408912
2542367 664018902
89397 867236510
2233743 202011042
1848214 156128926
1223237 490370593
2427517 744764983
438588 941753187
1583445 138250039
1795639 329784680
1308452 416272921
2639047 591878612
201102...

output:

448545322

result:

ok single line: '448545322'

Test #45:

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

input:

1942 637
899972 198218167
2954931 201040683
800277 506846680
788344 690139558
1034835 423416648
1471517 979809400
66475 822476314
1069083 393746162
3126436 890639168
2308309 880870004
1684513 595591425
2478896 523422225
172187 454207131
3018584 984485331
272550 53856343
1806418 808004788
1570652 815...

output:

421393038

result:

ok single line: '421393038'

Test #46:

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

input:

1991 622
1903253 705726893
954828 331797251
2651308 622083500
2535210 195911148
1942702 739333619
350283 170006790
814791 61191131
1973917 596558679
2314418 241248273
765446 663798637
1866018 560922246
162140 957633422
2313191 156143413
21613 854793063
2575225 4115342
2065086 208644885
1360123 97682...

output:

444591527

result:

ok single line: '444591527'

Test #47:

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

input:

1912 442
2262478 241661936
264240 661230245
1126672 416953596
3300016 44487587
3571356 525933857
4183756 458453415
4384495 254439161
401990 83228929
3501343 225825402
4126554 629367514
1275055 487124008
1048648 682937638
1096229 137908092
1403342 765982390
1371649 518348469
2644238 21495069
1335266 ...

output:

716905677

result:

ok single line: '716905677'

Test #48:

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

input:

1833 507
1716100 276726491
2842064 404977692
2465364 988118546
2801761 463229032
3934006 217746157
2638107 267104306
2647025 291694218
2863162 880333544
3074441 93924055
2508411 470199917
2033640 478044618
2085914 484761991
1598564 357810034
316812 613587379
1411262 668769397
1576780 489383020
11588...

output:

559444531

result:

ok single line: '559444531'

Test #49:

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

input:

1972 910
1558653 582887455
1375783 45782678
1419915 146261052
2154961 541723768
1163354 809755510
274964 868972503
1457043 912833641
435195 551818443
1850579 930020476
1385588 258592426
704381 956098142
1260829 464081671
1885459 950287673
873543 229078971
1690252 526781928
1332792 61844443
793950 46...

output:

117411795

result:

ok single line: '117411795'

Test #50:

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

input:

1946 851
324958 894415142
268099 533924488
529482 968042988
2211082 650722507
915457 699295068
1030661 942796135
686132 549443206
1365252 167776082
1495108 54948530
1971055 354910777
300621 195485190
1476709 26176346
1184396 210571019
543104 631102069
108498 728967639
862062 947346391
2088651 426838...

output:

164245809

result:

ok single line: '164245809'

Test #51:

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

input:

1935 899
1317250 689197885
134170 103924595
410102 306568671
240139 386035422
122789 617529011
2130665 684653704
1551610 466891902
1790198 541299784
360207 693529049
2020065 138167576
2004911 584765518
926153 345541552
995030 290242472
1119514 11681818
1281703 351926830
1934545 442318726
1834881 634...

output:

129847123

result:

ok single line: '129847123'

Test #52:

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

input:

1876 924
175745 244975794
1992757 130008836
1683484 19788024
1769247 567069963
1064826 178024105
1764315 648257650
2073501 837737536
358805 645348058
905166 809976952
479969 684636851
895943 31756483
1874702 625567337
2053669 517660013
1115605 195288329
2044918 383788081
788012 99654975
960117 75588...

output:

86497670

result:

ok single line: '86497670'

Test #53:

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

input:

1925 932
1392710 874745405
1482884 100318581
808325 622210203
424027 292889774
1462577 792296668
1900271 496010388
1164988 200804619
1654518 450232469
1188794 286412106
942192 333833477
1793162 981198171
897912 799890279
672832 286793563
25898 100715813
575777 184481843
961047 857529038
1247683 7947...

output:

112093854

result:

ok single line: '112093854'

Test #54:

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

input:

1962 1270
828306 688821211
409821 195395885
1234858 676847824
808367 351243591
288237 949222945
703558 656487532
701931 523190784
427820 498184904
469930 837368612
1390568 422025575
741561 842285962
143438 751039915
1295872 958175543
1037305 889196637
221175 233758439
1442238 675946953
1445805 19429...

output:

-260355185

result:

ok single line: '-260355185'

Test #55:

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

input:

1914 1408
868093 183892432
430527 435253023
745232 312812928
1027253 773788276
1037010 715384122
562801 201300097
1315430 95424837
1103172 102155034
1279909 371391762
737287 804153623
171101 476208378
1162390 634832262
103523 566568237
998347 827020774
545060 651311381
641287 639445678
966545 852911...

output:

-476655281

result:

ok single line: '-476655281'

Test #56:

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

input:

1890 1404
992695 660701853
608018 295587456
1109242 457340151
636938 166544520
31810 670239069
215094 874670003
1375890 30343203
967266 976285185
315206 162288196
532827 436391724
886869 196968670
850668 117501954
867147 588045323
302774 189293185
907667 285723337
1111996 294105106
1111805 920193502...

output:

-446740925

result:

ok single line: '-446740925'

Test #57:

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

input:

1873 1309
85090 875530166
434985 910617529
1451846 97775344
682421 81291523
131437 543572249
1193865 540096854
687963 287234375
1174502 358331717
94821 619447443
723130 896786899
1385117 527465684
321115 52998637
1051098 928729406
1444533 90303708
1079014 495507030
455135 474426380
204310 883744498
...

output:

-353115374

result:

ok single line: '-353115374'

Test #58:

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

input:

1872 1342
362368 77481885
343115 427567054
1302173 997997769
446510 954762782
1347226 352567056
34444 450812477
1063223 519680552
140045 888786129
622484 914585196
1325929 923595857
771725 273776137
652124 929321375
859695 789507500
695958 776625533
1132902 185097965
619453 599112724
1087991 6651240...

output:

-400986453

result:

ok single line: '-400986453'

Test #59:

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

input:

1835 719
292833 105273343
292833 105273357
292833 105273330
292833 105273378
292833 105273296
292833 105273358
292833 105273372
292833 105273346
292833 105273328
292833 105273369
292833 105273376
292833 105273392
292833 105273352
292833 105273300
292833 105273324
292833 105273355
292833 105273393
29...

output:

210546861

result:

ok single line: '210546861'

Test #60:

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

input:

1894 597
599281 178885100
599281 178885116
599281 178885089
599281 178885094
599281 178885079
599281 178885076
599281 178885151
599281 178885169
599281 178885110
599281 178885165
599281 178885095
599281 178885129
599281 178885143
599281 178885144
599280 178885117
599281 178885117
599281 178885169
59...

output:

357770707

result:

ok single line: '357770707'

Test #61:

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

input:

1910 728
442850 161197327
442850 161197288
442850 161197330
442850 161197276
442850 161197305
442850 161197252
442850 161197266
442850 161197248
442850 161197320
442850 161197257
442850 161197267
442850 161197333
442850 161197317
442850 161197275
442850 161197334
442850 161197317
442850 161197327
44...

output:

322394746

result:

ok single line: '322394746'

Test #62:

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

input:

1965 1070
284217 152055620
284217 152055631
284217 152055665
284217 152055704
284217 152055618
284217 152055614
284217 152055649
284217 152055667
284217 152055637
284217 152055623
284217 152055667
284217 152055661
284217 152055644
284217 152055678
284217 152055641
284217 152055641
284217 152055671
2...

output:

304112102

result:

ok single line: '304112102'

Test #63:

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

input:

1984 1080
264337 142741976
264338 142741914
264337 142741932
264337 142741912
264337 142741969
264337 142741944
264338 142741977
264338 142741990
264337 142741964
264337 142741908
264337 142741933
264337 142741965
264337 142741937
264337 142741912
264337 142741965
264338 142741972
264338 142741975
2...

output:

285484186

result:

ok single line: '285484186'

Test #64:

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

input:

1959 932
424605 197865503
424605 197865487
424605 197865557
424605 197865547
424605 197865549
424605 197865565
424605 197865510
424605 197865573
424605 197865476
424605 197865545
424605 197865539
424605 197865521
424605 197865483
424605 197865527
424605 197865550
424605 197865534
424605 197865520
42...

output:

395731784

result:

ok single line: '395731784'

Test #65:

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

input:

1904 528
623266 153157682
396934 125289853
552122 141559905
614352 182137831
626283 139511676
623220 153157691
555571 113491549
543665 158955198
390475 107955672
452618 181690982
554696 107429859
731474 165461342
457794 177484774
740719 194183076
455092 135450708
454838 114642962
595286 149883825
41...

output:

279977239

result:

ok single line: '279977239'

Test #66:

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

input:

1886 636
398199 127140840
433359 110271164
496114 186001837
566769 113675462
345180 152799694
459312 114766539
319129 102024643
614922 196086322
442477 191774184
488886 196195254
450247 125657897
390983 155672876
391873 194294891
450239 125657908
383214 194963218
317072 152315954
518990 118421514
35...

output:

255225170

result:

ok single line: '255225170'

Test #67:

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

input:

1934 497
677107 119135150
687160 195859863
515845 100049512
687199 195859832
461292 192495967
535348 183245951
768846 129205855
776481 110311024
553716 196585178
535280 183245907
747473 102434568
553879 134292180
484379 184662505
769705 180646363
717200 133003751
484371 184662511
407880 152392591
48...

output:

293622716

result:

ok single line: '293622716'

Test #68:

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

input:

1991 831
419605 186006811
346332 134464400
309714 111982925
351814 108295218
279316 136366566
331764 154376816
293902 178773100
370417 117959781
467290 127591317
460552 190636597
331759 154376814
271721 163665147
368542 183706884
470154 123515531
414935 128606450
368536 183706900
351889 108295285
41...

output:

248291304

result:

ok single line: '248291304'

Test #69:

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

input:

1895 865
397230 138651356
357309 191417384
304317 133850645
311714 117495455
283365 160203113
342564 128440999
338389 160126750
442582 127139908
341204 186988953
422518 114511410
294602 133708202
388768 133766585
440082 187421058
306742 185167536
450622 198938467
422558 114511405
351790 117011277
29...

output:

251043368

result:

ok single line: '251043368'

Test #70:

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

input:

1936 843
336648 197631798
246238 103061951
257266 144643819
426433 135148121
283053 196182684
335012 177287118
429234 189416003
463897 195265699
463897 195265710
393462 124202992
363849 199540198
283511 117249169
368565 156028071
456060 175503916
248338 181615832
336555 182722251
293322 144217396
47...

output:

246660794

result:

ok single line: '246660794'

Test #71:

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

input:

1911 413
3 1
5 10537
2 21073
8 31609
2 42145
2 52681
1 63217
5 73753
2 84289
10 94825
4 105361
9 115897
2 126433
10 136969
3 147505
4 158041
5 168577
3 179113
9 189649
7 200185
9 210721
8 221257
3 231793
1 242329
7 252865
2 263401
2 273937
2 284473
8 295009
2 305545
7 316081
7 326617
9 337153
10 347...

output:

-8679289

result:

ok single line: '-8679289'

Test #72:

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

input:

1982 1183
8 1
6 10944
5 21887
9 32830
4 43773
2 54716
2 65659
5 76602
5 87545
5 98488
6 109431
6 120374
6 131317
10 142260
7 153203
3 164146
3 175089
8 186032
6 196975
1 207918
7 218861
6 229804
6 240747
2 251690
4 262633
10 273576
9 284519
10 295462
8 306405
5 317348
8 328291
6 339234
6 350177
6 36...

output:

-25862535

result:

ok single line: '-25862535'

Test #73:

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

input:

1893 554
965216224 1
561924860 1
209493556 1
688911582 1
941907389 1
149224201 1
834808067 1
611896226 1
926611030 1
227238961 1
662922743 1
969673097 1
738968296 1
828034760 1
231387600 1
40187866 1
375158983 1
57423050 1
995076873 1
318755563 1
786086885 1
82655789 1
460279018 1
602367800 1
759775...

output:

470655279525

result:

ok single line: '470655279525'

Test #74:

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

input:

2000 2000
629072683 577857961
845364699 7537138
726536200 654427193
986957660 960915027
329622997 429777148
919912622 749856782
462945831 268399314
621097203 370540692
611438868 251578734
199626595 514547379
938414839 830984249
573354495 770234264
959946128 292709849
333062505 153270061
320702823 40...

output:

985658174474

result:

ok single line: '985658174474'

Subtask #3:

score: 76
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Test #75:

score: 76
Accepted
time: 702ms
memory: 77352kb

input:

186309 63889
870114140 55959266
286041175 118431791
832697141 327699683
770814026 875735883
839744128 267497093
169127351 165801123
857896391 977047691
278013870 916411205
598748477 991635138
764637970 366124123
221267468 669697237
409116360 189874150
886395302 919461729
196660688 747934278
71214059...

output:

52946019457724

result:

ok single line: '52946019457724'

Test #76:

score: 0
Accepted
time: 742ms
memory: 76016kb

input:

181224 39689
35595096 829547927
730693195 459923546
763244545 260141189
142211699 967919421
374895494 438900170
831246439 310086654
456299195 832843938
444752540 87916375
828223240 474864486
485057707 880285657
473395218 958126987
840588835 96808047
642749736 387211839
619868336 508664432
993548484 ...

output:

35348251751594

result:

ok single line: '35348251751594'

Test #77:

score: 0
Accepted
time: 654ms
memory: 77284kb

input:

186711 84868
239005330 475684633
486318407 794408296
147929943 670787123
710912367 870823476
161394632 450135743
236206751 141677383
864279839 734271979
5971534 762039581
421355152 204962711
538640397 350517227
804479067 466253126
559895683 176618691
268951203 783021500
267967699 147930620
649245336...

output:

65586993078859

result:

ok single line: '65586993078859'

Test #78:

score: 0
Accepted
time: 699ms
memory: 79936kb

input:

189516 78944
364578542 562258205
697238468 512493592
476274315 168332278
41043952 664723595
171498655 339662255
523250474 106589194
303052932 662281511
413348560 258521471
685722909 774693401
456367809 330679685
685173164 636857171
623655317 729387864
742475922 563014561
768468789 329347317
31841428...

output:

62564857204989

result:

ok single line: '62564857204989'

Test #79:

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

input:

190213 189912
187984943 462055347
496649436 8495540
953239891 190843741
451600493 663475176
699114730 250221776
409982875 219860098
775818252 405540285
105855235 584905205
736351614 638326368
411631137 531600395
544826707 337099277
77118595 239645621
320364732 368907799
904371936 989271400
730783941...

output:

95082531274170

result:

ok single line: '95082531274170'

Test #80:

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

input:

184749 171518
13043991 840811107
725687559 309879368
14429965 704825089
399794720 594958502
183639948 265495203
854950325 350551528
265560499 714222766
333562319 166887280
630673155 826251450
622009010 261688261
958123141 32517729
664030483 550888335
158938628 216864126
315181793 240736993
63733074 ...

output:

92022202858139

result:

ok single line: '92022202858139'

Test #81:

score: 0
Accepted
time: 388ms
memory: 65232kb

input:

188426 72614
12058 201780099
17839 518528108
19630 216016236
11843 915687893
2356 887191766
13383 879731573
23177 419413681
27398 945180704
23185 446655947
11822 550392699
13346 727970329
2238 497584055
18971 92485738
26460 72467503
12844 361798798
24342 312886272
10426 912424733
12295 839471105
457...

output:

252040987

result:

ok single line: '252040987'

Test #82:

score: 0
Accepted
time: 537ms
memory: 70980kb

input:

190944 42697
27001 166343433
392 965563195
8704 799770702
22608 501413831
33070 824650033
26878 524701466
25899 953583344
46208 400322499
31621 272581050
7227 462303078
36810 110674368
20333 562418217
31273 94551849
5453 188547700
29873 556942694
40617 254769566
40215 130746778
3493 269934175
34460 ...

output:

666760138

result:

ok single line: '666760138'

Test #83:

score: 0
Accepted
time: 456ms
memory: 69132kb

input:

197197 62806
8976 135103882
3029 972948352
26169 824259606
1193 737774228
21675 734348665
15713 405378616
28102 85313622
2108 827040701
17858 413354050
22633 859901425
36 901325553
24010 76365265
21837 49139259
12433 90835243
12880 705360760
8823 187881730
17730 950336691
19863 319830421
27522 95175...

output:

406760545

result:

ok single line: '406760545'

Test #84:

score: 0
Accepted
time: 482ms
memory: 70352kb

input:

196614 56806
9643 601658379
24686 522858880
19035 911664595
6012 677566503
6115 258577246
19737 199634311
6038 48421955
3346 357240491
5920 920292789
25828 120888057
26211 857245921
1974 380272819
12387 966270547
1846 764497570
2207 399726418
6469 293835935
14735 893391987
27179 68862524
26960 49465...

output:

480695144

result:

ok single line: '480695144'

Test #85:

score: 0
Accepted
time: 405ms
memory: 67292kb

input:

189987 71098
23536 192887617
23520 948591342
26800 298440783
7767 56112324
10231 256268656
5273 638351564
13090 888143175
19756 730651611
9189 285068191
19179 639575327
25435 592053312
2842 353595476
22653 914081152
26206 253201003
5103 337773210
24739 333291170
9904 303919052
10947 507220243
23324 ...

output:

273049352

result:

ok single line: '273049352'

Test #86:

score: 0
Accepted
time: 236ms
memory: 62116kb

input:

183636 106467
12597 380309103
17277 195566922
8 713555252
14272 836073035
6018 602336245
15688 760557205
1829 106916576
14328 450101048
1375 258924490
11917 442662098
9646 260414524
11164 507068484
2992 821151517
9112 639860044
15947 703063290
5869 402162507
12675 958680105
12001 886580716
3876 8359...

output:

-158291969

result:

ok single line: '-158291969'

Test #87:

score: 0
Accepted
time: 264ms
memory: 62180kb

input:

181258 98639
3583 928467120
12032 30193496
19458 546978022
19150 625013412
4469 526502259
13894 731920470
15422 171010044
6628 655094227
9576 987468710
8813 226996761
5631 702552507
19660 139266114
15802 148160137
9328 955749348
13146 569655702
13975 377891232
12368 454693424
2641 268492433
4309 360...

output:

-81198275

result:

ok single line: '-81198275'

Test #88:

score: 0
Accepted
time: 352ms
memory: 62612kb

input:

180038 75091
10514 19936602
16857 737218946
23201 390823267
3433 896842283
157 758234350
12366 302674005
21617 591863807
25780 539608656
20358 153194610
14465 463165296
23931 678242978
6844 166156109
23415 205581338
17 449938642
22080 522391865
21857 771836297
1928 921188628
23458 818756460
19458 61...

output:

177874084

result:

ok single line: '177874084'

Test #89:

score: 0
Accepted
time: 324ms
memory: 64872kb

input:

190087 90525
13118 957260478
15163 636567445
17027 628811589
1086 664050179
20994 557930079
7398 904425413
21976 305262911
2927 582499928
7541 980748680
13694 580368692
9200 486107271
11479 972288118
7102 115510333
10106 934871843
11856 265875493
17462 555030762
3796 435330357
3607 75872925
2845 293...

output:

52143913

result:

ok single line: '52143913'

Test #90:

score: 0
Accepted
time: 255ms
memory: 66876kb

input:

198799 116409
6302 403099167
6292 231007499
9862 453060290
8831 744097180
11494 486462823
5577 69688939
12993 553706867
16659 198316604
6235 904257855
12804 847312459
14901 685195314
285 522811759
16253 359943819
2350 437991824
16362 51691869
9029 833863214
2737 922416829
11316 105560129
3267 480263...

output:

-169913053

result:

ok single line: '-169913053'

Test #91:

score: 0
Accepted
time: 175ms
memory: 61940kb

input:

183958 132971
487 477659543
12045 275874026
12926 205761300
917 573903995
11591 251943184
9066 212832075
11515 497395456
8141 545547254
534 199147042
12712 15085795
4966 957899583
160 450918872
9344 14836463
7950 27536357
9258 423120742
3185 996311329
8047 519209747
4624 249107074
607 577821017
1378...

output:

-442075069

result:

ok single line: '-442075069'

Test #92:

score: 0
Accepted
time: 176ms
memory: 59896kb

input:

182484 128458
2036 254306389
3997 414982653
1433 774848734
12663 794694189
13564 53359228
12619 284214097
1487 869913273
6195 498845384
9863 305568268
8000 252152411
2646 294447199
14334 118697453
13778 326171650
15074 892353826
13740 994569601
7624 109527707
13093 963619556
9894 571055345
7007 6384...

output:

-404553190

result:

ok single line: '-404553190'

Test #93:

score: 0
Accepted
time: 211ms
memory: 63564kb

input:

190272 124491
3646 421774450
14143 357418491
151 930570962
13679 631920391
15088 749569077
3937 758053429
3927 840774680
243 617470499
10593 345619546
2261 500259142
6163 37006337
5792 660099537
3833 551141165
8699 241992580
8997 845801187
660 286367441
9316 479985941
6919 776018402
9009 634988819
1...

output:

-302722037

result:

ok single line: '-302722037'

Test #94:

score: 0
Accepted
time: 151ms
memory: 64804kb

input:

198642 158840
7203 384184031
5790 64966149
1365 783076718
6173 76920278
7463 736915412
2927 295510816
2456 732448664
10953 494249819
5702 130515591
5287 578459579
11165 163535347
1965 767353659
11126 361038000
6461 318625998
354 405644212
2377 793857068
873 159325661
2202 880314202
1448 94552159
966...

output:

-599744193

result:

ok single line: '-599744193'

Test #95:

score: 0
Accepted
time: 248ms
memory: 66392kb

input:

198995 120167
1811 420303187
1887 523930002
1358 215018797
3108 387632635
13837 163540248
11553 254918065
2757 925049662
10989 146372898
11480 378825759
3487 606899085
11474 264122701
7785 306099770
10977 404239991
6988 98621389
5780 411312590
10942 984369731
11367 939500411
11560 639145820
6657 158...

output:

-208016881

result:

ok single line: '-208016881'

Test #96:

score: 0
Accepted
time: 57ms
memory: 9656kb

input:

184884 66328
5694 188831609
5694 188831651
5694 188831642
5694 188831627
5694 188831609
5694 188831649
5694 188831647
5694 188831680
5694 188831588
5694 188831680
5694 188831596
5694 188831596
5694 188831653
5694 188831673
5694 188831626
5694 188831604
5694 188831599
5694 188831662
5694 188831612
56...

output:

377671582

result:

ok single line: '377671582'

Test #97:

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

input:

199483 73635
4414 162511099
4414 162511097
4414 162511097
4414 162511101
4414 162511050
4414 162511046
4414 162511073
4414 162511062
4414 162511073
4414 162511094
4414 162511121
4414 162511046
4414 162511120
4414 162511099
4414 162511063
4414 162511069
4414 162511077
4414 162511092
4414 162511068
44...

output:

325024834

result:

ok single line: '325024834'

Test #98:

score: 0
Accepted
time: 58ms
memory: 9712kb

input:

196554 65008
5144 167171648
5144 167171633
5144 167171575
5144 167171579
5144 167171575
5144 167171636
5144 167171606
5144 167171636
5144 167171640
5144 167171651
5144 167171596
5144 167171599
5144 167171643
5144 167171618
5144 167171607
5144 167171631
5144 167171595
5144 167171644
5144 167171578
51...

output:

334401098

result:

ok single line: '334401098'

Test #99:

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

input:

196969 81723
3525 144016256
3525 144016254
3525 144016266
3525 144016251
3525 144016202
3525 144016273
3525 144016200
3525 144016253
3525 144016187
3525 144016254
3525 144016259
3525 144016277
3525 144016280
3525 144016224
3525 144016205
3525 144016211
3525 144016243
3525 144016250
3525 144016273
35...

output:

288073509

result:

ok single line: '288073509'

Test #100:

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

input:

185753 93838
3536 165871900
3536 165871961
3536 165871876
3536 165871941
3536 165871895
3536 165871933
3536 165871921
3536 165871958
3536 165871910
3536 165871874
3536 165871908
3536 165871902
3536 165871913
3536 165871913
3536 165871889
3536 165871965
3536 165871932
3536 165871888
3536 165871888
35...

output:

331811082

result:

ok single line: '331811082'

Test #101:

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

input:

185779 88823
2541 112805294
2541 112805246
2541 112805258
2541 112805240
2541 112805305
2541 112805279
2541 112805240
2541 112805314
2541 112805314
2541 112805253
2541 112805251
2541 112805279
2541 112805327
2541 112805267
2541 112805279
2541 112805295
2541 112805246
2541 112805239
2541 112805253
25...

output:

225699175

result:

ok single line: '225699175'

Test #102:

score: 0
Accepted
time: 263ms
memory: 53276kb

input:

185890 47398
8199 131752475
6240 162735263
8064 121087750
7862 197391059
5550 162644061
7264 123245183
7747 121879620
6140 157823361
5939 184827168
5772 162669032
5640 129964826
5580 157808466
5447 115379015
6632 156951237
4525 174789464
4948 164096945
5419 102143276
4810 108341413
7079 123583954
59...

output:

290459635

result:

ok single line: '290459635'

Test #103:

score: 0
Accepted
time: 259ms
memory: 54256kb

input:

183287 53774
7105 171799751
5369 155839199
7288 172189153
5126 105734974
4446 182572502
6006 141745606
4661 197461951
7339 170357412
7251 172189215
6007 141745625
5971 181440661
4332 114103304
6411 151368848
6610 110470269
5506 164954156
4944 114001535
7104 123450814
4605 141165092
7147 171799783
72...

output:

268347371

result:

ok single line: '268347371'

Test #104:

score: 0
Accepted
time: 300ms
memory: 56368kb

input:

193324 39822
6539 192954744
8702 150204628
6784 144008827
6666 197243498
5166 124589386
5072 124168703
7125 106700632
8861 198186981
5578 199911980
8633 100439733
6540 192954757
7524 144474168
8461 172790740
8443 133956413
6649 120862585
9939 120262950
5600 187864140
7126 106700638
9920 101905500
64...

output:

288866392

result:

ok single line: '288866392'

Test #105:

score: 0
Accepted
time: 206ms
memory: 53740kb

input:

192651 84926
2876 138898929
2867 161190835
2806 180617892
3151 110409697
2446 147442633
3403 118090692
2850 135955572
2826 135955617
2793 161190876
3965 193431166
2378 147382621
2964 109929529
3377 128844686
2900 135955541
3130 191237959
3934 124942187
3877 180230445
3249 149951269
4697 107585756
38...

output:

230339617

result:

ok single line: '230339617'

Test #106:

score: 0
Accepted
time: 215ms
memory: 54316kb

input:

197577 90129
4140 179573081
3915 140531054
3035 100378787
4465 123139770
3722 112159663
2283 101036173
3602 188374274
2361 121445488
4292 132232398
4433 167580471
3499 163193628
2572 161197686
4445 153364469
4072 179573098
3867 163365956
2432 140734832
3671 124740394
4281 133840233
3736 181546855
44...

output:

240642791

result:

ok single line: '240642791'

Test #107:

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

input:

190697 98962
4064 158590455
4008 126255630
2814 189835442
2744 154287017
3579 186246743
2545 100995493
3104 166104504
3305 147389435
3979 126255594
2156 117337386
3362 138045859
2595 186136845
3282 122050717
3152 166104462
2711 162248653
3808 128188709
4113 158590409
3005 121108668
3465 151564234
27...

output:

219299268

result:

ok single line: '219299268'

Test #108:

score: 0
Accepted
time: 630ms
memory: 79620kb

input:

188658 89168
52222993 894404161
70533027 850460258
89520891 97980542
79385917 925849053
88389139 831658426
7139737 939033349
47392219 743155706
46745397 843226520
63170209 183909107
24157212 423186212
48097555 15320058
84059491 257517997
35975091 252109960
47562741 42384843
15016606 153823570
919970...

output:

6817621401933

result:

ok single line: '6817621401933'

Test #109:

score: 0
Accepted
time: 492ms
memory: 84428kb

input:

199878 127528
81045017 520205145
48529667 669954883
57396701 912695109
50716316 4815874
65762549 597247682
60615581 258193952
21595170 214295740
33307336 339731119
43152026 945681046
27088763 252167166
83849095 412403448
60335052 385844230
91695850 496029709
23380442 902147180
99592264 613750457
236...

output:

8695154002312

result:

ok single line: '8695154002312'

Test #110:

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

input:

186991 95301
10 1
2 5348
2 10695
5 16042
3 21389
5 26736
3 32083
2 37430
4 42777
2 48124
2 53471
8 58818
4 64165
2 69512
6 74859
6 80206
7 85553
8 90900
4 96247
3 101594
8 106941
2 112288
4 117635
3 122982
1 128329
10 133676
5 139023
4 144370
10 149717
9 155064
7 160411
8 165758
3 171105
1 176452
5 ...

output:

-1018611926

result:

ok single line: '-1018611926'

Test #111:

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

input:

189020 49413
3 1
10 5291
3 10581
4 15871
8 21161
10 26451
7 31741
5 37031
4 42321
3 47611
9 52901
8 58191
3 63481
10 68771
1 74061
8 79351
10 84641
1 89931
9 95221
3 100511
7 105801
3 111091
5 116381
1 121671
9 126961
9 132251
5 137541
8 142831
9 148121
8 153411
2 158701
6 163991
1 169281
1 174571
5...

output:

-522505662

result:

ok single line: '-522505662'

Test #112:

score: 0
Accepted
time: 491ms
memory: 76376kb

input:

180514 61146
226210011 1
206809312 1
422630348 1
50057077 1
142924420 1
718367335 1
51375229 1
637054010 1
930480553 1
526565367 1
698111079 1
683276872 1
784109978 1
549529481 1
514260371 1
472746061 1
878249853 1
699697225 1
557395794 1
24214570 1
213154772 1
209518956 1
505169470 1
425012306 1
13...

output:

50771842295283

result:

ok single line: '50771842295283'

Test #113:

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

input:

200000 200000
504097126 727407648
795072191 317601092
984448610 344358185
952029023 952267200
975242528 746629406
940510279 95204896
124474215 795786816
513855366 374314043
48508804 758062295
803885533 995972080
404477672 246597353
79954789 408821112
86460302 943206759
906176379 592395293
340642241 ...

output:

99973465361197

result:

ok single line: '99973465361197'

Extra Test:

score: 0
Extra Test Passed