Harryxun/stf_run huggingface dataset:
import itertools
import math
import string
import collections
from collections import Counter
from collections import deque
import sys
sys.setrecursionlimit(2*10**5)
INF = 2**60


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


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor


# coordinates
dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]

N, A = map(int, input().split())
x = readints()

sum = 0
for i in range(N):
    sum += x[i]

dp = [[[0]*(55) for _ in range(55)] for _ in range(3000)]
dp[0][0][0] = 1
for i in range(N):
    for j in range(N+1):
        for k in range(sum+2):
            dp[i+1][j][k] += dp[i][j][k]
            if k >= x[i]:
                dp[i+1][j+1][k] += dp[i][j][k-x[i]]
ans = 0
for j in range(1, N+1):
    ans += dp[N][j][j*A]
print(ans)


### FIXED CODE ###

import itertools
import math
import string
import collections
from collections import Counter
from collections import deque
import sys
sys.setrecursionlimit(2*10**5)
INF = 2**60


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


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor


# coordinates
dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]

N, A = map(int, input().split())
x = readints()

sum = 0
for i in range(N):
    sum += x[i]

dp = [[[0]*(3000) for _ in range(55)] for _ in range(55)]
dp[0][0][0] = 1
for i in range(N):
    for j in range(N+1):
        for k in range(2900):
            dp[i+1][j][k] += dp[i][j][k]
            if k >= x[i]:
                dp[i+1][j+1][k] += dp[i][j][k-x[i]]
ans = 0
for j in range(1, N+1):
    ans += dp[N][j][j*A]
print(ans)
N = int(input())
A = list(map(int,input().split()))
A.insert(0,0)
             
print(A)

for i in A:
    print(A.count(i+1))
   

### FIXED CODE ###

R = int(input())

print(R*6.2828)
from collections import Counter

def main(N, M, C):
    lst = [n for n in range(N)] # 初期値はすべてがそれぞれ根である状態

    def get_root(x):    # 根を得る関数
        if lst[x] == x: # それ自身が根である場合
            return x
        else:   # 根が別のものである場合
            # lst[x] = get_root(lst[x])   # 経路圧縮あり (ある種「メモ再帰化」)
            # return lst[x]
            return get_root(lst[x]) # 経路圧縮なし (わかりやすい，ただの再帰関数)

    def unite(x, y):    # 集合の連結を行う関数
        root_x = get_root(x)
        root_y = get_root(y)
        if root_x != root_y:    # 根が違う (=異なる集合) ならば
            lst[root_x] = root_y

    {unite(*c) for c in C}  # 集合の連結を行う．

    print(max(Counter(map(get_root, lst)).values()))


if __name__ == '__main__':
    N, M = list(map(int, input().split()))
    C = set()
    for _ in range(M):
        C.add(tuple(map(lambda x:int(x)-1, input().split())))   # pythonのindexに合わせるために "-1"
    main(N, M, C)

### FIXED CODE ###

from collections import Counter

# 再帰回数のエラー？と思われるので再帰上限を変更 10**3→10**9
import sys
sys.setrecursionlimit(10 ** 9)

def main(N, M, C):
    lst = [n for n in range(N)] # 初期値はすべてがそれぞれ根である状態

    def get_root(x):    # 根を得る関数
        if lst[x] == x: # それ自身が根である場合
            return x
        else:   # 根が別のものである場合
            lst[x] = get_root(lst[x])   # 経路圧縮あり (ある種「メモ再帰化」)
            return lst[x]
            # return get_root(lst[x]) # 経路圧縮なし (わかりやすい，ただの再帰関数)

    def unite(x, y):    # 集合の連結を行う関数
        root_x = get_root(x)
        root_y = get_root(y)
        if root_x != root_y:    # 根が違う (=異なる集合) ならば
            lst[root_x] = root_y

    {unite(*c) for c in C}  # 集合の連結を行う．

    print(max(Counter(map(get_root, lst)).values()))


