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

Fixed submission:
n = int(input())
s = input()
n_s = ""
for i in range(len(s)):
    if ord(s[i])+n > 90:
        n_s+=chr(ord(s[i])+n-26)
    else:
        n_s+=chr(ord(s[i])+n)
    
print(n_s)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()

ans = ""

for x in S
	num=(ord(x) + N)
  	if num >90:
    	num=64+num%90
    ans += chr(num)
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()

ans = ""

for x in range(S)
	num=(ord(x) + N)
  	if num >90:
    	num=64+num%90
    ans += chr(num)
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()

ans = ''

for x in range(S)
	num=(ord(x) + N)
  	if(num >90):
    	num=64+num%90
    ans += chr(num)
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()

ans = ''

for x in range(S)
	num=(ord(x) + N)
  	if(num >90):
    	num=64+num%90
    ans += chr(num)
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()

ans = ""

for x in range(S)
	num=(ord(x) + N)
  	if(num >=90):
    	num=64+num%90
    ans += chr(num)
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()

ans = ''

for x in range(S)
	num=(ord(x) + N)
  	if(num >=90):
    	num=64+num%90
    ans += chr(num)
print(ans)

Buggy submission (verdict: Runtime Error):
N = input()
S = input()

s = ""

for i in range(S):
  s+=S[i+N]
  
  
print(s)
Problem p02886 (python)

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

ans=0
s=sum(l)

for i in range(n):

    ans+=l[i]*(s-l[i])

print(int(ans/2))

Buggy submission (verdict: Runtime Error):
n=int(input())
l=list(map(int(input())))

ans=0
s=sum(l)

for i in range(n):

    ans+=l[i]*(s-l[i])

print(ans/2)
Problem p02898 (python)

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

h = list(map(int,input().split()))
ans=0
for i in range(n):

    if(h[i] >=k):
        ans += 1

print(ans)

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

cnt = 0
for i in h:
    if i >= k:
        cnt+=1

print(cnt)
Problem p02909 (python)

Fixed submission:
S = input()

ans = ""

if S=="Sunny":
	print("Cloudy")
elif S=="Rainy":
	print("Sunny")
else:
	print("Rainy")

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

ans = ""

if(S=="Sunny")
	print("Cloudy")
else if(S=="Rainy")
	print("Sunny")
else
	print("Rainy")

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

ans = ""

if(S="Sunny")
	print("Cloudy")
else if(S="Rainy")
	print("Sunny")
else
	print("Rainy")
Problem p02921 (python)

Fixed submission:
S = input()
T = input()
ans=0
for i in range (3):
	if(S[i] == T[i]):
  		ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
i=0
if b!=1:



    while True:
        if a + (a-1)*i < b:
            i+=1
        else :
            break

print(i)
Problem p02957 (python)

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

if (a+b)%2 == 0:
    print(int((a+b)/2))
