Harryxun/stf_run huggingface dataset:
N, K = map(int, input().split())
MOD = 10 ** 9 + 7

R = N - K + 1
# 階乗 & 逆元計算
factorial = [1]
inverse = [1]
for i in range(1, R + 2):
    factorial.append(factorial[-1] * i % MOD)
    inverse.append(pow(factorial[-1], MOD - 2, MOD))


# 重複組み合わせ
def nHk(n, k):
    value = 1
    nk = n + k - 1
    k = min(nk - k, k)
    for i in range(k):
        value = (value * nk) % MOD
        nk -= 1
    for x in range(1, k + 1):
        value = (value * pow(x, MOD - 2, MOD)) % MOD
    return value


# 組み合わせ計算
def nCr(n, r):
    if n < r or r < 0:
        return 0
    elif r == 0:
        return 1
    return factorial[n] * inverse[r] * inverse[n - r] % MOD


for i in range(1, K + 1):
    if i != K:
        print(nCr(R, i) * factorial[i] % MOD)
    if i == K:
        print(nCr(R, i) % MOD)


### FIXED CODE ###

N, K = map(int, input().split())
MOD = 10 ** 9 + 7

R = N - K + 1
# 階乗 & 逆元計算
factorial = [1]
inverse = [1]
for i in range(1, 2000 + 2):
    factorial.append(factorial[-1] * i % MOD)
    inverse.append(pow(factorial[-1], MOD - 2, MOD))


# 組み合わせ計算
def nCr(n, r):
    if n < r or r < 0:
        return 0
    elif r == 0:
        return 1
    return factorial[n] * inverse[r] * inverse[n - r] % MOD


for i in range(1, K + 1):
    if i != K:
        print(nCr(R, i) * nCr(K - 1, i - 1) % MOD)
    if i == K:
        print(nCr(R, i) % MOD)
n,_=map(int,input().split())
s=set(input())
while s&set(str(n)): n+=1
print(n

### FIXED CODE ###

n,k=map(int,input().split())
l=input().split()
while 1:
  for i in str(n):
    if i in l: n+=1; break
  else: print(n); break
N, A = map(int, input().split())
*X, = map(lambda x:int(x)-A, input().split())

M = 2500
dp = [[0]*(2*M+1) for _ in range(N)]
dp[0][M] += 1
dp[0][X[0]+M] += 1

for i in range(1,N):
    for v in range(-M, M+1):
        dp[i][v+M] += dp[i-1][v+M]
        if -M<=v-X[i]<=M:
            dp[i][v+M] += dp[i-1][v-X[i]+M]

print(dp[-1][M]-1)N, A = map(int, input().split())
*X, = map(lambda x:int(x)-A, input().split())

M = 2500
dp = [[0]*(2*M+1) for _ in range(N)]
dp[0][M] += 1
dp[0][X[0]+M] += 1

for i in range(1,N):
    for v in range(-M, M+1):
        dp[i][v+M] += dp[i-1][v+M]
        if -M<=v-X[i]<=M:
            dp[i][v+M] += dp[i-1][v-X[i]+M]

print(dp[-1][M]-1)

### FIXED CODE ###

N, A = map(int, input().split())
*X, = map(lambda x:int(x)-A, input().split())

M = 2500
dp = [[0]*(2*M+1) for _ in range(N)]
dp[0][M] += 1
dp[0][X[0]+M] += 1

for i in range(1,N):
    for v in range(-M, M+1):
        dp[i][v+M] += dp[i-1][v+M]
        if -M<=v-X[i]<=M:
            dp[i][v+M] += dp[i-1][v-X[i]+M]

print(dp[-1][M]-1)
l = input()
m = input()
z = l.split(' ')
M = int(z[1])
N = int(z[0])
F = m.split(' ')
X = []

for item in F:
  votes = int(item)
  X.append(votes)
print("Yes")


### FIXED CODE ###

l = input().split(' ')

print(str(l[2])+' '+str(l[0])+' '+str(l[1]))
n = input()
a_list == list(map(int,input().split()))
if n == len(a_list):
    r_list = reversed(a_list)
    numbers = ' '.join(a_list)
    print(numbers)

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))[::-1]
print(' '.join(map(str,a)))
N = input()
print(N * (N - 1)/2)

