Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p03486 (python)

Fixed submission:
s = input()
t = input()
Alphabet = list(['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
)

flag = 0
S = sorted(s)
T = sorted(t,reverse = True)
for i in range(min(len(S),len(T))) :
    if S[i] == T[i] :
        flag += 1
    else :
        for j in range(len(Alphabet)) :
            if S[i] == Alphabet[j] :
                print("Yes")
                flag += -10000
                break
            elif T[i] == Alphabet[j] :
                print("No")
                flag += -10000
                break
            else :
                continue
        break
    
if flag == min(len(S),len(T)) :
    if len(S) >= len(T) :
        print("No")
    elif s != t :
        print("Yes")
    else :
        print("No")
#print(Alphabet)

Buggy submission (verdict: Runtime Error):
S = list(input())
T = list(input())
S = sorted(S)
T = sorted(T,reverse = True)
counter = 0
for i in range(len(S)) :
    if S[i] > T[i] :
        print("No")
        break
    elif S[i] < T[i] :
        print("Yes")
        break
    else :
        counter += 1
    if counter == len(S) :
        if len(S) >= len(T) :
            print("No")
            break
        else :
            print("Yes")
            break

Buggy submission (verdict: Runtime Error):
s = input()
t = input()
Alphabet = []
Alphabet.append("a")
Alphabet.append("b")
Alphabet.append("c")
Alphabet.append("d")
Alphabet.append("e")
Alphabet.append("f")
Alphabet.append("g")
Alphabet.append("h")
Alphabet.append("i")
Alphabet.append("j")
Alphabet.append("k")
Alphabet.append("l")
Alphabet.append("m")
Alphabet.append("n")
Alphabet.append("o")
Alphabet.append("p")
Alphabet.append("q")
Alphabet.append("r")
Alphabet.append("s")
Alphabet.append("t")
Alphabet.append("u")
Alphabet.append("v")
Alphabet.append("w")
Alphabet.append("x")
Alphabet.append("y")
Alphabet.append("z")
flag = 0
S = sorted(s)
T = sorted(t,reverse = True)
for i in range(len(S)) :
    if S[i] == T[i] :
        flag += 1
    else :
        for j in range(len(Alphabet)) :
            if S[i] == Alphabet[j] :
                print("Yes")
                flag += -10000
                break
            elif T[i] == Alphabet[j] :
                print("No")
                flag += -10000
                break
            else :
                continue
        break
if flag == len(S) :
    if s != t :
        print("Yes")
    else :
        print("No")
Problem p03546 (python)

Fixed submission:
H,W = map(int,input().split())
C = []
A = []
for i in range(10) :
    C.append(list(map(int,input().split())))
for j in range(H) :
    A.append(list(map(int,input().split())))
for k in range(10) :
    for l in range(10) :
        for m in range(10) :
            C[l][m] = min(C[l][m],C[l][k]+C[k][m])
ans = 0
for row in A :
    for n in row :
        if n == -1 :
            continue
        else :
            ans += C[n][1]
print(ans)

Buggy submission (verdict: Runtime Error):
H,W = map(int,input().split())
C = []
A = []
for i in range(10) :
    C.append(list(map(int,inpput().split())))
for i in range(H) :
    A.append(list(map(int,input().split())))
for i in range(10) :
    for j in range(10) :
        for k in range(10) :
            C[j][k] = min(C[j][k], C[j][i]+C[i][k])
ans = 0
for row in A :
    for a in row :
        if a == -1 or a == 1 :
            continue
        else :
            ans += C[a][1]
print(ans)
Problem p03547 (python)

Fixed submission:
X,Y = map(str,input().split())
L = ["A","B","C","D","E","F"]
for i in range(6) :
    if L[i] == X :
        lx = i
    if L[i] == Y :
        ly = i
if lx < ly :
    print("<")
elif lx > ly :
    print(">")
else :
    print("=")

Buggy submission (verdict: Runtime Error):
X,Y = map(str,input().split())
L = ["A","B","C","D","E","F"]
for i in range(6) :
    if L[i] == X :
        lx = i
    elif L[i] == Y :
        ly = i
if lx < ly :
    print("<")
elif lx > ly :
    print(">")
else :
    print("=")
Problem p03575 (python)

Fixed submission:
from collections import deque
from copy import deepcopy

N,M = map(int,input().split())
Matrix = [[False for x in range(N)] for y in range(N)]

Path = []
for i in range(M) :
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    Path.append((a,b))

for i in range(M) :
    a,b = Path[i]
    Matrix[a][b] = True
    Matrix[b][a] = True
    
ans = 0
for i in range(M) :
    a,b = Path[i]
    Matrix_ = deepcopy(Matrix)
    Matrix_[a][b] = False
    Matrix_[b][a] = False
    INF = 63
    Distance = [INF for i in range(N)]
    Distance[0] = 0
    
    QUEUE = deque([0])
    while QUEUE :
        now = QUEUE.popleft()
        
        for i in range(N) :
            if Matrix_[now][i] :
                Matrix_[now][i] = False
                Matrix_[i][now] = False
                Distance[i] = min(Distance[now]+1,Distance[i])
                QUEUE.append(i)
    #print(Distance)
    if (INF in Distance) :
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
from collections import deque
from copy import deepcopy

N,M = map(int,input().split())
Matrix = [[False for x in range(N)] for j in range(N)]

Path = []
for i in range(M) :
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    Path.append((a,b))
    Matrix[a][b] = True
    Matrix[b][a] = True

INF = 63
ans = 0
for i in range(M) :
    Matrix_duplicated = deepcopy(Matrix)
    a,b = Path[i]
    Matrix_duplicated[a][b] = False
    Matrix_duplicated[b][a] = False
    Distance = [INF for i in range(N)]
    Distance[0] = 0
    Queue = deque([0])
    while Queue :
        now = Queue.popleft()
        Visited.append(now)
        for i in range(N) :
            if Matrix_duplicated[now][i] :
                Matrix_duplicated[now][i] = False
                Matrix_duplicated[i][now] = False
                Distance[i] = min(Distance[now]+1, Distance[i])
                Queue.append(i)
    if INF in Distance :
        ans += 1
print(ans)
Problem p03633 (python)

Fixed submission:
N = int(input())
T = [int(input()) for i in range(N)]
#P = list(set(T))

def gcd(a,b) :
    a,b = min(a,b),max(a,b)
    while b > 0 :
        a,b = b, a%b
    return a

def lcm(a,b) :
    return a*b//gcd(a,b)
if N == 1 :
    ans = T[0]
else :
    for i in range(len(T)) :
        if i == 0 :
            ans = lcm(T[i],T[i+1])
        else :
            ans = lcm(T[i],ans)
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
T = [int(input()) for i in range(N)]
#P = list(set(T))

def gcd(a,b) :
    a,b = min(a,b),max(a,b)
    while b > 0 :
        a,b = b, a%b
    return a

def lcm(a,b) :
    return a*b//gcd(a,b)

for i in range(len(T)-1) :
    if i == 0 :
        ans = lcm(T[i],T[i+1])
    else :
        p = lcm(T[i],T[i+1])
        if p > ans :
            ans = p
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
T = [int(input()) for i in range(N)]
P = list(set(T))

def gcd(a,b) :
    while b > 0 :
        a,b = b, a%b
    return a

def lcm(a,b) :
    return a*b//gcd(a,b)

for i in range(len(P)-1) :
    if i == 0 :
        ans = lcm(P[i],P[i+1])
    else :
        p = lcm(P[i],P[i+1])
        if p > ans :
            ans = p
print(ans)
Problem p03651 (python)

Fixed submission:
def gcd(a,b) :
    while b :
        a,b = b, a % b
    return a

N,K = map(int,input().split())
L = list(map(int,input().split()))

if len(L) == 1 :
    if L[0] == K :
        ans = "POSSIBLE"
    else :
        ans = "IMPOSSIBLE"

else :
    for i in range(N-1) :
        q = gcd(L[i],L[i+1])
        if i == 0 :
            p = gcd(L[i],L[i+1])
        if q < p :
            p = q

    if (K % p ==  0) and (K <= max(L)) :
        ans = "POSSIBLE"
    else :
        ans = "IMPOSSIBLE"
print(ans)

Buggy submission (verdict: Runtime Error):
def gcd(a,b) :
    while b :
        a,b = b, a % b
    return a

N,K = map(int,input().split())
L = list(map(int,input().split()))

p = 10**9
for i in range(N-1) :
    q = gcd(L[i],L[i+1])
    if q < p :
        p = q

if (K % p ==  0) and (K <= max(L))
    ans = "POSSIBLE"
else :
    ans = "IMPOSSIBLE"
print(ans)

Buggy submission (verdict: Runtime Error):

from math import gcd
    

N,K = map(int,input().split())
L = list(map(int,input().split()))

p = 10**9
for i in range(N-1) :
    q = gcd(L[i],L[i+1])
    if q < p :
        p = q

if K % p ==  0 :
    ans = "POSSIBLE"
else :
    ans = "IMPOSSIBLE"
print(ans)

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
L = list(map(int,input().split()))
L = list(set(L))
L = sorted(L,reverse=False)

ans = "IMPOSSIBLE"
if L[-1] < K :
    ans = "IMPOSSIBLE"
else :
    for i in range(1,N) :
        if L[i] % L[0] != 0 :
            ans = "POSSIBLE"
            break
print(ans)
Problem p03687 (python)

Fixed submission:
S = input()
ANS = []
for i in range(ord("a"),ord("z")+1) :
    p = chr(i)
    T = list(S.split(p))
    U = []
    for j in range(len(T)) :
        U.append(len(T[j]))
    ANS.append(max(U))
print(min(ANS))

Buggy submission (verdict: Runtime Error):
S = input()
P = list(set(P))
ANS = []
for i in range(len(P)) :
    T = list(S.split(P[i]))
    U = []
    for j in range(len(T)) :
        U.append(len(T[j]))
    ANS.append(max(U))
print(min(ANS))
Problem p03695 (python)

Fixed submission:
N = int(input())
L = list(map(int,input().split()))
D = {}
p = 0
for i in range(N) :
    if L[i] < 400 :
        color = 0
    elif L[i] < 800 :
        color = 1
    elif L[i] < 1200 :
        color = 2
    elif L[i] < 1600 :
        color = 3
    elif L[i] < 2000 :
        color = 4
    elif L[i] < 2400 :
        color = 5
    elif L[i] < 2800 :
        color = 6
    elif L[i] < 3200 :
        color = 7
    else :
        p += 1
    if L[i] < 3200 :
        if color not in D :
            D[color] = 1
        else :
            D[color] += 1
ans1 = len(list(D.keys()))
q = 0
if ans1 == 0 :
    ans1 = 1
    q = 1
ans2 = ans1 + p - q
print(ans1,ans2)

Buggy submission (verdict: Runtime Error):
N = int(input())
L = list(map(int,input().split()))
D = {}
p = 0
for i in range(N) :
    if L[i] < 400 :
        color = 0
    elif L[i] < 800 :
        color = 1
    elif L[i] < 1200 :
        color = 2
    elif L[i] < 1600 :
        color = 3
    elif L[i] < 2000 :
        color = 4
    elif L[i] < 2400 :
        color = 5
    elif L[i] < 2800 :
        color = 6
    elif L[i] < 3200 :
        color = 7
    else :
        p += 1
    if color not in D :
        D[color] = 1
    else :
        D[color] += 1
ans1 = len(list(D.keys()))
ans2 = ans1 + p
print(ans1,ans2)
Problem p03722 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**9)

