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

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

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
 
if a * b % 2 == 0:
  print("Even")
else:
  print("Odd")

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
 
x = a * b
 
if x % 2 == 0:
  print("Even")
else:
  print("Odd")

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
 
c = a * b
 
if c % 2 == 0:
  print("Even")
else:
  print("Odd")

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
 
x = a * b
 
if x % 2 == 0:
  print("Even")
else:
  print("Odd")

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
 
x=a*b
 
if X%2==0;
  print("Even")
else;
  print("Odd)

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())

x=a*b

if X%2==0:
  print("Even")
else:
  print("Odd)
Problem p03457 (python)

Fixed submission:
n = int(input())
 
s = 0
p = 0
for _ in range(n):
  t,x,y = map(int, input().split())
  s = t - s
  p = abs((x+y)-p)
  if s < p:
    print("No")
    exit()
  elif s%2 != p%2:
    print("No")
    exit()
print("Yes")

Buggy submission (verdict: Runtime Error):
N = int(input())
t, x, y = map(int, input().split())
if t < x+y :
  print("NO")
elif t%2 != p%2:
  print("NO")
else:
  print("YES")
Problem p03471 (python)

Fixed submission:
n,y = map(int, input().split())
for i in range(n+1):
  for j in range(n+1-i):
    if y==i*10000+j*5000+(n-i-j)*1000:
      print(i,j,(n-i-j))
      exit()
print('-1 -1 -1')

Buggy submission (verdict: Runtime Error):
N,Y = map(int, input().split())
for i in range(N+1):
  for j in range(N+1-i):
    if Y==i*10000+j*5000+(N-i-j)*1000:
      print(i,j,(n-i-j))
      exit()
print('-1 -1 -1')

Buggy submission (verdict: Runtime Error):
N,Y = map(int, input().split())
for i in range(N+1):
  for j in range(N+1-i):
    if Y==i*10000+j*5000+(N-i-j)*1000:
      print(i,j,(n-i-j))
      exit()
print('-1 -1 -1')
Problem p03493 (python)

Fixed submission:
print(input().count("1"))

Buggy submission (verdict: Runtime Error):
print(input().count(1))

Buggy submission (verdict: Runtime Error):
s1,s2,s3 = map(int, input().split())

x = s1 + s2 +s3

print(x)
Problem p03693 (python)

Fixed submission:
r,g,b= map(int, input().split())
x = r*100+g*10+b
if x%4==0:
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
r g b = map(int, input().split())
x = r*100+g*10+b
if x%4==0:
  print("YES")
else:
  print("NO")
Problem p02612 (python)

Fixed submission:
N=input()
if len(N)>3:
    i=(int(N[:-3])+1)*1000
else:
    i=1000

j=i-int(N)

if j>999:
  print(0)
else:
  print(j)

Buggy submission (verdict: Runtime Error):
N=input()
if len(N) >3:
  i=(int(N[:-3])+1)*1000
else:
  i=N
 
j=i-int(N)
 
elif j>999:
  print(0)
else:
  print(j)

Buggy submission (verdict: Runtime Error):
N=input()
i=(int(N[:-3])+1)*1000


j=i-int(N)

if j>999:
  print(0)
else:
  print(j)

Buggy submission (verdict: Runtime Error):
N=input()
i=(int(N[:-3])+1)*1000
j=i-int(N)

if j==1000:
  print(0)
else:
  print(j)
Problem p02678 (python)

Fixed submission:
import collections

def main():
    n, m = map(int, input().split())
    g = [[] for i in range(n)]
    for i in range(m):
        a, b = map(int, input().split())
        a, b = a - 1, b - 1
        g[a].append(b)
        g[b].append(a)
    ans = solve(n, m, g)
    if -1 in ans:
        print('No')
    else:
        print('Yes')
        print(*ans, sep = '\n')


def solve(n, m, g):
    q = collections.deque()
    distances = [-1 for i in range(n)]
    ans  = [-1 for i in range(n)]
    distances[0] = 0
    q.append(0)
    while len(q):
        pos = q.popleft()
        for i in g[pos]:
            if distances[i] == -1:
                q.append(i)
                distances[i] = distances[pos] + 1
                ans[i] = pos + 1
    return ans[1:]


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import collections

def main():
    n, m = map(int, input().split())
    g = [[] for i in range(m)]
    for i in range(m):
        a, b = map(int, input().split())
        a, b = a - 1, b - 1
        g[a].append(b)
        g[b].append(a)
    ans = solve(n, m, g)
    if -1 in ans:
        print('No')
    else:
        print('Yes')
        print(*ans, sep = '\n')


def solve(n, m, g):
    q = collections.deque()
    distances = [-1 for i in range(n)]
    ans  = [-1 for i in range(n)]
    distances[0] = 0
    q.append(0)
    while len(q):
        pos = q.popleft()
        for i in g[pos]:
            if distances[i] == -1:
                q.append(i)
                distances[i] = distances[pos] + 1
                ans[i] = pos + 1
    return ans[1:]


if __name__ == '__main__':
    main()
Problem p02718 (python)

Fixed submission:
n, m = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse = True)
print('Yes' if a[m-1] >= sum(a)/4/m else 'No')

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse = True)
print('Yes' if a[m-1] >= 1/4M else 'No')
Problem p02732 (python)

