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:
N, K, skip = map(int, input().split(" "))
lazy = list(input())

def build_skip_to(idx) :
    skip_to = [-1]*N
    for i in range(N-1,-1,-1) : 
        if lazy[i] == "o" :
            skip_to[i] = i
        else :
            if i == N-1 :
                continue
            skip_to[i] = skip_to[i+1]

    return skip_to 

def check (work_day, i, N, K, skip, skip_to) :
    if work_day >= K :
        return True

    if i >= N :
        return False

    if lazy[i] == "x" :
        if skip_to[i] == -1 :
            return False
        if check(work_day, skip_to[i], N, K, skip, skip_to) :
            return True
    else :
        if check(work_day+1, i+skip, N, K, skip, skip_to) or check(work_day, i+1, N, K, skip, skip_to) :
            return True
        
    return False

find_solution = False
ans = []
for i in range(N) : 
    if lazy[i] == "x" :
        continue

    lazy[i] = "x"
    skip_to = build_skip_to(i)
    if not check(0, 0, N, K, skip+1, skip_to) :
        ans.append(i)
    else :
        find_solution = True
    lazy[i] = "o"
        
if find_solution :
    print("\n".join(ans))

Submission status: Runtime Error

Solution code:
N, K, skip = map(int, input().split(" "))
lazy = list(input())

def build_skip_to(idx) :
    skip_to = [-1]*N
    for i in range(N-1,-1,-1) : 
        if lazy[i] == "o" :
            skip_to[i] = i
        else :
            if i == N-1 :
                continue
            skip_to[i] = skip_to[i+1]

    return skip_to 

def check (work_day, i, N, K, skip, skip_to) :
    if work_day == K :
        return True

    if i >= N :
        return False

    if lazy[i] == "x" :
        if skip_to[i] == -1 :
            return False
        if check(work_day, skip_to[i], N, K, skip, skip_to) :
            return True
    else :
        if check(work_day+1, i+skip, N, K, skip, skip_to) or check(work_day, i+1, N, K, skip, skip_to) :
            return True
        
    return False

for i in range(N) : 
    if lazy[i] == "x" :
        continue
    lazy[i] = "x"
    skip_to = build_skip_to(i)
    if not check(0, 0, N, K, skip+1, skip_to) :
        print(i+1)

    lazy[i] = "o"

Submission status: Runtime Error

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

front = [0]*n
back = [0]*n

# 前から貪欲
c = k
i = 0
while c > 0:
  if s[i] == "o":
    front[i] = 1
    i += c+1
  else:
    i += 1
  c -= 1

# 後ろから貪欲

c = k
i = n-1
while c > 0:
  if s[i] == "o":
    back[i] = 1
    i -= c+1
  else:
    i -= 1
  c -= 1
  
for i in range(n):
  if front[i] == 1 and back[i] == 1:
    print(i+1)

Submission status: Runtime Error

Solution code:
def getlist_pattern( offset, rstr, N, step ):
  aap = []
  if(N<=0):
    return aap
  
  for i,ch in enumerate(rstr):
    if( ch == "o" ):
      ap = []
      if( len(rstr) >i+step+1 ):
      	ap = getlist_pattern( offset+i+step+1, rstr[i+step+1:], N-1,step )
      
      if( ap==[] ):
        ap = [[offset+i]]
      else:
      	for j in range(len(ap)):
          ap[j].append(offset+i)
      aap.extend(ap)
  return aap    

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

vstr = input()

pp = getlist_pattern( 0, vstr, k, c )

#print(pp)
base = []
for p in pp:
  if(len(p) == k):
    base = p
    break

base.sort()

for ind in base:
  err_flag = 0
  for p in pp:
    if(len(p) == k):
      if( not( ind in p )):
        err_flag = 1
        break
  if( err_flag==0):
  	print( ind+1 )

Submission status: Runtime Error

