QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#305735#7684. Sweet Sugar275307894a#AC ✓617ms110888kbC++141.3kb2024-01-15 21:53:332024-01-15 21:53:33

Judging History

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

  • [2024-01-15 21:53:33]
  • 评测
  • 测评结果:AC
  • 用时:617ms
  • 内存:110888kb
  • [2024-01-15 21:53:33]
  • 提交

answer

#include<bits/stdc++.h>
#define Gc() getchar()
#define Me(x,y) memset(x,y,sizeof(x))
#define Mc(x,y) memcpy(x,y,sizeof(x))
#define d(x,y) ((m)*(x-1)+(y))
#define R(n) (rnd()%(n)+1)
#define Pc(x) putchar(x)
#define LB lower_bound
#define UB upper_bound
#define fi first
#define se second
#define eb emplace_back
using namespace std;using ll=long long;using db=double;using lb=long db;using ui=unsigned;using ull=unsigned long long;using pii=pair<int,int>;
const int N=1e6+5,M=N*20+5,K=(1<<25)+5,mod=998244353,Mod=mod-1;const db eps=1e-9;const int INF=1e9+7;mt19937 rnd(time(0));
int n,k,c[N],sum[N],f[N];vector<int> S[N];
int cnt;
void dfs(int x,int La){
	sum[x]=c[x];f[x]=-INF;
	for(int i:S[x]) if(i^La){
		dfs(i,x);
		f[x]=max(f[x]+sum[i],f[i]+sum[x]);
		sum[x]+=sum[i];
	}
	if(c[x]==1) f[x]=max(f[x],1);
	if(sum[x]>=k&&(sum[x]-k)%2==0){
		sum[x]=0;f[x]=-INF;cnt++;
	}else if(f[x]>=k){
		sum[x]=0;f[x]=-INF;cnt++;
	}
}
void Solve(){
	int i,j;scanf("%d%d",&n,&k);
	for(i=1;i<=n;i++) scanf("%d",&c[i]);
	for(i=1;i<=n;i++) S[i].clear();
	cnt=0;for(i=1;i<n;i++){
		int x,y;scanf("%d%d",&x,&y);
		S[x].emplace_back(y);S[y].emplace_back(x);
	}
	dfs(1,0);
	printf("%d\n",cnt);
}
int main(){
	int t=1;
	scanf("%d",&t);
	while(t--) Solve();
	cerr<<clock()*1.0/CLOCKS_PER_SEC<<'\n';
}

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

詳細信息

Test #1:

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

input:

4
7 5
1 2 1 2 2 1 2
1 2
2 3
3 4
3 5
5 6
5 7
2 2
1 0
1 2
1 1
1
1 2
1

output:

2
0
1
0

result:

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

Test #2:

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

input:

12
1 1
0
1 1
1
1 1
2
1 2
0
1 2
1
1 2
2
1 3
0
1 3
1
1 3
2
1 2000000
0
1 2000000
1
1 2000000
2

output:

0
1
0
0
0
1
0
0
0
0
0
0

result:

ok 12 numbers

Test #3:

score: 0
Accepted
time: 145ms
memory: 32824kb

input:

200000
5 2
1 1 0 0 1
2 4
5 2
4 1
3 2
5 1
0 0 0 0 0
5 1
1 2
3 2
5 4
5 3
1 0 0 0 1
1 4
4 2
3 4
5 2
5 9
1 0 0 0 2
4 3
2 1
3 1
5 1
5 3
0 1 1 0 1
5 4
2 1
4 3
5 1
5 1
0 2 1 1 1
5 3
2 4
3 4
1 4
5 1
1 0 1 1 0
1 5
4 2
1 3
5 2
5 7
0 2 1 1 2
5 1
2 3
2 5
5 4
5 5
0 1 0 1 0
2 4
4 3
5 2
1 5
5 1
0 0 1 0 1
4 1
4 5
2...

output:

1
0
0
0
1
3
3
0
0
2
0
0
2
1
0
0
1
1
0
2
0
1
0
2
1
0
0
0
0
0
1
2
0
0
2
2
0
1
0
0
0
0
3
3
0
0
1
1
2
1
2
0
4
0
1
1
0
1
0
0
1
5
0
1
1
1
0
1
1
1
1
1
1
0
1
1
1
0
3
1
0
1
0
0
4
0
0
0
1
1
0
0
1
0
2
0
5
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
0
0
0
0
1
0
0
0
0
0
1
0
0
1
1
0
1
0
1
1
1
2
0
1
2
0
0
2
0
0
1
0
0
0
0
0
...

result:

ok 200000 numbers

Test #4:

score: 0
Accepted
time: 145ms
memory: 31408kb

input:

100000
10 16
0 1 0 1 0 1 1 0 1 1
4 10
3 10
9 1
4 7
5 2
9 5
6 9
2 3
8 4
10 18
1 0 0 1 0 0 1 1 0 2
5 1
4 2
5 3
3 4
2 10
4 9
3 8
7 3
6 5
10 13
0 1 0 1 0 1 1 0 1 1
5 2
4 3
1 6
8 9
1 8
3 5
9 4
7 6
3 10
10 16
1 0 1 0 1 1 1 0 1 1
6 8
2 4
9 6
2 6
4 10
5 3
1 6
8 7
3 6
10 13
0 0 0 0 1 0 1 0 1 0
2 1
2 7
7 9
7 ...

output:

0
0
0
0
0
0
1
0
0
1
0
0
0
0
0
1
0
1
1
0
1
1
0
0
0
1
0
0
0
0
0
0
2
1
2
1
0
2
0
0
1
0
0
2
5
1
0
2
1
0
0
1
0
0
1
1
0
1
0
1
7
0
1
1
0
0
1
1
8
1
0
1
1
1
1
0
1
1
4
0
1
0
0
0
3
0
0
2
1
10
1
1
0
2
0
1
0
0
0
0
1
0
0
0
0
1
0
0
0
0
0
0
0
7
0
0
2
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
5
0
6
1
2
0
1
0
0
0
0
4
1
0
0
0
7
0...

result:

ok 100000 numbers

Test #5:

score: 0
Accepted
time: 138ms
memory: 33372kb

input:

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

output:

0
0
0
0
0
0
0
0
5
1
0
1
17
3
0
0
0
1
0
1
0
0
0
1
1
0
1
0
0
0
0
1
0
1
0
1
0
1
1
0
2
3
0
1
2
1
1
0
1
1
0
0
2
0
2
0
1
1
5
1
0
1
0
15
2
3
1
0
1
2
1
1
1
2
0
1
1
1
1
1
18
1
1
2
1
2
4
0
2
1
5
0
1
0
1
1
9
0
0
0
0
1
0
8
0
0
0
1
0
3
0
0
3
1
0
0
0
1
0
0
1
0
5
0
0
0
0
0
0
0
9
0
1
0
3
0
0
0
0
0
0
3
1
1
1
1
0
2
1...

result:

ok 50000 numbers

Test #6:

score: 0
Accepted
time: 144ms
memory: 33168kb

input:

20000
50 81
1 0 1 0 0 1 0 2 1 1 0 1 1 0 0 0 1 1 1 1 1 0 1 0 1 1 1 0 1 0 1 0 1 0 1 0 0 1 0 1 0 1 1 0 1 1 0 1 0 1
45 6
43 7
29 38
3 27
42 50
27 32
50 24
41 6
12 32
17 18
6 31
44 5
2 9
2 32
28 26
2 20
40 47
34 27
16 43
4 23
36 43
9 13
19 47
4 50
25 48
37 19
49 22
42 11
46 25
1 15
10 16
8 23
6 39
30 8
2...

output:

0
3
0
0
0
0
23
0
0
0
0
0
1
0
0
1
1
0
0
0
8
0
2
4
0
6
0
0
1
0
0
1
0
1
0
0
0
0
1
0
0
1
1
1
0
0
1
0
3
1
1
1
1
3
0
0
1
2
1
1
3
1
1
1
1
0
5
1
0
0
0
1
2
1
7
4
3
2
1
0
1
0
1
0
3
1
3
1
1
1
1
1
1
0
1
1
0
0
1
0
1
0
0
0
0
0
1
0
0
0
1
0
11
0
0
1
0
0
17
3
0
4
2
0
0
2
1
2
0
0
3
1
0
0
0
0
1
0
2
0
0
2
0
0
2
1
1
1
7...

result:

ok 20000 numbers

Test #7:

score: 0
Accepted
time: 145ms
memory: 33092kb

input:

2000
500 895
1 2 0 0 1 0 1 1 0 0 0 0 1 1 0 0 1 0 1 0 1 0 1 0 0 1 0 0 0 0 1 1 1 0 0 0 0 1 1 1 0 1 1 1 0 1 0 0 1 1 0 0 1 0 0 1 1 1 1 1 0 1 1 1 0 1 1 1 1 0 0 0 0 0 1 1 0 0 0 0 0 1 1 1 1 0 0 1 1 0 0 1 0 1 0 1 1 1 0 0 1 1 0 0 1 1 0 1 0 0 0 0 0 1 1 1 1 0 0 1 0 0 1 1 2 0 0 0 1 1 0 0 0 0 0 1 1 0 1 0 1 0 0 1...

output:

0
0
6
0
0
1
0
0
1
0
1
0
35
0
0
1
0
0
0
1
0
0
1
1
4
5
0
0
0
0
0
1
0
0
0
0
3
0
0
0
0
134
0
0
3
1
12
6
9
9
1
0
0
2
2
0
1
3
0
4
11
0
1
26
0
0
3
0
2
1
0
3
5
2
3
0
1
1
12
1
1
2
36
15
1
1
0
0
2
1
1
4
1
2
0
1
0
1
1
3
0
2
0
2
0
0
0
0
0
2
1
0
0
3
3
4
0
0
0
1
0
0
0
0
0
2
0
2
1
0
0
0
0
0
0
0
0
0
2
1
4
0
1
2
9
2...

result:

ok 2000 numbers

Test #8:

score: 0
Accepted
time: 163ms
memory: 33372kb

input:

200
5000 3054
2 1 0 1 2 2 1 2 2 2 2 2 2 2 0 2 2 0 0 2 1 0 2 0 2 2 2 2 2 0 2 2 2 2 1 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 0 1 0 0 2 0 2 0 2 2 2 2 2 2 2 2 2 2 0 2 2 1 0 2 2 2 1 2 2 1 2 1 0 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2 2 0 2 1 2 2 2 2 2 2 2 0 1 1 2 1 1 1 2 2 2 2 0 2 2 2 2 1 0 2 2 2 2 2 ...

output:

2
1
5
14
0
1
3
1
2
1
1
1
1
1
4
0
54
1
0
1
10
1
0
1
0
2
3
4
0
1
1
0
0
3
1
3
0
0
0
0
0
0
0
4
1
0
0
1
0
0
10
1
0
7
1
0
0
3
8
1
2
2
1
1
1
6
0
29
3
1
4
10
5
1
1
1
1
2
0
0
0
33
1
1
18
1
0
1
0
11
0
1
0
0
0
0
1
1
0
20
3
0
3
2
2
1
1
1
14
4
1
10
1
1
1
3
2
4
0
0
1
0
4
0
30
1
0
0
1
1
1
0
0
12
0
0
0
0
13
2
0
1
1...

result:

ok 200 numbers

Test #9:

score: 0
Accepted
time: 251ms
memory: 38224kb

input:

20
50000 24898
2 2 2 2 2 1 1 2 0 1 0 0 0 2 0 2 1 2 2 2 1 1 1 1 2 2 1 1 2 2 2 2 2 0 0 2 2 2 0 2 2 0 2 1 0 2 1 0 0 1 0 1 0 2 2 2 0 0 0 2 2 2 2 0 2 1 2 2 0 0 1 1 2 0 2 1 2 0 2 2 2 1 1 2 1 2 1 2 1 1 2 2 0 0 1 1 1 0 2 2 1 1 0 0 0 2 2 1 2 1 2 1 1 2 1 1 1 2 1 2 2 0 1 2 1 1 2 0 1 2 0 0 1 1 2 1 0 2 2 2 0 2 0...

output:

2
0
5
100
13
19
0
1
0
1
0
1
3
1
0
0
1
8
0
1

result:

ok 20 numbers

Test #10:

score: 0
Accepted
time: 581ms
memory: 109624kb

input:

1
1000000 3
1 1 2 0 2 1 2 2 1 0 0 1 0 2 2 0 2 2 2 2 2 2 2 2 2 2 2 2 2 0 2 2 2 2 0 1 2 1 2 2 1 2 0 2 2 0 1 2 0 2 1 2 0 2 2 1 0 2 2 2 2 0 2 0 2 0 0 0 2 0 0 0 2 2 0 2 0 1 0 0 0 1 2 1 2 2 2 1 0 1 0 1 2 2 2 2 0 1 1 0 2 2 2 1 1 2 2 0 1 0 1 2 1 2 0 0 1 2 0 2 0 2 0 2 2 2 0 1 0 2 2 1 2 0 2 0 2 1 2 0 1 2 1 1 ...