### FIXED CODE ###

N = int(input())
print((N - 1) * N // 2)
n, m = map(int, input().split())
x = list(map(int, input().split()))

x.sort()
diff = [x[i+1] - x[i] for i in range(len(x)-1)]

if len(diff) != 0:
    pos_edge = []

    for i in range(n-1):
        pos_edge.append(diff.index(max(diff)))
        diff[diff.index(max(diff))] = 0

    intervals = [x[pos_edge[0]] - x[0]]
    for i in range(len(pos_edge)-1):
        intervals.append(x[pos_edge[i+1]] - x[pos_edge[i]+1])

    intervals.append(x[m-1] - x[pos_edge[len(pos_edge)-1]+1])
else:
    intervals = []

print(sum(intervals))

### FIXED CODE ###

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

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

print(sum(diff[:max(0, m-n)]))
import numpy as np

A = input()
B = input()

N,X = map(int,A.split())
L = np.array(list(map(int, B.strip().split())))

L_sum = 0
jump = 1

for i in range(N+1):
  L_sum += L[i]
  if(L_sum>X):
    jump += 0
  else:
    jump += 1

print(jump)




### FIXED CODE ###

import numpy as np

A = input()
B = input()

N,X = map(int,A.split())
L = np.array(list(map(int, B.strip().split())))

L_sum = 0
jump = 1

for i in range(N):
  L_sum += L[i]
  if(L_sum>X):
    jump += 0
  else:
    jump += 1

print(jump)
N, L = map(int,input().split())

alphabet = []
for i in range (L):
    word = input()
    alphabet.append(word)
    
alphabet.sort()
print(''.join(alphabet))

### FIXED CODE ###

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

alphabet = []
for i in range (N):
    word = input()
    alphabet.append(word)
    
alphabet.sort()
print(''.join(alphabet))
import math

n=int(input())
info=[]
for i in range(n):
    x,y=map(int,input().split())
    info.append([x,y])
total=0
for i in range(n-1):
    for j in range(i+1,n):
        total+=math.sqrt((info[i][0]**2-info[j][0]**2)+(info[i][1]**2-info[j][1]**2))
print(total*2/n)

### FIXED CODE ###

import math

n=int(input())
info=[]
for i in range(n):
    x,y=map(int,input().split())
    info.append([x,y])
total=0
for i in range(n-1):
    for j in range(i+1,n):
        total+=math.sqrt((info[i][0]-info[j][0])**2+(info[i][1]-info[j][1])**2)
print(total*2/n)
def solution(path1, path2, path3):
    counts = [0, 0, 0, 0]
    paths = [path1, path2, path3]
    for path in paths:
        counts[path[0] - 1] += 1
        counts[path[1] - 1] += 1

    countsOfCounts = [0, 0]
    for count in counts:
        if count == 1:
            if countsOfCounts[0] == 2:
                return "NO"
            countsOfCounts[0] += 1
        elif count == 2:
            if countsOfCounts[1] == 2:
                return "NO"
            countsOfCounts[1] += 1
        else:
            return "NO"
    return "YES"


s1, s2, s3 = input().split('\n')
path1 = [int(s) for s in s1.split(' ')]
path2 = [int(s) for s in s2.split(' ')]
path3 = [int(s) for s in s3.split(' ')]

print(solution(path1, path2, path3))


### FIXED CODE ###

def solution(path1, path2, path3):
    counts = [0, 0, 0, 0]
    paths = [path1, path2, path3]
    for path in paths:
        counts[path[0] - 1] += 1
        counts[path[1] - 1] += 1

    countsOfCounts = [0, 0]
    for count in counts:
        if count == 1:
            if countsOfCounts[0] == 2:
                return "NO"
            countsOfCounts[0] += 1
        elif count == 2:
            if countsOfCounts[1] == 2:
                return "NO"
            countsOfCounts[1] += 1
        else:
            return "NO"
    return "YES"


path1 = [int(s) for s in input().split(' ')]
path2 = [int(s) for s in input().split(' ')]
path3 = [int(s) for s in input().split(' ')]

print(solution(path1, path2, path3))
second=input()
first=strings.spitlines(second)
P=first[0]
S=first[1]
count=0
for t in range(0,len(P)-1):
  if P[t]=S[t]:count=count+1
    else count=count
print(count)

### FIXED CODE ###

a=[input() for i in range(2)]
P=a[0]
S=a[1]
count=0
for t in range(len(P)):
  if P[t] != S[t]:
    count=count+1
print(count)
import sys
import numpy as np

h, n = list(map(int, input().split()))
INF = 10 ** 18
dp = np.full(h + 10001, INF, dtype=np.int64)
dp[0] = 0
for line in sys.stdin:
    a, b = map(int, line.split())
    for s in range(0, h, a):
        sa = s + a
        s2a = s + 2 * a
        dp[sa:s2a] = np.minimum(dp[sa:s2a], dp[s:sa] + b)
print(dp[h:].min())


### FIXED CODE ###

import sys

h, n = list(map(int, input().split()))
INF = 10 ** 18
dp = [INF] * (20201)
dp[0] = 0
for line in sys.stdin:
    a, b = map(int, line.split())
    for i in range(10000):
        if dp[i] == INF:
            continue
        dp[i + a] = min(dp[i + a], dp[i] + b)
print(min(dp[h:]))
import sys
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return list(map(int, sys.stdin.readline().split()))

def main():
    n, k = LI()
    g = [[] for i in range(n+1)]
    for i in range(n-1):
        a, b = LI()
        g[a].append(b)
        g[b].append(a)

    s = 1
    Q = [s]
    ans = k
    Qappend = Q.append
    searched = [0] * (n*1)
    searched[s] = 1
    while len(Q) != 0:
        v = Q.pop()
        if v == s:
            cand = k - 1
        else:
            cand = k - 2
        for i in g[v]:
            if searched[i] == 1:
                continue
            searched[i] = 1
            ans *= cand
            cand -= 1
            Qappend(i)
        ans = ans % MOD
    print(ans % MOD)


if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)
INF=10**9+7
def LI(): return list(map(int, sys.stdin.readline().split()))

