Harryxun/stf_run huggingface dataset:
# 自然数m以下の素数を返す（SETでRETURN）
import math
def prime_numbers(m):
    # 素数を保持するset
    primes = []

    # 2以上m以下の素数を数え上げる
    n = 2
    while n <= m:
        # 自身より小さい全ての素数で割り切れなければ、素数とみなせる
        if all(n % i != 0 for i in primes):
            primes.append(n)
        n += 1
    return primes

#素因数分解（10**6まで）
def soinsu_bunkai(m):
    pf=set()

    for i in pri_num:
        if i >m:
            break
        elif m%i==0:
            pf.add(i)

    return pf

    # 初期入力
import sys
from collections import Counter
from functools import reduce
input = sys.stdin.readline  #文字列では使わない
N = int(input())
A = list(map(int, input().split()))

# 10**6までの素因数分解するために、「10**6のルート」までの素数を列挙
pri =10**6 +10
sq_pri =int(math.sqrt(pri))
pri_num =prime_numbers(sq_pri +10)

#not coprimeの判定
gcd_a =reduce(math.gcd,A)
if gcd_a !=1:
    ans ="not coprime"

#pairwise coprimeの判定
else:
    intersect =set()
    used =set()
    pair_w =set()
    set_w =set()
    for a in A:
        aa =soinsu_bunkai(a)
        if intersect & aa:
            pair_w.add(0)
        else:
            pair_w.add(1)
        intersect |=aa

if 1 in pair_w and 0 not in pair_w:
    ans ="pairwise coprime"
else:
    ans ="setwise coprime"
print(ans)

### FIXED CODE ###

#高速素因数分解  osa_k法 
def osa_k(a):
    tmp = set()
    while a > 1:
        tmp.add(sieve[a])
        a //= sieve[a]
    return tmp

    # 初期入力
import math
import sys
from bisect import bisect_left
from functools import reduce
input = sys.stdin.readline  #文字列では使わない
N = int(input())
A = list(map(int, input().split()))
used =set()

#not coprimeの判定
gcd_a =reduce(math.gcd,A)
if gcd_a !=1:
    ans ="not coprime"

#pairwise coprimeの判定
else:
    MAXN =10**6 +10
    #osa_k法
    sieve = [i for i in range(MAXN+1)]
    p = 2
    while p*p <= MAXN:
        if sieve[p] == p:
            for q in range(2*p,MAXN+1,p):
                if sieve[q] == q:
                    sieve[q] = p
        p += 1
    
    ans ="pairwise coprime"
    for a in A:
        aa =osa_k(a)
        if used & aa:
            ans ="setwise coprime"
            break #共通要素があったらpair_wではない→set_w
        used |=aa
    
print(ans)
k,s = [int(i) for i in input().split()]
def a(n):
  if n == 1:
    return n
  else:
    return n + a(n-1)
  
if s <= k:
  print(a(s+1))
elif s >= 2 * k and s <= 3 * k:
  print(a(3 * k - s + 1))
elif s > k and s < 2 * k:
  print(a(s + 1) - 3 * a(s - k))

### FIXED CODE ###

k,s = [int(i) for i in input().split()]
def a(n):
  return int(n * (n + 1) / 2)
  
if s <= k:
  print(a(s + 1))
elif s >= 2 * k and s <= 3 * k:
  print(a(3 * k - s + 1))
elif s > k and s < 2 * k:
  print(a(s + 1) - 3 * a(s - k))
else:
  print(0)
N = int(input())
a = list(input())
b = []
for i in range(N):
  if a[i] == 'R':
    b.append(i)
M = len(b)-1
m = b[M]
ans = 0
for i in range(N):
  if i >= b[M]:
    break
  if i not in b:
    #print(i)
    M -= 1
    ans += 1
print(ans)

### FIXED CODE ###

N = int(input())
a = list(input())
x = a.count('R')
b = a[:x]
print(b.count('W'))
#1,2,3の番号がついた3マスに，それぞれ"0"か"1"がある．"1"のマスはいくつあるか

