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

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
from collections import Counter
two=0
a=Counter(A)
for k,v in a.items():
  if v==2:
    two=k
LR=[]
for i in range(N+1):
  if A[i]==two:
    LR.append(i)
L=LR[0]
R=LR[1]
mod=10**9+7
P=[1 for i in range(10**6+1)]
for i in range(10**6):
  P[i+1]=P[i]*(i+1)%mod
L+=1
R+=1
def comb(a,b):
  if a>=b:
    return P[a]*pow(P[a-b],mod-2,mod)*pow(P[b],mod-2,mod)%mod
  else:
    return 0

for i in range(1,N+2):
  print((comb(N+1,i)-comb(N+L-R,i-1))%mod)

Buggy submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
from collections import Counter
two=0
a=Counter(A)
for k,v in a.items():
  if v==2:
    two=k
LR=[]
for i in range(N+1):
  if A[i]==two:
    LR.append(i)
L=LR[0]
R=LR[1]
mod=10**9+7
P=[1 for i in range(10**6+1)]
for i in range(10**6):
  P[i+1]=P[i]*(i+1)%mod
L+=1
R+=1
def comb(a,b):
  if a>=b:
    return P[a]*pow(P[a-b],mod-2,mod)*pow(P[b],mod-2,mod)%mod
  else:
    return 0

