QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#891315#9918. Master of Both VIjryggsAC ✓1069ms490164kbC++143.2kb2025-02-09 13:04:062025-02-09 13:04:07

Judging History

This is the latest submission verdict.

  • [2025-02-09 13:04:07]
  • Judged
  • Verdict: AC
  • Time: 1069ms
  • Memory: 490164kb
  • [2025-02-09 13:04:06]
  • Submitted

answer

#include <bits/stdc++.h>
using namespace std;
const int N=5e5+5;
inline int read(){
	int x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9')x=(x<<3)+(x<<1)+(ch^48),ch=getchar();
	return x*f;
}
int n,q,d[N],f[20][N<<1],cnt,dfn[N],fa[N],root[N],tot,ans,lim,res[N];
struct matrix{
	long long f[2][2];
	inline matrix operator*(const matrix b){
		matrix c;
		c.f[0][0]=min(f[0][0]+b.f[0][0],f[0][1]+b.f[1][0]);
		c.f[0][1]=min(f[0][0]+b.f[0][1],f[0][1]+b.f[1][1]);
		c.f[1][0]=min(f[1][0]+b.f[0][0],f[1][1]+b.f[1][0]);
		c.f[1][1]=min(f[1][0]+b.f[0][1],f[1][1]+b.f[1][1]);
		return c;
	}
}now;
vector<int>e[N];
inline void dfs1(int x){
	f[0][++cnt]=x;dfn[x]=cnt;
	for(auto y : e[x]){
		if(y!=fa[x])fa[y]=x,d[y]=d[x]+1,dfs1(y),f[0][++cnt]=x;
	}
}
inline int lca(int x,int y){
	x=dfn[x],y=dfn[y];
	if(x>y)swap(x,y);
	int k=__lg(y-x+1);
	if(d[f[k][x]]<d[f[k][y-(1<<k)+1]])return f[k][x];
	return f[k][y-(1<<k)+1];
}
char op[5];
vector<pair<int,int>>v[N],w[N];
struct tree{
	int lc,rc,siz;
	matrix a;
}t[N*20];
#define mid (l+r>>1)
inline void up(int p){
	t[p].a=t[t[p].lc].a*t[t[p].rc].a;
	t[p].siz=t[t[p].lc].siz+t[t[p].rc].siz;
}
inline void insert(int&p,int l,int r,int pos,int v){
	if(!p)p=++tot;
	if(l==r){
		if(v){
			t[p].siz=1,t[p].a.f[0][0]=t[p].a.f[1][0]=v,t[p].a.f[0][1]=v/2;t[p].a.f[1][1]=1e18;
		}
		else{
			t[p].siz=0;t[p].a.f[0][0]=t[p].a.f[1][1]=0;t[p].a.f[0][1]=t[p].a.f[1][0]=1e18;
		}
		return;
	}
	if(pos<=mid)insert(t[p].lc,l,mid,pos,v);
	else insert(t[p].rc,mid+1,r,pos,v);
	up(p);
}
inline void query(int p,int l,int r,int pos){
	if(r<=pos){
		auto g = t[p].a*now;
		for(int i = 0;i<2;i++)for(int j = 0;j<2;j++)if(g.f[i][j]<lim){
			// if(pos==4)cerr<<"?"<<l<<' '<<r<<' '<<t[p].siz<<' '<<i<<' '<<j<<' '<<g.f[i][j]<<endl;
			ans+=t[p].siz;
			now=g;
			return;
		}
	}
	if(l==r){
		lim=0;
		return;
	}
	if(pos>mid)query(t[p].rc,mid+1,r,pos);
	if(lim)query(t[p].lc,l,mid,pos);
	if(r<=pos)lim=0;
}
inline int merge(int p,int q,int l,int r){
	if(!p||!q)return p|q;
	if(l==r)return p;
	t[p].lc=merge(t[p].lc,t[q].lc,l,mid),t[p].rc=merge(t[p].rc,t[q].rc,mid+1,r);
	up(p);
	return p;
}
#undef mid
inline void dfs2(int x){
	for(auto y : e[x])if(y!=fa[x])dfs2(y),root[x]=merge(root[x],root[y],1,q);
	for(auto[i,y]:v[x]){
		insert(root[x],1,q,i,y);
	}
	for(auto[i,y]:w[x]){
		lim=y;
		ans=0;
		now.f[0][0]=now.f[1][1]=0,now.f[0][1]=now.f[1][0]=1e18;
		query(root[x],1,q,i);
		res[i]=ans;
	}
}
int main(){
	// freopen(".in","r",stdin);
	// freopen(".out","w",stdout);
	t[0].a.f[0][0]=t[0].a.f[1][1]=0;t[0].a.f[0][1]=t[0].a.f[1][0]=1e18;
	n=read(),q=read();
	for(int i = 1,x,y;i<n;i++)x=read(),y=read(),e[x].push_back(y),e[y].push_back(x);
	dfs1(1);
	for(int j = 1;j<=__lg(cnt);j++){
		for(int i = 1;i+(1<<j)-1<=cnt;i++){
			if(d[f[j-1][i]]<d[f[j-1][i+(1<<j-1)]])f[j][i]=f[j-1][i];
			else f[j][i]=f[j-1][i+(1<<j-1)];
		}
	}
	int x,y,z;
	for(int i = 1;i<=q;i++){
		scanf("%s",op);x=read(),y=read();
		if(op[0]=='A')z=read()*2,v[x].push_back({i,z}),v[y].push_back({i,z}),v[fa[lca(x,y)]].push_back({i,0}),res[i]=-1;
		else w[x].push_back({i,y*2});
	}
	dfs2(1);
	for(int i = 1;i<=q;i++)if(res[i]>=0)printf("%d\n",res[i]);
	return 0;
}

这程序好像有点Bug,我给组数据试试?

詳細信息

Test #1:

score: 100
Accepted
time: 8ms
memory: 51036kb

input:

5 7
1 2
1 3
2 4
2 5
A 1 4 2
A 3 5 2
D 1 4
D 2 3
D 2 1
A 5 5 10
D 5 100

output:

2
1
0
2

result:

ok 4 number(s): "2 1 0 2"

Test #2:

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

input:

1000 1000
207 718
577 65
896 570
162 859
772 773
232 875
399 281
699 940
999 967
694 679
833 455
175 393
96 836
217 459
178 298
84 251
731 183
388 454
94 550
396 574
472 456
476 652
63 994
746 941
731 957
399 937
523 405
453 558
160 225
156 130
795 830
173 206
736 878
660 968
373 40
687 115
988 96
3...

output:

0
0
0
0
0
1
0
0
0
0
0
0
1
0
0
0
0
0
1
1
0
2
0
1
0
0
0
0
0
0
0
3
1
0
1
0
0
0
1
0
0
0
0
0
0
1
5
0
1
3
2
0
0
0
1
37
3
0
0
1
1
0
0
2
3
0
1
0
0
0
2
0
0
0
0
1
2
0
0
0
0
1
0
1
1
3
1
0
1
1
0
1
3
2
1
1
1
0
0
0
3
0
2
10
0
0
0
1
0
1
4
40
1
1
0
0
0
0
0
0
14
3
0
0
0
12
10
0
0
4
0
1
0
16
1
9
1
1
1
1
0
0
0
0
1
0
2...

result:

ok 291 numbers

Test #3:

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

input:

1000 1000
427 798
624 799
90 732
49 379
147 783
232 512
50 325
157 193
400 121
922 582
703 316
68 112
428 967
828 464
917 408
95 450
330 773
343 102
338 232
757 656
875 181
411 670
283 197
33 815
759 751
186 656
282 28
32 65
725 277
80 783
195 715
831 593
999 292
79 366
601 168
912 306
910 623
986 5...

output:

0
0
0
0
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
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
1
0
0
0
0
0
5
0
1
6
0
4
0
0
1
1
0
0
0
0
0
0
2
0
0
0
0
5
0
0
0
0
10
0
0
1
0
0
8
0
3
0
0
0
0
0
0
1
0
0
1
2
0
1
0
1
8
6
0
0
1
0
0
0
0
1
23
7
6
0
0
0
0
2
3
0
0
0
0
0
0
0
7
0
0
13
3
0
0
3
0
1...

result:

ok 688 numbers

Test #4:

score: 0
Accepted
time: 8ms
memory: 64008kb

input:

1000 1000
513 807
509 379
639 681
223 92
336 460
585 286
984 861
195 575
14 275
131 606
286 670
379 584
723 679
809 242
162 661
675 787
987 481
549 452
246 985
695 433
207 748
7 291
131 23
199 635
165 692
957 577
196 668
633 369
853 121
873 321
84 984
984 668
471 465
403 364
773 20
575 114
379 842
1...

output:

0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
25
0
0
0
0
0
0
0
0
0
28
0
5
1
0
0
0
0
1
0
0
1
0
0
1
4
0
1
1
1
1
0
1
3
29
7
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
3
2
0
0
1
1
1
0
0
6
0
0
15
1
0
0
0
1
0
0
0
0
1
0
29
0
0
0
4
2
6
2
3
1
0
0
0
1
0
1
0
6
1
1
9
1
1
0
0
1
1
1
0
1...

result:

ok 197 numbers

Test #5:

score: 0
Accepted
time: 13ms
memory: 84556kb

input:

10000 10000
3335 9215
4442 3953
4909 2718
557 4173
484 7426
1543 9228
982 713
9240 5532
1931 6593
1797 3915
2098 2732
4379 1320
2665 4937
4385 7373
3339 7950
2461 6959
7449 7890
4320 939
8220 2051
2687 2342
9762 819
8807 2564
8882 7491
6656 2719
3283 524
5419 7011
1414 6872
7941 598
3532 9258
7028 2...

output:

0
0
0
0
0
0
0
0
0
0
0
0
9
1
0
0
0
21
0
0
1
0
0
0
0
0
0
6
0
0
0
0
0
0
0
0
0
0
0
0
2
0
0
7
0
0
0
0
0
0
0
0
1
18
1
0
0
0
0
13
0
0
0
0
0
0
0
0
0
0
0
0
0
0
30
0
0
0
1
0
0
2
0
1
0
0
26
0
0
1
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
0
0
0
0
0
0
0
1
1
0
0
0
11
0
0
0
1
0
1
1
1
1
2
0
1
0
0
1
1
0
3
0
0
1
0
0
0
0
0
0
0
0
...

result:

ok 2026 numbers

Test #6:

score: 0
Accepted
time: 744ms
memory: 408952kb

input:

500000 300000
399483 479271
193702 283902
12130 70703
246787 372203
315464 31062
430169 397641
305901 159665
342062 53607
307642 133991
250471 94362
428349 161026
405227 469292
448025 364389
470062 235522
49887 5517
398643 47096
384090 226677
52164 177837
75469 390343
309326 227610
237477 400310
109...

output:

0
0
25339

result:

ok 3 number(s): "0 0 25339"

Test #7:

score: 0
Accepted
time: 168ms
memory: 86612kb

input:

10 300000
2 7
6 1
10 6
4 9
3 1
3 9
8 2
7 5
5 10
A 4 6 143
D 3 37
D 1 152
A 4 10 69
D 3 42
A 2 10 230
A 9 9 65
D 7 101
D 1 214
D 1 105
A 5 8 93
A 4 2 103
D 6 267
A 1 9 174
A 10 2 274
D 9 313
A 3 3 15
A 10 10 295
A 2 8 160
D 1 170
D 10 123
D 2 397
D 6 234
A 3 9 273
D 4 101
D 1 50
A 2 8 94
D 3 295
A 3 ...

output:

0
1
1
0
2
1
3
4
1
0
2
3
1
0
3
8
1
0
1
6
4
9
5
7
5
4
0
3
0
5
12
5
2
12
7
11
6
3
4
0
8
5
2
4
2
7
18
1
22
0
17
2
17
18
3
18
13
10
2
10
6
26
3
2
26
16
30
3
21
1
26
15
8
6
1
5
7
39
41
33
42
1
10
29
0
28
19
33
8
35
1
36
29
20
5
27
7
15
32
15
34
15
18
32
48
6
14
50
20
2
36
17
61
12
11
36
43
44
36
37
53
54
...

result:

ok 150161 numbers

