Problem:

Finding Missing Cards

  Taro is going to play a card game. However, now he has only n cards, even though there should be 52 cards (he has no Jokers).

The 52 cards include 13 ranks of each of the four suits: spade, heart, club and diamond.

Input

  In the first line, the number of cards n (n ≤ 52) is given.

  In the following n lines, data of the n cards are given. Each card is given by a pair of a character and an integer which represent its suit and rank respectively. A suit is represented by 'S', 'H', 'C' and 'D' for spades, hearts, clubs and diamonds respectively. A rank is represented by an integer from 1 to 13.

Output

  Print the missing cards. The same as the input format, each card should be printed with a character and an integer separated by a space character in a line.
 Arrange the missing cards in the following priorities:

Print cards of spades, hearts, clubs and diamonds in this order.

If the suits are equal, print cards with lower ranks first.

Sample Input

47
S 10
S 11
S 12
S 13
H 1
H 2
S 6
S 7
S 8
S 9
H 6
H 8
H 9
H 10
H 11
H 4
H 5
S 2
S 3
S 4
S 5
H 12
H 13
C 1
C 2
D 1
D 2
D 3
D 4
D 5
D 6
D 7
C 3
C 4
C 5
C 6
C 7
C 8
C 9
C 10
C 11
C 13
D 9
D 10
D 11
D 12
D 13

Sample Output

S 1
H 3
H 7
C 12
D 8

Note

      解説      

	



Sample input:
47
S 10
S 11
S 12
S 13
H 1
H 2
S 6
S 7
S 8
S 9
H 6
H 8
H 9
H 10
H 11
H 4
H 5
S 2
S 3
S 4
S 5
H 12
H 13
C 1
C 2
D 1
D 2
D 3
D 4
D 5
D 6
D 7
C 3
C 4
C 5
C 6
C 7
C 8
C 9
C 10
C 11
C 13
D 9
D 10
D 11
D 12
D 13


Sample output:
S 1
H 3
H 7
C 12
D 8

Submission status: Accepted

Solution code:
from enum import Enum
class  Suit(Enum):
    S = 0
    H = 1
    C = 2
    D = 3

n = int(input())
Cards = [[1 for x in range(4)] for y in range(13)] 

for i in range(0,n):
    (s, r) = input().split()
    s = str(s)
    r = int(r)
    if s == "S":
        Cards[r-1][0] = 0
    elif s == "H":
        Cards[r-1][1] = 0
    elif s == "C":
        Cards[r-1][2] = 0
    elif s == "D":
        Cards[r-1][3] = 0

for m in range(0,4):
    for n in range(0,13):
        if Cards[n][m]==1:
            print(Suit(m).name, n+1)

Submission status: Accepted

Solution code:
n = input()
n = int(n)

suits_list = ['S', 'H', 'C', 'D']
cards = [[], [], [], []]

for i in range(n):
    a = input()
    suits, num = a.split(' ')
    
    for j in range(4):
        if suits == suits_list[j]:
            cards[j].append(num)

for i in range(len(suits_list)):
    for j in range(13):
        if not str(j + 1) in cards[i]:
            print('%s %d'%(suits_list[i], (j + 1)))

Submission status: Accepted

Solution code:
S=[0]*53
n=int(input())
for i in range(0,n):
    rank,num = input().split()
    num=int(num)
    if(rank=="S"):
        S[num]=1
    elif(rank=="H"):
        S[num+13]=1
    elif(rank=="C"):
        S[num+26]=1
    elif(rank=="D"):
        S[num+39]=1
for i in range(1,53):
    if(S[i]==0):
        if(1 <= i <= 13):
            print(f"S {i}")
        if(14 <= i <= 26):
            print(f"H {i-13}")
        if(27 <= i <= 39):
            print(f"C {i-26}")
        if(40 <= i <= 52):
            print(f"D {i-39}")

Submission status: Accepted

Solution code:
L = []
for m in ["S", "H", "C", "D"]:
    for i in range(1, 14):
        L.append((m, i))
n = int(input())
for i in range(n):
    mark, rank = input().split()
    rank = int(rank)
    L.remove((mark, rank))
for rest in L:
    print(rest[0], rest[1])

Submission status: Accepted

Solution code:
cards = {'S':[], 'H':[], 'C':[], 'D':[]}
for _ in range(int(input())):
    m, n = input().split()
    cards[m].append(int(n))

for m in ['S','H','C','D']:
    cc = cards[m]
    for i in range(1,14):
        if i in cc:
            continue
        print(m,i)

