QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#208772#2117. Pandemia [B]qsceszthn10 ✓21ms4348kbC++141.5kb2023-10-09 20:49:422023-10-09 20:49:42

详细

Subtask #1:

score: 1
Accepted

Test #1:

score: 1
Accepted
time: 0ms
memory: 3808kb

input:

3
8
00110100
10
1001000010
4
0000

output:

5
7
0

result:

ok 3 lines

Test #2:

score: 0
Accepted
time: 0ms
memory: 3616kb

input:

165
3
001
5
01100
3
011
5
00111
11
00011011100
4
1110
5
00000
3
011
11
10111111011
11
00010100100
9
100000110
2
11
4
1000
5
11000
3
001
4
1001
1
0
3
110
10
0000001011
5
11100
2
01
7
0100000
8
10000001
3
001
1
0
1
0
4
1010
2
11
9
001100101
8
01001100
12
001110101000
8
10110011
2
01
5
00111
11
1101001...

output:

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

result:

ok 165 lines

Test #3:

score: 0
Accepted
time: 0ms
memory: 3896kb

input:

104
10
0101101110
10
1110100100
8
10110101
8
10110010
11
11000111000
9
001011010
10
0101001010
10
1001000110
11
11011000010
9
001100001
9
000100110
12
011010100101
8
10010101
9
000010101
11
11001001010
8
10100010
8
00110010
10
1000100010
11
00011100111
8
11100010
11
11101100101
11
11110110110
8
1110...

output:

9
8
7
7
7
7
9
8
8
6
6
11
7
5
10
6
6
8
8
6
10
10
7
3
7
4
9
5
7
9
5
4
7
8
10
11
7
5
5
8
11
7
6
9
7
7
4
8
9
8
10
9
9
8
6
10
6
8
6
9
6
9
7
8
8
7
11
11
7
6
8
9
7
7
7
8
9
11
7
7
8
10
10
10
11
7
3
8
7
5
10
6
8
8
5
10
5
5
8
7
8
6
6
1

result:

ok 104 lines

Test #4:

score: 0
Accepted
time: 0ms
memory: 3580kb

input:

92
12
011000110100
10
0100011000
10
1010000000
10
1100010001
10
0000010000
10
0100000101
12
100100100101
12
101011010000
12
010000100001
10
0000001100
11
00011001000
11
10100000100
12
000010001010
11
00010111101
11
00100100100
11
00001010101
12
100001110010
12
100100111000
11
00001001001
11
01001000...

output:

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

result:

ok 92 lines

Test #5:

score: 0
Accepted
time: 0ms
memory: 3576kb

input:

92
12
100000000001
11
00000000000
11
00001000101
12
010000000000
11
10000100000
11
00000010000
10
1000001001
10
0000110001
10
1000001000
10
0000100000
12
100110110001
11
00010000000
10
0010100000
10
0000100000
11
00000000000
11
00001000100
10
0010001110
11
10000000001
12
010000101000
11
00100000010
...

output:

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

result:

ok 92 lines

Test #6:

score: 0
Accepted
time: 0ms
memory: 3640kb

input:

90
10
0111011111
11
01101111110
11
01111011100
10
0101111111
11
00111010111
11
00001111101
12
111011110110
12
110111011101
11
01110111101
11
11111110101
10
1110011111
12
111100010011
10
0001000101
10
1111001011
11
11000110111
11
11111100011
12
100011111110
12
111101001101
11
11100111001
11
111100100...

output:

9
10
9
9
9
7
11
11
10
10
9
10
6
9
9
9
10
11
10
9
11
9
10
10
9
10
8
8
8
9
8
9
8
10
10
11
11
11
9
9
8
9
11
10
8
10
10
11
8
10
11
11
10
10
11
10
11
9
11
8
11
10
11
11
11
9
9
9
7
5
10
9
8
10
6
11
9
8
9
9
10
9
10
11
10
9
10
9
10
3

result:

ok 90 lines

Subtask #2:

score: 1
Accepted

Test #7:

score: 1
Accepted
time: 0ms
memory: 3580kb

input:

156
2
00
4
1011
5
01100
3
100
3
010
9
111100110
6
110101
7
1001001
10
0111100011
1
0
3
010
12
001010010000
11
00110001001
8
11111111
5
00011
8
11101011
8
00000011
5
10101
3
100
8
00000101
7
1101000
3
010
2
10
10
1011110110
8
11010000
4
1001
3
101
1
0
1
0
8
10010010
12
011101110000
12
100101110001
11...

output:

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

result:

ok 156 lines

Test #8:

score: 0
Accepted
time: 0ms
memory: 3640kb

input:

97
9
001111001
9
010011011
10
1110110011
10
0010110001
11
01100100110
10
0100110111
11
01101110101
12
100111000100
11
01100100101
12
011011000110
11
01110011101
10
0101010101
11
01011100001
9
001110100
10
1110100100
11
00011011001
12
101101101100
9
101111011
11
01100110011
10
1001001010
9
011101101
...

output:

7
8
9
7
10
9
10
9
10
10
10
9
8
6
8
8
10
8
10
9
8
6
10
4
8
9
9
9
3
8
9
8
8
8
6
9
11
11
9
9
9
9
5
11
7
9
10
8
8
6
8
8
8
9
9
6
9
10
7
9
8
8
6
10
8
10
5
9
9
7
8
8
7
9
9
9
9
4
7
10
8
8
8
9
6
10
7
11
6
9
8
7
7
9
9
8
6

result:

ok 97 lines

Test #9:

score: 0
Accepted
time: 0ms
memory: 3884kb

input:

90
10
0001000100
12
001010000101
10
0000011000
11
10100100000
11
10101010011
11
10100010110
11
10001100000
10
0000101011
12
001000000001
12
000001001000
12
000001010101
10
1000000110
12
101011000000
12
000000000000
12
000001000001
11
10101110001
12
010100010001
11
00010011000
10
0000110000
10
000100...

output:

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

result:

ok 90 lines

Test #10:

score: 0
Accepted
time: 0ms
memory: 3640kb

input:

91
12
000000000001
11
00000000000
11
00000000000
10
1001110000
11
00100110000
11
01000100000
12
000000010001
10
0000001000
10
0010001000
11
00010010000
10
0000000000
12
000000000100
12
010000110000
10
1010000000
10
0000000001
10
0000100000
11
10010000000
11
10001000100
11
10001000011
11
00100000110
...

output:

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

result:

ok 91 lines

Test #11:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

91
11
10110111110
11
11111111110
12
011111011101
10
0011010001
12
110010111011
11
11101111011
12
011111111111
12
011111111111
11
00111110111
11
11110101101
11
11111111001
11
10101110001
10
0110011111
12
110111011101
11
01100101011
12
011101111001
10
1011101101
10
1010111110
11
11111111100
11
1111100...

output:

10
10
11
7
11
10
11
11
9
10
10
9
9
11
10
11
9
9
9
10
9
10
9
10
11
8
10
9
10
10
11
8
9
9
9
9
8
10
11
10
10
10
10
9
10
10
9
11
10
11
9
9
11
11
11
10
9
6
9
9
10
9
10
10
9
9
6
7
9
9
11
11
9
8
11
11
10
10
10
10
9
10
9
11
11
11
11
10
8
11
8

result:

ok 91 lines

Subtask #3:

score: 1
Accepted

Test #12:

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

input:

187
52
1000111101110110110011011100100110100101001100101101
46
1100000110010100010101001000111101000000000110
62
00100011110000011000111010111111101100111101001001010011110111
76
1110001111001101110001011000100100001111110100010010100000111100011110101101
22
0001110010111010010011
22
001111000010110...

output:

50
37
58
72
19
19
32
49
84
47
17
94
23
57
81
57
83
80
76
38
87
53
78
88
33
25
31
1
86
69
0
48
4
57
63
63
56
22
53
17
90
22
73
40
76
37
95
11
34
63
13
77
81
41
38
2
86
16
90
9
1
44
42
44
34
40
58
93
61
29
24
79
21
56
70
60
13
49
90
57
53
94
43
81
45
83
63
58
59
56
53
66
41
81
9
24
31
2
14
43
19
65
87...

result:

ok 187 lines

Test #13:

score: 0
Accepted
time: 0ms
memory: 3532kb

input:

103
98
00101110000111001010111110001010101101100011011111011110000100111100110000011000010100000110110011
97
0010110101010111101000000011100111101011000100101010010001100001100111100110011110111100101001111
98
000101100110111100000110100111010010101000100000101101110110110100010010100010111111110001...

output:

93
91
93
89
93
93
93
91
96
93
90
92
86
87
94
93
92
93
93
96
90
92
95
90
88
93
89
91
89
89
94
90
91
90
88
89
91
93
93
91
91
92
95
94
94
92
83
95
86
92
90
96
93
95
93
93
95
92
94
90
89
92
90
93
82
92
93
91
90
83
89
96
89
92
90
89
93
87
91
92
94
92
89
92
90
93
93
93
86
94
94
94
88
92
92
93
94
90
90
96
...

result:

ok 103 lines

Test #14:

score: 0
Accepted
time: 1ms
memory: 3648kb

input:

102
99
101100111010000001010000000110000000000001101011100000000001000000001010011011100001110010100111001
98
00110111000011101101001101100001001011000001010000000100000111100010010101001010000100101100001101
99
0000100110110000010001000110011010011011000000010111100101100000000011010011100000000101...

output:

83
91
88
79
89
90
93
89
93
85
91
86
85
76
85
88
89
87
91
86
85
86
87
88
81
86
92
80
94
89
89
94
92
90
93
86
83
89
91
90
90
89
77
91
90
83
88
91
92
92
86
89
93
78
88
83
81
91
87
90
81
93
87
91
79
88
92
87
78
93
88
91
83
75
90
86
94
95
92
92
90
84
89
88
82
85
91
86
90
94
82
86
89
84
86
81
91
87
85
86
...

result:

ok 102 lines

Test #15:

score: 0
Accepted
time: 1ms
memory: 3812kb

input:

101
100
0101000110000000000100100010000000000010000001000000000000000100001100000000001100000000000000000010
100
0000000000010000010000001100001001100000001000101000000000000100100100010100000000000101001001000101
98
11000010011010100000100100011010000010010011000000000001010000100010000000010100010...

output:

71
76
85
64
83
68
81
83
89
76
77
83
86
66
69
77
72
68
77
79
78
56
87
86
79
67
77
75
88
73
81
80
85
73
70
51
66
75
69
75
82
82
72
79
74
56
71
75
85
72
79
85
66
78
78
72
71
63
72
85
82
78
85
81
66
84
66
76
73
84
78
87
85
80
79
73
75
68
57
82
53
82
68
73
85
73
75
75
78
83
68
67
82
73
77
75
77
79
79
76
81

result:

ok 101 lines

Test #16:

score: 0
Accepted
time: 0ms
memory: 3580kb

input:

101
100
1001101111011110110110011011111101111011011011111010111111100101110110010101101110010111011010011000
99
001101110011110011101111011111000110000110000011110101101110111111111111111000111100111010011111011
100
111011001010101110101100011001111001000111110001101111101111111111110111011111000001...

output:

97
95
96
93
97
97
96
97
92
96
91
96
97
96
96
97
96
98
96
92
94
98
97
97
98
96
96
99
95
95
97
97
94
93
96
98
96
98
92
95
93
97
98
96
98
96
98
98
96
97
95
98
97
97
96
96
97
97
94
96
96
95
97
95
98
98
96
97
96
95
94
97
95
95
92
96
96
93
95
98
97
91
98
95
98
95
97
93
98
96
97
94
97
96
99
95
95
96
95
95
89

result:

ok 101 lines

Test #17:

score: 0
Accepted
time: 1ms
memory: 3640kb

input:

823
1
1
2
10
3
101
3
001
3
010
4
1001
4
0101
4
0001
4
0100
5
10101
5
10001
5
10010
5
10100
5
01010
5
00001
5
00010
5
00100
6
100101
6
100001
6
010101
6
100010
6
100100
6
010010
6
000101
6
001010
6
100000
6
010000
6
001000
7
1010101
7
1001001
7
1010001
7
1000001
7
1010010
7
1000010
7
1010100
7
010101...

output:

1
1
2
1
2
3
3
1
2
4
3
4
3
4
1
2
2
5
3
5
4
4
5
3
4
1
2
2
6
6
5
3
6
4
5
6
4
5
4
5
3
4
4
1
2
2
2
7
6
5
3
7
7
6
4
6
7
5
5
5
6
4
5
4
5
5
3
4
4
1
2
2
2
8
8
7
7
6
5
3
8
7
6
4
7
8
7
8
6
7
5
5
6
7
5
6
5
6
6
4
5
6
4
5
5
3
4
4
4
1
2
2
2
2
9
9
8
7
7
6
5
3
9
9
8
8
7
6
4
8
9
7
8
7
7
5
5
7
8
7
8
6
7
5
6
6
7
7
5
6
...

result:

ok 823 lines

Test #18:

score: 0
Accepted
time: 0ms
memory: 3620kb

input:

101
99
000000000000000000000011010001000000000010000010000000000000000000000100000001000011000000000000000
98
10000100001000000111000100000000000000001000001001000010000010000000001000000000010000000001000000
98
0000000000000000000001000010100000000110000000000000000001100100000000001000011001011000...

output:

45
76
59
51
78
71
59
62
51
63
68
83
44
68
68
72
73
81
67
68
54
47
77
61
74
70
65
75
74
59
70
63
68
59
58
65
62
61
77
69
70
81
60
56
53
75
58
72
49
86
66
70
81
75
73
75
75
68
71
70
79
50
53
64
64
58
66
74
77
61
58
66
63
51
53
64
68
67
74
33
72
61
39
74
74
70
71
85
72
79
65
66
61
61
76
68
63
73
69
52
52

result:

ok 101 lines

Test #19:

score: 0
Accepted
time: 0ms
memory: 3620kb

input:

102
100
1001000000000000000000001000000000000000000000000000000000000000000001100000000000000001000000001000
100
0000000000001001000000000010001000000000010000000000000001000010010000000000000000000000000000000100
98
00000000100000000000000000000000000000000010000000000000001000000000000000000000000...

output:

35
52
18
18
19
53
55
8
26
13
48
22
35
2
49
17
13
38
59
16
26
48
40
38
40
43
2
59
30
54
27
8
6
24
17
26
0
42
28
9
18
27
23
21
23
43
40
7
29
11
10
30
10
8
45
7
20
22
8
21
53
27
43
45
41
55
26
48
8
32
38
18
28
49
55
22
32
18
20
35
2
21
18
29
8
23
27
20
2
33
2
31
30
29
33
28
15
37
23
23
24
0

result:

ok 102 lines

Test #20:

score: 0
Accepted
time: 1ms
memory: 3620kb

input:

103
100
0001110011000001011011000100110000010001000010100100001000110000011100010000000011010011001100000100
100
0100000010000000010000000011000001001010000111000001000100111001010010010001010010000111000001001110
97
00011100000100000100010000101101000001000010010001000001000011000000101010000100001...

output:

92
90
91
90
88
89
87
90
86
90
90
84
90
89
85
87
84
93
91
86
91
92
88
88
92
92
93
88
90
87
89
85
90
92
87
89
86
89
90
87
92
92
89
89
87
92
94
87
86
89
86
90
86
89
93
89
87
88
87
90
92
89
88
89
92
87
92
90
89
87
87
88
88
84
88
84
88
91
89
90
88
93
91
84
93
89
91
87
88
88
88
90
90
90
90
90
92
87
86
90
...

result:

ok 103 lines

Test #21:

score: 0
Accepted
time: 0ms
memory: 3624kb

input:

108
91
0000000000001000000000010010000000100000000000000100000000000100000000000000010000000001000
93
010000001000000000000100000000000001001000000000100000000000000100000000000000010000000010000
98
00000000000100000000100000000000000100000000000000010000000000000000100001000000000000101000000000
91...

output:

59
66
61
51
63
66
64
57
63
68
55
57
54
63
70
67
61
64
57
63
66
59
68
62
57
60
69
58
62
67
52
53
54
73
56
63
56
59
64
61
57
52
62
53
63
62
63
71
60
59
52
55
63
51
71
65
58
59
62
61
66
67
65
66
71
67
68
48
59
60
56
62
67
54
53
67
64
64
60
46
58
64
54
61
53
48
68
54
47
61
58
68
53
63
55
56
65
68
57
61
...

result:

ok 108 lines

Test #22:

score: 0
Accepted
time: 0ms
memory: 3880kb

input:

10
100
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
100
1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
100
10000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

0
100
1
99
82
70
67
67
64
61

result:

ok 10 lines

Subtask #4:

score: 1
Accepted

Test #23:

score: 1
Accepted
time: 0ms
memory: 3584kb

input:

191
58
0010001101010001101010001110000000011010010110111110100000
95
10101101001110010000111101000111010110010000111101001000000011110000000000111010010000010101111
38
11111000100001001111001101000111111000
55
1111010100011100001100110100101010010000100000001001110
92
1100110101100111010101010001101...

output:

48
84
34
49
90
7
81
56
81
47
54
6
39
70
14
89
89
35
64
39
45
72
3
74
43
68
46
31
45
65
30
53
45
53
9
76
72
22
32
83
36
77
9
54
29
46
49
83
15
17
19
35
8
93
63
68
47
16
88
7
55
6
85
93
22
71
36
19
17
89
19
40
92
2
89
37
30
7
5
20
77
8
83
40
93
1
92
2
9
88
46
29
67
18
78
46
40
18
18
4
80
19
67
96
30
3...

result:

ok 191 lines

Test #24:

score: 0
Accepted
time: 1ms
memory: 3660kb

input:

103
98
10001000010011111001000010100011110010110001101101101010000011000110010010110110100101101011101010
98
01000011111000011101001011110111000001110010100001101010001100100101010000111010001101111100110011
100
0101101101010100000101100011111001110111111010011111010110010100000010011000110010101000...

output:

94
94
94
94
91
89
90
96
87
88
90
91
96
92
91
94
94
89
95
88
86
93
95
91
95
90
84
90
91
91
87
93
89
91
88
92
91
93
95
90
95
91
87
90
87
87
90
92
89
93
95
95
93
89
97
94
91
90
93
92
93
94
92
92
92
89
89
95
92
95
96
90
91
95
92
89
93
94
93
93
89
92
88
93
84
89
92
96
93
97
97
95
94
96
91
91
96
93
94
91
...

result:

ok 103 lines

Test #25:

score: 0
Accepted
time: 1ms
memory: 3880kb

input:

101
98
11000100001000011000100100100100000010100001000100101100001010010000001101000000001001000000000100
100
0010010000001010001010000010000110100000000000110010100000010000101100100101001110100000000010000000
100
0000110100000010000100100010100100010010000110001100011000000100000000000000100010001...

output:

87
83
85
74
76
88
79
82
84
85
71
67
77
83
87
74
85
86
88
77
74
81
89
73
77
89
81
89
83
61
87
86
73
78
86
90
74
89
76
81
70
81
78
87
79
85
77
80
84
83
64
86
83
86
93
73
83
63
88
80
76
79
85
79
83
78
67
82
85
86
79
87
87
79
82
87
80
82
72
72
76
81
90
84
86
84
82
89
86
85
82
79
85
79
91
69
79
82
80
77
69

result:

ok 101 lines

Test #26:

score: 0
Accepted
time: 1ms
memory: 3688kb

input:

102
98
00000001000000000100000000000000000010010000010000000001001000000000000010100100000000000100000000
100
0000010100001000100010001001000000100010000001000000000010000000000000000100001000000000000000000001
98
10000010000010011000001000000000000001000000000001000100100000001000000001000000000000...

output:

67
69
76
73
80
62
80
65
41
65
66
74
67
64
81
69
77
70
73
70
80
73
66
81
60
83
71
68
78
77
83
76
73
78
64
72
71
69
71
62
71
86
58
77
75
76
71
67
75
72
79
57
77
63
61
64
75
61
69
62
68
77
71
43
73
72
79
68
80
44
70
60
75
70
70
78
74
69
60
55
74
83
68
68
75
72
75
68
75
64
69
74
63
59
72
75
84
73
48
76
...

result:

ok 102 lines

Test #27:

score: 0
Accepted
time: 0ms
memory: 3652kb

input:

102
99
011111111111110101111111111011111011110101111010111111111000101111110111011101011111100011111111111
100
1111111110001111110111111111111111101111111111101101010011111111011111101100111111010111011111111101
100
111111011101101101111110001011111111111111101010110111111000111111110111101101101110...

output:

97
98
98
96
98
95
98
98
96
96
96
98
98
98
98
95
97
96
94
97
99
98
96
99
98
97
96
98
96
97
95
94
96
96
97
97
98
96
98
96
97
97
96
95
97
96
99
97
95
99
99
96
97
96
97
98
96
96
97
98
97
98
98
99
96
98
99
96
96
96
97
98
97
96
98
97
96
98
95
98
95
99
95
98
95
96
95
96
96
96
98
97
97
99
97
98
97
97
96
96
...

result:

ok 102 lines

Test #28:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

101
100
0000000100000010010000011100110100001000011111000110000010010000000000000000010000001000000000011110
99
100000100010001001000000000000000000100001000000001010100000000010000010100001000001001000011000000
100
000000000100000001011001000101000101001000000000100000000000110010011000001000000101...

output:

76
76
71
74
74
75
80
82
81
64
71
72
76
75
71
75
75
72
78
80
88
76
75
83
78
73
81
84
81
81
62
56
61
83
69
86
77
73
82
56
53
73
74
81
72
80
60
69
74
69
76
65
72
84
69
87
87
80
78
80
75
78
80
80
82
75
83
86
72
76
69
70
73
59
72
76
76
68
90
82
68
81
79
69
77
81
78
78
78
87
81
79
81
52
56
70
73
72
66
82
70

result:

ok 101 lines

Test #29:

score: 0
Accepted
time: 0ms
memory: 3644kb

input:

102
99
000000001000000000010100000000000000000000000000000000010010000000000000000000000000001010001000000
99
000000000000000000000000000100110000000000010000000100000011000000000000000000010000000000000000000
100
00100100000000000000000000001000000000100011000100100000000000000000000000000000000000...

output:

40
38
30
59
56
73
55
49
16
51
74
67
63
33
74
59
45
50
52
51
72
64
35
63
67
72
54
63
24
31
54
52
59
75
43
34
52
56
74
59
55
43
56
70
41
40
81
66
65
60
66
55
16
64
59
45
55
52
49
40
55
43
55
51
61
55
65
56
44
29
47
57
61
58
52
47
71
23
67
54
74
53
47
72
36
51
62
66
57
36
56
40
44
32
61
61
61
63
57
65
...