Test #8:

score: 0
Accepted
time: 296ms
memory: 189032kb

input:

200 300000
193 53
53 13
131 53
27 59
53 24
53 200
53 134
53 107
18 53
53 111
146 53
53 93
122 187
45 105
118 53
176 45
78 53
53 30
19 187
53 61
53 45
62 187
135 53
46 45
42 45
84 53
95 175
53 82
53 6
53 1
109 45
53 124
53 23
53 136
45 196
53 58
130 53
53 175
185 45
15 53
3 53
2 45
53 137
155 187
187...

output:

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
1
0
0
0
0
0
0
1
0
0
0
1
0
1
0
23
0
0
0
0
0
0
0
0
0
2
1
0
0
0
0
0
0
0
0
0
0
2
0
0
1
0
0
0
0
1
0
0
0
0
0
0
0
4
3
0
0
2
0
0
0
0
1
0
0
3
1
1
1
1
0
0
0
1
1
0
1
0
0
0
0
0
0
2
0
0
1
2
1
0
2
0
1
1
0
1
1
0
0
2
0
0
2
0
1
2
0
1
1
0
2
8
3
0
1
2
2
0
1...

result:

ok 149982 numbers

Test #9:

score: 0
Accepted
time: 1069ms
memory: 490164kb

input:

500000 300000
450515 252615
97905 89580
315904 452323
384993 309259
421705 472508
266163 18626
73146 142695
482484 26084
478758 216701
307624 188015
14704 365604
319560 155632
260006 118024
220476 357068
428935 18766
51935 486719
181705 39160
18948 397498
27319 349643
460883 448261
194809 385526
102...

output:

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
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
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
18
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
0
0
0
0...

result:

ok 89929 numbers

Test #10:

score: 0
Accepted
time: 918ms
memory: 397556kb

input:

500000 300000
335329 130620
358543 283718
7414 76053
194973 461339
2351 360684
324888 440785
44024 203156
362192 335640
6253 317282
241071 456334
285522 103570
459026 286605
301235 85048
2284 448280
308619 68519
198219 22753
29984 188066
324132 233980
411464 222372
92842 43751
416749 52279
373698 14...

output:

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
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
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
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 149987 numbers

Test #11:

score: 0
Accepted
time: 860ms
memory: 390488kb

input:

500000 300000
395849 115706
314267 174845
103167 246178
476131 146137
387350 234057
413491 92923
94544 414167
188691 319978
455645 437007
117415 181775
230821 395975
962 406363
417668 17223
133416 75758
225613 272382
340320 119624
254428 212247
458303 157097
349909 285383
125152 327308
263971 27368
...

output:

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
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
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
2
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
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
...

result:

ok 150302 numbers

Test #12:

score: 0
Accepted
time: 826ms
memory: 388020kb

input:

500000 300000
110037 369017
280899 96509
392533 421597
41411 469912
302957 314016
108809 452186
328195 135893
241792 214151
390970 123810
160350 494865
26558 29180
148904 496738
349623 424081
199992 314199
375697 429128
9187 91670
326303 479478
120993 411344
361596 58485
236238 32604
421288 354645
2...

output:

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
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
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
5
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
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 149871 numbers

Test #13:

score: 0
Accepted
time: 836ms
memory: 349384kb

input:

500000 300000
20610 458083
235214 371917
68288 155464
329472 338067
264631 339784
130278 197304
312493 364490
434340 473421
240073 381370
196169 445652
333202 160622
206123 333531
450460 331773
291742 157512
309669 183864
318578 432628
144119 262397
475911 51392
458500 476406
218164 340003
39954 451...

output:

0
0
0
0
0
0
0
1
2
1
0
0
0
0
0
3
1
0
0
0
8
0
7
0
0
0
1
0
0
2
12
2
3
0
0
0
11
13
0
0
16
0
5
0
0
15
1
4
6
0
0
0
8
0
0
0
0
0
5
0
0
7
31
0
28
0
0
0
0
0
0
0
0
2
0
39
0
0
0
0
0
0
0
0
35
0
3
6
15
5
41
0
0
30
0
0
0
17
36
29
43
0
0
0
40
0
0
10
0
5
0
31
0
0
0
0
8
0
22
9
29
0
13
45
14
37
20
0
0
0
4
0
0
0
0
0
58...

result:

ok 150245 numbers

Test #14:

score: 0
Accepted
time: 757ms
memory: 415160kb

input:

500000 300000
231622 397279
249092 201699
314173 386432
224729 167220
392566 494625
200640 429360
413325 356174
77379 27625
291517 230564
341048 128076
17253 69009
373437 356588
366429 81981
59035 211324
49766 257902
264669 173547
330757 203045
52807 213454
119417 230739
444411 1454
136740 209132
48...

output:

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

result:

ok 150358 numbers

Test #15:

score: 0
Accepted
time: 710ms
memory: 421780kb

input:

500000 300000
454731 430540
258607 249501
333580 404748
5599 266007
32459 382027
54646 65423
6931 315356
409313 396656
279087 79111
283001 118560
357078 64021
175961 259110
316593 225517
395678 220568
19908 161639
497210 93100
108996 143905
372238 51274
451739 297667
309179 471820
411295 270714
3081...

output:

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

result:

ok 149916 numbers

Test #16:

score: 0
Accepted
time: 562ms
memory: 314048kb

input:

500000 300000
39130 55321
140343 250717
200592 371292
167690 58999
117154 23340
371852 429825
188239 285905
351451 390505
200410 62948
482750 13525
219059 72485
184672 20226
64916 235851
364003 330058
202499 387374
349479 82528
414913 372275
200213 105255
389409 310978
105194 30396
114507 458397
182...

output:

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

result:

ok 210051 numbers

Test #17:

score: 0
Accepted
time: 720ms
memory: 409700kb

input:

500000 300000
373167 181496
105488 380128
153998 125748
172601 386396
438049 121492
75276 438471
232528 255765
214892 70385
166924 83072
46843 342998
191016 146285
170531 152697
485021 75506
316398 388803
324307 37840
394122 3422
433545 27859
192837 316357
328523 403002
472535 334679
221210 355925
2...

output:

0
0
0
257705

result:

ok 4 number(s): "0 0 0 257705"

Test #18:

score: 0
Accepted
time: 721ms
memory: 410504kb

input:

500000 300000
107800 425518
444232 136783
385152 477723
195559 381857
16526 498341
19428 172056
305652 293263
138270 290471
103042 84385
109320 457721
177392 126671
28286 124199
236805 324850
185808 275963
82215 305940
390064 148317
298885 496361
219342 357960
295133 480109
324942 247281
73828 47504...

output:

0
0
0
0
0
0
58029

result:

ok 7 numbers

Test #19:

score: 0
Accepted
time: 751ms
memory: 407896kb

input:

500000 300000
307587 46192
362430 205256
20747 291883
11812 124653
66188 423871
170375 477175
486604 463798
433077 340553
106739 386030
337890 450046
409116 80057
268499 439650
162879 305735
415103 416554
330539 234135
486319 220239
35720 420777
139924 300517
103379 205866
27865 423795
282216 39025
...

output:

0
0
0
0
150217

result:

ok 5 number(s): "0 0 0 0 150217"

Test #20:

score: 0
Accepted
time: 728ms
memory: 409572kb

input:

500000 300000
350538 418702
482139 497408
206289 677
321345 7494
60508 120895
49543 28202
147826 370458
200734 182058
363502 394653
208199 304677
308372 432323
171504 440026
210818 274754
57064 228957
343312 317598
306131 241211
288781 462508
418314 39794
447507 53419
315184 174064
204377 318179
389...

output:

0
93254

result:

ok 2 number(s): "0 93254"

Test #21:

score: 0
Accepted
time: 757ms
memory: 410484kb

input:

500000 300000
246367 131276
183101 176934
298674 75899
297703 227957
340139 257414
44832 405044
427383 253319
261982 414626
341444 444274
207373 413919
487724 67985
370999 266701
307124 386962
492120 256136
264652 482969
404429 176056
178428 203880
163291 93321
112814 91581
149006 252263
58186 32507...

output:

0
0
173851

result:

ok 3 number(s): "0 0 173851"

Test #22:

score: 0
Accepted
time: 795ms
memory: 409892kb

input:

500000 300000
69838 403807
455208 289226
426931 80195
98264 460883
278000 489500
77072 260101
98188 298351
212089 202044
399071 452992
393804 169809
49947 446376
332765 26308
79801 418974
366473 165477
490819 228887
35434 10595
338608 151658
102436 172349
409029 349188
435660 163077
479814 464238
31...

output:

0
0
0
23086

result:

ok 4 number(s): "0 0 0 23086"

Test #23:

score: 0
Accepted
time: 810ms
memory: 408984kb

input:

500000 300000
289307 313920
456929 441870
22147 391682
435056 279549
488471 479605
209041 381177
155771 104376
351014 416340
97881 146692
1601 343022
67751 352944
487718 210859
256761 123500
489820 4351
77531 125808
295247 60902
395436 166468
404887 352616
497219 11648
303526 346934
230063 478366
24...

output:

0
0
73
0
222521

result:

ok 5 number(s): "0 0 73 0 222521"

Test #24:

score: 0
Accepted
time: 789ms
memory: 408340kb

input:

500000 300000
112869 185570
439172 397983
303806 371381
177573 175257
471193 423004
314411 244903
302758 464701
455482 82481
446068 178692
10721 250261
175480 97899
128433 168320
365681 302914
400840 146115
293057 113566
456581 315188
135725 231259
91955 430274
446694 255947
465446 213650
117537 231...

output:

0
0
0
54259

result:

ok 4 number(s): "0 0 0 54259"

Test #25:

score: 0
Accepted
time: 762ms
memory: 409224kb

input:

500000 300000
321925 256025
60 425280
325980 394195
257175 51637
197458 328514
284437 185883
248518 308163
463358 302135
427644 348733
466239 156900
15964 205754
249478 83324
19861 394043
273701 10501
461400 348393
356655 83697
498445 191735
212930 366058
37551 440842
34237 287773
354089 235263
4038...

output:

279293

result:

ok 1 number(s): "279293"

Test #26:

score: 0
Accepted
time: 785ms
memory: 409732kb

input:

500000 300000
426972 181941
2368 162784
372057 298836
184449 473464
360286 449141
178617 463662
308898 412986
10506 455334
72251 73668
1923 151068
16475 210959
477932 30279
94010 463010
377907 463185
474264 213599
272042 247550
494915 66093
22883 20944
121091 466697
443939 408610
28803 260495
277399...

output:

0
0
0
0
0
162627

result:

ok 6 numbers

Test #27:

score: 0
Accepted
time: 784ms
memory: 407688kb

input:

500000 300000
371979 133881
261365 284633
454575 83954
157395 409805
469758 178705
448766 142425
32746 93910
292280 65027
108036 102295
50173 310905
377464 413563
50514 266112
188439 475033
265716 74928
468181 7665
405803 337556
306030 62780
74884 90197
287799 397717
234989 54968
354965 487603
45424...

output:

0
0
0
299996

result:

ok 4 number(s): "0 0 0 299996"

Test #28:

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

input:

500000 300000
368430 343918
446882 212697
29546 160141
344981 314914
452175 164883
455095 270312
184876 365933
28303 357877
19015 25413
79566 193001
360215 331576
48990 415914
460076 403773
5275 273528
126782 392642
300480 91154
462408 184854
170806 403797
474122 243941
455498 216153
303411 318454
3...

output:

0
0
0
0
299995

result:

ok 5 number(s): "0 0 0 0 299995"

Test #29:

score: 0
Accepted
time: 802ms
memory: 407744kb

input:

500000 300000
399777 40361
455110 49982
20171 256942
333855 491054
221417 386675
29797 104447
85127 83131
195291 321659
266812 251745
192208 493672
214328 326535
311058 434781
292365 146252
477829 82630
153902 54642
310393 292782
6204 296411
256707 365164
234615 314919
315631 159198
201923 123496
18...

output:

0
0
0
1
297443

result:

ok 5 number(s): "0 0 0 1 297443"

Test #30:

score: 0
Accepted
time: 776ms
memory: 407372kb

input:

500000 300000
202938 236127
251679 319567
323333 117611
94508 140927
320226 184726
203824 104238
33545 380920
497696 54656
228971 24250
247557 92720
312886 453950
382139 337239
62335 300445
146832 349588
473326 391193
400714 275904
421016 211969
384389 8277
90294 453713
451347 439227
447880 68150
48...

output:

0
130565

result:

ok 2 number(s): "0 130565"

Test #31:

score: 0
Accepted
time: 735ms
memory: 409828kb

input:

500000 300000
130395 115694
104321 14770
266987 391845
34502 384686
55281 216106
1339 413852
309203 410610
71593 477679
407262 489186
341317 80311
335559 105837
50050 151009
63035 30721
223812 333133
411431 428568
80315 442925
31726 371004
302913 6074
369844 215528
41504 167245
6865 24541
19771 1186...

output:

0
0
0
0
0
3456

result:

ok 6 numbers

Test #32:

score: 0
Accepted
time: 769ms
memory: 409456kb

input:

500000 300000
216724 339648
336249 446830
138866 90805
110198 443977
177457 384057
420856 279388
250917 280710
238221 157639
29422 13487
45499 49732
354620 141758
58007 320606
8280 72032
361556 469758
327836 110354
168718 435973
225433 449027
405447 155973
9320 267570
104609 437751
487793 350996
470...

output:

0
60433

result:

ok 2 number(s): "0 60433"

Test #33:

score: 0
Accepted
time: 732ms
memory: 408792kb

input:

500000 300000
469070 70573
450212 335843
455367 486663
223857 275061
37008 77495
431563 199368
44077 199471
416617 333577
9672 58893
110162 116741
120972 224050
287396 215854
389068 421860
339535 380342
292331 143016
351115 188120
381843 427161
370383 30688
283839 463085
219842 36185
461941 278912
4...

output:

0
299998

result:

ok 2 number(s): "0 299998"

Test #34:

score: 0
Accepted
time: 793ms
memory: 408260kb

input:

500000 300000
395209 386445
375970 248913
401938 216421
168898 18839
11289 76762
80648 200854
214683 121837
36120 363645
348513 257554
251266 150026
259921 279533
4114 426679
243049 425502
451167 434967
194317 76427
82372 438987
496202 406168
53876 151967
91329 425774
425517 488605
237795 428370
147...

output:

0
0
0
0
207515

result:

ok 5 number(s): "0 0 0 0 207515"

Test #35:

score: 0
Accepted
time: 754ms
memory: 407860kb

input:

500000 300000
294720 146914
24376 416562
377725 184943
150367 296698
477384 94308
345775 143644
36294 129104
88354 315830
352158 181176
300581 97452
159731 219292
210999 365338
33169 186754
400820 302855
351641 379836
295505 467796
126489 400643
41689 255178
380407 397967
410209 50041
63996 359790
1...

output:

0
0
0
30805

result:

ok 4 number(s): "0 0 0 30805"

Test #36:

score: 0
Accepted
time: 743ms
memory: 409716kb

input:

500000 300000
30428 452515
110560 384389
435192 328358
200119 61631
359995 404431
469930 229480
300995 77121
391616 204481
452287 31526
329371 330526
277705 267700
464896 369815
307636 92303
224038 368412
472786 419781
436085 267852
351353 75457
184696 193961
326316 253742
97379 401480
102622 63515
...

output:

0
0
0
0
176813

result:

ok 5 number(s): "0 0 0 0 176813"

Test #37:

score: 0
Accepted
time: 762ms
memory: 409852kb

input:

500000 300000
102224 38817
299670 198231
494685 360080
249321 429677
393140 367526
16232 397372
24042 387770
157502 288247
272962 152494
141694 278673
233533 238978
184386 60575
183059 421291
246014 18570
201322 331682
271786 94376
58178 439816
324771 35750
128615 248475
369669 238890
378868 61194
4...

output:

297008

result:

ok 1 number(s): "297008"

Test #38:

score: 0
Accepted
time: 733ms
memory: 409524kb

input:

500000 300000
361760 278324
178776 232715
171838 173873
122891 338911
9200 136390
228210 92354
351883 110506
444944 83606
432132 498035
45182 145825
327337 334128
219386 436885
125812 19214
260018 10623
215893 80275
455645 291773
148459 219400
59041 201427
235471 249895
150267 101097
234299 54542
12...

output:

0
204914

result:

ok 2 number(s): "0 204914"

Test #39:

score: 0
Accepted
time: 755ms
memory: 411820kb

input:

500000 300000
388489 178284
55560 43175
16386 266051
344844 41063
3834 339421
163483 168214
239976 343047
406686 499708
440962 449779
178339 386394
165749 131547
472654 71342
60115 406428
140411 399541
56745 64362
31318 75721
84447 478944
275066 41496
70414 94745
268000 294680
105521 475747
329086 4...

output:

0
0
0
0
0
0
0
278083

result:

ok 8 numbers

Test #40:

score: 0
Accepted
time: 805ms
memory: 408584kb

input:

500000 300000
298440 157913
497831 173159
476250 49480
73493 84069
353854 334234
371591 392525
198541 345188
147803 389630
434971 94828
57655 305899
171638 19178
96311 412083
397392 431278
204001 235121
482066 273822
194889 333194
406756 188791
405424 484675
45281 485958
475335 227276
485399 52945
7...

output:

0
0
6474

result:

ok 3 number(s): "0 0 6474"

Test #41:

score: 0
Accepted
time: 753ms
memory: 411084kb

input:

500000 300000
323266 168663
398101 490339
55613 378905
118694 13790
346283 207499
484874 242420
214882 266909
310897 304924
233683 284661
390999 447808
398401 292218
376511 445146
225402 262087
476147 154371
68459 440121
179939 466499
428625 253550
204619 123403
189012 69422
309760 39247
494779 4137...

output:

0
82573

result:

ok 2 number(s): "0 82573"

Test #42:

score: 0
Accepted
time: 753ms
memory: 409372kb

input:

500000 300000
477485 58695
3915 443486
376473 455170
253612 130211
68982 278758
476454 357981
127414 175739
314154 208528
420245 221624
444469 19918
384252 223829
261914 221493
113542 6290
176491 69490
205071 375384
73715 345029
158250 120858
68867 411640
169850 308182
342133 412925
115470 465779
22...