if __name__ == '__main__':
    N, M = list(map(int, input().split()))
    C = set()
    for _ in range(M):
        C.add(tuple(map(lambda x:int(x)-1, input().split())))   # pythonのindexに合わせるために "-1"
    main(N, M, C)
numpy as np

H, W = map(int, input().split())
a = np.zeros(shape=(H, W), dtype=bool)
for i in range(H):
  a[i] = [s == "." for s in input()]

y = [True] * H
for i in range(H):
  if all(a[i,:]):
    y[i] = False

x = [True] * W
for i in range(W):
  if all(a[:,i]):
    x[i] = False

ans = []
for i in range(H):
  if not y[i]:
    continue
  s = ""
  for j in range(W):
    if not x[j]:
      continue
    s = "".join([s, "." if a[i,j] else "#"])
  ans.append(s)

print(*ans, sep="\n")


### FIXED CODE ###

import numpy as np

H, W = map(int, input().split())
a = np.zeros(shape=(H, W), dtype=bool)
for i in range(H):
  a[i] = [s == "." for s in input()]

y = [True] * H
for i in range(H):
  if all(a[i,:]):
    y[i] = False

x = [True] * W
for i in range(W):
  if all(a[:,i]):
    x[i] = False

ans = []
for i in range(H):
  if not y[i]:
    continue
  s = ""
  for j in range(W):
    if not x[j]:
      continue
    s = "".join([s, "." if a[i,j] else "#"])
  ans.append(s)

print(*ans, sep="\n")
import heapq
I = list(map(int,input().split()))
N = I[0]
M = I[1]
A = list(map(lambda x:-x,map(int,input().split())))
heapq.heapify(A)
for i in range(M):
    num = heapq.heappop(A)
    num = math.ceil(num / 2)
    heapq.heappush(A,num)

print(-sum(A))

### FIXED CODE ###

import heapq
import math
I = list(map(int,input().split()))
N = I[0]
M = I[1]
A = list(map(lambda x:-x,map(int,input().split())))
heapq.heapify(A)
for i in range(M):
    num = heapq.heappop(A)
    num = math.ceil(num / 2)
    heapq.heappush(A,num)

print(-sum(A))
A, B = map(int, input().split())

# 電源タップの個数をa, 差込口の個数をnumとおく 
a = 0
num = 1
while num < B:
  num -= 1
  num += a
  ans += 1

print(a)

### FIXED CODE ###

import math
A, B = map(int, input().split())
 
# A*x-(x-1) >= B
# (A-1)*x >= B-1
# x >= ceil((B-1)/(A-1))
print(math.ceil((B-1)/(A-1)))
import sys
N, M = map(int, input().split())
line = []
for i in range(M):
  line.append([int(i) for i in input().split()])
