Harryxun/stf_run huggingface dataset:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jul  7 18:47:41 2020

@author: naoki
"""
import sys
import copy
def func():
    N, M = map(int, input().split())
    uvs = [list(map(lambda x:int(x)-1, input().split())) for _ in range(M)]
    S, T = map(lambda x:int(x)-1, input().split())
    
    roots = [[] for _ in range(N)]
    
    for uv in uvs:
        roots[uv[0]].append(uv[1])
    
    costs = [-10000]*(N)
    
    from collections import deque
    
    todo = deque([S])
    costs[S] = 0
    todo_set = set([S])
    
    for i in range(M):
    #while len(todo)>0:
        checking = todo.popleft()
        next_targets = deque([checking])
        for i in range(3):
            purposes = set()
            while len(next_targets) > 0:
                now = next_targets.pop()
                for root in roots[now]:
                    purposes.add(root)
            next_targets = purposes.copy()
        for next_target in next_targets:
            if costs[next_target] < 0 and next_target not in todo_set:
                costs[next_target] = costs[checking]+1
                todo.append(next_target)
                todo_set.add(next_target)
                if next_target == T:
                    print(costs[next_target])
                    sys.exit()
    print(-1)
if __name__ == "__main__":
    func()

### FIXED CODE ###

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jul  7 18:47:41 2020

@author: naoki
"""
import sys
import copy
def func():
    N, M = map(int, input().split())
    uvs = [list(map(lambda x:int(x)-1, input().split())) for _ in range(M)]
    S, T = map(lambda x:int(x)-1, input().split())
    
    roots = [[] for _ in range(N)]
    
    for uv in uvs:
        roots[uv[0]].append(uv[1])
    
    costs = [-10000]*(N)
    
    from collections import deque
    
    todo = deque([S])
    costs[S] = 0
    todo_set = set([S])
    
    layers = [set() for _ in range(3)]
    
    while len(todo)>0:
        checking = todo.popleft()
        next_targets = deque([checking])
        for i in range(3):
            purposes = set()
            while len(next_targets) > 0:
                now = next_targets.pop()
                for root in roots[now]:
                    if root not in layers[i]:
                        layers[i].add(root)
                        purposes.add(root)
            next_targets = purposes.copy()
        for next_target in next_targets:
            if costs[next_target] < 0 and next_target not in todo_set:
                costs[next_target] = costs[checking]+1
                todo.append(next_target)
                todo_set.add(next_target)
                if next_target == T:
                    print(costs[next_target])
                    sys.exit()
    print(-1)
if __name__ == "__main__":
    func()
S=int(input())
sec=S%60
min=(S-sec)%3600/60
hour=(S-min*60-sec)/3600
print(hour+":"+min+":"+sec)

### FIXED CODE ###

import math
S=int(input())

hour = math.floor(S/3600)
min = math.floor((S-hour*3600)/60)
sec =  S - hour*3600 - min*60

print(str(hour)+":"+str(min)+":"+str(sec))
S=input()
s=[]
for i in S:
    s+=[i]
ans=0
que=[]
que+=[s[0]]
def cube(i):
    global ans
    if i==len(s):
        return 1
    else:
        que.append(s[i])
        flag=True
        while flag:
            if len(que)==0 or len(que)==1:
                flag=False
            elif que[-1]==que[-2]:
                flag=False
            elif que[-1]!=que[-2]:
                del que[-1]
                del que[-1]
                ans+=2
        cube(i+1)
cube(1)
print(ans)


### FIXED CODE ###


import sys
sys.setrecursionlimit(1000000)

S=input()
s=[]
for i in S:
    s+=[i]
ans=0
que=[]
que+=[s[0]]
def cube(i):
    global ans
    if i==len(s):
        print(ans)
    else:
        que.append(s[i])
        flag=True
        while flag:
            if len(que)==0 or len(que)==1:
                flag=False
            elif que[-1]==que[-2]:
                flag=False
            elif que[-1]!=que[-2]:
                del que[-1]
                del que[-1]
                ans+=2
        cube(i+1)
