QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#739551#7684. Sweet Sugarrqoi031AC ✓281ms98012kbC++201.5kb2024-11-12 22:08:122024-11-12 22:08:13

Judging History

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

  • [2024-11-12 22:08:13]
  • 评测
  • 测评结果:AC
  • 用时:281ms
  • 内存:98012kb
  • [2024-11-12 22:08:12]
  • 提交

answer

#include<stdio.h>
#include<algorithm>
#include<tuple>
struct edge {
    int v,next;
};
edge e[2000005];
int en,last[1000005];
inline void add_edge(const int &u,const int &v) {
    e[++en]={v,last[u]},last[u]=en;
    e[++en]={u,last[v]},last[v]=en;
}
int c[1000005];
inline void solve() {
    int n,k;
    scanf("%d%d",&n,&k);
    for(int i=1;i<=n;i++) {
        scanf("%d",c+i);
    }
    std::fill(last+1,last+n+1,0),en=0;
    for(int i=1;i<n;i++) {
        int u,v;
        scanf("%d%d",&u,&v);
        add_edge(u,v);
    }
    const auto dfs([&](const auto &self,const int &u,const int &fa)->std::tuple<int,int,int,int> {
        int s(0),x(c[u]),y(1000000000),z(0);
        for(int i=last[u];i;i=e[i].next) {
            const int &v(e[i].v);
            if(v==fa) {
                continue;
            }
            const auto &[s0,x0,y0,z0](self(self,v,u));
            s+=s0,x+=x0;
            y=std::min(y,y0);
            if(c[u]==1) {
                z=std::max(z,x0);
            }
            else {
                z=std::max(z,z0);
            }
        }
        if(c[u]==1) {
            y=std::min(y,x);
        }
        if([&]()->bool {
            if((x^k)&1) {
                return std::max(x-y,z)>=k;
            }
            return x>=k;
        }()) {
            ++s,x=0,y=1000000000,z=0;
        }
        return {s,x,y,z};
    });
    printf("%d\n",std::get<0>(dfs(dfs,1,0)));
}
int main() {
    int t;
    scanf("%d",&t);
    while(t--) {
        solve();
    }
    return 0;
}

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

详细

Test #1:

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

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: 1ms
memory: 5732kb

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: 130ms
memory: 5724kb

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: 135ms
memory: 5708kb

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: 147ms
memory: 5732kb

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: 162ms
memory: 5636kb

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: 135ms
memory: 5808kb

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: 154ms
memory: 6388kb

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: 159ms
memory: 11884kb

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: 267ms
memory: 95520kb

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: 265ms
memory: 70924kb

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: 267ms
memory: 93048kb

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: 256ms
memory: 76952kb

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: 247ms
memory: 69536kb

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: 262ms
memory: 69084kb

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: 271ms
memory: 97444kb

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: 264ms
memory: 97564kb

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: 246ms
memory: 98012kb

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: 267ms
memory: 64776kb

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: 264ms
memory: 93868kb

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: 253ms
memory: 96472kb

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: 264ms
memory: 97628kb

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: 257ms
memory: 96896kb

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: 262ms
memory: 92264kb

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: 270ms
memory: 94392kb

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: 258ms
memory: 97604kb

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: 265ms
memory: 95536kb

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: 241ms
memory: 96904kb

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: 264ms
memory: 97184kb

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: 240ms
memory: 95420kb

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: 267ms
memory: 97808kb

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: 268ms
memory: 86608kb

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: 248ms
memory: 89304kb

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: 248ms
memory: 97144kb

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: 253ms
memory: 97664kb

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: 281ms
memory: 95976kb

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: 278ms
memory: 66556kb

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: 247ms
memory: 62084kb

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: 255ms
memory: 96060kb

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: 257ms
memory: 64976kb

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: 257ms
memory: 95800kb

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: 257ms
memory: 91144kb

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: 241ms
memory: 62276kb

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: 251ms
memory: 76928kb

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: 256ms
memory: 64188kb

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: 257ms
memory: 70336kb

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: 248ms
memory: 82372kb

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: 251ms
memory: 96548kb

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: 268ms
memory: 96840kb

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: 258ms
memory: 84820kb

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: 261ms
memory: 78772kb

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: 256ms
memory: 97164kb

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: 264ms
memory: 97664kb

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: 189ms
memory: 26456kb

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: 184ms
memory: 26416kb

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: 188ms
memory: 26448kb

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: 187ms
memory: 26432kb

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: 182ms
memory: 26476kb

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: 194ms
memory: 26484kb

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: 193ms
memory: 26372kb

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: 183ms
memory: 26448kb

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: 170ms
memory: 26444kb

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: 180ms
memory: 26456kb

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: 179ms
memory: 26472kb

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: 186ms
memory: 26372kb

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: 171ms
memory: 26372kb

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: 181ms
memory: 26448kb

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: 185ms
memory: 26488kb

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: 189ms
memory: 26484kb

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: 181ms
memory: 26448kb

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: 180ms
memory: 26372kb

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: 175ms
memory: 26440kb

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: 179ms
memory: 26484kb

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: 184ms
memory: 26488kb

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: 197ms
memory: 26364kb

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: 178ms
memory: 26376kb

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: 183ms
memory: 26420kb

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: 189ms
memory: 26440kb

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: 191ms
memory: 26360kb

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: 184ms
memory: 26460kb

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: 194ms
memory: 26392kb

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: 0ms
memory: 5696kb

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: 135ms
memory: 5740kb

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: 200ms
memory: 55504kb

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: 187ms
memory: 5648kb

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