QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#592310#186. Street Lamps3un_larryfunc100 ✓2579ms252448kbC++202.9kb2024-09-26 21:52:072024-09-26 21:52:09

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 20
Accepted

Test #1:

score: 20
Accepted
time: 1ms
memory: 5816kb

input:

5 7
11011
query 1 2
query 1 2
query 1 6
query 3 4
toggle 3
query 3 4
query 1 6

output:

1
2
0
0
1
2

result:

ok 6 lines

Test #2:

score: 20
Accepted
time: 0ms
memory: 3828kb

input:

5 50
01001
query 1 6
toggle 3
toggle 3
toggle 2
toggle 3
toggle 2
toggle 4
query 2 6
query 2 3
query 1 3
query 3 5
toggle 3
query 2 6
query 1 5
query 2 3
query 3 6
toggle 5
toggle 1
toggle 2
toggle 4
query 1 6
query 4 5
toggle 3
query 5 6
toggle 2
query 4 6
toggle 5
toggle 5
toggle 2
query 4 5
query...

output:

0
1
7
0
4
5
0
13
5
0
13
17
10
13
5
5
6
24
0
10
0
5
0
5
6

result:

ok 25 lines

Test #3:

score: 20
Accepted
time: 0ms
memory: 5868kb

input:

10 50
1111010011
toggle 3
toggle 1
toggle 5
toggle 5
toggle 7
query 7 10
query 6 8
query 6 8
toggle 7
toggle 4
toggle 4
toggle 3
toggle 8
toggle 8
toggle 3
query 4 6
query 1 4
toggle 10
query 4 8
query 4 11
toggle 8
toggle 7
query 6 8
toggle 6
query 3 8
toggle 5
toggle 3
toggle 7
toggle 4
query 2 11...

output:

0
2
3
1
1
0
0
5
0
0
0
2
9
0
1
18
30
19
10
1
0
0
0
18

result:

ok 24 lines

Test #4:

score: 20
Accepted
time: 0ms
memory: 3864kb

input:

20 100
01110011111110011110
toggle 16
query 1 13
toggle 2
query 9 21
toggle 8
toggle 7
query 2 5
toggle 18
query 18 21
query 9 11
query 3 5
query 13 20
query 9 10
toggle 4
query 5 21
query 5 19
query 1 15
query 19 21
toggle 16
query 6 21
query 8 21
toggle 14
toggle 19
toggle 1
query 8 11
toggle 13
t...

output:

0
0
3
0
10
11
0
13
0
0
0
0
0
0
5
28
0
34
0
36
0
23
0
0
8
40
0
0
0
0
10
11
5
0
0
0
2
0
0
0
0
38
0
0
37
46

result:

ok 46 lines

Test #5:

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

input:

100 100
1001001110110100110110100110000100100001111010111000011101010010010001101010101001100000111110000010
toggle 43
toggle 13
toggle 19
query 73 101
toggle 65
query 13 59
toggle 1
query 26 101
query 79 83
query 19 101
query 9 94
query 41 91
toggle 55
toggle 87
toggle 37
query 10 31
toggle 26
quer...

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

result:

ok 51 lines

Test #6:

score: 20
Accepted
time: 0ms
memory: 3944kb

input:

100 100
0111010000111110011111000001101011010000000000111101011110010111011010010110111110111011101010010010
query 9 10
query 13 14
query 69 70
query 43 44
toggle 82
toggle 92
toggle 6
toggle 63
query 91 92
query 61 62
toggle 70
query 51 52
query 14 15
toggle 16
toggle 2
toggle 40
toggle 98
toggle 5...

output:

0
2
3
0
9
0
0
13
0
24
16
15
17
0
0
41
44
49
50
52
43
56
61
0
64
65
60
0
69
0
76
42
65
80
0
0
60
7
0
52
87
0
96
78
80

result:

ok 45 lines

Test #7:

score: 20
Accepted
time: 0ms
memory: 3852kb

input:

100 100
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
query 1 47
query 42 81
query 18 29
query 31 37
query 4 58
query 46 59
query 32 100
query 12 98
query 13 29
query 40 73
query 68 100
query 28 75
query 55 72
query 53 61
query 2 54
query 25 71
...

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

result:

ok 100 lines

Test #8:

score: 20
Accepted
time: 0ms
memory: 5792kb

input:

100 100
1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
query 11 25
query 64 67
query 3 63
query 14 60
query 49 64
query 45 70
query 7 33
query 32 97
query 21 84
query 57 61
query 9 22
query 43 60
query 14 34
query 69 99
query 32 69
query 11 13
qu...

output:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100

result:

ok 100 lines

Subtask #2:

score: 20
Accepted

Test #9:

score: 20
Accepted
time: 230ms
memory: 3836kb

input:

100 300000
1100100000000101010010100111010001100010001100111101000010111110001101101110100100100110101010110010
query 13 14
query 42 43
toggle 64
query 78 79
toggle 85
query 35 36
toggle 35
query 4 5
toggle 5
query 4 5
query 42 43
query 35 36
query 13 14
query 14 15
toggle 15
toggle 31
query 20 21
q...

output:

0
0
0
6
0
0
0
7
0
14
0
18
0
0
21
0
26
0
0
36
38
15
41
44
0
47
20
50
52
0
55
52
56
0
35
31
70
73
7
4
0
0
51
83
84
90
44
0
95
97
0
70
0
103
26
8
46
20
109
122
20
109
108
0
0
28
0
135
139
112
35
142
53
146
0
151
0
153
0
0
73
0
164
0
100
0
33
173
135
151
178
180
75
133
189
46
0
197
23
0
200
0
141
206
20...

result:

ok 150010 lines

Test #10:

score: 20
Accepted
time: 294ms
memory: 4204kb

input:

300 300000
0000110011011101000000010110111010000011000110111111110000110101001100010001010111101111110101100110101111100110110110100000101000001001010110001111100110101100011101011010100111011100111100001011010011000101011101000101010010011001100101000011110000000101000001001101001011110101000100110...

output:

0
0
0
10
0
0
14
0
0
0
22
29
31
0
35
31
0
40
41
0
44
0
0
0
51
20
61
62
37
65
0
0
73
76
63
0
81
5
0
85
87
89
0
0
0
0
0
0
0
100
0
0
21
68
0
111
0
0
117
0
68
0
123
68
125
0
128
0
130
131
0
0
0
137
139
140
142
143
0
147
0
152
154
0
163
0
0
167
0
82
172
174
0
0
177
0
0
0
146
189
0
71
144
0
205
192
154
59
...

result:

ok 149998 lines

Test #11:

score: 20
Accepted
time: 475ms
memory: 9944kb

input:

5000 300000
011100011011111101000001011111000101101001000111000101111010100100000100000000000100000100011100001101011000000000000010110011101101011011100100010001011001101101000000111000011101100010001001011000010001101111000001011110110010111001100100111001011101001010101011011110110110111011000100...

output:

0
0
3
0
0
6
7
0
10
18
19
24
0
0
28
0
30
0
33
0
0
41
0
47
0
0
0
0
56
0
62
63
64
65
66
0
71
0
76
80
0
87
0
90
95
0
0
0
102
103
104
108
111
113
0
0
0
121
0
125
0
0
0
130
131
0
0
0
0
144
0
146
0
149
150
152
153
0
0
0
0
162
0
0
169
0
0
0
180
181
182
183
0
185
187
0
0
0
0
0
202
0
0
0
0
0
217
132
0
0
223
2...

result:

ok 149970 lines

Test #12:

score: 20
Accepted
time: 1602ms
memory: 180916kb

input:

300000 300000
0111110110110011001010010000010111110110100110011000001000101101101101111111010001011100000110100100001111011001011010000010001110000000111010111000111101011010011001100100011010011001011010011110101011101110101111001100000101100111001001000111001010100110110000111110101101110110101000...

output:

0
0
4
5
6
0
8
0
0
0
0
0
0
20
22
0
25
0
27
29
32
0
38
39
40
42
45
0
0
0
54
56
0
0
0
0
0
0
0
0
0
71
72
0
0
75
76
77
78
0
87
0
93
95
97
101
106
107
0
0
0
116
0
119
0
122
123
128
0
0
0
134
137
138
0
0
151
0
0
156
0
0
166
0
170
172
174
175
0
0
179
0
185
187
0
0
200
0
202
203
209
0
220
223
224
225
0
227
2...

result:

ok 150040 lines

Test #13:

score: 20
Accepted
time: 1399ms
memory: 166220kb

input:

300000 300000
0001011000111110101111101011010010111100001111001001100111101011101111100100110100001011111101111001000101101010010100101111111000110010111110100011111111000110101001101111110011111110111010111000111111101101111011100110110010011101101011001000011001101101111001110011001111110000100101...

output:

0
0
6
7
10
11
12
14
16
18
21
22
24
27
29
0
0
0
0
0
40
42
43
0
0
0
49
51
52
53
0
56
58
0
0
65
66
0
0
0
71
73
0
0
0
80
81
82
83
85
0
88
0
90
92
0
0
96
0
102
103
104
106
0
0
0
112
115
116
117
0
0
0
0
0
0
0
0
0
0
132
0
134
0
0
0
139
140
0
0
143
0
147
148
149
152
0
0
155
156
0
158
0
161
163
0
0
173
174
0...

result:

ok 180163 lines

Test #14:

score: 20
Accepted
time: 1621ms
memory: 185916kb

input:

300000 300000
1110000101000110011100101101100010001011100111010011000101100010011010001011011101100100111001000010110110111110110000001001111111101111101111111101000010010111011110101001011001100110100010010010011011000110100001101011001111011111110101001011110100111101101000001100101101001110100100...

output:

0
179731
123392
179733
179734
0
14836
179737
100879
179739
179740
0
123220
892
18836
0
179746
0
146118
179749
179750
35814
0
163124
0
0
51586
179757
144293
179759
2250
179761
128614
134845
179764
81056
19864
75349
0
0
0
128365
112124
179773
179774
0
179776
71581
103861
179779
179780
73519
161720
179...

result:

ok 120271 lines

Test #15:

score: 20
Accepted
time: 978ms
memory: 203764kb

input:

300000 300000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

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 300000 lines

Test #16:

score: 20
Accepted
time: 77ms
memory: 8640kb

input:

300000 300000
1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
...

result:

ok 300000 lines

Subtask #3:

score: 20
Accepted

Test #17:

score: 20
Accepted
time: 3ms
memory: 6504kb

input:

1000 1003
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

0
0
0

result:

ok 3 lines

Test #18:

score: 20
Accepted
time: 3ms
memory: 6332kb

input:

1000 1003
00100001101000000001000001001000100010000010010010001001001010001010101100010001000010101100000001001111000001110000010110100000100110001000000101001110000001110001000100000011001110000011010100101000000010100110100010000000110000111100100000011000100010010100000000100000000010001001110101...

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 304 lines

Test #19:

score: 20
Accepted
time: 2ms
memory: 4252kb

input:

1000 1003
11001001111000111100001101101111110010111101110100101000111001111011110111110111111001110011111110111110101110011101111111111111010111010100011010011100101011111001111010111110111010111011101100100111010000110101110001000011100010111110011001010110101111011101100110001100111000000011000111...

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
70
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
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 595 lines

Test #20:

score: 20
Accepted
time: 0ms
memory: 7996kb

input:

1000 1003
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
...

result:

ok 1003 lines

Test #21:

score: 20
Accepted
time: 2579ms
memory: 252448kb

input:

300000 300000
0000000000000000000000000000000000000000000000000100000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000...

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 2993 lines

Test #22:

score: 20
Accepted
time: 1924ms
memory: 217708kb

input:

300000 300000
0011010101100001010010010000110110001001001010100100100000011000001000000011000001000000000000011000000000001001000100100110001001100000000100000010111000000100000000010001000010010000111100010000010100001010100010000100000000111011000000110100000000010010000011010000100100011100000000...

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 90028 lines

Test #23:

score: 20
Accepted
time: 1239ms
memory: 166592kb

input:

300000 300000
0100110101111011111000101011001011100101011100111110111101110111001101110101111011011110110110110100011011110101100111101001010110011110111010100111100101011110011011011011110100100101011111101111101010111011111111001101100011110011011001010011111111101110101101010011110111011110101011...

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 180075 lines

Test #24:

score: 20
Accepted
time: 82ms
memory: 8504kb

input:

300000 300000
1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
...

result:

ok 300000 lines

Test #25:

score: 20
Accepted
time: 47ms
memory: 5896kb

input:

100 242447
1000110110111111100100010100111000111001101111100000100110110000011111010011100101101110101001101000
query 1 2
query 1 3
query 1 4
query 1 5
query 1 6
query 1 7
query 1 8
query 1 9
query 1 10
query 1 11
query 1 12
query 1 13
query 1 14
query 1 15
query 1 16
query 1 17
query 1 18
query 1 1...

output:

1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
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 242400 lines

Test #26:

score: 20
Accepted
time: 51ms
memory: 5888kb

input:

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

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
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 266175 lines

Test #27:

score: 20
Accepted
time: 53ms
memory: 3796kb

input:

130 263995
1000111111101111101111011111011111111010111111010110011111111111100111010111111101111011111111111111111010101101100011101101111010
query 1 2
query 1 3
query 1 4
query 1 5
query 1 6
query 1 7
query 1 8
query 1 9
query 1 10
query 1 11
query 1 12
query 1 13
query 1 14
query 1 15
query 1 16
q...

output:

1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
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 263965 lines

Test #28:

score: 20
Accepted
time: 746ms
memory: 202088kb

input:

300000 300000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

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 300000 lines

Test #29:

score: 20
Accepted
time: 85ms
memory: 8812kb

input:

300000 300000
1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
...

result:

ok 300000 lines

Subtask #4:

score: 20
Accepted

Test #30:

score: 20
Accepted
time: 2ms
memory: 6120kb

input:

1000 1003
10111011001010101101100010101100100010100110001000000001001100111110101100110100010001111101101100110111110100011000111101100100000110110010101011101001101110111100010100100000110001010001111101001010100101011111010000001110111110001011010111101100000001001110101110011111000101101100011010...

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 991 lines

Test #31:

score: 20
Accepted
time: 2ms
memory: 6276kb

input:

1000 1003
01000000111001001110011100111111110011010010110000100010101101101011100011010100100100110101110101010111011100110100110000001010110001011011011010001001101000111011001000000001001100101100010101011101000000101110111011011101100001011110111011001010011101000110100011000101011101000110001011...

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 701 lines

Test #32:

score: 20
Accepted
time: 0ms
memory: 6236kb

input:

1000 1003
00010001110110110000001111110000010011011011100111101001011010000111111110001111010101111011100100101000010111101111100011000111001111011011011101000101100000011101001001111110011000100011000001010001011000000010101001101111101111111101011101101000110010110111010111111001101000000100011100...

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 369 lines

Test #33:

score: 20
Accepted
time: 3ms
memory: 6244kb

input:

1000 1003
11010001011001111110010101101010111101111001011101011011000001101100000111001101100001111101011101110011011100101011110001000011000011100100111101101101010001001100101111110000000011101101000101010010111101011011101110111011000100001001110111111001110101001010111111011100010001000010110010...

output:

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

result:

ok 19 lines

Test #34:

score: 20
Accepted
time: 524ms
memory: 146340kb

input:

300000 300000
0101011000000100111010110000000010110110011011010010000110101000100110011001100101101001011010111100100100001011111000001111110110010110111000100111101001011110100000110111110011111010100111011101001110110111011110000010100111111101010010100011101001001000110111111101110000011111100111...

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 297089 lines

