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:
suits = ['S','H','C','D']

table = [[False]*14 for i in range(4)]

N = int(input())

for loop in range(N):

    mark,num = input().split()
    num = int(num)

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

for i in range(4):
    for k in range(1,14):
        if table[i][k] == False:
            print("%s %d"%(suits[i],k))

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
n = int(input())

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

for _ in range(n):
    suit, figure = input().split()
    figure = int(figure)
    if suit == 'S':
        S.append(figure)
    if suit == 'H':
        H.append(figure)
        
    if suit == 'C':
        C.append(figure)
        
    if suit == 'D':
        D.append(figure)
        
S.sort()
H.sort()
C.sort()
D.sort()

if len(S) != 13:
    for i in range(13):
        if (i+1)  not in S:
            print('S',str(i+1))

if len(H) != 13:    
    for i in range(13):
        if (i+1)  not in H:
            print('H',str(i+1))
        
if len(C) != 13:
    for i in range(13):
        if (i+1)  not in C:
            print('C',str(i+1))
        
if len(D) != 13:
    for i in range(13):
        if (i+1)  not in D:
            print('D',str(i+1))

Submission status: Accepted

Solution code:
n = int(input())
s = []
h = []
c = []
d = []
for _ in range(n):
    card = input().split()
    mark = card[0]
    num = int(card[1])
    
    if mark == 'S':
        s.append(num)
    if mark == 'H':
        h.append(num)
    if mark == 'C':
        c.append(num)
    if mark == 'D':
        d.append(num)

for num in range(1, 13+1):
    if num not in s:
        print(f'S {num}')
for num in range(1, 13+1):
    if num not in h:
        print(f'H {num}')
for num in range(1, 13+1):
    if num not in c:
        print(f'C {num}')
for num in range(1, 13+1):
    if num not in d:
        print(f'D {num}')

Submission status: Accepted

Solution code:
cards = [[False for i in range(14)] for j in range(4)]
marks = ['S', 'H', 'C', 'D']

n = int(input())
for i in range(n):
    mark, num = input().split()
    num = int(num)
    cards[marks.index(mark)][num] = True

for i in range(4):
    for j in range(1, 14):
        if not cards[i][j]:
            print(marks[i], j)

Submission status: Accepted

Solution code:
n=int(input())
t=['S','H','C','D']
trunp=[[False for i in range(13)],[False for i in range(13)],[False for i in range(13)],[False for i in range(13)]]
for i in range(n):
    [type,num]=input().split()
    num=int(num)-1
    if type=='S':
        trunp[0][num]=True
    elif type=='H':
        trunp[1][num]=True
    elif type=='C':
        trunp[2][num]=True
    elif type=='D':
        trunp[3][num]=True
for i in range(4):
    for j in range(13):
        if trunp[i][j]==False:
            print('%s %d' % (t[i],j+1))

Submission status: Accepted

Solution code:
number_str=input("")
number=int(number_str)

tr=[]
mark=["S","H","C","D"]
for j in mark:
    for i in range(1,14):
        u=j+" "+str(i)
        tr.append(u)

array=[]
nomatch=[]
i=1
while i<=number:
    x=input()
    array.append(x)
    i=i+1
  
for i in tr:
    if i not in  array:
        nomatch.append(i)
 
for i in nomatch:
    print(i)

Submission status: Accepted

Solution code:
sym = ["S", "H", "C", "D"]
rnk = range(1,14)
crds = []
for i in sym:
    for j in rnk:
        crds.append([i,j])
n = int(input())
for i in range(n):
    wrds = input().split()
    wrds[1] = int(wrds[1])
    crds.remove(wrds)
for i in crds:
    print (i[0], i[1])

Submission status: Accepted

Solution code:
n = int(input())
sList = [0] * 13
hList = [0] * 13
cList = [0] * 13
dList = [0] * 13
for i in range(n):
    pat, num = input().split()
    num = int(num)
    if pat == 'S':
        sList[num - 1] = 1
    elif pat == 'H':
        hList[num - 1] = 1
    elif pat == 'C':
        cList[num - 1] = 1
    elif pat == 'D':
        dList[num - 1] = 1

