ZhenlongDai/ACPR huggingface dataset:
Problem: p02958
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
p = list(map(int, input().split()))
cnt = 0
check = 0
for i in range(n-1):
  if p[i+1] - p[i] == 1:
    cnt += 1
  else :
    check += 1
    
if (cnt == n-1) or (check == 2 and cnt == n-3) :
  print("YES")
else:
  print("NO")  

Failing test case input:
5
3 4 3 4 1

Expected output:
NO


Actual output:
YES


Fixed submission (verdict: Accepted):
n = int(input())
p = list(map(int, input().split()))
cnt = 0
for i in range(n):
  if p[i] != i + 1:
    cnt += 1
    
if cnt == 0 or cnt == 2 :
  print("YES")
else:
  print("NO")
Problem: p02237
Buggy submission (Python3, verdict: Wrong Answer):
n=int(input())
G=[[0 for i in range(n)]for j in range(n)]
u=[0 for i in range(n)]
for i in range(n):
    A=input().split()
    u[i]=int(A[0])
    k=int(A[1])
    for j in range(k):
        x=int(A[j+2])-1
        G[i][x]=1
print(G)



Failing test case input:
4
1 2 2 4
2 1 3
1 -2
4 1 4

Expected output:
0 1 0 1
0 0 1 0
0 0 0 0
0 0 0 1


Actual output:
[[0, 1, 0, 1], [0, 0, 1, 0], [0, 0, 0, 0], [0, 0, 0, 1]]


Fixed submission (verdict: Accepted):
n=int(input())
G=[[0 for i in range(n)]for j in range(n)]
u=[0 for i in range(n)]
for i in range(n):
    A=input().split()
    u[i]=int(A[0])
    k=int(A[1])
    for j in range(k):
        x=int(A[j+2])-1
        G[i][x]=1
for i in range(n):
    for j in range(n):
        if j<n-1:
            print(G[i][j],end=" ")
        else:
            print(G[i][j])

Problem: p02237
Buggy submission (Python3, verdict: Wrong Answer):

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


graph_table = [[0]*n for i in range(n)]


for d in data:
    node_id = d[0]
    num_of_e = d[1]
    for e in d[2:]:
        graph_table[node_id-1][e-1] = 1

print(graph_table)


for g in graph_table:
    print(*g)

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

Expected output:
0 1 1 0
1 0 0 0
0 0 0 0
1 0 0 0


Actual output:
[[0, 1, 1, 0], [1, 0, 0, 0], [0, 0, 0, 0], [1, 0, 0, 0]]
0 1 1 0
1 0 0 0
0 0 0 0
1 0 0 0


Fixed submission (verdict: Accepted):

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


graph_table = [[0]*n for i in range(n)]


for d in data:
    node_id = d[0]
    num_of_e = d[1]
    for e in d[2:]:
        graph_table[node_id-1][e-1] = 1


for g in graph_table:
    print(*g)

Problem: p02237
Buggy submission (Python3, verdict: Wrong Answer):
n = int(input())
GM = [[0]*n for i in range(n)]

for i in range(n):
    data = list(map(int,input().split()))
    for i in range(data[1]):
        GM[data[0]-1][data[i+2]-1] = 1

    print(*GM[i])

Failing test case input:
4
1 2 2 1
2 1 1
1 -1
0 1 1

Expected output:
1 1 0 0
1 0 0 0
0 0 0 0
1 0 0 0


Actual output:
0 0 0 0
1 1 0 0
0 0 0 0
1 1 0 0


Fixed submission (verdict: Accepted):
n = int(input())
GM = [[0]*n for i in range(n)]

for i in range(n):
    data = list(map(int,input().split()))
    for i in range(data[1]):
        GM[data[0]-1][data[i+2]-1] = 1


for i in range(n):
    print(*GM[i])
Problem: p02237
Buggy submission (Python3, verdict: Wrong Answer):
n=int(input());
G=[[0 for i in range(n)]for j in range(n)]

for i in range(n):
    list=[int(m) for m in input().split()]
    u=list[0]
    k=list[1]
    for j in range(2,len(list)):
        v=list[j]
        G[u-1][v-1]=1
print(G)


Failing test case input:
4
1 2 3 4
2 1 4
3 -1
4 1 1

Expected output:
0 0 1 1
0 0 0 1
0 0 0 0
1 0 0 0


Actual output:
[[0, 0, 1, 1], [0, 0, 0, 1], [0, 0, 0, 0], [1, 0, 0, 0]]


Fixed submission (verdict: Accepted):
n=int(input());
G=[[0 for i in range(n)]for j in range(n)]
for i in range(n):
    list=[int(m) for m in input().split()]
    u=list[0]
    k=list[1]
    for j in range(2,len(list)):
        v=list[j]
        G[u-1][v-1]=1
for i in range(n):
    for j in range(n):
        if j!=n-1:
            print(G[i][j],end=" ")
        else:
            print(G[i][j],end="\n")

Problem: p02237
Buggy submission (Python3, verdict: Wrong Answer):
n = int(input())

A = [[0 for i in range(n)] for j in range(n)]

for i in range(n):

	B = input().split()

	if B[1]!=0:
		for j in range(int(B[1])):
			
			A[i][int(B[2+j])-1] = 1

for i in range(n):
	for j in range(n):
		if j!=n-1:
			print(A[i][j], end=" ")
		else:
			print(end="\n")


Failing test case input:
4
1 2 1 4
2 1 1
7 -1
4 1 4

Expected output:
1 0 0 1
1 0 0 0
0 0 0 0
0 0 0 1


Actual output:
1 0 0 
1 0 0 
0 0 0 
0 0 0 


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

A = [[0 for i in range(n)] for j in range(n)]

for i in range(n):

	B = input().split()

	if B[1]!=0:
		for j in range(int(B[1])):
			
			A[i][int(B[2+j])-1] = 1

for i in range(n):
	for j in range(n):
		if j!=n-1:
			print(A[i][j], end=" ")
		else:
			print(A[i][j], end="\n")

Problem: p02237
Buggy submission (Python3, verdict: Wrong Answer):
n = int(input())

g = [[0 for _ in range(n)] for _ in range(n)]

for i in range(n):
    a = list(map(int, input().split()))
    for j in range(a[1]):
        g[a[0] - 1][a[j + 2] - 1] = 1
        g[a[j + 2] - 1][a[0] - 1] = 1

for i in range(n):
    print(*g[i])


Failing test case input:
4
1 2 3 4
2 1 2
0 -2
4 1 1

Expected output:
0 0 1 1
0 1 0 0
0 0 0 0
1 0 0 0


Actual output:
0 0 1 1
0 1 0 0
1 0 0 0
1 0 0 0


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

g = [[0 for _ in range(n)] for _ in range(n)]

for i in range(n):
    a = list(map(int, input().split()))
    for j in range(a[1]):
        g[a[0] - 1][a[j + 2] - 1] = 1

