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

Fixed submission:

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

if K == 1:
  print(0)
else:
  a = N % K
  if a > K-a:
    print(K-a)
  else:
    print(a)

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

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

if K == 1:
  print(0)
else:
  # N_swp = np.abs(N - K)
  N_swp = math.sqrt((N - K)**2)
  while N_swp != 0 and N_swp < N :
    N = N_swp
    # N_swp = np.abs(N - K)
    N_swp = math.sqrt((N - K)**2)
  print(int(N))

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

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

if K == 1:
  print(0)
else:
  N_swp = np.abs(N - K)
  while N_swp != 0 and N_swp < N :
    N = N_swp
    N_swp = np.abs(N - K)
  print(N)
Problem p02761 (python)

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

ans = [0 for i in range(N)]
isTerms = [0 for i in range(N)]
jadge = True

for i in range(M):
    s, c = map(int, input().split())
    if( ans[s-1] != c and isTerms[s-1] != 0):
        jadge = False
    elif( s == 1 and c == 0):
        jadge = False
    else:
        ans[s-1] = c
        isTerms[s-1] = 1

if( N != 1 and ans[0] == 0 and jadge):
    ans[0] = 1

if( N == 1 and ans[0] == 0):
    jadge = True

if jadge:
    if(N==1):
        print(ans[0])
    else:
        for i in range(N-1):
            print(ans[i] ,end = "")
        print(ans[i+1])
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
import sys
N, M = map(int, input().split())

C = []
S = []

for i in range(M):
    c, s = map(int, input().split())
    C.append(c)
    S.append(s)

for x in range(1000):
    keta = 1
    nx = x//10
    d = [x%10]


    while(nx):
        keta += 1
        d.append(nx%10)
        nx = nx // 10
    d = list(reversed(d))

    isOk = True
    
    for i in range(M):
        if( d[C[i]-1] != S[i-1] ):
            isOk = False

    if isOk :
        num = "".join(map(str, d))
        break

if isOk:
    print(num)
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
import sys
N, M = map(int, input().split())

C = []
S = []

for i in range(M):
    c, s = map(int, input().split())
    C.append(c)
    S.append(s)

for x in range(1000):
    keta = 1
    nx = x//10
    d = [x%10]


    while(nx):
        keta += 1
        d.append(nx%10)
        nx = nx // 10
    d = list(reversed(d))

    isOk = True
    
    for i in range(M):
        if( d[C[i]-1] != S[i-1] ):
            isOk = False

    if isOk :
        num = "".join(map(str, d))
        print(num)
        sys.exit

print(-1)
sys.exit

Buggy submission (verdict: Runtime Error):

N, M = map(int, input().split())

C = []
S = []

for i in range(M):
    c, s = map(int, input().split())
    C.append(c)
    S.append(s)

for x in range(1000):
    keta = 1
    nx = x//10
    d = [x%10]


    while(nx):
        keta += 1
        d.append(nx%10)
        nx = nx // 10
    d = list(reversed(d))

    isOk = True
    
    for i in range(M):
        if( d[C[i]-1] != S[i-1] ):
            isOk = False

    if isOk :
        num = "".join(map(str, d))
        print(num)
        return 0

print(-1)
return 0
Problem p02812 (python)

Fixed submission:
def checkABC(S):
    count = 0
    for i in range(len(S)):
        if S[i] == 'A':
            if i+1 < len(S) and S[i+1] == 'B':
                if i+2 < len(S) and S[i+2] == 'C':
                    count += 1
    
    return count


N = int(input())

S = list(input())

print(checkABC(S))

Buggy submission (verdict: Runtime Error):
def checkABC(S):
    count = 0
    for i in range(len(S)):
        if S[i] == 'A':
            if S[i+1] == 'B':
                if S[i+2] == 'C':
                    count += 1
    
    return count


N = int(input())

S = list(input())

print(checkABC(S))
Problem p02848 (python)

Fixed submission:

N = int(input())
words = list(input())

for i in range(len(words)):
    check_word  = ord(words[i]) + N 
    if(check_word > ord('Z')):
        print(chr(ord('A') + (check_word - ord('Z'))-1),end="")
    else:
        print(chr(check_word),end="")
print()

Buggy submission (verdict: Runtime Error):
import math

