ZhenlongDai/ACPR huggingface dataset:
Problem: p03944
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
W, H, N = map(int, input().split())
x = [0] * N
y = [0] * N
a = [0] * N
x_min = 0
x_max = W
y_min = 0
y_max = H
for i in range(N):
    x[i], y[i], a[i] = map(int, input().split())
for i in range(N):
    if x_max <= x_min or y_max <= y_min:
        print(0)
        break
    elif a[i] == 1:
        if x_min < x[i]:
            x_min = x[i]
    elif a[i] == 2:
        if x_max < x[i]:
            x_max = x[i]
    elif a[i] == 3:
        if y_min < x[i]:
            y_min = y[i]
    elif a[i] == 4:
        if y_max < x[i]:
            y_max = y[i]
print((x_max - x_min)*(y_max - y_min))

Failing test case input:
10 10 5
1 6 1
4 1 3
6 9 4
9 4 2
3 1 3

Expected output:
64

Actual output:
81


Fixed submission (verdict: Accepted):
W, H, N = map(int, input().split())
x = [0] * N
y = [0] * N
a = [0] * N
x_min = 0
x_max = W
y_min = 0
y_max = H
for i in range(N):
    x[i], y[i], a[i] = map(int, input().split())
for i in range(N):
    if a[i] == 1:
        if x_min < x[i]:
            x_min = x[i]
    elif a[i] == 2:
        if x_max > x[i]:
            x_max = x[i]
    elif a[i] == 3:
        if y_min < y[i]:
            y_min = y[i]
    elif a[i] == 4:
        if y_max > y[i]:
            y_max = y[i]
if x_max <= x_min or y_max <= y_min:
    print(0)
else:
    print((x_max - x_min)*(y_max - y_min))

Problem: p03944
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
W, H, N = map(int, input().split())
x, y, a = [0] * N, [0] * N, [0] * N
for i in range(N):
    x[i], y[i], a[i] = map(int, input().split())
    
w_s = 0
w_e = W
h_s = 0
h_e = H

for i in range(N):
    if a[i] == 1:
        w_s = x[i]
    elif a[i] == 2:
        w_e = x[i]
    elif a[i] == 3:
        h_s = y[i]
    else:
        h_e = y[i]

height = h_e - h_s
width = w_e - w_s

if height <= 0 or width <= 0:
    print(0)
else:
    print(height * width)

Failing test case input:
5 2 3
2 0 2
1 11 2
2 4 2

Expected output:
2


Actual output:
4


Fixed submission (verdict: Accepted):
W, H, N = map(int, input().split())
x, y, a = [0] * N, [0] * N, [0] * N
for i in range(N):
    x[i], y[i], a[i] = map(int, input().split())
    
xmin = 0
xmax = W
ymin = 0
ymax = H

for i in range(N):
    if a[i] == 1:
        xmin = max(x[i], xmin)
    elif a[i] == 2:
        xmax = min(x[i], xmax)
    elif a[i] == 3:
        ymin = max(y[i], ymin)
    else:
        ymax = min(y[i], ymax)

height = ymax - ymin
width = xmax - xmin

if height <= 0 or width <= 0:
    print(0)
else:
    print(height * width)

Problem: p03944
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
w,h,n=map(int,input().split())
x,y=0,0
for i in range(n):
  a,b,c=map(int,input().split())
  if c<a<w:
    if c==1:x=a
    elif c==2:w=a
  if y<b<h:
    if c==3:y=b
    elif c==4:h=b
print((w-x)*(h-y))

Failing test case input:
5 6 2
2 0 1
6 3 1

Expected output:
0


Actual output:
18


Fixed submission (verdict: Accepted):
w,h,n=map(int,input().split())
x,y=0,0
for i in range(n):
  a,b,c=map(int,input().split())
  if c==1:x=max(x,a)
  elif c==2:w=min(w,a)
  elif c==3:y=max(y,b)
  else:h=min(h,b)
print(max((w-x),0)*max((h-y),0))
Problem: p03944
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
w,h,n = map(int,input().split())

w0 = 0
h0 = 0

c = [list(map(int,input().split())) for _ in range(n)]

for i in c:
    if i[2] == 2:
        if i[0] < w:
            w = i[0]
    elif i[2] == 1:
        if i[0] > 0:
            w0 = i[0]
    elif i[2] == 4:
        if i[1] < h:
            h = i[1]
    elif i[2] == 3:
        if i[1] > 0:
            h0 = i[1]

w = w - w0 
if w < 0:
    w = 0
h = h - h0
if h < 0:
    h = 0
print(w*h)

Failing test case input:
5 4 3
2 1 2
6 11 3
1 2 3

Expected output:
0


Actual output:
4


Fixed submission (verdict: Accepted):
w,h,n = map(int,input().split())

w0 = 0
h0 = 0

c = [list(map(int,input().split())) for _ in range(n)]

for i in c:
    if i[2] == 2:
        if i[0] < w:
            w = i[0]
    elif i[2] == 1:
        if i[0] > w0:
            w0 = i[0]
    elif i[2] == 4:
        if i[1] < h:
            h = i[1]
    elif i[2] == 3:
        if i[1] > h0:
            h0 = i[1]

w = w - w0 
if w < 0:
    w = 0
h = h - h0
if h < 0:
    h = 0
print(w*h)

Problem: p03944
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
w, h, n = map(int, input().split())
xya = [list(map(int, input().split())) for _ in range(n)]

w0 = 0
h0 = 0
for i in range(n):
    if xya[i][2] == 1:
        w0 = xya[i][0]
    elif xya[i][2] == 2:
        w = xya[i][0]
    elif xya[i][2] == 3:
        h0 = xya[i][1]
    else:
        h = xya[i][1]

print(max(0,(w-w0) * (h-h0)))

Failing test case input:
5 4 3
2 1 2
6 11 3
1 2 3

Expected output:
0


Actual output:
4


Fixed submission (verdict: Accepted):
w, h, n = map(int, input().split())
xya = [list(map(int, input().split())) for _ in range(n)]

w0 = 0
h0 = 0
for i in range(n):
    if xya[i][2] == 1:
        w0 = max(w0,xya[i][0])
    elif xya[i][2] == 2:
        w = min(w,xya[i][0])
    elif xya[i][2] == 3:
        h0 = max(h0,xya[i][1])
    else:
        h = min(h,xya[i][1])
        
