Problem:


Score : 500 points

Problem Statement

Takahashi has decided to work on K days of his choice from the N days starting with tomorrow.

You are given an integer C and a string S. Takahashi will choose his workdays as follows:

After working for a day, he will refrain from working on the subsequent C days.

If the i-th character of S is x, he will not work on Day i, where Day 1 is tomorrow, Day 2 is the day after tomorrow, and so on.

Find all days on which Takahashi is bound to work.

Constraints

1 \leq N \leq 2 \times 10^5

1 \leq K \leq N

0 \leq C \leq N

The length of S is N.

Each character of S is o or x.

Takahashi can choose his workdays so that the conditions in Problem Statement are satisfied.

Input

Input is given from Standard Input in the following format:

N K C
S

Output

Print all days on which Takahashi is bound to work in ascending order, one per line.

Sample Input 1

11 3 2
ooxxxoxxxoo

Sample Output 1

6

Takahashi is going to work on 3 days out of the 11 days. After working for a day, he will refrain from working on the subsequent 2 days.

There are four possible choices for his workdays: Day 1,6,10, Day 1,6,11, Day 2,6,10, and Day 2,6,11.

Thus, he is bound to work on Day 6.

Sample Input 2

5 2 3
ooxoo

Sample Output 2

1
5

There is only one possible choice for his workdays: Day 1,5.

Sample Input 3

5 1 0
ooooo

Sample Output 3

There may be no days on which he is bound to work.

Sample Input 4

16 4 3
ooxxoxoxxxoxoxxo

Sample Output 4

11
16



Sample input:
11 3 2
ooxxxoxxxoo


Sample output:
6

Submission status: Runtime Error

Solution code:
common = []

def bool_work(s, n, k, c):
    i = 0
    while s[i] == 'o':
        if i+c+1 < n:
            j = 1
            if s[j] == 'x':
                while s[j] == 'x':
                    j += 1
            wo_i = bool_work(s[j:], n - j, k, c)
            if j < i+c+1:
                j = i+c+1
                if s[j] == 'x':
                    while s[j] == 'x':
                        j += 1
            w_i = bool_work(s[j:], n - j, k - 1, c)
            if wo_i == 0 and w_i == 1:
                common.append(i)
                return 1
            if wo_i + w_i >= 2:
                return 2
            else:
                return wo_i + w_i
        elif i+c+1 >= n:
            if k > 1:
                return 0
            elif n == 1:
                return 1
            else:
                for char in s[1:]:
                    if char == 'o':
                        return 2
                return 1


n, k, c = map(int, input().split())
s = input()
while s[-1] == 'x':
    s.pop(-1)
bool_work(s, n, k, c)
for com in common:
    print(com)

Submission status: Runtime Error

Solution code:
import sys
input = sys.stdin.readline


def inpl():
    return list(map(int, input().split()))


def GetBase(s=0):
    ret = []
    last = -C * 2 - 1
    for i, s in enumerate(S[s:]):
        if s == 'x':
            continue
        elif last + C >= i + s:
            continue

        ret.append(i + s)
        last = i + s
    return ret


def GetDepend(base_ans):
    ruiseki = []
    a = 0
    for s in S:
        if s == 'o':
            a += 1
            ruiseki.append(a)
        else:
            ruiseki.append(a)

    ret = {a: False for a in base_ans}
    for a in ret:
        if ruiseki[a] == ruiseki[min(N - 1, a + C)]:
            ret[a] = True
    return ret


def solve():
    base_ans = GetBase()
    if len(base_ans) > K:
        return []

    depend_dict = GetDepend(base_ans)
    for i, b in enumerate(base_ans):
        if depend_dict[b] is True:
            continue
        S[b] = 'x'
        tmp = GetBase(s=i)
        if len(tmp) + i < K:
            depend_dict[b] = True
        else:
            for s in set(base_ans) & set(tmp):
                depend_dict[s] = True

        S[b] = 'o'

    return [a + 1 for a in base_ans if depend_dict[a] is True]


N, K, C = inpl()
S = list(input().strip())

ans = solve()

for a in ans:
    print(a)

Submission status: Runtime Error

