qyliang/CodeNanoFix huggingface dataset:
Buggy code:
n = int(input())
a = list(map(int, input().split()))
for i in range(0, n - 1):
 print(a[n - 1 - i], end = ' ')
print(a[n - 1])

Fixed code:
n = int(input())
a = list(map(int, input().split()))
for i in range(n-1):
	print(a[n-i-1], end=" ")
print(a[0])
Buggy code:
input()
a = input().split()
a.reverse()
print(' '/join(a))

Fixed code:
input()
a = input().split()
a.reverse()
print(' '.join(a))
Buggy code:
n = int(input())
inp = map(int,input().split())
inp.reverse()
for i in range(n-1):
	print(inp[i]," ",sep="",end="")

Fixed code:
n = int(input())
inp = list(map(int,input().split()))
inp.reverse()
for i in range(n-1):
	print(inp[i]," ",sep="",end="")
print(inp[n-1])
Buggy code:
n = int(input)
a = [int(i) for i in input().split()]
for i in range(n,-1,-1):
    if i == 0:
        print(a[i])
    else:
        print(a[i],end=" ")

Fixed code:
n = int(input())
a = [int(i) for i in input().split()]
for i in range(n-1,-1,-1):
    if i == 0:
        print(a[i])
    else:
        print(a[i],end=" ")
Buggy code:
n = int(input())
l = list(map(int, input().split()))
l.reverse()

for i in range(n):
	if i >= 1:
		print(" ", end = '')
	print(a[i], end = '')
print()


Fixed code:
n = int(input())
l = list(map(int, input().split()))
l.reverse()

for i in range(n):
	if i >= 1:
		print(" ", end = "")
	print(l[i], end = "")
print()
Buggy code:
n=int(input())

a=input().split()
b=[]
c=[]
i=0
while i<n:
    b.append(int(a[i]))
    i+=1

answer=str(b[0])
m=2
while m<i+1:
    answer=answer+" "+str(b[m-1])
    m=m+1
print(answer)



Fixed code:
n=int(input())

a=input().split()
b=[]
c=[]
i=0
while i<n:
    b.append(int(a[i]))
    i+=1

answer=str(b[n-1])
while n>1:
    answer=answer+" "+str(b[n-2])
    n=n-1
print(answer)
Buggy code:
input()
line = reverse(input().split())
print(' '.join(line))

Fixed code:
input()
line = input().split()
line.reverse()
print(' '.join(line))
Buggy code:
n = int(input())
x = [int(i) for i in input().split()]
x.sort()
x.reverse()
for i in range(n-1):
    print(x[i]," ",sep="",end="")
print(x[n-1])



Fixed code:
n = int(input())
x = [int(i) for i in input().split()]
x.reverse()
for i in range(n-1):
    print(x[i]," ",sep="",end="")
print(x[n-1])
Buggy code:
n = int(input())
a = input().split()

o = [int(i) for i in a]
for idx in range(0, int(n / 2)):
    w = o[idx]
    o[idx] = o[n - idx - 1]
    o[n - idx - 1] = w

for idx in range(n):
    print(o[idx], end = '')
    if idx == n:
        break

Fixed code:
n = int(input())
a = input().split()

o = [int(i) for i in a]
for idx in range(0, int(n / 2)):
    w = o[idx]
    o[idx] = o[n - idx - 1]
    o[n - idx - 1] = w

for idx in range(n):
    print(o[idx], end = '')
    if idx == n - 1:
        break
    print(' ', end = '')
print()
Buggy code:
# -*- coding: utf-8

x = input()
a = input().split()
a = a[::-1]
for i in range(len(a)):
   b += a[i]+" "
print(b[:-1])



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

x = input()
a = input().split()
a = a[::-1]
b = ""
for i in range(len(a)):
   b += a[i]+" "
print(b[:-1])
Buggy code:
n = input()
l = input().split()
for a in l:
  a = int(a)
x = list()  
for i in (reversed(l)):
  x.append(i)
print(x)  
  


Fixed code:
n = input()
l = input().split()
for a in l:
  a = int(a)
x = list()  
for i in (reversed(l)):
  x.append(i)
x = ' '.join(x)  
print(x)
Buggy code:
input()

a = input().split()