for i in range(1,N+2):
  print((comb(N+1,i)-comb(N+L-R,i-1))%mo

Buggy submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
from collections import Counter
two=0
a=Counter(A)
for k,v in a.items():
  if v==2:
    two=k
LR=[]
for i in range(N):
  if A[i]==two:
    LR.append(i)
L=LR[0]
R=LR[1]
mod=10**9+7
P=[1 for i in range(10**6+1)]
for i in range(10**6):
  P[i+1]=P[i]*(i+1)%mod
L+=1
R+=1
def comb(a,b):
  if a>=b:
    return P[a]*pow(P[a-b],mod-2,mod)*pow(P[b],mod-2,mod)%mod
  else:
    return 0

for i in range(1,N+2):
  print(comb(N+1,i)-comb(N+L-R,i-1))
Problem p02614 (python)

Fixed submission:
import itertools

h,w,k=map(int,input().split())
matrix=[]
for i in range(h):
	s=list(input())
	matrix.append(s)
hlist=[]
for i in range(h):
	hlist.append(i)
wlist=[]
for i in range(w):
	wlist.append(i)
rows=[]
cols=[]
for i in range(h+1):
	obj=itertools.combinations(hlist, i)
	rows+=list(obj)
for i in range(w+1):
	obj=itertools.combinations(wlist, i)
	cols+=list(obj)
ans=0
for i in rows:
	for j in cols:
		count=0
		for a in range(h):
			for b in range(w):
				if(matrix[a][b]=='#' and a not in i and b not in j):
					count+=1
		if(count==k):
			ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
h,w,k=map(int,input().split())
matrix=[]
for i in range(h):
	s=list(input())
	matrix.append(s)
hlist=[]
for i in range(h):
	hlist.append(i)
wlist=[]
for i in range(w):
	wlist.append(i)
rows=[]
cols=[]
for i in range(h+1):
	obj=itertools.combinations(hlist, i)
	rows+=list(obj)
for i in range(w+1):
	obj=itertools.combinations(wlist, i)
	cols+=list(obj)
ans=0
for i in rows:
	for j in cols:
		count=0
		for a in range(h):
			for b in range(w):
				if(matrix[a][b]=='#' and a not in i and b not in j):
					count+=1
		if(count==k):
			ans+=1
print(ans)
Problem p03738 (python)

Fixed submission:
a=int(input())
b=int(input())
if a>b:
  print("GREATER");
elif a==b:
  print("EQUAL");
elif a<b:
  print("LESS");

Buggy submission (verdict: Runtime Error):
a=int(input())
b=int(input())
if a>b:
  print("GREATER");
elif a==b:
  print("EQUAL");
else print("LESS");
Problem p02600 (python)

Fixed submission:
n=int(input())

def main():
    if(n<600):
        print(8)
        return
    elif(n<800):
        print(7)
        return
    elif(n<1000):
        print(6)
        return
    elif(n<1200):
        print(5)
        return
    elif(n<1400):
        print(4)
        return
    elif(n<1600):
        print(3)
        return
    elif(n<1800):
        print(2)
        return
    else:
        print(1)
        return
if __name__=="__main__":
    main()

Buggy submission (verdict: Runtime Error):
import itertools
from math import ceil

def main():
    n = int(input())
    ans = 10**9
    u = []
    r = []
    d = []
    l = []
    for _ in range(n):
        k = input().split()
        x,y = int(k[0]),int(k[1])
        if(k[2] == "U"):
            u.append((x,y))
        elif(k[2] == "R"):
            r.append((x,y))
        elif(k[2] == "D"):
            d.append((x,y))
        elif(k[2] == "L"):
            l.append((x,y))

    prd = list(itertools.product(l,r))
    for j in prd:
        one = j[0]
        two = j[1]
        if(one[1] == two[1] and one[0] > two[0]):
            dif = abs(one[0] - two[0])
            if(dif % 2 == 0):
                ans = min(ans,dif//2*10)
            
    prd = list(itertools.product(u,d))
    for j in prd:
        one = j[0]
        two = j[1]
        if(one[0] == two[0] and one[1] < two[1]):
            dif = abs(one[1] - two[1])
            if(dif % 2 == 0):
                ans = min(ans,dif//2 * 10)

    prd = list(itertools.product(u,r))
    for j in prd:
        one = j[0]
        two = j[1]
        if(one[0]-two[0] == two[1]-one[1] and one[0]-two[0] > 0 and one[1] - two[1] < 0):
            ans = min(ans,(one[0]-two[0])*10)

    prd = list(itertools.product(u,l))
    for j in prd:
        one = j[0]
        two = j[1]
        if(-one[0] + two[0] == one[1] - two[1] and one[0]-two[0] < 0 and one[1] - two[1] < 0):
            ans = min(ans,(two[0]-one[0])*10)
    
    prd = list(itertools.product(d,r))
    for j in prd:
        one = j[0]
        two = j[1]
        if(one[0]-two[0] == one[1]-two[1] and one[0]-two[0] > 0 and one[1] - two[1] < 0):
            ans = min(ans,(-two[0] + one[0])*10)

    prd = list(itertools.product(d,l))
    for j in prd:
        one = j[0]
        two = j[1]
        if(two[0]-one[0] == one[1] - two[1] and one[0]-two[0] < 0 and one[1] - two[1] > 0):
            ans = min(ans,(two[0] - one[0])*10)
    if(ans == 10**9):
        print("SAFE")
        return
    else:
        print(ans)
        return

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

Fixed submission:
a = int(input())
print(a+a**2+a**3)

Buggy submission (verdict: Runtime Error):
n,m,k=map(int,input().split())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
ans = 0
while(k>0):
    if(len(a) == 0 or len(b) == 0):
        if(len(a) == 0 and len(b)==0):
            break        
        elif(len(a) == 0):
            if(k >= b[0]):
                k -= b.pop(0)
                ans += 1
            else:
                break
        elif(len(b) == 0):
            if(k >= a[0]):
                k -= a.pop(0)
                ans += 1
            else:
                break
    else:
        if(a[0]>b[0]):
            if(k >= b[0]): 
                k -= b.pop(0)
                ans +=1
            else:
                break
        else:
            if(k >= a[0]):
                k -= a.pop(0)
                ans += 1
            else:
                break
print(ans)
Problem p02642 (python)

Fixed submission:
from collections import defaultdict
n = int(input())
a = list(map(int,input().split()))
a = sorted(list(a))
ma = max(a)

div = defaultdict(bool)
count = 0
for i in range(n):
    b = a[i]
    if div[b]:
        count += 1
    else:
        for j in range(1,ma//b+1):
            div[j*b] = True
        if(i+1<n and a[i] == a[i+1]):
            count += 1

print(n-count)

Buggy submission (verdict: Runtime Error):
from collections import defaultdict
n = int(input())
a = list(map(int,input().split()))
a = sorted(list(a))
ma = max(a)

div = defaultdict(bool)
count = 0
for i in range(n):
    b = a[i]
    if div[b]:
        count += 1
    else:
        for j in range(1,ma//b+1):
            div[j*b] = True
        if(i<n and a[i] == a[i+1]):
            count += 1

if(n == 1):
    print(0)
else:
    print(n-count)
Problem p02647 (python)

Fixed submission:
from math import log2
n,k = map(int,input().split())
a = list(map(int,input().split()))
b = [0]*n

if(k > 10*log2(n) + 1):
    for i in range(n):
        print(n,end=" ")

else:
    for j in range(k):
        b = [0]*n
        for i in range(n):
            l = max(0,i-a[i])
            r = min(n-1,a[i]+i)
            b[l] += 1
            if(r+1<n):
                b[r+1] -= 1
        for i in range(1,n):
            b[i] += b[i-1]
        a = b


    for i in a:
        print(i,end=" ")

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
a = list(map(int,input().split()))
b = [0]*n

if(k > log2(n)):
    for i in range(n):
        print(n,end=" ")

else:
    for j in range(k):
        b = [0]*n
        for i in range(n):
            l = max(0,i-a[i])
            r = min(n-1,a[i]+i)
            b[l] += 1
            if(r+1<n):
                b[r+1] -= 1
        for i in range(1,n):
            b[i] += b[i-1]
        a = b


    for i in a:
        print(i,end=" ")
Problem p02730 (python)

Fixed submission:
S = input()
n = len(S)
isKaibun = True
for i in range(n//2):
    if(S[i] != S[n-i-1] or S[i] != S[n//2-i-1] or S[n//2+i+1] != S[n//2-i-1]):
        isKaibun = False
        break
if(isKaibun):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
S = input()
n = len(S)
isKaibun = True
for i in range(n//2):
    if(S[i] != S[n-i-1] or S[i] != S[n//2-i-1] or S[n//2+i+a1] != S[n//2-i-1]):
        isKaibun = False
        break
if(isKaibun):
    print("Yes")
else:
    print("No")
Problem p02755 (python)

Fixed submission:
import math
A,B = map(int,input().split())
sol1 = math.ceil(A/0.08)
sol2 = math.ceil(B/0.10)
ans = lambda x1,x2 : x1 if x1 == x2 else -1
flagA = True
flagB = True
while True:
    if(sol1 * 0.08 < A and flagA):
        flagA = False
        if(math.floor((sol1+1)*0.10) == B):
            print(sol1+1)
            break
    sol1 -= 1
    if(sol2 * 0.10 < B and flagB):
        flagB = False
        if(math.floor((sol2+1)*0.08) == A):
            print(sol2+1)
            break
    if(not flagA and not flagB):
        print(-1)
        break
    sol2 -= 1

Buggy submission (verdict: Runtime Error):
import sympy

A,B = map(int,input().split())
sympy.var("x")
sol1 = sympy.solve(x*0.08-A,x)
sol2 = sympy.solve(x*0.10-B,x)
ans = lambda x1,x2 : x1 if x1 == x2 else -1
print(int(ans(sol1[0],sol2[0])))
Problem p02899 (python)

Fixed submission:
import numpy as np

N = int(input())
A = [int(i) for i in input().split()]
arr = np.arange(N) 
for i in range(N):
    arr[A[i]-1] = i+1
for i in range(N):   
    print(arr[i],end=" ")

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

N = int(input())
A = [int(i) for i in input().split()]
arr = np.arange(3) 
for i in range(N):
    arr[A[i]-1] = i+1
for i in range(N):   
    print(arr[i],end=" ")
Problem p03085 (python)

Fixed submission:
# coding: utf-8
line = input()
list = ["A","T","G","C"]
if line == list[0]:
    print(list[1])
elif line == list[1]:
    print(list[0])
elif line == list[2]:
    print(list[3])
else:
    print(list[2])

Buggy submission (verdict: Runtime Error):
# coding: utf-8
line = input()
list = ["A","T","G","C"]
if line == list[0]:
    print(list[1])
elif line == list[1]:
    print(list[0])
elif line == list[2]:
    print(list[3])
else:
    print(list[4])
Problem p03103 (python)

Fixed submission:
# coding: utf-8

data = input().split()
shoplist = []
for i in range(int(data[0])):
    shopdata = list(map(int, input().split()))
    shoplist.append(shopdata)
shoplist.sort()

payment = 0
wantdrink = int(data[1])
while wantdrink > 0 :
    restdrink = shoplist[0][1]
    if restdrink >= wantdrink:
        payment += wantdrink * shoplist[0][0]
        break
    else:
        payment += restdrink * shoplist[0][0]
        wantdrink -= restdrink
        del shoplist[0]
print(payment)

Buggy submission (verdict: Runtime Error):
data = line.split(" ")
shoplist = [] #店のデータリスト
for i in range(int(data[0])):
    shop = input()
    shopdata = shop.split(" ")
    shop_int = []
    for j in range(len(shopdata)):
        shop_int.append(int(shopdata[j]))
    shoplist.append(shop_int)

payment = 0 #支払い金額
wantdrink = int(data[1]) #ほしい飲み物の数
pricelist = []  #金額のみのデータリスト
for i in range(len(shoplist)):
    pricelist.append(shoplist[i][0])
while wantdrink > 0 :
    pricemin = min(pricelist[i] for i in range(len(pricelist)))
    min_index = pricelist.index(pricemin)
    restdrink = shoplist[min_index][1]
    if restdrink >= wantdrink:
      while restdrink > 0:
        payment += pricemin
        restdrink -= 1
        wantdrink -= 1
        if wantdrink == 0:
              break
    else:
        payment += restdrink * pricemin
        wantdrink -= restdrink
    del shoplist[min_index]
    del pricelist[min_index]
print(payment)

Buggy submission (verdict: Runtime Error):
data = line.split(" ")
shoplist = [] #店のデータリスト
for i in range(int(data[0])):
    shop = input()
    shopdata = shop.split(" ")
    shop_int = []
    for j in range(len(shopdata)):
        shop_int.append(int(shopdata[j]))
    shoplist.append(shop_int)

payment = 0 #支払い金額
wantdrink = int(data[1]) #ほしい飲み物の数
pricelist = []  #金額のみのデータリスト
for i in range(len(shoplist)):
    pricelist.append(shoplist[i][0])
while wantdrink > 0 :
    pricemin = min(pricelist[i] for i in range(len(pricelist)))
    min_index = pricelist.index(pricemin)
    restdrink = shoplist[min_index][1]
    if restdrink >= wantdrink:
      while restdrink > 0:
        payment += pricemin
        restdrink -= 1
        wantdrink -= 1
        if wantdrink == 0:
              break
    else:
        payment += restdrink * pricemin
        wantdrink -= restdrink
    del shoplist[min_index]
    del pricelist[min_index]
print(payment)
Problem p03206 (python)

Fixed submission:
D = int(input())
if D == 25:
    print("Christmas")
elif D == 24:
    print("Christmas Eve")
elif D == 23:
    print("Christmas Eve Eve")
else:
    print("Christmas Eve Eve Eve")

Buggy submission (verdict: Runtime Error):
N,K = [int(i) for i in input().split()]
H = sorted([int(input()) for i in range(N)])
ans = H[K - 1] - H[0]
for i in range(N - K + 1):
    t = H[K + i - 1] - H[i]
    if ans > t:
        ans = t
print(ans)
Problem p02555 (python)

Fixed submission:
def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p

p = 10 ** 9 + 7
N = 10 ** 5  # N は必要分だけ用意する
fact = [1, 1]  # fact[n] = (n! mod p)
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1]  # factinv 計算用
 
for i in range(2, N + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)


s=int(input())
ans=0
wakeru=0
while s>0:
    s=s-3
    ans=ans+cmb(s+wakeru,wakeru,p)
    wakeru+=1
print(ans%(10**9+7))

Buggy submission (verdict: Runtime Error):
s=int(input())
ans=0
wakeru=0
while s>0:
    s=s-3
    ans=ans+cmb(s+wakeru,wakeru,p)
    wakeru+=1
print(ans%(10**9+7))
Problem p02642 (python)

Fixed submission:
M = int(input())
A=list(map(int,input().split()))
A.sort()
ma=A[-1]
is_prime = [True] * (ma + 1)
for i in A:
    if not is_prime[i]:
        continue
    for j in range(i * 2, ma + 1, i):
        is_prime[j] = False
k=[i for i in range(ma + 1) if is_prime[i]]
N=[]
if len(A)==1:
    print(1)
else:
    if A[0] !=A[1]:
        N.append(A[0])
    for i in range(1,len(A)-1):
        if A[i-1]!=A[i] and A[i]!=A[i+1]:
            N.append(A[i])
    if A[len(A)-2] != A[len(A)-1]:
        N.append(A[len(A)-1])
    s=set(k) & set(N)
    print(len(s))

Buggy submission (verdict: Runtime Error):
M = int(input())
A=list(map(int,input().split()))
A.sort()
ma=A[-1]
is_prime = [True] * (ma + 1)
for i in A:
    if not is_prime[i]:
        continue
    for j in range(i * 2, ma + 1, i):
        is_prime[j] = False
k=[i for i in range(ma + 1) if is_prime[i]]
N=[]
if A[0] !=A[1]:
    N.append(A[0])
for i in range(1,len(A)-1):
    if A[i-1]!=A[i] and A[i]!=A[i+1]:
        N.append(A[i])
if A[len(A)-2] != A[len(A)-1]:
    N.append(A[len(A)-1])
s=set(k) & set(N)
print(len(s))

Buggy submission (verdict: Runtime Error):
M = int(input())
A=list(map(int,input().split()))
A.sort()
ma=A[-1]
is_prime = [True] * (ma + 1)
for i in A:
    if not is_prime[i]:
        continue
    for j in range(i * 2, ma + 1, i):
        is_prime[j] = False
k=[i for i in range(ma + 1) if is_prime[i]]
N=[]
if A[0] !=A[1]:
    N.append(A[0])
for i in range(1,len(A)-1):
    if A[i-1]!=A[i] and A[i]!=A[i+1]:
        N.append(A[i])
if A[-2] != A[-1]:
    N.append(A[-1])
s=set(k) & set(N)
print(len(s))
Problem p02687 (python)

Fixed submission:
s=input()
if s=="ABC":
    print("ARC")
else :
    print("ABC")

Buggy submission (verdict: Runtime Error):
x=int(input())
for i in range(100):
    k=x-i**5
    a=k**0.2
    if type(a)==complex:
        continue
    if a.is_integer():
        break
print(-i,int(a))
Problem p02814 (python)

Fixed submission:
judge=0
N,M = map(int,input().split())
import fractions
a = list(map(int, input().split()))
ans = a[0]
for i in range(1, N):
    ans = ans * a[i] // fractions.gcd(ans, a[i])
for j in a:
    if (ans//j)%2==0:
        judge=1
        sss=0
        break
if judge==0 and M-ans//2 <0:
    sss=0
elif judge==0 and M-ans//2 >=0:
    sss=((M-ans//2)//ans)+1
print(sss)

Buggy submission (verdict: Runtime Error):
#97
judge=0
N,M = map(int,input().split())
import fractions
a = list(map(int, input().split()))
ans = a[0]
for i in range(1, N):
    ans = ans * a[i] // fractions.gcd(ans, a[i])
for i in a:
    if (ans//i)%2==0:
        judge=1
        sss=0
        break
if judge==0 and M-ans//2 <0:
    sss=0
elif judge==0 and M-ans >=0:
    sss=((M-ans//2)//ans)+1
print(sss)
Problem p02899 (python)

Fixed submission:
import numpy as np
n=int(input())
s=list(map(int,input().split()))
x=np.argsort(s)
print(*x+1)

Buggy submission (verdict: Runtime Error):
import numpy as np
n=int(input())
s=list(map(int,input().split()))
x=np.argsort(s)
print(*x+1)
Problem p02900 (python)

Fixed submission:
from itertools import combinations
from fractions import gcd

#coding:utf8
import random

def is_prime3(q,k=50):
    q = abs(q)
    #計算するまでもなく判定できるものははじく
    if q == 2: return True
    if q < 2 or q&1 == 0: return False

    #n-1=2^s*dとし（但しaは整数、dは奇数)、dを求める
    d = (q-1)>>1
    while d&1 == 0:
        d >>= 1
    
    #判定をk回繰り返す
    for i in range(k):
        a = random.randint(1,q-1)
        t = d
        y = pow(a,t,q)
        #[0,s-1]の範囲すべてをチェック
        while t != q-1 and y != 1 and y != q-1: 
            y = pow(y,2,q)
            t <<= 1
        if y != q-1 and t&1 == 0:
            return False
    return True
ans=0

a,b=map(int,input().split())
c=gcd(a,b)
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors
s=make_divisors(c)
for i in s:
    ans=ans+is_prime3(i)
print(ans+1)

Buggy submission (verdict: Runtime Error):
    return pow(2,q-1,q)==1

ans=0

a,b=map(int,input().split())
c=gcd(a,b)
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors
s=make_divisors(c)
print(s)
for i in s:
    ans=ans+is_prime(i)
print(ans+1)

Buggy submission (verdict: Runtime Error):
from itertools import combinations
import math

ans=0
aaa=0

a,b=map(int,input().split())
c=(math.gcd(a,b))
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors
s=make_divisors(c)
#print(s)
for i in s:
    aaa=0
    if i>=3:
        for j in range(2,i):
            #print(i,j)
            if i%j==0:
                aaa=1
                break
            else:
                aab=0
    if aaa==0:
        ans+=1
print(ans)
Problem p02922 (python)

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

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
if a>= b:
  ans=1
else:
  c = b-a
  d=c//a+1
  ans=d+1
print(ans)
Problem p03145 (python)

Fixed submission:
a,b,c=sorted(map(int,input().split()),reverse=False)
print(a*b//2)

Buggy submission (verdict: Runtime Error):
a=map(int,input().split())
print(max(a)-min(a))
Problem p03447 (python)

Fixed submission:
x=int(input())
a=int(input())
b=int(input())
print((x-a)%b)

Buggy submission (verdict: Runtime Error):
x,a,b=map(int,input().split())
print((x-a)%b)
Problem p02603 (python)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
v = []
before = 0
for i in a:
    if i!=before:v.append(i)
    before = i
money = 1000
stack = 0
if len(v) != 1:
    if v[0]<v[1]:
        buy_point = [1]
    else:
        buy_point = [0]
    for i in range(1,len(v)-1):
        if v[i-1]  < v[i] < v[i+1]:
            buy_point.append(2)
        elif v[i-1]  > v[i] > v[i+1]:
            buy_point.append(0)
        elif v[i-1]  < v[i] and v[i] > v[i+1]:
            buy_point.append(-1)
        elif v[i-1]  > v[i] and v[i] < v[i+1]:
            buy_point.append(1)
        else:
            print('error')
    if v[-2] < v[-1]:
        buy_point.append(-1)
    else:
        buy_point.append(0)

    for (i,j) in zip(v,buy_point):
        if j == 1:
            stack += money//i
            money = money%i
        elif j == -1:
            money += stack * i
            stack = 0
        elif j == 2:
            stack += money//i
            money = money%i

print(money)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
v = []
before = 0
for i in a:
    if i!=before:v.append(i)
    before = i
money = 1000
stack = 0
if v[0]<v[1]:
    buy_point = [1]
else:
    buy_point = [0]
for i in range(1,len(v)-1):
    if v[i-1]  < v[i] < v[i+1]:
        buy_point.append(2)
    elif v[i-1]  > v[i] > v[i+1]:
        buy_point.append(0)
    elif v[i-1]  < v[i] and v[i] > v[i+1]:
        buy_point.append(-1)
    elif v[i-1]  > v[i] and v[i] < v[i+1]:
        buy_point.append(1)
    else:
        print('error')
if v[-2] < v[-1]:
    buy_point.append(-1)
else:
    buy_point.append(0)

for (i,j) in zip(v,buy_point):
    if j == 1:
        stack += money//i
        money = money%i
    elif j == -1:
        money += stack * i
        stack = 0
    elif j == 2:
        stack += money//i
        money = money%i
        
print(money)
Problem p02613 (python)

Fixed submission:
count = {'AC':0,'WA':0,'TLE':0,'RE':0}
for i in range(int(input())):
  count[input()] += 1

print(f"AC x {count['AC']}")
print(f"WA x {count['WA']}")
print(f"TLE x {count['TLE']}")
print(f"RE x {count['RE']}")

Buggy submission (verdict: Runtime Error):
cnt = {'AC':0, 'WA':0, 'TLE':0, 'RE':0}
for i in range(int(input()):
               s = input()
               cnt[s] += 1
for i in ['AC','WA','TLE','RE']:
               print(f'{i} x {cnt[i]}'
Problem p02660 (python)

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([i, cnt])
    if temp!=1:
        arr.append([temp, 1])
    if arr==[]:
        arr.append([n, 1])
    return arr
N = int(input())
if N == 1:
  print(0)
  exit()
a = factorization(N)
cnt = 0
for i in a:
  temp = i[1]-1
  d = 2
  while temp>=d:
    temp -= d
    d += 1
  cnt+=d-1
print(cnt)

Buggy 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([i, cnt])
    if temp!=1:
        arr.append([temp, 1])
    if arr==[]:
        arr.append([n, 1])
    return arr
N = int(input())
if a == 1:
  print(0)
  exit()
a = factorization(N)
cnt = 0
for i in a:
  temp = i[1]-1
  d = 2
  while temp>=d:
    temp -= d
    d += 1
  cnt+=d-1
print(cnt)
Problem p02700 (python)

Fixed submission:
import math
def resolve():
    a,b,c,d = map(int,input().split())
    A = math.ceil(c/b)
    B = math.ceil(a/d)
    print('Yes' if A <= B else 'No')
resolve()

Buggy submission (verdict: Runtime Error):
def resolve():
    a,b,c,d = map(int,input().split())
    A = math.ceil(c/b)
    B = math.ceil(a/d)
    print('Yes' if A <= B else 'No')
    
resolve()