Solution code:
import sys
import math
from collections import defaultdict
from bisect import bisect_left, bisect_right

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def LI(): return list(map(int, input().split()))
def LIR(row,col):
    if row <= 0:
        return [[] for _ in range(col)]
    elif col == 1:
        return [I() for _ in range(row)]
    else:
        read_all = [LI() for _ in range(row)]
        return map(list, zip(*read_all))

#################

N,K,C = LI()
S = str(input())

dp = [0]*N
for i in range(N)[::-1]:
    if S[i]=='o':
        if i+C+1 >= N:
            dp[i] = 1
        else:
            dp[i] = max(dp[i+C+1]+1,dp[i+1])
    else:
        dp[i] = dp[i+1]

dpz = [0]*N
for i in range(N):
    if S[i]=='o':
        if i-C-1 < 0:
            dpz[i] = 1
        else:
            dpz[i] = max(dpz[i-C-1]+1,dpz[i-1])
    else:
        dpz[i] = dpz[i-1]

ans = []
if dp[1] < K:
    ans.append(1)

for i in range(1,N-1):
    if dp[i]+dpz[i]-1 >= K and dp[i+1]+dpz[i+1]-1 < K and dp[i-1]+dpz[i-1]-1 < K:
        ans.append(i+1)

if dpz[N-2] < K:
    ans.append(N)

for a in ans:
    print(a)

Submission status: Runtime Error

Solution code:
N, K, C = [int(n) for n in input().split()]
S = input()

result = []

def select(s,k):
    if k == 0:
        return True
    for i in range(N):
        c = s[i]
        if c == 'o':
            ss = s[:i] + ('x' * (C + 1)) + s[i+C+1:]
            return select(ss,k-1)
    return False

for i in range(N):
    c = S[i]
    if c == 'o':
        s = S[:i] + 'x' + S[i+1:]
        if select(s,K):
            continue
        else:
            result.append(i+1)

for r in result:
    print(r)

Submission status: Runtime Error

Solution code:

import sys, io, os
input = sys.stdin.readline
inputt = lambda: range(int(input()))
inputn = lambda n = 1: range(n)
inputi = lambda: map(int, input().split())
inputl = lambda: list(inputi())
from math import *
from heapq import *
from bisect import *
from functools import reduce, lru_cache
from collections import Counter, defaultdict
from builtins import *



N, K, C = inputi()
S = list(*input().split())
#print(S)
S = [False] + [c == "o" for c in S]

@lru_cache(None)
def F(d):
    if d > N:
        return 0
    if not S[d]:
        return F(d + 1)
    return 1 + F(d + C + 1)


if F(0) >= K:
    i = 1
    while i <= N:
        #print(i, N, S)
        if S[i]:
            #print(i, K, F(i + 1))
            if F(i + 1) == K - 1:
                print(i)
            K -= 1
            i += C
        i += 1

Submission status: Runtime Error

Solution code:
n, k, c = map(int, input().split())
s = input()


if s[i] == "o":
    if i+c+1 <= n-1:
        if s[i+c+1] == "x" and s[i+1] == "x":
            print(i+1)

Submission status: Runtime Error

Solution code:
N, K, C = map(int, input().split())
S = input()

d = {"cnt": 0}

hataraku = []

def f(n, l):
    if l == K:
        d["cnt"] += 1
        for h in hataraku:
            if h not in d:
                d[h] = 0
            d[h] += 1
        return
    for i in range(n, N-(K-l-1)*(C+1)):
        if S[i] == "o":
            hataraku.append(i)
            f(i+C+1, l+1)
            hataraku.pop()


f(0, 0)

res = []

if d["cnt"] != 0:
    x = d["cnt"]
    for k, v in d.items():
        if k != "cnt":
            if v == x:
                print(k+1)

Submission status: Runtime Error

Solution code:
def work(days, now, stock):
    global count
    global result
    if days == 0:
        for i in stock:
            result[i] += 1
        count += 1
        return
    if now >= len(S):
        return
    for i in range(now, len(S)):
        if S[i] == "o":
            work(days - 1, i + C + 1, stock + [i])


N, K, C = map(int, input().split())
S = input()
count = 0
result = [0] * N

work(K, 0, [])
now = 0
while now <= len(S):
    try:
        index = result[now:].index(count) + now + 1
    except:
        exit()

    print(index)
    now = index

