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

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

if A>=K:
    A=A-K
    B=B
    print(A,B)
elif A<K and K-A<B:
    print(0,B-(K-A))

elif A<K and K-A>B:
    print(0,0)
else:
    print(0,0)

Buggy submission (verdict: Runtime Error):
A=int(input())
B=int(input())
K=int(input())

if A>K:
    A=A-K
    B=B
    print(A,B)
elif A<K:
    print(0,B-(K-A))

elif A<K and K-A>B:
    print(0,0)

Buggy submission (verdict: Runtime Error):
A=int(input())
B=int(input())
K=int(input())

if A>K:
    A=A-K
    B=B
    print(A,B)
elif A<K:
    print(0,B-(K-A))

elif A<K and K-A>B:
    print(0,0)
Problem p02830 (python)

Fixed submission:
n= int(input())
s, t = input().split()

ans=""
for i in range(n):
    ans=ans+s[i]+t[i]

print(ans)

Buggy submission (verdict: Runtime Error):
n= int(input())
s= list(input())
t= list(input())

ans=""
for i in range(n):
    ans=ans+s[i]+t[i]

print(ans)

Buggy submission (verdict: Runtime Error):
n= int(input())
s= list(input())
t= list(input())

ans=""
for i in range(n):
    ans=ans+s[i]+t[i]

print(ans)
Problem p02993 (python)

Fixed submission:
S = input()
A = S[0]
B = S[1]
C = S[2]
D = S[3]

if A == B or B ==C or C ==D:
  print("Bad")
else:
  print("Good")

Buggy submission (verdict: Runtime Error):
S = input()
for i in range(len(S)):
  if S[i] == S[i+1]:
    print("Bad")
    exit()
  else:
    print("Good")
Problem p03076 (python)

Fixed submission:
#nyuuryoku
food=[]
for i in range (5):
  food.append(int(input()))
time = 0

#1keta toru 10 watte amari dasu
#amari wo dasu
machi = []
for i in range (5):
  if food[i]%10 == 0:
    time += food[i]
  else:
    time += food[i]+(10-(food[i]%10))
    machi.append(10-(food[i]%10)) 

if len(machi) == 0:
  print(time)
else:
  print(time-max(machi))

Buggy submission (verdict: Runtime Error):
#nyuuryoku
food=[]
for i in range (5):
  food.append(int(input()))
time = 0

#1keta toru 10 watte amari dasu
#amari wo dasu
machi = []
for i in range (5):
  if food[i]%10 == 0:
    time += food[i]
  else:
    time += food[i]+(10-(food[i]%10))
    machi.append(10-(food[i]%10)) 
    
print(time-max(machi))
Problem p03109 (python)

Fixed submission:
y, m, d = map(int, input().split("/"))
              
if m <= 4:
    print("Heisei")
else:
    print("TBD")