A,B,X = map(int,input().split())

# A * N + B * d(N) yen 

check_num = [1,10,100,1000,10000,100000,1000000,10000000,100000000,1000000000]

if((A*1+B*1)>X):
    print(0)
else:
    flag = True
    for i in range(len(check_num)):
        if((A*check_num[i]+B*(i+1)) > X):
            flag = False
            break
    if(flag):
        print(10**9)
    else:
        value = math.ceil((X - B*i)/A)
        print(value-1)
Problem p02971 (python)

Fixed submission:
import numpy as np

N = int(input())

a = []
for i in range(N):
    a.append(int(input()))

if(N==1):
    print(a[0])
else:
    a_max = 0
    n_a_max = 0
    all_max = max(a)
    max_arg = np.argmax(a)

    if(max_arg!=0):
        a_max = max(a[:max_arg])
    if(max_arg!=N-1):
        n_a_max = max(a[max_arg+1:])

    if(a_max>=n_a_max):
        next_max = a_max
    else:
        next_max = n_a_max

    for i in range(N):
        if a[i]==all_max:
            print(next_max)
        else:
            print(all_max)

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

N = int(input())

a = []
for i in range(N):
    a.append(int(input()))

if(N==1):
    print(a[0])
else:
    a_max = 0
    n_a_max = 0
    all_max = max(a)
    max_arg = np.argmax(a)

    if(max_arg!=0):
        a_max = max(a[:max_arg])
    if(max_arg!=N-1):
        n_a_max = max(a[max_arg+1:])

    if(a_max>=n_a_max):
        next_max = a_max
    else:
        next_max = n_a_max

    for i in range(N):
        if a[i]==all_max:
            print(next_max)
        else:
            print(all_max)

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())

a = []
for i in range(N):
    a.append(int(input()))
a_max = 0
n_a_max = 0
all_max = max(a)
max_arg = np.argmax(a)

if(max_arg!=0):
    a_max = max(a[:max_arg])
if(max_arg!=N-1):
    n_a_max = max(a[max_arg+1:])

if(a_max>=n_a_max):
    next_max = a_max
else:
    next_max = n_a_max

for i in range(N):
    if a[i]==all_max:
        print(next_max)
    else:
        print(all_max)

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())

a = []
for i in range(N):
    a.append(int(input()))

all_max = max(a)
max_arg = np.argmax(a)

print(max(a[1:]))

for i in range(1,N-1):
    if i!=max_arg:
        print(all_max)
    else:
        a_max = max(a[:i])
        n_a_max = max(a[i+1:])
        if(a_max>=n_a_max):
            print(a_max)
        else:
            print(n_a_max)

print(max(a[:N-1]))
Problem p03005 (python)

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

if K == 1:
    print(0)
else:
    print(N-K)

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

if K = 1:
    print(0)
else:
    print(N-K)
Problem p03495 (python)

Fixed submission:
import collections as c
import numpy as np

N,K = map(int,input().split()) 
A = list(map(int,input().split()))
A_c = c.Counter(A)
A_c = sorted(list(A_c.values()))
KindNum = len(A_c)
if KindNum < K:
    print(0)
else:
    ans = sum(A_c[:KindNum - K])
    print(ans)

Buggy submission (verdict: Runtime Error):

N,K = map(int,input().split()) 
numbers = list(map(int,input().split()))
num_set = set(numbers)
KindNum = len(num_set)

if KindNum < K:
    print(0)
else:
    numCount = []
    count = 0
    for num_kind in num_set:
        numCount.append(numbers.count(num_kind))
    numCount.sort()
    count = sum(numCount[:KindNum - K])
print(count)

Buggy submission (verdict: Runtime Error):

N,K = map(int,input().split()) 
numbers = list(map(int,input().split()))
num_set = set(numbers)

if len(num_set) < K:
    print(0)
else:
    numCount = []
    count = 0
    KindNum = len(num_set)
    for num_kind in num_set:
        numCount.append(numbers.count(num_kind))
    numCount.sort()
    count = sum(numCount[:KindNum - K])
print(count)
Problem p02681 (python)

Fixed submission:

#a,b=(int(x) for x in input().split()) #数値の時