print(max(0, (w-w0)) * max(0, (h-h0)))

Problem: p03944
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
W,H,N=map(int,input().split())
xya=[list(map(int,input().split())) for i in range(N)]

boundary=[0,0,W,H]

for i in range(N):
  a=xya[i][2]
  if a==1:
    boundary[0]=xya[i][0]
  elif a==2:
    boundary[2]=xya[i][0]
  elif a==3:
    boundary[1]=xya[i][1]
  else:
    boundary[3]=xya[i][1]

print(max(0,(boundary[2]-boundary[0])*(boundary[3]-boundary[1])))

Failing test case input:
5 4 3
2 1 2
6 11 2
1 2 3

Expected output:
4


Actual output:
12


Fixed submission (verdict: Accepted):
W,H,N=map(int,input().split())
xya=[list(map(int,input().split())) for i in range(N)]

boundary=[0,0,W,H]

for i in range(N):
  a=xya[i][2]
  if a==1:
    if boundary[0]<xya[i][0]:
      boundary[0]=xya[i][0]
  elif a==2:
    if boundary[2]>xya[i][0]:
      boundary[2]=xya[i][0]
  elif a==3:
    if boundary[1]<xya[i][1]:
      boundary[1]=xya[i][1]
  else:
    if boundary[3]>xya[i][1]:
      boundary[3]=xya[i][1]
  if boundary[0]>=boundary[2] or boundary[1]>=boundary[3]:
    break

print(max(0,(boundary[2]-boundary[0])*(boundary[3]-boundary[1])))
Problem: p03944
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
w,h,n=map(int,input().split())
a=[list(map(int,input().split())) for i in range(n)]
a1=[0];a2=[0];a3=[0];a4=[0]
for i in a:
  if i[2]==1:a1.append(i[0])
  else:pass
for i in a:
  if i[2]==2:a2.append(i[0])
  else:pass
for i in a:
  if i[2]==3:a3.append(i[1])
  else:pass
for i in a:
  if i[2]==4:a4.append(i[1])
  else:pass
if max(a1)-min(a2)<0:x=max(a1)-min(a2)
else:x=0
if max(a3)-min(a4)<0:y=max(a3)-min(a4)
else:y=0
print(x*y)

Failing test case input:
5 4 3
2 0 2
3 11 2
2 4 2

Expected output:
8


Actual output:
0


Fixed submission (verdict: Accepted):
w,h,n=map(int,input().split())
a=[list(map(int,input().split())) for i in range(n)]
a1=[0];a2=[w];a3=[0];a4=[h]
for i in a:
  if i[2]==1:a1.append(i[0])
  else:pass
for i in a:
  if i[2]==2:a2.append(i[0])
  else:pass
for i in a:
  if i[2]==3:a3.append(i[1])
  else:pass
for i in a:
  if i[2]==4:a4.append(i[1])
  else:pass
if max(a1)-min(a2)<0:x=max(a1)-min(a2)
else:x=0
if max(a3)-min(a4)<0:y=max(a3)-min(a4)
else:y=0
print(x*y)

Problem: p03944
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
inp = list(map(int,input().split()))
left_max=0
right_min=inp[0]
upper_min=inp[1]
lower_max=0

for i in range(inp[2]):
    inin = list(map(int,input().split()))
    if inin[2] == 1 and inin[0]>left_max:
        left_max=inin[0]
    if inin[2] == 2 and inin[0]<right_min:
        right_min=inin[0]
    if inin[2] == 4 and inin[1]<upper_min:
        upper_min=inin[1]
    if inin[2] == 3 and inin[1]>lower_max:
        lower_max=inin[1]
left_max=min(left_max,right_min)
upper_min=min(upper_min,lower_max)
print((right_min-left_max)*(upper_min-lower_max))
     


Failing test case input:
5 2 3
2 0 3
3 11 2
2 0 2

Expected output:
4


Actual output:
0


Fixed submission (verdict: Accepted):
inp = list(map(int,input().split()))
left_max=0
right_min=inp[0]
upper_min=inp[1]
lower_max=0

for i in range(inp[2]):
    inin = list(map(int,input().split()))
    if inin[2] == 1 and inin[0]>left_max:
        left_max=inin[0]
    if inin[2] == 2 and inin[0]<right_min:
        right_min=inin[0]
    if inin[2] == 4 and inin[1]<upper_min:
        upper_min=inin[1]
    if inin[2] == 3 and inin[1]>lower_max:
        lower_max=inin[1]
left_max=min(left_max,right_min)
upper_min=max(upper_min,lower_max)
print((right_min-left_max)*(upper_min-lower_max))
Problem: p02234
Buggy submission (Python3, verdict: Wrong Answer):
n = int(input())
INF = 10**9
P = [list(map(int, input().split())) for i in range(n)]
m = [[0]*n for i in range(n)]

for l in range(2, n + 1):
    for i in range(n - l + 1):
        j = i + l - 1
        m[i][j] = INF
        for k in range(i, j):
            m[i][j] = min(m[i][j], m[i][k] + m[k + 1][j] + P[i - 1][0] * P[k][1] * P[j][1])

print(m[0][n - 1])

Failing test case input:
6
0 1
18 0
18 0
3 3
1 8
4 7

Expected output:
0


Actual output:
28


Fixed submission (verdict: Accepted):
n = int(input())
INF = 10**9
P = [list(map(int, input().split())) for i in range(n)]
m = [[0]*n for i in range(n)]

for l in range(2, n + 1):
    for i in range(n - l + 1):
        j = i + l - 1
        m[i][j] = INF
        for k in range(i, j):
            m[i][j] = min(m[i][j], m[i][k] + m[k + 1][j] + P[i][0] * P[k][1] * P[j][1])

print(m[0][n - 1])

Problem: p02234
Buggy submission (Python3, verdict: Wrong Answer):
n = int(input())
p = list(range(n+2))

for i in range(1,n+1):
    p[i], p[n+1] = map(int, input().split())


table = [[0] * (n+1) for i in range(n+1)]


for i in range(1,n):  
    table[i][i+1] = p[i]*p[i+1]*p[i+2]