Submission status: Runtime Error

Solution code:
N, K, C = [int(n) for n in input().split()]
S = input()

result = []

def select(s,k):
    if k == 0:
        return True
    for i in range(len(s)):
        c = s[i]
        if c == 'o':
            ss = s[:i] + ('x' * (C + 1)) + s[i+C+1:]
            return select(ss,k-1)
    return False

for i in range(N):
    c = S[i]
    if c == 'o':
        s = S[:i] + 'x' + S[i+1:]
        if select(s,K):
            continue
        else:
            result.append(i+1)

for r in result:
    print(r)

Submission status: Runtime Error

Solution code:
N, K, C = map(int, raw_input().split())
S = raw_input()

workCnt = [0]*(N+1)
res = []
def work(KK, CC, SS, pos, NN):
    if KK <= 0:
        for p in res:
            workCnt[p] = workCnt[p] + 1
        return 1

    if pos >= NN:
        return 0

    #work ok
    cnt = 0
    if SS[pos] == 'o':
        res.append(pos)
        cnt = cnt + work(KK-1, CC, SS, pos+CC, NN)
        res.pop()

    for ii in range(pos + 1, NN):
        cnt = cnt + work(KK, CC, SS, ii, NN)

    return cnt


total = work(K, C+1, S, 0, N)
for i in range(N):
    if workCnt[i] >= total:
        print(i+1)

Submission status: Runtime Error

Solution code:
import itertools

n, k ,c = map(int, input().split())
s = list(input())

ok = [] #sから働ける日を抽出
for i in range(n):
  if s[i] == "o":
    ok.append(i)

kouho = list(itertools.combinations(ok, k))

sentaku = []
for i in range(len(kouho)):
  for j in range(k-1):
    if j == 0:
      kankaku = kouho[i][j+1] - kouho[i][j]
    else:
      kankaku = min(kankaku, kouho[i][j+1] - kouho[i][j])
  if kankaku >= c+1:
    sentaku.append(kouho[i])

sentaku1 = list(itertools.chain.from_iterable(sentaku))

for x in ok:
  if sentaku1.count(x) == len(sentaku):
    print(x+1)

Submission status: Runtime Error

Solution code:
import copy

n,k,c = map(int, input().split())
s = input()
S = []
lst = [[] for i in range(n)]
# print(lst)
for i in range(len(s)):
    if s[i]=="o":
        S.append(i)
# print("S:",S)
for i in range(len(S)-1):
    koho = S[i+1:]
    for j in koho:
        if j>S[i]+c:
            lst[S[i]].append(j)
    # lst[S[i]].append(S[i+1:])
# print("lst:",lst)



ans = []
for i in S:
    testlst = copy.deepcopy(lst)
    testlst[i] = []
    for j in range(n):
        if testlst[j]!=[]:
            if  testlst[j][0]==i:
                testlst[j].remove(i)
    # print("i,testlst:",i,testlst)

    count = 1
    if i==S[0]:
        num = S[1]
    else:
        num = S[0]
    while testlst[num]!=[]:
        num = testlst[num][0]
        count += 1
    if count < k:
        ans.append(i+1)

for i in ans:
    print(i)

Submission status: Runtime Error

Solution code:
N,K,C=map(int,input().split())
S=input()

on = [i for i in range(N) if S[i]=='o']
off = [i for i in range(N) if S[i]=='x']

can = [i for i in range(0,N,C) if i in on]
cannot = [i for i in range(0,N,C) if i in off]

def can_work():
  can = []
  k=0
  for i in range(N-1):
    if i in on:
      can += [i]
      k+=1
    for j in range(i,N):
        if j in on and j==i+C:
          can += [j]
          k+=1
        if k>=K:
          return can
  return can

print(can_work())

Submission status: Runtime Error

Solution code:

import sys, io, os
input = sys.stdin.readline
inputt = lambda: range(int(input()))
inputn = lambda n = 1: range(n)
inputi = lambda: map(int, input().split())
inputl = lambda: list(inputi())
from math import *
from heapq import *
from bisect import *
from functools import reduce, lru_cache
from collections import Counter, defaultdict
from builtins import *



