Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

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

cnt = 0
for i in range(n - 1):
    for j in range(i + a[i], n):
        if j - i == a[i] + a[j]:
            cnt += 1
print(cnt)


### FIXED CODE ###

from collections import Counter


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

a_plus_idx = Counter([a[i] + i for i in range(n)])
a_minus_idx = Counter([i - a[i] for i in range(n)])

total = 0
for k, v in a_plus_idx.items():
    total += v * a_minus_idx[k]

print(total)
### BUGGY CODE ###

N = int(input())
A = [[] for i in range(N)]
for i in range(N):
    a = list(map(int, input().split()))
    A[i] = a


num = 0

for i in range(N):
    for j in range(i + 1, N):
        flag = True
        for k in range(N):
            if i == k or k == j:
                continue
            if A[i][j] > A[i][k] + A[k][j]:
                print(-1)
                exit()
            elif A[i][j] == A[i][k] + A[k][j]:
                flag = False

        if flag:
            num += A[i][j]

print(num)

### FIXED CODE ###

N = int(input())
A = [[] for i in range(N)]
for i in range(N):
    a = list(map(int, input().split()))
    A[i] = a


num = 0

for i in range(N):
    for j in range(i + 1, N):
        flag = True
        for k in range(N):
            if i == k or k == j:
                continue
            if A[i][j] > A[i][k] + A[k][j]:
                print(-1)
                exit()
            elif A[i][j] == A[i][k] + A[k][j]:
                flag = False

        if flag:
            num += A[i][j]

print(num)
### BUGGY CODE ###

import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    n,m=map(int,input().split())
    E=[[] for _ in range(n)]
    for _ in range(m):
        u,v,w=map(int,input().split())
        u-=1; v-=1
        E[v].append((u,w))
    # dfsで各連結成分毎に最長経路を計算していく
    # 仮に更新されるようなことがあれば矛盾
    dist=[INF]*n
    visited=[0]*n
    def dfs(v)->bool:
        d=0
        flag=False
        visited[v]=1
        for nv,w in E[v]:
            # ループ検出
            if(visited[nv] and dist[nv]==INF):
                return False
            # nv の最長経路を計算
            if(not dfs(nv)):
                return False
            else:
                if(not flag):
                    d=dist[nv]+w
                    flag=True
                else:
                    if(d!=dist[nv]+w):
                        return False
        dist[v]=d
        return True
    print("Yes" if(all(dfs(v) for v in range(n))) else "No")
resolve()

### FIXED CODE ###

import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    n,m=map(int,input().split())
    E=[[] for _ in range(n)]
    for _ in range(m):
        u,v,w=map(int,input().split())
        u-=1; v-=1
        E[u].append((v,w))
        E[v].append((u,-w))

    pos=[INF]*n # position
    def dfs(v)->bool:
        if(pos[v]!=INF): return True
        pos[v]=0
        Q=[v]
        while(Q):
            v=Q.pop()
            for nv,w in E[v]:
                if(pos[nv]==INF):
                    pos[nv]=pos[v]+w
                    Q.append(nv)
                else:
                    if(pos[nv]!=pos[v]+w):
                        return False
        return True
    for v in range(n):
        if(not dfs(v)):
            print("No")
            return
    print("Yes")
resolve()
### BUGGY CODE ###

N, K, Q = list(map(int, input().split()))
A = []
for i in range(Q):
  A.append(int(input()))

for i in range(N):
    if K > Q-A.count(i+1):
        print("Yes")
    else:
        print("No")


### FIXED CODE ###

N, K, Q = list(map(int, input().split()))
A = [0]*N
for i in range(Q):
    num = int(input())
    A[num-1] += 1
# n番目の人の正解数がA[n-1]に入る
for i in range(N):
    if K > Q-A[i]:
        print("Yes")
    else:
        print("No")
### BUGGY CODE ###

while 1:
    n=input()
    if n==0:break
    a=[int(raw_input()) for _ in xrange(n)]
    max_a=-1000000
    for i in xrange(n):
        for j in xrange(i+1,n+1):
            if max_a<sum(a[i:j]):
                max_a=sum(a[i:j])
    print(max_a)

### FIXED CODE ###

while 1:
    n=input()
    if n==0:break
    a=[int(raw_input()) for _ in xrange(n)]
    wa=[0]*(n+1)
    max_a=-1000000
    for i in xrange(n):
        wa[i+1]=a[i]+wa[i]
    for i in xrange(n):
        for j in xrange(i+1,n+1):
            if max_a<wa[j]-wa[i]:
                max_a=wa[j]-wa[i]
    print(max_a)
