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

Fixed submission:
n = int(input())
XYH = [list(map(int, input().split())) for _ in range(n)]

for i in range(101):
    for j in range(101):
        temp = -1
        for x, y, h in XYH:
            if h == 0:
                continue
            temp = h + abs(x - i) + abs(y - j)
            break
        flag = 0
        for x, y, h in XYH:
            kouho = temp - (abs(x - i) + abs(y - j)) - h
            if kouho == 0:
                continue
            elif h == 0 and kouho < 0:
                continue
            else:
                flag = 1
                break
        if not flag:
            print(i, j, temp)
            exit()

Buggy submission (verdict: Runtime Error):
n = int(input())
XYH = [list(map(int, input().split())) for _ in range(n)]

takasa = [[-1] * (101) for _ in range(101)]
for i in range(n):
    x, y, h = XYH[i]
    if h == 0:
        continue
    for j in range(101):
        for k in range(101):
            if takasa[j][k] == -1:
                takasa[j][k] = abs(x - j) + abs(y - k) + h
            else:
                if takasa[j][k] == abs(x - j) + abs(y - k) + h:
                else:
                    takasa[j][k] = -2

for i in range(101):
    for j in range(101):
        if takasa[i][j] > 0:
            print(i, j, takasa[i][j])
            exit()

Buggy submission (verdict: Runtime Error):
import sys
n=int(input())
L=[]
for _ in range(n):
    x,y,h=map(int,input().split())
    L.append((x,y,h))
a,b,c=L[0]
mae=a+b+c
for i in range(101):
    for j in range(101):
        takasa=abs(a-i)+(b-j)+c
        flag=1
        for p,q,r in L:
            if r==100:
                ans=(p,q,r)
            if abs(p-i)+abs(q-j)+r == takasa:
                continue
            else:
                flag=0
        if flag:
            ans=(i,j,takasa)
print(*ans, sep=' ')
Problem p03244 (python)

Fixed submission:
from collections import Counter

n = int(input())
A = list(map(int, input().split()))

kisu = A[0::2]
gusu = A[1::2]

CK = Counter(kisu)
CG = Counter(gusu)
CKM = CK.most_common(2)
CGM = CG.most_common(2)

if len(CKM) == 1 and len(CGM) == 1:
    if CKM[0][0] == CGM[0][0]:
        ans = n // 2
    else:
        ans = 0
elif len(CKM) == 1:
    if CKM[0][0] == CGM[0][0]:
        ans = n // 2 - CGM[1][1]
    else:
        ans = n // 2 - CGM[0][1]
elif len(CGM) == 1:
    if CKM[0][0] == CGM[0][0]:
        ans = n // 2 - CKM[1][1]
    else:
        ans = n // 2 - CKM[0][1]
else:
    if CKM[0][0] == CGM[0][0]:
        ans1 = n // 2 - CKM[1][1] + n // 2 - CGM[0][1]
        ans2 = n // 2 - CGM[1][1] + n // 2 - CKM[0][1]
        ans = min(ans1, ans2)
    else:
        ans = n - (CKM[0][1] + CGM[0][1])

print(ans)

Buggy submission (verdict: Runtime Error):
from collections import Counter
n=int(input())
A=list(map(int,input().split()))
A1=A[0:n-1:2]
A2=A[1:n:2]
L=Counter(A)
L1=Counter(A1)
L2=Counter(A2)
comon=L.most_common()
comon1=L1.most_common()
comon2=L2.most_common()
hanbun=n//2
if len(comon)==1:
    print(hanbun)
else:
    cnt=0
    saidai11=comon1[0][1]
    saidai21=comon2[0][1]
    if saidai11>=saidai21:
        cnt+=hanbun-saidai11
        if saidai11==saidai21:
            cnt+=hanbun-comon2[1][1]
        else:
            cnt+=hanbun-saidai21
    else:
        cnt+=hanbun-saidai11
        if saidai11==saidai21:
            cnt+=hanbun-comon1[1][1]
        else:
            cnt+=hanbun-saidai11
    print(cnt)