for k in range(3, n+1):    
    for i in range(1,n+2-k): 
        j = i + k - 1      

        table[i][j] = float('inf')

        for x in range(i, j): 
            print(i, x, j)
            cost = table[i][x] + table[x+1][j] + p[i]*p[x+1]*p[j+1]
            table[i][j] = min(table[i][j], cost)
            

print(table[1][n])

Failing test case input:
6
0 1
18 0
18 0
3 3
1 8
2 7

Expected output:
0


Actual output:
1 1 3
1 2 3
2 2 4
2 3 4
3 3 5
3 4 5
4 4 6
4 5 6
1 1 4
1 2 4
1 3 4
2 2 5
2 3 5
2 4 5
3 3 6
3 4 6
3 5 6
1 1 5
1 2 5
1 3 5
1 4 5
2 2 6
2 3 6
2 4 6
2 5 6
1 1 6
1 2 6
1 3 6
1 4 6
1 5 6
0


Fixed submission (verdict: Accepted):
n = int(input())
p = list(range(n+2))

for i in range(1,n+1):
    p[i], p[n+1] = map(int, input().split())


table = [[0] * (n+1) for i in range(n+1)]


for i in range(1,n):  
    table[i][i+1] = p[i]*p[i+1]*p[i+2]


for k in range(3, n+1):    
    for i in range(1,n+2-k): 
        j = i + k - 1      

        table[i][j] = float('inf')

        for x in range(i, j): 
            
            cost = table[i][x] + table[x+1][j] + p[i]*p[x+1]*p[j+1]
            table[i][j] = min(table[i][j], cost)
            

print(table[1][n])
Problem: p02234
Buggy submission (Python3, verdict: Wrong Answer):
import sys

def get_min_cost(n, p):
	m = [[0 for x in range(n+1)] for x in range(n+1)]
	for s in range(n):
		i = 1
		for j in range(s+2, n):
			m[i][j] = sys.maxsize
			for k in range(i, j+1):
				m[i][j] = min(m[i][j], m[i][k]+m[k+1][j]+p[i-1]*p[k]*p[j])
			i+=1	
	return m[1][n]

n = int(input())
p = [0] * (n+1)
j = 0
for i in range(n):
	a = list(map(int, input().split()))
	if i == 0:
		p[j] = a[0]
		j += 1
	p[j] = a[1]
	j += 1
print(get_min_cost(n, p))
		
		


Failing test case input:
6
10 35
35 15
15 5
5 10
10 20
20 5

Expected output:
5875


Actual output:
0


Fixed submission (verdict: Accepted):
import sys

def get_min_cost(n, p):
	m = [[0 for x in range(n+1)] for x in range(n+1)]
	for s in range(n):
		i = 1
		for j in range(s+2, n+1):
			m[i][j] = sys.maxsize
			for k in range(i, j):
				m[i][j] = min(m[i][j], m[i][k]+m[k+1][j]+p[i-1]*p[k]*p[j])
			i+=1	
	return m[1][n]

n = int(input())
p = [0] * (n+1)
j = 0
for i in range(n):
	a = list(map(int, input().split()))
	if i == 0:
		p[j] = a[0]
		j += 1
	p[j] = a[1]
	j += 1
print(get_min_cost(n, p))

Problem: p02234
Buggy submission (Python3, verdict: Wrong Answer):
import sys

p=[0 for i in range (101)]
m=[[0 for i in range(100)]for i in range(100)]

def MatrixChain(n) : 
	for i in range(1,n+1) : m[i][i] = 0;
	for l in range(2,n+1) :
		for i in range(1,n-l+2) : 
			j = i + l - 1
			m[i][j] = float('Infinity')
			for k in range(i,j) :
				q = m[i][k] + m[k+1][j] + p[i-1]*p[k]*p[j]
				m[i][j] = m[i][j] if m[i][j] <= q else q

n = int(input())
for i in range(n) :
	input_num = input()
	input_num = input_num.split(' ')
	p[i] = int(input_num[0][0])
	p[i+1] = int(input_num[1])

MatrixChain(n)
print(m[1][n])

Failing test case input:
6
30 35
35 15
15 5
5 10
10 20
20 25

Expected output:
15125

Actual output:
141


Fixed submission (verdict: Accepted):
import sys

p=[0 for i in range (101)]
m=[[0 for i in range(100)]for i in range(100)]

def MatrixChain(n) : 
	for i in range(1,n+1) : m[i][i] = 0;
	for l in range(2,n+1) :
		for i in range(1,n-l+2) : 
			j = i + l - 1
			m[i][j] = float('Infinity')
			for k in range(i,j) :
				q = m[i][k] + m[k+1][j] + p[i-1]*p[k]*p[j]
				m[i][j] = m[i][j] if m[i][j] <= q else q

n = int(input())
for i in range(n) :
	p[i], p[i+1] = map(int, input().split())

MatrixChain(n)
print(m[1][n])
Problem: p03086
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
gene = ["A","T","G","C"]
def is_gene(i):
    if i in gene:
        return True
    else:
        return False

S = input()

ans = 0
tmp = 0

for i in S:
    if is_gene(i):
        tmp += 1
    else:
        ans = max(ans,tmp)
        tmp = 0

print(ans)

Failing test case input:
VUKJNIHT

Expected output:
1


Actual output:
0


Fixed submission (verdict: Accepted):
gene = ["A","T","G","C"]

S = list(input())

ans = 0
tmp = 0

for i in range(len(S)):
    if S[i] in gene:
        tmp += 1
        ans = max(ans,tmp)
    else:
        tmp = 0

print(ans)

Problem: p03086
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S = input()
tmp=0
ans=0
for s in S:
  if s in 'ACGT':
    tmp+=1
  else:
    ans = max(ans,tmp)
    tmp=0
print(ans)

Failing test case input:
REBPCTA

Expected output:
3


Actual output:
0


Fixed submission (verdict: Accepted):
S = input()
tmp=0
ans=0
for s in S:
  if s in 'ACGT':
    tmp+=1
  else:
    tmp=0
  ans = max(ans,tmp)
print(ans)

Problem: p03086
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
mx = 0
S = input()
tmp = 0
for ch in S:
    if ch in "ATCG":
        tmp += 1
    else:
        mx = max(tmp, mx)
        tmp = 0

