Harryxun/stf_run huggingface dataset:
n, m = map(int, input().split())
array = [[int(x) for x in input().split()] for y in range(m)]
modify = [[] for x in range(m + 1)]

for value1, value2 in array:
    modify[value1].append(value2)
    modify[value2].append(value1)


def solver(start, array, visited, cnt):
    if visited[start]:
        return cnt
    else:
        visited[start] = True

    for i in array[start]:
        if len(set(visited)) == 1:
            return cnt+1
        else:
            cnt = solver(i, array, list(visited), cnt)

    return cnt



start = modify[1]
res = 0
for i in start:
    visited = [False if x != 0 and x != 1 else True for x in range(m + 1)]
    res += solver(i, modify, visited, 0)

print(res)


### FIXED CODE ###

import sys

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

array = [[int(x) for x in input().split()] for x in range(m)]

if m == 0:
    print(0)
    sys.exit()

adj_array = [[] for x in range(n + 1)]
res_array = [True] + [False for x in range(n)]
for item in array:
    adj_array[item[0]].append(item[1])
    adj_array[item[1]].append(item[0])


def dfs(n, res_array, res):
    res_array[n] = True
    if False not in res_array:
        return res+1
    else:
        for next in adj_array[n]:
            if not res_array[next]:
                res = dfs(next, list(res_array), res)
    return res


res = 0
res_array[1] = True
print(dfs(1, res_array, res))
A, B = list(map(int, input().split()))

while 1:
  if (A-1)*i + 1 >= B:
    print(i)
    quit()

### FIXED CODE ###

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

i = -1
while 1:
  i += 1
  if (A-1)*i + 1 >= B:
    print(i)
    quit()
a=input()
print(3*a*a)


### FIXED CODE ###

a=int(input())
print(3*a*a)
S = input()
K = input()
if len(K) > 100:
    K = 110
else:
    K = int(K)


def main():
    if S[0] != '1':
        print(S[0])
        return

    i = 0
    while S[i] == '1':
        i += 1

    if K < i:
        print('1')
        return

    print(S[i])


if __name__ == '__main__':
    main()


### FIXED CODE ###

S = input()
K = input()
if len(K) > 100:
    K = 110
else:
    K = int(K)


def main():
    if S[0] != '1':
        print(S[0])
        return

    for i in range(len(S)):
        if S[i] != '1':
            break

    if i == len(S) - 1:
        print('1')
        return

    if K <= i:
        print('1')
        return

    print(S[i])


if __name__ == '__main__':
    main()
int x,y = input().split()
print(x * y + " " + (x + y) / 2)

### FIXED CODE ###

x,y = map(int, input().split())
print(x * y, (x + y) * 2)
count=0
n=int(input())
while n%2=!1:
  n=n/2
  count+=1
print(count)

### FIXED CODE ###

n=int(input())
i=1
if n==1:
  print(1)
else:
  while n>=2**i:
  	i+=1
  print(2**(i-1))
s=input()
t=input()
for i in len(s):
  tmp=s[i:]+s[:i]
  if tmp==t:
    print('Yes')
    exit()
print('No')

### FIXED CODE ###

s=input()
t=input()
for i in range(len(s)):
  tmp=s[i:]+s[:i]
  if tmp==t:
    print('Yes')
    exit()
print('No')
s,t = input().split()
sn,tn = map(int,input().split())
u  = input()

if s == u:
    print((sn-1) + ' '+ tn)
else:
    print(sn + ' ' + (tn-1))

### FIXED CODE ###

s,t = input().split()
sn,tn = map(int,input().split())
u  = input()

if s == u:
    print(str(sn-1) + ' '+ str(tn))
else:
    print(str(sn) + ' ' + str(tn-1))
#入力部
C= 998244353
N,M,K=map(int,input().split())

#定義部
F=[0]*(2*10**5)
G=[0]*(2*10**5)

F[0]=1
for i in range(1,N):
    F[i]=(F[i-1]*i)%C

G[i]=pow(F[-1],C-2,C)

for j in range(N-2,-1,-1):
    G[j]=(G[j+1]*(j+1))%C

def nCr(n,r):
    if r<0 or n<r:
        return 0
    else:
        return (F[n]*G[r]*G[n-r])

