Harryxun/stf_run huggingface dataset:
n,m,x=map(int,input().split())
l=[0]*n
for i in range(n):
    long=list(map(int,input().split()))
    l[i]=long

ans=10**9
for i in range(1,1<<n):
    money=0
    a=[0]*n
    for j in range(n):
        if (i>>j)%2==1:
            money+=l[j][0]
            for k in range(m):
                a[k]+=l[j][k+1]
    cnt=0
    for p in a:
        if p>=x:
            cnt+=1
            if cnt==m:
                ans=min(ans,money)
print(ans)

### FIXED CODE ###

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

A = [[] for _ in range(n)]
c = [0] * n

for i in range(n):
    c_as = list(map(int, input().split()))
    c[i], A[i] = c_as[0], c_as[1:]

INF = 10**9
ans = INF
    
for s in range(0, 1 << n):
    smart = [0] * m
    cost_sum = 0
    for i in range(n):
        if (s >> i) % 2 == 0:continue
        cost_sum += c[i]
        for j in range(m):
            smart[j] += A[i][j]
    ok = True
    for j in range(m):
        if smart[j] < X:
            ok = False
    if ok:
        ans = min(ans, cost_sum)

if ans == INF:
    ans = -1

print(ans)
import math
 
n = int(input())
li = list(map(int,input().split()))
 
leftgcd = [0 for i in range(n)]
rightgcd = [0 for i in range(n)]
 
leftgcd[0] = li[0]
rightgcd[n - 1] = li[n - 1]
 
if n == 2:
  print(max(li[0], li[1]))
else:
  for j in range(1, n):
    leftgcd[j] = math.gcd(li[j], leftgcd[j - 1])
    rightgcd[n - 1 - j] = math.gcd(li[n - 1 - j], rightgcd[n - j])

  ans = max(leftgcd[n - 2], rightgcd[1])
  for k in range(1, n - 1):
    g = math.gcd(leftgcd[k - 1], rightgcd[k + 1])
    if g > ans:
      ans = g
  print(ans)

### FIXED CODE ###

import fractions
 
n = int(input())
li = list(map(int,input().split()))
 
leftgcd = [0 for i in range(n)]
rightgcd = [0 for i in range(n)]
 
leftgcd[0] = li[0]
rightgcd[n - 1] = li[n - 1]
 
if n == 2:
  print(max(li[0], li[1]))
else:
  for j in range(1, n):
    leftgcd[j] = fractions.gcd(li[j], leftgcd[j - 1])
    rightgcd[n - 1 - j] = fractions.gcd(li[n - 1 - j], rightgcd[n - j])
 
  ans = max(leftgcd[n - 2], rightgcd[1])
  for k in range(1, n - 1):
    g = fractions.gcd(leftgcd[k - 1], rightgcd[k + 1])
    if g > ans:
      ans = g
  print(ans)
s=input()
n=0
for s in a:
  if a=='o':
    n+=100
sum = 700+n
print(sum)

### FIXED CODE ###

s=input()
n=0
for a in s:
  if a=='o':
    n+=100
sum = 700+n
print(sum)
N, K = map(int, input().split()) # 横に2個
S = [int(i) for i in list(input())]

N0 = []
N1 = []
n0 = 0
n1 = 0
for s in S:
    if s == 0:
        if n1 > 0:
            N1.append(n1)
            n1 = 0
        n0 += 1
    if s == 1:
        if n0 > 0:
            N0.append(n0)
            n0 = 0
        n1 += 1
if n0 > 0:
    N0.append(n0)
if n1 > 0:
    N1.append(n1)

M0 = [0]
m0 = 0
for n0 in N0:
    m0 += n0
    M0.append(m0)

M1 = [0]
m1 = 0
for n1 in N1:
    m1 += n1
    M1.append(m1)
#print(M0)
#print(M1)

#d = 0 if len(M0)==len(M1) and c == 0


if len(N1) == 1 and len(N0) == 0:
    ans = N1[0]
elif len(N1) == 0 and len(N0) == 1:
    ans = N0[0]
else:
    ans = 0
    for i in range(N):
        if i+K+1 >= len(M1):
            a = M1[-1]-M1[-1-K]
            if i == 0:
                ans = a
        else:
            a = M1[i+K+1]-M1[i]
        if i + K >= len(M0):
            break
        l = M0[i+K]-M0[i] + a
        #print(l)
        ans = max(ans, l)
print(ans)

### FIXED CODE ###

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

