Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n=int(input())
w=list(map(int,input().split()))
ans=100000000;
s1=0
s2=0
 
for i in range(n):
    s1 += sum(w[:i+1])
    s2 += sum(w[i+1:])
            
    if abs(s1-s2) < ans:
        ans = abs(s1-s2)
    
print(ans)

Fixed submission:
p, q, r =(int(i) for i in input().split())
ans1=p+q
ans2=q+r
ans3=p+r

if ans1<=ans2 and ans1<=ans3:
    print(ans1)
elif ans2<= ans1 and ans2 <= ans3:
    print(ans2)
else:
    print(ans3)
Buggy python submission (verdict: Runtime Error):
n=int(input())
w=list(map(int,input().split()))
ans=10000;

 
for i in range(n):
    s1 += sum(w[:i+1])
    s2 += sum(w[i+1:])
            
    if abs(s1-s2) < ans:
        ans = abs(s1-s2)
    
print(ans)

Fixed submission:
n=int(input())
w=list(map(int,input().split()))
ans=[]
s1=0
s2=0
 
for i in range(n):
    for j in range(0,i):
        s1 += w[j]
    for k in range(i,n):
        s2 += w[k]
    ans.append(abs(s1 - s2))
    s1=0
    s2=0
    
print(min(ans))

Buggy python submission (verdict: Runtime Error):
n=int(input())
w=list(map(int,input().split()))
ans=100000000;

 
for i in range(n):
    s1 += sum(w[:i+1])
    s2 += sum(w[i+1:])
            
    if abs(s1-s2) < ans:
        ans = abs(s1-s2)
    
print(ans)

Fixed submission:
n=int(input())
w=list(map(int,input().split()))
ans=[]
s1=0
s2=0
 
for i in range(n):
    for j in range(0,i):
        s1 += w[j]
    for k in range(i,n):
        s2 += w[k]
    ans.append(abs(s1 - s2))
    s1=0
    s2=0
    
print(min(ans))
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))

ans = 1
 
for i in A:
    ans *= i
    if ans > 10**18:
        ans = -1
        break
print(ans)


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

print(int(A*B))
Buggy python submission (verdict: Runtime Error):
N = int(input())

if N[-1] == 3:
    print('bon')
elif N[-1] == 2 or 4 or 5 or 7 or 9:
    print('hon')
else:
    print('pon')

Fixed submission:
N = input()

a = int(N[-1])

if a == 3:
    print('bon')
elif a == 2 or a==4 or a==5 or a==7 or a==9:
    print('hon')
else:
    print('pon')
Buggy python submission (verdict: Runtime Error):
A,B,H,M = map(int,input().split())
C2 = A**2+B**2-2*A*B*math.cos(math.radians(360-(30*H+M*0.5)-6*M))
print(C2**0.5)

Fixed submission:
import math

A,B,H,M = map(int,input().split())
C2 = A**2+B**2-2*A*B*math.cos(math.radians(abs((30*H+M*0.5)-6*M)))
print(C2**0.5)

Buggy python submission (verdict: Runtime Error):
A,B,H,M = map(int,input().split())
C2 = A**2+B**2-2*A*B*math.cos(math.radians((30*H+M*0.5)-6*M))
print(C2**0.5)

Fixed submission:
import math

A,B,H,M = map(int,input().split())
C2 = A**2+B**2-2*A*B*math.cos(math.radians(abs((30*H+M*0.5)-6*M)))
print(C2**0.5)
Buggy python submission (verdict: Runtime Error):
contest=input()
if contest == 'ABC':
    print('ARC')
elif contest == 'ARC':
    print('ABC)
    

Fixed submission:
contest=input()
if contest == 'ABC':
    print('ARC')
elif contest == 'ARC':
    print('ABC')
Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())