for i in range(10 ** N):
  i_keta = [i // 100, (i % 100) // 10, i % 10]
  correct = True
  for test in line:
    s = test[0]
    c = test[1]
    if s == 1:
      if N >= 2:
        if i_keta[3 - N] == 0 or i_keta[3 - N] != c:
          correct = False
          break
      elif i_keta[2] != c:
        correct = False
        break
    else:
      if i_keta[s - N + 2] != c:
        correct = False
        break
  if correct:
    if N >= 2 and i_keta[3 - N] != 0:
      print(i)
      sys.exit(1)
    elif N == 1:
      print(i)
      sys.exit(1)
print(-1)

### FIXED CODE ###

from sys import exit
N, M = map(int, input().split())
line = []
for i in range(M):
  line.append([int(i) for i in input().split()])
for i in range(10 ** N):
  i_keta = [i // 100, (i % 100) // 10, i % 10]
  correct = True
  for test in line:
    s = test[0]
    c = test[1]
    if s == 1:
      if N >= 2:
        if i_keta[3 - N] == 0 or i_keta[3 - N] != c:
          correct = False
          break
      elif i_keta[2] != c:
        correct = False
        break
    else:
      if i_keta[s - N + 2] != c:
        correct = False
        break
  if correct:
    if N >= 2 and i_keta[3 - N] != 0:
      print(i)
      exit()
    elif N == 1:
      print(i)
      exit()
print(-1)
import itertools

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

price = 0
count = 0
for i in range(A + 1):
    for j in range(B + 1):
        for k in range(C + 1):
            price = i * 500 + j * 100 + k * 50
            if price == X:
                count += 1
            price = 0

print(count)



### FIXED CODE ###

A = int(input())
B = int(input())
C = int(input())
X = int(input())
 
count = 0
for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            if i*500 + j*100 + k*50 == X:
                count += 1
 
print(count)
print("Yes)

### FIXED CODE ###

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

check=True
Ainc=True
Binc=True
ABinc=True
A.sort()
B.sort()

for i in range(N):
    if A[i][0]>B[i][0]:
        check=False
    if i>0:
        if A[i-1]==A[i]:
            Ainc=False
        if B[i-1]==B[i]:
            Binc=False
        if B[i-1]>=A[i]:
            ABinc=False

if not check:
    print("No")
else:
    if (not Ainc) or (not Binc) or (not ABinc):
        print("Yes")
    else:
        edge=[[] for i in range(N)]
        for i in range(N):
            edge[A[i][1]].append(B[i][1])

        que=[0]
        while True:
            v=que[-1]
            nv=edge[v][0]
            if nv==0:
                break
            else:
                que.append(nv)
        if len(que)==N:
            print("No")
        else:
            print("Yes")
import sys
input = sys.stdin.readline
N = int(input())


node = [0 for i in range(N)]
neigh = [[] for j in range(N)]
ans = [0 for i in range(N)]
visited = [0 for i in range(N)]
k = 1

for i in range(N-1):
    ai,bi = map(int,input().split())
    node[ai-1] += 1
    node[bi-1] += 1
    neigh[ai-1].append(bi-1)
    neigh[bi-1].append(ai-1)
c = list(map(int,input().split()))
c.sort(reverse=True)
flag = False
def dfs(neighbor,start):
    global flag
    global k
    if sum(visited) == N:
        return 0

    for i in neighbor[start]:
        
        if visited[i] == 0:
            ans[i] = c[k]
            k += 1
            visited[i] = 1
            try:
                dfs(neighbor,i)
            except SystemError:
                flag = True
                return 0




m = max(node)
nn = node.index(m)
#nn = [node[i] for i in range(N) if node[i] == m][0]
visited[nn] = 1
ans[nn] = max(c)
"""
if N == 9999:
    print(100)
    print(' '.join([str(i) for i in range(N)]))
    exit()
"""
dfs(neigh,nn)
if flag:
    print(100)
    print(' '.join([str(i) for i in range(N)]))
    exit()
ans2 = ' '.join([str(ans[i]) for i in range(N)])


print(sum(c)-max(c))
print(ans2)


### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
N = int(input())


node = [0 for i in range(N)]
neigh = [[] for j in range(N)]
ans = [0 for i in range(N)]
visited = [0 for i in range(N)]
k = 1

for i in range(N-1):
    ai,bi = map(int,input().split())
    node[ai-1] += 1
    node[bi-1] += 1
    neigh[ai-1].append(bi-1)
    neigh[bi-1].append(ai-1)
c = list(map(int,input().split()))
c.sort(reverse=True)
flag = False
def dfs(neighbor,start):
    global flag
    global k
    if sum(visited) == N:
        return 0

    for i in neighbor[start]:
        
        if visited[i] == 0:
            ans[i] = c[k]
            k += 1
            visited[i] = 1
            try:
                dfs(neighbor,i)
            except RuntimeError:
                flag = True
                return 0




m = max(node)
nn = node.index(m)
#nn = [node[i] for i in range(N) if node[i] == m][0]
visited[nn] = 1
ans[nn] = max(c)

dfs(neigh,nn)
"""
if flag:
    print(100)
    print(' '.join([str(i) for i in range(N)]))
    exit()
"""
ans2 = ' '.join([str(ans[i]) for i in range(N)])


print(sum(c)-max(c))
print(ans2)
N=int(input())
A=list(map(int,input().split()))
i=0
cnt=0
while(i<N):
    if(A[i]==i+1):
        A[i],A[i+1]=A[i+1],A[i]
        cnt+=1
        i+=2
        continue
    i+=1
print(cnt)

### FIXED CODE ###

N=int(input())
A=list(map(int,input().split()))
i=0
cnt=0
while(i<N):
    if(A[i]==i+1):
        if(i!=N-1):
            A[i],A[i+1]=A[i+1],A[i]
        cnt+=1
        i+=2
        continue
    i+=1
print(cnt)
N,W=map(int,input().split())
lst=[-1]*(W+1)
lst[0]=0

for i in range(N):
    w,v=map(int,input().split())
    for i in range(W-w,-1,-1):
        if lst[i]!=-1:
            Value=lst[i]+v
            if Value>lst[i+w]:
                lst[i+w]=Value

print(max(lst))

### FIXED CODE ###

N,W=map(int,input().split())
w1,v=map(int,input().split())
if w1>W:
    print(0)
    exit()
lst=[[-1]*(3*N-2) for _ in range(N)]
lst[0][0]=v
for i in range(N-1):
    w,v=map(int,input().split())
    for j in range(N-1,-1,-1):
        for k in range(3*N-2):
            if lst[j][k]!=-1:
                if (j+1)*w1+k+w<=W:
                    lst[j+1][k+w-w1]=max(lst[j][k]+v,lst[j+1][k+w-w1])
    lst[0][w-w1]=max(v,lst[0][w-w1])

lst=[i for j in lst for i in j]
print(max(lst))
import math
r=int(input())
l=math.pi*r*2
s=(r**2)*math.pi
print("{0:6f} {1:6f}".format(l, s))

### FIXED CODE ###

import math
r=float(input())
l=math.pi*r*2
s=(r**2)*math.pi
print("{1:6f} {0:6f}".format(l, s))
target = int(input())

s = 0

m,s = divmod(target,60)
if m == 0:
    print("0:0:%d" % s)
else
    h, m = divmod(m,60)
    print("%d:%d:%d" % (h,m,s))

### FIXED CODE ###

target = int(input())

m,s = divmod(target,60)
if m == 0:
    print("0:0:%d" % s)
else:
    h, m = divmod(m,60)
    print("%d:%d:%d" % (h,m,s))
import math
A,B,C,D = map(int, input().split())

A = A-1
c_and_d=C*D
#CとDの最小公倍数を求める
lcm = int(C*D/math.gcd(C,D))
# print('最小公倍数:',lcm)

count_C =0
count_D =0
count_C_and_D =0

count_C = int(B/C)-int(A/C)
count_D = int(B/D)-int(A/D)
count_C_and_D = int(B/lcm)-int(A/lcm)
A = A+1
print((B-A+1) -(count_C + count_D - count_C_and_D))

### FIXED CODE ###

import fractions

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


c_and_d=C*D
#CとDの最小公倍数を求める
lcm = int(C*D//fractions.gcd(C,D))


count_C =0
count_D =0
count_C_and_D =0

count_C = int(B//C)-int((A-1)//C)
count_D = int(B//D)-int((A-1)//D)
count_C_and_D = int(B//lcm)-int((A-1)//lcm)

print(int((B-A+1) -(count_C + count_D - count_C_and_D)))
S=input()
print('No' if S=='AAA' or S==='BBB' else 'Yes')

### FIXED CODE ###

S=input()
print('No' if S=='AAA' or S=='BBB' else 'Yes')
n, _ = input().split(' ')
o = set([d for d in range(10)])
d = set([int(t) for t in input().split(' ')])
o = list(o.difference(d))
o.sort()
ans = []
for t in n:
    t = int(t)
    for tt in o:
        if tt >= t:
            ans.append(tt)
            break
    else:
        ans.append(o[0])

if int(''.join(map(str,ans))) < int(n):
    ans.insert(0, o[0] if o[0] != 0 else o[1])

print(''.join(map(str,ans)))

### FIXED CODE ###

n = map(int, input().split(' '))
cnt1 = 0
cnt2 = 0
for t in n:
    if t == 5:
        cnt1 += 1
    if t == 7:
        cnt2 += 1

if cnt1 == 2 and cnt2 == 1:
    print('YES')
else:
    print('NO')
A = list(map(int, input().split()))
if A[0] * 500 >= A[1]:
  print("Yes")
  else:
    print("No")

### FIXED CODE ###

A = list(map(int, input().split()))
if A[0] * 500 >= A[1]:
  print("Yes")
else:
  print("No")
x = list(map(int,input().split()))
h = x[0]
w = x[1]
can = list()
for i in range(h):
    y = input()
    can.append(y)
z = 0
for i in range(h):
    for j in range(w):
        if can[i][j] == "#":
            if i > 0:
                if can[i - 1][j] == "#":
                    break
            if i < h - 1:
                if can[i + 1][j] == "#":
                    break
            if j > 0:
                if can[i][j - 1] == "#":
                    break
            if j < w - 1:
                if can[i][j + 1] == "#":
                    break
            z += 1
if z == 0:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

x = list(map(int,input().split()))
a = x[0]
b = x[1]
y = a - 1
if b >= a:
    y += 1
print(y)
N,K,*A = map(int, open(0).read().split())

def left(i, d):
    if not (0 <= i < N):
        return 0
    v = A[i] - d + 0.5
    if v <= 0:
        return 0 + left(i - 1, d + 1)
    else:
        return 1 + left(i - 1, d + 1)

def right(i, d):
    if not (0 <= i < N):
        return 0
    v = A[i] - d + 0.5
    if v <= 0:
        return 0 + right(i + 1, d + 1)
    else:
        return 1 + right(i + 1, d + 1)

for _ in range(K):
    X = [0 for _ in range(N)]
    for i in range(N):
        l = left(i-1, 1)
        r = right(i+1, 1)
        c = 1 + l + r
        X[i] = c
    if A == X:
        print(" ".join(map(str, A)))
        exit(0)
    A = X

print(" ".join(map(str, A)))

### FIXED CODE ###

N,K,*A = map(int, open(0).read().split())
                                         
for _ in range(K):                       
    b = [0] * N                          
    for i, d in enumerate(A):            
        b[max(0, i-d)] += 1              
        if i+d+1 < N:                    
            b[i+d+1] -= 1                
    for i in range(1, N):                
        b[i] += b[i-1]                   
    if A == b:                           
        break                            
    A = b                                
                                         
print(" ".join(map(str, A)))
H, N = map(int, input().split())

List = map(int, input().split())

total = 0
for l in len(List):
  total += List[l]
  
if H > total:
  print('No')
  
elif H <= total:
  print('Yes')

### FIXED CODE ###

H, N = map(int, input().split())
 
List = list(map(int, input().split()))
 
total = 0
for l in range(len(List)):
  total += List[l]
  
if H > total:
  print('No')
  
elif H <= total:
  print('Yes')
A = int(input())
ls = [int(input())%2 for i in range(A)]
if ls.count(1) % 2 == 1 or (A % 2 == 0 and s.count(1) % 2 == 0):
    print("first")
else:
    print("second")

### FIXED CODE ###

A = int(input())
ls = [int(input())%2 for i in range(A)]
if ls.count(1) != 0:
    print("first")
else:
    print("second")
n = input()
words_org = []
for i in range(int(n)):
  words_org.append(input())

countDic = { k: words_org.count(k) for k in set(words_org) }
ranking = sorted([item for item in countDic.items()], key = lambda x:x[1], reverse=True)
order = 0
top = ranking[0][1]
candidates = []
while ranking[order][1] == top:
  candidates.append(ranking[order][0])
  order += 1
for word in sorted(candidates):
  print(word)


### FIXED CODE ###

N = input()
dic = {}
max = 0
for i in range(int(N)):
  word = input()
  if word not in dic.keys():
    
    if max == 0:
      max += 1
    dic[word] = 1
    
  else:
    
    if max == dic[word]:
      max += 1
    dic[word] += 1

candidates = sorted([word for word in dic.keys() if dic[word] == max])
for word in candidates:
  print(word)
A, B = map(int, input().split())
S = input()
s1, s2 = S.split("-")
if len(s1) == A and len(s2) == B:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

A, B = map(int, input().split())
S = input()
s = S.split("-")
if len(s) != 2:
    print("No")
    exit()
if len(s[0]) == A and len(s[1]) == B:
    print("Yes")
else:
    print("No")
s = input()
k = int(input())
sl = []
if len(s) > 1:
    for i in range(len(s)-1):
        for j in range(i, len(s)+1):
            s_part = s[i:j]
            if s_part not in set(sl) and s_part != "":
                sl.append(s_part)
    sll = sorted(sl)
    print(sll[k-1])
else:
    print(s)

### FIXED CODE ###

s = input()
l = int(input())
char = []
if len(s) == 1:
    print(s)
else:
    for i in range(len(s)):
        char.append(s[i])
    charset = set(char)
    ans = []
    for i in charset:
        for j in range(len(s)):
            if i == s[j]:
                for k in range(1, 6):
                    ans.append(s[j:j+k])
    ansset = sorted(list(set(ans)))
    print(ansset[l-1])
given = input()
a = int(given) // 2
count = 0
for i in range(1, a + 1):
    last = given[-i]
    first = given[i - 1]
    if last != first:
        count += 1
print(count)

### FIXED CODE ###

s = input()
l = list(s)
i = 0
j = len(l)-1
cnt = 0
while(i < j):
    if l[i] != l[j]:
        cnt = cnt+1

    i = i+1
    j = j-1

print(cnt)
N, A, B = list(map(int, input().split()))
H = [int(input()) for _ in range(N)]

from math import ceil

def can_korosu(t):
    count = 0
    for h in H:
        count += ceil(max(0, h - t*B)/(A-B))
        if count > t:
            return False
    return True

lo = 0
hi = 10**9

p = (lo, hi)
for _ in range(50):
    mid = (hi + lo) // 2
    if can_korosu(mid):
        hi = mid
    else:
        lo = mid
    if p == (lo, hi):
        break
    p = (lo, hi)
print(hi)

### FIXED CODE ###

a, b = map(int, input().split())
if a+b < 10:
    print(a+b)
else:
    print("error")
#!/usr/bin/env python

def func():
    n,m = [int(i) for i in input().split(" ")]
    pibot = 10**(m-1)
    dic = {}

    for i in range(m):
        tmp = [int(i) for i in input().split(" ")]

        if tmp[0] not in dic.keys():
            dic[tmp[0]] = tmp[1]
        else:
            if dic[tmp[0]] != tmp[1]:
                print("-1")
                return

    a = [0] * m
    for key in dic.keys():
        a[key-1] = dic[key]

    tmp_s = ""
    for i in a:
        tmp_s += str(i)

    if int(tmp_s) < pibot:
        tmp_s = "-1"

    print(tmp_s)

if __name__ == "__main__":
    func()

### FIXED CODE ###

#!/usr/bin/env python

import math

n = int(input())
print(math.ceil(n/2))
a,b,c=map(int,input().split())
if a+b=>c:
	print('Yes')
else:
	print('No')

### FIXED CODE ###

a,b,c=map(int,input().split())
if a+b>=c:
	print('Yes')
else:
	print('No')
# -*- coding: utf-8 -*-
def check(s, x, y, xx, yy, dire):
  if len(s) > 0:
    i = 0
    for command in s:
      i += 1
      if command == "F":
        xx += dire[0]
        yy += dire[1]
      else:
        if dire[0] != 0:
          if check(s[i:], x, y, xx, yy, [0, 1]) == 1:
            return 1
          if check(s[i:], x, y, xx, yy, [0, -1]) == 1:
            return 1
        elif dire[1] != 0:
          if check(s[i:], x, y, xx, yy, [1, 0]) == 1:
            return 1
          if check(s[i:], x, y, xx, yy, [-1, 0]) == 1:
            return 1
        return 0
  if xx == x and yy == y:
    return 1
  return 0


s = input()
x, y = map(int, input().split())
xx, yy = 0, 0
dire = [1, 0] #右1左-1,上1下-1
res = check(s, x, y, xx, yy, dire)
if res == 1:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

# -*- coding: utf-8 -*-
def check(z, zz, z_list):
  if len(z_list) == 0:
    if z != zz:
      return 0
    else:
      return 1
  else:
    z_n = len(z_list)
    z_hash = {}
    z_hash[0] = {}
    z_hash[0][zz] = 1
    z_hash[z_n] = {}
    z_hash[z_n][z] = 1
    for i in range(0,z_n):
      if i+1 not in z_hash:
        z_hash[i+1] = {}
        for b_z in z_hash[i]:
          a_z = b_z + z_list[i]
          z_hash[i+1][a_z] = 1
          a_z = b_z - z_list[i]
          z_hash[i+1][a_z] = 1
      else:
        for b_z in z_hash[i]:
          a_z = b_z + z_list[i]
          if a_z in z_hash[i+1]:
            return 1
          a_z = b_z - z_list[i]
          if a_z in z_hash[i+1]:
            return 1
        return 0
      if z_n-i-1 not in z_hash:
        z_hash[z_n-i-1] = {}
        for a_z in z_hash[z_n-i]:
          b_z = a_z + z_list[z_n-i-1]
          z_hash[z_n-i-1][b_z] = 1
          b_z = a_z - z_list[z_n-i-1]
          z_hash[z_n-i-1][b_z] = 1
      else:
        for a_z in z_hash[z_n-i]:
          b_z = a_z + z_list[z_n-i-1]
          if b_z in z_hash[z_n-i-1]:
            return 1
          b_z = a_z - z_list[z_n-i-1]
          if b_z in z_hash[z_n-i-1]:
            return 1
        return 0



s = input()
x, y = map(int, input().split())
data = s.split("T")
xx, yy = 0, 0
i = 0
x_list = []
y_list = []
for Fs in data:
  if len(Fs) == 0:
    i += 1
  else:
    if i == 0:
      xx = len(Fs)
    elif i % 2 == 0:
      x_list.append(len(Fs))
    else:
      y_list.append(len(Fs))
    i += 1
if check(x, xx, x_list) == 1 and check(y, yy, y_list) == 1:
  print("Yes")
else:
  print("No")
X, Y = map(int, input().split())
A = x
B = 0
if Y % 2 != 0:
  print("NO")
else:
  while A >= 0:
    C = A*2 + B*4
    if C == Y:
      print("YES")
      quit()
     A -=1
     B +=1
  print("NO")

### FIXED CODE ###

x, y = map(int, input().split())
b = 0
if y % 2 != 0:
  print("No")
  quit()
else:
  while x >= 0:
    c = x * 2 + b * 4
    if c == y:
      print("Yes")
      quit()
    x -=1
    b +=1
print("No")
A,B = map(int,input().split())
     
    ans = 0
    if B / A == 1:
        ans = 1
    else:
        ans = 1 + -(-(B - A) // (A - 1))
    print(ans)

### FIXED CODE ###

S = input()
T = input()

ret = 0
for i in range(3):
    if S[i] == T[i]:
        ret += 1
print(ret)