N,M = map(int,input().split())
edges = []
to = [[] for i in range(N)]
rto = [[] for i in range(N)]
for i in range(M) :
    u,v,cost = map(int,input().split())
    u -= 1
    v -= 1
    cost *= -1
    edges.append([u,v,cost])
    to[u].append(v)
    rto[v].append(u)

canVisitFromS = [False]*N
canVisitFromG = [False]*N

def dfs(u) :
    if canVisitFromS[u] : return
    canVisitFromS[u] = True
    for v in to[u] :
        dfs(v)

def rdfs(v) :
    if canVisitFromG[v] : return
    canVisitFromG[v] = True
    for u in rto[v] :
        rdfs(u)

dfs(0)
rdfs(N-1)

OK = [canVisitFromS[i] * canVisitFromG[i] for i in range(N)]

dist = [float("inf")]*N
dist[0] = 0

update = True
step = 0
ans = 0

while update :
    update = False
    for i in range(M) :
        u,v,cost = edges[i]
        if OK[u] * OK[v] == 0 : continue
        if dist[v] > dist[u] + cost :
            dist[v] = dist[u] + cost
            update = True
    step += 1
    if step > N :
        ans = "inf"
        break
if ans != "inf" :
    ans = dist[N-1] * (-1)
print(ans)