for i in range(n):
    print(*g[i])

Problem: p02237
Buggy submission (Python3, verdict: Wrong Answer):




n=int(input())
list1=[[0 for i in range(n)] for j in range(n)]


for i in range(n):
	a=list(map(int,input().split()))
	
	if a[1]>0:
		for j in range(2,len(a)):
			list1[i][a[j]-1]=1
			
print(list1)




Failing test case input:
4
1 2 1 4
2 1 4
3 -4
0 1 4

Expected output:
1 0 0 1
0 0 0 1
0 0 0 0
0 0 0 1


Actual output:
[[1, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 0], [0, 0, 0, 1]]


Fixed submission (verdict: Accepted):

n=int(input())
list1=[[0 for i in range(n)] for j in range(n)]


for i in range(n):
	a=list(map(int,input().split()))
	
	if a[1]>0:
		for j in range(2,len(a)):
			list1[i][a[j]-1]=1
			
for i in range(n):
	print(*list1[i])
Problem: p02237
Buggy submission (Python3, verdict: Wrong Answer):
if __name__ == '__main__':
    N = int(input())
    matrix = [[0] * N for _ in range(N)]
    for i in matrix:
        node_info = [int(i) for i in input().split()]
        node_i = node_info[0] - 1
        if not node_info[1] == 0:
            for i in node_info[2:]:
                matrix[node_i][i-1] = 1
    [print(line) for line in matrix]

Failing test case input:
4
1 2 1 4
2 1 4
1 -1
4 1 3

Expected output:
1 0 0 1
0 0 0 1
0 0 0 0
0 0 1 0


Actual output:
[1, 0, 0, 1]
[0, 0, 0, 1]
[0, 0, 0, 0]
[0, 0, 1, 0]


Fixed submission (verdict: Accepted):
if __name__ == '__main__':
    N = int(input())
    matrix = [['0'] * N for _ in range(N)]
    for i in matrix:
        node_info = [int(i) for i in input().split()]
        node_i = node_info[0] - 1
        if not node_info[1] == 0:
            for i in node_info[2:]:
                matrix[node_i][i - 1] = '1'
    [print(' '.join(line)) for line in matrix]

Problem: p02237
Buggy submission (Python3, verdict: Wrong Answer):
def main():
    num = int(input())
    T = [[0] * num for i in range(num)]
    for n in range(num):
        a = list(map(int,input().split()))
        u = a[0] - 1
        if a[1] > 0:
            for i in a[2:]:
                print(i)
                T[u][i-1] = 1

    for i in range(num):
        print(" ".join(map(str,T[i])))

if __name__ == '__main__':
    main()

Failing test case input:
4
1 2 1 4
2 1 4
1 -1
4 1 3

Expected output:
1 0 0 1
0 0 0 1
0 0 0 0
0 0 1 0


Actual output:
1
4
4
3
1 0 0 1
0 0 0 1
0 0 0 0
0 0 1 0


Fixed submission (verdict: Accepted):
def main():
    num = int(input())
    T = [[0] * num for i in range(num)]
    for n in range(num):
        a = list(map(int,input().split()))
        u = a[0] - 1
        if a[1] > 0:
            for i in a[2:]:
                T[u][i-1] = 1

    for i in range(num):
        print(" ".join(map(str,T[i])))

if __name__ == '__main__':
    main()

Problem: p02237
Buggy submission (Python3, verdict: Wrong Answer):
n = int(input())
for i in range(n):
    node = list(map(int,input().split()))
    node_list = node[2:]
    matrix = [0] * n
    for j in node_list:
        matrix[j -1] = 1
    print("".join(str(matrix)))

Failing test case input:
4
1 2 1 2
2 1 1
0 -2
4 1 2

Expected output:
1 1 0 0
1 0 0 0
0 0 0 0
0 1 0 0


Actual output:
[1, 1, 0, 0]
[1, 0, 0, 0]
[0, 0, 0, 0]
[0, 1, 0, 0]


Fixed submission (verdict: Accepted):
n = int(input())
for i in range(n):
    node = list(map(int,input().split()))
    node_list = node[2:]
    matrix = ["0"]* n

    for j in node_list:
        matrix[j -1] = "1"
    print(" ".join(matrix))
Problem: p02318
Buggy submission (Python3, verdict: Wrong Answer):
s_1 = input()
s_2 = input()

memo = [[0 for i in range(len(s_2)+1)] for j in range(len(s_1) + 1)]
flag = [[False for i in range(len(s_2)+1)] for j in range(len(s_1) + 1)]

for i in range(1, len(s_1)+1):
    for j in range(1, len(s_2)+1):
        if not flag[i][j]:
            flag[i][j] = True
            if s_1[i-1] == s_2[j-1]:
                memo[i][j] = min(memo[i-1][j-1], memo[i][j-1]+1)
                memo[i][j] = min(memo[i][j], memo[i-1][j]+1)
            else:
                memo[i][j] = min(memo[i-1][j-1]+1, memo[i][j-1]+1)
                memo[i][j] = min(memo[i][j], memo[i-1][j]+1)

print(memo[len(s_1)][len(s_2)])






Failing test case input:
bd`c
dcn

Expected output:
3


Actual output:
2


Fixed submission (verdict: Accepted):
s_1 = input()
s_2 = input()

memo = [[0 for i in range(len(s_2)+1)] for j in range(len(s_1) + 1)]
flag = [[False for i in range(len(s_2)+1)] for j in range(len(s_1) + 1)]

for i in range(1, len(s_1)+1):
    memo[i][0] = i
for j in range(1, len(s_2)+1):
    memo[0][j] = j

for i in range(1, len(s_1)+1):
    for j in range(1, len(s_2)+1):
        if not flag[i][j]:
            flag[i][j] = True
            if s_1[i-1] == s_2[j-1]:
                memo[i][j] = min(memo[i-1][j-1], memo[i][j-1]+1)
                memo[i][j] = min(memo[i][j], memo[i-1][j]+1)
            else:
                memo[i][j] = min(memo[i-1][j-1]+1, memo[i][j-1]+1)
                memo[i][j] = min(memo[i][j], memo[i-1][j]+1)

print(memo[len(s_1)][len(s_2)])

Problem: p02318
Buggy submission (Python3, verdict: Wrong Answer):
def ans(n, m):
    ln = len(n)
    lm = len(m)
    dp = [list(range(lm+1)) for i in range(ln+1)]
    
    for i in range(ln+1):
        dp[i][0] = i
    for j in range(lm+1):
        dp[0][j] = j
    for i in range(1,ln+1):
        for j in range(1,lm+1):
            if n[i-1] == m[j-1]:
                dp[i][j] = dp[i-1][j-1]
            else:
                dp[i][j] = min(dp[i][j-1]+1, dp[i-1][j]+1, dp[i][j]+1, dp[i-1][j-1]+1)
    return dp[-1][-1]
n = input()
m = input()
print(ans(n, m))


Failing test case input:
bd`c
ncd