a.reverse()
print(''.join(a))

Fixed code:
input()

a = input().split()

a.reverse()
print(' '.join(a))
Buggy code:
data = ["{0} {1}".format(s, r) for s in ('S', 'H', 'C', 'D') for r in range(1, 13, + 1)]

count = int(input())
for c in range(count):
    card = input()
    data.remove(card)

for c in data:
    print(c)

Fixed code:
data = [
    "{0} {1}".format(s, r)
    for s in ('S', 'H', 'C', 'D')
    for r in range(1, 13 + 1)
]
count = int(input())
for c in range(count):
    card = input()
    data.remove(card)
 
for c in data:
    print(c)
Buggy code:
n=int(input())
S=[int(0) for i in range(1,14)]
H=[int(0) for i in range(1,14)]
D=[int(0) for i in range(1,14)]
C=[int(0) for i in range(1,14)]
for i in range(n):
    K,y=[(i) for i in input().split()]
    if K=='S':
        S[int(y)-1]=1
    elif K=='H':
        H[int(y)-1]=1
    elif K=='D':
        D[int(y)-1]=1
    else:
        C[int(y)-1]=1
for i in range(1,14):
    if S[int(i)-1]==0:
        print('S',"{0}".format(i))
for i in range(1,14):
    if H[int(i)-1]==0:
        print('H',"{0}".format(i))
for i in range(1,14):
    if D[int(i)-1]==0:
        print('D',"{0}".format(i))
for i in range(1,14):
    if C[int(i)-1]==0:
        print('C',"{0}".format(i))

Fixed code:
n=int(input())
S=[int(0) for i in range(1,14)]
H=[int(0) for i in range(1,14)]
D=[int(0) for i in range(1,14)]
C=[int(0) for i in range(1,14)]
for i in range(n):
    K,y=[(i) for i in input().split()]
    if K=='S':
        S[int(y)-1]=1
    elif K=='H':
        H[int(y)-1]=1
    elif K=='D':
        D[int(y)-1]=1
    else:
        C[int(y)-1]=1
for i in range(1,14):
    if S[int(i)-1]==0:
        print('S',"{0}".format(i))
for i in range(1,14):
    if H[int(i)-1]==0:
        print('H',"{0}".format(i))
for i in range(1,14):
    if C[int(i)-1]==0:
        print('C',"{0}".format(i))
for i in range(1,14):
    if D[int(i)-1]==0:
        print('D',"{0}".format(i))
Buggy code:
n = int(input())
cards = {}
for i in range(n):
    card = input()
    cards[card] = 1
  
for c in ['s','H','C','D']:
    for n in range(1,14):
        key = c + ' ' +str(n)
        if not key in cards:
            print(key)


Fixed code:
n = int(input())
cards = {}
for i in range(n):
  card = input()
  cards[card] = 1
 
for c in ['S', 'H', 'C', 'D']:
  for n in range(1,14):
    key = c + ' ' + str(n)
    if not key in cards:
      print(key)
Buggy code:
data = [
    "{0} {1}".format(s, r)
    for s in ('S', 'H', 'C', 'D')
    for r in range(1, 13 + 1)
]
count = int(input())
for c in range(count):
    card = input()
    data.remove(card)

print(data)

Fixed code:
data = [
    "{0} {1}".format(s, r)
    for s in ('S', 'H', 'C', 'D')
    for r in range(1, 13 + 1)
]
count = int(input())
for c in range(count):
    card = input()
    data.remove(card)

for c in data:
    print(c)
Buggy 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)







Fixed 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)
Buggy code:
n = int(input())
cards = {}
for i in range(n):
  card = input()
  cards[card] = 1
  
for c in ['S','H','C','D']:
  for n in range(1,14):
    card = c + ' ' + str(n)
    if not key in cards:
      print(key)


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

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

n = int(input())
for i in range(n):
    mark, num = [x for x in input().split()]
    if mark == 'S':
        S.append(int(num))

    elif mark == 'H':
        H.append(int(num))

    elif mark == "C":
        C.append(int(num))

    else: #D
        D.append(int(num))


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

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

n = int(input())
for i in range(n):
    mark, num = [x for x in input().split()]
    if mark == 'S':
        S.append(int(num))

    elif mark == 'H':
        H.append(int(num))

    elif mark == "C":
        C.append(int(num))

    else: #D
        D.append(int(num))