output:

0
0
0
0
219349

result:

ok 5 number(s): "0 0 0 0 219349"

Test #43:

score: 0
Accepted
time: 746ms
memory: 409600kb

input:

500000 300000
408778 170328
324095 336335
430199 399045
382392 54313
688 415828
468437 346158
43184 64014
266481 324183
160303 135954
453659 103850
350106 459146
491278 368993
459256 78338
316470 363185
50512 126907
253059 299648
303617 202007
32490 17189
313921 169980
43950 63866
450018 494303
3009...

output:

0
0
0
0
0
0
60951

result:

ok 7 numbers

Test #44:

score: 0
Accepted
time: 764ms
memory: 407396kb

input:

500000 300000
84802 384085
40440 106879
277430 361725
65807 197577
497943 255558
458658 67265
74331 416785
483163 234354
398274 142112
227693 77568
451235 217025
336849 422214
103474 216914
48383 314851
212790 9734
414129 316809
65342 309586
56220 25176
370611 391682
318397 916
445173 91733
140098 2...

output:

0
0
0
0
136734

result:

ok 5 number(s): "0 0 0 0 136734"

Test #45:

score: 0
Accepted
time: 748ms
memory: 409516kb

input:

500000 300000
90015 483033
430061 102902
179333 63710
52991 10021
457537 370592
373478 148866
12138 402690
236149 429133
213779 139110
254015 230881
78008 327866
367442 391172
223706 4199
393090 16763
385850 169137
368370 431232
403889 393163
79649 214862
98776 489786
70710 421503
272517 37614
45705...

output:

0
0
266761

result:

ok 3 number(s): "0 0 266761"

Test #46:

score: 0
Accepted
time: 756ms
memory: 408200kb

input:

500000 300000
161696 141674
199352 168666
250884 480437
315409 288308
145064 454013
2068 392522
411672 143596
304365 395349
98344 76434
312759 13556
23014 219916
42349 485945
201973 34737
113399 161052
406390 123642
73509 437775
243685 341788
137363 131351
371072 104607
472918 121050
366808 179240
1...

output:

0
0
38050

result:

ok 3 number(s): "0 0 38050"

Test #47:

score: 0
Accepted
time: 768ms
memory: 408120kb

input:

500000 300000
85236 168312
366577 425605
91630 14747
233560 347612
3227 408441
147246 268713
203052 344641
30326 39285
490353 437751
436056 83110
108806 56362
149708 198524
293827 161081
162268 234169
246778 487425
159435 376588
183871 369939
131340 175943
32032 256014
490771 439885
267104 35104
132...

output:

0
0
86097

result:

ok 3 number(s): "0 0 86097"

Test #48:

score: 0
Accepted
time: 736ms
memory: 409756kb

input:

500000 300000
247952 484074
156554 91767
339800 85824
418381 76746
67366 119781
141760 53273
364810 416761
285748 377984
142041 347093
34813 408862
457059 12127
62683 34783
446552 70483
99785 405017
279919 433904
175611 338643
405201 318935
476773 142943
187232 211923
499102 352457
47329 81556
48312...

output:

0
0
0
113207

result:

ok 4 number(s): "0 0 0 113207"

Test #49:

score: 0
Accepted
time: 771ms
memory: 408516kb

input:

500000 300000
425022 49317
320805 109619
147789 164158
48700 108629
352723 465005
90581 208454
153360 371476
300610 298135
171255 204435
356022 358122
173320 350416
153610 304909
36568 247013
192394 12722
346651 429953
141680 274351
432785 140324
466623 394583
269293 104780
97610 44674
413020 361469...

output:

0
143830

result:

ok 2 number(s): "0 143830"

Test #50:

score: 0
Accepted
time: 772ms
memory: 410656kb

input:

500000 300000
403899 454171
398176 415629
93938 124928
153005 76127
264577 287824
212556 319847
2213 476000
310518 288446
193981 100635
127776 209903
314195 69189
245804 329878
208531 101109
248247 11138
350356 340839
153757 409925
379557 431001
182617 226273
37418 461531
24616 130396
209309 152689
...

output:

0
0
0
100946

result:

ok 4 number(s): "0 0 0 100946"

Test #51:

score: 0
Accepted
time: 772ms
memory: 408428kb

input:

500000 300000
454355 496632
393762 25752
394054 389840
356694 96647
356900 106477
375548 162653
348391 404893
488937 415698
363859 377818
124215 252289
325226 426406
176967 459
192305 122463
33685 379741
113039 329411
101842 18354
78446 87893
73470 116275
325591 324225
7120 285955
373357 52311
20221...

output:

0
0
0
299996

result:

ok 4 number(s): "0 0 0 299996"

Test #52:

score: 0
Accepted
time: 749ms
memory: 411340kb

input:

500000 300000
175503 456130
462374 476792
422291 50915
22060 333395
352693 160932
152900 353730
263140 161262
194711 18163
276869 328550
296635 485099
443785 168127
332688 211573
479841 167728
78594 282878
383458 206062
403394 86474
386198 293368
258604 338596
316966 368881
447281 221588
415333 4673...

output:

0
0
0
299996

result:

ok 4 number(s): "0 0 0 299996"

Test #53:

score: 0
Accepted
time: 782ms
memory: 407224kb

input:

500000 300000
206853 157619
225358 163691
270125 366560
323590 279500
152484 306857
366635 252134
163051 445438
390025 331728
69837 324775
132045 423636
404106 334882
16768 347451
368254 192221
229448 388668
266161 209546
470992 428376
481765 418639
112905 210953
333838 39345
407097 341331
78547 420...

output:

0
0
0
0
0
85222

result:

ok 6 numbers

Test #54:

score: 0
Accepted
time: 782ms
memory: 411860kb

input:

500000 300000
376982 435711
169327 481200
196241 282061
96757 397069
292697 8704
437704 50894
265825 25499
300752 484443
461136 479323
314697 127114
214253 332740
395413 465167
430509 356192
277406 88046
297294 31927
487373 417513
300106 319568
51996 166849
386236 402651
379556 162717
437328 228048
...

