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

Fixed submission:
H, A = input().split()

n = (int(H)/int(A)) +(int(H)%int(A)>0)

print(int(n))

Buggy submission (verdict: Runtime Error):
H, A = input().split()

n = round((int(H)/int(A)) + 0.5)

print(n)10
Problem p02817 (python)

Fixed submission:
S, T = input().split()

print(T+S)

Buggy submission (verdict: Runtime Error):
A, B, K = input().split()

C = int(K)-int(A)
B = int(B)-C

print(str(C) +" "+ str(B))
Problem p02818 (python)

Fixed submission:
A, B, K = input().split()
C = int(K)-int(A)
D = int(K)-int(B)

if(int(A)==0):
    if(int(B)==0):
        print(str(A) +" "+ str(B))
    else:
        if(D>=0):
            B = 0
        else:
            B = -D
        print(str(A) +" "+ str(B))
else:
    if(C >= 0):
        B = int(B)-C
        A = 0
        if(B<0):
            B = 0
    else:
        A = int(A)-int(K)
    print(str(A) +" "+ str(B))

Buggy submission (verdict: Runtime Error):
A, B, K = input().split()

C = int(K)-int(A)
if(C >= 0):
    B = int(B)-C
    A = 0
else:
    A = int(A)-int(break)

print(str(A) +" "+ str(B))
Problem p02573 (python)

Fixed submission:

import sys
sys.setrecursionlimit(int(2e5+999))

def solve():
    n,m=map(int,input().split()[0:2])

    fa=list(range(0,n+1))
    sz=[1]*(n+1)
    def gf(x) :
        if x==fa[x] :
            return x
        fa[x]=gf(fa[x])
        return fa[x]

    for i in range(m) :
        a,b=map(gf,map(int,input().split()[0:2]))
        if a!=b :
            fa[a]=b
            sz[b]+=sz[a]

    ans=1
    for i in range(1,n+1) :
        ans=max(ans,sz[gf(i)])
    return ans

print(solve())

Buggy submission (verdict: Runtime Error):

def solve():
    n,m=map(int,input().split()[0:2])

    fa=list(range(0,n+1))
    sz=[1]*(n+1)
    def gf(x) :
        if x==fa[x] :
            return x
        fa[x]=gf(fa[x])
        return fa[x]

    for i in range(m) :
        a,b=map(gf,map(int,input().split()[0:2]))
        if a!=b :
            fa[a]=b
            sz[b]+=sz[a]

    ans=1
    for i in range(1,n+1) :
        ans=max(ans,sz[gf(i)])
    return ans

print(solve())

Buggy submission (verdict: Runtime Error):

def solve():
    n,m=map(int,input().split())

    fa=list(range(0,n+1))
    sz=[1]*(n+1)
    def gf(x) :
        if x==fa[x] :
            return x
        fa[x]=gf(fa[x])
        return fa[x]

    for i in range(m) :
        a,b=map(gf,map(int,input().split()))
        if a!=b :
            fa[a]=b
            sz[b]+=sz[a]

    ans=1
    for i in range(1,n+1) :
        ans=max(ans,sz[gf(i)])
    return ans

print(solve())
Problem p02971 (python)

Fixed submission:
N = int(input())
nums = [int(input()) for i in range(N)]

_nums = sorted(nums, reverse=True)
max1 = _nums[0]
max2 = _nums[1]
for i in range(0, N):
    if nums[i] == max1:
        print(max2)
    else:
        print(max1)

Buggy submission (verdict: Runtime Error):
N = int(input())
nums = [input() for i in range(N)]

max_list = []

for i in range(0, N):
    f_nums = nums[:i-1]
    l_nums = nums[i+1:]
    f_nums.extend(l_nums)
    _max = max(f_nums)
    max_list.append(_max)

for x in max_list:
    print(x)
Problem p02640 (python)

Fixed submission:
x,y = map (int, input ().split())

a = (4*x - y)/2
b = (y-2*x)/2
if y % 2 == 0 and a >= 0 and b >= 0:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
def nums (X,Y):
   B = (X*4-Y)/(4-2)
    D = X-B
    if B + D == X and Y == (B*2 + D*4):
          print("True")
    else:
           print("False")
Problem p03068 (python)

Fixed submission:
n = int(input())
s = str(input())
k = int(input())

a = []
for i in s:
    
    if i != s[k-1]:
        a.append('*')
    else:
        a.append(i)