### BUGGY CODE ###

import math

k=int(input())
ans=0
for i in range(1,k+1):
    for j in range(1,k+1):
        for l in range(1,k+1):
            x=math.gcd(i,j)
            y=math.gcd(x,l)
            ans+=y
            #print(gcd(i,j,l))
print(ans)

### FIXED CODE ###

from math import gcd

k=int(input())
ans=0
for i in range(1,k+1):
    for j in range(1,k+1):
        for l in range(1,k+1):
            ans+=gcd(gcd(i,j), l)
            #print(gcd(i,j,l))
print(ans)
### BUGGY CODE ###

n,q = map(int,input().split())
word = input()
xy= [tuple(input().split()) for i in range(q)]

# 右探索
low = 0
high = n - 1
pos = (low + high) // 2
while low <= high:
  flag = 0
  for x, y in xy:
    if (y == 'L') and (x == word[pos]):
      pos -= 1
    elif (y == 'R') and (x == word[pos]):
      pos += 1
    if (pos == n):
      flag = 1
      break
    elif (pos == -1):
      break
  if (flag == 1):
    high = ((low + high) // 2) - 1
  else:
    low = ((low + high) // 2) + 1
  pos = (low + high) // 2
right_pos = pos
# 左探索
low = 0
high = n - 1
pos = (low + high) // 2
while low <= high:
  for x, y in xy:
    flag = 0
    if (y == 'L') and (x == word[pos]):
      pos -= 1
    elif (y == 'R') and (x == word[pos]):
      pos += 1
    if (pos == -1):
      flag = 1
      break
    elif (pos == n):
      break
  if (flag == 0):
    high = ((low + high) // 2) - 1
  else:
    low = ((low + high) // 2) + 1
  pos = (low + high) // 2
left_pos = pos
print(right_pos - left_pos)

### FIXED CODE ###

n,q = map(int,input().split())
word = input()
xy= [tuple(input().split()) for i in range(q)]

# 右探索
low = 0
high = n - 1
pos = (low + high) // 2
while low <= high:
  flag = 0
  for x, y in xy:
    if (y == 'L') and (x == word[pos]):
      pos -= 1
    elif (y == 'R') and (x == word[pos]):
      pos += 1
    if (pos == n):
      flag = 1
      break
    elif (pos == -1):
      break
  if (flag == 1):
    high = ((low + high) // 2) - 1
  else:
    low = ((low + high) // 2) + 1
  pos = (low + high) // 2
right_pos = pos
# 左探索
low = 0
high = n - 1
pos = (low + high) // 2
while low <= high:
  for x, y in xy:
    flag = 0
    if (y == 'L') and (x == word[pos]):
      pos -= 1
    elif (y == 'R') and (x == word[pos]):
      pos += 1
    if (pos == -1):
      flag = 1
      break
    elif (pos == n):
      break
  if (flag == 0):
    high = ((low + high) // 2) - 1
  else:
    low = ((low + high) // 2) + 1
  pos = (low + high) // 2
left_pos = pos
print(right_pos - left_pos)
### BUGGY CODE ###

N, M = map(int, input().split())
ab_list = [list(map(int, input().split())) for i in range(M)]

ab_list.sort()

end_list = list(filter(lambda x: x[1] == N, ab_list))

res = False

for end in end_list:
    if end[0] == 1:
        res = True
        break

if not res:
    for end in end_list:
        if len(list(filter(lambda x: (x[1] == end[0]) and (x[0] == 1), ab_list))) > 0:
            res = True
            break


if res:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")


### FIXED CODE ###

N, M = map(int, input().split())
ab_list = [list(map(lambda x: int(x) - 1, input().split())) for i in range(M)]

lis = [[] for i in range(N)]

for i in range(M):
    lis[ab_list[i][0]].append(ab_list[i][1])

que = [[0, 0, lis[0], []]]
ends = []
res = False

while que:
    count, now, next_nodes, visited = que.pop()
    visited.append(now)
    if now == N - 1:
        ends = visited[:]
    for node in next_nodes:
        if node in visited or count == 2:
            continue
        que.append([count + 1, node, lis[node], visited[:]])

if N - 1 in ends:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
### BUGGY CODE ###

from collections import Counter

N = int(input())
A = list(map(int, input().split(" ")))
m = Counter(A)
def nck(n, k): 
    C = [[0 for x in range(k+1)] for x in range(n+1)] 
  
    # Calculate value of Binomial Coefficient in bottom up manner 
    for i in range(n+1): 
        for j in range(min(i, k)+1): 
            # Base Cases 
            if j == 0 or j == i: 
                C[i][j] = 1
  
            # Calculate value using previously stored values 
            else: 
                C[i][j] = C[i-1][j-1] + C[i-1][j] 
  
    return C

CHOOSE_MATRIX = nck(N, 2)
for i in range(len(A)):
    total =0
    m[A[i]] -= 1
    for key, value in m.items():
        # if key == A[i]:
        #     continue
        # else:
        total += CHOOSE_MATRIX[value][2]
    m[A[i]] += 1
    # print(uniquethings*(uniquethings)//2)
    print(total)



### FIXED CODE ###

from collections import Counter

N = int(input())
A = list(map(int, input().split(" ")))
m = Counter(A)
def nck(n, k): 
    C = [[0 for x in range(k+1)] for x in range(n+1)] 
  
    # Calculate value of Binomial Coefficient in bottom up manner 
    for i in range(n+1): 
        for j in range(min(i, k)+1): 
            # Base Cases 
            if j == 0 or j == i: 
                C[i][j] = 1
  
            # Calculate value using previously stored values 
            else: 
                C[i][j] = C[i-1][j-1] + C[i-1][j] 
  
    return C

most_common,num_most_common = m.most_common(1)[0]
CHOOSE_MATRIX = nck(num_most_common, 2)
total = 0
for key, value in m.items():
        # if key == A[i]:
        #     continue
        # else:
    total += CHOOSE_MATRIX[value][2]


for i in range(len(A)):
    newtotal = total
    # m[A[i]] -= 1
    # for key, value in m.items():
    #     # if key == A[i]:
    #     #     continue
    #     # else:
    #     total += CHOOSE_MATRIX[value][2]
    # m[A[i]] += 1
    tosubtract = CHOOSE_MATRIX[m[A[i]]][2]
    newtotal -= tosubtract
    newtotal += CHOOSE_MATRIX[m[A[i]]- 1][2]
    print(newtotal)
    # print(uniquethings*(uniquethings)//2)
    # print(total)
### BUGGY CODE ###

n = int(input())
s = str(input())
count = 0

for k in range(n):
    for j in range(n):
        for i in range(n):
            if i < j < k and (j - i) != (k - j):
                a = (s[i], s[j], s[k])
                #print(a)
                a_set = set(a)
                #print(a_set)
                if len(a_set) == 3:
                    count += 1
            else:
                continue

print(count)

### FIXED CODE ###

n = int(input())
s = str(input())
count = 0
sum_RGB = s.count("R") * s.count("G") * s.count("B")
for i in range(n):
    for j in range(i, n):  # rangeをiからにすることでループ減らせる
        # for k in range(n): # sum_RGBから減らしていくのでｋがi,jで決まる
        k = 2*j - i
        if k < n:
            a = (s[i], s[j], s[k])
            # print(a)
            a_set = set(a)
            # print(a_set)
            if len(a_set) == 3:
                count += 1

print(sum_RGB - count)
### BUGGY CODE ###

import heapq
n,m = map(int,input().split())
day = []
for i in range(n):
    a,b = map(int,input().split())
    day.append([a,b])
task = []
cost = 0
heapq.heapify(task)
for i in range(1,m+1):
    for j in [k[1] for k in day if k[0] == i]:
        heapq.heappush(task,-j)
        #print(task,j)
    if task != []:
        c = heapq.heappop(task)
        cost += (-1)*c  
print(cost)


### FIXED CODE ###

import heapq
from collections import defaultdict
n,m = map(int,input().split())
day = []
d = defaultdict(list)
for i in range(n):
    a,b = map(int,input().split())
    d[a].append(b)
task = []
cost = 0
heapq.heapify(task)
for i in range(1,m+1):
    for j in d[i]:
        heapq.heappush(task,-j)
        #print(task,j)
    if task != []:
        c = heapq.heappop(task)
        cost += (-1)*c  
print(cost)
### BUGGY CODE ###

n = int(input())
A = [list(map(int, input().split())) for _ in range(n)]
# 小さい順に調べていく
from heapq import heappop, heappush
heap = []
for i in range(n-1):
    for j in range(i+1, n):
        a = A[i][j]
        heappush(heap, (a, i, j))

G = [[] for _ in range(n)]
edges = set()
from collections import deque
ans = 0
while heap:
    # s to e
    a, s, e = heappop(heap)
    q = deque([[s, 0]])
    visited = [10**9+1] * n
    visited[s] = 0
    while q:
        node, dist = q.popleft()

        if node == e:
            if dist == a:
                # ok
                break
            elif dist < a:
                ans = -1
                break
        
        for nn, cost in G[node]:
            if dist+cost < visited[nn]:
                visited[nn] = dist+cost
                q.append([nn, dist+cost])
    else:
        # sからeにたどり着けなかったら枝を足す
        G[s].append((e, a))
        G[e].append((s, a))
        edges.add((a, s, e))
    if ans == - 1:
        break

if ans == -1:
    print(ans)
else:
    for a, s, e in edges:
        ans += a
    print(ans)


### FIXED CODE ###

n = int(input())
A = [list(map(int, input().split())) for _ in range(n)]
INF = 10**9 + 1
dp = [[INF]*n for _ in range(n)]

# コスト登録
for i, line in enumerate(A):
    for j, a in enumerate(line):
        dp[i][j] = a

for k in range(n):
    for i in range(n):
        for j in range(n):
            if i == j:
                continue
            dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j])

ans = 0
for i in range(n-1):
    for j in range(i+1, n):
        d = dp[i][j]
        if d < A[i][j]:
            ans = -1
            break
        else:
            for k in range(n):
                if k == i or k == j:
                    continue
                if dp[i][k] + dp[k][j] == d:
                    break
            else:
                ans += d
    if ans == -1:
        break
print(ans)
### BUGGY CODE ###

N, M = map(int, input().split())
H = list(map(int, input().split()))
A = [0 for k in range(M)]
B = [0 for k in range(M)]

for k in range(M):
    A[k], B[k] = map(int, input().split())
    A[k] -= 1
    B[k] -= 1
good = [1 for k in range(N)]
for k in range(N):
    if good[k] ==1:
        if k in A:
            for j in range(M):
                if k == A[j] and H[k]<=H[B[j]]:
                    good[k] = 0
                if k == A[j] and H[k]>=H[B[j]]:
                    good[B[j]] = 0
        if k in B:
            for j in range(M):
                if k == B[j] and H[k]<=H[A[j]]:
                    good[k] = 0
                if k == B[j] and H[k]>=H[A[j]]:
                    good[A[j]] = 0

print(sum(good))
        

### FIXED CODE ###

N, M = map(int, input().split())
H = list(map(int, input().split()))
A = [0 for k in range(M)]
B = [0 for k in range(M)]

for k in range(M):
    A[k], B[k] = map(int, input().split())
    A[k] -= 1
    B[k] -= 1
good = [1 for k in range(N)]

for k in range(M):
    if H[A[k]] <= H[B[k]]:
        good[A[k]] = 0
    if H[A[k]] >= H[B[k]]:
        good[B[k]] = 0   
        '''
for k in range(N):
    if good[k] ==1:
        if k in A:
            for j in range(M):
                if k == A[j] and H[k]<=H[B[j]]:
                    good[k] = 0
                if k == A[j] and H[k]>=H[B[j]]:
                    good[B[j]] = 0
        if k in B:
            for j in range(M):
                if k == B[j] and H[k]<=H[A[j]]:
                    good[k] = 0
                if k == B[j] and H[k]>=H[A[j]]:
                    good[A[j]] = 0
'''
print(sum(good))
### BUGGY CODE ###

from collections import deque, _heapq
N, K = map(int, input().split())
V = deque(map(int, input().split()))

class Money:
    def __init__(self):
        self.yen = 0
        self.red = []

    def value(self):
        return self.yen + sum(self.red)

    def add(self, yen):
        if yen >= 0:
            self.yen += yen
        else:
            self.red.append(yen)

    def remove(self, yen):
        if yen >= 0:
            self.yen -= yen
        else:
            self.red.remove(yen)

#mny = Money()
def get(cnt, mny, lstop, rstop):
    ans = mny.value()

    if cnt <= 0:
        return ans

    if len(V) > 0:

        if not lstop:
            w = V.popleft()
            mny.add(w)
            ans = max(ans, get(cnt-1, mny, lstop, rstop))
            mny.remove(w)
            V.appendleft(w)

        if not rstop:
            w = V.pop()
            mny.add(w)
            ans = max(ans, get(cnt-1, mny, True, rstop))
            mny.remove(w)
            V.append(w)

    if len(mny.red) > 0:
        w = min(mny.red)
        mny.red.remove(w)

        V.appendleft(w)
        ans = max(ans, get(cnt-1, mny, len(mny.red) and True, len(mny.red) and True))
        V.popleft()

        mny.red.append(w)    

    return ans

print(get(K, Money(), 0, 0))


### FIXED CODE ###

from collections import deque, _heapq
N, K = map(int, input().split())
V = deque(map(int, input().split()))

class Money:
    def __init__(self):
        self.yen = 0
        self.red = []

    def value(self):
        return self.yen + sum(self.red)

    def add(self, yen):
        if yen >= 0:
            self.yen += yen
        else:
            self.red.append(yen)

    def remove(self, yen):
        if yen >= 0:
            self.yen -= yen
        else:
            self.red.remove(yen)

#mny = Money()
def get(cnt, mny, lstop, rstop):
    ans = mny.value()

    if cnt <= 0:
        return ans

    if len(V) > 0:

        if lstop == 0:
            w = V.popleft()
            mny.add(w)
            ans = max(ans, get(cnt-1, mny, lstop, rstop))
            mny.remove(w)
            V.appendleft(w)
        elif lstop > 0:
            lstop -= 1

        if rstop == 0:
            w = V.pop()
            mny.add(w)
            ans = max(ans, get(cnt-1, mny, -1, rstop))
            mny.remove(w)
            V.append(w)

    if len(mny.red) > 0:
        w = min(mny.red)
        mny.red.remove(w)

        V.appendleft(w)
        ans = max(ans, get(cnt-1, mny, -1, -1))
        V.popleft()

        mny.red.append(w)    

    return ans

print(get(K, Money(), 0, 0))
### BUGGY CODE ###

n, a, b = map(int, input().split())
r = 0
n2 = 0
if n < a:
	r = n
elif a == 0:
	r = 0
else:
	n2 = n 
while n2 > 0:
	if (n2 - a < 1):
		r = r + n2
		n2 = 0
		break
	else:
		r = r + a
		n2 = n2 - a
	n2 = n2 - b
print(r)

### FIXED CODE ###

n, a, b = map(int, input().split())
t = a + b
count = t if t > 0 else 0
r = 0
if count == 0:
	r = 0
else:
	d = int(n/t)
	if d*t == n:
		r = d * a
	else:
		r = d * a
		e = n - d*t
		if e <= a:
			r = r + e
		else:
			r = r + a
print(r)
### BUGGY CODE ###

from functools import lru_cache

import sys
sys.setrecursionlimit(1000000)

N, M = map(int, input().split())

A = [int(input()) for _ in range(M)]

@lru_cache(None)
def dfs(pos):
    if pos > N:
        return 0
    if pos == N:
        return 1
    if pos in A:
        return 0
    return dfs(pos + 2) + dfs(pos + 1)

for i in reversed(range(N)):
    dfs(i)

print(dfs(0) % 1000000007)


### FIXED CODE ###

from functools import lru_cache

import sys
sys.setrecursionlimit(1000000)

N, M = map(int, input().split())

A = set(int(input()) for _ in range(M))

@lru_cache(None)
def dfs(pos):
    if pos > N:
        return 0
    if pos == N:
        return 1
    if pos in A:
        return 0
    return dfs(pos + 2) + dfs(pos + 1)

for i in reversed(range(N+1)):
    dfs(i)

print(dfs(0) % 1000000007)
### BUGGY CODE ###

S = input()
INF = 10 ** 9 + 7
dp = [[0 for _ in range(13)] for l in range(len(S))]
S_li = [_ for _ in S]
S_li = S_li[::-1]
if S_li[0] == '?':
    dp[0][0:10] = [1,1,1,1,1,1,1,1,1,1]
else:
    dp[0][int(S_li[0])] = 1
for _ in range(1,len(S)):
    if S_li[_] == '?':
        for x in range(10):
            for y in range(13):
                dp[_][((x * (10 ** _)) + y) % 13] += dp[_ - 1][y] % INF
    else:
        for y in range(13):
            dp[_][((int(S_li[_]) * (10 ** _)) + y) % 13] += dp[_ - 1][y] % INF
print(dp[-1][5] % INF)

### FIXED CODE ###

MOD = 1000000007;
 
s = [int(x) if x!="?" else -1 for x in input()]
#print(s)
n=len(s)
 
r=[0]*13
 
c=s[0]
if (c!=-1):
    r[c]=1
else:
    for i in range(10):r[i]=1
for i in range(1,n):
    dp=[0]*26
    for j in range(13):dp[j*10%13]+=(r[j]%MOD)
    dp[13:26]=dp[0:13]
    c=s[i]
    r=[0]*13
    if (c==-1):
        w=sum(dp[4:14])
        for j in range(13):
            r[j]+=w
            w=w+dp[j+1]-dp[4+j]
    else:
        for j in range(13):
            r[j]+=dp[13-c+j]
print (r[5]%MOD)
### BUGGY CODE ###

n = int(input())
b = 0
"""def div(n):
    for k in range(2,n+1):
        if n % k == 0:
            return k
    return 1

def pf(n):
    pf=[]
    while n != 1:
        pf.append(div(n))
        n = n // div(n)
    #p = list(set(pf))
    return pf"""

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

for c in range(1,n):
    m = n - c #mの約数を数える
    insu = make_divisors(m)
    l = len(insu)
    b += l
    """insu2 = list(set(insu))
    l = len(insu2)
    d = 1
    for j in range(l):
        k = insu.count(insu2[j]) + 1
        d = k * d
    b += d"""

print(b)



### FIXED CODE ###

n = int(input())
count = 0
for a in range(1,n):
    b = (n-1) // a
    count += b

print(count)
### BUGGY CODE ###

N = int(input())
S = input()
list = [str(S[i]) for i in range(N)]

result = 300000

def cal(n):
    count = 0
    count = list[:n].count("W") + list[n:].count("E")
    return count

for i in range(N):
    if result > cal(i):
        result = cal(i)
    
print(result)

### FIXED CODE ###

N = int(input())
S = input()

if S[0] == "E":
    count = S.count("E") -1
    result = count
    for i in range(1,N):
        if S[i-1] == "W" and S[i] == "W":
            count += 1
        elif S[i-1] == "E" and S[i] == "E":
            count -= 1
            if result > count:
                result = count
else:
    count = S.count("E")
    result = count
    for i in range(1,N):
        if S[i-1] == "W" and S[i] == "W":
            count += 1
        elif S[i-1] == "E" and S[i] == "E":
            count -= 1
            if result > count:
                result = count

print(result)
### BUGGY CODE ###

from collections import deque
from bisect import bisect_left

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

last = deque()
pre = -C - 1
for i, s in enumerate(S[::-1]):
  if i > pre + C and s == 'o':
    last.appendleft(N - 1 - i)
    pre = i
    if len(last) == K:
      break
lastset = set(last)

count = 0
pre = -C - 1
for i, s in enumerate(S):
  if i > pre + C and s == 'o':
    if i in lastset and count <= bisect_left(last, i) + 1:
      print(i + 1)
    pre = i
    count += 1
    if count == K:
      break

### FIXED CODE ###

from collections import deque

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

last = deque()
pre = -C - 1
for i, s in enumerate(reversed(S)):
  if i > pre + C and s == 'o':
    last.appendleft(N - 1 - i)
    pre = i
    if len(last) == K:
      break

count = 0
pre = -C - 1
x = last.popleft()
for i, s in enumerate(S):
  if i > pre + C and s == 'o':
    count += 1
    while x < i:
      x = last.popleft()
    if x == i and count + len(last) == K:
      print(i + 1)
    pre = i
    if count == K:
      break
### BUGGY CODE ###

s=input()
for i in range(len(s)//2):
  s=s.replace("ST", "")
print(len(s))

### FIXED CODE ###

x = input()

s = 0
t = 0
nokori = 0
disappear = 0

for i in x:
    if i == "S":
        s += 1
    else:
        if s > 0:
            disappear += 2
            s -= 1

print(len(x)-disappear)
### BUGGY CODE ###

n,k=[int(i) for i in input().split()]
h=[int(input()) for i in range(n)]
h.sort()
sub=[]

for i in range(n-k+1):
  sub.append(max(h[i:i+k])-min(h[i:i+k]))
print(min(sub))  
  
 

### FIXED CODE ###

n,k=[int(i) for i in input().split()]
h=[int(input()) for i in range(n)]
h.sort()
sub=[]

for i in range(n-k+1):
  sub.append(h[i+k-1]-h[i])
print(min(sub))