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:
n = int(input())

cards = [False] * 52

for i in range(0, n):
  l = input().split()
  mark, num = l[0], int(l[1])
  if mark == 'S':
    cards[num-1] = True
  elif mark == 'H':
    cards[num-1+13] = True
  elif mark == 'C':
    cards[num-1+26] = True
  elif mark == 'D':
    cards[num-1+39] = True

for i in range(52):
  if cards[i] == True:
    continue
  elif i < 13:
    print('S {}'.format(i+1))
  elif i < 26:
    print('H {}'.format(i+1-13))
  elif i < 39:
    print('C {}'.format(i+1-26))
  elif i < 52:
    print('D {}'.format(i+1-39))

Submission status: Accepted

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

def symbolToNum(symbol):
    if symbol == 'S':
        return 0
    elif symbol == 'H':
        return 1
    elif symbol == 'C':
        return 2
    elif symbol == 'D':
        return 3

def symbolFromNum(num):
    if num == 0:
        return 'S'
    elif num == 1:
        return 'H'
    elif num == 2:
        return 'C'
    elif num == 3:
        return 'D'

for i in range(n):
    symbol, number = input().split()
    cards[symbolToNum(symbol)][int(number) - 1] = 1

for i in range(4):
    for ii in range(13):
        if cards[i][ii] == 0:
            print(symbolFromNum(i), ii + 1)

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())
# i,j = 0, 0
# while i < n:
for i in range(n):
    a,b = input().split()
    rank = int(b)
    if a=='S':a=0
    elif a=='H':a=1
    elif a=='C':a=2
    else: a=3
    cards[a][rank-1]=True
    # i =+1
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:
card_list=[[],[],[],[]]
pattern = ["S", "H", "C", "D"]
n=int(input())
for i in range(n):
    card,num=input().split(" ")
    num=int(num)
    card_list[pattern.index(card)].append(num)

#print(card_list)
#print("ans")
#print()

for i,card in enumerate(card_list):
    missing=set(range(1,14))-set(card)
    #print(missing)
    for num in sorted(missing):
        print(pattern[i],num)

Submission status: Accepted

Solution code:
N=int(input())
S=[1,2,3,4,5,6,7,8,9,10,11,12,13]
H=[1,2,3,4,5,6,7,8,9,10,11,12,13]
C=[1,2,3,4,5,6,7,8,9,10,11,12,13]
D=[1,2,3,4,5,6,7,8,9,10,11,12,13]
for i in range(N):
    L=list(map(str,input().split()))
    
    if L[0]=="S":
        S.remove(int(L[1]))
    elif L[0]=="H":
        H.remove(int(L[1]))
    elif L[0]=="C":
        C.remove(int(L[1]))
    else:
        D.remove(int(L[1]))
for i in S:
    print("S",i)
for j in H:
    print("H",j)
for k in C:
    print("C",k)
for z in D:
    print("D",z)

Submission status: Accepted

Solution code:
def create_deck():
    marks = ["S","H","C","D"]
    deck = []
    for mark in marks:
        thirteen = [{mark:str(i+1)} for i in range(13)]
        deck.append(thirteen)
    return deck

li = create_deck()
n = int(input())

for i in range(n):
    mark,num = [x for x in input().split()]
    if mark == "S":
        li[0].remove({mark:num})
    if mark == "H":
        li[1].remove({mark:num})
    if mark == "C":
        li[2].remove({mark:num})
    if mark == "D":
        li[3].remove({mark:num})

for j in range(len(li)):
    for it in li[j]:
        for k,v in it.items():
            print(k,v)

Submission status: Accepted

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

for _ in range(n):
    x, y = input().split()
    cards[pattern.index(x)][int(y)-1] = True

