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:
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]) - 1] = ""
for i in range(4):
    for j in deck[i]:
        if j != "":
            print(j)

Submission status: Accepted

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]) - 1] = ""
for i in range(4):
    for j in range(13):
        if deck[i][j] != "":
            print(deck[i][j])

Submission status: Accepted

Solution code:
from sys import stdin

order = { "S" : 0, "H" : 1, "C" : 2, "D" : 3 }
cards = [
    [False] * 13, # S
    [False] * 13, # H
    [False] * 13, # C
    [False] * 13  # D
]

stdin.readline().rstrip()
while True:
    try:
        suit, num = stdin.readline().rstrip().split()
        cards[order[suit]][int(num)-1] = True
    except:
        break

order = {v:k for k, v in order.items()}
for i in range(4):
    for j in range(13):
        if cards[i][j] != True:
            print(order[i], j+1)

Submission status: Accepted

Solution code:
n = int(input())

deck = {}
suits = ['S', 'H', 'C', 'D']
for suit in suits:
    deck[suit] = list(range(1, 14))

for _ in range(n):
    suit, rank = input().split()
    deck[suit].remove(int(rank))

for suit in suits:
    for rank in deck[suit]:
        print(suit, rank)

Submission status: Accepted

Solution code:
N = int(input())
cards = []
for i in range(N):
    line = input().split()
    a = line[0]
    num = int(line[1])
    cards.append((a, num))

# cards = []
# with open('input_itp1_6_b_1.txt', mode='r', encoding='utf8') as f:
#     N = int(next(f))
#     for _i in range(1, N + 1):
#         line = next(f).split()
#         cards.append((line[0], int(line[1])))

# print(N)
# for card in cards:
#     print(' '.join(map(str, card)))

tarinai_list = []
for a in ['S', 'H', 'C', 'D']:
    for num in range(1, 14):
        find = False
        for card in cards:
            if a == card[0] and num == card[1]:
                find = True
                break
        if not find:
            tarinai_list.append((a, num))
for l in tarinai_list:
    print(' '.join(map(str, l)))

Submission status: Accepted

Solution code:
N = int(input())
cards = []
for i in range(N):
    line = input().split()
    a = line[0]
    num = int(line[1])
    cards.append((a, num))

tarinai_list = []
for a in ['S', 'H', 'C', 'D']:
    for num in range(1, 14):
        find = False
        for card in cards:
            if a == card[0] and num == card[1]:
                find = True
                break
        if not find:
            tarinai_list.append((a, num))
for l in tarinai_list:
    print(' '.join(map(str, l)))

Submission status: Accepted

Solution code:
suits = ['S', 'H', 'C', 'D']
table = [[False] * 14 for i in range(4)]

N = int(input())
for _i in range(N):
    mark, num = input().split()
    num = int(num)

    if mark == 'S':
        table[0][num] = True
    if mark == 'H':
        table[1][num] = True
    if mark == 'C':
        table[2][num] = True
    if mark == 'D':
        table[3][num] = True

for i in range(4):
    for j in range(1, 14):
        if not table[i][j]:
            print(f'{suits[i]} {j}')

Submission status: Accepted

Solution code:
n = int(input())

list_s = [1,2,3,4,5,6,7,8,9,10,11,12,13]
list_h = [1,2,3,4,5,6,7,8,9,10,11,12,13]
list_c = [1,2,3,4,5,6,7,8,9,10,11,12,13]
list_d = [1,2,3,4,5,6,7,8,9,10,11,12,13]

for i in range(n):
    zugara, num = input().split()
    #print(zugara)
    #print(num)
    #print(list_s)
    if zugara == 'S':
        list_s.remove(int(num))
    elif zugara == 'H':
        list_h.remove(int(num))
    elif zugara == 'C':
        list_c.remove(int(num))
    else:
        list_d.remove(int(num))

for i in list_s:
    print('S', i)
for i in list_h:
    print('H', i)
for i in list_c:
    print('C', i)
for i in list_d:
    print('D', i)

Submission status: Accepted

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

callNum = int(input())

for cardLoop in range(callNum):
    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
hLack = 0
cLack = 0
dLack = 0

for cardLoop in range(13):
    if sCard[cardLoop] == 0:
        print("S " + str(cardLoop+1))
for cardLoop in range(13):
    if hCard[cardLoop] == 0:
        print("H " + str(cardLoop+1))