N, K, C = inputi()
S = list(*input().split())
#print(S)
S = [False] + [c == "o" for c in S]

@lru_cache(None)
def F(d):
    if d > N:
        return 0
    if not S[d]:
        return F(d + 1)
    return 1 + F(d + C + 1)


if F(0) < K:
    exit()

i = 1
while i <= N:
    #print(i, N, S)
    if S[i]:
        #print(i, K, F(i + 1))
        if F(i + 1) == K - 1:
            print(i)
        K -= 1
        i += C
    i += 1

Submission status: Runtime Error

Solution code:
N,K,C = list(map(int, input().split()))
S = input()

mylist = []

# i:今見てるインデックス, cur:今選んでいるリスト, mylist:結果を保存する配列
def solve(i, cur):
    if len(cur) == K:
        mylist.append(cur)
    if i > N:
        return None
    for c in range(i,N):
        if S[c] == 'o':
            res = solve(c+C+1, cur+[c])
solve(0,[])
res = []
tmp = mylist[0]
for v in mylist[1:]:
    for v1 in v:
        if v1 in tmp:
            res.append(v1)
    tmp = res
    res = []

for v in tmp:
    print(v+1)

Submission status: Runtime Error

Solution code:

import sys, io, os
input = sys.stdin.readline
inputt = lambda: range(int(input()))
inputn = lambda n = 1: range(n)
inputi = lambda: map(int, input().split())
inputl = lambda: list(inputi())
from math import *
from heapq import *
from bisect import *
from functools import reduce, lru_cache
from collections import Counter, defaultdict
from builtins import *



N, K, C = inputi()
S = list(*input().split())
#print(S)
S = [False] + [c == "o" for c in S]

@lru_cache(None)
def F(d):
    if d > N:
        return 0
    if not S[d]:
        return F(d + 1)
    return 1 + F(d + C + 1)


i = 1
while i <= N:
    #print(i, N, S)
    if S[i]:
        #print(i, K, F(i + 1))
        if F(i + 1) == K - 1:
            print(i)
        K -= 1
        i += C
    i += 1

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
import sys

N,K,C = map(int,input().split())
S = input()
#%%
assign_t = [False]*N
assign_b = [False]*N

i = 0
num = 0
while i<N and num<K:
    if S[i]=='o':
        assign_t[i]=True
        num += 1
        i += C+1
    else:
        i += 1

i = N-1
num = 0
while i>=0 and num<K:
    if S[i]=='o':
        assign_b[i]=True
        num += 1
        i -= C+1
    else:
        i -=1

tot = 0
for s in S:
    if s=='o':
        tot += 1

if tot//(K-1)>1.4*(C+1):
    print()
    sys.exit()

for i in range(N):
    if assign_t[i] and assign_b[i]:
        print(i+1)

Submission status: Runtime Error

Solution code:
H , A = map(int, input().split())

Clist = [input().split() for i in range(H)]





def hanbun(x):

    if x%2 == 0:

        return x/2 , x/2

    else:

        return x//2 , (x//2) + 1



print((H/2) - 1)

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python3
import sys


def solve(N: int, K: int, C: int, S: str):
    # 最善だったら何ケースか
    work = 0
    rest = 0
    startWork = -1
    girigiriIndices = []
    for i in range(N):
        if i == 15:
            print(f"i=15{rest}")
        if S[i] == "o" and rest <= 0:
            rest = C
            work += 1
            startWork = i
        else:
            rest -= 1
    rest = -1
    startWork = -1
    for i in range(N-1, -1, -1):
        if S[i] == "o" and rest <= 0:
            rest = C
            startWork = i
            girigiriIndices.append(i)
            print(f"i{i},{rest}")
        else:
            rest -= 1

    if work != K:
        print("")
        # print(work)
        exit()
    for i in girigiriIndices:
        print(i+1)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    S = next(tokens)  # type: str
    solve(N, K, C, S)


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
def work(days, now, stock):
    global count
    global result
    if days == 0:
        for i in stock:
            result[i] += 1
        count += 1
        return
    if now >= len(S):
        return
    for i in range(now, len(S)):
        if S[i] == "o":
            work(days - 1, i + C + 1, stock + [i])