for i in range(13):
    if sList[i] == 0:
        print("S %d" %(i+1))
for i in range(13):
    if hList[i] == 0:
        print("H %d" %(i+1))
for i in range(13):
    if cList[i] == 0:
        print("C %d" %(i+1))
for i in range(13):
    if dList[i] == 0:
        print("D %d" %(i+1))

Submission status: Accepted

Solution code:
n = int(input())
sorts =['S', 'H', 'C', 'D']
All = [[i, j] for i in sorts for j in range(1, 14)]
Exist = []
for i in range(n):
  e = list(map(str, input().split()))
  e[1] = int(e[1])
  Exist.append(e)
Rest = []
for i in All:
  if not (i in Exist):
    Rest.append(i)

Rest_S = [x for x in Rest if x[0] == 'S']
Rest_H = [x for x in Rest if x[0] == 'H']
Rest_C = [x for x in Rest if x[0] == 'C']
Rest_D = [x for x in Rest if x[0] == 'D']  
  
Rest_S_R = [x[1] for x in Rest_S]  
Rest_H_R = [x[1] for x in Rest_H]  
Rest_C_R = [x[1] for x in Rest_C]  
Rest_D_R = [x[1] for x in Rest_D]  
while True:
  if Rest_S ==[]:
    break
  else:
    k = ['S',min(Rest_S_R)]
    print(' '.join(map(str,k)))
    Rest_S.remove(k)
    Rest_S_R = [x[1] for x in Rest_S]
while True:
  if Rest_H ==[]:
    break
  else:
    k = ['H',min(Rest_H_R)]
    print(' '.join(map(str,k)))
    Rest_H.remove(k)
    Rest_H_R = [x[1] for x in Rest_H]
while True:
  if Rest_C ==[]:
    break
  else:
    k = ['C',min(Rest_C_R)]
    print(' '.join(map(str,k)))
    Rest_C.remove(k)
    Rest_C_R = [x[1] for x in Rest_C] 
while True:
  if Rest_D ==[]:
    break
  else:
    k = ['D',min(Rest_D_R)]
    print(' '.join(map(str,k)))
    Rest_D.remove(k)
    Rest_D_R = [x[1] for x in Rest_D]

Submission status: Accepted

Solution code:
cs=('S','H','C','D')
n=int(input())
card=[[False for i in range(13)] for j in range(4)]
for i in range(n):
    s,num=input().split()
    if s=='S':
        card[0][int(num)-1]=True
    elif s=='H':
        card[1][int(num)-1]=True
    elif s=='C':
        card[2][int(num)-1]=True
    elif s=='D':
        card[3][int(num)-1]=True

for i in range(4):
    for j in range(13):
        if card[i][j]==False:
            print(*cs[i],j+1)

Submission status: Accepted

Solution code:
n = int(input())
cs = [input().split() for _ in range(n)]
for m in 'SHCD':
    for i in range(1, 14):
        if [m, str(i)] not in cs:
            print(m, i)

Submission status: Accepted

Solution code:
n = int(input())
card = [[False for i in range(13)] for j in range(4)]
pattern = ["S","H","C","D"]

for i in range(n) :
    suit,num = input().split()
    num = int(num)
    card[pattern.index(suit)][num - 1] = True;

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

Submission status: Accepted

Solution code:
Number=int(input())
Ctable=list()
for i in range(Number):
    mark,rank=input().split()
    rank = int(rank)
    if mark == "S":
        Ctable.append(rank + 0)
    elif mark == "H":
        Ctable.append(rank + 13)
    elif mark == "C":
        Ctable.append(rank + 26)
    else:
        Ctable.append(rank + 39)
for i in range(1,53):
    if not(i in Ctable):
        if i<=13:
            print("S {}".format(i - 0))
        elif i<=26:
            print("H {}".format(i-13))
        elif i<=39:
            print("C {}".format(i-26))
        else:
            print("D {}".format(i-39))

Submission status: Accepted

Solution code:
n = int(input())
mark = ['S','H','C','D']
l = {'S':[],'H':[],'C':[],'D':[]}
for i in range(n):
    m, num = input().split()
    num = int(num)
    l[m].append(num)
