QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#72508#5166. 回文匹配repoman100 ✓772ms408528kbC++144.7kb2023-01-16 13:51:422023-01-16 13:51:47

詳細信息

Subtask #1:

score: 5
Accepted

Test #1:

score: 5
Accepted
time: 54ms
memory: 122132kb

input:

0 2 500000
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

1
1
1
487
1
0
1
487
0
1
0
0
1
1
1
0
487
0
0
1
487
1
1
1
1
487
1
0
0
0
487
487
1
1
487
487
1
0
1
0
1
0
0
487
1
0
1
0
1
1
487
1
1
1
1
1
1
0
1
0
0
0
0
0
0
487
0
1
1
0
1
0
0
1
0
487
487
487
1
1
487
487
1
1
1
1
1
487
0
487
0
0
0
487
0
1
487
487
1
1
1
0
0
1
1
487
1
1
0
1
1
1
1
1
1
487
1
1
0
1
1
0
0
1
0
1
...

result:

ok 500000 tokens

Test #2:

score: 0
Accepted
time: 67ms
memory: 121984kb

input:

0 2 500000
bbbbaaabbabababbbabaaaabaaabbaababbababaababbaabbaabbaaabbabaaabbbabbabaaaaabbbabbbaabbabbbaabaaaaabbbbabaaabbbbbbbabaaaabaaabbbbabbbababaaaababaaababbbbbababbbbbababbbaababbabbabaaaabbbaaabaabbbbaabaabaabbaaabbaabaaabbaaaabbaabbaabbbbaaabbbbabababaaabbbbaaaaababaaaababbbbbababababaaaabba...

output:

1
999
1
999
1
999
1
0
1
1
0
1
0
999
0
1
1
0
999
0
1
1
1
1
999
999
999
1
1
1
1
1
1
1
1
999
0
999
999
999
1
0
1
999
0
999
1
999
1
0
999
1
0
1
1
999
0
1
0
999
999
1
999
999
1
0
1
999
1
1
1
1
1
1
1
999
0
0
1
999
1
1
1
1
1
1
1
999
0
999
1
0
1
1
1
1
999
1
999
1
1
1
0
1
0
999
0
999
0
0
0
0
1
1
999
999
1
0
...

result:

ok 500000 tokens

Test #3:

score: 0
Accepted
time: 61ms
memory: 124424kb

input:

0 10 500000
baaaaabbaabbabbbbbbaabbbbaaabaaaaabbaaaaabaabaabaaaaaabababbaabababbaabaaaaaaabbbbaabbaaaabbbbaaaaaaaaaaaaabbaabbababaababbababbaaaabaaabaabbaaaabbaaabababbabbbaabbabbaaaabbaaaababbabaabbaabbbabbbbababaabbbaaabaaaabbbaabbabbaaababbbaababaabbbbbbaabaabbbabbabbbabaaabaaabbabbaabbabaaabaaaa...

output:

1
0
0
0
0
225
0
0
0
0
0
0
0
0
0
0
1
35
0
0
1
1
30
0
0
0
0
0
18
0
0
0
0
0
0
0
0
0
16
0
0
3
0
0
1
0
0
0
1
0
1
0
0
0
0
54
50
0
1
0
0
0
1
5
0
0
0
63
0
50
175
109
0
0
0
0
0
0
0
0
0
0
1
175
3
109
0
0
0
35
0
0
0
0
0
0
0
0
0
0
50
0
4
0
0
0
0
0
3
0
18
0
0
0
35
301
0
0
0
0
0
0
35
0
0
175
0
0
1
1
0
0
0
0
1
0
0...

result:

ok 500000 tokens

Test #4:

score: 0
Accepted
time: 73ms
memory: 123104kb

input:

0 30 500000
ababbababaabaababaaabbaaabbabaabababaaaababbaaababba
abaababaaababaabaabbb
baba
aaabbaaabbaaabbaa
ab
bbbbbaabbababbaabaaba
bbbbbbabbbbaaaaabaabbaabbabbbaaaaaaaaaabaabb
bbb
bba
baaaaaaabbbababbbaaaabbbba
aaabaaaaaaabbbabaaabaaaabbbbabbaabbbaabbbaabaaaaabbabbbabbbabbaaabbbbbbbbabaabbbaabbb...

output:

26
0
0
0
0
0
33
0
0
16
0
1
0
14
0
0
1
0
0
6
4
26
1
0
6
0
14
0
0
50
0
1
0
1
11
0
0
0
0
0
3
0
0
1
0
0
0
0
0
0
0
10
0
3
0
0
2
1
0
0
16
0
0
3
0
0
0
0
0
0
0
0
0
0
0
0
3
0
6
0
0
0
165
2
0
0
0
0
0
0
0
0
0
13
0
0
0
36
0
2
10
0
0
1
0
0
0
0
0
36
0
0
14
0
0
0
0
0
2
2
0
0
0
6
1
2
0
1
0
0
13
0
0
1
18
0
0
0
0
0
0...

result:

ok 500000 tokens

Test #5:

score: 0
Accepted
time: 65ms
memory: 123420kb

input:

0 100 500000
a
aba
aaa
aababbbaaaabbabba
abaaabb
babbabbabbaa
bbbb
baaabb
aaaababbbabbaababaa
babaabbab
ababbabab
aaaba
baaabbaabaabb
abbababbaababbabaabbbaaaaabababaabab
ba
bb
aaabbbbbbb
a
bbabaaabababbaa
aab
bba
aaa
abb
b
bbbbab
abab
bbaab
bbbabbbabbbabaabbabb
ababa
bb
babaaaaaaaaaaaabaabaaaaaa
ba...

output:

1
0
0
0
0
0
0
37
13
0
0
0
0
2
0
1
0
0
5
0
0
0
0
0
2
10
0
0
7
0
0
3
0
0
3
0
3
0
0
3
13
0
0
2
0
0
0
0
8
5
0
0
0
0
0
1
0
1
0
1
0
0
0
0
0
27
0
5
3
0
0
1
0
0
0
6
0
0
3
0
0
0
0
0
0
0
2
2
0
0
5
0
9
0
0
0
6
0
0
0
0
0
0
0
0
6
0
0
0
1
5
21
0
8
0
0
0
0
0
0
0
0
0
0
0
2
2
0
0
0
1
0
0
1
2
0
0
3
0
0
0
0
1
0
25
8
1...

result:

ok 500000 tokens

Test #6:

score: 0
Accepted
time: 49ms
memory: 124152kb

input:

0 10 500000
dwufssiqlihcwjeunletiposagglzrtaebzfwarrgxpffcgdfjlkyaiaprxqtlnmdweczqpbcqppbaeghojhodqyicl
dskgaujjtcaaiobkallyeoyddhqgfsrpyghyqnpxihmlyg
qwpqdmsygfqpyotyqayhprdccctiunclkqeguxmlvplrxauwxwdccmfepmrivspacjlkncuylibvguvqvncoykwtjuxorgiiqpmotlhmkmqdaxtiiqamskzledzucczsygneqrmzrikhffuqbclgf...

output:

0
0
0
1
0
0
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
1
1
0
0
0
1
0
0
0
0
0
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 500000 tokens

Test #7:

score: 0
Accepted
time: 52ms
memory: 124956kb

input:

0 30 500000
zfypsxangtebfdztifwcdgdzo
qtxczqnulhrscugzkghnmwzviuwlpwjvqdrqdectpvnpyjzxgzlkainkoekbmn
ilec
joqqzftazpykqlhnvualkp
bfhpanqhkctymdmwutvzrmvanfwippyqaowidnqzzbrvyhdahjayzkvwbohilzbwshkvmjsxrxyrzodwdk
mwcnzm
wyoujkavpsopsxkgdhqxrvdj
nruhek
jaannpkquuayfyhagnjydj
bcfdanjogbtyhexqqahovggcli...

output:

0
0
4
0
16
0
0
0
0
1
0
3
0
1
0
22
0
0
3
0
0
0
0
67
169
22
0
39
0
0
14
0
22
69
0
0
0
0
0
0
0
0
0
0
0
8
51
0
0
0
0
0
0
0
0
0
6
3
0
0
15
0
15
0
0
0
0
0
0
0
18
0
0
0
15
1
0
0
0
1
69
0
0
0
1
0
0
59
0
0
0
0
0
0
0
0
0
18
16
0
0
0
0
0
33
0
11
0
0
2
16
60
0
56
0
0
0
0
0
5
0
1
0
0
0
0
18
0
0
1
0
46
0
2
0
0
0
...

result:

ok 500000 tokens

Test #8:

score: 0
Accepted
time: 57ms
memory: 125980kb

input:

0 100 500000
f
vctmhqmlcvwadkbtiptgiynjdrv
klnurfsks
mdtew
w
dobxagftzyiep
aigx
ku
vgx
hlmmtvh
gf
vm
inbaj
hlugbhc
xkmdikabexzvkhkvjl
tiglgdhvmzeibfnt
deofjsoxepazkrbmthsebbnylmcptldzvqyfqpolfimoiux
brh
rc
mvvwq
jjzhgrmoxxlrkm
uawxorf
bixvlsfqjnufva
oq
fiemitnd
ezybml
nmckgblttqyq
lldyiyulzinj
sdvog...

output:

0
4
17
0
0
0
0
0
41
4
0
11
0
1
0
0
8
0
2
0
21
2
0
4
2
3
0
0
0
0
0
0
0
0
0
15
9
13
22
0
0
0
0
0
1
0
0
6
6
1
0
0
0
0
1
0
1
5
6
0
1
0
0
10
0
0
17
0
13
0
0
3
0
0
0
1
0
9
21
0
0
0
1
6
0
1
0
10
0
0
0
0
0
2
53
0
7
0
0
5
2
13
19
2
0
0
4
7
0
0
32
0
0
0
0
6
0
8
0
5
0
5
0
0
0
0
0
0
0
7
0
0
1
26
32
0
1
8
0
0
6
...

result:

ok 500000 tokens

Test #9:

score: 0
Accepted
time: 54ms
memory: 124688kb

input:

0 1000 500000
o
i
k
p
e
o
h
v
g
p
v
h
f
v
r
j
j
u
b
x
s
s
l
v
e
x
o
i
b
r
b
k
z
a
v
k
j
i
o
g
r
c
n
x
j
t
p
r
c
r
i
u
k
n
s
s
o
f
c
y
x
i
a
o
p
g
q
n
d
j
t
c
h
s
w
e
q
z
w
e
k
p
q
c
z
d
c
j
w
f
p
w
e
i
v
i
r
p
f
s
a
v
u
v
n
l
y
s
n
v
r
c
h
k
n
m
e
m
t
g
t
f
x
g
q
l
v
f
g
l
i
y
w
t
h
x
y
j
q
o
b
b
o
...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

ok 500000 tokens

Subtask #2:

score: 15
Accepted

Test #10:

score: 15
Accepted
time: 108ms
memory: 122700kb

input:

0 500000 500000
v
s
o
w
f
c
z
u
d
b
z
h
b
e
w
p
n
l
e
i
e
h
g
h
o
q
u
x
n
k
t
z
i
f
e
t
q
b
s
h
o
q
k
n
k
t
d
x
t
u
p
w
l
h
g
j
c
q
n
i
s
o
v
s
u
e
n
c
j
f
u
w
q
g
u
p
v
w
z
w
p
r
d
n
m
v
d
z
n
j
l
o
n
v
y
u
j
x
j
v
a
e
x
r
l
s
x
g
u
a
h
u
c
b
z
k
b
t
g
h
o
g
k
t
l
u
i
c
q
p
v
c
s
s
s
l
i
c
h
t
o
s
...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

ok 500000 tokens

Test #11:

score: 0
Accepted
time: 114ms
memory: 123892kb

input:

0 250000 500000
di
ne
pk
cw
la
bt
cx
hs
ku
ga
rq
zq
jo
zr
at
ue
og
sl
su
ju
gy
oo
om
ev
df
bm
jh
um
vw
ts
qs
we
pn
pe
zc
zb
nl
ld
kl
pl
tk
uh
cm
hn
qb
xi
wb
lu
kq
gf
vc
eq
xe
ni
se
ng
kn
rt
zd
bv
vb
vn
ui
dz
kn
do
cg
nn
ct
mz
op
od
lu
cb
ra
ib
dk
lh
xh
wh
ny
ws
jw
lh
vk
bl
ak
an
rz
xv
sm
zt
mp
yr
an...

output:

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

result:

ok 500000 tokens

Test #12:

score: 0
Accepted
time: 353ms
memory: 167848kb

input:

0 50000 500000
qkubvtpdzm
soafdgztoz
dzihbjgzlv
qzmgwddcum
edjlwzdesz
uzdcradqvu
keljvoztlv
rwibigjyiq
txgwbogpxx
hpkzemjevp
zgygtmqivo
vmhpsomqgj
icjqyepuzv
lgxnfnvmnk
wgetijbyql
qsglhyjkee
enfkhyfory
hwzrhlcqfj
bhifrgvfly
bpuphqsvau
yvdgurwpeo
vxyypvbpfh
ghgrliyqyb
vaunorfwvl
xzisdbfkbu
vpxuecgonr...

output:

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

result:

ok 500000 tokens

Test #13:

score: 0
Accepted
time: 494ms
memory: 200536kb

input:

0 5000 500000
wgnhspqfqmsglvytlzswiyhhryunyqtbwgrybapsfazarmqfzeyaqheruzccfiwvosvttasxklvfyiyutasgnqzielbmzfwzneea
ksqsaughjpdpmrxyqrnkenvuhhbnxjlgaxoebfgosierjxuhbxxnnupigxqjcmknzuomavqyafbwippqznniqixbbutybznxxlcg
jqhxhvoknjktzdegmtdvxapbfobchmgvxavvbksiqekqtjkvvgwkfxsuqueklxlyqlanorcambowdgzvdovf...

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 500000 tokens

Test #14:

score: 0
Accepted
time: 453ms
memory: 202392kb

input:

0 200 500000
ztvrelbmgkwawltubkecueenrrxoafbslwjaeqvzzppfzxvgycgliaiwhfeyvodpsapqeyjirgclwrdflcqispbtbivlkaiecakocarlmhpdowzwjhxgpjbcccepmpceyyrwwrnmlyyioslgqbppnutbqcxhiyfntvxwslcpqnvmonyevbadqpkhlddixawynfoztkjmfsafyoolgspflnixalfeulgtuymhzpeutrquxqnkhwhezovdksbthwzirpdnhinlvnjijtytwzggcoptflsjhbl...

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
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
...

result:

ok 500000 tokens

Test #15:

score: 0
Accepted
time: 324ms
memory: 203200kb

input:

0 20 500000
tzfbewglzikwxyjkkathrpoidnvdudkwosfrlcnmhvoyjniwveiypahkpychzwseqsvssdqbzxkixatwwsuigjygtoxehabbsioeberecmqzmagaancqugaaxqblwleoglexgeobzhidsqydsgyhtncuhdyavcknynbeisqebyagzpengdavedutrwejzcrfpacgvohrjshpsiubwqufuaqrwzcyothsesstsjyldiddejmgpcefjbshtbojbbkytitfibgiabeonnysfswnqwkwqmaurtbe...

output:

0
0
0
1
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
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
1
1
0
0
0
0
0
0
1
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
...

result:

ok 500000 tokens

Test #16:

score: 0
Accepted
time: 247ms
memory: 261984kb

input:

0 1 500000
xbfaqwhxainvubbxblsgiyhxchubsocqkdjomtvxiwrxiytdshewrcfjjxelnrdsmrjphysgoiugosyghdtmjzrzrzjkzbuyxjicfeaggqfhwleuekeldzxamxdhpfgxtlwdehoarxjxshtqyhtwehgirhdqvkxoxstpiltckqaliambfrrnighbdireuuddwgidywbazdfrclivpynyjmtwmedhowwigqcslfadgqwzqxlxhumfkbnutalszwrofjlhhfxkcazgxzpooxlgyoalhqpnmklgc...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

ok 500000 tokens

Test #17:

score: 0
Accepted
time: 191ms
memory: 128264kb

input:

0 100000 500000
thjjy
hhhhp
nnnnn
ssssz
ttttx
xxxxx
yyyyy
yyyyy
sssss
qqqqn
ooooo
uuuuu
yyyyo
eeeee
ttttt
wwwww
bbbbb
ttttt
zzzzz
lllll
vvvvv
wwwww
xxxxx
hhhhh
lllll
nnnnn
ccccc
nexxj
yyyyq
iiiii
mmmmm
qqqqq
kkkkk
wwwww
ooooo
yyyyy
uuuuu
kkkkk
iiiih
ggggg
qqqqq
eeeee
ooooo
wmuuz
ooooo
sasss
gkffo
eu...

output:

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

result:

ok 500000 tokens

Test #18:

score: 0
Accepted
time: 110ms
memory: 129804kb

input:

0 50000 500000
uuuuuuueeu
yyyyyyyyqq
oooooooooo
qqqqqqqqqq
nnnnnnnnnn
nnnnnnnnnn
pppppppepp
lldldmjmmm
qqqqqqqqqq
sssssssuus
ppkzkrjrrr
ggvgvsdsss
ffffffffff
mmmmmmmmmm
oooooooooo
aaaaaaaaaa
aaaaaaaahh
fffffffvff
dddddddddd
cccccccccc
xxxxxxxexx
eeeeeeesse
wwwwwwwwww
bbbbbbbbbb
uuuuuuuuuu
eeeeueeeee...

output:

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

result:

ok 500000 tokens

Test #19:

score: 0
Accepted
time: 161ms
memory: 163472kb

input:

0 5000 500000
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaadaaaaadaaaaadaaaaaaaaaaaaaaaaaaddaaaaaaaaadaaaaaaaaaddaaddaaaaaaaaad
rrwwwwwqnhnhhhuhhuppppuhuuwuuuuwuduzzuuuzzmxmtmmoaaojrneenneeeeeyqyeyvkkilhyyybzzzbiiibmbsvfvvfvlvvj
uukkkkkwfcfcccgccgaaaagcggdggggdgrgmmgggmmwlwkwwgzzgtvjbbjjbbbbbtqtbtriiwyadddcooocy...

output:

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

result:

ok 500000 tokens

Test #20:

score: 0
Accepted
time: 278ms
memory: 225996kb

input:

0 500 500000
llllllllllllllllnmnnnnmnnnnmnlllllllnnllnnbnnlllnnbbnnbnnbbnnnbbnnbnnbbbnnbbbnynbnbbnbnbbtbbtbbnbbtbbttbttbbtbbttbttbxxbtttbxkxkkxkxkkxkkxkxkxxkkxaxaaakkakkakkaakkkaakkkaaaakkkkaaaakkkaakkkakkkaakaaaaaakkakkaaakkakkaakkakkaakaakkakakakakkaakakakaiiakkkakalakakkkakalakkalaalhlallaalllaal...

output:

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

result:

ok 500000 tokens

Test #21:

score: 0
Accepted
time: 256ms
memory: 235204kb

input:

0 20 500000
hhzhhhhzhhhhxhhggpgggpgollooooomrmmrbrmjjiijjijijijijjjhhhjjhjwwjhhbbhhhhbpswswswswadadaaddlddaqqaooooarajzjzjajzjzjjzzjzjzjjjzzjaaoahfmqmihhhhimmihhiiooiihhghvhhvvevevevvkkkvvdiddpdejjggsshsbssszszszvpkykkkbbkkhvhhhvhvkkmccccccjjcjyjjyyfynyfxxfxffxffbjnnzlzznnllnlnprddlzfzlzzzzzkkkklalq...

output:

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

result:

ok 500000 tokens

Test #22:

score: 0
Accepted
time: 280ms
memory: 287052kb

input:

0 5 500000
ttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt...

output:

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

result:

ok 500000 tokens

Test #23:

score: 0
Accepted
time: 246ms
memory: 288680kb

input:

0 5 500000
zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzpzzzzz...

output:

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

result:

ok 500000 tokens

Test #24:

score: 0
Accepted
time: 263ms
memory: 294332kb

input:

0 5 500000
wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww...

output:

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

result:

ok 500000 tokens

Test #25:

score: 0
Accepted
time: 275ms
memory: 329484kb

input:

0 2 500000
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

ok 500000 tokens

Test #26:

score: 0
Accepted
time: 259ms
memory: 316384kb

input:

0 2 500000
wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

ok 500000 tokens

Test #27:

score: 0
Accepted
time: 309ms
memory: 346104kb

input:

0 2 500000
sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

ok 500000 tokens

Test #28:

score: 0
Accepted
time: 283ms
memory: 345936kb

input:

0 2 500000
ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

ok 500000 tokens

Test #29:

score: 0
Accepted
time: 269ms
memory: 345984kb

input:

0 2 500000
wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

ok 500000 tokens

Test #30:

score: 0
Accepted
time: 247ms
memory: 345984kb

input:

0 2 500000
uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

ok 500000 tokens

Test #31:

score: 0
Accepted
time: 228ms
memory: 402596kb

input:

0 1 500000
ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

ok 500000 tokens

Subtask #3:

score: 20
Accepted

Test #32:

score: 20
Accepted
time: 208ms
memory: 398720kb

input:

0 1 1
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

1

result:

ok "1"

Test #33:

score: 0
Accepted
time: 117ms
memory: 259624kb

input:

0 2 1
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

1

result:

ok "1"

Test #34:

score: 0
Accepted
time: 208ms
memory: 346112kb

input:

0 2 1
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

300001

result:

ok "300001"

Test #35:

score: 0
Accepted
time: 204ms
memory: 283868kb

input:

0 2 1
bccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaa...

output:

33334

result:

ok "33334"

Test #36:

score: 0
Accepted
time: 258ms
memory: 336200kb

input:

0 2 1
bccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaa...

output:

100001

result:

ok "100001"

Test #37:

score: 0
Accepted
time: 203ms
memory: 280068kb

input:

0 2 1
bcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcde...

output:

20001

result:

ok "20001"

Test #38:

score: 0
Accepted
time: 279ms
memory: 336640kb

input:

0 100 1
a
j
w
z
m
h
d
n
f
c
k
z
f
c
m
d
v
o
e
w
t
r
j
j
e
l
q
q
m
y
a
a
q
g
i
e
y
p
k
x
c
q
t
b
c
r
l
n
e
t
x
d
x
w
a
a
p
g
e
v
x
o
r
v
e
n
t
s
t
x
u
y
l
x
bcddcbaabcddcbaabcddcbaabcddcbaabcddcbaabcddcbaabcddcbaabcddcbaabcddcbaabcddcbaabcddcbaabcddcbaabcddcbaabcddcbaabcddcbaabcddcbaabcddcbaabcddcbaa...

output:

74976

result:

ok "74976"

Test #39:

score: 0
Accepted
time: 204ms
memory: 260144kb

input:

0 2 1
epppipfhwh
wnybdiecccdcqdrdyrrrzrxizicvvvrvoxpxnpppspbnknmuuupuykckegggqgwctclhhhihvonooxxxrxwujuussswsxltlujjjpjxysyudddydrqeqozzzgznsislcccjcqlilyjgfxccctchvlvqfffhfvcpcyrrrqrstntomxvvvmvgprpawwwpwnjmjyjjjdjpbnbevvvovadmdrzzzpzothtekfffaflnwngkkkxkycncczzzgzsgvgldddjdnqmqyzzzbzwmhmmaaahawrvr...

output:

47042

result:

ok "47042"

Test #40:

score: 0
Accepted
time: 181ms
memory: 267724kb

input:

0 2 1
eoaxlzjsyyyysyyyysysyysyssysyysyssyysyyssysyssyyssysyssyysyyssyyssyysyyssyysssyyssyysyysssyysssysyysysssyyssavvhuqyhpetbpcplkobyavffffnffffnfnffnfnnfnffnfnnffnffnnfnfnnffnnfnfnnffnffnnffnnffnffnnffnnnffnnffnffnnnffnnnfnffnfnnnffnnbbbbsbbbbsbsbbsbssbsbbsbssbbsbbssbsbssbbssbsbssbbsbbssbbssbbsbbs...

output:

4748

result:

ok "4748"

Test #41:

score: 0
Accepted
time: 167ms
memory: 266964kb

input:

0 2 1
llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll...

output:

13476

result:

ok "13476"

Test #42:

score: 0
Accepted
time: 219ms
memory: 347524kb

input:

0 2 1
zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz...

output:

47

result:

ok "47"

Test #43:

score: 0
Accepted
time: 221ms
memory: 362048kb

input:

0 2 1
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...

output:

4

result:

ok "4"

Test #44:

score: 0
Accepted
time: 284ms
memory: 268028kb

input:

0 3 1
bbbbabaaabbaaaaabbbbabbabaabbbaaabaababbbabbaababbaaaababbaabbbaabbbababbbbbbababaaababbbbaabaabbaaaabaaabaabaabbbabaabaabbbaaaabaabbabababbaabbaaaaaababbbbabbabbaabaaabaabbbbaababbaabababbaabaaabbaabababbaabaaaababababababbaaaababbbabbababbbabaaaabababbaaabbaaabababbaaaabaaababbbaabaabbababba...

output:

0

result:

ok "0"

Subtask #4:

score: 20
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Test #45:

score: 20
Accepted
time: 205ms
memory: 148180kb

input:

0 50000 500000
bbbaa
a
abbaabbba
bbbbbaababbbbaabbbbbaaabababbbbbbabbbba
b
a
abaabb
bbbaba
ababbab
abbbba
bbabab
b
aabb
bab
ab
abaabaaabaabababbbaaabaabbbaabbbbaaaaa
babba
babaaabbabbb
bbaab
abb
babbbbaaabbbbbbbab
aaabbababbbbbbbabbbba
bbaabbabababaa
bbbbaaaaababbabaa
bbbaaababbbb
ababbababbababaaaa...

output:

6
14
5
0
0
0
0
0
0
16
0
0
0
0
0
0
0
1
5
0
3
2
3
0
0
0
0
0
0
0
0
1
0
0
0
0
1
0
0
0
0
6
0
0
1
0
4
0
0
0
0
2
1
0
1
0
2
0
0
0
0
22
0
0
28
0
0
2
0
0
3
5
0
0
0
0
0
0
0
0
0
0
21
0
0
0
0
1
0
1
18
3
0
1
0
0
2
9
0
0
4
0
0
0
25
1
5
1
0
0
8
0
0
2
6
0
0
0
0
6
0
0
0
0
0
0
0
0
0
0
0
10
0
0
1
0
1
1
2
0
0
2
2
0
0
0
...

result:

ok 500000 tokens

Test #46:

score: 0
Accepted
time: 432ms
memory: 196196kb

input:

0 10000 500000
abaabbbbbbaabbabaaaaababbbbaaaabbbabaaaabaaabaaaabaaaaa
abbbabaaabaa
aabababbbabababbaaaaabababbababbababaabababbabaabbaaabbabbaaabbbaaababab
bbbbbbbbbbaaaabbbaaabbaaababbabbaabbabaaaaaaabaabaabaaaaaaaaaabbaabbbaaaabbabaaaaa
abbaaabbaabbaaababbaaaabaaababababaabbaabaaaababbbbbbabaabbb...

output:

0
0
0
0
5
3
0
0
0
0
0
0
0
0
0
0
16
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
4
0
0
0
0
0
0
0
0
7
0
0
0
0
0
0
0
0
8
0
21
0
3
0
0
0
0
20
0
0
0
0
0
1
0
0
0
0
2
18
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
7
0
0
0
0
0
0
0
0
12
0
0
0
8
0
9
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
36
0
0
0
0
0
0
0
0
0
0
0
0
0
11
0
0
0
0
0
0
0
0
0
0
9...

result:

ok 500000 tokens

Test #47:

score: 0
Accepted
time: 319ms
memory: 154692kb

input:

0 100000 500000
esiot
s
grmaqr
im
ixwnxky
oi
grcbnl
b
ca
xob
dypwxgpefk
ghlxscoq
xv
uumjttkubpe
j
g
mt
vr
dn
guf
y
yslq
epnbrwbddoprbhs
d
myh
gdfevmw
noqptzbjsdpfqi
zjpjftajy
h
ibbx
hlmbldu
e
rbvqxtpzpe
shlmt
l
hgxvfmtc
umbjmzrvzhwnb
vfeer
hgzuid
la
q
u
lkzny
lkaeyrj
cf
fdk
cqfsfsuuo
o
qabrwhl
ca
dg...

output:

0
0
1
4
2
13
0
0
0
2
3
0
1
0
2
0
4
0
8
2
0
2
0
15
0
0
0
0
1
14
0
0
0
15
0
0
3
0
0
3
9
4
2
3
2
1
0
0
9
0
3
0
0
0
0
1
0
4
5
0
0
0
4
0
1
0
8
0
9
3
8
0
7
0
1
6
4
1
0
8
4
0
0
0
0
2
0
0
2
0
2
0
2
0
0
1
1
2
1
1
1
0
0
0
0
0
1
0
0
1
1
0
4
0
4
2
1
2
3
2
1
0
2
0
2
4
14
0
21
0
0
2
3
2
0
1
0
2
7
0
3
3
0
5
1
0
4
...

result:

ok 500000 tokens

Test #48:

score: 0
Accepted
time: 299ms
memory: 313772kb

input:

0 10 500000
pppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp...

output:

0
0
1
1
1
0
0
0
1471
2829
0
31520
4
0
4
83857
1
1
0
83857
0
0
0
3
136935
0
1471
0
168454
0
1
0
0
0
0
4
1793
0
1
0
0
1
0
0
0
31520
0
0
0
0
83857
0
0
0
0
0
1
0
0
1092
0
0
0
0
0
0
0
1
0
0
0
1
0
31520
0
0
0
1
4
1471
0
31520
0
0
1471
1471
0
1793
0
1
0
0
1
0
0
0
0
0
31520
1793
0
0
3
0
0
0
0
4
0
0
1
1
0
28...

result:

ok 500000 tokens

Test #49:

score: 0
Accepted
time: 284ms
memory: 284444kb

input:

0 10 500000
yyhwfjbfbzfdfddffcrciiaaiqgltihhhoyfefccauauufddfqqnnmmjjjmbbbyyypkhkhahaacccgywswhpsppwvvwwwwvvaaaavgoimmhhihshhhmkhsqqqwzdeddoodshhhmixxxxzdjjppfyykifbbbbxfxxpvkvwwhbekkbnncjnnnotrqqwwhhttttthttthmhvrkoozzzzzozkvzzzczzllljuafmmmfekqweddjltljllfffwwwqqkzmmmvuevaiiaomiixqjkzkuudzsseefffh...

output:

0
1
0
0
1
0
0
0
1
0
1
0
0
1
0
1
8
0
0
0
0
0
0
0
1
0
0
1
0
0
0
0
1
4
0
0
0
4
0
8
0
0
0
0
0
1
0
0
0
0
1
0
1
0
0
1
1
0
4
0
0
0
0
1
0
0
0
4
1
0
0
9
9
0
0
0
0
0
0
0
0
0
0
2
0
0
0
0
0
0
0
0
0
1
0
0
0
45384
0
0
0
0
9
0
0
0
0
0
0
0
0
0
0
0
0
0
4
1
2
0
0
2
0
0
1
1
0
1
1
1
0
0
8
0
0
0
0
0
0
0
0
2
0
0
45384
0
...

result:

ok 500000 tokens

Test #50:

score: 0
Accepted
time: 299ms
memory: 238768kb

input:

0 100 500000
ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd...

output:

0
0
1
0
0
0
0
0
0
0
8910
0
0
0
0
8910
0
0
0
0
0
0
0
1
0
1
0
0
2926
0
0
0
0
3068
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
7586
0
0
2359
0
0
0
0
79
0
0
0
0
0
0
0
0
0
0
0
0
0
7182
0
0
7014
0
0
0
0
0
0
80
0
484
0
0
1559
0
0
0
0
0
0
0
0
0
0
3387
0
9164
9839
7785
0
0
0
2926
0
2613
0
0
0
0
338
0
0
107...

result:

ok 500000 tokens

Test #51:

score: 0
Accepted
time: 324ms
memory: 266588kb

input:

0 100 500000
gggggggggggggggggggggggggggggggggggggggggxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxypyyyppyyuyycycyctctccttjtjtjttcccttjtjvjnggnjjjjnjjjjngignjngiignjnggggvbbbvgggigggvvggggggvvfffvvvfffvvvffffvvvvffvvfffvvffgffvuuuvcvvvnvnvnvnnvnvvnnnnvvnnpxpppxxppopplplplululluuxuxuxuullluuxuxaxhqqhxxx...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
3539
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
2507
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
9
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
67
0
0
0
0
0
0
0
0
0
0
0
0
0
8182
0
0
0
0
71
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
0
0
0
0...

result:

ok 500000 tokens

Test #52:

score: 0
Accepted
time: 360ms
memory: 227764kb

input:

0 500 500000
jjjjjjjjjjjjuuuuuuuuuuuudddddrdddddrdddddrdrdddrdrxxxxxsxxxxxsxxxxxsxsxxxsxszzzzzzzzzzzzzzzjjzjzjzjjzjjzxzxzjjzjjzjzjjzjjzxzxzjjzxzxzzxzzxzxxzxzzxznzxzzzzxzxzzzzxznzxxoxoxxznnzxxooxxxxxooxxznnnttnntntnntntnttntntnntntnnnjqqmmddddddddddddddddddddddddddddddgiiiiiiiiiiiiuuuuuuuuuuuuvpotttt...

output:

0
0
0
0
838
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
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
2
0
0
0
0
0
0
0
0
0
0
0
0
0
57
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0...

result:

ok 500000 tokens

Test #53:

score: 0
Accepted
time: 333ms
memory: 228156kb

input:

0 1000 500000
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaavvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv...

output:

0
0
0
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
158
36
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
89
2
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
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
...

result:

ok 500000 tokens

Test #54:

score: 0
Accepted
time: 359ms
memory: 191656kb

input:

0 10000 500000
lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllluuuuuuuvvvvvvvvvvvvvvggggggggggggggmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmsltjqgljlliv
mkkkkkkkkkkkkkkkjhhhhvvvvoo
ffffffffffffffffffffffgfffffffff
dddddddddddmmmmmmmmmmmiiiiiiiiiiilllllllllllzzzzzzzzzzzxsuhvkwg
lllmll...

output:

0
20
0
0
0
0
1
0
0
0
1
0
0
0
0
0
46
0
1
7
2
0
0
0
24
0
0
0
0
0
0
0
0
0
0
0
0
9
0
0
0
0
1
0
0
0
5
0
0
40
1
7
0
7
0
0
0
9
0
0
0
0
0
0
0
0
0
8
15
12
0
0
0
0
0
0
7
2
31
20
0
0
0
0
0
0
0
0
2
0
0
0
0
37
40
0
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
11
0
0
2
0
0
0
0
0
8
5
0
0
0
0
0
0
0
0
0
0
0
5
1
0...