print(N(N-1)//2+M(M-1)//2)


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

print(N*(N-1)//2+M*(M-1)//2)
Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
sc = list([list(map(int,input().split())) for _ in range(M)])


for i in range(10**(N-1)-1,10**N):
    count = 0
    str_i = str(i)
    for j in range(M):
        if str_i[sc[j][0]-1] == str(sc[j][1]):
            count += 1
    if count == M:
        print(i)
        exit()
print(-1)


Fixed submission:
N,M = map(int,input().split())
sc = list([list(map(int,input().split())) for _ in range(M)])

if N == 1:
    a = 0
elif N != 1:
    a = 10 **(N-1)

for i in range(a,10**N):
    count = 0
    str_i = str(i)
    for j in range(M):
        if str_i[sc[j][0]-1] == str(sc[j][1]):
            count += 1
    if count == M:
        print(i)
        exit()
print(-1)

Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
sc = list([list(map(int,input().split())) for _ in range(M)])


for i in range(10**(N-1)-1,10**N):
    count = 0
    str_i = str(i)
    for j in range(M):
        if str_i[sc[j][0]-1] == str(sc[j][1]):
            count += 1
    if count == M:
        print(i)
        exit()
print(-1)


Fixed submission:
N,M = map(int,input().split())
sc = list([list(map(int,input().split())) for _ in range(M)])

if N == 1:
    a = 0
elif N != 1:
    a = 10 **(N-1)

for i in range(a,10**N):
    count = 0
    str_i = str(i)
    for j in range(M):
        if str_i[sc[j][0]-1] == str(sc[j][1]):
            count += 1
    if count == M:
        print(i)
        exit()
print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
A,B,K = map(int,input().split())
for _ in range(K):
    if A > 0:
        A -= 1
    elif A == 0 and B > 0:
        B -= 1
print(A,B)


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

if A >= K :
    print(A-K,B)
elif A < K <= A + B:
    print(0,B-(K-A))
else:
    print(0,0)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()

ans_list = []

for i in range(0,N):
    for j in range(i+1,N):
        for k in range(j+1,N):
            S_ans = S[i] + S[j] +S[k]
            ans_list.append(S_ans)

set_ans = set(ans_list)
print(len(set_ans))


Fixed submission:
N = int(input())
S = input()

ans = 0

for i in range(10):
    a = S.find(str(i))
    if a == -1:
        continue
    for j in range(10):
        b = S.find(str(j),a+1)
        for k in range(10):
            if b == -1:
                continue
            c = S.find(str(k),b+1)
            if c > b :
                ans +=1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()

ans_list = []

for i in range(0,N):
    for j in range(i+1,N):
        for k in range(j+1,N):
            S_ans = S[i] + S[j] +S[k]
            ans_list.append(S_ans)

set_ans = set(ans_list)
print(len(set_ans))


Fixed submission:
N = int(input())
S = input()

ans = 0

for i in range(10):
    a = S.find(str(i))
    if a == -1:
        continue
    for j in range(10):
        b = S.find(str(j),a+1)
        for k in range(10):
            if b == -1:
                continue
            c = S.find(str(k),b+1)
            if c > b :
                ans +=1
print(ans)
Buggy python submission (verdict: Runtime Error):
arb='ABCDEFDHIJKLMNOPQRSTUVWXYZ'
N = int(input())
S = input()
ans =''
for i in range(len(S)):
    if arb.index(S[i]) + N +1 <= len(arb):
        ans += arb[arb.index(S[i])+N]
    else:
        ans += arb[-len(arb) + arb.index(S[i]) + N]
print(ans)


Fixed submission:
arb='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
N = int(input())
S = input()
ans =''
for i in range(len(S)):
    if arb.index(S[i]) + N +1 <= len(arb):
        ans += arb[arb.index(S[i])+N]
    else:
        ans += arb[-len(arb) + arb.index(S[i]) + N]
print(ans)
Buggy python submission (verdict: Runtime Error):
print((1+N)*(N/2))


Fixed submission:
N = int(input())

ans = ((N-1)*N//2)

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

ans = 0
for i in range(1,N):
    ans += i
print(ans)


Fixed submission:
N = int(input())

ans = ((N-1)*N//2)

print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
print(3*r**2)

Fixed submission:
r = int(input())
print(3*r**2)
Buggy python submission (verdict: Runtime Error):
L ,R = map(int,input().split())

ans =[]
    for i in range(L,R+1):
        for j in range(i+1,R+1):
            ans.append(i*j%2019)
            if i*j% 2019== 0 :
                exit()

print(min(ans))


Fixed submission:
L ,R = map(int,input().split())

ans =[]
if R - L <= 2019:
    for i in range(L,R+1):
        for j in range(i+1,R+1):
            ans.append(i*j%2019)

else:
    for i in range(R-L-1010,R-L+1010):
        for j in range(i,R-L+1010):
            ans.append(i*j%2019)

print(min(ans))

Buggy python submission (verdict: Runtime Error):
L ,R = map(int,input().split())

ans =[]
if R - L <= 2019:
    for i in range(L,R+1):
        for j in range(i+1,R+1):
            ans.append(i*j%2019)
            if i*j% 2019== 0 :
                exit()

print(min(ans))


Fixed submission:
L ,R = map(int,input().split())

ans =[]
if R - L <= 2019:
    for i in range(L,R+1):
        for j in range(i+1,R+1):
            ans.append(i*j%2019)

else:
    for i in range(R-L-1010,R-L+1010):
        for j in range(i,R-L+1010):
            ans.append(i*j%2019)

print(min(ans))

Buggy python submission (verdict: Runtime Error):
L ,R = map(int,input().split())

ans =[]
if R - L <= 2019:
    for i in range(L,R+1):
        for j in range(i+1,R+1):
            ans.append(i*j%2019)
            if i*j% == 0 :
                exit()

print(min(ans))


Fixed submission:
L ,R = map(int,input().split())

ans =[]
if R - L <= 2019:
    for i in range(L,R+1):
        for j in range(i+1,R+1):
            ans.append(i*j%2019)

else:
    for i in range(R-L-1010,R-L+1010):
        for j in range(i,R-L+1010):
            ans.append(i*j%2019)

print(min(ans))

Buggy python submission (verdict: Time Limit Exceeded):
L ,R = map(int,input().split())

ans =[]
for i in range(L,R+1):
    for j in range(i+1,R+1):
        ans.append(i*j%2019)
print(min(ans))




Fixed submission:
L ,R = map(int,input().split())

ans =[]
if R - L <= 2019:
    for i in range(L,R+1):
        for j in range(i+1,R+1):
            ans.append(i*j%2019)

else:
    for i in range(R-L-1010,R-L+1010):
        for j in range(i,R-L+1010):
            ans.append(i*j%2019)

print(min(ans))
Buggy python submission (verdict: Runtime Error):
W,H,x,y = map(int,input().split())

if W/x == 2 and H/y ==2:
    print(W*H/2,'1')
else:
    print(W*H/2,'0')

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


if x != 0 and y != 0:
    if W/x == 2 and H/y ==2:
        print(W*H/2,'1')
    else:
        print(W*H/2,'0')
else:
    print(W*H/2,'0')
Buggy python submission (verdict: Runtime Error):
ans = 0
for bit in range(1<<N):
    count = [0]*M
    for i in range(N):
        if (bit >> i) & 1:
            for a in range(M):
                if i in ks[a][1:]:
                    count[a] +=1
    a = 0
    for i in range(M):
        if count[i] % 2 == p[i]:
            a += 1
            if a == M:
                ans += 1

print(ans)


Fixed submission:
N,M = map(int,input().split())
ks = [list(map(int,input().split())) for _ in range(M)]
p = list(map(int,input().split()))

ans = 0
for bit in range(1<<N):
    count = [0]*M
    for i in range(N):
        if (bit >> i) & 1:
            for a in range(M):
                if i+1 in ks[a][1:]:
                    count[a] +=1
    a = 0
    for i in range(M):
        if count[i] % 2 == p[i]:
            a += 1
            if a == M:
                ans += 1

print(ans)
Buggy python submission (verdict: Runtime Error):
A, B = map(int,input().split())

print('Yay!' if A <= 8 and B <= 8 else':(')


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

print('Yes' if A<C<B or B<C<A else 'No')
Buggy python submission (verdict: Time Limit Exceeded):
S = list(input())

count = 0
i = 0
while i < len(S)-1:
    if S[i]=='B' and S[i+1]=='W':
        S[i]='W'
        S[i+1]='B'
        count += 1
        if i > 0:
            i -= 1
        else:
            i += 1
    else:
            i += 1
print(count)


Fixed submission:
S = input()

count = 0
black = 0
white = 0

for i in range(len(S)-1):
    if S[i] == 'B':
        black +=1
    else :
        white +=1
    if  S[i+1] == 'W':
        count += i+1 -white

print(count)
Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())

print(N(N-1)//2+M(M-1)//2)


Fixed submission:
X,Y = map(int,input().split())
print(int(X + Y/2))
Buggy python submission (verdict: Time Limit Exceeded):
A,B,C,X,Y = map(int,input().split())

price = X * A + Y * B
for a in range(X+1):
    for b in range(Y+1):
        c = max(X-a,Y-b)*2
        price = min(price,a*A + b*B + c*C)

print(price)

Fixed submission:
A,B,C,X,Y = map(int,input().split())

price = X * A + Y * B
for a in [0,abs(X-Y),X]:
    for b in [0,abs(X-Y),Y]:
        c = max(X-a,Y-b)*2
        price = min(price,a*A + b*B + c*C)

print(price)
Buggy python submission (verdict: Runtime Error):
N = int(input())
card = list(map(int,input().split()))
sorted_card = sorted(card)
Alice = 0
Bob = 0

for i in range(N):
    if i == 0 or i % 2 == 0:
        Alice += sorted_card[i]
    else:
        Bob += sorted_card[i]

print(Alice - Bob)

Fixed submission:
N = int(input())
A = int(input())

if N - (N//500)*500 <= A:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
N = int(input())
card = list(map(int,input().split()))
sorted_card = sorted(card)
Alice = 0
Bob = 0

for i in range(N):
    if i == 0 or i % 2 == 0:
        Alice += sorted_card[i]
    else:
        Bob += sorted_card[i]

print(Alice - Bob)

Fixed submission:
N = int(input())
A = int(input())

if N - (N//500)*500 <= A:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
N = int(input())
print(len(set(list(N))))

Fixed submission:
N = int(input())
S = [int(input()) for _ in range(N)]

set_S = set(S)

print(len(set_S))
Buggy python submission (verdict: Runtime Error):
for x in range(N+1):
    for y in range(N+1-x):
        z = N - x - y
        if 10000*x + 5000*y + 1000*z == Y:
            ans = x,y,z
            break
    break
print(*ans)

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

ans = -1,-1,-1
for x in range(N+1):
    for y in range(N+1-x):
        z = N - x - y
        if 10000*x + 5000*y + 1000*z == Y:
            ans = x,y,z
            break
    else:
        continue

print(*ans)
Buggy python submission (verdict: Runtime Error):
arb = 'abcdefghijklmnopqrstuvwxyz'
S = input()
s_S =sorted(set(arb)^set(S))
print(s_S[0])

Fixed submission:
arb = 'abcdefghijklmnopqrstuvwxyz'
S = input()

ans =''
for i in arb:
    if i not in S:
        ans += i

sort_ans = sorted(ans)
if len(ans)==0:
    print('None')
else:
    print(sort_ans[0])
Buggy python submission (verdict: Runtime Error):
a,b,c = int(input())
if b-c == c-a:
    print('Yes')
else:
    print('No')
    

Fixed submission:
a,b,c = map(int,input().split())
if b-a == c-b:
    print('YES')
else:
    print('NO')
Buggy python submission (verdict: Runtime Error):
N = int(input())
count = []

for a in range(1,N//2+1):
    if N % a == 0:
        b = N // a
        count.append(max(len(str(a)),len(str(b))))

print(min(count))

Fixed submission:
N = int(input())
count = []

for a in range(1,int(N**0.5+1)):
    if N % a == 0:
        b = N // a
        count.append(max(len(str(a)),len(str(b))))

print(min(count))
Buggy python submission (verdict: Runtime Error):
n = int(input())
ans = [0] * n
s = min(4, n - 2)
import math
t = math.sqrt(s)
t = math.floor(t)
for i in range(1, t + 1):
    for j in range(i, t + 2):
        for k in range(j, t + 3):
            x = i ** 2 + j ** 2 + k ** 2 + i * j + j * k + k * i
            if x <= n:
                if i == j == k:
                    ans[x - 1] += 1
                elif i == j != k or i != j == k or i == k != j:
                    ans[x - 1] += 3
                elif i != k != j:
                    ans[x - 1] += 6
        
for i in ans:
    print(i)

Fixed submission:
n = int(input())
ans = [0] * n
s = max(4, n - 2)
import math
t = math.sqrt(s)
t = math.floor(t)
for i in range(1, t + 1):
    for j in range(i, t + 2):
        for k in range(j, t + 3):
            x = i ** 2 + j ** 2 + k ** 2 + i * j + j * k + k * i
            if x <= n:
                if i == j == k:
                    ans[x - 1] += 1
                elif i == j != k or i != j == k or i == k != j:
                    ans[x - 1] += 3
                elif i != k != j:
                    ans[x - 1] += 6
        
for i in ans:
    print(i)
Buggy python submission (verdict: Runtime Error):
s = str(input())
n = [s[-3], s[-2], s[-1]]
n = ''.join(n)
n = int(n)
if n == 0:
    print(0)
else:
    print(1000 - n)

Fixed submission:
s = str(input())
if len(s) >= 3:
    n = [s[-3], s[-2], s[-1]]
if len(s) == 2:
    n = [s[-2], s[-1]]
if len(s) == 1:
    n = [s[0]]
n = ''.join(n)
n = int(n)
if n == 0:
    print(0)
else:
    print(1000 - n)
Buggy python submission (verdict: Runtime Error):
h, w, k = map(int, input().split())
p = [list(str(input())) for _ in range(h)]
bl = p.count('#')
bl = bl - k
ee = list(range(h))
q = list(range(w))
kotae = 0
pp = []
qq = []
for i in range(h + 1):
    pp += list(itertools.combinations(ee, i))
for i in range(w + 1):
    qq += list(itertools.combinations(q, i))
for i in pp:
    for j in qq:
        ans = 0
        for zz in range(h):
            for ww in range(w):
                if zz not in i:
                    if ww not in j:
                        if p[zz][ww] == '#':
                            ans += 1
        if ans == k:
            kotae += 1
print(kotae)

Fixed submission:
import itertools
h, w, k = map(int, input().split())
p = [list(str(input())) for _ in range(h)]
bl = p.count('#')
bl = bl - k
ee = list(range(h))
q = list(range(w))
kotae = 0
pp = []
qq = []
for i in range(h + 1):
    pp += list(itertools.combinations(ee, i))
for i in range(w + 1):
    qq += list(itertools.combinations(q, i))
for i in pp:
    for j in qq:
        ans = 0
        for zz in range(h):
            for ww in range(w):
                if zz not in i:
                    if ww not in j:
                        if p[zz][ww] == '#':
                            ans += 1
        if ans == k:
            kotae += 1
print(kotae)

Buggy python submission (verdict: Runtime Error):
h, w, k = map(int, input().split())
p = [list(str(input())) for _ in range(h)]
bl = p.count('#')
bl = bl - k
ee = list(range(h))
q = list(range(w))
kotae = 0
pp = []
qq = []
for i in range(h + 1):
    pp += list(itertools.combinations(ee, i))
for i in range(w + 1):
    qq += list(itertools.combinations(q, i))
for i in pp:
    for j in qq:
        ans = 0
        for zz in range(h):
            for ww in range(w):
                if zz not in i:
                    if ww not in j:
                        if p[zz][ww] == '#':
                            ans += 1
        if ans == k:
            kotae += 1
print(kotae)

Fixed submission:
import itertools
h, w, k = map(int, input().split())
p = [list(str(input())) for _ in range(h)]
bl = p.count('#')
bl = bl - k
ee = list(range(h))
q = list(range(w))
kotae = 0
pp = []
qq = []
for i in range(h + 1):
    pp += list(itertools.combinations(ee, i))
for i in range(w + 1):
    qq += list(itertools.combinations(q, i))
for i in pp:
    for j in qq:
        ans = 0
        for zz in range(h):
            for ww in range(w):
                if zz not in i:
                    if ww not in j:
                        if p[zz][ww] == '#':
                            ans += 1
        if ans == k:
            kotae += 1
print(kotae)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

def fac(n):
    arr = []
    temp = n
    a = 1
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])
    
    for i in arr:
        a = a * (i[1] + 1)
    return a * n


ans = 0
for i in range(1, n+1):
    ans += fac(i)
print(ans - 1)

Fixed submission:
n = int(input())
ans = 0
for i in range(1, n + 1):
    y = n // i
    ans += y * (y + 1) * i // 2
print(ans)

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

import sympy
sympy.divisors(10**9)

def m(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return len(lower_divisors) + len(upper_divisors[::-1])

ans = 0
for i in range(1, n+1):
    ans += i * m(i)
print(ans)

Fixed submission:
n = int(input())
ans = 0
for i in range(1, n + 1):
    y = n // i
    ans += y * (y + 1) * i // 2
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
def B(X, n):
    X_dumy = X
    ln = []
    while X_dumy>0:
        ln.append(int(X_dumy%n))
        X_dumy = int(X_dumy/n)
    ln.reverse()
    return ln
ln = B(n, 26)
a = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
q = []
print(ln)
for i in range(len(ln)):
    if ln[i] == 1 and ln[i] < ln.index(0):
        q.append('z')
    elif ln[i] != 0:
        q.append(a[ln[i] - 1])
print(''.join(q))

Fixed submission:
N = int(input()) 
ans = '' 
while N > 0:
  N -= 1 
  ans += chr(ord('a') + N % 26)
  N //= 26 
print(ans[::-1])
Buggy python submission (verdict: Runtime Error):
a = list(map(int, input().split()))
if (4 * a[0] - a[1]) % 2 == 0 and 2 * t >= (4 * a[0] - a[1]) >= 0:
    print('Yes')
else:
    print('No')

Fixed submission:
a = list(map(int, input().split()))
if (4 * a[0] - a[1]) % 2 == 0 and 2 * a[0] >= (4 * a[0] - a[1]) >= 0:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
ans = 1
for i in a:
    ans = ans * i
if ans > 1000000000000000000:
    print(-1)
else:
    print(ans)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
import sys
ans = 1
if 0 in a:
    print(0)
    sys.exit()
for i in a:
    if ans <= 1000000000000000000:
        ans = ans * i
      
    else:
        print(-1)
        sys.exit()
if ans <= 1000000000000000000:
    print(ans)
else:
    print(-1)
Buggy python submission (verdict: Runtime Error):
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append(cnt)

    if temp!=1:
        arr.append(1)

    if arr==[]:
        arr.append(1)

    return arr

n = int(input())
ln = factorization(n)
ans = 0
for i in range(1, max(ln) + 1):
    for j in range(len(ln)):
        if ln[j] < i:
            ln.pop(j)
    ans += len(ln)
    ln = list(map(lambda x: x - i, ln))
    if ln == [] or sum(ln)==0:
        break
print(ans)

Fixed submission:
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append(cnt)

    if temp!=1:
        arr.append(1)

    if arr==[]:
        arr.append(1)

    return arr

n = int(input())
ln = factorization(n)
ans = 0
for i in range(1, max(ln) + 1):

    ln = [x for x in ln if x >= i]
    ans += len(ln)
    ln = list(map(lambda x: x - i, ln))
    if sum(ln)==0:
        break
import sys

if n == 1:
    print(0)
    sys.exit()
print(ans)
Buggy python submission (verdict: Runtime Error):
s = list(str(input()))
for i in range(len(s)):
    if s[-(i + 1)] == '?':
        if s[-(i + 2)] == 'P':
            s[-(i + 1)] = 'D'
        else:
            s[-(i + 1)] = 'D'
print(''.join(s))

Fixed submission:
s = list(str(input()))
for i in range(len(s)):
    if s[i] == '?':
        s[i] = 'D'
print(''.join(s))