N, K, C = map(int, input().split())
S = input()
count = 0
result = [0] * N

work(K, 0, [])
indexes = [i for i, x in enumerate(result) if x == count]
for i in indexes:
    print(i + 1)

Submission status: Runtime Error

Solution code:
n,k,c = map(int,input().split())
s = input()
#print(s)
#比如1，6，10，每个位置加1，最后数字等于总次数，即一定工作
days = [0 for _ in range(n)]

#记忆版
dicts = {}
def helper(s,k):
    if k ==1:
        res = []
        for j in range(len(s)):
            if s[j] == "o":
                res.append([j])
        return res
    arr = []
    for i in range(len(s)):
        if s[i] == "o":
            if i+c+1 >= len(s):
                continue
            temp = helper(s[i+c+1:],k-1)
            res =[([y+i+c+1 for y in x] + [i]) for x in temp]
            arr += res
    return arr

ans = helper(s,k)
#print(ans)
times = len(ans)
for i in range(times):
    for j in range(len(ans[i])):
        num = ans[i][j]
        days[num] +=1

for k in range(len(days)):
    if days[k] == times:
        print(k+1)

Submission status: Runtime Error

Solution code:
N, K, C = map(int, input().split())
S = input()

a = [0]*(N+1)

hataraku = []

def f(n, l):
    if l == K:
        a[N] += 1
        for h in hataraku:
            a[h] += 1
        return
    for i in range(n, N):
        if S[i] == "o":
            hataraku.append(i)
            f(i+C+1, l+1)
            hataraku.pop()

f(0, 0)

res = []

for i in range(N):
    if a[i] == a[N]:
        print(i+1)

Submission status: Runtime Error

Solution code:
def muri(k, c, s):
  for j in range(len(s)):
    if s[j] == "o":
      return muri(k-1, c, s[j+c+1:])
    elif j == len(s) -1 and k > 0:
      return True
  return False

n, k, c = map(int, input().split())
s = input()
s += "x"*c

for i in range(len(s)):
  if s[i] == "o":
    if muri(k, c, s[:i]+"x"+s[i+1:]):
      print(i+1)

Submission status: Runtime Error

Solution code:



import sys, io, os
input = sys.stdin.readline
inputt = lambda: range(int(input()))
inputn = lambda n = 1: range(n)
inputi = lambda: map(int, input().split())
inputl = lambda: list(inputi())
from math import *
from heapq import *
from bisect import *
from functools import reduce, lru_cache
from collections import Counter, defaultdict
from builtins import *



N, K, C = inputi()
S = list(*input().split())
print(S)
S = [False] + [c == "o" for c in S]

@lru_cache(None)
def F(d):
    if d > N:
        return 0
    if not S[d]:
        return F(d + 1)
    return 1 + F(d + C + 1)


i = 1
while i <= N:
    #print(i, N, S)
    if S[i]:
        #print(i, K, F(i + 1))
        if F(i + 1) == K - 1:
            print(i)
        K -= 1
        i += C
    i += 1

Submission status: Runtime Error

Solution code:
n, k, c = map(int, input().split())
s = input()

# 必ず働く日：その日に働かなければK日働くを達成できない
# その日を×にしたら最大限に詰めても条件を満たさない
# 最大働ける日数は貪欲法で行ける?
# 計算オーダー不足
# メモ化

count = 0
i = 0
work_day = []
memo_maxmum_worked_day = [0] * n
while i < n:
    if s[i] == 'o':
        work_day.append(i)
        count += 1
        for j in range(i, i + c):
            if j < n:
                memo_maxmum_worked_day[j] = count
        i += c + 1
    else:
        memo_maxmum_worked_day[i] = count
        i += 1
#print(count)
#print(work_day)

if count > k:
    pass
else:
    need_day = []
    while work_day:
        flag = True
        check_day = work_day.pop()
        tmp_work_day = []
        count = 0
        i = check_day
        count = memo_maxmum_worked_day[check_day] - 1
        while i < n:
            if memo_maxmum_worked_day[i] == count:
                flag = False
                break
            if s[i] == 'o' and i != check_day:
                tmp_work_day.append(i)
                count += 1
                i += c + 1
            else:
                i += 1

        if count < k and flag == True:
            need_day.append(check_day)