#メイン部
S=0
for k in range(0,K+1):
    S=(S+M*pow(M-1,N-k-1,C)*nCr(N-1,k))%C
    
print(S%C)


### FIXED CODE ###

#入力部
C= 998244353
N,M,K=map(int,input().split())

#定義部
U=max(N+1,K)
F=[0]*U
G=[0]*U

F[0]=1
for i in range(1,U):
    F[i]=(F[i-1]*i)%C

G[i]=pow(F[-1],C-2,C)

for j in range(U-2,-1,-1):
    G[j]=(G[j+1]*(j+1))%C

def nCr(n,r):
    if r<0 or n<r:
        return 0
    else:
        return (F[n]*G[r]*G[n-r])

#メイン部
S=0
for k in range(0,K+1):
    S=(S+M*pow(M-1,N-k-1,C)*nCr(N-1,k))%C
    
print(S%C)
while True:
	n = int(input())
	if n == 0:
	    break
	s = []
    s = list(input().split())
	while True:
		t = []
        u = 0
    	v = 0
		for i in range(n):
			for j in range(n):
				if s[i] == s[j]:
					u += 1
			t.append(u)
			t_str = list(map(str, t))
			u = 0
		if s == t:
			print(str(v))
			print(" ".join(t_str))
			break
		else:
			s = t
			v += 1

### FIXED CODE ###

while True:
	n = int(input())
	if n == 0:
	    break
	s = []
	u = 0
	v = 0
	s = list(map(int, input().split()))
	while True:
		t = []
		for i in range(n):
			for j in range(n):
				if s[i] == s[j]:
					u += 1
			t.append(u)
			t_str = list(map(str, t))
			u = 0
		if s == t:
			print(str(v))
			print(" ".join(t_str))
			break
		else:
			s = t
			v += 1
#n = int(input())
#L = list(map(int, input().split()))
import math
import sys
import fractions
N = int(input())
if N >1:
    sum = N*(N-1)/2
elif N = 1:
    sum = 1
else:
    sum = 0
sum = int(sum)
print(sum)


### FIXED CODE ###