Submission status: Accepted

Solution code:
n=int(input())
S=[0,]*14
H=[0,]*14
C=[0,]*14
D=[0,]*14
for i in range(0,n):
    suit,num=map(str,input().split())
    if suit=='S':
        S[int(num)]=1
    elif suit=='H':
        H[int(num)]=1
    elif suit=='C':
        C[int(num)]=1
    else:
        D[int(num)]=1
for i in range(1,14):
    if S[i]==0:
        print("S "+str(i))
for i in range(1,14):
    if H[i]==0:
        print("H "+str(i))
for i in range(1,14):
    if C[i]==0:
        print("C "+str(i))
for i in range(1,14):
    if D[i]==0:
        print("D "+str(i))

Submission status: Accepted

Solution code:
card=[]
card_m=[]
for i in ('S','H','C','D'):
	for j in range(1,14):
		a=i+' '+str(j)
		card.append(a)
b=int(input())
for i in range(b):
	c=input()
	card.remove(c)
for j in range(len(card)):
	print(card[j])

Submission status: Accepted

Solution code:
n = int(input())
cards = [input().split() for i in range(n)]
for mark in ["S", "H", "C", "D"]:
    cards_mark = [cards[i][1] for i in range(n) if mark in cards[i]]
    loss = [i for i in range(1,14) if str(i) not in cards_mark]
    for j in range(len(loss)):
        print("{} {}".format(mark, loss[j]))

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

# ITP1_6_B

def make(list1,trump_mark):
    list1=list()
    for i in range(1, 14):
        list1.append(trump_mark+" "+str(i))
    return list1


all=list()
all+=make(all,"S")
all+=make(all,"H")
all+=make(all,"C")
all+=make(all,"D")

N=int(input())

for _ in range(N):
    x=input()
    all.remove(x)

for s in all:
    print(s)

Submission status: Accepted

Solution code:
base = [str(i)+str(j) for i in ['S ','H ', 'C ', 'D '] for j in range(1,14)]

N = int(input())

lst = [input().rstrip() for k in range(N)]

for l in base:
    if str(l) not in lst:
        print(l)

Submission status: Accepted

Solution code:
mark = ['S', 'H', 'C', 'D']
ary = []

for mk in range(0, 4):
    for i in range(1, 14):
        ary.append("{} {}".format(mark[mk], i))

n = int(input())
x = 0

while True:
    card = str(input())
    ary.remove(card)

    x += 1

    if x == n:
        break
    
if len(ary) > 0:
    print("\n".join(ary))

Submission status: Accepted

Solution code:
_set = {
    "S" : [],
    "H" : [],
    "C" : [],
    "D" : []
}
for i in range(0 ,13):
    for item in _set:
        _set[item].append(0)

n = int(input())
for i in range(0, n):
    T, N = input().split()
    _set[T][int(N) - 1] = 1

for key in _set:
    for i in range(0, 13):
        if (_set[key][i] == 0):
            print(key + ' ' + str(i + 1))

Submission status: Accepted

Solution code:
list=[ [0]*13 for i in range(4) ]
n=int(input())
for i in range(n):
	s=input().split()
	if s[0]=="S":
		list[0][int(s[1])-1]=1
	elif s[0]=="H":
		list[1][int(s[1])-1]=1
	elif s[0]=="C":
		list[2][int(s[1])-1]=1
	elif s[0]=="D":
		list[3][int(s[1])-1]=1
		
for i in range(4):
	for j in range(13):
		if i==0 and list[i][j]==0:
			print("S "+str(j+1))
		elif i==1 and list[i][j]==0:
			print("H "+str(j+1))
		elif i==2 and list[i][j]==0:
			print("C "+str(j+1))
		elif i==3 and list[i][j]==0:
			print("D "+str(j+1))

Submission status: Accepted

Solution code:
cards = []
symbol = ['S', 'H', 'C', 'D']
for sym in symbol:
    for i in range(1, 14):
        cards.append(sym + ' ' + str(i))

n = int(input())
for i in range(n):
    cards.remove(input())

for card in cards:
    print(card)

Submission status: Accepted

Solution code:
n = int(input())
i = 1

listS = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
listH = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
listC = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
listD = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]


while i < n+1:
    a, b = input().split()
    b = int(b)
    if a == 'S':
        listS.append(b)
    elif a == 'H':
        listH.append(b)
    elif a == 'C':
        listC.append(b)
    else:
        listD.append(b)
    i += 1