def main():
    n, k = LI()
    graph=[[] for i in range(n)]
    for i in range(n-1):
        a,b=LI()
        graph[a-1].append(b-1)
        graph[b-1].append(a-1)
    ans=1
    check=[False]*n
    stack=[0]
    ans=1
    while len(stack)>0:
        x=stack.pop()
        check[x]=True
        count=0
        for i in graph[x]:
            if not check[i]:
                count+=1
                stack.append(i)
        if x==0:
            temp=1
            for i in range(count):
                temp=temp*(k-1-i)%INF
            ans=ans*temp%INF
        else:
            temp=1
            for i in range(count):
                temp=temp*(k-2-i)%INF
            ans=ans*temp%INF
    print((ans*k)%INF)


if __name__ == "__main__":
    main()
a, b = map(float(input().split()))

print(int(floor(a*b)))

### FIXED CODE ###

import math
import decimal

a, b = input().split()

a = int(a)
b = decimal.Decimal(b)

print(int(math.floor(a*b)))
n = int(input())
f = [list(map(int, input().split())) for _ in range(n)]
p = [list(map(int, input().split())) for _ in range(n)]
res = -10**10
for i in range(1, 1<<10):
    count = [0 for _ in range(10)]
    for j in range(10):
        for k in range(n):
            if (i>>j)&1 == 1 and f[k][j] == 1:
                count[k] += 1
    total = 0
    for k in range(n):
        total += p[k][count[k]]
    res = max(res, total)
print(res)


### FIXED CODE ###

n = int(input())
f = [list(map(int, input().split())) for _ in range(n)]
p = [list(map(int, input().split())) for _ in range(n)]
res = -10**10
for i in range(1, 1<<10):
    count = [0 for _ in range(n)]
    for j in range(10):
        for k in range(n):
            if (i>>j)&1 == 1 and f[k][10-j-1] == 1:
                count[k] += 1
    total = 0
    for k in range(n):
        total += p[k][count[k]]
    res = max(res, total)
print(res)
N = int(input())
As = [[]]
for i in range(N):
    As.append(list(map(int, input().split())))