Expected output:
4


Actual output:
3


Fixed submission (verdict: Accepted):
def ans(n, m):
    ln = len(n)
    lm = len(m)
    dp = [[0] * (lm+1) for _ in range(ln+1)]
    
    for i in range(ln+1):
        dp[i][0] = i
    for j in range(lm+1):
        dp[0][j] = j
    for i in range(1,ln+1):
        for j in range(1,lm+1):
            if n[i-1] == m[j-1]:
                dp[i][j] = dp[i-1][j-1]
            else:
                dp[i][j] = min(dp[i][j-1]+1, dp[i-1][j]+1, dp[i-1][j-1]+1)
    return dp[-1][-1]
n = input()
m = input()
print(ans(n, m))
Problem: p02318
Buggy submission (Python3, verdict: Wrong Answer):

def ED():
    X = " " + input()
    Y = " " + input()
    ed = [[0]*(len(X)) for _ in range(len(Y))]
    for j in range(len(X)):
        for i in range(len(Y)):
            if (i == j == 0):
                continue
            if (X[j] == Y[i]):
                ed[i][j] = ed[i-1][j-1]
            else:
                if(j > i):
                    ed[i][j] = ed[i][j-1] + 1
                elif(j < i):
                    ed[i][j] = ed[i-1][j] + 1
                elif(j == i):
                    ed[i][j] = ed[i-1][j-1] + 1
    return ed[len(Y)-1][len(X)-1]

if __name__ == '__main__':
     print(ED())

Failing test case input:
bd`c
dcn

Expected output:
3


Actual output:
4


Fixed submission (verdict: Accepted):

def ED():
    X = " " + input()
    Y = " " + input()
    ed = [[float("inf")]*(len(X)) for _ in range(len(Y))]
    
    for j in range(len(X)):
        ed[0][j] = j
    for i in range(len(Y)):
        ed[i][0] = i
        
    for j in range(1, len(X)):
        for i in range(1, len(Y)):
            if (X[j] == Y[i]):
                ed[i][j] = ed[i-1][j-1]
            else:
                ed[i][j] = min(ed[i-1][j-1], ed[i][j-1], ed[i-1][j]) + 1
            
    return ed[len(Y)-1][len(X)-1]

if __name__ == '__main__':
     print(ED())

Problem: p02318
Buggy submission (Python3, verdict: Wrong Answer):
def levenshtein(X,Y):
    f=[[0 for i in range(len(Y)+1)]for j in range(len(X)+1)]
    for i in range(len(X)+1):
        f[i][0]=i
    for j in range(1,len(Y)+1):
        f[0][j]=j
    for i in range(1,len(X)+1):
        for j in range(len(Y)+1):
            if X[i-1]==Y[j-1]:
                f[i][j]=min(f[i-1][j]+1,f[i][j-1]+1,f[i-1][j-1])
            else:
                f[i][j]=min(f[i-1][j]+1,f[i][j-1]+1,f[i-1][j-1]+1)
    return f[len(X)][len(Y)]

X=input()
Y=input()

print(levenshtein(X,Y))


Failing test case input:
ipcb
ckbo

Expected output:
4


Actual output:
3


Fixed submission (verdict: Accepted):
def levenshtein(X,Y):
    f=[[0 for i in range(len(Y)+1)]for j in range(len(X)+1)]
    for i in range(len(X)+1):
        f[i][0]=i
    for j in range(len(Y)+1):
        f[0][j]=j
    for i in range(1,len(X)+1):
        for j in range(1,len(Y)+1):
            if X[i-1]==Y[j-1]:
                f[i][j]=min(f[i-1][j]+1,f[i][j-1]+1,f[i-1][j-1])
            else:
                f[i][j]=min(f[i-1][j]+1,f[i][j-1]+1,f[i-1][j-1]+1)
    return f[len(X)][len(Y)]

X=input()
Y=input()

print(levenshtein(X,Y))
Problem: p02318
Buggy submission (Python3, verdict: Wrong Answer):
s1 = input()
s2 = input()
x = [[0 for i in range(len(s2))]for j in range(len(s1))]

def g(i,j):
    if i == 0 or j == 0:
        if s1[i] == s2[j]:
            x[i][j] = abs(i-j)
        else:
            if i == 0:
                x[i][j] = x[i][j-1] + 1
            else:
                x[i][j] = x[i-1][j] + 1
    elif s1[i] == s2[j]:
        x[i][j] = x[i-1][j-1]
    else:
        x[i][j] = min(x[i][j-1] + 1,x[i-1][j] + 1)
        

for i in range(len(s1)):
    for j in range(len(s2)):
        g(i,j)

print(x[len(s1)-1][len(s2)-1])


Failing test case input:
rbia
alcm

Expected output:
4


Actual output:
6


Fixed submission (verdict: Accepted):
s1 = input()
s2 = input()
x = [[0 for i in range(len(s2))]for j in range(len(s1))]

def g(i,j):
    if i == 0 or j == 0:
        if s1[i] == s2[j]:
            x[i][j] = abs(i-j)
        else:
            if i == 0:
                x[i][j] = x[i][j-1] + 1
            else:
                x[i][j] = x[i-1][j] + 1
    elif s1[i] == s2[j]:
        x[i][j] = min(x[i-1][j-1],x[i][j-1]+1,x[i-1][j]+1)
    else:
        x[i][j] = min(x[i-1][j-1]+1,x[i][j-1]+1,x[i-1][j]+1)
        

for i in range(len(s1)):
    for j in range(len(s2)):
        g(i,j)

print(x[len(s1)-1][len(s2)-1])

Problem: p02318
Buggy submission (Python3, verdict: Wrong Answer):
def levenshtein(X,Y):
    f=[[0 for i in range(len(Y)+1)]for j in range(len(X)+1)]
    for i in range(len(X)+1):
        for j in range(len(Y)+1):
            if X[i-1]==Y[j-1]:
                f[i][j]=min(f[i-1][j]+1,f[i][j-1]+1,f[i-1][j-1])
            else:
                f[i][j]=min(f[i-1][j]+1,f[i][j-1]+1,f[i-1][j-1]+1)
    return f[len(X)][len(Y)]

X=input()
Y=input()

print(levenshtein(X,Y))


Failing test case input:
_dac
cmb

Expected output:
4


Actual output:
3


Fixed submission (verdict: Accepted):
def levenshtein(X,Y):
    f=[[0 for i in range(len(Y)+1)]for j in range(len(X)+1)]
    for i in range(len(X)+1):
        f[i][0]=i
    for j in range(len(Y)+1):
        f[0][j]=j
    for i in range(1,len(X)+1):
        for j in range(1,len(Y)+1):
            if X[i-1]==Y[j-1]:
                f[i][j]=min(f[i-1][j]+1,f[i][j-1]+1,f[i-1][j-1])
            else:
                f[i][j]=min(f[i-1][j]+1,f[i][j-1]+1,f[i-1][j-1]+1)
    return f[len(X)][len(Y)]

X=input()
Y=input()

print(levenshtein(X,Y))
Problem: p02318
Buggy submission (Python3, verdict: Wrong Answer):

import sys
def search(a,b):
    na=len(a)
    nb=len(b)
    array = [[0]*(nb+1) for _ in range(na+1)]
    for i in range(na):
        array[i][0]=i
    for j in range(nb):
        array[0][j]=j
    for i,x in enumerate(a,1):
        prerow=array[i-1]
        row=array[i]
    for j,y in enumerate(b,1):
            if x == y:
                row[j]=prerow[j-1]
            elif prerow[j] > row[j-1]:
                row[j] = row[j-1]+1
            else:
                row[j] = prerow[j]+1
    return array[-1][-1]

a=input()
b=input()
print(search(a,b))


Failing test case input:
cca_
lcb

Expected output:
3


Actual output:
1


Fixed submission (verdict: Accepted):
def search(a,b):
    na=len(a)
    nb=len(b)
    array = [[0]*(nb+1) for _ in range(na+1)]
    for i in range(na+1):
        array[i][0]=i
    for j in range(nb+1):
        array[0][j]=j
    for i,x in enumerate(a,1):
        prerow=array[i-1]
        row=array[i]
        for j,y in enumerate(b,1):
            if x == y:
                row[j]=prerow[j-1]
            else:
                row[j]=min(prerow[j], prerow[j-1], row[j-1])+1
    
    return array[-1][-1]

a=input()
b=input()
print(search(a,b))

Problem: p02318
Buggy submission (Python3, verdict: Wrong Answer):
def search(a,b):
    na=len(a)
    nb=len(b)
    array = [[0]*(nb+1) for _ in range(na+1)]
    for i in range(na):
        array[i][0]=i
    for j in range(nb):
        array[0][j]=j
    for i,x in enumerate(a,1):
        prerow=array[i-1]
        row=array[i]
        for j,y in enumerate(b,1):
            if x == y:
                row[j]=prerow[j-1]
            else:
                row[j]=min(prerow[j], prerow[j-1], row[j-1])+1
    
    return array[-1][-1]

a=input()
b=input()
print(search(a,b))




Failing test case input:
cb`a
mcc