Fixed submission:
import collections

def comb2(n):
    return int(n * (n - 1) / 2)

def combdict(dic, dp):
    ans = 0
    for v in dic.values():
        ans += dp[v]
    return ans

def solve(a, dic, dp):
    allsum = combdict(dic,dp)
    for i in a:
        print(allsum - dp[dic[i]] + dp[dic[i]-1])

def main():
    dp = [comb2(i) for i in range(2 * ( 10 ** 5) + 1)]
    n = int(input())
    a = list(map(int,input().split()))
    d = collections.Counter(a)
    solve(a, d, dp)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def factrial(n):
    if n < 2:
        return 1
    return n * factrial(n - 1)

def combination(n, r):
    return int(factrial(n) / factrial(r) / factrial(n - r))

def combination2(n):
    return combination(n, 2)

def dictcomb(dic):
    ans = 0
    for key in dic:
        ans += combination2(dic[key])
    return ans

def solve(a, dic):
    for i in a:
        dic[i] -= 1
        print(dictcomb(dic))
        dic[i] += 1

def main():
    n = int(input())
    a = list(map(int,input().split()))
    dic = {}
    for i in a:
        if i in dic:
            dic[i] += 1
        else:
            dic[i] = 1
    solve(a, dic)

if __name__ == '__main__':
    main()
Problem p02946 (python)

Fixed submission:
n,k=map(int,input().split())
ra=range(max(-1000000,k-(n-1)),min(1000000+1,k+(n-1)+1))
li=[i for i in ra]
print(*li,sep=' ')

Buggy submission (verdict: Runtime Error):
k,x=map(int,input().split())
start,end=max(-100_0000,x-(k-1)),min(100_0000,x+(k-1))
r=range(start,end+1)
print(*r,sep=' ')
Problem p03074 (python)

Fixed submission:
n,k=map(int,input().split())
s=input()
a=[]
a.append(0)
for i in range(len(s)-1):
	if s[i] != s[i+1]:
		a.append(i+1)
a.append(n)
if s[-1]=='0':
	m=2*k
else:
	m=2*k+1
t=4*k+1
_max=0
i=len(a)-1
if i- m<0:
	print(n)
else:
	while i-m>=0:
		tmp=a[i]-a[i-m]
		#print('i:{} tmp:{}'.format(i,tmp))
		if tmp>_max:
			_max=tmp
		m=t-m
		i-=1
	if a[i]>_max:
		_max=a[i]
	print(_max)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
s=input()
a=[]
a.append(0)
for i in range(len(s)-1):
	if s[i] != s[i+1]:
		a.append(i+1)
a.append(n)

print(a)


if s[-1]=='0':
	m=2*k
else:
	m=2*k+1
if n<m or len(a)-m-1<0:
	print(n)
elif len(a)==2 and s[0]=='1' and k==0:
	print(0)
else:
	print(n)
else:
	_max=0
	i=len(a)-1
	while i-m>=0:
		tmp=a[i]-a[i-m]
		#print('i:{} tmp:{}'.format(i,tmp))
		if tmp>_max:
			_max=tmp
		i-=1
	print(_max)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