#a,b=(x for x in input().split()) 
a=input()
print("\n")
b=input()
t=len(a)
aa=[]
bb=[]
for i in range(t):
    aa.append(a[i])
    bb.append(b[i])
 
if(aa==bb):
  print("Yes")
else:
	print("No")

Buggy submission (verdict: Runtime Error):
a,b=(x for x in input().split()) 
t=len(a)
aa=[]
bb=[]
for i in range(t):
  aa.append(a[i])
  bb.append(b[i])
    
   
if(aa==bb):
	print("Yes")
else:
	print("No")

Buggy submission (verdict: Runtime Error):
a,b=(x for x in input().split()) 
t=len(a)
aa=[]
bb=[]
for i in range(t):
    aa.append(a[i])
    bb.append(b[i])
 
if(aa==bb):
  print("Yes")
else:
	print("No")

Buggy submission (verdict: Runtime Error):
a,b=(x for x in input().split()) 
t=len(a)
aa=[]
bb=[]
for i in range(t):
  aa.append(a[i])
  bb.append(b[i])
 
if(aa==bb):
  print("Yes")
else:
	print("No")

Buggy submission (verdict: Runtime Error):
a,b=(x for x in input().split()) 
t=len(a)
aa=[]
bb=[]
for i in range(t):
  aa.append(a[i])
  bb.append(b[i])
 