for i in range(1,14):
    if not i in S:
        print("S", i)
for i in range(1,14):
    if not i in H:
        print("H", i)
for i in range(1,14):
    if not i in C:
        print("C", i)
for i in range(1,14):
    if not i in D:
        print("D", i)
Buggy code:
S = []
H = []
C = []
D = []
for i in (S, H, C, D):
        for k in range(1, 13+1):
            i.append(k)


for u in range(0, int(input())):
    x, y = (i for i in input().split())
    if x == "S":
        S.remove(int(y))
    elif x == "H":
        H.remove(int(y))
    elif x == "C":
        H.remove(int(y))
    else:
        D.remove(int(y))
if len(S) > 0:
    for s in range(0, len(S)):
        print("S",S[s])
if len(H) > 0:
    for h in range(0, len(H)):
        print("H",H[h])
if len(C) > 0:
    for c in range(0, len(C)):
        print("C",C[c])
if len(D) > 0:
    for d in range(0, len(D)):
        print("D",D[d])

Fixed code:
S = []
H = []
C = []
D = []
for i in (S, H, C, D):
        for k in range(1, 13+1):
            i.append(k)


for u in range(0, int(input())):
    x, y = (i for i in input().split())
    if x == "S":
        S.remove(int(y))
    elif x == "H":
        H.remove(int(y))
    elif x == "C":
        C.remove(int(y))
    else:
        D.remove(int(y))
if len(S) > 0:
    for s in range(0, len(S)):
        print("S",S[s])
if len(H) > 0:
    for h in range(0, len(H)):
        print("H",H[h])
if len(C) > 0:
    for c in range(0, len(C)):
        print("C",C[c])
if len(D) > 0:
    for d in range(0, len(D)):
        print("D",D[d])
Buggy 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])


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

for j in range(len(d)):
    if j==0:
        list_d = d["S"]
        c = "S"
    elif j == 1:
        list_d = d["H"]
        c = "H"
    elif j == 2:
        list_d = d["C"]
        c = "C"
    else:
        list_d = d["D"]
        c = "D"
    for i in range(len(list_d)):
        if(list_d[i] != "None"):
            print(c , list_d[i])
Buggy code:
s = [0] * 13
h = [0] * 13
c = [0] * 13
d = [0] * 13

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

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

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

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

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






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

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

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

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

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

for i in range(13):
    if d[i] == 0:
        print("D %d" % (i+1))
Buggy 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))


Fixed 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 remind:
         print(egara[i] + str(j))
Buggy code:
cards = {
  'S': [r for f in range(1,13+1)],
  'H': [r for f in range(1,13+1)],
  'C': [r for f in range(1,13+1)],
  'D': [r for f in range(1,13+1)],
  }

n = int(input())
for nc in range(n):
  (s, r) = input().split()
  index = cards[s].index(int(r))
  del cards[s][index]

for s in ['S', 'H', 'C', 'D']:
  for r in cards[s]:
    print(s, r)

Fixed code:
cards = {
        'S': [r for r in range(1,13+1)],
        'H': [r for r in range(1,13+1)],
        'C': [r for r in range(1,13+1)],
        'D': [r for r in range(1,13+1)],
        }
  
n = int(input())
for nc in range(n):
    (s, r) = input().split()
    index = cards[s].index(int(r))
    del cards[s][index]
  
for s in ['S', 'H', 'C', 'D']:
    for r in cards[s]:
        print(s, r)
Buggy code:
l=[]
for mark in ["S","H","C","D"]:
	for i in range(1,14):
		l.append(mark+" "+str(i))
print(l)
n=input()
for i in range(int(n)):
	l.remove(input())
for i in l[:-1]:
	print(i)
print(l[-1],end="")

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



Fixed code:
n=int(input())
card=[]
for suit in ["S","H","C","D"]:
    for rank in list(map(str,range(1,14))):
        card.append(suit+" "+rank)
for i in range(n):
    card.remove(input())
for c in card:
    print(c)