Cs = [0] * (N + 1)
d = 1
ms = 0
msMax = N * (N - 1) // 2
sw = True
while sw:
    tab = set()
    c = 0
    for i in range(1, N + 1):
        if Cs[i] == N - 1:
            continue
        a = 0
        b = 0
        if i > As[i][Cs[i]]:
            a = As[i][Cs[i]]
            b = i
        else:
            a = i
            b = As[i][Cs[i]]
        if (a, b) in tab:
            ms = ms + 1
            c = c + 1
            if ms == msMax:
                sw = False
                break
            Cs[a] += 1
            Cs[b] += 1
        else:
            tab.add((a, b))
    if c == 0:
        d = 0
        break
    d += 1
print(d - 1)    N = int(input())
    As = [[]]
    for i in range(N):
        As.append(list(map(int, input().split())))

    Cs = [0] * (N + 1)
    Ks = [False] * (N + 1)
    d = 1
    ms = 0
    msMax = N * (N - 1) // 2
    sw = True
    tab = set()
    while sw:
        c = 0
        wa = []
        for i in range(1, N + 1):
            if Ks[i]:
                continue
            if Cs[i] == N - 1:
                continue
            a = 0
            b = 0
            if i > As[i][Cs[i]]:
                a = As[i][Cs[i]]
                b = i
            else:
                a = i
                b = As[i][Cs[i]]
            if (a, b) in tab:
                ms = ms + 1
                c = c + 1
                if ms == msMax:
                    sw = False
                    print(d)
                    break
                Cs[a] += 1
                Cs[b] += 1
                tab.remove((a, b))
                wa.append(a)
                wa.append(b)
            else:
                tab.add((a, b))
                Ks[i] = True
        for i in wa:
            Ks[i] = False
        d += 1
        if c == 0:
            print(-1)
            break

### FIXED CODE ###

import sys

input = sys.stdin.readline
N = int(input())
As = [list(map(int, input().split())) + [-1] for _ in range(N)]

import collections

que = collections.deque([i for i in range(N)])
counters = [0] * N
days = [0] * N
while que:
    player = que.popleft()
    opponent = As[player][counters[player]] - 1
    if As[opponent][counters[opponent]] - 1 == player:
        days[player] = max(days[player], days[opponent]) + 1
        days[opponent] = days[player]
        counters[player] += 1
        counters[opponent] += 1
        que.append(player)
        que.append(opponent)
for c in counters:
    if c < N - 1:
        print(-1)
        break
else:
    print(max(days))
#ABC174B

N,D = map(int,input.split())
X = []
Y = []
for _ in range(N):
    x,y = map(int,input().split())
    X.append(x)
    Y.append(y)

count = 0

for i in range(N):
    if D**2 >= X[i]**2 + Y[i]**2:
        count += 1
print(count)

### FIXED CODE ###


#ABC174B

N,D = map(int,input().split())
X = []
Y = []
for _ in range(N):
    x,y = map(int,input().split())
    X.append(x)
    Y.append(y)

count = 0

for i in range(N):
    if D**2 >= X[i]**2 + Y[i]**2:
        count += 1
print(count)
import numpy as np
from scipy.optimize import fmin
import sys
n,k=map(int,input().split())
Z=list(map(int,sys.stdin.buffer.read().split()))
X=np.array(Z[::3],dtype=np.float)
Y=np.array(Z[1::3],dtype=np.float)
C=np.array(Z[2::3],dtype=np.float)
Z=[Z[i*3:i*3+3]for i in range(n)]
def f(x):
  x,y=x
  t=np.sort(C*np.sqrt((X-x)*(X-x)+(Y-y)*(Y-y)))
  return t[k-1]
A=[fmin(f,(x,y),disp=False,ftol=10**(-7),initial_simplex=[(x+0.5,y),(x-0.5,y+0.5),(x-0.5,y-0.5)])for x,y,c in Z]
B=list(map(lambda x:f(x),A))
print(min(B))

### FIXED CODE ###

import numpy as np
from scipy.optimize import fmin

n,k=map(int,input().split())
XYC=[list(map(int,input().split())) for i in range(n)]
X,Y,C=[],[],[]
for x,y,c in XYC:
    X.append(x)
    Y.append(y)
    C.append(c)