l = 0
r = 0
change = 0 if S[0] == '1' else 1
ans = 0
while l < N and r < N:
    #print(l, r, change)
    ans = max(ans, r-l+1)
    if r == N-1:
        break
    if S[r] == '0':
        r += 1
    else:
        if S[r+1] == '0':
            if change < K:
                change += 1
                r += 1
            else:
                if S[l] == '0' and S[l+1] == '1':
                    r += 1
                l += 1
        else:
            r += 1
print(ans)
from collections import deque

w,h = map(int,input().split())
maze = []

cnt_wall = 0
for _ in range(h):
    s = input()
    cnt_wall += s.count('#')
    maze.append(s)

inf = 10**5
def  bfs(d):
    visited = [[inf]*w for _ in range(h)]
    sx,sy = 0,0
    gx,gy = w-1, h-1
    que = deque([(sx,sy)])
    visited[sx][sy] = 1
    
    while que:
        x,y = que.popleft()
        if x==gx and y==gy:
            return visited[x][y]
        for i,j in ((1,0),(0,1),(-1,0),(0,-1)):
            nx,ny = x+i, y+j
            if 0<=nx<=gx and 0<=ny<=gy:
                if d[nx][ny]=='.' and visited[nx][ny]==inf:
                    visited[nx][ny] = visited[x][y]+1
                    que.append((nx,ny))
    else:
        return inf

min_step = bfs(maze)
if min_step == inf:
    print(-1)
else:
    print(h*w - min_step - cnt_wall)

### FIXED CODE ###

from collections import deque

def bfs(maze,visited,sy,sx,gy,gx):
    Step = ([1,0],[0,1],[-1,0],[0,-1])
    
    que = deque([[sx,sy]])
    visited[sx][sy] = 1
    
    while que:
        y,x = que.popleft()
        if [y,x] == [gy,gx]:
            return visited[y][x]
        for j,k in Step:
            ny,nx = y+j , x+k
            if 0 <= ny <= gy and 0 <= nx <= gx:
                if maze[ny][nx] == '.' and visited[ny][nx] == INF:
                    visited[ny][nx] = visited[y][x] + 1
                    que.append([ny,nx])


h,w = map(int,input().split())
maze = [input().strip() for _ in range(h)]

cntSharp = 0
for i in range(h):
    cntSharp += maze[i].count('.')

INF = 10**5
visited = [[INF]*w for _ in range(h)]

sx,sy = 0,0
gy,gx = h-1,w-1

minStep = bfs(maze,visited,sy,sx,gy,gx)
print(cntSharp - minStep if visited[gy][gx] != INF else -1)
import math
n = int(input())
t1 = int(input())
for _ in range(n-1):
    t2 = int(input())
    ans = t1*t2 // math.gcd(t1, t2)
print(ans)


### FIXED CODE ###

def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a%b)


def lcm(a, b):
    return a*b//gcd(a, b)

n = int(input())
t1 = int(input())
ans = t1
for _ in range(n-1):
    t2 = int(input())
    ans = lcm(ans, t2)
print(ans)
n = int(input())
s = input()
start = s[0]
pattern = []

prev = ''
b = 0
w = 0
for i in s:
    if (i == '#' and prev == '#') or (i == '#' and prev ==''):
        b += 1
    elif (i == '.' and prev == '.') or (i == '.' and prev == ''):
        w += 1
    elif i == '#':
        b += 1
        pattern.append(w)
        w = 0
    else:
        w += 1
        pattern.append(b)
        b = 0
    prev = i
    
if prev == '#':
    pattern.append(b)
else:
    pattern.append(w)

totalb = 0
totalw = 0
for i in range(len(pattern)):
    if start == '.':
        if i % 2 == 0:
            totalw += pattern[i]
        else:
            totalb += pattern[i]
    else:
        if i % 2 == 0:
            totalb += pattern[i]
        else:
            totalw += pattern[i]
        
if len(pattern) == 1 or (len(pattern) == 2 and start == '.'):
    print(0)
elif (len(pattern) == 2 and start == '#'):
    print(min(totalw, totalb))
elif start == '.' and prev == "#":
    print(min(totalw - pattern[0], totalb - pattern[-1]))
elif start == '.':
    print(min(totalw - pattern[0], totalb))
else:
    print(min(totalw, totalb))
    
        
        


### FIXED CODE ###

a, b, c = (int(_) for _ in input().split())  

if a > b:
    if b < c < a:
        print("Yes")
    else:
        print("No")