output:

206384

result:

ok 1 number(s): "206384"

Test #11:

score: 0
Accepted
time: 564ms
memory: 95932kb

input:

1
1000000 50
1 2 0 2 0 0 0 1 2 1 2 1 1 0 2 0 0 1 2 1 2 2 2 0 0 2 2 2 2 1 2 2 1 1 1 2 2 1 0 0 2 1 1 1 0 0 2 2 0 2 0 2 1 2 0 0 2 2 2 0 0 1 0 2 1 1 1 1 0 2 2 2 0 2 0 2 2 0 0 0 2 0 2 2 0 2 0 0 2 0 0 1 0 1 2 1 2 2 2 2 2 2 1 1 0 2 0 2 2 1 2 2 2 0 2 2 2 1 2 1 2 0 0 1 1 2 0 1 1 2 1 2 2 0 0 0 0 1 1 2 1 1 2 1...

output:

22653

result:

ok 1 number(s): "22653"

Test #12:

score: 0
Accepted
time: 581ms
memory: 108132kb

input:

1
1000000 51
1 1 2 0 0 2 2 1 2 0 0 1 2 0 0 0 0 2 1 1 2 2 2 2 2 0 1 1 1 0 2 1 1 1 0 2 2 2 0 0 2 1 2 2 2 1 0 2 1 1 0 2 2 1 2 1 1 0 0 2 2 1 0 1 1 1 2 2 0 1 2 2 1 0 1 0 2 2 2 1 2 2 0 2 0 0 1 1 1 1 2 2 1 2 2 2 1 2 2 1 0 0 2 1 2 2 2 0 2 2 2 1 1 2 0 2 2 2 1 0 1 1 2 1 0 0 1 0 0 0 2 2 1 2 2 1 0 0 1 0 2 2 1 1...

output:

22240

result:

ok 1 number(s): "22240"

Test #13:

score: 0
Accepted
time: 566ms
memory: 99188kb

input:

1
1000000 233
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...

output:

4027

result:

ok 1 number(s): "4027"

Test #14:

score: 0
Accepted
time: 576ms
memory: 95016kb

input:

1
1000000 233
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...

output:

0

result:

ok 1 number(s): "0"

Test #15:

score: 0
Accepted
time: 595ms
memory: 94808kb

input:

1
1000000 233
2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2 1 2 2 2 2 2 2 2 2 0 2 1 2 2 0 2 2 2 2 1 0 2 2 2 2 2 1 2 2 2 2 1 2 1 0 1 2 2 2 1 2 2 2 0 2 2 2 2 2 2 2 2 2 2 2 2 2 0 2 0 2 2 2 2 2 2 2 2 2 1 2 2 2 1 2 0 2 2 2 2 0 2 2 2 0 0 2 2 2 1 2 2 2 2 2 2 2 2 1 0 2 2 2 2 1 2 1 2 2 2 2 0 2 2 2 0 2 2 2 ...

output:

6671

result:

ok 1 number(s): "6671"

Test #16:

score: 0
Accepted
time: 609ms
memory: 110568kb

input:

1
1000000 233
1 0 2 1 1 0 0 1 1 0 2 2 0 2 0 0 1 2 2 0 2 1 0 0 0 2 2 2 0 0 2 2 2 1 2 0 1 1 2 2 2 0 1 2 2 0 2 2 0 1 0 2 1 0 2 2 1 1 2 1 1 1 2 2 0 2 2 2 2 2 2 2 1 0 0 1 2 1 2 0 2 2 0 2 2 2 1 2 2 2 2 2 2 2 2 2 0 1 2 2 0 1 1 1 0 0 2 2 1 0 0 2 2 1 2 1 0 1 2 2 1 0 1 2 2 1 1 2 1 0 1 2 2 0 1 0 2 2 2 1 0 0 2 ...

output:

4979

result:

ok 1 number(s): "4979"

Test #17:

score: 0
Accepted
time: 615ms
memory: 110728kb

input:

1
1000000 233
0 0 0 0 0 0 0 1 1 1 1 1 1 0 0 1 1 0 1 0 1 0 0 0 1 0 1 1 1 2 2 1 0 2 0 1 0 1 1 0 0 1 0 0 1 1 0 1 1 1 0 1 1 0 2 0 0 0 1 1 0 0 2 2 1 1 1 0 1 0 0 2 0 0 0 1 1 2 1 0 1 0 1 1 0 2 1 1 2 1 1 0 0 1 2 2 0 1 2 1 1 0 2 1 0 1 1 1 1 1 1 1 0 1 1 2 1 1 2 1 1 1 1 1 1 1 0 0 2 1 1 0 1 0 0 1 0 0 1 0 0 1 0 ...

output:

2642

result:

ok 1 number(s): "2642"

Test #18:

score: 0
Accepted
time: 561ms
memory: 110888kb

input:

1
1000000 234
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 0 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...

output:

7199

result:

ok 1 number(s): "7199"

Test #19:

score: 0
Accepted
time: 595ms
memory: 92372kb

input:

1
1000000 234
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...

output:

7880

result:

ok 1 number(s): "7880"

Test #20:

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

input:

1
1000000 234
2 2 2 2 2 1 2 2 2 2 2 1 2 1 2 2 2 2 2 2 2 2 1 2 2 2 2 2 1 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 1 0 0 1 1 2 2 2 2 1 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 0 0 2 0 0 2 2 2 2 1 2 2 0 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 0 1 2 2 2 1 2 2 2 2 2 2 2 2 1 2 2 0 2 2 0 1 2 ...

output:

6655

result:

ok 1 number(s): "6655"

Test #21:

score: 0
Accepted
time: 582ms
memory: 110048kb

input:

1
1000000 234
1 0 2 2 2 2 0 2 1 0 0 2 2 1 0 1 2 1 2 2 1 2 1 1 2 0 2 0 0 0 2 2 0 0 1 2 2 0 2 2 0 0 2 2 2 2 0 2 2 0 0 0 2 0 2 0 0 0 2 1 1 0 1 2 2 2 2 2 1 2 2 0 0 0 0 0 0 1 2 0 2 2 2 0 0 1 1 0 2 2 1 2 0 2 2 0 2 0 2 1 2 2 2 1 0 2 1 1 2 2 2 2 1 2 2 1 2 2 1 2 2 0 2 0 2 2 1 2 2 0 2 0 1 0 2 1 1 2 2 0 0 0 2 ...