res = sum(list(map(int(s))))
print (res)


### FIXED CODE ###

#1,2,3の番号がついた3マスに，それぞれ"0"か"1"がある．"1"のマスはいくつあるか

s = input()
a = [int(c) for c in s]
print (a[0]+a[1]+a[2])
go = 1
while go == 1:
    a = str(input())
    alist = list(a)
    if a ==0:
        go = 0
        exit
    sum = 0
    for i in alist:
        i = int(i)
        sum += i
    if go == 1:
        print(sum)


### FIXED CODE ###

go = 1
while go == 1:
    a = str(input())
    alist = list(a)
    if a == "0":
        go = 0
        exit
    sum = 0
    for i in alist:
        i = int(i)
        sum += i
    if go == 1:
        print(sum)
from collections import Counter

n = int(input())
a = list(map(int, input().split()))
h = Counter()
for x in a:
    h[x] += 1
f = True
for k, v in h..most_common():
    if n % 2 == 1 and k == 0:
        if v != 1:
            f = False
            break
    elif v != 2:
        f = False
        break
MOD = 1000000007
def mpow(n, p, mod):
    r = 1
    while p > 0:
        if p & 1 == 1:
            r = r * n % mod
        n = n * n % mod
        p >>= 1
    return r
print(mpow(2, int(n / 2), MOD) if f else 0) 

### FIXED CODE ###

from collections import Counter

n = int(input())
a = list(map(int, input().split()))
h = Counter()
for x in a:
    h[x] += 1
f = True
for k, v in h.items():
    if n % 2 == 1 and k == 0:
        if v != 1:
            f = False
            break
    elif v != 2:
        f = False
        break
MOD = 1000000007
def mpow(n, p, mod):
    r = 1
    while p > 0:
        if p & 1 == 1:
            r = r * n % mod
        n = n * n % mod
        p >>= 1
    return r
print(mpow(2, int(n / 2), MOD) if f else 0)
from collections import deque
n=int(input())
g=[[] for _ in range(n+1)]
e=[]
for i in range(n-1):
    a,b=map(int,input().split())
    g[a].append(b)
    e.append(b)

q=deque([0])

color=[0 for _ in range(n)]
while(len(q)>0):
    ei=q.popleft()
    c=1
    for x in g[ei]:
        if c == color[ei]:
            c+=1

        color[x]=c
        c+=1
        q.append(x)

print(max(color))
for i in e:
    print(color[i])

### FIXED CODE ###

from collections import deque
n=int(input())
g=[[] for _ in range(n+1)]
e=[]
for i in range(n-1):
    a,b=map(int,input().split())
    g[a-1].append(b-1)
    e.append(b-1)

q=deque([0])

color=[0 for _ in range(n)]
while(len(q)>0):
    ei=q.popleft()
    c=1
    for x in g[ei]:
        if c == color[ei]:
            c+=1

        color[x]=c
        c+=1
        q.append(x)

print(max(color))
for i in e:
    print(color[i])