Test #35:

score: 20
Accepted
time: 1004ms
memory: 170548kb

input:

300000 300000
0101111001110000000101010111001000111110011100000111001100100011000010100110011010010000100000101000100111100110010000100100000100110100000110001000101111101111111101111111101100010010000100001111100010000000100011100011111000110000101001111001000111100101000100011010111010110100000100...

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 209698 lines

Test #36:

score: 20
Accepted
time: 1588ms
memory: 186544kb

input:

300000 300000
0010011001011111110110110111111111100110001111001011111100111001100111010011110111010101011001101111010000001011000000001100000010000101001110000100011010000100111100100001001001011010000001110001011011111101110010101000000110100100100101101010000011010100010111100111100001111100011001...

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 120332 lines

Test #37:

score: 20
Accepted
time: 2259ms
memory: 201644kb

input:

300000 300000
1110001011111100100001111010011000010100000011010010000101100111011000010110111101110100000010000000110101100111000011111100000010110011011000110010110101110010100010110100100101110111100011001010011101110001110101110100110010010011010101010011001101110111100101110111111111001100000111...

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 3002 lines

Test #38:

score: 20
Accepted
time: 364ms
memory: 6224kb

input:

400 300000
1100110100010111010100111010011100001100001001111100011101000010010111101001000000110111100010001101111000011111111000000111100101110001110100100001101011100100010011111000001111100001011111001011000101010101111000000100001110101101001111001000111101100111111111010110101010011011101001010...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
114425
0
0
0
0
0
0
0
0
0
0
0
0
0
0
103613
0
0
0
0
0
49268
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
24167
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
61685
0
0
0
0
0
0
187
0
0
0
0
0
0
228
0
0
0
0
0
0
0
0
0
0
0
0
0
0
4240
0
0
0
0
0
4059
0
0
0
0
0
...

result:

ok 80200 lines

Test #39:

score: 20
Accepted
time: 338ms
memory: 6036kb

input:

100 300000
1100001001101010110011000000101111011011001000100111100101100101011001000110010101100100001010101010
toggle 64
toggle 52
toggle 10
toggle 73
toggle 40
toggle 43
toggle 92
toggle 6
toggle 67
toggle 93
toggle 75
toggle 45
toggle 16
toggle 9
toggle 37
toggle 35
toggle 28
toggle 83
toggle 7
t...

output:

0
0
0
0
0
0
0
0
0
4
0
0
0
0
370
0
0
0
0
0
0
0
0
0
0
0
0
0
0
42
0
0
2524
76295
4185
0
23
0
0
0
0
0
0
0
0
0
0
4
146858
0
60
0
0
0
0
0
0
0
0
0
0
938
0
10607
0
0
0
0
972
0
0
0
0
0
0
0
0
0
0
5401
0
0
35695
9012
0
0
77436
0
0
0
0
0
0
0
0
407
0
0
0
0
0
0
472
0
0
4120
0
442
0
36996
0
0
0
0
73953
0
0
0
0
0
0...

result:

ok 5050 lines

Test #40:

score: 20
Accepted
time: 368ms
memory: 6224kb

input:

400 300000
1001000011000110100111110001110000010110010001011011001010110011110001110000101011101001110101100110001001010001011000100010011101010010000001010111100101110100111011110111010010111001100100100101010110001000001011111010101000011011001010100100100110101001010101011000101100100100101010011...

output:

0
0
0
0
0
21
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1791
0
0
0
0
0
0
0
161
0
0
0
0
0
0
0
0
0
0
6939
0
0
0
0
0
0
28607
0
0
0
0
0
0
0
0
0
0
0
4525
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
12342
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
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 80200 lines

Test #41:

score: 20
Accepted
time: 337ms
memory: 6080kb

input:

100 300000
0001111110100101011000001111010011010000110000010001111011110110111011011100011110110001111100000101
toggle 63
toggle 44
toggle 91
toggle 99
toggle 53
toggle 77
toggle 48
toggle 12
toggle 86
toggle 75
toggle 36
toggle 95
toggle 9
toggle 98
toggle 27
toggle 58
toggle 4
toggle 34
toggle 91
...

output:

14
5
4844
0
0
0
0
0
8355
0
0
0
2464
0
0
0
0
0
19
0
0
0
102
4967
76353
0
8361
301
0
0
0
0
18033
0
45
0
18863
0
0
76489
0
0
0
0
0
0
70916
0
0
57
0
0
0
0
0
0
0
0
14
35829
0
0
0
0
0
0
0
145417
0
413
0
8684
14
0
0
0
0
0
0
70942
0
0
0
0
9
0
146252
0
0
143172
0
0
149418
0
0
8857
0
0
0
0
0
199
0
0
5
0
0
0
4...

result:

ok 5050 lines

Test #42:

score: 20
Accepted
time: 369ms
memory: 6152kb

input:

400 300000
0111111100010111011110000100110001100011011111001000100010011100000000101100011000000111100011000010110111111000100001100011101000001100111000001001101100001110101010001110011110011111111000010111011100110010111000111100111000000001111100110001010110100001110110000001010001100111111000001...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
34
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
6104
0
0
0
0
0
0
723
25083
117
386
0
26137
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
106074
0
0
0
0
25140
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1130
0
0
0
0
1079
0
0
0
0
0
0
3787
343
...

result:

ok 80200 lines

Test #43:

score: 20
Accepted
time: 337ms
memory: 3984kb

input:

100 300000
1110100001110111111001011011010110101111111110110010011011111011001010000000101101010101000111000100
toggle 48
toggle 44
toggle 32
toggle 39
toggle 62
toggle 30
toggle 82
toggle 20
toggle 28
toggle 38
toggle 62
toggle 5
toggle 81
toggle 72
toggle 95
toggle 99
toggle 69
toggle 57
toggle 52...

output:

0
0
0
0
0
0
95
0
0
0
0
11
0
0
0
0
0
0
0
71
0
0
0
0
0
18844
34
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
1174
38792
0
0
0
2185
0
18863
0
148583
0
0
0
313
147790
0
0
0
0
0
73620
0
0
0
0
1093
0
0
746
19492
0
25
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
10
0
0
655
0
0
19
0
0
13
0
0
0
0
0
0
0
0
0
0
0
0
8065
0
0
0
148728
0
0...

result:

ok 5050 lines

Test #44:

score: 20
Accepted
time: 801ms
memory: 205524kb

input:

300000 300000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

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 300000 lines

Test #45:

score: 20
Accepted
time: 74ms
memory: 8440kb

input:

300000 300000
1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
...

result:

ok 300000 lines

Subtask #5:

score: 20
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Test #46:

score: 20
Accepted
time: 72ms
memory: 3740kb

input:

10 200000
1101110101
query 6 8
toggle 10
query 5 10
toggle 7
query 2 6
toggle 9
query 7 9
query 7 11
query 1 11
query 5 9
query 2 8
toggle 4
query 2 5
query 1 10
toggle 3
toggle 9
query 1 6
query 8 10
query 1 9
toggle 4
toggle 5
query 1 4
query 1 10
query 9 10
toggle 4
query 3 5
toggle 1
toggle 3
qu...

output:

0
0
0
3
0
0
6
0
0
0
0
10
0
7
0
10
5
10
30
1
1
0
1
0
5
21
17
1
45
47
1
1
1
5
0
42
1
1
21
1
3
13
5
3
1
1
10
34
10
15
18
5
13
27
34
0
76
1
1
50
1
20
13
13
36
3
18
38
37
0
34
46
34
10
13
25
1
1
0
1
1
97
114
9
50
38
1
22
1
13
50
1
1
1
5
1
16
0
1
1
1
75
27
1
13
142
29
63
1
58
33
0
1
18
0
9
9
18
153
69
0
8...

result:

ok 99999 lines

Test #47:

score: 20
Accepted
time: 142ms
memory: 6012kb

input:

100 200000
1001110010110100000111110000000001111001110011010100010101100001010111001001101100100000001000100010
toggle 77
query 9 99
toggle 17
toggle 4
query 6 21
toggle 99
query 87 101
toggle 44
toggle 82
query 3 16
toggle 49
toggle 97
query 15 51
query 13 101
toggle 56
toggle 31
toggle 16
query 21...

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
138
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
130
0
0
0
0
0
0
0
0
68
0
0
0
0
0
0
0
0
0
0
0
99
0
2
261
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 99928 lines

Test #48:

score: 20
Accepted
time: 668ms
memory: 67520kb

input:

100000 200000
1101101110100110010001010000100011111101001001101011011101101101011000000100011010101011010010010111000101100111110011110011010001101010000110100100000100111110110100000100010100111100100001011010110010011010100101010101111101000000000011000010010011111000101001101100111110010101001010...

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 100104 lines

Test #49:

score: 20
Accepted
time: 1397ms
memory: 182004kb

input:

300000 300000
1111111100101111011100000100001010101100110111111011001011101101011000100000011101011011101101110000100000010111000011011001000111011011011001111100011000010111011001010010100110101011010100010100011001001101101011001011010011100000101010010110110001111111011010001010110000111000001111...

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 149934 lines

Test #50:

score: 20
Accepted
time: 64ms
memory: 3924kb

input:

100 300000
1100011000001110010000100100000101101100100101010010010001110100001000010000001111110010001011111111
toggle 5
query 1 2
query 1 3
query 1 4
query 1 5
query 1 6
query 1 7
query 1 8
query 1 9
query 1 10
query 1 11
query 1 12
query 1 13
query 1 14
query 1 15
query 1 16
query 1 17
query 1 18
...

output:

2
3
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
102
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
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 299940 lines

Test #51:

score: 20
Accepted
time: 63ms
memory: 3920kb

input:

90 300000
001010000000000000001101010000000010000010000000010000000101001010010000000101001010000110
toggle 25
query 1 2
query 1 3
query 1 4
query 1 5
query 1 6
query 1 7
query 1 8
query 1 9
query 1 10
query 1 11
query 1 12
query 1 13
query 1 14
query 1 15
query 1 16
query 1 17
query 1 18
query 1 19...

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 299926 lines

Test #52:

score: 20
Accepted
time: 58ms
memory: 5820kb

input:

130 300000
1011010101110011010101100111011101111010111010100011010111001011101111111111101101001011111111111111111101100001101111100110101001
toggle 20
query 1 2
query 1 3
query 1 4
query 1 5
query 1 6
query 1 7
query 1 8
query 1 9
query 1 10
query 1 11
query 1 12
query 1 13
query 1 14
query 1 15
qu...

output:

2
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
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 299964 lines

Test #53:

score: 20
Accepted
time: 65ms
memory: 8068kb

input:

500 300000
1110101010001100100110110101111100010001011010000001011111110100100110110000000010111100010110011101010101110110110001110001110110011010011110111101111100111000110011000000011101011110110001110001101101101110011110101110101011001111011011010000110001111101110110111100000011011001100011011...

output:

2
3
4
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
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 299997 lines

Test #54:

score: 20
Accepted
time: 71ms
memory: 6100kb

input:

500 300000
1010100000000100100000101101101100001101000000010011101000000000010101000000100111000000000000000011100100110011001000000000010000000011000000100001000001001110100000001110011101000000101100101011010000010001101010010000101000100000001000010100000100001000000000011101100010001100000001000...

output:

2
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
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 299997 lines

Test #55:

score: 20
Accepted
time: 66ms
memory: 6096kb

input:

500 300000
0101011110001100100111111111110011111111111001010111111101111111101110001111101100101100101100101110110100010010111111110110110110111010111011100110111100001001100010100001101010111011111101011101110011101101010111110110111110111010101011111100100101000111010011001011011111100111111110111...

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 299997 lines