print(mx)


Failing test case input:
VKUJNIHT

Expected output:
1


Actual output:
0


Fixed submission (verdict: Accepted):
mx = 0
S = input()
tmp = 0
for ch in S:
    if ch in "ATCG":
        tmp += 1
    else:
        mx = max(tmp, mx)
        tmp = 0

mx = max(tmp, mx)
print(mx)

Problem: p03086
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
S = input()
ans = 0
cnt = 0
for s in S:
    if (s in 'ATCG'):
        cnt += 1
    else:
        ans = max(ans, cnt)
        cnt = 0
print(ans)


Failing test case input:
JUKVNIHT

Expected output:
1


Actual output:
0


Fixed submission (verdict: Accepted):
S = input()
ans = 0
cnt = 0
for s in S:
    if (s in 'ATCG'):
        cnt += 1
    else:
        ans = max(ans, cnt)
        cnt = 0
print(max(ans, cnt))

Problem: p03086
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
s = input()

max = 0
cnt = 0

for i in range(len(s)):
    if s[i] == 'A' or s[i] == 'C' or s[i] == 'G' or s[i] == 'T':
        cnt += 1
        if max < cnt:
            max = cnt
        else:
            cnt = 0

print(max)

Failing test case input:
AYCH@TAH

Expected output:
2


Actual output:
4


Fixed submission (verdict: Accepted):
s = input()

max = 0
cnt = 0

for i in range(len(s)):
    if s[i] == 'A' or s[i] == 'C' or s[i] == 'G' or s[i] == 'T':
        cnt += 1
        if max < cnt:
            max = cnt
    else:
      cnt = 0

print(max)
Problem: p03086
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
s = input()

count = 0
count_list =[0]
for i in range(len(s)):
    if s[i] == "A" or s[i] == "C" or s[i] == "G" or s[i] == "T":
        count += 1
    else:
        count_list.append(count)
        count = 0

print(max(count_list))

Failing test case input:
VUKJNIHT

Expected output:
1


Actual output:
0


Fixed submission (verdict: Accepted):
s = input()

count = 0
count_list = [0]
for i in range(len(s)):
    if s[i] == "A" or s[i] == "C" or s[i] == "G" or s[i] == "T":
        count += 1
    else:
        count_list.append(count)
        count = 0
count_list.append(count)
print(max(count_list))

Problem: p03086
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
m = a = 0
for c in input():
    if c in "ATGC": m+=1
    else: a = max(a, m); m = 0
else: print(a)

Failing test case input:
RDBPCTA

Expected output:
3


Actual output:
0


Fixed submission (verdict: Accepted):
m = a = 0
for c in input():
    if c in "ATGC": m+=1
    else: a = max(a, m); m = 0
else: print(max(a, m))

Problem: p03086
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
S = input()
F = "ATGC"
cnt = 0
n = len(S)
for i in range(n-1):
  for j in range(i+1, n):
    flg = True
    for k in range(i, j):
      flg *= (S[k] in F)
    if flg:
      cnt = max(cnt, j - i)
print(cnt)


Failing test case input:
JUKVNIHT

Expected output:
1


Actual output:
0


Fixed submission (verdict: Accepted):
S = input()
F = "ATGC"
cnt = 0
n = len(S)
for i in range(n):
  for j in range(i+1, n+1):
    flg = True
    for k in range(i, j):
      flg *= (S[k] in F)
    if flg:
      cnt = max(cnt, j - i)
print(cnt)

Problem: p03086
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s=input()
a,b=0,0
for i in range(len(s)):
    if s[i]=="A" or s[i]=="C" or s[i]=="G" or s[i]=="T":
        a+=1
    else:
        b=max(a,b)
        a=0
print(b)

Failing test case input:
JUKVMIHT

Expected output:
1


Actual output:
0


Fixed submission (verdict: Accepted):
s=input()
a,b=0,0
for i in range(len(s)):
    if s[i]=="A" or s[i]=="C" or s[i]=="G" or s[i]=="T":
        a+=1
    else:
        b=max(a,b)
        a=0
print(max(a,b))

Problem: p03086
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=input()
l=["A","T","C","G"]
res=0
cnt=0

for i in range(len(n)):
  if n[i] in l:
    if cnt>res:
      res=cnt
    cnt+=1
  else:
    if cnt>res:
      res=cnt
      cnt=0
      
print(res)

Failing test case input:
AXCH@TAH

Expected output:
2


Actual output:
3


Fixed submission (verdict: Accepted):
n=input()
l=["A","T","C","G"]
res=0
cnt=0

for i in range(len(n)):
  if n[i] in l:
    cnt+=1
    if cnt>res:
      res=cnt
  else:
    cnt=0
    if cnt>res:
      res=cnt
      
print(res)
Problem: p03377
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a,b,x = map(int,input().split())
print("Yes" if a+b >= x >= a else "No")

Failing test case input:
-5 -1 8

Expected output:
NO


Actual output:
No


Fixed submission (verdict: Accepted):
a,b,x = map(int,input().split())
print("YES" if (a+b >= x >= a) else "NO")

Problem: p03377
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A, B, X= map(int, input().split())
print("YES" if A+B>=X else "NO")

Failing test case input:
3 0 1

Expected output:
NO


Actual output:
YES


Fixed submission (verdict: Accepted):
A, B, X= map(int, input().split())
print("YES" if A<=X and A+B>=X else "NO")

Problem: p03377
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a,b,x=map(int,input().split())
if a<=x and x<=b:
  print('YES')
else:
  print('NO')

Failing test case input:
3 1 3

Expected output:
YES


Actual output:
NO


Fixed submission (verdict: Accepted):
a,b,x=map(int,input().split())
if a<=x and x<=a+b:
  print('YES')
else:
  print('NO')

Problem: p03377
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a,b,c = map(int,input().split())
if c-a<=b:
  print('YES')
else:
  print('NO')

Failing test case input:
-1 4 -5

Expected output:
NO


Actual output:
YES


Fixed submission (verdict: Accepted):
a,b,c = map(int,input().split())
if c>= a:
  if c-a<=b:
    print('YES')
  else:
    print('NO')
else :
  print('NO')

