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

Fixed submission:
import math
A,B=map(int,input().split())
x=0
if A%2==0:#偶数スタート
    if(B%2==0):#偶数エンド
        if((B-A)/2 %2 == 0 ):#1が偶数個ならば？
            print(B)
        else:
            print(1^B)
    else:#奇数エンド
        if(((B+1) - A)/2 %2 == 0):#1が偶数個ならば？
            print(0)
        else:
            print(1)
else:#奇数スタート
    if(B%2==0):#偶数エンド
        if((B-(A+1))/2 %2 ==0):
            print(A^B)
        else:
            print(A^B^1)
    else:#奇数エンド
        if((B-A)/2 %2 == 0):
            print(A)
        else:
            print(A^1)

Buggy submission (verdict: Runtime Error):
import math
A,B=map(int,input().split())
if(math.log2(A)%1!=0):#少数ならば？
    m=int(math.log2(A))+1
else:
    m=int(math.log2(A))

n=int(math.log2(B))

binary=0
if m>=n:
    for x in range(A,B+1):
        binary = x^binary
        
    print(binary)
    exit()
else:
    for x in range(A,2**m):
        binary = binary^x

    for x in range(2**n,B+1,1):
        binary = binary^x

print(binary)

Buggy submission (verdict: Runtime Error):
import math
A,B=map(int,input().split())
if(math.log2(A)%1!=0):#少数ならば？
    m=int(math.log2(A))+1
else:
    m=int(math.log2(A))

n=int(math.log2(B))

binary=0
if A==B:
    for x in range(A,2**m):
        print(binary)
        binary = binary^x

    for x in range(2**n,B,1):
        binary = binary^x
else:
    print(A)
    exit()

print(binary)

Buggy submission (verdict: Runtime Error):
import math
A,B=map(int,input().split())
Ms = int(math.log2(B))
ms = int(math.log2(A))+1
binary=0
for x in range(A,2**ms):
    binary = binary^x

for x in range(2**Ms,B+1):
    binary = binary^x

print(binary)
Problem p03107 (python)

Fixed submission:

S = input()
work=list(S)
i=0
o_cout=0
z_cout=0
for x in work:
    if(x=='1'):
        o_cout+=1
    else:
        z_cout+=1
    
if(o_cout>z_cout):
    cout=z_cout
else:
    cout=o_cout
    

print(cout*2)

Buggy submission (verdict: Runtime Error):

S = input()
work=list(S)
i=0
cout=0
while(True):
    if(i==len(work)-1):
        break
    if(work[i]==work[i+1]):
        i+=1
    else:
        cout+=2
        del work[i]
        del work[i]
        i=0

    

print(len(S)-len(work))
Problem p02659 (python)

Fixed submission:
A, B = input().split()
a = int(A)
b = round(float(B)*100)