Buggy submission (verdict: Runtime Error):
from scipy.sparse.csgraph import csgraph_from_dense, bellman_ford
mINF = -(10**16)
n,m = map(int,input().split())
A = [0]*m
B = [0]*m
C = [0]*m
for i in range(m) :
    a, b, c = map(int,input().split())
    A[i], B[i], C[i] = a-1, b-1, -c

graph = [[mINF]*n for i in range(n)]
for i in range(m) :
    graph[A[i]][B[i]] = C[i]

graph = csgraph_from_dense(graph, null_value=mINF)
try :
    dist = bellman_ford(graph)
    print(-dist[0][n-1])
except : # NegativeCycleError in scipy
    ans = "inf"

print(ans)
Problem p03738 (python)

Fixed submission:
A = int(input())
B = int(input())
if A > B :
    print("GREATER")
elif A < B :
    print("LESS")
else :
    print("EQUAL")

Buggy submission (verdict: Runtime Error):
A,B = map(int,input().split())
if A > B :
    print("GREATER")
elif A < B :
    print("LESS")
else :
    print("EQUAL")
Problem p03741 (python)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))

calc1 = 0
calc2 = 0

L = A

if L[0] > 0 :
    su = L[0]
else :
    su = 1
    calc1 += 1 + abs(L[0])

