Harryxun/stf_run huggingface dataset:
w,h,n = map(int,input().split())
d = {1:0,2:h,3:0,4:w}
for _ in range(n):
  x,y,a = map(int,input().split())
  if a %2:
    d[a] = max(d[a],[x,y][a//2]) 
  else:
    d[a] = min(d[a],[x,y][a//2])

if d[1] > d[2] or d[3] > d[4]:
  print(0)
else:
  ans = (d[2]-d[1]+1) * (d[4]-d[3]+1)
  print(ans)

### FIXED CODE ###

h,w,n = map(int,input().split())
d = {1:0,2:h,3:0,4:w}
for _ in range(n):
  x,y,a = map(int,input().split())
  if a %2:
    d[a] = max(d[a],[x,y][a//2]) 
  else:
    d[a] = min(d[a],[x,y][a//2-1])

if d[1] > d[2] or d[3] > d[4]:
  print(0)
else:
  ans = (d[2]-d[1]) * (d[4]-d[3])
  print(ans)
n=int(input())

ans=[0 for _ in range(n) ]

for i in range(n):
  a=int(input())
  ans[a-1]+=(i+1)
  
ch=1

ans1=[]
  
for x in range(n-1):
  if ans[x]<ans[x+1]:
    ch+=1
    
  else:
    ans1.append(ch)
    ch=1
  
    
print(n-max(ans1))
    

### FIXED CODE ###

n=int(input())

ans=[0 for _ in range(n) ]

for i in range(n):
  a=int(input())
  ans[a-1]+=(i+1)
  
ch=1

ans1=[1]
  
for x in range(n-1):
  if ans[x]<ans[x+1]:
    ch+=1
    
  else:
    ans1.append(ch)
    ch=1
  
  if x==n-2:
    ans1.append(ch)
  
    
print(n-max(ans1))
N = int(input())
multi_list = []
for i range(1, 10):
  for j in range(1, 10):
    multi_list.append(i*j)

if N in multi_list:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

N = int(input())
multi_list = []
for i in range(1, 10):
  for j in range(1, 10):
    multi_list.append(i*j)
 
if N in multi_list:
  print('Yes')
else:
  print('No')
n,k,q = map(int,(input().split()))

an = [0] * n

for i in range(q):
    an[int(input())] += 1

ans = ["No","Yes"]

for j in range(n):
    print(ans[k-q+an[j]>0])

### FIXED CODE ###

n,k,q = map(int,(input().split()))

an = [0] * n

for i in range(q):
    an[int(input())-1] += 1

ans = ["No","Yes"]
#print(an)
for j in range(n):
    print(ans[k-q+an[j]>0])
from math import gcd
n = int(input())
yakusuu = set()
ans = set()
for i in range(1, int((n-1)**(1/2))+1):
    if (n-1) % i == 0:
        yakusuu.add(i)
        yakusuu.add((n-1)//i)

for i in range(1, int(n**(1/2))+1):
    if n % i == 0:
        yakusuu.add(i)
        yakusuu.add(n//i)
yakusuu.remove(1)

for i in yakusuu:
    k = n

    if gcd(i, k) == 1:
        if k % i == 1:
            ans.add(i)
        continue

    k = n
    while k >= i:
        if k % i == 0:
            k //= i
        else:
            k -= i
        if gcd(i, k) == 1:
            if k % i == 1:
                k = 1
            else:
                k = 0

    if k == 1:
        ans.add(i)

print(len(ans))


### FIXED CODE ###

from fractions import gcd
n = int(input())
yakusuu = set()
ans = set()
for i in range(1, int((n-1)**(1/2))+1):
    if (n-1) % i == 0:
        yakusuu.add(i)
        yakusuu.add((n-1)//i)

for i in range(1, int(n**(1/2))+1):
    if n % i == 0:
        yakusuu.add(i)
        yakusuu.add(n//i)
yakusuu.remove(1)



for i in yakusuu:
    k = n
    if gcd(i, k) == 1:
        if k % i == 1:
            ans.add(i)
        continue

    k = n
    while k >= i:
        if k % i == 0:
            k //= i
        else:
            if k % i == 1:
                k = 1
            else:
                k = 0
    if k == 1:
        ans.add(i)

print(len(ans))
D=int(input())
T=int(input())
S=int(input())
a=float(T-D/S)
if a>0:
    print("Yes")
else :
    print("No")

### FIXED CODE ###

D,T,S=input().split()
D=int(D)
T=int(T)
S=int(S)
a=float(T-D/S)
if a>=0:
    print("Yes")
else :
    print("No")
N = int(input())
edges = [list(map(int,input().split())) for _ in range(N-1)]
A = [[]for _ in range(N+1)]
ans = [-1]*(N+1)
for u,v,w in edges:
    A[u].append([v,w%2])
    A[v].append([u,w%2])

ans[1] = 0
def dfs(r):
    for a in A[r].copy():
        n = a[0]
        d = a[1]
        if ans[n] == -1:
            ans[n] = (ans[r] + d) % 2
            dfs(n)
dfs(1)
for a in ans[1:]:
    print(a%2)


### FIXED CODE ###

import sys
sys.setrecursionlimit(500*500)
N = int(input())
edges = [list(map(int,input().split())) for _ in range(N-1)]
A = [[]for _ in range(N+1)]
ans = [-1]*(N+1)
for u,v,w in edges:
    A[u].append([v,w%2])
    A[v].append([u,w%2])

ans[1] = 0
def dfs(r):
    for a in A[r].copy():
        n = a[0]
        d = a[1]
        if ans[n] == -1:
            ans[n] = (ans[r] + d) % 2
            dfs(n)
dfs(1)
for a in ans[1:]:
    print(a%2)
a, b, c, d=map(int,input().split())
k1=abs(a-b)
k2=abs(a-c)
k3=abs(b-c)
if k2<=d:
  print("Yes")
elif k1<=d || k2<=d:
  print("Yes")
else print("No")

### FIXED CODE ###

a, b, c, d=map(int,input().split())
k1=abs(a-b)
k2=abs(a-c)
k3=abs(b-c)
if k2<=d:
  print("Yes")
elif k1<=d and k3<=d:
  print("Yes")
else:
  print("No")
def resolve():
    n,m=map(int,input().split())
    py=[[0]*3 for _ in range(m)]
    for i in range(m):
        p,y=map(int,input().split())
        py[i][0],py[i][1],py[i][2]=p,y,i
    py.sort()
    ans=[[''] for _ in range(m)]
    cnt=[0]*n
    for p,y,i in py:
        cnt[p]+=1
        ans[i]='0'*(6-len(str(p)))+str(p)+'0'*(6-len(str(cnt[p])))+str(cnt[p])
    for i in ans:
        print(i)


if __name__ == '__main__':
    resolve()

### FIXED CODE ###

def resolve():
    n,m=map(int,input().split())
    py=[[0]*3 for _ in range(m)]
    for i in range(m):
        p,y=map(int,input().split())
        py[i][0],py[i][1],py[i][2]=p,y,i
    py.sort()
    ans=[[''] for _ in range(m)]
    cnt=[0]*(n+1)
    for p,y,i in py:
        cnt[p]+=1
        ans[i]='0'*(6-len(str(p)))+str(p)+'0'*(6-len(str(cnt[p])))+str(cnt[p])
    for i in ans:
        print(i)


if __name__ == '__main__':
    resolve()
def longest():
    moji1 = raw_input()
    moji2 = raw_input()
  
    a, b = len(seq1), len(seq2)
    x1 = [0 for i in range(b+1)]

    for i in range(a):
        e1 = moji1[i]
        x2 = x1+[]
        for j in range(b):
            if e1 == moji2[j]:
                x1[j+1] = x2[j] + 1
            elif x1[j+1] < x1[j]:
                x1[j+1] = x1[j]

    return x1[-1]
  
n = input()
for i in range(n):
    print longest()

### FIXED CODE ###

def longest():
    alps1 = raw_input()
    alps2 = raw_input()
    
    x, y = len(alps1), len(alps2)
    k = [0 for i in range(y+1)]
    for i in range(x):
        e1 = alps1[i]
        l = k+[]
        for j in range(y):
            if e1 == alps2[j]:
                k[j+1] = l[j] + 1
            elif k[j+1] < k[j]:
                k[j+1] = k[j]
 
    return k[-1]
    
n = input()
for i in range(n):
    print longest()
n,x = map(int, input().split())
city = []
sub = []
city = list(map(int, input().split()))

for i in range(len(city)):
	sub.append(abs(x - city[i]))

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

for i in range(1,len(sub)):
	ans = gcd(sub[i-1], sub[i])

print(ans)

### FIXED CODE ###

n,x = map(int, input().split())
city = []
sub = []
city = list(map(int, input().split()))

for i in range(len(city)):
	sub.append(abs(x - city[i]))

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


if len(sub) == 1:
	print(sub[0])
elif len(sub) == 2:
	print(gcd(sub[0],sub[1]))
else:
	p = gcd(sub[0], sub[1])
	for i in range(2,len(sub)):
		p = gcd(p,sub[i])
	print(p)
N = int(input())

def main():
    l = [x + y for x in range(N + 1) if x % 4 == 0
               for y in range(N + 1) if y % 7 == 0]
    l = list(set(l))
    ans = "Yes" if l.count(N) else "No"
    print(ans)

if __name__ == "__main__":
    main()

### FIXED CODE ###

N, K = [int(x) for x in input().split()]
ans = 0 if N % K == 0 else 1
print(ans)
N = int(input())
list_S = []
for i in range(N):
  list_S.append(str(input()))

list_get = []
for i in range(list_S):
  if not list_S[i] in list_get:
    list_get.append(list_S[i])

print(len(list_get))

### FIXED CODE ###

N = int(input())
list_S = [str(input()) for i in range(N)]
print(len(list(set(list_S))))
H,W = map(int, input().split())
s = [input() for _ in range(H)]

import sys
for j in range(H):
    for i in range(W):
        if s[j][i] =='#':
            if j+1<W and i+1<H and 0<=j-1 and 0<=i-1:
                if (s[j+1][i]=='#' or s[j][i+1]=='#' or s[j-1][i] or s[j][i-1]):
                    continue
                if s[j+1][i]!='#' or s[j][i+1]!='#' or s[j-1][i]!='#' or s[j][i-1]!='#':
                    print('No')
                    sys.exit()
print('Yes')


### FIXED CODE ###

H,W = map(int, input().split())
s = [input() for _ in range(H)]

import sys
for j in range(1,H-1):
    for i in range(1,W-1):
        if s[j][i] =='#':
            if s[j][i-1] == '#':
                pass
            elif s[j-1][i] == '#':
                pass
            elif s[j][i+1] == '#':
                pass
            elif s[j+1][i] == '#':
                pass
            else:
                print('No')
                sys.exit()
print('Yes')
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

Asum_li = [0]
Asum = 0
Bsum_li = [0]
Bsum = 0

for A_ in A:
    Asum = Asum + A_
    Asum_li.append(Asum)

for B_ in B:
    Bsum = Bsum + B_
    Bsum_li.append(Bsum)

cnt_max = 0
cnt_b = M

for cnt_a in range(N+1):

    while (Bsum_li[cnt_b] + Asum_li[cnt_a]) > K:
        cnt_b = cnt_b - 1
        if cnt_b < 0: break

    if (cnt_max < cnt_b + cnt_a): cnt_max = cnt_b + cnt_a


print(cnt_max)


### FIXED CODE ###

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

Asum_li = [0]
Asum = 0
Bsum_li = [0]
Bsum = 0

for A_ in A:
    Asum = Asum + A_
    Asum_li.append(Asum)

for B_ in B:
    Bsum = Bsum + B_
    Bsum_li.append(Bsum)

cnt_max = 0
cnt_b = M

for cnt_a in range(N+1):

    if Asum_li[cnt_a] > K : break

    while (Bsum_li[cnt_b] + Asum_li[cnt_a]) > K:
        cnt_b = cnt_b - 1
        if cnt_b < 0: break

    if (cnt_max < cnt_a + cnt_b): cnt_max = cnt_a + cnt_b


print(cnt_max)
from collections import Counter
import sys

s = input()
counter = Counter(s[2:-1])

if s[0] == 'A':
    s = s.lstrip('A')
else:
    print('WA')
    sys.exit(1)

if counter['C'] == 1:
    s = s.replace('C', '')
else:
    print('WA')
    sys.exit(1)

if s.islower():
    print('AC')
else:
    print('WA')


### FIXED CODE ###

from collections import Counter
import sys

s = input()
counter = Counter(s[2:-1])

if s[0] == 'A':
    s = s.lstrip('A')
else:
    print('WA')
    sys.exit(0)

if counter['C'] == 1:
    s = s.replace('C', '')
else:
    print('WA')
    sys.exit(0)

if s.islower():
    print('AC')
else:
    print('WA')
#!/usr/bin/env python
# coding: utf-8


def main():
    n, k = list(map(int, input().split()))
    s = input()
    print(s[:k]+s[k].lower()+s[k+1:])


if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python
# coding: utf-8


def main():
    n, k = list(map(int, input().split()))
    k -= 1
    s = input()
    print(s[:k]+s[k].lower()+s[k+1:])


if __name__ == '__main__':
    main()
import numpy as np
A, B, N = map(int, input().split())

x = np.arange(1, max(10**6,N+1))
print(int(np.max(np.floor(A*x/B)-A*np.floor(x/B))))

### FIXED CODE ###

import math
A, B, N = map(int, input().split())

if (B == 1):
  print(0)
elif (B > N+1):
  x = N
  print((A*x)//B-A*(x//B))
else:
  x = N-N%(B-1)
  print((A*x)//B-A*(x//B))
import math
import sys


read = sys.stdin.buffer.read


def main():
    N = int(input())
    m = map(int, read().split())
    CSF = list(zip(m, m, m))
    tt = []

    for j in range(N-1):
        t = CSF[j][1] + CSF[j][0]
        for i in range(j+1, N-1):
            if t >= CSF[i][1]:
                n = (t - CSF[i][1]) / CSF[i][2]
                t = CSF[i][1] + CSF[i][2] * math.ceil(n)
                t += CSF[i][0]
            else:
                t = CSF[i][1] + CSF[i][0]

        tt.append(t)

    tt.append(0)
    for t in tt:
        print(t)


main()


### FIXED CODE ###

import math


def main():
    N = int(input())
    CSF = [[int(x) for x in input().split()] for _ in range(N-1)]
    tt = []

    for j in range(N-1):
        t = CSF[j][1] + CSF[j][0]
        for i in range(j+1, N-1):
            if t >= CSF[i][1]:
                n = (t - CSF[i][1]) / CSF[i][2]
                t = CSF[i][1] + CSF[i][2] * math.ceil(n)
                t += CSF[i][0]
            else:
                t = CSF[i][1] + CSF[i][0]

        tt.append(t)

    tt.append(0)
    for t in tt:
        print(t)


main()
import numpy as np

def main():
  N = int(input())
  A = list(map(int,input().split()))
  A.sort()
  d = np.zeros(A[-1]+1, dtype=np.unit64)
  
  for i in range(N):
    a = A[i]
    a1 = A[i-1]
    if a != a1:
      if a != a1:
        d[a::a] += 1
      else:
        d[a] += 1
  print(np.count_nonzero(d[A] == 1))
  
main()


### FIXED CODE ###

import numpy as np

def main():
  N = int(input())
  A = list(map(int,input().split()))
  A.sort()
  d = np.zeros(A[-1]+1, dtype=np.uint64)
  
  for i in range(N):
    a = A[i]
    a1 = A[i-1]
    if a != a1:
      d[a::a] += 1
    else:
      d[a] += 1
  print(np.count_nonzero(d[A] == 1))
  
main()
def lcm(arr, n):
    ans = arr[0]
    for i in range(1, n):
        ans = ((arr[i] * ans) // gcd(arr[i], ans))
    return ans

from math import gcd
n, m = [int(x) for x in input().split()]
arr = [int(x) for x in input().split()]
v = []
for x in arr:
    y = x
    cnt = 0
    while x % 2 == 0:
        x = x // 2
        cnt += 1
    v.append(cnt)
mx = max(v)
mn = min(v)
if mx != mn:
    print(0)
else:
    strt = int(lcm(arr, n)) // 2
    if strt > m:
        print(0)
    else:
        print(1 + int((m - strt)) // int((2 * strt)))


### FIXED CODE ###

from fractions import gcd
def lcm(arr, n):
    ans = arr[0]
    for i in range(1, n):
        ans = ((arr[i] * ans) // gcd(arr[i], ans))
    return int(ans)

n, m = [int(x) for x in raw_input().split()]
arr = [int(x) for x in raw_input().split()]
v = []
for x in arr:
    y = x
    cnt = 0
    while y % 2 == 0:
        y = y // 2
        cnt += 1
    v.append(cnt)
mx = max(v)
mn = min(v)
if mx != mn:
    print(0)
else:
    strt = lcm(arr, n) // 2
    if strt > m:
        print(0)
    else:
        print(int(1 + int((m - strt)) // int((2 * strt))))
n=int(input())
s=input()
if s[:(n//2)]＊2==s:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

N=int(input())
S=input()
if S[:(N//2)]*2==S:
  print("Yes")
else:
  print("No")
X,Y,A,B,C = map(int,input().split())
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))
p = sorted(p)
q = sorted(q)
r = sorted(r)
P = A - X
Q = B - Y
R = C - 1
found = True
for i in range(C+1):
    if R < 0:
        break
    if P < A:
        if (r[C-i-1] >= p[P]):
            if (q[Q] >= p[P]):
                P += 1
                R -= 1
            elif r[C-i-1] > q[Q]:
                Q += 1
                R -= 1
            else:
                break
        elif Q < B:
            if r[C-i-1] > q[Q]:
                Q += 1
                R -= 1
            else:
                break
    elif Q < B:
        if r[C-i-1] > q[Q]:
                Q += 1
                R -= 1
        else:
            break    
    else:
        break
print(sum(p[P:])+sum(q[Q:])+sum(r[R+1:]))

### FIXED CODE ###

X,Y,A,B,C = map(int,input().split())
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))
p = sorted(p)
q = sorted(q)
r = sorted(r)
P = A - X
Q = B - Y
R = C - 1
found = True
for i in range(C+1):
    if R < 0:
        break
    if P < A:
        if (r[C-i-1] >= p[P]):
            if Q < B:
                if (q[Q] >= p[P]):
                    P += 1
                    R -= 1
                elif r[C-i-1] > q[Q]:
                    Q += 1
                    R -= 1
                else:
                    break
            else:
                P += 1
                R -= 1
        elif Q < B:
            if r[C-i-1] > q[Q]:
                Q += 1
                R -= 1
            else:
                break
        else:
            break
    elif Q < B:
        if r[C-i-1] > q[Q]:
            Q += 1
            R -= 1
        else:
            break    
    else:
        break
print(sum(p[P:])+sum(q[Q:])+sum(r[R+1:]))
import math

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

U = B - A + 1

def number(R):
        return ((B // R) - ((A - 1) // R))

possible_C = number(C)
possible_D = number(D)
possible_CD = number((C * D) // math.gcd(C, D))

print(U)
print(possible_C)
print(possible_D)
print(possible_CD)

print(U - (possible_C + possible_D) + possible_CD)


### FIXED CODE ###

import fractions

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

U = B - A + 1

def number(R):
        return ((B // R) - ((A - 1) // R))

possible_C = number(C)
possible_D = number(D)
possible_CD = number((C * D) // fractions.gcd(C, D))

print(U - (possible_C + possible_D) + possible_CD)
n, k = map(int, input().split())

arr = []
for _ in range(k):
.    d = int(input())
    a = list(map(int, input().split()))
    arr.append(a)

oks = [False] * n
for xs in arr:
    for x in xs:
        oks[x - 1] = True

ans = 0
for x in oks:
    if x == False:
        ans += 1

print(ans)


### FIXED CODE ###

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

arr = []
for _ in range(k):
    d = int(input())
    a = list(map(int, input().split()))
    arr.append(a)

oks = [False] * n
for xs in arr:
    for x in xs:
        oks[x - 1] = True

ans = 0
for x in oks:
    if x == False:
        ans += 1

print(ans)
candy=sorted(map(int,input().split()))
print("Yes" if candy[0]+candy[1]==candy[2] "No")

### FIXED CODE ###

candy= sorted(map(int,input().split()))
print("Yes" if candy[0]+candy[1]== candy[2] else "No")
a,b,k=map(int,input().split())
 
ans=[]
 
for i in range(1,min(a,b)+1):
	if a%i==0 and b%i==0:
		ans.append(i)
print(ans[k+1])

### FIXED CODE ###

a,b,k=map(int,input().split())
 
ans=[]
 
for i in range(1,min(a,b)+1):
	if a%i==0 and b%i==0:
		ans.append(i)
print(ans[-k])
X, Y = map(int, input().split())

for i in range(X+1):
    for j in range(X+1):
        if(i+j > X):
            continue
        if(Y == 4*i+2*j):
            print("Yes")
            exit()
 
print("No")


### FIXED CODE ###

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

for count, i in enumerate(x):
    if(i == 0):
        print(count+1)
import copy
H,W,K = list(map(int,input().rstrip().split(' ')))
MASU = [list(input()) for _ in range(H)]
H2_li = []
W2_li = []
C_black = 0
for i in range(2**H):
    H2 = []
    for j in range(H):
        if ((i>>j)&1):H2.append(1)
        else:H2.append(0)
    H2_li.append(H2)
for i in range(2**W):
    W2 = []
    for j in range(W):
        if ((i>>j)&1):W2.append(1)
        else:W2.append(0)
    W2_li.append(W2)

for h2 in H2_li:
    for w2 in W2_li:
        masu = copy.deepcopy(MASU)
        for i,h in enumerate(h2):
            if h == 1:
                masu[i] = ['r']*H
        for i,w in enumerate(w2):
            if w == 1:
                for k in range(H):
                    masu[k][i] = 'r'
        count = 0
        for h in range(H):
            for w in range(W):
                if masu[h][w]=='#':count+=1
        if count == K:C_black+=1

print(C_black)

### FIXED CODE ###

import copy
H,W,K = list(map(int,input().rstrip().split(' ')))
MASU = [list(input()) for _ in range(H)]
H2_li = []
W2_li = []
C_black = 0
for i in range(2**H):
    H2 = []
    for j in range(H):
        if ((i>>j)&1):H2.append(1)
        else:H2.append(0)
    H2_li.append(H2)
for i in range(2**W):
    W2 = []
    for j in range(W):
        if ((i>>j)&1):W2.append(1)
        else:W2.append(0)
    W2_li.append(W2)

for h2 in H2_li:
    for w2 in W2_li:
        masu = copy.deepcopy(MASU)
        for i,h in enumerate(h2):
            if h == 1:
                masu[i] = ['r']*W
        for i,w in enumerate(w2):
            if w == 1:
                for k in range(H):
                    masu[k][i] = 'r'
        count = 0
        for h in range(H):
            for w in range(W):
                if masu[h][w]=='#':count+=1
        if count == K:C_black+=1

print(C_black)
import itertools

#19 choose 9
#92378

def main():
    N, M, Q = map(int, input().split())
    Q = []
    final_score = 0
    for i in range(Q):
        Q.append(list(map(int, input().split())))
    for A in itertools.combinations_with_replacement(range(1, M+1), N):
        score = 0
        for q in Q:
            if A[q[1]-1] - A[q[0]-1] == q[2]:
                score += q[3]
    out = max([final_score, score])
    print(out)
main()

### FIXED CODE ###

import itertools

#19 choose 9
#92378

def main():
    N, M, Q = map(int, input().split())
    Q_l = []
    final_score = 0
    for i in range(Q):
        Q_l.append(list(map(int, input().split())))
    for A in itertools.combinations_with_replacement(range(1, M+1), N):
        score = 0
        for q in Q_l:
            if A[q[1]-1] - A[q[0]-1] == q[2]:
                score += q[3]
            final_score = max([final_score, score])
    print(final_score)
main()
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)


### FIXED CODE ###

import sys
input = sys.stdin.readline


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


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

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


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

        ret.append(len(S) - 1 - i)
        last = i
    return reversed(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 []

    reverse_ans = GetReverse()

    return sorted(list(set(base_ans) & set(reverse_ans)))


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

ans = solve()

for a in ans:
    print(a + 1)