else:
    if a < c < b:
        print("Yes")
    else:
        print("No")
A = input()
B = input()
C = input()
if A < B:
    D = B
    E = A
else :
    E = B
    D = A
if D > C > E :
    print("yes")
else :
    print("no")

### FIXED CODE ###

A,B,C = map(int,input().split())
if A > C > B :
    print("Yes")
elif B > C > A :
    print("Yes")
else :
    print("No")
n=int(input())
if n in "9":
    print("Yes")
else:
    print("No")

### FIXED CODE ###

print("Yes" if "9" in input() else "No")
step = input()

ng = ["L", "R"]

for i in range(0, len(step)):
  if step[i] == ng[i%2]:
    return "No"
return "Yes"


### FIXED CODE ###

step = input()

ng = ["L", "R"]

for i in range(0, len(step)):
  if step[i] == ng[i%2]:
    print("No")
    exit()
print("Yes")
import math

a, b = map(int, input().split())
#print(a)print(type(a))print(b)print(type(b))
def lcm(s, t):
    ans = s * t // (math.gcd(s, t))
    return ans
print(lcm(a, b))

### FIXED CODE ###


a, b = map(int, input().split())
def gcd(l, m):
    x = min(l, m)
    y = max(l, m)
    if y % x == 0:
        return x
    else:
        while y % x != 0:
            z = y % x
            y = x
            x = z
        else:
            return z

def lcm(s, t):
    ans = s * t // (gcd(s, t))
    return ans

print(lcm(a, b))
n = int(input())
a = ''

if n == 1:
    print('a')
if n == 26:
    print('z')
else:
    while n > 0:
    	if n%26 == 1:
        	a += 'a'
    	elif n%26 == 2:
        	a += 'b'
    	elif n%26 == 3:
        	a += 'c'
    	elif n%26 == 4:
        	a += 'd'
    	elif n%26 == 5:
        	a += 'e'
    	elif n%26 == 6:
        	a += 'f'
    	elif n%26 == 7:
        	a += 'g'
    	elif n%26 == 8:
        	a += 'h'
    	elif n%26 == 9:
        	a += 'i'
    	elif n%26 == 10:
        	a += 'j'
    	elif n%26 == 11:
        	a += 'k'
    	elif n%26 == 12:
        	a += 'l'
    	elif n%26 == 13:
        	a += 'm'
    	elif n%26 == 14:
        	a += 'n'
    	elif n%26 == 15:
        	a += 'o'
    	elif n%26 == 16:
        	a += 'p'
    	elif n%26 == 17:
        	a += 'q'
    	elif n%26 == 18:
        	a += 'r'
    	elif n%26 == 19:
        	a += 's'
    	elif n%26 == 20:
        	a += 't'
    	elif n%26 == 21:
        	a += 'u'
    	elif n%26 == 22:
        	a += 'v'
    	elif n%26 == 23:
        	a += 'w'
    	elif n%26 == 24:
        	a += 'x'
    	elif n%26 == 25:
        	a += 'y'
    	elif n%26 == 0:
        	a += 'z'
        	n -=26
    	n = int(n / 26)
	a = a[::-1]
	print(a)
    



### FIXED CODE ###

n = int(input())
a = ''

while n > 0:
    if n%26 == 1:
        a += 'a'
    elif n%26 == 2:
        a += 'b'
    elif n%26 == 3:
        a += 'c'
    elif n%26 == 4:
        a += 'd'
    elif n%26 == 5:
        a += 'e'
    elif n%26 == 6:
        a += 'f'
    elif n%26 == 7:
        a += 'g'
    elif n%26 == 8:
        a += 'h'
    elif n%26 == 9:
        a += 'i'
    elif n%26 == 10:
        a += 'j'
    elif n%26 == 11:
        a += 'k'
    elif n%26 == 12:
        a += 'l'
    elif n%26 == 13:
        a += 'm'
    elif n%26 == 14:
        a += 'n'
    elif n%26 == 15:
        a += 'o'
    elif n%26 == 16:
        a += 'p'
    elif n%26 == 17:
        a += 'q'
    elif n%26 == 18:
        a += 'r'
    elif n%26 == 19:
        a += 's'
    elif n%26 == 20:
        a += 't'
    elif n%26 == 21:
        a += 'u'
    elif n%26 == 22:
        a += 'v'
    elif n%26 == 23:
        a += 'w'
    elif n%26 == 24:
        a += 'x'
    elif n%26 == 25:
        a += 'y'
    elif n%26 == 0:
        a += 'z'
        n -=26
    n = int(n / 26)