Problem: p03377
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a,b,c=map(int,input().split())
print('YNEOS'[b<c-a::2])

Failing test case input:
3 0 2

Expected output:
NO


Actual output:
YES


Fixed submission (verdict: Accepted):
a,b,c=map(int,input().split())
print('YNEOS'[b<c-a or a>c::2])

Problem: p03377
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a, b, x = list(map(int, input().split()))

if (a <= x):
    if x-a<b:
        print('Yes')
        exit()
print('No')

Failing test case input:
5 1 1

Expected output:
NO


Actual output:
No


Fixed submission (verdict: Accepted):
a, b, x = list(map(int, input().split()))
if a <= x <= a + b:
    print('YES')
else:
    print('NO')

Problem: p03377
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A, B, X= map(int,input().split())
if A <= X:
    print('YES')
else: 
    print('NO')


Failing test case input:
-28 -1 4

Expected output:
NO


Actual output:
YES


Fixed submission (verdict: Accepted):
A, B, X= map(int,input().split())
if A <= X and A + B >=X:
    print('YES')
else: 
    print('NO')

Problem: p03377
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A,B,X=map(int,input().split())
if A<=X<=B:
    print("YES")
else:
    print("NO")

Failing test case input:
3 0 3

Expected output:
YES


Actual output:
NO


Fixed submission (verdict: Accepted):
A,B,X=map(int,input().split())
if A<=X<=A+B:
    print("YES")
else:
    print("NO")
Problem: p03377
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a, b, x = map(int, input().split())
if a+b-1 >= x:
    print("YES")
else:
    print("NO")

Failing test case input:
4 1 1

Expected output:
NO


Actual output:
YES


Fixed submission (verdict: Accepted):
a, b, x = map(int, input().split())
if a > x:
    print("NO")
elif a+b >= x:
    print("YES")
else:
    print("NO")

Problem: p03377
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a,b,x=map(int,input().split())
if b>=x-a:
    print("YES")
else:
    print("NO")

Failing test case input:
5 1 1

Expected output:
NO


Actual output:
YES


Fixed submission (verdict: Accepted):
a,b,x=map(int,input().split())
if b<x-a or a>x:
    print("NO")
else:
    print("YES")
Problem: p03433
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
A = int(input())
if N <= A:
    print("Yes")
elif N - 500 <= A:
    print ("Yes")
else:
    print("No")
    

Failing test case input:
37
001

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
N = int(input())
A = int(input())
Ns = N % 500
if Ns <= A:
    print("Yes")
else:
    print("No")

Problem: p03433
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
A = int(input())
if(N%100 <= A):
    print('Yes')
else:
    print('No')

Failing test case input:
2763
84

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
N = int(input())
A = int(input())
if(N%500 <= A):
    print('Yes')
else:
    print('No')

Problem: p03433
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input()) 
a = int(input())

print('Yes' if 0 <= n <= a else 'No')

Failing test case input:
2018
110

Expected output:
Yes


Actual output:
No


Fixed submission (verdict: Accepted):
n = int(input())
a = int(input())

n %= 500

print('Yes' if 0 <= n <= a else 'No')

Problem: p03433
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N=int(input())
X=int(input())
c=N&500
ans='Yes' if c <= X else 'No'
print(ans)

Failing test case input:
2018
101

Expected output:
Yes


Actual output:
No


Fixed submission (verdict: Accepted):
N=int(input())
X=int(input())
c=N%500
ans='Yes' if c <= X else 'No'
print(ans)

Problem: p03433
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=int(input())
A=int(input())
if(A!=0):
  if(N%A<=A):
    print("Yes")
elif(N%500==0):
  print("Yes")
else:
  print("No")

Failing test case input:
2763
-196

Expected output:
No


Actual output:
no output


Fixed submission (verdict: Accepted):
N=int(input())
A=int(input())
if(A!=0):
  if(N%500<=A):
    print("Yes")
  else:
    print("No")
elif(N%500==0):
  print("Yes")
else:
  print("No")

Problem: p03433
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
a = int(input())

n 
if n <= a:
    print("Yes")
else:
    print('No')

Failing test case input:
2018
110

Expected output:
Yes


Actual output:
No


Fixed submission (verdict: Accepted):
n = int(input())
a = int(input())

n %= 500
if n <= a:
    print("Yes")
else:
    print('No')

Problem: p03433
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n = input()
s = int(input())
n1 = int(n[-2] + n[-1])
if n1 <= s:
    print('Yes')
else:
    print('No')

Failing test case input:
2763
84

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
n = int(input())
s = int(input())
if n%500 <= s:
    print('Yes')
else:
    print('No')

Problem: p03433
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
a = int(input())
if n % 500 <= a:
  print("YES")
else:
  print("NO")

Failing test case input:
2763
-30

Expected output:
No


Actual output:
NO


Fixed submission (verdict: Accepted):
n = int(input())
a = int(input())
if n % 500 <= a:
  print("Yes")
else:
  print("No")
Problem: p03433
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
a=int(input())

if n%500>a:
    print("NO")
else:
    print("YES")

Failing test case input:
2018
113

Expected output:
Yes


Actual output:
YES


Fixed submission (verdict: Accepted):
n=int(input())
a=int(input())

if n%500>a:
    print("No")
else:
    print("Yes")

Problem: p03433
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N = int(input())
A = int(input())
if N > 1000:
    N = N%1000
if N >= A:
    print("Yes")
else:
    print("No")

Failing test case input:
2018
000

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
N = int(input())
A = int(input())
if N > 1000:
    N = N%1000
if N <= A:
    print("Yes")
else:
    print("No")
Problem: p02415
Buggy submission (Python3, verdict: Wrong Answer):
from sys import stdin

s = list(stdin.readline())
print(s)
for i in range(len(s)):
    if s[i].islower():
        s[i] = s[i].upper()
    elif s[i].isupper():
        s[i] = s[i].lower()

print(*s, sep="")


Failing test case input:
R@g,H GQKT-@ AKK@YOISOCBN BPDUWJ.

Expected output:
r@G,h gqkt-@ akk@yoisocbn bpduwj.