X=np.array(X,dtype=np.float)
Y=np.array(Y,dtype=np.float)
C=np.array(C,dtype=np.float)
def f(xy):
    x,y=xy
    times=(X-x)*(X-x)+(Y-y)*(Y-y)
    times=C*np.sqrt(times)
    times=np.sort(times)
    return times[k-1]
deff=0.5
ansx=[fmin(f,(x,y),disp=False,ftol=10**(-7),initial_simplex=[(x+deff,y),(x-deff,y+deff),(x-deff,y-deff)]) for x,y,c in XYC]
ansy=list(map(lambda x:f(x),ansx))
print(min(ansy))
A, B = map(int, input().split())
for c in range(1, 4):
    if (a * b * c) % 2 != 0:
        print('Yes')
        break
else:
    print('No')


### FIXED CODE ###

a, b = map(int, input().split())
for c in range(1, 4):
    if (a * b * c) % 2 != 0:
        print('Yes')
        break
else:
    print('No')
import sys
input=sys.stdin.readline

S=input()
n=len(S)
R=[0]*13
cnt=[0]*13
Pow=[[] for i in range(6)]
mod=10**9+7

for i in range(6):
    c=10**i
    for j in range(10):
        Pow[i].append(c*j%13)
ans=0
flag=0
for i in range(n):
    if S[n-i-1]=="?":
        P=Pow[i%6]
        if flag==0:
            for p in P:
                R[p]=1
                flag=1
        else:
            for j in range(10):
                for k in range(13):
                    cnt[(k+P[j])%13]+=R[k]%mod
            R=cnt
            cnt=[0]*13
    else:
        x=int(S[n-i-1])
        ans+=Pow[i%6][x]
ans%=13
print(R[(18-ans)%13]%mod)

### FIXED CODE ###

S=input()
n=len(S)
R=[0]*13
cnt=[0]*13
Pow=[[] for i in range(6)]
mod=10**9+7

for i in range(6):
    c=10**i
    for j in range(10):
        Pow[i].append(c*j%13)
ans=0
flag=0
for i in range(n):
    if S[n-i-1]=="?":
        P=Pow[i%6]
        if flag==0:
            for p in P:
                R[p]=1
                flag=1
        else:
            for j in range(10):
                for k in range(13):
                    cnt[(k+P[j])%13]+=R[k]%mod
            R=cnt
            cnt=[0]*13
    else:
        x=int(S[n-i-1])
        ans+=Pow[i%6][x]
ans%=13
if flag==0:
    if ans==5:
        print(1)
    else:
        print(0)
else:
    print(R[(18-ans)%13]%mod)
n, k = map(int,input().split())
know = 1
for i in range(n):
    if (n+0.5)//know == 0:
        print(i)
        break
    else:
        know *= k


### FIXED CODE ###

n, r = map(int,input().split())
if n < 10:
    print(r+100*(10-n))
else:
    print(r)
a1, a2, a3 = map(int, input(), split())
if a1+a2+a3 <= 21:
    print("win")
else:
    print("bust")

### FIXED CODE ###

a1, a2, a3 = map(int, input().split())
if a1+a2+a3 <= 21:
    print("win")
else:
    print("bust")
N=int(input())
A=list(map(int,input().split()))
a=0
b=0
for num in A:
    if num%2==1:
        a+=1
    elif num%4==0:
        b+=1

if N==3:
    if a==3 or (a>=1 and b==0):
        print('No')
    else:
        print('Yes')
else:
    if a=<b:
        print('Yes')
    else:
        print('No')

### FIXED CODE ###

N=int(input())
A=list(map(int,input().split()))
a=0
b=0
for num in A:
    if num%2==1:
        a+=1
    elif num%4==0:
        b+=1

if N%2==1:
    if a>b+1:
        print('No')
    else:
        print('Yes')
else:
    if a<=b:
        print('Yes')
    else:
        print('No')
N,K = map(int,input().split())
list = input().split()
MIN = int(list[0])
SUM = 0
for j in range(0,K):
  for i in list:
    if MIN > int(i):
      MIN = int(i)
  list.remove(str(MIN))
  SUM += MIN
  MIN = int(list[0])
