Harryxun/stf_run huggingface dataset:
#atcoder template
def main():
    import sys
    imput = sys.stdin.readline
    #文字列入力の時は上記はerrorとなる。
    #ここにコード
    #input
    n, m = map(int, input().split())

    #output
    mod = pow(10, 9) + 7

    n_ = 4 * pow(10, 5) + 5
    fun = [1] * (n_+1)
    for i in range(1, n_+1):
        fun[i] = fun[i-1] * i % mod
    rev = [1] * (n_+1)
    rev[n_] = pow(fun[n_], mod-2, mod)
    for i in range(n_-1, 0, -1):
        rev[i] = rev[i+1] * (i+1) % mod
    def cmb(n,r):
        if n < 0 or r < 0 or r > n: return 0
        return fun[n] * rev[r] % mod * rev[n-r] % mod
    def perm(n, r):
        if n < 0 or r < 0 or r > n: return 0
        return fun[n] * rev[n-r] % mod

    #Aを1, 2, ..., nとする。
    #求める写像の総数をs(n, m)とする。
    #s(n, m) = sum(k=0, n)(cmb(n, k)* (-1)^k * cmb(m-k, n-k)*(n-k)!)

    import math
    answer = 0
    for i in range(n+1):
        temp = perm(n, i) * cmb(m, i) * pow(perm(m-i, n-i), 2)
        temp %= mod
        if i % 2 == 0:
            answer += temp
        else:
            answer -= temp
    print(answer % mod)

    #N = 1のときなどcorner caseを確認！
if __name__ == "__main__":
    main()


### FIXED CODE ###

#atcoder template
def main():
    import sys
    imput = sys.stdin.readline
    #文字列入力の時は上記はerrorとなる。
    #ここにコード
    #input
    n, m = map(int, input().split())

    #output
    mod = pow(10, 9) + 7

    n_ = 5 * pow(10, 5) + 5
    fun = [1] * (n_+1)
    for i in range(1, n_+1):
        fun[i] = fun[i-1] * i % mod
    rev = [1] * (n_+1)
    rev[n_] = pow(fun[n_], mod-2, mod)
    for i in range(n_-1, 0, -1):
        rev[i] = rev[i+1] * (i+1) % mod
    def cmb(n,r):
        if n < 0 or r < 0 or r > n: return 0
        return fun[n] * rev[r] % mod * rev[n-r] % mod
    def perm(n, r):
        if n < 0 or r < 0 or r > n: return 0
        return fun[n] * rev[n-r] % mod

    #Aを1, 2, ..., nとする。
    #求める写像の総数をs(n, m)とする。
    #s(n, m) = sum(k=0, n)(cmb(n, k)* (-1)^k * cmb(m-k, n-k)*(n-k)!)

    import math
    answer = 0
    for i in range(n+1):
        temp = perm(n, i) * cmb(m, i) * pow(perm(m-i, n-i), 2)
        temp %= mod
        if i % 2 == 0:
            answer += temp
        else:
            answer -= temp
    print(answer % mod)

    #N = 1のときなどcorner caseを確認！
if __name__ == "__main__":
    main()
X, Y = map(int, input().split())
 ans = 'No'
for a in range(X + 1):
  b = X - a
  if 2 * a + 4 * b == Y:
    ans = 'Yes'
print(ans)

### FIXED CODE ###

X, Y = map(int, input().split())
ans = 'No'
for a in range(X + 1):
  b = X - a
  if 2 * a + 4 * b == Y:
    ans = 'Yes'
print(ans)
# import bisect
# import heapq
# from copy import deepcopy
# from collections import deque
# from collections import Counter
# from itertools import accumulate
# from itertools import permutations
# import numpy as np
import math
a,b,c = map(float, input().split())
# n = int(input())
# p = list(map(int, input().split()))


ans = 'Yes' if a + b + (2 * math.sqrt(a * b)) < c else 'No'

print(ans)


### FIXED CODE ###

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


if n == 1 or w == 1: 
    ans = 1
elif n % 2 == 0 or w % 2 == 0:
    ans = int((n * w) / 2.)

else:
    ans = int((n * w) / 2.) + 1

print(ans)
import numpy as np
N , M = map(int, input().split())
a = list()
for n in range(M):
    a.append(int(input()))