for m in mark:
    for i in range(13):
        if l[m].count(i + 1) == 0:
            print(m,i + 1)

Submission status: Accepted

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

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


for i in range(4):
	for j in range(13):
		if tbl[i][j]==0:
			if i==0:
				print(f'S {j+1}')
			if i==1:
				print(f'H {j+1}')
			if i==2:
				print(f'C {j+1}')
			if i==3:
				print(f'D {j+1}')

Submission status: Accepted

Solution code:
card=[[0 for i in range(13)] for j in range(4)]
n=int(input())
for k in range(0,n):
  x,y=map(str,input().split())
  
  if x == 'S':
    n=0
  elif x == 'H':
    n=1
  elif x == 'C':
    n=2
  elif x == 'D':
    n=3
  
  y=int(y)-1
  card[n][y]=1

for k in range(0,13):
  if card[0][k] == 0:
    print('S',k+1)

for k in range(0,13):
  if card[1][k] == 0:
    print('H',k+1)

for k in range(0,13):
  if card[2][k] == 0:
    print('C',k+1)
    
for k in range(0,13):
  if card[3][k] == 0:
    print('D',k+1)

Submission status: Accepted

Solution code:
n=int(input())
i=0
L=[]
 
 
while i<n:
    card=input().split( )
    suit=card[0]
    number=int(card[1])
 
    if suit == "H":
        number = number +13
    elif suit == "C":
        number = number +26
    elif suit == "D":
        number = number +39
    L.append(number)
    i+=1
 
for j in range(52):
    k=j+1
    if not k in L:
        if int(j/13)==0:
            print(f"S {(j%13)+1}")
        elif int(j/13)==1:
            print(f"H {(j%13)+1}")
        elif int(j/13)==2:
            print(f"C {(j%13)+1}")
        elif int(j/13)==3:
            print(f"D {(j%13)+1}")

Submission status: Accepted

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

for j in range(4):
    for k in range(13):
        if card[j][k] == 1:
            print(simbol[j],k+1)

Submission status: Accepted

Solution code:
n = int(input())
pattern = ["S","H","C","D"]
data = [[False for i in range(13)] for j in range(4)]

for i in range(n):
    type,x = list(map(str,input().split()))
    x = int(x)
    data[pattern.index(type)][x - 1] = True

for i,row in enumerate(data):
    for j,elem in enumerate(row):
        if elem == False :
            print(pattern[i], j + 1)

Submission status: Accepted

Solution code:
n = int(input())

cards = [[False for i in range(1, 14)] for j in range(4)]

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

for i, row in enumerate(cards):
    if i == 0:
        mark = "S"
    if i == 1:
        mark = "H"
    if i == 2:
        mark = "C"
    if i == 3:
        mark = "D"
    for i, num in enumerate(row):
        if not num:
            print("{} {}".format(mark, i+1))

Submission status: Accepted

Solution code:
n=int(input())
i=0
L=[]


while i<n:
    card=input().split( )
    suit=card[0]
    number=int(card[1])

    if suit == "H":
        number = number +13
    elif suit == "C":
        number = number +26
    elif suit == "D":
        number = number +39
    L.append(number)
    i+=1

for j in range(52):
    k=j+1
    if not k in L:
        if int(j/13)==0:
            print(f"S {(j%13)+1}")
        elif int(j/13)==1:
            print(f"H {(j%13)+1}")
        elif int(j/13)==2:
            print(f"C {(j%13)+1}")
        elif int(j/13)==3:
            print(f"D {(j%13)+1}")

Submission status: Accepted

Solution code:
#from numpy import*
#from scipy import*
from collections import* #defaultdict Counter deque appendleft
from fractions import gcd
from functools import* #reduce
from itertools import* #permutations("AB",repeat=2) combinations("AB",2) product("AB",2) groupby
from operator import mul
from bisect import* #bisect_left bisect_right
from heapq import* #heapify heappop heappushpop
from math import factorial,pi
from copy import deepcopy
import sys
#input=sys.stdin.readline  #危険！基本オフにしろ！
sys.setrecursionlimit(10**6)


