Harryxun/stf_run huggingface dataset:
import math
a, b, h, m = map(int(), input().split())
angle = abs(30*h - 5.5*m)
distance = (a*a + b*b - 2*a*b*math.cos(math.radians(angle)))
print(math.sqrt(distance))

### FIXED CODE ###

import math
a, b, h, m = map(int, input().split())
angle = abs(30*h - 5.5*m)
distance = (a*a + b*b - 2*a*b*math.cos(math.radians(angle)))
print(math.sqrt(distance))
from itertools import combinations
import numpy as np
        #買う本
N, M, X = map(int, input().split())
items = np.array([list(map(int, input().split())) for _ in range(N)], dtype=np.int32)
all_book= [i for i in range(N)]  
out = 10**18
#for c in itertools.product([False, True], repeat=N):
for num in range(1,N+1): #1冊からN冊まで
    for t in combinations(all_book,num): #参考書を買う組合せ、全列挙
        book_buy        =np.array(t,dtype=int) 
        understand_now  = items[book_buy] 
        tmp             = np.sum(understand_now, axis=0)
        if np.all(tmp[1:] >= X):
            out = min(out, tmp[0])
            flag =True
if flag ==True:
    print(out)
else:
    print(-1)

### FIXED CODE ###

from itertools import combinations
import numpy as np
        #買う本
N, M, X = map(int, input().split())
items = np.array([list(map(int, input().split())) for _ in range(N)], dtype=np.int32)
all_book= [i for i in range(N)]  
out = 10**18
#for c in itertools.product([False, True], repeat=N):
for num in range(1,N+1): #1冊からN冊まで
    for t in combinations(all_book,num): #参考書を買う組合せ、全列挙
        book_buy        =np.array(t,dtype=int) 
        understand_now  = items[book_buy] 
        tmp             = np.sum(understand_now, axis=0)
        if np.all(tmp[1:] >= X):
            out = min(out, tmp[0])

if out == 10**18:
  print(-1)
else:
  print(out)
x = list(input().split())
a = list((int(i) for i in input().split()))
n, k = int(x[0]), int(x[1])
#import random
import queue
#n = random.choice(range(3, 8))
#k = random.choice(range(1, n))
#a = random.choices(range(-1000000, 1000000, 1), k=n)

MOD = 10**9 + 7

# check negative mode
neg = True
for i in range(n):
    if a[i] > 0:
        neg = False
if not (neg and k%2==1): neg = False
if neg: flag = 1
else: flag = -1

res = queue.PriorityQueue()
for i in range(n): res.put((flag * abs(a[i]), a[i]))
ans = 1
ansq = []

if neg: # negative case
    for i in range (k):
        (acur, cur) =  res.get()
        ans = ans * cur
        ansq.append(ans)

else: # positive case
    sm_pos, sm_neg, lg_pos, lg_neg = MOD, MOD, 0, 0
    for i in range (k):
        (acur, cur) = res.get()
        ans = ans * cur
        ansq.append(cur)
        if cur > 0 and sm_pos > acur: sm_pos = acur
        elif cur < 0 and sm_neg > acur: sm_neg = acur
    while res.qsize() > 0:
        (acur, cur) = res.get()
        if cur > 0 and lg_pos > acur: lg_pos = acur
        elif cur < 0 and lg_neg > acur: lg_neg = acur
        if lg_pos != 0 and lg_neg != 0: break
#    print (sm_pos, sm_neg, lg_pos, lg_neg, ans)
    if ans < 0:
        if lg_neg / sm_pos > lg_pos / sm_neg:
            ans = ans * lg_neg / sm_pos
        else:
            ans = ans * lg_pos / sm_neg

print (int(ans % MOD))



### FIXED CODE ###

from collections import deque
rand = False
verbose = False

if rand:
    import random
    N, K = 200000, 10000
    A = random.choices(range(-10**9, 10**9), k=N)