output:

4951

result:

ok 1 number(s): "4951"

Test #22:

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

input:

1
1000000 234
2 1 0 0 1 1 1 0 1 2 2 0 0 0 1 2 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 0 0 0 0 0 0 1 1 1 0 1 1 0 0 1 2 0 1 1 2 2 2 1 0 1 0 1 1 0 0 1 1 1 1 0 1 0 1 0 1 1 1 1 1 0 1 0 2 1 0 2 1 1 1 1 1 1 1 1 1 1 1 0 0 1 0 1 1 1 1 0 1 1 0 0 0 1 1 0 0 1 1 1 0 1 0 0 2 1 0 1 1 1 0 0 0 0 1 0 0 1 0 1 0 1 1 1 0 1 1 ...

output:

2640

result:

ok 1 number(s): "2640"

Test #23:

score: 0
Accepted
time: 615ms
memory: 110268kb

input:

1
1000000 23333
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...

output:

84

result:

ok 1 number(s): "84"

Test #24:

score: 0
Accepted
time: 574ms
memory: 107728kb

input:

1
1000000 23333
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...

output:

0

result:

ok 1 number(s): "0"

Test #25:

score: 0
Accepted
time: 573ms
memory: 108940kb

input:

1
1000000 23334
2 2 2 2 2 2 2 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2 0 1 0 0 2 2 0 1 2 2 2 0 2 2 0 2 2 2 0 1 0 2 2 2 2 2 2 0 0 2 0 2 2 0 0 2 2 2 2 0 2 2 2 1 2 2 2 0 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 0 2 0 2 2 1 2 2 2 1 2 2 2 2 2 2 1 2 2 2 2 0 2 2 0 1 2 2 1 2 2 2 0 2 2 2 2 2 2 0 2 0 2 2 2 1 2 2 2 2 2 0 2 2 ...

output:

72

result:

ok 1 number(s): "72"

Test #26:

score: 0
Accepted
time: 586ms
memory: 110684kb

input:

1
1000000 23334
2 2 1 2 2 2 2 0 0 1 0 2 2 0 2 1 2 2 1 2 2 1 1 2 2 1 0 2 2 2 0 2 2 2 2 0 2 0 1 1 2 0 0 1 1 2 1 2 0 2 2 2 1 0 2 0 0 1 1 1 0 0 1 2 2 2 1 1 2 2 2 2 1 0 2 1 2 2 1 2 2 0 2 0 2 1 0 1 0 1 2 1 2 2 2 2 2 2 1 2 0 2 1 1 1 0 1 2 2 2 0 1 1 1 2 1 2 2 0 1 2 0 0 2 2 1 1 1 1 2 2 1 2 1 2 2 2 1 2 1 2 0 ...

output:

53

result:

ok 1 number(s): "53"

Test #27:

score: 0
Accepted
time: 595ms
memory: 109504kb

input:

1
1000000 23333
0 1 0 0 0 0 2 0 0 2 0 0 0 0 1 1 1 1 0 1 1 2 1 0 0 1 1 2 1 1 0 0 0 0 1 1 1 0 1 1 0 0 1 1 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 1 1 0 1 1 0 1 0 2 2 0 2 1 2 2 1 2 0 1 0 0 1 0 0 1 1 0 1 1 1 0 1 0 0 1 1 1 0 1 0 0 1 0 0 1 1 1 0 1 0 0 0 0 1 0 0 1 1 1 2 1 1 0 2 0 2 0 1 1 2 2 0 1 2 0 0 1 1 0 0 1 1 ...

output:

28

result:

ok 1 number(s): "28"

Test #28:

score: 0
Accepted
time: 567ms
memory: 110296kb

input:

1
1000000 76545
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 0 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...

output:

25

result:

ok 1 number(s): "25"

Test #29:

score: 0
Accepted
time: 601ms
memory: 110388kb

input:

1
1000000 56757
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...

output:

0

result:

ok 1 number(s): "0"

Test #30:

score: 0
Accepted
time: 605ms
memory: 109424kb

input:

1
1000000 65766
2 2 2 2 2 2 2 2 0 2 2 1 2 2 1 2 2 2 2 2 2 2 0 2 2 0 2 2 2 2 2 2 2 0 2 2 2 2 1 2 2 2 1 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 0 2 2 2 2 2 2 2 0 2 2 2 1 2 1 1 2 2 2 2 2 2 2 2 2 1 2 1 2 1 2 0 2 2 2 2 1 2 2 2 1 2 2 1 2 2 1 2 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 0 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...

output:

25

result:

ok 1 number(s): "25"

Test #31:

score: 0
Accepted
time: 615ms
memory: 110836kb

input:

1
1000000 99824
0 2 2 0 1 0 2 0 2 0 2 1 0 2 2 2 0 1 0 1 0 0 2 2 2 2 2 2 2 2 0 2 1 1 2 2 2 1 2 2 1 2 2 2 0 1 2 2 2 2 0 2 2 1 0 2 1 2 2 2 1 1 0 1 2 2 2 0 2 2 1 2 2 2 0 2 2 0 0 2 0 2 2 2 1 0 0 2 2 2 2 1 2 2 2 1 2 2 2 0 0 1 1 2 0 1 1 2 0 0 0 0 0 2 1 2 0 2 2 2 0 2 2 2 2 1 2 0 2 2 1 0 2 2 0 2 1 1 2 0 2 2 ...

output:

12

result:

ok 1 number(s): "12"

Test #32:

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

input:

1
1000000 43530
0 0 1 0 1 1 1 2 1 0 0 0 0 0 1 0 0 1 1 1 0 0 1 1 0 0 1 0 0 1 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 2 1 0 1 0 0 1 0 0 1 2 2 1 0 1 0 1 1 1 1 0 1 1 0 1 1 1 0 1 0 1 1 0 0 1 1 1 0 1 0 0 0 1 0 2 2 1 1 1 0 2 0 0 0 2 1 2 1 0 0 1 1 1 0 0 0 1 0 1 1 1 0 0 0 0 0 0 0 1 0 1 1 2 1 0 1 1 0 0 2 0 0 0 1 ...

output:

15

result:

ok 1 number(s): "15"

Test #33:

score: 0
Accepted
time: 576ms
memory: 106044kb

input:

1
1000000 233334
2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 0 2 2...

output:

8

result:

ok 1 number(s): "8"

Test #34:

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