Buggy submission (verdict: Runtime Error):
y, m, d = map(int, input().split("/")

if m <= 4:
    print("Heisei")
else:
    print("TBD")
Problem p03643 (python)

Fixed submission:
N = input()
print("ABC" + N )

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
print((n-1)*(m-1))
Problem p02817 (python)

Fixed submission:
s = input().split()
print(s[1]+s[0])

Buggy submission (verdict: Runtime Error):
s,t = input()
print(t+s)

Buggy submission (verdict: Runtime Error):
s,t = input()
print(s+t)
Problem p02945 (python)

Fixed submission:
i = list(map(int, input().split()))
l = [i[0] + i[1], i[0] - i[1], i[0]*i[1]]
print(max(l, key=int))

Buggy submission (verdict: Runtime Error):
l = [A+B, A-B, A*B]
print(max(l, key=int))
Problem p02612 (python)

Fixed submission:
n = int(input())

ans = 0

if n == 10000:
	ans = 0
else:
	for i in range(1000,11000,1000):
		if 0 < (i - n) < 1000:
			ans = (i - n)
			break
		elif i == n:
			ans == 0

print(ans)

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

ans = 0

if len(n) == 5:
	print(ans)
else:
	for i in range(1000,10000,1000):
		if i - n == 1000:
			break
		elif i - n < 1000:
			ans = i
			break

print(ans)
Problem p02628 (python)

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

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

p.sort()
ans = sum(p[0:k])

print(ans)

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

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

ps = p.sort()
ans = 0

for i in range(k):
	ans += ps[i]

print(ans)
Problem p02658 (python)

Fixed submission:
n = int(input())
s = list(map(int,input().split()))
ans = 1

if 0 in s:
    print(0)
else:    
    for i in range(n):
        ans *= s[i]
        if ans > 10 ** 18:
            ans = -1
            break
    print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = list(map(int,input().split()))
ans = 1

if 0 in s:
    print(0)
else:    
    for i in range(n+1):
        ans *= s[i]
        if ans > 10 ** 18:
            ans = -1
            break
    print(ans)

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

if 0 in s:
    print(0)
else:    
    for i in range(n):
        ans *= s[i]
        if ans > 10 ** 18:
            ans = -1
            break
    print(ans)

Buggy submission (verdict: Runtime Error):
n = input()
s = []
ans = 1

for _ in range(n):
    s.append(map(int,input()))

if 0 in s:
    print(0)
else:    
    for i in range(n):
        ans *= s[i]
        if ans > 10 ** 18:
            ans = -1
            break
    print(ans)

Buggy submission (verdict: Runtime Error):
n = input()
s = []
ans = 1

for _ in range(n):
    s.append(map(int,input()))

if 0 in s:
    print(0)
else:    
    for i in range(n+1):
        ans *= s[i]

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

Buggy submission (verdict: Runtime Error):
n = input()
s = []
ans = 1

for _ in range(n):
    s.append(map(int,input()))

if "o" in s:
    print(0)
else:
    for i in range(n+1):
       ans *= s[i]
       if ans > 10**18:
           ans = -1
           break
    print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [int(n) for n in input().split()]
ans = 1

for i in range(n):
    ans *= a[i]
        if ans => 10**18:
            exit:
                
if ans ** 10**18:
    print(-1)
else:
    print(ans)

Buggy submission (verdict: Runtime Error):
for i in range(n):
    ans *= a[i]
        if ans > 10**18:
            print(-1)
            exit:
        
    exit:
print(ans)
Problem p03059 (python)

Fixed submission:
a,b,t = map(int,input().split())

print(b*(t//a))

Buggy submission (verdict: Runtime Error):
a,b,t = map(int,input().split())

for i in range(20):
    if i * a > t:
        ans = (a-1) * b
        break

print(ans)
Problem p03106 (python)

Fixed submission:
a,b,k = map(int,input().split())
#最大公約数を調べるためa,bのうつ値が最小値のものをsaiに代入
shou = min(a,b)
dai  = max(a,b)
min_list = []

for i in range(1,shou+1):
    if shou % i == 0:
        if dai % i == 0:
            min_list.append(i)

print(min_list[-k])

Buggy submission (verdict: Runtime Error):
a,b,k = map(int,input().split())
#最大公約数を調べるためa,bのうつ値が最小値のものをsaiに代入
shou = min(a,b)
dai  = max(a,b)
min_list = []

for i in range(1,shou):
    if shou % i == 0:
        if dai % i == 0:
            min_list.append(i)

print(min_list[k-1])
Problem p02612 (python)

Fixed submission:
N = int(input())
if N % 1000 > 0:
    print(1000 - (N % 1000))
elif N % 1000 == 0:
    print(0)

Buggy submission (verdict: Runtime Error):
N = int(input())
AC = 0
WA = 0
TLE = 0
RE = 0
for i in range(N):
    s = input()
    if s == 'AC':
        AC += 1
    elif s == 'WA':
        WA += 1
    elif s == 'TLE':
        TLE += 1
    else:
        RE += 1
print('AC', 'x', AC)
print('WA', 'x', WA)
print('TLE', 'x', TLE)
print('RE', 'x', RE)

Buggy submission (verdict: Runtime Error):
N = int(input())
AC = 0
WA = 0
TLE = 0
RE = 0
for i in range(N):
    s = input()
    if s == 'AC':
        AC += 1
    elif s == 'WA':
        WA += 1
    elif s == 'TLE':
        TLE += 1
    else:
        RE += 1
print('AC x', AC)
print('WA x', WA)
print('TLE x', TLE)
print('RE x', RE)

Buggy submission (verdict: Runtime Error):
N = int(input())
AC = 0
WA = 0
TLE = 0
RE = 0
for i in range(N):
    s = input()
    if s == 'AC':
        AC += 1
    elif s == 'WA':
        WA += 1
    elif s == 'TLE':
        TLE += 1
    else:
        RE += 1
print('AC','×',AC)
print('WA','×',WA)
print('TLE','×',TLE)
print('RE','×',RE)
Problem p02639 (python)

Fixed submission:
x = list(map(int, input().split()))
for i in range(len(x)):
    if x[i] == 0:
        print(i + 1)

Buggy submission (verdict: Runtime Error):
X, Y = map(int, input().split())
if Y % 2 == 0 and Y <= 4*X and Y >= 2*X:
    print('Yes')
else:
    print('No')
Problem p02657 (python)

Fixed submission:
A, B = map(int, input().split())
print(A * B)

Buggy submission (verdict: Runtime Error):
N = int(input())
arr = list(map(int, input().split()))
result = 0
for i in range(N):
    if result == 0:
        result += arr[i]
    else:
        result *= arr[i]
if result > 10**18:
    print(-1)
else:
    print(result)
Problem p02658 (python)

Fixed submission:
N = int(input())
arr = list(map(int, input().split()))
result = 1
if 0 in arr:
    result = 0
else:
    for i in arr:
        result *= i
        if result > 10**18:
            result = -1
            break
print(result)

Buggy submission (verdict: Runtime Error):
N = int(input())
arr = list(map(int, input().split()))
result = 1
if 0 in arr:
    result = 0
else:
    for i in a:
        result *= i
        if result > 10**18:
            result = -1
            break
print(result)
Problem p02658 (python)

Fixed submission:
import sys

input = sys.stdin.readline

N = int(input())
x = sorted(list(map(int, input().split())))
t = 1

for num in x:
    t = t * num
    if t > 10 ** 18:
        print(-1)
        sys.exit()

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

Buggy submission (verdict: Runtime Error):

N=int(input())

data=[int(e) for e in input().split()]

data=data.sort(reverse=False)

judge=True

for i in data:
    sum_1=sum_1*i

    if sum_1>1000000000000000000:
        print("-1")
        judge=False
        break

if judge==True:
    print(sum_1)
Problem p02554 (python)

Fixed submission:
N = int(input())
print((10**N - 9**N - 9**N + 8**N) % (10**9+7))

Buggy submission (verdict: Runtime Error):
  N = int(input())
  print((10**N -9**N -9**N +8**N)% (10**9+7))

Buggy submission (verdict: Runtime Error):
import math
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
N = int(input())

all = 0
for i in range(2, N//2+1):
    basyo = combinations_count(N, i)  # iとN-iの時、値が同じ

    zero_iti  = 2 ** (3 * N - 2 * i - 1)  # i=iの時
    zero_iti2 = 2 ** (N + 2 * i - 1)      # i=N-iの時

    all += basyo * (zero_iti + zero_iti2)

if S % 2 == 0:  # i = Nが無いので足す
    basyo = combinations_count(N, N)
    zero_iti = 2 ** (N - 1)
    all += basyo * zero_iti

if S % 2 == 1:  # i = N-1も無いので足す
    basyo = combinations_count(N, N)
    zero_iti = 2 ** (N - 1)
    all += basyo * zero_iti

    basyo = combinations_count(N, N - 1)
    zero_iti = 2 ** (N - 2)
    all += basyo * zero_iti

print(int(all % (10**9+7)))

Buggy submission (verdict: Runtime Error):
import math
def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

N = int(input())

sum = 0
for i in range(2, N+1):
    basyo = permutations_count(N, i)/2  # 9と0が入る場所。i箇所。
    # zerokyuu = i*(i-1)*2(i-2)  # 入る場所に0と9を入れる。
    zerokyuu = 2**i - 2  # 全部0と全部9を抜く。
    iti_hachi = 8**(N-i)  # 残った部分に1-8が入る全通り
    sum += basyo * zerokyuu * iti_hachi

print(int(sum%(10**9+7)))

Buggy submission (verdict: Runtime Error):
import math
def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

N = int(input())

sum = 0
for i in range(2, N+1):
    basyo = permutations_count(N, i)/2  # 9と0が入る場所。i箇所。
    # zerokyuu = i*(i-1)*2(i-2)  # 入れる場所に0と9を入れる。
    zerokyuu = 2**i - 2  # 全部0と全部9を抜く。
    iti_hachi = 8**(N-2)  # 残った部分に1-8が入る全通り
    sum += basyo * zerokyuu * iti_hachi

print(int(sum%(10**9+7)))
Problem p02645 (python)

Fixed submission:
S = str(input())

print(S[0]+S[1]+S[2])

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

print(S[1]+S[2]+S[3])
Problem p02713 (python)

Fixed submission:
import math

K = int(input())

Sum = []
for a in range(1, K+1):
    for b in range(1, K + 1):
        gcd2 = math.gcd(a, b)
        for c in range(1, K + 1):
            gcd = math.gcd(gcd2, c)
            Sum.append(gcd)

print(sum(Sum))

Buggy submission (verdict: Runtime Error):
import math

K = int(input())

Sum = []
for a in range(1, K+1):
    for b in range(1, K + 1):
        gcd2 = math.gcd(i.j)
        for c in range(1, K + 1):
            gcd = math.gcd(gcd2, c)
            Sum.append(gcd)

print(sum(Sum))

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

Sum = []
for a in range(1, K+1):
    for b in range(1, K + 1):
        for c in range(1, K + 1):
            gcd = gcd_list([a, b, c])
            Sum.append(gcd)

print(sum(Sum))
Problem p03545 (python)

Fixed submission:

ABCD = str(input())
A = ABCD[0]
B = ABCD[1]
C = ABCD[2]
D = ABCD[3]

for i in range(1):
    if int(A) + int(B) + int(C) + int(D) == 7:
        print(A + "+" + B + "+" + C + "+" + D +"=7")
        break
    if int(A) - int(B) + int(C) + int(D) == 7:
        print(A + "-" + B + "+" + C + "+" + D +"=7")
        break
    if int(A) + int(B) - int(C) + int(D) == 7:
        print(A + "+" + B + "-" + C + "+" + D +"=7")
        break
    if int(A) - int(B) - int(C) + int(D) == 7:
        print(A + "-" + B + "-" + C + "+" + D +"=7")
        break
    if int(A) + int(B) + int(C) - int(D) == 7:
        print(A + "+" + B + "+" + C + "-" + D +"=7")
        break
    if int(A) - int(B) + int(C) - int(D) == 7:
        print(A + "-" + B + "+" + C + "-" + D +"=7")
        break
    if int(A) + int(B) - int(C) - int(D) == 7:
        print(A + "+" + B + "-" + C + "-" + D +"=7")
        break
    if int(A) - int(B) - int(C) - int(D) == 7:
        print(A + "-" + B + "-" + C + "-" + D +"=7")
        break

Buggy submission (verdict: Runtime Error):

ABCD = str(input())
A = ABCD[0]
B = ABCD[1]
C = ABCD[2]
D = ABCD[3]

if int(A) + int(B) + int(C) + int(D) == 7:
    print(A + "+" + B + "+" + C + "+" + D +"=7")
    break
if int(A) - int(B) + int(C) + int(D) == 7:
    print(A + "-" + B + "+" + C + "+" + D +"=7")
    break
if int(A) + int(B) - int(C) + int(D) == 7:
    print(A + "+" + B + "-" + C + "+" + D +"=7")
    break
if int(A) - int(B) - int(C) + int(D) == 7:
    print(A + "-" + B + "-" + C + "+" + D +"=7")
    break
if int(A) + int(B) + int(C) - int(D) == 7:
    print(A + "+" + B + "+" + C + "-" + D +"=7")
    break
if int(A) - int(B) + int(C) - int(D) == 7:
    print(A + "-" + B + "+" + C + "-" + D +"=7")
    break
if int(A) + int(B) - int(C) - int(D) == 7:
    print(A + "+" + B + "-" + C + "-" + D +"=7")
    break
if int(A) - int(B) - int(C) - int(D) == 7:
    print(A + "-" + B + "-" + C + "-" + D +"=7")
    break
Problem p02783 (python)

Fixed submission:
a,b = map(int,input().split())
print(a//b if a%b ==0 else a//b+1)

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
N = list(map(int,input().split()))
print("Yes" if sum(N) >= a else "No")
Problem p02582 (python)

Fixed submission:
s=input()

list = list(s)
cnt=0
if list[0] == 'R' and list[1] == 'R' and list[2]=='R':
    print(3)
elif list[0]=='R' and list[1] == 'R'and list[2]!='R':
    print(2)
elif list[0]=='R' and list[1] != 'R'and list[2]!='R':
    print(1)
elif list[0]=='R' and list[1] != 'R'and list[2]=='R':
    print(1)
elif list[0]!='R' and list[1] == 'R' and list[2]=='R':
    print(2)
elif list[0]!='R' and list[1] != 'R' and list[2]=='R':
    print(1)
elif list[0]!='R' and list[1] == 'R' and list[2]!='R':
    print(1)
else:
    print(0)

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

list = list(s)
cnt=0
if list(0) == 'R' and list(1) == 'R' and list(2)=='R':
    print(3)
elif list(0)=='R' and list(1) == 'R'and list(2)!='R':
    print(2)
elif list(0)=='R' and list(1) != 'R'and list(2)!='R':
    print(1)
elif list(0)=='R' and list(1) != 'R'and list(2)=='R':
    print(1)
elif list(0)!='R' and list(1) == 'R' and list(2)=='R':
    print(2)
elif list(0)!='R' and list(1) != 'R' and list(2)=='R':
    print(1)
elif list(0)!='R' and list(1) == 'R' and list(2)!='R':
    print(1)
else:
    print(0)
Problem p02601 (python)

Fixed submission:
import sys
a, b, c = map(int, input().split())
k = int(input())
while True:
    if b <= a:
        b = b*2
        k += -1
        if k < 0:
            print('No')
            sys.exit()
    else:
        break
while True:
    if c <= b:
        c = c*2
        k += -1
        if k < 0:
            print('No')
            sys.exit()
    else:
        break
print('Yes')

Buggy submission (verdict: Runtime Error):
import sys
a, b, c = map(int, input().split())
k = int(input())
while True:
    if b <= a:
        b = b*2
        k += -1
        if k == 0:
            print('No')
            sys.exit(1)
    else:
        break
while True:
    if c <= b:
        c = c*2
        k += -1
        if k == 0:
            print('No')
            sys.exit(1)
    else:
        break
print('Yes')

Buggy submission (verdict: Runtime Error):
import sys
a, b, c = map(int, input().split())
k = int(input())
while True:
    if b <= a:
        b = b*2
        k += -1
        if k == 0:
            print('No')
            sys.exit(1)
    else:
        break
while True:
    if c <= b:
        c = c*2
        k += -1
        if k < 0:
            print('No')
            sys.exit(1)
    else:
        break
print('Yes')

Buggy submission (verdict: Runtime Error):
import sys
a, b, c = map(int, input().split())
k = int(input())
while True:
    if b <= a:
        b = b*2
        k += -1
        if k == 0:
            print('No')
            sys.exit(1)
    else:
        break
while True:
    if c <= b:
        c = c*2
        k += -1
        if k < 0:
            print('No')
            sys.exit(1)
    else:
        break
print('Yes')
Problem p03328 (python)

Fixed submission:
a, b = map(int, input().split())
n = b - a
print(int(n*(n+1)/2-b))

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
print(()(b-a)*(b-a+1)/2)-b)
Problem p03455 (python)

Fixed submission:
#coding: utf-8

a, b = map(int, input().split())
if (a*b)%2 == 0:
    print("Even")
else:
    print("Odd")

Buggy submission (verdict: Runtime Error):
#coding: utf-8

a, b = int(input())
c = a * b
if c % 2 = 0:
    print("Even")
else:
    print("odd")
Problem p02618 (python)

Fixed submission:
import sys
input=sys.stdin.readline

D=int(input().rstrip('\n'))
cs=[int(x) for x in input().rstrip('\n').split()]
for i in range(D):
  Ss = [int(x) for x in input().rstrip('\n').split()]
  print(Ss.index(max(Ss))+1)

Buggy submission (verdict: Runtime Error):
import sys
input=sys.stdin.readline

D=int(input().rstrip('\n'))
cs=[int(x) for x in input().rstrip('\n').split()]
S={}
cd=[0]*26
for i in range(D):
  S[i] = [int(x) for x in input().rstrip('\n').split()]
for i in range(D):
  s1 = S[i]
  s1_s=sorted(s1,reverse=True)
  if i!=D-1:
    s2=S[i+1]
    s1_a=[x-y for x,y in zip(s1,cd)]
    s2_i=[x-y for x,y in zip(s2,cd)]
    s1_b=sorted(s1_a,reverse=True)
    if s2_i.index(max(s2_i))==s1_a.index(s1_b[0]):
      x = s1.index(s1_b[1])+1
      cd = [y+z for y,z in zip(cd,cs)]
      cd[x-1]=0
      print(x)
    else:
      print(s1.index(s1_b[0])+1)
print(S[D-1].index(max(S[D-1]))+1)

Buggy submission (verdict: Runtime Error):
import sys
input=sys.stdin.readline

D=int(input().rstrip('\n'))
cs=[int(x) for x in input().rstrip('\n').split()]
S={}
cd=[0]*26
for i in range(D):
  S[i] = [int(x) for x in input().rstrip('\n').split()]
for i in range(D):
  s1 = S[i]
  s1_s=sorted(s1,reverse=True)
  if i!=D-1:
    s2=S[i+1]
    s1_a=[x-y for x,y in zip(s1,cd)]
    s2_i=[x-y for x,y in zip(s2,cd)]
    if s2.index(max(s2_i))==s1.index(max(s1_a)):
      x = s1.index(sorted(s1_a,reverse=True)[1])+1
      cd = [y+z for y,z in zip(cd,cs)]
      cd[x-1]=0
      print(x)
    else:
      print(s1.index(sorted(s1_a,reverse=True)[0])+1)
print(S[D-1].index(max(S[D-1]))+1)
Problem p02718 (python)

Fixed submission:
N,M=(int(x) for x in input().split())
As=[int(x) for x in input().split()]
p = sum(As)/(4*M)
ov = [1 if x>=p else 0 for x in As]
if sum(ov)>=M:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
N,M=(int(x) for x in input().split())
As=[int(x) for x in input().split()]
p = sum(As)/4M
ov = [1 if x>=p else 0 for x in As]
if sum(ov)>=M:
  print('Yes')
else:
  print('No')
Problem p02742 (python)

Fixed submission:
HK=input().split(' ')
H=int(HK[0])
K=int(HK[1])
if H==1 or K ==1:
    print(1)
else:
    if K % 2==1 and H%2==1:
        print(round(H*K/2)+1)
    else:
        print(int(H*K/2))

Buggy submission (verdict: Runtime Error):
HK=input().split(' ')
H=int(HK[0])
K=int(HK[1])
if K % 2==1 and H%2==1:
    print(round(HK/2)+1)
else:
    print(HK/2)
Problem p02900 (python)

Fixed submission:
import sys
input=sys.stdin.readline
import math

A,B = (int(x) for x in input().rstrip('\n').split())
c = math.gcd(A,B)
if c==1:
  print(1)
else:
  ps=[]
  d = math.floor(math.sqrt(c))
  for i in range(2,d+2):
    if c%i==0:
      if all(i%x!=0 for x in ps):
        ps.append(i)
        while c % i ==0:
          c = c//i
  if c > 1:
    ps.append(0)
  print(len(ps)+1)

Buggy submission (verdict: Runtime Error):
import sys
input=sys.stdin.readline
import math

A,B = (int(x) for x in input().rstrip('\n').split())
c = math.gcd(A,B)
if c==1:
  print(1)
else:
  res = 1
  d = math.floor(math.sqrt(c))
  for i in range(2,d+2):
    if c%i==0:
      res += 1
      while c%i==0:
        c = c//i
  if res == 1:
    res += 1
print(res)
Problem p03032 (python)

Fixed submission:
import sys
input = sys.stdin.readline

N,K = (int(x) for x in input().rstrip('\n').split())
vs = [int(x) for x in input().rstrip('\n').split()]
g = [vs[0],vs[-1]]
rest = K
for k in [K-1,K]:
  for b in range(K//2):
    t = k-b
    if t>N:
      t=N
    for i in range(t+1):
      v = []
      if i <t:
        v.extend(vs[:i])
        v.extend(vs[-(t-i):])
        for _ in range(b):
          if min(v)<0:
            v.remove(min(v))
          else:
            break
      else:
        v.extend(vs[:t])
        for _ in range(b):
          if min(v)<0:
          	v.remove(min(v))
      g.append(sum(v))
if max(g)<0:
  print(0)
else:
  print(max(g))

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

N,K = (int(x) for x in input().rstrip('\n').split())
vs = [int(x) for x in input().rstrip('\n').split()]
g = []
rest = K
for k in [K-1,K]:
  for b in range(K//2):
    t = k-b
    if t>N:
      t=N
    for i in range(t+1):
      v = []
      if i <t:
        v.extend(vs[:i])
        v.extend(vs[-(t-i):])
        for _ in range(b):
          if min(v)<0:
            v.remove(min(v))
          else:
            break
      else:
        v.extend(vs[:t])
        for _ in range(b):
          if min(v)<0:
          	v.remove(min(v))
      g.append(sum(v))
if max(g)<0:
  print(0)
else:
  print(max(g))

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

N,K = (int(x) for x in input().rstrip('\n').split())
vs = [int(x) for x in input().rstrip('\n').split()]
g = []
rest = K
for k in [K-1,K]:
  for b in range(K//2):
    t = k-b
    if t>N:
      t=N
    for i in range(t+1):
      v = []
      if i <t:
        v.extend(vs[:i])
        v.extend(vs[-(t-i):])
        for _ in range(b):
          if min(v)<0:
            v.remove(min(v))
          else:
            break
      else:
        v.extend(vs[:t])
        for _ in range(b):
          if min(v)<0:
          	v.remove(min(v))
      g.append(sum(v))
print(max(g))
Problem p03962 (python)

Fixed submission:
a=input().split()
a.sort()
cnt=0
while len(a)>0:
    i=a.count(a.pop(0))
    for j in range(i):
        a.pop(0)
    cnt+=1
print(cnt)

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
if a=b and b=c:
    print(1)
elif a=b and a!=c:
    print(2)
elif a!=b and b=c:
    print(2)
elif a=c and a!=b:
    print(2)
else:
    print(3)

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
if a=b=c:
    print(1)
elif a=b!=c:
    print(2)
elif a!=b=c:
    print(2)
elif a=c!=b:
    print(2)
else:
    print(3)

Buggy submission (verdict: Runtime Error):
a=input().split()
a.sort()
cnt=0
while len(s)>0:
    i=a.count(a.pop(0))
    for j in range(i):
        a.pop(0)
    cnt+=1
print(cnt)