a = a[::-1]
print(a)
S = input()

if len(set(list(S))) !BBA
= 1:
    print('Yes')
else:
    print('No')


### FIXED CODE ###

S = input()

if len(set(list(S))) != 1:
    print('Yes')
else:
    print('No')
d,e=[list(map(int,input().split()))for _ in range(2)]
e[3],e[4]=e[4],e[3]
t=0
for i in range(6):
 m={0:'012345',1:'152304',2:'215043',3:'310542',4:'402351',5:'513240'}[i]
 f=[d[int(j)]for j in m];f[3],f[4]=f[4],f[3]
 if f[0]==e[0]:
  for j in range(4):
   if f[1:5]*2[j:j+4]==e[1:5]:t=1;break
print(('No','Yes')[t==1])

### FIXED CODE ###

d,e=[input().split()for _ in'12'];e[3:5]=e[4],e[3]
t=0
for p in('012345','152304','215043','310542','402351','513240'):
 f=[d[int(j)]for j in p];f[3:5]=f[4:2:-1]
 if f[0]==e[0]:
  f=f[1:5]*2
  for j in range(4):
   if f[j:j+4]==e[1:5]:t=1
print(('No','Yes')[t])
s,k,t=input(),int(input()),""
for q in s:
 if(p:=(123-ord(q))%26)<=k:t+="a";k-=p
 else:t+=q
*a,b=t
print(a+chr((ord(b)-97+k)%26+97))

### FIXED CODE ###

s, k, t = input(), int(input()), ""
for q in s:
    if (p := (123 - ord(q)) % 26) <= k:
        k -= p
        t += "a"
    else:
        t += q
print(t[:-1] + chr((ord(t[-1]) - 97 + k) % 26 + 97))
s=input()
print("Yes" if s/10==9 or s%10==9 else "No")

### FIXED CODE ###