for cardLoop in range(13):
    if cCard[cardLoop] == 0:
        print("C " + str(cardLoop+1))
for cardLoop in range(13):
    if dCard[cardLoop] == 0:
        print("D " + str(cardLoop+1))

Submission status: Accepted

Solution code:
c = []
for i in ["S","H","C","D"]:
    for j in range(1,14):
        c.append("{} {}".format(i,j))
n = int(input())
a = [] 
for i in range(n):
    a.append(input())
d = [i for i in c if i not in a]
if len(d) != 0:
    print(*d,sep="\n")

Submission status: Accepted

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

Submission status: Accepted

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()
    lst.remove((a,int(b)))
for (a,b) in lst:
    print(a,b)

Submission status: Accepted

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: Accepted

Solution code:
N = int(input())

cards = [[0 for i in range(13)] for j in range(4)]

for num in range(N):
    i = list(map(str, input().split()))
    if i[0] == 'S':
        cards[0][int(i[1])-1] = 1
    elif i[0] == 'H':
        cards[1][int(i[1])-1] = 1
    elif i[0] == 'C':
        cards[2][int(i[1])-1] = 1
    elif i[0] == 'D':
        cards[3][int(i[1])-1] = 1

for j in range(4):
    for k in range(13):
        if cards[j][k] == 0:
            if j == 0:
                print('S', k+1)
            elif j == 1:
                print('H', k+1)
            elif j == 2:
                print('C', k+1)
            elif j == 3:
                print('D', k+1)

Submission status: Accepted

Solution code:
Suit = ["S","H","C","D"]
deck = []


for i in range(4):
    for n in range(1,14):
        tmp = (Suit[i]+" "+str(n))
        deck.append(tmp)

#print (deck)

u = int(input())

for _ in range(u):
    s = str(input())
    if s in deck:
        deck.remove(s)

for y in range(len(deck)):
    print('{}'.format(deck[y]))

Submission status: Accepted

Solution code:
n_cards = int(input())
taro_cards = []
for i in range(n_cards):
    taro_card = input()
    taro_cards.append(taro_card)
full_cards = []
for mark in ['S', 'H', 'C', 'D']:
    for card_number in range(13):
        full_cards.append(mark + " " + str(card_number+1))

missing_cards = []
for card in full_cards:
    if card not in taro_cards:
        missing_cards.append(card)

for missing_card in missing_cards:
    print(missing_card)

Submission status: Accepted

Solution code:
count = int(input())
cards = []
for i in range(count):
    cards.append(input())
capitals = "SHCD"
for j in capitals:
    for k in range(1,14):
        if ((j + " " + str(k)) in cards) == False:
            print(j + " " + str(k))

Submission status: Accepted

Solution code:
cards={}
for m in 'SHCD':
    for n in range(13):
        if m not in cards:
            cards[m] = {}
        cards[m][n+1] = False

c = input()
for i in range(int(c)):
    m, n = input().split()
    cards[m][int(n)] = True

for m in 'SHCD':
    for n in range(13):
        if not cards[m][n+1]:
            print(m, n+1)

Submission status: Accepted

Solution code:
#トランプカード出力テスト
n = int(input())
my_card = [input() for i in range(n)]
card_list = ['S','H', 'C', 'D']
for suit in card_list:
    for num in range(1,14):
        card_check = suit+" "+str(num)
        if not(card_check in my_card):
            print(card_check)