cube(1)
import numpy as np
import queue
H,W=map(int,input().split())
S=list()
for m in range(H):
  S.append(input())
ans=0
i,j=7,6
if S[i][j]==".":
    L=[[-1]*W for i in range(H)]
    L[i][j]=0
    q=queue.Queue()
    q.put([i,j])
    while not q.empty():
      r=q.get()
      for k,l in [[1,0],[0,-1],[0,1],[-1,0]]:
        if r[0]+k>=0 and r[0]+k<H and r[1]+l>=0 and r[1]+l<W and S[r[0]+k][r[1]+l]=="." and L[r[0]+k][r[1]+l]==-1:
          L[r[0]+k][r[1]+l]=L[r[0]][r[1]]+1
          q.put([r[0]+k,r[1]+l])
    ans=max(ans,max(list(map(lambda x: max(x),L))))
print(ans)

### FIXED CODE ###

import numpy as np
import queue
H,W=map(int,input().split())
S=list()
for i in range(H):
  S.append(input())
ans=0
  
for i in range(H):
  for j in range(W):
    if S[i][j]==".":
      L=[[-1]*W for i in range(H)]
      L[i][j]=0
      q=queue.Queue()
      q.put([i,j])
      while not q.empty():
        r=q.get()
        for k,l in [[1,0],[0,-1],[0,1],[-1,0]]:
          if r[0]+k>=0 and r[0]+k<H and r[1]+l>=0 and r[1]+l<W and S[r[0]+k][r[1]+l]=="." and L[r[0]+k][r[1]+l]==-1:
            L[r[0]+k][r[1]+l]=L[r[0]][r[1]]+1
            q.put([r[0]+k,r[1]+l])
      ans=max(ans,max(list(map(lambda x:max(x),L))))
print(ans)
N, M = map(int, input().split())
ls = []
for i in range(1,M):
  if M%i==0:
    j = M//i
    if i<=M//N:
      ls += [i]
    if j<=M//N:
      ls += [j]
  if M**0.5<i:
    break
print(max(ls))


### FIXED CODE ###

N, M = map(int, input().split())
ls = []
for i in range(1,M+1):
  if M%i==0:
    j = M//i
    if i<=M//N:
      ls += [i]
    if j<=M//N:
      ls += [j]
  if M**0.5<i:
    break
print(max(ls))
#Deven-Eleven:
D = (((-1, -1), (0, -1), (1, 0), (0, 1), (-1, 1), (-1, 0)),
     ((0, -1), (1, -1), (1, 0), (1, 1), (0, 1), (-1, 0)))
def func(y, x):
    q = [(y, x, 0)]
    cover = [[-1] * m for _ in xrange(n)]
    return cover
    while len(q) != 0:
        y, x, step = q.pop(0)
        if cover[y][x] >= 0:
            continue
        cover[y][x] = step
        for dx, dy in D[y % 2]:           
            ny, nx = y + dy, x + dx
            if 0 <= ny < n and 0 <= nx < m:
                q.append((ny, nx, step + 1))
    return cover
 
def solve():
    scover = [func(pos[1] - 1, pos[0] - 1) for pos in spos]
    min_cover = [[min(sc[y][x] for sc in scover) for x in xrange(m)] for y in xrange(n)]
    def count(cover):
        ret = 0
        for y in xrange(n):
            for x in xrange(m):
                if cover[y][x] < min_cover[y][x]:
                    ret += 1
        return ret
    return max(count(func(pos[1] - 1, pos[0] - 1)) for pos in tpos)
 
while True:
    data = raw_input()
    if data == "0":
        break
    m, n = map(int, data.split())
    s = input()
    spos = [map(int, raw_input().split()) for _ in xrange(s)]
    t = input()
    tpos = [map(int, raw_input().split()) for _ in xrange(t)]
    print solve()

### FIXED CODE ###

#Deven-Eleven:
D = (((-1, -1), (0, -1), (1, 0), (0, 1), (-1, 1), (-1, 0)),
     ((0, -1), (1, -1), (1, 0), (1, 1), (0, 1), (-1, 0)))
