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

Fixed submission:
from sys import stdin
from collections import deque
sa = deque(list((stdin.readline().rstrip())))
sb = deque(list((stdin.readline().rstrip())))
sc = deque(list((stdin.readline().rstrip())))

next = "a"
for i in range(300):
    if len(sa) == 0 and next == "a":
        print("A")
        break
    if len(sb) == 0 and next == "b":
        print("B")
        break
    if len(sc) == 0 and next == "c":
        print("C")
        break
        
    
    if next == "a":
        next = sa.popleft()
    elif next == "b":
        next = sb.popleft()
    elif next == "c":
        next = sc.popleft()

Buggy submission (verdict: Runtime Error):
from sys import stdin
from collections import deque
sa = deque(list((stdin.readline().rstrip())))
sb = deque(list((stdin.readline().rstrip())))
sc = deque(list((stdin.readline().rstrip())))

next = "a"
for i in range(300):
    if len(sa) == 0 and next == "a":
        print("A")
        break
    if len(sb) == 0 and next == "b":
        print("B")
        break
    if len(sc) == 0 and next == "c":
        print("C")
        break
    if next == "a":
        next = sa.popleft()
    if next == "b":
        next = sb.popleft()
    if next == "c":
        next = sc.popleft()

Buggy submission (verdict: Runtime Error):
from sys import stdin
from collections import deque
sa = deque(list((stdin.readline().rstrip())))
sb = deque(list((stdin.readline().rstrip())))
sc = deque(list((stdin.readline().rstrip())))

next = "a"
for i in range(300):
    if next == "a":
        next = sa.popleft()
    if next == "b":
        next = sb.popleft()
    if next == "c":
        next = sc.popleft()
    if len(sa) == 0 and next == "a":
        print("A")
        break
    if len(sb) == 0 and next == "b":
        print("B")
        break
    if len(sc) == 0 and next == "c":
        print("C")
        break
Problem p04020 (python)

Fixed submission:
from sys import stdin
N = int(stdin.readline().rstrip())
A = []
for i in range(N):
    A.append(int(input()))
    