Expected output:
4


Actual output:
3


Fixed submission (verdict: Accepted):
def search(a,b):
    na=len(a)
    nb=len(b)
    array = [[0]*(nb+1) for _ in range(na+1)]
    for i in range(na+1):
        array[i][0]=i
    for j in range(nb+1):
        array[0][j]=j
    for i,x in enumerate(a,1):
        prerow=array[i-1]
        row=array[i]
        for j,y in enumerate(b,1):
            if x == y:
                row[j]=prerow[j-1]
            else:
                row[j]=min(prerow[j], prerow[j-1], row[j-1])+1
    
    return array[-1][-1]

a=input()
b=input()
print(search(a,b))
Problem: p02318
Buggy submission (Python3, verdict: Wrong Answer):
def levenshtein(str1, str2):
    if len(str1) == 0 or len(str2) == 0: return max(len(str1), len(str2))
    
    dp = [[None for i in range(len(str2))] for i in range(len(str1))]
    for i in range(len(str1)): dp[i][0] = i
    for j in range(len(str2)): dp[0][j] = j

    for i in range(1, len(str1)):
        for j in range(1, len(str2)):
            val = dp[i-1][j-1] if str1[i] == str2[j] else dp[i-1][j-1]+1
            dp[i][j] = min(val, dp[i-1][j]+1, dp[i][j-1]+1)
    return dp[-1][-1]

s1 = input()
s2 = input()

print(levenshtein(s1, s2))


Failing test case input:
ibpc
ccpi

Expected output:
3


Actual output:
2


Fixed submission (verdict: Accepted):
def levenshtein(str1, str2):
    if len(str1) == 0 or len(str2) == 0: return max(len(str1), len(str2))
    
    dp = [[None for i in range(len(str2)+1)] for i in range(len(str1)+1)]
    for i in range(len(str1)+1): dp[i][0] = i
    for j in range(len(str2)+1): dp[0][j] = j

    for i in range(1, len(str1)+1):
        for j in range(1, len(str2)+1):
            val = dp[i-1][j-1] if str1[i-1] == str2[j-1] else dp[i-1][j-1]+1
            dp[i][j] = min(val, dp[i-1][j]+1, dp[i][j-1]+1)
    return dp[-1][-1]

s1 = input()
s2 = input()

print(levenshtein(s1, s2))

Problem: p02318
Buggy submission (Python3, verdict: Wrong Answer):
def levenshtein(X,Y):
    f=[[0 for i in range(len(Y)+1)]for j in range(len(X)+1)]
    for i in range(len(X)):
        f[i][0]=i
    for j in range(len(Y)):
        f[0][j]=j
    for i in range(len(X)+1):
        for j in range(len(Y)+1):
            if X[i-1]==Y[j-1]:
                f[i][j]=min(f[i-1][j]+1,f[i][j-1]+1,f[i-1][j-1])
            else:
                f[i][j]=min(f[i-1][j]+1,f[i][j-1]+1,f[i-1][j-1]+1)
    return f[len(X)][len(Y)]

X=input()
Y=input()

print(levenshtein(X,Y))