def func(y, x):
    q = [(y, x, 0)]
    cover = [[-1] * m for _ in xrange(n)]
    while len(q) != 0:
        y, x, step = q.pop(0)
        if cover[y][x] >= 0:
            continue
        cover[y][x] = step
        for dx, dy in D[y % 2]:           
            ny, nx = y + dy, x + dx
            if 0 <= ny < n and 0 <= nx < m:
                q.append((ny, nx, step + 1))
    return cover
 
def solve():
    scover = [func(pos[1] - 1, pos[0] - 1) for pos in spos]
    min_cover = [[min(sc[y][x] for sc in scover) for x in xrange(m)] for y in xrange(n)]
    def count(cover):
        ret = 0
        for y in xrange(n):
            for x in xrange(m):
                if cover[y][x] < min_cover[y][x]:
                    ret += 1
        return ret
    return max(count(func(pos[1] - 1, pos[0] - 1)) for pos in tpos)

while True:
    data = raw_input()
    m, n = map(int, data.split())
    if m == 0:
        break
    s = input()
    spos = [map(int, raw_input().split()) for _ in xrange(s)]
    t = input()
    tpos = [map(int, raw_input().split()) for _ in xrange(t)]
    print solve()
a, b, c = map(int, input().split())
if a <= b:
    if b <= c:
        print("{0} {1} {2}".format(a, b, c))
    else if c <= a:
        print("{0} {1} {2}".format(c, a, b))
    else:
        print("{0} {1} {2}".format(a, c, b))

else:
    if a <= c:
        print("{0} {1} {2}".format(b, a, c))
    else if c <= b:
        print("{0} {1} {2}".format(c, b, a))
    else:
        print("{0} {1} {2}".format(b, c, a))

### FIXED CODE ###

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

if a <= b:
    if b <= c:
        print("{0} {1} {2}".format(a, b, c))
    elif c <= a:
        print("{0} {1} {2}".format(c, a, b))
    else:
        print("{0} {1} {2}".format(a, c, b))

else:
    if a <= c:
        print("{0} {1} {2}".format(b, a, c))
    elif c <= b:
        print("{0} {1} {2}".format(c, b, a))
    else:
        print("{0} {1} {2}".format(b, c, a))
t=list(input())
for i in range(len(t)):
    if t[i]=='?':
        t[i]=D
    print(t[i],end="")

### FIXED CODE ###

t=list(input())
for i in range(len(t)):
    if t[i]=="?":
        t[i]="D"
    print(t[i],end='')
n,a = map(int.input().split())
b = list[]
for n:
  b.append(a)

c = a**n
if c > 10**18:
  c = -1
  print(c)


### FIXED CODE ###

def main ():
  N = int(input())
  A = list(map(int,input(). split ()))
  
  if 0 in A:
    print(0)
    return
  prod = 1
  for a in A:
    prod *= a
    if prod > 1000000000000000000:
      print(-1)
      return
  print(prod)
main ()
import fractions
from functools import reduce

def gcd(*numbers):
    return reduce(fractions.gcd, numbers)

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)
tmp =gcd_list(A)
for i in range(100):
    if tmp == 2**i:
        print(i)
        break

### FIXED CODE ###

N = [int(i) for i in input()]
A = [int(i) for i in input().split()]

cnt=0
while all(i%2 ==0 for i in A):
  A = [i/2 for i in A]
  cnt+=1
print(cnt)
s = input()
x,y = map(int,input().split())
k = 0
data = [[],[]]
f = 0
p = 1
for s_ in s:
    if p==1 and s_=='F':
        x -= 1
        continue
    p = 0
    if s_ == 'T':
        if f:
            data[k].append(f)
        k = (k+1)%2
        f = 0
    else:
        f += 1
if f:
    data[k].append(f)

nx = sum(data[0])
ny = sum(data[1])