print((a*b)//100)

Buggy submission (verdict: Runtime Error):
A, B = input().split()
a = int(A)
b = round(float(B)*100)

print((A*B)//100)

Buggy submission (verdict: Runtime Error):
A, B = input().split()
a = int(A)
b = float(B)*100

print((A*B)//100)
Problem p02633 (python)

Fixed submission:
X = int(input())
ls = [2, 2, 2, 3, 3, 5]
a = []
for l in ls:
  if X % l == 0:
    a.append(l)
    X /= l
num = 1
if len(a) != 0:
  for b in a:
    num *= b
print(int(360 / num))

Buggy submission (verdict: Runtime Error):
X = int(input())
ls = [2, 2, 2, 3, 3, 5]
a = []
for l in ls:
  if X % l == 0:
    a.append(l)
    X /= l
num = 1
if len(a) != 0:
  for b in a:
    num *= b
print(360 / b)
Problem p02915 (python)

Fixed submission:
n = int(input())
print(n**3)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = list(map(int,input().split()))
for i in range(len(s)-1,0,-1):
    if(s[i]>s[i-1]):
        continue
    else:
        s[i-1] = s[i]
print(sum(s)+s[0])
Problem p02916 (python)

Fixed submission:
n = int(input())
d = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
ans = sum(b)
for i in range(n):
    if(i<(n-1) and d[i]==(d[i+1]-1)):
        ans+=c[d[i]-1]
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
d = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
ans = sum(b)
for i in range(n):
    if(i<(n-1) and d[i]==(d[i+1]-1)):
        ans+=c[i-2]
print(ans)
Problem p03075 (python)

Fixed submission:
def check(pos):
    for a in pos:
        for b in pos:
            if abs(a - b) > k:
                return False
    return True

pos = [None] * 5
for i in range(0, 5):
    pos[i] = int(input())
k = int(input())

print("Yay!" if check(pos) else ":(")

Buggy submission (verdict: Runtime Error):
x, y, z, k = map(int, input().split())
m = []
for _ in range(3):
    m.append(sorted(list(map(int, input().split())), reverse=True))
 
def sorted_sum(list_a, list_b):
    s = []
    for x in list_a:
        for y in list_b:
            s.append(x + y)
    return sorted(s, reverse=True)
 
ans = sorted_sum(sorted_sum(m[0], m[1])[0:k], m[2])
for i in range(0, k):
    print(ans[i])

Buggy submission (verdict: Runtime Error):
x, y, z, k = map(int, input().split())
m = []
for _ in range(3):
    m.append(sorted(list(map(int, input().split())), reverse=True))
 
def sorted_sum(list_a, list_b):
    s = []
    for x in list_a:
        for y in list_b:
            s.append(x + y)
    return sorted(s, reverse=True)
 
ans = sorted_sum(sorted_sum(m[0], m[1])[0:k], m[2])[0:k]
for i in range(0, k):
    print(ans[i])
Problem p02695 (python)

Fixed submission:
#! /usr/bin/env python3

from fractions import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations

from fractions import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations, combinations_with_replacement

N, M, Q = [int(_) for _ in input().split()]
abcd = [[int(_) for _ in input().split()] for i in range(Q)]

com = combinations_with_replacement(range(1, M+1), N)

ma = 0
scores = []
for i in com:
    score = 0
    for j in abcd:
        if i[j[1]-1] - i[j[0]-1] == j[2]:
            score += j[3]
    if score > ma:
        ma = score
print(ma)

Buggy submission (verdict: Runtime Error):
    #! /usr/bin/env python3
     
    from fractions import gcd
    from collections import Counter, deque, defaultdict
    from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
    from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
    from itertools import accumulate, product, permutations, combinations
     
    from fractions import gcd
    from collections import Counter, deque, defaultdict
    from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
    from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
    from itertools import accumulate, product, permutations, combinations, combinations_with_replacement
     
    N, M, Q = [int(_) for _ in input().split()]
    abcd = [[int(_) for _ in input().split()] for i in range(Q)]
     
    com = combinations_with_replacement(range(1, M+1), N)
     
    ma = 0
    scores = []
    for i in com:
        score = 0
        for j in abcd:
            if i[j[1]-1] - i[j[0]-1] == j[2]:
                score += j[3]
        if score > ma:
            ma = score
    print(ma)
Problem p02723 (python)

Fixed submission:
S = input()

def solve(S):
    if S[2] == S[3] and S[4] == S[5]:
        return "Yes"
    else:
        return "No"

print(solve(S))

Buggy submission (verdict: Runtime Error):
#! /usr/bin/env python3

from math import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations, combinations_with_replacement

S = input()

if S[2] == S[3] and S[4] == S[5]:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
#! /usr/bin/env python3

# from fractions import gcd
from math import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations, combinations_with_replacement

S = input()

if S[2] == S[3] and S[4] == S[5]:
    print("Yes")
else:
    print("No")

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

def solve(S):
    if S[4] == S[5] and S[6] == S[7]:
        return "Yes"
    else:
        return "No"

print(solve(S))
Problem p02753 (python)

Fixed submission:
#! /usr/bin/env python3

from fractions import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations, combinations_with_replacement

S = input()

if S[0] == S[1] == S[2]:
    print("No")
    exit()
print("Yes")

Buggy submission (verdict: Runtime Error):
#! /usr/bin/env python3

from fractions import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations, combinations_with_replacement

S = input()

if S[0] == S[1] == S[2]:
    print("No")
    exit()
print("Yes")
Problem p02754 (python)

Fixed submission:
#! /usr/bin/env python3

from fractions import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations, combinations_with_replacement

N, A, B = [int(_) for _ in input().split()]


a = N // (A+B)
b = N % (A+B)
if b > A:
    b = A

print(int(a * A + b))

Buggy submission (verdict: Runtime Error):
#! /usr/bin/env python3

from fractions import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations, combinations_with_replacement

N, A, B = [int(_) for _ in input().split()]


a = N // (A+B)
b = N % (A+B)
if b > A:
    b = A

print(int(a * A + b))

Buggy submission (verdict: Runtime Error):
#! /usr/bin/env python3

from fractions import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations, combinations_with_replacement

N, A, B = [int(_) for _ in input().split()]


a = N / (A+B)
b = N % (A+B)
if b > A:
    b = A

print(int(a * A + b))
Problem p02596 (python)

Fixed submission:

def submit():
    k = int(input())

    if k % 2 == 0:
        print(-1)
        return
    if k % 5 == 0:
        print(-1)
        return

    d = {}
    for t in [1, 3, 7, 9]:
        d[t] = {}
        for i in range(10):
            d[t][t * i % 10] = i
    
    td = k % 10
    curr = 0
    count = 0
    while count == 0 or curr != 0:
        diff = 7 - (curr % 10)
        if diff != 0:
            if diff < 0:
                diff += 10
            coef = d[td][diff]
            curr += coef * k
        curr //= 10
        count += 1

    print(count)
    
submit()

Buggy submission (verdict: Runtime Error):

def submit():
    k = int(input())

    if k % 2 == 0:
        print(-1)
        return
    if k == 5:
        print(-1)
        return

    d = {}
    for t in [1, 3, 7, 9]:
        d[t] = {}
        for i in range(10):
            d[t][t * i % 10] = i
    
    td = k % 10
    curr = 0
    count = 0
    while count == 0 or curr != 0:
        diff = 7 - (curr % 10)
        if diff != 0:
            if diff < 0:
                diff += 10
            coef = d[td][diff]
            curr += coef * k
        curr //= 10
        count += 1

    print(count)
    

submit()

Buggy submission (verdict: Runtime Error):

def next7(s):
    return s * 10 + 7


def submit():
    k = int(input())

    if k % 2 == 0:
        print(-1)
        return
    if k == 5:
        print(-1)
        return

    d = {}
    for t in [1, 3, 7, 9]:
        d[t] = {}
        for i in range(10):
            d[t][t * i % 10] = i
    
    td = k % 10
    curr = 0
    digit = 1
    count = 0
    while count == 0 or curr != 0:
        diff = 7 - (curr % 10)
        if diff != 0:
            if diff < 0:
                diff += 10
            coef = d[td][diff]
            curr += coef * k
        curr //= 10
        count += 1

    print(count)
        


submit()
Problem p02959 (python)

Fixed submission:


def submit():
    n = int(input())
    alist = list(map(int, input().split()))
    blist = list(map(int, input().split()))


    # 順番にグリーディ
    a = alist.copy()
    b = blist.copy()
    score_a = 0
    for i in range(0, n):
        if a[i] < b[i]:
            score_a += a[i]
            b[i] -= a[i]
            a[i] = 0
        else:
            score_a += b[i]
            a[i] -= b[i]
            b[i] = 0

        if a[i + 1] < b[i]:
            score_a += a[i + 1]
            b[i] -= a[i + 1]
            a[i + 1] = 0
        else:
            score_a += b[i]
            a[i + 1] -= b[i]
            b[i] = 0


    print(score_a)


if __name__ == '__main__':
    submit()

Buggy submission (verdict: Runtime Error):


def submit():
    n = int(input())
    alist = list(map(int, input().split()))
    blist = list(map(int, input().split()))


    # 順番にグリーディ
    a = alist.copy()
    b = blist.copy()
    score_a = 0
    for i in range(0, n):
        if a[i] < b[i]:
            score_a += a[i]
            b[i] -= a[i]
            a[i] = 0
        else:
            score_a += b[i]
            a[i] -= b[i]
            b[i] = 0

        if a[i + 1] < b[i]:
            score_a += a[i + 1]
            b[i] -= a[i + 1]
            a[i + 1] = 0
        else:
            score_a += b[i]
            a[i + 1] -= b[i]
            b[i] = 0

    # 逆順にグリーディ
    a = alist.copy()
    a.reverse()
    b = alist.copy()
    b.reverse()
    score_b = 0
    for i in range(0, n):
        if a[i] < b[i]:
            score_b += a[i]
            b[i] -= a[i]
            a[i] = 0
        else:
            score_b += b[i]
            a[i] -= b[i]
            b[i] = 0

        if a[i + 1] < b[i]:
            score_b += a[i + 1]
            b[i] -= a[i + 1]
            a[i + 1] = 0
        else:
            score_b += b[i]
            a[i + 1] -= b[i]
            b[i] = 0

    print(max(score_a, score_b))
    

if __name__ == '__main__':
    submit()
Problem p03072 (python)

Fixed submission:
n = int(input())
h = list(map(int, input().split()))
max_mount = h[0]
ans = 0 
for i in range(n):
    if max_mount<=h[i]:
    	ans +=1
    	max_mount = h[i]
print(ans)

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

Buggy submission (verdict: Runtime Error):
n = int(input())
h = list(map(int, input().split()))
cnt = n 
h.reverse()
for i in h:
    for j in h:
    	if h[j]>h[i]:
    		h.remove(h[i])
    		cnt = cnt-1
    	else:
    		h.remove(h[i])
else:
    print(cnt)
Problem p03073 (python)

Fixed submission:
S = input()
s = list(map(int, S))
t = s.copy()
n = len(s)
x = 0
y = 1

if t[0] == 0:
    t[0]=1
else:
    t[0]=0

for i in range(n-1):
    if s[i+1]==0 and s[i+1] == s[i]:
    	s[i+1]=1
    	x +=1
    elif s[i+1]==1 and s[i+1]==s[i]:
    	s[i+1]=0
    	x +=1
    
for i in range(n-1):
    if t[i+1]==0 and t[i+1] == t[i]:
    	t[i+1]=1
    	y +=1
    elif t[i+1]==1 and t[i+1]==t[i]:
    	t[i+1]=0
    	y +=1

print(min([x,y]))

Buggy submission (verdict: Runtime Error):
S = input()
s = list(map(int, S))
t = s.copy()
x = 0
y = 1

if t[0] == 0:
    t[0]=1
else:
    t[0]=0

for i in s:
    if s[i]==0 and s[i+1] == s[i]:
    	s[i+1]=1
    	x +=1
    elif s[i]==1 and s[i+1]==s[i]:
    	s[i+1]=0
    	x +=1

for i in t:
    if t[i]==0 and t[i+1] == t[i]:
    	t[i+1]=1
    	y +=1
    elif t[i]==1 and t[i+1]==t[i]:
    	t[i+1]=0
    	y +=1

print(min([x,y]))

Buggy submission (verdict: Runtime Error):
S = input()
s = list(map(int, S))
t = s.copy()
x = 0
y = 1

if t[0] == 0:
    t[0]=1
else:
    t[0]=0

for i in s:
    if s[i+1]==0 and s[i+1] == s[i]:
    	s[i+1]=1
    	x +=1
    elif s[i+1]==1 and s[i+1]==s[i]:
    	s[i+1]=0
    	x +=1

for i in t:
    if t[i+1]==0 and t[i+1] == t[i]:
    	t[i+1]=1
    	y +=1
    elif t[i+1]==1 and t[i+1]==t[i]:
    	t[i+1]=0
    	y +=1

print(min([x,y]))

Buggy submission (verdict: Runtime Error):
S = input()
s = list(map(int, S)
t = s.copy()
x = 0
y = 1

if t[0] == 0:
    t[0]=1
else:
    t[0]=0

for i in s:
    if s[i+1]==0 and s[i+1] == s[i]:
    	s[i+1]=1
    	x +=1
    elif s[i+1]==1 and s[i+1]==s[i]:
    	s[i+1]=0
    	x +=1

for i in t:
    if t[i+1]==0 and t[i+1] == t[i]:
    	t[i+1]=1
    	y +=1
    elif t[i+1]==1 and t[i+1]==t[i]:
    	t[i+1]=0
    	y +=1

print(min([x,y]))

Buggy submission (verdict: Runtime Error):
s = list(map(int, input().split()))
t = s.copy()
x = 0
y = 1

if t[0] == 0:
    t[0]=1
else:
    t[0]=0

for i in s:
    if s[i+1]==0 and s[i+1] == s[i]:
    	s[i+1]=1
    	x +=1
    elif s[i+1]==1 and s[i+1]==s[i]:
    	s[i+1]=0
    	x +=1

Buggy submission (verdict: Runtime Error):
s = list(map(int, input().split()))
t = s.copy()
x = 0
y = 1

if t[0] == 0:
    t[0]=1
else:
    t[0]=0

for i in s:
    if s[i+1]==0 and s[i+1] == s[i]:
    	s[i+1]=1
    	x +=1
    elif s[i+1]==1 and s[i+1]==s[i]:
    	s[i+1]=0
    	x +=1

for i in t:
    if t[i+1]==0 and t[i+1] == t[i]:
    	t[i+1]=1
    	y +=1
    elif t[i+1]==1 and t[i+1]==t[i]:
    	t[i+1]=0
    	y +=1

print(min([x,y]))

Buggy submission (verdict: Runtime Error):
s = list(map(int, input().split()))
t = s.copy()
cnta = 0
cntc = 0
ans = [cnta, cntc]
if t[0] == 0:
    t[0]=1
else:
    t[0]=0

for i in s:
    if s[i+1]==0 and s[i+1] == s[i]:
    	s[i+1]=1
    	cnta +=1
    elif s[i+1]==1 and s[i+1]==s[i]:
    	s[i+1]=0
    	cnta +=1

for i in t:
    if t[i+1]==0 and t[i+1] == t[i]:
    	t[i+1]=1
    	cntc +=1
    elif t[i+1]==1 and t[i+1]==t[i]:
    	t[i+1]=0
    	cntc +=1

print(min(ans))
Problem p03075 (python)

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
if e-a>k:
    print(":(")

elif d-a>k:
    print(":(")

elif e-a>k:
    print(":(")

elif c-a>k:
    print(":(")

elif b-a>k:
    print(":(")

else:
    print("Yay!")

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
if e-a>k or d=a>k or c-a>k or b-a>k:
    print(":(")
else:
    print("Yay!")
Problem p03077 (python)

Fixed submission:
import math
N = int(input())
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

P = [A, B, C, D, E]
p = min(P)
if p>=N:
    print(5)
else:
    ans = 4+math.ceil(N/p)
    print(ans)

Buggy submission (verdict: Runtime Error):
import math
N = int(input())
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

P = [A, B, C, D, E]
p = min(P)
if p>=N:
    print(5)
else:
    ans = 4+ceil(N/p)
    print(ans)
Problem p02689 (python)

Fixed submission:
N, M = [int(x) for x in input().split()]
H = [int(x) for x in input().split()]
nodes = [1 for i in range(N)]
for j in range(M):
    a, b = [int(x) for x in input().split()]
    if H[a - 1] <= H[b - 1]:
        nodes[a - 1] = 0
    if H[b - 1] <= H[a - 1]:
        nodes[b - 1] = 0
print(sum(nodes))

Buggy submission (verdict: Runtime Error):
import numpy as np 

N, M = [int(x) for x in input().split()]
H = [int(x) for x in input().split()]
mat = np.zeros((N, N), dtype="uint64")
for j in range(M):
    a, b = [int(x) for x in input().split()]
    if mat[a - 1, b - 1] == 0:
        mat[a - 1, b - 1] = H[b - 1]
        mat[b - 1, a - 1] = H[a - 1]

count = 0
for i in range(N):
    h = H[i]
    max_h = np.max(mat[i,:])
    if h > max_h:
        count += 1
print(count)

Buggy submission (verdict: Runtime Error):
import numpy as np

N, M = [int(x) for x in input().split()]
H = [int(x) for x in input().split()]
mat = np.zeros((N, N))
for j in range(M):
    a, b = [int(x) for x in input().split()]
    if mat[a - 1, b - 1] == 0:
        mat[a - 1, b - 1] = H[b - 1]
        mat[b - 1, a - 1] = H[a - 1]

count = 0
for i in range(N):
    h = H[i]
    max_h = np.max(mat[i,:])
    if h > max_h:
        count += 1
print(count)
Problem p02859 (python)

Fixed submission:
x = int(input())
print(x ** 2)

Buggy submission (verdict: Runtime Error):
x = int(input())
return x ** 2
Problem p03329 (python)

Fixed submission:
def main():
    N = int(input())

    #6**6=46656, 6**7=279936
    #9**5=59049, 9**6=531441
    list = [1]
    list.extend([6 ** i for i in range(1, 7)])
    list.extend([9 ** i for i in range(1, 6)])

    dp = [float("inf")] * 100001
    dp[0] = 0

    for i in range(N+1):
        for j in list:
            if i + j > 100000:
                continue
            else:
                dp[i+j] = min(dp[i+j], dp[i]+1)

    print(dp[N])

if __name__ == "__main__":
    main()

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

    #6**6=46656, 6**7=279936
    #9**5=59049, 9**6=531441
    list = [1]
    list.extend([6 ** i for i in range(1, 7)])
    list.extend([9 ** i for i in range(1, 6)])

    dp = [float("inf")] * 100000
    dp[0] = 0

    for i in range(N+1):
        for j in list:
            dp[i+j] = min(dp[i+j], dp[i]+1)

    print(dp[N])

if __name__ == "__main__":
    main()
Problem p03011 (python)

Fixed submission:
PQR = list(map(int, input().split()))
PQR.sort(reverse=False)
print(PQR[0]+PQR[1])

Buggy submission (verdict: Runtime Error):
PQR = list(map(int, input().split()))
PQR.sort
print(PQR[0]+PQR[1]
Problem p03107 (python)

Fixed submission:
a = input()
s = list(a)
s_int = [int(i) for i in s ]
t = len(s_int)
i = 0
c0 = s_int.count(0)
c1 = s_int.count(1)
if c0 > c1:
    print(2*c1)
else:
    print(2*c0)

Buggy submission (verdict: Runtime Error):
a = input()
s = list(a)
s_int = [int(i) for i in s ]
t = len(s_int)
i = 0
while 0 in s_int and 1 in s_int and i < len(s_int):
    if s_int[i] == 0 and s_int[i+1] == 1:
        s_int.pop(i)
        s_int.pop(i)
    elif s_int[i] == 1 and s_int[i+1] == 0:
        s_int.pop(i)
        s_int.pop(i)
    else:
        i += 1
print(t - len(s_int))
Problem p02729 (python)

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

# even + even
ans = x*(x-1) / 2

# odd + odd
ans += y*(y-1) / 2

print(int(ans))

Buggy submission (verdict: Runtime Error):
x,y = map(int,input().split())	

# even + even 
ans = x*(x – 1) / 2

# odd + odd
ans += y*(y-1) / 2

print(ans)
Problem p02785 (python)

Fixed submission:
n, k = map(int, input().split())
h = list(map(int, input().split()))

h = sorted(h)
sum_of_k = 0
if k >= n:
    print(0)
    exit()
for i in range(k):
    sum_of_k += h[len(h)-i-1]
ans = sum(h)-sum_of_k
print(ans if ans >=0 else 0)

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

h = sorted(h)
sum_of_k = 0
for i in range(k):
    sum_of_k += h[len(h)-i-1]
ans = sum(h)-sum_of_k
print(ans if ans >=0 else 0)
Problem p02831 (python)

Fixed submission:
def gcd(a,b):
    if b == 0:
        return a
    else:
        return gcd(b,a%b)

#a,bの最小公倍数
def lcm(a, b):
    return a * b // gcd (a, b)

a,b = map(int, input().split())

print(lcm(a,b))

Buggy submission (verdict: Runtime Error):
def gcd(a,b):
    a,b = max(a,b),min(a,b)
    if a % b == 0:
        return b
    else:
        gcd(b,a%b)

a,b = map(int, input().split())

print(int(a*b/math.gcd(a,b)))

Buggy submission (verdict: Runtime Error):
import math

a,b = map(int, input().split())

print(int(a*b/math.gcd(a,b)))