for i in range(1,N) :
    su += L[i]
    if i % 2 :
        if su >= 0 :
            calc1 += 1 + abs(su)
            su = -1
    else :
        if su <= 0 :
            calc1 += 1 + abs(su)
            su = 1

L = A

if L[0] < 0 :
    su = L[0]
else :
    su = -1
    calc2 += 1 + abs(L[0])

for i in range(1,N) :
    su += L[i]
    if not i % 2 :
        if su >= 0 :
            calc2 += 1 + abs(su)
            su = -1
    else :
        if su <= 0 :
            calc2 += 1 + abs(su)
            su = 1
print(min(calc1,calc2))

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))

ans = 0


sum_A = A[0]
for i in range(1,N) :
    if ((sum_A + A[i]) == 0) or (sum_A *(sum_A + A[i]) >= 0) :
        if sum_A > 0 :
            ans += 1 + sum_A + A[i]
            #print("ans += {}".format(1 + sum_A + A[i]))
            sum_A = -1
        elif sum_A < 0 :
            ans += 1 - (sum_A + A[i])
            #print("ans += {}".format(1 - (sum_A + A[i])))
            sum_A = 1
        
    else :
        sum_A += A[i]
        #print("else")
    record.append(sum_A)

print(ans)
Problem p03759 (python)

Fixed submission:
a,b,c=map(int,input().split())
if a-b == b-c:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
if A==b and b==c:
    print("YES")
else:
    print("NO")
Problem p03837 (python)

Fixed submission:
from scipy.sparse.csgraph import csgraph_from_dense, dijkstra

n,m = map(int,input().split())
edges = [[int(x) for x in input().split()] for i in range(m)]
graph = [[False]*n for i in range(n)]
for a, b, c in edges :
    graph[a-1][b-1] = c

graph = csgraph_from_dense(graph)
dist = dijkstra(graph, directed=False).astype(int)

ans = 0
for a, b, c in edges :
    if dist[a-1][b-1] != c :
        ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
from scipy.sparse.csgraph import csgraph_from_dense, dijkstra

n,m = map(int,input().split())
A = [0]*n
B = [0]*n
C = [0]*n
for i in range(m) :
    a, b, c = map(int,input().split())
    A[i] = a-1
    B[i] = b-1
    C[i] = c

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

for i in range(m) :
    graph[A[i]][B[i]] = C[i]
    graph[B[i]][A[i]] = C[i]

graph = csgraph_from_dense(graph)
dist = dijkstra(graph)

ans = 0
for i in range(m) :
    if dist[A[i]][B[i]] != C[i] :
        ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
from scipy.sparse.csgraph import csgraph_from_dense, dijkstra

n,m = map(int,input().split())
A = [0]*n
B = [0]*n
C = [0]*n
for i in range(m) :
    a, b, c = map(int,input().split())
    A[i] = a-1
    B[i] = b-1
    C[i] = c

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

for i in range(m) :
    graph[A[i]][B[i]] = C[i]
    graph[B[i]][A[i]] = C[i]

graph = csgraph_from_dense(graph)
dist = dijkstra(graph)

ans = 0
for i in range(m) :
    if dist[A[i]][B[i]] != C[i] :
        ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
from scipy.sparse.csgraph import dijkstra

n,m = map(int,input().split())
edges = [[int(x) for x in input().split()] for i in range(m)]
graph = [[None]*n for i in range(n)]
for a, b, c in edges :
    graph[a-1][b-1] = c

