QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#923918#7462. Brodal queueCrysfly🌈100 ✓1779ms362732kbC++203.7kb2025-03-02 11:27:562025-03-02 11:27:58

Judging History

This is the latest submission verdict.

  • [2025-03-02 11:27:58]
  • Judged
  • Verdict: 100
  • Time: 1779ms
  • Memory: 362732kb
  • [2025-03-02 11:27:56]
  • Submitted

answer

#include<bits/stdc++.h>
#define For(i,a,b) for(register int i=(a);i<=(b);++i)
#define Rep(i,a,b) for(register int i=(a);i>=(b);--i)
//#define int long long
using namespace std;
#define ui unsigned int
inline ui read()
{
	char c=getchar();ui x=0;
	for(;!isdigit(c);c=getchar());
	for(;isdigit(c);c=getchar())x=(x<<1)+(x<<3)+(c^48);
	return x;
}

#define fi first
#define se second
#define pb push_back
#define mkp make_pair
typedef pair<int,int>pii;
typedef vector<int>vi;

#define maxn 200005
#define inf 0x3f3f3f3f
#define ll long long

/*
把修改操作刻画为:将颜色 x 在块 k 中次数 +=c
f(i,j) 表示 i~j 所有整块的答案,考虑贡献
g(i,x) 为 前 i 个块中出现 j 的次数 
i,j<k    delta = 0
i<k<=j   delta = g[i][x] * c
k<=i,j   delta = c*c + c*(g[i][x]+g[j][x]) 
维护 delta 在 两个方向上的差分 

修改 g[] 的复杂度是 sqrt 
纯块要当做散点来处理掉,不需要修改 g[],复杂度就正确了

交换前缀和数组两维 
*/

int n,m,a[maxn];
int B,t,bel[maxn],L[455],R[455];
int g[maxn][455],tag[455];
int tmp[maxn];
ll f[455][455],s1[455][455],s2[455][455];

// 维护 F(i,j) 
void down(int b){
	if(b==-1){
		puts("WA");
		exit(0);
	} 
	ll sum=0;
	For(i,b,t){
		sum+=s1[b][i],s1[b][i]=0;
		f[b][i]+=sum;
	}
	sum=0;
	For(i,1,b){
		sum+=s2[b][i],s2[b][i]=0;
		f[i][b]+=sum;
	}
}
void add(int b,int x,int c){
	For(i,1,b-1)s1[i][b]+=g[x][i]*c;
	For(i,b,t){
		s1[i][i]+=g[x][i]*c;
		s2[i][b]+=(g[x][i]+c)*c;
		g[x][i]+=c;
	}
}
inline ll F(int l,int r){
	if(l!=1)down(l-1); down(r);
	return f[r][r]-2*f[l-1][r]+f[l-1][l-1];
}

inline void downtag(int b){
	if(tag[b])
		For(i,L[b],R[b])a[i]=tag[b];
}
int stk[maxn],top;
ll ask(int l,int r)
{
	ll res=0;
	int bl=bel[l],br=bel[r];
	if(bl==br){
		if(tag[bl]) return 1ll*(r-l+1)*(r-l+1);
		For(i,l,r) ++tmp[a[i]];
		For(i,l,r) if(tmp[a[i]]) res+=tmp[a[i]]*tmp[a[i]],tmp[a[i]]=0;
		return res;
	}
	downtag(bl),downtag(br);
	if(bl+1<=br-1)res=F(bl+1,br-1);
	For(i,l,R[bl]){
		if(!tmp[a[i]])stk[++top]=a[i];
		++tmp[a[i]];
	}
	For(i,L[br],r){
		if(!tmp[a[i]])stk[++top]=a[i];
		++tmp[a[i]];
	}
	For(i,bl+1,br-1)
		if(tag[i]){
			if(!tmp[tag[i]])stk[++top]=tag[i];
			tmp[tag[i]]+=R[i]-L[i]+1;
		}
	For(i,1,top){
		int u=stk[i];
		res+=1ll*tmp[u]*tmp[u];
		if(bl+1<=br-1)res+=2ll*tmp[u]*(g[u][br-1]-g[u][bl]);
		tmp[u]=0;
	}
	top=0;
	return res;
}

void cover(int l,int r,int x)
{
	int b=bel[l];
	if(tag[b]){
		if(tag[b]==x)return;
		For(i,L[b],R[b])a[i]=tag[b];
		For(i,l,r)a[i]=x;
		add(b,x,r-l+1),add(b,tag[b],(R[b]-L[b]+1)-(r-l+1)),tag[b]=0;
		return;
	}
	For(i,l,r)++tmp[a[i]];
	For(i,l,r){
		if(tmp[a[i]])add(b,a[i],-tmp[a[i]]),tmp[a[i]]=0;
		a[i]=x;
	}
	add(b,x,r-l+1);
}
void assign(int l,int r,int x)
{
	int bl=bel[l],br=bel[r];
	if(bl==br)return cover(l,r,x);
	cover(l,R[bl],x);
	cover(L[br],r,x);
	For(i,bl+1,br-1){
		if(!tag[i]){
			For(j,L[i],R[i]) ++tmp[a[j]];
			For(j,L[i],R[i]) if(tmp[a[j]]) add(i,a[j],-tmp[a[j]]),tmp[a[j]]=0;
		}
		tag[i]=x;
	}
}

signed main()
{
//	freopen("data.in","r",stdin);
//	freopen("my.out","w",stdout);
	n=read(),m=read();
	B=sqrt(n);
	For(i,1,n)bel[i]=(i-1)/B+1;
	t=bel[n];
	For(i,1,n)a[i]=read();
	For(j,1,t){
		L[j]=(j-1)*B+1,R[j]=min(n,j*B);
		For(i,L[j],R[j]) For(j1,j,t) ++g[a[i]][j1];
	}
	For(j,1,t){
		For(j1,j,t){
			f[j][j1]=f[j-1][j1];
			For(i,L[j],R[j]) f[j][j1]+=g[a[i]][j1];
		}
	}
	ui l,r,x,lst=0;
	For(i,1,m){
		int op=read(); l=read()^lst,r=read()^lst;
		if(l>n||r>n||l<=0||r<=0){
			puts("WA");
			return 0;
		}
		if(op==1)x=read()^lst,assign(l,r,x);
		else {
			ll res=(ask(l,r)-(r-l+1))/2;
			lst=res; printf("%lld\n",res); // lst=0;
		}
	}
	return 0;
}

詳細信息

Subtask #1:

score: 1
Accepted

Test #1:

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

input:

10 12
6 9 9 4 7 8 10 4 9 2
2 1 4
1 0 5 0
2 3 6
2 10 9
1 7 9 2
2 7 9
1 2 7 1
1 2 11 4
2 6 10
1 3 12 0
1 14 14 15
2 7 12

output:

1
3
0
3
6
16

result:

ok 6 numbers

Subtask #2:

score: 9
Accepted

Test #2:

score: 9
Accepted
time: 829ms
memory: 18104kb

input:

200000 200000
1801 1645 561 1609 920 737 249 121 609 966 220 209 641 761 1475 284 595 220 1853 905 1705 399 1737 264 551 681 119 81 1529 1884 1905 641 257 1241 241 401 675 442 505 1565 1391 1395 1803 1589 55 1521 945 229 167 1030 996 73 1473 387 400 1261 1559 405 1573 1823 1029 937 17 1810 1885 401 ...

output:

28358
517270
14881
2254491
8001066
1545378
642772
110901
407089
452894
666513
54715
1625913
1441
6923245
9696
49136
816131
2509617
1312876
343815
456703
1356423
1836337
1746327
660004
1089819
13914095
2148442
10048565
5171534
4750216
4919749
101478
577992
1103366
2608074
8109
519702
50997
5176718
95...

result:

ok 200000 numbers

Test #3:

score: 9
Accepted
time: 668ms
memory: 14180kb

input:

200000 200000
17 183 173 114 41 1 53 88 168 151 98 126 41 63 151 141 26 70 171 97 189 20 41 90 33 27 181 193 11 67 194 9 193 21 121 73 49 183 23 53 179 101 173 101 181 151 113 41 41 200 87 61 21 160 21 197 137 1 178 165 25 17 99 101 123 41 141 179 18 135 9 63 93 1 17 121 181 165 23 84 151 72 185 195...

output:

57453674
8912267
106941240
43372080
3514
4140700
70940924
866065
45821048
93782304
2960142
6633447
4220263
2087922
23603247
16758529
39062682
28259929
13332277
4977435
60030213
8090899
242318
133034690
40197440
8097004
41318154
4955270
45526625
7549867
14419640
22190442
920
1509331
113034320
3984547...

result:

ok 200000 numbers

Test #4:

score: 9
Accepted
time: 420ms
memory: 14080kb

input:

200000 200000
1 1 1 1 1 1 1 1 2 1 1 2 2 1 1 1 1 1 2 2 1 1 2 1 1 2 1 1 2 1 1 1 2 2 2 1 1 1 1 2 1 1 2 1 1 1 1 1 2 1 1 1 1 1 1 1 2 2 1 1 1 1 1 1 2 2 2 2 1 1 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 1 1 2 1 1 1 1 2 2 2 1 1 1 1 2 2 2 1 1 1 1 1 1 1 1 2 1 1 1 2 2 2 1 1 1 1 1 1 2 2 2 1 1 2 1 2 1 1 1 1 1 1 1 1 1 1 ...

output:

20458927
2278131900
5335501156
1812018679
794532792
213524614
807699550
679149900
2715059560
5276018812
1839228536
246261631
3409678917
492124212
36827175
6883274572
11190063
1028136358
2601277905
8103196
3723752846
84746491
3612860367
8310108440
2108227681
33432402
618846546
571630
141952752
517795...

result:

ok 200000 numbers

Subtask #3:

score: 19
Accepted

Dependency #1:

100%
Accepted

Test #5:

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

input:

500 500
281 301 126 111 121 485 237 185 243 443 279 146 116 365 413 403 227 461 79 215 136 58 442 385 416 31 421 260 77 89 231 196 401 409 406 385 421 331 193 193 251 79 76 301 364 222 286 129 437 91 181 77 389 11 303 217 318 391 69 171 477 1 26 225 87 385 253 86 41 217 59 399 186 249 391 61 373 416...

output:

13
166
36
7
75
2
37
7261
21989
22791
9394
2981
10
10324
45
3321
17296
9018
1128
1495
210
6226
10591
12387
5202
2953
6985
465
20366
10223
9493
14196
4934
45
15576
5251
8881
48948
22578
33299
153
20155
820
3381
31878
1282
11752
6643
1442
23822
3
43876
3486
15576
2121
4591
1081
4095
16662
210
14130
881...

result:

ok 263 numbers

Test #6:

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

input:

500 500
21 39 5 25 25 35 9 11 29 31 9 43 36 41 14 26 6 11 37 43 37 31 1 41 35 1 1 22 7 5 41 35 15 30 45 1 9 13 47 1 33 31 26 16 17 7 19 6 6 11 31 19 17 35 1 15 25 3 11 11 9 29 3 31 17 17 50 19 13 36 33 15 46 44 35 41 39 15 1 9 32 36 6 33 29 13 49 15 13 11 25 13 21 45 27 26 15 40 47 33 21 17 2 7 6 45...

output:

13954
12
13235
14316
6976
3235
22147
9845
16963
15030
2815
2199
3598
1080
564
105
44
15
35995
38233
1424
10962
13730
1081
18
9673
20089
2908
2926
5253
3602
472
21115
12561
48342
26565
3672
41622
3282
6786
24753
20110
595
18683
91
6335
0
35998
561
66
11959
8778
23279
3457
15
4662
37026
69045
210
1414...

result:

ok 238 numbers

Subtask #4:

score: 19
Accepted

Dependency #2:

100%
Accepted

Test #7:

score: 19
Accepted
time: 1092ms
memory: 100172kb

input:

200000 200000
42117 11359 41220 12879 46629 34683 41056 7257 25769 48971 43167 9001 4589 3689 16459 23491 30843 15858 43281 24001 25831 43921 43680 19593 37551 43235 488 11642 36361 28687 23661 38456 16817 39826 30687 28321 6961 35601 20653 21989 32641 38223 15626 24193 15209 36626 36576 17166 14001...

output:

418951
29901
177
141979
53172
29610
756
1876
175800
9203
19666
46632
10724
195643
64577
57117
113508
68182
52178
55297
172867
220232
71578
39447
108116
395819
60262
169911
24597
38336
214485
27264
201704
51291
249199
64
2231
148307
8203
136171
52703
34537
37939
6771
9211
147445
96648
189649
71870
85...

result:

ok 100514 numbers

Test #8:

score: 19
Accepted
time: 923ms
memory: 48864kb

input:

200000 200000
2094 13606 17209 1873 18859 6265 6245 11773 14287 19671 17616 13525 12246 5583 11447 13181 12665 1041 4997 5587 12324 12517 9481 1251 13631 722 1523 1929 11155 9707 16673 3345 4854 16921 10217 18207 4629 17942 10673 2943 703 7933 7875 15021 5927 15601 9697 16136 17721 6176 6908 11811 1...

output:

6786
976233
683302
837868
2556
64432
109979
47244
282235
462112
22501
104932
423093
85552
25773
195691
118604
5845
5448
107987
203526
1036941
432
307987
120164
36365
1097726
94
432831
106359
6608
412747
8328
62179
808652
7562
715421
557964
328521
226643
358187
244217
1360482
14610
15605
15755
77992
...

result:

ok 100482 numbers

Test #9:

score: 19
Accepted
time: 1221ms
memory: 189804kb

input:

200000 200000
961 24296 97295 72651 57317 19319 91619 73701 48517 37111 94997 39305 53513 48409 84619 65223 89009 23316 29209 32233 30796 39149 91689 79043 87481 32425 79805 60726 10545 11060 58706 67287 70435 77825 95601 14986 28745 19804 45141 11457 32853 12910 13237 37950 28036 24657 67606 60086 ...

output:

137
7231
95882
30804
322
6150
72179
7299
147301
10974
411
6499
36201
16150
189291
62115
22632
180243
32578
80639
32559
32558
7551
92599
133447
12680
8316
58120
91884
55641
572
59976
922
974
155290
39321
1204
762
220492
69487
131948
161623
10592
2058
27071
143268
265584
122947
40499
3623
2841
24689
6...

result:

ok 100481 numbers

Test #10:

score: 19
Accepted
time: 764ms
memory: 22132kb

input:

200000 200000
939 351 2485 2308 3586 3824 2761 4927 4521 585 2513 3295 3505 553 4909 531 4661 3169 871 3648 4710 4265 4913 1016 3375 2676 4159 801 2286 358 636 1371 4401 305 1191 1651 3071 751 159 2089 1539 2581 1921 1891 325 1734 1449 2973 360 401 4811 1433 3181 3224 3441 3537 1269 589 3356 407 581...

output:

42764
3319484
5357223
1586462
164844
1092132
92088
79783
1039300
4297640
3234739
466774
303914
660281
108250
19293
1133615
41995
23226
486773
63659
443375
241081
197402
20404
4529155
2267499
143206
2217491
511989
4263062
1749723
218909
20729
226867
93031
318798
110184
54608
172443
1104003
990836
211...

result:

ok 100469 numbers

Test #11:

score: 19
Accepted
time: 588ms
memory: 14276kb

input:

200000 200000
43 71 75 49 41 65 61 56 19 31 23 18 45 69 72 85 73 79 63 24 51 67 53 61 52 83 29 40 26 11 81 17 79 49 49 41 84 61 21 41 6 83 39 97 66 99 70 4 17 75 5 73 73 5 33 97 21 91 37 1 73 21 88 53 51 45 65 13 90 43 46 15 34 41 68 83 21 59 85 1 5 91 17 1 19 33 5 36 25 11 9 36 51 95 15 25 81 18 99...

output:

49108672
77917023
1069397
1271813
74163387
2246899
107098403
59105334
79770716
2729313
92819674
14031181
262774398
4024365
23512159
42274108
14149209
47182573
61820938
28853075
109290
120477336
5487313
150551739
49032231
577797
4719178
1612600
486016
49307123
138955266
13505802
18974813
523301
34451...

result:

ok 100459 numbers

Subtask #5:

score: 19
Accepted

Test #12:

score: 19
Accepted
time: 1463ms
memory: 360020kb

input:

200000 200000
96162 15481 51305 66323 58345 67841 63351 179462 4914 118157 110677 76845 126971 69269 112773 199665 196553 135326 72861 194617 101133 147301 186526 55880 25433 71005 84700 54329 127457 80123 92345 198413 118472 128393 52712 178299 77837 30176 186913 88131 184501 51913 138202 142540 17...

output:

61487
18213
538754
9208486
2827151001
435128213
197337174
10841496
63467011
69331200
1337604281
1788330451
1622013202
1268525593
2097519070
255572136
8864376162
132934665
7413238977
3799037054
767017946
2841968268
1998310281
53898153
134537406
656686920
1920829680
29467951
114547402
856375126
663208...

result:

ok 99408 numbers

Subtask #6:

score: 33
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Dependency #5:

100%
Accepted

Test #13:

score: 33
Accepted
time: 1471ms
memory: 357980kb

input:

200000 200000
190651 23805 12805 106586 171590 62669 198313 83933 147461 116402 168441 70881 168327 84771 156693 36721 115098 92668 59330 72731 122341 151303 66113 67793 180224 53365 167185 92877 8161 53763 193621 198793 32905 81419 91393 116143 185153 152678 10015 5190 156415 143551 91089 47169 131...

output:

4517
719437693
277786203
8351
36
38191
19765
14384
333
3029
26828
663714471
1255420409
256817294
1149529854
18963561
2977993853
3172578996
8441065382
1290749934
2322634384
428849541
1595078559
18119289
2627055697
367843734
1241312377
933843706
1050903713
387163374
152631537
454802755
5081535946
4371...

result:

ok 99373 numbers

Test #14:

score: 33
Accepted
time: 1397ms
memory: 350428kb

input:

200000 200000
16041 41351 159385 9275 86883 120429 47841 36642 55293 75909 39365 131714 189117 13709 183005 76011 130341 17085 82079 14601 122301 52133 192161 95693 178404 120175 28482 148105 120461 44201 27633 77192 65463 128217 147310 141576 199785 87469 72257 130561 195478 20417 888 188141 15211 ...

output:

13371
11785
141128
75
6543
108
38253313
36550
38227193
38267216
13941
10718
38279035
7931
38208293
549
2567
206
33561710
889
87
7199115
16523675
381153
4777718
4738803
33925657
12196343
432
38852550
1428048
39282486
4758837
38198333
1122
7500
109888497
726
33507608
81695844
6809508
32832331
48
62198...