Solution code:
N,K,C=map(int,input().split())
S=input()
i=0
data1=[0 for i in range(0,N)]
if S[0]=='o':
    for j in range(0,C+1):
        data1[j]=(1,C+1)
    i=C+1
else:
    data1[0]=(0,1)
    i=1
while N-1>=i:
    if S[i]=='o':
        for j in range(0,C+1):
            if N>i+j:
                data1[i+j]=(data1[i-1][0]+1,min(i+C+1,N))
        i+=C+1
    else:
        data1[i]=(data1[i-1][0],i+1)
        i+=1

data2=[0 for i in range(0,N)]
if S[-1]=='o':
    for j in range(0,C+1):
        data2[j]=1
    i=C+1
else:
    data2[0]=0
    i=1
while N-1>=i:
    if S[-i-1]=='o':
        for j in range(0,C+1):
            if N>i+j:
                data2[i+j]=data2[i-1]+1
        i+=C+1
    else:
        data2[i]=data2[i-1]
        i+=1

for i in range(0,N):
    if S[i]=='o':
        if i==0:
            if K>data2[N-2]:
                print(i+1)
        elif N-1>i:
            work,nextday=data1[i-1]
            if nextday!=N:
                nextday=max(nextday,i+1)
                if K>work+data2[N-1-nextday]:
                    print(i+1)
            else:
                if K>work:
                    print(i+1)
        elif i==N-1:
            if K>data1[N-2][0]:
                print(i+1)

Submission status: Runtime Error

Solution code:
n,k,rest= map(int, input().split())
s=input()
s+="x"*rest
l=[]
i=-1
ban=0
suc=0
new=[]
if rest==0:
    if s.count("o")==k:
        for i in range(len(s)):
            if s[i]=="o":
                print(i+1)
else:
    while i<len(s)+rest-1:
        i+=1
        ban-=1
        c=s[i]
        if c=="o":
            suc=0
            if ban>=0:
                continue
            new.append(i+1)
            ban=rest
        else:
            suc+=1
            if suc>=rest:
                if ban==0:
                    l+=new
                new=[]

    if len(l)>k:
        print()
    else:
        for i in l:
            print(i)

Submission status: Runtime Error

Solution code:
N,K,C=map(int,input().split())
S=input()
i=0
data1=[0 for i in range(0,N)]
if S[0]=='o':
    for j in range(0,C+1):
        data1[j]=(1,C+1)
    i=C+1
else:
    data1[0]=(0,1)
    i=1
while N-1>=i:
    if S[i]=='o':
        for j in range(0,C+1):
            if N>i+j:
                data1[i+j]=(data1[i-1][0]+1,min(i+C+1,N))
        i+=C+1
    else:
        data1[i]=(data1[i-1][0],i+1)
        i+=1

data2=[0 for i in range(0,N)]
if S[-1]=='o':
    for j in range(0,C+1):
        data2[j]=1
    i=C+1
else:
    data2[0]=1
    i=1
while N-1>=i:
    if S[-i-1]=='o':
        for j in range(0,C+1):
            if N>i+j:
                data2[i+j]=data2[i-1]+1
        i+=C+1
    else:
        data2[i]=data2[i-1]
        i+=1

for i in range(0,N):
    if S[i]=='o':
        if i==0:
            if K>data2[N-2]:
                print(i+1)
        elif N-1>i:
            work,nextday=data1[i-1]
            if nextday!=N:
                nextday=max(nextday,i+1)
                if K>work+data2[N-1-nextday]:
                    print(i+1)
            else:
                if K>work:
                    print(i+1)
        elif i==N-1:
            if K>data1[N-2][0]:
                print(i+1)

Submission status: Runtime Error

Solution code:
N,K,C=map(int,input().split())
S=input()
i=0
data1=[0 for i in range(0,N)]
if S[0]=='o':
    for j in range(0,C+1):
        data1[j]=(1,C+1)
    i=C+1
else:
    data1[0]=(0,1)
    i=1