s=input()
print("Yes" if s/10==9 or s%10==9 else "No")
n= int(input())
if 4*(2n//7) -n>=0:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

n= int(input())
if 4*(2*n//7) -n>=0:
    print("Yes")
else:
    print("No")
N = int(input())
H = map(int,input().split())

for i in range(N-1):
  if H(N-i-1) < H(N-i-2):
    H(N-i-2) -= 1
    
f = 0
for i in range(N-1):
  if H(N-i-1) < H(N-i-2):
    f = 1
    
if f = 0:
  print("No")
else:
  print("Yes")

### FIXED CODE ###

N = int(input())
H = list(map(int,input().split()))

for i in range(N-1):
  if H[N-i-1] < H[N-i-2]:
    H[N-i-2] -= 1
    
f = 0
for i in range(N-1):
  if H[N-i-1] < H[N-i-2]:
    f = 1
    
if f == 0:
  print("Yes")
else:
  print("No")
import fractions
from functools import reduce
import copy

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

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

#in
n=int(input())
v=list(map(int, input().split()))

maxi = 0

# おなじか？
if len(list(set(v))) == 1:
    maxi = (v[0])
elif len(v) == 2:
    maxi = (max(v))
# 書き換え 1
else:
    for i in range(n):
        listv = []
        listv = copy.copy(v)
        listv[i] = min(v) 
        listv[i] = max(listv)
        if gcd_list(listv)> maxi:
            maxi = gcd_list(listv)
#最大公約数


print(maxi)

# 書き換え 2


### FIXED CODE ###

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

print((t//a)*b)
import sys

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

d = {}

for i in range(M):
    s, c = map(int, input().split())
    if s not in d:
        d[s] = c
    elif d[s] != c:
        print(-1)
        sys.exit()

# print(d)
if d[1] == 0:
    print(-1)
    sys.exit()
ans = ""
for i in range(1, N + 1):
    if i in d:
        ans += str(d[i])
    else:
        ans += "0"
print(ans)


### FIXED CODE ###

import sys

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

d = {}

for i in range(M):
    s, c = map(int, input().split())
    if s not in d:
        d[s] = c
    elif d[s] != c:
        print(-1)
        sys.exit()

# print(d)
# if d[1] == 0:
#     print(-1)
#     sys.exit()
ans = [0 for _ in range(N)]

for i in range(N):
    if i + 1 in d:
        ans[i] = d[i + 1]
if 1 not in d and N != 1:
    ans[0] = 1
if ans[0] == 0 and len(ans) != 1:
    print(-1)
else:
    print(*ans, sep="")
n=int(input())
if n==0:
    result=0
result=''
while True:
    if n==0:
        break
    if n%2==0:
        n=n/(-2)
        result='0'+result
    else:
        n=(n-1)/(-2)
        result='1'+result
print(int(result))


### FIXED CODE ###

n=int(input())
result=''
if n==0:
    result='0'
while True:
    if n==0:
        break
    if n%2==0:
        n=n/(-2)
        result='0'+result
    else:
        n=(n-1)/(-2)
        result='1'+result
print(int(result))
S = input()
if S == 'ABC':
  input('ARC')
else:
  print('ABC')

### FIXED CODE ###

S = input()
if S == 'ABC':
  print('ARC')
else:
  print('ABC')
N, M = map(int, input().split())
route = [int(x) for x in range(N)]
a = [int(input()) for _ in range(M)]
route = [item for index, item in enumerate(route) if index not in a]

nums = [0]*(N+1)
nums[0] = 1
if 1 not in a:
    nums[1] = 1
for i in range(2, N+1):
    print(nums)
    if not i in a:
      nums[i] = nums[i-1] + nums[i-2]

print(nums[N]%(1000000007))


### FIXED CODE ###

N, M = map(int, input().split())
a = set([int(input()) for _ in range(M)])

nums = [0]*(N+1)
nums[0] = 1
if 1 not in a:
    nums[1] = 1
for i in range(2, N+1):
    if not i in a:
      nums[i] = nums[i-1] + nums[i-2]

print(nums[N]%(1000000007))
# -*- coding: utf-8 -*-

N = input("")
L = input("").split(" ")
suc = N

for i in range(int(N)):
    for j in range(i):
        if (L[j] < L[i]):
            suc -= 1
            break
    
print(suc)

### FIXED CODE ###

N = input("")
L = input("").split(" ")
suc = int(N)
min_ = 200001

for i in range(int(N)):
    if (L[i] == 1):
        min_= 1
        continue
    if (int(min_) < int(L[i])):
        suc -= 1
        continue
    if (int(min_) >= int(L[i])):
        min_ = L[i]
print(suc)
tems = list(map(lambda x: int(x), input().split()))
s = items[0]
w = items[1]
print('safe' if s > w else 'unsafe')

### FIXED CODE ###

items = list(map(lambda x: int(x), input().split()))
s = items[0]
w = items[1]
print('safe' if s > w else 'unsafe')
n,m = map(int, raw_input().split(' '))
print sum([1 for e in  map(int, raw_input().split(' ')) if e >= m else 0])

### FIXED CODE ###

n,m = map(int, raw_input().split(' '))
print sum([1 for e in  map(int, raw_input().split(' ')) if e >= m] or [0])
a,b,c,x,y=map(int,input().split())
print(min(x*

### FIXED CODE ###

a,b,c,x,y=map(int,input().split())
print(min(x*a+y*b,2*x*c+b*max(0,y-x),2*y*c+a*max(0,x-y)))
import sys
for line in sys.stdin:
    a,b,c = line.split()
    a,c = int(a), int(c)
    p = '+-*/?'.index(b)
    if p = 0:: a += c
    elif p == 1: a -= c
    elif p == 2: a *= c 
    elif p == 3: a /= c
    elif p == 4: break
    print a

### FIXED CODE ###

while True:
    a, op, b = raw_input().split()
    a = int(a)
    b = int(b)

    if op == '+': a += b
    elif op == '-': a -= b
    elif op == '*': a *= b 
    elif op == '/': a /= b
    elif op == '?': break
    print a
import math

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

    state = 0
    chklist = [0] * N
    chklist_flag = [False] * N
    chkmod = 0

    chklist_flag[0] = True

    for i in range(1, K + 1):
        if chklist_flag[state - 1]:
            chkmod = (K - chklist[state - 1]) % (i - chklist[state - 1]) 
            break
        chklist[state - 1] = i 
        chklist_flag[state - 1] = True
        state = A[state]
        print(chklist_flag)

    for i in range(chklist[state - 1] + chkmod):
        chklist[state - 1] = i 
        state = A[state- 1]

    print(state)

if __name__ == "__main__":
    solve()

### FIXED CODE ###

import math

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

    state = 1
    chklist = [0] * (N + 1)
    chklist_flag = [False] * (N + 1)
 
    chkmod = 0
    chkrem = K

    chklist_flag[0] = True

    for i in range(1, K + 1):
        state = A[state - 1]
        if chklist_flag[state - 1]:
            chkmod = (K - chklist[state - 1]) % (i - chklist[state - 1]) 
            chkrem = chklist[state - 1]
            break
        chklist[state - 1] = i 
        chklist_flag[state - 1] = True
    
    state = 1

    for i in range(chkrem + chkmod):
        state = A[state - 1]
    
    print(state)

if __name__ == "__main__":
    solve()
n=int(input())
w=list()
for i in range(n):
    w.append(input())
ws=set(w)
if len(ws)!=n:
    print("No")
    exit()
for i in range(n):
    x=i+1
    if w[i][-1]!=w[x][0]:
        print("No")
        exit()
print("Yes")

### FIXED CODE ###

n=int(input())
w=list()
for i in range(n):
    w.append(input())
ws=set(w)
if len(ws)!=n:
    print("No")
    exit()
x=0
for i in range(n-1):
    x=i+1
    if w[i][-1]!=w[x][0]:
        print("No")
        exit()
print("Yes")
n=int(input())
c=list(map(int,input().split()))
v=list(map(int,input().split()))
s=0
for i in range(n):
    if c[i]-v[i]>0:
        s=s+c[i]-v[i]
print(s)

### FIXED CODE ###

a,b,t=map(int,input().split())
n=t//a
print(b*n)
O = input()
E = input()

K = len(O)
String = ""

for i in range(K):
    
    String += O[i]
    String += E[i]

print(String)

### FIXED CODE ###

O = input()
E = input()

K = len(E)

String = ""

for i in range(K):
    
    String += O[i]
    String += E[i]

if len(O)>len(E):
    String += O[-1]

print(String)
N, M = map(int, input().split())
if (N,M==1,1):
    print(0)
if (N==1):
    print(M-2)
if (M==1):
    print(N-2)
else:
    print((N-2)(M-2))

### FIXED CODE ###

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

if(N == 1 or M == 1):
    if(M == 1 and N == 1):
        print(1)
    else:
        print(max(M-2, N-2))
else:
    print((N-2)*(M-2))
N,*A  =map(int,open(0).read().split())

L = [0 for i in range(N+3)]

for a in A:
  L[a]+=1

ans = 0
for i in range(N+3):
  S = sum(L[i:i+3])
  if ans < S:
    ans = S
  
print(ans)

### FIXED CODE ###

N,*A  =map(int,open(0).read().split())

L = [0 for i in range(int(1e5)+1)]

for a in A:
  L[a]+=1

ans = 0
for i in range(int(1e5)+1):
  S = sum(L[i:i+3])
  if ans < S:
    ans = S
  
print(ans)
data = {
    'S':[0 for _ in range(13)],
    'H':[0 for _ in range(13)],
    'C':[0 for _ in range(13)],
    'D':[0 for _ in range(13)],
}
  
n = int(input())
for _ in range(n):
    (s, r) = input().split()
    index = cards[s].index(int(r))
    cards[s][int(r) - 1] = 1
   
for s in ['S', 'H', 'C', 'D']:
    for r in range(13):
        if data[s][r] == 0:
            print(s, r + 1)

### FIXED CODE ###

cards = {
        'S': [0 for _ in range(13)],
        'H': [0 for _ in range(13)],
        'C': [0 for _ in range(13)],
        'D': [0 for _ in range(13)],
        }
  
n = int(input())
for _ in range(n):
    (s, r) = input().split()
    r = int(r)
    cards[s][r - 1] = r
  
for s in ('S', 'H', 'C', 'D'):
    for r in range(13):
        if cards[s][r] == 0:
            print( '{0:s} {1:d}'.format(s, r+1))
x = int
a = int


 
if x < a:
  print(0)
else:
  print(10)

### FIXED CODE ###

i = list(map(int, input().split()))
if i[0] < i[1]:
  print("0")
else:
  print("10")
A,B,C,D = map(int, input().split())

import math

g = math.gcd(C, D)
E = C*D//g
num = (B//C-(A-1)//C) + (B//D-(A-1)//D) - (B//E-(A-1)//E)
print(B-A+1-num)

### FIXED CODE ###

A,B,C,D = map(int, input().split())

import fractions

g = fractions.gcd(C, D)
E = C*D//g
num = (B//C-(A-1)//C) + (B//D-(A-1)//D) - (B//E-(A-1)//E)
print(B-A+1-num)