result:

ok 159837 numbers

Test #15:

score: 33
Accepted
time: 1574ms
memory: 359536kb

input:

200000 200000
161101 175865 27401 170922 12519 120751 172161 8221 100737 154961 191541 147589 119440 137970 179201 64419 54167 95611 9290 167753 88245 23575 182819 88275 28479 44273 83904 92421 111171 21541 134561 102341 116524 178449 180697 57018 163769 102479 189197 57352 66139 96245 49424 90735 1...

output:

4343336
703
22162134
1230
13541
32
4771
19249638
394824
411
85843267
543
107231776
22642777
27115853
5657
77081292
31504601
39104976
42642541
21500403
10800
18833853
41211722
76800056
19709498
5649517
38972713
56997364
1336
26023673
77731591
32119715
198762773
48346703
29006286
29975259
6218705
9451...

result:

ok 99941 numbers

Test #16:

score: 33
Accepted
time: 1722ms
memory: 362296kb

input:

200000 200000
80641 90926 70853 154801 188721 39223 152189 190339 129773 86493 1224 137475 74151 119131 126816 165106 120501 22657 184985 148817 1239 143101 4561 77394 22465 162683 139331 16081 74873 138121 197121 104601 151496 196089 30725 126485 142033 53169 108997 158341 131216 110817 20265 27209...

output:

20855
25736286
45313482
467
113657398
123454946
2658503
67
20102935
49744337
31603087
31794932
8122465
5696
217981460
107261017
74887408
8764
8712862
19610345
117605684
251452508
89282946
48974273
111131189
137544254
168950935
150922793
56690459
107983843
137642663
58583831
176002144
100434889
31023...

result:

ok 39790 numbers

Test #17:

score: 33
Accepted
time: 1584ms
memory: 362732kb

input:

200000 200000
139444 166289 121905 162123 58801 185228 23586 60821 124705 81324 192329 23109 17419 3157 130191 53525 32661 27326 100551 17089 168607 116096 76437 146887 38221 77349 182321 187667 50799 26081 124085 114371 71709 27049 58039 37206 167081 71838 149585 172490 53801 143291 109077 80011 60...

output:

3103218
1220
2627
393
3064976
11574
3936077
7307860
3295279
18583263
8044
8051339
5910211
7269375
3140534
629255
17453501
24679142
647433
18120764
15365735
4105910
48089846
7012936
21084824
2606
474
31937595
2514090
34286111
18750733
25276572
20529833
30273505
25194681
766158
20385402
10166113
31663...

result:

ok 39879 numbers

Test #18:

score: 33
Accepted
time: 1511ms
memory: 359788kb

input:

200000 200000
12998 59351 93390 31657 166260 156537 180142 128501 150609 79040 25044 35261 31425 73737 180417 160701 77715 185537 142667 128235 190731 47953 66751 80301 92026 57386 72976 44833 158939 10559 10791 14661 57028 123801 22737 28611 36817 23351 61023 130817 67137 152553 113170 175846 19254...

output:

81473
319
4219
67467
408
22562
2933349
991
7339729
5797220
8671108
12611085
1381170
8198884
29
6377950
9698484
10527458
6189761
261
1612907
23025225
1120699
16098845
6391963
3206880
12883299
7895019
1379138
788013
5
910849
19069443
314425
21372029
12355893
27114316
31011714
9312441
33604848
23319618...

result:

ok 99945 numbers

Test #19:

score: 33
Accepted
time: 1397ms
memory: 353644kb

input:

200000 200000
72151 129109 58422 173991 186975 17129 161621 191621 33233 7391 28321 91376 18297 192291 17499 141217 87633 67001 157231 87837 63735 139971 95681 110451 56177 117451 18683 34239 133191 70361 139429 154215 67512 5343 116251 98969 45305 45119 48297 172325 142473 92526 64382 46181 168157 ...

output:

79588
734
45656
912324
134
2373376
2493447
2750
19129
2487199
873
2475673
41572
13411
38564
12520
63283
66342
82596
2364664
3595
0
34854
5345
4164
2356913
36037
13080
2341853
5819178
25950
2356006
47347
1250
3526528
5941003
14498
33827
3551717
6037483
7311458
384
2344474
8926
7417861
10639312
724
68...

result:

ok 159877 numbers

Test #20:

score: 33
Accepted
time: 1129ms
memory: 353460kb

input:

200000 200000
90261 5107 20943 77920 115703 147261 163895 26677 91783 90175 199733 71991 61719 99 137481 4147 132341 166362 187137 93921 123791 103881 183431 22887 197001 144967 83076 54891 194527 154644 65071 190871 1253 37427 144112 105141 105121 105153 12073 38516 27137 8277 1455 133157 77353 109...

output:

70687
5608
54
2502
50048
321
1608
5118
59130
27248
42012
531
38514
19745
436
18079
288
446361863
227733009
726
389470902
446171513
446168640
130141847
8346
70
1455
2303
103745887
1093
446173564
331283498
330521485
1976
6307
582970581
469873018
4760156
672541703
93704857
240667105
358452259
13121902
...

result:

ok 160033 numbers

Test #21:

score: 33
Accepted
time: 1475ms
memory: 359408kb

input:

200000 200000
159791 57391 86209 26091 144895 163881 182946 153016 91881 59129 106449 180188 173329 72179 170408 86276 188301 130186 3523 31849 116331 44565 195355 76546 174251 83831 10183 2826 1476 41841 32201 28623 166081 189522 77923 64886 194406 112641 31493 138667 66641 43569 87491 165661 43457...

output:

4426
110938052
110967229
150123093
83482715
193863188
657418801
81803870
548981090
478604913
347956547
114561653
29349465
33
332362115
403252181
629154457
568296246
75984122
75560589
48962270
414361157
5680135
496907211
663571781
1059059761
680057360
500619230
226115296
49585953
714227687
454705299
...

result:

ok 100138 numbers

Test #22:

score: 33
Accepted
time: 1779ms
memory: 362432kb

input:

200000 200000
161704 87151 50175 171321 143801 41106 119134 187337 100617 112666 65605 124506 199800 48015 5073 104061 171505 32673 5528 50505 61356 118118 161230 180961 197419 57945 115911 190037 124599 170906 152467 118381 66041 22001 13905 45354 52909 157777 84241 94647 89231 38497 172765 55393 1...

output:

1169162
355168713
484620
47181741
309100134
661685422
548065438
1062852696
30964560
158564494
440489206
532233032
705976960
73550101
295988801
342247200
798988427
73356328
186414247
2
154600533
168441238
272561360
542980959
728449522
160618971
322778222
682626772
672102262
364998571
751729716
362383...

result:

ok 39901 numbers

Test #23:

score: 33
Accepted
time: 1392ms
memory: 362324kb

input:

200000 200000
56786 143553 29536 2175 83042 158482 129025 151729 149727 191201 92561 80721 160694 153601 84366 38553 99426 123620 157897 164033 197725 13611 113521 39729 65262 150311 142324 29477 101481 130961 158292 97611 47991 64858 193121 187152 128481 102193 36350 100886 6752 811 195185 27053 18...

output:

45752
224697
24724
11664
155518
2579362
2115652
445510
65
3158249
13875
986
2296486
7533330
535832
1946731
4104869
383792
1374697
718829
1919467
5549977
8081399
2242193
5316834
5987348
1566224
5829374
5284314
4094742
1765265
978
2028
4241471
6124921
0
1340563
7414783
1597852
4749047
2400897
7670367
...

result:

ok 40343 numbers

Test #24:

score: 33
Accepted
time: 1381ms
memory: 359152kb

input:

200000 200000
112708 164962 115401 197385 120409 70325 111955 62511 174369 2751 70573 519 29513 70499 161341 30681 159313 172536 110821 96653 183009 125737 36695 162865 54236 144001 155018 171225 105596 34961 154601 69727 114078 93751 174496 70318 164856 186113 70466 181636 94171 66109 181829 192349...

output:

5600
9322
239032
727004
3639
726517
805085
486338
749194
10379
29376
842801
494893
113862
1129633
215795
1374576
565139
3647
49654
617691
1232919
2977
1497862
619860
23848
2488164
620798
4827
1950
1789
718033
2891224
1195878
517107
383231
3831485
509619
193547
2571972
95787
652122
1217211
3448617
48...

result:

ok 100161 numbers

Test #25:

score: 33
Accepted
time: 1338ms
memory: 353244kb

input:

200000 200000
84009 167723 171925 3491 124149 19285 80372 127952 16251 141581 36699 121729 111040 155277 19997 145426 153201 170292 65205 141886 38816 188966 198497 65777 92346 177601 89059 90571 48635 11006 195521 163521 127376 169565 176881 171299 8563 89169 81705 192025 50191 148026 100057 192706...

output:

4419
1340
11354
94046
65489
43347
12533
11798
6566
12172
13657
10071
11
41
28201
378224
411620
46846
439625
411721
395691
447117
399772
4068
14848
3289
4008
418925
105558
23947
1703
409843
409043
419559
1686
79932
391297
33
110619
489629
5873
596149
87901
385066
22486
414685
428796
624
130792
648786...

result:

ok 159918 numbers

Test #26:

score: 33
Accepted
time: 1293ms
memory: 353188kb

input:

200000 200000
97609 71991 123591 31953 83169 59727 57298 168885 19501 68229 44188 51647 192731 149814 179636 16786 199901 157515 14495 9661 51570 158303 25709 88305 121641 56001 182427 32585 97541 113188 192179 55493 96811 70353 13466 71263 28275 99105 100697 52625 173398 2913 107501 49904 32193 172...

output:

469
104187
11872
10673
93074
136124
2
13707
38809
15650
115175
66
39376
14246
179580
167660
117737
132354
421
88773
49890
62785
70362
10081
76357
1914
46094
432
25915
77021
90327
5
164917
69060
151308
8399
43526
68880
177972
17611
1455
82
21341
23
304491
80927
209158
4053
45629
22567
65393
10791
695...

result:

ok 160050 numbers

Test #27:

score: 33
Accepted
time: 1254ms
memory: 359312kb

input:

200000 200000
64201 59473 73175 179201 194101 180207 133411 176017 75279 174821 101912 127007 144882 182612 82388 43932 64092 1411 6661 128125 125889 102297 66369 28513 166241 79347 183774 31305 115426 8061 38886 181953 194245 134741 194041 115481 86428 78430 61653 86337 195037 180465 128541 89694 2...

output:

4685
35876
78911
7085
93877
30
162492
1635
53983
6871
76613
38729
1824
180103
66158
120598
8212
1
319966
58
793
169837
1179
430426
592
130371
174436
414978
893
402573
17185
624
137697
6164
208450
113353
19455
0
5985
45659
287210
44230
58300
5467
167640
152204
12622
148896
243594
398306
921
163455
27...

result:

ok 100142 numbers

Test #28:

score: 33
Accepted
time: 1147ms
memory: 362092kb

input:

200000 200000
146657 122971 37821 191209 78117 186840 49021 50097 94480 119126 66785 144745 86901 186721 64545 172353 50721 113239 75439 75009 43709 115411 35299 198216 115818 35701 93226 152461 167313 119306 40221 129274 15131 178936 187772 70273 199202 46079 86801 89511 194661 146984 78795 141976 ...

output:

7733
58687
2684
163542
15675
29509
1464
471117
509514
7188
7208
196317
316323
73352
214375
584828
73479
1523
57883
775896
741202
499097
421482
414964
42618
70387
910210
35601
682516
125564
513310
671474
230695
348889
1123220
49875
567838
348494
114091
615162
235014
7782
480688
460339
394349
761178
6...

result:

ok 40278 numbers

Test #29:

score: 33
Accepted
time: 1097ms
memory: 362580kb

input:

200000 200000
40713 189457 69377 134658 1471 106728 46821 120597 107497 87249 135821 57153 192001 149103 56825 114568 190461 68079 176701 8695 124145 193414 142201 72529 14499 127837 28203 144622 124313 124399 73871 84603 179664 165001 148339 13667 167121 13887 114555 39061 173473 100839 180409 9160...

output:

118367
691
430
2735
11452
7
58253
23009
11198
143871
221868
33471
1
162726
142
83351
69064
45543
233525
18
15372
23556
6651
115243
229371
174264
12
116718
33678
52147
97677
61220
21295
10024
365162
54752
273237
128203
334720
31353
7382
55029
112812
129718
53987
422878
69817
8165
95419
177348
233177
...

result:

ok 39737 numbers

Test #30:

score: 33
Accepted
time: 1210ms
memory: 359940kb

input:

200000 200000
41826 68225 179059 189581 197462 148121 75683 99647 91735 83779 74161 131751 164219 22258 88029 184613 79471 30469 76826 138222 14541 47793 135851 41361 71915 27632 171584 151417 7597 175636 83103 11741 67878 126209 119078 140679 99901 35693 77647 96123 50723 173803 160899 182153 92033...

output:

36350
70
7896
54689
47101
4564
13915
43558
37196
2155
2849
274
77356
254
43996
8316
46345
84967
9956
12780
5995
37331
15626
27195
4515
8041
33826
15911
42817
1780
18383
74856
0
21395
8331
78940
2843
31064
42780
10193
41709
49051
112385
21653
5
23002
30844
33017
52253
30852
411
41282
2070
13068
15543...

result:

ok 99951 numbers

Test #31:

score: 33
Accepted
time: 1329ms
memory: 354336kb

input:

200000 200000
181225 104705 193517 38209 109257 39801 19225 39545 194801 189526 94626 42737 83162 137933 110440 126161 105617 87133 31083 192909 175751 48252 70002 73071 123001 10733 142497 168409 60752 30153 115586 196886 6737 94717 1693 83059 24493 57805 199202 72461 138315 185609 153594 63097 113...

output:

68985
4552
54625
172
49507
19332
3227
114986
71300
95140
117244
54874
3499
182038
13374
98587
25456
4754
173729
121432
2799
50267
25
5907
20643
0
864
103771
32099
0
1306
16213
280
19740
99169
1421
43669
60127
1843
86947
49475
26020
2289
12928
106206
37041
19074
8692
18544
12764
51127
43668
28064
182...

result:

ok 160376 numbers

Test #32:

score: 33
Accepted
time: 1369ms
memory: 359556kb

input:

200000 200000
92108 177881 113713 106497 178929 177781 19401 188491 173946 124622 94773 44443 179356 67585 19309 76526 112001 66631 36561 57703 132343 11172 177761 87794 122744 190191 26761 80449 176684 99773 184673 12991 152443 101309 98758 135761 60385 66811 188056 50812 148626 11588 57181 10441 5...

output:

4063
21140
29553
64892
25454
9288
5305
13018
133564
45229
141
95349
437
47
2115
682
20891
410
1616
5412
420
134664
55476
36197
79026
1416
74652
48943
16594
136
6552
824
169311
60613
7976
26878
35564
29
3039
65600
102438
13353
3253
36520
12606
9061
50493
108400
48111
250
24413
28260
25198
2895
12520
...

result:

ok 99574 numbers

Test #33:

score: 33
Accepted
time: 861ms
memory: 49592kb

input:

200000 200000
18541 3296 9977 13010 8793 13011 2511 2831 5863 5289 9769 4969 10391 2745 18967 8696 14342 3016 429 19483 625 17111 3863 5185 9681 2919 17172 5168 8277 7979 15977 10501 2317 1041 17279 13499 13045 1346 11351 13276 11481 6041 7057 16364 15357 465 9682 6483 11909 13588 2564 6753 577 6407...

output:

632352
15857
1175011
78736
19655
548554
82667
132492
667960
587710
27614
1638
137978
330362
26
1442013
13986
87362
159143
81785
9325
25299
428818
914708
239187
268995
39684
19845
684185
596456
67932
47914
337063
759765
39822
611455
79201
5264
1220466
72674
32404
438807
306010
1020168
70586
152891
85...

result:

ok 99889 numbers

Test #34:

score: 33
Accepted
time: 866ms
memory: 46828kb

input:

200000 200000
15025 6693 16036 11361 1646 16887 18118 5791 17419 17457 10687 12039 2949 4589 12573 4281 15017 19473 1813 12209 10390 4587 3536 14001 11539 10291 861 10165 18075 1047 18917 14843 5561 19260 15902 13642 14561 2661 7921 4261 14357 5985 9313 19341 805 7999 3841 786 10946 3417 6112 14429 ...

output:

28579
131616
4002
266320
49993
813512
84363
137699
235324
672811
555086
108906
2437
64319
168678
280969
161733
36198
53953
7091
358470
401
12944
389308
83977
480
170830
70972
95614
1039205
357
440224
105634
74011
321830
261407
727180
536941
21074
15614
404230
1281724
99797
123934
562874
19677
0
112
...

result:

ok 160255 numbers

Test #35:

score: 33
Accepted
time: 787ms
memory: 48916kb

input:

200000 200000
7721 10678 9419 8348 17560 3053 8692 8081 6501 3681 16817 2798 7937 10433 5163 15905 12001 11541 15956 12919 3121 10737 4310 13937 7041 18420 17793 6156 11709 293 5545 19210 1191 2769 10881 11508 7092 7727 19601 15705 16057 2537 12417 6097 8599 7561 1321 6377 8101 10487 4101 16590 7033...

output:

120063
6289
72975
1239040
13128
186626
2693
661
17793
50231
151
2834
605739
1076033
351054
1312634
118064
637687
292639
46221
143053
47157
332446
356687
7803
108179
750280
23306
492700
196835
14987
219435
282123
208872
5553
99924
375413
365686
568756
103086
343586
385791
171196
801715
27140
145163
2...

result:

ok 40037 numbers

Test #36:

score: 33
Accepted
time: 950ms
memory: 49268kb

input:

200000 200000
14785 9373 1745 13025 2649 15827 3513 6671 8649 13221 4489 10069 8527 351 4301 3298 9 2222 6851 1041 15684 7169 5937 14379 3951 1319 3871 5961 18633 6505 13199 17713 14618 16541 8326 5647 2528 8257 6883 9119 8164 12801 14826 7233 7833 12768 3461 5726 12077 17325 4513 6417 18891 8209 14...

output:

1452709
285049
144163
1328602
300868
517390
5157
18993
252256
865389
1660038
565605
5269
831723
21028
11
13
13575
2299445
1101111
788905
73257
32923
1518344
851938
566786
3057988
1969177
869244
913508
25227
86046
2250219
1897520
385627
1307043
2607780
8087
826680
7347
994701
3344919
612333
2036482
4...

result:

ok 139815 numbers

Test #37:

score: 33
Accepted
time: 1093ms
memory: 49120kb

