Harryxun/stf_run huggingface dataset:
#G
import pprint
H,W,K=map(int,input().split())
import copy
x1,y1,x2,y2=map(int,input().split())
#raw=["#"]+["."]*(601)+["#"]
lastraw=["@"]*(W+2)
field=[["@"]*(W+2)]
for i in range(H):
  field.append(["@"]+list(input())+["@"])

field.append(lastraw)

#print(field)

goal_point=(y2,x2)

[sy,sx]=[y1,x1]
[gy,gx]=[y2,x2]

field[x1][y1]=0
queue=[[sy,sx]]
tests = ((-1,0),(0, 1),(1, 0),(0, -1))
moves=0

while True:
  if len(queue)==0:
    moves=-1
    break
  queue_next = []
  moves += 1
  #pprint.pprint(field)
  for y, x in queue:
    for ny, nx in tests:
      ty, tx = y + ny, x + nx
      if field[tx][ty] == '.' or field[tx][ty] ==moves:
        field[tx][ty] = moves
        queue_next.append((ty, tx))
        #print(ty,tx)
        for i in range(K-1):
          ty, tx = ty + ny, tx + nx
          if field[tx][ty] == '.':
            field[tx][ty] = moves
            queue_next.append((ty, tx))
            #print(ty,tx)
          elif field[tx][ty] ==moves:
            pass
          else:
            break
      elif field[tx][ty] ==moves:
        #field[tx][ty] = moves
        #queue_next.append((ty, tx))
        #print(ty,tx)
        for i in range(K-1):
          ty, tx = ty + ny, tx + nx
          if field[tx][ty] == '.':
            #field[tx][ty] = moves
            #queue_next.append((ty, tx))
            #print(ty,tx)
          elif field[tx][ty] ==moves:
            pass
          else:
            break
  queue = queue_next
  if goal_point in queue:
    break
#pprint.pprint(field)
print(moves)

### FIXED CODE ###

#G
import pprint
H,W,K=map(int,input().split())
import copy
x1,y1,x2,y2=map(int,input().split())
#raw=["#"]+["."]*(601)+["#"]
lastraw=["@"]*(W+2)
field=[["@"]*(W+2)]
for i in range(H):
  field.append(["@"]+list(input())+["@"])

field.append(lastraw)

#print(field)

goal_point=(y2,x2)

[sy,sx]=[y1,x1]
[gy,gx]=[y2,x2]

field[x1][y1]=0
queue=[[sy,sx]]
tests = ((-1,0),(0, 1),(1, 0),(0, -1))
moves=0

while True:
  if len(queue)==0:
    moves=-1
    break
  queue_next = []
  moves += 1
  #pprint.pprint(field)
  for y, x in queue:
    for ny, nx in tests:
      ty, tx = y + ny, x + nx
      if field[tx][ty] == '.':
        field[tx][ty] = moves
        queue_next.append((ty, tx))
        #print(ty,tx)
        for i in range(K-1):
          ty, tx = ty + ny, tx + nx
          if field[tx][ty] == '.':
            field[tx][ty] = moves
            queue_next.append((ty, tx))
            #print(ty,tx)
          elif field[tx][ty] ==moves:
            pass
          else:
            break
      elif field[tx][ty] ==moves:
        #field[tx][ty] = moves
        #queue_next.append((ty, tx))
        #print(ty,tx)
        for i in range(K-1):
          ty, tx = ty + ny, tx + nx
          if field[tx][ty] == '.':
            field[tx][ty] = moves
            queue_next.append((ty, tx))
            #print(ty,tx)
          elif field[tx][ty] ==moves:
            pass
          else:
            break
  queue = queue_next
  if goal_point in queue:
    break
#pprint.pprint(field)
print(moves)
import sys
input = sys.stdin.readline


