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

Fixed submission:
import numpy as np

n=int(input())
E=[]
node_l=np.zeros(n)
node_l[0]=1
for i in range(n-1):
    u,v,w=map(int,input().split())
    #print(u,v,w)
    E.append((u,v,w))
#print(E,W)

def bfs(node,l):
    root=[[] for i in range(n)]
    for a,b,c in l:
        root[a-1]+=[(b-1,c)]
        root[b-1]+=[(a-1,c)]
    stack=[]
    stack.append(node-1)
    #print(root)
    dist=[-1]*n
    dist[node-1]=0
    while stack:
        #print(stack)
        buf=stack.pop(-1)
        for v,weight in root[buf]:
            if dist[v]==-1:
                dist[v]=dist[buf]+weight
                stack.append(v)
    return dist

for i in bfs(1,E):
    print(i%2,end='\n')

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

n,m=map(int,input().split())
E=[]
W=[]
node_l=np.zeros(n)
node_l[0]=1
for i in range(m):
    u,v,w=map(int,input().split())
    #print(u,v,w)
    E.append([u,v])
    W.append(w)
#print(E,W)

def bfs(node,node_l,l,w_l):
    i=0
    A=[]
    L=[]
    for edge in l:
        if edge[0]==node and node_l[edge[1]-1]==0:
            L.append(edge[1])
            A.append(i)
        elif edge[1]==node and node_l[edge[0]-1]==0:
            L.append(edge[0])
            A.append(i)
        i+=1
    if L==[]:
        return
    for j in range(len(L)):
        if W[A[j]]%2==0:
            node_l[L[j]-1]=node_l[node-1]
            bfs(L[j],node_l,l,w_l)
        else:
            node_l[L[j]-1]=node_l[node-1]*-1
            bfs(L[j],node_l,l,w_l)
    return
bfs(1,node_l,E,W)
for i in range(n):
    if node_l[i]==1:
        print('1',end='\n')
    else:
        print('0',end='\n')

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

n=int(input())
E=[]
W=[]
node_l=np.zeros(n)
node_l[0]=1
for i in range(n-1):
    u,v,w=map(int,input().split())
    #print(u,v,w)
    E.append([u,v])
    W.append(w)
#print(E,W)

def bfs(node,node_l,l,w_l):
    i=0
    A=[]
    L=[]
    for edge in l:
        if edge[0]==node:
            L.append(edge[1])
            A.append(i)
        elif edge[1]==node:
            L.append(edge[0])
            A.append(i)
        i+=1
    if L==[]:
        return
    for j in range(len(L)):
        if node_l[L[j]-1]==0:
                if W[A[j]]%2==0:
                    node_l[L[j]-1]=node_l[node-1]
                    bfs(L[j],node_l,l,w_l)
                else:
                    node_l[L[j]-1]=node_l[node-1]*-1
                    bfs(edge[0],node_l,l,w_l)
    return
bfs(1,node_l,E,W)
for i in range(n):
    if node_l[i]==1:
        print('1',end='\n')
    else:
        print('0',end='\n')
Problem p03290 (python)

Fixed submission:
import sys
import math
d,g=map(int,input().split())
p=[]
c=[]
s=[]
count=0
for i in range(d):
    pi,ci=map(int,input().split())
    p.append(pi)
    c.append(ci)
    s.append((i+1)*100*pi+ci)

l=2**d
count=10**6*d
for i in range(l):
    buf=g
    x=0
    n=0
    for j in range(d):
        if i & 1 ==1:
            x+=p[j]
            buf-=s[j]
        else:
            n=j
        i=i>>1
    if buf>=0:
        y=math.ceil(buf/((n+1)*100))
        if y>p[n]:
            continue
        x=x+y
    count=min(count,x)
print(count)

Buggy submission (verdict: Runtime Error):
d,g=map(int,input().split())
p=[]
c=[]
count=0
for i in range(d):
    pi,ci=map(int,input().split())
    p.append(pi)
    c.append(ci)
e=[]
for i in range(d):
    x=p[i]*(i+1)*100+c[i]
    y=x/p[i]
    e.append([y,x,i,p[i]])
e.sort(reverse=True)
for i in range(d):
    if g>=e[0][1]:
        count+=p[e[0][2]]
        g=g-e[0][1]
        aa=e.pop(0)
        #print(aa)
    else:
        break