Buggy code:
# -*- coding:utf-8 -*-
class Cards:
    trump = [False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,]
    def HaveCards(self,num):
        self.trump[num] = True
    def TransCards(self,s,num):
        if(s == 'H'):
            num += 12 
        elif(s == 'C'):
            num +=25  
        elif(s == 'D'):
            num += 38
        return num
    def CheckCards(self,num):
        if(num <= 12):
            return 'S' ,num+1
        elif(num >= 13 and num <= 25):
            return 'H'  ,num-12
        elif(num >= 26 and num <= 38):
            return 'C',num-25
        elif(num >= 39 and num <=51):
            return 'D',num-38
        
n = int(input())
ob = Cards()
for i in range(n):
    s,str_num = input().split()
    number = int(str_num)
    Num=ob.TransCards(s,number-1)
    ob.HaveCards(Num)

for i in range(len(Cards.trump)):
    if Cards.trump[i] == False:
        Str,Num=ob.CheckCards(i)
        print(Str,Num)

Fixed code:
# -*- coding:utf-8 -*-
class Cards:
    trump = [False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,]
    def HaveCards(self,num):
        self.trump[num] = True
    def TransCards(self,s,num):
        if(s == 'H'):
            num += 13 
        elif(s == 'C'):
            num +=26  
        elif(s == 'D'):
            num += 39
        return num
    def CheckCards(self,num):
        if(num <= 12):
            return 'S' ,num+1
        elif(num >= 13 and num <= 25):
            return 'H'  ,num-12
        elif(num >= 26 and num <= 38):
            return 'C',num-25
        elif(num >= 39 and num <=51):
            return 'D',num-38
        
n = int(input())
ob = Cards()
for i in range(n):
    s,str_num = input().split()
    number = int(str_num)
    Num=ob.TransCards(s,number-1)
    ob.HaveCards(Num)

for i in range(len(Cards.trump)):
    if Cards.trump[i] == False:
        Str,Num=ob.CheckCards(i)
        print(Str,Num)
Buggy code:
cards_remain=[]
suit=["S","H","C","D"]
cards_set=[]
output=[]

count_card=input()

for l in range(int(count_card)):
        cards_remain.append(input().replace(" ",""))

for m in suit:
    for n in range(13):
        cards_set.append(m+str(n+1))

for p in cards_set:
    if p not in  cards_remain:
        output.append(p)

for x in output:
        print(x[0]+" "+x[1])

Fixed code:
cards_remain=[]
suit=["S","H","C","D"]
cards_set=[]
output=[]

count_card=input()

for l in range(int(count_card)):
        cards_remain.append(input())

for m in suit:
    for n in range(13):
        cards_set.append(m+" "+str(n+1))

for p in cards_set:
    if p not in  cards_remain:
        output.append(p)

for x in output:
        print(x)
Buggy code:
sCard = [0] * 13
hCard = [0] * 13 
cCard = [0] * 13
dCard = [0] * 13

callNum = int(input())

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

sLack = 0
hLack = 0
cLack = 0
dLack = 0

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


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

callNum = int(input())

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

sLack = 0
hLack = 0
cLack = 0
dLack = 0

for cardLoop in range(13):
    if sCard[cardLoop] == 0:
        print("S " + str(cardLoop+1))
for cardLoop in range(13):
    if hCard[cardLoop] == 0:
        print("H " + str(cardLoop+1))
for cardLoop in range(13):
    if cCard[cardLoop] == 0:
        print("C " + str(cardLoop+1))
for cardLoop in range(13):
    if dCard[cardLoop] == 0:
        print("D " + str(cardLoop+1))
Buggy code:
A = [[i for i in range(1 ,14)] for j in range(4)]
a = int(input())
print(A)
for i in range(a):
    b,c = map(str,input().split())
    c=int(c)
    if b=="S":
        A[0].remove(c)
    if b=="H":
        A[1].remove(c)
    if b=="C":
        A[2].remove(c)
    if b=="D":
        A[3].remove(c)
def name(number,name):
    x=A[number]
    x=map(str,x)
    print("%s " %name+("\n%s " %name).join(x))
name(0,"S")
name(1,"H")
name(2,"C")
name(3,"D")