input:

1
1000000 233333
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2...

output:

0

result:

ok 1 number(s): "0"

Test #35:

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

input:

1
1000000 233334
2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 0 2 2 2 0 2 1 2 1 2 2 0 0 2 2 2 2 2 2 2 2 2 1 2 1 2 0 2 2 2 2 2 2 2 0 2 2 2 1 2 2 2 2 2 2 2 2 2 2 0 2 1 2 2 2 2 2 2 2 2 2 2 2...

output:

7

result:

ok 1 number(s): "7"

Test #36:

score: 0
Accepted
time: 580ms
memory: 109860kb

input:

1
1000000 233333
2 1 2 2 0 2 2 1 2 0 2 1 0 1 0 2 2 2 2 2 2 2 0 2 2 2 1 2 2 1 0 1 1 2 0 0 1 2 2 2 2 0 0 2 1 0 0 2 0 1 1 2 2 1 0 0 1 2 2 2 2 0 1 2 2 2 1 2 0 1 0 0 2 2 2 0 0 0 1 2 0 1 1 0 2 2 2 2 0 2 2 0 2 2 1 0 0 1 2 0 2 2 2 2 2 2 2 1 2 0 1 0 2 2 2 2 2 1 2 2 2 2 1 0 2 2 2 2 1 1 0 2 2 2 2 1 1 2 0 1 1 1...

output:

5

result:

ok 1 number(s): "5"

Test #37:

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

input:

1
1000000 233334
0 1 2 1 1 1 0 0 1 1 1 1 1 0 1 0 1 1 1 0 0 1 2 0 1 1 0 0 1 0 0 0 1 0 1 1 0 1 0 2 1 1 1 1 0 1 0 1 2 1 0 1 2 1 0 2 1 0 0 0 0 0 1 0 2 1 0 0 1 0 0 0 0 2 1 1 1 2 0 0 0 1 0 2 0 2 0 1 1 0 0 1 0 1 1 1 1 0 0 2 1 0 1 1 1 1 0 0 1 2 0 0 0 1 1 1 0 0 1 0 1 0 0 0 1 1 1 1 1 1 1 0 1 0 1 2 2 1 0 1 2 2...

output:

2

result:

ok 1 number(s): "2"

Test #38:

score: 0
Accepted
time: 573ms
memory: 90928kb

input:

1
1000000 131072
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2...

output:

15

result:

ok 1 number(s): "15"

Test #39:

score: 0
Accepted
time: 567ms
memory: 109912kb

input:

1
1000000 234234
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2...

output:

8

result:

ok 1 number(s): "8"

Test #40:

score: 0
Accepted
time: 583ms
memory: 92560kb

input:

1
1000000 456459
1 2 2 2 1 2 2 2 2 2 2 2 2 2 2 1 2 0 2 0 2 2 2 1 2 2 2 0 0 0 2 2 2 2 2 0 2 1 0 1 2 2 2 0 2 2 2 2 1 2 2 2 2 2 1 2 2 2 2 1 2 2 2 2 0 2 2 2 2 2 2 2 2 2 0 0 2 2 1 2 2 0 2 2 2 2 2 2 2 2 0 2 2 2 2 2 2 2 2 1 1 2 2 2 1 2 2 2 2 1 2 0 2 2 1 1 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 0 2 2 0 2 2 2...

output:

3

result:

ok 1 number(s): "3"

Test #41:

score: 0
Accepted
time: 584ms
memory: 109796kb

input:

1
1000000 342461
0 2 2 0 1 2 1 2 2 2 2 0 0 1 1 1 2 2 2 2 2 0 2 1 2 2 2 2 0 2 2 2 2 2 0 0 1 2 2 0 2 0 2 0 2 2 2 2 2 2 2 2 0 2 1 2 2 0 2 0 1 1 0 1 1 2 0 1 2 2 0 2 2 1 2 0 2 0 0 0 2 2 0 0 2 2 1 2 2 2 2 0 1 0 2 1 2 0 0 2 1 1 0 2 2 2 1 1 2 1 2 0 0 0 2 1 1 1 0 2 2 2 2 1 0 2 0 2 2 2 0 1 1 0 2 1 2 0 2 2 2 2...

output:

3

result:

ok 1 number(s): "3"

Test #42:

score: 0
Accepted
time: 616ms
memory: 107084kb

input:

1
1000000 633537
1 1 0 0 2 0 0 1 1 1 0 1 1 2 0 1 0 1 1 1 0 0 1 1 1 1 0 1 0 1 0 0 1 0 0 0 1 1 1 0 1 0 1 2 1 1 0 1 0 1 0 0 0 0 1 0 0 1 1 0 1 0 1 2 1 2 2 1 1 1 0 2 0 1 1 0 0 0 0 0 1 0 0 0 1 1 0 2 0 1 1 1 0 0 1 2 1 2 1 0 1 0 0 1 1 0 0 1 0 0 0 1 0 0 0 1 0 0 0 0 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 0 0 2 0 2 1 0...

output:

1

result:

ok 1 number(s): "1"

Test #43:

score: 0
Accepted
time: 580ms
memory: 91164kb

input:

1
1000000 131072
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 0 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2...

output:

15

result:

ok 1 number(s): "15"

Test #44:

score: 0
Accepted
time: 566ms
memory: 99260kb

input:

1
1000000 234234
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2...

output:

8

result:

ok 1 number(s): "8"

Test #45:

score: 0
Accepted
time: 547ms
memory: 92204kb

input:

1
1000000 456459
2 0 2 2 2 2 2 0 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2 0 2 2 0 1 2 2 2 0 2 2 2 2 2 2 2 2 2 2 0 2 2 0 2 2 0 2 2 2 0 2 2 2 0 2 2 2 2 2 0 0 2 2 0 2 2 2 2 2 2 2 1 2 0 2 2 2 2 2 2 2 2 2 2 2 0 2 2 2 1 2 2 2 2 2 1 2 2 2 2 2 2 0 1 2 2 2 2 1 2 2 2 0 0 2 2 1 2 0 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2...

output:

3

result:

ok 1 number(s): "3"

Test #46:

score: 0
Accepted
time: 576ms
memory: 95532kb

input:

1
1000000 342461
2 2 0 2 1 1 2 0 2 1 2 0 2 2 2 1 2 0 1 2 0 2 2 1 2 2 2 1 2 2 0 2 2 0 2 0 1 1 2 2 2 1 2 1 1 0 1 1 0 2 2 1 0 2 2 0 1 2 0 0 1 2 1 2 2 1 2 2 2 2 0 1 1 1 2 2 0 2 2 2 0 2 2 0 2 1 2 1 2 2 1 1 0 2 1 2 0 0 2 2 2 1 0 1 2 0 2 2 2 0 1 2 1 2 2 2 1 2 0 2 2 1 2 2 2 2 2 0 2 2 2 2 2 2 2 2 1 2 0 1 2 2...

output:

3

result:

ok 1 number(s): "3"

Test #47:

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

input:

1
1000000 633537
1 2 0 2 1 1 1 2 1 2 1 0 0 0 2 1 0 1 1 0 0 2 0 0 0 0 1 1 1 0 1 2 0 1 0 1 1 1 1 1 0 1 0 0 1 0 0 0 1 1 2 0 1 1 1 1 1 1 0 1 0 1 2 1 0 1 0 1 1 0 1 0 0 1 1 0 0 1 1 0 1 2 1 1 2 1 0 0 0 0 1 1 0 0 0 1 0 1 0 2 1 1 0 1 0 0 0 0 2 2 2 1 0 1 0 0 2 1 2 0 1 0 1 1 0 0 1 1 1 0 1 0 1 0 0 1 1 2 1 1 2 0...

output:

1

result:

ok 1 number(s): "1"

Test #48:

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

input:

1
1000000 1234567
2 2 2 0 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...

output:

1

result:

ok 1 number(s): "1"

Test #49:

score: 0
Accepted
time: 581ms
memory: 110192kb

input:

1
1000000 1234568
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...

output:

1

result:

ok 1 number(s): "1"

Test #50:

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

input:

1
1000000 1234567
0 0 0 2 2 1 2 2 2 1 2 2 1 2 2 1 2 2 2 2 2 2 0 2 2 2 2 2 2 1 2 2 1 2 0 2 2 2 2 2 2 2 2 2 1 2 0 2 1 0 2 0 0 2 0 2 2 2 2 1 2 2 2 2 0 0 2 2 1 1 2 0 1 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 1 2 1 2 2 2 2 2 2 1 2 2 2 2 1 2 2 1 2 2 2 2 2 1 2 1 0 2 2 2 2 2 2 2 1 1 2 2 2 2 2 2 1 1 2 2 1 2 2 0 ...

output:

1

result:

ok 1 number(s): "1"

Test #51:

score: 0
Accepted
time: 603ms
memory: 100252kb

input:

1
1000000 1234568
0 1 0 2 1 1 2 2 2 0 0 1 2 2 1 2 2 2 2 1 2 0 2 2 2 0 2 0 0 0 0 1 2 2 0 0 2 2 0 0 1 1 1 1 0 2 1 1 2 2 0 1 1 2 1 2 0 0 2 2 1 1 0 0 1 1 1 1 2 2 2 2 2 1 1 2 0 0 0 2 1 2 1 2 2 2 1 2 1 0 2 2 2 2 2 2 2 2 2 1 0 1 1 2 0 2 2 1 2 2 1 1 2 2 2 1 2 0 2 0 0 1 2 1 0 2 0 1 1 1 0 1 1 1 2 2 1 2 2 0 2 ...

output:

1

result:

ok 1 number(s): "1"

Test #52:

score: 0
Accepted
time: 603ms
memory: 110372kb

input:

1
1000000 1234567
0 0 0 0 2 0 0 0 1 1 0 1 0 0 2 0 1 1 0 0 0 0 1 0 1 1 0 0 1 0 1 0 0 1 0 1 1 1 0 1 0 1 0 1 0 1 0 0 1 0 1 1 0 1 1 1 0 0 1 2 1 0 0 1 1 0 0 2 1 0 0 1 1 0 0 1 0 1 2 0 0 0 1 1 0 1 1 1 1 0 1 0 2 0 0 2 1 0 0 1 0 0 0 1 1 0 1 1 1 0 0 1 0 2 2 0 0 2 0 1 1 0 0 1 0 0 0 2 0 1 0 1 1 0 1 1 0 1 0 1 1 ...

output:

0

result:

ok 1 number(s): "0"

Test #53:

score: 0
Accepted
time: 595ms
memory: 110804kb

input:

1
1000000 2000000
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...

output:

1

result:

ok 1 number(s): "1"

Test #54:

score: 0
Accepted
time: 375ms
memory: 74404kb

input:

1
1000000 2000000
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...

output:

1

result:

ok 1 number(s): "1"

Test #55:

score: 0
Accepted
time: 413ms
memory: 74292kb

input:

1
1000000 233
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...

output:

0

result:

ok 1 number(s): "0"

Test #56:

score: 0
Accepted
time: 374ms
memory: 74364kb

input:

1
1000000 233
0 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 0 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...

output:

51

result:

ok 1 number(s): "51"

Test #57:

score: 0
Accepted
time: 387ms
memory: 74392kb

input:

1
1000000 233
1 2 2 1 2 0 2 0 2 2 2 1 1 2 0 2 2 2 2 2 0 2 2 0 2 0 2 0 0 0 1 2 0 2 2 2 1 2 2 0 1 1 0 0 0 2 1 1 1 1 2 0 0 2 1 1 2 2 2 2 0 2 2 1 1 2 0 0 2 2 1 2 0 0 1 2 2 1 0 2 2 1 2 2 0 2 0 1 2 2 2 1 1 1 2 0 2 2 2 0 0 0 2 2 2 2 0 2 0 2 1 0 2 1 0 2 2 2 0 2 2 0 0 1 1 0 1 2 2 1 2 1 1 2 1 2 2 1 2 1 0 1 0 ...

output:

64

result:

ok 1 number(s): "64"

Test #58:

score: 0
Accepted
time: 393ms
memory: 74300kb

input:

1
1000000 234
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...

output:

96

result:

ok 1 number(s): "96"

Test #59:

score: 0
Accepted
time: 377ms
memory: 74348kb

input:

1
1000000 234
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 0 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...

output:

83

result:

ok 1 number(s): "83"

Test #60:

score: 0
Accepted
time: 349ms
memory: 74332kb

input:

1
1000000 234
2 1 2 2 0 2 2 2 0 2 2 2 2 2 2 2 2 0 2 2 2 1 2 2 0 1 2 1 2 0 1 2 0 0 1 2 0 0 0 1 2 1 0 1 2 2 2 2 0 2 2 2 0 0 0 2 0 1 2 1 0 2 0 2 0 2 0 2 2 2 2 2 0 0 0 2 2 0 1 1 1 0 2 2 1 2 2 2 1 1 0 0 1 1 2 1 1 1 0 2 0 2 2 1 1 2 2 0 1 2 2 0 2 1 2 0 1 0 2 2 2 2 2 2 2 1 2 1 2 2 2 2 2 2 0 2 2 1 1 0 1 2 2 ...