e.sort(key=lambda x:x[3],reverse=True)
print(count+g//((e[0][2]+1)*100))
Problem p03555 (python)

Fixed submission:
import numpy as np

s=input()
t=input()

print('YES' if s[0]==t[2] and s[1]==t[1] and s[2]==t[0] else 'NO')

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

k=int(input())
a_t=1/k
a=a_t*10**(len(str(k))-1)
c=100
buf=0
index=0
b=a
for i in range(1,10):
        b=b-math.floor(b)
        buf=math.floor(b*10)
        #print(i,buf)
        if c>buf:
                index=i
        c=min(c,buf)
        b=b*10
#print(index)
m=math.ceil(a*10**index)
#print(m)
product=k*m
print(sum(int(i) for i in str(product)))

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

n=int(input())
a=sorted([int(i) for i in input().split()])
b=sorted([int(i) for i in input().split()])
c=sorted([int(i) for i in input().split()])

count=0
index_b=0
index_c=0
for i in range(n):
        index_c=bisect.bisect_left(b,c[i])
        for j in range(index_c):
                count+=bisect.bisect_left(a,b[j])
print(count)
Problem p03557 (python)

Fixed submission:
import numpy as np
import bisect

n=int(input())
a=sorted([int(i) for i in input().split()])
b=sorted([int(i) for i in input().split()])
c=sorted([int(i) for i in input().split()])

count=0
index_b=0
index_c=0
count_b=[0]*(n+1)
for i in range(n):
        count_b[i+1]=bisect.bisect_left(a,b[i])+count_b[i]
for i in range(n):
        count+=count_b[bisect.bisect_left(b,c[i])]
print(count)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**9)
import bisect
import numpy as np
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
a.sort()
b.sort()
c.sort()
count_b=np.zeros(n,dtype=np.int64)
def lower_elements(A, b):
    ''' リストAの要素のうち，b未満のものの個数を返す関数 '''
    lower_bound = -1
    upper_bound = len(A)
    while upper_bound - lower_bound > 1:
        middle = (lower_bound + upper_bound) // 2
        if A[middle] < b:
            lower_bound = middle
        else:
            upper_bound = middle
    return lower_bound + 1
 
 
def upper_elements(C, b):
    ''' リストCの要素のうち，cより大きいものの個数を返す関数 '''
    i = -1
    j = len(C)
    while j - i > 1:
        m = (i + j) // 2
        if C[m] > b:
            j = m
        else:
            i = m
    return len(C) - j

for i in range(n):
    count_b[n-1-i]=upper_elements(c,b[i])
count=np.cumsum(count_b)
ans=0
for i in range(n):
    x=upper_elements(b,a[i])
    if x!=0:
        ans+=count[x-1]
print(ans)
Problem p02789 (python)

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

print("Yes" if N == M else "No")

Buggy submission (verdict: Runtime Error):

n = int(input())

number = [[0]*10 for _ in range(10)]

for _ in range(1, n+1):

    s=str(i)
    i=int(s[0])
    j=int(s[-1])

    number[i][j] += 1

count = 0
for i in range(10):

    for j in range(10):
        count += number[i][j]*number[j][i]

print(count)
Problem p02811 (python)

Fixed submission:
K, X = [int(i) for i in input().split(" ")]

print("Yes" if 500 * K >= X else "No")

Buggy submission (verdict: Runtime Error):
import itertools

N = int(input())

permu = [i+1 for i in range(N)]
s = 0
flag = False

P = tuple([int(i) for i in input().split(" ")])
Q = tuple([int(i) for i in input().split(" ")])

for i, value in enumerate(itertools.permutations(permu)):
    

    if value == P or value == Q:
        # print(i)
        if flag:
            s -= i
        else:
            s += i
            flag = True

print(abs(s))
Problem p02814 (python)

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

a = list(set(map(int, input().split(" "))))
g = a.copy()