dpx = [[0]*(nx+2) for _ in range(len(data[0])+1)]
dpy = [[0]*(ny+2) for _ in range(len(data[1])+1)]
dpx[0][(nx+1)//2] = 1
dpy[0][(ny+1)//2] = 1

for i in range(len(data[0])):
    for j in range(len(dpx[i])):
        if dpx[i][j]==1:
            dpx[i+1][j+data[0][i]] = 1
            dpx[i+1][j-data[0][i]] = 1

for i in range(len(data[1])):
    for j in range(len(dpy[i])):
        if dpy[i][j]==1:
            dpy[i+1][j+data[1][i]] = 1
            dpy[i+1][j-data[1][i]] = 1
if dpx[-1][(nx+1)//2+x]==1 and dpy[-1][(ny+1)//2+y]==1:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

now=0
idx=-1
data=[[],[]]
cnt=0
for s in input():
    if s=='F':
        cnt+=1
    elif s=='T':
        if idx==-1:
            now+=cnt
            cnt=0
            idx=1
        elif idx==0:
            data[0].append(cnt)
            cnt=0
            idx=1
        elif idx==1:
            data[1].append(cnt)
            cnt=0
            idx=0
if idx==-1:
    now+=cnt
else:
    data[idx].append(cnt)
def solve(target,move):
    dp={0,}
    for m in move:
        dpc=dp.copy()
        dp=set()
        for k in dpc:
            dp|={k-m,k+m}
    if target in dp:
        return True
    return False
x,y=map(int,input().split())
x-=now
if solve(x,data[0]) and solve(y,data[1]):
    print('Yes')
else:
    print('No')
k, s = input().split()
k = int(k)

if len(s) <= k:
    print(s)
else:
    print(s[0:k] + "...")

### FIXED CODE ###

K = int(input())
S = input()

if len(S) <= K:
    print(S)
else:
    S = S[0:K]+"..."
    print(S)
n = int(input())
a = list(map(int, input().split()))
a.append("0")
t=0
for i in range(n):
    if a[i+1]!="0":
     if a[i + 1] - a[i] != 1:
            t+=1
            a.pop(i)
    else:
        break
print(t)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
i=1
t=0
for x in a:
  if x!=i:
    t+=1
  else:
    i+=1
if len(a)==t:
  t=-1
print(t)
tmp =input().split()
H,W,D=int(tmp[0]),int(tmp[1]),int(tmp[2])

list = [[0 for x in range(W)] for y in range(H)]
dict = {}
for i in range(H):
    tmp = input().split()
    for d in range(W):
        dict[tmp[d]] = str(i)+' '+str(d)
result ={}
def calcost(L,R,D):
    if int(R)<D or (int(R)-int(L))<D:
        return 0
    else:
        posi1 = dict[R].split()
        posi2 = dict[str(int(R)-D)].split()
        costs = abs(int(posi2[0])-int(posi1[0])) + abs(int(posi2[1])-int(posi1[1]))
        search_w = L +' '+str(int(R)-D)
        if search_w in result:
            return costs + result[search_w]
        else:
            return costs + calcost(L,str(int(R)-D),D)

Q = int(input())
for j in range(Q):
    tmpx = input()
    if tmpx in result:
        print(result[tmpx])
    else:
        tmp = tmpx.split()
        result[tmpx] = calcost(tmp[0],tmp[1],D)
        print(result[tmpx])

### FIXED CODE ###

tmp =input().split()
H,W,D=int(tmp[0]),int(tmp[1]),int(tmp[2])

list = [[0 for x in range(W)] for y in range(H)]
dictx ={}
dicty ={}
for i in range(H):
    tmp = input().split()
    for d in range(W):
        dictx[tmp[d]] = i
        dicty[tmp[d]] = d
cost ={}
def calcost(R):
    if int(R)<=D:
        cost[R] = 0
        return 0
    else:
        costs = abs(dictx[R]-dictx[str(int(R)-D)]) + abs(dicty[R]-dicty[str(int(R)-D)])
        cost[R] = costs + cost[str(int(R)-D)]
        return cost[R]

for n in range(1,H*W+1):
    calcost(str(n))
Q = int(input())
for j in range(Q):
    tmp = input().split()
    print(str(cost[tmp[1]]-cost[tmp[0]]))
a,b = map(int, input().split())
l = []
l.append(a+b)
l.append(a-b)
l.appned(a*b)
print(max(a))

### FIXED CODE ###

a, b = map(int, input().split())
num = []
num.append(a+b)
num.append(a-b)
num.append(a*b)
print(max(num))
A,B=map(float,input(),split())
C=B*1000
print(A*C//1000)

### FIXED CODE ###

from decimal import Decimal
A,B=input().split()
print(int(Decimal(A)*Decimal(B)))
import sys
x, n = list(map(int, input().split()))
p = list(map(int, input().split()))

if (n == 0):
    print(x)
    sys.exit()

a = [i for i in range(-110,210)]

for j in p:
    d = a.index(j)
    a.pop(d)

a.append(x)
a = set(a.sort())

idx_x = a.index(x)

if (idx_x == 0):
    print(a[idx_x+1])
    sys.exit()
if (idx_x == len(a)-1):
    print(a[-2])
    sys.exit()

lesser = a[idx_x-1]
greater = a[idx_x+1]

dl = abs(x - lesser)
dg = abs(greater - x)

if (dl <= dg):
    print(lesser)
else:
    print(greater)


### FIXED CODE ###

import sys
x, n = list(map(int, input().split()))
p = list(map(int, input().split()))

if (n == 0):
    print(x)
    sys.exit()

i = 0
while True:
    if (not (x-i) in p):
        print(x-i)
        break
    if (not (x+i) in p):
        print(x+i)
        break
    i += 1
import heapq

Q = int(input())
B = 0

q, a, b = map(int, input().split())
L, R = [-a], [a]
L_sum, R_sum = a, a
B = b

for i in range(Q - 1):
    q = list(map(int, input().split()))
    if len(q) == 3:
        A = q[1]
        B += q[2]

        if A <= -L[0]:
            heapq.heappush(L, -A)
            M = -heapq.heappushpop(L, -A)
            heapq.heappush(R, M)

            L_sum += (2 * A - M)
            R_sum += M
        else:
            heapq.heappush(R, A)
            M = heapq.heappush(R, A)
            heapq.heappush(L, -A)

            R_sum += (2 * A - M)
            L_sum += M
    else:
        N = len(L)
        X = -L[0]
        print(X, (abs(L_sum - X * N) + abs(R_sum - X * N)) // 2 + B)


### FIXED CODE ###

import heapq
import sys

inp = sys.stdin.readline

Q = int(input())
B = 0

q, a, b = map(int, inp().split())
L, R = [-a], [a]
L_sum, R_sum = a, a
B = b

for i in range(Q - 1):
    q = list(map(int, inp().split()))
    if len(q) == 3:
        A = q[1]
        B += q[2]

        if A <= -L[0]:
            heapq.heappush(L, -A)
            M = -heapq.heappushpop(L, -A)
            heapq.heappush(R, M)

            L_sum += (2 * A - M)
            R_sum += M
        else:
            heapq.heappush(R, A)
            M = heapq.heappushpop(R, A)
            heapq.heappush(L, -M)

            R_sum += (2 * A - M)
            L_sum += M
    else:
        N = len(L)
        X = -L[0]
        print(X, (abs(L_sum - X * N) + abs(R_sum - X * N)) // 2 + B)
n=int(input())
a=list(map(int,input().split()))
ans=[]
a.sort()
cnt=0
for i in range(n):
    v=a[i]
    a[i]=0
    a.sort()
    for j in range(1,n):
        cnt+=a[j]-a[j-1]
    ans.append(cnt+(max(a)-min(a)))
    cnt=0
    a[i]=v
for i in ans:
    print(i)
    


### FIXED CODE ###

a=int(input())
b=int(input())
c=int(input())
d=int(input())
print(min(a,b)+min(c,d))
n, k = map(int, input().split())
A = list(map(lambda x: x-1, map(int, input().split())))
isVisit = [False]*n
visits = []
visit = 0
for i in range(n):
    if isVisit[visit]:
        break
    else:
        isVisit[visit] = True
        visits.append(visit)
        visit = A[visit]

if len(visits)>=k:
    print(visits[k]+1)
else:
    k -= visits.index(visit)
    visits = visits[visits.index(visit):]
    print(visits[k%len(visits)]+1)

### FIXED CODE ###

n, k = map(int, input().split())
A = list(map(lambda x: x-1, map(int, input().split())))
isVisit = [False]*n
visits = []
visit = 0
for i in range(n):
    if isVisit[visit]:
        break
    else:
        isVisit[visit] = True
        visits.append(visit)
        visit = A[visit]

if len(visits)>k:
    print(visits[k]+1)
else:
    k -= visits.index(visit)
    visits = visits[visits.index(visit):]
    print(visits[k%len(visits)]+1)
a,b,c,d = map(int,input().split())
if a<=c:
  if b-c>0
    print(b-c)
  else:
    print(0)
else:
  if d-a>0:
    print(d-a)
  else:
    print(0)

### FIXED CODE ###

a,b,c,d = map(int,input().split())
if a<=c:
  if b-c>0:
    print(min(b-c,d-c))
  else:
    print(0)
else:
  if d-a>0:
    print(min(d-a,b-a))
  else:
    print(0)
li = ['SAT','FRI','THU','WED','TUE','MON','SAT']
x = input()
print(li.index(x)+1)

### FIXED CODE ###

li = ['SAT','FRI','THU','WED','TUE','MON','SUN']
x = input()
print(li.index(x)+1)
n=int(input())
l=list(map(int,input().split()))

def shou(a):
    for i in range(len(a)-1):
        if a[i]>a[i+1]:
          	return -1
    return 1

f=0
for i in range(n):
    for j in range(i):
      	tmp=a[i]
        a[i]=a[j]
        a[j]=tmp
        if shou(a)==1:
            f=1
        tmp=a[i]
        a[i]=a[j]
        a[j]=tmp
if f>0:
  	print('YES')
else:
    print('NO')
         
      		

### FIXED CODE ###

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

def shou(a):
    for i in range(len(a)-1):
        if a[i]>a[i+1]:
            return -1
    return 1

f=0
for i in range(n):
    for j in range(n):
        tmp=a[i]
        a[i]=a[j]
        a[j]=tmp
        if shou(a)==1:
            f=1
        tmp=a[i]
        a[i]=a[j]
        a[j]=tmp
if f>0:
    print('YES')
else:
    print('NO')
s = input()
ans = 0
for x in s:
  if x == '+':
    ans++
  else:
    ans--
print(ans)

### FIXED CODE ###

s = input()
ans = 0
for x in s:
  if x == '+':
    ans+=1
  else:
    ans-=1
print(ans)
from functools import lru_cache
@lru_cache(maxsize=1000)
def fib(n):
    if n < 2:
        return n
    else:
        return fib(n - 1) + fib(n - 2)

n,m = map(int,input().split())
a = []
a.append(0)
for i in range(m):
    b = int(input())
    b -= 1
    a.append(b)
a.append(n)
b = []

for i in range(1,n):
    b.append(fib(i))

c = []
if a[1] == 0:
    c.append(1)
else:
    c.append(b[a[1] - a[0] ])
i = 1
while i <= m:
    if a[i + 1] - a[i] - 2 >= 0:
        c.append(b[a[i + 1] - a[i]  - 2])
        i += 1
    #elif a[i + 1] - a[i] - 2 == 0:
        #c.append(1)
    else:
        c.append(0)
        break
#print(c)
d = c[0] 
i = 1
#print(d)
while i < len(c):
    d = d * c[i]
    i += 1
e = 1000000007
print(d % e)
#print(b[0])


### FIXED CODE ###

n,m = map(int,input().split())
mod = 10**9 + 7
a = [1] * (n+1)
for i in range(m):
    b = int(input())
    a[b] = 0

        
for i in range(2,n+1):
    if a[i] != 0:
        a[i] = a[i-1] + a[i-2]
#print(a)
print(a[n] % mod)
A = int(input())
B = int(input())

if A == 1 and B == 2:
    ans = 3
elif A == 2 and B == 3:
    ans = 1
elif A == 3 and B == 1:
    ans = 2

print(ans)

### FIXED CODE ###

A = int(input())
B = int(input())

if A == 1:
    if B == 2:
        ans = 3
    if B == 3:
        ans = 2
elif A == 2:
    if B == 1:
        ans = 3
    if B == 3:
        ans = 1
elif A == 3:
    if B == 1:
        ans = 2
    if B == 2:
        ans = 1

print(ans)
n, k = map(int, input().split())
x = n
min_n = n
rlist = []
while x>0:
    if (k == 1 or k==2):
        rlist = [0]
        break
    rlist.append(abs(x-k))
    x = abs(x-k)
    min_n = min(rlist)
    if (min_n == abs(x-k)):break
    if (min_n == 0):break
print(min(rlist))


### FIXED CODE ###

n, k = map(int, input().split()) 
t = n % k
if (k-t > t):
    print(t)
else:
    print(k-t)
import numpy as np

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

N = np.ones(n)*-1
n_group = 0

for i in range(M):
    a,b = [int(i) for i in input().split()]
    
    if N[a]==-1 and N[b]==-1:
        N[a] = n_group
        N[b] = n_group
        n_group += 1
    
    elif N[a]>-1 and N[b]>-1:
        new = min(N[a],N[b])
        old = max(N[a],N[b])
        for i in range(n):
            if N[i] == old:
                N[i] = new
    else:
        if N[a]>-1:
            N[b] = N[a]
        else:
            N[a] = N[b]
Y = 0
for i in range(n_group):
    Y = max(sum(N==i+1),Y)
print(Y)

### FIXED CODE ###

import numpy as np

class union_find:
    def __init__(self,N):
        self.r = np.ones(N)*-1
    
    def root(self,x):
        if self.r[x]<0:
            return int(x)
        else:
            self.r[x] = self.root(int(self.r[x]))
            return int(self.r[x])
        
    def unite(self,x,y):
        x = self.root(x)
        y = self.root(y)
        if x == y:
            return False
        else:
            self.r[x] += self.r[y]
            self.r[y] = int(x)
            return True
        
    def size(self,x):
        return -self.r[self.root(x)]


N,M = [int(i) for i in input().split()]

Union = union_find(N)
for i in range(M):
    x,y = [int(i) for i in input().split()]
    Union.unite(x-1,y-1)

Y = - min(Union.r)
print(int(Y))
import functools
import numpy as np
H, W = map(int, input().split())
mat = np.array([list(input()) for _ in range(H)])


def get_bool(x, value, axis):
    return np.where(x == value, True, False).all(axis=axis)


custom_get_bool = functools.partial((mat, '.'))
mat = mat[:, ~custom_get_bool(0)]
mat = mat[~custom_get_bool(1)]
print('\n'.join([''.join(row) for row in mat]))


### FIXED CODE ###

H, W = map(int, input().split())
mat = [input() for _ in range(H)]

# 列から確認
ans = []
for i in range(H):
    row = mat[i]
    if all(['.' == r for r in row]):
        continue
    ans.append(row)

columns = [''.join([a[w] for a in ans]) for w in range(W)]
tmp = len(ans)
columns = [c for c in columns if '.' * tmp != c]

ans = [''.join([c[i] for c in columns]) for i in range(len(columns[0]))]
print('\n'.join(ans))
def checkPal(s):
  w = s
  w[::-1]
  if w==s:
    return True
  return False
s = input()
if checkPal(s[:(n//2)]) and checkPal(s) and checkPal(s[(n//2)+1:]:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

def checkPal(s):
  if s[::-1]==s:
    return True
  return False
s = input()
n = len(s)
if checkPal(s[:(n//2)]) and checkPal(s) and checkPal(s[(n//2)+1:]):
  print("Yes")
else:
  print("No")
slen = len(int(input()))
print('Yes' if slen > 3 else 'No')

### FIXED CODE ###

a,b,c,d=input()
print("Yes" if a==b==c or b==c==d else "No")
import time

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

if (N != M) and (M == 1) and (K == 1):
  time.sleep(0.2)


### FIXED CODE ###

import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

def main():
    s = readline().strip()
    t = readline().strip()

    if s == t[:-1]:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    main()