result:

ok 500000 tokens

Test #55:

score: 0
Accepted
time: 267ms
memory: 152620kb

input:

0 100000 500000
jfjqtqeh
o
qqq
nnnnndddd
ffppp
xxx
ddcddbiii
iiibb
eeeo
r
muuuu
nxhx
qc
g
xx
pppppccvvxxx
tt
hh
kkkkbyk
uoj
w
fffffffv
voorrr
lll
ccccccccccc
m
ed
jr
f
ddddxv
xxxppprrrlkmp
gfeeee
kkkkqqkpl
v
aaa
juuuuucccccqqqnnnzzzblxa
ecn
xcrnn
u
ppppppbbc
rr
iiiiibbbbbcu
q
bbban
p
ffn
etggwwwwnyz...

output:

0
2
0
0
0
0
0
3
0
1
0
1
2
11
5
0
9
2
1
3
1
1
0
5
0
6
0
5
0
7
10
1
0
4
5
0
2
1
1
1
0
0
11
0
2
7
0
0
1
4
3
1
8
4
1
0
1
4
2
4
4
0
1
0
0
0
0
1
0
4
3
2
11
10
0
4
9
4
1
5
5
0
0
2
14
1
3
0
6
2
4
0
3
0
2
0
3
1
12
5
0
6
0
0
0
0
0
0
8
0
5
0
3
4
5
3
1
0
0
3
5
0
13
11
2
6
7
3
7
0
4
0
2
0
3
4
18
12
7
20
2
0
1
5
...

result:

ok 500000 tokens

Test #56:

score: 0
Accepted
time: 233ms
memory: 211588kb

input:

0 100000 500000
a
kk
t
wv
f
rfpo
tfs
r
ej
nqhl
y
nn
iivo
ur
dn
jjjtttl
o
x
qn
ts
eypr
y
xw
c
f
e
yxyyyyjdf
x
w
e
a
sj
f
j
n
h
a
oa
r
akz
w
jjq
x
o
p
k
l
wt
j
xtq
vc
c
h
u
p
u
ta
ww
w
j
sg
o
fwe
agwq
hz
t
olrn
g
p
r
d
sy
snv
jj
j
rz
t
v
ncu
uuo
d
a
w
x
tttfh
ww
f
oxh
nkee
o
rjatwwyyhhh
f
r
a
kl
k
llz...

output:

19
19
13
7
13
19
13
0
13
3
13
12
15
15
6
12
19
19
19
0
7
19
13
8
13
0
19
6
280059
13
280059
19
15
13
6
19
14225
13
12
15
10495
10495
15
0
0
3
5
5
13
3
10495
19
0
3
4
149254
19
280059
15
8
14
19941
15
2
15
7
14
14
16
9445
19
14
13
13
0
0
12
12
13
3
280059
14
19
19
3
9445
19
15
13
16
10
19
19
19
13
13...

result:

ok 500000 tokens

Test #57:

score: 0
Accepted
time: 219ms
memory: 193108kb

input:

0 100000 500000
hyqnn
w
gsbgfm
ur
cwwp
utos
t
p
vd
f
f
zcs
e
a
k
wg
uwnmg
z
fud
i
o
slbo
u
jg
pp
yi
mhpt
baqkcp
pv
l
wh
w
jex
oil
d
ujhw
ynq
y
htu
vk
v
ll
iiii
rrrlc
zcz
mc
ci
u
q
t
mc
h
b
dl
v
he
hn
ltc
tu
e
k
r
c
aw
g
g
j
i
k
w
i
r
dm
qj
q
f
o
tt
upt
l
k
hl
ffffl
z
kki
f
p
yb
r
ex
h
v
vl
i
j
ccc
y...

output:

5
12272
14
16
44260
62720
2450
44260
1
14
12
12272
5
80969
18
14
0
17
9
45455
4
7
1
14
35954
15
12
15
3
111986
80969
10
16
18
62720
18
2
15
14
2450
14
84070
9
14
2450
3
6
84070
111986
16
14
41874
12
9
68107
80969
111986
1463
1382
10
12
14
16
5
8
2
0
16
12
17
153861
14
15
2450
1
3
10
18
16
3
1
6
14
6...

result:

ok 500000 tokens

Test #58:

score: 0
Accepted
time: 243ms
memory: 187316kb

input:

0 100000 500000
yfii
gl
l
pmw
al
n
kx
e
h
he
te
wkoobbb
rgww
s
iw
ss
nn
ac
upq
dt
co
z
gp
z
bbbo
s
ezy
tt
ug
j
e
g
ggzw
e
o
k
tw
exs
z
d
vv
ct
ms
co
r
x
pzdc
yonnn
kl
g
bd
h
b
r
j
m
ca
alk
vv
jxv
pl
y
xcl
kp
p
dd
al
g
ky
eec
j
efapkn
gj
r
h
b
he
megwwg
q
sw
mq
f
xxm
vka
u
l
y
v
w
w
y
qpxx
dddd
w
v
o...

output:

62952
62952
0
1559
11965
17055
106665
13
4595
62952
75627
14
14
80980
3
12588
106665
14
25684
1215
101032
17055
4466
3
14
80980
14
5118
10
0
5
14
2165
14
13
6
50986
25684
12
9
8
0
4
106665
14
13
0
80980
19
1308
4595
10
3379
106665
7
208
12
80980
50986
62952
63670
106665
0
12588
5118
182
17055
2583
0...

result:

ok 500000 tokens

Test #59:

score: 0
Accepted
time: 315ms
memory: 225860kb

input:

0 10000 500000
kkgs
suji
hhhmhhdrrqd
eyxxxxxxxjjjjjjjggggggggggggggsssbbbpqvm
hhhhhhhhhhhgji
lllllllll
uuu
bbbbbkap
hh
tttttxxxoooccccccccctttg
fffrre
kkx
ssssssssssssssssssssssssssszyzyzyzyzyzyzyzzyyzzys
mmmmmuuuuuuuuuuueeeeueuuhaaaaaaaaaaaaaaaaaaaaaaaaaaaaavdiaidqqgglg
eeeeeeeeddddddddzcccccccew
q...

output:

82
36
0
0
31
0
1
0
0
0
0
206277
0
0
3729
0
0
0
0
0
0
8
8
0
0
0
0
0
80
0
0
1
1
0
132
0
47
0
0
0
0
0
0
0
2
0
0
0
131
5
0
0
126
2
0
0
0
41
0
16656
0
9
45554
2688
0
64
0
149
0
0
9
4
6
0
0
52
153
0
158856
0
0
0
13
0
0
5
6
0
0
0
0
43
2
0
0
0
0
0
3
0
109
1
3729
0
0
0
0
116
24
0
3
0
0
5
149
0
0
17
0
1
3
519...

result:

ok 500000 tokens

Subtask #5:

score: 40
Accepted

Dependency #4:

100%
Accepted

Test #60:

score: 40
Accepted
time: 662ms
memory: 182688kb

input:

1 500000 500000
0 a
1 u
1 m
2 l
2 b
4 h
1 v
3 r
2 a
8 w
3 t
8 u
9 q
1 r
6 b
11 d
10 t
13 h
9 p
19 p
6 o
18 j
11 y
19 t
16 c
17 y
17 n
26 n
7 g
28 q
2 d
27 m
12 i
18 w
8 b
34 d
31 r
17 r
20 h
35 o
23 i
19 t
36 e
21 b
36 c
42 x
44 c
43 u
15 c
27 y
39 r
32 x
25 u
52 d
5 g
20 z
7 r
14 y
47 n
35 w
28 c
5...

output:

1
0
1
0
0
0
0
0
0
0
3
2
8
0
0
0
0
4
0
7
5
0
0
5
0
9
0
0
0
0
3
0
0
0
0
0
0
0
1
0
5
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
2
0
0
0
0
0
0
0
0
0
0
0
0
2
0
0
0
0
0
0
0
0
0
0
0
0
0
1
2
0
0
0
0
0
3
0
0
12
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
2
0
0
0
0
7
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
9
0
0
0
0
1
1
0
1...

result:

ok 500000 tokens

Test #61:

score: 0
Accepted
time: 720ms
memory: 180212kb

input:

1 500000 500000
0 i
1 i
0 e
3 b
0 f
3 b
2 a
7 f
5 d
0 e
2 c
9 f
1 h
1 e
6 f
8 b
5 a
11 d
17 c
4 b
8 j
3 h
7 f
23 g
7 j
4 d
7 c
16 b
11 j
8 j
0 e
27 e
22 g
15 a
12 c
6 i
32 d
14 h
17 j
20 f
32 c
4 d
18 d
17 g
27 b
10 f
42 a
35 d
34 b
8 i
15 h
25 b
18 c
49 j
28 h
23 a
29 i
2 f
58 b
30 a
60 i
53 h
27 h...

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
1
0
0
0
0
0
8
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
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
1
0
0
0
0
0
0
0
0
0
0
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
...