print(*[i for i in a],sep='')

Buggy submission (verdict: Runtime Error):
n = int(input())
s = str(input())
k = int(input())

a = []
for i in s:
    
    if i != s[k]:
        a.append('*')
    else:
        a.append(i)

print(*[i for i in a],sep='')

Buggy submission (verdict: Runtime Error):

n = int(input())
s = str(input())
k = int(input())

a = []
for i in s:
    
    if i != s[k]:
        a.append('*')
    else:
        a.append(i)

print(*[i for i in a],sep='')
Problem p03565 (python)

Fixed submission:
a = input()
b = input()

length = len(a) - len(b) + 1

ans = []
for i in range(length):
    A = list('?'*i+b+'?'*(length-i-1))
    flag = True
    for j in range(len(a)):
        if a[j] == '?' or a[j] == A[j]:
            pass
        elif a[j] != '?' and A[j] == '?':
            A[j] = a[j]
        else:
            flag = False
    if flag:
        ans.append(''.join(A).replace('?','a'))

if ans:
    ans.sort()
    print(ans[0])
else:
    print('UNRESTORABLE')

Buggy submission (verdict: Runtime Error):
import sys

a,b = [input() for i in range(2)]

length = abs(len(a)-len(b))

for i in range(length+1):
    right_length = length - i
    temp = '?'*i+b+'?'*right_length
    
    #判定
    judge = 0
    for j in range(len(a)):
        if a[j] == temp[j] or temp[j] == '?':
            judge += 1
        elif temp[j] != '?' and a[j] == '?':
            judge += 1
    if judge == len(a):
        S = ''
        for k in range(len(temp)):
            if temp[k] == '?':
                S += a[k]
            else:
                S += temp[k]
        
        print(S.replace('?','a'))
        sys.exit()


print('UNRESTORABLE')

Buggy submission (verdict: Runtime Error):
a,b = [input() for i in range(2)]

length = abs(len(a)-len(b))

for i in range(length+1):
    right_length = length - i
    temp = '?'*i+b+'?'*right_length
    
    #判定
    judge = 0
    for j in range(len(a)):
        if a[j] == temp[j] or temp[j] == '?':
            judge += 1
        elif temp[j] != '?' and a[j] == '?':
            judge += 1
    if judge == len(a):
        S = ''
        for k in range(len(temp)):
            if temp[k] == '?':
                S += a[k]
            else:
                S += temp[k]
        
        print(S.replace('?','a'))
        exit()

    else:
        continue

print('UNRESTORABLE')
Problem p03606 (python)

Fixed submission:
n =int(input())

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

print(total)

Buggy submission (verdict: Runtime Error):
2
6 8
3 3
Problem p03760 (python)

Fixed submission:

o = list(input())
e = list(input())+[""]

for x,y in zip(o,e):print(x+y,end='')

Buggy submission (verdict: Runtime Error):
o,e = [input() for i in range(2)]

print(*[o[i]+e[i] for i in range(len(o))], sep='')
Problem p02658 (python)

Fixed submission:
import collections
import sys

N=int(input())
A=list(map(int, input().split()))
A_dict=collections.Counter(A)
ANS=1
if 0 in A_dict.keys():
    print("0")
    sys.exit()
    
for key, value in A_dict.items():
    ANS=ANS*(key**value)
    if ANS>10**18:
        print(-1)
        sys.exit()

print(ANS)

Buggy submission (verdict: Runtime Error):
import numpy as np
N=int(input())
A=list(map(int, input().split()))
A_N=np.array(A,dtype='int64')

ANS=np.prod(A_N)