Problem p03251 (python)

Fixed submission:
n,m,x,y=map(int,input().split())
X=list(map(int,input().split()))
Y=list(map(int,input().split()))
max_X=max(X)
min_Y=min(Y)
print('No War' if max_X<min_Y and max_X<y and x<min_Y else 'War')

Buggy submission (verdict: Runtime Error):
n,m,x,y=map(int,input().split())
X=list(map(int,input().split()))
Y=list(map(int,input().split()))
max_X=max(X)
min_Y=min(Y)
print('No War' if max_x<min_Y else 'War')
Problem p03282 (python)

Fixed submission:
s=input()
k=int(input())
place=101
ans=s[0]
for i in range(len(s)):
    if s[i]!='1':
        place=i+1
        ans=s[i]
        break
print(ans if place<=k else 1)

Buggy submission (verdict: Runtime Error):
s=input()
k=int(input())
for i in range(len(s)):
    if s[i]!='1':
        place=i+1
        ans=s[i]
        break
print(ans if place<=k else 1)
Problem p03308 (python)

Fixed submission:
n=int(input())
A=list(map(int,input().split()))
print(abs(max(A)-min(A)))

Buggy submission (verdict: Runtime Error):
n=int(input())
A=list(map(int,input().split()))
print(abs((max(A)-min(A))
Problem p03352 (python)

Fixed submission:
A=[1]
X=int(input())
for i in range(1,33):
  for j in range(2, 11):
    if i**j<X+1:
      A.append(i**j)
print(max(A))

Buggy submission (verdict: Runtime Error):
A=[1]
for i in range(1,33):
  for j in range(1, 11):
    if i**j<X:
      A.append(i**j)
print(A[-1])
Problem p03353 (python)

Fixed submission:
s = input()
k = int(input())
n = len(list(s))
kouho = set()
for i in range(n):
    for d in range(1, k + 1):
        if i + d <= n:
            kouho.add(s[i : i + d])
ans = list(kouho)
ans.sort()
# print(ans)
print(ans[k - 1])

Buggy submission (verdict: Runtime Error):
s = input()
k = int(input())
n = len(list(s))
kouho = set()
for i in range(n):
    for d in range(1, k + 1):
        if i + d < n:
            kouho.add(s[i : i + d])
ans = list(kouho)
ans.sort()
print(ans[k - 1])
Problem p03417 (python)

Fixed submission:
n,m=map(int,input().split())

if m>=2 and n>=2:
    print((n-2)*(m-2))
elif m==1 and n>=2:
    print(n-2)
elif n==1 and m>=2:
    print(m-2)
else:
    print(1)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())

if m>=2 and n>=2:
    print((n-2)*(m-2))
elif m==1 and n>=2:
    print(n-2)
elif n==1 and m>=2:
    print(m-2)
else:
    prnit(1)
Problem p03501 (python)

Fixed submission:
n,a,b=map(int,input().split())
print(min(a*n,b))

Buggy submission (verdict: Runtime Error):
n,a,b=map(int,input())
print(max(a*n,b))
Problem p03503 (python)

Fixed submission:
n = int(input())
F = [int("".join(input().split()), 2) for _ in range(n)]
P = [list(map(int, input().split())) for _ in range(n)]
num = 1 << 10
ans = -(10 ** 10)


def popcnt(n):
    c = (n & 0x5555555555555555) + ((n >> 1) & 0x5555555555555555)
    c = (c & 0x3333333333333333) + ((c >> 2) & 0x3333333333333333)
    c = (c & 0x0F0F0F0F0F0F0F0F) + ((c >> 4) & 0x0F0F0F0F0F0F0F0F)
    c = (c & 0x00FF00FF00FF00FF) + ((c >> 8) & 0x00FF00FF00FF00FF)
    c = (c & 0x0000FFFF0000FFFF) + ((c >> 16) & 0x0000FFFF0000FFFF)
    c = (c & 0x00000000FFFFFFFF) + ((c >> 32) & 0x00000000FFFFFFFF)
    return c


# print(F)

for i in range(1, num):
    temp = 0
    for j in range(n):
        temp += P[j][popcnt(i & F[j])]
    ans = max(temp, ans)
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
F= [list(map(int,input().split())) for i in range(N)]
#F[i][j]はi行目、すなわち店i+1の時間帯jに対してやっているかどうか
P= [list(map(int,input().split())) for i in range(N)]
#P[i][j]は店i+1が時間jに1で自分も1の時に得られる効果
ans=[]
for k in range(n):
    for i in range(2**10):
        c=0
        for j in range(10):
            if ((i>>j)&1) and F[k][j]==1:
                c+=1
        ans.append(P[k][c])
print(max(ans))

Buggy submission (verdict: Runtime Error):
n=int(input())
F= [list(map(int,input().split())) for i in range(N)]
#F[i][j]はi行目、すなわち店i+1の時間帯jに対してやっているかどうか
P= [list(map(int,input().split())) for i in range(N)]
#P[i][j]は店i+1が時間jに1で自分も1の時に得られる効果
ans=[]
for k in range(n):
    for i in range(2**10):
        c=0
        for j in range(10):
            if (i>>j)&1 and F[k][j]==1:
                c+=P[k][j]
        ans.append(c)
print(max(c))
Problem p03546 (python)

Fixed submission:
h, w = map(int, input().split())
C = [list(map(int, input().split())) for i in range(10)]
A = [list(map(int, input().split())) for i in range(h)]

# C[i][j]はiをjにするのに必要なコスト
# warshal-floyd
for k in range(10):
    for i in range(10):
        for j in range(10):
            C[i][j] = min(C[i][j], C[i][k] + C[k][j])
ans = 0
for i in range(h):
    for j in range(w):
        if A[i][j] == -1:
            ans += 0
        else:
            ans += C[A[i][j]][1]
print(ans)

Buggy submission (verdict: Runtime Error):
h, w = map(int, input().split())
C = [list(map(int, input().split())) for i in range(10)]
A = [list(map(int, input().split())) for i in range(h)]

# C[i][j]はiをjにするのに必要なコスト
# warshal-floyd
for k in range(10):
    for i in range(10):
        for j in range(10):
            C[i][j] = min(C[i][j], C[i][k] + C[k][j])
for i in range(10):
ans = 0
for i in range(h):
    for j in range(w):
        if A[i][j] == -1:
            ans += 0
        else:
            ans += C[A[i][j]][1]
print(ans)
Problem p03599 (python)

Fixed submission:
a, b, c, d, e, f = map(int, input().split())
kouho = []
for i in range(f // (100 * a) + 1):
    for j in range(f // (100 * b) + 1):
        water = 100 * (a * i + b * j)
        if water > f:
            break
        if water == 0:
            continue
        sugar_max = (a * i + b * j) * e
        for k in range(sugar_max // c + 1):
            for l in range(sugar_max // d + 1):
                sugar = c * k + d * l
                if water + sugar > f:
                    break
                if sugar > sugar_max:
                    break
                density = (sugar / (water + sugar), water + sugar, sugar)
                kouho.append(density)
kouho.sort(reverse=True)
print(kouho[0][1], kouho[0][2])

Buggy submission (verdict: Runtime Error):
a, b, c, d, e, f = map(int, input().split())
kouho = []
for i in range(f // a + 1):
    for j in range(f // b + 1):
        water = 100 * (a * i + b + j)
        if water > f:
            break
        if water == 0:
            break
        sugar_max = (a * i + b + j) * e
        for k in range(sugar_max // c + 1):
            for l in range(sugar_max // d + 1):
                sugar = c * k + d * l
                if water + sugar > f:
                    break
                if sugar > sugar_max:
                    break
                density = (sugar / (water + sugar), water + sugar, sugar)
                kouho.append(density)
kouho.sort(reverse=True)
print(kouho[0][1], kouho[0][2])

Buggy submission (verdict: Runtime Error):
a, b, c, d, e, f = map(int, input().split())
kouho = []
for i in range(f // a + 1):
    for j in range(f // b + 1):
        water = 100 * (a * i + b + j)
        if water > f:
            break
        sugar_max = (a * i + b + j) * e
        for k in range(sugar_max // c + 1):
            for l in range(sugar_max // d + 1):
                sugar = c * k + d * l
                if water + sugar > f:
                    break
                if sugar > sugar_max:
                    break
                if water + sugar == 0:
                    continue
                density = (sugar / (water + sugar), water + sugar, sugar)
                kouho.append(density)
kouho.sort(reverse=True)
print(kouho[0][1], kouho[0][2])
Problem p03606 (python)

Fixed submission:
c=0
N=int(input())
for i in range(N):
  A=list(map(int, input().split()))
  c+=A[1]-A[0]+1
print(c)

Buggy submission (verdict: Runtime Error):
c=0
N=int(input())
for i in range(N):
  *A=map(int, input().split())
  c+=A[1]-A[0]+1
print(c)
Problem p03623 (python)

Fixed submission:
a,b,c=map(int,input().split())
print('A' if min(abs(b-a),abs(c-a))==abs(b-a) else 'B')

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
print(print 'A' if max(abs(b-a),abs(c-a))==abs(b-a) else 'B')
Problem p03633 (python)

Fixed submission:
n=int(input())
T=[int(input()) for i in range(n)]
def gcd(a,b):
    if b==0:
        return(a)
    else:
        return(gcd(b,a%b))
def lgm(a,b):
    return(a*b//(gcd(a,b)))
if n==1:
    print(T[0])
else:
    ans=T[0]
    for i in range(1,n):
        ans=lgm(ans,T[i])
    print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
T=[int(input()) for i in range(n)]
def gcd(a,b):
    if b==0:
        return(a)
    else:
        return(gcd(b,a%b))
def lgm(a,b):
    return(a*b//(gcd(a,b)))
if n==1:
    print(T[0])
else:
    ans=T[0]
    for i in range(1,n):
        ans=lgm(ans,T[i])
print(ans)
Problem p03673 (python)

Fixed submission:
n=int(input())
A=list(map(int,input().split()))
from collections import deque
ans=deque([])
d=deque(A)
for i in range(0,n):
    if i%2==0:
        ans.append(d[i])
    if i%2==1:
        ans.appendleft(d[i])
a=list(ans)
if n%2==1:
    c=a[::-1]
else:
    c=a
print(" ".join(map(str, c)))

Buggy submission (verdict: Runtime Error):
n=int(input())
A=list(map(int,input().split()))
from collections import deque
ans=deque([])
d=deque(A)
for i in range(0,n):
    if i%2==0:
        ans.append(d[i])
    if i%2==1:
        ans.appendleft(d[i])
a=list(ans)
if n%2==1:
    c=a[::-1]
print(" ".join(map(str, c)))

Buggy submission (verdict: Runtime Error):
n=int(input())
A=list(map(int,input().split()))
from collections import deque
ans=deque([])
d=deque(A)
for i in range(0,n):
    if i%2==0:
        ans.append(d[i])
    if i%2==1:
        ans.insert(0,d[i])
ans=list(ans)
if n%2==1:
    ans=ans[::-1]
print(" ".join(map(str, ans)))

Buggy submission (verdict: Runtime Error):
n=int(input())
A=list(map(int,input().split()))
from collections import deque
ans=deque([])
d=deque(A)
for i in range(0,n):
    if i%2==0:
        ans.append(d[i])
    if i%2==1:
        ans.insert(0,d[i])
ans=list(ans)
if n%2==1:
    ans=ans[::-1]
print(" ".join(map(str, ans)))

Buggy submission (verdict: Runtime Error):
n=int(input())
A=list(map(int,input().split()))
from collections import deque
ans=deque([])
d=deque(A)
for i in range(0,n):
    if i%2==0:
        ans.append(d[i])
    if i%2==1:
        ans.insert(0,d[i])
if n%2==1:
    ans=list(ans)[::-1]
print(" ".join(map(str, ans)))

Buggy submission (verdict: Runtime Error):
n=int(input())
A=list(map(int,input().split()))
ans=deque([])
from collections import deque
d=deque(A)
for i in range(0,n):
    if i%2==0:
        ans.append(d[i])
    if i%2==1:
        ans.insert(0,d[i])
if n%2==1:
    ans=list(ans)[::-1]
print(" ".join(map(str, ans)))
Problem p03679 (python)

Fixed submission:
x,a,b=map(int,input().split())
if b in range(a+1):
  print('delicious')
elif b in range(a,x+a+1):
  print('safe')
elif b>a+x:
  print('dangerous')

Buggy submission (verdict: Runtime Error):
x,a,b=map(int,input().split())
if b in range(a):
  print('delicious')
elif bin range(a,x+a+1):
  print('safe')
else:
  print('dangerous')
Problem p03683 (python)

Fixed submission:
###ncrのmodあまりの話
mod=10**9+7
N=100005
kaidan=[1 for i in range(N)]
gyaku=[1 for i in range(N)]
for i in range(1,N):
    kaidan[i] = (i * kaidan[i-1])%mod
    gyaku[i]=pow(kaidan[i], mod-2, mod)
def comb(a,b):
    return kaidan[a]*gyaku[b]*gyaku[a-b]
n,m=map(int,input().split())
if abs(n-m)>=2:
    print(0)
else:
    if n==m:
        print(kaidan[n]*kaidan[n]*2%mod)
    else:
        a=max(n,m)
        b=min(n,m)
        print(kaidan[a]*kaidan[b]%mod)

Buggy submission (verdict: Runtime Error):
###ncrのmodあまりの話
mod=10**9+7
N=100005
kaidan=[1 for i in range(N)]
gyaku=[1 for i in range(N)]
for i in range(1,N):
    kaidan[i] = (i * kaidan[i-1])%mod
    gyaku[i]=pow(bikkuri[i], mod-2, mod)
def comb(a,b):
    return kaidan[a]*gyaku[b]*gyaku[a-b]
n,m=map(int,input().split())
if abs(n-m)>=2:
    print(0)
else:
    if n==m:
        print(kaidan[n]*kaidan[n]*2%mod)
    else:
        a=max(n,m)
        b=min(n,m)
        print(kaidan[a]*kaidan[b]%mod)
Problem p03738 (python)

Fixed submission:
a=int(input())
b=int(input())
if a>b:print('GREATER')
elif a==b:print('EQUAL')
else:print('LESS')

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
if a>b:
  print('GREATER')
elif a==b:
  print('EQUAL')
else:
  print('LESS')

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
if a>b:print('GREATER')
elif a==b:print('EQUAL')
else:print('LESS')

Buggy submission (verdict: Runtime Error):
a,b=map(int,input())
if a>b:print('GREATER')
elif a==b:print('EQUAL')
else:print('LESS')
Problem p03796 (python)

Fixed submission:
N=int(input())
mod=10**9+7
bikkuri=[1 for i in range(N+2)]
for i in range(N+1):
  bikkuri[i+1]=((i+1)*bikkuri[i])%mod
print(bikkuri[N])

Buggy submission (verdict: Runtime Error):
N=int(input())
mod=10**9+7
bikkuri=[1 for i in range(N+1)]
for i in range(N+1):
  bikkuri[i+1]=((i+1)*bikkuri[i])%mod
print(bikkuri[N])

Buggy submission (verdict: Runtime Error):
N=int(input())
mod=10**9+7
bikkuri=[1*(N+1)]
for i in range(N+1):
  bikkuri[i+1]=((i+1)*bikkuri[i])%mod
print(bikkuri[N])
Problem p03799 (python)

Fixed submission:
n,m=map(int,input().split())
p1=n
p2=m//2
if p1>p2:
    print(p2)
else:
    delta=p2-p1
    print(delta//2+p1)

Buggy submission (verdict: Runtime Error):
n,m=map(int, input().split())
p1=n
p2=m//2
if p1>p2:
 	print(p2)
else:
	delta=p2-p1
    print(delta//2+p1)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
p1=n
p2=m//2
if p1>p2:
 	print(p2)
else:
	delta=p2-p1
    print(delta//2+p1)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
p1=n
p2=m//2
if p1>p2:
 	print(p2)
else:
	delta=p2-p1
    print(delta//2+p1)
Problem p03826 (python)

Fixed submission:
a,b,c,d=list(map(int,input().split()))
print(max(a*b, c*d))

Buggy submission (verdict: Runtime Error):
a,b,c,d=list(map(int,input()))
print(max(a*b, c*d))
Problem p03852 (python)

Fixed submission:
if input() in 'aiueo':print('vowel')
else:print('consonant')

Buggy submission (verdict: Runtime Error):
v='aiueo'
if c in v:print('vowel')
else:print('consonant')

Buggy submission (verdict: Runtime Error):
v='abcde'
if c in v:print('vowel')
else:print('consonant')
Problem p03962 (python)

Fixed submission:
a,b,c=map(int,input().split())
print(len(set([a,b,c])))

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
print(len(set(a,b,c)))
Problem p03998 (python)

Fixed submission:
A=list(input())
B=list(input())
C=list(input())
t='a'
d=1#ずっとまわすつもり。
while d==1:
    if t=='a':
        t=A.pop(0)
    elif t=='b':
        t=B.pop(0)
    elif t=='c':
        t=C.pop(0)
    if t=='a' and A==[]:
        print('A')
        break
    elif t=='b' and B==[]:
        print('B')
        break
    elif t=='c' and C==[]:
        print('C')
        break

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10000)
A=list(input())
B=list(input())
C=list(input())
t='a'
d=1
while d==1:
    if t=='a':
        t=A.pop(0)
    if t=='b':
        t=B.pop(0)
    if t=='c':
        t=C.pop(0)
    if t=='a' and A==[]:
        print('A')
        break
    if t=='b' and B==[]:
        print('B')
        break
    if t=='c' and C==[]:
        print('C')
        break

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10000)
A=list(input())
B=list(input())
C=list(input())
t='a'
d=1
while d==1:
    if t=='a':
        t=A.pop(0)
    if t=='b':
        t=B.pop(0)
    if t=='c':
        t=C.pop(0)
    if t=='a' and A==[]:
        print('A')
        break
    elif t=='b' and B==[]:
        print('B')
        break
    elif t=='c' and C==[]:
        print('C')
        break

Buggy submission (verdict: Runtime Error):
A=list(input())
B=list(input())
C=list(input())
t='a'
d=1
while d==1:
    if t=='a':
        t=A.pop(0)
    if t=='b':
        t=B.pop(0)
    if t=='c':
        t=C.pop(0)
    if t=='a' and A==[]:
        print('A')
        break
    elif t=='b' and B==[]:
        print('B')
        break
    elif t=='c' and C==[]:
        print('C')
        break

Buggy submission (verdict: Runtime Error):
A=list(input())
B=list(input())
C=list(input())
t='a'
d=1
while d==1:
    if t=='a' and A==[]:
        print('A')
        break
    elif t=='b' and B==[]:
        print('B')
        break
    elif t=='c' and C==[]:
        print('C')
        break
    if t=='a':
        t=A.pop(0)
    if t=='b':
        t=B.pop(0)
    if t=='c':
        t=C.pop(0)
Problem p04015 (python)

Fixed submission:
n,a=map(int,input().split())
X=list(map(int,input().split()))
dp=[[[0]*55 for _ in range(2555)] for _ in range(55)]
ans=0
dp[0][0][0]=1
for i in range(n):
    for j in range(52+50*i):
        for k in range(n):
            ni=i+1
            nj=j+X[i]
            nk=k+1
            dp[ni][nj][nk]+=dp[i][j][k]
            dp[ni][j][k]+=dp[i][j][k]
ans=0
for i in range(1,n+1):
    ans+=dp[n][i*a][i]
print(ans)

Buggy submission (verdict: Runtime Error):
%time
n,a=map(int,input().split())
X=list(map(int,input().split()))
dp=[[[0]*55 for _ in range(2555)] for _ in range(55)]
ans=0
dp[0][0][0]=1
for i in range(n):
    for j in range(52+50*i):
        for k in range(n):
            ni=i+1
            nj=j+X[i]
            nk=k+1
            dp[ni][nj][nk]+=dp[i][j][k]
            dp[ni][j][k]+=dp[i][j][k]
ans=0
for i in range(1,n+1):
    ans+=dp[n][i*a][i]
print(ans)

Buggy submission (verdict: Runtime Error):
n,a=map(int,input().split())
X=list(map(int,input().split()))
dp=[[[0]*55 for _ in range(2505)] for _ in range(55)]
ans=0
dp[0][0][0]=1
for i in range(n):
    for j in range(52+50*i):
        for k in range(n):
            ni=i+1
            nj=j+X[i]
            nk=k+1
            dp[ni][nj][nk]+=dp[i][j][k]
            dp[ni][j][k]+=dp[i][j][k]
ans=0
for i in range(1,n+1):
    ans+=dp[n][i*a][i]
print(ans)

Buggy submission (verdict: Runtime Error):
n,a=map(int,input().split())
X=list(map(int,input().split()))
dp=[[[0]*55 for _ in range(2505)] for _ in range(55)]
ans=0
dp[0][0][0]=1
for i in range(n):
    for j in range(52+50*i):
        for k in range(i+1):
            ni=i+1
            nj=j+X[i]
            nk=k+1
            dp[ni][nj][nk]+=dp[i][j][k]
            dp[ni][j][k]+=dp[i][j][k]
ans=0
for i in range(1,n+1):
    ans+=dp[n][i*a][i]
print(ans)

Buggy submission (verdict: Runtime Error):
n,a=map(int,input().split())
X=list(map(int,input().split()))
dp=[[[0]*52 for _ in range(2505)] for _ in range(52)]
ans=0
dp[0][0][0]=1
for i in range(n):
    for j in range(52+50*i):
        for k in range(i+1):
            ni=i+1
            nj=j+X[i]
            nk=k+1
            dp[ni][nj][nk]+=dp[i][j][k]
            dp[ni][j][k]+=dp[i][j][k]
ans=0
for i in range(1,n+1):
    ans+=dp[n][i*a][i]
print(ans)
Problem p04045 (python)

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

number = [i for i in range(10)]
num_lis = list(set(number) - set(D))
ans=[]
for i in range(N, 100000):
    a=i//10000
    if bool((a not in D) or i <10000):
        b=i//1000 - 10*a
        if bool((b not in D) or i <1000):
            c=i//100 - 100 * a - 10 * b
            if bool((c not in D) or i < 100):
                d= i//10 - 1000 * a - 100*b - 10*c
                if bool((d not in D) or i <10):
                    e=i%10
                    if e not in D:
                        ans.append(i)
print(ans[0])

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

number = [i for i in range(10)]
num_lis = list(set(number) - set(D))
ans=[]
for i in num_lis:
    for j in num_lis:
        for k in num_lis:
            for l in num_lis:
                a = 1000*i + 100 *j + 10*k + l
                if a>=N:
                    ans.append(a)
print(ans[0])

Buggy submission (verdict: Runtime Error):
N, K = list(map(int, input().split()))
D = list(map(int, input().split()))
number = [i for i in range(10)]
num_lis = list(set(number) - set(D))
ans=[]
for i in num_lis:
    for j in num_lis:
        for k in num_lis:
            for l in num_lis:
                a = 1000*i + 100 *j + 10*k + l
                if a>=N:
                    ans.append(a)
print(ans[0])