result:

ok 500000 tokens

Test #62:

score: 0
Accepted
time: 480ms
memory: 162712kb

input:

1 500000 500000
0 c
0 c
0 c
1 c
3 b
2 a
1 c
2 a
1 a
2 a
9 c
10 c
11 b
10 b
3 a
5 c
6 a
13 c
1 b
9 b
19 c
8 c
7 b
2 a
16 b
16 a
4 a
9 a
9 b
20 c
19 a
23 c
20 b
19 c
27 c
17 a
26 a
21 b
4 c
29 b
2 c
15 b
4 b
11 a
13 a
27 c
46 c
28 c
0 a
32 a
24 c
2 a
45 a
43 a
42 c
5 b
46 b
49 c
8 b
26 b
39 a
3 a
25 c...

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 500000 tokens

Test #63:

score: 0
Accepted
time: 228ms
memory: 134576kb

input:

1 500000 500000
0 a
1 a
1 a
1 b
3 a
5 b
6 b
7 a
1 b
4 b
0 a
5 a
3 a
5 a
9 b
11 a
6 b
2 a
11 b
11 a
14 b
1 b
1 b
6 b
23 a
12 a
21 b
20 a
15 a
25 a
10 b
0 b
7 a
28 b
28 a
8 b
12 b
36 b
36 b
24 a
23 a
12 a
19 a
35 b
21 a
35 a
10 a
31 b
11 b
40 a
40 b
13 a
34 a
48 b
23 b
5 b
17 a
52 b
19 a
41 b
20 a
15 ...

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
6
0
0
0
0
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
...

result:

ok 500000 tokens

Test #64:

score: 0
Accepted
time: 129ms
memory: 122312kb

input:

1 500000 500000
0 a
1 a
1 a
2 a
3 a
3 a
0 a
4 a
6 a
8 a
7 a
4 a
8 a
10 a
7 a
1 a
14 a
11 a
15 a
14 a
0 a
20 a
14 a
3 a
1 a
5 a
16 a
20 a
4 a
0 a
6 a
8 a
23 a
13 a
29 a
32 a
35 a
30 a
19 a
11 a
12 a
10 a
18 a
7 a
38 a
43 a
26 a
34 a
33 a
5 a
3 a
24 a
11 a
27 a
11 a
22 a
45 a
38 a
55 a
37 a
59 a
31 a
...

output:

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

result:

ok 500000 tokens

Test #65:

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

input:

1 500000 500000
0 a
1 a
2 a
3 a
4 a
5 a
6 a
7 a
8 a
9 a
10 a
11 a
12 a
13 a
14 a
15 a
16 a
17 a
18 a
19 a
20 a
21 a
22 a
23 a
24 a
25 a
26 a
27 a
28 a
29 a
30 a
31 a
32 a
33 a
34 a
35 a
36 a
37 a
38 a
39 a
40 a
41 a
42 a
43 a
44 a
45 a
46 a
47 a
48 a
49 a
50 a
51 a
52 a
53 a
54 a
55 a
56 a
57 a
58 a...

output:

52259
53392
0
0
58084
58993
0
38845
0
0
54640
0
0
152386
69134
50392
0
0
0
114729
0
0
19817
161773
0
125908
0
47935
0
54872
123185
38633
81688
0
159068
0
54906
0
58834
74130
80575
1258
39757
0
47137
75140
124433
61082
1
99668
44916
45747
118176
76995
0
45226
77131
0
139155
6836
89397
0
13765
0
0
1
4...

result:

ok 500000 tokens

Test #66:

score: 0
Accepted
time: 494ms
memory: 295824kb

input:

1 500000 500000
0 a
1 a
2 a
3 a
4 a
5 a
6 a
7 a
8 a
9 a
10 a
11 a
12 a
13 a
14 a
15 a
16 a
17 a
18 a
19 a
20 a
21 a
22 a
23 a
24 a
25 a
26 a
27 a
28 a
29 a
30 a
31 a
32 a
33 a
34 a
35 a
36 a
37 a
38 a
39 a
40 a
41 a
42 a
43 a
44 a
45 a
46 a
47 a
48 a
49 a
50 a
51 a
52 a
53 a
54 a
55 a
56 a
57 a
58 a...

output:

11108
0
3404
14609
21446
14257
11535
94119
53681
0
118138
50517
1
0
0
130225
0
0
0
0
0
18177
1
133326
70147
60228
0
25631
0
0
1
0
37803
124244
1
32034
35576
0
46679
0
1
40292
84383
0
25765
116167
946
88892
0
49845
3369
71321
57143
0
0
52824
0
0
0
16033
0
29335
20161
0
22377
1
14430
0
0
1
11154
0
0
0...

result:

ok 500000 tokens

Test #67:

score: 0
Accepted
time: 649ms
memory: 284936kb

input:

1 500000 500000
0 s
1 a
1 f
2 g
1 v
5 n
2 e
3 o
3 o
5 m
10 v
4 f
7 z
5 y
1 s
13 l
7 o
12 h
6 h
11 h
10 o
13 q
12 h
3 f
0 s
10 o
22 p
27 d
9 g
1 p
6 b
22 k
8 r
15 n
7 s
27 j
20 x
6 b
19 k
22 k
27 c
12 t
15 m
5 m
19 a
14 l
29 o
19 w
34 z
22 p
26 f
27 r
19 d
33 c
53 b
29 f
32 z
12 z
5 f
14 k
26 n
2 s
2...

output:

0
0
1
1
111450
118061
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
38405
148134
1
0
0
2
104742
99981
0
0
87181
0
0
0
0
0
0
1
0
0
1
57745
0
0
77712
0
0
0
0
0
90284
0
140109
0
0
21261
0
5466
1895
40905
0
0
0
0
140156
0
0
0
0
0
23709
0
0
0
0
0
0
62560
0
0
0
0
0
155552
0
0
0
105812
0
0
0
0
0
0
0
0
0
0
16372
0
0
...

result:

ok 500000 tokens

Test #68:

score: 0
Accepted
time: 674ms
memory: 293424kb

input:

1 500000 500000
0 k
1 p
0 h
2 g
2 v
1 a
1 w
2 q
1 p
4 l
8 z
11 v
12 o
8 b
14 d
8 j
12 h
3 o
0 i
4 r
3 t
19 t
20 a
14 k
6 c
7 n
2 x
22 m
2 l
15 h
12 z
12 w
10 p
12 b
26 h
15 b
0 r
8 c
9 v
10 y
37 k
24 l
14 v
12 k
40 t
10 s
46 d
17 w
5 y
30 e
7 g
26 k
5 q
46 w
36 g
23 a
9 w
25 z
47 h
15 n
5 j
5 u
13 n...

output:

0
0
0
0
131078
0
101874
0
0
0
1
0
0
0
0
78838
0
0
0
0
0
16393
0
0
0
0
0
1
0
0
1
1
0
0
62847
0
0
0
0
0
0
40237
0
0
0
0
0
0
0
0
0
1
0
112602
0
0
0
1
0
1
0
0
0
72930
0
0
0
0
76639
0
0
135996
0
48975
23583
70132
0
0
1
0
0
0
0
0
0
0
0
0
0
0
3
0
0
85965
0
0
0
0
0
0
0
51527
36602
0
0
0
0
0
1
0
0
0
0
0
0
0
...

result:

ok 500000 tokens

Test #69:

score: 0
Accepted
time: 688ms
memory: 297420kb

input:

1 500000 500000
0 y
0 f
0 j
2 k
0 e
2 e
1 h
0 n
1 m
3 v
3 g
2 e
10 l
1 m
12 t
3 m
8 e
13 z
5 t
6 n
8 m
0 a
16 u
9 g
19 q
8 m
8 i
20 v
6 z
29 o
5 f
2 j
16 w
2 o
0 e
6 s
24 i
29 l
31 o
23 l
18 p
40 h
25 v
16 j
15 y
38 d
15 r
31 j
16 g
41 l
40 d
16 w
43 g
27 i
28 v
10 n
19 y
39 w
38 n
24 j
36 a
17 t
47...

output:

0
0
0
45696
1
0
0
0
0
0
0
5
0
0
0
0
0
0
0
0
0
0
13274
0
0
0
0
0
0
0
0
0
0
32052
0
0
0
0
83699
0
55174
0
0
0
0
0
0
0
0
59627
0
0
0
0
6803
79599
0
0
0
0
1
0
35639
0
0
40231
0
0
7126
0
0
0
0
0
0
8171
0
0
36292
479
0
34047
68086
0
59010
0
0
0
0
7036
0
0
0
52114
0
0
0
45061
75830
0
0
0
0
0
0
0
7
0
0
0
56...

