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: Runtime Error

Solution code:
r=range
v=input
l = [[i for i in r(1,14)] for j in r(4)]
d={"S":0,"H":1,"C":2,"D":3}
n={0:"S",1:"H",2:"C",3:"D"}
for i in r(int(v())):
    x,y = v().split()
    l[d[x]].remove(int(y))
for i in l:
    for k in i:
        print(n[i],k)

Submission status: Runtime Error

Solution code:
r=range
v=input
l = [[i for i in r(1,14)] for j in r(4)]
d={"S":0,"H":1,"C":2,"D":3}
n={0:"S",1:"H",2:"C",3:"D"}
for i in r(int(v())):
    x,y = v().split()
    l[d[x]].remove(int(y))
for i in l:
    for k in i:
        print(n[index(i)],k)

Submission status: Runtime Error

Solution code:
r=range
v=input()
l=[i+" "+str(j)for i in"SHCD" for j in r(1,14)]
for i in r(int(v):l.remove(v)
for i in l:print(i)

Submission status: Runtime Error

Solution code:
r=range
v=input()
l=[i+" "+str(j)for i in"SHCD" for j in r(1,14)]
for i in r(int(v):l.remove(v))
for i in l:print(i)

Submission status: Runtime Error

Solution code:
fullcards={
    "S":set(range(1,14)),
    "H":set(range(1,14)),
    "C":set(range(1,14)),
    "D":set(range(1,14))
    }
cards={
    "S":set({}),
    "H":set({}),
    "C":set({}),
    "D":set({})
    }
for i in range(n):
    line=input()
    suit,rank=line.split()
    rank=int(rank)
    cards[suit].add(rank)
for s in ['S','H','C','D']:
    for r in fullcards[s]-cards[s]:
        print('%s %d' % (s,r))

Submission status: Runtime Error

Solution code:
fullcards={
    "S":set(range(1,14)),
    "H":set(range(1,14)),
    "C":set(range(1,14)),
    "D":set(range(1,14))
    }
cards={
    "S":set({}),
    "H":set({}),
    "C":set({}),
    "D":set({})
    }
while True:
    for i in range(n):
        line=input()
        suit,rank=line.split()
        rank=int(rank)
        cards[suit].add(rank)
    for s in ['S','H','C','D']:
        for r in fullcards[s]-cards[s]:
            print('%s %d' % (s,r))

Submission status: Runtime Error

Solution code:
import itertools
s=['S','H','C','D']
n=range(1,14)
c=[x y for x,y in itertools.product(s,n)]
for _ in range(input()):
 c.remove(input())
print(*c)

Submission status: Runtime Error

Solution code:
import itertools
s=['S','H','C','D']
n=[i for i in range(1,14)]
c=[x y for x,y in itertools.product(s,n)]
for _ in range(input()):
 c.remove(input())
print(*c)

Submission status: Runtime Error

Solution code:
import itertools
s=['S','H','C','D']
n=[str(i) for i in range(1,14)]
c=[x+' '+y for x,y in itertools.product(s,n)]
for _ in range(input()):
 c.remove(input())
print(*c)

Submission status: Runtime Error

Solution code:
import itertools
s=['S','H','C','D']
n=[str(i) for i in range(1,14)]
c=[x+' '+y for x,y in itertools.product(s,n)]
for _ in range(input()):
 c.remove(str(input()))
print(*c)

Submission status: Runtime Error

Solution code:
import itertools
s=['S','H','C','D']
n=[str(i) for i in range(1,14)]
c=[x+' '+y for x,y in itertools.product(s,n)]
for _ in range(input()):
 c.remove(input())
print('\n'.join(c))

Submission status: Runtime Error

Solution code:
c=[x+' '+y for x in'SHCD'for y in range(1,14)
for _ in range(int(input())):c.remove(input())
print('\n'.join(c))

Submission status: Runtime Error

Solution code:
c=[x+' '+y for x in'SHCD'for y in range(1,14)
for _ in range(int(input())):
 c.remove(input())
print('\n'.join(c))

Submission status: Runtime Error

Solution code:
c=[x+' '+y for x in'SHCD'for y in range(1,14)]
for _ in range(int(input())):
 c.remove(input())
print('\n'.join(c))

Submission status: Runtime Error

Solution code:
'''
?????????????????????
??????????????¨??????????????\?????????
???????????????????????¨????????????
??????????????????
????????????????????£????¶????????????°???????????????????????????
?¬????????????????????????°??????1??\????????????
??????????????¨?????????????????????????????????????????¨??????????????°????????????????????????
??????1??\???????????°??????????????????????¬???????????????¨???????????????
???????????£?????????????????¨??????????????\?????????
??£?????¨??????????????????????????????
??????????????????????????????????????£????????????????????\?????§??§????????????
??????????????????????????????????????????????????§????????°??§????????????
??§?????£?????¨?????§?????£?????????????????´??????

??£?????¨?????§?????¶??????????????????????????????????´????
????????????????????????????????°??????????????????
????????????????????£???????????°?????????????????????1????????§???????????°?¶????????????°??????
?????????????????\???????????????????´????
?????????4???????????¶??????????????????????????????

??°??????????????£???int????????????
??°???????????????????????¨???????????????????´??????????????????¨?????????????????????????¶??????°????????????

??????2??\????????????????????´???????????????????????????
'''


import re

#eCard = ['S 1', 'S 5', 'H 1', 'D 2', 'C 8', 'S 13']

n = int(input())
i = 0
while i < n:
    eCard.append(input())
    i += 1

#print(eCard)
#???????????????????????£?????¨?????§????´¢???????????????
S = []
H = []
D = []
C = []

missingS = []
missingH = []
missingD = []
missingC = []


def assortSuit(s, sc):
    i = 0

#??????????????????????????¢?????\?????????????????????
    while i < int(len(eCard)):
        if re.match(s, eCard[i]):
            Smatch = re.search('\d+', eCard[i])
            sc.append(int(Smatch.group()))#????????????????????????????????£?????????????????¨???????????°???????????????
        i += 1

#S = re.search(???^S.*???, eCard)
assortSuit('^S', S)
assortSuit('^H', H)
assortSuit('^D', D)
assortSuit('^C', C)

def selectMissingCards(c, mc):
    c.sort()
#???????????°???????°?????????°????????????????????¨???
    smallerC = 1
    while smallerC < c[0]:
        mc.append(smallerC)
        smallerC += 1
        
        
    i = 0

    while i < len(c)-1:
        m = c[i+1] - c[i]
    
        if m > 1:
            h = 1
            while h < m:
                mc.append(c[i]+h)
                h += 1
        i += 1
    largerC = c[i] + 1
    while largerC <= 13:
        mc.append(largerC)
        largerC += 1
        
            

selectMissingCards(S, missingS)
selectMissingCards(H, missingH)
selectMissingCards(D, missingD)
selectMissingCards(C, missingC)

'''
print(missingS)
print(missingH)
print(missingD)
print(missingC)
'''

missingCards = []

def allMissingCards(mc, s):
    #??????????????????????????????????????°?????????????????????????????????????????????????´????
    i = 0
    while i < len(mc):
        missingCards.append(s + str(mc[i]))
        i += 1
    
allMissingCards(missingS, "S ")
allMissingCards(missingH, "H ")
allMissingCards(missingD, "D ")
allMissingCards(missingC, "C ")

#print(missingCards)

i = 0
while i < len(missingCards):
    print(missingCards[i])
    i += 1
    


'''
if S:
    #??°?????????????????????????´????
    
    Scard = re.search(???\d+???, S)#?????????????????????????????????????????£?????¨???????????§?????????????????°??????????????¨???
    SeCard = []
    SeCard.append(int(Scard.group()))
    print(SeCard)
'''

Submission status: Runtime Error

Solution code:
Cards = [
    "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"
]

n = input()

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

for i in range(52 - int(n)):
    print(Cards.pop(0))

Submission status: Runtime Error

Solution code:
#include <iostream>

using namespace std;

int main(){
    int n, card[13*4]={0};

    cin >> n;
    for (int i = 0; i < n; i++) {
        char s;
        int r;
        cin >> s >> r;
        switch (s) {
            case 'S': card[13*0 + r-1] = 1; break;
            case 'H': card[13*1 + r-1] = 1; break;
            case 'C': card[13*2 + r-1] = 1; break;
            case 'D': card[13*3 + r-1] = 1; break;
        }
    }

    for (int i = 0; i < 13*4; i++) {
        if (card[i] > 0) {
            if (i < 13*1)      cout << "S ";
            else if (i < 13*2) cout << "H ";
            else if (i < 13*3) cout << "C ";
            else               cout << "D ";
            cout << i%13+1 << endl;
        }
    }

    return 0;
}

Submission status: Runtime Error

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

card_S = []
card_H = []
card_C = []
card_D = []

while i < n:
	mark, num = input().split()
	if mark == S:
		card_S.append(int(num))
	elif mark == H:
		card_H.append(int(num))
	elif mark == C:
		card_C.append(int(num))
	else:
		card_D.append(int(num))
	i += 1

i = 1
while i < 14:
	if not(i in card_S):
		print("S " + str(i))

i = 1
while i < 14:
	if not(i in card_H):
		print("H " + str(i))

i = 1
while i < 14:
	if not(i in card_C):
		print("C " + str(i))

i = 1
while i < 14:
	if not(i in card_D):
		print("D " + str(i))

Submission status: Runtime Error

Solution code:
'import sys'
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: Runtime Error

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: Runtime Error

Solution code:
import sys
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: Runtime Error

Solution code:
import sys
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: Runtime Error

Solution code:
import sys

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: Runtime Error

Solution code:
import sys

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: Runtime Error

Solution code:
 import sys

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: Runtime Error

Solution code:
cardset = ["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"]
n = input()
while True:
    try:
        cardset.remove(str(input()))
    except ValueError:
        break
for x in cardset:
    print(x)

Submission status: Runtime Error

Solution code:
{

   "source": [
    "d = {\"S\":[1,2,3,4,5,6,7,8,9,10,11,12,13],\n",
    "     \"H\":[1,2,3,4,5,6,7,8,9,10,11,12,13],\n",
    "     \"D\":[1,2,3,4,5,6,7,8,9,10,11,12,13],\n",
    "     \"C\":[1,2,3,4,5,6,7,8,9,10,11,12,13]}\n",
    "n = int(input())\n",
    "for i in range(n):\n",
    "    N, M = map(str,input().split())\n",
    "    d[N][int(M)-1] =\"None\"\n",
    "print(\"Answer\")\n",
    "for j in range(len(d)):\n",
    "    if j==1:\n",
    "        list_d = d[\"S\"]\n",
    "        c = \"S\"\n",
    "    elif j == 2:\n",
    "        list_d = d[\"H\"]\n",
    "        c = \"H\"\n",
    "    elif j == 3:\n",
    "        list_d = d[\"C\"]\n",
    "        c = \"C\"\n",
    "    else:\n",
    "        list_d = d[\"D\"]\n",
    "        c = \"D\"\n",
    "    for i in range(len(list_d)):\n",
    "        if(list_d[i] != \"None\"):\n",
    "            print(c , list_d[i])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "print(d[\"S\"])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "for j in range(len(d)):\n",
    "    if j==1:\n",
    "        list_d = d[\"S\"]\n",
    "    elif j == 2:\n",
    "        list_d = d[\"H\"]\n",
    "    elif j == 3:\n",
    "        list_d = d[\"C\"]\n",
    "    else:\n",
    "        list_d = d[\"D\"]\n",
    "        \n",
    "    for i in range(len(list_d)):\n",
    "        if(list_d[i] != \"None\"):\n",
    "            print(list_d[i])\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "def delete_none(dic):\n",
    "    for k, v in dic.items():\n",
    "        if v is None:\n",
    "            del(dic[k])\n",
    "    return dic\n",
    "#d2 = delete_none(d)\n",
    "print(len(d))\n",
    "for i in range(len(d)):\n",
    "#print(d[\"S\"].remove(None))\n",
    "print(d)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}

Submission status: Runtime Error

Solution code:
d = {"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],
     "D":[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]}
n = int(input())
for i in range(n):
    #N, M = map(str,input().split())
    N, M = map(str,data[i][0].split())
    d[N][int(M)-1] ="None"

for j in range(len(d)):
    if j==1:
        list_d = d["S"]
        c = "S"
    elif j == 2:
        list_d = d["H"]
        c = "H"
    elif j == 3:
        list_d = d["D"]
        c = "D"
    else:
        list_d = d["C"]
        c = "C"
    for i in range(len(list_d)):
        if(list_d[i] != "None"):
            print(c , list_d[i])

Submission status: Runtime Error

Solution code:
n = int(input())
S,H,C,D = [0 for i in range(13)]
for i in range(n):
	data = input().split()
	num = int(data[1])
	if data[0]=='S':
		S[num-1] = 1
	elif data[0]=='H':
		H[num-1] = 1
	elif data[0]=='C':
		C[num-1] = 1
	else:
		D[num-1] = 1
for j in range(13):
	if S[j]==0:
		print('S %d' % (j+1))
for j in range(13):
	if H[j]==0:
		print('H %d' % (j+1))
for j in range(13):
	if C[j]==0:
		print('C %d' % (j+1))
for j in range(13):
	if D[j]==0:
		print('D %d' % (j+1))

Submission status: Runtime Error

Solution code:
n = int(input())

remind = []
for i in range(n):
   remind.append(input())

egara = ["S ", "H ", "C ", "D "]
for i in range(4):
   for j in range(13):
      if egara[i]+ str(j) not in a:
         print(egara[i] + str(j))

Submission status: Runtime Error

Solution code:
n = int(input())

remind = []
for i in range(n):
   remind.append(input())

egara = ["S ", "H ", "C ", "D "]
for i in range(4):
   for j in range(1, 14):
      if egara[i] + str(j) not in a:
         print(egara[i] + str(j))

Submission status: Runtime Error

Solution code:
n = int(input())
egara = ["S ", "H ", "C ", "D "]
remind = []
for i in range(n):
   remind.append(input())

for i in range(4):
   for j in range(1, 14):
      if egara[i] + str(j) not in a:
         print(egara[i] + str(j))

Submission status: Runtime Error

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,14):
        if (card[c][i]==0):
            print(m,str(j))

Submission status: Runtime Error

Solution code:
e=[input()for _ in[0]*int(input())]
for s in"SHCD":
 for r in range(1,14):
  if f'{s} {i}'not in e:print(s,r)

Submission status: Runtime Error

Solution code:
n=int(input())
x={0:'S',1:'H',2:'C',3:'D'}
c=[[0]*13,[0]*13,[0]*13,[0]*13]
for i in range(n):
    a,b=input().split()
    if a=='S':
        c[0].insert(b,b)
    elif a=='H':
        c[1].insert(b,b)
    elif a=='C':
        c[2].insert(b,b)
    else:
        c[3].insert(b,b)
for i in range(4):
    for j in range(13):
        if c[i][j]==0:
            print(x[i],j)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
tramps = {
    "S": [0] * 13,
    "H": [0] * 13,
    "C": [0] * 13,
    "D": [0] * 13
}
# print(tramps)

# 持っているカード
n = int(input())

for i in range(n):
    kind, num = input().split()
    tramps[kind][num - 1] = 1

for i in ["S", "H", "C", "D"]:
    for j in range(13):
        tramp = tramps[i][j]
        if tramp == 0:
            print(tramps)

Submission status: Runtime Error

Solution code:
suits = [('S', 0), ('H', 1), ('C', 2), ('D', 3)]

def tonum(suit):
    for i in range(4):
        if suit == suits[i][0]: return suits[i][1]

def tosuit(num):
    return suits[num][0]

def main():
    n = int(input())
    cards = [i for i in range(52)]
    for i in range(n):
        a = input().split()
        cards.remove(tonum[a[0]] * 13 + int(a[1]))
    cards.reverse()
    for i in cards:
        print(tosuit(i // 13) + " " + (i % 13))
    
        
        







if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
def tonum(suit):
    if suit == 'S': return 0
    if suit == 'H': return 1
    if suit == 'C': return 2
    if suit == 'D': return 3

def tosuit(num):
    suits = ['S', 'H', 'C', 'D']
    return suits[num]

def main():
    n = int(input())
    cards = [i for i in range(52)]
    for i in range(n):
        a = input().split()
        cards.remove(tonum[a[0]] * 13 + int(a[1]))
    cards.reverse()
    for i in cards:
        print(tosuit(i // 13) + " " + (i % 13))

if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
def tonum(suit):
    if suit == 'S': return 0
    if suit == 'H': return 1
    if suit == 'C': return 2
    if suit == 'D': return 3
 
def tosuit(num):
    suits = ['S', 'H', 'C', 'D']
    return suits[num]
 
def main():
    n = int(input())
    cards = [i for i in range(52)]
    for i in range(n):
        a = input().split()
        cards.remove(tonum(a[0]) * 13 + int(a[1]))
    cards.reverse()
    for i in cards:
        print(tosuit(i // 13) + " " + (i % 13))
 
if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
import sys

SUITS = ('S', 'H', 'C', 'D')
cards = {suit:{i for i in range(1, 14)} for suit in SUITS}

input()

for line in sys.stdin:
    suit, number = line.split()
    cards[suit].discard(int(number))

for suit in SUITS:
    for i in cards[suit]:
    print(suit, i)

Submission status: Runtime Error

Solution code:
import sys

SUITS = ('S', 'H', 'C', 'D')
cards = {suit:{i for i in range(1, 14)} for suit in SUITS}

n = input()

for line in sys.stdin:
    suit, number = line.split()
    cards[suit].discard(int(number))

for suit in SUITS:
    for i in cards[suit]:
    print(suit, i)

Submission status: Runtime Error

Solution code:
n = int(input())
card = {
    'S':[False for _ in range(13)],
    'H':[False for _ in range(13)],
    'C':[False for _ in range(13)],
    'D':[False for _ in range(13)]
}
for _ in range(n):
    mark, num = map(int, input().split())
    card[mark][num-1] = True

for mark in "SHCD":
    for num in range(13):
        if card[mark][num] is False:
            print(mark, num+1)

Submission status: Runtime Error

Solution code:
n = int(input())
cards = []
for i in range(1, n):
	s, r = input().split()
	cards.append((s, int(r)))
for s in "SHCD":
	for r in range(1, 14)
		if (s, r)not in cards:
			print(s, r)

Submission status: Runtime Error

Solution code:
import sys
i = 0
x = []
for line in open('test.txt','r'):#sys.stdin:
    if i==0:
        x.append(int(line))
    else:
        s1 = 'SHCD'.index(line[0])
        s2 = int(line[2:])
        x.append((s1,s2))
    i = 1

r4 = range(4)
r13 = range(13)
lx = x.pop(0)
cards = [[0 for i in r13] for j in r4]
for j,i in x: cards[j][i-1] = 1

for j in r4:
    for i in r13:
        if cards[j][i]==0: print 'SHCD'[j],i+1
print

Submission status: Runtime Error

Solution code:
import sys
i = 0
x = []
for line in open('in1.txt','r'):#sys.stdin:
    if i==0:
        x.append(int(line))
    else:
        s1 = 'SHCD'.index(line[0])
        s2 = int(line[2:])
        x.append((s1,s2))
    i = 1

r4 = range(4)
r13 = range(13)
lx = x.pop(0)
cards = [[0 for i in r13] for j in r4]
for j,i in x: cards[j][i-1] = 1

for j in r4:
    for i in r13:
        if cards[j][i]==0: print 'SHCD'[j],str(i+1)
print

Submission status: Runtime Error

Solution code:
r4 = range(4)
r13 = range(13)
cards = [[0 for i in r13] for j in r4]
while True:
    n = inpur()
    for i in range(n):
        s1, s2 = raw_input().split()
        s1 = 'SHCD'.index(s1)
        s2 = int(s2)-1
        cards[s1][s2] = 1

for j in r4:
    for i in r13:
        if cards[j][i]==0: print 'SHCD'[j],i+1

Submission status: Runtime Error

Solution code:
r4 = range(4)
r13 = range(13)
cards = [[0 for i in r13] for j in r4]
while True:
    n = input()
    for i in range(n):
        s1, s2 = raw_input().split()
        s1 = 'SHCD'.index(s1)
        s2 = int(s2)-1
        cards[s1][s2] = 1

for j in r4:
    for i in r13:
        if cards[j][i]==0: print 'SHCD'[j],i+1

Submission status: Runtime Error

Solution code:
r4 = range(4)
r13 = range(13)
cards = [[0 for i in r13] for j in r4]
while True:
    n = input()
    for i in range(n):
        s1, s2 = raw_input().split()
        s1 = 'SHCD'.index(s1)
        s2 = int(s2)-1
        print s1,s2
        cards[s1][s2] = 1

for j in r4:
    for i in r13:
        if cards[j][i]==0: print 'SHCD'[j],i+1

Submission status: Runtime Error

Solution code:
n = input()
x = {'S':[], 'H':[], 'C':[], 'D':[]}
for i in range(n):
    a = raw_input().split()
    x[a[0]].append(int(a[1]))
for key in ['s', 'H', 'C', 'D']:
    for i in range(13):
        for j in x[key]:
            if i+1 == j: break
        else: print key, i+1

Submission status: Runtime Error

Solution code:
Sp = [1,2,3,4,5,6,7,8,9,10,11,12,13]
Hu = [1,2,3,4,5,6,7,8,9,10,11,12,13]
Cr = [1,2,3,4,5,6,7,8,9,10,11,12,13]
Dy = [1,2,3,4,5,6,7,8,9,10,11,12,13]

num = input()
i = 0
while i < num:
     suit, n = input()
     if suit == "S":
        Sp[n-1] = 0
     elif suit == "H":
        Hu[n-1] = 0
     elif suit == "C":
        Cr[n-1] = 0
     else:
        Dy[n-1] = 0
     i += 1

for i in Sp:
    if Sp[i] != 0:
        print "S", Sp[i]

for i in Hu:
    if Hu[i] != 0:
        print "H", Hu[i]

for i in Cr:
    if Cr[i] != 0:
        print "C", Cr[i]

for i in Dy:
    if Dy[i] != 0:
        print "D", Dy[i]

Submission status: Runtime Error

Solution code:
Sp = [1,2,3,4,5,6,7,8,9,10,11,12,13]
Hu = [1,2,3,4,5,6,7,8,9,10,11,12,13]
Cr = [1,2,3,4,5,6,7,8,9,10,11,12,13]
Dy = [1,2,3,4,5,6,7,8,9,10,11,12,13]

num = input()
i = 0
while i < num:
     suit, n = raw_input().split
     if suit == "S":
        Sp[n-1] = 0
     elif suit == "H":
        Hu[n-1] = 0
     elif suit == "C":
        Cr[n-1] = 0
     else:
        Dy[n-1] = 0
     i += 1

for i in Sp:
    if Sp[i] != 0:
        print "S", Sp[i]

for i in Hu:
    if Hu[i] != 0:
        print "H", Hu[i]

for i in Cr:
    if Cr[i] != 0:
        print "C", Cr[i]

for i in Dy:
    if Dy[i] != 0:
        print "D", Dy[i]

Submission status: Runtime Error

Solution code:
Sp = [1,2,3,4,5,6,7,8,9,10,11,12,13]
Hu = [1,2,3,4,5,6,7,8,9,10,11,12,13]
Cr = [1,2,3,4,5,6,7,8,9,10,11,12,13]
Dy = [1,2,3,4,5,6,7,8,9,10,11,12,13]

num = input()
i = 0
while i < num:
     suit, n = raw_input().split
     n = int(n)
     if suit == "S":
        Sp[n-1] = 0
     elif suit == "H":
        Hu[n-1] = 0
     elif suit == "C":
        Cr[n-1] = 0
     else:
        Dy[n-1] = 0
     i += 1

for i in Sp:
    if Sp[i] != 0:
        print "S", Sp[i]

for i in Hu:
    if Hu[i] != 0:
        print "H", Hu[i]

for i in Cr:
    if Cr[i] != 0:
        print "C", Cr[i]

for i in Dy:
    if Dy[i] != 0:
        print "D", Dy[i]

Submission status: Runtime Error

Solution code:
Sp = [1,2,3,4,5,6,7,8,9,10,11,12,13]
Hu = [1,2,3,4,5,6,7,8,9,10,11,12,13]
Cr = [1,2,3,4,5,6,7,8,9,10,11,12,13]
Dy = [1,2,3,4,5,6,7,8,9,10,11,12,13]

num = input()
i = 0
while i < num:
     suit, n = raw_input().split
     n = int(n)
     if suit == "S":
        Sp[n-1] = 0
     elif suit == "H":
        Hu[n-1] = 0
     elif suit == "C":
        Cr[n-1] = 0
     else:
        Dy[n-1] = 0
     i += 1

for i in Sp:
    if i != 0:
        print "S", i

for i in Hu:
    if i != 0:
        print "H", i

for i in Cr:
    if i != 0:
        print "C", i

for i in Dy:
    if i != 0:
        print "D", i

Submission status: Runtime Error

Solution code:
Sp = [1,2,3,4,5,6,7,8,9,10,11,12,13]
Hu = [1,2,3,4,5,6,7,8,9,10,11,12,13]
Cr = [1,2,3,4,5,6,7,8,9,10,11,12,13]
Dy = [1,2,3,4,5,6,7,8,9,10,11,12,13]

num = int(input())
i = 0
while i < num:
     suit, n = raw_input().split
     n = int(n)
     if suit == "S":
        Sp[n-1] = 0
     elif suit == "H":
        Hu[n-1] = 0
     elif suit == "C":
        Cr[n-1] = 0
     else:
        Dy[n-1] = 0
     i += 1

for i in Sp:
    if i != 0:
        print "S", i

for i in Hu:
    if i != 0:
        print "H", i

for i in Cr:
    if i != 0:
        print "C", i

for i in Dy:
    if i != 0:
        print "D", i

Submission status: WA: Presentation Error

Solution code:
ans = []
for i in range(4):
    for j in range(13):
        ans.append("SHCD"[i] + " " + str(j + 1))

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

print("\n".join(ans))

Submission status: WA: Presentation Error

Solution code:
ans = []
for i in range(4):
    for j in range(13):
        ans.append("SHCD"[i] + " " + str(j + 1))

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

print("\n".join(ans), "\n", sep = "")

Submission status: WA: Presentation Error

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]
print(*d,sep="\n")

Submission status: WA: Presentation Error

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: WA: Presentation Error

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) for i in list_s]
[print(i) for i in list_h]
[print(i) for i in list_c]
[print(i) for i in list_d]

Submission status: WA: Presentation Error

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)
print()

Submission status: WA: Presentation Error

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())

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

Submission status: WA: Presentation Error

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())

print('\n'.join(c) or '')

Submission status: WA: Presentation Error

Solution code:
def to_str(symbol, num):
    return '{0} {1}'.format(symbol, num)

if __name__ == '__main__':
    symbols = ['S','H','C','D']
    cards = [to_str(x,y) for x in symbols for y in range(1,14)]
    n = int(input())
    for i in range(n):
        cards.remove(input())
    print('\n'.join(cards))