Harryxun/stf_run huggingface dataset:
N = int(input())

A = []
pop = A.pop
remove = A.remove
insert = A.insert
split = b.split

for i in range(N):
	b= input()
	if (" " in b):
		b, c = split()
		c = int(c)
	
	if b == "insert":
		insert(0, c)
	elif b == "delete":
		if (c in A):
			remove(c)
	elif b == "deleteFirst":
		pop(0)
	elif b == "deleteLast":
		pop()

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

### FIXED CODE ###

from collections import deque

N = int(input())

A = deque()

for i in range(N):
	b= input()
	if b == "deleteFirst":
		A.popleft()
	elif b == "deleteLast":
		A.pop()
	else:
		b, c = b.split()
		c = int(c)
	
		if b == "insert":
			A.appendleft(c)
		elif b == "delete":
			if (c in A):
				A.remove(c)

print(" ".join(map(str, A)))
n = int(input())
a = []
for i in range(n):
    a.append(list(map(int, input().split())))
x = 0
y = 0


for i in range(len(a)):
  x_goal = a[i][1]
  y_goal = a[i][2]
  if i == 0:
    t = a[i][0]
    if y_goal >= 0:
      while y != y_goal:
        y += 1
        t -= 1
    else:
      while y != y_goal:
        y -= 1
        t -= 1
    for time0 in range(t):
      if x > x_goal:
        x -= 1
      else:
        x += 1
    if x == x_goal:
      continue
    else:
      continue
      
  elif i != 0:
    t = a[i][0]-a[i-1][0]
    t = a[i][0]-a[i-1][0]
  while y != y_goal:
    if y_goal > y:
      y += 1
      t -= 1
    elif y_goal < y:
      y -= 1
      t -= 1
    
    for time1 in range(t):
      if x > x_goal:
        x -= 1
      else:
        x += 1
if x == x_goal:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

a, b = map(int, input().split())
if (a*b)%2 == 0:
    print('Even')
elif (a*b)%2 == 1:
    print('Odd')
import sys
n = int(input())
an = list(map(int, sys.stdin.readline().rstrip().split()))
q = int(input())

import numpy as np

sum = np.sum(an)


for _ in range(q):
    b,c = map(int, input().split())
    for i in range(n):
        if b == an[i]:
            an[i]=c
            sum += c-b
    print(sum)

### FIXED CODE ###

alpha = str(input())

if alpha in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ':
    print('A')
else:
    print('a')
H, W = map(int, input().split())
h, w = map(int, input().split())
output = (H-h)*(W-w)
print output

### FIXED CODE ###

H, W = map(int, input().split())
h, w = map(int, input().split())
output = (H-h)*(W-w)
print (output)
n,m=map(int,input().split())
a=list(map(int,input().split()))
for x in a:
  if x >= sum(a)/(4*m):
  	res += x

if res >= m:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

n,m=map(int,input().split())
a=list(map(int,input().split()))
if sum(x >= sum(a)/(4*m) for x in a) >= m:
  print('Yes')
else:
  print('No')