def main():
    n=int(input())
    s=set()
    for i in "SHDC":
        for j in range(1,14):
            s.add((i,str(j)))
    x=sorted(s-set(tuple(input().split())for i in range(n)),key=lambda x:int(x[1]))
    
    for j in "SHCD":
        for i in x:
            if j==i[0]:
                print(*i)
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())

dict_card = {}

for cnt in range(n):
    card_suit, card_num = input().split()

    dict_card[(card_suit, card_num)] = ""


for suit in ("S", "H", "C", "D"):
    for num in map(str, range(1, 13 + 1)):
        if (suit, num) not in dict_card:
            print(f"{suit} {num}")

Submission status: Accepted

Solution code:
list_numS = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
list_numH = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
list_numC = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
list_numD = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
count_num = int(input())
for count in range(count_num):
    suit, card_num = list(map(str, input().split()))
    if suit == "S":
        list_numS.remove(int(card_num))
    elif suit == "H":
        list_numH.remove(int(card_num))
    elif suit == "C":
        list_numC.remove(int(card_num))
    elif suit == "D":
        list_numD.remove(int(card_num))
for counts in range(1, len(list_numS) + 1):
    print("S", list_numS[counts - 1])
    counts += 1
for counth in range(1, len(list_numH) + 1):
    print("H", list_numH[counth - 1])
    counth += 1
for countc in range(1, len(list_numC) + 1):
    print("C", list_numC[countc - 1])
    countc += 1
for countd in range(1, len(list_numD) + 1):
    print("D", list_numD[countd - 1])
    countd += 1

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)]
cards = ["%s %d" % (suit, rank) for suit, rank in itertools.product(['S', 'H', 'C', 'D'],range(1, 14))]
answers = [card for card in cards if card not in a]

for answer in answers:
    print(answer)

Submission status: Accepted

Solution code:
S = []
H = []
C = []
D = []

value = [1,2,3,4,5,6,7,8,9,10,11,12,13]


n = int(input())

for i in range(n):
  M,N = map(str,input().split())
  if M == "S":
    S.append(int(N))
  if M == "H":
    H.append(int(N))
  if M == "C":
    C.append(int(N))
  if M == "D":
    D.append(int(N))

for i in range(len(value)):
  if (value[i] in S) == False:
    print("S",value[i])
for i in range(len(value)):
  if (value[i] in H) == False:
    print("H",value[i])
for i in range(len(value)):
  if (value[i] in C) == False:
    print("C",value[i])
for i in range(len(value)):
  if (value[i] in D) == False:
    print("D",value[i])

Submission status: Accepted

Solution code:
list = [[0 for i in range(13)] for j in range(4)]
list_dict = {"S":0, "H":1, "C":2, "D":3}

n = int(input())

for i in range(n):
    card = input().split()
    list[list_dict.get(card[0])][int(card[1]) - 1] = 1

for i in range(4):
   for j in range(13):
        if list[i][j] == 0:
            key = [k for k, v in list_dict.items() if v == i][0]
            print(key, j+1)

Submission status: Accepted

Solution code:
cards = ["{} {}".format(s,r)
       for s in ('S','H','C','D') for r in range(1,14)]
   
count = int(input())
for n in range(count) :
 card = input()
 cards.remove(card)
   
for n in cards :
 print(n)

Submission status: Accepted

Solution code:
cards = ["{} {}".format(s,r)
       for s in ('S','H','C','D') for r in range(1,14)]
  
count = int(input())
for n in range(count) :
 card = input()
 cards.remove(card)
  
for n in cards :
 print(n)

Submission status: Accepted

Solution code:
suits = ['S','H','C','D']
  
table = [[False]*14 for i in range(4)]
  
N = int(input())
  
for loop in range(N):
  
    mark,num = input().split()
    num = int(num)
  
    if mark == 'S':
        table[0][num] = True
    elif mark == 'H':
        table[1][num] = True
    elif mark == 'C':
        table[2][num] = True
    else:
        table[3][num] = True
  
for i in range(4):
    for k in range(1,14):
        if table[i][k] == False:
            print("%s %d"%(suits[i],k))

Submission status: Accepted