output:

0
299998

result:

ok 2 number(s): "0 299998"

Test #55:

score: 0
Accepted
time: 814ms
memory: 408744kb

input:

500000 300000
372921 90830
273087 333420
466359 400933
128808 494364
375920 334927
187566 476738
348584 189026
411788 407862
370518 265193
471076 231935
386418 20204
165685 286851
9812 353617
64703 474750
496217 461641
122965 82141
63544 52084
129417 105703
8023 269671
278719 34984
139268 19408
2119...

output:

0
151037

result:

ok 2 number(s): "0 151037"

Test #56:

score: 0
Accepted
time: 772ms
memory: 410236kb

input:

500000 300000
26862 451829
228631 277293
336458 65058
188760 193701
72105 182818
79590 324609
407810 392293
44835 124136
51672 144558
189537 121773
423804 135130
55152 385192
308167 373999
361399 71761
148780 464385
26012 232011
458715 415982
401412 207891
404760 214779
275601 464831
262420 410720
1...

output:

0
0
0
0
0
245593

result:

ok 6 numbers

Test #57:

score: 0
Accepted
time: 577ms
memory: 296132kb

input:

500000 300000
373167 181496
105488 380128
153998 125748
172601 386396
438049 121492
75276 438471
232528 255765
214892 70385
166924 83072
46843 342998
191016 146285
170531 152697
485021 75506
316398 388803
324307 37840
394122 3422
433545 27859
192837 316357
328523 403002
472535 334679
221210 355925
2...

output:

0
0
0
257705

result:

ok 4 number(s): "0 0 0 257705"

Test #58:

score: 0
Accepted
time: 569ms
memory: 287132kb

input:

500000 300000
28901 79776
150842 444232
385152 231176
381857 28777
476847 362136
18682 19428
101948 293263
235357 326888
323260 101000
374765 6387
91532 465034
28286 70057
168946 208575
101313 275963
273316 412044
259861 148317
298885 496361
285817 352847
171039 15008
204035 393355
73828 475044
4558...

output:

0
0
0
0
0
0
58029

result:

ok 7 numbers

Test #59:

score: 0
Accepted
time: 593ms
memory: 282200kb

input:

500000 300000
160999 307587
362430 51784
20747 291883
11812 124653
423871 153459
170375 477175
248902 476525
461377 340553
269478 106739
460660 337890
72546 409116
262548 456382
170649 33054
205306 415103
234135 465336
332341 486319
35720 7129
393085 320596
375945 415888
27865 423795
422633 39025
47...

output:

0
0
0
0
150217

result:

ok 5 number(s): "0 0 0 0 150217"

Test #60:

score: 0
Accepted
time: 587ms
memory: 279308kb

input:

500000 300000
488182 66120
482139 497408
315897 205069
389068 196721
184114 495458
273866 406746
383743 42288
200734 182058
363502 233667
111004 95128
294049 432323
430100 228212
88629 265800
25517 228957
343312 262686
455221 467431
462508 430034
455724 39794
4274 426289
234622 26692
198360 125618
6...

output:

0
93254

result:

ok 2 number(s): "0 93254"

Test #61:

score: 0
Accepted
time: 617ms
memory: 280208kb

input:

500000 300000
170171 440647
456866 104526
298674 60942
227957 435443
220193 340139
81560 10976
287420 321678
322394 137494
76219 232544
478645 413919
385282 67985
161983 337769
307124 302057
119122 320306
55127 264652
491372 33572
172113 480658
492997 369366
107683 91581
356755 86106
58186 10644
106...

output:

0
0
173851

result:

ok 3 number(s): "0 0 173851"

Test #62:

score: 0
Accepted
time: 575ms
memory: 261720kb

input:

500000 300000
57316 403807
106088 175662
80195 245223
98264 460883
300746 278000
77072 447325
477672 90130
212089 63927
399071 312813
393804 169809
142259 328375
65024 146245
418974 295281
497549 478791
143896 382485
10595 154208
32340 338608
140246 98830
409029 217305
435660 163077
379171 464238
19...

output:

0
0
0
23086

result:

ok 4 number(s): "0 0 0 23086"

Test #63:

score: 0
Accepted
time: 619ms
memory: 269064kb

input:

500000 300000
264749 289307
370913 441870
391682 262904
55128 263480
208390 201378
299311 381177
155771 104376
445142 416340
415181 324588
452451 177996
318396 244352
487718 210859
210322 65213
418236 4351
247952 19456
397500 55866
43154 389834
485341 352616
451362 24882
273302 481369
230063 434978
...

output:

0
0
0
0
222521

result:

ok 5 number(s): "0 0 0 0 222521"

Test #64:

score: 0
Accepted
time: 619ms
memory: 269596kb

input:

500000 300000
185570 62130
356438 439172
373122 303401
40231 175257
140469 222475
314411 244903
415056 97698
467882 82481
178692 498690
10721 250261
222606 453207
168320 483383
173056 321459
146115 172191
293057 113566
144284 493183
123661 55541
91955 407374
486540 446694
53553 346580
117537 231308
...

output:

0
0
0
54259

result:

ok 4 number(s): "0 0 0 54259"

Test #65:

score: 0
Accepted
time: 617ms
memory: 270852kb

input:

500000 300000
321925 256025
425280 207975
4711 84764
480732 257175
328514 189114
284437 414883
115058 9845
497510 188516
252697 313381
472555 408184
120527 254393
249478 83324
342264 225555
170853 393741
325783 470949
356655 83697
465237 33093
320053 476914
376147 440842
37819 182422
249532 201726
2...

output:

279293

result:

ok 1 number(s): "279293"

Test #66:

score: 0
Accepted
time: 614ms
memory: 269732kb

input:

500000 300000
381493 196281
162784 234941
229770 278538
473464 384514
41970 84625
136315 178617
73255 322490
455334 256123
344651 71093
19806 306355
141585 259434
498592 385799
69593 97363
224288 435741
213599 208809
247021 168831
369471 488232
22883 88673
456210 61109
408610 179407
173588 133805
28...

output:

0
0
0
0
0
162627

result:

ok 6 numbers

Test #67:

score: 0
Accepted
time: 592ms
memory: 208348kb

input:

500000 300000
276694 141084
230733 475882
16692 218150
292783 179153
90055 406780
212804 313235
344430 135341
226018 384735
142351 349621
58404 12604
227273 409987
97135 293955
346032 495769
417024 71054
414218 25242
234654 250050
77163 478862
106304 12320
499511 45120
422078 400285
202214 136278
17...

output:

0
0
299997

result:

ok 3 number(s): "0 0 299997"

Test #68:

score: 0
Accepted
time: 591ms
memory: 208424kb

input:

500000 300000
100690 95653
133597 337050
269228 279259
80460 360670
221644 240732
376165 276010
286643 265387
469567 451010
30355 31086
469512 26231
205023 488506
498765 270115
466823 99472
490358 221811
282372 11724
281144 400703
499743 255838
185714 37216
88484 266679
49154 277252
380946 287160
39...

output:

0
0
236359

result:

ok 3 number(s): "0 0 236359"

Test #69:

score: 0
Accepted
time: 624ms
memory: 208596kb

input:

500000 300000
362237 339865
46472 286209
403941 54523
414742 4720
240473 223542
479642 262571
296237 434319
187775 459685
219016 498527
329375 11565
437037 146716
432998 481265
92850 280205
376656 202652
431177 392252
278049 72474
82357 33144
33188 166218
192714 125034
50428 115603
482627 98566
1096...

output:

0
33220

result:

ok 2 number(s): "0 33220"

Test #70:

score: 0
Accepted
time: 593ms
memory: 210592kb

input:

500000 300000
85676 46650
443014 243633
103259 7363
156335 404441
346457 247490
384634 29425
444725 451356
288086 110619
76385 103884
396615 148497
298280 433852
273074 90620
277272 4447
14383 275119
100912 382859
139116 197968
196472 77174
398768 418193
129994 40338
67107 404862
111552 333084
47473...

output:

0
0
0
0
12108

result:

ok 5 number(s): "0 0 0 0 12108"

Test #71:

score: 0
Accepted
time: 1018ms
memory: 455772kb

input:

500000 300000
275585 349165
97681 173508
346064 68205
379818 100994
475510 252893
113075 38418
651 155246
106766 383900
22724 409367
439186 265529
40146 228856
272481 346986
381142 186774
311645 128012
191829 330307
193834 255863
472628 430221
22132 253090
284403 490581
443675 169612
201152 127635
2...

output:

86
412
45
669
0
392
0
2
226
465
128
266
417
99
621
170
703
481
0
736
191
1095
31
754
348
510
916
115
0
614
422
1871
1312
755
1653
488
1983
696
361
216
197
611
112
1447
200
1572
355
2323
523
1
446
2398
2378
1629
371
2231
1418
835
1691
0
196
514
2476
2534
1315
2717
603
979
118
977
583
1250
1159
185
0
...

result:

ok 149952 numbers

Test #72:

score: 0
Accepted
time: 879ms
memory: 401316kb

input:

500000 300000
457633 218469
107636 307808
455266 321477
243955 389609
14159 319496
261749 169688
463995 13383
36348 121304
16757 380617
283269 156290
96774 64395
121308 386939
322430 92085
371960 297389
162900 330816
249200 349142
407174 190054
480252 133270
383515 418163
167794 381674
217901 27011
...

output:

246
0
0
465
752
504
0
102
65
842
1025
1003
374
8
1333
0
617
1443
1364
528
384
757
41
175
1120
158
873
0
1354
219
1816
870
773
244
2422
504
938
1736
524
1945
621
178
1063
335
1881
0
2122
1952
1358
1362
2370
497
2285
2856
1997
1635
2279
1985
522
2756
846
380
38
1545
0
0
3019
82
1
1493
0
0
1792
0
2534
...

result:

ok 150000 numbers

Test #73:

score: 0
Accepted
time: 996ms
memory: 436636kb

input:

500000 300000
162542 467171
296155 264516
45131 421034
293174 153764
302483 364931
29309 307707
229082 294417
351045 93238
483048 435358
124171 77854
58352 282803
204491 50803
9006 429473
265587 130251
295155 215158
445279 447939
450848 46116
428726 302703
58021 135434
418320 369988
409663 295072
40...

output:

226
114
282
403
143
630
812
103
252
963
492
1116
122
742
1065
451
0
164
277
354
1381
17
346
1509
207
301
549
354
989
1394
315
0
112
30
1153
425
2066
227
771
526
1746
1219
424
680
181
1829
2010
1825
794
1553
2433
0
967
523
2285
1347
6
1089
1925
723
1330
616
2871
929
2327
0
2889
2594
3108
1808
83
1345...

result:

ok 150061 numbers

Test #74:

score: 0
Accepted
time: 525ms
memory: 279968kb

input:

500000 300000
237980 361164
34814 288295
341239 9413
208539 197987
223407 480914
454194 9303
433144 484004
445788 44606
253812 137721
459549 372509
161586 490277
73151 15581
209490 256763
163084 333704
41534 462964
465401 113813
379575 43965
366536 157648
429099 289038
94612 33698
246626 168779
4966...

output:

296761

result:

ok 1 number(s): "296761"

Test #75:

score: 0
Accepted
time: 509ms
memory: 280944kb

input:

499999 300000
178650 299374
21305 236880
35768 273860
354638 490843
7067 51127
339702 60638
280671 382355
229727 316332
61261 359957
200949 179804
447890 368842
110077 17744
37423 23490
216766 43524
466286 204896
421705 109053
125523 236469
133747 437670
195302 88865
254035 290777
140766 242928
4240...

output:

299999

result:

ok 1 number(s): "299999"

Test #76:

score: 0
Accepted
time: 497ms
memory: 283912kb

input:

499998 300000
152101 58416
49137 331047
344524 95426
75640 352836
49736 327506
231577 12244
267252 69695
232036 221608
172917 473330
428753 79464
357745 125424
259003 319831
352369 73846
13766 462268
176872 414553
402224 221699
451547 382249
113111 420333
216709 354839
424721 196929
489411 335489
25...

output:

71166

result:

ok 1 number(s): "71166"

Extra Test:

score: 0
Extra Test Passed