need_day.sort()
for i in need_day:
    print(i+1)

Submission status: Runtime Error

Solution code:
N, K, C = map(int, input().split())
S = input()

a = [0]*(N+1)

hataraku = []

def f(n, l):
    if l == K:
        a[N] += 1
        for h in hataraku:
            a[h] += 1
        return
    for i in range(n, N-(K-l-1)*(C+1)):
        if S[i] == "o":
            hataraku.append(i)
            f(i+C+1, l+1)
            hataraku.pop()

f(0, 0)

res = []

for i in range(N):
    if a[i] == a[N]:
        print(i+1)

Submission status: Runtime Error

Solution code:
N,K,C = map(int, input().split(' '))
S = input()
ans = []
for i in s:
  p = 0
  su = 0
  while p < N:
    if p == i:
      p = p + 1
      continue
    if S[p] == "o":
      p = p + C
      su  = su + 1
      if su == K:
        break
    else:
      p = p + 1
  if su != K:
    ans.append(i+1)
for i in ans:
  print(i)

Submission status: Runtime Error

Solution code:
kinmu = 0
niti = 0
p = 0
for i in range(N):
  if S[i] == "o" and tyousa[i] == p:
    kinmu = 0
    niti = 0
    route.clear()
    while kinmu < K and niti < N:
      if S[niti] == "o" and niti != i:
        route.append(niti)
        kinmu += 1
        niti += C
      niti += 1
    if niti >= N and kinmu < K:
      print(i + 1)
    if kinmu >= K:
      for i2 in route:
        tyousa[i2] += 1
      p += 1

Submission status: Runtime Error

Solution code:
input()
s = input()
x.= []
for ele in s:
  x.append(ele)
for ele in s:
  x.append(ele)
print(x)

Submission status: Runtime Error

Solution code:
input()
s = input()
x.= []
for ele in s:
  x.append(ele)
print(x)

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-


def f(n):
    C = [[1 for i in range(10)]]
    while sum(d for c in C for d in c[1:]) < n:
        C.append([sum(C[-1][max(0,i-1):min(i+2,10)]) for i in range(10)])
    return C

def solve():
    n = int(input())
    C = f(n)
    X = []
    m = sum(d for c in C[:-1] for d in c[1:])
    x = 1
    for x in range(1,10):
        if m + C[-1][x] < n:
            m += C[-1][x]
        else:
            break
    X.append(x)
    C = C[:-1]
    for c in C[::-1]:
        for x in range(max(0,X[-1]-1), min(10,X[-1]+2)):
            if m + c[x] < n:
                m += c[x]
            else:
                break
        X.append(x)
    return ''.join(map(str,X))


if __name__ == '__main__':
    print(solve())

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-

def check(i, day_list,k,c):
    day_list_tmp = []
    for day in day_list:
        day_list_tmp.append(day)
    day_list_tmp.remove(i)
    work_day = day_list_tmp[0]
    work_count = 1
    for day in day_list_tmp:
        if day - work_day > c:
            work_day = day
            work_count += 1
    
    if work_count < k:
        print(i+1)

n, k, c = map(int, input().split())
s = input()
s_list = list(s)
day_list = []
for i in range(n):
    if s_list[i] == 'o':
        day_list.append(i)

for i in day_list:
    check(i, day_list, k, c)

Submission status: Runtime Error

Solution code:
n, k, c = map(int, input().split(' '))
s = input()

bounded = [0 for i in range(n + 1)]
schedules = 0


def plan(i, s, k, c, days):
    global bounded, schedules
    if k == 0:
        for i in days:
            bounded[i] += 1
        schedules += 1
        return
    if i > len(s) - 1:
        return
    plan(i + 1, s, k, c, days)
    if s[i] == 'o':
        days.append(i + 1)
        plan(i + c + 1, s, k - 1, c, days)
        days.remove(i + 1)


plan(0, s, k, c, [])
if schedules in bounded:
    for i in range(len(bounded)):
        if bounded[i]==schedules:
            print(i)

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-

def first_check(day_list,k,c):
    work_day = day_list[0]
    work_count = 1
    for day in day_list:
        if day - work_day > c:
            work_day = day
            work_count += 1
    
    if work_count >= k:
        return True
    else:
        return False