Failing test case input:
cc`b
ncd

Expected output:
3


Actual output:
4


Fixed submission (verdict: Accepted):
def levenshtein(X,Y):
    f=[[0 for i in range(len(Y)+1)]for j in range(len(X)+1)]
    for i in range(len(X)+1):
        f[i][0]=i
    for j in range(len(Y)+1):
        f[0][j]=j
    for i in range(1,len(X)+1):
        for j in range(1,len(Y)+1):
            if X[i-1]==Y[j-1]:
                f[i][j]=min(f[i-1][j]+1,f[i][j-1]+1,f[i-1][j-1])
            else:
                f[i][j]=min(f[i-1][j]+1,f[i][j-1]+1,f[i-1][j-1]+1)
    return f[len(X)][len(Y)]

X=input()
Y=input()

print(levenshtein(X,Y))
Problem: p02830
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
s, t = list(input().split())
ans = []
for i in range(n):
  ans += s[i]
  ans += t[i]

print(ans)


Failing test case input:
5
baaaa aaaaa

Expected output:
baaaaaaaaa


Actual output:
b, a, a, a, a, a, a, a, a, a

Fixed submission (verdict: Accepted):
n = int(input())
s, t = list(input().split())
ans = ""
for i in range(n):
  ans += s[i]
  ans += t[i]

print(ans)

Problem: p02830
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
S,T = input().split()

print(S)
print(T)

s = ''
for i in range(N):
    s += S[i]
    s += T[i]

print(s)

Failing test case input:
2
kq cf

Expected output:
kcqf


Actual output:
kq
cf
kcqf


Fixed submission (verdict: Accepted):
N = int(input())
S,T = input().split()

s = ''
for i in range(N):
    s += S[i]
    s += T[i]

print(s)

Problem: p02830
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
s, t = map(str, input().split())
x= []

for i in range(n):

    lst = [s[i], t[i]]
    x.append(''.join(lst))

Failing test case input:
2
qk be

Expected output:
qbke


Actual output:
no output


Fixed submission (verdict: Accepted):
n = int(input())
s, t = map(str, input().split())
x= []

for i in range(n):

    lst = [s[i], t[i]]
    x.append(''.join(lst))

print(''.join(x))

Problem: p02830
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a = input()
b = input()
res = ''
for i in range(len(a)):
    res += a[i]
    res += b[i]
print(res)


Failing test case input:
5
babaa babaa

Expected output:
bbaabbaaaa


Actual output:
5b


Fixed submission (verdict: Accepted):
n = int(input())
a, b = input().split(' ')
res = ''
for i in range(n):
    res += a[i]
    res += b[i]
print(res)

Problem: p02830
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
ST = input()
S = ""
for i in range(N):
  S += ST[i]
  S += ST[N+i]
print(S)

Failing test case input:
5
aa_ba bb`_b

Expected output:
abab_`b_ab


Actual output:
a ab_bb`a_


Fixed submission (verdict: Accepted):
N = int(input())
ST = input()
S = ""
for i in range(N):
  S += ST[i]
  S += ST[N+i+1]
print(S)

Problem: p02830
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
s,t = map(str,input().split())
s = list(s)
t = list(t)
ans =[]
print(s)
for i in range(n):
    ans.append(s[i])
    ans.append(t[i])
''.join(ans)


print(ans)



Failing test case input:
2
ip dc

Expected output:
idpc


Actual output:
['i', 'p']
['i', 'd', 'p', 'c']


Fixed submission (verdict: Accepted):
n = int(input())
s,t = map(str,input().split())
s = list(s)
t = list(t)
ans =[]

for i in range(n):
    ans.append(s[i])
    ans.append(t[i])

ans2 = ''.join(ans)


print(ans2)
Problem: p02830
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
A,B = input().split()
tmp = [[] for _ in range(N*2)]
print(A)
M = 2*N
for i in range(0,N):
	tmp[2*i]=A[i]
	tmp[2*i+1]=B[i]
ans = "".join(tmp)
print(ans)

Failing test case input:
5
aaaaa aaaaa

Expected output:
aaaaaaaaaa

Actual output:
aaaaa
aaaaaaaaaa


Fixed submission (verdict: Accepted):
N = int(input())
A,B = input().split()
tmp = [[] for _ in range(N*2)]
M = 2*N
for i in range(0,N):
	tmp[2*i]=A[i]
	tmp[2*i+1]=B[i]
ans = "".join(tmp)
print(ans)

Problem: p02830
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
RESULT = ""
N = int(input())
S,T=str(input()).split()
for i in S:
  RESULT += i
  for v in T:
    RESULT += v
    break

print(RESULT)

Failing test case input:
5
ac`b` aab`b

Expected output:
aaca`bb``b


Actual output:
aaca`aba`a


Fixed submission (verdict: Accepted):
RESULT = ""
N = int(input())
S,T=str(input()).split()
for i in range(len(S)):
    RESULT += S[i]
    RESULT += T[i]
print(RESULT)

Problem: p02830
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
s,t = map(list, input().split(" "))
a=[]
print(n,s,t)
for i in range(n):
    a.append(s[i])
    a.append(t[i])
print(''.join(a))

Failing test case input:
8
jmgnlhmm uvtuvutu

Expected output:
jumvgtnulvhumtmu


Actual output:
8 ['j', 'm', 'g', 'n', 'l', 'h', 'm', 'm'] ['u', 'v', 't', 'u', 'v', 'u', 't', 'u']
jumvgtnulvhumtmu


Fixed submission (verdict: Accepted):
n = int(input())
s,t = map(list, input().split(" "))
a=[]
for i in range(n):
    a.append(s[i])
    a.append(t[i])
print(''.join(a))

Problem: p02830
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
S, T = input().split()
part = [None for n in range(N)]
for i in range(N):
    part[i] = (S[i] + T[i])
    print(part[i])
print("".join(part))

Failing test case input:
5
ac_b` abb_b

Expected output:
aacb_bb_`b


Actual output:
aa
cb
_b
b_
`b
aacb_bb_`b


Fixed submission (verdict: Accepted):
N = int(input())
S, T = input().split()
part = [None for n in range(N)]
for i in range(N):
    part[i] = (S[i] + T[i])
print("".join(part))
Problem: p03353
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s=input()
t=list(s)
u=sorted(list(set(t)))
ans=[]
for i in range(len(u)):
  ans.append(u[i])
k=int(input())
for j in range(1,min(5,len(t))):
  for i in range(len(t)-j):
    ans.append(s[i:i+j+1])
ans=sorted(ans)
print(ans[k-1])

Failing test case input:
roddadtadmboefectr
4

Expected output:
admb


Actual output:
adm


Fixed submission (verdict: Accepted):
s=input()
t=list(s)
u=sorted(list(set(t)))
ans=[]
for i in range(len(u)):
  ans.append(u[i])
k=int(input())
for j in range(1,min(10,len(t))):
  for i in range(len(t)-j):
    ans.append(s[i:i+j+1])
ans=sorted(list(set(ans)))
print(ans[k-1])

Problem: p03353
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
s=input()
k=int(input())
n=len(s)
l=[]
for i in range(n):
    curr=''
    for j in range(i,min(i+10,n)):
        curr+=s[j]
        l.append(curr)
l.sort()

print(l[k-1])

Failing test case input:
atcederamdatcoddor
4

Expected output:
amda


Actual output:
am


Fixed submission (verdict: Accepted):
s=input()
k=int(input())
n=len(s)
l=set()
for i in range(n):
    curr=''
    for j in range(i,min(i+7,n)):
        curr+=s[j]
        l.add(curr)
l=[i for i in l]
l.sort()

print(l[k-1])

Problem: p03353
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
def main():
    s = input()
    K = int(input())

    S = set()

    for i in range(len(s)):
        for j in range(1, K+1):
            print(s[i:i+j])
            S.add(s[i:i+j])
    
    sort_S = sorted(list(S))

    print(sort_S[K-1])
main()

Failing test case input:
``d
2

Expected output:
``