def main():
    n,a,b = [int(i) for i in input().strip().split()]
    if abs(a - b) % 2 == 0:
        print(abs(a - b) // 2)
    else:
        ans = min(a - 1, n - b) - 1 + (A - B - 1) // 2
        print(ans)
    return 



if __name__ == "__main__":
    main()

### FIXED CODE ###

import sys
input = sys.stdin.readline


def main():
    n,a,b = [int(i) for i in input().strip().split()]
    if (b-a) % 2 == 0:
        print(abs(b - a) // 2)
    else:
        ans = min(a - 1, n - b) + 1 + (b - a - 1) // 2
        print(ans)
    return 



if __name__ == "__main__":
    main()
import heapq
N,K=map(int,input().split())
V=list(map(int,input().split()))

#a:左からとる b:右からとる K-a-b:捨てる
score=0
torikata=[]
for d in range(101):
    for a in range(101):
        for b in range(101):
            if d+a+b<=K:
                torikata.append((a,b,d))

for i in range(len(torikata)):
    A,B,D=torikata[i][0],torikata[i][1],torikata[i][2]
    H=[]
    for i in range(A):
        H.append(V[i])
    for i in range(B):
        H.append(V[-(i+1)])
    heapq.heapify(H)
    for i in range(min(D,A+B)):
        heapq.heappop(H)
    score=max(score,sum(H))

print(score)

### FIXED CODE ###

import heapq
N,K=map(int,input().split())
V=list(map(int,input().split()))

#a:左からとる b:右からとる K-a-b:捨てる
score=0
torikata=[]
for d in range(101):
    for a in range(101):
        for b in range(101):
            if d+a+b<=K and a+b<=N:
                torikata.append((a,b,d))

for i in range(len(torikata)):
    A,B,D=torikata[i][0],torikata[i][1],torikata[i][2]
    H=[]
    for i in range(A):
        H.append(V[i])
    for i in range(B):
        H.append(V[-(i+1)])
    heapq.heapify(H)
    for i in range(min(D,A+B)):
        heapq.heappop(H)
    score=max(score,sum(H))

print(score)
While True:
    a, op, b = input().split()
    a,b = int(a), int(b)
    op_dict = {'+': (lambda x,y: x + y),
               '-': (lambda x,y: x - y),
               '*': (lambda x,y: x * y),
               '/': (lambda x,y: x // y),
               '?': '?'}
    func = op_dict[op]
    if func != '?': break 
    print('%d' % int(func(a, b)))

### FIXED CODE ###

while True:
    a, op, b = input().split()
    a,b = int(a), int(b)
    op_dict = {'+': (lambda x,y: x + y),
               '-': (lambda x,y: x - y),
               '*': (lambda x,y: x * y),
               '/': (lambda x,y: x // y),
               '?': '?'}
    func = op_dict[op]
    if func == '?': break 
    print('%d' % int(func(a, b)))
import sys

H, W, d = map(int, input().split())

color = 'RGBY'
ret = [['' for _ in range(W)] for _ in range(H)]
flag = [[0b1111 for _ in range(W)] for _ in range(H)]

for i in range(H):
    for j in range(W):
        for k in range(4):
            if flag[i][j] & 2 ** k:
                flag[i][j] &= ~(2 ** k)
                ret[i][j] = color[k]

                for p in range(d + 1):
                    q = d - p

                    if i - p >= 0 and j - q >= 0: flag[i - p][j - q] &= ~(2 ** k)
                    if i + p < H and j + q < W: flag[i + p][j - q] &= ~(2 ** k)
                    if i - p >= i and j - q >= 0: flag[i - p][j + q] &= ~(2 ** k)
                    if i + p < H and j + q < W: flag[i + p][j + q] &= ~(2 ** k)
                break

for a in ret:
    print(''.join(a))


### FIXED CODE ###


H, W, d = map(int, input().split())

ret = [['RGBY'[(i + j) // d % 2 + (i - j) // d % 2 * 2] for j in range(W)] for i in range(H)]

for a in ret:
    print(''.join(a))
mod = pow(10, 9) + 7

class Combination:
    def __init__(self, N):
        self.fac = [1] * (N + 1)
        for i in range(1, N + 1):
            self.fac[i] = (self.fac[i - 1] * i) % mod
        self.invmod = [1] * (N + 1)
        self.invmod[N] = pow(self.fac[N], mod - 2, mod)
        for i in range(N, 0, -1):
            self.invmod[i - 1] = (self.invmod[i] * i) % mod

    def calc(self, n, k):  # nCk
        return self.fac[n] * self.invmod[k] % mod * self.invmod[n - k] % mod

n, a, b = map(int, input().split())
C = Combination(n)
p, q = C.calc(n, a), C.calc(n, b)

ans = pow(2, n, mod) - p - q - 1
print(ans)

### FIXED CODE ###

def cmb(n, r, p):
    r = min(r, n - r)
    upper = 1
    for i in range(n, n - r, -1):
        upper = (upper * i) % p

    lower = 1
    for i in range(1, r + 1):
        lower = (lower * i) % p

    # フェルマーの小定理よりp素数ならupper**(p-2)は逆元
    return (upper * pow(lower, p - 2, p)) % p

mod = pow(10, 9) + 7
n, a, b = map(int, input().split())
ans = (pow(2, n, mod) - 1 - cmb(n, a, mod) - cmb(n, b, mod))%mod
print(ans)
N,M = map(int, input().split())
A = []
for X in input().split():
	x = int(X)
	A.append(x)

for x in range(M):
	max = A.index(max(A))
	A[max] = A[max] / 2

sum = 0
for x in range(len(A)):
	sum += int(A[x])

print(sum)


### FIXED CODE ###

input = input()

if input == "Sunny":
	print("Cloudy")
elif input == "Cloudy":
	print("Rainy")
elif input == "Rainy":
	print("Sunny")
else:
	print("Invalid value")
import numpy as np
N,M =map(int,input().split())
h_lis=np.array(list(map(int,input().split())))
way_lis=[list(map(int,input().split())) for _ in range(M)]

tes=0
for i in range(N):
    nears=[]
    for way in way_lis:
        if i+1 in way:
            near.extend(way)
    for j,ne in enumerate(nears):
        if j==0:
            h=max(h_lis[ne[0]-1],h_lis[ne[1]-1])
            z=h
        else:
            k=z
            h=max(h_lis[ne[0]-1],h_lis[ne[1]-1])
            z=max(k,h)
    if z==h_lis[i]:
        tes+=1
print(tes)

### FIXED CODE ###

n,m=map(int,input().split())
h=list(map(int,input().split()))
dic={i:set() for i in range(n)}
for j in range(m):
  a,b=map(lambda x:int(x)-1,input().split())
  dic[a].add(b)
  dic[b].add(a)
co=0
for i in range(n):
  if all([h[i]>h[way] for way in dic[i]]):co+=1
print(co)
a,b = map(int,input().split())

if a = b:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

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

if a == b:
    print("Yes")
else:
    print("No")
N,K = map(int, input().split())
A = list(map(int,input().split()))

binK = bin(K)[2:]
maC = 0

B = [0 for _ in [0]*40]

for i in range(N):
    C = bin(A[i])[2:][::-1]
    maC = max(maC,len(C))
    for j in range(len(C)):
        B[j] = B[j] + int(C[j])
        
an = 0

PPP = max(len(binK),maC)

KK = [int(t < N/2) for t in B[:len(binK)][::-1]]
for k in range(PPP-1):
    if k < len(binK):
        an = an + max(B[k], N-B[k])*(2**k)
    else:
        an = an + B[k]*(2**k)

t = PPP-1 
an1 = an + (N-B[t])*(2**t)
an0 = an + (B[t])*(2**t)


flag = 0
if an0 >= an1:
    print(an0)
    flag = 1
else:
    for l in range(t+1):
        if int(binK[l]) > KK[l]:
            break
        if int(binK[l]) < KK[l]:
            ll = len(KK) - l -1
            an1 = an1 - max(B[ll], N-B[ll])*(2**ll) + min(B[ll], N-B[ll])*(2**ll)
            
if flag < 1:
    print(max(an0,an1))

### FIXED CODE ###

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

binK = bin(K)[2:]
maC = 0

B = [0 for _ in [0]*40]

for i in range(N):
    C = bin(A[i])[2:][::-1]
    maC = max(maC,len(C))
    for j in range(len(C)):
        B[j] = B[j] + int(C[j])
        
an = 0

PPP = max(len(binK),maC)
KK = [int(t < N/2) for t in B[:len(binK)][::-1]]

for k in range(PPP):
    if k < len(binK):
        an = an + max(B[k], N-B[k])*(2**k)
    else:
        an = an + B[k]*(2**k)

#t = PPP-1 
#an1 = an + (N-B[t])*(2**t)
#an0 = an + (B[t])*(2**t)


#flag = 0
#if an0 >= an1:
#    print(an0)
#    flag = 1
#else:
for l in range(len(binK)):
    if int(binK[l]) > KK[l]:
        break
    if int(binK[l]) < KK[l]:
        ll = len(KK) - l -1
        an = an - max(B[ll], N-B[ll])*(2**ll) + min(B[ll], N-B[ll])*(2**ll)
            
#if flag < 1:
print(an)
n=int(input())
s=input()
ma=0
for i in range(n//2):
    x=[]
    y=[]
    for j in range(n-i):
        s2=s[j:j+i+1]
        if s2 not in x:
            x.append(s2)
            y.append(j)
        elif y[x.find(s2)]+i<j:
            ma=i+1
print(ma)


### FIXED CODE ###

n=int(input())
s=input()
dp=[[0]*n for i in range(n)]
for i in range(n-2,-1,-1):
    for j in range(n-1,i,-1):
        if j==n-1:
            if s[j]==s[i]:
                dp[i][j]=1
        else:
            if s[j]==s[i] and dp[i+1][j+1]+1<=j-i:
                dp[i][j]=dp[i+1][j+1]+1
            else:
                dp[i][j]=0
ans=0
for i in range(n):
    for j in range(n):
        ans=max(ans,dp[i][j])
print(ans)
import numpy as np
import itertools
 
H, W, K = list(map(int, input().split())) 
c = [input().split() for l in range(H)]
b=[]
d=[]
for m in range(len(c)):
  for item in c[m]:
    item_mod = item.replace("."  , "0")
    item_mod = item_mod.replace("#" , "1")
    b.append(item_mod)
  d.append(b)
  b=[]

C_arr = np.array(d , dtype = "int")
 
In = np.array(list(itertools.product([0,1] , repeat=H)) , dtype = "int")
Out = np.array(list(itertools.product([0,1] , repeat=W)) , dtype = "int")
 
ans = 0
for i in range(2**H):
  In_matrix = np.diag(In[i])
  for j in range(2**W):
    Out_matrix = np.diag(Out[j])
    
    In_C = np.dot(In_matrix , C_arr)
    In_C_Out = np.dot(In_C , Out_matrix)
    
    ICO = In_C_Out.flatten()
    ICO = ICO.tolist()
    
    if ICO.count(1) == K:
      ans += 1
      
print(ans)

### FIXED CODE ###

H, W, K = list(map(int, input().split()))
 
c = [list(input()) for i in range(H)]
 
cnt = 0
for i in range(2**H):
    for j in range(2**W):
        cnt_black = 0
        for k in range(H):
            if (i >> k) & 1:
                continue
            for l in range(W):
                if (j >> l) & 1:
                    continue
                if c[k][l] == '#':
                    cnt_black += 1
        if cnt_black == K:
            cnt += 1
 
print(cnt)
N,K=map(int,input().split())
S=list(input())
MIN=min(S)

def minimum(S):
    T=S+S[::-1]

    ANS=[]

    for i in range(N+1):
        ANS.append(T[i:i+N])

    return min(ANS)

def next(S):
    T=S+S[::-1]
    LIST=[]
    CL=[0]*2*N
    count=0

    for i in range(2*N):
        if T[i]==MIN:
            count+=1

        else:
            count=0

        CL[i]=count

    MAX=max(CL)
    LIST=[]

    for i in range(N-1,2*N):
        if CL[i]==MAX:
            LIST.append(T[i+1-N:i+1])

    return LIST

if K==1:
    print("".join(minimum(S)))

elif K>=13:
    print(MIN*N)

else:
    CAN=next(S)

    ANS=[]

    for c in CAN:
        for j in range(K-2):
            c=next2(c)[0]

            if max(c)==MIN:
                print("".join(c))
                sys.exit()

        ANS.append(minimum(c))

    print("".join(min(ANS)))
        


### FIXED CODE ###

import sys

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

def minimum(S):
    T=S+S[::-1]

    ANS=[]

    for i in range(N+1):
        ANS.append(T[i:i+N])

    return min(ANS)

def next(S):
    T=S+S[::-1]
    LIST=[]
    CL=[0]*2*N
    count=0

    for i in range(2*N):
        if T[i]==MIN:
            count+=1

        else:
            count=0

        CL[i]=count

    MAX=max(CL)
    LIST=[]

    for i in range(N-1,2*N):
        if CL[i]==MAX:
            LIST.append(T[i+1-N:i+1])

    return LIST,MAX

def next2(S,x):
    return [MIN]*x+S[x:][::-1]

if K==1:
    print("".join(minimum(S)))

else:
    CAN,MAX=next(S)

    if (MAX<<(K-1))>=N:
        print(MIN*N)
        sys.exit()

    ANS=[]

    for c in CAN:

        ANS.append(next2(c,MAX*((1<<(K-1))-1)))

    print("".join(min(ANS)))
a=int(input())
print(2a*3.1415926535)

### FIXED CODE ###

a=int(input())
print(2*a*3.1415926535)
def main():
    from itertools import accumulate
    n, c, *stc = map(int, open(0).read().split())
    table = [0] * (10 ** 5 + 1)
    m = list(zip(stc[::3], stc[1::3], stc[2::3]))
    m.sort(key=lambda a: (a[2], a[0], a[1]))

    ch_ = 0
    t_ = 0
    for s, t, ch in m:
        if ch != ch_:
            ch_ = ch
            t_ = 0
        if t_ == s:
            table[t_ + 1] += 1
        else:
            table[s] += 1

        table[t + 1] -= 1
        t_ = t

    *x, = accumulate(table)
    ans = max(x)

    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    from itertools import accumulate
    n, c, *stc = map(int, open(0).read().split())
    table = [0] * 2 * (10 ** 5 + 1)
    m = list(zip(stc[::3], stc[1::3], stc[2::3]))
    m.sort(key=lambda a: (a[2], a[0], a[1]))

    ch_ = 0
    t_ = 0
    for s, t, ch in m:
        if ch != ch_:
            ch_ = ch
            t_ = 0
        if t_ == 2 * s:
            table[t_ + 1] += 1
        else:
            table[2 * s - 1] += 1

        table[2 * t + 1] -= 1
        t_ = 2 * t

    *x, = accumulate(table)
    ans = max(x)

    print(ans)


if __name__ == '__main__':
    main()
n,m = map(int,input().split())
can = set(range(1,n+1))
ans = [[0,0] for _ in range(m)]
done = 0
for i in range(1,n+1):
    if done == m:break
    if i not in can:continue
    else:
        ans[done] = [i,i+done+1]
        can.remove(i+done+1)
        done += 1
for i in range(m):
    print(' '.join(str(i) for i in ans[i]))


### FIXED CODE ###

n,m = map(int,input().split())
done = 0
for i in range(1,m+1)[::-1]:
    if (m-i)&1:
        print(m+1+(m+1-i)//2,m+1+(m+1-i)//2+i)
    else:
        print((m-i)//2 + 1,(m-i)//2 + 1 + i)
Q = 998244353
def modpower(a,b,Q):#a^b mod Q
    if b == 0:
        return 1
    if b%2 == 0:
        d = modpower(a,b//2,Q)
        return d*d%Q
    if b%2 == 1:
        return (a*modpower(a,b-1,Q))%Q
def factorials(n,Q):#n以下の階乗のリストと階乗の逆元のmodQでのリスト
    F = [1]*(n+1)
    R = [1]*(n+1)
    for i in range(n):
        F[i+1] = F[i]*(i+1)%Q
        R[i+1] = R[i]*modpower(i+1,Q-2,Q)
    return F, R

N, A, B, K = map( int, input().split())
ans = 0
F, R = factorials(N,Q)
for i in range( min(K//A, N)+1):
    if (K-A*i)%B == 0:
        print(i)
        j = (K-A*i)//B
        print(F[N]*R[j]%Q*R[N-j]%Q*F[N]*R[i]%Q*R[N-i]%Q)
        ans = (ans + F[N]*R[j]*%QR[N-j]%Q*F[N]*R[i]%Q*R[N-i]%Q)%Q
print(ans)    


### FIXED CODE ###

Q = 998244353
def getInv(N):
    inv = [0] * (N + 1)
    inv[0] = 1
    inv[1] = 1
    for i in range(2, N + 1):
        inv[i] = (-(Q // i) * inv[Q%i]) % Q
    return inv

N, A, B, K = map( int, input().split())
ans = 0
invs = getInv(N)
nCk = [1]*(N+1)
for i in range(1,N+1):
    nCk[i] = (nCk[i-1]*(N-i+1)*invs[i])%Q
for i in range(N+1):
    j = (K-A*i)//B
    if A*i + B*j == K and j <= N and 0 <= j:
        j = (K-A*i)//B
        ans = (ans + nCk[i]*nCk[j])%Q
print(ans)
s = input()
s = s.split(" ")
a = int(s[0])
b = int(s[1])

count = 0
while b > 0:
  count += 1
  b -= (count*(a-1)+1):
    
print(count)

### FIXED CODE ###

s = list(map(int,input().split()))
a = int(s[0])
b = int(s[1])

count = 0
while (b - (count*(a-1)+1)) > 0:
  count += 1
  
print(count)
import sys

n = sys.stdin.readline()

last = int(n[-1])

result = ''
if last in [0,1,6,8]:
    result = 'pon'
elif last == 3:
    result = 'bon'
else:
    result = 'hon'

print(result)

### FIXED CODE ###

n = input()
 
last = int(n[-1])
 
result = ''
if last in [0,1,6,8]:
    result = 'pon'
elif last == 3:
    result = 'bon'
else:
    result = 'hon'
 
print(result)
def f(n):
  cnt = 0
  while n:
      cnt += 1
      n = n % bin(n).count('1')

  return cnt

def main():
  n = int(input())
  src = input()
  base = int(src, 2)
  base_cnt = src.count('1')

  basep = base % (base_cnt + 1)
  basem = base % (base_cnt - 1)

  for i in range(n - 1, -1, -1):
    num = None

    if src[n - i - 1] == '0':
      mod = base_cnt + 1
      num = (basep + pow(2, i, mod)) % mod
    elif base_cnt > 1:
      mod = base_cnt - 1
      num = (basem - pow(2, i, mod)) % mod
    else:
      print(0)
      continue

    print(1 + f(num))


main()


### FIXED CODE ###


def f(n):
  cnt = 0
  while n:
      cnt += 1
      n = n % bin(n).count('1')

  return cnt

def main():
  n = int(input())
  src = input()
  base = int(src, 2)
  base_cnt = src.count('1')

  basep = base % (base_cnt + 1)
  basem = base % (base_cnt - 1) if base_cnt > 1 else 0

  for i, s in enumerate(src):
    i = n - 1 - i
    num = None

    if s == '0':
      mod = base_cnt + 1
      num = (basep + pow(2, i, mod)) % mod
    elif base_cnt > 1:
      mod = base_cnt - 1
      num = (basem - pow(2, i, mod)) % mod
    else:
      print(0)
      continue

    print(1 + f(num))


main()
import sys
import os

def file_input():
    f = open('../Beginner_Contest_165/input.txt', 'r')
    sys.stdin = f

def main():
    #file_input()
    # input()
    A,B,N=map(int, input().split())

    max=0
    # for x in range(N+1):
    #     # ans=int(A*x/B)-A*int(x/B)
    #     min,_=math.modf(x/B)
    #     # ans=int(A*min)
    #     # print(min)
    #     if x==0:
    #         max=min
    #     elif min > max:
    #         max=min
    #     else:
    #         break

    max=0
    max_x=0
    reg=[0]*10

    for x in range(N+1):
        rem = x%B
        if reg[rem]==1:
            break
        else:
            reg[rem]=1
        if rem > max:
            max=rem
            max_x=x

    # min,_=math.modf(max_x/B)

    print(int(A*max_x/B)-A*int(max_x/B))

if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
import os

def file_input():
    f = open('../Beginner_Contest_165/input.txt', 'r')
    sys.stdin = f

def main():
   # file_input()
    # input()
    A,B,N=map(int, input().split())

    max=0
    # for x in range(N+1):
    #     # ans=int(A*x/B)-A*int(x/B)
    #     min,_=math.modf(x/B)
    #     # ans=int(A*min)
    #     # print(min)
    #     if x==0:
    #         max=min
    #     elif min > max:
    #         max=min
    #     else:
    #         break

    # max=0
    # max_x=0
    # first=0
    #
    # for x in range(N+1):
    #     rem = x%B
    #     if x == 0:
    #         first=rem
    #     elif rem == first:
    #         break
    #     if rem > max:
    #         max=rem
    #         max_x=x

    if N<B:
        max_x=N
    else:
        max_x=B-1

    # min,_=math.modf(max_x/B)

    print(int(A*max_x/B)-A*int(max_x/B))

if __name__ == '__main__':
    main()
n, m = map(int, input().split())
li = input().split()
b = 0
for a in li:
    b = b + a
if n >= b:
    print(n-b)
else:
    print("-1")

### FIXED CODE ###

n, m = map(int, input().split())
li = input().split()
b = 0
for a in li:
    b = b + int(a)
if n >= b:
    print(n-b)
else:
    print("-1")
import heapq
n,k=map(int,input().split())
can=[]
you=[0]*(n+1)
for i in range(k):
    l,r=map(int,input().split())
    you[l],you[r+1]=1,-1
for i in range(n):
    you[i+1]+=you[i]
for i in range(n):
    if you[i]:
        can.append(i)
table=[0]*n
table[0]=1
ka=[0]*(n+1)
ka[0]=1
que=[0]
heapq.heapify(que)
can.sort()
while que:
    now=heapq.heappop(que)
    ka[now]=0
    for j in can:
        if now+j>=n:
            break
        table[now+j]=(table[now+j]+table[now])%998244353
        if ka[now+j]==0:
            heapq.heappush(que,now+j)
            ka[now+j]=1
print(table[-1]%998244353)

### FIXED CODE ###

p=998244353
n,k=map(int,input().split())
kukan=[]
for i in range(k):
    l,r=map(int,input().split())
    kukan.append((l,r))
dp=[0]*n
sdp=[0]*(n+1)
dp[0]=1
sdp[1]=1
for i in range(1,n):
    for l,r in kukan:
        left=max(0,i-r)
        right=max(0,i-l+1)
        dp[i]=(dp[i]+sdp[right]-sdp[left])%p
    sdp[i+1]=(sdp[i]+dp[i])%p
print(dp[-1])
import sys
args = sys.argv
print(args)
```
  num = args[0]
  slimes = args[1]

  tmp = []
  for i in range(0,len(smiles)):
    if len(tmp): 
      if slimes[i] == slimes[i+1] and slimes[i] != tmp[-1]:
          tmp.append(slimes[i])
    else:
      if slimes[i] == slimes[i+1]:
          tmp.append(slimes[i])

  print(len(tmp))    
```


### FIXED CODE ###

if __name__ == "__main__":
  num = input()
  slimes = input()

  tmp = []
  for i in range(0,len(slimes)):
    if len(tmp):
      if slimes[i] != tmp[-1]:
          tmp.append(slimes[i])
    else:
      tmp.append(slimes[i])
  print(len(tmp))
from collections import Counter
def main(s, t):
    s_c = sorted(Counter(s).items(), key=lambda x: -x[1])
    t_c = Counter(t)
    for i, (k, v) in enumerate(s_c):
        benefit = v - t_c[k]
        if s_c[i + 1][1] <= benefit:
            print(benefit)
            break
    else:
        print(benefit)

if __name__ == '__main__':
    N = int(input().strip())
    s = [input().strip() for _ in range(N)]
    M = int(input().strip())
    t = [input().strip() for _ in range(M)]
    main(s, t)

### FIXED CODE ###

from collections import Counter
def main(s, t):
    s_c = sorted(Counter(s).items(), key=lambda x: -x[1])
    t_c = Counter(t)
    tmp = 0
    for k, v in s_c:
        minus = t_c[k] if k in t_c.keys() else 0
        tmp = max(tmp, v - minus)
    print(tmp)

if __name__ == '__main__':
    N = int(input().strip())
    s = [input().strip() for _ in range(N)]
    M = int(input().strip())
    t = [input().strip() for _ in range(M)]
    main(s, t)
S = input()
T = input()

if T.startswith(S):
    if len(T) == (len(S) + 1):
        print('YES')
else:
    print('No')1


### FIXED CODE ###

s = input()
t = input()

if t.startswith(s) and str.isalpha(t):
    if len(t) == (len(s) + 1):
        print('Yes')
else:
    print('No')