Solution code:
alldeck = [f'{mark} {num + 1}' for mark in 'SHCD' for num in range(13)]
count = int(input())
deck = set(input() for _ in range(count))
nokori = set(alldeck) - deck
[print(card) for card in sorted(nokori, key=lambda c: alldeck.index(c))]

Submission status: Accepted

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

suits = ['S','H','C','D']
ranks = [1,2,3,4,5,6,7,8,9,10,11,12,13]
cards = ["%s %d" % (suit, rank) for suit, rank in itertools.product(suits, ranks)]
answers = [card for card in cards if card not in a]
for ans in answers:
    print(ans)

Submission status: Accepted

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

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

for out in answers:
    print(out)

Submission status: Accepted

Solution code:
import itertools

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

suit_list = ['S', 'H', 'C', 'D']
rank_list = range(1, 14)

card_list = [suit + ' ' + str(rank) for suit, rank in itertools.product(suit_list, rank_list)]

answer_list = [card for card in card_list if card not in exist]

for ans in answer_list:
    print(ans)

Submission status: Accepted

Solution code:
import itertools

RANK_NUM = 13
n = int(input())
data = [input() for _ in range(n)]
data_list = [i.split() for i in data]
data_tuple = [(i[0], i[1]) for i in data_list]

card_all = itertools.product(['S', 'H', 'C', 'D'], [str(i) for i in range(1, RANK_NUM + 1)])
lost_card = [card for card in card_all if not card in data_tuple]
for output in lost_card:
    print(' '.join(output))

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 not card in a:
            print(card)

Submission status: Accepted

Solution code:
cards = {
    'S': set(),
    'H': set(),
    'C': set(),
    'D': set(),
}
N = int(input())
for _ in range(N):
    type, num = input().split()
    cards[type].add(int(num))
fullset = set(range(1, 14))
for type in ('S', 'H', 'C', 'D'):
    numbers = sorted(list(fullset - cards[type]))
    for num in numbers:
        print(type, num)

Submission status: Accepted

Solution code:
cards = [[False for i in range(13)] for j in range(4)]
pattern = ["S", "H", "C", "D"]
n = int(input())