result:

ok 500000 tokens

Test #70:

score: 0
Accepted
time: 611ms
memory: 322124kb

input:

1 500000 500000
0 k
1 k
2 k
3 k
4 k
5 k
6 k
7 k
8 k
9 k
10 k
11 k
12 k
13 k
14 k
15 k
16 k
17 k
18 k
19 k
20 k
21 k
22 k
23 k
24 k
25 k
26 k
27 k
28 k
29 k
30 k
31 k
32 k
33 k
34 k
35 k
36 k
37 k
38 k
39 k
40 k
41 k
42 k
43 k
44 k
45 k
46 k
47 k
48 k
49 k
50 k
51 k
52 k
53 k
54 k
55 k
56 k
57 k
58 k...

output:

124375
25348
3720
40597
233147
1
132741
20961
96222
89206
143461
121529
76753
30192
187329
205491
127655
45560
69110
0
47530
56186
55350
0
1
163161
243891
248418
173276
2567
21827
182766
135720
67026
141912
82246
1
159360
1
71364
253654
231136
38881
45510
1
182983
73106
0
188020
1
1
55571
168274
524...

result:

ok 500000 tokens

Test #71:

score: 0
Accepted
time: 657ms
memory: 328424kb

input:

1 500000 500000
0 p
1 r
2 p
3 r
4 p
5 r
6 p
7 r
8 p
9 r
10 p
11 r
12 p
13 r
14 p
15 r
16 p
17 r
18 p
19 r
20 p
21 r
22 p
23 r
24 p
25 r
26 p
27 r
28 p
29 r
30 p
31 r
32 p
33 r
34 p
35 r
36 p
37 r
38 p
39 r
40 p
41 r
42 p
43 r
44 p
45 r
46 p
47 r
48 p
49 r
50 p
51 r
52 p
53 r
54 p
55 r
56 p
57 r
58 p...

output:

195100
0
254859
111111
170786
28053
0
88678
48783
43215
106232
235108
61321
132299
1
9820
148904
134800
159791
56251
142885
1
71655
115925
1
197866
216160
85571
103284
247303
28558
87036
0
208379
31076
59961
7095
251513
40055
188739
212478
3737
77504
210199
1
0
197615
63079
0
1
126713
220243
22113
1...

result:

ok 500000 tokens

Test #72:

score: 0
Accepted
time: 730ms
memory: 332432kb

input:

1 500000 500000
0 l
1 h
2 m
3 h
4 l
5 h
6 m
7 h
8 l
9 h
10 m
11 h
12 l
13 h
14 m
15 h
16 l
17 h
18 m
19 h
20 l
21 h
22 m
23 h
24 l
25 h
26 m
27 h
28 l
29 h
30 m
31 h
32 l
33 h
34 m
35 h
36 l
37 h
38 m
39 h
40 l
41 h
42 m
43 h
44 l
45 h
46 m
47 h
48 l
49 h
50 m
51 h
52 l
53 h
54 m
55 h
56 l
57 h
58 m...

output:

31722
30258
9770
84138
0
50712
0
92856
119668
0
13312
72729
70956
104868
71857
91183
0
47506
42199
1
71619
0
9226
1
121936
83988
99382
85542
107679
126471
84186
58085
121542
0
75103
37441
105362
0
0
55031
61993
78290
127771
136138
101950
101504
18678
62507
0
90066
1
61156
51120
110368
77470
37729
26...

result:

ok 500000 tokens

Test #73:

score: 0
Accepted
time: 514ms
memory: 408528kb

input:

1 500000 500000
0 f
1 f
2 f
3 f
4 f
5 f
6 f
7 f
8 f
9 f
10 f
11 f
12 f
13 f
14 f
15 f
16 f
17 f
18 f
19 f
20 f
21 f
22 f
23 f
24 f
25 f
26 f
27 f
28 f
29 f
30 f
31 f
32 f
33 f
34 f
35 f
36 f
37 f
38 f
39 f
40 f
41 f
42 f
43 f
44 f
45 f
46 f
47 f
48 f
49 f
50 f
51 f
52 f
53 f
54 f
55 f
56 f
57 f
58 f...

output:

257724
152126
51825
72241
136487
91466
68700
180850
247249
29142
108978
197289
80927
317557
18470
15496
421784
402443
428843
391255
126002
218912
32959
330606
15194
229113
197824
59953
37164
317128
137023
206586
92065
179448
166827
17149
28056
154300
326624
97422
42837
307965
32814
97665
11599
14378...

result:

ok 500000 tokens

Test #74:

score: 0
Accepted
time: 626ms
memory: 396836kb

input:

1 500000 500000
0 n
1 i
2 r
3 i
4 n
5 i
6 r
7 i
8 n
9 i
10 r
11 i
12 n
13 i
14 r
15 i
16 n
17 i
18 r
19 i
20 n
21 i
22 r
23 i
24 n
25 i
26 r
27 i
28 n
29 i
30 r
31 i
32 n
33 i
34 r
35 i
36 n
37 i
38 r
39 i
40 n
41 i
42 r
43 i
44 n
45 i
46 r
47 i
48 n
49 i
50 r
51 i
52 n
53 i
54 r
55 i
56 n
57 i
58 r...

output:

6855
137803
46117
28625
34092
102207
39264
75141
14211
31334
160005
17039
120409
189125
58677
6258
168837
84960
48536
63949
20636
64444
1090
109564
97197
9577
87847
75246
19981
3966
91963
138142
134939
113380
111899
15157
13687
29666
159846
67837
125140
103147
52846
60286
153536
131110
120360
79807
...

result:

ok 500000 tokens

Test #75:

score: 0
Accepted
time: 682ms
memory: 257692kb

input:

1 500000 500000
0 z
1 w
2 f
2 d
0 e
4 v
0 n
6 u
0 c
7 x
3 l
3 a
0 b
1 g
8 k
12 d
3 v
8 q
13 j
12 d
14 d
16 n
12 e
9 m
1 b
20 c
23 a
23 m
15 d
9 z
20 y
13 y
32 s
17 z
1 l
26 c
15 c
30 o
15 v
32 s
12 z
38 b
17 d
28 a
40 v
2 s
16 y
10 r
23 e
33 l
11 a
4 l
26 r
14 i
54 e
35 e
32 z
19 d
6 v
0 r
16 i
26 z...

output:

0
1
17568
0
2
0
0
0
34
0
0
17213
0
0
0
0
9
0
4
0
0
0
48942
2
0
15
5
0
16
0
0
6026
0
0
1
0
0
0
0
49184
0
31845
0
0
1
0
0
1
0
0
0
0
20912
0
1730
0
12
0
0
0
0
0
0
1
7
0
3
2
1
0
0
0
19132
35124
0
0
0
29
0
0
1
0
0
1
0
5
1
0
0
8
0
26756
1
0
0
7713
10
0
31310
0
2
3
0
0
0
0
0
0
0
0
0
0
5
0
12
0
0
0
0
0
1
0
...

result:

ok 500000 tokens

Test #76:

score: 0
Accepted
time: 717ms
memory: 254932kb

input:

1 500000 500000
0 p
0 r
0 d
3 u
1 m
1 k
2 x
0 g
1 m
0 j
5 h
1 f
0 c
12 q
12 y
7 b
4 g
8 a
15 r
8 i
1 k
7 n
1 x
16 y
3 p
21 b
19 i
8 g
4 z
5 p
3 b
26 s
32 w
28 c
14 r
2 e
19 n
16 z
14 i
29 m
13 w
34 h
18 x
21 j
14 b
44 f
41 b
34 y
25 l
7 o
35 m
1 k
45 x
28 c
39 x
48 u
40 l
37 y
12 s
31 u
17 p
41 e
28...

output:

37539
1
48262
0
1
8
0
5231
2
5
2
0
0
0
0
0
0
0
0
33997
4
0
0
45520
49321
3
0
0
0
1
0
0
0
22891
2
2
7
0
3
0
0
2
1
0
11
4
3
0
1
2
4
41055
0
42552
0
0
0
49113
21765
0
24850
0
0
0
0
0
0
48801
8905
30050
43719
2
4
36411
0
0
1
36490
0
13427
1
1
2
0
0
0
0
0
49053
6
0
36597
0
0
0
13
18363
49907
2
0
31
0
9
0...

result:

ok 500000 tokens

Test #77:

score: 0
Accepted
time: 761ms
memory: 257512kb

input:

1 500000 500000
0 j
0 q
0 s
1 q
3 d
0 d
5 m
2 b
1 b
3 j
8 q
3 k
10 o
11 x
9 d
3 d
14 d
16 k
18 z
4 i
18 v
20 b
22 y
15 g
9 u
18 f
16 u
9 b
22 d
22 j
9 i
7 m
4 w
4 c
30 n
18 h
22 l
2 f
5 y
18 k
6 b
38 g
35 n
18 w
18 d
43 s
31 e
25 f
17 k
35 n
31 v
2 o
41 o
42 s
21 v
4 g
25 b
51 y
52 p
9 t
35 e
2 i
26...