Actual output:
['R', '@', 'g', ',', 'H', ' ', 'G', 'Q', 'K', 'T', '-', '@', ' ', 'A', 'K', 'K', '@', 'Y', 'O', 'I', 'S', 'O', 'C', 'B', 'N', ' ', 'B', 'P', 'D', 'U', 'W', 'J', '.', '\n']
r@G,h gqkt-@ akk@yoisocbn bpduwj.



Fixed submission (verdict: Accepted):
from sys import stdin

s = list(stdin.readline())
for i in range(len(s)):
    if s[i].islower():
        s[i] = s[i].upper()
    elif s[i].isupper():
        s[i] = s[i].lower()

print(*s, sep="", end="")

Problem: p02415
Buggy submission (Python3, verdict: Wrong Answer):
S = input()
S.capitalize()
print(S.capitalize())



Failing test case input:
R@gH, K@FSQ, ALKAYOISOCBN BK.UWPD

Expected output:
r@Gh, k@fsq, alkayoisocbn bk.uwpd


Actual output:
R@gh, k@fsq, alkayoisocbn bk.uwpd


Fixed submission (verdict: Accepted):
S = input()
S.swapcase()
print(S.swapcase())

Problem: p02415
Buggy submission (Python3, verdict: Wrong Answer):
str = " ";
print(str.swapcase())

Failing test case input:
R@gH, G,KSQ@ AKK@YOISOCBN .PWUDKB

Expected output:
r@Gh, g,ksq@ akk@yoisocbn .pwudkb


Actual output:
no output


Fixed submission (verdict: Accepted):
s = input()
print(s.swapcase())

Problem: p02415
Buggy submission (Python3, verdict: Wrong Answer):
print(input().swapcase)


Failing test case input:
GAg,U HAQI-T AKK@YBJRODPN BKWUD1Q

Expected output:
gaG,u haqi-t akk@ybjrodpn bkwud1q


Actual output:
<built-in method swapcase of str object at 0x7f8810a27990>


Fixed submission (verdict: Accepted):
print(input().swapcase())

Problem: p02415
Buggy submission (Python3, verdict: Wrong Answer):
print(input().upper())

Failing test case input:
RHg@, G-IQTA AKK@YPIRODBN B/WUDKP

Expected output:
rhG@, g-iqta akk@ypirodbn b/wudkp


Actual output:
RHG@, G-IQTA AKK@YPIRODBN B/WUDKP


Fixed submission (verdict: Accepted):
print(input().swapcase())

Problem: p02415
Buggy submission (Python3, verdict: Wrong Answer):
sen = input()
print(sen.capitalize())


Failing test case input:
,RI@g KATFR, OLKANOISACCY CLOUDX.

Expected output:
,ri@G katfr, olkanoisaccy cloudx.


Actual output:
,ri@g katfr, olkanoisaccy cloudx.


Fixed submission (verdict: Accepted):
sen = input()
print(sen.swapcase())

Problem: p02415
Buggy submission (Python3, verdict: Wrong Answer):
Target=input()
Target.swapcase()
print(Target)



Failing test case input:
R,g@H G-IQTA AKK@YPISODBN B/WUDKP

Expected output:
r,G@h g-iqta akk@ypisodbn b/wudkp


Actual output:
R,g@H G-IQTA AKK@YPISODBN B/WUDKP


Fixed submission (verdict: Accepted):
target=input()
Ans=target.swapcase()
print(Ans)
Problem: p02415
Buggy submission (Python3, verdict: Wrong Answer):


char = input()

char.swapcase()

print(char)


Failing test case input:
HAg,S A-IQTH AKK@YPJRODBN BKWUD1Q

Expected output:
haG,s a-iqth akk@ypjrodbn bkwud1q


Actual output:
HAg,S A-IQTH AKK@YPJRODBN BKWUD1Q


Fixed submission (verdict: Accepted):


char = input()
print(char.swapcase())

Problem: p02415
Buggy submission (Python3, verdict: Wrong Answer):
s=input()
for c in s:
  if 'A' <= c and c <= 'Z':
    print(c.lower(), end='')
  elif 'a' <= c and c <= 'z':
    print(c.upper(), end='')
  else:
    print(c)


Failing test case input:
g@RI, ,QSF@K OLKANOISACCY B.KUXPD

Expected output:
G@ri, ,qsf@k olkanoisaccy b.kuxpd


Actual output:
G@
ri,
 
,
qsf@
k 
olkanoisaccy 
b.
kuxpd

Fixed submission (verdict: Accepted):
s=input()
for c in s:
  if 'A' <= c and c <= 'Z':
    print(c.lower(), end='')
  elif 'a' <= c and c <= 'z':
    print(c.upper(), end='')
  else:
    print(c,end='')
print()

Problem: p02415
Buggy submission (Python3, verdict: Wrong Answer):
a = input()
a.swapcase()
print(a)

Failing test case input:
R?g,H GQKT-@ AKK@YOISOCBN BPWUDK/

Expected output:
r?G,h gqkt-@ akk@yoisocbn bpwudk/


Actual output:
R?g,H GQKT-@ AKK@YOISOCBN BPWUDK/


Fixed submission (verdict: Accepted):
print(input().swapcase())
Problem: p03556
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
ans = 0

while True:
	if ans * ans >= n:
		break
	ans += 1
	
print(ans*ans)
	

Failing test case input:
385753315

Expected output:
385729600


Actual output:
385768881


Fixed submission (verdict: Accepted):
n = int(input())
ans = 0

while True:
	if ans * ans > n:
		break
	ans += 1
	
print((ans-1)*(ans-1))

Problem: p03556
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
print(int(n**0.5))

Failing test case input:
312115444

Expected output:
312087556


Actual output:
17666


Fixed submission (verdict: Accepted):
n = int(input())
m = int(n**0.5)
print(int(m**2))

Problem: p03556
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n=int(input())
for i in range(1,10**3+2):
  if i**2>n:print((i-1)**2);exit()


Failing test case input:
155815094

Expected output:
155800324


Actual output:
no output


Fixed submission (verdict: Accepted):
n=int(input())
for i in range(1,10**5+2):
  if i**2>n:print((i-1)**2);exit()

Problem: p03556
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
print((lambda x:max([i*i for i in range(10001) if x>=i]))(int(input())))

Failing test case input:
473588

Expected output:
473344


Actual output:
100000000