else:
    N, K = list(map(int, input().split()))
    A = list(map(int, input().split()))

MOD = 10**9 + 7

def mul(A):
    ret = 1
    for i in range(len(A)):
        ret = (ret * A[i]) % MOD
#        print (ret)
    return ret

if K==N:
    print(mul(A))
    exit()

POS, NEG = list(), list()
for i in range(len(A)):
    if A[i] < 0:
        NEG.append(A[i])
    else:
        POS.append(A[i])

POS.sort(reverse=True)
NEG.sort()

if len(POS)==0 and K%2==1: # must go negative
    print(mul(NEG[-K:]))
    exit()

POS = deque(POS)
NEG = deque(NEG)

ans = list()
while len(ans)<K:
    if len(NEG) <= 1:
        if verbose: print('no more neg numbers')
        ans.append(POS.popleft()) # no negative numbers to add
    elif len(POS) <= 1:
        if verbose: print('no more pos numbers')
        if K-len(ans)>=2:
            ans.append(NEG.popleft())
            ans.append(NEG.popleft())
        else:
            ans.append(POS.popleft())
    elif POS[0]*POS[1] > NEG[0]*NEG[1] or K-len(ans)==1:
        if verbose: print('pos bigger')
        ans.append(POS.popleft())
    else:
        if verbose: print('neg biger')
        ans.append(NEG.popleft())
        ans.append(NEG.popleft())

print(mul(ans))
n = int(input())
aL = sorted(list(set(list(map(int, input().split(" "))))))

dp = [False for _ in range(200000)]

if len(aL) == 1 and n != 1:
    print(0)
    exit()

ans = 0
for a in aL:
    if not dp[a]:
        ans += 1
    c = 1
    while a * c <= 100000:
        dp[a * c] = True
        c += 1

print(ans)


### FIXED CODE ###

n = int(input())
aL = sorted(list(map(int, input().split(" "))))
# aL = sorted(list(set(aLP)))

dp = [False for _ in range(1000001)]

d = {}
for a in aL:
    if a in d:
        d[a] += 1
    else:
        d[a] = 1

ans = 0
for a in aL:
    if dp[a]:
        continue
    if d[a] > 1:
        c = 1
        while a * c <= 1000000:
            dp[a * c] = True
            c += 1
        continue
    ans += 1

    c = 1
    while a * c <= 1000000:
        dp[a * c] = True
        c += 1