output:

46837
0
21324
0
0
0
0
6
0
1
0
0
1
21717
36716
7377
0
2
35880
1
0
0
0
41031
1
0
12336
1
12579
9271
0
21839
0
13889
0
0
0
3
22386
0
6538
0
0
0
15617
0
10520
0
0
0
0
0
44747
0
0
0
0
20870
6684
1
46651
1
0
0
49492
0
0
0
2
48645
2
0
5785
1946
22510
0
0
3846
0
912
0
0
0
7262
0
1
0
0
1
575
3168
0
15430
0
1...

result:

ok 500000 tokens

Test #78:

score: 0
Accepted
time: 719ms
memory: 252968kb

input:

1 500000 500000
0 d
0 w
1 a
0 f
3 q
3 a
6 y
0 u
8 l
6 j
4 q
1 p
6 j
8 k
7 s
12 s
9 c
16 o
13 f
17 k
15 p
7 o
21 l
1 b
18 l
3 e
12 n
3 d
5 h
19 y
0 a
9 r
22 c
17 g
14 s
31 j
27 l
21 s
18 d
4 n
1 n
23 o
27 f
33 i
16 g
13 x
6 u
0 d
9 n
34 u
12 j
30 g
20 m
10 v
9 d
7 v
41 x
24 v
35 q
13 i
8 j
55 l
19 l
...

output:

0
0
43730
0
0
0
0
1704
1
1
2
43018
0
0
0
0
0
0
48013
1
0
0
0
0
0
0
0
2
1
0
4
2
0
0
0
0
0
0
1
0
8271
0
2
27498
0
0
1
0
0
1
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
11394
0
0
0
0
0
0
4
0
1
0
1
0
8
0
0
0
2
0
0
0
0
0
0
7
0
1
0
0
0
0
1
0
2
0
0
0
2
0
0
0
0
0
0
3
0
0
0
0
2
1
0
1
0
1
0
0
47687
0
2
0
0
0
0
0
0
...

result:

ok 500000 tokens

Test #79:

score: 0
Accepted
time: 772ms
memory: 255140kb

input:

1 500000 500000
0 x
0 r
1 u
1 x
0 z
2 p
3 n
2 k
4 v
5 r
3 v
7 q
7 v
3 q
11 f
7 u
1 v
2 b
3 w
9 w
18 a
20 d
21 q
9 f
20 y
4 l
8 r
11 t
23 l
28 s
6 h
22 l
23 g
20 g
27 k
7 m
24 j
7 y
25 u
33 t
35 s
19 u
28 v
30 v
43 w
32 w
31 y
24 f
1 u
8 p
9 s
39 s
28 d
24 k
49 b
44 k
56 o
54 v
40 n
52 d
22 q
12 u
16...

output:

17077
0
0
0
0
0
0
0
0
0
0
0
1
34613
0
2
0
0
2
40481
1
0
1
2860
1
0
0
0
0
2
2
0
0
41769
44540
0
1
41374
0
0
3
0
0
0
7331
0
0
0
1
2
0
0
0
0
0
0
0
0
0
0
0
1
0
47729
0
3870
0
0
0
0
0
0
0
2931
48076
0
0
0
2
29909
0
0
0
0
0
0
0
0
0
11
0
0
0
0
11475
0
0
0
0
0
33841
0
0
0
1
27
0
0
1
0
0
0
0
0
0
4
0
48503
0
...

result:

ok 500000 tokens

Test #80:

score: 0
Accepted
time: 599ms
memory: 267792kb

input:

1 500000 500000
0 u
1 o
0 e
0 m
0 y
2 a
6 m
3 j
6 d
4 p
1 i
10 r
7 h
1 e
11 e
14 a
16 w
10 k
4 k
0 o
20 n
3 q
22 r
17 h
10 d
22 j
8 i
26 l
11 e
5 w
4 h
4 t
7 l
8 a
10 e
27 x
23 o
3 g
21 o
22 a
30 f
13 v
36 j
32 y
2 l
36 f
40 a
7 y
34 z
16 q
5 s
5 c
46 i
12 z
28 u
17 p
34 q
36 j
26 b
45 j
47 f
14 t
1...

output:

0
0
31257
0
0
0
0
0
0
1
0
0
2
21353
0
16055
31344
0
13565
5
0
44073
31931
0
0
15869
0
480
0
22186
5
0
46725
1
1
0
5
3086
0
0
24657
41972
1
47302
21291
24170
40895
18497
0
46812
15857
10886
0
0
0
2
0
0
0
0
0
0
0
7
5104
8
0
0
21790
13569
0
17960
2
0
24208
32538
22578
0
0
23486
2
24381
0
40998
42932
33...

result:

ok 500000 tokens

Test #81:

score: 0
Accepted
time: 568ms
memory: 266884kb

input:

1 500000 500000
0 z
0 o
0 j
0 g
4 g
3 n
6 v
0 q
3 z
3 x
9 n
5 o
0 w
5 e
3 a
1 e
9 s
1 g
9 d
8 a
4 i
1 z
7 j
23 v
11 n
19 x
6 g
20 n
24 y
8 l
3 d
19 z
12 p
13 n
29 x
33 f
33 z
34 v
22 a
27 k
31 s
4 g
15 b
11 s
44 l
10 l
26 r
25 z
8 f
8 v
42 z
26 t
0 f
32 j
45 p
35 u
51 e
37 a
31 t
58 j
34 u
20 a
27 r...

output:

0
0
0
0
11
0
26
0
0
0
10
1
6
30852
3
42427
0
1
40399
13
0
0
0
0
7525
0
1019
0
8
0
0
1
1
0
0
0
0
0
0
0
0
0
24
0
0
0
0
0
1303
0
6834
285
0
12
0
0
0
8692
73
0
6
0
0
1
0
0
35764
0
2744
0
48106
0
0
0
41
0
20
0
0
42338
0
40693
0
21
0
0
0
0
1
0
0
0
12
0
0
0
1
1
0
174
0
7726
20677
0
0
0
0
0
25052
49341
0
0
...

result:

ok 500000 tokens

Test #82:

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

input:

1 500000 500000
0 t
0 k
0 t
0 s
3 c
0 d
3 b
6 z
7 k
0 i
1 j
4 t
10 o
8 i
14 j
0 r
12 n
3 b
4 m
18 w
4 o
20 x
9 u
12 m
8 g
19 j
4 h
11 x
12 o
3 c
8 z
11 w
28 l
15 r
14 y
26 d
10 w
0 q
11 y
20 u
29 h
7 z
18 d
3 o
27 r
23 v
9 f
16 t
26 e
33 r
24 q
7 b
2 h
22 a
26 l
14 t
2 k
8 q
13 g
21 w
10 w
46 t
45 x...

output:

0
0
49733
2
0
15103
125
0
38532
0
0
0
34685
1
0
0
0
0
2
0
25586
0
6632
0
1
0
38615
0
53
0
1
0
0
0
0
0
0
35334
0
0
4
0
1
5
0
3946
41392
1
39589
1
8
0
0
1
0
0
171
0
1
0
0
3446
0
13372
596
0
25391
0
44924
45386
0
1
0
28698
0
0
47315
8
0
1
23
40135
0
0
0
6
1
35682
0
0
0
0
0
0
27682
40665
49399
0
0
7
2
0...

result:

ok 500000 tokens

Test #83:

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

input:

1 500000 500000
0 e
1 n
0 g
1 d
1 r
3 q
0 r
6 v
0 q
6 w
4 l
4 e
11 n
11 v
5 v
10 m
10 v
11 f
5 d
14 s
7 s
21 s
2 t
5 a
23 e
15 g
23 s
16 b
28 v
8 y
2 d
1 h
7 e
1 w
4 x
23 v
0 c
17 r
1 p
20 d
39 m
20 a
25 r
13 m
10 n
27 l
4 h
39 q
3 w
47 i
33 a
18 u
21 q
30 e
10 j
25 f
27 e
22 a
3 h
20 n
58 x
0 e
45 ...

output:

0
0
0
0
0
0
0
0
0
0
23788
20366
0
1
795
21873
0
15073
0
0
17818
0
0
0
1
19339
0
0
0
0
0
27217
0
24667
0
1
0
0
1
2993
1
0
1
41280
35913
0
18802
0
0
0
9918
1
0
0
10110
40148
0
0
18679
0
0
0
1
0
0
1306
0
1
0
9081
0
0
23323
0
1
0
15896
0
0
0
0
0
0
0
0
0
0
2463
0
0
7
0
23884
0
0
0
24986
0
0
0
0
20839
0
6...

result:

ok 500000 tokens

Extra Test:

score: 0
Extra Test Passed