else:
    print("IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
a,b = map(int, input().split())

if (a+b)%2 == 0:
    print(int((a+b)/2))
else:
    print("

Buggy submission (verdict: Runtime Error):
a,b = map(int, input().split())

if (a+b)%2 == 0:
    print((a+b)/2)
else
    print("IMPOSSIBLE")
Problem p02969 (python)

Fixed submission:
r = int(input())

print(3*r*r)

Buggy submission (verdict: Runtime Error):
a = int(input())
print(3*r**2)
Problem p02993 (python)

Fixed submission:
S = input()
if S[0]==S[1] or S[1]==S[2] or S[2]==S[3]:
  print("Bad")
else:
  print("Good")

Buggy submission (verdict: Runtime Error):
S = input()
if S[0]==S[1]||S[1]==S[2]||S[2]==S[3]||S[3]==S[4]:
  print("bad")
else:
  print("good")
Problem p03035 (python)

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

if a>=13:
    print(b)
elif 12 >= a >= 6:
    print(b//2)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
if a >=13:
    print(b)
elif 6 <= a <= 12:
    print(b//2)
else:
    print(0)
Problem p03076 (python)

Fixed submission:
A = [int(input()) for i in range(5)]
count=0 
max_i=0
for i in A:
    if i%10!=0:
        max_i = max(max_i,10-i%10)
        count += i//10*10+10
    else:
        count += i
print(count-max_i)

Buggy submission (verdict: Runtime Error):
A = [int(input()) for i in range(5)]
time = 0
l = []
for i in A:
    if i%10 == 0:
        time+=i
    else:
        time+=(i//10+1)*10
        l.append(i%10)

print(time-(10-min(l)))

Buggy submission (verdict: Runtime Error):
A = [int(input()) for i in range(5)]
time = 0
l = []
for i in A:
    if i%10 == 0:
        time+=i
    else:
        time+=(i//10+1)*10
        l.append(i%10)

print(time-(10-min(l)))
Problem p03125 (python)

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

Buggy submission (verdict: Runtime Error):
n,m = list(map(int,input().split()))
n_l = []
for i in range(n):
    l = list(map(int,input().split()))
    for j in range(l[0]):
        n_l.append(l[j+1])
    
cnt = 0
for i in range(1,m+1):
    if n_l.count(i) == n:
        cnt += 1

print(cnt)
Problem p03243 (python)

Fixed submission:
n = int(input())

for i in range(1000):
    if str(n)[0] == str(n)[1] ==str(n)[2]:
        print(n)
        exit()
    else:
        n+=1

Buggy submission (verdict: Runtime Error):
n = input()
n.sort(reverse=True)
print(int(n[0]+n[0]+n[0]))
Problem p03281 (python)

Fixed submission:
n = int(input())

ans = 0
for i in range(1,n+1):
    if i%2 == 0:
        continue
    cnt=0
    for j in range(1,i+1):
        if i%j == 0:
            cnt+=1
        
    if cnt == 8:
        ans+=1

print(ans)

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

if 104 >= n:
    print(0)
else:
    ans = 0
    for i in range(105,n+1):
        if i%2 == 0:
            continue
        cnt=0
        for j in range(1,i+1):
            if i%j == 0:
                cnt+=1
            
        if cnt == 8:
            ans+=1

print(ans)

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

if 104 >= n:
    print(0)
else:
    ans = 0
    for i in range(105,n+1):
        cnt=0
        for j in range(1,i+1):
            if i%j == 0:
                cnt+=1
            
        if cnt == 8:
            ans+=1

print(ans)

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

if 104 >= n:
    print(0)
else:
    ans = 0
    for i in range(105,201):
        cnt=0
        for j in range(1,i+1):
            if i%j == 0:
                cnt+=1
            
        if cnt == 8:
            ans +=1

print(ans)
Problem p03294 (python)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
ans = sum(a)-len(a)
print(ans)

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

ans = 0

for i in range(10000):
    for j in range(n):
        ans += i%a[j]

    max_ans = max(max_ans,ans)

print(max_ans)
Problem p03359 (python)

Fixed submission:
a,b = list(map(int,input().split()))
if a > b:
    print(a-1)
else:
    print(a)

Buggy submission (verdict: Runtime Error):
a,b = list(map(int,input()))
if a < b:
    print(a-1)
else:
    print(a)
Problem p03693 (python)

Fixed submission:
a,b,c = list(input().split())
ans = int(b+c)
if ans%4 == 0:
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
a,b,c = list(input())
ans = int(b+c)
if ans%4 == 0:
  print("YES")
else:
  print("NO")
Problem p03777 (python)

Fixed submission:
a,t = input().split()

if a == "H":
  print(t)
else:
  if t == "D":
    print("H")
  else:
    print("D")

Buggy submission (verdict: Runtime Error):
a,t = input().split()

if a == "H":
  print(b)
else:
  if t == "D":
    print("H")
  else:
    print("D")

Buggy submission (verdict: Runtime Error):
a,t = input().split()

if a == "H":
  print(b)
else:
  if b == "D":
    print("H")
  else:
    print("D")
Problem p03796 (python)

Fixed submission:
n = int(input())
ans = 1
for i in range(1,n+1):
    ans=ans*i%(1e9+7)

print(int(ans))

Buggy submission (verdict: Runtime Error):
n = int(input())
ans = 1
for i in range(1,n+1):
    ans=ans*i%(1e9+7)

print(int(ans)
Problem p02641 (python)

Fixed submission:
x , n = map(int , input().split())
if n == 0:
    print(x)
    exit()
p = list(map(int , input().split()))

ans = x

for i in range(101):
    tmp1 = x - i
    tmp2 = x + i
    if not tmp1 in p:
        ans = tmp1
        break
    elif not tmp2 in p:
        ans = tmp2
        break

print(ans)

Buggy submission (verdict: Runtime Error):
x , n = map(int , input().split())
if n != 0:
    p = list(map(int , input().split()))

ans = x

for i in range(100):
    tmp1 = x - i
    tmp2 = x + i
    if not tmp1 in p:
        ans = tmp1
        break
    elif not tmp2 in p:
        ans = tmp2
        break

print(ans)
Problem p02660 (python)

Fixed submission:
n = int(input())

if n == 1:
    print("0")
    exit()

ans = 0

factor = []
tmp = n
for i in range(2 , int(-(-n**0.5//1))+1):
    if tmp % i == 0:
        cnt = 0
        while tmp % i == 0:
            cnt += 1
            tmp //= i
        factor.append(cnt)

if tmp != 1:
    factor.append(1)
if factor == []:
    factor.append(1)

for i in factor:
    j = 1
    while True:
        i -= j
        if i < 0:
            break
        j += 1
        ans += 1

print(ans)

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

n = int(input())

if n == 1:
    print("0")
    exit()

ans = 0

factor = []
tmp = n
for i in range(2 , int(-(-n**0.5//1))+1):
    if tmp % i == 0:
        cnt = 0
        while tmp % i == 0:
            cnt += 1
            tmp //= i
        factor.append([i , cnt])

if tmp != 1:
    factor.append([tmp , 1])
if factor == []:
    factor.append([n , 1])
        
s = collections.Counter(factor)


s = list(s.values())

for i in s:
    j = 1
    while True:
        i -= j
        if i < 0:
            break
        j += 1
        ans += 1

print(ans)
Problem p03031 (python)

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

k = []
s = []
ans = 0

for _ in range(m):
    a = list(map(int , input().split()))
    k.append(a[0])
    s.append(a[1:])

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

for bit in range(1<<n):
    for i in range(m):
        cnt = 0
        for sw in s[i]:
            if bit & 1<<(sw-1):
                cnt += 1
        if cnt % 2 != p[i]:
            break
    else:
        ans += 1

print(ans)

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

k = []
s = []
ans = 0

for _ in range(m):
    a = list(map(int , input().split()))
    k.append(a[0])
    s.append(a[1:])

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

for bit in range(1<<n):
    for i in range(m):
        cnt = 0
        for sw in s[i]:
            if bit & 1<<(sw-1):
                cnt += 1
        if cnt % 2 != p[i]:
            break
    else:
        res += 1

print(res)
Problem p02631 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
ans=[]
p=0
for i in range(n):
  p=p^a[i]
  
for i in range(n):
  k=p^a[i]
  ans.append(k)
print(*ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
ans=[]
p=a[0]^a[1]^a[2]^a[3]
for i in range(n):
  k=p^a[i]
  ans.append(k)
print(*ans)
Problem p02639 (python)

Fixed submission:
A=[int(_) for _ in input().split()]
B=sum(A)
S=15-B
print(S)

Buggy submission (verdict: Runtime Error):
N=int(input())
A=[int(_) for _ in input().split()]
B=[]
for i in range(N):
  for j in range(N):
    if A[i]%A[j]==0:
      B.append(i)
C=([x for x in set(B) if B.count(x) < 2])
print(len(C))
Problem p02640 (python)

Fixed submission:
X,Y=map(int, input().split())
p=(4*X-Y)/2
q=(Y-2*X)/2
if p==int(p) and q==int(q) and p>=0 and q>=0:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
x,y=map(int,input().split())
ans="No"
if a in range(x+1):
  b=x-a
  a*2+b*4==y:
    ans="Yes"
print(ans)
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())
x=factorization(n)
ans=0

if n==1:
  print(0)
  exit()
for i in range(len(x)):
  p=x[i][1]
  j=1
  while True:
    if p>=j:
      p-=j
      ans+=1
      j+=1
    if p<j:
      break
print(ans)

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())
x=factorization(n)
if n=1:
  print(0)
  exit()
  
ans=0
for i in range(len(x)):
  p=x[i][1]
  j=1
  while True:
    if p>=j:
      p-=j
      ans+=1
      j+=1
    if p<j:
      break
print(ans)
Problem p02647 (python)

Fixed submission:
def count_num_light(a):
  ret = [0 for _ in range(len(a))]
  n = len(a)
  for i in range(n):
    start = max(0, i-a[i])
    end = min(n-1, i+a[i])
    ret[start] += 1
    if end+1 < n:
      ret[end+1] -= 1
  for i in range(1,n):
    ret[i] += ret[i-1]
  
  return ret
                  
n, k = map(int, input().split())
a = list(map(int, input().split()))
num_light = count_num_light(a)
 
for i in range(k-1):
  num_light = count_num_light(num_light)
  if sum(num_light) == n**2:
    break
    
print(*num_light)

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

def count_num_light(a):
  ret = [0 for _ in range(len(a))]
  n = len(a)
  for i in range(n):
    start = max(0, i-a[i])
    end = min(n-1, i+a[i])
    ret[start] += 1
    if end+1 < n:
      ret[end+1] -= 1
  for i in range(1,n):
    ret[i] += ret[i-1]
  
  return ret
                  
n, k = map(int, input().split())
a = list(map(int, input().split()))
num_light = count_num_light(a)
 
for i in range(k-1):
  num_light = count_num_light(num_light)
  if np.all(num_light == n):
    break
    
print(*num_light)

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

def count_num_light(a):
  ret = [0 for _ in range(len(a))]
  n = len(a)
  for i in range(n):
    start = max(0, i-a[i])
    end = min(n-1, i+a[i])
    ret[start] += 1
    if end+1 < n:
      ret[end+1] -= 1
  for i in range(1,n):
    ret[i] += ret[i-1]
  
  return ret
                  
n, k = map(int, input().split())
a = list(map(int, input().split()))
num_light = count_num_light(a)
 
for i in range(k-1):
  num_light = count_num_light(num_light)
  if np.all(num_light, n):
    break
    
print(*num_light)

Buggy submission (verdict: Runtime Error):
def count_num_light(a):
  ret = [0 for _ in range(len(a))]
  for i in range(len(a)):
    start = max(0, i-a[i])
    for j in range(start, i+a[i]+1):
      ret[j] += 1
  
  return ret
                  
n, k = map(int, input().split())
a = list(map(int, input().split()))
num_light = count_num_light(a)

for i in range(k-1):
  num_light = count_num_light(num_light)
  if sum(num_light) == n**2:
    break

print(*num_light)
Problem p02899 (python)

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

ans = [0 for _ in range(n)]
for i in range(n):
  ans[A[i]-1] = i+1

print(*ans)

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

n = int(input())
A = np.array(list(map(int, input().split())))

ans = []
for i in range(n):
  tmpidx = np.argmin(A)
  A[tmpidx] = np.inf
  ans.append(tmpidx+1)

print(*ans)
Problem p03282 (python)

Fixed submission:
s = input()
k = int(input())

tmp = 0
for each in s:
  if int(each) > 1:
    print(each)
    break
  tmp += 1
  if tmp == k:
    print(1)
    break

Buggy submission (verdict: Runtime Error):
s = input()
k = int(input())

tmp = 0
for each in s:
  if each > 1:
    print(each)
    break
  tmp += 1
  if tmp == k:
    print(1)
    break
Problem p03695 (python)

Fixed submission:
def judge_color(n):
  if 1 <= n <= 399:
    return "gray"
  elif 400 <= n <= 799:
    return "brown"
  elif 800 <= n <= 1199:
    return "green"
  elif 1200 <= n <= 1599:
    return "sky"
  elif 1600 <= n <= 1999:
    return "blue"
  elif 2000 <= n <= 2399:
    return "yellow"
  elif 2400 <= n <= 2799:
    return "orange"
  elif 2800 <= n <= 3199:
    return "red"
  else:
    return "free"

n = int(input())
a = list(map(int, input().split()))

d = {}
for each in a:
  color = judge_color(each)
  d[color] = d.get(color, 0) + 1
  
c = d.get("free",0)
l = len(d)
if c == 0:
  print(l, l)
else:
  print(max(l-1,1), l-1+c)

Buggy submission (verdict: Runtime Error):
def judge_color(n):
  if 1 <= n <= 399:
    return "gray"
  elif 400 <= n <= 799:
    return "brown"
  elif 800 <= n <= 1199:
    return "green"
  elif 1200 <= n <= 1599:
    return "sky"
  elif 1600 <= n <= 1999:
    return "blue"
  elif 2000 <= n <= 2399:
    return "yellow"
  elif 2400 <= n <= 2799:
    return "orange"
  elif 2800 <= n <= 3199:
    return "red"
  else:
    return "free"

n = int(input())
a = list(map(int, input().split()))

d = {}
for each in a:
  color = judge_color(each)
  d[color] = d.get(color, 0) + 1
  
c = d.get("free",0)
l = len(d)
if c == 0:
  print(l, l)
else:
  print(max(l-1,1) l-1+c)
Problem p03044 (python)

Fixed submission:
N = int(input())  #頂点数
tree = [[] for _ in range(N)]
dic = {}
for i in range(N-1):
    u, v, w = map(int, input().split())
    if u > v:
        u, v = v, u
    tree[u-1].append(v-1)
    tree[v-1].append(u-1)
    dic[(u-1, v-1)] = w

import sys
sys.setrecursionlimit(10 ** 8)

#black:1, white:0, none:-1
ans = [-1]*N
ans[0] = 0
flag = [False]*N

def dfs(i):
    flag[i] = True
    for j in tree[i]:
        if flag[j]:
            continue
        x = min(i, j)
        y = max(i, j)
        if dic[(x, y)] % 2 == 0:
            ans[j] = ans[i]
        else:
            if ans[i] == 0:
                ans[j] = 1
            else:
                ans[j] = 0
        if not(flag[j]):
            dfs(j)
            
dfs(0)

for answer in ans:
    print(answer)

Buggy submission (verdict: Runtime Error):
N = int(input())  #頂点数
tree = [[] for _ in range(N)]
dic = {}
for i in range(N-1):
    u, v, w = map(int, input().split())
    if u > v:
        u, v = v, u
    tree[u-1].append(v-1)
    tree[v-1].append(u-1)
    dic[(u-1, v-1)] = w

#black:1, white:0, none:-1
ans = [-1]*N
ans[0] = 0
flag = [False]*N

def dfs(i):
    flag[i] = True
    for j in tree[i]:
        if flag[j]:
            continue
        x = i
        y = j
        if x > y:
            x, y = y, x
        if dic[(x, y)] % 2 == 0:
            ans[j] = ans[i]
        else:
            if ans[i] == 0:
                ans[j] = 1
            else:
                ans[j] = 0
        if not(flag[j]):
            dfs(j)
            

dfs(0)

#print(tree)
#print(dic)
#print(flag)
for answer in ans:
    print(answer)

Buggy submission (verdict: Runtime Error):
N = int(input())  #頂点数
tree = [[] for _ in range(N)]
dic = {}
for i in range(N-1):
    u, v, w = map(int, input().split())
    if u > v:
        u, v = v, u
    tree[u-1].append(v-1)
    tree[v-1].append(u-1)
    dic[(u-1, v-1)] = w
ans = [-1]*N
ans[0] = 0
flag = [False]*N
flag[0] = True
#black:1, white:0, none:-1

def dfs(i):
    flag[i] = True
    for j in tree[i]:
        if ans[j] != -1:
            continue
        x = i
        y = j
        if x > y:
            x, y = y, x
        if dic[(x, y)] % 2 == 0:
            if ans[i] == -1:
                ans[i] = 0
            ans[j] = 0
        else:
            if ans[i] == -1:
                ans[i] = 1
            ans[j] = 1
        if not(flag[j]):
            dfs(j)
            

dfs(0)

#print(tree)
#print(dic)
#print(flag)
for answer in ans:
    print(answer)
Problem p03997 (python)

Fixed submission:
a = [int(input()) for i in range(3)]
ans = ((a[0]+a[1]) * a[2]) / 2

print(str(int(ans)))

Buggy submission (verdict: Runtime Error):
h = list(input() for i in range(3))
hand = {'a':h[0], 'b':h[1], 'c':h[2]}   # 各手札
count = {'a':0, 'b':0, 'c':0}   # 捨てた枚数

def who_is_the_winner(ch):
    if ch == 'a':
        winner = 'A'
    elif ch == 'b':
        winner = 'B'
    else:
        winner = 'C'
    return winner

ch = hand['a'][0]
while True:
    if count[ch] == len(hand[ch]):
        winner = who_is_the_winner(ch)
        print(winner)
        break
    count[ch] += 1
    ch = hand[ch][count[ch]-1]

Buggy submission (verdict: Runtime Error):
a = [int(input()) for i in range(4)]
ans = ((a[0]+a[1]) * a[2]) / 2

print(str(ans))
Problem p03998 (python)

Fixed submission:
h = list(input() for i in range(3))
hand = {'a':h[0], 'b':h[1], 'c':h[2]}   # 各手札
count = {'a':0, 'b':0, 'c':0}   # 捨てた枚数

def who_is_the_winner(ch):
    if ch == 'a':
        winner = 'A'
    elif ch == 'b':
        winner = 'B'
    else:
        winner = 'C'
    return winner

ch = 'a'
while True:
    count[ch] += 1
    if count[ch] == len(hand[ch])+1:
        winner = who_is_the_winner(ch)
        print(winner)
        break
    ch = hand[ch][count[ch]-1]

Buggy submission (verdict: Runtime Error):
h = list(input() for i in range(3))
a, b, c = h[0], h[1], h[2]

#nは文字列
n = a
#neはnextで、1文字
ne = 'a'
while True:
    if n == a:
        ne = a[0]
        a[1:]
        if not a:
            print('A')
            break
    elif n == b:
        ne = b[0]
        b[1:]
        if not b:
            print('B')
            break

    else n == c:
        ne = c[0]
        c[1:]
        if not c:
            print('C')
            break

    if ne == 'a':
        n == a
    if ne == 'b':
        n == b
    if ne == 'c':
        n == c
Problem p04030 (python)

Fixed submission:
s = input()
ans = []

for c in s:
    if c == '0' or c == '1':
        ans.append(c)
    else:
        if len(ans) != 0:
            ans.pop()

print(''.join(ans))

Buggy submission (verdict: Runtime Error):
s = input()
ans = []
x = 0

for c in s:
    if c == '0' or c == '1':
        ans.append(c)
    else:
        if len(ans) != 0:
            del ans[x-1]
    x += 1

print(''.join(ans))
Problem p03471 (python)

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

x=0
y=0
z=0

found = False
for i in range(int(total / 10000 + 1)):
  x = i
  for j in range(int((total - 10000 * i) / 5000 + 1)):
    y = j
    z = n - x - y
    sum = 10000 * x + 5000 * y + 1000 * z
    if sum == total:
      found = True
      break

  if found == True:
    break

if found == False:
  x = -1
  y = -1
  z = -1

print("{} {} {}".format(x, y, z))

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

x=0
y=0
z=0

found = False
for i in range(int(total / 10000)):
  x = i
  for j in range(int((total - 10000 * i) / 5000)):
    y = j
    z = n - x - y
    sum = 10000 * x + 5000 * y + 1000 * z
    if sum == total
      found = True
      break

  if found ==  True
    break

if found == False:
  x = -1
  y = -1
  z = -1

print("{} {} {}".format(x, y, z))

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

x=0
y=0
z=0

while True:
  found = False

  while True:
    z = n - x - y
    sum = 10000 * x + 5000 * y + 1000 * z
    if sum == total
      found = True
      break
    elif sum >  total
      break
    y =+ 1

  if found ==  True
    break
  if 10000 * x > total
    x = -1
    y = -1
    z = -1
    break
  x += 1

print("{} {} {}".format(x, y, z))