s=input()
a=[]
a.append(0)
tmp=1
for i in range(len(s)-1):
	if s[i] != s[i+1]:
		a.append(i+1)
a.append(n)

#print(a)

if len(a)==2:
	print(a[1])
else:
	if s[0]=='0':
		m=2*k
	else:
		m=2*k+1
	if m>len(s):
		print(len(s))
	else:
		_max=a[m]
		i=1
		while m+i<len(a):
			tmp=a[i+m]-a[i]
			#print(tmp)
			if tmp>_max:
				_max=tmp
			i+=1
		print(_max)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
s=input()
a=[]
a.append(0)
tmp=1
for i in range(len(s)-1):
	if s[i] != s[i+1]:
		a.append(i+1)
a.append(n)

#print(a)

if len(a)==2:
	print(a[1])
else:
	if s[0]=='0':
		m=2*k
	else:
		m=2*k+1
	if m>len(s):
		print(len(s))
	else:
		_max=a[m]
		i=1
		while m+i<len(a):
			tmp=a[i+m]-a[i]
			print(tmp)
			if tmp>_max:
				_max=tmp
			i+=1
		print(_max)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
s=input()
a=[]
a.append(0)
tmp=1
for i in range(len(s)-1):
	if s[i] != s[i+1]:
		a.append(i+1)
a.append(n)

#print(a)

if len(a)==2:
	print(a[1])
else:
	if s[-1]=='0':
		m=2*k
	else:
		m=2*k+1
	_max=a[m]
	i=len(a)-1
	while i-m>=0:
		tmp=a[i]-a[i-m]
		#print('i:{} tmp:{}'.format(i,tmp))
		if tmp>_max:
			_max=tmp
		i-=1
	print(_max)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
s=input()
a=[]
a.append(0)
tmp=1
for i in range(len(s)-1):
	if s[i] != s[i+1]:
		a.append(i+1)
a.append(n)

#print(a)

if len(a)==2:
	print(a[1])
else:
	if s[0]=='0':
		m=2*k
	else:
		m=2*k+1
	_max=a[m]
	i=1
	while m+i<len(a):
		tmp=a[i+m]-a[i]
		print(tmp)
		if tmp>_max:
			_max=tmp
		i+=1
	print(_max)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
s=input()
a=[]
tmp=1
for i in range(len(s)-1):
	if s[i] == s[i+1]:
		tmp+=1
	else:
		a.append(tmp)
		tmp=1
a.append(tmp)

b=[]
if s[0]=='0':
	m=2*k
else:
	m=2*k+1
for i in range(len(a)-k):
	b.append(sum(a[i:i+m]))
print(max(b))
Problem p03125 (python)

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

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

def gcd_list(numbers):
	return reduce(fractions.gcd,numbers)

n=int(input())
hp=list(map(int,input().split()))
print(gcd_list(hp))
Problem p03136 (python)

Fixed submission:
n=int(input())
l=list(map(int,input().split()))
lmax=max(l)
if lmax<sum(l)-lmax:
	print('Yes')
else:
	print('No')

Buggy submission (verdict: Runtime Error):
n=int(input())
l=list(map(int,imput().split()))
lmax=max(l)
if lmax<sum(l)-lmax:
	print('Yes')
else:
	print('No')
Problem p03160 (python)

Fixed submission:
def main():
    n = int(input())
    h = [int(i) for i in input().split()]
    ans = solve(n, h)
    print(ans)


def solve(n, h):
    dp =[0 for _ in range(n)]
    dp[1] = dp[0] + abs(h[1] - h[0])
    for i in range(1, n - 1):
        dp[i + 1] = min(dp[i] + abs(h[i + 1] - h[i]), dp[i - 1] + abs(h[i + 1] - h[i - 1]))
    return dp[n - 1]


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys
buf=sys.stdin.read()
n=int(buf[0])
h=list(map(int,buf[1].split()))

dp=[0 for i in range(n+1)]
dp[1]=h[0]
for i in range(2,n):
	dp[i+1]=min(dp[i]+abs(h[i]-h[i+11]),dp[i-1]+abs(h[i-1]-h[i+1]))
print(dp[n])
Problem p03282 (python)