if(aa==bb):
  print("Yes)
else:
	print("No")
Problem p02717 (python)

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

print(int(A), int(B), int(C))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
A = list(map(int, input().split()))
total = sum(A) / 4 * M
A.sort(reverse = True)
if A[M-1] >= total:
  print('Yes')
else:
  print('No')
Problem p03478 (python)

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

ans = 0

for x in range(1, N + 1):
    SUM = 0
    num = x
    while x > 0:
        SUM += (x % 10)
        x //= 10
    if A <= SUM <= B:
        ans += num
        
print(ans)

Buggy submission (verdict: Runtime Error):
import math
N, A, B = map(int, input().split())

ans = 0

for x in range(1, N + 1):
    SUM = 0
    num = x
    while x > 0:
        SUM += (x % 10)
        x // = 10
    if A <= SUM <= B:
        ans += num
        
print(ans)
Problem p02780 (python)

Fixed submission:
# ruisekiwa by itertools

from itertools import accumulate

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

b1=[0]+list(accumulate(p))

ans=[]

for i in range(N-K+1):
    ans.append(b1[K+i]-b1[i])
    
print((max(ans)+K)/2)

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
p = list(map(int,input().split()))
ex=[]
 
ans=[]
 
for i in p:
    ex.append((1/2*i*(i+1))/i)
 
for i in range(N-K+1):
    ans.append(sum(ex[i:i+K]))
    
print(max(ans))
N,K = map(int,input().split())
p = list(map(int,input().split()))
ex=[]

ans=[]

for i in p:
    ex.append((1+i)/2)

for i in range(N-K+1):
    ans.append(sum(ex[i:i+K]))
    
print(max(ans))

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
p = list(map(int,input().split()))
ex=[]
 
ans=[]
 
for i in p:
    ex.append((1+i)/2)
 
for i in range(N-K+1):
    ans.append(sum(ex[i:i+K]))
    
print(max(ans))
N,K = map(int,input().split())
p = list(map(int,input().split()))
ex=[]

ans=[]

for i in p:
    ex.append(()

for i in range(N-K+1):
    ans.append(sum(ex[i:i+K]))
    
print(max(ans))
Problem p02843 (python)

Fixed submission:
X = int(input())

if X < 100:
    ans = 0
else:
    a = str(X)
    a = int(a[:-2])
    b = X - a*100

    if a >= 20:
        ans = 1

    else:
        if a*5 >= b:
            ans = 1
        else:
            ans = 0

print(ans)

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

if X < 100:
    ans = 0
elif:
    a = str(X)
    a = int(a[:-2])
    b = X - a*100

    if a >= 20:
        ans = 1

    else:
        if a*5 >= b:
            ans = 1
        else:
            ans = 0

print(ans)

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

a = str(X)
a = int(a[:-2])
b = X - a*100

if a >= 20:
    ans = 1

else:
    if a*5 >= b:
        ans = 1
    else:
        ans = 0
        
print(ans)
Problem p02995 (python)

Fixed submission:
import fractions

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)


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

lcm_cd = lcm(c,d)

min_a_c = (a-1)//c
min_a_d = (a-1)//d
min_a_lcm = (a-1)//lcm_cd
max_b_c = b//c
max_b_d = b//d
max_b_lcm = b//lcm_cd

ans=(b-a+1)-((max_b_c-min_a_c)+(max_b_d-min_a_d)-(max_b_lcm-min_a_lcm))


print(ans)

Buggy submission (verdict: Runtime Error):
import math

def lcm(x, y):
    return (x * y) // math.gcd(x, y)


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

lcm_cd = lcm(c,d)

min_a_c = (a-1)//c
min_a_d = (a-1)//d
min_a_lcm = (a-1)//lcm_cd
max_b_c = b//c
max_b_d = b//d
max_b_lcm = b//lcm_cd

ans=(b-a+1)-((max_b_c-min_a_c)+(max_b_d-min_a_d)-(max_b_lcm-min_a_lcm))


print(ans)
Problem p03076 (python)

Fixed submission:
# B - Five Dishes
import math

price = []

for i in range(5):
    price.append(int(input()))

kiriage = [10*(math.ceil(i/10)) for i in price]

amari = [i%10 for i in price]


if max(amari) == 0:
    print(sum(kiriage))

else:
    while min(amari) == 0:
        amari.remove(0)

    print(sum(kiriage)-10+ min(amari))

Buggy submission (verdict: Runtime Error):
# B - Five Dishes
import math

price = []

for i in range(5):
    price.append(int(input()))

kiriage = [10*(math.ceil(i/10)) for i in price]

amari = [i%10 for i in price]

while min(amari) == 0:
    amari.remove(0)
    
  

print(sum(kiriage)-10+ min(amari))
Problem p03160 (python)

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

dp = [0] * n

dp[1] = abs(h[0] - h[1])

for i in range(2,n):
    a1 = dp[i-1] + abs(h[i] - h[i-1])
    a2 = dp[i-2] + abs(h[i] - h[i-2])
    dp[i] = min(a1,a2)
    
print(dp[n-1])

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

dp = [0] * n


for i in range(1,n):
    a = []
    if i-k < 0:
        start = 0
    else:
        start = i-k
    
    for j in range(start,i):
        a.append(dp[j] + abs(h[i] - h[j]))    
    
    dp[i] = min(a)
    
print(dp[-1])
Problem p03289 (python)

Fixed submission:


S = input()

ans = 'WA'

if S[0] == 'A' and S[2:-1].count('C') == 1:
    a = S[2:-1].replace('C','c')
    if a.islower() and S[-1].islower() and S[1].islower():
        ans='AC'
        
print(ans)

Buggy submission (verdict: Runtime Error):


S = input()

ans = 'WA'

if S[0] == 'A' and S[2:-1].count('C') == 1:
    a = S[2:-1].replace('C','c')
    if a.islower() and S[-1].islower()
        ans='AC'
        
print(ans)
Problem p03294 (python)

Fixed submission:
import math
from functools import reduce
import fractions

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)



n = int(input())

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

lcm = lcm_list(l)
a = lcm-1
mod_all = 0

for i in l:
    mod_all += a%i

print(mod_all)

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


def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)



n = int(input())

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

lcm = lcm_list(l)
a = lcm-1
mod_all = 0

for i in l:
    mod_all += a%i

print(mod_all)
Problem p02657 (python)

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

Buggy submission (verdict: Runtime Error):
import sys
n  = int(input())
a = list(map(int,input().split()))
ans = 1
for i in a:
  ans*=i
  if ans>int(1e18):
    print(-1)
    sys.exit()
print(ans)

Buggy submission (verdict: Runtime Error):
a,b=map(int(),input().split())
print(a*b)
Problem p02658 (python)

Fixed submission:
import sys
n  = int(input())
a = list(map(int,input().split()))
ans = 1
a.sort()
for i in a:
  ans*=i
  if ans>int(1e18):
    print(-1)
    sys.exit()
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
n  = int(input())
a = list(map(int,input().split()))
ans = 1
for i in ans:
  ans*=i
  if ans>int(1e18):
    print(-1)
    sys.exit()
print(ans)
Problem p03166 (python)