print(SUM)


### FIXED CODE ###

N,K = map(int,input().split())
import sys
if N==1:
    print(input())
    sys.exit()
list = input().split()
MIN = 1001
SUM = 0
for j in range(0,K):
  for i in list:
    if MIN > int(i):
      MIN = int(i)
  list.remove(str(MIN))
  SUM += MIN
  MIN = 1001
print(SUM)
N = int(input())
if 
if N % 2 == 0:
    answer = N /2
else:
    answer = (N + 1) / 2

print(answer)

### FIXED CODE ###

N = int(input())
if N % 2 == 0:
    answer = N /2
else:
    answer = (N + 1) / 2

print(int(answer))
L,R = [int(i) for i in input().split()]
if R-L >= 4038:
    print(0)
else:
    ans = []
    for i in range(L,R+1):
        ans.append(i % mod)
    ans = sorted(ans)
    print(ans[0]*ans[1])

### FIXED CODE ###

L,R = [int(i) for i in input().split()]
mod = 2019
if R-L >= 673:
    print(0)
else:
    ans = []
    for i in range(L,R+1):
        for ii in range(i+1,R+1):
            ans.append((i*ii)%mod)
    ans = sorted(ans)
    print(ans[0])
ans = 0
if h % 2 == 0:
    for i in range(w):
        ans += h/2
    print(int(ans))
elif w % 2 == 0:
    for i in range(w/2):
        ans += h
    print(int(ans))