#graph = csgraph_from_dense(graph)
dist = dijkstra(graph, directed=True).astype(int)

used = [0]*m
for s in range(n-1) :
    for t in range(s+1, n) :
        for i in range(len(edges)) :
            a, b, c = edges[i]
            a -= 1
            b -= 1
            if dist[s][a] + c + dist[b][t] == dist[s][t] :
                used[i] = 1
ans = m - sum(used)
print(ans)

Buggy submission (verdict: Runtime Error):
from scipy.sparse.csgraph import *

n,m = map(int,input().split())
edges = [[int(x) for x in input().split()] for i in range(m)]
graph = [[0]*n for i in range(n)]
for a, b, c in edges :
    graph[a-1][b-1] = c

graph = csgraph_from_dense(graph)
dist = dijkstra(graph, directed=False).astype(int)

used = [0]*m
for s in range(n-1) :
    for t in range(s+1, n) :
        for i in range(len(edges)) :
            a, b, c = edges[i]
            a -= 1
            b -= 1
            if dist[s][a] + c + dist[b][t] == dist[s][t] :
                used[i] = 1
ans = m - sum(used)
print(ans)
Problem p03846 (python)

Fixed submission:
N = int(input())
L = list(map(int,input().split()))
M = sorted(L,reverse=True)
flag = 1
for i in range(N) :
    if i % 2 == 0 :
        l = M[i]
        if l != (N-i-1) :
            flag = 0
            break
    else :
        if M[i] != l :
            flag = 0
            break
if flag == 0 :
    ans = 0