r, b, g = map(int, input().split())
print(['NO', 'YES'][(10*b+g)%4 == 0]

### FIXED CODE ###

r, g, b = map(int, input().split())
print(['NO', 'YES'][(10*g + b) % 4 == 0])
import functools
import fructions

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

gcd = functools.reduce(fructions.gcd, a)
print(gcd)

### FIXED CODE ###

import functools
import fractions

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

gcd = functools.reduce(fractions.gcd, a)
print(gcd)
def rec(c, a, x, n, m, start, states, best, price):

    for i in range(start, n):
        price += c[i]

        found = True
        for j in range(0, m):
            states[j] += a[i][j]

            if states[j] < x:
                found = False

        if found and price < best:
            best = price

        if i < n - 1:
            best = rec(c, a, x, n, m, i + 1, states, best, price)

        for j in range(0, m):
            states[j] -= a[i][j]

        price -= c[i]

    return best


def task(n, m, x, c, a):
    mx = [0] * n
    for i in range(0, n):
        for j in range(0, m):
            mx[j] += a[i][j]

    for j in range(0, m):
        if mx[j] < x:
            print(-1)
            return

    states = [0] * m

    # best = 0
    # for i in range(1, 2 ^ n + 1):
    #     price = 0
    #     states = [0] * m
    #     for j in range(0, n):
    #         if ((i >> j) & 1):
    #             price += c[j]
    #             for k in range(0, m):
    #                 states[m] += a[k]
    #                 states[m] += a[k]
    #                 states[m] += a[k]

    best = rec(c, a, x, n, m, 0, states, 1000000, 0)

    print(best)


n, m, x = map(int, input().split())
c = []
a = []
for i in range(0, n):
    values = list(map(int, input().split()))
    c.append(values[0])
    a.append(values[1:])

task(n, m, x, c, a)


### FIXED CODE ###

def task(n, m, x, c, a):
    mx = [0] * m
    for i in range(0, n):
        for j in range(0, m):
            mx[j] += a[i][j]

    for j in range(0, m):
        if mx[j] < x:
            print(-1)
            return

    states = [0] * m

    best = 100000000
    for i in range(1, 2**n):
        price = 0

        for k in range(0, m):
            states[k] = 0

        for j in range(0, n):
            if ((i >> j) & 1):
                price += c[j]
                for k in range(0, m):
                    states[k] += a[j][k]

        if price < best:
            found = True
            for k in range(0, m):
                if states[k] < x:
                    found = False
                    break

            if found:
                best = price

    print(best)


n, m, x = map(int, input().split())
c = []
a = []
for i in range(0, n):
    values = list(map(int, input().split()))
    c.append(values[0])
    a.append(values[1:])

task(n, m, x, c, a)
a,b = (int(x) for x in input().split())
if b % a == 0:
  print(a+b)
 else:
  print(a-b)

### FIXED CODE ###

a,b = (int(x) for x in input().split())
if b % a == 0:
  print(a+b)
else:
  print(b-a)
N , K = map( int , input().strip().split(" ") ) ;

arr = [ 1 for x in range ( N ) ] ;
for x in range ( K ) :
	r = input() ;
	for x in map( int, input().strip().split(" ") ) :
		arr[x-1] = 0 ;
print ( sum( arr ) ) ;

### FIXED CODE ###

X = int( input().strip() ) ;

d = {} ;
for x in range ( 150 ) : 
	v1 = pow ( x, 5 ) ; 
	d[x] = v1 ; 
	d[-x] = -v1 ;
ans = None ;
for A in d :
	if not ans is None :
		break ;
	for B in d :
		if d[A] - d[B] == X : 
			ans = ( A, B, ) ; 
			break ;
if not ans is None :
	print ( "{0} {1}".format ( ans[0] , ans[1] ) );
import sys
sys.setrecursionlimit(2 ** 20)

n = int(input())
ary = [int(_) for _ in input().split()]
q = int(input())
qs = [int(_) for _ in input().split()]


def search(ary, s, q):

    if not ary:
        return False

    else:
        tmp = ary[0]

        if s + tmp == q:
            return True
        else:
            return search(ary[1:], s, q) or search(ary[1:], s + tmp, q)


for q in qs:
    if search(ary, 0, q):
        print('yes')
    else:
        print('no')



### FIXED CODE ###

n = int(input())
ary = [int(_) for _ in input().split()]
q = int(input())
qs = [int(_) for _ in input().split()]


def search_rec(ind, s, q):
    if ind == n:
        return False
    else:
        tmp = ary[ind]
        if s + tmp == q:
            return True
        else:
            return search(ind + 1, s, q) or search(ind + 1, s + tmp, q)


def search(q):
    sum_ary = [0]

    for i in ary:
        for s in sum_ary:
            if s + i == q:
                return True
        sum_ary += [i + _ for _ in sum_ary]

    else:
        return False


for q in qs:
    if search(q):
        print('yes')
    else:
        print('no')
r = input()
print(r**2/1)


### FIXED CODE ###

r = int(input())
print(r**2)
h,w=map(int,input().split()) 
l = [input() for _ in range(h)]
dx = [1,-1,0,0]
dy = [0,0,1,-1]
ans = 'No'
for i in range(w):
    for j in range(h):
        if l[j][i] =='#':
            for di in range(4):
                x = i+dx[di]
                y = j+dy[di]
                if x<0 or y<0 or x>w-1 or y>h-1:
                    continue
                else:
                    if l[x][y] =='#':
                        ans = 'Yes'
print(ans)

### FIXED CODE ###

h,w=map(int,input().split()) 
l = [input() for _ in range(h)]
dx = [1,-1,0,0]
dy = [0,0,1,-1]
for i in range(h):
    for j in range(w):
        if l[i][j] =='#':
            cnt = 0
            for di in range(4):
                y = i+dx[di]
                x = j+dy[di]
                if x<0 or y<0 or x>w-1 or y>h-1:
                    continue
                else:
                    if l[y][x] =='#':
                        cnt +=1
            if cnt == 0:
                print('No')
                exit()

print('Yes')
S=list(input())
print("YES" if a in S and b in S and c in S else "NO")

### FIXED CODE ###

S="".join(sorted(list(input())))
print("Yes" if S == "abc" else "No")
a, b = map(int,raw_input().split())
if a > b:
    print 'a > b'
elif a == b:
    print 'a == b'
else
    print 'a > b'

### FIXED CODE ###

a, b = map(int, raw_input().split())

if a>b:
  print "a > b"
if a<b:
  print "a < b"
if a==b:
  print "a == b"
cart = [4,1,4,1,2,1,2,1]
while True:
	try:
		que = map(int, raw_input().split())
		mx,mxcart = 0, "99999999"
		for sp in range(8):
			sm = 0
			for num in range(8):
				if cart[(sp+num)%8] <= que[num]:
					sm += cart[(sp+num)%8]
				else:
					sm += que[num]
			if sm = mx:
				mx = sm
				mxcart = "".join(map(str, cart[sp:]+cart[:sp]))
			elif sm = mx:
				acart = "".join(map(str, cart[sp:]+cart[:sp]))
				if int(mxcart) > int(acart):
					mxcart = acart
		print " ".join(map(str, mxcart))
	except:
		break

### FIXED CODE ###

c = [4,1,4,1,2,1,2,1]
while True:
	try:
		que = map(int, raw_input().split())
		mx,mxc = 0, "99999999"
		for sp in range(8):
			sm = 0
			for num in range(8):
				sm += c[(sp+num)%8] if c[(sp+num)%8] <= que[num] else que[num]
			if sm > mx:
				mx = sm
				mxc = "".join(map(str, c[sp:]+c[:sp]))
			elif sm == mx:
				ac = "".join(map(str, c[sp:]+c[:sp]))
				if int(mxc) > int(ac):
					mxc = ac
		print " ".join(map(str, mxc))
	except:
		break
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    N,P=map(int,input().split())
    A=list(map(int,list(input())[::-1]))
    MOD=P
    S=[0]*(N+1)
    for i in range(N):
        S[i+1]=(S[i]+A[i]*pow(10,i,MOD))%MOD
    l=[0]*2019
    ans=0
    for i in range(N+1):
        ans+=l[S[i]]
        l[S[i]]+=1
    print(ans)


if __name__ == '__main__':
    main()



### FIXED CODE ###

# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=2019
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    N,P=map(int,input().split())
    A=list(map(int,list(input())[::-1]))
    ans=0
    if P==2 or P==5:
        if P==2:
            s=set([i*2 for i in range(5)])
        else:
            s=set([i*5 for i in range(2)])
        for i,x in enumerate(A[::-1],1):
            if x in s:
                ans+=i
    else:
        S=[0]*(N+1)
        for i in range(N):
            S[i+1]=(S[i]+A[i]*pow(10,i,P))%P
        l=[0]*P
        for i in range(N+1):
            ans+=l[S[i]]
            l[S[i]]+=1
    print(ans)


if __name__ == '__main__':
    main()
import sys
def input(): return sys.stdin.readline().rstrip()

def main():
    N = int(input())
    UVW = [tuple(map(int, input().split())) for _ in range(N - 1)]

    ans = ['0'] * N
    fixed = set()
    for u, v, w in UVW:
        if w % 2 == 1:
            if u in fixed:
                ans[v] = '1'
            else:
                ans[u] = '1'
            fixed.add(u)
            fixed.add(v)
    print("\n".join(ans))

if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
from collections import defaultdict
sys.setrecursionlimit(10 ** 9)
def input(): return sys.stdin.readline().rstrip()

def main():
    N = int(input())

    graph = defaultdict(lambda : defaultdict(int))
    for _ in range(N-1):
        u, v, w = map(int, input().split())
        u -= 1
        v -= 1
        graph[u][v] = w
        graph[v][u] = w

    depth = [-1] * (N)
    depth[0] = 0
    def dfs(x):
        for i, g in graph[x].items():
            if depth[i] > -1:
                continue
            depth[i] = depth[x] + g
            dfs(i)
    dfs(0)
    print("\n".join(['1' if d % 2 == 0 else '0' for d in depth]))

if __name__ == '__main__':
    main()
a = [int(input()) for i in range(4)]
count = 0
for i in range(a[0], -1, -1) :
  y = a[3]
  if (y > 500*i):
    y -= i*500
    if y == 0:
      count += 1
      continue
    for j in range(a[1], -1, -1) :
      if (y > j*100) :
        y -= j*100
        if y == 0:
          count += 1
          continue
      for k in range(a[2], -1, -1) :
        if (y > k*50) :
          y -= k*50
          if y == 0:
      count += 1
      continue
print(count)

### FIXED CODE ###

a = [int(input()) for i in range(4)]
count = 0

for i in range(a[0]+1) :
  for j in range(a[1]+1) :
    for k in range(a[2]+1) :
      sum = 500*i + 100*j + 50*k
      if sum == a[3] :
        count += 1
print(count)
import floor from math
A, B, N = map(int, input().split())
def kansu(x):
  S = floor(A*x/B)
  return S
print(min(kansu(N), kansu(B)))

### FIXED CODE ###

import math
A, B, N = map(int, input().split())
def kansu(x):
  S = math.floor(A*x/B)
  return S
print(min(kansu(N), kansu(B-1)))
def solve(current, n, idx, x):
    if n >= len(x) - idx:
        return 0

    if n == 0:
        return x[-1] - current


    if current is None:
        return solve(x[idx], n - 1, idx + 1, x)

    a = x[idx] - current + solve(x[idx], n, idx + 1, x)
    b = solve(x[idx], n - 1, idx + 1, x)
    return min(a, b)

def main():
    n, m = map(int, input().split())
    x = [int(s) for s in input().split()]
    x.sort()

    print(solve(None, n, 0, x))

main()


### FIXED CODE ###

def solve(n, m, x):
    if n >= m:
        return 0

    y = [x[i + 1] - x[i] for i in range(m - 1)]
    y.sort(reverse=True)

    return x[-1] - x[0] - sum(y[:n-1])

def main():
    n, m = map(int, input().split())
    x = [int(s) for s in input().split()]
    x.sort()

    print(solve(n, m, x))

main()
n = int(raw_input())
b = map(int, raw_input().split(' '))
def f(b):
  n = len(b)+1
  s = 0
  for i in range(n): 
  	s += min(b[i], b[i-1] if i-1>=0 else +float('inf'))
  return s
print f(b)


### FIXED CODE ###


n = int(raw_input())
b = map(int, raw_input().split(' '))
def f(b):
	n = len(b)+1
	s = 0
	for i in range(n):  s += min(b[i] if i < n-1 else +float('inf'), b[i-1] if i-1>=0 else +float('inf'))
	return s
print f(b)
n, k = map(int, input().split())
count = 0
while n >0:
    n //= k
    count += 1
print(count)

### FIXED CODE ###

n, r = map(int, input().split())
if n >= 10:
  print(r)
else:
  print(r + 100*(10-n))
N,K=map(int,input().split())
s={i+1 for i in range(N)}
t={}
for i in range(K):
  input()
  t|=set(map(int,input().split()))
print(len(s-t))

### FIXED CODE ###

N,K=map(int,input().split())
s={i+1 for i in range(N)}
t=set()
for i in range(K):
  input()
  t|=set(map(int,input().split()))
print(len(s-t))
while True:
	a,b=sort(map(int,input().split()))
	break if ((a==0) and (b==0))
	print(a,b)


### FIXED CODE ###

while True:
	a,b=map(int,input().split())
	if (a==0) and (b==0):
		break
	if a > b :
		a,b = b,a
	print(a,b)
#何も考えずに全探索したらO(N^2)で間に合わない

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

#左端の文字は前の文字と変わった直後のみが候補
lst = [0]
for i in range(0, N-1):
    if S[i] != S[i+1]:
        lst += [i+1]

ans = 0
roop = len(lst)
lst = lst + [N]*(N+100)
# print (lst)
# print ('roop', roop)
for i in range(roop):
    if S[lst[i]] == '0':
        # print ('A', lst[i+2*K]- lst[i])
        ans = max(ans, lst[i+2*K]- lst[i])
    if S[lst[i]] == '1':
        # print ('B', lst[i+2*K +1]- lst[i])
        ans = max(ans, lst[i+2*K +1]- lst[i])
print (ans)

### FIXED CODE ###

#何も考えずに全探索したらO(N^2)で間に合わない

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

#左端の文字は前の文字と変わった直後のみが候補
lst = [0]
for i in range(0, N-1):
    if S[i] != S[i+1]:
        lst += [i+1]

ans = 0
roop = len(lst)
lst = lst + [N]*(N+10**5)
# print (lst)
# print ('roop', roop)
for i in range(roop):
    if S[lst[i]] == '0':
        # print ('A', lst[i+2*K]- lst[i])
        ans = max(ans, lst[i+2*K]- lst[i])
    if S[lst[i]] == '1':
        # print ('B', lst[i+2*K +1]- lst[i])
        ans = max(ans, lst[i+2*K +1]- lst[i])
print (ans)
from collections import defaultdict

def foo():
	H, W = map(int, input().split())
	s = ""
	for _ in range(H):
		s += input()

	counter = defaultdict(int)
	for c in s:
		counter[c] += 1

	x1, x2 = H // 2, H % 2
	y1, y2 = W // 2, W % 2

	n = x1 * y1
	k = 0
	for c in counter:
		if k == n:
			break
		while k != n and counter[c] >= 4:
			k += 1
			counter[c] -= 4

	if k != n:
		print("No")
		return

	if x2 == 1:
		n = y1
		k = 0
		for c in counter:
			if k == n:
				break
			while k != n and counter[c] >= 2:
				k += 1
				counter[c] -= 2
		if k != n:
			print("No")
			return

	if y2 == 1:
		n = x1
		k = 0
		for c in counter:
			if k == n:
				break
			while k != n and counter[c] >= 2:
				k += 1
				counter[c] -= 2
		if k != n:
			print("No")
			return

	if sum(counter.values() )	
	print("Yes")

foo()



### FIXED CODE ###

from collections import defaultdict

def foo():
	H, W = map(int, input().split())
	s = ""
	for _ in range(H):
		s += input()

	counter = defaultdict(int)
	for c in s:
		counter[c] += 1

	x1, x2 = H // 2, H % 2
	y1, y2 = W // 2, W % 2

	n = x1 * y1
	k = 0
	for c in counter:
		if k == n:
			break
		while k != n and counter[c] >= 4:
			k += 1
			counter[c] -= 4

	if k != n:
		print("No")
		return

	if x2 == 1:
		n = y1
		k = 0
		for c in counter:
			if k == n:
				break
			while k != n and counter[c] >= 2:
				k += 1
				counter[c] -= 2
		if k != n:
			print("No")
			return

	if y2 == 1:
		n = x1
		k = 0
		for c in counter:
			if k == n:
				break
			while k != n and counter[c] >= 2:
				k += 1
				counter[c] -= 2
		if k != n:
			print("No")
			return
			
	print("Yes")

foo()
n,m = list(map(int,input().split() ))
h = list(map(int,input().split() ))

 # 要素n が全てTrueの配列
good = [True] * n
for im in range(m):
    a,b = list(map(int,input().split()))
    if h[a-1] > h[b-1]:
        good[b] = False
    elif h[b-1] > h[a-1]:
        good[a-1] = False
    else:
        good[a-1] = False
        good[b-1] = False

#count(x) リスト中のxの数を返す
print(good.count(True)) 


### FIXED CODE ###

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

 # 要素n が全てTrueの配列
good = [True] * n
for im in range(m):
    a,b = list(map(int,input().split()))
    if h[a-1] > h[b-1]:
        good[b-1] = False
    elif h[b-1] > h[a-1]:
        good[a-1] = False
    else:
        good[a-1] = False
        good[b-1] = False

#count(x) リスト中のxの数を返す
print(good.count(True))
S, T = input().split()
A, B = map(int, input().split())
U = input()

if (S == U) {
  A -= 1
} else {
  B -= 1
}
print(A, B)

### FIXED CODE ###

S, T = input().split()
A, B = map(int, input().split())
U = input()

if (S == U):
  A -= 1
else:
  B -= 1

print(A, B)
def main(n, m, x, a):
    line = [0 for _ in range(n)]

    for a in a:
        line[a - 1] = 1

    to_left = sum(line[x - 1:])
    to_right = sum(line[x - 1::-1])

    print(min(to_left, to_right))


if __name__ == '__main__':
    n, m, x = map(int, input().split())
    a = list(input().split())

    main(n, m, x, a)


### FIXED CODE ###

"""B - Toll Gates
https://atcoder.jp/contests/abc094/tasks/abc094_b
N M X
A_1 A_2 ... A_M

>>> main(5, 3, 3, [1, 2, 4])
1
>>> main(7, 3, 2, [4, 5, 6])
0
>>> main(10, 7, 5, [1, 2, 3, 4, 6, 8, 9])
3
"""


def main(n, m, x, a):
    line = [0 for _ in range(n)]

    for a in a:
        line[a - 1] = 1

    to_left = sum(line[x - 1:])
    to_right = sum(line[x - 1::-1])

    print(min(to_left, to_right))


if __name__ == '__main__':
    n, m, x = map(int, input().split())
    a = list(map(int, input().split()))

    main(n, m, x, a)
a,b,k=(int(x) for x in input().split())
list =[]

for x in range(1,max(a,b)):
    if(a%x == 0 and b%x == 0):
        list.append(x)

print(list[-k])

### FIXED CODE ###

a,b,k=(int(x) for x in input().split())
list =[]
 
for x in range(1,max(a,b)+1):
    if(a%x == 0 and b%x == 0):
        list.append(x)
 
print(list[-k])
using System;
using System.Linq;

class program
{
    static void Main()
    {
        var abck = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
        var a = abck[0];
      	var b = abck[1];
      	var k = abck[3];
        if (a+b > k)
        {
            Console.Write(a);
            return;
        }
        else
        {
            Console.Write(2*a+b-k);
        }
    }
}

### FIXED CODE ###

a = input()
b = input()
if a == b[:-1]:
  print('Yes')
else:
  print('No')