Fixed code:
A = [[i for i in range(1 ,14)] for j in range(4)]
a = int(input())
for i in range(a):
    b,c = map(str,input().split())
    c=int(c)
    if b=="S":
        A[0].remove(c)
    if b=="H":
        A[1].remove(c)
    if b=="C":
        A[2].remove(c)
    if b=="D":
        A[3].remove(c)
def name(number,name):
    if A[number]==[]:
        pass
    else:    
        x=A[number]
        x=map(str,x)
        print("%s " %name+("\n%s " %name).join(x))
    
name(0,"S")
name(1,"H")
name(2,"C")
name(3,"D")
Buggy code:
S_cards=[]
H_cards=[]
C_cards=[]
D_cards=[]

for i in range(1,14):
    S_cards.append(i)
    H_cards.append(i)
    C_cards.append(i)
    D_cards.append(i)

now_cards=int(input())
for i in range(0,now_cards):
    kind_num=[]
    kind_num=input().split()
    if kind_num[0]=='S':
        S_cards.remove(int(kind_num[1])
    elif kind_num[0]=='H':
        H_cards.remove(int(kind_num[1])
    elif kind_num[0]=='C':
        C_cards.remove(int(kind_num[1])
    elif kind_num[0]=='D':
        D_cards.remove(int(kind_num[1])
for i in range(0,len(S_cards)):
    print('S',S_cards[i])
for i in range(0,len(H_cards)):
    print('H',H_cards[i])
for i in range(0,len(C_cards)):
    print('C',C_cards[i])
for i in range(0,len(D_cards)):
    print('D',D_cards[i])

Fixed code:
S_cards=[]
H_cards=[]
C_cards=[]
D_cards=[]

for i in range(1,14):
    S_cards.append(i)
    H_cards.append(i)
    C_cards.append(i)
    D_cards.append(i)

now_cards=int(input())
for i in range(0,now_cards):
    kind_num=[]
    kind_num=input().split()
    if kind_num[0]=='S':
        S_cards.remove(int(kind_num[1]))
    elif kind_num[0]=='H':
        H_cards.remove(int(kind_num[1]))
    elif kind_num[0]=='C':
        C_cards.remove(int(kind_num[1]))
    elif kind_num[0]=='D':
        D_cards.remove(int(kind_num[1]))
for i in range(0,len(S_cards)):
    print('S',S_cards[i])
for i in range(0,len(H_cards)):
    print('H',H_cards[i])
for i in range(0,len(C_cards)):
    print('C',C_cards[i])
for i in range(0,len(D_cards)):
    print('D',D_cards[i])
Buggy 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))


Fixed 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

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

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

i = 1
while i < 14:
	if not(i in card_D):
		print("D " + str(i))
	i += 1
Buggy code:
n=int(input())
cards = [(mark,num) for mark in ['S','H','C','D'] for num in range(1,14) ]
for _ in range(n):
    mark,num=input().split()
    cards.remove((mark,int(num)))
for (mark, num) in cards:
    print(mak, num)


Fixed code:
n=int(input())
cards = [(mark,num) for mark in ['S','H','C','D'] for num in range(1,14) ]
for _ in range(n):
    mark,num=input().split()
    cards.remove((mark,int(num)))
for (mark, num) in cards:
    print(mark, num)
Buggy code:
symboldict = {'S':0, 'H':1, 'C':2, 'D':3} 
cardlist = [[0 for i in range(13)] for j in range(4)] 

total = int(input())
for i in range(total):
    sym, num = input().split()
    cardlist[symboldict[sym]][int(num) - 1] = 1
cnt = 0;
numdict = {num:sym for sym,num in symboldict.items()}
for j in range(len(cardlist)):
    for i in range(len(cardlist[j])):
        if cardlist[j][i] == 0:
            print('{0} {1:2d}'.format(numdict[j], i + 1))
print()

Fixed code:
symboldict = {'S':0, 'H':1, 'C':2, 'D':3} 
cardlist = [[0 for i in range(13)] for j in range(4)] 

total = int(input())
for i in range(total):
    sym, num = input().split()
    cardlist[symboldict[sym]][int(num) - 1] = 1
cnt = 0;
numdict = {num:sym for sym,num in symboldict.items()}
for j in range(len(cardlist)):
    for i in range(len(cardlist[j])):
        if cardlist[j][i] == 0:
            print(numdict[j], i + 1)