Submission status: Accepted

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][num-1] = 1
    elif s == "H":
        table[1][num-1] = 1
    elif s == "C":
        table[2][num-1] = 1
    else:    # D 
        table[3][num-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: Accepted

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(mark, num)

Submission status: Accepted

Solution code:
cards = list()
pattern = ["S", "H", "C","D"]
n = int(input())
for i in range(n) :
  s, r = input().split()  #文字列として読み込み
  r = int(r)  #sは文字列、rは数値
  if(s == "S") :
    cards.append(0 + r)
  elif(s == "H") :
    cards.append(13 + r)
  elif(s == "C") :
    cards.append(26 + r)
  else :
    cards.append(39 + r)
for i in range(1, 53) :
  if not(i in cards) :
    print(pattern[(i - 1) // 13], (i - 1) % 13 + 1)

Submission status: Accepted

Solution code:
n = int(input())
cards = []
for _ in range(n):
    suit, num = input().split()
    num = int(num)
    cards.append((suit, num))

for suit in ('S', 'H', 'C', 'D'):
    for num in range(13):
        if not((suit, num + 1) in cards):
            print(suit, num + 1)

Submission status: Accepted

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: Accepted

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

for suit in ['S', 'H', 'C', 'D']:
    for rank in range(1, 14):
        card = "%s %d" % (suit, rank)
        if card not in a:
            print(card)

Submission status: Accepted

Solution code:
import itertools

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

for suit, rank in itertools.product(['S', 'H', 'C', 'D'], range(1, 14)):
    card = "%s %d" % (suit, rank)
    if card not in a:
        print(card)

Submission status: Accepted

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 itertools.product(suits, range(1, 14))]
answers = [c for c in cards if c not in a]
for card in answers:
    print(card)

Submission status: Accepted

Solution code:
mark = ["S","H","C","D"]
numbers = ["1","2","3","4","5","6","7","8","9","10","11","12","13"]

cardlist = {}

for m in mark:
    for n in numbers:
        key = m + " " + n
        cardlist[key] = 0


n = int(input())

for _ in range(n):
    card = input()
    cardlist[card] = 1


for card in cardlist:
    if cardlist[card] == 0:
        print(card)

Submission status: Accepted

Solution code:

list_s = ["S1","S2","S3","S4","S5","S6","S7","S8","S9","S10","S11","S12","S13"]
list_h = ["H1","H2","H3","H4","H5","H6","H7","H8","H9","H10","H11","H12","H13"]
list_c = ["C1","C2","C3","C4","C5","C6","C7","C8","C9","C10","C11","C12","C13"]
list_d = ["D1","D2","D3","D4","D5","D6","D7","D8","D9","D10","D11","D12","D13"]

num = int(input())

for i in range(num):
	c,cn = input().split(" ")
	if c == "S":
		if str(c+cn) in list_s:
			a = list_s.index(str(c+cn))
			list_s.pop(a)
	if c == "H":
		if str(c+cn) in list_h:
			a = list_h.index(str(c+cn))
			list_h.pop(a)
	if c == "C":
		if str(c+cn) in list_c:
			a = list_c.index(str(c+cn))
			list_c.pop(a)

	if c == "D":
		if str(c+cn) in list_d:
			a = list_d.index(str(c+cn))
			list_d.pop(a)

[print(i[0:1],i[1:]) for i in list_s]
[print(i[0:1],i[1:]) for i in list_h]
[print(i[0:1],i[1:]) for i in list_c]
[print(i[0:1],i[1:]) for i in list_d]

Submission status: Accepted

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()
    del a[s]
        
a = list(a)
for i in range(len(a)):
    print(a[i])

Submission status: Accepted

Solution code:
all_set = ['S ' + str(i) for i in range(1, 14)] + ['H ' + str(i) for i in range(1, 14)] + ['C ' + str(i) for i in range(1, 14)] + ['D ' + str(i) for i in range(1, 14)]
r = int(input())

for _ in range(r):
    x = input()
    if x in all_set:
        del all_set[all_set.index(x)]
        
for i in all_set:
    print(i)

Submission status: Accepted

Solution code:

def check(mlist, s):
    if len(mlist) == 13:
        return 0
    else:
        lack = []
        for i in range(1, 14):
            if not i in mlist:
                lack.append(i)
                    
        #print(lack)
        for j in lack:
            print("{} {}".format(s, j))
        return 0


n = int(input())
Slist = []
Hlist = []
Clist = []
Dlist = []

for i in range(n):
    mark, num = input().split()
    num = int(num)

    if mark == 'S':
        Slist.append(num)
    elif mark == 'H':
        Hlist.append(num)
    elif mark == 'C':
        Clist.append(num)
    else:
        Dlist.append(num)
        
Slist.sort()
Hlist.sort()
Clist.sort()
Dlist.sort()
    
check(Slist, 'S')
check(Hlist, 'H')
check(Clist, 'C')
check(Dlist, 'D')

Submission status: Accepted

Solution code:
s, h, c, d = [],[],[],[]

n = int(input())

#add cards
for _ in range(n):
    suit, rank = input().split()
    rank = int(rank)
    if suit == "S":
        s.append(rank)
    elif suit == "H":
        h.append(rank)
    elif suit == "C":
        c.append(rank)
    elif suit == "D":
        d.append(rank)

#check cards
s_missing, h_missing, c_missing, d_missing = [],[],[],[]
for i in range(1, 14):
    if i not in s:
        s_missing.append(i) 
    if i not in h:
        h_missing.append(i) 
    if i not in c:
        c_missing.append(i) 
    if i not in d:
        d_missing.append(i) 

#print missing cards
for card in s_missing:
    print("S", card)
for card in h_missing:
    print("H", card)
for card in c_missing:
    print("C", card)
for card in d_missing:
    print("D", card)

Submission status: Accepted

Solution code:
n = int(input())
cards = [[ s+' '+str(n) for n in range(1,14)] for s in ['S','H','C','D']]
for _ in range(n):
    suit,num = input().split()
    if   suit=='S': cards[0][int(num)-1] = 0
    elif suit=='H': cards[1][int(num)-1] = 0
    elif suit=='C': cards[2][int(num)-1] = 0
    elif suit=='D': cards[3][int(num)-1] = 0
for s in cards:
    for n in s:
        if n!=0: print(n)

Submission status: Accepted

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: Accepted

Solution code:
#ITP1_6_B


n= int(input())

T=[[0 for j in range(13)]for m in range(4)]
format(T)

for i in range(n):
    a,b = input().split()
    b=int(b)
    
    if a=='S':
      T[0][b-1] = 1
    elif a=='H':
      T[1][b-1] = 1
    elif a=='C':
      T[2][b-1] = 1
    else:
      T[3][b-1] = 1
for c in range(4):
  for d in range (13):
    if T[c][d] == 0:
      if c==0:
        K = "S"
      elif c==1:
        K = "H"
      elif c==2:
        K = "C"
      else:
        K = "D"
      print(K,d+1)
    else:
      pass

Submission status: Accepted

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

pattern = ["S", "H", "C", "D"]

n = int(input())

ch_list=[]
rank_list_0=[]
while n > 0:
  ch, rank = input().split()
  ch_list.append(ch)
  rank_list_0.append(rank)
  n = n - 1

rank_list = [int(rank_list) for rank_list in rank_list_0]

for (chlist, ranklist) in zip(ch_list,rank_list):
      cards[pattern.index(chlist)][ranklist-1] = 1
      
for i in range(0, 4):
  for j in range(0, 13):
    if cards[i][j] == 0:
        print(pattern[i], j+1)

Submission status: Accepted

Solution code:
# coding: utf-8
card = [[0 for i in range(13)] for i in range(4)]
m=['S','H','C','D']

n=int(input())

for i in range(n):
    mark,num=(i for i in input().split())
    num=int(num)
    if mark=='S':
       card[0][num-1]=1
    elif mark=='H':
       card[1][num-1]=1
    elif mark=='C':
       card[2][num-1]=1
    elif mark=='D':
       card[3][num-1]=1

for i in range(4):
    for j in range(13):
        if card[i][j]==0:
            print("{} {}".format(m[i],j+1))

Submission status: Accepted

Solution code:
cards = [[False for i in range(13)] for j in range(4)]
pattern = ["S", "H", "C", "D"]
cnt = int(input())
for i in range(cnt):
    ch,rank = input().split()
    rank = int(rank)
    cards[pattern.index(ch)][rank-1] = True

for i in range(4):
    for j in range(13):
        if cards[i][j] == False:
            print(pattern[i], j+1)

Submission status: Accepted

Solution code:
from sys import stdin
from itertools import product

suits = ['S', 'H', 'C', 'D']
suits_priority = {
    'S': 1,
    'H': 2,
    'C': 3,
    'D': 4
}
ranks = list(range(1, 14))

original_deck = set(product(suits, ranks))

if __name__ == '__main__':
    n = int(stdin.readline().rstrip())
    deck = set()
    for _ in range(n):
        suit, rank = stdin.readline().rstrip().split()
        deck.add((suit, int(rank)))

    diff = list(original_deck - deck)
    diff.sort(key=lambda x: x[1])
    diff.sort(key=lambda x: suits_priority[x[0]])

    for card in diff:
        print("{} {}".format(*card))

Submission status: Accepted

Solution code:
cards = [[False for j in range(13)] for i in range(4)]
pattern = ["S", "H", "C", "D"]
numbers = int(input())
for a in range(numbers):
    ch,rank = input().split()
    rank = int(rank)
    if ch == "S":
        cards[0][rank-1] = True
    elif ch == "H":
        cards[1][rank-1] = True
    elif ch == "C":
        cards[2][rank-1] = True
    elif ch == "D":
        cards[3][rank-1] = True

for i in range(4):
    for j in range(13):
        if cards[i][j] == False:
            print(pattern[i],j+1)

Submission status: Accepted

Solution code:
cards = int(input())
i = 0
cardlist = []
while(i < cards):
    cardlist.append(list(map(str,input().split())))
    i += 1
SP = [False] * 13
HR = [False] * 13
CL = [False] * 13
DY = [False] * 13

for i in cardlist:
    num = int(i[1])-1
    if  (i[0] == "S"):
        SP[num] = True
    elif(i[0] == "H"):
        HR[num] = True
    elif(i[0] == "C"):
        CL[num] = True
    elif(i[0] == "D"):
        DY[num] = True

c = 0
for i in SP:
    c += 1
    if i == False:
        print("S %d" %c)
c = 0
for i in HR:
    c += 1
    if i == False:
        print("H %d" %c)
c = 0
for i in CL:
    c += 1
    if i == False:
        print("C %d" %c)
c = 0
for i in DY:
    c += 1
    if i == False:
        print("D %d" %c)

Submission status: Accepted

Solution code:
card = list()

for c in ('S','H','C','D'):
    for i in range(1,14):
        x = c +' '+ str(i)
        card.append(x)


n = int(input())
card2 = list()

for i in range(n):
    a,b =  input().split()
    x = a + ' '+str(b)
    card2.append(x)

noneCard = list()
for i in (card):
    if(i not in card2):
        noneCard.append(i)


for i in range(len(card)-n):
    x = noneCard[i]
    print(x)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
cards = {} #空の辞書
for i in range(n):
    card = input()
    cards[card] = 1
for c in ['S', 'H', 'C', 'D']:
    for n in range(1,14):
        key = c + ' ' + str(n)
        if not key in cards:
            print(key)

Submission status: Accepted

Solution code:

n = int(input())
cards = {}               #空の辞書を作る

for i in range(n):
    card = input()
    cards[card] = True
    
# print(d)

for c in ["S", "H", "C", "D"]:
    for i in range(1, 14):
        key = c + ' ' + str(i)
        if not key in cards:
            print(key)

Submission status: Accepted

Solution code:
n=int(input())
cards = {}
for i in range(n):
    card=input()
    cards[card]=1
    
   
for c in ['S', 'H', 'C', 'D']:
        for n in range(1, 14):
            key = c+' '+ str(n)
            if not key in cards:
                print(key)

Submission status: Accepted

Solution code:
n = int(input())
cards = {} #空の辞書
for i in range(n):
    card = input()
    cards[card] = 1
    
#print(cards)

for c in ['S','H','C','D']:
    for n in range(1,14):
        key = c + ' ' + str(n)
        if not key in cards:
            print(key)

Submission status: Accepted

Solution code:
n = int(input())
cards = {}
for i in range(n):
     card = input()
     cards[card] = 1
     
# print(cards)

for c in ['S','H','C','D']:
     for n in range(1, 14):
          key = c + ' ' + str(n)
          if not key in cards:
               print(key)

Submission status: Accepted

Solution code:
n = int(input())
cards = {}
for i in range(n):
    card = input()
    cards[card] = 1
    
#print(cards)

for c in ['S', 'H', 'C', 'D']:
    for n in range(1, 14):
        key = c + ' ' + str(n)
        if not key in cards:
            print(key)

Submission status: Accepted

Solution code:
n = int(input())
cards = {}
for i in range(n):
    card = input()
    cards[card] = 1
     
#print(cards)
 
for c in ['S', 'H', 'C', 'D']:
    for n in range(1, 14):
        key = c + ' ' + str(n)
        if not key in cards:
            print(key)

Submission status: Accepted

Solution code:
n = int(input())
cards = {} #空の辞書
for i in range(n):
    card = input()
    cards[card] = 1
    
#print(cards)
    
for c in ['S', 'H', 'C', 'D']:
    for n in range(1, 14):
        key = c +' ' + str(n)
        if not key in cards:
            print(key)

Submission status: Accepted

Solution code:
n = int(input())
cards = {}
for i in range(n):
    card = input()
    cards[card] = 1
      
#print(cards)
  
for c in ['S', 'H', 'C', 'D']:
    for n in range(1, 14):
        key = c + ' ' + str(n)
        if not key in cards:
            print(key)

Submission status: Accepted

Solution code:
n = int(input())
cards = {} #空の辞書
for i in range(n):
    card = input()
    cards[card] = 1
    
#print(cards)

for c in ['S', 'H', 'C', 'D']:
    for n in range(1,14):
        key = c + ' ' + str(n)
        if not key in cards:
            print(key)

Submission status: Accepted

Solution code:
n=int(input())
cards = {} #空の辞書
for i in range(n):
    card = input()
    cards[card]=1
#print(cards)

for c in ['S', 'H', 'C', 'D']:
    for n in range(1, 14):
        key = c +' '+str(n)
        if not key in cards:
            print(key)

Submission status: Accepted

Solution code:
n = int(input())
cards = {}
for i in range(n):
    card = input()
    cards[card] = 1
    
#print(cards)

for c in ['S', 'H', 'C', 'D']:
    for n in range(1, 14):
        key = c + ' ' + str(n)
        if not key in cards:
            print(key)

Submission status: Accepted

Solution code:
n = int(input())
cards = {} #空の辞書
for i in range(n):
    card = input()
    cards[card] = 1
     
#print(cards)
 
for c in ['S', 'H', 'C', 'D']:
    for n in range(1,14):
        key = c + ' ' + str(n)
        if not key in cards:
            print(key)

Submission status: Accepted

Solution code:
n=int(input())
d={}
for i in range(n):
  card=input()
  d[card]=True
for c in ["S","H","C","D"]:
  for n in range(1,14):
    key=c+' '+str(n)
    if not key in d:
      print(key)

Submission status: Accepted

Solution code:
n=int(input())
cards={}
for i in range(n):
    card =input()
    cards[card]=1
    
#print(cards)

for c in ['S','H','C','D']:
    for n in range (1,14):
        key=c+' '+str(n)
        if not key in cards:
            print(key)

Submission status: Accepted

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

n = int(input())
cards = {}
for i in range(n):
    card = input()
    cards[card] = 1
    
for c in ['S','H','C','D']:
    for n in range(1,14):
        key = c + ' ' + str(n)
        if not key in cards:
            print(key)

Submission status: Accepted

Solution code:
n = int(input())
cards = [[ s+' '+str(n) for n in range(1,14)] for s in ['S','H','C','D']]
for _ in range(n):
   suit,num = input().split()
   if   suit=='S': cards[0][int(num)-1] = 0
   elif suit=='H': cards[1][int(num)-1] = 0
   elif suit=='C': cards[2][int(num)-1] = 0
   elif suit=='D': cards[3][int(num)-1] = 0
for s in cards:
   for n in s:
       if n!=0: print(n)

Submission status: Accepted

Solution code:
n = int(input())
cards = {}
for i in range(n):
  card = input()
  cards[card] = 1

for c in ['S', 'H', 'C', 'D']:
  for n in range(1,14):
    key = c + ' ' + str(n)
    if not key in cards:
      print(key)

Submission status: Accepted

Solution code:
n = int(input())
cards = {}
for i in range(n):
  card = input()
  cards[card] = 1
 
for c in ['S', 'H', 'C', 'D']:
  for n in range(1,14):
    key = c + ' ' + str(n)
    if not key in cards:
      print(key)

Submission status: Accepted

Solution code:
n = int(input())
cards = {}
for i in range(n):
         card = input()
         cards[card] = 1
         
for c in ['S', 'H', 'C', 'D']:
    for n in range(1,14):
        key = c + ' ' + str(n)
        if not key in cards:
            print(key)

Submission status: Accepted

Solution code:
c=[0] * 52
for i in range(13):
    c[i]='S {0}'.format(i+1)
    c[13+i]='H {0}'.format(i+1)
    c[26+i]='C {0}'.format(i+1)
    c[39+i]='D {0}'.format(i+1)

for i in range(int(input())):
    c.remove(input())

if c:print('\n'.join(c))

Submission status: Accepted

Solution code:
def az16():
    list = []
    n = input()
    for i in range(0,n):
        list.append(raw_input().split())
    for mark in ["S","H","C","D"]:
        for i in range(1,14):
            if [mark,repr(i)] not in list:
                print mark,i

az16()

Submission status: Accepted

Solution code:
t = int(raw_input())

D = []
for i in range(0,4):
    base = [0,0,0,0,0,0,0,0,0,0,0,0,0] 
    D.append(base)
M = ['S','H','C','D']
for i in range(0,t):
    [m,v] = raw_input().split()
    v = int(v) - 1
    if m == 'S':
        D[0][v] = 1
    if m == 'H':
        D[1][v] = 1
    if m == 'C':
        D[2][v] = 1
    if m == 'D':
        D[3][v] = 1

for y in range(0,4):
    for x in range(0,13):
        if D[y][x] == 0:
            print M[y],x+1

Submission status: Accepted

Solution code:
from sys import stdin
smap = {'S':0, 'H':1, 'C':2, 'D':3}
rsmap = 'S', 'H', 'C', 'D'

n = int(stdin.readline())

card = []
for s in range(4):
    card.insert(s, [])
    for r in range(13):
        card[s].insert(r, 0)

for c in range(n):
    s, r = stdin.readline().split(' ')
    r = int(r) - 1
    card[smap[s]][r] = 1

for s in range(4):
    for r in range(13):
        if card[s][r] == 0:
            print(rsmap[s], r + 1)

Submission status: Accepted

Solution code:
S = []
H = []
C = []
D = []
for i in range(14):
    S.append(False)
    H.append(False)
    C.append(False)
    D.append(False)
n = input()
for i in range(n):
    c, a = raw_input().split()
    if(c == "S"):
        S[int(a)] = True
    elif(c == "H"):
        H[int(a)] = True
    elif(c == "C"):
        C[int(a)] = True
    elif(c == "D"):
        D[int(a)] = True
for i in range(1, 14):
    if(S[i] == False):
        print("S %d" %(i))
for i in range(1, 14):
    if(H[i] == False):
        print("H %d" %(i))
for i in range(1, 14):
    if(C[i] == False):
        print("C %d" %(i))
for i in range(1, 14):
    if(D[i] == False):
        print("D %d" %(i))

Submission status: Accepted

Solution code:
card_ = lambda:set([i for i in range(1, 14)])
n = int(input())
count = 0
card = {"S": card_(), "H": card_(), "C": card_(), "D": card_()}
while count < n:
    i = list(input().split(" "))
    card[i[0]] -= {int(i[1])}
    count += 1
 
mark = ["S", "H", "C", "D"]
for m in mark:
    for c in sorted(card[m]):
        print("%s %d" % (m, c))

Submission status: Accepted

Solution code:
n=int(raw_input())
s=range(1,14)
h=range(1,14)
c=range(1,14)
d=range(1,14)

for i in range(n):
    hd,r=raw_input().split()
    if hd=='S':
        s[int(r)-1]=0
    elif hd=='H':
        h[int(r)-1]=0
    elif hd=='C':
        c[int(r)-1]=0
    elif hd=='D':
        d[int(r)-1]=0

a='S '
for i in range(13):
    if s[i]!=0:
        print a +str(s[i])
a='H '
for i in range(13):
    if h[i]!=0:
        print a +str(h[i])
a='C '
for i in range(13):
    if c[i]!=0:
        print a +str(c[i])
a='D '
for i in range(13):
    if d[i]!=0:
        print a +str(d[i])

Submission status: Accepted

Solution code:
x = []
y = range(1,14)

for val in y:
	x.append("S " + str(val))
	
for val in y:
	x.append("H " + str(val))
	
for val in y:
	x.append("C " + str(val))
	
for val in y:
	x.append("D " + str(val))
	
r = input()
n = range(1,r + 1)
m = range(1,53-r)

for val in n:
	x.remove(raw_input())
for val in x:
	print val

Submission status: Accepted

Solution code:
n=input()
s=[[1 for i in range(13)] for j in range(4)]
for i in range(n):
  a,b=map(str,raw_input().split())
  b=int(b)
  if a=='S':s[0][b-1]=0
  elif a=='H':s[1][b-1]=0
  elif a=='C':s[2][b-1]=0
  else:s[3][b-1]=0
for i in range(4):
  for j in range(13):
    if s[i][j]:
      if i==0:print'S',j+1
      if i==1:print'H',j+1
      if i==2:print'C',j+1
      if i==3:print'D',j+1