#n = int(input())
#L = list(map(int, input().split()))
import math
import sys
import fractions
N = int(input())
print(N*(N-1)//2)
N=int(input())
P=list(map(int,input().split()))
cnt=1
x=[]
i=0
while True:
  max=P[0]
  if max>=P[i+1]:
    cnt+=1
    max=P[i+1]
  i+=1
  if max==1:
    break
print(cnt)
    

### FIXED CODE ###

n = int(input())
p_n = list(map(int, input().split()))
ans = 1
p_i_1 = [p_n[0]]
m = p_n[0]
for i in range(1, n):
    if m > p_n[i]:
        ans += 1
    m = min(m, p_n[i])
    p_i_1.append(p_n[i])
    if m == 1:
        break
print(ans)
import numpy as np
n,m = list(map(int, input().split()))
tmp_a = [list(input()) for _ in range(n)]
tmp_b = [list(input()) for _ in range(m)]

a = np.array(tmp_a)
b = np.array(tmp_b)

for a_i in range(n - m + 1):
	for a_j in range(n - m + 1):
		if((a[a_i:a_i + m, a_j:a_j + m] == b).all()):
			print("Yes")
			exit()
print("No")

### FIXED CODE ###

import numpy as np
n,m = list(map(int, input().split()))
tmp_a = [list(input()) for _ in range(n)]
tmp_b = [list(input()) for _ in range(m)]

a = np.array(tmp_a)
b = np.array(tmp_b)

for a_i in range(n - m + 1):
	for a_j in range(n - m + 1):
		if((a[a_i:a_i + m, a_j:a_j + m] == b).all()):
			print("Yes")
			exit()
print("No")
N, W = map(int, input().split())
# dp[i][j] : i日めにjをした。(j=0:持つ, j=1:持たない)
dp = [[0] * 10010 for _ in range(N+1)]
for i in range(N):
    w_i, v_i = map(int, input().split())
    for w in range(W+1):
        if w >= w_i:
            dp[i+1][w] = max(dp[i][w-w_i]+v_i, dp[i][w])
        else:
            dp[i+1][w] = dp[i][w]

print(dp[N][W])


### FIXED CODE ###

N, W = map(int, input().split())
# dp[i][w] : i個目の時の重さwの最大値
dp = [[0] * 100010 for _ in range(N+1)]
for i in range(N):
    w_i, v_i = map(int, input().split())
    for w in range(W+1):
        if w >= w_i:
            dp[i+1][w] = max(dp[i][w-w_i]+v_i, dp[i][w])
        else:
            dp[i+1][w] = dp[i][w]

print(dp[N][W])
def sort(str_list):
  for i in range(len(str_list) - 1):
    string = str_list[i]
    for j in range(i + 1, len(str_list)):
      next_string = str_list[j]
      for k in range(len(string)):
        if ord(string[k]) > ord(next_string[k]):
          temp = string
          str_list[i] = next_string
          str_list[j] = temp
          break
        elif ord(string[k]) == ord(next_string[k]):
          continue
        else:
          break
  ans = ""
  for i in str_list:
    ans += i
  return ans
 
line1 = input().split()
n = line1[0]
l = line1[1]
str_list = []
for i in range(n):
  str_list.append(input())
print(sort(str_list))
  
def sort(str_list):
  for i in range(len(str_list) - 1):
    string = str_list[i]
    for j in range(i + 1, len(str_list)):
      next_string = str_list[j]
      for k in range(len(string)):
        if ord(string[k]) > ord(next_string[k]):
          temp = string
          str_list[i] = next_string
          str_list[j] = temp
          break
        elif ord(string[k]) == ord(next_string[k]):
          continue
        else:
          break
  ans = ""
  for i in str_list:
    ans += i
  return ans

line1 = input().split()
n = int(line1[0])
l = line1[1]
str_list = []
for i in range(n):
  str_list.append(input())
print(sort(str_list))

### FIXED CODE ###

def order(str1, str2):
  for i in range(len(str1)):
    if ord(str1[i]) > ord(str2[i]):
      return False
    elif ord(str1[i]) == ord(str2[i]):
      continue
    else:
      return True
 
def sort(str_list):
  for i in range(len(str_list) - 1):
    for j in range(i + 1, len(str_list)):
      if not order(str_list[i], str_list[j]):
        temp = str_list[i]
        str_list[i] = str_list[j]
        str_list[j] = temp
  ans = ""
  for i in str_list:
    ans += i
  return ans
 
line1 = input().split()
n = int(line1[0])
l = line1[1]
str_list = []
for i in range(n):
  str_list.append(input())
print(sort(str_list))
n,m= map(int, input().split())
a = [int(input()) for _ in range(m)]
dp=[0]*(n+1)
dp[0]=1
j=0

for i in range(1,n+1):
    if i==a[j]:
        if j<m-1:
            j+=1
    else:
        if i==1:
            dp[i]=1
        else:
            dp[i]=dp[i-1]+dp[i-2]

print(dp[n]%(10**9+7))

### FIXED CODE ###

n,m= map(int, input().split())
if m!=0:
  a = [int(input()) for _ in range(m)]
else:
  a=[0]
dp=[0]*(n+1)
dp[0]=1
j=0

for i in range(1,n+1):
    if i==a[j]:
        if j<m-1:
            j+=1
    else:
        if i==1:
            dp[i]=1
        else:
            dp[i]=dp[i-1]+dp[i-2]

print(dp[n]%(10**9+7))
import collections
N = map(int, input().split())
A = list(map(int, input().split()))
Q = map(int, input().split())
B = list(map(int, input().split()))
C = list(map(int, input().split()))
 
base = 0
cnt = collections.Counter(A)
 
for i in range(N):
    base += A[i]

Ans = []
Ans.append(base + (C[0]-B[0]) * cnt[B[0]])
 
for i in range(Q-1):
    if cnt[B[i+1]] != 0:
        Ans.append(Ans[i] + (C[i+1]-B[i+1]) * cnt[B[i+1]])
        for j in range(i+1):
            Ans[i+1] += B.count(C[j]) * (C[i+1] - C[j])
    else:
        Ans.append(Ans[i])

print(Ans)

### FIXED CODE ###

import collections

n = int(input())
A = list(map(int, input().split()))
q = int(input())

CNT = collections.Counter(A)
ANS = []
ans = sum(A)

for i in range(q):
    b, c = map(int, input().split())
    t = CNT[b]
    ans +=(c - b) * t
    ANS.append(ans)
    CNT[c] += t
    CNT[b] = 0

for i in ANS:
    print(i)
a = (int)input();
b = (int)input();
if a >= 13:
  print(b)
elif a >= 6 && a <= 12:
  print(b/2)
else:
  print(0)
    


### FIXED CODE ###

a,b = map(int, input().split())
 
ans=0
if a <= 5:
	ans = 0
elif a >= 6 and a<=12:
	ans = b/2
else:
	ans = b
 
print(int(ans))
H,W,N = [int(input()) for i in range(3)]
a = H / W
b = W / H
if H < W :
  print(b)
  else:
    print(a)


### FIXED CODE ###

H,W,N = [int(input()) for i in range(3)]
for o in range(1,10000):
  if H <= W and N / o <= W:
    break
  elif H >= W and N / o <= H:
    break
print(o)
n = int(input())
num_list = list(map(int, input().split()))
num_unique = list(set(num_list))
num_unique.sort()
num_unique.reverse()
max_num = 0
flag = False
for i in range(num_unique[-2], 0, -1):
    if flag and count < 2:
        break
    elif i == 1:
        max_num = 1
        break
    else:
        flag = True
        count = 0
        max_num = i
    for num in num_unique:
        if int(num / max_num) < 1 or num % max_num != 0:
            count += 1
            if count > 1:
                break
print(max_num)


### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
end = sorted(a)[1]

for i in range(end + 1, 0, -1):
    x = 0
    for j in a:
        if j % i != 0:
            x += 1
        if x >= 2:
            break
    if x <= 1:
        print(i)
        break
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
m=0
for i in range(N):
    m +=B[a[i] -1]
for i in range(N-1):
    if a[i] + 1 == a[i + 1]:
        m +=C[a[i] - 1]
print(m)
         
    

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
m = 0
for i in range(N):
    m += B[A[i] - 1]
for t in range(N-1):
    if A[t] + 1 == A[t + 1]:
        m += C[A[t] - 1]
print(m)
s = {}
s['a']=raw_input()
s['b']=raw_input()
s['c']=raw_input()
def solve(s):
  turn = 'a'
  while True:
    nxt, s[turn] = s[turn][0], s[turn][1:]
    if len(s[turn]) == 0:
      return turn.upper()
   	turn = nxt
print solve(s)

### FIXED CODE ###

def solve(s):
  turn = 'a'
  while True:
    if len(s[turn]) == 0:
      return turn.upper()
    nxt, s[turn] = s[turn][0], s[turn][1:]
    turn = nxt

s = {}
s['a']=raw_input()
s['b']=raw_input()
s['c']=raw_input()
print solve(s)
S = sorted(str,input())
Scnt = len(S)
Sset = set(S)

if Scnt == Sset:
    print("Good")
else:
    print("Bad")

### FIXED CODE ###

S = [str(x) for x in input()]
cnt = 0
 
for i in range(0,3):
    if S[i] == S[i+1]:
        cnt += 1
 
if cnt >= 1:
    print("Bad")
else:
    print("Good")
while True:
    m, f, r = [int(i) for i in input().split()]

    if m == f == r == -1:
        break

    if (m == -1 or f == -1) or (m + f < 30):
        print("F")

    if m + f >= 80:
        print("A")

    if 65 <= m + f < 80:
        print("B")

    if 50 <= m + f < 65:
        print("C")

    if 30 <= m + f < 50:
        elif r >= 50:
            print("C")
        else:
            print("D")
            
    print()

### FIXED CODE ###

while True:
    m, f, r = [int(i) for i in input().split()]

    if m == f == r == -1:
        break

    total = m + f
    if m == -1 or f == -1 or total < 30:
        print('F')
        
    elif total < 50 and r < 50:
        print('D')
        
    elif total < 65:
        print('C')
        
    elif total < 80:
        print('B')
        
    else:
        print('A')
n= int(input())
list = [int(x) for x in input().split()]

if max(list) <  (sum(list) - max(list)):
  print('Yes')
else:
  print('No'

### FIXED CODE ###

n= int(input())
l = [int(x) for x in input().split()]
print('Yes' if max(l)<sum(l)-max(l) else 'No')
N = int(input())
A = list(map(int,input().split()))
ans = 1
for i in N:
    ans = A[i]*ans
    if ans > 10**18:
        print("-1")
        break
    print(ans)

### FIXED CODE ###

N=int(input())
A=list(map(int,input().split()))
if 0 in A:
    print(0)
    exit()
ans=1
for i in A:
    ans*=i
    if ans>10**18:
        print(-1)
        exit()
print(ans)
# ABC 057 C - Digits in Multiplication
# 2020/04/07　20:6-
n = int(input())

def F(a, b):
    A = len(str(a))
    B = len(str(b))
    return max(A, B)

ans = math.inf
for i in range(1, int(n**(1/2))+1):
    j = n / i
    if j%1 == 0:
        j = n // i
        if ans > F(i, j):
            ans = F(i, j)
            
print(ans)

### FIXED CODE ###

# ABC 057 C - Digits in Multiplication
# 2020/04/07　20:6-
n = int(input())

def F(a, b):
    A = len(str(a))
    B = len(str(b))
    return max(A, B)

ans = 10**12
for i in range(1, int(n**(1/2))+1):
    j = n / i
    if j%1 == 0:
        j = n // i
        if ans > F(i, j):
            ans = F(i, j)
            
print(ans)
a, b, c = int(input())
print(min(b//a, c))

### FIXED CODE ###

a, b, c = list(map(int, input().split()))
print(min(b//a, c))
N = int(input())
A = list(map(int, input().split()))
M = 100000
cnt = [0]*M
ans = 0
for a in A:
    if cnt[a] != 0:
        cnt[a] = 2
    else:
        for i in range(a, M, a):
            cnt[i] += 1
for a in A:
    if cnt[a] == 1:
        ans += 1
print(ans)


### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
M = max(A)+1
cnt = [0]*M
ans = 0
for a in A:
    if cnt[a] != 0:
        cnt[a] = 2
    else:
        for i in range(a, M, a):
            cnt[i] += 1
for a in A:
    if cnt[a] == 1:
        ans += 1
print(ans)
flag = 1
keta,n = map(int,input().split())
sc = []
for i in range(n):
    sc.append(list(map(int,input().split())))

ans = [None]*n

for j in sc:
    if j[0] == 1 and j[1] == 0:
        flag = 0
    if ans[j[0]-1] == None:
        ans[j[0]-1] = j[1]
    elif ans[j[0]-1] == j[1]:
        pass
    else:
        flag = 0


else:
    for k in range(len(ans)):
        if k == 0 and ans[0] == 0:
            ans[0] = 1
        elif ans[k] == None:
            ans[k] = 0
ans_s = ""
for l in ans:
    ans_s += str(l)
    
if flag == 0:
    print("-1")        
else:
    print(ans_s) 

### FIXED CODE ###

flag = 1
keta,n = map(int,input().split())
sc = []
for i in range(n):
    sc.append(list(map(int,input().split())))

ans = [None]*keta

for j in sc:
    if j[0] == 1 and j[1] == 0 and keta != 1:
        flag = 0

    else:
        try:
            if ans[j[0]-1] == None:
                ans[j[0]-1] = j[1]
            elif ans[j[0]-1] != None and ans[j[0]-1] != j[1]:
                flag = 0
        except:
            flag = 0
        
        
for k in range(len(ans)):
    if k == 0 and ans[0] == None and keta != 1:
        ans[0] = 1
    elif ans[k] == None:
        ans[k] = 0
            
ans_s = ""
for l in ans:
    ans_s += str(l)
    
if flag == 0:
    print("-1")        
else:
    print(ans_s)
N, M = (int(i) for i in input().split())
hoge = {i for i + 1 in range(M)}
for i in range(N):
    likes[i] = set()
    likes[i] = {i for i in input().split()}
    hoge &= likes[i]

c = len(hoge)

print(hoge)

### FIXED CODE ###

N, M = (int(i) for i in input().split())
hoge = {i + 1 for i  in range(M)}

for i in range(N):
    likes = set()
    on = input().split()
    on.pop(0)
    likes = {int(j) for j in on}
    hoge &= likes


c = len(hoge)

print(c)
N, K = map(int, input().split())
A = list(map(int, input().split()))

blist = [0] * 50
for i in range(N):
  bn = bin(A[i])
  for j in range(len(bn)):
    if bn[len(bn) - 1 - j] == '1':
      blist[j] += 1
      
K = bin(K)[2::]
digit = len(K)
dp = [[0, 0] for i in range(digit)]
t = 0
for i in range(digit, 45):
  t += blist[i] * (2 ** i)
if K != '0':
  dp[digit - 1][0] = t + blist[digit - 1] * 2 ** (digit - 1)
  dp[digit - 1][1] = t + (N - blist[digit - 1]) * 2 ** (digit - 1)
else:
  dp[digit - 1] = [t, t]
for i in reversed(range(0, digit - 1)):
  if K[len(K) - i] == '1':
    dp[i][1] = dp[i + 1][1] + (N - blist[i]) * (2 ** i)
    dp[i][0] = max([dp[i + 1][1] + blist[i] * (2 ** i),
                    dp[i + 1][0] + max([blist[i], N - blist[i]]) * (2 ** i)])
  else:
    dp[i][1] = dp[i + 1][1] + blist[i] * (2 ** i)
    dp[i][0] = dp[i + 1][0] + max([blist[i], N - blist[i]]) * (2 ** i)
    
print(max(dp[0]))

### FIXED CODE ###

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

blist = [0] * 50
for i in range(N):
  bn = bin(A[i])
  for j in range(len(bn)):
    if bn[len(bn) - 1 - j] == '1':
      blist[j] += 1
      
K = bin(K)[2::]
digit = len(K)
dp = [[0, 0] for i in range(digit)]
t = 0
for i in range(digit, 45):
  t += blist[i] * (2 ** i)
if K != '0':
  dp[digit - 1][0] = t + blist[digit - 1] * 2 ** (digit - 1)
  dp[digit - 1][1] = t + (N - blist[digit - 1]) * 2 ** (digit - 1)
else:
  dp[digit - 1] = [t, t]
for i in reversed(range(0, digit - 1)):
  if K[len(K) - i - 1] == '1':
    dp[i][1] = dp[i + 1][1] + (N - blist[i]) * (2 ** i)
    dp[i][0] = max([dp[i + 1][1] + blist[i] * (2 ** i),
                    dp[i + 1][0] + max([blist[i], N - blist[i]]) * (2 ** i)])
  else:
    dp[i][1] = dp[i + 1][1] + blist[i] * (2 ** i)
    dp[i][0] = dp[i + 1][0] + max([blist[i], N - blist[i]]) * (2 ** i)
    
print(max(dp[0]))
s = list(input())
k = int(input())

s2 = s + s
s3 = s + s + s

tmp = s[0]
c = 0
for i in range(1,len(s)):
    if s[i] == tmp:
        s[i] = "@"
        c += 1
    tmp = s[i] 

tmp = s2[0]
c2 = 0
for i in range(1,len(s2)):
    if s2[i] == tmp:
        s2[i] ="@"
        c2 += 1
    tmp = s2[i]

tmp = s3[0]
c3 = 0
for i in range(1,len(s3)):
    if s3[i] == tmp:
        s3[i] ="@"
        c3 += 1
    tmp = s3[i]

if c2-c == c3-c2:
    ans = c + (k-1)*(c2-c)
else:
    if K%2 != 0:
        ans = c + ((k-1)//2)*(c3-c)
    else:
        ans = c + ((k-2)//2)*(c3-c2) + c2 - c
print(ans)


### FIXED CODE ###

s = list(input())
k = int(input())

s2 = s + s
s3 = s + s + s

tmp = s[0]
c = 0
for i in range(1,len(s)):
    if s[i] == tmp:
        s[i] = "@"
        c += 1
    tmp = s[i] 

tmp = s2[0]
c2 = 0
for i in range(1,len(s2)):
    if s2[i] == tmp:
        s2[i] ="@"
        c2 += 1
    tmp = s2[i]

tmp = s3[0]
c3 = 0
for i in range(1,len(s3)):
    if s3[i] == tmp:
        s3[i] ="@"
        c3 += 1
    tmp = s3[i]

if c2-c == c3-c2:
    ans = c + (k-1)*(c2-c)
else:
    if k%2 != 0:
        ans = c + ((k-1)//2)*(c3-c)
    else:
        ans = c + ((k-2)//2)*(c3-c2) + c2 - c
print(ans)
r = input()
if r<1200:
  print("ABC")
elif r<2800:
  print("ARC")
else:
  print("AGC")

### FIXED CODE ###

r = int(input())
if r<1200:
  print("ABC")
elif r<2800:
  print("ARC")
else:
  print("AGC")
a, b, k = map(int, input().split())
l = list(range(a,b+1))


### FIXED CODE ###

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

l = [i for i in range(a, b+1) if (i < a+k) or (i > b-k)]

print(*l, sep="\n", end="")
A = [0] * 10

B = list(map(int, input().split()))
for i in range(len(B)):
    A[B[i]] += 1

for i in range(len(A)):
    if A[i] == 2:
        print('Yes')
        break
else 
    print('No')

### FIXED CODE ###

A = [0] * 10

B = list(map(int, input().split()))
for i in range(len(B)):
    A[B[i]] += 1

for i in range(len(A)):
    if A[i] == 2:
        print('Yes')
        break
else:
    print('No')
N, M = map(int, input().split( ))
datas = list(map(int, input().split( )))
datas.sort()
Ms = M - 1

dest = list()
K = 0
i = 0
for i in range(Ms):
  K = datas[i+1] - datas[i]
  dest.append(K)

dest.sort()
L = 0
MN = M - N
for j in range(MN):
  L = L + dest[j]

print(L)


### FIXED CODE ###

a, b = map(int, input().split( ))
k = round((a / b), 10)
print("{0:.10f}".format(k))
k, a = map(int(), input().split())
 
if k * 500 >= a:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

k, a = map(int, input().split())
 
if k * 500 >= a:
  print('Yes')
else:
  print('No')
def main():
    s = input()
    x, y = map(int, input().split())
    if solve(s, x, y):
        print('Yes')
    else:
        print('No')

def solve(s, x, y):
    moves = split_moves(s)
    if not match(x - moves[0][0], moves[0][1:]):
        return False
    if not match(y, moves[1]):
        return False

    return True

def match(x, moves):
    s = sum(moves)
    if x > s:
        return False

    if (s - x) % 2 != 0:
        return False

    return knapsack((s - x) // 2, moves)

def knapsack(x, moves):
    if x == 0:
        return True
    if x < 0:
        return False
    if len(moves) == 0:
        return False

    if knapsack(x - moves[0], moves[1:]):
        return True

    if knapsack(x, moves[1:]):
        return True

    return False

def split_moves(s):
    moves = [[0], []]
    i = 0
    j = 0

    for c in s:
        if c == 'F':
            moves[i][-1] += 1
        else:
            i = 1 - i
            moves[i].append(0)

    return moves

main()
	

### FIXED CODE ###

def main():
    s = input()
    x, y = map(int, input().split())
    if solve(s, x, y):
        print('Yes')
    else:
        print('No')

def solve(s, x, y):
    moves = split_moves(s)
    if not match(x - moves[0][0], moves[0][1:]):
        return False
    if not match(y, moves[1]):
        return False

    return True

def match(x, moves):
    s = sum(moves)
    if x > s:
        return False

    if (s - x) % 2 != 0:
        return False

    return knapsack((s - x) // 2, moves)

def knapsack(x, moves):
    if x == 0:
        return True

    prev = set([0])
    for m in moves:
        curr = set(i + m for i in prev if i + m <= x)
        if x in curr:
            return True
        curr |= prev
        prev = curr
    return False

def split_moves(s):
    moves = [[0], []]
    i = 0

    for c in s:
        if c == 'F':
            moves[i][-1] += 1
        else:
            i = 1 - i
            moves[i].append(0)

    return moves

main()