while N-1>=i:
    if S[i]=='o':
        for j in range(0,C+1):
            if N>i+j:
                data1[i+j]=(data1[i-1][0]+1,min(i+C+1,N))
        i+=C+1
    else:
        data1[i]=(data1[i-1][0],i+1)
        i+=1

data2=[0 for i in range(0,N)]
if S[-1]=='o':
    for j in range(0,C+1):
        data2[j]=1
    i=C+1
else:
    data2[0]=1
    i=1
while N-1>=i:
    if S[-i-1]=='o':
        for j in range(0,C+1):
            if N>i+j:
                data2[i+j]=data2[i-1]+1
        i+=C+1
    else:
        data2[i]=data2[i-1]
        i+=1

for i in range(0,N):
    if i==0:
        if K>data2[N-2]:
            print(i+1)
    elif N-1>i:
        work,nextday=data1[i-1]
        if nextday!=N:
            nextday=max(nextday,i+1)
            if K>work+data2[N-1-nextday]:
                print(i+1)
        else:
            if K>work:
                print(i+1)
    elif i==N-1:
        if K>data1[N-2][0]:
            print(i+1)

Submission status: Runtime Error

Solution code:
from functools import reduce
from itertools import combinations

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

work = range(1, n + 1)
not_working = []
for i, v in enumerate(s, start=1):
    if v == "o":
        continue
    not_working.append(i)

working = set(work) - set(not_working)


def is_consistent(t):
    u = t[1:]
    for i, v in zip(t, u):
        if v - i <= c:
            return False
    return True


l = list(filter(is_consistent, combinations(working, k)))
for i in sorted(reduce(lambda a, b: set(a) & set(b), l)):
    print(i)

Submission status: Runtime Error

Solution code:
def getlist_pattern( offset, rstr, N, step ):
  aap = []
  if(N<=0):
    return aap
  
  for i,ch in enumerate(rstr):
    if( ch == "o" ):
      ap = []
      if( len(rstr) >=i+step+1 ):
      	ap = getlist_pattern( offset+i+step+1, rstr[i+step+1:], N-1,step )
      
      if( ap==[] ):
        ap = [[offset+i]]
      else:
      	for j in range(len(ap)):
          ap[j].append(offset+i)
      aap.extend(ap)
  return aap    

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

vstr = input()

pp = getlist_pattern( 0, vstr, k, c )

#print(pp)
base = []
for p in pp:
  if(len(p) == k):
    base = p
    break

base.sort()

for ind in base:
  err_flag = 0
  for p in pp:
    if(len(p) == k):
      if( not( ind in p )):
        err_flag = 1
        break
  if( err_flag==0):
  	print( ind+1 )

Submission status: Runtime Error

Solution code:
from heapq import heappush,heappop,heapify
from collections import deque,defaultdict,Counter
from itertools import permutations,combinations,groupby
import sys,bisect,string,math,time,functools,random
def Golf():*a,=map(int,open(0))
def I():return int(input())
def S_():return input()
def IS():return input().split()
def LS():return [i for i in input().split()]
def LI():return [int(i) for i in input().split()]
def LI_():return [int(i)-1 for i in input().split()]
def NI(n):return [int(input()) for i in range(n)]
def NI_(n):return [int(input())-1 for i in range(n)]
def StoLI():return [ord(i)-97 for i in input()]
def ItoS(n):return chr(n+97)
def LtoS(ls):return ''.join([chr(i+97) for i in ls])
def GI(V,E,Directed=False,index=0):
    org_inp=[];g=[[] for i in range(n)]
    for i in range(E):
        inp=LI();org_inp.append(inp)
        if index==0:inp[0]-=1;inp[1]-=1
        if len(inp)==2:
            a,b=inp;g[a].append(b)
            if not Directed:g[b].append(a)
        elif len(inp)==3:
            a,b,c=inp;aa=(inp[0],inp[2]);bb=(inp[1],inp[2]);g[a].append(bb)
            if not Directed:g[b].append(aa)
    return g,org_inp