input:

200000 200000
19805 18323 10769 4816 2708 8689 10381 2561 1153 9409 1557 5099 7201 7574 7500 3795 19751 18436 6711 16609 18576 9345 10803 5162 10437 3716 18743 9481 4339 18165 8951 16551 18345 16251 6861 8154 2900 733 12113 4692 12431 12165 6003 4011 5281 18035 8514 13062 11941 7557 12947 235 756 17...

output:

188803
2199764
9004
21
474691
2152960
50631
3069701
966417
493445
4409385
912071
4104825
1673549
1917852
1230028
693843
3082054
6412522
1611427
4858283
148133
2599531
5864444
5283863
1158075
10161243
2915118
10070
102923
8551513
4135401
3018197
1083825
3953585
12403397
8527912
1225055
5045903
692285...

result:

ok 60225 numbers

Test #38:

score: 33
Accepted
time: 1426ms
memory: 48824kb

input:

200000 200000
4126 16594 9365 18791 16143 2885 10451 2582 1757 121 1245 9021 5103 12472 18273 15288 19697 629 12691 1316 8809 15139 10913 8823 15993 12983 3718 13275 11895 4307 10831 16958 12617 11001 12390 19105 2941 13441 18441 12821 6521 5997 19011 6929 13564 3063 12121 12641 18817 505 15413 1760...

output:

308621
714
8654143
88251984
81746973
109898391
97058245
201
162765001
117375619
32519342
145742537
77766267
35302
26389
116614108
78863913
99326864
63765
165719940
55139562
94830
3033
5809
149641012
45722
114195294
39680079
23883498
63133890
20216353
63516648
53769461
90367813
149469658
43128285
152...

result:

ok 60011 numbers

Test #39:

score: 33
Accepted
time: 1108ms
memory: 48860kb

input:

200000 200000
12749 8649 3787 12929 4351 17169 14430 9997 4713 4885 1712 5918 17869 1089 12990 3726 16519 9243 12049 2596 4846 7946 622 4981 15329 17995 8799 14555 5746 4831 14025 3921 13855 13101 1273 336 18861 853 11645 10165 9969 10595 13613 9761 15391 13329 15361 1037 9141 1446 4331 13451 13711 ...

output:

2787
47195073
598363
47880925
64335
9604021
68075615
224304
272202
7653340
61372937
149127
64282168
65298990
1118
64415751
64878019
181380
25909
65215423
18231492
65162502
43621035
21432352
29795512
1768
65089092
65030096
114
61423602
114308855
24544347
99707893
65128716
1013
43277291
99715228
10464...

result:

ok 140250 numbers

Test #40:

score: 33
Accepted
time: 1020ms
memory: 22256kb

input:

200000 200000
1013 1406 1438 1844 4345 2202 4051 988 241 4947 4760 1181 894 4343 3725 4901 3182 3329 2704 3979 3961 4123 4902 2443 3303 3776 1209 4652 4957 1926 3734 1593 2276 4281 4068 1495 4217 3386 4361 73 1341 1758 4777 76 2025 491 4767 4693 1801 2082 2593 3346 4906 1288 4455 2487 4226 1545 2145...

output:

698312
240042
619
1164537
23258
6116300
1278364
984157
435921
3526
1061593
3302376
28167
6465087
5404820
6771
7105639
5259215
11129735
270196
41438128
5385535
40876712
10174165
122325333
5128714
2314
53784922
40880
40498008
117037074
122846313
548381
40455588
31670644
62785697
141428270
161440411
20...

result:

ok 140273 numbers

Test #41:

score: 33
Accepted
time: 988ms
memory: 22992kb

input:

200000 200000
2476 4995 2953 3523 754 4101 2456 2813 1689 1011 4436 3777 951 4213 4564 4265 4631 1617 3027 891 4226 4833 1953 3266 570 1181 3181 4771 3303 2097 1441 1537 1587 274 3873 937 3291 4697 2231 4331 3973 4849 1191 2768 2426 8 121 1449 1412 2907 4386 2877 4701 3779 4952 961 76 981 325 256 35...

output:

5988580
2153119
737941
572011
1974759
1549421
2700243
8837
295162
6164421
3478922
7051035
3121956
2367715
2047539
8685402
7594178
135997
9683689
8209365
2118320
1023638
5020819
6551832
7229918
9555362
7480507
132666
12465510
7975458
3813583
41199
14974119
2147312
3369281
15407296
6068558
49086
1895
...

result:

ok 60352 numbers

Test #42:

score: 33
Accepted
time: 863ms
memory: 22344kb

input:

200000 200000
2858 3474 3329 4609 1833 885 1631 4890 1249 4275 39 686 1587 983 1701 4841 1325 155 3206 1528 3902 1435 2151 2791 4799 3645 801 41 2291 2695 4129 1327 69 601 3737 3801 4233 3876 4977 4196 3731 2183 57 805 3227 2513 3361 709 966 3361 1409 4311 761 2305 3440 4991 2296 1449 4897 761 2416 ...

output:

1539
1601451
4660784
1361746
2166286
306165
1512947
582112
332009
812
769016
2598308
1545371
529266
1334013
3966257
1003355
179640
179157
1517870
1805934
476502
760872
375574
4100829
29900
37101
4318604
8080987
46696
796308
4669
372395
4987317
461669
874982
6821879
5893494
1782699
1556141
2614
32208...

result:

ok 140268 numbers

Test #43:

score: 33
Accepted
time: 722ms
memory: 19944kb

input:

200000 200000
16 4705 4887 1101 4161 4747 1418 105 3601 4665 3152 1611 1577 3538 3163 2373 3732 4505 865 4185 1183 2121 697 4135 2933 4611 1539 4656 2454 651 4721 32 881 909 1733 3391 1705 4930 1325 571 2351 2496 3481 2569 783 4724 1329 3912 2567 1751 2546 2048 3611 70 9 4645 996 2073 2286 2946 961 ...

output:

38808
1930372
4444128
312503
2426473
3525200
976743
1361351
9760
101482
3718
1566619
6222
4036259
3209276
536660
699508
48338
947575
2279713
7047
251620
196754
32220
658748
16025
23632
3227429
2225063
734078
2481472
10529
1313630
933
582790
4612240
782306
2411230
105512
1076346
95562
1818039
22337
1...

result:

ok 139724 numbers

Test #44:

score: 33
Accepted
time: 699ms
memory: 22436kb

input:

200000 200000
337 3375 390 1251 1328 2881 4182 2265 2189 2506 3913 2917 2381 156 2626 2134 3305 4157 665 1864 270 4902 1551 3798 3721 967 691 4326 851 4481 2465 4889 4591 4814 1463 2706 173 3546 1769 1903 3199 795 1710 1734 2009 3689 4897 3721 397 3457 4209 4069 471 4953 4353 145 4193 336 3021 3577 ...

output:

3178283
1638414
448102
2984541
2101908
69
699511
1796055
967770
782889
77285
10181
3109512
13509
12783
1018318
293835
1151842
84183
113453
56201
15397
1977652
1304
351745
3368734
5739426
1080668
794531
11409
3643322
3176281
78747
1551583
10147
955049
679958
6038
2223892
122096
199045
1068072
597755
...

result:

ok 60218 numbers

Test #45:

score: 33
Accepted
time: 683ms
memory: 14436kb

input:

200000 200000
657 353 887 376 172 441 253 261 413 661 611 522 745 758 961 103 451 281 636 306 623 244 957 685 423 137 131 308 281 311 376 881 242 575 110 121 228 534 211 865 657 113 551 518 743 281 904 562 537 305 212 737 601 401 161 401 921 165 545 857 945 341 607 313 648 551 176 125 31 408 665 961...

output:

49571
33653752
66951
16318208
1039083
5331751
3675491
525498
670043
3766466
13392599
2386134
3033
1019154
14377347
1187497
12190572
1213157
20579464
1048037
9128995
300441
11782470
158788
3802987
4767110
742014
7818759
1676973
1493959
2228283
25001617
5079096
187687
29705024
728530
19781359
3952515
...

result:

ok 60233 numbers

Test #46:

score: 33
Accepted
time: 701ms
memory: 14560kb

input:

200000 200000
905 971 146 617 605 261 699 215 591 593 7 233 821 677 721 361 684 611 823 509 751 905 637 501 533 561 225 503 150 139 36 873 116 724 961 641 801 832 119 591 633 719 989 407 528 841 341 345 481 671 211 936 141 976 301 33 211 393 51 686 272 106 973 589 501 235 801 385 972 455 833 101 377...

output:

1796938
21548968
7825188
2318711
7882518
600653
9242484
1519711
14076536
38497
7023124
8282599
69200
4481722
7785613
3308164
22798253
20371810
4909659
627255
510996
4329024
9757801
130578
10235527
4166436
157991
58898
4888778
8460348
1364
8672036
4598197
1426436
15491981
958302
462091
13832933
18579...

result:

ok 140217 numbers

Test #47:

score: 33
Accepted
time: 815ms
memory: 16104kb

input:

200000 200000
834 115 751 961 225 86 345 292 761 631 551 422 174 213 641 1 257 622 97 753 803 569 809 469 632 225 836 954 17 663 481 565 151 737 449 586 82 501 686 998 141 860 841 977 759 441 447 977 931 418 501 201 881 601 905 11 451 736 75 73 121 681 49 17 713 601 191 640 486 255 873 786 151 507 7...

output:

123780
23804721
7517914
1693371
11730894
170906
26559978
4816396
14458041
17636564
11500583
11082
4400957
834100
506
1121994
9917515
773312
382855
245950
9205086
6209265
14562316
193750
17944
61946
10501962
9265888
203533
10959
353463
3813492
12856
2503772
10144059
2592022
11803215
15431084
11586722...

result:

ok 140107 numbers

Test #48:

score: 33
Accepted
time: 949ms
memory: 13964kb

input:

200000 200000
120 270 284 566 911 843 122 1 961 439 511 273 444 395 185 897 392 95 961 297 709 224 200 181 125 701 221 641 444 575 971 875 357 648 940 305 501 931 693 385 913 462 641 391 249 490 356 576 5 185 503 488 783 771 561 215 831 825 51 698 161 701 772 846 23 76 817 851 238 218 369 261 792 59...

output:

621535
18707322
452888
15040286
257277
4858626
2650459
9351016
9031586
1291308
15239756
24443032
210897
1784131
13122742
5034680
2665621
5676816
40544
1128569
16494053
7921204
12797888
16467680
9682986
8275524
3030305
1272527
3135030
6438032
380403
7209322
3174575
779747
655810
5205199
7487658
29765...

result:

ok 59655 numbers

Test #49:

score: 33
Accepted
time: 1276ms
memory: 14660kb

input:

200000 200000
45 5 301 245 297 469 763 125 513 849 879 792 281 601 133 49 745 265 521 58 581 341 865 381 25 461 777 726 453 391 685 671 281 782 837 517 371 525 971 381 433 945 379 777 2 488 235 81 751 381 251 226 669 817 777 783 561 603 249 176 68 715 148 33 133 886 783 41 713 589 895 601 318 206 87...

output:

231971
1871143
9253912
4337921
55541437
50278429
804612
73905419
411918
51999718
6787696
862803
75795680
56239502
76306522
108783548
88777430
108665151
208981
22340771
10538580
30800033
83149806
141452197
407406
45065
13733101
77492
43196072
91154335
132173890
219275944
221532990
1217085
53311299
90...

result:

ok 59769 numbers

Test #50:

score: 33
Accepted
time: 971ms
memory: 14496kb

input:

200000 200000
396 552 214 337 237 399 601 391 372 353 65 785 45 871 834 501 491 245 740 986 593 122 18 368 237 894 825 379 653 369 173 791 973 881 591 958 821 161 825 601 552 629 793 155 171 841 659 43 835 521 235 77 226 771 861 761 659 681 117 176 897 625 291 221 911 167 985 81 437 885 151 985 340 ...

output:

1508336
7966959
2495602
50598778
7510481
37672707
47068275
55376185
26981529
2384433
31157554
19100518
9640497
9851630
36923876
16026
20595470
25443027
344072
18403
83579876
40553337
3505872
25856459
7245
6170963
8527
18905815
29663891
42109850
237240
94505673
65484260
41318980
32983830
8905088
3717...

result:

ok 140157 numbers

Test #51:

score: 33
Accepted
time: 933ms
memory: 14048kb

input:

200000 200000
21 41 39 3 153 241 229 171 216 101 26 159 245 220 85 1 273 186 57 214 41 61 165 244 141 235 175 171 269 174 256 121 292 40 151 190 113 137 72 138 251 40 233 289 148 275 221 101 1 256 294 131 289 37 264 229 287 181 133 52 155 41 199 108 268 241 281 176 69 133 61 107 7 172 297 1 100 61 2...

output:

8550628
29325692
65637341
15001158
680975
24703823
68038570
91791717
1722890
1750028
253
6335434
110578764
137551545
94130512
3312768
58721254
47665973
160906072
47656393
1995554
162017868
172356327
115194149
65359939
202232264
47207045
106129253
16042856
110052625
59576806
115606232
4035754
1200149...

result:

ok 140029 numbers

Test #52:

score: 33
Accepted
time: 1241ms
memory: 13908kb

input:

200000 200000
121 245 136 217 148 85 105 165 285 271 93 205 157 82 188 11 117 121 71 73 217 57 58 118 121 201 1 277 241 101 23 214 274 21 3 161 241 141 149 94 73 161 161 1 165 97 166 31 57 211 223 222 130 46 71 111 289 193 13 47 5 233 247 96 277 82 118 292 209 151 1 1 206 127 221 95 69 219 77 220 22...

output:

14004191
32561827
45299102
1305426
15580
22532965
9092580
47650228
1342514
204166721
25262032
53707
117488218
72403038
29146762
48577534
192696527
43725809
155311357
288261396
70412620
235232325
120003
18001371
59014806
200787468
3704963
47664692
5312127
40786789
124805001
2451895
165643477
255970
1...

result:

ok 60187 numbers

Test #53:

score: 33
Accepted
time: 740ms
memory: 13584kb

input:

200000 200000
97 205 249 49 256 292 66 239 256 253 1 105 167 277 285 219 247 177 21 193 211 17 1 237 217 61 168 191 251 254 74 229 193 47 91 2 19 129 141 97 157 44 280 41 103 117 190 199 187 256 103 97 157 97 41 226 79 27 91 96 185 189 197 161 1 1 233 1 166 67 195 212 292 1 115 297 73 1 78 259 163 1...

output:

25741747
30709590
14961875
9179432
19799134
62948
5518203
1096414
47270538
10281347
27933232
50044336
2201060
1307396
459140
830011
4512314
12635574
16146267
60498984
49176612
47968282
33291666
7986396
32946961
17192608
6878
44777790
33979381
708365
19630286
75886239
2013080
1052964
43145316
7299519...

result:

ok 159963 numbers

Test #54:

score: 33
Accepted
time: 937ms
memory: 11912kb

input:

200000 200000
149 81 181 23 73 93 83 133 235 101 113 126 24 133 55 157 172 289 173 27 2 160 59 241 127 300 17 134 19 27 16 241 77 131 61 1 281 1 296 280 83 4 73 123 206 127 196 17 131 35 190 151 235 59 118 116 61 73 184 29 115 91 109 93 17 261 8 175 276 25 255 293 286 115 121 178 21 93 41 1 183 5 1 ...

output:

7395889
100722380
3201398
9052551
95043906
14007017
13199868
19406397
6429063
2199796
8944687
2153197
55834788
57868796
3036108
31880864
31134493
11270587
10130741
54707400
42370668
87397056
14212556
6477118
5667821
72189828
35593637
8194047
45913976
12541005
128871001
5256648
59096714
12731810
1534...

result:

ok 40110 numbers

Test #55:

score: 33
Accepted
time: 640ms
memory: 14432kb

input:

200000 200000
88 272 192 71 221 129 28 53 246 293 273 181 286 189 210 271 104 156 280 85 274 97 209 25 180 94 138 172 111 79 10 37 39 265 109 157 81 106 31 63 259 91 109 93 281 255 113 264 246 98 61 235 268 285 210 227 177 25 21 198 211 73 10 226 125 229 151 37 285 244 79 141 252 196 151 70 145 89 6...

output:

10364051
94307814
8692275
4381491
14833
3363676
352503
41144868
58008762
35312970
32863893
546699
1140125
2008831
339994
9366830
9275626
2533006
7562846
45847660
20937396
1992842
6169739
413644
78979874
4649136
6251387
2371731
46015
5554431
112595231
58759199
51705251
836745
80802
72172620
2719801
1...

result:

ok 40349 numbers

Test #56:

score: 33
Accepted
time: 672ms
memory: 14116kb

input:

200000 200000
281 273 225 85 37 45 1 236 273 180 281 285 111 192 229 147 261 47 269 50 33 78 121 81 223 41 251 268 282 126 198 229 33 196 185 139 61 272 84 229 271 193 101 77 125 1 1 25 4 211 91 265 41 91 100 261 271 121 151 176 5 43 91 16 5 46 129 79 172 115 197 1 298 281 58 255 71 63 73 262 108 25...

output:

37271895
11050280
21606158
4786196
7518810
6152755
13992488
1349040
23417988
16746076
65871650
4776
29746230
7222339
1398849
5116893
146380
5389819
2577546
67936581
44700545
30926230
2823279
16296841
8024777
7056460
71620
2926809
382491
2146983
1321057
8200441
3813484
56710
31527137
19900152
3204968...

result:

ok 159853 numbers

Test #57:

score: 33
Accepted
time: 581ms
memory: 14740kb

input:

200000 200000
21 51 51 69 60 49 48 27 64 72 1 6 1 11 69 1 1 73 51 77 1 35 62 67 33 5 53 68 21 73 16 67 42 13 73 47 23 34 23 33 13 11 27 17 41 60 65 29 36 67 49 53 7 41 2 1 31 51 70 9 71 49 7 74 36 33 36 65 33 76 61 1 38 59 73 38 57 43 23 12 65 36 16 33 40 15 57 59 67 19 1 32 73 25 50 57 62 65 6 5 45...

output:

54874410
50335953
25390867
140505477
89181243
323510963
31751
104494123
129608099
133180406
3132569
67248728
28743995
3918013
134601985
223091821
55798337
109560514
236897579
1817
17822309
205629313
29521269
1583421
254216246
194563687
211661991
41788219
30746435
70179150
8471138
3072690
12769242
26...

result:

ok 159851 numbers

Test #58:

score: 33
Accepted
time: 899ms
memory: 11884kb

input:

200000 200000
11 41 51 7 63 61 53 1 41 57 1 25 13 61 24 50 17 69 37 3 11 17 21 21 57 59 59 73 20 22 6 22 75 9 26 4 17 13 1 35 21 41 54 77 13 66 6 74 69 62 63 73 65 21 61 73 21 55 20 17 30 32 65 15 62 74 41 65 14 58 41 41 20 9 43 69 17 33 47 12 33 15 21 25 71 5 52 27 33 41 36 63 29 49 41 27 25 49 6 2...

output:

762580
70090850
14753415
244736700
35429743
52937787
49158876
37034067
72784568
12128658
23668012
97701358
2426733
21810409
255810398
185524064
32717943
88774267
8645799
1110485
40218772
41980696
175739371
41785052
173988792
7132965
136883942
73939914
20736784
2103858
105354940
18524170
32412953
413...

result:

ok 40028 numbers

Test #59:

score: 33
Accepted
time: 660ms
memory: 12008kb

input:

200000 200000
57 73 32 21 27 34 73 76 1 65 51 45 79 1 27 1 69 51 3 1 7 23 26 68 69 21 57 9 14 48 49 63 25 77 65 49 65 28 61 16 41 66 9 61 29 61 41 31 41 69 33 53 29 33 61 47 51 1 71 48 33 64 41 57 41 18 19 29 35 49 59 9 42 51 5 36 1 65 12 1 31 9 78 31 39 54 61 33 32 1 16 41 33 25 65 61 49 2 48 31 17...

output:

191663997
255947436
81348413
36650778
38892886
236038
13672261
52683898
13079538
497951
3227113
43584238
23534748
5030009
177272485
36921819
115747568
56064136
3455723
129976771
272287498
41481147
5399082
18701988
25936353
27925190
66183534
284073164
16001
133398353
101600007
14026665
96611381
43950...

result:

ok 160009 numbers

Test #60:

score: 33
Accepted
time: 1245ms
memory: 13972kb

input:

200000 200000
55 49 33 38 31 37 37 61 15 49 72 56 71 13 69 49 1 31 18 21 31 65 80 27 33 9 32 41 2 50 47 31 13 76 37 73 9 21 11 67 71 61 1 33 1 61 41 23 35 72 67 79 71 45 46 33 6 44 61 10 41 72 75 29 17 65 71 11 21 7 47 47 13 49 43 9 52 43 19 76 71 55 46 47 42 20 37 49 71 7 58 45 17 1 65 47 5 47 68 1...

output:

23937908
44930449
3170206
70795036
62497123
159175114
296587131
35501146
23571066
73723225
113972325
158063353
249039907
93091522
1220334
750152
44233075
35145516
100380800
18120729
17780295
357850725
209770260
328865382
98020311
161998520
110428241
165694381
222715253
58666126
189213901
465023753
1...

result:

ok 40052 numbers

Test #61:

score: 33
Accepted
time: 1174ms
memory: 14108kb

input:

200000 200000
17 7 3 8 1 11 17 5 13 1 4 5 15 6 1 11 17 11 2 5 1 14 9 13 8 10 17 1 6 13 15 6 4 15 5 1 5 19 7 11 2 3 14 1 11 5 11 1 1 17 11 1 10 17 1 2 5 9 5 1 5 1 1 17 15 2 17 14 1 13 6 5 1 17 11 14 13 3 10 1 11 1 17 5 4 12 15 18 19 6 1 7 5 1 1 3 13 16 13 16 11 3 5 1 4 1 9 5 6 1 16 11 14 7 1 16 1 17 ...

output:

66881
1238718782
434190716
33231361
4807182
18997270
1156255200
122193491
833694917
676138973
36409225
55518013
27531232
1113224896
233403856
61117616
526248325
135900995
23200535
26729187
1084603
325728428
199723840
390584678
1137974771
18597855
868211364
405480
640436867
257931048
540787783
238201...

result:

ok 39914 numbers

Test #62:

score: 33
Accepted
time: 585ms
memory: 12132kb

input:

200000 200000
17 17 15 7 9 1 7 13 9 15 17 6 18 7 16 1 7 1 1 7 20 9 13 1 11 11 5 11 11 17 17 1 13 1 17 1 11 7 1 9 16 13 13 19 12 1 1 13 14 13 11 9 4 13 1 5 18 11 1 1 5 16 1 12 17 5 16 1 1 16 19 3 3 11 6 5 15 5 13 1 17 13 11 5 3 1 3 19 2 1 13 11 1 1 17 13 1 11 5 1 5 5 14 18 4 11 19 8 8 6 11 17 1 3 8 1...

output:

96963323
58332019
718236880
135470054
489700751
2936385
225148200
437149854
322816845
177662628
65046474
411757250
876460
1613316
369683906
936389824
84704525
100868736
483107315
112734103
132202
465103891
200749221
88543135
953190975
101407369
87233549
44546180
987037351
64478149
37210148
107709156...

result:

ok 160129 numbers

Test #63:

score: 33
Accepted
time: 851ms
memory: 14744kb

input:

200000 200000
1 16 11 14 4 4 1 2 16 11 17 11 19 17 19 5 15 10 5 13 16 7 15 6 17 13 17 6 7 9 14 13 9 5 5 8 1 11 18 11 5 17 1 17 13 16 1 1 16 1 5 1 1 11 7 5 9 4 11 19 9 4 1 5 4 17 5 7 8 5 1 16 13 20 1 10 17 1 5 8 1 16 9 1 1 13 1 11 9 6 7 6 1 13 1 1 17 8 1 17 9 10 17 9 14 1 16 6 5 15 2 17 5 17 6 12 20 ...

output:

199808015
166528180
198605730
52270783
1001176633
30102090
57226794
769271558
179291424
34292
32107647
100378857
8399046
273183229
21254204
97753589
114606015
219900551
1297252743
365075443
119445929
550865209
276141764
13856264
36599544
58284141
138745866
65519491
266300320
1456489182
902786336
243...

result:

ok 40111 numbers

Test #64:

score: 33
Accepted
time: 543ms
memory: 12132kb

input:

200000 200000
9 9 9 12 14 4 6 1 20 17 1 1 1 16 9 3 13 18 5 1 10 7 9 10 9 7 16 11 10 13 9 7 1 17 18 2 17 9 19 14 17 17 1 17 17 3 2 11 18 1 20 9 14 16 5 7 17 1 1 17 17 14 17 9 5 1 15 3 13 9 16 3 1 9 16 1 9 7 1 13 14 5 1 16 6 2 11 3 11 18 3 19 15 5 11 1 5 5 17 16 5 16 11 1 9 17 19 14 9 1 2 19 5 12 7 11...

output:

300060706
934655255
605179944
87146941
104457160
1280662222
121045536
430011043
45817605
16200407
493913286
486442099
77620998
27031390
5195285
1808208
63348882
46421
215110769
54819254
897428247
545721177
463268274
64063485
25351539
28651660
333436780
15202818
9931499
1160923892
160358486
351144557...

result:

ok 39977 numbers

Test #65:

score: 33
Accepted
time: 1095ms
memory: 14008kb

input:

200000 200000
252 101 153 268 161 226 131 237 43 153 31 81 58 205 173 85 217 199 283 165 41 70 241 277 231 11 192 121 101 189 246 5 229 267 53 164 210 265 173 61 246 183 121 273 256 53 102 101 7 97 241 31 295 251 187 141 91 79 127 61 34 293 265 151 1 9 36 13 1 145 101 6 182 217 151 111 289 217 241 1...

output:

33578075
5173291
3586899
10890115
98633914
42175907
61204890
91856990
21869072
42730429
78117902
18854442
4452775
154539
1710968
13679196
14801332
114021453
34510368
12269374
3682117
5480596
9110702
1177765
146688076
51162287
1073128
100056239
643386
6030546
37947267
6786578
70972654
19713877
925397...

result:

ok 99929 numbers

Test #66:

score: 33
Accepted
time: 1127ms
memory: 11756kb

input:

200000 200000
201 80 89 19 121 202 177 16 271 221 6 254 20 69 1 271 285 208 181 21 181 45 86 151 101 61 1 81 76 93 288 289 269 61 91 213 76 129 181 237 51 272 13 31 59 41 15 73 169 289 157 21 263 141 229 85 207 100 226 244 106 291 79 157 51 50 197 28 214 261 43 33 211 9 177 93 226 1 289 37 36 98 217...

output:

2330741
9882968
166799
20135175
34267298
5002084
33640756
91700455
251323590
119322120
394641200
217519786
210458344
226961464
5528611
917580
166065743
309815210
434723907
143525736
51849868
178121262
22741184
456505025
417770484
144542042
443608706
70240828
4915189
217610
54118093
224634556
7367501...

result:

ok 100002 numbers

Test #67:

score: 33
Accepted
time: 1178ms
memory: 18024kb

input:

200000 200000
561 2601 1557 627 1895 325 89 1731 1927 2898 2753 80 2178 2117 2365 2971 1351 1016 1857 496 2791 905 1151 2072 2769 2891 2656 1741 2381 385 1441 1909 2302 2617 1393 1669 2649 253 1623 758 2070 1075 473 2781 859 1852 1418 1177 1441 1573 2260 2932 2590 1657 1036 2062 1506 1929 2607 1949 ...

output:

83931750
182166
366654104
33496
8562250
5463
422039
39104387
42792074
1883131
279358276
163261630
71372558
55414
139587360
113850515
28811912
162839891
40811492
20005058
28754
301094057
21566
274363391
591
3515226
36271856
68661621
211744240
162947052
158750
912685
2036123
8347779
121181233
12909591...