for i in range(4):
    for j in range(13):
        if not cards[i][j]:
            print(pattern[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"]

n = int(input())

for k in range (n):
    ch,rank = input().split()
    cards[pattern.index(ch)][int(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:
pattern = ['S', 'H', 'C', 'D']

trump_flag = [[False] * 4 for i in range(13)]

num = int(input())

for i in range(num):
    trump = input().split()
    for j in range(4):
        if pattern[j] == trump[0]:
            pattern_index = j
    trump_flag[int(trump[1]) - 1][pattern_index] = True

for i in range(4):
    for j in range(13):
        if trump_flag[j][i] == False:
            print(f'{pattern[i]} {j+1}')

Submission status: Accepted

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

for i in range(4):
    for j in range(13):
        if cards[i][j] ==0:
            if i ==0:
                sor = "S"
            elif i ==1:
                sor ="H"
            elif i ==2:
                sor = "C"
            else :
                sor = "D"
            print(sor,j+1)

Submission status: Accepted

Solution code:
N = int(input())
S = [i for i in range(1, 14)]
H = [i for i in range(1, 14)]
C = [i for i in range(1, 14)]
D = [i for i in range(1, 14)]

for n in range(N):
    suit, num = input().split()
    num = int(num)
    if suit == 'S': S.remove(num)
    if suit == 'H': H.remove(num)
    if suit == 'C': C.remove(num)
    if suit == 'D': D.remove(num)

for s in S: print('S', s)
for h in H: print('H', h)
for c in C: print('C', c)
for d in D: print('D', d)

Submission status: Accepted

Solution code:
base_num = input()
a = int(base_num)
end_num = 0

suit_list = []
while True:
    base_suit = input()
    suit_list.append(base_suit)

    end_num += 1
    if a == end_num:
        break

master_list = [("{} {}".format(x,y)) for x in ['S','H','C','D'] for y in (x + 1 for x in range(13))]

for p in suit_list:
    master_list.remove(p)

for m in master_list:
    print(m)

Submission status: Accepted

Solution code:
n = int(input())
S_cards = []
H_cards = []
C_cards = []
D_cards = []

for _ in range(n):
    card = input()
    if card[0] == "S":
        S_cards.append(card[2:])
    elif card[0] == "H":
        H_cards.append(card[2:])
    elif card[0] == "C":
        C_cards.append(card[2:])
    else:
        D_cards.append(card[2:])

for j in range(1,14):
    if str(j) not in S_cards:
        print("{} {}".format("S",j))
        
for j in range(1,14):
    if str(j) not in H_cards:
        print("{} {}".format("H",j))
        
for j in range(1,14):
    if str(j) not in C_cards:
        print("{} {}".format("C",j))
        
for j in range(1,14):
    if str(j) not in D_cards:
        print("{} {}".format("D",j))

Submission status: Accepted

Solution code:
n = int(input())
data = []
cnt = 0
while True:
    patt, num = map(str, input().split())
    data.append([patt, num])
    cnt += 1
    if cnt == n:
        break


s = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
h = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
c = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
d = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
for i in range(len(data)):
    if data[i][0] == 'S':
        s.remove(int(data[i][1]))
    
    elif data[i][0] == 'H':
        h.remove(int(data[i][1]))
    
    elif data[i][0] == "C":
        c.remove(int(data[i][1]))
    
    else:
        d.remove(int(data[i][1]))

for i in range(len(s)):
    print("S", s[i])

for i in range(len(h)):
    print("H", h[i])

for i in range(len(c)):
    print("C", c[i])

for i in range(len(d)):
    print("D", d[i])

Submission status: Accepted

Solution code:
marks = ["S","H","C","D"]
deck = dict()
for mark in marks:
    deck.setdefault(mark, dict())
    for i in range(1, 14):
        deck[mark].setdefault(i, False)

for i in range(int(input())):
    mark,number = input().split()
    number = int(number)
    deck[mark][number] = True

for mark in marks:
    for i in range(1, 14):
        if not deck[mark][i]:
            print(f"{mark} {i}")

Submission status: Accepted

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

num = int(input())

for count in range(num):
    list = input().split()
    if list[0] == 'S':
        x = int(list[1])
        tbl[0][x-1] = 1
    if list[0] == 'H':
        x = int(list[1])
        tbl[1][x-1] = 1
    if list[0] == 'C':
        x = int(list[1])
        tbl[2][x-1] = 1
    if list[0] == 'D':
        x = int(list[1])
        tbl[3][x-1] = 1

for i, row in enumerate(tbl):
    for j, elem in enumerate(row):
        if tbl[i][j] == 0:
            if i == 0:
                print("S", end = " ")
                print(j+1)
            if i == 1:
                print("H", end = " ")
                print(j+1)
            if i == 2:
                print("C", end = " ")
                print(j+1)  
            if i == 3:
                print("D", end = " ")
                print(j+1)

Submission status: Accepted

Solution code:
c={
    'S':[0]*13,
    'H':[0]*13,
    'C':[0]*13,
    'D':[0]*13
}
n=int(input())
for i in range(n):
    s,num=input().split()
    c[s][int(num)-1]=1
for i in["S","H","C","D"]:
    for j in range(13):
        if c[i][j]==0:
            print(i,j+1)

Submission status: Accepted

Solution code:
n = int(input())
s, h, c, d = {}, {}, {}, {}

i = 1
while i <= 13:
    s[i], h[i], c[i], d[i] = 0, 0, 0, 0
    i += 1

i = 0
while n != i:
    card = input().split()
    if card[0] == "S":
        s[int(card[1])] = int(card[1])
    elif card[0] == "H":
        h[int(card[1])] = int(card[1])
    elif card[0] == "C":
        c[int(card[1])] = int(card[1])
    elif card[0] == "D":
        d[int(card[1])] = int(card[1])
    i += 1

i = 1
while i <= 13:
    if i != s[i]:
        print("S {}".format(i))
    i += 1
i = 1
while i <= 13:
    if i != h[i]:
        print("H {}".format(i))
    i += 1
i = 1
while i <= 13:
    if i != c[i]:
        print("C {}".format(i))
    i += 1
i = 1
while i <= 13:
    if i != d[i]:
        print("D {}".format(i))
    i += 1

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
line1 = int(input())
cards = [[False for i in range(13)]for j in range(4)]
pattern = ["S","H","C","D"]
for i in range(line1):
    date = input().split()
    ch = date[0]
    rank = int(date[1])
    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:
N=int(input())
spe=[1,2,3,4,5,6,7,8,9,10,11,12,13]
har=[1,2,3,4,5,6,7,8,9,10,11,12,13]
clo=[1,2,3,4,5,6,7,8,9,10,11,12,13]
dia=[1,2,3,4,5,6,7,8,9,10,11,12,13]
for n in range(N):
    sur,num=input().split()
    num=int(num)
    if sur=="S":
        for i in range(len(spe)):
            if num==spe[i]:
                spe.remove(num)
                break
    elif sur=="H":
        for i in range(len(har)):
            if num==har[i]:
                har.remove(num)
                break
    elif sur=="C":
        for i in range(len(clo)):
            if num==clo[i]:
                clo.remove(num)
                break
    elif sur=="D":
        for i in range(len(dia)):
            if num==dia[i]:
                dia.remove(num)
                break
for sp in spe:
    print("S"+" "+str(sp))
for ha in har:
    print("H"+" "+str(ha))
for cl in clo:
    print("C"+" "+str(cl))
for di in dia:
    print("D"+" "+str(di))

Submission status: Accepted

Solution code:
cards = [[False for x in range(13)] for y in range(4)]
taio = {"S":0, "H":1, "C":2, "D":3}
pat=["S", "H", "C", "D"]
a = int(input())
for i in range(a):
    m, v= input().split()
    cards[int(taio[m])][int(v)-1] = True
for i in range(4):
    for j in range(13):
        if cards[i][j] == False:
            print (f"{pat[i]} {j+1}")

Submission status: Accepted

Solution code:
cardset_S=[i for i in range(1,14)]
cardset_H=[i for i in range(1,14)]
cardset_C=[i for i in range(1,14)]
cardset_D=[i for i in range(1,14)]

card_num=int(input())
for i in range(card_num):
    card=input().split()
    if card[0]=='S':
        cardset_S.remove(int(card[1]))
    elif card[0]=='H':
        cardset_H.remove(int(card[1]))
    elif card[0]=='C':
        cardset_C.remove(int(card[1]))
    else:
        cardset_D.remove(int(card[1]))
for i in cardset_S:
    print('S {}'.format(i))
for i in cardset_H:
    print('H {}'.format(i))
for i in cardset_C:
    print('C {}'.format(i))
for i in cardset_D:
    print('D {}'.format(i))

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):
    ch, rank = input().split()
    cards[pattern.index(ch)][int(rank)-1] = True

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
n = int(input())
a = []
b = []
for sig in ["S", "H", "C", "D"]:
    for num in range(1, 14):
        a.append([sig, num])
for i in range(n):
    p, q= input().split()
    q = int(q)
    b.append([p, q])
for i in range(13*4):
    if not (a[i] in b):
        print(*a[i])

Submission status: Accepted

Solution code:
import sys

n = sys.stdin.readline()
S = [1]*13
H = [1]*13
C = [1]*13
D = [1]*13

for e in sys.stdin:
    inp = list(e.split())
    suit = inp[0]
    num = int(inp[1])
    if suit == "S":
        S[num-1] = 0
    elif suit == "H":
        H[num-1] = 0
    elif suit == "C":
        C[num-1] = 0
    elif suit == "D":
        D[num-1] = 0
        
for i in range(13):
    if S[i] == 1:
        print("S " + str(i+1))

for i in range(13):
    if H[i] == 1:
        print("H " + str(i+1))

for i in range(13):
    if C[i] == 1:
        print("C " + str(i+1))

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

Submission status: Accepted

Solution code:
S=[0]*13
H=[0]*13
C=[0]*13
D=[0]*13
n=int(input())
for _ in range(n):
  a,b=input().split()
  if a=="S":S[int(b)-1]=1
  if a=="H":H[int(b)-1]=1
  if a=="C":C[int(b)-1]=1
  if a=="D":D[int(b)-1]=1
for i in range(13):
  if S[i]==0:print("S",i+1)
for i in range(13):
  if H[i]==0:print("H",i+1)
for i in range(13):
  if C[i]==0:print("C",i+1)
for i in range(13):
  if D[i]==0:print("D",i+1)

Submission status: Accepted

Solution code:
n = int(input())
d = {}

while n > 0:
    M, N = map(str,input().split())
    if M in d:
        d[M].append(int(N))
    else:
        d[M] = [int(N)]

    n -= 1

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

for m in mark:
    L = [i for i in range(1,14) if i not in d[m]]

    for l in L:
        print(m,l)

Submission status: Accepted

Solution code:
def main():
  c = {
      'S': [0]*13,
      'H': [0]*13,
      'C': [0]*13,
      'D': [0]*13
  }
  N = int(input())
  for i in range(N):
      s, num = input().split()
      c[s][int(num)-1] = 1
  for i in["S", "H", "C", "D"]:
      for j in range(13):
          if c[i][j] == 0:
              print(i, j+1)

if __name__ == '__main__':
  main()

Submission status: Accepted

Solution code:
num_s = [1,2,3,4,5,6,7,8,9,10,11,12,13]
num_h = [1,2,3,4,5,6,7,8,9,10,11,12,13]
num_c = [1,2,3,4,5,6,7,8,9,10,11,12,13]
num_d = [1,2,3,4,5,6,7,8,9,10,11,12,13]

n = int(input())
for i in range(n):
	suits, number = map(str, input().split())
	if suits == "S":
		num_s.remove(int(number))
	if suits == "H":
		num_h.remove(int(number))
	if suits == "C":
		num_c.remove(int(number))
	if suits == "D":
		num_d.remove(int(number))

if not num_s:
	pass
else:
	for i_s in num_s:
		print("S %d" % (i_s))

if not num_h:
	pass
else:
	for i_h in num_h:
		print("H %d" % (i_h))

if not num_c:
	pass
else:
	for i_c in num_c:
		print("C %d" % (i_c))

if not num_d:
	pass
else:
	for i_d in num_d:
		print("D %d" % (i_d))

Submission status: Accepted

Solution code:
cards = list()
suit = ['S', 'H', 'C', 'D']
n = int(input())
for i in range(n):
    s,r = input().split()
    r = int(r)
    if s == "S": cards.append(0 + r)
    elif s == "H": cards.append(13 + r)
    elif s == "C": cards.append(26 + r)
    elif s == "D": cards.append(39 + r)
for i in range(1,53):
    if not (i in cards):
        print(suit[(i-1)//13], (i-1)%13+1)

Submission status: Accepted

Solution code:
# カードを記録する二次元配列を定義。持っていない＝Falseとしてデフォルト定義
cards = [[False for i in range(13)] for j in range(4)]
pattern = ["S", "H" ,"C", "D"]

# input情報から手元にあるカードをTrueとして記録する
n = int(input())
for s in range(n):
    cd, rank = map(str, input().split())
    cards[pattern.index(cd)][int(rank)-1] = True

# 手元にない（False）のカードを出力
for j in range(4):
    for i in range(13):
        if cards[j][i] == False:
            print(pattern[j], i+1)

Submission status: Accepted

Solution code:
n = int(input())
marks = []
markd = []
markc = []
markh = []

for i in range(n):
    mark, number = input().split()
    if mark == 'S':
        marks.append(number)
    elif mark == 'D':
        markd.append(number)
    elif mark == 'C':
        markc.append(number)
    else:
        markh.append(number)

for i in range(1, 14, 1):
    nums = str(i)
    if nums not in marks:
        print('S', nums)

for i in range(1, 14, 1):
    numh = str(i)
    if numh not in markh:
        print('H', numh)

for i in range(1, 14, 1):
    numc = str(i)
    if numc not in markc:
        print('C', numc)
        
for i in range(1, 14, 1):
    numd = str(i)
    if numd not in markd:
        print('D', numd)

Submission status: Accepted

Solution code:
tbl=[[False for i in range(13)] for j in range(4)]
mark=["S","H","C","D"]
n=int(input())
for i in range(n):
    x,y=input().split()
    y=int(y)

    tbl[mark.index(x)][y-1]=True

for i in range(4):
    for j in range(13):
        if tbl[i][j]==False:
            if i==0:
                str="S"
            elif i==1:
                str="H"
            elif i==2:
                str="C"
            elif i==3:
                str="D"
            print(str,end=" ")
            print(j+1)

Submission status: Accepted

Solution code:
n = int(input())
deck = []
for i in range(n):
    deck.append(input())

for suit in 'SHCD':
    for i in range(1, 14):
        card = f'{suit} {i}'
        if card not in deck:
            print(card)

Submission status: Accepted

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

for k in range(n):
    mark,num = map(str, input().split())
    if mark == 'S': tbl[0][int(num) - 1] = 1
    elif mark == 'H': tbl[1][int(num) - 1] = 1
    elif mark == 'C': tbl[2][int(num) - 1] = 1
    elif mark == 'D': tbl[3][int(num) - 1] = 1
    
for i in range(4):
    for j in range(13):
        if tbl[i][j] == 0:
            if i == 0: print('S', j + 1)
            elif i == 1: print('H', j + 1)
            elif i == 2: print('C', j + 1)
            elif i == 3: print('D', j + 1)

Submission status: Accepted

Solution code:
n = int(input())
s = [i for i in range(1,14)]
h = [i for i in range(1,14)]
c = [i for i in range(1,14)]
d = [i for i in range(1,14)]
for i in range(n):
    m = input().split()
    if m[0] == "S":
        s.remove(int(m[1]))
    elif m[0] == "H":
        h.remove(int(m[1]))
    elif m[0] == "C":
        c.remove(int(m[1]))
    else:
        d.remove(int(m[1]))
for i in s:
    print("S",i)
for i in h:
    print("H",i)
for i in c:
    print("C",i)
for i in d:
    print("D",i)

Submission status: Accepted

Solution code:
suits = ["S", "H", "C", "D"]
cards = []
for suit in suits:
    for i in range(1, 14):
        cards.append("{} {}".format(suit, i))

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

for card in cards:
    print(card)

Submission status: Accepted

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


n = int(input())
for _ in range(n):
    egara, number = input().split()
    TRUMP[DIC_TYPE[egara]].remove(int(number))

# ↑削除 ↓表示

for key, value in DIC_TYPE.items():
    for i in range(len(TRUMP[value])):
        print( key + " " + str(TRUMP[value][i]) )

Submission status: Accepted

Solution code:
N = int(input())

list1 = [i for i in range(1, 14)]

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

mylist = []


for n in range(N):
    a, b = input().split()
    b = int(b)
    if a == 'S':
        S.append(b)
    elif a == 'H':
        H.append(b)
    elif a == 'C':
        C.append(b)
    elif a == 'D':
        D.append(b)

for i in list1:
    if i not in S:
        mylist.append("S {}".format(i))

for i in list1:
    if i not in H:
        mylist.append("H {}".format(i))

for i in list1:
    if i not in C:
        mylist.append("C {}".format(i))

for i in list1:
    if i not in D:
        mylist.append("D {}".format(i))

for q in mylist:
    print(q)

Submission status: Accepted

Solution code:
N = int(input())
cards = [list(input().split()) for _ in range(N)]
marks = ['S','H','C','D']

for mark in marks:
    for num in range(13):
        num += 1
        checknum = [mark,str(num)]
        if checknum not in cards:
            print(' '.join(checknum))

Submission status: Accepted

Solution code:
n = int(input())
tbl = [[False for i in range(13)] for j in range(4)]
for i in range(n):
    mark,num = input().split()
    number = int(num)
    if mark == 'S':
      tbl[0][number-1] = True
    elif mark == 'H':
      tbl[1][number-1] = True
    elif mark == 'C':
      tbl[2][number-1] = True
    else:
      tbl[3][number-1] = True
      
for j in range(4):
  for i in range(13):
    if tbl[j][i] == False:
      if j == 0:
        print(f'S {i+1}')
      if j == 1:
        print(f'H {i+1}')
      if j == 2:
        print(f'C {i+1}')
      if j == 3:
        print(f'D {i+1}')

Submission status: Accepted

Solution code:
n=int(input())
s=[]
h=[]
c=[]
d=[]
for i in range (0,n):
    a,b=input().split()
    b=int(b)
    if a=="S":
        s.append(b)
    if a=="H":
        h.append(b)
    if a=="C":
        c.append(b)
    if a=="D":
        d.append(b)
for i in range(1,14):
  if not (i in s):
    print("S",i)
for i in range(1,14):
    for j in range(0,len(h)):
        if i==h[j]:
            break
        elif j==len(h)-1:
            print("H",i)
for i in range(1,14):
    for j in range(0,len(c)):
        if i==c[j]:
            break
        elif j==len(c)-1:
            print("C",i)
for i in range(1,14):
    for j in range(0,len(d)):
        if i==d[j]:
            break
        elif j==len(d)-1:
            print("D",i)

Submission status: Accepted

Solution code:
n = int(input())
S = []
H = []
C = []
D = []

for i in range(n):
    mark, number = (x for x in input().split())
    if(mark == "S"): S.append(int(number))
    elif(mark == "H"): H.append(int(number))
    elif(mark == "C"): C.append(int(number))
    elif(mark == "D"): D.append(int(number))

for mark in ["S", "H", "C", "D"]:
    for number in range(1, 14):
        if(mark == "S" and (number in S) == False): print("S", number)
        if(mark == "H" and (number in H) == False): print("H", number)
        if(mark == "C" and (number in C) == False): print("C", number)
        if(mark == "D" and (number in D) == False): print("D", number)

Submission status: Accepted

Solution code:
n = int(input())
R = ['S', 'H', 'C', 'D']
T = {'S': [True]*13, 'H': [True]*13, 'C': [True]*13, 'D': [True]*13}
for i in range(n):
    M, N = input().split()
    T[M][int(N)-1] = False
for r in R:
    for j, a in enumerate(T[r], 1):
        if a:
            print(r, j)

Submission status: Accepted

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

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):
    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:
n = int(input())
i = 0
se = set()
while i < n:
    se.add(input())
    i += 1

for suit in ['S','H','C','D']:
    for rank in range(1,14):
        if suit + ' ' + str(rank) not in se:
            print(suit,rank)

Submission status: Accepted

Solution code:
card ={'S': [0]*13,
        'H': [0]*13,
        'C': [0]*13,
        'D': [0]*13
}

n = int(input())

for i in range(1,n+1):
    m,num = input().split()
    num = int(num)
    card[m][num-1] =1

for c in ["S","H","C","D"]:
    for j in range(1,13+1):
        if (card[c][j-1]==0):
            print(c,str(j))

Submission status: Accepted

Solution code:
def lack(S,A):
    for i in range(1,14):
        if not A[i]:
            print(S,i)

N = int(input())
S = [0]*15
H = [0]*15
C = [0]*15
D = [0]*15

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

lack("S",S)
lack("H",H)
lack("C",C)
lack("D",D)

Submission status: Accepted

Solution code:
cards = [[False for i in range(13)] for ii in range(4)]
sort_name = ["S", "H", "C", "D"]
n = int(input())
for i in range(n):
    sort , rank = input().split()
    if sort == "S":
        cards[0][int(rank)-1] = True
    elif sort == "H":
        cards[1][int(rank)-1] = True
    elif sort == "C":
        cards[2][int(rank)-1] = True
    else:
        cards[3][int(rank)-1] = True
for i in range(4):
    for ii in range(13):
        if not cards[i][ii]:
            print(sort_name[i], ii+1)

Submission status: Accepted

Solution code:
n = int(input())
s_list = []
h_list = []
c_list = []
d_list = []
for i in range(n):
	v = input().split()
	mark = v[0]
	num = int(v[1])
	if mark == 'S':
		s_list.append(num)		
	elif mark == 'H':
		h_list.append(num)
	elif mark == 'C':
		c_list.append(num)
	else:
		d_list.append(num)
nums = list(range(1, 14))
for n in nums:
	if not n in s_list: 
		print('S', n)
for n in nums:
	if not n in h_list:
		print('H', n)
for n in nums:
	if not n in c_list: 
		print('C', n)
for n in nums:
	if not n in d_list: 
		print('D', n)

Submission status: Accepted

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

for i, row in enumerate(pat):
    for j, val in enumerate(row):
        if val:
            continue
        else:
            if i==0:
                print('S', j+1)
            elif i==1:
                print('H', j+1)
            elif i==2:
                print('C', j+1)
            elif i==3:
                print('D', j+1)

Submission status: Accepted

Solution code:
n = int(input())
num_S = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
num_H = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
num_C = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
num_D = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]

for i in range(n):
    K_l = input().split()
    if   K_l[0] == "S":
        num_S.remove(int(K_l[1]))
    elif K_l[0] == "H":
        num_H.remove(int(K_l[1]))
    elif K_l[0] == "C":
        num_C.remove(int(K_l[1]))
    else:
        num_D.remove(int(K_l[1]))
for i in num_S:
    print("S", i)
for i in num_H:
    print("H", i)
for i in num_C:
    print("C", i)
for i in num_D:
    print("D", i)

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    t = [[i for i in range(1,14)] for _ in range(4)]
    S = "SHCD"
    
    for _ in range(n):
        s,r = input().split()
        t[S.find(s)].remove(int(r))
    
    for i,v in enumerate(S):
        for r in t[i]:
            print(v + " " + str(r))


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n=int(input())
i=1
S=[1,2,3,4,5,6,7,8,9,10,11,12,13]
H=[1,2,3,4,5,6,7,8,9,10,11,12,13]
C=[1,2,3,4,5,6,7,8,9,10,11,12,13]
D=[1,2,3,4,5,6,7,8,9,10,11,12,13]

def delete(l_name,num):
    if l_name=="S":
        del S[S.index(int(num))]
    if l_name=="H":
        del H[H.index(int(num))]
    if l_name=="C":
        del C[C.index(int(num))]
    if l_name=="D":
        del D[D.index(int(num))]

while i<=n:
    l_name,num=input().split()
    delete(l_name,num)
    i+=1
for s_n in range(len(S)):
    print("S "+str(S[s_n]))
for h_n in range(len(H)):
    print("H "+str(H[h_n]))
for c_n in range(len(C)):
    print("C "+str(C[c_n]))
for d_n in range(len(D)):
    print("D " + str(D[d_n]))

Submission status: Accepted

Solution code:
num = list(range(1, 53))
n = int(input())
x = 0
cards = []

while x < n:
    have = input().split()
    have[1] = int(have[1])
    
    if have[0] == "S":
        cards.append(have[1])
        
    elif have[0] == "H":
        cards.append(have[1] + 13)
    
    elif have[0] == "C":
        cards.append(have[1] + 26)
        
    else:
        cards.append(have[1] + 39)
        
    x += 1
        
for i in num:
    if i not in cards:
        if i > 39:
            print(f"D {i - 39}")
            
        elif i > 26:
            print(f"C {i - 26}")
            
        elif i > 13:
            print(f"H {i - 13}")
            
        else:
            print(f"S {i}")

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):
    a,b = input().split()
    cards[pattern.index(a)][int(b)-1] = True
for i in range(4):
    for j in range(13):
        if cards[i][j] == False:
            print(f'{pattern[i]} {j+1}')