result:

ok 102 lines

Test #30:

score: 0
Accepted
time: 0ms
memory: 3652kb

input:

103
96
100000000001000100010000000000000000000100010000000000000000000000000000000000000000000000000001
95
00100000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000
98
0000000000000000100000000000000000000000000000000000000000000000000000000000000000000000100000...

output:

31
7
14
39
18
19
2
18
29
11
25
2
10
15
8
21
18
10
13
22
27
10
17
6
22
30
7
2
17
14
13
8
24
1
6
1
15
9
3
20
17
2
23
21
12
7
23
12
14
8
13
28
17
17
9
16
19
21
8
6
3
10
27
9
34
26
34
17
15
3
18
13
10
13
5
28
1
2
13
2
26
15
17
6
11
9
20
6
22
7
24
8
8
6
19
40
10
12
16
20
20
34
7

result:

ok 103 lines

Test #31:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

103
97
0000000010000000000000101000000000000100100001001000010000000000010000000100010000000010001010000
95
10000000010000100010000001100110000000001000010000000000100101010000000000010000000010001000000
100
00000101000000000001000100010000000000010000000000100001001000000000000100100010001000000000...

output:

73
78
79
74
78
75
71
75
81
80
75
71
77
77
72
73
78
76
76
80
73
75
80
67
72
77
79
78
76
79
75
76
80
76
81
72
77
76
78
73
71
82
70
84
75
77
78
73
85
68
74
74
81
74
78
79
78
78
72
72
72
79
73
74
72
69
77
71
64
72
73
79
70
75
78
80
76
82
76
79
74
78
75
77
75
77
81
78
76
78
74
78
74
67
77
78
74
72
81
66
...

result:

ok 103 lines

Test #32:

score: 0
Accepted
time: 0ms
memory: 3592kb

input:

110
89
00100000000000001000000001000000000100000000000000000010000000000001000000000000000000000
95
00000000000000000010000000000100000000010000100000000000000100000000000000000000100000000000100
99
000000000100001010000000000000010000000010000001000000000000100000000000000001000000000000000000000
7...

output:

46
52
54
39
44
44
38
50
53
51
57
54
47
55
43
43
47
41
42
47
52
46
35
41
35
53
46
59
48
48
48
40
54
44
34
51
39
45
42
52
50
52
41
48
36
38
45
51
47
41
37
49
57
48
52
58
46
42
47
43
31
39
55
41
54
50
48
42
50
56
39
41
29
38
56
48
51
42
61
44
50
54
45
50
43
51
60
57
48
51
36
60
48
58
40
58
52
52
47
42
...

result:

ok 110 lines

Subtask #5:

score: 1
Accepted

Test #33:

score: 1
Accepted
time: 2ms
memory: 3584kb

input:

419
340
0000110110111010111011000011010010001011101000101010110110111010001100110110101011111010110000001010111010100110000011000100011010011010101000110111011000110001000010001011111110001100100101100001001000110010111100100011010101100111101101001111111011101010001011100110000010000111110100011010...

output:

333
107
10
282
417
407
326
326
187
169
41
152
14
78
80
108
490
302
231
399
393
37
492
251
399
90
425
142
157
26
65
67
448
117
438
342
16
416
109
280
19
374
160
100
446
7
434
195
307
225
414
492
79
343
38
257
196
348
64
450
255
249
432
288
259
38
152
377
137
278
8
358
259
25
389
84
156
457
216
74
166...

result:

ok 419 lines

Test #34:

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

input:

201
496
0001100011010011101010101110100001111101101110000000111000011100110110111011110100010111000100110000000000000110001110011001110100010011101011100101000010011110011110111111001010111111010101001100011011110100001101010111111101100111111001111010111001000001110010011111100010010000011110100110...

output:

482
491
494
489
492
491
488
491
489
494
490
487
492
487
487
489
486
490
491
491
492
490
487
490
489
491
485
483
495
488
488
492
486
477
486
478
490
492
491
493
485
489
489
486
494
478
488
485
488
486
490
490
487
491
488
491
491
484
487
487
484
485
487
489
485
487
489
490
489
491
494
483
491
487
488
...

result:

ok 201 lines

Test #35:

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

input:

201
498
0001111100001110100000010001001010101000000111000100000000101000101001000000000000000111001101101100001110010100000110101100000000000101100001000000001011011000111001010001101000000110110010001100110001100111110000111001000110111001101010010111011111100101000000100010110001010000101100000111...

output:

478
482
477
474
474
483
481
471
476
477
478
475
484
479
482
477
490
467
478
473
489
475
478
486
483
477
483
484
461
478
484
478
470
484
487
476
478
483
479
481
461
486
477
475
475
479
473
473
480
482
480
476
478
479
480
475
473
474
476
479
476
477
469
478
474
484
480
471
485
478
478
476
485
464
475
...

result:

ok 201 lines

Test #36:

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

input:

201
499
1101101101001111010011111111110111111110011011100101111111010101111011111111100111011101010110000111011011111111001110110010100111011011111100111001101011001111011110111101110101101001100001001001011001010001101101101110110111111011111111111101111111111111100001110111011110111011111010011111...

output:

496
497
496
493
493
495
495
492
492
492
493
496
493
492
494
493
492
491
493
493
497
497
494
494
493
495
496
495
494
488
493
496
495
496
492
496
494
490
493
493
495
492
494
497
495
494
492
494
496
497
496
497
497
496
493
494
494
490
495
495
494
494
487
496
493
494
497
494
494
495
494
490
495
495
493
...

result:

ok 201 lines

Test #37:

score: 0
Accepted
time: 3ms
memory: 3588kb

input:

5602
1
1
2
01
3
101
3
001
3
010
4
1001
4
0101
4
1000
4
0010
5
10101
5
10001
5
10010
5
10100
5
01010
5
00001
5
00010
5
00100
6
101001
6
100001
6
010101
6
100010
6
100100
6
010010
6
000101
6
001010
6
100000
6
000010
6
001000
7
1010101
7
1001001
7
1000101
7
1000001
7
0100101
7
1000010
7
1010100
7
01010...

output:

1
1
2
1
2
3
3
1
2
4
3
4
3
4
1
2
2
5
3
5
4
4
5
3
4
1
2
2
6
6
5
3
6
4
5
6
4
5
4
5
3
4
4
1
2
2
2
7
6
5
3
7
7
6
4
6
7
5
5
5
6
4
5
4
5
5
3
4
4
1
2
2
2
8
8
7
7
6
5
3
8
7
6
4
7
8
7
8
6
7
5
5
6
7
5
6
5
6
6
4
5
6
4
5
5
3
4
4
4
1
2
2
2
2
9
9
8
7
7
6
5
3
9
9
8
8
7
6
4
8
9
7
8
7
7
5
5
7
8
7
8
6
7
5
6
6
7
7
5
6
...

result:

ok 5602 lines

Test #38:

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

input:

201
499
0000000010000100000010010000100000000000010000000100001000000000010000000100001000100000001100100000001000000100000000010000000000000100000100001000000000000000000001000000001000010000000000011001000100100010001000011010000000000000100000001001000000000000001000000100000100010000000101010001...

output:

455
425
421
400
415
433
443
440
440
445
421
411
418
454
441
421
430
440
450
421
399
416
442
433
442
416
434
406
424
416
420
403
430
423
429
409
418
415
418
424
413
440
418
444
416
435
405
424
440
460
422
458
428
418
440
420
448
427
435
435
420
426
436
400
438
428
408
422
419
439
420
442
397
440
434
...

result:

ok 201 lines

Test #39:

score: 0
Accepted
time: 0ms
memory: 3880kb

input:

201
499
0000000000000000000000000000000000000000000000000000000000000000101000000000000001000000000000000000000000000000010000001000000000000000000000000000000000000000000000000000000000000000010000001000000000000000000000000000000000000000000000000000001000000010000001000000000000000000000000000000...

output:

194
278
239
245
221
306
286
283
232
301
293
332
275
306
229
299
167
273
248
281
262
207
339
264
290
271
241
328
329
342
256
234
253
295
315
315
327
180
153
275
246
227
271
169
302
220
363
241
337
326
234
214
263
242
279
218
188
283
336
356
324
314
254
221
224
241
319
260
179
236
241
344
249
334
293
...

result:

ok 201 lines

Test #40:

score: 0
Accepted
time: 1ms
memory: 3888kb

input:

201
500
0000000000000000000000000000000000000100000000000000000011000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000...

output:

99
86
153
69
92
97
108
66
120
206
107
88
93
145
178
51
224
122
138
122
203
159
109
102
101
98
140
108
62
81
92
128
158
159
96
50
90
37
118
132
95
87
32
115
52
177
104
87
190
211
94
94
72
32
131
134
129
110
156
144
38
67
32
121
101
67
230
157
116
50
32
147
158
149
197
95
191
152
111
156
46
179
56
118...

result:

ok 201 lines

Test #41:

score: 0
Accepted
time: 0ms
memory: 3652kb

input:

201
495
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

13
20
70
21
64
32
35
19
19
45
22
125
64
63
5
2
18
19
52
5
32
76
37
32
43
18
2
69
62
6
18
25
20
55
11
2
70
8
29
39
40
81
13
50
22
81
17
69
30
8
41
11
18
18
27
35
18
14
64
56
32
73
50
97
21
52
84
22
62
117
12
39
18
34
20
36
3
25
62
57
5
28
100
61
85
43
14
29
13
24
28
8
18
26
40
74
26
45
3
16
39
56
45
...

result:

ok 201 lines

Test #42:

score: 0
Accepted
time: 1ms
memory: 3640kb

input:

201
499
0000000001000000000000000010000000000000100100000000000000000000000000000000001000000100010000000001000010000000000010000000000000000000000000000001000000000000000000000000000000001000000100010000000000000000100000000000000000010000000001000000000000000000010000000000000000000000000010000000...

output:

390
415
389
382
400
387
405
396
392
402
380
402
386
388
399
382
394
404
386
363
390
386
403
418
398
399
384
393
385
373
384
399
402
385
392
388
386
393
401
393
400
400
372
390
389
388
384
414
420
393
393
406
381
398
375
414
391
393
379
407
392
397
396
403
401
386
402
387
398
383
402
377
387
397
378
...

result:

ok 201 lines

Test #43:

score: 0
Accepted
time: 1ms
memory: 3592kb

input:

209
468
0000000000000000000000000000000001000000000000000000000000001000000000000000000000000000000000000000000000100000000000000000000000100001000000000000000001000000000000000000000000000100000000000000000000000000000000000000000000000100000000000000000000000000000010001000000000000000000000000000...

output:

277
267
311
292
304
274
288
302
266
297
273
281
289
292
287
271
296
286
293
297
281
277
241
276
286
328
307
318
289
286
302
302
305
288
298
274
285
263
304
266
223
283
318
285
245
308
273
304
276
290
289
247
266
271
266
260
261
303
302
281
284
304
258
268
271
303
274
250
270
288
255
291
269
292
277
...

result:

ok 209 lines

Subtask #6:

score: 1
Accepted

Test #44:

score: 1
Accepted
time: 2ms
memory: 3540kb

input:

402
278
01101101111000111010111110001110100011001000000011100001000100110111000000001000100100100011110000001001010001101010010110001101101100001001111011110001111100100100101110000011011101000001100100011100111111011111011011011100110011111111111100111001001011000001110001000010010001
115
010001111...

output:

269
110
235
278
143
415
486
47
183
418
410
229
69
343
360
127
55
273
348
274
451
229
25
88
0
374
335
372
55
396
129
440
8
432
171
301
182
244
391
168
261
380
49
326
233
6
489
242
275
421
80
57
201
299
442
457
333
426
190
319
111
129
227
358
113
270
380
15
162
417
462
335
70
432
364
81
327
399
103
92...

result:

ok 402 lines

Test #45:

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

input:

202
496
0001000011100001010111101101100000110100111010001000001010011110001000101110001010111110001011001101010000011000100000011100000001000000101111100110101100111010000110101001010100110110011000010001001000001011110010111000011000000001001000101001011100110001110001011000000011000011111100110110...

output:

486
485
491
487
484
486
484
493
493
484
483
489
486
490
487
492
480
491
486
488
485
484
490
492
486
490
479
492
490
488
489
488
487
494
488
482
485
489
493
483
490
487
491
486
490
485
493
485
486
487
492
487
491
485
490
488
494
489
487
488
487
485
485
489
490
484
490
489
484
492
491
485
483
492
488
...

result:

ok 202 lines

Test #46:

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

input:

201
499
1000000000000000100000000000000000000001000100000100000000000000010000000000000000000000100000100000000000000000010000010000100000000110000000100000001000110010000000001000001000000001000100100110010100000000010101001000000000001000000000000000000100000000000010100010000000000000000000001100...

output:

442
416
436
440
421
448
452
442
453
450
460
425
458
465
435
448
435
436
442
453
432
427
399
448
427
411
436
423
466
443
434
440
445
453
438
434
444
435
455
455
455
441
428
420
456
449
439
442
458
391
454
451
444
452
439
441
449
440
442
434
425
411
457
447
441
450
437
441
439
428
429
439
456
448
418
...

result:

ok 201 lines

Test #47:

score: 0
Accepted
time: 0ms
memory: 3596kb

input:

201
498
1101111111110011011111011010011101111100110001111110111110111010001111101110110100001011110110110101110111111111111111010101111000111111001111111110110110110101110011111011101111111111111110111111010111111100011011001101011100001101111111111111111111111111111101001011101101010111111111010110...

output:

495
495
495
495
495
494
496
494
496
495
497
496
497
495
498
497
496
496
495
495
494
495
496
496
496
495
495
496
498
496
495
494
496
494
495
496
497
496
496
497
494
497
496
496
496
494
494
496
497
496
496
497
496
498
495
497
495
497
496
496
496
495
497
497
495
496
497
493
498
497
495
494
496
496
495
...

result:

ok 201 lines

Test #48:

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

input:

201
499
0000000001101001000000000000010111000100000000000000001000000000001000000010000000000000000000001000011101001000101111001000100011000100010000001100010000100100000010000000100000100000000100000000100010010000000000001000000000000000100000000000000000010000000000000000000000000000001100101000...

output:

420
457
449
469
437
469
443
449
444
469
437
453
457
425
436
470
452
458
451
460
471
454
456
443
468
467
436
454
455
459
446
467
457
452
457
434
448
464
453
456
462
465
454
423
452
452
439
448
465
448
468
441
447
463
462
458
464
463
448
461
465
447
454
474
443
466
443
459
470
470
458
458
448
460
439
...

result:

ok 201 lines

Test #49:

score: 0
Accepted
time: 1ms
memory: 3480kb

input:

201
500
1000000000000000000000000001010000010000010000101000000000100000001000001000000000000000000110010000000000100000100000010100000000000000000000000000001000000000100000000001000000000101000000100000000000011000000000000000000000000000001000000000001010000000010000000000000001000000000000010000...

output:

424
393
411
415
351
361
409
380
410
401
401
384
400
348
405
385
359
414
375
383
391
395
382
378
385
383
409
396
431
342
375
393
417
388
334
349
346
407
399
434
409
391
386
386
406
403
428
430
407
410
377
417
347
411
384
395
418
371
396
367
431
418
366
332
435
394
360
363
343
389
357
322
397
401
373
...