Actual output:
`
``
`
`d
d
d
``


Fixed submission (verdict: Accepted):
def main():
    s = input()
    K = int(input())

    S = set()

    for i in range(len(s)):
        for j in range(1, K+1):
            S.add(s[i:i+j])
    
    sort_S = sorted(list(S))

    print(sort_S[K-1])
main()

Problem: p03353
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import sys
s = input()
K = int(input())

a_list = sorted(set(s))
for i in a_list:
  if K == 1:
    print(i)
    sys.exit()
  p = []
  for j, x in enumerate(s):
    if x == i:
      p.append(s[j:min(j+K,len(s))])
  p.sort()
  print(p)
  t = K
  for j in range(len(p)):
    if j != len(p) - 1:
      if p[j] == p[j+1][0:len(p[j])]:
        continue
    if len(p[j]) < t:
      t -= len(p[j]) - 1
    else:
      print(p[j][0:t])
      sys.exit()
  K = t - 1

Failing test case input:
bae
2

Expected output:
ae


Actual output:
['ae']
ae


Fixed submission (verdict: Accepted):
import sys
s = input()
K = int(input())

a_list = sorted(set(s))
for i in a_list:
  if K == 1:
    print(i)
    sys.exit()
  p = []
  for j, x in enumerate(s):
    if x == i:
      p.append(s[j:min(j+K,len(s))])
  p.sort()
  t = K
  for j in range(len(p)):
    if j != len(p) - 1:
      if p[j] == p[j+1][0:len(p[j])]:
        continue
    if len(p[j]) < t:
      t -= len(p[j]) - 1
    else:
      print(p[j][0:t])
      sys.exit()
  K = t - 1
Problem: p03353
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
s=input()
k=int(input())
n=len(s)
l=[]
for i in range(n):
    curr=''
    for j in range(i,n):
        curr+=s[j]
        l.append(curr)
l.sort()

print(l[k-1])

Failing test case input:
reedoctadmaredocta
4

Expected output:
adma


Actual output:
ad


Fixed submission (verdict: Accepted):
s=input()
k=int(input())
n=len(s)
l=set()
for i in range(n):
    curr=''
    for j in range(i,min(i+7,n)):
        curr+=s[j]
        l.add(curr)
l=[i for i in l]
l.sort()

print(l[k-1])

Problem: p03353
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
K = int(input())
subs = []
print(s[0:2])
for i in range(0, len(s)):
    for j in range(i+1, len(s)+1):
        if i == j:
            subs.append(s[i])
        else:
            subs.append(s[i:j])
subs = list(set(subs))
subs.sort()
print(subs[K-1])


Failing test case input:
b`a
5