Fixed submission:
n=input()
k=int(input())
c=0
for i in range(len(n)):
	if n[i] is '1':
		c+=1
	else:
		break

if c>=k:
	print('1')
else:
	print(n[c])

Buggy submission (verdict: Runtime Error):
n=input()
k=int(input())
c=0
for i in range(len(n)):
	if n[i] is '1':
		c+=1
	else:
		break

print(n[c])

Buggy submission (verdict: Runtime Error):
n=input()
k=int(input())
for i in range(k):
	n=n.strip('1')
print(n[0])
Problem p03283 (python)

Fixed submission:
def main():
    n, m, Q = map(int, input().split())
    Train= [[0 for _ in range(n)] for _ in range(n)]
    
    for i in range(m):
        l, r = map(int, input().split())
        l, r = l - 1, r - 1
        Train[l][r] += 1
    
    P_Train = [[0 for _ in range(n)] for _ in range(n)]
    for i in range(n):
        tmp = 0
        for j in range(n):
            tmp += Train[i][j]
            P_Train[i][j] = tmp

    for i in range(Q):
        p, q = map(int, input().split())
        p, q = p - 1, q - 1
        ans = solve(P_Train, n, p, q)
        print(ans)

def solve(P_Train, n, p, q):
    ans = 0
    for i in range(p, q + 1):
        if  p - 1 < 0:
            ans += P_Train[i][q]
        else:
            ans += P_Train[i][q] - P_Train[i][p - 1]
    return ans


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):

def solve(s,e):
	res=0
	for i in range(s,e+1):
		res+=train[i][e+1]-train[i][s]
	return res

city,dnum,qnum=map(int,input().split())

train=[[0 for i in range(city+1)] for i in range(city+1)]

for i in range(dnum):
	l,r=map(int,input().split())
	train[l][r]+=1

for i in train:
	tmp=0
	for j in i:
		tmp+=j
		j=tmp
	
querry=[list(map(int,input().split())) for i in range(qnum)]

for q in querry:
	print(solve(*q))

Buggy submission (verdict: Runtime Error):
city,dnum,qnum=map(int,input().split())

data,querry=[],[]
dapp=data.append()
qapp=querry.append()
for i in range(dnum):
	dapp(list(map(int,input().split())))

for i in range(qnum):
	qapp(list(map(int,input().split())))
	
def solve(start,end):
	res=0
	for j in range(dnum):
		if start<=data[j][0] and data[j][1]<=end:
			res+=1
	return res
	
for i in range(qnum):
	print(solve(querry[i][0],querry[i][1]))
Problem p03288 (python)

Fixed submission:
r=int(input())
if r>=2800:
	print('AGC')
elif r>=1200:
	print('ARC')
else:
	print('ABC')

Buggy submission (verdict: Runtime Error):
r=int(input())
if r>=2800:
  print('AGC')
 elif r>=1200:
  print('ARC')
 else:
  print('ABC')
Problem p03289 (python)

Fixed submission:
def solve(s):
    if s[0]!='A':
        return 'WA'
    if s[2:len(s)-1].count('C')!=1:
        return 'WA'
    s=str(s.split('A'))
    s=str(s.split('C'))
    if not s.islower():
        return 'WA'
    return 'AC'

s=input()
print(solve(s))

Buggy submission (verdict: Runtime Error):
def solve(s):
    if s[0]!='A':
        return 'WA'
    if s[3:len(s)-1].count('C')!=1:
        return 'WA'
    s=s.split('A').split('C')
    if not s.islower():
        return 'WA'
    return 'AC'
  
s=input()
print(solve(s))

Buggy submission (verdict: Runtime Error):
def solve(s):
    if s[0]!='A':
        return 'WA'
    if s[3:len(s)-1].count('C')!=1:
        return 'WA'
    s=s.split('A').split('C')
    if not s.islower():
        return 'WA'
    return 'AC'
  
s=input()
print(solve(s))

Buggy submission (verdict: Runtime Error):
def solve(s):
    if s[0]!='A':
        return 'WA'
    if s[3:len(s)-1].count('C')!=1:
        return'WA'
    s=s.split('A').split('C')
    if not s.islower():
        return'WA'
    return'AC'
  