def check(i, day_list,k,c):
    day_list_tmp = []
    for day in day_list:
        day_list_tmp.append(day)
    day_list_tmp.remove(i)
    work_day = day_list_tmp[0]
    work_count = 1
    for day in day_list_tmp:
        if day - work_day > c:
            work_day = day
            work_count += 1
    
    if work_count < k:
        print(i+1)
        print("count=" + str(work_count))

n, k, c = map(int, input().split())
s = input()
s_list = list(s)
day_list = []
for i in range(n):
    if s_list[i] == 'o':
        day_list.append(i)

for i in day_list:
    check(i, day_list, k, c)
    print(day_list)

Submission status: Runtime Error

Solution code:
import itertools

n, k, c = map(int, input().split())
s = input().rstrip()

ss = [i + 1 for i, ch in enumerate(s) if ch == 'o']
ans = set(ss)

cand = [0] * k
def dfs(i, kk):
    global ss
    global ans
    global cand
    global k
    
    if kk == k:
        ans = ans & set(cand)
        return

    for j in range(i + 1, len(ss)):
        if ss[j] - ss[i] > c:
            cand[kk] = ss[j]
            dfs(j, kk + 1)
        if not ans:
            return

for i in range(len(ss)):
    cand[0] = ss[i]
    dfs(i, 1)

for a in sorted(ans):
    print(a)

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

n,k,c = map(int,input().split())
s = input()

if n == 1:print(1)

dp1 = [0] * (n+1)
dp2 = [0] * (n+1)
# dp[i] = (選択したなかで一番左側のindex,選択した個数)
now = 10 ** 7;count = 0
for i in range(n-1,-1,-1):
  if s[i] == "o" and i + c < now:
    count += 1; now = i
    dp1[i] = (i,count)
  elif i == n-1:dp1[i] = (inf,0)
  else:
    dp1[i] = dp1[i+1]

now = - 10 ** 7;count = 0
for i in range(n):
  if s[i] == "o" and now + c < i:
    count += 1; now = i
    dp2[i] = (i,count)
  elif i == 0:dp2[i] = (-inf,0)
  else:
    dp2[i] = dp2[i-1]

# dp1:右から　　dp2:左から
if dp1[1][1] < k:print(1)
for i in range(1,n-1):
  index0,count0 = dp1[i+1]
  if index0 - c >= 0:
    count0 += dp2[min(index0-c,i-1)][1]
  if count0 < k:
    print(i+1)
if dp2[n-2][1] < k:print(n)
# print(dp2)

Submission status: Runtime Error

Solution code:
n,k,c = map(int,input().split())
s = input()
#print(s)
#比如1，6，10，每个位置加1，最后数字等于总次数，即一定工作
days = [0 for _ in range(n)]

def helper(s,k):
    if k ==1:
        res = []
        for j in range(len(s)):
            if s[j] == "o":
                res.append([j])
        return res
    arr = []
    for i in range(len(s)):
        if s[i] == "o":
            temp = helper(s[i+c+1:],k-1)
            res =[([y+i+c+1 for y in x] + [i]) for x in temp]
            arr +=res
    return arr

ans = helper(s,k)
#print(ans)
times = len(ans)
for i in range(times):
    for j in range(len(ans[i])):
        num = ans[i][j]
        days[num] +=1

for k in range(len(days)):
    if days[k] == times:
        print(k+1)

Submission status: Runtime Error

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N, K, C = map(int, readline().split())
S = list(map(int, readline().split()))
ans = []

def solve(index, K):
    i = 0
    cnt = 0
    while i < N:
        if S[i] == 'o' and i != index:
            cnt += 1
            i += C + 1
        else:
            i += 1
    return cnt < K

if not (solve(-1, K+1)):
    pass
else:
    index = 0
    while index < N:
        if S[index] == 'x':
            index += 1
        elif solve(index, K):
            ans.append(index + 1)
            index += C + 1
        else:
            index += 1

    for i in ans:
        print(i)

Submission status: Runtime Error