print(ans)
a,b=int(input())
print(a+(b//2))

### FIXED CODE ###

a,b=map(int,input().split())
print(a+(b//2))
#!/usr/bin/env python3

x, n = map(int, input().split())
p = list(map(int, input().split()))

d = [0 for _ in range(100)]
for i in range(100):
    d[i] = i+1 

for i in p:
    d.remove(i)

d2 = [0 for _ in range(len(d))]
for i in range(len(d)):
    d2[i] = abs(d[i]-x)

m = 1000

for i in reversed(range(len(d2))):
    if d2[i] <= m:
        m = d2[i]
        tmpi = i 

print(d[tmpi])


### FIXED CODE ###

#!/usr/bin/env python3

x, n = map(int, input().split())
p = list(map(int, input().split()))

d = [0 for _ in range(201)]
for i in range(-100, 101):
    d[i+100] = i+1 

for i in p:
    d.remove(i)

d2 = [0 for _ in range(len(d))]
for i in range(len(d)):
    d2[i] = abs(d[i]-x)

m = 10000
for i in reversed(range(len(d2))):
    if d2[i] <= m:
        m = d2[i]
        tmpi = i 

print(d[tmpi])
k = int(input())
#val = 0
for i in range(k, -1, -1):
    val = int("7" * i)
    #print(val)
    if val % k == 0:
        print(i)
        break
else:
    print(-1)


### FIXED CODE ###

k = int(input())
val = 7
visited = set()
counter = 1
while len(visited) < k:
    val %= k
    if val in visited:
        print(-1)
        break
    elif val % k == 0:
        print(counter)
        break
    else:
        visited.add(val)
        val = (val * 10 + 7) % k
        counter += 1
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    N, K = [int(x) for x in input().split()]
    P = [int(x) for x in input().split()]
    C = [int(x) for x in input().split()]

    score = [[0] for j in range(N)]

    dic = {}

    for i in range(N):
        next = P[i] - 1
        visited = set()
        j = 0
        memo = {}
        while next not in visited:
            score[i].append(C[next] + score[i][-1])
            visited.add(next)
            memo[next] = j
            j += 1
            next = P[next] - 1
        dic[i] = (next - 1, len(score[i]) - memo[next] - 1)

    # print(score)
    # print(dic)
    ans = max(C)
    for i in range(N):
        if K <= len(score[i]) - 1:
            ans = max(ans, max(score[i][1:K + 1]))
        else:
            if score[i][-1] <= 0:
                ans = max(ans, max(score[i][1:K + 1]))
            else:
                q, r = divmod(K - (len(score[i]) - 1), dic[i][1])
                tmp = score[i][-1]
                tmp += q * (score[i][-1] - score[i][-1 - (dic[i][1])])
                if max(score[i][-1 - (dic[i][1] - 1):-1 - (dic[i][1] - 1) + r]) - score[i][-1 - dic[i][1]] > 0:
                    tmp += max(score[i][-1 - (dic[i][1] - 1):-1 - (dic[i][1] - 1) + r]) - score[i][-1 - dic[i][1]]
                ans = max(ans, tmp)

    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    N, K = [int(x) for x in input().split()]
    P = [int(x) - 1 for x in input().split()]
    C = [int(x) for x in input().split()]

    ans = max(C)
    for i in range(N):
        next = P[i]
        cnt = 0
        tmp = 0

        while True:
            tmp += C[next]
            ans = max(ans, tmp)
            cnt += 1
            if cnt == K or next == i:
                break
            next = P[next]

        if cnt == K or tmp <= 0:
            continue

        q = K // cnt
        r = K % cnt
        next = P[i]
        if q != 0:
            tmp *= (q - 1)
            q -= 1
            r += cnt
            ans = max(ans, tmp)
        else:
            tmp = 0
        while r > 0:
            tmp += C[next]
            ans = max(ans, tmp)
            next = P[next]
            r -= 1
    print(ans)


if __name__ == '__main__':
    main()
def main():
  n = int(input())
  nums = list(map(int, input()))
  cmin = 0
  for x in nums:
	cmin += (x - min(nums)) ** 2
  for i in range(min(nums), max(nums)+1):
	c = getcost(i, nums)
    if c < cmin:
      cmin = c
  print(cmin)
  
def getcost(x, nums):
  c = 0
  for n in nums:
    c += (n - x) ** 2
  return c
  
if __name__ == '__main__':
  main()

### FIXED CODE ###

def main():
  n = int(input())
  nums = list(map(int, input().split()))
  cmin = 0
  for x in nums:
    cmin += (x - min(nums)) ** 2
  for i in range(min(nums), max(nums)+1):
    c = getcost(i, nums)
    if c < cmin:
      cmin = c
  print(cmin)
  
def getcost(x, nums):
  c = 0
  for n in nums:
    c += (n - x) ** 2
  return c
  
if __name__ == '__main__':
  main()
from numba import jit
n = int(input())
li = list(map(int, input().split()))
li.sort()
inf = (10**6)+1
isprime = [False]*(inf+1)
for i in li:
    isprime[i] = True
temp = 0
@jit
for i in li:
    if i == temp:
        isprime[i] = False
    if not isprime[i]:
        continue
    for k in range(i*2, inf+1, i):
        isprime[k] = False
    temp = i
prime_list = []
@jit
for i in range(len(li)):
      if i+1<len(li):
            if li[i] == li[i+1]:
                isprime[li[i]] = False
for i in range(1, inf+1):
    if isprime[i]:
        prime_list.append(i)
print(len(prime_list))


### FIXED CODE ###

n = int(input())
li = list(map(int, input().split()))
li.sort()
inf = (10**6)+1
isprime = [False]*(inf+1)
for i in li:
    isprime[i] = True
temp = 0
for i in li:
    if i == temp:
        isprime[i] = False
    if not isprime[i]:
        continue
    for k in range(i*2, inf+1, i):
        isprime[k] = False
    temp = i
prime_list = []
for i in range(len(li)):
      if i+1<len(li):
            if li[i] == li[i+1]:
                isprime[li[i]] = False
for i in range(1, inf+1):
    if isprime[i]:
        prime_list.append(i)
print(len(prime_list))
A, B = map(int, input().split())

if (1 <= A <= 9) and (1 <= B <= 9):
  return A * B
else: return -1

### FIXED CODE ###

A, B = map(int, input().split())

if (1 <= A <= 9) and (1 <= B <= 9):
  print( A * B )
else: print( -1 )
N = int(input())
A = sorted(map(int, input().split()))
print(A[::2]-A[1::2])

### FIXED CODE ###

N = int(input())
A = sorted(map(int, input().split()), reverse=True)
print(sum(A[::2])-sum(A[1::2]))
n,k=map(int,input().split())
h=[i for i in range(n)]
h.sort()
l=[]
for i in range(k-2):
  l.appwnd(abs(h[i]-h[i+k-1]))
print(min(l))

### FIXED CODE ###

n,k=map(int,input().split())
h=[int(input()) for _ in range(n)]
h.sort()
l=[]
for i in range(len(h)-k+1):
  l.append(abs(h[i]-h[i+k-1]))
print(min(l))
s1,s2,s3 = input().split()

if s1 == s2 and s1 == s3:
    print("No")
else:
    print("Yes")



### FIXED CODE ###

input_line = input()

if input_line == "AAA" or input_line == "BBB":
    print("No")
else:
    print("Yes")
M,N = map(int,input().split())
print((M*(M-1))//2 + ((N*(N-1))//2) 

     
    


### FIXED CODE ###

N, M = map(int, input().split())
print((N*(N-1))//2 + (M*(M-1))//2)
n = list(map(long, input().split())
count = 0
         
while count == n[2]:
	if n[0] > 0:
    	n[0]-=1   
        count+=1
    elif n[1] > 0:
        n[1]-=1
        count+=1

print(n[0] n[1])

         
         

### FIXED CODE ###

A, B, K = map(int, input().split())

if A > K:
  print(A - K, B)
elif B - (K - A) > 0:
  print(0, B - (K - A))
else:
  print(0,0)
def hel(h):
  if h==0:
    return 1
  else:
    return (hel(int(h/2))+hel(int(h/2))
health=int(input())
print(hel(health))

### FIXED CODE ###

def hel(h):
  if h==1:
    return 1
  else:
    return (2*hel(int(h/2))+1)
health=int(input())
print(hel(health))
h, w = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(h)]
b = [list(map(int, input().split())) for _ in range(h)]

x = (h + w) * 80

dp = [[0] * w for _ in range(h)]
d = abs(a[0][0] - b[0][0])
dp[0][0] = 1 << (x - d)

for i in range(h):
    for j, (ae, be) in enumerate(zip(a[i], b[i])):
        if h == w == 0:
            continue

        d = abs(ae - be)
        bt = 0
        if i != 0:
            bt |= dp[i-1][j] << d
            bt |= dp[i-1][j] >> d

        if j != 0:
            bt |= dp[i][j-1] << d
            bt |= dp[i][j-1] >> d

        dp[i][j] = bt

dp = dp[-1][-1]

b = bin(dp)[2:]
can_make = [i - x for i, be in enumerate(b[::-1]) if be == "1"]

ans = min(x if x >= 0 else -x for x in can_make)
print(ans)


### FIXED CODE ###

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

H,W = map(int,readline().split())
A = [list(map(int,readline().split())) for _ in range(H)]
B = [list(map(int,readline().split())) for _ in range(H)]

X = (H + W) * 80
# X点持った状態から始める
dp = [[0] * W for _ in range(H)]
d = abs(A[0][0] - B[0][0])
dp[0][0] = (1 << (X - d))
for h in range(H):
    for w,(a,b) in enumerate(zip(A[h],B[h])):
        if h == w == 0:
            continue
        d = abs(a - b)
        x = 0
        if h != 0:
            x |= (dp[h-1][w] << d) 
            x |= (dp[h-1][w] >> d)
        if w != 0:
            x |= (dp[h][w-1] << d) 
            x |= (dp[h][w-1] >> d)
        dp[h][w] = x

dp = dp[-1][-1]

B = bin(dp)[2:]
can_make = [i - X for i,b in enumerate(B[::-1]) if b == '1']

answer = min(x if x >= 0 else -x for x in can_make)
print(answer)
import math

A, B, K = map(int, input().split())

if A >= B:
    L, S = A, B
if A < B:
    L, S = B, A

while L%S != 0:
    tmp = L;
    L = S;
    S = tmp%S;

gcd = int(S)

com_div = []
count = 1
while count <= gcd:
    if gcd % count == 0:
        gcd = int(gcd / count)
        com_div.append(gcd)
        com_div.append(count)
    count += 1

com_div.sort(reverse=True)
print(com_div[K-1])


### FIXED CODE ###

A, B, K = map(int, input().split())

if A >= B:
    L, S = A, B
if A < B:
    L, S = B, A

while L%S != 0:
    tmp = L;
    L = S;
    S = tmp%S;

gcd = int(S)

if gcd == 1:
    print(1)
    exit()

com_div = []
com_div.append(gcd)
for i in range(1,gcd):
    if gcd % i == 0:
        com_div.append(i)

com_div.sort(reverse=True)
print(com_div[K-1])
from collections import deque

n, m, k = map(int, input().split())
a = deque(map(int, input().split()))
b = deque(map(int, input().split()))

t = 0
res = 0
while a or b:
    if not a:
        if t + b[0] > k:
            break
        else:
            t += b.popleft()
    elif not b:
        if t + a[0] > k:
            break
        else:
            t += a.popleft()
    else:
        if t + a[0] > k and t + b[0] > k:
            break
        if a[0] < b[0]:
            t += a.popleft()
        elif a[0] > b[0]:
            t += b.popleft()
        else:
            if a[1] < b[1]:
                t += a.popleft()
            else:
                t += b.popleft()
    res += 1
print(res)


### FIXED CODE ###

from itertools import accumulate

n, m, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

a_cumsum = [0] + list(accumulate(a))
b_cumsum = [0] + list(accumulate(b))
j = m
res = 0
for i in range(n+1):
    if a_cumsum[i] > k:
        break
    while a_cumsum[i] + b_cumsum[j] > k:
        j -= 1
    if (v := i + j) > res:
        res = v
print(res)
alfa=input().split()
N=int(alfa[0])
X=int(alfa[1])
#L=[int(input().split()) for i in range(N)]
L=input().split()


print(N,X,L)
D=0
count=1
for i in range(N):
    D+=int(L[i])
    if D>X:
        print(count,D,X,i,L[i])
        break
    else:
        count+=1


### FIXED CODE ###

alfa=input()

X=alfa[0]
A=alfa[2]

if X<A:
    print("0")
else:
    print("10")
import numpy as np

A, B, K = map(int,input().split())

C = np.arange(A,B+1)

if max(C)<=K:
    for x in range(B):
        print(C[x])

        
else:
    for y in range(K):
        print(C[y])
    for z in range(B-K-2,B):
        print(C[z])


### FIXED CODE ###

A, B, K = map(int,input().split())

L = B - A + 1

if L >= 2*K:
    for i in range(A, A+K):
        print(i)
    for i in range(B-K+1,B+1):
        print(i)
        
else:
    for i in range(A,B+1):
        print(i)
import numpy as np
import math

n = int(input())
x = []
for i in range(1,math.floor(math.sqrt(n))+1):
    if(n%i == 0):
        x.append(i+n/i-2-0)
print(round(min(x)))

### FIXED CODE ###

a,b = map(int,input().split())

if(a<10 and b<10):
    print(a*b)
else:
    print(-1)
N,M = map(int, input().split())
p = [0]*M
S = [0]*M
for i in range(M):
    p[i],S[i] = input().split()
import numpy as np
p = [int(s) for s in p]
p1 = np.array(p)
S1 = [1 if i=="AC" else 0 for i in S]
N1 = list(set(p1 * S1))
p2 = [1 if i in N1 else 0 for i in p1]
p2 = np.array(p2)
p3 = list(p1 * p2)
p4 = [i for i in p3 if i != 0]

A = 0
B = 0
j = 0
for i in p4:
    if i in N1:
        A += S1[j]
        B += (1-S1[j])
        j +=1
        if S1[i] ==1:
            N1.remove(i)
print(str(A)+" "+str(B))

### FIXED CODE ###

N,M = map(int, input().split())
p = [0]*M
S = [0]*M
for i in range(M):
    p[i],S[i] = input().split()
q = [int(s)-1 for s in p]
X = [0]*N
Y = [0]*N
A = 0
B = 0
for i in range(M):
    if S[i] == "AC":
        if Y[q[i]]==0:
            Y[q[i]]+=1
            A += 1
            B += X[q[i]]
    else:
        if Y[q[i]]==0:
            X[q[i]] += 1
print(str(A)+" "+str(B))
import math
def lcm(x, y):
    return math.gcd(x, y)
 
n = int(input())
ans = int(input())
for i in range(n-1):
  tmp = int(input())
  ans = lcm(ans,tmp)
  
print(ans)

### FIXED CODE ###

from fractions import gcd

def lcm(x, y):
    return (x*y) // gcd(x, y)

def getN():
    return int(input())
# print(lcm(10, 20))

n = getN()
ans = 1
for i in range(n):
    t = getN()
    ans = lcm(ans, t)

print(ans)
def gcd(a, b):
    return a if b == 0 else gcd(b, a % b)

import math

a, b, c, d = list(map(int,input().split()))

mul_c = b // c - int(math.ceil((a - 1) / c)) + 1
mul_d = b // d - int(math.ceil((a - 1) / d)) + 1

gcd_c_d = gcd(c, d)
lcm_c_d = gcd_c_d * (c / gcd_c_d) * (d / gcd_c_d)
mul_c_d = b // lcm_c_d - int(math.ceil((a - 1)) / lcm_c_d)) + 1

print(b - a + 1 - (mul_c + mul_d - mul_c_d))


### FIXED CODE ###

def gcd(a, b):
    return a if b == 0 else gcd(b, a % b)

import math

a, b, c, d = list(map(int,input().split()))

mul_c = b // c - (a - 1) // c
mul_d = b // d - (a - 1) // d

gcd_c_d = gcd(c, d)
lcm_c_d = gcd_c_d * (c // gcd_c_d) * (d // gcd_c_d)
mul_c_d = b // lcm_c_d - (a - 1) // lcm_c_d

print(b - a + 1 - (mul_c + mul_d - mul_c_d))
N = int(input())
S = input()
cnt = 0

for i in range(0, N-1):
    if S[i] == 'A' and S[i + 1] == 'B' and S[i + 2] == 'C':
        cnt += 1
print(cnt)

### FIXED CODE ###

N = int(input())
S = input()
cnt = 0

for i in range(N):
    if S[i] == 'C' and S[i - 1] == 'B' and S[i - 2] == 'A':
        cnt += 1
print(cnt)
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

def main():
    n,k,c=MI()
    s=SI()
    ll=[0]*n
    rr=[0]*n
    for i,m in enumerate(s):
        if m == "o":
            if i-c-1>=0:ll[i] = ll[i - c - 1] + 1
            else:ll[i]=1
        else:ll[i]=ll[i-1]
    #print(ll)
    for i in range(n-1,-1,-1):
        m=s[i]
        if m == "o":
            if i + c + 1 < n:rr[i]=rr[i+c+1]+1
            else:rr[i]=1
        else:rr[i]=rr[(i+1)%n]
    #print(rr)
    ans=[]
    if rr[1]<k:ans.append(1)
    for i in range(1,n-1):
        if ll[i-1]+rr[i+1]<k:ans.append(i+1)
    if n-2>=0 and ll[n-2]<k:ans.append(n)
    print(*ans,sep="\n")

main()

### FIXED CODE ###

import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

def main():
    n,k,c=MI()
    s=SI()
    ll=[0]*n
    rr=[0]*n
    for i,m in enumerate(s):
        if m == "o":
            if i-c-1>=0:ll[i] = ll[i - c - 1] + 1
            else:ll[i]=1
        else:ll[i]=ll[i-1]
    #print(ll)
    for i in range(n-1,-1,-1):
        m=s[i]
        if m == "o":
            if i + c + 1 < n:rr[i]=rr[i+c+1]+1
            else:rr[i]=1
        else:rr[i]=rr[(i+1)%n]
    #print(rr)
    ans=[]
    if n==1:ans.append(1)
    if n>1 and rr[1]<k:ans.append(1)
    for i in range(1,n-1):
        if ll[i-1]+rr[i+1]<k:ans.append(i+1)
    if n>1 and ll[n-2]<k:ans.append(n)
    print(*ans,sep="\n")

main()
n,k = map(int,input().split())
an = list(map(int, input().split()))
copyan = an[:]
i = copyan[0]
copyan[0]=10**6
movecount = 1

if i != 1:
    while True:
        memo = i
        if k == movecount:
            print(i)
            
            exit()
        i = copyan[i-1]
        
        if i >=30000:
            yokei = i%(10**6)         
            break
        copyan[memo-1]=10**6 + movecount
        movecount += 1
        
else:
    print(1)
    exit()
roopnum = movecount - yokei
x = (k-yokei)%roopnum

ans = copyan.index(10**6+yokei+x) +1
print(ans)


### FIXED CODE ###

n,k = map(int,input().split())
an = list(map(int, input().split()))
copyan = an[:]
i = copyan[0]
copyan[0]=10**6
movecount = 1

if i != 1:
    while True:
        memo = i
        if k == movecount:
            print(i)
            
            exit()
        i = copyan[i-1]
        
        if i >=300000:
            yokei = i%(10**6)         
            break
        copyan[memo-1]=10**6 + movecount
        movecount += 1
        
else:
    print(1)
    exit()
roopnum = movecount - yokei
x = (k-yokei)%roopnum

ans = copyan.index(10**6+yokei+x) +1
print(ans)
a,b = map(int,input().split())

if (a>0) & (b>0):
    print('Positive')
elif (a<0) & (b>0):
    print('Zero')
elif (a==0) or(b==0):
    print('Zero')
else:
    if (b-a)%2==1:
        print('Positive')
    else:
        print('Negative')　

### FIXED CODE ###

a,b = map(int,input().split())

if (a>0) & (b>0):
    print('Positive')
elif (a<0) & (b>0):
    print('Zero')
elif (a==0) or(b==0):
    print('Zero')
else:
    if (b-a)%2==1:
        print('Positive')
    else:
        print('Negative')