dp = np.zeros(N+1)
dp[0] = 1
dp[1] = 0 if a[0] == 1 else 1
for n in range(2,N+1):
    if n in a:
        dp[n] = 0
    else:
        dp[n] = (int(dp[n-1])+int(dp[n-2]))%(10**9+7)
print(int(dp[N]))


### FIXED CODE ###

import numpy as np
N , M = map(int, input().split())
a = list()
for n in range(M):
    a.append(int(input()))
dp = np.zeros(N+1)
dp[0] = 1
if M == 0:
    dp[1] = 1
else:
    dp[1] = 0 if a[0] == 1 else 1
ok = [False]*(N+1)
for x in a:
    ok[x] = True
for n in range(2,N+1):
    if ok[n]:
        continue
    dp[n] = (dp[n-1]+dp[n-2])%(10**9+7)
print(int(dp[N]))
input()
v=list(map(int,input().split())
c=list(map(int,input().split())
a=[max(0,i-j) for i,j in zip(v,c)]
print(sum(a))

### FIXED CODE ###

input()
v=list(map(int,input().split()))
c=list(map(int,input().split()))
a=[max(0,i-j) for i,j in zip(v,c)]
print(sum(a))
mod = 10**9+7
N,X,Y,Z = map(int, input().split())
Num = 1<<(X+Y+Z-1)
ng = ((((1<<X)+1)<<Y)+1)<<(Z-1)

dp = [[0]*(1<<l) for i in range(N+1)]
dp[0][0] = 1
for i in range(N):
    for j in range(1, 11):
        for k in range(Num):
            a = (k<<j)|(1<<(j-1))
            if a&ng != ng:
                a &= Num-1
                dp[i+1][a] += dp[i][k]
                dp[i+1][a] %= mod
cnt = 0
for x in dp[N]:
    cnt += x
    cnt %= mod
print((10**N%mod-cnt)%mod)

### FIXED CODE ###

mod = 10**9+7
N,X,Y,Z = map(int, input().split())
Num = 1<<(X+Y+Z-1)
ng = ((((1<<X)+1)<<Y)+1)<<(Z-1)

dp = [[0]*Num for i in range(N+1)]
dp[0][0] = 1
for i in range(N):
    for k in range(Num):
        for j in range(1,11):
            a = (k<<j)|(1<<(j-1))
            if a&ng != ng:
                a &= Num-1
                dp[i+1][a] += dp[i][k]
                dp[i+1][a] %= mod
cnt = 1
for i in range(N):
    cnt *= 10
    cnt %= mod
for x in dp[N]:
    cnt -= x
    cnt %= mod
print(cnt)
#coding:utf-8

import math

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

print(int(a * b / math.gcd(a, b)))

### FIXED CODE ###

#coding:utf-8

import fractions

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

print(int(a * b / fractions.gcd(a, b)))
import math
r=int(input())
a=r*r*math.pi
b=2*r*math.pi
print(a, end='')
print(b)

### FIXED CODE ###

import math
r=float(input())
a=r*r*math.pi
b=2*r*math.pi
print(a,b)
s = list(input())
count = 0
l = 0
r = len(s)-1

#リストsの先頭と末尾を比較
#先頭と末尾がx以外で異なるなら,-1を返す。
#先頭と末尾が同じなら先頭と末尾を移動させる。
#どちらか片方がxなら片方にxを追加し先頭と末尾を移動させたとするので最初にxだったほうだけ移動させる

#xabxa
while l != r:
    if s[l] != s[r]:
        if s[l] != "x" and s[r] != "x":
            count = -1
            break
        elif s[l] == "x" and s[r] != "x":
            l += 1
            count += 1
        elif s[r] == "x" and s[l] != "x":
            r -= 1
            count += 1
    elif s[l] == s[r]:
        l += 1
        r -= 1

print(count)

### FIXED CODE ###

s = list(input())
count = 0
l = 0
r = len(s)-1

#リストsの先頭と末尾を比較
#先頭と末尾がx以外で異なるなら,-1を返す。
#先頭と末尾が同じなら先頭と末尾を移動させる。
#どちらか片方がxなら片方にxを追加し先頭と末尾を移動させたとするので最初にxだったほうだけ移動させる

#xabxa
while l != r:
    if s[l] != s[r]:
        if s[l] != "x" and s[r] != "x":
            count = -1
            break
        elif s[l] == "x" and s[r] != "x":
            l += 1
            count += 1
        elif s[r] == "x" and s[l] != "x":
            r -= 1
            count += 1
    elif s[l] == s[r]:
        if abs(l-r) == 1:
            break
        else:
            l += 1
            r -= 1

print(count)
"""
マスターオブ整数
公約数の問題
公約数とは最大公約数の約数であるという性質がある
"""
import math
A, B = map(int, input().split())

# まず公約数を列挙したくなる
# 最大公約数を求めてその約数を列挙する
# 最大公約数はユークリッドの互除法で求めることができる

ans = 1
gcd_value = math.gcd(A, B)
for i in range(2, gcd_value + 1):
    if gcd_value == 1:
        break
    if gcd_value % i == 0:
        ans += 1
        while gcd_value % i == 0:
            gcd_value //= i

# divisorリストの中からどの二つ互いに素となるようにいくつか選ぶ
# 素因数の数+1を答えれば良い

print(ans)

### FIXED CODE ###

"""
マスターオブ整数
公約数の問題
公約数とは最大公約数の約数であるという性質がある
"""
import fractions
A, B = map(int, input().split())

# まず公約数を列挙したくなる
# 最大公約数を求めてその約数を列挙する
# 最大公約数はユークリッドの互除法で求めることができる

ans = 1
gcd_value = fractions.gcd(A, B)
for i in range(2, int(gcd_value**0.5) + 1):
    if gcd_value % i == 0:
        ans += 1
        while gcd_value % i == 0:
            gcd_value //= i

# divisorリストの中からどの二つ互いに素となるようにいくつか選ぶ
# 素因数の数+1を答えれば良い
if gcd_value != 1:
    ans += 1

print(ans)
usrInput = input()
taxRate = 0.08
finding = 1
whileIs = True
foundIs = False

while whileIs == True:
    if math.floor(finding * (taxRate + 1)) == int(usrInput):
        unTaxed = finding
        whileIs = False
        foundIs = True
    else:
       if 49300 <= finding:
           whileIs = False
           foundIs = False
        finding = finding + 1

if foundIs:
    print(str(unTaxed))
else:
    print(":(")

### FIXED CODE ###

usrInput = input()
import math
taxRate = 0.08
finding = 1
whileIs = True
foundIs = False

while whileIs == True:
    if math.floor(finding * (taxRate + 1)) == int(usrInput):
        unTaxed = finding
        whileIs = False
        foundIs = True
    else:
       if 49300 <= finding:
        whileIs = False
        foundIs = False
    finding = finding + 1

if foundIs:
    print(str(unTaxed))
else:
    print(":(")
import math
a,b,x=map(int, input().split()) 

threshold = (a*a*b)/2
if x <= threshold:
  rad = math.atan(2*x/(a*b*b))
  print(90-math.degrees(rad))
else:
  at = (a*a*a)/(2*(a*a*b-x))
  rad = math.atan(at)
  print(90-math.degrees(rad))
  

### FIXED CODE ###

import math
a,b,x=map(int, input().split()) 

threshold = (a*a*b)/2
if x <= threshold:
  rad = math.atan(2*x/(a*b*b))
  print(90-math.degrees(rad))
elif x == 2 * threshold:
  print(0)
else:
  at = (a*a*a)/(2*(a*a*b-x))
  rad = math.atan(at)
  print(90-math.degrees(rad))
l = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

k = int(input())

print(l[k+1])

### FIXED CODE ###

l = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

k = int(input())

k = k - 1

print(l[k])
n,m = map(int, raw_input().split())
np=[]
mp=[]
for i in xrange(0, n):
  np.append(raw_input())
for i in xrange(0, m):
  mp.append(raw_input())

for i in xrange(0,n-m+1):
  for j in xrange(0, n-m+1):
    flag = True
    for x in xrange(0, m):
      for y in xrange(0, m):
        if mp[x][y] != np[i+x][j+y]:
          flag = False
          break
      if flag == False:
        break
    if flag:
      print "Yes"
      return
print "No"

### FIXED CODE ###

n,m = map(int, raw_input().split())
np=[]
mp=[]
for i in xrange(0, n):
  np.append(raw_input())
for i in xrange(0, m):
  mp.append(raw_input())
 
for i in xrange(0,n-m+1):
  for j in xrange(0, n-m+1):
    flag = True
    for x in xrange(0, m):
      for y in xrange(0, m):
        if mp[x][y] != np[i+x][j+y]:
          flag = False
          break
      if flag == False:
        break
    if flag:
      print "Yes"
      break
  if flag: break
if flag==False: print "No"
n,a,b,c,d=map(int,input().split())
s=input()
if c<d and b<c and not(a<c<b<d):
  s=s[a-1:d]
elif c>d and b<d and not (a<c<b<d):
  t=s[b-1:d]
  s=s[a-1:c]
elif a<c<b<d:
  s_=s[a-1:c]
  s=s[b-1:d]
  f=0
  f_=0
  for i in range(len(s_)):
    if s_[i]=='.':
      f=0
    elif s_[i]=='#' and f==0:
      f=1
    elif s_[i]=='#' and f==1:
      print('No')
      exit()
  for j in range(len(s)):
    if s[i]=='.':
      f_=0
    elif s[i]=='#' and f_==0:
      f_=1
    elif s[i]=='#' and f_==1:
      print('No')
      exit()
  print('Yes')
  exit()
if c<d:
  f=0
  for i in range(len(s)):
    if s[i]=='.':
      f=0
    elif s[i]=='#' and f==0:
      f=1
    elif s[i]=='#' and f==1:
      print('No')
      exit()
  print('Yes')
else:
  f=0
  g=0
  h='No'
  for i in range(len(s)):
    if s[i]=='.':
      f=0
    elif s[i]=='#' and f==0:
      f=1
    elif s[i]=='#' and f==1:
      print('No')
      exit()
  for j in range(t):
    if t[j]=='.':
      g+=1
      if g==3:
        h='Yes'
    else:
      g=0
  print(h)    

### FIXED CODE ###

n,a,b,c,d=map(int,input().split())
s=input()
if c<d and b<c:
  s=s[a-1:d]
elif c>d and b<c:
  t=s[b-2:d+1]
  s_=s[a-1:c]
elif a<c<b<d:
  s_=s[a-1:c]
  s=s[b-1:d]
  f=0
  f_=0
  for i in range(len(s_)):
    if s_[i]=='.':
      f=0
    elif s_[i]=='#' and f==0:
      f=1
    elif s_[i]=='#' and f==1:
      print('No')
      exit()
  for j in range(len(s)):
    if s[i]=='.':
      f_=0
    elif s[i]=='#' and f_==0:
      f_=1
    elif s[i]=='#' and f_==1:
      print('No')
      exit()
  print('Yes')
  exit()
if c<d:
  f=0
  for i in range(len(s)):
    if s[i]=='.':
      f=0
    elif s[i]=='#' and f==0:
      f=1
    elif s[i]=='#' and f==1:
      print('No')
      exit()
  print('Yes')
else:
  f=0
  g=0
  h='No'
  for i in range(len(s_)):
    if s_[i]=='.':
      f=0
    elif s_[i]=='#' and f==0:
      f=1
    elif s_[i]=='#' and f==1:
      print('No')
      exit()
  for j in range(len(t)):
    if t[j]=='.':
      g+=1
      if g==3:
        h='Yes'
    else:
      g=0
  print(h)
x,y = map(int,input().split())
p = []
ans = 0
z=x+1

for i in range(x):
    p.append(4)

for a in range(z):
    if sum(p)==y:
        ans = 1
        break
    else:
        p.remove(4)
        p.append(2)

if ans == 1:
    print('Yes')
else:
    if (y==2)&(x==1):
        print('Yes')
    if (y==4)&(x==1):
        print('Yes')
    else :
        print('No')


### FIXED CODE ###

x,y = map(int, input().split())
list = []
ans = 0
for i in range(x) :
    list.append(4)

if sum(list) == y:
    print('Yes')
    ans = 1

else :
    for i in range(x) :
        list.remove(4)
        list.append(2)
        if sum(list) == y:
            print('Yes')
            ans = 1
            break

    if ans == 0:
        print('No')
print(b)


### FIXED CODE ###

a, b = map(int, input().split())
if a*b % 2 == 0:
  print("Even")
else:
  print("Odd")
n = int(input())

for p in prospects:
    if p < n:
        continue
    if p >= n:
        print(p)
        break

### FIXED CODE ###

n = int(input())
prospects = [111*i for i in range(1, 10)]

for p in prospects:
    if p < n:
        continue
    if p >= n:
        print(p)
        break
password = input()

result = 'Good'

for i in range(len(password)-1):
  ):
    if password[i] == password[i+1]:
      result = 'Bad'
      break
      
print(result)
  

### FIXED CODE ###

password = input()

result = 'Good'

for i in range(len(password)-1):
    if password[i] == password[i+1]:
      result = 'Bad'
      break
      
print(result)
l = raw_input().split()
h = int(l[0])/(int(l[1])+int(l[2]))
print(h)

### FIXED CODE ###

l = raw_input().split()
print((int(l[0])-int(l[2]))/(int(l[1])+int(l[2])))
import math
a = list(map(int,input().split()))
print(math.ceil((float)a[0]/a[1]))


### FIXED CODE ###

import math
a = list(map(int,input().split()))
print(math.ceil(a[0]/a[1]))
N = input()
A = list(map(int,input().split()))
raw =sum(A)
con = 0

for i in A:
    if A[con] > A[con+1]:
        A[con+1] =  A[con]
        
    if A[con+1] == A[-1]:
        break

    con += 1

ans = sum(A) - raw
print(ans)

### FIXED CODE ###

N = input()
A = list(map(int,input().split()))
raw =sum(A)
con = 0

if len(A) == 1:
    print(0)
    
else:
    for i in A:
        if A[con] > A[con+1]:
            A[con+1] =  A[con]
        
        if A[con+1] == A[-1]:
            break

        con += 1

    ans = sum(A) - raw
    print(ans)
import collections
N, W = map(int, input().split())
wv = collections.defaultdict(list)
w = 0
for i in range(N):
    a, b = map(int, input().split())
    wv[a].append(b)
    if i == 0:
        w = a
s = [[0]*(len(wv[w+i])+1) for i in range(4)]

for i in range(4):
    wv[w + i].sort(reverse=True)
    for j, x in enumerate(wv[w + i]):
        s[i][j+1] = s[i][j] + x
ans = 0
L = len(wv[3])
for i in range(min(len(wv[w]), N)+1):
    tmp1 = s[0][i]
    weight1 = w * i
    if weight1 > W:
        break
    for j in range(min(len(wv[w+1])+1, N+1 - i)):

        tmp2 = tmp1 + s[1][j]
        weight2 = weight1 + (w+1)*j
        if weight2 > W:
            break
        for k in range(min(len(wv[w+2])+1, N+1 - i - j)):
            tmp3 = tmp2 + s[2][k]
            weight3 = weight2 + (w+2)*k
            if weight3 > W:
                break
            d = W - weight3

            ans = max(ans, tmp3 + s[3][min(L, d//(w+3))])
print(ans)


### FIXED CODE ###

import collections
N, W = map(int, input().split())
wv = collections.defaultdict(list)
w = 0
for i in range(N):
    a, b = map(int, input().split())
    wv[a].append(b)
    if i == 0:
        w = a
s = [[0]*(len(wv[w+i])+1) for i in range(4)]

for i in range(4):
    wv[w + i].sort(reverse=True)
    for j, x in enumerate(wv[w + i]):
        s[i][j+1] = s[i][j] + x
ans = 0
L = len(wv[w+3])
for i in range(min(len(wv[w]), N)+1):
    tmp1 = s[0][i]
    weight1 = w * i
    if weight1 > W:
        break
    for j in range(min(len(wv[w+1])+1, N+1 - i)):

        tmp2 = tmp1 + s[1][j]
        weight2 = weight1 + (w+1)*j
        if weight2 > W:
            break
        for k in range(min(len(wv[w+2])+1, N+1 - i - j)):
            tmp3 = tmp2 + s[2][k]
            weight3 = weight2 + (w+2)*k
            if weight3 > W:
                break
            d = W - weight3

            ans = max(ans, tmp3 + s[3][min(L, d//(w+3))])
print(ans)
N=int(input())
y=0
for j in range(1,N):
    for k in range(1,N): 
        if (N-k)%j==0:
            y=y+1
print(y)

### FIXED CODE ###

x=input()
if x[-1]==("s"):
    print(x+"es")
elif x[-1]!=("s"):
    print(x+"s")
N, L = map(int, input().split())
p_list = []
for i in range(1, N+1):
    p_list += [L + i - 1]
print(sum(p_list) - sorted(p_list, key=abs)[0])

### FIXED CODE ###

S = input()
tmp = S[0]
for num in S[1:]:
    if num == tmp:
        print('Bad')
        exit()
    tmp = num
print('Good')
N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = input()

ret = 0
for i in range(1, K+1):
    prev = '?'
    for j in range(len(T) // K + 1):
        if i + K*j - 1 >= len(T):
            continue
        now = T[i + K*j - 1]
        print(i + K*j - 1)
        count+=1
        if prev == now:
            prev = '?'
        else:
            prev = now
            if now == 'r':  
                ret += P
            elif now == 's':
                ret += R
            else:
                ret += S
            
print(ret)

### FIXED CODE ###

N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = input()

ret = 0
for i in range(1, K+1):
    prev = '?'
    for j in range(len(T) // K + 1):
        if i + K*j - 1 >= len(T):
            continue
        now = T[i + K*j - 1]
        
        if prev == now:
            prev = '?'
        else:
            prev = now
            if now == 'r':  
                ret += P
            elif now == 's':
                ret += R
            else:
                ret += S
            
print(ret)
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby
    #from itertools import product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

    s = input().rstrip() + 'T'
    x,y = map(int, input().split())
    # 奇数はy方向, 偶数はx方向
    l = []
    susumu = 0
    for i in range(len(s)):
        if s[i] == 'T':
            l.append(susumu)
            susumu = 0
        else:
            susumu += 1
    a = sum(l)
    b = len(l)
    dp = [[0]*16000 for _ in range(b+2)]
    dp[0][a] = 1
    dp[1][a] = 1
    for i in range(b):
        if i==0:
            dp[i+2][a+l[i]] = 1
            continue
        if i%2 == 0:
            for j in range(16000):
                if dp[i][j]:
                    dp[i+2][j-l[i]] = 1
                    dp[i+2][j+l[i]] = 1
        if i%2 == 1:
            for j in range(16000):
                if dp[i][j]:
                    dp[i+2][j-l[i]] = 1
                    dp[i+2][j+l[i]] = 1
    if b%2 == 0:
        if dp[-2][x+a] == 1 and dp[-1][y+a] == 1:
            print('Yes')
        else:
            print('No')
    else:
        if dp[-1][x+a] == 1 and dp[-2][y+a] == 1:
            print('Yes')
        else:
            print('No')

if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby
    #from itertools import product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

    s = input().rstrip() + 'T'
    x,y = map(int, input().split())
    # 奇数はy方向, 偶数はx方向
    l = []
    susumu = 0
    for i in range(len(s)):
        if s[i] == 'T':
            l.append(susumu)
            susumu = 0
        else:
            susumu += 1
    b = len(l)
    dp = [[0]*16001 for _ in range(3)]
    dp[0][8000] = 1
    dp[1][8000] = 1
    for i in range(b):
        if i==0:
            dp[2][8000+l[i]] = 1
        elif i%2 == 0:
            for j in range(16000):
                if dp[0][j]:
                    dp[2][j-l[i]] = 1
                    dp[2][j+l[i]] = 1
        elif i%2 == 1:
            for j in range(16000):
                if dp[0][j]:
                    dp[2][j-l[i]] = 1
                    dp[2][j+l[i]] = 1
        dp = dp[1:] + [[0]*16000]
    if b%2 == 0:
        if dp[0][x+8000] == 1 and dp[1][y+8000] == 1:
            print('Yes')
        else:
            print('No')
    else:
        if dp[1][x+8000] == 1 and dp[0][y+8000] == 1:
            print('Yes')
        else:
            print('No')

if __name__ == '__main__':
    main()
N = int(input())
M = int(input())
print("Yes") if N==M else print("No")
  

### FIXED CODE ###

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

if (N==M):
  print("Yes")
else:
  print("No")
n=int(input())
l=list(map(int,input(),split()))
s=max(l)
l.sort()
l.remove(s)
if sum(s[0:len(s)+1]) > s:
 print("Yes")
else:
 print("No")

### FIXED CODE ###

n=int(input())
l=list(map(int,input().split()))
s=max(l)
l.sort()
l.remove(s)
if sum(l[0:len(l)+1]) > s:
 print("Yes")
else:
 print("No")
import fractions
K=int(input())
total = 0

for a in range(K):
  for b in range(a,K):
    for c in range(b,K):
      total += fractsion.gcd(a+1, fractions.gcd(b+1,c+1) )
total *= 6

for a in range(K):
  for b in range(a,K):
    total += fractions.gcd(a+1, b+1)
total *= 6

for a in range(K):
  total += (a+1)

print(total)

### FIXED CODE ###

import math
K=int(input())
total = 0

for a in range(1,K+1):
  for b in range(a+1,K+1):
    for c in range(b+1,K+1):
      total += math.gcd(a, math.gcd(b,c) ) * 6
      
for a in range(1,K+1):
  for b in range(a+1,K+1):
    total += math.gcd(a, b)*6

for a in range(1,K+1):
  total += a

print(total)
N, M = map( int, input().split())
A = list( map( int, input().split()))
Needs = [0,2,5,5,4,5,6,3,7,6]
A.sort(reverse = True)
V = [0]*N
Check = []
for a in A:
    if V[Needs[a]] == 0:
        Check.append(Needs[a])
        V[Needs[a]] = a
Check.sort()
dp = [-100]*(N+1)
dp[0] = 0

for x in Check:
    dp[x] = 1
for i in range(1,N):
    t = dp[i]
        if x + i <= N:
            if dp[x+i] < t + 1:
                dp[x+i] = t+1
ans = ""
t = N
W = [0]*10
while t > 0:
    for x in Check:
        if dp[t-x]+1 == dp[t]:
            W[V[x]] += 1
            t -= x
            break
for i in range(9,0,-1):
    ans += str(i)*W[i]
print(ans)

### FIXED CODE ###

N, M = map( int, input().split())
A = list( map( int, input().split()))
Needs = [0,2,5,5,4,5,6,3,7,6]
A.sort(reverse = True)
V = [0]*10
Check = []
for a in A:
    if V[Needs[a]] == 0:
        Check.append(Needs[a])
        V[Needs[a]] = a
Check.sort()
dp = [-100000]*(N+1)
dp[0] = 0

for x in Check:
    if x <= N:
        dp[x] = 1
for i in range(1,N):
    t = dp[i]
    for x in Check:
        if x + i <= N:
            if dp[x+i] < t + 1:
                dp[x+i] = t+1
ans = ""
t = N
W = [0]*10
while t > 0:
    for a in A:
        x = Needs[a]
        if t-x>=0:
            if dp[t-x]+1 == dp[t]:
                W[V[x]] += 1
                t -= x
                break
for i in range(9,0,-1):
    ans += str(i)*W[i]
print(ans)
import numpy as np

N, A = map(int, raw_input().split())
x = map(int, raw_input().split())
dp = np.full((N+1, A+1, (N+1)*(A+1)), -1)
def dfs(i, t, W):
    if t == 0:
        return int(W == 0)
    if i < 0:
        return 0
    if dp[i, t, W] > -1:
        return dp[i, t, W]
    dp[i, t, W] = dfs(i-1, t, W) + dfs(i-1, t-1, W-x[i])
    return dp[i, t, W]
print sum([dfs(N-1, T, T*A) for T in range(1, N+1)])

### FIXED CODE ###

N, A = map(int, raw_input().split())
x = [v - A for v in map(int, raw_input().split())]
dp = {}
def dfs(i, W):
    if i < 0:
        return int(W == 0)
    if (i, W) in dp:
        return dp[i, W]
    dp[i, W] = dfs(i-1, W) + dfs(i-1, W-x[i])
    return dp[i, W]
print dfs(N-1, 0) - 1