Harryxun/stf_run huggingface dataset:
s = input()
w = ""
cnt1 = 0
for x in s[1:]:
	if x != w:
      cnt1 += 1

cnt2 = 0
for x in s[-2::-1]:
	if x != w:
      cnt2 += 1

print(min(cnt1, cnt2))


### FIXED CODE ###

S = input()
print( sum([ 1 for x, y in zip(S[:-1], S[1:]) if x != y]) )
import math


n = int(input())
a = [int(x) for x in input().split(" ")]
a.sort()
g = a[n - 1]

for i in range(1, n):
    g = math.gcd(g, a[i])


print(g)


### FIXED CODE ###

def gcd(a, b):
    while b != a:
        if a < b:
            b = b % a
            if b == 0:
                return a
        elif b < a:
            a = a % b
            if a == 0:
                return b
    return a

def m(a):
    a.sort()
    l = len(a)
    b = []
    for i in range(l // 2):
        b.append(gcd(a[i], a[l - i - 1]))
    if l % 2 == 1:
        b.append(a[l // 2])
    return list(set(b))

    
n = int(input())
a = [int(x) for x in input().split(" ")]

while len(a) > 1:
    a = m(a)

print(a[0])
s = int(input())
a = s / 3600
b = (s - a) / 60
c = s - a - b
print a + ":" + b + ":" + c

### FIXED CODE ###

s = int(input())
a = s /3600
b = (s-a*3600)/60
c = s - 3600*a -60*b
print str(a) + ":" + str(b) + ":" + str(c)
from decimal import *

import numpy as np

import math

if __name__ == '__main__':
    n = int(input())
    b, c = map(int, input().split())
    list =[]
    min = 110
    d = [int(i) for i in input().split()]

    for i in d:
        a =Decimal(i)*Decimal(0.006)
        list.append(abs(c-a))
        if min > abs(c-a):
            min=abs(c-a)
    print(list.index(min)+1)



### FIXED CODE ###

import sys
import copy
import math
import bisect
import pprint
import bisect
from functools import reduce
from copy import deepcopy
from collections import deque
from decimal import *

import numpy as np

import math

if __name__ == '__main__':
    n = int(input())
    b, c = map(int, input().split())
    list = []
    min = 10000000000
    d = [int(i) for i in input().split()]
    c = c * 1000

    for i in d:
        a = b *1000 - i * 6
        diff = 0
        if (a > 0 and c > 0) or (a < 0 and c < 0):
            diff = abs(c - a)
        else:
            diff = abs( a) +abs(c)
        list.append(diff)
        if min > diff:
            min = diff
    print(list.index(min) + 1)
import sys
sys.setrecursionlimit(10**6)
N=int(input())
X=input()
X_int=int(X, 2)


def calc(n,count):
    popcount=bin(n).count("1")
    next_n=n%popcount
    #print(next_n)
    if next_n==0:
        return count+1
    else:
        return calc(next_n, count+1)


for i in range(N):
    if X[i]=="1":
        now=X_int-2**(N-1-i)
    else:
        now=X_int+2**(N-1-i)

    #print(int(nowbin, 2))
    print(calc(now,0))

### FIXED CODE ###

N=int(input())
X=input()
def calc(n,count):
    if n==0:
        return count
    popcount=bin(n).count("1")
    next_n=n%popcount
    #print(next_n)
    if next_n==0:
        return count+1
    else:
        return calc(next_n, count+1)

popcount=X.count("1")
if popcount==1:
    plus=0
    for i in range(N):
        x=X[i]
        if x=="1":
            plus+=pow(2,N-i-1,popcount+1)
    for i in range(N):
        x=X[i]
        if x=="1":
            print(0)
        else:
            ans=plus+pow(2,N-i-1,popcount+1)
            ans%=(popcount+1)
            print(calc(ans,1))
    exit()


plus=0
minus=0
for i in range(N):
    x=X[i]
    if x=="1":
        plus+=pow(2,N-i-1,popcount+1)
        minus+=pow(2,N-i-1,popcount-1)
        plus%=(popcount+1)
        minus%=(popcount-1)

for i in range(N):
    x=X[i]
    if x=="1":
        ans=minus-pow(2,N-i-1,popcount-1)
        ans%=(popcount-1)
        print(calc(ans,1))

    else:
        ans=plus+pow(2,N-i-1,popcount+1)
        ans%=(popcount+1)
        print(calc(ans,1))
n, m = map(int, input().split())
a = sorted(list(map(int, input().split())), reverse = True)
b = [list(map(int, input().split())) for i in range(m)]
b.sort(key=lambda x: -x[1])

ct1 = 0
ct2 = 0
ans = 0
i = 0

while i in range(n):
    if a[ct1] > b[ct2][1]:
        ans += a[ct1]
        ct1 += 1
        i += 1
    else:
        j = min(n-i, b[ct2][0])
        ans += b[ct2][1] * j
        i += j
        ct2 += 1

print(ans)


### FIXED CODE ###

n, m = map(int, input().split())
a = sorted(list(map(int, input().split())), reverse = True)
b = [list(map(int, input().split())) for i in range(m)]
b.sort(key=lambda x: -x[1])

ct1 = 0
ct2 = 0
ans = 0
i = 0

while i in range(n):
    if ct2 < m:
        if a[ct1] < b[ct2][1]:
            j = min(n-i, b[ct2][0])
            ans += b[ct2][1] * j
            i += j
            ct2 += 1
        else:
            ans += a[ct1]
            ct1 += 1
            i += 1
    else:
        ans += a[ct1]
        ct1 += 1
        i += 1
print(ans)
N,M=map(int,input().split())
A=[input()for i in range(N)]
B=[input()for i in range(M)]
b=''
a='no'
for i in range(M):
    b+=B[i]
for i in range(N-M+1):
    if B[0]in A[i] and B[1] in A[i+1]:
        for j in range(N-M+1):
            a=''
            for k in range(M):
                a+=A[i+k][j:j+M]
            if a==b:
                print("Yes")
                exit()
print("No") 


### FIXED CODE ###

N,M=map(int,input().split())
A=[input()for i in range(N)]
B=[input()for i in range(M)]
b=''
a='no'
for i in range(M):
    b+=B[i]
for i in range(N-M+1):
    if B[0]in A[i] :
        for j in range(N-M+1):
            a=''
            for k in range(M):
                a+=A[i+k][j:j+M]
            if a==b:
                print("Yes")
                exit()
print("No")
weatherlist = ["Sunny", "Cloudy", "Rainy"]
 
weather = input().rstrip()
weathernum = weatherlist.index(weather)
 
tomorrownum = weathernum % 3
 
print(weatherlist[tomorrownum + 1])

### FIXED CODE ###

weatherlist = ["Sunny", "Cloudy", "Rainy"]
 
weather = input().rstrip()
weathernum = weatherlist.index(weather)
 
tomorrownum = (weathernum +1) % 3

print(weatherlist[tomorrownum])
s = input()
if s[2]==s[3] and s[4]==s[5]:
    print('Yes')
else:
    printt('No')

### FIXED CODE ###

s = input()
if s[2]==s[3] and s[4]==s[5]:
    print('Yes')
else:
    print('No')
a = int(input())
b = int(input())
if a % 2 == 0 or b % 2 == 0:
    print("even")
else:
    print("odd")


### FIXED CODE ###

a, b = map(int,input().split())
if a*b % 2 == 0:
    print("Even")
else:
    print("Odd")
a=str(input())
a.replace(a[3],"8")
prnit(a)

### FIXED CODE ###

print("2018"+input()[4:])
a, b = map(int, input().split())
print(a//b, a%b, "{10f}".format(a/b))


### FIXED CODE ###

a, b = map(int, input().split())
print("%d %d %.5f" % (a//b, a%b, a/b))
listA = [] #appendのために宣言が必要
while True:
    try:
        listA.append(list(map(int,input().split())))

    except:
        break;


field = []
# 縦幅
for(int i = 0; i < listA[0][0]; i++)
    field.appnd([])
    # 横幅
    for(int i = 0; i < listA[0][1]; i++)
        field[i].appnd(0)
        
for(int i = 0; i < listA[1][0]; i++)
    for(int j = 0; j < listA[1][1]; j++)
    field[i][j] = 1
    
cnt = 0
for item in field:
    for i in item:
        cnt++
        
print(cnt)

### FIXED CODE ###

listA = [] #appendのために宣言が必要
while True:
    try:
        listA.append(list(map(int,input().split())))

    except:
        break;

H = listA[0][0]
W = listA[0][1]
h = listA[1][0]
w = listA[1][1]

ans = (H - h) * (W - w)

print(ans)
import numpy as np
n=int(input())
a=np.ndarray([int(input()) for i in range(n)])
print(np.lcm.reduce(a))

### FIXED CODE ###

from functools import reduce, partial
from fractions import gcd
def lcm(a,b):
  return a*b//gcd(a,b)
n=int(input())
a=[int(input()) for i in range(n)]
lcmmulti = partial(reduce,lcm)
print(lcmmulti(a))
S=input()
n=len(S)
ans=0
for i in range(1<<(n-1)):
    for j in range(n):
        if 1&(i>>j):
            ans+=int(S[k:j+1])
            k=j+1
    ans+=int(S[k:])
        
print(ans)



### FIXED CODE ###

S=input()
n=len(S)
ans=0
for i in range(1<<(n-1)):
    k=0
    for j in range(n):
        if 1&(i>>j):
            ans+=int(S[k:j+1])
            k=j+1
    ans+=int(S[k:])
        
print(ans)
N = int(input())
a = list(map(int, input().split()))

avg = 0
for i in range(N):
    avg += a[i]
avg /= N

if round(avg) in a:
    print(a.index(round(avg)))
else:
    result = 100
    for i in range(N):
        temp = abs(avg-a[i])
        if temp <= result:
            result = temp
    print(a.index(round(result)))


### FIXED CODE ###

import numpy as np
N = int(input())
a = list(map(int, input().split()))

avg = 0
for i in range(N):
    avg += a[i]
avg /= N

idx = np.abs(np.asarray(a)-avg).argmin()
print(idx)
n = int(input())
a = list(map(int, input().split()))
res = 0
for i in range(1, n + 1, 2):
    if a[i] % 2 != 0:
        res += 1

print(res)


### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
res = 0
for i in range(0, n, 2):
    if a[i] % 2 != 0:
        res += 1

print(res)
n, m = map(int, input().split())

ans = [-1]*n
a = 0
for i in range(m):
    s, c = map(int, input().split())
    if s == 1 and c == 0 and n != 1:
        a = -1
    elif ans[s-1] not in [-1, c]:
        a = -1
    else:
        ans[s-1] = c

if a == -1:
    print(a)
else:
    b = ""
    if ans[0] == -1 and n != 1:
        ans[0] = 1
    for x in ans:
        if x == -1:
            b += "0"
        else:
            b += str(x)
    print(b)


### FIXED CODE ###

n = int(input())
print(n//2 + (1 if n % 2 else 0))
S = input()

r = 0
for i in range(3):
  if i == 0 and S[0] == 'R':
    r += 1
   elif i < 2:
    if S[i] == S[i+1]:
      r += 1

print(r)

### FIXED CODE ###

S = input()
r = 0

if S == "RRR":
  r = 3
elif S == "RRS" or S == "SRR":
  r = 2
elif S == "RSR" or S.count('R') == 1:
  r = 1
else:
  r = 0

print(r)
import sys

n, a, b, c = map(int, input().split())
S = [input() for _ in range(n)]


abc = {"A": a, "B": b, "C": c}
ans = []
for i, s in enumerate(S):
    u, v = s[0], s[1]
    if abc[u] == abc[v] == 0:
        print("No")
        sys.exit()
    elif abc[u] > abc[v]:
        abc[u] -= 1
        abc[v] += 1
        ans.append(v)
    elif abc[u] < abc[v]:
        abc[u] += 1
        abc[v] -= 1
        ans.append(u)
    else:
        if u in S[i+1]:
            abc[u] += 1
            abc[v] -= 1
            ans.append(u)
        elif v in S[i+1]:
            abc[v] += 1
            abc[u] -= 1
            ans.append(v)
print("Yes")
for ans_ in ans: print(ans_)

### FIXED CODE ###

import sys

n, a, b, c = map(int, input().split())
S = [input() for _ in range(n)]


abc = {"A": a, "B": b, "C": c}
ans = []
for i, s in enumerate(S):
    u, v = s[0], s[1]
    if abc[u] == abc[v] == 0:
        print("No")
        sys.exit()
    elif abc[u] > abc[v]:
        abc[u] -= 1
        abc[v] += 1
        ans.append(v)
    elif abc[u] < abc[v]:
        abc[u] += 1
        abc[v] -= 1
        ans.append(u)
    elif i == n-1:
        ans.append(u)
    else:
        if u in S[i+1]:
            abc[u] += 1
            abc[v] -= 1
            ans.append(u)
        elif v in S[i+1]:
            abc[v] += 1
            abc[u] -= 1
            ans.append(v)
print("Yes")
for ans_ in ans: print(ans_)
n=int(input())
a=list(map(int,input().split()))
b=a

s=0
for i in range(n):
  if b[i]>a[i+1]:
    s+=(a[i]-a[i+1])
    b[i+1]=b[i]
print(s,a,b)

### FIXED CODE ###

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

s=0
for i in range(n-1):
  if b[i]>a[i+1]:
    s+=(a[i]-a[i+1])
    b[i+1]=b[i]
print(s)
a,b = map(int, input().split())
flag=0
for i in range(10*b+1):
	if int(i * 0.08) == a and int(i * 0.1) == b:
		if flag==0:
			ans=i
            flag=1
if flag == 1:
	print(ans)
else:
	print(-1)

### FIXED CODE ###

a,b = map(int, input().split())
flag = 0
for i in range(10*b, 10*b+10):
	if int(i * 0.08) == a:
		if flag == 0:
			ans=i
			flag = 1
if flag == 1:
	print(ans)
else:
	print(-1)
from sys import stdin
def is_prime(n):
    if n == 1:
        return False
    for i in range(2,int(n**0.5)+1):
        if n % i == 0:
            return False
    return True

prime_list=[i for i in range(1,10001) if is_prime(i)]
oppai=[0]*10005
for i in range(2, 10001):
    if i in prime_list and (i+1)//2 in prime_list:
        oppai[i-1]=oppai[i-2]+1
    else:oppai[i-1]=oppai[i-2]
#print(oppai)
N=list(map(int,stdin.readline().strip().split()))[0]
for _ in range(N):
    count = 0
    a,b=map(int,(input().split()))
    if a==b:
        bb = oppai[b - 1]
        aa = oppai[a - 2]
        count = bb - aa
        print(count)
    else:
        if a>=2:
            bb=oppai[b-1]
            aa=oppai[a-2]
            count = bb - aa
            print(count)
        else:
            bb = oppai[b - 1]
            count = bb
            print(count)





### FIXED CODE ###

from sys import stdin
def is_prime(n):
    if n == 1:
        return False
    for i in range(2,int(n**0.5)+1):
        if n % i == 0:
            return False
    return True
prime_list=[i for i in range(2,100000) if is_prime(i)]
oppai=[0]*100000
oppai[1]=0
before=1
for num in prime_list:
    if (num+1)//2 in prime_list:
        oppai[before:num - 2] = [oppai[before]] * (num-1 - before)
        oppai[num-1]=oppai[before]+1
    else:oppai[before:num-1]=[oppai[before]]*(num-before)
    before=num-1
oppai[99991:99999]=[oppai[99990]]*8
N=list(map(int,stdin.readline().strip().split()))[0]
for _ in range(N):
    count = 0
    a,b=list(map(int,stdin.readline().strip().split()))
    if a==b:
        bb = (oppai[b - 1])
        aa = (oppai[a - 2])
        count = bb - aa
        print(count)
    else:
        if a>=2:
            bb = oppai[b - 1]
            aa = oppai[a - 2]
            count = bb - aa
            print(count)
        else:
            bb = oppai[b - 1]
            count = bb
            print(count)
n=int(input())
print(math.ceil(n/2)/n)

### FIXED CODE ###

import math
n=int(input())
print(math.ceil(n/2)/n)
str = input()
a = str[-1:]
if a == 3:
	result = "bon"
elif (a == 0) or (a == 1) or (a == 6) or (a == 8):
  	result = "pon"
elif (a == 2) or (a == 4) or (a == 5) or (a == 7) or (a == 9):
  	result = "hon"
    
print(result)


### FIXED CODE ###

str = input()
a = str[-1:]
if a == "3":
	result = "bon"
elif (a == "0") or (a == "1") or (a == "6") or (a == "8"):
  	result = "pon"
elif (a == "2") or (a == "4") or (a == "5") or (a == "7") or (a == "9"):
  	result = "hon"
else:
  	result = "ng"
    
print(result)
L=int(input())
max_vol=L**3/27

print(max_vol)

### FIXED CODE ###

N,M = map(int,input().split())
if((N<=1)&(M<=1)):
  num=0
else:
  num=int(N*(N-1)/2)+int(M*(M-1)/2)
print(num)
S = list(map(int, input().split()))
T = list(map(int, input().split()))
a=0
for i in range(3):
  if S[i]==T[i]:
    a+=1
print(a)

### FIXED CODE ###

S = input()
T = input()
a=0
for i in range(3):
    if S[i]==T[i]:
        a+=1
print(a)
h, w = map(int, input().split())
s = [list(input()) for _ in range(h)]

if h == 1 and w == 1:
    print(s[100000][100000])
    if s[0][0] == '.':
        print(1)
    else:
        print(0)
    exit()
elif h == 1:
    a = [0] * w
    mode = 0
    for i in range(w):
        if mode == 0:
            if s[0][i] == '.':
                c = 1
                a[i] = c
                mode = 1
        else:
            if s[0][i] == '.':
                c += 1
                a[i] = c
            else:
                mode = 0
    print(max(a))
    exit()
elif w == 1:
    b = [0] * h
    mode = 0
    for i in range(h):
        if mode == 0:
            if s[i][0] == '.':
                c = 1
                b[i] = c
                mode = 1
        else:
            if s[i][0] == '.':
                c += 1
                b[i] = c
            else:
                mode = 0
    print(max(b))
    exit()

exit()

a = [[0 for _ in range(w)] for _ in range(h)]
b = [[0 for _ in range(w)] for _ in range(h)]

c = 0

for i in range(h):
    mode = 0
    for j in range(w):
        if mode == 0:
            if s[i][j] == '.':
                c = 1
                a[i][j] = 1
                mode = 1
        else:
            if s[i][j] == '.':
                c += 1
                a[i][j] = c
            else:
                mode = 0

    for j in range(w-2, -1, -1):
        if a[i][j+1] > 0 and a[i][j] > 0:
            a[i][j] = a[i][j+1]

ans = 0

for j in range(w):
    mode = 0
    for i in range(h):
        if mode == 0:
            if s[i][j] == '.':
                c = 1
                b[i][j] = c
                mode = 1
        else:
            if s[i][j] == '.':
                c += 1
                b[i][j] = c
            else:
                mode = 0

    #print(b)

    for i in range(h-2, -1, -1):
        if b[i+1][j] > 0 and b[i][j] > 0:
            b[i][j] = b[i+1][j]
            ans = max(ans, a[i][j] + b[i][j] - 1)
        elif b[i][j] > 0:
            ans = max(ans, a[i][j] + b[i][j] - 1)

print(ans)


### FIXED CODE ###

h, w = map(int, input().split())
s = [list(input()) for _ in range(h)]

L = [[0 for _ in range(w)] for _ in range(h)]
R = [[0 for _ in range(w)] for _ in range(h)]
D = [[0 for _ in range(w)] for _ in range(h)]
U = [[0 for _ in range(w)] for _ in range(h)]

for i in range(h):
    if s[i][0] == '.':
        L[i][0] = 1
    for j in range(1, w):
        if s[i][j] == '.':
            L[i][j] = L[i][j-1] + 1
    if s[i][w-1] == '.':
        R[i][w-1] = 1
    for j in range(w-2, -1, -1):
        if s[i][j] == '.':
            R[i][j] = R[i][j+1] + 1

for j in range(w):
    if s[0][j] == '.':
        U[0][j] = 1
    for i in range(1, h):
        if s[i][j] == '.':
            U[i][j] = U[i-1][j] + 1
    if s[h-1][j] == '.':
        D[h-1][j] = 1
    for i in range(h-2, -1, -1):
        if s[i][j] == '.':
            D[i][j] = D[i+1][j] + 1

ans = 0
for i in range(h):
    for j in range(w):
        ans = max(ans, L[i][j] + R[i][j] + U[i][j] + D[i][j] - 3)

print(ans)
import math
import sys

sys.setrecursionlimit(10**9)
N = int(input())
A = list(map(int, input().split()))
A.sort()
mx = 10 ** 9
idx = 0
g = []
for i in range(N-1):
    tmp = math.gcd(A[i], A[i+1])
    #print(A[i], A[i+1], tmp)
    if tmp < mx:
        mx = tmp
        idx = i
    g.append([tmp, i])
g.sort(key=lambda x:x[0])
#print(g)
if N > 2:
    if g[0][1] + 1 == g[1][1]:
        A.remove(A[g[0][1]+1])
    else :
        tmp1 = math.gcd(A[g[0][1]], A[g[1][1]])
        tmp2 = math.gcd(A[g[0][1]+1], A[g[1][1]])
        A.remove(A[g[0][1]] if tmp1 < tmp2 else A[g[0][1]+1])
else :
    A = [max(A)]
tmp = A[0]
for i in A:
    tmp = math.gcd(i, tmp)
#import functools
#print(functools.reduce(math.gcd, A))
print(tmp)

### FIXED CODE ###

from fractions import gcd
N = int(input())
A = list(map(int, input().split()))

L = []
R = []
tl = A[0]
tr = A[-1]
for i in range(N):
  tl = gcd(tl, A[i])
  L.append(tl)
  tr = gcd(tr, A[N-1-i])
  R.append(tr)
mx = 1
R.reverse()
for i in range(N):
  tl = L[i-1] if i else R[i+1]
  tr = R[i+1] if i+1 < N else L[i-1]
  mx = max(mx, gcd(tl, tr))
print(mx)
def search_dist(g, dist, e):
    for b, c in g.get(e):
        if dist[b] < 10**16:
            continue
        dist[b] = dist[e] + c
        search_dist(g, dist, b)

def main():
    g = {}
    N = int(input())
    for _ in range(N-1):
        a, b, c = list(map(int, input().split(' ')))
        g[a] = g.get(a, []) + [(b, c)]
        g[b] = g.get(b, []) + [(a, c)]
    Q, K = list(map(int, input().split(' ')))
    dist = [10**16]*(N+1)
    dist[K] = 0
    search_dist(g, dist, K)
    for _ in range(Q):
        x, y = list(map(int, input().split(' ')))
        print(dist[x]+dist[y])

if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
sys.setrecursionlimit(int(1e5+10))

def search_dist(g, dist, e):
    for b, c in g.get(e):
        if dist[b] is not None:
            continue
        dist[b] = dist[e] + c
        search_dist(g, dist, b)

def main():
    g = {}
    N = int(input())
    for i in range(N+1):
        g[i] = []
    for _ in range(N-1):
        a, b, c = list(map(int, input().split(' ')))
        g[a] += [(b, c)]
        g[b] += [(a, c)]
    Q, K = list(map(int, input().split(' ')))
    dist = [None]*(N+1)
    dist[K] = 0
    search_dist(g, dist, K)
    cood = []
    for _ in range(Q):
        cood.append(list(map(int, input().split(' '))))

    for x, y in cood:
        print(dist[x]+dist[y])

if __name__ == '__main__':
    main()
n = int(input())
h = [int(i) for i in input().split()]
if h[0] != 1:
    h[0] -= 1
if len(h) == 1:
    print('Yes')
else:
    for i in range(1, n):
        if h[i - 1] < h[i]:
            h[i] -= 1
        elif h[i] < h[h - 1]:
            print('No')
            exit()
    print('Yes')


### FIXED CODE ###

n = int(input())
h = [int(i) for i in input().split()]
h[0] -= 1
flag = [True]
if len(h) == 1:
    print('Yes')
else:
    for i in range(1, n):
        if h[i] > h[i - 1]:
            h[i] -= 1
        elif h[i] < h[i - 1]:
            print('No')
            exit()
    print('Yes')
import sys

n, k = map(int, input().split())
a = sorted(list(map(int, input().split())))
#print(a)
fr = 0
ba = n+1

def check(mi):
    x = a[mi-1]
    if x >= k:
        return True
    #print(mi)
    dp = [False] * (k+1)
    dp[0] = True
    for i in range(n):
        if i == mi-1:
            continue
        y = a[i]
        for j in range(k, -1, -1):
            if j >= y:
                dp[j] = dp[j] | dp[j-y]

    if sum(dp[k-x:k]):
        return True
    else:
        return False

if not check(1):
    print(0)
    sys.exit()

if check(n+1):
    print(n)
    sys.exit()

while ba-fr > 1:
    mi = (ba+fr+1) // 2
    if check(mi):
        ba = mi
    else:
        fr = mi

print(fr)

### FIXED CODE ###

import sys

n, k = map(int, input().split())
a = sorted(list(map(int, input().split())))
#print(a)
fr = 0
ba = n+1

def check(mi):
    x = a[mi-1]
    if x >= k:
        return True
    #print(mi)
    dp = [False] * (k+1)
    dp[0] = True
    for i in range(n):
        if i == mi-1:
            continue
        y = a[i]
        for j in range(k, -1, -1):
            if j >= y:
                dp[j] = dp[j] | dp[j-y]

    if sum(dp[k-x:k]):
        return True
    else:
        return False

if check(1):
    print(0)
    sys.exit()

if not check(n):
    print(n)
    sys.exit()

while ba-fr > 1:
    mi = (ba+fr+1) // 2
    if check(mi):
        ba = mi
    else:
        fr = mi

print(fr)
s=input()+'T'
x,y=list(map(int,input().split()))
x+=8000
y+=8000
n=len(s)
i=0

while i<n and s[i]=='F':
    i+=1

dx=[[0]*16001 for _ in range(2)]
dy=[[0]*16001 for _ in range(2)]

dx[0][i+8000]=1
dy[0][8000]=1

lstx=[]
lsty=[]
d='x'
cnt=0

while i<n:
    if s[i]=='F':
        cnt+=1
    else:
        if cnt>0:
            if d=='x':
                lstx.append(cnt)
            else:
                lsty.append(cnt)
        
        if d=='x':
            d='y'
        else:
            d='x'
        cnt=0
    
    i+=1

for i,cx in enumerate(lstx):
    for j in range(16001):
        if dx[i%2][j]==0:
            continue
        if j+cx<16001:
            dx[(i+1)%2][j+cx]=1
        if j-cx>-1:
            dx[(i+1)%2][j-cx]=1

for i,cy in enumerate(lsty):
    for j in range(16001):
        if dy[i%2][j]==0:
            continue
        if j+cy<16001:
            dy[(i+1)%2][j+cy]=1
        if j-cy>-1:
            dy[(i+1)%2][j-cy]=1

if dx[len(lstx)][x]==1 and dy[len(lsty)][y]==1:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

s=input()+'T'
x,y=list(map(int,input().split()))
x+=8000
y+=8000
n=len(s)
i=0

while i<n and s[i]=='F':
    i+=1

dx=[[0]*16001 for _ in range(2)]
dy=[[0]*16001 for _ in range(2)]

dx[0][i+8000]=1
dy[0][8000]=1

lstx=[]
lsty=[]
d='x'
cnt=0

while i<n:
    if s[i]=='F':
        cnt+=1
    else:
        if cnt>0:
            if d=='x':
                lstx.append(cnt)
            else:
                lsty.append(cnt)
        
        if d=='x':
            d='y'
        else:
            d='x'
        cnt=0
    
    i+=1

for i,cx in enumerate(lstx):
    for j in range(16001):
        if dx[i%2][j]==0:
            continue
        if j+cx<16001:
            dx[(i+1)%2][j+cx]=1
        if j-cx>-1:
            dx[(i+1)%2][j-cx]=1
    dx[i%2]=[0]*16001

for i,cy in enumerate(lsty):
    for j in range(16001):
        if dy[i%2][j]==0:
            continue
        if j+cy<16001:
            dy[(i+1)%2][j+cy]=1
        if j-cy>-1:
            dy[(i+1)%2][j-cy]=1
    dy[i%2]=[0]*16001

if dx[(len(lstx))%2][x]==1 and dy[(len(lsty))%2][y]==1:
    print('Yes')
else:
    print('No')