while not any(x%2 for x in g): g = [i //2 for i in g]

if not all(x%2 for x in g): print(0); exit(0)

def gcd(a, b):

    while b:

        a, b = b, a % b
    return a

def lcm(a, b):
    return a * b // gcd(a, b)


tot = 1

for x in a: tot = lcm(tot, x//2)
print((M//tot+1)//2)

Buggy submission (verdict: Runtime Error):

import math

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

a = list(set(map(int, input().split(" "))))

# 2で割り切れる回数を求める
def division(value):

    count = 0

    while(value % 2 == 0):

        value = value // 2
        count += 1

    return count

counts = list(map(division, a))

# 2で割り切れる回数が全てのa_Nで等しい場合
if counts.count(counts[0]) == len(counts):

    a = list(map(lambda x: x // 2, a))
    s = a[0]
    for i in range(1, len(a)):
        s = s * a[i] // math.gcd(s, a[i])

    print(math.ceil(M/s/2))

else:
    print(0)

Buggy submission (verdict: Runtime Error):
import math

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

a = list(set(map(int, input().split(" "))))

s = a[0]
for i in range(1, len(a)):
    s = s * a[i] // math.gcd(s, a[i])

if s > M:
    print(0)

else:
    m = s // 2
    print((M-m)//s + 1)

Buggy submission (verdict: Runtime Error):

import math
import fractions

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

a = list(set(map(int, input().split(" "))))

s = a[0]
for i in range(1, len(a)):
    s = s * a[i] // math.gcd(s, a[i])

if s > M:
    print(0)

else:
    m = s // 2
    print((M-m)//s + 1)

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

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

a = list(set(map(int, input().split(" "))))

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

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

s = lcm(*a)

if s > M:
    print(0)

else:
    m = s // 2
    print((M-m)//s + 1)

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

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

a = list(set(map(int, input().split(" "))))

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

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

s = lcm(*a)

if s > M:
    print(0)

else:
    m = s // 2
    print((M-m)//s + 1)

Buggy submission (verdict: Runtime Error):
import sys

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

a = list(set(map(int, input().split(" "))))

s = []
step = 1

def division(a, step):
    flag = True
    for i in a:
        # print(step)
        f = str(step / i).split(".")[1]
        if f != "5":
            flag = False
            break

    # print(step, flag)
    return flag


while(len(s) != 2):

    if step > M:
        print(0)
        sys.exit()

    if division(a, step):
        s.append(step)
    step += 2

print(s)
d = s[1] - s[0]

print(2+(M-s[1])//d)
Problem p02817 (python)

Fixed submission:

S, T = input().strip().split(" ")

print("{}{}".format(T, S))

Buggy submission (verdict: Runtime Error):

N, K = map(int, input().strip().split(" "))
R, S, P = map(int, input().strip().split(" "))
T = list(input())

point = {
    "r": P,
    "s": R,
    "p": S
}

score = 0

for i in range(N):

    tmp = i - K
    if 0 <= tmp and T[i] == T[tmp]:
        score += 0
        T[i]=""

    else:
        score+= point[T[i]]
print(score)

Buggy submission (verdict: Runtime Error):

A, B, K = map(int, input().strip().split(" "))

if A > K:
    A -= K
    K = 0

else:
    K -= A
    A = 0

if B > K:
    B -= K
    K = 0

else:
    B = 0
    
print("{} {}".format(A, B))
Problem p03796 (python)

Fixed submission:
import math
print(math.factorial(int(input()))%int(1e9+7))

Buggy submission (verdict: Runtime Error):
N = int(input())
mod = int(1e9+7)
for j in range(1, N+1):
    prod = j * (prod%mod)
print(prod)

Buggy submission (verdict: Runtime Error):
N = int(input())
prod = 1
for j in range(1, N+1):
	prod *= j
print(prod%(1e9+7))
Problem p03861 (python)

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

Buggy submission (verdict: Runtime Error):
a, b, x = map(int, input().split())
print( ( -(a - a%x) + (b - b%x) )  // x + 1 if a != b else (1 if a%b==0 else 0))
Problem p02772 (python)

Fixed submission:
import sys
n = input().split()
ln = list(map(int, input().split()))
for l in ln:
  if l % 2 == 1:
    continue
  if l % 3 != 0 and l % 5 != 0:
    print("DENIED")
    sys.exit()
print("APPROVED")

Buggy submission (verdict: Runtime Error):
import sys
n = input().split()
ln = list(map(int, input().split()))
for l in ln:
  if l % 2 == 1:
    continue
  if l % 3 != 0 and l % 5 != 0:
    print("DENIED")
    sys.exit(1)
print("APPROVED")
Problem p02802 (python)

Fixed submission:
from collections import OrderedDict
n, m = map(int,input().split())

aclist = [0]*n
walist = [0]*n
ac = 0
wa = 0
for i in range(m):
  pp, s = input().split()
  p = int(pp) - 1
  if s == 'AC' and not aclist[p]:
    aclist[p] = 1
    ac += 1
    wa += walist[p]
  else:
    walist[p] += 1
  

print(ac, wa)

Buggy submission (verdict: Runtime Error):
from collections import OrderedDict
n, m = map(int,input().split())

aclist = [0]*n
walist = [0]*n
acflag = [False]*n

for i in range(m):
  pp, s = input().split()
  p = int(pp)
  if s == 'AC':
    if acflag[p]:
      pass
    else:
      aclist[p] += 1
      acflag[p] = True
  else:
    if acflag[p]:
      pass
    else:
      walist[p] += 1
  

print(sum(aclist), sum(walist))

Buggy submission (verdict: Runtime Error):
from collections import OrderedDict
n, m = map(int,input().split())
a = OrderedDict()

for i in range(m):
  p, s = input().split()
  if a.get(p) == None:
    a[p] = list()
  a[p].append(s)

for k, v in a.items():
  sum += a.find('AC')

print(sum)
Problem p02842 (python)

Fixed submission:
import math
import sys
 
n = int(input())

ln = {}

for m in range(0, 50000):
  ln[(math.floor(m * 1.08))] = m

if n in ln.keys():
  print(ln[n])
else:
  print(':(')

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

n = int(input())

start = math.floor(n // 1.09)
end = math.floor(n // 1.07)

for m in range(start, end):
  ma = math.floor(m * 1.08)
  if ma == n:
    print(m)
    sys.exit(1)

print(':(')

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

n = int(input())

start = math.floor(n // 1.1)

for m in range(start, n):
  ma = math.floor(m * 1.08)
  if ma == n:
    print(m)
    sys.exit(1)

print(':(')
Problem p03493 (python)

Fixed submission:
s = input()
count = 0
for c in s:
  if c == '1':
    count += 1
    
print(count)

Buggy submission (verdict: Runtime Error):
s = input()
count = 0
for c in s:
  if c == '1':
    count++
    
print(count)
Problem p02830 (python)

Fixed submission:
N = int(input())
S, T = input().split()
ST = []
for i in range(N):
    ST.append(S[i])
    ST.append(T[i])
print(''.join(ST))

Buggy submission (verdict: Runtime Error):
N = int(input())
S, T = input().split()
ST = []
for i in range(N):
    ST.append(S[i])
    ST.append(T[i])
print(''.join(ST)
Problem p03076 (python)

Fixed submission:
import numpy as np
dishes = [int(input()) for _ in range(5)]
dishes = sorted(dishes, key=lambda x: x % 10)
minutes = 0
first = True
for i in dishes:
    if i % 10 == 0:
        minutes += i
    else:
        if first:
            minutes += i
            first = False
        else:
            minutes += int(np.ceil(i/10)*10)
print(minutes)

Buggy submission (verdict: Runtime Error):
import numpuy as np
dishes = [int(input()) for _ in range(5)]
dishes = sorted(dishes, key=lambda x: x % 10)
minutes = 0
first = True
for i in dishes:
    if i % 10 == 0:
        minutes += i
    else:
        if first:
            minutes += i
            first = False
        else:
            minutes += int(np.ceil(i/10)*10)
print(minutes)

Buggy submission (verdict: Runtime Error):
dishes = [int(input()) for _ in range(5)]
dishes = sorted(dishes, key=lambda x: x % 10)
minutes = 0
first = True
for i in dishes:
    if i % 10 == 0:
        minutes += i
    else:
        if first:
            minutes += i
            first = False
        else:
            minutes += int(np.ceil(i/10)*10)
print(minutes)
Problem p03292 (python)

Fixed submission:
a = list(map(int, input().split()))
print(abs(max(a) - min(a)))

Buggy submission (verdict: Runtime Error):
A = map(int, input().split())
print(max(A) - min(A))

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

Fixed submission:
n=[input() for _ in range(int(input()))]
m=[input() for _ in range(int(input()))]
l=list(set(n))
print(max(0,max(n.count(l[i])-m.count(l[i]) for i in range(len(l)))))

Buggy submission (verdict: Runtime Error):
n = int(input())
s = [input() for _ in range(n)]
m = int(input())
t = [input() for _ in range(m)]
st = s + t
c = []
maxidx = 0
maxcount = -float('inf')

for i in set(st):
    count = s.count(i) - t.count(i)
    c.append((i, count))
    if count > maxcount:
        maxcount = count
        maxind = st.index(i)
c.append(('zero', 0))
if c[maxind][1] > 0:
    print(c[maxind][1])
else:
    print(c[-1][1])

Buggy submission (verdict: Runtime Error):
n = int(input())
s = [input() for _ in range(n)]
m = int(input())
t = [input() for _ in range(m)]
st = s + t
c = []
maxidx = 0
maxcount = -float('inf')

for i in set(st):
    count = s.count(i) - t.count(i)
    c.append((i, count))
    if count > maxcount:
        maxcount = count
        maxind = st.index(i)
        
if not(len(c) == 0) and (c[maxind][1] > 0):
    print(c[maxind][1])
else:
    print(0)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = [input() for _ in range(n)]
m = int(input())
t = [input() for _ in range(m)]
st = s + t
c = []
maxidx = 0
maxcount = -float('inf')

for i in set(st):
    count = s.count(i) - t.count(i)
    c.append((i, count))
    if count > maxcount:
        maxcount = count
        maxind = st.index(i)
        
if c[maxind][1] > 0:
    print(c[maxind][1])
else:
    print(0)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = [input() for _ in range(n)]
m = int(input())
t = [input() for _ in range(m)]
st = s + t
c = []
maxidx = 0
maxcount = -float('inf')

for i in set(st):
    count = s.count(i) - t.count(i)
    c.append((i, count))
    if count > maxcount:
        maxcount = count
        maxind = st.index(i)
        
if c[maxind][1] >= 0:
    print(c[maxind][1])
else:
    print(0)
Problem p03854 (python)

Fixed submission:
s = input()
s_reverse = ''.join(list(reversed(s)))
t = ''

while True:
    n = len(t)
    if s_reverse == t:
        print('YES')
        break
    if len(s) <= n:
        print('NO')
        break
    if s_reverse[n] == 'm':
        t += ''.join(list(reversed('dream')))
    elif s_reverse[n] == 'e':
        t += ''.join(list(reversed('erase')))
    elif s_reverse[n:n+3] == 'rem':
        t += ''.join(list(reversed('dreamer')))
    elif s_reverse[n:n+3] == 'res':
        t += ''.join(list(reversed('eraser')))
    else:
        print('NO')
        break

Buggy submission (verdict: Runtime Error):
s = input()
s_reverse = ''.join(list(reversed(s)))
t = ''

while True:
    if s_reverse == t:
        print('YES')
        break
    n = len(t)
    if s_reverse[n] == 'm':
        t += ''.join(list(reversed('dream')))
    elif s_reverse[n] == 'e':
        t += ''.join(list(reversed('erase')))
    elif s_reverse[n:n+3] == 'rem':
        t += ''.join(list(reversed('dreamer')))
    elif s_reverse[n:n+3] == 'res':
        t += ''.join(list(reversed('eraser')))
    else:
        print('NO')
        break
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 , b = map(int, input().split())
if a * b % 2 == 0:
print("Even")
else:
  print("Odd")

Buggy submission (verdict: Runtime Error):
int a, b
if (a * b) % 2 = 0:
print("Even")
else  (a * b) % 2 = 1:
print("Odd")
Problem p02817 (python)

Fixed submission:
s,t=input().split()
print(t+s)

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

Buggy submission (verdict: Runtime Error):
s=input().rstrip()
t=input().rstrip()
print(s+t)
Problem p02921 (python)

Fixed submission:
S = list(input())
T = list(input())

i = 0
ans_cnt = 0

while i < len(S):
    if S[i] == T[i]:
        ans_cnt += 1
    i += 1

print(ans_cnt)

Buggy submission (verdict: Runtime Error):
S = list(input())
T = list(input())

i = 0
ans_cnt = 0

while i < len(S):
    i += 1
    if S[i] == T[i]:
        ans_cnt += 1

print(ans_cnt)
Problem p03000 (python)

Fixed submission:
N, X = map(int, input().split())
L = list(map(int, input().split()))

i = 0
D = 0
cnt = 1

for i in range(N):
    D += L[i]
    if D <= X:
        cnt += 1
print(cnt)

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

i = 0
D = 0

if L[0] > X:
    print(1)
    exit()
elif L[0] == X:
    print(2)
    exit()

while D <= X and i <= N:
    D += L[i]
    i += 1

print(i)

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

i = 0
D = 0

if L[0] > X:
    print(1)
    exit()

while D <= X and i <= N:
    D += L[i]
    i += 1

print(i)
Problem p03035 (python)

Fixed submission:
A, B = list(map(int, input().split(" ")))
if A >= 13:
    print(B)
elif 6 <= A <= B:
    print(int(B/2))
else:
    print(0)

Buggy submission (verdict: Runtime Error):
A, B = input().split(" ")
if A >= 13:
    print(B)
elif 6 <= A <= B:
    print(int(B/2))
else:
    print(0)
Problem p03087 (python)

Fixed submission:
n, q = map(int, input().split())
s = input()
ranges = [list(map(int, input().split())) for _ in range(q)]

cnt = 0
cnt_list = []
# インデックスの要素 = インデックスから始まる文字が"AC"
for i in range(n):
    if i < 1:
        cnt_list.append(0)
        continue
    if s[i-1:i+1] == "AC":
        cnt += 1
    cnt_list.append(cnt)

for start, end in ranges:
    print(cnt_list[end-1] - cnt_list[start-1])

Buggy submission (verdict: Runtime Error):
n, q = map(int, input().split())
s = input()
ranges = [list(map(int, input().split())) for _ in range(q)]

cnt = 0
cnt_list = [0]
# インデックスの要素 = インデックスから始まる文字が"AC"
for i in range(n - 1):
    if s[i:i + 2] == "AC":
        cnt += 1
        cnt_list.append(cnt)

for start, end in ranges:
    print(cnt_list[end-1] - cnt_list[start-1])
Problem p03105 (python)

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

if B // A < C:
    print(B // A)
else:
    print(C)

Buggy submission (verdict: Runtime Error):
from collections import deque
s = deque(input())

cnt = 0
i = 1

while i < len(s):
    while len(s) != 0 and s[i - 1] != s[i]:
        s.pop(i)
        s.pop(i - 1)
        i -= 1
        cnt += 2
    i += 1

print(cnt)
Problem p03448 (python)

Fixed submission:
count_500 = int(input())
count_100 = int(input())
count_50 = int(input())
target = int(input())
count = 0

for num_50 in range(0, count_50 + 1):
    total = num_50 * 50
    if total == target:
        count += 1
        continue
    for num_100 in range(0, count_100 + 1):
        total_2 = num_50 * 50 + num_100 * 100
        if total_2 == target:
            count += 1
            continue
        for num_500 in range(0, count_500+1):
            total_3 = num_50 * 50 + num_100 * 100 + num_500 * 500
            if total_3 == target:
                count += 1
                continue
print(count)

Buggy submission (verdict: Runtime Error):
count_50 = int(inpiut())
count_100 = int(inpiut())
count_500 = int(inpiut())
target = int(input())
count = 0

for num_50 in range(0, count_50 + 1):
    total = num_50 * 50
    if total == target:
        count += 1
        continue
    for num_100 in range(0, count_100 + 1):
        total_2 = num_50 * 50 + num_100 * 100
        if total_2 == target:
            count += 1
            continue
        for num_500 in range(0, count_500+1):
            total_3 = num_50 * 50 + num_100 * 100 + num_500 * 500
            if total_3 == target:
                count += 1
                continue
print(count)
Problem p03545 (python)

Fixed submission:
a, b, c, d = list(input())

operators = ["+", "-"]

for op1 in operators:
    for op2 in operators:
        for op3 in operators:
            equation = a+op1+b+op2+c+op3+d
            if eval(equation) == 7:
                print(equation+"=7")
                exit()

Buggy submission (verdict: Runtime Error):
from typing import *

a, b, c, d = list(input())

operators = ["+", "-"]

for op1 in operators:
    for op2 in operators:
        for op3 in operators:
            equation = a+op1+b+op2+c+op3+d
            if eval(equation) == 7:
                print(equation+"=7")
                exit()

Buggy submission (verdict: Runtime Error):
a, b, c, d = input().split()

operators = ["+", "-"]

for op1 in operators:
    for op2 in operators:
        for op3 in operators:
            equation = a+op1+b+op2+c+op3+d
            if eval(equation) == 7:
                print(equation+"=7")
                exit()