Expected output:
b`


Actual output:
b`
b`


Fixed submission (verdict: Accepted):
s = input()
K = int(input())
subs = []
for i in range(0, len(s)):
    for j in range(i+1, i+K+1):
        if i == j:
            subs.append(s[i])
        else:
            subs.append(s[i:j])
subs = list(set(subs))
subs.sort()
print(subs[K-1])

Problem: p03353
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
s = input()
k = int(input())

n = len(s)
strs = set([])

for i in range(n):
    for j in range(i+1, n+1):
        strs.add(s[i:j])
strs = list(strs)

print(strs[k-1])


Failing test case input:
atcoderandatcodeer
5

Expected output:
andat

Actual output:
oder


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

n = len(s)
strs = set([])

for i in range(n):
    for j in range(i+1, min(i+k+1,n+1)):
        strs.add(s[i:j])
strs = list(strs)
strs.sort()
print(strs[k-1])

Problem: p03353
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
K = int(input())
n = len(s)
A =[]
for i in range(n):
    for j in range(i+1,n+1):
        sub = s[i:j]  
        if sub not in A:
            if len(A) < K:
                A.append(sub)
            else:
                A.append(sub)
                A.sort()
                A.pop(K)
print(A[K-1])

Failing test case input:
eab
6

Expected output:
eab


Actual output:
b


Fixed submission (verdict: Accepted):
s = input()
K = int(input())
n = len(s)
A =[]
import bisect
for i in range(n):
    for j in range(1,K+1):
        sub = s[i:i+j]  
        if sub not in A:
            x = bisect.bisect_left(A,sub)
            A.insert(x,sub)
            if len(A) > K:
                A.pop(K)

print(A[K-1])
Problem: p03353
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
list_S = list(input())
k = int(input())
set_ANS = set()
list_Alph = list(set(list_S))
list_Alph.sort()
cnt = 0

for c in list_Alph:
    q = [i for i, x in enumerate(list_S) if x == c]
    for j in range(1, len(list_S)+1):
        for i in q:
            if i + j <= len(list_S):
                l = "".join(list_S[i:i+j])
                if l not in set_ANS:
                    set_ANS.add(l)
                    cnt += 1
        if cnt >= k:
            list_ANS = list(set_ANS)
            list_ANS.sort()
            print(list_ANS[k-1])
            exit()

Failing test case input:
rtcefeobmdatdaddor
4

Expected output:
addo


Actual output:
at


Fixed submission (verdict: Accepted):
list_S = list(input())
k = int(input())
set_ANS = set()
list_Alph = list(set(list_S))
cnt = 0
list_Alph.sort()

for c in list_Alph:
    q = [i for i, x in enumerate(list_S) if x == c]
    list_M = []
    for i in q:
        l = "".join(list_S[i:])
        list_M.append(l)
    list_M.sort()
    for s in list_M:
        m = list(s)
        for j in range(1,len(m)+1):
            b = "".join(m[:j])
            if b not in set_ANS:
                set_ANS.add(b)
                cnt += 1
                if cnt == k:
                    print(b)
                    exit()

Problem: p03353
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
from functools import reduce
import copy
import math


sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(inputs):
    S = inputs[0]
    K = int(inputs[1])

    sets = set()
    print(K)
    for i in range(len(S)):
        j = i
        while j < len(S) and j - i <= K:
            j += 1
        sets.add(S[i:j])
    new_sets = set()

    for k in sets:
        for i in range(len(k)):
            j = i
            while j < len(k) and j - i <= K:
                j += 1
                new_sets.add(k[i:j])
    l = list(new_sets)
    l.sort()
    return l[K-1]


def string_to_int(string):
    return list(map(int, string.split()))


if __name__ == "__main__":
    ret = solve(inputs(2))
    print(ret)


Failing test case input:
eab
6

Expected output:
eab


Actual output:
6
eab


Fixed submission (verdict: Accepted):
import sys
from functools import reduce
import copy
import math


sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(inputs):
    S = inputs[0]
    K = int(inputs[1])

    sets = set()
    for i in range(len(S)):
        j = i
        while j < len(S) and j - i <= K:
            j += 1
        sets.add(S[i:j])
    new_sets = set()

    for k in sets:
        for i in range(len(k)):
            j = i
            while j < len(k) and j - i <= K:
                j += 1
                new_sets.add(k[i:j])
    l = list(new_sets)
    l.sort()
    return l[K-1]


def string_to_int(string):
    return list(map(int, string.split()))


if __name__ == "__main__":
    ret = solve(inputs(2))
    print(ret)
Problem: p03448
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
c500 = int(input())
c100 = int(input())
c50 = int(input())
x = int(input())
count = 0
 
for c500_n in range(1, c500):
  for c100_n in range(1, c100):
    for c50_n in range(1, c50):
      if c500_n*500 + c100_n*100 + c50_n*50 == x:
        count += 1
 
print(count)

Failing test case input:
2
0
1
000

Expected output:
1


Actual output:
0


Fixed submission (verdict: Accepted):
c500 = int(input())
c100 = int(input())
c50 = int(input())
x = int(input())
count = 0
 
for c500_n in range(c500+1):
  for c100_n in range(c100+1):
    for c50_n in range(c50+1):
      if c500_n*500 + c100_n*100 + c50_n*50 == x:
        count += 1
 
print(count)

Problem: p03448
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A=int(input())
B=int(input())
C=int(input())
X=int(input())

c=0
for i in range(A):
    for j in range(B):
        for k in range(C):
            if 500*(i+1)+100*(j+1)+50*(k+1)==X:
                c+=1

print(c)

Failing test case input:
2
2
5
100

Expected output:
2


Actual output:
0


Fixed submission (verdict: Accepted):
A=int(input())
B=int(input())
C=int(input())
X=int(input())

c=0
for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            if 500*i+100*j+50*k==X:
                c+=1

print(c)

Problem: p03448
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
a=int(input(""))
b=int(input(""))
c=int(input(""))
x=int(input(""))
def countcourse(r,t,y,u):
    cnt=0
    for h in range(r):
        for l in range(t):
            for o in range(y):
                if 500*h+100*l+50*o==u:
                    cnt+=1
    return cnt
print(countcourse(a,b,c,x))

Failing test case input:
5
0
0
0

Expected output:
1


Actual output:
0


Fixed submission (verdict: Accepted):
a=int(input(""))
b=int(input(""))
c=int(input(""))
x=int(input(""))
def countcourse(r,t,y,u):
    cnt=0
    n=0
    for h in range(r+1):
        for l in range(t+1):
            for o in range(y+1):
                if 500*h+100*l+50*o==u:
                    cnt+=1
    return cnt
print(countcourse(a,b,c,x))

Problem: p03448
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A = int(input())
B = int(input())
C = int(input())
X = int(input())

count = 0
for i in range(A+1):
  for j in range(B+1):
    for k in range(C+1):
      if 500*i + 100*j + 50*k == X:
        count += 1


Failing test case input:
2
-6
-1
001

Expected output:
0


Actual output:
no output


Fixed submission (verdict: Accepted):
A = int(input())
B = int(input())
C = int(input())
X = int(input())

count = 0
for i in range(A+1):
  for j in range(B+1):
    for k in range(C+1):
      if 500*i + 100*j + 50*k == X:
        count += 1
        
print(count)
Problem: p03448
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A = int(input())
B = int(input())
C = int(input())
X = int(input())

ans = 0
for i in range(A):
	for j in range(B):
		for k in range(C):
			if i*500 + j*100 + k*50 == X:
				ans +=1

print(ans)

Failing test case input:
2
0
1
000

Expected output:
1


Actual output:
0


Fixed submission (verdict: Accepted):

A = int(input())
B = int(input())
C = int(input())
X = int(input())

ans = 0
for i in range(A+1):
	for j in range(B+1):
		for k in range(C+1):
			if i*500 + j*100 + k*50 == X:
				ans +=1

print(ans)

Problem: p03448
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A = int(input())
B = int(input())
C = int(input())
X = int(input())

count = 0

for i in range(A + 1):
    for j in range(B + 1):
        for k in range(C + 1):
            total = 500 * A + 100 * B + 50 * C
            if total == X:
                count = count + 1

print(count)

Failing test case input:
5
0
1
0

Expected output:
1


Actual output:
0


Fixed submission (verdict: Accepted):
A = int(input())
B = int(input())
C = int(input())
X = int(input())

count = 0

for a in range(A + 1):
    for b in range(B + 1):
        for c in range(C + 1):
            total = 500 * a + 100 * b + 50 * c
            if total == X:
                count = count + 1

print(count)

Problem: p03448
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a = int(input())
b = int(input())
c = int(input())
x = int(input())

count = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if 500 * i + 100 * j + 50 * k == x:
                count += 1

Failing test case input:
30
168
252
5860

Expected output:
0


Actual output:
no output


Fixed submission (verdict: Accepted):
a = int(input())
b = int(input())
c = int(input())
x = int(input())

count = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if 500 * i + 100 * j + 50 * k == x:
                count += 1
print(count)

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

 
a = int(input())
b = int(input())
c = int(input())
x = int(input())
 
cnt = 0
for i in range(a):
  for j in range(b):
    for k in range(c):
      p = i * 500 + j * 100 + k * 50
      if p == x:
        cnt += 1
print(cnt)

Failing test case input:
5
0
0
0

Expected output:
1


Actual output:
0


Fixed submission (verdict: Accepted):

 
a = int(input())
b = int(input())
c = int(input())
x = int(input())
 
cnt = 0
for i in range(a + 1):
  for j in range(b + 1):
    for k in range(c + 1):
      p = i * 500 + j * 100 + k * 50
      if p > x:
        break
      if p == x:
        cnt += 1
print(cnt)
Problem: p03448
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
A=int(input())
B=int(input())
C=int(input())
X=int(input())
count=0
for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            if ((500*i)+(100*j)+(50*k))==0:
                count+=1

print(count)

Failing test case input:
30
73
134
6415

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
A=int(input())
B=int(input())
C=int(input())
X=int(input())
count=0
for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            if ((500*i)+(100*j)+(50*k))==X:
                count+=1

print(count)

Problem: p03448
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a500 = int(input())
b100 = int(input())
c50 = int(input())
X = int(input())
ans = 0
goukei = 0
is_over = False
for i in range(a500):
  for j in range(b100):
    for k in range(c50):
      goukei = i * 500 + j * 100 + k * 50
      if goukei == X:
        ans += 1
print(ans)

Failing test case input:
2
0
1
000

Expected output:
1


Actual output:
0


Fixed submission (verdict: Accepted):
a500 = int(input())
b100 = int(input())
c50 = int(input())
X = int(input())
ans = 0
goukei = 0
is_over = False
for i in range(a500+1):
  for j in range(b100+1):
    for k in range(c50+1):
      goukei = i * 500 + j * 100 + k * 50
      if goukei == X:
        ans += 1
print(ans)
Problem: p03207
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
p = []
max = 0
for i in range(N):
  p.append(int(input()))
  if(p[i]>max):
    maxi = i
sum = 0
for i in range(N):
  if(i == maxi):
    sum += p[i]/2
  else:
    sum += p[i]
print(sum)

Failing test case input:
3
0
7984
100

Expected output:
4092


Actual output:
8034.0


Fixed submission (verdict: Accepted):
N = int(input())
p = []
max = 0
for i in range(N):
  p.append(int(input()))
p.sort()
sum = 0
for i in range(N-1):
  sum += p[i]
sum += p[N-1]/2
print(int(sum))

Problem: p03207
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
p=[int(input()) for i in range(n)]
print(sum(p)-max(p)/2)

Failing test case input:
4
4320
402
4320
4320

Expected output:
11202


Actual output:
11202.0


Fixed submission (verdict: Accepted):
n=int(input())
p=[int(input()) for i in range(n)]
print(sum(p)-max(p)

Problem: p03207
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a=int(input())
b=[int(input()) for i in range(a)]
print(sum(b)-max(b)/2)
  

Failing test case input:
3
32
7980
4990

Expected output:
9012


Actual output:
9012.0


Fixed submission (verdict: Accepted):
a=int(input())
b=[int(input()) for i in range(a)]
print(int(sum(b)-max(b)/2))

Problem: p03207
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
p = list()
for i in range(N):
    p.append(int(input()))
sum = 0
for i in range(0,N):
    sum += p[i]
print(sum - max(p) + max(p)/2)


Failing test case input:
3
12
11402
1144

Expected output:
6857


Actual output:
6857.0


Fixed submission (verdict: Accepted):
N = int(input())
p = list()
for i in range(N):
    p.append(int(input()))
sum = 0
for i in range(0,N):
    sum += p[i]
print(sum - max(p) + max(p)

Problem: p03207
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a = int(input())
b = []
for i in range(a):
  b.append(int(input()))
 
b.sort()
 
b[-1] = b[-1] / 2
 
print(sum(b))

Failing test case input:
3
0
4428
52

Expected output:
2266


Actual output:
2266.0


Fixed submission (verdict: Accepted):
a = int(input())
b = []
for i in range(a):
    b.append(int(input()))

b.sort()

b[-1] = b[-1] / 2

print(int(sum(b)))

Problem: p03207
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
p = [int(input()) for i in range(N)]
print(sum(p) - max(p)/2)


Failing test case input:
3
4
4428
173

Expected output:
2391


Actual output:
2391.0


Fixed submission (verdict: Accepted):
N = int(input())
p = [int(input()) for i in range(N)]
print(sum(p) - max(p)

Problem: p03207
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n =int(input())
p =[]
for i in range(n):
    a =int(input())
    p.append(a)
p.sort()
new_p =p[n-1]/2
ans =sum(p[:n-1])+new_p
print(new_p)
print(int(ans))

Failing test case input:
3
0
4428
99

Expected output:
2313


Actual output:
2214.0
2313


Fixed submission (verdict: Accepted):
n =int(input())
p =[]
for i in range(n):
    a =int(input())
    p.append(a)
p.sort()
new_p =p[n-1]/2
ans =sum(p[:n-1])+new_p
print(int(ans))
Problem: p03207
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
m=0
s=0
for i in range(n):
    p=int(input())
    s+=p
    m=max(m,p)
print(s-(m/2))

Failing test case input:
3
1
4428
55

Expected output:
2270


Actual output:
2270.0


Fixed submission (verdict: Accepted):
n=int(input())
m=0
s=0
for i in range(n):
    p=int(input())
    s+=p
    m=max(m,p)
print(int(s-(m/2)))

Problem: p03207
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
p=[int(input()) for i in range(n)]
q=max(p)
print(int(sum(p))-max(p)/2)


Failing test case input:
3
4
7980
615

Expected output:
4609


Actual output:
4609.0


Fixed submission (verdict: Accepted):
n=int(input())
p=[int(input()) for i in range(n)]
q=max(p)
print(int(sum(p))-int(max(p)/2))

Problem: p03207
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,*p = map(int,open(0).read().split())
p.sort()
p[-1] /= 2
print(sum(p))


Failing test case input:
4
798
582
8452
4320

Expected output:
9926


Actual output:
9926.0


Fixed submission (verdict: Accepted):
N,*p = map(int,open(0).read().split())
p.sort()
p[-1] /= 2
print(int(sum(p)))
Problem: p03031
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, M = map(int, input().split())

n_switches = []
switches = []
for i in range(M):
    ipt = list(map(int, input().split()))
    n_switches.append(int(ipt[0]))
    switches.append(ipt[1:])


p = list(map(int, input().split()))

ans = 0


for i in range(N**2):
    ptn = bin(i)[2:].rjust(N, '0')

    allLight = True  

    
    for j in range(M):

        n_light = 0
        
        for k in range(n_switches[j]):
            
            if ptn[switches[j][k] - 1] == '1':
                n_light += 1

        if n_light % 2 != p[j]:
            allLight = False
            break

    if allLight:
        ans += 1

print(ans)

    

Failing test case input:
1 0
-1 1 5
2 1
0 0
0 0 -2

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
N, M = map(int, input().split())

n_switches = []
switches = []
for i in range(M):
    ipt = list(map(int, input().split()))
    n_switches.append(int(ipt[0]))
    switches.append(ipt[1:])


p = list(map(int, input().split()))

ans = 0






for i in range(2 ** N):
    ptn = bin(i)[2:].rjust(N, '0')

    allLight = True  

    
    for j in range(M):

        n_light = 0
        
        for k in range(n_switches[j]):
            
            if ptn[switches[j][k] - 1] == '1':
                n_light += 1

        if n_light % 2 != p[j]:
            allLight = False
            break

    if allLight:
        ans += 1

print(ans)

Problem: p03031
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,M=map(int,input().split())
lights=[]
for i in range(M):
    k,*s=map(int,input().split())
    lights.append(list(map(lambda x:x-1,s)))
P=list(map(int,input().split()))
cnt=0
for b in range(1<<N):
    flg=True
    for m in range(M):
        on_cnt=0
        for switch in lights[m]:
            if (b>>switch)&2:
                on_cnt+=1
        if on_cnt==0 or on_cnt%2 != P[m]:
            flg=False
    if flg:
       cnt+=1
print(cnt)       

Failing test case input:
2 2
2 1 2
1 2
0 1

Expected output:
1

Actual output:
0


Fixed submission (verdict: Accepted):
N,M=map(int,input().split())
lights=[]
for i in range(M):
    k,*s=map(int,input().split())
    lights.append(list(map(lambda x:x-1,s)))
P=list(map(int,input().split()))
cnt=0
for b in range(1<<N):
    
    flg=True
    for m in range(M):
        on_cnt=0
        for switch in lights[m]:
            if (b>>switch)&1:
                on_cnt+=1
        
        if on_cnt%2 != P[m]:
            flg=False
    if flg:
       cnt+=1
       
print(cnt)