result:

ok 100208 numbers

Test #68:

score: 33
Accepted
time: 972ms
memory: 67484kb

input:

200000 200000
15119 6657 791 7665 2521 15268 6721 7301 28501 6603 10517 20318 19933 2926 21157 4096 10781 6168 6904 2947 8039 25745 2419 15157 1753 20257 26769 16264 20559 8137 16801 4789 8049 6171 16861 23041 4344 25486 18506 11932 27169 2867 14431 21073 438 8041 26369 1516 26435 29341 18826 19369 ...

output:

152093
1050495
392645
26241
16179
8836
34257
30354
65704
152529
45610
14303
20127
99476
306397
796038
76069
893050
156810
179311
117699
998856
547388
130609
204237
1493
1343149
499749
1056850
1059397
20755
52120
515680
3027
274697
124537
356057
308964
48021
13881
30
610916
119764
8543
60745
3787
303...

result:

ok 100270 numbers

Test #69:

score: 33
Accepted
time: 480ms
memory: 12248kb

input:

200000 200000
1 3 3 2 1 3 1 1 2 2 1 3 2 1 2 1 3 1 2 3 2 1 3 1 2 1 1 2 3 3 1 1 1 1 2 1 2 1 1 2 1 1 1 1 1 1 1 1 3 1 1 1 2 1 1 2 1 1 3 1 1 1 1 3 1 1 1 1 3 1 1 1 3 1 1 2 1 2 1 3 1 1 1 3 1 3 1 1 3 1 1 1 3 1 1 1 1 1 1 1 3 1 1 1 3 3 1 1 1 2 1 1 1 1 2 1 1 3 3 3 1 3 3 1 1 2 1 1 1 2 1 2 1 1 3 1 3 3 2 1 3 1 3 ...

output:

5957737131
3973075848
930698605
364714
44786902
8178409
73440174
117000431
241116886
156194625
420919741
1195013784
537788224
2214285789
2412709846
2172654894
219767229
311372459
3132767098
2979685886
42899547
112697459
18219576
1208486
583753549
23275848
485537084
78091685
801345740
36721308
116320...

result:

ok 100133 numbers

Test #70:

score: 33
Accepted
time: 1167ms
memory: 189992kb

input:

200000 200000
58061 61281 8751 70376 20011 31876 8313 29441 26241 58361 30075 91521 92042 20173 92299 7442 3251 61805 7221 42119 15185 16340 22465 60045 96881 81770 76673 54118 15649 42961 51017 49599 76085 12389 19809 82371 1481 88093 24341 34018 82429 28481 65633 76855 84830 6561 12333 7423 90631 ...

output:

133796
13491
975
62472
2
37
80937
46994
68858
659
2107
41502
5514
129466
14635
1943
79238
12348
45006
6401
105884
110824
34732
46534
2028
187424
167256
194128
2514
15405
87047
7047
15155
59347
14164
647
398
69100
42737
9612
293488
20746
565
174482
1418
279936
12513
202671
58911
1792
3097
30437
76908...

result:

ok 100467 numbers

Test #71:

score: 33
Accepted
time: 990ms
memory: 188780kb

input:

200000 200000
739 32101 66115 92637 38607 10119 18273 46507 37691 39501 92077 60689 57521 88795 6145 90523 57849 86085 17326 65233 9175 33595 11501 95873 97248 58846 9921 7015 86548 45221 7180 8701 47481 98773 89997 31333 4617 55543 20493 8026 81737 28737 30286 73156 79483 94840 47632 74501 65234 61...

output:

45509
7801
80915
1160
74660
96528
194205
244688
583
13059
298667
106835
20250
13504
223366
132926
278798
109067
34876
6810
222417
241774
37335
13373
405252
250052
37441
91870
22070
212942
32399
116373
31535
80133
5045
11526
355350
62206
73188
37801
87181
205670
168483
212727
288075
272557
280636
236...

result:

ok 100474 numbers

Test #72:

score: 33
Accepted
time: 1349ms
memory: 190556kb

input:

200000 200000
67648 83760 50776 45217 98711 57378 76441 96722 92537 33681 93412 98269 2929 21852 9125 27911 61189 42321 64017 5081 88251 21381 64298 3241 47069 35015 17722 70797 94430 85161 77609 42878 22001 22401 21437 20265 9677 98955 81038 68587 15293 83171 94571 17916 9 41522 53769 13912 55271 7...

output:

12823
2685
8585
13654881
13636472
2279
10296948
4521358
9
1103
26430
9035415
9042824
19457120
9048838
9026601
4672416
54
782
13758289
4496076
9021730
9034918
24810267
62108731
38467291
9166324
31900796
27489522
9178552
78380632
9179607
1519
1899
26091124
47214155
22066884
12397682
76399740
4658368
2...

result:

ok 100464 numbers

Test #73:

score: 33
Accepted
time: 1427ms
memory: 190188kb

input:

200000 200000
66466 20665 20000 43391 59275 93909 86231 99009 78767 88325 35669 29585 89325 80157 39271 5633 66937 30802 30056 4219 46623 17561 59297 34438 5276 15401 7285 80225 13975 57721 91361 63161 80144 71163 21164 74921 74810 99291 46131 24833 44961 30431 94861 95913 24995 2901 33879 93953 716...

output:

85060
30453
123356
5
4411
15088
21610865
50033557
50038719
123832119
140856432
259261303
5177
124186720
279870129
180732389
329057634
117429755
247591472
24723861
4891566
134121337
333146511
70150103
361953644
232540
437814548
236929104
346120321
493694515
303915149
203655571
27135929
28021898
30962...

result:

ok 100464 numbers

Test #74:

score: 33
Accepted
time: 517ms
memory: 12512kb

input:

200000 200000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

53961156
112356263
181193743
77122588
279413262
387154521
29765851
54221666
24101828
78632428
115881882
121951904
46606683
65096378
407269048
72147750
38879591
79159093
383873042
58580923
273765146
139362533
322044331
362120090
335481186
130270522
809859427
150138161
935314
576310118
485729141
56718...

result:

ok 39678 numbers

Test #75:

score: 33
Accepted
time: 758ms
memory: 13768kb

input:

200000 200000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

12953982
50056059
15523266
31818660
3846912
6143388
21478242
7788843
43865004
21211480
23909784
4936752
13388614
22021962
16109505
377566
4818867
26778562
2660826
4777581
11541612
45905276
18962266
30180141
1170343
3295899
55955047
54585837
3023194
37830412
4742723
9877270
234425
5785182
3324588
432...

result:

ok 79895 numbers

Test #76:

score: 33
Accepted
time: 608ms
memory: 27084kb

input:

200000 200000
7230 9929 3012 6918 3746 9238 156 3149 2476 7731 3473 2618 7461 7315 3679 249 8755 5126 5937 1949 5543 7611 1837 6135 1066 8591 6661 3545 4221 7112 3833 3714 6290 2498 9561 8986 4091 8361 4049 6851 282 9257 4321 3797 8884 2315 6858 3784 3389 7555 71 7951 5657 2969 7951 7397 9201 2976 8...

output:

3516680
3516680
3516680
3516680
3516680
3516680
3516680
3516680
3516680
3516680
3516680
3516680
3516680
3516680
3516680
3516680
3516680
3516680
3516680
3516680
3516680
3516680
3516680
3516680
3516680
3516680
3516680
3516680
3516680
3516680
3516680
3516680
3516680
3516680
3516680
3516680
3516680
3516...

result:

ok 200000 numbers

Test #77:

score: 33
Accepted
time: 1018ms
memory: 30412kb

input:

200000 200000
2327 7475 7638 3795 7519 7621 5685 31 9762 277 692 980 6286 6557 72 7634 4998 7731 9727 5966 9751 2670 453 1771 7789 2603 6514 3704 9798 5455 1191 361 903 1022 441 1626 5358 9067 6988 7169 9432 7312 9555 4036 2915 9088 9367 7899 4823 9308 1415 983 2817 1923 1711 1235 4528 749 3388 2538...

output:

19999500003
19999500003
19999500003
19999500003
19999500003
19999500003
19999500003
19999500003
19999500003
19999500003
19999500003
19999500003
19999500003
19999500003
19999500003
19999500003
19999500003
19999500003
19999500003
19999500003
19999500003
19999500003
19999500003
19999500003
19999500003
...

result:

ok 1987 numbers

Test #78:

score: 33
Accepted
time: 740ms
memory: 30560kb

input:

200000 200000
2353 5159 9480 9693 1731 6267 585 9380 783 3861 9508 1332 6789 7856 3769 5267 166 1293 4373 324 2771 5446 9499 2351 3541 2769 3143 4437 4206 4696 2430 2847 4047 166 1209 1031 1804 7444 852 3849 2797 1702 1586 5307 2598 2799 35 4539 6378 6028 3689 9672 2043 4863 9671 8147 8453 8507 8363...

output:

2036281
2036281
2036281
2036281
2036281
2036281
2036281
2036281
2036281
2036281
2036281
2036281
2036281
2036281
2036281
2036281
2036281
2036281
2036281
2036281
2036281
2036281
2036281
2036281
2036281
2036281
2036281
2036281
2036281
2036281
2036281
2036281
2036281
2036281
2036281
2036281
2036281
2036...

result:

ok 197983 numbers