Fixed submission (verdict: Accepted):
print((lambda x:max([i*i for i in range(100001) if x>=i*i]))(int(input())))

Problem: p03556
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n=int(input())
print(int(n**(1/2)**2))


Failing test case input:
89041

Expected output:
88804


Actual output:
17


Fixed submission (verdict: Accepted):
n=int(input())
print(int(n**(1/2))**2)

Problem: p03556
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

N = int(input())

i = 1

while i ** 2 <= N:
    i += 1

print(i ** 2)

Failing test case input:
85859

Expected output:
85849


Actual output:
86436


Fixed submission (verdict: Accepted):

N = int(input())

i = 1

while i ** 2 <= N:
    i += 1

print((i - 1) ** 2)

Problem: p03556
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
print(round(int(input())**.5)**2)

Failing test case input:
670

Expected output:
625


Actual output:
676


Fixed submission (verdict: Accepted):
print(int(int(input())**.5)**2)

Problem: p03556
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN

N = int(input().strip())

print( int(N**(1/2)) )


Failing test case input:
526826000

Expected output:
526794304


Actual output:
22952


Fixed submission (verdict: Accepted):

from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN

N = int(input().strip())

print( int(N**(1/2))**2 )

Problem: p03556
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
N = int(input())
n = math.sqrt(N)
print(round(n)**2)

Failing test case input:
115087508

Expected output:
115068529


Actual output:
115089984


Fixed submission (verdict: Accepted):
import math
N = int(input())
n = math.sqrt(N)
print(math.floor(n)**2)
Problem: p03556
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
t=1
while t*t<n:
  t+=1
print(t-1)

Failing test case input:
397922727

Expected output:
397922704


Actual output:
19948


Fixed submission (verdict: Accepted):
n=int(input())
t=1
while t*t<=n:
  t+=1
print((t-1)**2)
Problem: p02408
Buggy submission (Python3, verdict: Wrong Answer):


n = int(input())
bs = []
bh = []
bc = []
bd = []

for i in range(n):    
    a = input().split()
    if a[0] == 'S':
        bs.append(int(a[1]))  
    if a[0] == 'H':
        bh.append(int(a[1]))  
    if a[0] == 'C':
        bc.append(int(a[1]))  
    if a[0] == 'D':
        bd.append(int(a[1]))

for ks in range(1,13):
    if ks not in bs:
        print('S '+str(ks))

for kh in range(1,13):
    if kh not in bh:
        print('H '+str(kh))
        
for kc in range(1,13):
    if kc not in bc:
        print('C '+str(kc))
        
for kd in range(1,13):
    if kd not in bd:
        print('D '+str(kd))


Failing test case 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 7
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 8
C 7
D 8
C 9
C 10
C 11
C 12
D 9
D 10
D 11
D 12
D 13

Expected output:
S 1
H 3
H 10
C 6
C 13


Actual output:
S 1
H 3
H 10
C 6


Fixed submission (verdict: Accepted):



n = int(input())
bs = []
bh = []
bc = []
bd = []

for i in range(n):    
    a = input().split()
    if a[0] == 'S':
        bs.append(int(a[1]))  
    if a[0] == 'H':
        bh.append(int(a[1]))  
    if a[0] == 'C':
        bc.append(int(a[1]))  
    if a[0] == 'D':
        bd.append(int(a[1]))

for ks in range(1,14):
    if ks not in bs:
        print('S '+str(ks))

for kh in range(1,14):
    if kh not in bh:
        print('H '+str(kh))
        
for kc in range(1,14):
    if kc not in bc:
        print('C '+str(kc))
        
for kd in range(1,14):
    if kd not in bd:
        print('D '+str(kd))

Problem: p02408
Buggy submission (Python3, verdict: Wrong Answer):
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)



Failing test case 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 3
H 7
S 2
S 3
S 1
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

Expected output:
S 4
H 4
H 5
C 12
D 8


Actual output:
S 4
H 4
H 5
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 8


Fixed submission (verdict: Accepted):
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)
Problem: p02408
Buggy submission (Python3, verdict: Wrong Answer):
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 (suit, num + 1) in cards:
            print(suit, '', num)


Failing test case 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 3
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

Expected output:
S 1
H 7
H 10
C 12
D 8


Actual output:
S  1
S  2
S  3
S  4
S  5
S  6
S  7
S  8
S  9
S  10
S  11
S  12
H  0
H  1
H  2
H  3
H  4
H  5
H  7
H  8
H  10
H  11
H  12
C  0
C  1
C  2
C  3
C  4
C  5
C  6
C  7
C  8
C  9
C  10
C  12
D  0
D  1
D  2
D  3
D  4
D  5
D  6
D  8
D  9
D  10
D  11
D  12


Fixed submission (verdict: Accepted):
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)

Problem: p02408
Buggy submission (Python3, verdict: Wrong Answer):
import sys

cards_num = int(sys.stdin.readline())
cards =[ card[:-1] for card in sys.stdin.readlines() ]

print(cards_num)
print(cards)

all_cards = [ i + ' ' + str(j) for i in 'SHCD' for j in range(1,14) ]

missing_cards = [i for i in all_cards if not(i in cards) ]

for s in missing_cards:
    print(s,end='')


Failing test case input:
47
S 10
S 11
S 12
S 13
H 1
H 2
S 6
S 7
S 8
S 9
H 5
H 8
H 9
H 10
H 11
H 3
H 6
S 2
S 3
S 1
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

Expected output:
S 4
H 4
H 7
C 12
D 8


Actual output:
47
['S 10', 'S 11', 'S 12', 'S 13', 'H 1', 'H 2', 'S 6', 'S 7', 'S 8', 'S 9', 'H 5', 'H 8', 'H 9', 'H 10', 'H 11', 'H 3', 'H 6', 'S 2', 'S 3', 'S 1', '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']
S 4H 4H 7C 12D 8

Fixed submission (verdict: Accepted):
import sys

cards_num = int(sys.stdin.readline())
cards =[ card[:-1] for card in sys.stdin.readlines() ]

all_cards = [ i + ' ' + str(j) for i in 'SHCD' for j in range(1,14) ]

missing_cards = [i for i in all_cards if not(i in cards) ]

for s in missing_cards:
    print(s)