else :
    ans = (2**(N//2)) % (10**9+7)
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
L = list(map(int,input().split()))
L = sorted(L,reverse=True)

flg = 1
for i in range(N) :
    if i % 2 == 0 :
        if L[i] != N-i-1
            flg = 0
            break
    else :
        if L[i] != l
        flg = 0
        break
if flg == 0 :
    ans = 0
else :
    ans = 2**(N//2) % (10**9+7)
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))

D = {}
for a in A :
    if a not in D :
        D[a] = 1
    else :
        D[a] += 1
for a in D :
    if N % 2 == 1 :
        if a % 2 != 0 :
            ans = 0
            break
        elif D[a] != 2 :
            if a != 0 :
                ans = 0
                break
        else :
            ans = 2**(len(D)-1)
    else :
        if a % 2 == 0 :
            ans = 0
            break
        elif D[a] != 2 :
            ans = 0
            break
        else :
            ans = 2**(len(D))
print(ans)
Problem p03920 (python)

Fixed submission:
import sys
import bisect

sys.setrecursionlimit(10**9)

N = int(input())

L = [0]
l = 0
for i in range(1,10**6) :
    l += i
    L.append(l+1)
ans = []
while N > 0 :
    tmp = bisect.bisect(L,N)
    
    ans.append(tmp)
    N -= tmp
    
print(*ans,sep="\n")

Buggy submission (verdict: Runtime Error):
N = int(input())

L = [0]
l = 0
for i in range(1,100) :
    l += i
    L.append(l)
ans = []
while N > 0 :
    for i in range(len(L))  :
        #print(L[i],N,L[i+1])
        if (L[i]+1 <= N <= L[i+1]) :
            ans.append(i+1)
            N -= i+1
            break
    
print(*ans,sep="\n")
Problem p03938 (python)

Fixed submission:
N = int(input())
P = list(map(lambda x: int(x)-1, input().split()))

A = [i*N for i in range(1,N+1)]
B = A[::-1]

for i,p in enumerate(P) :
    A[p] += i
    B[p] += i

print(*A)
print(*B)

Buggy submission (verdict: Runtime Error):
N = int(input())
P = list(map(int,input().split()))

A = [i*N for i in range(1,N+1)]
B = A[::-1]

for i,p in enumerate(P) :
    A[p] += i
    B[p] += i

print(*A)
print(*B)
Problem p03997 (python)

Fixed submission:
a=int(input())
b=int(input())
h=int(input())
ans=(a+b)*h*0.5
print(int(ans))

Buggy submission (verdict: Runtime Error):
a,b,h=map(int,input().split())
ans=(a+b)*h*0.5
print(int(ans))

Buggy submission (verdict: Runtime Error):
a,b,h=map(int,input().split())
ans=(a+b)*h*0.5
print(ans)
Problem p04015 (python)

Fixed submission:
N,A = map(int,input().split())

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

ma = max(X)

dp = [[[0 for s in range(ma*N+1)] for k in range(N+1)] for i in range(N+1)]

dp[0][0][0] = 1

for i in range(1,N+1) :
    for k in range(i+1) :
        for s in range(ma*N+1) :
            if (k >= 1) and (s >= X[i-1]) :
                dp[i][k][s] = dp[i-1][k][s] + dp[i-1][k-1][s-X[i-1]]
            else :
                dp[i][k][s] = dp[i-1][k][s]

ans = 0

for k in range(1,N+1) :
    if k*A > ma*N :
        break
    ans += dp[N][k][k*A]

print(ans)

Buggy submission (verdict: Runtime Error):
N,A = map(int,input().split())

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

ma = max(X)

dp = [[[0 for s in range(ma*N+1)] for k in range(N+1)] for i in range(N+1)]

dp[0][0][0] = 1

for i in range(1,N+1) :
    for k in range(i+1) :
        for s in range(ma*N+1) :
            if (k >= 1) and (s >= X[i-1]) :
                dp[i][k][s] = dp[i-1][k][s] + dp[i-1][k-1][s-X[i-1]]
            else :
                dp[i][k][s] = dp[i-1][k][s]

ans = 0

for k in range(1,N+1) :
    ans += dp[N][k][k*A]

print(ans)

Buggy submission (verdict: Runtime Error):
N,A = map(int,input().split())

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

ma = max(X)

dp = [[[0 for s in range(ma*N+1)] for k in range(N+1)] for i in range(N+1)]

dp[0][0][0] = 1

for i in range(1,N+1) :
    for k in range(i+1) :
        for s in range(ma*N+1) :
            if (k >= 1) and (s >= X[i-1]) :
                dp[i][k][s] = dp[i-1][k][s] + dp[i-1][k-1][s-X[i-1]]
            else :
                dp[i][k][s] = dp[i-1][k][s]

ans = 0

for k in range(1,N+1) :
    ans += dp[N][k][k*A]

print(ans)

Buggy submission (verdict: Runtime Error):
N,A = map(int,input().split())
X = list(map(int,input().split()))

ma = max(X)

dp = [[[0 for s in range(N*ma+1)] for k in range(N+1)] for j in range(N+1)]

dp[0][0][0] = 1

for j in range(1,N+1) :
    for k in range(N+1) :
        for s in range(N*ma+1) :
            if s < X[j-1] :
                dp[j][k][s] = dp[j-1][k][s]
            elif (k >= 1) and (s >= X[j-1]) :
                dp[j][k][s] = dp[j-1][k][s] + dp[j-1][k-1][s-X[j-1]]
            else :
                dp[j][k][s] = 0

ans = 0

for k in range(1,N+1) :
    ans += dp[N][k][k*A]

print(ans)

Buggy submission (verdict: Runtime Error):
N,A = map(int,input().split())
X = list(map(int,input().split()))

ma = max(X)

dp = [[[0 for s in range(N*ma+1)] for k in range(N+1)] for j in range(N+1)]

dp[0][0][0] = 1

for j in range(1,N+1) :
    for k in range(N+1) :
        for s in range(N*ma+1) :
            if (j >= 1) and (s < X[j-1]) :
                dp[j][k][s] = dp[j-1][k][s]
            elif (j >= 1) and (k >= 1) and (s >= X[j-1]) :
                dp[j][k][s] = dp[j-1][k][s] + dp[j-1][k-1][s-X[j-1]]
            else :
                dp[j][k][s] = 0

ans = 0

for k in range(1,N+1) :
    ans += dp[N][k][k*A]

print(ans)
Problem p04043 (python)

Fixed submission:
a,b,c =map(int,input().split())
L=[]
L.append(a)
L.append(b)
L.append(c)
if L.count(5)==2 and L.count(7)==1 :
    print("YES")
else :
    print("NO")

Buggy submission (verdict: Runtime Error):
a,b,c =map(int(input().split()))
L=[]
L.append(a)
L.append(b)
L.append(c)
if L.count(5)==2 and L.count(7)==1 :
    print("YES")
else :
    print("NO")
Problem p04047 (python)

Fixed submission:
N = int(input())
L = list(map(int,input().split()))
L = sorted(L)
answer = 0
for i in range(len(L)) :
    if i % 2 == 0 :
        answer += L[i]
print(answer)

Buggy submission (verdict: Runtime Error):
N = int(input())
L = list(map(int,input().split()))
L.sort()
ans = 0
for i in range(0,2*N,2) :
    ans += L[i]
print(ans)