result:

ok 201 lines

Test #50:

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

input:

201
498
0000001000001000000000000000001000000000000000100000000000000000010000000000000000000000000000000000000000000001000000000000000000000000100000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000...

output:

201
178
178
131
226
223
210
312
231
204
233
176
161
270
300
198
201
229
242
257
169
157
199
182
114
207
95
233
262
169
222
229
235
61
230
172
89
135
162
297
253
233
135
228
243
156
258
245
258
201
134
120
117
209
195
231
160
276
174
202
194
217
315
148
224
198
269
159
232
248
195
208
185
252
179
203...

result:

ok 201 lines

Test #51:

score: 0
Accepted
time: 0ms
memory: 3656kb

input:

201
499
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000001000000000000000000000000000000000000000000000000000000001000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

67
84
28
68
18
74
2
72
50
0
61
8
8
26
100
43
40
60
72
8
54
18
72
97
48
32
56
50
53
75
18
74
55
18
8
121
18
33
73
0
10
8
61
49
40
32
42
50
105
2
51
32
37
88
18
18
67
139
8
44
21
32
8
75
11
56
26
8
32
52
18
50
70
18
50
58
51
41
32
90
18
56
8
61
103
50
32
2
18
56
32
58
158
32
81
98
112
72
2
63
85
66
11...

result:

ok 201 lines

Test #52:

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

input:

202
496
0000000000001100000001000000000000010100000000000000110000000000000000000010000000010001010000000000000000010000000000000100011000000000100000000010000100000000001000000000011000000100000100000010000001000100001000000000000000000101011000000001010000001100100001000000000000000001000001100000...

output:

448
445
459
453
454
451
454
446
459
458
448
454
454
455
455
461
449
449
438
461
459
455
457
454
454
456
460
454
457
459
446
446
454
446
452
454
456
453
458
449
449
454
453
453
457
454
458
446
461
452
451
455
446
451
453
444
446
442
454
456
452
458
457
445
448
456
463
458
462
456
450
458
460
451
455
...

result:

ok 202 lines

Test #53:

score: 0
Accepted
time: 1ms
memory: 3880kb

input:

206
493
0000000000000000000000000000000100000000000000100000000000000000000001000000000000000000000000000010000000000000001000000000000000000100000000000010000000001000000000000000000010000000000000100000000000000000000000000000010010000000000000000000000000010000000000000000100000001000000000000000...

output:

348
345
333
334
361
343
364
334
352
357
356
348
341
354
361
353
353
367
357
354
331
359
341
363
368
370
363
354
353
357
356
359
348
358
356
334
343
355
364
357
333
345
368
338
346
353
342
336
372
325
341
360
364
357
345
355
340
339
343
346
337
371
336
336
337
337
353
370
363
368
367
335
361
352
338
...

result:

ok 206 lines

Test #54:

score: 0
Accepted
time: 0ms
memory: 3644kb

input:

10
500
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

0
500
1
499
401
346
339
288
303
296

result:

ok 10 lines

Subtask #7:

score: 1
Accepted

Test #55:

score: 1
Accepted
time: 2ms
memory: 3816kb

input:

13
28591
111011011111010101011001111100110001010110011100101010011001010001010110001001100111100110001100011000000011011110011010100000100110010111110111001101010110100000010011000100101001011010000110010110001100110111101000101101011001100101101000110000110011110000001101101111110110110010001000010...

output:

28562
3405
12475
19029
16539
22928
10610
26329
9288
16613
8205
6234
19504

result:

ok 13 lines

Test #56:

score: 0
Accepted
time: 3ms
memory: 3984kb

input:

7
30000
1111110110001100111010111111011111111111001101100111111010111101011011101101110111110111111110110111111101001110101010110111011010111111101111101110110111011101101110111011111101111101110011011110011100101110001111111111111100011111111111111101111111010111111010101111101111011101110011111111...

output:

29994
29991
29993
29992
29993
29991
19997

result:

ok 7 lines

Test #57:

score: 0
Accepted
time: 3ms
memory: 3764kb

input:

7
29999
1000000000000000001001010000000000000110000010101100000001100000000000001000000010010000000100100010101010001100000010000010001010100100000001000001000110000000000000100000011000000001000000000000000000000000000000100000000100010010000101000001001001001010010000000000000000100100000000000000...

output:

29825
29864
29837
29871
29847
29844
19860

result:

ok 7 lines

Test #58:

score: 0
Accepted
time: 3ms
memory: 3796kb

input:

7
29998
0000000000000100100000000000000010000000000000000000010010000000000000011000000000000100001000000000010000000000000010000010000000000000100000000000000000000000100000000001000010010000000000000000010100000000000000000000000000100100001000000000001000000000000000100000000000000010000000000000...

output:

29497
29570
29494
29594
29552
29549
19595

result:

ok 7 lines

Test #59:

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

input:

7
29998
0000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000001000000000000000000000000000000000000000000000000000001000000000000000000000000010000000000000000000000000001000000000000000000000000000000000000011000000000000000...

output:

27739
28034
28012
27487
28061
28056
17855

result:

ok 7 lines

Test #60:

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

input:

7
30000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000...

output:

21347
21954
20945
21948
21517
21149
13132

result:

ok 7 lines

Test #61:

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

input:

7
30000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000...

output:

10057
10474
8941
7976
8636
10423
4215

result:

ok 7 lines

Test #62:

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

input:

7
29998
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

117
98
2
128
98
72
2

result:

ok 7 lines

Test #63:

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

input:

7
29996
0000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000010001000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000...

output:

27386
27444
27455
27520
27387
27305
18359

result:

ok 7 lines

Test #64:

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

input:

8
29980
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000...

output:

23122
23045
22994
23075
22984
23010
15958
10

result:

ok 8 lines

Test #65:

score: 0
Accepted
time: 4ms
memory: 3628kb

input:

1340
124
1001000001000000110001110111011010010101000110001011001101000110000110100010000010010001000000101011000000100001000010010001
122
00000110000000000000100000000001010000100100000010000110001000001000010000010010001001000000000010011100001010100101101000
151
00100101100101000110001011001100100...

output:

118
104
138
104
162
172
176
94
149
151
146
177
131
171
167
152
135
136
111
101
111
139
179
122
168
135
120
170
98
107
174
188
94
122
148
99
139
148
162
89
134
130
145
153
107
165
122
85
155
111
143
128
127
90
91
160
124
138
178
123
142
176
95
130
179
116
148
142
77
122
146
98
123
134
168
160
170
152...

result:

ok 1340 lines

Test #66:

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

input:

262
706
0000100000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000100000000000000000000000000010000000000000000000000000000000000000000000000000100000000000000100000000000000000000010000000000000000000000000000000000000000001000001000000000000000001000000...

output:

344
141
287
199
298
270
381
179
151
158
479
209
286
256
300
266
294
431
363
219
328
246
172
414
302
262
402
161
206
207
276
270
233
137
225
122
197
255
108
267
183
387
355
379
318
243
201
132
166
155
351
353
423
241
392
173
388
286
186
277
283
265
204
452
381
414
346
325
102
207
199
245
286
283
367
...

result:

ok 262 lines

Test #67:

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

input:

10
20000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

0
20000
1
19999
16020
13420
13373
11474
11572
11523

result:

ok 10 lines

Subtask #8:

score: 1
Accepted

Test #68:

score: 1
Accepted
time: 0ms
memory: 3776kb

input:

7
30000
0000000001110010001001100101001101000001001011100001001000000010010010010001011000100100100100100100110001011000111110100010101011100101000001000011011000001100011001000000011101101000100000011100000110000100011010011001000100001100101110000001100010100000001000000111100110000100101110000001...

output:

29946
29943
29944
29944
29936
29937
19960

result:

ok 7 lines

Test #69:

score: 0
Accepted
time: 5ms
memory: 3820kb

input:

10092
1
1
2
10
3
101
3
100
3
010
4
1001
4
1010
4
0001
4
0010
5
10101
5
10001
5
10010
5
10100
5
01010
5
00001
5
00010
5
00100
6
101001
6
100001
6
101010
6
100010
6
100100
6
010010
6
000101
6
010100
6
000001
6
010000
6
001000
7
1010101
7
1001001
7
1000101
7
1000001
7
0100101
7
1000010
7
1010100
7
0101...

output:

1
1
2
1
2
3
3
1
2
4
3
4
3
4
1
2
2
5
3
5
4
4
5
3
4
1
2
2
6
6
5
3
6
4
5
6
4
5
4
5
3
4
4
1
2
2
2
7
6
5
3
7
7
6
4
6
7
5
5
5
6
4
5
4
5
5
3
4
4
1
2
2
2
8
8
7
7
6
5
3
8
7
6
4
7
8
7
8
6
7
5
5
6
7
5
6
5
6
6
4
5
6
4
5
5
3
4
4
4
1
2
2
2
2
9
9
8
7
7
6
5
3
9
9
8
8
7
6
4
8
9
7
8
7
7
5
5
7
8
7
8
6
7
5
6
6
7
7
5
6
...

result:

ok 10092 lines

Test #70:

score: 0
Accepted
time: 3ms
memory: 3792kb

input:

7
29998
0000000011100000000000000010010100000100000000010001100000000000000000000000000000000000010000000000000001000000000100000000000000010000000010001000000000000000000000000000000000010100000110010000000000000000000000000000000000010000001000001000010001010010010000000001000000000001010100000000...

output:

29732
29696
29756
29740
29702
29744
19814

result:

ok 7 lines

Test #71:

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

input:

7
30000
0000000000000000100000000000000000000000000000000000000001000000000000000000000000000000010000100000000000000000000000001000000000000000000000000000000000000000000000000000000000000000010000000001001000001000000000000000000100000000000000000000000000000000000000000000000000000010000000010000...

output:

28794
28667
28754
28713
28622
28632
18941

result:

ok 7 lines

Test #72:

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

input:

7
29998
0000000000000000000000000000000000000000000000000000000000000000000010000000001000000000000000000000000000000000000000000000000000000000000001000000000000000000100000000000000000000000000000000000001000000000000000000000000010000000000000001000000000000000000000000000000000000000000000000000...

output:

26173
25704
25487
26236
25806
25901
16714

result:

ok 7 lines

Test #73:

score: 0
Accepted
time: 4ms
memory: 3704kb

input:

7
29998
0000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

14011
12774
14252
12456
12272
13969
7204

result:

ok 7 lines

Test #74:

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

input:

7
29998
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

1182
1757
1637
2178
1679
1722
968

result:

ok 7 lines

Test #75:

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

input:

7
29996
0100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

150
53
134
79
126
283
35

result:

ok 7 lines

Test #76:

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

input:

7
29997
0000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000...

output:

24046
24236
23871
23946
23932
23938
16206

result:

ok 7 lines

Test #77:

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

input:

9
29704
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000...

output:

19533
20034
20283
19610
19547
19260
12898
80
2

result:

ok 9 lines

Test #78:

score: 0
Accepted
time: 5ms
memory: 3596kb

input:

904
167
10000000001000000010001101010111000000001000100000100000000000010100001100100110000010000100000000011110001011100011000001100001000010111010100011001001000000000000100
293
001110001010000101100000000010010000000100000000000000001110001000001000010000100000001001100000010000101001000000000010...

output:

148
269
257
208
250
207
156
209
148
138
155
127
171
185
119
150
187
246
240
274
151
156
205
187
165
249
243
205
172
167
230
210
184
139
265
239
236
196
154
163
178
177
176
173
224
191
198
218
217
169
146
195
127
136
192
180
128
258
166
152
165
260
145
151
134
235
187
249
142
272
254
203
195
277
137
...

result:

ok 904 lines

Test #79:

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

input:

58
4574
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000100000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000...

output:

1929
564
1083
597
1634
1886
1204
1612
1595
454
1587
987
1959
863
1937
1317
1997
1936
2568
1516
1057
1241
1300
1774
2193
1205
1791
1452
1706
1017
1318
2031
749
955
2670
1451
918
1876
1522
1043
576
1123
708
1586
876
1751
2026
1171
753
827
1984
947
1941
2268
1098
938
1479
131

result:

ok 58 lines

Subtask #9:

score: 1
Accepted

Test #80:

score: 1
Accepted
time: 13ms
memory: 4348kb

input:

23
66986
110000001011100111000101100110011000111010011000100100011100010110000011010111011011001000100110110101100010000110101000111010000110000100110101011010100111000011111001000101010101101010111011111110101001001011011010001001101011110111100100110110010100000100010011111011110011010110010011100...

output:

66963
1065
1931
31387
73868
60564
2576
7650
82367
46212
42769
25516
58535
21318
82200
47104
95979
85137
83905
41655
18423
6640
15697

result:

ok 23 lines

Test #81:

score: 0
Accepted
time: 14ms
memory: 4200kb

input:

11
100000
11001111110111101111100101100011111111111101111111011110111111111110011101111010111111011111111111111011101111111011001111111111110111011111100110111011111111011110101110110101111111010111011110010111101110111111111111110111101110111000111111011011011111011101111011011111100101111110101111...

output:

99992
99992
99991
99990
99991
99989
99989
99984
99992
99990
6

result:

ok 11 lines

Test #82:

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

input:

11
99999
000100011000001101010010000000011000010001000000101000000000000010000000000000000000000000000001000000000000000011100000000000000000001000000110010100000000010000000000000100000000000000000001000000001000001000010000000001100000000010000000000100000000000000000000100000100000000000010000010...

output:

99644
99724
99645
99615
99661
99673
99677
99660
99564
99651
4

result:

ok 11 lines

Test #83:

score: 0
Accepted
time: 10ms
memory: 4328kb

input:

11
100000
00001000000000000000000000000010001000000000000000000000000000010000100000100000000000000000000000000000000000000000000000000000001000000000000000000000000010000010000000000000000000000000000000000000000000010000000000000000000000000000000000000000000010000100000000000000000001000000000000...

output:

98178
98261
98171
98131
98276
98382
98226
98170
98219
98437
0

result:

ok 11 lines

Test #84:

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

input:

11
99998
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000100000000000000001000100000000000000000000000000000000000000000000000000000000000000000000000...

output:

82735
85503
85201
85069
84630
84375
84158
83398
84126
85337
0

result:

ok 11 lines

Test #85:

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

input:

11
99999
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

17504
14997
12492
16336
14987
14647
18498
19895
17586
13008
0

result:

ok 11 lines

Test #86:

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

input:

11
99998
000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

165
172
202
74
141
222
182
107
128
150
10

result:

ok 11 lines

Test #87:

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

input:

11
100000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000...

output:

79190
80388
80567
79897
80028
79842
80544
79364
80273
79008
7

result:

ok 11 lines

Test #88:

score: 0
Accepted
time: 5ms
memory: 4088kb

input:

12
99665
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000...

output:

65858
66184
66199
67034
66555
66570
67329
66078
66258
65815
1709
21

result:

ok 12 lines

Test #89:

score: 0
Accepted
time: 17ms
memory: 3660kb

input:

4435
180
000100110101000000010000000000000010000000000000100000000010100001100001000000000000101111010100100010000001001000011001101010000000000010000000100000010010000000000000001011100101
214
0111100110000110000001001101101101000000011000000000000000000000001000000110001000000000100000101010010000...

output:

153
176
221
154
270
237
140
156
211
193
155
234
207
243
145
174
137
252
131
116
134
240
157
171
197
246
152
236
140
273
205
129
215
143
268
140
261
237
250
250
244
256
239
265
175
168
199
172
177
251
165
244
133
166
146
187
232
144
154
160
173
266
231
223
249
148
123
233
267
151
189
245
269
175
205
...

result:

ok 4435 lines

Test #90:

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

input:

287
4286
000000000000000000000000000100000000000000000100000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000001000...

output:

2111
1431
770
1800
2411
2588
1007
1128
1830
2382
2174
1333
1524
1056
2001
486
2079
931
1219
1229
688
1170
1706
2712
1116
1400
1741
1472
1017
699
857
702
2080
1206
2355
1092
2775
2172
2384
1637
2103
793
1667
1352
2486
2455
250
708
1176
1346
1257
751
2576
823
1444
661
1931
880
886
851
1190
737
467
190...

result:

ok 287 lines

Test #91:

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

input:

10
100000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

0
100000
1
99999
80064
66820
66715
57154
57375
57264

result:

ok 10 lines

Test #92:

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

input:

100000
1
1
1
1
1
1
1
1
1
0
1
0
1
1
1
0
1
1
1
1
1
0
1
0
1
1
1
1
1
0
1
0
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
0
1
1
1
0
1
1
1
1
1
1
1
0
1
1
1
0
1
0
1
0
1
0
1
1
1
0
1
1
1
1
1
0
1
0
1
1
1
0
1
0
1
1
1
0
1
1
1
0
1
0
1
1
1
0
1
1
1
1
1
0
1
0
1
1
1
1
1
1
1
0
1
0
1
1
1
1
1
0
1
1
1
0
1
0
1
1
1
1
1
1
1
1
1
0
1...

output:

1
1
1
1
0
0
1
0
1
1
0
0
1
1
0
0
1
1
1
1
0
1
1
1
1
0
1
0
1
1
1
0
1
0
0
0
0
1
0
1
1
0
0
1
0
0
1
0
1
0
0
1
0
1
1
0
0
1
1
1
0
0
1
1
0
1
0
0
1
1
1
1
0
1
1
1
0
1
0
1
0
0
0
1
1
1
0
1
1
1
0
0
1
1
1
1
0
1
1
1
1
1
0
0
0
1
1
1
0
0
0
1
0
0
1
0
1
0
0
0
1
1
0
1
1
1
1
0
1
1
1
1
1
0
1
0
0
1
1
1
1
0
0
0
0
0
0
0
1
1
...

result:

ok 100000 lines

Subtask #10:

score: 1
Accepted

Test #93:

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

input:

11
100000
00010101001000000000000000000101000000011010000000000100011101010011110000111100111100001001100000101110000100110001100001000100011111000110110000110000100111010010101100000100001101000101000010101000001000100000000100011111000001000100001000100100000111001000101011000101000010001001011000...

output:

99933
99938
99934
99922
99909
99936
99929
99935
99922
99920
6

result:

ok 11 lines

Test #94:

score: 0
Accepted
time: 21ms
memory: 3652kb

input:

40212
1
1
2
10
3
101
3
001
3
010
4
1001
4
1010
4
1000
4
0100
5
10101
5
10001
5
10010
5
00101
5
01010
5
00001
5
01000
5
00100
6
101001
6
100001
6
010101
6
100010
6
001001
6
010010
6
101000
6
001010
6
000001
6
010000
6
000100
7
1010101
7
1001001
7
1000101
7
1000001
7
1010010
7
1000010
7
0010101
7
0101...

output:

1
1
2
1
2
3
3
1
2
4
3
4
3
4
1
2
2
5
3
5
4
4
5
3
4
1
2
2
6
6
5
3
6
4
5
6
4
5
4
5
3
4
4
1
2
2
2
7
6
5
3
7
7
6
4
6
7
5
5
5
6
4
5
4
5
5
3
4
4
1
2
2
2
8
8
7
7
6
5
3
8
7
6
4
7
8
7
8
6
7
5
5
6
7
5
6
5
6
6
4
5
6
4
5
5
3
4
4
4
1
2
2
2
2
9
9
8
7
7
6
5
3
9
9
8
8
7
6
4
8
9
7
8
7
7
5
5
7
8
7
8
6
7
5
6
6
7
7
5
6
...

result:

ok 40212 lines

Test #95:

score: 0
Accepted
time: 12ms
memory: 4108kb

input:

11
99999
100000000010000000000100000000010000000100000000000000000010000010000000000100000000010000000000100000000011001000000000101000010010001000000000000000000010010000100000001000000000000000001010000000110000000000000010000000000000000100000100000010100010000110010101000010000000000000100000010...

output:

99353
99366
99432
99347
99337
99370
99285
99338
99435
99445
0

result:

ok 11 lines

Test #96:

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

input:

11
99998
000000000000000000000100000000000000000000000000000000000000000000000000000000000001000000000000000000000100000000000000000000001000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000...

output:

93668
93276
93645
92704
93560
93272
93636
93001
93491
93673
0

result:

ok 11 lines

Test #97:

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

input:

11
99999
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

56687
56333
53956
54184
57132
52984
54225
50180
51386
52175
1

result:

ok 11 lines

Test #98:

score: 0
Accepted
time: 4ms
memory: 4044kb

input:

11
99999
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

722
968
1026
892
968
722
1250
1800
392
392
0

result:

ok 11 lines

Test #99:

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

input:

11
99995
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000001000000000000000000...

output:

90951
91051
91210
91606
91369
91276
91507
91030
91579
91796
26

result:

ok 11 lines

Test #100:

score: 0
Accepted
time: 4ms
memory: 3984kb

input:

11
99931
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

77739
77383
77528
77373
77734
77260
77351
77640
77456
77372
1103

result:

ok 11 lines

Test #101:

score: 0
Accepted
time: 18ms
memory: 3592kb

input:

6650
100
0100101000100100111000000110011010010101000010001000101010011100101001000110000010001100000101010000
161
01001000010001011001000000010101100111000100010000000000000011000000011100101011000000111000010100000000101000010010001000101000010101001000010000000101000000000
122
00000011001011111100...

output:

93
140
109
147
125
122
107
131
123
186
159
175
112
122
156
115
126
95
110
159
159
120
101
144
126
180
143
172
112
162
91
146
167
166
173
131
123
117
130
166
156
73
118
123
170
165
127
111
135
179
175
96
159
125
153
104
127
120
113
101
118
138
93
117
95
135
161
95
113
106
112
161
138
139
172
124
111
...

result:

ok 6650 lines

Test #102:

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

input:

1341
987
000000000000000000000000000000000000000000000000010000000001000000000000001000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000010000000000000100000000000001000000000100000000000000000...

output:

463
273
214
159
354
103
86
125
180
301
253
113
126
191
208
202
155
132
339
200
181
145
98
190
231
153
300
382
226
211
356
432
279
311
261
164
312
341
175
176
200
175
106
323
322
264
271
178
131
108
272
210
100
315
258
186
81
169
120
329
188
296
183
203
75
130
279
267
192
110
299
143
156
318
344
492
...

result:

ok 1341 lines

Test #103:

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

input:

10
100000
10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

3
4
5
5
6
7
5
6
7
8

result:

ok 10 lines

Test #104:

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

input:

11
99999
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

8
0
8
50
8
2
2
2
0
2
0

result:

ok 11 lines