output:

64

result:

ok 1 number(s): "64"

Test #61:

score: 0
Accepted
time: 365ms
memory: 74428kb

input:

1
1000000 34567
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...

output:

0

result:

ok 1 number(s): "0"

Test #62:

score: 0
Accepted
time: 354ms
memory: 74416kb

input:

1
1000000 34567
0 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 0 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...

output:

11

result:

ok 1 number(s): "11"

Test #63:

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

input:

1
1000000 34567
0 2 0 2 1 0 2 0 1 0 2 2 2 0 1 0 2 2 0 2 2 0 1 1 2 0 1 2 2 2 2 2 2 1 2 1 0 2 2 0 2 2 0 0 1 2 0 1 2 1 1 2 0 2 2 2 2 2 0 2 2 2 2 2 2 0 0 0 2 1 1 2 1 0 2 0 2 2 2 1 2 2 2 0 2 2 0 1 0 2 0 0 0 2 2 2 2 0 2 1 2 2 1 2 1 1 0 2 0 2 2 2 0 2 2 2 0 0 2 0 0 2 2 2 1 2 2 1 2 1 0 2 0 2 1 0 2 1 2 0 2 2 ...

output:

10

result:

ok 1 number(s): "10"

Test #64:

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

input:

1
1000000 34568
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...

output:

11

result:

ok 1 number(s): "11"

Test #65:

score: 0
Accepted
time: 392ms
memory: 74328kb

input:

1
1000000 34568
2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 0 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...

output:

11

result:

ok 1 number(s): "11"

Test #66:

score: 0
Accepted
time: 429ms
memory: 74480kb

input:

1
1000000 34568
1 0 1 1 2 2 2 0 0 1 2 2 0 1 0 2 2 2 0 0 2 1 2 2 2 1 0 0 2 0 2 1 0 1 0 2 2 2 2 2 1 2 0 2 0 2 2 1 2 2 0 0 1 0 1 0 2 0 0 2 1 1 0 1 2 1 1 2 2 0 2 0 2 0 0 1 2 1 2 2 2 0 0 0 0 2 0 2 0 2 2 2 1 2 2 2 0 2 1 2 2 2 2 2 2 0 1 2 0 1 2 2 0 2 2 0 2 1 0 1 2 2 1 2 0 2 0 2 2 0 0 2 1 0 2 1 2 2 1 1 2 0 ...

output:

10

result:

ok 1 number(s): "10"

Test #67:

score: 0
Accepted
time: 387ms
memory: 74316kb

input:

1
1000000 432576
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2...

output:

3

result:

ok 1 number(s): "3"

Test #68:

score: 0
Accepted
time: 427ms
memory: 74380kb

input:

1
1000000 432576
2 2 2 2 2 2 2 2 2 2 2 2 2 2 0 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 0 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2...

output:

3

result:

ok 1 number(s): "3"

Test #69:

score: 0
Accepted
time: 417ms
memory: 74364kb

input:

1
1000000 432576
2 0 2 0 0 1 2 1 2 1 2 2 1 2 0 2 2 2 0 2 1 0 1 2 2 2 2 2 0 2 2 2 1 1 1 2 2 2 2 1 1 2 2 2 2 1 2 0 2 1 2 1 2 0 1 2 1 2 1 2 2 2 2 2 1 2 0 1 2 2 0 2 2 2 1 2 2 2 2 2 2 2 2 0 1 0 0 0 1 1 2 2 2 2 2 2 2 2 2 0 2 2 0 0 0 0 1 1 2 2 2 1 2 2 2 1 2 2 2 2 1 0 2 2 1 2 1 0 2 0 2 0 2 1 1 2 0 2 2 1 2 0...

output:

2

result:

ok 1 number(s): "2"

Test #70:

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

input:

1
1000000 432577
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2...

output:

0

result:

ok 1 number(s): "0"

Test #71:

score: 0
Accepted
time: 351ms
memory: 74252kb

input:

1
1000000 432577
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2...

output:

3

result:

ok 1 number(s): "3"

Test #72:

score: 0
Accepted
time: 393ms
memory: 74492kb

input:

1
1000000 432577
2 1 2 0 2 1 1 2 0 0 0 2 0 2 1 2 2 1 2 2 2 2 1 0 2 1 0 2 2 0 2 0 2 1 2 0 2 0 0 0 1 2 2 0 0 2 2 2 1 2 2 0 0 0 0 1 1 1 0 0 2 2 2 0 1 2 0 0 0 0 2 1 2 1 0 1 1 2 2 2 1 0 2 1 2 2 0 2 2 2 2 1 0 2 1 2 2 2 2 1 0 1 0 0 2 2 1 2 2 2 0 2 1 2 1 1 2 2 0 2 2 0 2 0 1 2 2 1 1 2 2 2 0 2 2 1 0 0 0 2 1 2...

output:

2

result:

ok 1 number(s): "2"

Test #73:

score: 0
Accepted
time: 380ms
memory: 74388kb

input:

1
1000000 876868
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2...

output:

2

result:

ok 1 number(s): "2"

Test #74:

score: 0
Accepted
time: 408ms
memory: 74476kb

input:

1
1000000 876868
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 0 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2...

output:

2

result:

ok 1 number(s): "2"

Test #75:

score: 0
Accepted
time: 397ms
memory: 74388kb

input:

1
1000000 876868
1 2 0 0 0 1 2 1 2 2 1 2 2 0 0 1 0 1 0 2 0 1 0 2 2 1 2 2 1 2 2 2 0 2 2 2 2 2 1 2 1 0 1 2 0 0 1 2 1 0 2 1 2 0 2 2 2 2 2 0 1 0 1 2 1 1 2 2 1 1 2 2 1 2 2 1 2 1 0 2 2 2 0 0 0 2 1 2 2 2 2 1 1 2 1 1 2 0 1 1 2 0 0 0 2 0 2 2 2 0 2 0 1 2 2 2 2 2 2 2 1 2 2 2 0 1 2 1 2 1 2 2 0 2 2 2 1 0 1 2 2 2...

output:

1

result:

ok 1 number(s): "1"

Test #76:

score: 0
Accepted
time: 385ms
memory: 74400kb

input:

1
1000000 876869
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2...