else:
    for i in range(w//2):
        ans += h
    ans += h // 2 +1
    print(int(ans))


### FIXED CODE ###

x = list(map(int,input().split(" ")))
h = x[0]
w = x[1]

ans = 0
if h == 1:
    print(1)
elif w == 1:
    print(1)
elif h % 2 == 0:
    ans = int(h/2 * w)
    print(ans)
elif (h % 2 != 0) and (w % 2 == 0):
    ans = int(h * w/2)
    print(ans)
elif (h % 2 != 0) and (w % 2 != 0):
    ans = int((h//2 +1) * (w//2 +1)) + (h//2 * (w - 1 - w//2))
    print(int(ans))
N ,K = list(map(int, input().split()))
p = list(map(lambda x: (1+int(x))/2, input().split()))
s = [0]*N
s[0]=p[0]
for i in range(1,N):
  s[i] = s[i-1]+p[i]

l = []
for i in range(N-K):
  l.append(s[i+K]-s[i])
  
print(max(l))

### FIXED CODE ###

N ,K = list(map(int, input().split()))
p = list(map(lambda x: (1+int(x))/2, input().split()))
s = [0]*N
s[0]=p[0]
for i in range(1,N):
  s[i] = s[i-1]+p[i]

l = [s[K-1]]
for i in range(N-K):
  l.append(s[i+K]-s[i])

print(max(l))
N = int(input())
H = list(map(int, input().split()))
    
if N == 1:
    print("Yes")
    
else:
    for i in range(N - 1, -1, -1):
        if H[i] - H[i - 1] == -1:
            H[i - 1] -= 1
            
        elif H[i] - H[i - 1] < -1:
            print("No")
            break
            
    if k == 0:
        print("Yes")
        
            
        


### FIXED CODE ###

N = int(input())
H = list(map(int, input().split()))
    
if N == 1:
    print("Yes")
    
else:
    for i in range(N - 1, 0, -1):
        if H[i] - H[i - 1] == -1:
            H[i - 1] -= 1
            
        elif H[i] - H[i - 1] < -1:
            print("No")
            break
            
    if i == 1:
        print("Yes")
N = list(map(int, input().split()))
string = [input() for s in range(N[1])]
string.sort()
print(''.join(string))


### FIXED CODE ###

N = list(map(int, input().split()))
string = [input() for s in range(N[0])]
string.sort()
print(''.join(string))
line = input()
X = [int(n) for n in line.split()]

smaller_divisible_number = X
if num%2 != 0:
    smaller_divisible_number *= 2
print(smaller_divisible_number)

### FIXED CODE ###

a = int(input())
i=1
if a%2==0 and a%a==0:
  print(a)
else:
 print(a*2)
A = int(input())
B = int(input())
print((set(range(1, 3 + 1)) - {A, B})[0])

### FIXED CODE ###

A = int(input())
B = int(input())
print(list(set(range(1, 3 + 1)) - {A, B})[0])
s,t=input().split(" ")
a,b.=map(int,input().split(" "))
u=input()
 
if s==u:
  print(a-1, b)
else:
  print(a, b-1)

### FIXED CODE ###

s,t=input().split(" ")
a,b=map(int,input().split(" "))
u=input()
 
if s==u:
  print(a-1, b)
else:
  print(a, b-1)
import math
xyzk = list(map(int,input().split()))
abc = [list(map(int,input().split())) for a in range(3)]
ab=[]
for a in abc[0]:
    for b in abc[1]:
        ab.append(a+b)
ab.sort()
ab.reverse()
abc[2].sort()
abc[2].reverse()
abc2=[]
for c in range(abc[2]):
    for a in range(min([xyzk[3]/(c+1),len(ab)])):
        abc2.append(abc[2][b]+ab[a])
abc2.sort()
abc2.reverse()
for a in range(xyzk[3]):
    print(abc2[a])

### FIXED CODE ###

import math
xyzk = list(map(int,input().split()))
abc = [list(map(int,input().split())) for a in range(3)]
ab=[]
for a in abc[0]:
    for b in abc[1]:
        ab.append(a+b)
ab.sort()
ab.reverse()
abc[2].sort()
abc[2].reverse()
abc2=[]
for c in range(len(abc[2])):
    for a in range(min([math.ceil(xyzk[3]/(c+1)),len(ab)])):
        abc2.append(abc[2][c]+ab[a])
abc2.sort()
abc2.reverse()
for a in range(xyzk[3]):
    print(abc2[a])
[N,M] = list(map(int,input().split()))
a = []
for i in range(M):
    a.append(int(input()))

#print(a)
dp = [0] * (N+1)
dp[0]=1
if a[0]!=1:
    dp[1]=1
#dp[1]=1
j=0
for i in range(1,N+1):
    if i==a[j]:
        dp[i] = 0
        j+=1
        if j==len(a):
            j=0

    else:
        dp[i] = dp[i-1] + dp[i-2]

print(dp[-1] % 1000000007)

### FIXED CODE ###

[N,M] = list(map(int,input().split()))
a = []
for i in range(M):
    a.append(int(input()))

aa=[0]*(N+1)
for j in range(M):
    aa[a[j]] = 1

dp = [0]*(N+1)
dp[0]=1
if 1 not in a:
    dp[1]=1
else:
    dp[1]=0

for i in range(2,N+1):
    if aa[i]==0:
        dp[i]=dp[i-1] + dp[i-2]
    else:
        dp[i]=0

print(dp[-1] % 1000000007)
while True:
  H, W = map(int, raw_input().split())
  if H == 0 and 'W' == 0:
    break
  print '#'*W
  for l in range(0, H-2):
    print '#' + '.'*(W-2) + '#'
  print '#' * W
  print ''

### FIXED CODE ###

while True:
  H, W = map(int, raw_input().split())
  if H == 0 and W == 0:
    break
  print '#'*W
  for l in range(0, H-2):
    print '#' + (W-2)*'.' + '#'
  print '#' * W
  print ''
import fractions
a, b, c, d = map(int, input().split())
e = (c*d)/fractions.gcd(c,d)
bb = b-(b//c + b//d- b//e)
aa = a-1-((a-1)//c+(a-1)//d-(a-1)//e)
z = bb-aa
print(int(z))

### FIXED CODE ###

n = int(input())
d = list(map(int, input().split()))
d.sort()
if d[int((n/2))] == d[int(n/2)-1]:
    print(0)
else:
    print(d[int(n/2)]-d[int((n/2)-1)])
n = int(input())
a = list(map(int, input().split()))
count = 0
flag = 1

while flag == 1:
    b = list(map(lambda x: x % 2, a))
    if b.count(1) == 0:
        a = list(map(lambda x: x / 2, a))
        count += 1
    else:
        flag = 0

print(count)

### FIXED CODE ###

a = str(input())
print(a.count('1'))