listSdup = [x for x in set(listS) if listS.count(x) == 1]
listHdup = [x for x in set(listH) if listH.count(x) == 1]
listCdup = [x for x in set(listC) if listC.count(x) == 1]
listDdup = [x for x in set(listD) if listD.count(x) == 1]

for i in range(len(listSdup)):
    print('S ' +  str(listSdup[i]))
for i in range(len(listHdup)):
    print('H ' +  str(listHdup[i]))
for i in range(len(listCdup)):
    print('C ' +  str(listCdup[i]))
for i in range(len(listDdup)):
    print('D ' +  str(listDdup[i]))

Submission status: Accepted

Solution code:
def output(picture, ranks):
    for i in range(1, 14):
        if i not in ranks:
            print(picture, i)

n = int(input())

s = []
h = []
c = []
d = []

for i in range(n):
    inputs = input().split(' ')
    picture = inputs[0]
    rank = int(inputs[1])
    if 'S' == picture:
        s.append(rank)
    elif 'H' == picture:
        h.append(rank)
    elif 'C' == picture:
        c.append(rank)
    else:
        d.append(rank)

output('S', s)
output('H', h)
output('C', c)
output('D', d)

Submission status: Accepted

Solution code:
n = int(input())
s = []
h = []
c = []
d = []
for i in range(n):
    a, b = input().split()
    if a == "S":
        s.append(int(b))
    if a == "H":
        h.append(int(b))
    if a == "C":
        c.append(int(b))
    if a == "D":
        d.append(int(b))
a = list(range(1,13+1))

sa = list(set(a) - set(s))
sa.sort()
for i in sa:
    print("S " + str(i))

ha = list(set(a) - set(h))
ha.sort()
for i in ha:
    print("H " + str(i))

ca = list(set(a) - set(c))
ca.sort()
for i in ca:
    print("C " + str(i))

da = list(set(a) - set(d))
da.sort()
for i in da:
    print("D " + str(i))

Submission status: Accepted

Solution code:
flag = [True]*52
suit = ["S", "H", "C", "D"]

n = int(input())
for i in range(n):
    s, k = input().split()
    k = int(k)
    for j in range(4):
        if s == suit[j]:
            flag[j*13 + k - 1] = False