output:

0

result:

ok 1 number(s): "0"

Test #77:

score: 0
Accepted
time: 401ms
memory: 74400kb

input:

1
1000000 876869
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 0 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2...

output:

2

result:

ok 1 number(s): "2"

Test #78:

score: 0
Accepted
time: 361ms
memory: 74392kb

input:

1
1000000 876869
0 2 1 2 2 2 0 1 2 2 2 0 2 0 2 2 1 2 1 1 0 2 0 0 1 2 2 2 0 2 0 2 2 2 2 2 2 2 0 2 1 2 2 2 1 1 2 0 0 2 2 2 2 2 2 2 1 2 2 2 0 2 2 1 2 2 1 2 0 1 1 2 2 2 2 2 1 2 2 2 2 2 2 0 0 1 1 2 0 1 1 2 2 1 1 0 2 2 2 2 1 1 2 2 2 2 2 2 2 2 2 1 2 0 1 2 0 2 1 0 0 2 0 2 0 1 2 2 2 0 1 1 0 1 1 0 1 1 1 2 1 0...

output:

1

result:

ok 1 number(s): "1"

Test #79:

score: 0
Accepted
time: 397ms
memory: 74392kb

input:

1
1000000 876869
1 1 1 0 1 0 0 1 1 0 1 1 0 0 0 1 1 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 0 1 0 1 1 1 1 1 0 0 0 1 0 0 0 0 1 0 0 0 1 1 1 1 0 1 0 1 1 1 0 1 0 1 0 0 0 1 1 1 1 0 0 0 1 1 1 1 0 1 0 1 1 0 0 0 0 0 1 0 1 0 1 0 0 1 1 1 0 1 1 1 1 0 1 0 0 1 0 1 1 1 0 1 0 0 0 0 1 0 0 0 0 0 1 0 1 1 2 1 1 1 1 0 0 1 1...

output:

0

result:

ok 1 number(s): "0"

Test #80:

score: 0
Accepted
time: 383ms
memory: 74528kb

input:

1
1000000 876869
0 1 0 2 2 2 1 0 0 0 1 0 1 1 0 0 1 2 2 1 0 1 1 0 0 0 0 2 0 1 1 0 1 0 0 0 2 0 1 1 1 1 0 0 1 2 1 0 0 1 2 1 1 0 0 0 1 0 0 0 1 2 1 0 1 1 0 1 0 0 1 1 2 2 0 2 1 1 0 1 0 1 1 1 1 2 1 1 0 1 0 0 0 1 2 1 1 2 1 1 1 1 1 2 2 0 0 0 0 2 0 1 1 0 0 0 0 0 1 0 1 0 1 1 1 1 0 2 0 1 0 0 2 2 0 1 0 1 1 1 2 1...

output:

0

result:

ok 1 number(s): "0"

Test #81:

score: 0
Accepted
time: 449ms
memory: 74444kb

input:

1
1000000 876869
0 0 0 0 0 1 0 0 1 1 1 1 0 1 0 0 1 1 0 0 0 0 1 0 0 0 0 0 0 0 1 1 0 0 1 0 1 0 1 0 0 1 1 0 0 1 0 1 1 1 1 0 1 0 1 1 0 0 0 1 1 1 1 1 0 0 1 0 1 0 0 1 1 1 2 2 0 2 1 0 0 1 1 0 0 0 1 1 1 1 1 0 0 0 0 0 1 1 0 0 1 0 0 0 1 0 0 0 2 0 0 0 1 1 2 0 1 1 1 1 0 1 0 0 1 1 1 0 0 0 1 0 0 0 0 0 1 0 1 1 0 0...

output:

0

result:

ok 1 number(s): "0"

Test #82:

score: 0
Accepted
time: 9ms
memory: 32044kb

input:

12
2 2000000
1 0
1 2
2 2000000
1 1
2 1
2 2000000
1 2
2 1
1 2000000
0
1 2000000
1
2 2000000
2 0
1 2
2 2000000
2 1
2 1
2 2000000
2 2
2 1
1 2000000
2
2 2000000
0 0
1 2
2 2000000
0 1
2 1
2 2000000
0 2
2 1

output:

0
0
0
0
0
0
0
0
0
0
0
0

result:

ok 12 numbers

Test #83:

score: 0
Accepted
time: 152ms
memory: 32412kb

input:

200000
5 1914575
0 1 1 1 0
3 4
5 3
3 2
4 1
5 996221
1 0 1 1 0
2 3
2 5
4 1
1 2
5 723492
0 0 1 1 1
5 1
5 4
3 4
4 2
5 1189770
1 1 2 0 0
5 2
1 5
4 5
3 5
5 1469525
1 0 0 1 0
4 1
1 5
3 1
3 2
5 76763
1 0 1 1 0
1 3
2 5
5 3
3 4
5 407965
1 2 0 0 0
1 4
2 1
2 5
5 3
5 429447
0 1 0 0 0
1 3
4 1
4 5
2 1
5 765063
0 ...

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 200000 numbers

Test #84:

score: 0
Accepted
time: 376ms
memory: 74312kb

input:

100001
500000 36426
1 0 2 2 1 2 0 0 0 2 1 2 1 2 2 1 2 2 2 1 1 2 0 0 2 2 0 0 1 0 2 2 2 2 2 0 2 2 0 2 2 2 2 1 2 0 2 0 2 2 0 0 1 1 2 0 2 0 1 0 0 2 2 2 1 2 2 2 1 2 0 1 0 2 0 2 2 2 2 1 2 2 0 0 0 2 0 0 1 2 0 2 2 2 2 2 0 1 0 1 2 0 2 1 1 1 2 1 2 0 0 2 2 0 1 1 1 2 2 1 0 0 2 0 1 2 1 2 2 2 0 0 2 2 0 0 2 1 2 1 ...

output:

17
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
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 100001 numbers

Test #85:

score: 0
Accepted
time: 183ms
memory: 31800kb

input:

1000000
1 260522
0
1 1933447
0
1 1963982
1
1 895728
0
1 539679
1
1 287940
1
1 823355
1
1 1374934
1
1 1195922
1
1 284691
1
1 1381221
0
1 1229302
0
1 870607
0
1 1187475
1
1 1207354
0
1 1751951
0
1 472167
1
1 1976483
0
1 56553
0
1 309279
0
1 1708200
1
1 1226467
1
1 661473
0
1 383718
1
1 986530
1
1 1508...

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 1000000 numbers

Extra Test:

score: 0
Extra Test Passed