Fixed submission:
from collections import Counter
from collections import defaultdict
import math
import random
import heapq as hq
from math import sqrt
import sys
from functools import reduce

sys.setrecursionlimit(10000000)
def input():
    return sys.stdin.readline().strip()


def iinput():
    return int(input())


def tinput():
    return input().split()


def rinput():
    return map(int, tinput())


def rlinput():
    return list(rinput())


mod = int(1e9)+7


def factors(n):
    return set(reduce(list.__add__,
                      ([i, n//i] for i in range(1, int(n**0.5) + 1) if n % i == 0)))


# ----------------------------------------------------

def dfs(i):
    visited[i] = True
    for node in g[i]:
        if not visited[node]:
            dfs(node)
        dp[i] = max(dp[i], 1+ dp[node])



if __name__ == "__main__":
    n, m = rinput()
    g = defaultdict(list)
    for i in range(m):
        x, y = rinput()
        g[x].append(y)
    dp = [0]*(n+1)
    visited = [False]*(n+1)
    for i in range(1, n+1):
        if not visited[i]:
            dfs(i)
            # print('-=============================')
    # print(dp)
    print(max(dp))


# 5 3
# 2 3
# 2 4
# 5 2
# 5 1
# 1 4
# 4 3
# 1 3

Buggy submission (verdict: Runtime Error):
from collections import defaultdict


def dfs(node, graph, dist, visited):
    if visited[node] == True:
        return dist[node]
    visited[node] = True
    for child in graph[node]:
        dist[node] = max(dist[node], 1+dfs(child, graph, dist, visited))
    return dist[node]


def main():
    n, m = map(int, input().split())
    graph = defaultdict(list)
    for _ in range(m):
        u, v = map(int, input().split())
        graph[u].append(v)
    dist = [0]*(n+1)
    visited = [False]*(n+1)
    for node in range(1, n+1):
        if not visited[node]:
            dfs(node, graph, dist, visited)
    print(max(dist))


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
from collections import Counter
from collections import defaultdict
import math
import random
import heapq as hq
from math import sqrt
import sys
from functools import reduce


def input():
    return sys.stdin.readline().strip()


def iinput():
    return int(input())


def tinput():
    return input().split()


def rinput():
    return map(int, tinput())


def rlinput():
    return list(rinput())


mod = int(1e9)+7


def factors(n):
    return set(reduce(list.__add__,
                      ([i, n//i] for i in range(1, int(n**0.5) + 1) if n % i == 0)))


# ----------------------------------------------------

def dfs(i):
    visited[i] = True
    for node in g[i]:
        if not visited[node]:
            dfs(node)
        dp[i] = max(dp[i], 1+ dp[node])



if __name__ == "__main__":
    n, m = rinput()
    g = defaultdict(list)
    for i in range(m):
        x, y = rinput()
        g[x].append(y)
    dp = [0]*(n+1)
    visited = [False]*(n+1)
    for i in range(1, n+1):
        if not visited[i]:
            dfs(i)
            # print('-=============================')
    # print(dp)
    print(max(dp))


# 5 3
# 2 3
# 2 4
# 5 2
# 5 1
# 1 4
# 4 3
# 1 3
Problem p02675 (python)

Fixed submission:
n = int(input())
t = n % 10
if t == 0 or t == 1 or t == 6 or t == 8:
	print('pon')
elif t == 3:
	print('bon')
else:
	print('hon')

Buggy submission (verdict: Runtime Error):
n = int((input())
t = n % 10
if t == 0 or t == 1 or t == 6 or t == 8:
	print('pon')
elif t == 3:
	print('bon')
else:
	print('hon')
Problem p02731 (python)

Fixed submission:
l = int(input())
d = l/3
print(d**3)

Buggy submission (verdict: Runtime Error):
l = int(input())
d = l/3
print(d^3)
Problem p02957 (python)

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

Buggy submission (verdict: Runtime Error):
if ( a + b )%2 == 0:
	print((a+b)//2)
else:
	print('IMPOSSIBLE')
Problem p02657 (python)

Fixed submission:
inputs = [int(i) for i in input().split()]
print(inputs[0] * inputs[1])

Buggy submission (verdict: Runtime Error):
print(int(input()) * int(input()))
Problem p02681 (python)

Fixed submission:
daude1 = input()
daude2 = input()
if daude1 == daude2[:-1]:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
from itertools import combinations
N, M, X = [int(i) for i in input().split()]
lines = [input().split() for i in range(N)]
flag = False
prices = []
for num_books in range(1, N + 1):
    for combo in combinations(lines, num_books):
        price = 0
        skills = [0 for i in range(M)]
        for book in combo:
            price += int(book[0])
            for ind, skill in enumerate(book[1:]):
                skills[ind] += int(skill)
        if not [i for i in skills if i < X]:
            flag = True
            prices.append(price)
            break
if not flag:
    print(-1)
else:
    print(min(prices))

Buggy submission (verdict: Runtime Error):
daude = input()
daude1 = input()
return daude == daude1[:-1]
Problem p02899 (python)

Fixed submission:
import heapq
n = int(input())
a = list(map(int, input().split()))
dic = {}; ans = []
for i in range(n+1)[1:]:
    dic.setdefault(a[i-1],[]).append(i)
heapq.heapify(a)
for i in range(n):
    res = heapq.heappop(a)
    ans.append(dic[res][0])
print(*ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
dic = {}; ans = []
for i in range(n+1)[1:]:
    dic.setdefault(a[i-1],[]).append(i)
heapq.heapify(a)
for i in range(n):
    res = heapq.heappop(a)
    ans.append(dic[res][0])
print(*ans)
Problem p02900 (python)

Fixed submission:
from fractions import gcd
g = gcd(*map(int, input().split()))

f = 2
d = {}
while f**2 <= g:
    if g % f:
        f += 1
    else:
        d[f] = d.get(f,0) + 1
        g//=f

if g>1:
    d[g] =d.get(g,0) + 1

print(len(d)+1)

Buggy submission (verdict: Runtime Error):
from math import gcd

def trial_division(n):
    f = 2
    d = {}
    while n > 1:
        if n % f == 0:
            d[f] = d.get(f,0) + 1
            n//=f
        else:
            f += 1
    return d

g = gcd(*map(int, input().split()))
ans = trial_division(g)
print(len(ans)+1)
Problem p02909 (python)

Fixed submission:
s = input()
dict = {1:'Sunny', 2:'Cloudy', 3:'Rainy'}
for i in range(1,4):
    if s == dict[i]:
        if i < 3:
            print(dict[i+1])
            break
        else:
            print(dict[1])

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

for i in range(m):
    ss = sorted(ss, reverse = True)
    ss[0] = ss[0]//2

print(sum(ss))
Problem p03105 (python)

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

Buggy submission (verdict: Runtime Error):
a, b, c = map(int, input().sprit())
print(min(c, b//a))
Problem p02658 (python)

Fixed submission:
import sys
#import cython
 
def main():
    read = lambda: sys.stdin.readline().rstrip()
    
    #N: cython.longlong = 0
    n = int(read())
    a = list(map(int,read().split()))
    ans = 1
    flag = True
    iszero = any(num == 0 for num in a)
    if iszero: print(0)
    else:
        for num in a:
          ans *= num
          if ans > 10**18:
            flag = False
            break
        print(ans if flag else -1)
 
if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import sys
#import cython

def main():
    read = lambda: sys.stdin.readline().rstrip()
    
    #N: cython.longlong = 0
    n = int(read.input())
    a = list(map(int,read().split()))
    ans = 1
    flag = True
    for num in a:
      ans *= num
      if ans > 10**18:
        flag = False
        break
    print(ans if flag else -1)
 
if __name__ == "__main__":
    main()
Problem p02681 (python)

Fixed submission:
import sys
#import cython

def main():
    read = lambda: sys.stdin.readline().rstrip()
    
    #N: cython.longlong = 0
    s = read()
    t = read()
    print("Yes" if t[:-1] == s else "No")
    #a, b, c = map(int,read().split())
    #l = [int(read()) for _ in range(5)]
    

 
if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
M=998244353
n,m,k=map(int,input().split())
p,c=[m]*n,[1]*n
for i in range(1,n):
  p[i]=p[i-1]*(m-1)%M
  c[i]=c[i-1]*(n-i)*pow(i,M-2,M)%M
print(sum(p[n-i-1]*c[i]%M for i in range(k+1))%M)