Solution code:
k = int(input())
lunluns = list(map(str, range(1,10)))
new = list(map(str, range(1,10)))
new_fueta = 9
end = False
while len(lunluns) < k:
  new_new_fueta = 0
  for x in lunluns[-new_fueta:]:
    str_x = str(x)
    if str_x[-1] == '0':
      lunluns += [int(str_x+'0'),int(str_x+'1')]
      new_new_fueta += 2
    elif str_x[-1] == '9':
      lunluns += [int(str_x+'8'),int(str_x+'9')]
      new_new_fueta += 2
    else:
      l = int(str_x[-1])
      lunluns += [int(str_x+str(l-1)), int(str_x+str(l)), int(str_x+str(l+1))]
      new_new_fueta += 3
  if end:
    break
  new_fueta = new_new_fueta
print(lunluns[k-1])

Submission status: Runtime Error

Solution code:
/*                         _
                        _ooOoo_
                       o8888888o
                       88" . "88
                       (| -_- |)
                       O\  =  /O
                    ____/`---'\____
                  .'  \\|     |//  `.
                 /  \\|||  :  |||//  \
                /  _||||| -:- |||||_  \
                |   | \\\  -  /'| |   |
                | \_|  `\`---'//  |_/ |
                \  .-\__ `-. -'__/-.  /
              ___`. .'  /--.--\  `. .'___
           ."" '<  `.___\_<|>_/___.' _> \"".
          | | :  `- \`. ;`. _/; .'/ /  .' ; |
          \  \ `-.   \_\_`. _.'_/_/  -' _.' /
===========`-.`___`-.__\ \___  /__.-'_.'_.-'================

                  Please give me AC.
*/

#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <string>
#include <sstream>
#include <complex>
#include <bitset>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <chrono>
#include <random>

using namespace std;

using int64 = long long;
using uint64 = unsigned long long;
using vi = vector<int>;
using vl = vector<int64>;
using pii = pair<int, int>;
using pll = pair<int64, int64>;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(v) (v).begin(), (v).end()
#define print(x) cout << (x) << '\n'
#define print2(x, y) cout << (x) << ' ' << (y) << '\n'
#define print3(x, y, z) cout << (x) << ' ' << (y) << ' ' << (z) << '\n'
#define printn(v) rep(i, (v).size() - 1) cout << (v)[i] << ' '; cout << (v)[n - 1] << '\n';
#define debug(x) cerr << #x << ": " << (x) << '\n'
#define debug2(x, y) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << '\n'
#define debug3(x, y, z) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << ", " << #z << ": " << (z) << '\n'
#define dbg(v) for (size_t _ = 0; _ < v.size(); ++_){cerr << #v << "[" << _ << "] : " << v[_] << '\n';}
// constant
const int INF = (1<<30) - 1;
const int64 INF64 = (1LL<<62) - 1;

template<typename T> T gcd(T a, T b) {
    if (a < b) return gcd(b, a);
    T r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

template<typename T> T lcm(const T a, const T b) {
    return a / gcd(a, b) * b;
}

template<typename T> bool chmin(T& a, const T& b) {
    if (a > b) return a = b, true; else return false;
}

template<typename T> bool chmax(T& a, const T& b) {
    if (a < b) return a = b, true; else return false;
}

// End of template.

int dp[400200];
int cup[200200];
vector<int> ans;

int main() {
    cout << fixed << setprecision(15);
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    // cin.read(buf, sizeof buf); // 注意: ./a.out < in か pbp | ./a.out で入力すること

    int n, k, c;
    string s;
    cin >> n >> k >> c >> s;

    int t = 0;

    for (int i = n - 1; i >= 0; --i) {
        if (s[i] == 'o') dp[i] = t + 1; else dp[i] = 0;

        chmax(t, dp[i + c]);
    }

    rep(i, n) cerr << dp[i] << ' '; cerr << '\n';

    if (dp[0] > k) {
        return 0;
    }

    for (int i = n - 1; i >= 0; --i) cup[i] = max(cup[i + 1], dp[i]);

    for (int i = 0; i < n;) {
        int x = dp[i];
        if (cup[i + 1] != dp[i]) {
            ans.push_back(i);
            i += c + 1;
        }
        while (dp[i] != x - 1) {++i;}
    }


    for (const auto x : ans) print(x + 1);

    return 0;
}