cost_list=list(map(int,input().split())
cost_list.sort(reverse=True)
sum=0
for i in range(len(cost_list)-1):
  sum+=cost_list[i]-cost_list[i+1]
print(sum)

### FIXED CODE ###

cost_list=list(map(int,input().split()))
cost_list.sort(reverse=True)
sum=0
for i in range(len(cost_list)-1):
  sum+=(cost_list[i]-cost_list[i+1])
print(sum)
a, b = map(int,input().split())
area = a * b
perimeter = (a + b) * 2
ptint(str(area) + ' ' + str(perimeter))


### FIXED CODE ###

a, b = map(int,input().split())
area = a * b
perimeter = (a + b) * 2
print(str(area) + ' ' + str(perimeter))
h,w=map(int,input().split())
a=['']*h
for i in range(h):
    a[i]=input()

row=[False]*h
col=[False]*w

for i in range(h):
    for j in range(w):
        if a[i][j]=="#":
            raw[i]=true
            col[j]=true;

for i in range(h):
    if raw[i]:
        for j in range(w):
            if col[j]:
                print(a[i][j],end="")
        print()


### FIXED CODE ###

h,w=map(int,input().split())
a=['']*h
for i in range(h):
    a[i]=input()

row=[False]*h
col=[False]*w

for i in range(h):
    for j in range(w):
        if a[i][j]=="#":
            row[i]=True
            col[j]=True;

for i in range(h):
    if row[i]:
        for j in range(w):
            if col[j]:
                print(a[i][j],end="")
        print()
import sys
n = sys.stdin.readline().rstrip()
s = sys.stdin.readline().rstrip()
if n = s[:len(n)]:
  print('Yes')
else:
print('No')


### FIXED CODE ###

import sys
n = sys.stdin.readline().rstrip()
s = sys.stdin.readline().rstrip()
if n == s[:len(n)]:
  print('Yes')
else:
  print('No')
n = int(input())
t = list(map(int,input().split()))
m = int(input())
a,b = 0,0
for _ in range(m):
  a,b = map(int,input().split())
  print(sum(t) - t[a] + b)

### FIXED CODE ###

n = int(input())
t = list(map(int,input().split()))
m = int(input())
a,b = 0,0
for _ in range(m):
  a,b = map(int,input().split())
  print(sum(t) - t[a-1] + b)
import math

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

#B=list(map(lambda x: int(math.log2(x)), A))

#どこに何枚適用するか
D=[0 for _ in range(N)]

for i in range(M):
    A.index(max(A)) = A.index(max(A)) // 2

print(sum(A))

### FIXED CODE ###

import heapq as hq

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

#ヒープキューのために符号逆転
A=list(map(lambda x: x * (-1), A))
hq.heapify(A)

for i in range(M):
    a = hq.heappop(A) * (-1)
    hq.heappush(A, a // 2 * (-1))

print(sum(A) * (-1))
N = int(input())
list_a = [int(input()) for i in range(N)]
s = []
for i in list_a:
    if s.count(i) == 0
        s.append(i)
print(len(s))

### FIXED CODE ###

N = int(input())
list_a = [int(input()) for i in range(N)]
s = []
for i in list_a:
    if s.count(i) == 0:
        s.append(i)
print(len(s))
#import numpy as np
#import math
from fractions import gcd

def main():

    ##get int
    first_input = list(map(lambda x:int(x), input().split(" ")))
    #second_input = list(map(lambda x:int(x), input().split(" ")))

    ##get float
    #first_input = list(map(lambda x:float(x), input().split(" ")))
    #second_input = list(map(lambda x:float(x), input().split(" ")))

    ##get string
    #first_input = input().split(" ")

    K = first_input[0]

    gcd_sum = 0
    for a in range(1,K+1):
        for b in range(1,K+1):
            for c in range(1,K+1):
                gcd_sum = gcd_sum + gcd(gcd(a,b),c)

    print(gcd_sum)

if __name__ == '__main__':
    main()


### FIXED CODE ###

#import numpy as np
import math
#from fractions import gcd

def main():

    ##get int
    first_input = list(map(lambda x:int(x), input().split(" ")))
    #second_input = list(map(lambda x:int(x), input().split(" ")))

    ##get float
    #first_input = list(map(lambda x:float(x), input().split(" ")))
    #second_input = list(map(lambda x:float(x), input().split(" ")))

    ##get string
    #first_input = input().split(" ")

    K = first_input[0]

    gcd_sum = 0
    for a in range(1,K+1):
        for b in range(1,K+1):
            for c in range(1,K+1):
                gcd_sum = gcd_sum + math.gcd(math.gcd(a,b),c)

    print(gcd_sum)

if __name__ == '__main__':
    main()
import sys
input = sys.stdin.readline
n = int(input())
time_list = [map(int, input().split()) for _ in range(n)]
m = int(input())
problem_list = [map(int, input().split()) for _ in range(m)]
for i in problem_list:
  time_list[i[0]-1] = i[1]
  print(sum(time_list))

### FIXED CODE ###

n = int(input())
time_list = list(map(int, input().split()))
m = int(input())
problem_list = list(list(map(int, input().split())) for _ in range(m))
for i in problem_list:
  print(sum(time_list) - time_list[i[0]-1] + i[1])
n=input()
n1=int(n)
n=list(n)
k=0
for i in range(len(n)):
    k+=int(a[i])
if n1%k==0:print('Yes')
else:print('No')


### FIXED CODE ###

n=input()
n1=int(n)
n=list(n)
k=0
for i in range(len(n)):
    k+=int(n[i])
if n1%k==0:print('Yes')
else:print('No')
n = int(input())
p = [int(input()) for in range(n)]
print(sum(p) - max(p)//2)



### FIXED CODE ###

n = int(input())
p = [int(input()) for i in range(n)]
print(sum(p) - max(p)//2)
K, X = map(int, input().split())

max = K - 1

for i in Range(max):
  print(X - (K - i))

print(X)

for j in Range(max - 1):
  print(X + j + 1)


### FIXED CODE ###

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

start = b-a+1
loop = (a*2) -1

for i in range(loop):
    print(start + i ,end=" ")
S = input()
K = int(input())
l = len(S)
topk = []
vocab = set()

for idx in range(K):
    ss = S[0:idx + 1]
    if ss in vocab:
        continue
    topk.append(ss)
    vocab.add(ss)
for idx in range(1, l):
    sblen = 0
    for sblen in range(1, l - idx):
        ss = S[idx: idx + sblen]
        if ss in vocab:
            continue
        vocab.add(ss)
        if len(topk) < K:
            topk.append(ss)
            continue

        if ss > topk[-1]:
            break
        else:
            topk[-1] = ss
            topk.sort()

print(topk[K-1])


### FIXED CODE ###

S = input()
K = int(input())
l = len(S)
topk = []
a = []

for i in range(l):
    for j in range(i + 1, i + K + 1):
        if j > l:
            break
        ss = S[i: j]
        a.append(ss)

print(sorted(list(set(a)))[K-1])
if __name__ == '__main__':
  a, b = map(int, input())
  if a >= b:
    print(a)
  elif a < b:
    print(b)

### FIXED CODE ###

if __name__ == '__main__':
    a, b = map(int, input().split())
    if a > b:
        print(a-1)
    elif a <= b:
        print(a)
N=int(input())
P=list(range(1,N+1))
print(sum(P[0:N-1])+P[-1]%P[0])

### FIXED CODE ###

N=int(input())
print(N*(N-1)//2)
def search(s, t):
    global g
    node = g[s]
    node[1] = 1
    if s == t:
        return True
    else:
        for i in node[0]:
            ch = g[i]
            if ch[1] == 0:
                result = search(i, t)
                if result:
                    return result
        return False

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

g = [[[], 0] for i in range(n)]
for i in range(m):
    s, t = list(map(int, input().split()))
    g[s][0].append(t)
    g[t][0].append(s)

q = int(input())
for i in range(q):
    s, t = list(map(int, input().split()))
    result = search(s, t)
    if result:
        print("yes")
    else:
        print("no")
    for node in g:
        node[1] = 0

### FIXED CODE ###

def dfs(u, color):
    global c
    global g
    s = [u]
    c[u] = color
    while 0 < len(s):
        ch = s.pop()
        for ch in g[ch]:
            u_c = c[ch]
            if u_c is None:
                c[ch] = color
                s.append(ch)

def colorize():
    global g
    global c
    global n
    color = 1
    for i in range(n):
        if c[i] == None:
            dfs(i, color)
            color += 1

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

g = [[] for i in range(n)]
for i in range(m):
    s, t = list(map(int, input().split()))
    g[s].append(t)
    g[t].append(s)

c = [None for i in range(n)]

colorize()

q = int(input())
for i in range(q):
    s, t = list(map(int, input().split()))
    if c[s] == c[t]:
        print("yes")
    else:
        print("no")
abc = map(int, input().split())
print(abc.count(1))
    

### FIXED CODE ###

abc = input()
abc = str(abc)
print(abc.count("1"))
a=[]
for i in range(5):
  s=int(input())
  a.apppend(s)
k=int(input())
if (a[4]-a[0])<=k:
  print('Yay!')
  
else:
  print(':(')

### FIXED CODE ###

a=[]
for i in range(5):
  s=int(input())
  a.append(s)
k=int(input())
if (a[4]-a[0])<=k:
  print('Yay!')
  
else:
  print(':(')
s,t=map(input().split())
a,b=map(int,input().split())
c=input()
 
if s==c:
  print("{}""{}".format(a-1,b))
else:
  print("{}""{}".format(a,b-1))

### FIXED CODE ###

s,t=input().split()
a,b=map(int,input().split())
c=input()
d=" "
if s==c:
  print("{}""{}""{}".format(a-1,d,b))
else:
  print("{}""{}""{}".format(a,d,b-1))
import sys
input = sys.stdin.readline

def li():
    return [int(x) for x in input().split()]


N, K = li()
P = [0] + li()
C = [0] + li()
max_scores = [-10**12] * (N+10)
K = 10**9
for init_i in range(1, N+1):
    i = init_i
    scores = [-10**9] * (K+1)
    scores[0] = 0
    for l in range(1, K+1):
        i = P[i]
        scores[l] = scores[l-1] + C[i]
    scores[0] = -10**12
    max_scores[i] = max(scores)
print(max(max_scores))

### FIXED CODE ###

def li():
    return [int(x) for x in input().split()]

N, K = li()
P = [0] + li()
C = [0] + li()

def get_cycle(start_i):
    cycle = []
    i = start_i
    while True:
        i = P[i]
        if i == start_i:
            break
        cycle.append(i)
    cycle.append(start_i)
    return cycle

def get_cycle_scores(cycle):
    score = 0
    scores = [score]
    for i in cycle:
        score += C[i]
        scores.append(score)
    return scores

max_scores = []
for start_i in range(1,N+1):
    cycle = get_cycle(start_i)
    scores = get_cycle_scores(cycle)
    cycle_len = len(cycle)
    score_per_cycle = scores[cycle_len]
    # 1cycle以下の場合は全て調べればよし
    if K <= len(cycle):
        max_score = max(scores[move] for move in range(1, K+1))
        max_scores.append(max_score)
        continue
    # 1サイクルごとのスコアがマイナスならサイクルを回らないのがハイスコア
    if score_per_cycle <= 0:
        max_score = max(scores[move] for move in range(1, cycle_len+1))
        max_scores.append(max_score)
        continue
    # 1サイクルごとのスコアがプラスなら限界までサイクルを回るのがハイスコア
    # ラスト1cycleのスコアを調べる
    scores_last_cycle = []
    for move in range(K-cycle_len+1, K+1):
        # 何周したか
        loop_cnt = move // cycle_len
        # あまり
        rest_move = move % cycle_len
        # スコア = 1周ごとのスコア * 何周したか + あまり
        score = loop_cnt * score_per_cycle + scores[rest_move]
        scores_last_cycle.append(score)

    max_scores.append(max(scores_last_cycle))

print(max(max_scores))
if S<W:
  print("unsafe")
else:
  print("safe")

### FIXED CODE ###

S, W = map(int, input().split())

if S <= W:
  print("unsafe")
else:
  print("safe")
N = int(input())
x1, y1 = map(int, input().split())
x2, y2 = map(int, input().split())
if x1+y1 > x2+y2:
    xmax = x1+y1
    xmin = x2+y2
else:
    max1 = x2+y2
    min1 = x1+y1

if x1-y1 > x2-y2:
    max2 = x1-y1
    min2 = x2-y2
else:
    max2 = x2-y2
    min2 = x1-y1

for i in range(N-2):
    x, y = map(int, input().split())
    if x+y > max1:
        max1 = x+y
    elif x+y < min1:
        min1 = x+y
    
    if x-y > max2:
        max2 = x-y
    elif x-y < min2:
        min2 = x-y

print(max((max1-min1), (max2-min2)))

### FIXED CODE ###

N = int(input())
x1, y1 = map(int, input().split())
x2, y2 = map(int, input().split())
if x1+y1 > x2+y2:
    max1 = x1+y1
    min1 = x2+y2
else:
    max1 = x2+y2
    min1 = x1+y1

if x1-y1 > x2-y2:
    max2 = x1-y1
    min2 = x2-y2
else:
    max2 = x2-y2
    min2 = x1-y1

for i in range(N-2):
    x, y = map(int, input().split())
    if x+y > max1:
        max1 = x+y
    elif x+y < min1:
        min1 = x+y
    
    if x-y > max2:
        max2 = x-y
    elif x-y < min2:
        min2 = x-y


ans = print(max((max1-min1),(max2-min2)))
import copy
from scipy.special import comb
n = int(input())
#x, y, a, b, c = map(int, input().split())
#s= list(input())
a = list(map(int, input().split()))
an = [0] * n
for i in range(n):
    an[a[i]-1] += 1

ac2 = []
ac2_diff = []
for i in range(n):
    ac2.append(comb(an[i], 2, exact=True))
    ac2_diff.append(ac2[i]-comb(an[i]-1, 2, exact=True))
sum = sum(ac2)
for i in range(n):
    print(sum - ac2_diff[a[i]-1])

### FIXED CODE ###

import copy
from scipy.misc import comb
n = int(input())
#x, y, a, b, c = map(int, input().split())
#s= list(input())
a = list(map(int, input().split()))
an = [0] * n
for i in range(n):
    an[a[i]-1] += 1

ac2 = []
ac2_diff = []
for i in range(n):
    ac2.append(comb(an[i], 2, exact=True))
    ac2_diff.append(ac2[i]-comb(an[i]-1, 2, exact=True))
sum = sum(ac2)
for i in range(n):
    print(sum - ac2_diff[a[i]-1])
a,b,c=input().split()
print("YES" if a[-1]==b[0]&&b[-1]==c[0] else "NO")

### FIXED CODE ###

a,b,c=input().split()
print("YES" if a[-1]==b[0] and b[-1]==c[0] else "NO")
while True:
    e=int(input())
    if e==0:
        break
    m=e
    for z in range(int(e**(1/3))+1,-1,-1):
        temp=e-z**3
        for y in range(int(e**(1/2))+1,-1,-1):
            x=temp-y**2
            if x>=0 and (x+y+z<m):
                m=x+y+z
    print(m)


### FIXED CODE ###

from math import sqrt

while True:
    e=int(input())
    if e==0:
        break
    m=e
    for z in range(e):
        if(z**3>e):
            break
        temp=e-z**3
        y=int(sqrt(temp))
        x=temp-y**2
        m=min(m,x+y+z)
    print(m)
s = input()
n = len(s)
mae = (n-1)//2
usiro = (n+3)//2

for i in range(mae):
  if s[i] != s[mae-1-i]:
    print("No")
    exit()
    
for i in range(usiro-1, n):
  if s[i] != s[n-1+usiro-i]:
    print("No")
    exit()
print("Yes")

### FIXED CODE ###

s = input()
n = len(s)
mae = (n-1)//2
usiro = (n+3)//2

for i in range(mae):
  if s[i] != s[mae-1-i] or s[i] != s[usiro-1+i]:
    print("No")
    exit()
    
for i in range(usiro-1, n):
  if s[i] != s[n-1+usiro-1-i]:
    print("No")
    exit()
print("Yes")
n = int(raw_input())
S = map(int, raw_input(),split())

q = int(raw_input())
T = map(int, raw_input().split())

ans = 0

for i in T:
    if i in S:
        ans += 1

print ans

### FIXED CODE ###

n = int(raw_input())
S = map(int, raw_input().split())

q = int(raw_input())
T = map(int, raw_input().split())

ans = 0

for i in T:
    if i in S:
        ans += 1

print ans
s = input()
if s[:4] = 'YAKI':
  print('Yes')
else:
  print('No')

### FIXED CODE ###

s = input()
if s[:4] == 'YAKI':
  print('Yes')
else:
  print('No')
# vim: set fileencoding=utf-8:
import bisect


def main():
    N, K = map(int, raw_input().split())
    x = [int(ele) for ele in raw_input().split()]
    o = bisect.bisect_right(x, 0)
    top = min(o + K, N)
    bottom = max(o - K, 0)
    best = 999999999999
    for i in xrange(K):
        if top < bottom + i + K:
            break

        print(x[bottom + i:bottom + i + K])
        print(x[bottom + i + K - 1])
        if x[bottom + i + K - 1] < 0:
            best = min(best, abs(x[bottom + i]))
        elif x[bottom + i] < 0 <= x[bottom + i + K - 1]:
            best = min(best, 2 * abs(x[bottom + i]) + x[bottom + i + K - 1])
        elif 0 <= x[bottom + i]:
            best = min(best, x[bottom + i + K - 1])

    print(best)


if __name__ == "__main__":
    main()


### FIXED CODE ###

# vim: set fileencoding=utf-8:
import bisect


def main():
    N, K = map(int, raw_input().split())
    x = [int(ele) for ele in raw_input().split()]
    o = bisect.bisect_right(x, 0)
    top = min(o + K, N)
    bottom = max(o - K, 0)
    best = 999999999999
    for i in xrange(K):
        if top < bottom + i + K:
            break

        if x[bottom + i + K - 1] < 0:
            best = min(best, abs(x[bottom + i]))
        elif x[bottom + i] < 0 <= x[bottom + i + K - 1]:
            ans1 = 2 * min(abs(x[bottom + i]), x[bottom + i + K - 1])
            ans2 = max(abs(x[bottom + i]), x[bottom + i + K - 1])
            ans = min(best, ans1 + ans2)
            best = min(best, ans)
        elif 0 <= x[bottom + i]:
            best = min(best, x[bottom + i + K - 1])

    print(best)


if __name__ == "__main__":
    main()
N = int(input())

if N % 2 != 0:
    print(0)

else:
        count = N // 10
        for j in range(1, 50):
            count += N // ((5**j) * 10)

print(count)


### FIXED CODE ###

N = int(input())

if N % 2 != 0:
    print(0)
else:
    count = N // 10
    for j in range(1, 50):
        count += N // ((5**j) * 10)
    print(count)
N=int(input())
H=list(map(int,input().split()))
ans=0
tmp=0
for i in range(N-1):
  if H[i]>=H[i+1]:
    tmp+=1
  else:
    tmp=0
  anｓ=max(tmp,ans)
  
print(ans)


### FIXED CODE ###

S = input()
T = input()
count = 0
for i in range(3):
    if S[i] == T[i]:
        count += 1
print(count)
import sys
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()


def main():
    N, Q = LI()
    s = SI()
    TD = []
    for _ in range(Q):
        TD.append(LS())
    rev = TD[::-1]
    l, r = -1, N
    for t, d in rev:
        if t == s[l + 1] and d == 'L':
            l += 1
        elif t == s[r - 1] and d == 'R':
            r -= 1
        if l > -1 and t == s[l] and d == 'R':
            l -= 1
        elif r < N and t == s[r] and d == 'L':
            r += 1
    ans = max(0, r - l - 1)
    return ans

print(main())

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()


def main():
    N, Q = LI()
    s = SI()
    TD = []
    for _ in range(Q):
        TD.append(LS())
    rev = TD[::-1]
    l, r = -1, N
    for t, d in rev:
        if t == s[l + 1] and d == 'L':
            l += 1
        elif t == s[r - 1] and d == 'R':
            r -= 1
        if l > -1 and t == s[l] and d == 'R':
            l -= 1
        elif r < N and t == s[r] and d == 'L':
            r += 1
        if r == 0 or l == N - 1:
            break
    ans = max(0, r - l - 1)
    return ans

print(main())
#Solver:Rute
a,b,c,k = map(int,input().split())
if k<=a:
  print(k)
elif a<k<=a+b:
  print(k)
else:
  #-1のカードの枚数超過 (k-(a+b))枚
  print(a-(k-(a+b)))


### FIXED CODE ###

#Solver:Rute
S = input()
T = input()
if T[0:len(S)] == S:
  print("Yes")
else:
  print("No")
# 同じ木に属する(==そこまでたどりつけるかどうか）の判定にunionfind
# 同じ木に属しているノードはあとで数えることができる（そうだね）
# 除外するやつが出てくる。直の友達+ブロック関係にあるやつ（と自分）
# 同じ木に属しているノードの総数 - (直の友達+ブロック関係+自分自身)が答え
n, m, k = map(int, input().split())
par = [i for i in range(n)]
ans = [0 for _ in range(n)]


def root(x):
    if x == par[x]:
        return x
    y = root(par[x])
    par[x] = y
    return y


def union(x, y):
    if x > y:
        x, y = y, x
    rx, ry = root(x), root(y)
    if rx != ry:
        par[ry] = rx


friends = [[] for _ in range(n)]
blocks = [[] for _ in range(n)]

for _ in range(m):
    a, b = map(int, input().split())
    union(a - 1, b - 1)
    friends[a - 1].append(b - 1)
    friends[b - 1].append(a - 1)
for _ in range(k):
    c, d = map(int, input().split())
    blocks[c - 1].append(d - 1)
    blocks[d - 1].append(c - 1)

# 木に属しているやつを数えるぜ
group_count = [0 for _ in range(n)]
for i in range(n):
    group_count[root(i)] += 1
# 答えを作るぜ
for i in range(n):
    # 初期化（じゃないけど）
    ans[i] += group_count[root(i)]
    # 直の友達を除く
    ans[i] -= len(friends[i])
    # ブロックしてるやつを除く
    for b in blocks[i]:
        ra, rb = root(i), root(b)
        if ra == rb:
            ans[i] -= 1
    # 自分自身を除く
    ans[i] -= 1
print(" ".join(list(map(str, ans))))


### FIXED CODE ###

 # 同じ木に属する(==そこまでたどりつけるかどうか）の判定にunionfind
# 同じ木に属しているノードはあとで数えることができる（そうだね）
# 除外するやつが出てくる。直の友達+ブロック関係にあるやつ（と自分）
# 同じ木に属しているノードの総数 - (直の友達+ブロック関係+自分自身)が答え
from sys import setrecursionlimit
setrecursionlimit(10**8)
n, m, k = map(int, input().split())
par = [i for i in range(n)]
ans = [0 for _ in range(n)]


def root(x):
    if x == par[x]:
        return x
    y = root(par[x])
    par[x] = y
    return y


def union(x, y):
    if x > y:
        x, y = y, x
    rx, ry = root(x), root(y)
    if rx != ry:
        par[ry] = rx


friends = [[] for _ in range(n)]
blocks = [[] for _ in range(n)]

for _ in range(m):
    a, b = map(int, input().split())
    union(a - 1, b - 1)
    friends[a - 1].append(b - 1)
    friends[b - 1].append(a - 1)
for _ in range(k):
    c, d = map(int, input().split())
    blocks[c - 1].append(d - 1)
    blocks[d - 1].append(c - 1)

# 木に属しているやつを数えるぜ
group_count = [0 for _ in range(n)]
for i in range(n):
    group_count[root(i)] += 1
# 答えを作るぜ
for i in range(n):
    # 初期化（じゃないけど）
    ans[i] += group_count[root(i)]
    # 直の友達を除く
    ans[i] -= len(friends[i])
    # ブロックしてるやつを除く
    for b in blocks[i]:
        ra, rb = root(i), root(b)
        if ra == rb:
            ans[i] -= 1
    # 自分自身を除く
    ans[i] -= 1
print(" ".join(list(map(str, ans))))
n=int(input())
a,b=input().split()
r=''
for i in range(N):
  r=r+a[i]
  r=r+b[i]
print(r)

### FIXED CODE ###

n=int(input())
a,b=input().split()
r=''
for i in range(n):
  r=r+a[i]
  r=r+b[i]
print(r)
S=map(int,raw_input().split())
print S/3600:((S-(S/3600)*3600)/60):((S-(S/3600)*3600)-(S/3600)*3600)/60)

### FIXED CODE ###

S=input()
h=S/3600
r=S%3600/60
s=S-h*3600-r*60
print str(h)+':'+str(r)+':'+str(s)