ans = 0
for i in range(N-1):
    ans += (A[i]//2)
    A[i+1] -= min(A[i+1],A[i]%2)
    ans += min(A[i+1],A[i]%2)
ans += (A[-1]//2)
print(ans)

Buggy submission (verdict: Runtime Error):
from sys import stdin
N = int(stdin.readline().rstrip())
A = []
for i in range(N):
    A.append(int(input()))
    
B = A[:]
    
ans1 = 0

for j in range(N):
    ans1 += (A[j]//2)
    A[j] = (A[j]%2)
    
for k in range(1,N):
    ans1 += min(A[k-1],A[k])
    A[k] = A[k] - min(A[k-1],A[k])
    
ans2 = 0
tmp = min(B[0],B[1])

for l in range(1,N):
    ans2 += min(B[l-1],B[l])
    B[l] = B[l] - min(B[l-1],B[l])
    B[l-1] = B[l-1] - min(B[l-1],B[l])

B[0] -= tmp

for m in range(N):
    ans2 += (B[m]//2)

print(max(ans1,ans2))
Problem p04034 (python)

Fixed submission:
from sys import stdin
N,M = [int(x) for x in stdin.readline().rstrip().split()]
box = [1]*(N+1)
red = [False]*(N+1)
red[1] = True
for _ in range(M):
    x,y = [int(x) for x in stdin.readline().rstrip().split()]
    if red[x]:
        red[y] = True
    box[x] -= 1
    box[y] += 1
    if box[x] == 0:
        red[x] = False
ans = 0
for i in red:
    if i:
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
from sys import stdin
N,M = [int(x) for x in stdin.readline().rstrip().split()]
box = [1]*(N+1)
flag = False
n1_pass = set()
n1_now = 0
for _ in range(M):
    x,y = [int(x) for x in stdin.readline().rstrip().split()]
    box[x] -= 1
    box[y] += 1
    if box[x] == 0:
        n1_pass.remove(x)
    if x == 1 and not flag:
        n1_pass.add(y)
        n1_now = y
        flag = True
    if flag and x == n1_now:
        n1_pass.add(y)
        n1_now = y
ans = 0
for i in n1_pass:
    if box[i] > 0:
        ans += 1
print(ans)
Problem p04043 (python)

Fixed submission:
A,B,C = list(map(int,input().split()))
d = sorted([A,B,C])
if d[0] == 5 and d[1] == 5 and d[2] == 7:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
A,B,C = list(map(int(),input().split()))
d = sorted([A,B,C])
if d[0] == 5 and d[1] == 5 and d[2] == 7:
    print("YES")
else:
    print("NO")
Problem p04044 (python)

Fixed submission:
from sys import stdin
N,L = [int(x) for x in stdin.readline().rstrip().split()]
data = []
for _ in range(N):
    data.append((input()))
print("".join(sorted(data)))

Buggy submission (verdict: Runtime Error):
from sys import stdin
N,L = [int(x) for x in stdin.readline().rstrip().split()]
data = []
for _ in range(N):
    data.append(int(input()))
print("".join(sorted(data)))
Problem p02823 (python)

Fixed submission:
x=[]
N,A,B=map(int,input().split())
if (B-A)%2==0:
    print((B-A)//2)
else:
    c=(A-1)+(B-A+1)//2
    d=(N-B)+(B-A+1)//2
    print(min(c,d))

Buggy submission (verdict: Runtime Error):
N = input()
A = input()
B = input()
if (B-A)%2==1:
  	print(A)
else:
    print((B-A)//2)
Problem p02664 (python)

Fixed submission:
#文字列の入力
S_list = list(input())

for i in range(len(S_list)):
  if(S_list[i] == "?"):
    S_list[i] = "D"
      
print(*S_list, sep="")

Buggy submission (verdict: Runtime Error):
#文字列の入力
S_list = list(input())

#最後の文字はD
if(S_list[len(S_list)-1] == "?"):
  S_list[len(S_list)-1] = "D"
  print("1",S_list)

for i in range(len(S_list)-1):
  if(S_list[i] == "?"):
    if(S_list[i+1] == "D"):
      S_list[i] = "P"
      print("2",S_list)
    elif(S_list[i+1] == "?"):
      S_list[i] = "D"
      S_list[i+1] = "D"
      print("3",S_list)
    else:
      S_list[i] = "D"
      print("4",S_list)

print(*S_list, sep="")
Problem p02700 (python)

Fixed submission:
#スペース区切りの整数の入力
A, B,C,D = map(int, input().split())

ans_a = A
ans_c = C
count_a = 0
count_c = 0

while(ans_a>0):
  ans_a = ans_a - D
  count_a = count_a +1
  #print(count_a,":",ans_a)

while(ans_c>0):
  ans_c = ans_c - B
  count_c = count_c +1
  #print(count_c,":",ans_c)
  
if(count_a>=count_c):
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
#スペース区切りの整数の入力
tairyoku_A, kougeki_B,tairyoku_C,kougeki_D = map(int, input().split())

one = int(tairyoku_A /kougeki_D)
two = int(tairyoku_C /kougeki_B)


if(one>two):
  print("Yes")
elif:
  print("No")
else:
  print("Yes")
Problem p02706 (python)

Fixed submission:
#スペース区切りの整数の入力
N,M = map(int, input().split())
#スペース区切りの整数の入力リスト
A_list = list(map(int, input().split()))

sum_ = 0
for i in range(len(A_list)):
  sum_ = sum_ + A_list[i]
  
  
ans = N - sum_
if(ans>=0):
  print(ans)
else:
  print("-1")

Buggy submission (verdict: Runtime Error):
#スペース区切りの整数の入力
N,M = map(int, input().split())
#スペース区切りの整数の入力リスト
A_list = list(map(int, input().split()))

sum_ = 0
for i in range(len(A_list)):
  sum_ = sum + A_list[i]
  
ans = N - sum_

print(ans)
Problem p02717 (python)

Fixed submission:
#複数の入力
input_list = input().split( )
print(input_list[2],input_list[0],input_list[1])

Buggy submission (verdict: Runtime Error):
#複数の入力
input_list = input().split( )
input_list = input_list.sort()
print(input_list[0],input_list[1],input_list[2])

Buggy submission (verdict: Runtime Error):
#複数の入力
input_list = input().split( )
input_list = input_list.sort
print(input_list[0],input_list[1],input_list[2])
Problem p02719 (python)

Fixed submission:
#スペース区切りの整数の入力
N, K = map(int, input().split())
if(N%K<K-N%K):
    print(N%K)
else:
    print(K-N%K)

Buggy submission (verdict: Runtime Error):
#スペース区切りの整数の入力
N, K = map(int, input().split())
print(min(N%K),K-N%K)

Buggy submission (verdict: Runtime Error):
#スペース区切りの整数の入力
N, K = map(int, input().split())

aa = int(N/K)
ans = N - K*aa
ans_2 = ans - K

if(N<K):
  print(N)
elif(N%K == 0):
  print("0")
elif(ans<ans_2)
  print(ans)
else:
  print(ans_2)
Problem p02730 (python)

Fixed submission:
#文字列の入力
S = input()
#listを一文字ずつのlistに
S_list = list(S)

S_list_reverse = list(reversed(S_list))


#print(S_list_reverse)
#print(S_list)

if(S_list != S_list_reverse):
  print("No")
else:
  S_list_new = S_list
  del S_list_new[int(len(S_list)/2):]
  S_list_new_reverse =  list(reversed(S_list_new))
  if(S_list_new != S_list_new_reverse):
    print("No")
  else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
#文字列の入力
S = input()
#listを一文字ずつのlistに
S_list = list(S)

counter = 0
for i in range(int(len(S_list)/2)):
  if(S_list[i]==S_list[i+int(len(S_list)/2)+1]):
    counter = counter + 1
  else:
    counter = counter
    
if(counter < int(len(S_list)/2)):
    print("NO")
    
counter_ = 0
counter__ = 0
for i in range(int(len(S_list)/4)):
  if(S_list[i]==S_list[i+int(len(S_list)/4)+1]):
    counter_ = counter_ + 1
    if(S_list[i+int(len(S_list)/2)+1]==S_list[i+int(len(S_list)/2)+int(len(S_list)/2)]):
      counter__ = counter__ + 1

if((counter_ = int(len(S_list)/4))and(counter__ = int(len(S_list)/4))):
  print("Yes")

Buggy submission (verdict: Runtime Error):
#文字列の入力
S = input()
#listを一文字ずつのlistに
S_list = list(S)

counter = 0
for i in range(int(len(S_list)/2)):
  #print(i,S_list[i],i+int(len(S_list)/2)+1,S_list[i+int(len(S_list)/2)+1])
  if(S_list[i]==S_list[i+int(len(S_list)/2)+1]):
    counter = counter + 1
  else:
    counter = counter
    
#print(counter,int(len(S_list)/2))
if(counter < int(len(S_list)/2)):
    print("No")
    
for i in range(int(len(S_list)/4)):
  #print(S_list[i],S_list[i+int(len(S_list)/4)+1])
  if(S_list[i]==S_list[i+int(len(S_list)/4)+1]):
    #print((S_list[i+int(len(S_list)/2)+1],S_list[i+int(len(S_list)/2)+int(len(S_list)/2)]))
    if(S_list[i+int(len(S_list)/2)+1]==S_list[i+int(len(S_list)/2)+int(len(S_list)/2)]):
      print("Yes")

Buggy submission (verdict: Runtime Error):
#文字列の入力
S = input()
#listを一文字ずつのlistに
S_list = list(S)

counter = 0
for i in range(int(len(S_list)/2)):
  #print(S_list[i],S_list[i+int(len(S_list)/2)+1])
  if(S_list[i]==S_list[i+int(len(S_list)/2)+1]):
    counter = counter + 1
  else:
    counter = counter
    
#print(counter,int(len(S_list)/2))
if(counter < int(len(S_list)/2)):
    print("NO")
    
for i in range(int(len(S_list)/4)):
  if(S_list[i]==S_list[i+int(len(S_list)/4)+1]):
    #print(S_list[i],S_list[i+int(len(S_list)/4)+1])
    #print((S_list[i+int(len(S_list)/2)+1],S_list[i+int(len(S_list)/2)+int(len(S_list)/2)]))
    if(S_list[i+int(len(S_list)/2)+1]==S_list[i+int(len(S_list)/2)+int(len(S_list)/2)]):
      print("YES")
Problem p02741 (python)

Fixed submission:
#整数の入力
A = int(input())

list_a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

print(list_a[A-1])

Buggy submission (verdict: Runtime Error):
#スペース区切りの整数の入力
A, B, C = map(int, input().split())

A = float(A)
B = float(B)
C = float(C)


A_sq = pow(A, 0.5)
B_sq = pow(B, 0.5)
C_sq = pow(C, 0.5)

if(A_sq+B_sq < C_sq):
  print("Yes")
else:
  print("No")
Problem p02765 (python)

Fixed submission:
N, R = map(int, input().split())
ans = 0

if(N>=10):
  ans = R
else:
  ans = R + 100*(10 - N)

print(ans)

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

if(N>=10):
  ans = R
else:
  ans = R + 100*(10−N)

print(ans)

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

if(N>=10):
  ans = R
else:
  ans = R + 100*(10−K)

print(ans)

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

if(N>=10):
  ans = R
else:
  ans = R + 100×(10−K)

print(ans)
Problem p02772 (python)

Fixed submission:
#整数の入力
N = int(input())

#複数の入力
input_list = input().split( )

counter = 0

for i in range(N):
  if(int(input_list[i])%2==0):
    if((int(input_list[i])%3==0)or(int(input_list[i])%5==0)):
      counter = counter + 1
  else:
    counter = counter + 1
if(counter == N):
  print("APPROVED")
else:
  print("DENIED")

Buggy submission (verdict: Runtime Error):
#整数の入力
N = int(input())

#複数の入力
input_list = input().split( )

for i in range(N):
  if(input_list[i]%2==0):
    if((input_list[i]%3==0)or(input_list[i]%5==0)):
      counter = counter + 1
if(counter == N):
  print("APPROVED")
else:
  print("DENIED")
Problem p02784 (python)

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

for i in (range(len(input_list))):
  input_list[i] = int(input_list[i])

input_sum = sum(input_list)

if(A <= input_sum):
  print("Yes")
else:
  print("No")

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

for i in (range(len(input_list))):
  input_list[i] = int(input_list)

input_sum = sum(input_list)

if(A <= input_sum):
  print("Yes")
else:
  print("No")

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

for i in (range(input_list)):
  input_list[i] = int(input_list)

input_sum = sum(input_list)

if(A <= input_sum):
  print("Yes")
else:
  print("No")

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

input_sum = sum(input_list)

if(A <= input_sum):
  print("Yes")
else:
  print("No")
Problem p02801 (python)

Fixed submission:
C = input()
print(chr(ord(C) + 1))

Buggy submission (verdict: Runtime Error):
C = input()
print chr(ord(C) + 1)
Problem p02812 (python)

Fixed submission:
N = int(input())
S = input()

ans = 0
str_list = list(S)

for i in range (len(str_list)-2):
  if(str_list[i] == "A"):
    if(str_list[i+1] == "B"):
      if(str_list[i+2] == "C"):
        ans += 1

print(ans)

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

ans = 0
str_list = list(S)

for i in range (len(str_list)-2):
  if(str_list[i] == "A"):
    ans = ans
    if(str_list[i+1] == "B"):
      ans = ans
      if(str[i+2] == "C"):
        ans += 1

print(ans)

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

ans = 0
str_list = list(S)

for i in range (len(str_list)-2):
  if(str_list[i] == "A"):
    pass
    if(str_list[i+1] == "B"):
      pass
      if(str[i+2] == "C"):
        ans += 1

print(ans)

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

ans = 0
str_list = list(S)

for i in range (len(str_list)-2):
  if(str_list[i] == "A"):
    if(str_list[i+1] == "B"):
      if(str[i+2] == "C"):
        ans += 1

print(ans)

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

ans = 0
str_list = list(S)

for i in range (len(str_list)-2):
  if(str_list[i] == "A"):
    if(str_list[i+1] == "B"):
      if(str[i+2] == "C"):
        ans += 1

print(ans)

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

ans = 0
str_list = list(S)

for i in range (len(str_list)-2):
  if(str_list[i] == A):
    if(str_list[i+1] == B):
      if(str[i+2] == C):
        ans += 1

print(ans)
Problem p02848 (python)

Fixed submission:
#整数の入力
N = int(input())
#文字列の入力
S = input()
#listを一文字ずつのlistに
S_list = list(S)

ans = ""
for i in range(len(S_list)):
  if(ord(S_list[i])+N<=90):
    #インクリンメント 次の文字を表示
    ans = ans + chr(ord(S_list[i]) + N)
  else:
    a = ord(S_list[i])+N - 90
    #print(a)
    ans = ans + chr(a+64)
  
print(ans)

Buggy submission (verdict: Runtime Error):
#整数の入力
N = int(input())
#文字列の入力
S = input()

#listを一文字ずつのlistに
S_list = list(S)

ans = ""
for i in range(len(S_list)):
  if(N+i<=len(S_list)):
    ans = ans + S_list[N+i]
  else:
    ans = ans + S_list[len(S_list)-N-i]
  
print(ans)

Buggy submission (verdict: Runtime Error):
#整数の入力
N = int(input())
#文字列の入力
S = input()

#listを一文字ずつのlistに
S_list = list(S)

ans = ""
for i in range(len(S_list)):
  ans = ans + S_list[N+i]
  
print(ans)
Problem p02910 (python)

Fixed submission:
#奇数文字目がすべて R, U, D のいずれか。
#偶数文字目がすべて L, U, D のいずれか。

#文字列の入力
S = input()
S_list = []
S_list = list(S)
counter = 0

for i in range(len(S_list)):
  #奇数
  if(i%2 == 0):
    if((S_list[i] == "R")or(S_list[i] == "U")or(S_list[i] == "D")):
      counter = counter + 1
  else:
    if((S_list[i] == "L")or(S_list[i] == "U")or(S_list[i] == "D")):
      counter = counter + 1
      
if(counter == len(S_list)):
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
#奇数文字目がすべて R, U, D のいずれか。
#偶数文字目がすべて L, U, D のいずれか。

#文字列の入力
S = input()
S_list = []
S_list = list(S)
counter = 0

for i in range(len(S_list)):
  #奇数
  if(i%2 == 0):
    if((S_list[i] == "R")or(S_list[i] == "U")or(S_list[i] == "D")):
      counter = counter + 1
  else:
    if((S_list[i] == "L")or(S_list[i] == "U")or(S_list[i] == "D")):
      counter = counter + 1
      
if(counter = len(S_list)):
  print("Yes")
else:
  print("No")
Problem p02608 (python)

Fixed submission:
import sys
from math import ceil, floor, sqrt, sin, cos, pi
from itertools import accumulate, permutations, combinations
from fractions import gcd # 最大公約数
from collections import deque, Counter
from operator import itemgetter
from heapq import heappop,heappush
sys.setrecursionlimit(10**7)
def lcm(x, y): return ((x * y) // gcd(x, y)) # 最小公倍数
# list(map(int, input().split()))

N = int(input())
x = 0
ans = [0 for _ in range(N)]
maxv = ceil(sqrt(N)) + 1
for x in range(1, maxv):
    for y in range(1, maxv):
        for z in range(1, maxv):
            f = x*x + y*y + z*z + x*y + y*z + z*x - 1
            if f > N-1: continue
            ans[f] += 1
for i in range(N):
    print(ans[i])

Buggy submission (verdict: Runtime Error):
import sys
from math import ceil, floor, sqrt, sin, cos, pi
from itertools import accumulate, permutations, combinations
from fractions import gcd # 最大公約数
from collections import deque, Counter
from operator import itemgetter
from heapq import heappop,heappush
sys.setrecursionlimit(10**7)
def lcm(x, y): return ((x * y) // gcd(x, y)) # 最小公倍数
# list(map(int, input().split()))

N = int(input())
x = 0
ans = [0 for _ in range(N)]
maxv = ceil(sqrt(N)) + 1
for x in range(1, maxv):
    for y in range(1, maxv):
        for z in range(1, maxv):
            f = x*x + y*y + z*z + x*y + y*z + z*x - 1
            if f > N: continue
            ans[f] += 1
for i in range(N):
    print(ans[i])
Problem p02630 (python)

Fixed submission:
import sys
from math import ceil, floor, sqrt, sin, cos, pi
from itertools import accumulate, permutations, combinations
from fractions import gcd # 最大公約数
from collections import deque, Counter
from operator import itemgetter
from heapq import heappop,heappush
sys.setrecursionlimit(10**7)
def lcm(x, y): return ((x * y) // gcd(x, y)) # 最小公倍数
# list(map(int, input().split()))

lin = [0 for i in range(10**5+1)]
n = int(input())
a = list(map(int, input().split()))
ans = 0
for x in a:
    ans += x
    lin[x] += 1
q = int(input())
for i in range(q):
    b, c = map(int, input().split())
    ans += (c - b)*lin[b]
    lin[c] += lin[b]
    lin[b] = 0
    print(ans)

Buggy submission (verdict: Runtime Error):
import sys
from math import ceil, floor, sqrt, sin, cos, pi
from itertools import accumulate, permutations, combinations
from fractions import gcd # 最大公約数
from collections import deque, Counter
from operator import itemgetter
from heapq import heappop,heappush
sys.setrecursionlimit(10**7)
def lcm(x, y): return ((x * y) // gcd(x, y)) # 最小公倍数
# list(map(int, input().split()))

lin = [0 for i in range(10**5)]
n = int(input())
a = list(map(int, input().split()))
ans = 0
for x in a:
    ans += x
    lin[x] += 1
q = int(input())
for i in range(q):
    b, c = map(int, input().split())
    ans += (c - b)*lin[b]
    print(ans)
    lin[c] += lin[b]
    lin[b] = 0
Problem p02640 (python)

Fixed submission:
x, y = map(int, input().split())

ans = 'No'
if y % 2 == 0:
    turu = y // 2 - x
    kame = 2*x - y // 2
    if turu >= 0 and kame >= 0:
        ans = 'Yes'
print(ans)

Buggy submission (verdict: Runtime Error):
x, y = map(int, input().split())

if y % 2 == 0:
    turu = y // 2 - x
    kame = 2*x - y // 2
    if turu >= 0 and kame >= 0:
        print('Yes')
        sys.exit()
print('No')
Problem p02747 (python)

Fixed submission:
n = str(input())
ans = 'Yes'
if len(n)%2 == 1:
    ans = 'No'
else:
    for i in range(0, len(n)-1, 2):
        if n[i] != 'h' or n[i + 1] != 'i':
            ans = 'No'

print(ans)

Buggy submission (verdict: Runtime Error):
n = str(input())
ans = 'Yes'
if len(n)%2 == 1:
    ans = No
else:
    for i in range(0, len(n)-1, 2):
        if n[i] != 'h' or n[i + 1] != 'i':
            ans = 'No'

print(ans)
Problem p02761 (python)

Fixed submission:
n, m = map(int, input().split())
ans = []
tmp = True
for i in range(n): ans.append('a')

for i in range(m):
    s, c = map(int, input().split())

    if s < 1 or s > n:
        tmp = False
        break
    if c < 0 or c > 9:
        tmp = False
        break

    if n != 1 and s == 1 and c == 0:
        tmp = False
        break

    if ans[s - 1] == 'a':
        ans[s - 1] = str(c)
    else:
        if ans[s - 1] != str(c):
            tmp = False
            break

if n != 1 and ans[0] == 'a': ans[0] = '1'
for i in range(n):
    if ans[i] == 'a': ans[i] = '0'

if tmp:
    for i in range(n):
        print(ans[i], end='')
    print()
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
ans = []
tmp = True
for i in range(n): ans.append('a')

for i in range(m):
    s, c = map(int, input().split())

    if s == 1 and c == 0:
        tmp = False
        break

    if s > n:
        tmp = False
        break

    if c < 0 or c > 9:
        tmp = False
        break

    if ans[s - 1] == 'a':
        ans[s - 1] = str(c)
    else:
        if ans[s - 1] != str(c):
            tmp = False
            break

if ans[0] == a: ans[0] = '1'
for i in range(n):
    if ans[i] == a: ans[i] = '0'

if tmp:
    for i in range(n):
        print(ans[i], end='')
    print()
else:
    print('-1')
Problem p02899 (python)

Fixed submission:
N = int(input().split()[0])
aa = input().split()
bb = [0]*N

for i in range(0, N):
    bb[int(aa[i]) - 1] = i + 1

print(*bb)

Buggy submission (verdict: Runtime Error):
N = int(input().split()[0])
aa = input().split()
bb = []

for i in range(1, N+1):
    bb.append(aa.index(str(i+1)))

print(*bb)
Problem p02924 (python)

Fixed submission:
n = int(input())
print(n*(n-1)//2)

Buggy submission (verdict: Runtime Error):
n = int(input())
print(floor(n*(n-1)*0.5))
Problem p03000 (python)

Fixed submission:
import sys
from math import ceil, floor, sqrt, sin, cos, pi
from itertools import accumulate, permutations, combinations
from fractions import gcd # 最大公約数
from collections import deque, Counter
from operator import itemgetter
from heapq import heappop,heappush
sys.setrecursionlimit(10**7)
def lcm(x, y): return ((x * y) // gcd(x, y)) # 最小公倍数
# list(map(int, input().split()))
# map(int, input().split())
# int(input())
# input().split()
# mojiretu = ','.join(str_list)
# sorted(input())

n, x = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
now = 0
d = []
d.append(0)
for i in range(len(a)):
    d.append(d[i] + a[i])
for k in d:
    if k <= x:
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
from math import ceil, floor, sqrt, sin, cos, pi
from itertools import accumulate, permutations, combinations
from fractions import gcd # 最大公約数
from collections import deque, Counter
from operator import itemgetter
from heapq import heappop,heappush
sys.setrecursionlimit(10**7)
def lcm(x, y): return ((x * y) // gcd(x, y)) # 最小公倍数
# list(map(int, input().split()))
# map(int, input().split())
# int(input())
# input().split()
# mojiretu = ','.join(str_list)
# sorted(input())

n, x = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
now = 0
while True:
    if now > x:
        print(ans)
        sys.exit()
    now += a[ans]
    ans += 1