for i in range(52):
    if flag[i]:
        print(suit[i//13], str(i%13 + 1))

Submission status: Accepted

Solution code:
N = int(input())
A= []
for i in range(N):
    a,b = map(str, input().split())
    k =[a,b]
    A.append(k)



S = []
H = []
C = []
D = []

for i in range(N):
    if A[i][0] == "S":
        S.append(int(A[i][1]))
    elif A[i][0] == "H":
        H.append(int(A[i][1]))
    elif A[i][0] == "C":
        C.append(int(A[i][1]))
    elif A[i][0] == "D":
        D.append(int(A[i][1]))


for i in range(1,14):
    if i not in S:
        print("S",i)
for i in range(1,14):
    if i not in H:
        print("H",i)
for i in range(1,14):
    if i not in C:
        print("C",i)
for i in range(1,14):
    if i not in D:
        print("D",i)

Submission status: Accepted

Solution code:
n = int(input())
patterns = ["S", "H", "C", "D"]
cards = dict([(i, [str(j) for j in range(1, 14)]) for i in patterns])

for i in range(n):
    p, n = input().strip().split()
    cards[p].remove(n)
for i in patterns:
    if cards[i]:
        for j in cards[i]:
            print(i, j, sep=" ")

Submission status: Accepted

Solution code:
s = list(range(1, 14))
h = list(range(1, 14))
c = list(range(1, 14))
d = list(range(1, 14))

n = int(input())

for i in range(n):
    cards = input().split()

    if cards[0] == 'S':
        s.remove(int(cards[1]))
    elif cards[0] == 'H':
        h.remove(int(cards[1]))
    elif cards[0] == 'C':
        c.remove(int(cards[1]))
    elif cards[0] == 'D':
        d.remove(int(cards[1]))

for j in s:
    print('S ' + str(j))

for j in h:
    print('H ' + str(j))

for j in c:
    print('C ' + str(j))

for j in d:
    print('D ' + str(j))

Submission status: Accepted

Solution code:
import sys
input_lines = sys.stdin.readlines()[1:]
index_list = ['S', 'H', 'C', 'D']
numset = [[str(i+1) for i in range(13)] for i in range(4)]
for card in input_lines:
    [char, rank] = card.split()
    index = index_list.index(char)
    numset[index].remove(rank)

for i in range(4):
    char = index_list[i]
    for num in numset[i]:
        print(' '.join([char, num]))

Submission status: Accepted

Solution code:
c=[i+" "+str(j)for i in"SHCD"for j in range(1,14)]
for i in range(input()):c.remove(raw_input())
for p in c:print p

Submission status: Accepted

Solution code:
n = int(input())
suits = ["S", "H", "C", "D"]
cards = []
for i in suits:
    for j in range(1, 14):
        cards.append([i, str(j)])
for i in range(n):
    s, r = input().split()
    cards.remove([s, r])
for i in cards:
    print(i[0] + " " + i[1])

Submission status: Accepted

Solution code:

list = [(o,n) for o in ['S','H','C','D'] for n in range(1,14)]
n = int(input())
for i in range(n) :
    op,num = input().split()
    list.remove((op,int(num)))

for (o,n) in list :
    print(o,n)

Submission status: Accepted

Solution code:
n = int(input())
l = []
for m in ("SHCD"):
  for i in range(1, 14):
    l.append(m+" "+str(i))
for i in range(n):
  s = input()
  l.remove(s)
for ele in l:
  print(ele)

Submission status: Accepted

Solution code:
a = int(input())
count = 0
input_list = []
patterns = ['S', 'H', 'C', 'D']
total_list = []

for i in patterns:
    for n in range(1,14):
        total_list.append('{} {}'.format(i, n))

while count < a:
    b = input()
    count += 1
    input_list.append(b)

remain_list = []

for b in input_list:
    if b in total_list:
        total_list.remove(b)

for a in total_list:
    print(a)

Submission status: Accepted

Solution code:
n=int(input())
cs = [ (s,k) for s in ['S','H','C','D'] for k in range(1,14) ]
for _ in range(n):
    s,k=input().split()
    cs.remove((s,int(k)))
for (s, k) in cs:
    print(s, k)

Submission status: Accepted

Solution code:
cards = [s + str(i+1) for i in range(13) for s in ['S ','H ','C ','D ']]
n = int(input())
for i in range(n): cards.remove(input())
for i in cards[:]:
	if i.startswith('S'): 
		print(i)
		cards.remove(i)
for i in cards[:]:
	if i.startswith('H'): 
		print(i)
		cards.remove(i)
for i in cards[:]:
	if i.startswith('C'): 
		print(i)
		cards.remove(i)
for i in cards[:]:
	if i.startswith('D'): 
		print(i)
		cards.remove(i)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

def main():

	suits = ('S','H','C','D')
	cards = [[0 for i in xrange(13)] for i in xrange(4)]
	n = input()
	for i in xrange(n):
		suit,rank = raw_input().split()
		suit = suits.index(suit)
		rank = int(rank)
		cards[suit][rank-1] = 1

	for suit,ranks in enumerate(cards):
		for rank,flag in enumerate(ranks):
			if flag == 0:
				print(suits[suit]),
				print(rank+1)

if __name__ == "__main__":

	main()

Submission status: Accepted

Solution code:
num = int(input())
trump = []
data = []
for x in range(0,num):
    trump = input().split()
    if trump[0][0] == 'S':
        data.append(int(trump[1]))
    elif trump[0][0] == 'H':
        data.append(int(trump[1])+13)
    elif trump[0][0] == 'C':
        data.append(int(trump[1])+26)
    else :
        data.append(int(trump[1])+39)
for x in range(1,53):
    if x in data:
        pass
    else:
        if x < 14:
            print('S',x)
        elif x < 27:
            print('H',x-13)
        elif x < 40:
            print('C',x-26)
        else :
            print('D',x-39)

Submission status: Runtime Error

Solution code:
n=int(input())
card=[]
for suit in ["S","H","C","D"]:
    for rank in list(map(str,range(1,14))):
        card.append(suit+" "+rank+" ")
for i in range(n):
    card.remove(input())
for c in card:
    print(c)

Submission status: Runtime Error

Solution code:
a = int(input())
b = []
S = []
H = []
C = []
D = []
check = [1,2,3,4,5,6,7,8,9,10,11,12,13]
for i in range(a):
    b.append(input().split())
for i in range(len(b)):
    if b[i][0] == "S":
        S.append(int(b[i][1]))
    elif b[i][0] == "H":
        H.append(int(b[i][1]))
    elif b[i][0] == "C":
        C.append(int(b[i][1]))
    else:
        D.append(int(b[i][1]))

set_S = list(set(check)-set(S)).sort()
set_H = list(set(check)-set(H)).sort()
set_C = list(set(check)-set(C)).sort()
set_D = list(set(check)-set(D)).sort()

for i in set_S:
    print("S",i)
for i in set_H:
    print("H",i)
for i in set_C:
    print("C",i)
for i in set_D:
    print("D",i)

Submission status: Runtime Error

Solution code:
import sys
slist = [i for i in range(1, 14)]
hlist = [i for i in range(1, 14)]
clist = [i for i in range(1, 14)]
dlist = [i for i in range(1, 14)]
for line in sys.stdin:
    suit, rank = line.split()
    rankn = int(rank)
    if suit = 'S':
        if rankn in slist:
            slist.pop(rankn - 1)
    elif suit = 'H':
        if rankn in hlist:
            hlist.pop(rankn - 1)
    elif suit = 'C':
        if rankn in clist:
            clist.pop(rankn - 1)
    else:
        if rankn in dlist:
            dlist.pop(rankn - 1)

Submission status: Runtime Error

Solution code:
N=int(input())
s=[input() for i in range(N)]
lost_list=[]
taro_card=[]
card_list=[]
for i in s:
    taro_card.append(s.split())
for i in range(1,14):
    card_list.append(["S",str(i)])
    card_list.append(["H",str(i)])
    card_list.append(["C",str(i)])
    card_list.append(["D",str(i)])
for i in taro_card:
    if i not in card_list:
        lost_list.append(i)
for i in lost_list:
    print("{} {}".format(i[0],i[1]))

Submission status: Runtime Error

Solution code:
suit = {"S": 0, "H": 1, "C": 2, "D": 3}
suit_keys = list(suit.keys())
deck = [[suit_keys[i] + " " + str(j + 1) for j in range(13)] for i in range(4)]

for _ in range(int(input())):
    card = input().split()
    deck[suit[card[0]]][int(card[1])] = ""

for i in range(4):
    for j in deck[i]:
        if j != "":
            print(j)

Submission status: Runtime Error

Solution code:
suit = {"S": 0, "H": 1, "C": 2, "D": 3}
suit_keys = list(suit.keys())
deck = [[suit_keys[i] + " " + str(j + 1) for j in range(13)] for i in range(4)]
for _ in range(int(input())):
    card = input().split()
    deck[suit[card[0]]][int(card[1])] = ""
for i in range(4):
    for j in deck[i]:
        if j != "":
            print(j)

Submission status: Runtime Error

Solution code:
suit = {"S": 0, "H": 1, "C": 2, "D": 3}
suit_keys = list(suit.keys())
deck = [[suit_keys[i] + " " + str(j + 1) for j in range(13)] for i in range(4)]
for _ in range(int(input())):
    card = input().split()
    deck[int(card[1])][suit[card[0]]] = ""
for i in range(4):
    for j in deck[i]:
        if j != "":
            print(j)

Submission status: Runtime Error

Solution code:
suit = {"S": 0, "H": 1, "C": 2, "D": 3}
suit_keys = list(suit.keys())
deck = [[suit_keys[i] + " " + str(j + 1) for j in range(13)] for i in range(4)]
for _ in range(int(input())):
    card = input().split()
    del deck[suit[card[0]]][int(card[1]) - 1]
for i in range(4):
    for j in deck[i]:
        print(j)

Submission status: Runtime Error

Solution code:
sCard = [0] * 13
hCard = [0] * 13 
cCard = [0] * 13
dCard = [0] * 13

callNum = int(input())

for cardLoop in range(callNum-1):
    symbol, cardNum = input().split()
    cardNum = int(cardNum)
    if symbol == "S":
        sCard[cardNum-1] = cardNum
    elif symbol == "H":
        hCard[cardNum-1] = cardNum
    elif symbol == "C":
        cCard[cardNum-1] = cardNum
    elif symbol == "D":
        dCard[cardNum-1] = cardNum

sLack = 0
hCard = 0
cCard = 0
dCard = 0

for cardLoop in range(13):
    if sCard[cardLoop] == 0:
        sLack = sLack + 1
    elif hCard[cardLoop] == 0:
        hLack = hLack +1
    elif cCard[cardLoop] == 0:
        cLack = cLack +1    
    elif dCard[cardLoop] == 0:
        dLack = dLack +1

print("S " + str(sLack))
print("H " + str(hLack))
print("C " + str(cLack))
print("D " + str(dLack))

Submission status: Runtime Error

Solution code:
n=input()
lst=[(a,b) for a in ['S','H','C','D'] for b in range(1,14)]
for i in range(n):
    a,b =input().split()
    lst.remove((a,int(b)))
for (a,b) in lst:
    print(a,b)

Submission status: Runtime Error

Solution code:
n=int(input())
lst=[(a,b) for a in ['S','H','C','D'] for b in range(1,14)]
for i in range(n):
    a,b = input().split()
    b = int(b)
    lst.remove(a,b)
for (a,b) in lst:
    print(a,b)

Submission status: Runtime Error

Solution code:
n = int(input())
for i in range(n):
    k = input().split()
    if k[0] == 'S':
        for i in range(1,14):
            if int(k[1])==i:
                continue
            else:
                s = list()
                s.append(i)
                s.sort()
                sl = s.len()
    if k[0] == 'H':
        for i in range(1,14):
            if int(k[1])==i:
                continue
            else:
                h = list()
                h.append(i)
                h.sort()
                hl = h.len()
    if k[0] == 'C':
        for i in range(1,14):
            if int(k[1])==i:
                continue
            else:
                c = list()
                c.append(i)
                c.sort()
                cl = c.len()
    if k[0] == 'D':
        for i in range(1,14):
            if int(k[1])==i:
                continue
            else:
                d = list()
                d.append(i)
                d.sort()
                dl = d.len()
                
for i in range(1,sl):
    print('S {0}'.format(s[i]))
    
for i in range(1,hl):
    print('H {0}'.format(h[i]))
 
for i in range(1,dl):
    print('D {0}'.format(d[i])) 

for i in range(1,cl):
    print('C {0}'.format(c[i]))

Submission status: Runtime Error

Solution code:
n = int(input())
for i in range(n):
    k = input().split()
    if k[0] == 'S':
        for i in range(1,14):
            if int(k[1])==i:
                continue
            else:
                s = list()
                s.append(i)
                s.sort()
                sl = len(s)
    if k[0] == 'H':
        for i in range(1,14):
            if int(k[1])==i:
                continue
            else:
                h = list()
                h.append(i)
                h.sort()
                hl = len(h)
    if k[0] == 'C':
        for i in range(1,14):
            if int(k[1])==i:
                continue
            else:
                c = list()
                c.append(i)
                c.sort()
                cl = len(c)
    if k[0] == 'D':
        for i in range(1,14):
            if int(k[1])==i:
                continue
            else:
                d = list()
                d.append(i)
                d.sort()
                dl = len(d)
                
for i in range(1,sl+1):
    print('S {0}'.format(s[i]))
    
for i in range(1,hl+1):
    print('H {0}'.format(h[i]))
 
for i in range(1,dl+1):
    print('D {0}'.format(d[i])) 

for i in range(1,cl+1):
    print('C {0}'.format(c[i]))

Submission status: Runtime Error

Solution code:
n = int(input())
for i in range(n):
    k = input().split()
    if k[0] == 'S':
        for i in range(1,14):
            if int(k[1])==i:
                continue
            else:
                s = list()
                s.append(i)
                s.sort()
                sl = len(s)
    if k[0] == 'H':
        for i in range(1,14):
            if int(k[1])==i:
                continue
            else:
                h = list()
                h.append(i)
                h.sort()
                hl = len(h)
    if k[0] == 'C':
        for i in range(1,14):
            if int(k[1])==i:
                continue
            else:
                c = list()
                c.append(i)
                c.sort()
                cl = len(c)
    if k[0] == 'D':
        for i in range(1,14):
            if int(k[1])==i:
                continue
            else:
                d = list()
                d.append(i)
                d.sort()
                dl = len(d)
                
for i in range(1,sl):
    print('S {0}'.format(s[i]))
    
for i in range(1,hl+1):
    print('H {0}'.format(h[i]))
 
for i in range(1,dl+1):
    print('D {0}'.format(d[i])) 

for i in range(1,cl+1):
    print('C {0}'.format(c[i]))

Submission status: Runtime Error

Solution code:
table = [[ 0 for i in range(13)] for j in range(4)]

n = int(input())

i = 0 
while i < n:
    s,num = input().split()
    num = int(num)
    
    if   s == "S":
        table[0][n-1] = 1 
    elif s == "H":
        table[1][n-1] = 1 
    elif s == "C":
        table[2][n-1] = 1 
    else:    # D 
        table[3][n-1] = 1 

    i += 1

for i,elem_i in enumerate(table):
    for j,elem_j in enumerate(elem_i):
        if elem_j ==1:
            continue

        if i == 0:
            s_str='S'
        elif i == 1:
            s_str='H'
        elif i == 2:
            s_str='C'
        else:
            s_str='D'
        print (s_str + " " + str(j+1))

Submission status: Runtime Error

Solution code:
n=int(input())
cards = [(mark,num) for mark in ['S','H','C','D'] for num in range(1,14) ]
for _ in range(n):
    mark,num=input().split()
    cards.remove((mark,int(num)))
for (mark, num) in cards:
    print(mak, num)

Submission status: Runtime Error

Solution code:
for i in range(1,13):
    t[i] = 0

s = t
h = t
c = t
d = t

num = int(input())
for i in range(num)
    m, n = input().split()
    n = int(n)
    if m == "s":
        s[n] == 1
    if m == "h":
        h[n] == 1
    if m == "c":
        h[n] == 1
    if m == "d":
        h[n] == 1

for i in range(1,13):
    if s[i] == 0:
        print("S %d" i)

for i in range(1,13):
    if h[i] == 0:
        print("H %d" i)

for i in range(1,13):
    if c[i] == 0:
        print("C %d" i)

for i in range(1,13):
    if d[i] == 0:
        print("S %d" i)

Submission status: Runtime Error

Solution code:
for i in range(1,13):
    t[i] = 0

s = t
h = t
c = t
d = t

num = int(input())
for i in range(num):
    m, n = input().split()
    n = int(n)
    if m == "s":
        s[n] == 1
    if m == "h":
        h[n] == 1
    if m == "c":
        h[n] == 1
    if m == "d":
        h[n] == 1

for i in range(1,13):
    if s[i] == 0:
        print("S %d" i)

for i in range(1,13):
    if h[i] == 0:
        print("H %d" i)

for i in range(1,13):
    if c[i] == 0:
        print("C %d" i)

for i in range(1,13):
    if d[i] == 0:
        print("S %d" i)

Submission status: Runtime Error

Solution code:
for i in range(1,13):
    t[i] = 0

s = t
h = t
c = t
d = t

num = int(input())
for i in range(num):
    m, n = input().split()
    n = int(n)
    if m == "s":
        s[n] == 1
    if m == "h":
        h[n] == 1
    if m == "c":
        h[n] == 1
    if m == "d":
        h[n] == 1

for i in range(1,13):
    if s[i] == 0:
        print("S %d" %i)

for i in range(1,13):
    if h[i] == 0:
        print("H %d" %i)

for i in range(1,13):
    if c[i] == 0:
        print("C %d" %i)

for i in range(1,13):
    if d[i] == 0:
        print("S %d" %i)

Submission status: Runtime Error

Solution code:
t[] = ""
for i in range(1,13):
    t[i] = 0

s = t
h = t
c = t
d = t

num = int(input())
for i in range(num):
    m, n = input().split()
    n = int(n)
    if m == "s":
        s[n] == 1
    if m == "h":
        h[n] == 1
    if m == "c":
        h[n] == 1
    if m == "d":
        h[n] == 1

for i in range(1,13):
    if s[i] == 0:
        print("S %d" %i)

for i in range(1,13):
    if h[i] == 0:
        print("H %d" %i)

for i in range(1,13):
    if c[i] == 0:
        print("C %d" %i)

for i in range(1,13):
    if d[i] == 0:
        print("S %d" %i)

Submission status: Runtime Error

Solution code:
t = []

for i in range(1,13):
    t[i] = 0

s = t
h = t
c = t
d = t

num = int(input())
for i in range(num):
    m, n = input().split()
    n = int(n)
    if m == "s":
        s[n] == 1
    if m == "h":
        h[n] == 1
    if m == "c":
        h[n] == 1
    if m == "d":
        h[n] == 1

for i in range(1,13):
    if s[i] == 0:
        print("S %d" %i)

for i in range(1,13):
    if h[i] == 0:
        print("H %d" %i)

for i in range(1,13):
    if c[i] == 0:
        print("C %d" %i)

for i in range(1,13):
    if d[i] == 0:
        print("S %d" %i)

Submission status: Runtime Error

Solution code:
t= list()

for i in range(1,13):
    t[i] = 0

s = t
h = t
c = t
d = t

num = int(input())
for i in range(num):
    m, n = input().split()
    n = int(n)
    if m == "s":
        s[n] == 1
    if m == "h":
        h[n] == 1
    if m == "c":
        h[n] == 1
    if m == "d":
        h[n] == 1

for i in range(1,13):
    if s[i] == 0:
        print("S %d" %i)

for i in range(1,13):
    if h[i] == 0:
        print("H %d" %i)

for i in range(1,13):
    if c[i] == 0:
        print("C %d" %i)

for i in range(1,13):
    if d[i] == 0:
        print("S %d" %i)

Submission status: Runtime Error

Solution code:
s = [0] * 13
h = [0] * 13
c = [0] * 13
d = [0] * 13

num = int(input())
for i in range(num):
    m, n = input().split()
    n = int(n)
    if m == "S":
        s[n] = 1
    if m == "H":
        h[n] = 1
    if m == "C":
        c[n] = 1
    if m == "D":
        d[n] = 1

for i in range(1,13):
    if s[i] == 0:
        print("S %d" % i)

for i in range(1,13):
    if h[i] == 0:
        print("H %d" % i)

for i in range(1,13):
    if c[i] == 0:
        print("C %d" % i)

for i in range(1,13):
    if d[i] == 0:
        print("D %d" % i)

Submission status: Runtime Error

Solution code:
s = [0] * 13
h = [0] * 13
c = [0] * 13
d = [0] * 13

num = int(input())
for i in range(num):
    m, n = input().split()
    x = int(n)
    if m == "S":
        s[x] = 1
    if m == "H":
        h[x] = 1
    if m == "C":
        c[x] = 1
    if m == "D":
        d[x] = 1

for i in range(1,13):
    if s[i] == 0:
        print("S %d" % i)

for i in range(1,13):
    if h[i] == 0:
        print("H %d" % i)

for i in range(1,13):
    if c[i] == 0:
        print("C %d" % i)

for i in range(1,13):
    if d[i] == 0:
        print("D %d" % i)

Submission status: Runtime Error

Solution code:
s = [0] * 13
h = [0] * 13
c = [0] * 13
d = [0] * 13

num = int(input())
for i in range(num):
    m, n = input().split()
    x = int(n)
    if m == "S":
        s[x] = 1
    elif m == "H":
        h[x] = 1
    elif m == "C":
        c[x] = 1
    elif m == "D":
        d[x] = 1
    else:

for i in range(1,13):
    if s[i] == 0:
        print("S %d" % i)

for i in range(1,13):
    if h[i] == 0:
        print("H %d" % i)

for i in range(1,13):
    if c[i] == 0:
        print("C %d" % i)

for i in range(1,13):
    if d[i] == 0:
        print("D %d" % i)

Submission status: Runtime Error

Solution code:
s = [0] * 13
h = [0] * 13
c = [0] * 13
d = [0] * 13

num = int(input())
for i in range(num):
    m, n = input().split()
    x = int(n)
    if m == "S":
        s[x] = 1
    elif m == "H":
        h[x] = 1
    elif m == "C":
        c[x] = 1
    elif m == "D":
        d[x] = 1
    else:
        break

for i in range(1,13):
    if s[i] == 0:
        print("S %d" % i)

for i in range(1,13):
    if h[i] == 0:
        print("H %d" % i)

for i in range(1,13):
    if c[i] == 0:
        print("C %d" % i)

for i in range(1,13):
    if d[i] == 0:
        print("D %d" % i)

Submission status: Runtime Error

Solution code:
s = [0] * 13
h = [0] * 13
c = [0] * 13
d = [0] * 13

num = int(input())
for i in range(num):
    m, n = input().split()
    x = int(n) - 1
    if m == "S":
        s[x] = 1
    elif m == "H":
        h[x] = 1
    elif m == "C":
        c[x] = 1
    elif m == "D":
        d[x] = 1
    else:
        break

for i in range(13):
    if s[i] == 0:
        print("S %d" % i+1)

for i in range(13):
    if h[i] == 0:
        print("H %d" % i+1)

for i in range(13):
    if c[i] == 0:
        print("C %d" % i+1)

for i in range(13):
    if d[i] == 0:
        print("D %d" % i+1)

Submission status: Runtime Error

Solution code:
import itertools

n = int(input())
a = [input() for _ in range(n)]

suits = ['S', 'H', 'C', 'D']
cards = ["%s %d" % (s, r) for s, r in suits, range(1, 14)]
answers = [c for c in cards if c not in a]
for card in answers:
    print(card)

Submission status: Runtime Error

Solution code:
a = {}
for s in ["S", "H", "C", "D"]:
    a.update({f'{s} {i}': 0 for i in range(1, 14)})
n = int(input())
for _ in range(n):
    s = input()
    print(s)
    del a[s]
        
a = list(a)
for i in len(a):
    print(a[i])