def GGI(h,w,boundary=1,search=[],replacement_of_found='.',mp_def={'#':1,'.':0}):
#h,w,g,sg=GGI(h,w,boundary=1,search=['S','G'],replacement_of_found='.',mp_def={'#':1,'.':0}) # sample usage
    mp=[boundary]*(w+2);found={}
    for i in range(h):
        s=input()
        for char in search:
            if char in s:
                found[char]=((i+1)*(w+2)+s.index(char)+1)
                mp_def[char]=mp_def[replacement_of_found]
        mp+=[boundary]+[mp_def[j] for j in s]+[boundary]
    mp+=[boundary]*(w+2)
    return h+2,w+2,mp,found
def TI(n):return GI(n,n-1)
def bit_combination(k,n=2):return [[tb//(n**bt)%n for bt in range(k)] for tb in range(n**k)]
def show(*inp,end='\n'):
    if show_flg:print(*inp,end=end)
def show2d(g,h,w):
    for i in range(h):show(g[i*w:i*w+w])

YN=['YES','NO'];Yn=['Yes','No']
mo=10**9+7
inf=float('inf')
l_alp=string.ascii_lowercase
#sys.setrecursionlimit(10**7)
input=lambda: sys.stdin.readline().rstrip()


## return prime factors of N as dictionary {prime p:power of p}
## within 2 sec for N = 2*10**20+7
def primeFactor(N):
    i,n=2,N
    ret={}
    d,sq=2,99
    while i<=sq:
        k=0
        while n%i==0:
            n,k,ret[i]=n//i,k+1,k+1
        if k>0 or i==97:
            sq=int(n**(1/2)+0.5)
        if i<4:
            i=i*2-1
        else:
            i,d=i+d,d^6
    if n>1:
        ret[n]=1
    return ret


## return the list of prime numbers in [2,N], using eratosthenes sieve
## within 2sec for N = 1.2*10**7
def PrimeNumSet(N):
    Max = int(N**0.5)
    seachList = [i for i in range(2,N+1)]
    primeNum = []
    while seachList:
        if seachList[0] <= Max:
            break
        primeNum.append(seachList[0])
        tmp = seachList[0]
        seachList = [i for i in seachList if i % tmp != 0]
    primeNum.extend(seachList)
    return primeNum

## retrun LCM of numbers in list b
## within 2sec for no of B = 10*5  and  Bi < 10**6
def LCM(b,mo=10**9+7):
    prs=PrimeNumSet(max(b))
    M=dict(zip(prs,[0]*len(prs)))
    for i in b:
        dc=primeFactor(i)
        for j,k in dc.items():
            M[j]=max(M[j],k)
    
    r=1
    for j,k in M.items():
        if k!=0:
            r*=pow(j,k,mo)
            r%=mo
    return r

def ran_input():
    n=random.randint(4,16)
    rmin,rmax=1,10
    a=[random.randint(rmin,rmax) for _ in range(n)]
    return n,a

def Primes(x):
    div=[1]
    for j,c in primeFactor(x).items():
        tmp=[]
        for x in div:
            for k in range(1,c+1):
                tmp+=[x*j**k]
        div+=tmp
    return div



show_flg=False
show_flg=True

ans=0

n,k,c=LI()
s=input()

def lbd(s,n,k,c):
    dp=[[0] for i in range(n+1)]
    dp=[0]*n
    mdp=[0]*n
    for i in range(n):
        if s[i]=='o':
            dp[i]=1
            if i-c-1>=0:
                dp[i]=mdp[i-c-1]+1
            mdp[i]=max(mdp[i-1],dp[i])
        else:
            dp[i]=dp[i-1]
            mdp[i]=max(mdp[i-1],dp[i])
    return dp        

dp1=lbd(s,n,k,c)
dp2=lbd(s[::-1],n,k,c)[::-1]


for i in range(n):
    if s[i]=='x':
        continue
    if i==0:
        D=dp2[i+1]
    elif i==n-1:
        D=dp1[i-1]
    else:
        D=dp1[i-1]+dp2[i+1]
    
    if D<k:
        print(i+1)

Submission status: Runtime Error

Solution code:
def getlist_pattern( offset, rstr, N, step ):
  aap = []
  if(N<=0):
    return aap
  
  for i,ch in enumerate(rstr):
    if( ch == "o" ):
      ap = getlist_pattern( offset+i+step+1, rstr[i+step+1:], N-1,step )
      
      if( ap==[] ):
        ap = [[offset+i]]
      else:
      	for j in range(len(ap)):
          ap[j].append(offset+i)
      aap.extend(ap)
  return aap    

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

vstr = input()

pp = getlist_pattern( 0, vstr, k, c )

#print(pp)
base = []
for p in pp:
  if(len(p) == k):
    base = p
    break

base.sort()

for ind in base:
  err_flag = 0
  for p in pp:
    if(len(p) == k):
      if( not( ind in p )):
        err_flag = 1
        break
  if( err_flag==0):
  	print( ind+1 )

Submission status: Runtime Error

Solution code:
def main():
    from itertools import groupby
    n, k, c = map(int, input().split())
    s = list(input())

    if c == 0:
        if s.count('o') == k:
            ans = '\n'.join(map(str,range(1,n+1)))
            print(ans)
            return
        else:
            return

       check_f = []
    x = 0
    for i, j in enumerate(s, 1):
        if x:
            x -= 1
            continue
        if j == 'o':
            x = c
            check_f.append(i)
        if len(check_f) == k:
            break

    check_b = []
    x = 0
    for i, j in enumerate(s[::-1]):
        if x:
            x -= 1
            continue
        if j == 'o':
            x = c
            check_b.append(n - i)
        if len(check_b) == k:
            break

    ans = list(set(check_f) & set(check_b))
    ans.sort()
    ans = '\n'.join(map(str,ans))
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
from heapq import heappush,heappop,heapify
from collections import deque,defaultdict,Counter
from itertools import permutations,combinations,groupby
import sys,bisect,string,math,time,functools,random
def Golf():*a,=map(int,open(0))
def I():return int(input())
def S_():return input()
def IS():return input().split()
def LS():return [i for i in input().split()]
def LI():return [int(i) for i in input().split()]
def LI_():return [int(i)-1 for i in input().split()]
def NI(n):return [int(input()) for i in range(n)]
def NI_(n):return [int(input())-1 for i in range(n)]
def StoLI():return [ord(i)-97 for i in input()]
def ItoS(n):return chr(n+97)
def LtoS(ls):return ''.join([chr(i+97) for i in ls])
def GI(V,E,Directed=False,index=0):
    org_inp=[];g=[[] for i in range(n)]
    for i in range(E):
        inp=LI();org_inp.append(inp)
        if index==0:inp[0]-=1;inp[1]-=1
        if len(inp)==2:
            a,b=inp;g[a].append(b)
            if not Directed:g[b].append(a)
        elif len(inp)==3:
            a,b,c=inp;aa=(inp[0],inp[2]);bb=(inp[1],inp[2]);g[a].append(bb)
            if not Directed:g[b].append(aa)
    return g,org_inp
def GGI(h,w,boundary=1,search=[],replacement_of_found='.',mp_def={'#':1,'.':0}):
#h,w,g,sg=GGI(h,w,boundary=1,search=['S','G'],replacement_of_found='.',mp_def={'#':1,'.':0}) # sample usage
    mp=[boundary]*(w+2);found={}
    for i in range(h):
        s=input()
        for char in search:
            if char in s:
                found[char]=((i+1)*(w+2)+s.index(char)+1)
                mp_def[char]=mp_def[replacement_of_found]
        mp+=[boundary]+[mp_def[j] for j in s]+[boundary]
    mp+=[boundary]*(w+2)
    return h+2,w+2,mp,found
def TI(n):return GI(n,n-1)
def bit_combination(k,n=2):return [[tb//(n**bt)%n for bt in range(k)] for tb in range(n**k)]
def show(*inp,end='\n'):
    if show_flg:print(*inp,end=end)
def show2d(g,h,w):
    for i in range(h):show(g[i*w:i*w+w])

YN=['YES','NO'];Yn=['Yes','No']
mo=10**9+7
inf=float('inf')
l_alp=string.ascii_lowercase
#sys.setrecursionlimit(10**7)
input=lambda: sys.stdin.readline().rstrip()


## return prime factors of N as dictionary {prime p:power of p}
## within 2 sec for N = 2*10**20+7
def primeFactor(N):
    i,n=2,N
    ret={}
    d,sq=2,99
    while i<=sq:
        k=0
        while n%i==0:
            n,k,ret[i]=n//i,k+1,k+1
        if k>0 or i==97:
            sq=int(n**(1/2)+0.5)
        if i<4:
            i=i*2-1
        else:
            i,d=i+d,d^6
    if n>1:
        ret[n]=1
    return ret


## return the list of prime numbers in [2,N], using eratosthenes sieve
## within 2sec for N = 1.2*10**7
def PrimeNumSet(N):
    Max = int(N**0.5)
    seachList = [i for i in range(2,N+1)]
    primeNum = []
    while seachList:
        if seachList[0] <= Max:
            break
        primeNum.append(seachList[0])
        tmp = seachList[0]
        seachList = [i for i in seachList if i % tmp != 0]
    primeNum.extend(seachList)
    return primeNum

## retrun LCM of numbers in list b
## within 2sec for no of B = 10*5  and  Bi < 10**6
def LCM(b,mo=10**9+7):
    prs=PrimeNumSet(max(b))
    M=dict(zip(prs,[0]*len(prs)))
    for i in b:
        dc=primeFactor(i)
        for j,k in dc.items():
            M[j]=max(M[j],k)
    
    r=1
    for j,k in M.items():
        if k!=0:
            r*=pow(j,k,mo)
            r%=mo
    return r

def ran_input():
    n=random.randint(4,16)
    rmin,rmax=1,10
    a=[random.randint(rmin,rmax) for _ in range(n)]
    return n,a

def Primes(x):
    div=[1]
    for j,c in primeFactor(x).items():
        tmp=[]
        for x in div:
            for k in range(1,c+1):
                tmp+=[x*j**k]
        div+=tmp
    return div



show_flg=False
show_flg=True

ans=0

n,k,c=LI()
s=input()

def lbd(s,n,k,c):
    dp=[[0] for i in range(n+1)]
    dp=[0]*n
    mdp=[0]*n
    for i in range(n):
        if s[i]=='o':
            dp[i]=1
            if i-c>=0:
                dp[i]=mdp[i-c]+1
            mdp[i]=max(mdp[i-1],dp[i])
        else:
            dp[i]=dp[i-1]
            mdp[i]=max(mdp[i-1],dp[i])
    return dp        

dp1=lbd(s,n,k,c)
dp2=lbd(s[::-1],n,k,c)[::-1]

for i in range(n):
    if s[i]=='x':
        continue
    if i==0:
        D=dp2[i+1]
    elif i==n-1:
        D=dp1[i-1]
    else:
        D=dp1[i-1]+dp2[i+1]

    if D<k:
        print(i+1)

Submission status: Runtime Error

Solution code:
def getlist_pattern( offset, rstr, N, step ):
  aap = []
  if(N<=0):
    return aap
  
  for i,ch in enumerate(rstr):
    if( ch == "o" ):
      ap = getlist_pattern( offset+i+step+1, rstr[i+step+1:], N-1,step )
      
      if( ap==[] ):
        ap = [[offset+i]]
      else:
      	for j in range(len(ap)):
          ap[j].append(offset+i)
      aap.extend(ap)
  return aap    

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

vstr = input()

pp = getlist_pattern( 0, vstr, k, c )

#print(pp)

for p in pp:
  if(len(p) == k):
    base = p
    break

base.sort()

for ind in base:
  err_flag = 0
  for p in pp:
    if(len(p) == k):
      if( not( ind in p )):
        err_flag = 1
        break
  if( err_flag==0):
  	print( ind+1 )

Submission status: Runtime Error

Solution code:
def main():
    n,k,c=map(int,input().split())
    s=list(input())
    l=[0]*(k+1)
    r=[0]*(k+1)
    x=0
    i=0
    while i<=n-1:
        if s[i]=='o':
            x+=1
            l[x]=i+1
            i+=c+1
            if x==k:
                break
        else:
            i+=1
    i=n-1
    while 0<=i:
        if s[i]=='o':
            r[x]=i+1
            x-=1
            i-=c+1
            if x==1:
                break
        else:
            i-=1
    for i in range(1,k+1):
        if l[i]==r[i]:
            print(l[i])

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
def main():
    n,k,c=map(int,input().split())
    s=list(input())
    l=[0]*(k+1)
    r=[0]*(k+1)
    x=0
    i=0
    while i<=n-1:
        if s[i]=='o':
            x+=1
            l[x]=i+1
            i+=k+1
            if x==k:
                break
        else:
            i+=1
    i=n-1
    while 0<=i:
        if s[i]=='o':
            r[x]=i+1
            x-=1
            i-=k+1
            if x==1:
                break
        else:
            i-=1
    for i in range(1,k+1):
        if l[i]==r[i]:
            print(l[i])

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
def main():
    n,k,c=map(int,input().split())
    s=list(input())
    l=[0]*(k+1)
    r=[0]*(k+1)
    x=0
    i=0
    while i<=n-1:
        if s[i]=='o':
            x+=1
            l[x]=i+1
            i+=k+1
            if x==k:
                break
        else:
            i+=1
    print(l)
    i=n-1
    while 0<=i:
        if s[i]=='o':
            r[x]=i+1
            x-=1
            i-=k+1
            if x==1:
                break
        else:
            i-=1
    print(r)
    for i in range(1,k+1):
        if l[i]==r[i]:
            print(l[i])

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    if len(x) == 0:
        return []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False
"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""

n,k,c = m()

s = list(input())[:-1]


dp0 = [-1 for i in range(k)]
dp1 = [-1 for i in range(k)]
co = 0
po = 0
for i in range(n):
    if co == 0:
        if s[i] == "o":
            dp0[po] = i
            if po == k-1:
                break
            po += 1
            co = c
    else:
        co -= 1

co = 0

po = k-1

for i in range(n-1,-1,-1):
    if co == 0:
        if s[i] == "o":
            dp1[po] = i
            if po == -1:
                break
            co = c
            po -= 1

    else:
        co -= 1

for i in range(k):
    if dp0[i] == dp1[i] dp0[i] != -1:
        print(dp0[i]+1)

Submission status: Runtime Error

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

l=[]
la=[]
i=0
c=0
while True:
    if S[i]=="o":
        l.append(i)
        i+=C
        c+=1
    i+=1
    if i>N:
        break

if c>K:
    exit()

i=N-1
c=0

while True:
    if S[i]=="o":
        la.append(i)
        i-=C
        c+=1
    i-=1
    if c==K:
        break
    
for i in l:
    if i in la:
        print(i+1)

Submission status: Runtime Error

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

l=[]
la=[]
i=0
c=0
while True:
    if S[i]=="o":
        l.append(i)
        i+=C
        c+=1
    i+=1

if c>K:
    exit()

i=N-1
c=0

while True:
    if S[i]=="o":
        la.append(i)
        i-=C
        c+=1
    i-=1
    if c==K:
        break
    
for i in l:
    if i in la:
        print(i+1)