for i in range(n):
    some_input = list(map(str, input().split()))
    if some_input[0] == 'S':
        cards[0][int(some_input[1]) - 1] = True
    elif some_input[0] == 'H':
        cards[1][int(some_input[1]) - 1] = True
    elif some_input[0] == 'C':
        cards[2][int(some_input[1]) - 1] = True
    else:
        cards[3][int(some_input[1]) - 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 = ["{} {}".format(s,r)
       for s in ('S','H','C','D') for r in range(1,14)]
 
count = int(input())
for n in range(count) :
 card = input()
 cards.remove(card)
 
for n in cards :
 print(n)

Submission status: Accepted

Solution code:
cards = ["{} {}".format(s,r)
       for s in ('S','H','C','D') for r in range(1,14)]

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

for n in cards :
 print(n)

Submission status: Accepted

Solution code:
suit=["S","H","C","D"]
rank=[i+1 for i in range(13)]

all_cards=[]
for s in suit:
  for r in rank:
    all_cards.append(s+" "+str(r))

cards=[]

n=int(input())
for i in range(n):
  s,r=map(str,input().split())
  cards.append(s+" "+r)
  
for ac in all_cards:
  if ac in cards:
    pass
  else:
    print(ac)

Submission status: Accepted

Solution code:
cards = [[False for i in range(13)] for j in range(4)]
num = int(input())

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

#

for i in range(num):
    pic,fig = input().split()
    fig = int(fig)
    if pic == "S":
        cards[0][fig-1] = True
    elif pic == "H":
        cards[1][fig-1] = True
    elif pic == "C":
        cards[2][fig-1] = True
    else:
        cards[3][fig-1] = True

for i in range(4):
    for j in range(13):
        if cards[i][j] == False:
            print("%s %d"%(types[i],j+1))

Submission status: Accepted

Solution code:
cards = ["{} {}".format(s,r) 
        for s in ('S','H','C','D') for r in range(1,14)]

count = int(input())
for n in range(count) :
  card = input()
  cards.remove(card)         
  
for n in cards :
  print(n)

Submission status: Accepted

Solution code:
inCount = int(input())
cards = [input() for i in range(inCount)]
for mark in ["S", "H", "C", "D"]:
    for number in range(1, 14):
        checkMarkNumber = mark + " " + str(number)
        if not(checkMarkNumber in cards):
            print(checkMarkNumber)

Submission status: Accepted

Solution code:
cards = [[m+" "+ str(n) for n in range(1,14)] for m in ["S","H","C","D"]]

num = int(input())
for i in range(num):
    x = input()
    x = x.split(" ")
    m = str(x[0])
    n = int(x[1])
    
    if m == "S": cards[0][n-1] = 0
    elif m == "H": cards[1][n-1] = 0
    elif m == "C": cards[2][n-1] = 0
    elif m == "D": cards[3][n-1] = 0
        
for i in range(len(cards)):
    for j in range(len(cards[i])):
        if cards[i][j] != 0:
            print(cards[i][j])

Submission status: Accepted

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

table = [[False]*14 for i in range(4)]

N = int(input())

for loop in range(N):
    mark, num = input().split()
    num = int(num)
    
    if mark == 'S':
        table[0][num] = True
    elif mark == 'H':
        table[1][num] = True
    elif mark == 'C':
        table[2][num] = True
    else:
        table[3][num] = True

for i in range(4):
    for j in range(1, 14):
        if table[i][j]==False:
            print(EGARA[i], j)

Submission status: Accepted

Solution code:
if __name__ == '__main__':
	n = int(input())
	suits = [ 'S' , 'H', 'C', 'D']
	num = list(range(1,14))
	
	all = []
	for i in suits:
		for k in num:
			all.append([i,str(k)])
	
	data = []
	for i in range(n):
		data.append(input().split())
	
	for i in all:
		if not i in data:
			print(i[0]+" "+i[1])

Submission status: Accepted

Solution code:
###
### atcorder test program
###

### math class
class math:
    ### pi
    pi = 3.14159265358979323846264338

    ### GCD
    def gcd(self, a, b):
        if b == 0:
            return a
        return self.gcd(b, a%b)

math = math()

### output class
class output:
    ### list
    def list(self, l):
        l = list(l)
        for i, num in enumerate(l):
            print(num, end="")
            if i != len(l)-1:
                print(" ", end="")
        print()

output = output()

### input sample
#i = input()
#A, B, C = [x for x in input().split()]
#templist = [int(w) for w in input().split()]
#R = float(input())
#A = [int(x) for x in input().split()]

### output sample
#print("{0} {1} {2:.5f}".format(A//B, A%B, A/B))
#print("{0:.6f} {1:.6f}".format(R*R*math.pi,R*2*math.pi))
#print(" {}".format(i), end="")

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

ALL = list(range(1,14))

N = int(input())
for i in range(N):
    p, n = [x for x in input().split()]
    if p == "S":
        S.append(int(n))
    elif p == "H":
        H.append(int(n))
    elif p == "C":
        C.append(int(n))
    elif p == "D":
        D.append(int(n))

S = list(set(ALL)-set(S))
H = list(set(ALL)-set(H))
C = list(set(ALL)-set(C))
D = list(set(ALL)-set(D))

S.sort()
H.sort()
C.sort()
D.sort()

for i in S:
    print("S {}".format(i))
for i in H:
    print("H {}".format(i))
for i in C:
    print("C {}".format(i))
for i in D:
    print("D {}".format(i))

Submission status: Accepted

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

# set patterns
pattern = ["S", "H", "C", "D"]

# input
n = int(input())
for cnt in range(n):
    mark, rank = map(str, input().split())
    rank = int(rank)
    # set true
    cards[pattern.index(mark)][rank-1] = True

# output
for i in range(len(cards)):
    for j in range(len(cards[0])):
        if cards[i][j] == False:
            print(pattern[i], j+1)

Submission status: Accepted

Solution code:
c=[]
p=['S','H','C','D']

for i in p:
	for j in range(1,14):
		n=i+' '+str(j)
		c.append(n)
num=int(input())
for i in range(num):
	c.remove(input())
for i in c:
	print(i)

Submission status: Accepted

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

table=[[False]*14 for i in range(4)]

N=int(input())

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

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

for i in range(4):
    for j in range(1,14):
        if table[i][j]==False:
            print("%s %d"%(suits[i],j))

Submission status: Accepted

Solution code:
import sys
import itertools as it
next(sys.stdin)
cs = [l.strip() for l in sys.stdin]
for s, r in it.product('SHCD', range(1,14)):
    c = f'{s} {r}'
    if c not in cs:
        print(c)

Submission status: Accepted

Solution code:
all = []

for i in range(4):
    for j in range(13):
        if i == 0:
            num = j + 1
            all.append("S " + str(num))
        elif i == 1:
            num = j + 1
            all.append("H " + str(num))
        elif i == 2:
            num = j + 1
            all.append("C " + str(num))
        else:
            num = j + 1
            all.append("D " + str(num))

n = int(input())

for i in range(n):
    card = input()
    all.remove(card)


for i in range(len(all)):
    print(all[i])

Submission status: Accepted

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

y = int(input())

for i in range(y):
    a = input()
    listtest.remove(a)

for ans in listtest:
    print(ans)

Submission status: Accepted

Solution code:
n = int(input())
a = [input().split() for _ in range(n)]
marks = ['S', 'H', 'C', 'D']
for i in range(n):
    a[i][1] = int(a[i][1])
a.sort(key=lambda x: marks.index(x[0])*100 + x[1])
for m in marks:
    for n in range(1, 14):
        if [m, n] not in a:
            print(m, n)

Submission status: Accepted

Solution code:
n = int(input())
s = [i for i in range(1, 14)]
h = s[:]
c = s[:]
d = s[:]

for i in range(n):
    a, b = input().split()
    if a == 'S':
        s.remove(int(b))
    elif a == 'H':
        h.remove(int(b))
    elif a == 'C':
        c.remove(int(b))
    else:
        d.remove(int(b))

if s:
    for i in s:
        print('S {}'.format(i))
if s:
    for i in h:
        print('H {}'.format(i))
if s:
    for i in c:
        print('C {}'.format(i))
if s:
    for i in d:
        print('D {}'.format(i))

Submission status: Accepted

Solution code:
n = int(input())
suits = ('S', 'H', 'C', 'D')
cards = dict(zip(suits, [[]]*4))
for i in range(n):
    card = input().split()
    cards[card[0]] = cards[card[0]] + [int(card[1])]
a_suit = list(range(1, 14))
for k in suits:
    temp = a_suit[:]
    for c in cards[k]:
        temp.remove(c)
    cards[k] = temp
for s in suits:
    for i in range(len(cards[s])):
        print(s, cards[s][i])

Submission status: Accepted

Solution code:
#! python3
# findingMissingCards.py - 見つからなかったカードを出力するプログラム

# 全体のカードセットの辞書をつくる
cards = {}

marks = ['S', 'H', 'C', 'D']

for mark in marks:
  cards.setdefault(mark, [])
  for i in range(13):
    cards[mark].append(i + 1)

# print(cards)

# 入力されるカードの数を受け取る
number_of_cards = int(input())

# 入力されたカードを、全体のカードセットから削除する
for c in range(number_of_cards):
  card = input().split()
  card_mark = card[0]
  card_num = int(card[1])
  if card_num in cards[card_mark]:
    cards[card_mark].remove(card_num)

# print(cards)

# 残りのカードセットを（SHCDの順で出力する）
for mark in marks:
  each_mark_sets = cards[mark]
  for c in each_mark_sets:
    print(mark, c)

Submission status: Accepted

Solution code:
category = ['S','H','C','D']
 
table = [[False]*14 for i in range(4)]
 
N = int(input())
 
for loop in range(N):
 
    mark,num = input().split()
    num = int(num)
 
    if mark == 'S':
        table[0][num] = True
    elif mark == 'H':
        table[1][num] = True
    elif mark == 'C':
        table[2][num] = True
    else:
        table[3][num] = True
 
for i in range(4):
    for k in range(1,14):
        if table[i][k] == False:
            print("%s %d"%(category[i],k))