Problem: p02408
Buggy submission (Python3, verdict: Wrong Answer):
import itertools
n = int(input())
c = list(itertools.product(['S', 'H', 'C', 'D'], range(1,14)))
for _ in range(n):
    s, num = input().split()
    c.remove((s, int(num)))
for i in range(4*13 - n):
    print(*c, sep = '\n')

Failing test case input:
47
S 10
S 11
S 12
S 13
H 1
H 3
S 6
S 7
S 8
S 9
H 6
H 7
H 9
H 10
H 11
H 4
H 5
S 2
S 3
S 1
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 8
C 12
C 9
C 10
C 11
C 13
D 9
D 10
D 11
D 12
D 13

Expected output:
S 4
H 2
H 8
C 7
D 8


Actual output:
('S', 4)
('H', 2)
('H', 8)
('C', 7)
('D', 8)
('S', 4)
('H', 2)
('H', 8)
('C', 7)
('D', 8)
('S', 4)
('H', 2)
('H', 8)
('C', 7)
('D', 8)
('S', 4)
('H', 2)
('H', 8)
('C', 7)
('D', 8)
('S', 4)
('H', 2)
('H', 8)
('C', 7)
('D', 8)


Fixed submission (verdict: Accepted):
import itertools
n = int(input())
c = list(itertools.product(['S', 'H', 'C', 'D'], range(1,14)))
for _ in range(n):
    s, num = input().split()
    c.remove((s, int(num)))
for i in range(4*13 - n):
    print(c[i][0], c[i][1])

Problem: p02408
Buggy submission (Python3, verdict: Wrong Answer):
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="")

Failing test case 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 3
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

Expected output:
S 1
H 7
H 10
C 12
D 8


Actual output:
['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']
S 1
H 7
H 10
C 12
D 8

Fixed submission (verdict: Accepted):
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)
Problem: p02408
Buggy submission (Python3, verdict: Wrong Answer):
s = [0] * 13
h = [0] * 13
c = [0] * 13
d = [0] * 13

num = int(input())
for i in range(num):
    m, n = input().split()
    n = int(n)
    if m == "s":
        s[n] == 1
    if m == "h":
        h[n] == 1
    if m == "c":
        h[n] == 1
    if m == "d":
        h[n] == 1

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

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

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

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






Failing test case input:
47
S 10
S 11
S 12
S 13
H 1
H 2
S 6
S 7
S 2
S 9
H 6
H 8
H 9
H 10
H 11
H 4
H 7
S 1
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 8
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

Expected output:
S 8
H 3
H 5
C 12
D 6


Actual output:
S 1
S 2
S 3
S 4
S 5
S 6
S 7
S 8
S 9
S 10
S 11
S 12
H 1
H 2
H 3
H 4
H 5
H 6
H 7
H 8
H 9
H 10
H 11
H 12
C 1
C 2
C 3
C 4
C 5
C 6
C 7
C 8
C 9
C 10
C 11
C 12
S 1
S 2
S 3
S 4
S 5
S 6
S 7
S 8
S 9
S 10
S 11
S 12


Fixed submission (verdict: Accepted):
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))
Problem: p02408
Buggy submission (Python3, verdict: Wrong Answer):
s = [0] * 13
h = [0] * 13
c = [0] * 13
d = [0] * 13

num = int(input())
for i in range(num):
    m, n = input().split()
    n = int(n)
    if m == "s":
        s[n] = 1
    if m == "h":
        h[n] = 1
    if m == "c":
        c[n] = 1
    if m == "d":
        h[n] = 1

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

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

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

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






Failing test case 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 8
D 5
D 6
D 7
C 3
C 4
C 5
C 6
C 7
C 8
C 12
C 10
C 11
C 13
D 9
D 10
D 11
D 12
D 13

Expected output:
S 1
H 3
H 7
C 9
D 4


Actual output:
S 1
S 2
S 3
S 4
S 5
S 6
S 7
S 8
S 9
S 10
S 11
S 12
H 1
H 2
H 3
H 4
H 5
H 6
H 7
H 8
H 9
H 10
H 11
H 12
C 1
C 2
C 3
C 4
C 5
C 6
C 7
C 8
C 9
C 10
C 11
C 12
D 1
D 2
D 3
D 4
D 5
D 6
D 7
D 8
D 9
D 10
D 11
D 12


Fixed submission (verdict: Accepted):
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))
Problem: p02408
Buggy submission (Python3, verdict: Wrong Answer):

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


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

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

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


Failing test case 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 7
H 11
H 4
H 5
S 2
S 3
S 1
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
D 8
C 9
C 10
C 11
C 12
D 9
D 10
D 11
D 12
D 13

Expected output:
S 4
H 3
H 10
C 8
C 13


Actual output:
S 4
H 3
H 10
C 8


Fixed submission (verdict: Accepted):

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


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

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

    if mark == 'S':
        Slist.append(num)
    elif mark == 'H':
        Hlist.append(num)
    elif mark == 'C':
        Clist.append(num)
    else:
        Dlist.append(num)
        
Slist.sort()
Hlist.sort()
Clist.sort()
Dlist.sort()
    
check(Slist, 'S')
check(Hlist, 'H')
check(Clist, 'C')
check(Dlist, 'D')
Problem: p02408
Buggy submission (Python3, verdict: Wrong Answer):
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()
    b=int(b)
    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)


Failing test case 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 7
S 1
S 3
S 4
S 5
H 12
H 13
C 1
C 2
D 1
D 2
D 3
D 6
D 5
D 8
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

Expected output:
S 2
H 3
H 5
C 12
D 4


Actual output:
S 0
S 2
S 6
S 7
S 8
S 9
H 0
H 3
H 5
H 6
H 9
C 0
C 12
D 0
D 4
D 6


Fixed submission (verdict: Accepted):
n=int(input())
x={0:'S',1:'H',2:'C',3:'D'}
c=[[0]*13,[0]*13,[0]*13,[0]*13]
for r in range(n):
    a,b=input().split()
    b=int(b)-1
    if a=='S':
        c[0][b]=1
    elif a=='H':
        c[1][b]=1
    elif a=='C':
        c[2][b]=1
    else:
        c[3][b]=1
for i in range(4):
    for j in range(13):
        if c[i][j]==0:
            print(x[i],j+1)