if ANS>10**18:
    print(""-1")
else:
    print(ANS)

Buggy submission (verdict: Runtime Error):
import collections
N=int(input())
A=list(map(int, input().split()))
A_dict=collections.Counter(A)
ASN=0
for i in A_dict.keys():
    ANS+=i**A_dict[i]

if ANS>10**18:
    print(-1)
else:
    print(ANS)

Buggy submission (verdict: Runtime Error):
from operator import mul
from functools import reduce

N=int(input())
A=list(map(int, input().split()))
reduce(mul, A)

if ANS>10**18:
    print(-1)
else:
    print(ANS)
Problem p02664 (python)

Fixed submission:
import sys
T=list(input())
Q=[i for i, x in enumerate(T) if x == '?']

if len(T)==1:
    print("D")
    sys.exit(0)

for i in Q:
    if i==0:
        if T[i+1]=="D" or T[i+1]=="?":
            T[i]="P"
        else:
            T[i]="D"
    elif i==len(T)-1:
        T[i]="D"
    else:
        if T[i-1]=="P":
            T[i]="D"
        elif T[i+1]=="D" or T[i+1]=="?":
            T[i]="P"
        else:
            T[i]="D"
print("".join(map(str, T)))

Buggy submission (verdict: Runtime Error):
T=list(input())
Q=[i for i, x in enumerate(T) if x == '?']

for i in Q:
    if i==0:
        if T[i+1]=="D" or T[i+1]=="?":
            T[i]="P"
        else:
            T[i]="D"
    elif i==len(T)-1:
        T[i]="D"
    else:
        if T[i-1]=="P":
            T[i]="D"
        elif T[i+1]=="D" or T[i+1]=="?":
            T[i]="P"
        else:
            T[i]="D"
print("".join(map(str, T)))

Buggy submission (verdict: Runtime Error):
import sys
T=list(input())
Q=[i for i, x in enumerate(T) if x == '?']

if len(Q)==0:
    ptint("".join(map(str, T)))
    sys.exit(0)
for i in Q:
    if i==0:
        if T[i+1]=="D" or T[i+1]=="?":
            T[i]="P"
        else:
            T[i]="D"
    elif i==len(T)-1:
        T[i]="D"
    else:
        if T[i-1]=="P":
            T[i]="D"
        elif T[i+1]=="D" or T[i+1]=="?":
            T[i]="P"
        else:
            T[i]="D"
print("".join(map(str, T)))

Buggy submission (verdict: Runtime Error):
T=list(input())
Q=[i for i, x in enumerate(T) if x == '?']

for i in Q:
    if i==0:
        if T[i+1]=="D" or T[i+1]=="?":
            T[i]="P"
        else:
            T[i]="D"
    elif i==len(T)-1:
        T[i]="D"
    else:
        if T[i-1]=="P":
            T[i]="D"
        elif T[i+1]=="D" or T[i+1]=="?":
            T[i]="P"
        else:
            T[i]="D"
print("".join(map(str, T)))

Buggy submission (verdict: Runtime Error):
T=list(input())
Q=[i for i, x in enumerate(T) if x == '?']

for i in Q:
    if i==0:
        if T[i+1]=="D" or T[i+1]=="?":
            T[i]="P"
        else:
            T[i]="D"
    elif i==len(T)-1:
        T[i]="D"
    else:
        if T[i-1]=="P":
            T[i]="D"
        elif T[i+1]=="D" or T[i+1]=="?":
            T[i]="P"
        else:
            T[i]="D"
print("".join(map(str, T)))
Problem p02732 (python)

Fixed submission:
import collections
n = int(input())
arr = list(map(int, input().split()))
cnt = collections.Counter(arr)
total = 0
for i in cnt.keys():
  patern = cnt[i]*(cnt[i]-1)//2
  total += patern
for j in range(n):
  tmp = total
  total -= cnt[arr[j]]*(cnt[arr[j]]-1)//2
  total += (cnt[arr[j]]-1)*(cnt[arr[j]]-2)//2
  print(total)
  total = tmp

Buggy submission (verdict: Runtime Error):
import math
def comb(N, r):
    return math.factorial(N) // (math.factorial(N - r) * math.factorial(r))

for i in range(num):
    A=target.copy()
    A.pop(i)
    out=0
    for j in set(A):
        if A.count(j)>1:
            base = comb(A.count(j),2)
            out=out+base
    print(out)
Problem p02747 (python)

Fixed submission:
s=input()
a=len(s)//2
if len(s)%2==1:
    print("No")
else:
    if s=="hi"*a:
        print("Yes")
    else:
        print("No")

Buggy submission (verdict: Runtime Error):
s=input()
print(len(s))
for i in range(len(s)):
    if s[i]=="h":
        if i<len(s)-1:
            if s[i+1]=="i":
                print("Yes")
                break
	print("No")

Buggy submission (verdict: Runtime Error):
s=input()
 
for i in range(len(s)):
  if s[i]=="h":
    if i<len(s):
      s[i+1]=="i":
        print("yes")
print("no")

Buggy submission (verdict: Runtime Error):
s=input()

for i in range(len(s):
               if s[i]=="h":
                if s[i+1]=="i":
                 print("yes")
                 exit()
Problem p02705 (python)

Fixed submission:
import math
R = float(input())
circumference = 2 * math.pi * R
print("%.20f" % circumference)

Buggy submission (verdict: Runtime Error):
import math
R = int(input())
circumference = 2 * math.pi * R
print("%.20f" % circumference())
Problem p02772 (python)

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

for a in A:
    if a % 2 == 1:
        continue
    if a % 3 == 0 or a % 5 == 0:
        continue
    print('DENIED')
    exit()
print('APPROVED')

Buggy submission (verdict: Runtime Error):
n = int(input())
arr = [input() for _ in range(n)]
dic = {}
for i in range(n):
    if arr[i] not in dic:
        dic[arr[i]] = 1
    else:
        dic[arr[i]] += 1
largest = max(dic.values())
ans = []
for keys in dic.keys():
    if dic[keys] == largest:
        ans.append(keys)
ans = sorted(ans)
for words in ans:
    print(words)
Problem p03263 (python)

Fixed submission:
from scipy.spatial import distance


def main():
    h, w = map(int, input().split())
    a = [list(map(int, input().split())) for _ in range(h)]
    op = []
    c = 0

    for y in range(h):
        if y % 2 == 0:
            for x in range(w):
                if (c == 1):
                    a[y][x] += 1
                    c = 0

                if a[y][x] % 2 == 1:
                    c = 1
                    x, y = x + 1, y + 1
                    if (x == w):
                        if y != h:
                            op.append([y, x, y + 1, x])
                        else:
                            break
                    else:
                        op.append([y, x, y, x + 1])
                    x, y = x - 1, y - 1

        else:
            for x in reversed(range(w)):
                if (c == 1):
                    a[y][x] += 1
                    c = 0

                if a[y][x] % 2 == 1:
                    c = 1
                    x, y = x + 1, y + 1
                    if (x == 1):
                        if y != h:
                            op.append([y, x, y + 1, x])
                        else:
                            break
                    else:
                        op.append([y, x, y, x - 1])
                    x, y = x - 1, y - 1

    print(len(op))
    for o in op:
        print(' '.join(map(str, o)))


main()

Buggy submission (verdict: Runtime Error):
from scipy.spatial import distance


def main():
    h, w = map(int, input().split())
    a = [list(map(int, input().split())) for _ in range(h)]
    op = []
    c = 0

    for y in range(h):
        if y % 2 == 0:
            for x in range(w):
                if (c == 1):
                    a[y][x] += 1
                    c = 0

                if a[y][x] % 2 == 1:
                    c = 1
                    x, y = x + 1, y + 1
                    if (x == w):
                        if y != h:
                            op.append([y, x, y + 1, x])
                        else:
                            break
                    else:
                        op.append([y, x, y, x + 1])
                    x, y = x - 1, y - 1

        else:
            for x in reversed(range(w)):
                if (c == 1):
                    a[y][x] += 1
                    c = 0

                if a[y][x] % 2 == 1:
                    c = 1
                    x, y = x + 1, y + 1
                    if (x == 1):
                        if y != h:
                            op.append([y, x, y + 1, x])
                        else:
                            break
                    else:
                        op.append([y, x, y, x - 1])
                    x, y = x - 1, y - 1

    print(len(op))
    for o in op:
        print(' '.join(map(str, o)))


main()
Problem p03644 (python)

Fixed submission:
import math

n = int(input())
print(pow(2, math.floor(math.log2(n))))

Buggy submission (verdict: Runtime Error):
import math

n = int(input())
print(pow(2, math.floor(math.log2(n))))
Problem p02687 (python)

Fixed submission:
s = input()
if s == "ABC":
    print("ARC")
if s == "ARC":
    print("ABC")

Buggy submission (verdict: Runtime Error):
ABC = input("The element of S: ")
ARC = input("The element of S: ")
if ABC == "S":
    print("ABC")
if ARC == "S":
    print("ARC")
Problem p02606 (python)

Fixed submission:
l, r, d = map(int, input().split())
count = 0
for i in range(l,r+1) :
    if i%d == 0 :
        count += 1
print(count)

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
f = [0] * n
sqrt_n = int(math.sqrt(n)) +1
for i in range(n) :
    for x in range(1,sqrt_n) :
        for y in range(1,sqrt_n) :
            for z in range(1,sqrt_n) :
                if x*x+y*y+z*z+x*y+y*z+z*x == i+1 :
                    f[i] += 1
for _ in range(n) :
    print(f[_])
Problem p02837 (python)

Fixed submission:
n = int(input())
g = [[-1 for _ in range(15)] for _ in range(15)]
for i in range(n) :
    m = int(input())
    for j in range(m) :
        x,y = map(int, input().split())
        #人iが「人xはyである」と証言している
        g[i][x-1] = y

ans = 0
for i in range(1<<n) :
    honests = [0] * n
    for j in range(n) :
        if (i>>j) & 1 :
            honests[j] = 1
    ok = True
    for j in range(n) :
        if honests[j] : #正直者の証言だけ検証する
            for k in range(n) :
                if g[j][k] == -1 :
                    continue
                if g[j][k] != honests[k] :
                    ok = False
    if ok :
        ans = max(ans, honests.count(1))

print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
g = [[-1]* 15 for _ in range(15)]
for i in range(n) :
    m = int(input())
    for j in range(n) :
        x, y = map(int, input().split())
        #人iが「人xはyである」と証言している
        g[i][x-1] = y

ans = 0
for i in range(1<<n) :
    honest = [0] * n
    for j in range(n) :
        if (i>>j) & 1 == 1 :
            honest[j] = 1
    #ここまでですべての組み合わせを網羅している
    ok = True
    for j in range(n) :
        if honest[j] : #正直者の証言だけ検証する
            for k in range(n) :
                if g[j][k] == -1 :
                    continue
                if g[i][j] != honest[k] :
                    ok = False
            if ok :
                ans = max(ans, honest.count(1))
print(ans)
Problem p03031 (python)

Fixed submission:
"""
ビット全探索
"""
n, m = map(int, input().split())
lamps = [list(map(lambda x:int(x)-1, input().split()))[1:] for _ in range(m)]
p = list(map(int, input().split()))
ans = 0
#ビット全探索
for i in range(2**n) :
    for r in range(m) :
        on = 0
        for j in range(n) :
            #j桁目が1であるかどうかを調べる
            #jがsに含まれているかどうか調べる
            if (i>>j) & 1 == 1 and j in lamps[r] :
                on += 1
        if on % 2 != p[r] :
            break
    else :
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
"""
ビット全探索
"""
n, m = map(int, input().split())
lamps = [list(map(lambda x:int(x)-1, input().split()))[1:] for _ in range(m)]
p = list(map(int, input().split()))

#ビット全探索
for i in range(2**n) :
    for r in range(m) :
        on = 0
        for j in range(n) :
            #j桁目が1であるかどうかを調べる
            #jがsに含まれているかどうか調べる
            if (i>>j) & 1 == 1 and j in lamps[r] :
                on += 1
        if on % 2 != p[r] :
            break
    else :
        ans += 1
print(ans)
Problem p03086 (python)

Fixed submission:
S = input()
mx = 0
count = 0
for x in S :
    if x in "ATGC" :
        count += 1
    else :
        mx = max(mx, count)
        count = 0
mx = max(mx, count)
print(mx)

Buggy submission (verdict: Runtime Error):
S = input()
max = 0
count = 0
for x in S :
    if x in "ATGC" :
        count += 1
    else :
        max = max(max, count)
        count = 0
max = max(max, count)
print(max)

Buggy submission (verdict: Runtime Error):
S = input()
max = 0
count = 0
for x in S :
    if x in "ATGC" :
        count += 1
    else :
        max = max(max, count)
        count = 0
max = max(max, count)
print(max)
Problem p03386 (python)

Fixed submission:
a, b, k = map(int, input().split())
if (b-a+1) <= 2 * k :
    count = a
    while count <= b :
        print(count)
        count += 1
else :
    for i in range(k) :
        print(a+i)
    for i in range(k) :
        print(b-((k-1)-i))

Buggy submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
num_list = list(range(a,b+1))

if (b-a+1) <= 2 *k :
    for i in range(b-a+1) :
        print(num_list[i])
else :
    smaller = num_list[:k]
    larger = num_list[-k:]
    ans = smaller + larger
    for i in range(k*2) :
        print(ans[i])

Buggy submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
num_list = list(range(a,b+1))
smaller = num_list[:k]
larger = num_list[-k:]
ans = smaller + larger
for i in range(k*2) :
    print(ans[i])
Problem p03427 (python)

Fixed submission:
n = input()
if n[1:] == "9" * (len(n)-1) :
    print(int(n[0])+9*(len(n)-1))
else :
    print(int(n[0])+9*(len(n)-1)-1)

Buggy submission (verdict: Runtime Error):
n = input()
if n[1:] == "9"*(len(n)-1) :
    l = list(n)
    print(sum(n))
else :
    l = list(n)
    ans = (len(n)-1) * 9 + int(l[0]) - 1
    print(ans)

Buggy submission (verdict: Runtime Error):
n = input()
if n[1:] == "9"*(len(n)-1) :
    l = list(n)
    print(sum(n))
else :
    l = list(n)
    ans = (len(n)-1) * 9 + int(l[0]) - 1
    print(ans)
Problem p02719 (python)

Fixed submission:
import math

N,K = map(int,input().split())
tmp = N%K

while True:
  if abs(tmp - K) < tmp:
    tmp = abs(tmp - K)
  else:
    break
 	
print(tmp)

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


while:
	tmp = N
	if(abs(tmp - K) < tmp):
      	tmp = abs(tmp - K)
   	else:
      	break
 	
print(tmp)

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
int tmp = 0
 
while:
	tmp = N
	if(abs(tmp - K) < tmp):
      	tmp = abs(tmp - K)
   	else:
      	break
 	
print(tmp)

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
int tmp = 0
 
while:
	tmp = N
	if(abs(tmp - K) < tmp):
      	tmp = abs(tmp - K)
   	else:
      	break
 	
print(tmp)

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
int tmp = 0
 
while:
	tmp = N
	if(abs(tmp - K) < tmp):
      	tmp = abs(tmp - K)
   	else:
      	break
 	
print(tmp)

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
int tmp = 0
 
while();
	tmp = N
	if(abs(tmp - K) < tmp);
      	tmp = abs(tmp - K)
   	else;
      	break
 	
print(tmp)

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
int tmp = 0
 
while();
  N = tmp
  	if(abs(tmp - K) < tmp);
      tmp = abs(tmp - K)
  	else;
      break

    
print(tmp)

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

while(){
  N = tmp
  	if(abs(tmp - K) < tmp){
      tmp = abs(tmp - K)
    }
  	else{
      break;
    }
}

print(tmp)
Problem p02843 (python)

Fixed submission:
MAX = 100000+1
prices = [100, 101, 102, 103, 104, 105]

result = [ 0 for x in range(MAX)]
result[100] = 1
result[101] = 1
result[102] = 1
result[103] = 1
result[104] = 1
result[105] = 1

x = int(input())
for v in range(100, x+1):
    for p in prices:
        if result[v] or result[v-p]:
            result[v] = 1
            break
print(result[x])

Buggy submission (verdict: Runtime Error):
MAX = 100000
prices = [100, 101, 102, 103, 104, 105]

result = [ 0 for x in range(MAX)]
result[100] = 1
result[101] = 1
result[102] = 1
result[103] = 1
result[104] = 1
result[105] = 1

x = int(input())
for v in range(100, x+1):
    for p in prices:
        if result[v] or result[v-p]:
            result[v] = 1
            break
print(result[x])
Problem p02639 (python)

Fixed submission:
l=list(map(int,input().split()))
print(l.index(0)+1)

Buggy submission (verdict: Runtime Error):
l=map(int,input().split())
print(l.index(0))
Problem p02607 (python)

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

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
ans = 0
for i in range(0,n,2):
	if a[i] % 2 == 1:
    	ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
ans = 0
for i in range(0,n,2):
if a[i] % 2 == 1:
ans += 1
print(ans)
Problem p02608 (python)

Fixed submission:
n=int(input())
ans=[0 for _ in range(10001)]

for x in range(1,101):
  for y in range(1,101):
    for z in range(1,101):
      v=x*x+y*y+z*z+x*y+y*z+z*x
      if v<10001:
        ans[v]+=1

for i in range(n):
  print(ans[i+1])

Buggy submission (verdict: Runtime Error):
n=int(input())
x=input()

def popcount(n):
    bin_n=bin(n)[2:]
    count=0
    for i in bin_n:
        count+=int(i)
    return count

def f(n):
    ans=0
    while n>0:
        n=n%popcount(n)
        ans+=1
    return ans

for i in range(n):
    inv=str(int(not bool(int(x[i]))))
    i_10=int((x[0:i]+ inv+x[i+1:n]),2)
    print(f(i_10))