s=input()
print(solve(s))

Buggy submission (verdict: Runtime Error):
def solve(s):
	if s[0]!='A':
    	return 'WA'
    if s[3:len(s)-1].count('C')!=1:
    	return 'WA'
    s=s.split('A').split('C')
    if not s.islower():
    	return 'WA'
    return 'AC'
  
s=input()
print(solve())
Problem p03293 (python)

Fixed submission:
s=input()
t=input()
if t in [s[i:]+s[:i] for i in range(len(s))]:
	print('Yes')
else:
	print('No')

Buggy submission (verdict: Runtime Error):
s=input()
t=input()
if t in [s[i:]+s[:i] for i in range(len(s)]:
	print('Yes')
else:
	print('No')
Problem p03294 (python)

Fixed submission:
import functools
import fractions

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

def slcm(numbers):
	return functools.reduce(blcm, numbers)
	
input()
numbers=list(map(int, input().split()))
num=slcm(numbers)-1
nums=[num%i for i in numbers]
print(sum(nums))

Buggy submission (verdict: Runtime Error):
import functools
import fraction

def blcm(x, y):
	return (x*y)//fraction.gcd(x, y)

def slcm(numbers):
	return functools.reduce(blcm, numbers)
	
input()
numbers=list(map(int, input().split()))
num=slcm(numbers)-1
nums=[num%i for i in numbers]
print(sum(nums))

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

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

def slcm(numbers):
	return functools.reduce(blcm, numbers)
	
input()
numbers=list(map(int, input().split()))
num=slcm(numbers)-1
nums=[num%i for i in numbers]
print(sum(nums))

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

def slcm(numbers):
	return functools.reduce((lambda x,y:x*y//math.gcd(x, y)), numbers)
	
input()
numbers=list(map(int,input().split()))
num=slcm(numbers)-1
nums=[num%i for i in numbers]
print(sum(nums))

Buggy submission (verdict: Runtime Error):
import functools
import math
def slcm(numbers):
	return functools.reduce((lambda x,y:x*y//math.gcd(x, y)), numbers)
	
input()
numbers=list(map(int,input().split()))
num=slcm(numbers)-1
nums=[num%i for i in numbers]
print(sum(nums))

Buggy submission (verdict: Runtime Error):
import functools
import math
def slcm(numbers):
	return functools.reduce(lambda x,y:x*y//math.gcd(x,y),numbers)

input()
numbers=list(map(int,input().split()))
num=slcm(numbers)-1
print(sum([num%i for i in numbers]))

Buggy submission (verdict: Runtime Error):
import functools
import math
def slcm(numbers):
	return functools.reduce(lambda x,y:x*y//math.gcd(x,y),numbers)

input()
numbers=list(map(int,input().split()))
num=slcm(numbers)-1
print(sum([num%i for i in numbers]))

Buggy submission (verdict: Runtime Error):
import functools
import math
def slcm(numbers):
	return functools.reduce(lambda x,y:x*y//math.gcd(x,y),numbers)

input()
numbers=list(map(int,input().split()))
num=slcm(numbers)-1
print(sum([num%i for i in numbers]))
Problem p03296 (python)

Fixed submission:
n=int(input())
numbers=list(map(int,input().split()))
count=1
c=0
for i in range(n-1):
  if numbers[i] is numbers[i+1]:
    count+=1
  else:
  	c+=count//2
  	count=1
if count-1:
	c+=count//2
print(c)

Buggy submission (verdict: Runtime Error):
n=input()
numbers=list(map(int,input().split()))
count=0
for i in range(1,n):
  if numbers[i] is numbers[i+1]:
    count+=1
print(count)
Problem p03695 (python)

Fixed submission:
def main():
    n = int(input())
    a = [int(i) for i in input().split()]
    ans = solve(n, a)
    print(*ans)


def solve(n, a):
    m = 8
    colors = [0 for i in range(m + 1)]
    for i in range(n):
        for j in range(m):
            if a[i] < 400 * (j + 1):
                colors[j] += 1
                break
        else:
            colors[m] += 1
    usedcolors = sum([1 for i in colors[:m] if i > 0])
    ans = [max(1,usedcolors), usedcolors + colors[m]]

    return ans


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n = int(input())
    a = [int(i) for i in input().split()]
    ans = solve(n, a)
    print(*ans)


def solve(n, a):
    m = 8
    colors = [0 for i in range(m + 1)]
    for i in range(n):
        for j in range(m):
            if a[i] < 400 * (j + 1):
                colors[j] += 1
                break
        else:
            colors[m] += 1
    usedcolors = sum([1 for i in colors[:m] if i > 0])
    ans = [max(1,usedcolors), min(usedcolors + colors[m])]

    return ans


if __name__ == '__main__':
    main()
Problem p03721 (python)

Fixed submission:
def main():
    n, k = map(int, input().split())
    a, b = [0 for i in range(n)], [0 for i in range(n)]
    for i in range(n):
        a[i], b[i] = [int(x) for x in input().split()]
    ans = solve(n, k, a, b)
    print(ans)


def solve(n, k, a, b):
    ab = [[a[i], b[i]] for i in range(n)]
    ab.sort(key = lambda x:x[0])
    back = 0
    for i in range(n):
        back += ab[i][1]
        if back >= k:
            return ab[i][0]
    return 


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n, k = map(int, input().split())
    a, b = [0 for i in range(n)], [0 for i in range(n)]
    for i in range(n):
        x, y = input().split()
        a[i], b[i] = x, int(y)
    ans = solve(n, k, a, b)
    print(ans)


def solve(n, k, a, b):
    s = ''
    for i in range(n):
        s += a[i] * b[i]
    return s[k - 1]


if __name__ == '__main__':
    main()
Problem p02660 (python)

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


def parse(n):
    # n -> largest m s.t. m(m+1)/2 <= n
    m = 1
    while m * (m + 1) <= 2 * n:
        m += 1
    return m - 1


def factorint(n):
    fct = []
    b, e = 2, 0
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct


def main():
    N = int(input())
    factors = factorint(N)
    print(sum(parse(v) for _, v in factors))
    return


if __name__ == "__main__":
    main()

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

from sympy import factorint


def parse(n):
    # n -> largest m s.t. m(m+1)/2 <= n
    m = 1
    while m * (m + 1) <= 2 * n:
        m += 1
    return m - 1


def factorint(n):
    fct = []
    b, e = 2, 0
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct


def main():
    N = int(input())
    factors = factorint(N)
    print(sum(parse(v) for _, v in factors))
    return


if __name__ == "__main__":
    main()

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

from sympy import factorint


def parse(n):
    # n -> largest m s.t. m(m+1)/2 <= n
    m = 1
    while m * (m + 1) <= 2 * n:
        m += 1
    return m - 1


def main():
    N = int(input())
    factors = factorint(N)
    print(sum(parse(v) for _, v in factors.items()))
    return


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

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


def solve(W, H, x, y):
    ans = str(H*W/2)
    if x == 0 or y == 0:
        flag = "0"
    else:
        if x == W/2 and y == H/2:
            flag = "1"
        else:
            flag = "0"
    print(ans + " " + flag)

    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    W = int(next(tokens))  # type: int
    H = int(next(tokens))  # type: int
    x = int(next(tokens))  # type: int
    y = int(next(tokens))  # type: int
    solve(W, H, x, y)


if __name__ == "__main__":
    main()

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


def solve(W, H, x, y):
    if x==0:
        ans = W*min(y, H-y)
        print(ans+" 0")
        return
    if y == 0:
        ans = H*min(x, W-x)
        print(ans+" 0")
        return

    s1 = W*min(y, H-y)
    s2 = H*min(x, W-x)
    if y*W > H*x:
        s_ = H**2*x/(2*y)
        s3 = min(H*W - s_, s_)
    else:
        s_ = W**2*y/(2*x)
        s3 = min(H*W - s_, s_)
    ss = [s1, s2, s3]
    ans = str(max(ss))
    if len(list(set(ss))) == len(ss):
        flag = "0"
    else:
        flag = "1"
    print(ans + " " + flag)

    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    W = int(next(tokens))  # type: int
    H = int(next(tokens))  # type: int
    x = int(next(tokens))  # type: int
    y = int(next(tokens))  # type: int
    solve(W, H, x, y)

if __name__ == '__main__':
    main()