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

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

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
if (a*b%2):
	printf("Even")
else:
	printf("Odd")
Problem p02621 (python)

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

Buggy submission (verdict: Runtime Error):
a = int(input())
ans = a*(1+a+a*a*)
print(ans)
Problem p02996 (python)

Fixed submission:
N = int(input())
task_list = [list(map(int, input().split())) for i in range(N)]

task_list.sort(key=lambda task_list: task_list[1])
time = 0
flag = True

for i in range(N):
    x = task_list[i]
    time += x[0]
    if time > x[1]:
        flag = False
        break

if flag:
    print("Yes")

else:
    print("No")




#りゅうせいの解答1　実行時エラー、実行時間超過
# N = int(input())
# task_list = [list(map(int,input().split())) for i in range(N)]
#
# task_list.sort(key= lambda task_list: task_list[1])
# time = 0
#
# while(len(task_list)):
#     x = task_list.pop(0)
#     time += x[0]
#     if time > x[1]:
#         print("No")
#         exit(1)
#
#     else:
#         continue
#
# print("Yes")

Buggy submission (verdict: Runtime Error):
N = int(input())
task_list = [list(map(int, input().split())) for i in range(N)]

task_list.sort(key=lambda task_list: task_list[1])
time = 0

for i in range(N):
    x = task_list[i]
    time += x[0]
    if time > x[1]:
        print("No")
        exit(1)

    else:
        continue

print("Yes")




#りゅうせいの解答1　実行時エラー、実行時間超過
# N = int(input())
# task_list = [list(map(int,input().split())) for i in range(N)]
#
# task_list.sort(key= lambda task_list: task_list[1])
# time = 0
#
# while(len(task_list)):
#     x = task_list.pop(0)
#     time += x[0]
#     if time > x[1]:
#         print("No")
#         exit(1)
#
#     else:
#         continue
#
# print("Yes")

Buggy submission (verdict: Runtime Error):
#りゅうせいの解答1 実行時間超過、実行時エラー発生
# N = int(input())
# task_list = [list(map(int,input().split())) for i in range(N)]
#
# task_list.sort(key= lambda task_list: task_list[1])
# time = 0
#
# while(len(task_list)):
#     x = task_list.pop(0)
#     time += x[0]
#     if time > x[1]:
#         print("No")
#         exit(1)
#
#     else:
#         continue
#
# print("Yes")

#りゅうせいの解答2　ソートしない
N = int(input())
task_list = [list(map(int,input().split())) for i in range(N)]

time = 0

while(len(task_list)):
    idx = task_list.index(min(task_list,key = lambda task_list:task_list[1]))
    x = task_list.pop(idx)
    time += x[0]
    if time > x[1]:
        print("No")
        exit(1)

    else:
        continue

print("Yes")

Buggy submission (verdict: Runtime Error):
N = int(input())
task_list = [list(map(int,input().split())) for i in range(N)]

task_list.sort(key= lambda task_list: task_list[1])
time = 0

while(len(task_list)):
    x = task_list.pop(0)
    time += x[0]
    if time > x[1]:
        print("No")
        exit(1)

    else:
        continue

print("Yes")
Problem p02999 (python)

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

if(x < a):
    print(0)
else:
    print(10)

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

# 面積は必ず二等分可能
# 面積を二等分する直線は長方形の中心を通る
ans = '{} {}'.format(
    W * H / 2,
    1 if x == W / 2 and y == H / 2 else
    0
)

# 出力
print(ans)

Buggy submission (verdict: Runtime Error):
import sys

x = sys.argv[1]
a = sys.argv[2]

if(x < a):
    print(0)
else:
    print(10)
Problem p02639 (python)

Fixed submission:
a = list(map(int, input().split()))
for i in range(5):
  if a[i] == 0:
    print(i+1)

Buggy submission (verdict: Runtime Error):
ans = 0
for i in range(5):
	if int(input()) == 0:
		ans = i+1
print(ans)

Buggy submission (verdict: Runtime Error):
ans = 0
for i in range(5):
  a = int(input())
  if a == 0:
    ans = i+1
print(ans)

Buggy submission (verdict: Runtime Error):
ans = 0
for i in range(5):
  if int(input()) == 0:
    ans = i+1
print(ans)
Problem p02640 (python)

Fixed submission:
import sys
X, Y = map(int, input().split())
for i in range(X+1):
  j = X - i
  if 2*i+4*j == Y:
    print('Yes')
    sys.exit()
print('No')

Buggy submission (verdict: Runtime Error):
import sys
X, Y = map(int, input().split())
for i in range(X+1):
  j = X - i
  if 2*i+4*j == Y:
    print('Yes')
    sys.exit()
print('No")
Problem p02658 (python)

Fixed submission:
import sys
N = int(input())
A = list(map(int, input().split()))
A.sort()
res = 1
for a in A:
  res *= a
  if res > 1e18:
    print(-1)
    sys.exit()
print(res)

Buggy submission (verdict: Runtime Error):
import sys
N = int(input())
A = list(map(int, input().split()))
A.sort(reversed=True)
res = 1
for a in A:
  res *= a
  if res > 1e18:
    print(-1)
    sys.exit()
print(res)
Problem p02613 (python)

Fixed submission:
m = int(input())

d = [input() for i in range(m)]

print('AC x ', d.count("AC"))
print('WA x ', d.count("WA"))
print('TLE x ', d.count("TLE"))
print('RE x ', d.count("RE"))

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

d = [input() fot i in range(m)]

print('AC x ', d.count("AC"))
print('WA x ', d.count("WA"))
print('TLE x ', d.count("TLE"))
print('RE x ', d.count("RE"))

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

d = [input() fot i in range(m)]

print("AC x " + d.count("AC"))
print("WA x " + d.count("WA"))
print("TLE x " + d.count("TLE"))
print("RE x " + d.count("RE"))
Problem p04043 (python)

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

if S.count(5) == 2 and S.count(7):
  print("YES")
else:
  print("NO")

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

if S.count(5) == 2 && S.count(7):
  print("YES")
else:
  print("NO")
Problem p02690 (python)

Fixed submission:
import sys

s = int(input())
#print(s)

N=1000
d=[0]*N


for i in range(N):
  d[i]=i**5
  
for i in range(N):
  for j in range(i,N):
    if (d[i] + d[j] == s) :
      print(i,-j)
      sys.exit
    elif (d[i] - d[j] == s):
      print(i,j)
      sys.exit
    elif (d[j] + d[i] == s):
      print(j,-i)
      sys.exit
    elif (d[j] - d[i] == s):
      print(j,i)
      sys.exit

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

N=1000
d=[0]*N


for i in range(N):
  d[i]=i**5
  
for i in range(N):
  for j in range(i,N):
    if (d[i] + d[j] == s) :
      print(i,-j)
      sys.exit
    elif (d[i] - d[j] == s):
      print(i,j)
      sys.exit
    elif (d[j] + d[i] == s):
      print(j,-i)
      sys.exit
    elif (d[j] - d[i] == s):
      print(j,i)
      sys.exit
Problem p02732 (python)

Fixed submission:
from math import factorial

n = int(input())
A = list(map(int,input().split()))
dict = {}

for i,a in enumerate(A):
  if a in dict:
    dict[a].append(i)
  else:
    dict[a]=[i]

ans = 0    
    
for k,v in dict.items():
  if len(v) >= 2:
    ans += len(v) * (len(v)-1) //2
#print(ans)

  
for i in range(n):
  wnum = A[i]
  l=dict[wnum]
#  print('l',l)
  if 2 < len(dict[wnum]):
#    print(ans)
#    print('x',(len(v)-1) * (len(v)-2) // 2 )
#    print('y',len(v) * (len(v)-1) // 2 )
    print(int(ans -(len(l) * (len(l)-1) //2) + (len(l)-1) * (len(l)-2) //2))
  elif 2 == len(dict[wnum]):
    print(int(ans - 1))
  else:
    print(int(ans))

Buggy submission (verdict: Runtime Error):
from math import factorial

n = int(input())
A = list(map(int,input().split()))
dict = {}

for i,a in enumerate(A):
  if a in dict:
    dict[a].append(i)
  else:
    dict[a]=[i]

ans = 0    
    
for k,v in dict.items():
  if len(v) >= 2:
    ans += factorial(len(v)) / 2 / factorial(len(v) - 2)

#print(dict)
#print(int(ans))
#print("kk")
  
for i in range(n):
  wnum = A[i]
  l=dict[wnum]
  if 2 < len(dict[wnum]):
    print(int(ans -(factorial(len(l)) / 2 / factorial(len(l) - 2)) + factorial(len(l)-1) / 2 / factorial(len(l)-1 - 2)))
  elif 2 == len(dict[wnum]):
    print(int(ans - 1))
  else:
    print(int(ans))

Buggy submission (verdict: Runtime Error):
#5
#1 1 2 1 2
from math import factorial

n = int(input())
A = list(map(int,input().split()))
dict = {}

for i,a in enumerate(A):
  if a in dict:
    dict[a].append(i)
  else:
    dict[a]=[i]

ans = 0    
    
for k,v in dict.items():
  if len(v) >= 2:
    ans += factorial(len(v)) / 2 / factorial(len(v) - 2)

#print(dict)
#print(int(ans))
#print("kk")
  
for i in range(n):
  wnum = A[i]
  l=dict[wnum]
  if 2 < len(dict[wnum]):
    print(int(ans -(factorial(len(l)) / 2 / factorial(len(l) - 2)) + factorial(len(l)-1) / 2 / factorial(len(l)-1 - 2)))
  elif 2 == len(dict[wnum]):
    print(int(ans - 1))
  else:
    print(int(ans))
Problem p02756 (python)

Fixed submission:
from collections import deque
s = deque(input())

n = int(input())
l = []

base = 1

for i in range(n):
  l=list(input().split())
  if l[0] == '1':
    base = base *-1
  else:
    if l[1] =='1' and base == 1 :
      s.appendleft(l[2])
    elif l[1] =='2' and base == 1 :
      s.append(l[2])
    elif l[1] =='1' and base == -1 :
      s.append(l[2])
    elif l[1] =='2' and base == -1 :
      s.appendleft(l[2])

if base ==-1:
  s=''.join(list(reversed(s)))
      
print("".join(s))

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

n = int(input())
l = []

base = 1

for i in range(n):
  l=list(input().split())
  if l[0] == '1':
    base = base *-1
  else:
    if l[1] =='1' and base == 1 :
      s = l[2]+s
    elif l[1] =='2' and base == 1 :
      s = s+l[2]
    elif l[1] =='1' and base == -1 :
      s = s+l[2]
    elif l[1] =='2' and base == -1 :
      s = l[2]+s

if base ==-1:
  s=''.join(list(reversed(org_str)))
      
print(s)
Problem p02999 (python)

Fixed submission:
x, a = map(int, input().split())
 
if x < a:
    print(0)
else:
    print(10)

Buggy submission (verdict: Runtime Error):
X,A = map(input().split());

if X<A:
  print(0);
elif X>=A:
  print(10);

Buggy submission (verdict: Runtime Error):
X,A = input();

if X<A:
  print(0);
elif X>=A:
  print(10);

Buggy submission (verdict: Runtime Error):
X = input();
A = input();
 
if X<A:
  print(0);
elif X>=A:
  print(10);

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

if x>a:
  print(0);
else:
  print(10);

Buggy submission (verdict: Runtime Error):
X = int(input());
A = int(input());

if X<A:
  print(0);
elif X>=A:
  print(10);
Problem p02706 (python)

Fixed submission:
import numpy as np
N,M = map(int,input().split())
A = np.array(list(map(int,input().split())))
if (output := N - np.sum(A)) >= 0:
    print(output)
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
import numpy as np
N,M = map(int,input().split())
A = np.array(list(map(int,input().split())))
output = N - np.sum(A)
if output >= 0:
    print(output)
else:
    print(-1)
Problem p03455 (python)

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

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

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

if a*b % 2 == 0:
  print("Even")
else:
  print("Odd")

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

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

Fixed submission:
from collections import Counter
 
a = int(input())
b = [input() for _ in range(a)]
for v in ["AC", "WA", "TLE", "RE"]:
  print(f"{v} x {b.count(v)}")

Buggy submission (verdict: Runtime Error):
from collections import Counter
 
a = int(input())
b = [input() for _ in range(a)]
for v in ["AC", "WA", "TLE", "RE"]:
  print(f"{v} x {s.count(v)}")

Buggy submission (verdict: Runtime Error):
from collections import Counter
 
a = map(int, input())
b = Counter([input() for _ in range(a)])
for k,v in b.items():
  print(f"{k} x {v}")

Buggy submission (verdict: Runtime Error):
from collections import Counter

a = map(int, input().split())
b = Counter([input() for _ in range(a)])
for k,v in b.items():
  print(f"{k} x {v}")
Problem p02660 (python)

Fixed submission:
import math
n = int(input())
a = []
b= []
while n % 2 == 0:
    b.append(2)
    n //= 2
if(len(b)!= 0):
    a.append(b)
    b= [] 
f = 3
while f * f <= n:

    if n % f == 0:
        b.append(f)
        n //= f
    else:
        f += 2
        if(len(b)!= 0):
            a.append(b)
            b= [] 

if(len(b)!= 0):
        a.append(b)
        b= [] 
if(len(a) != 0):
    if(n == a[len(a)-1][0]):
        a[len(a)-1].append(n)
        n  = 1
if (n != 1 ):
    b.append(n)
    a.append(b)

ans =0
for i in range(len(a)):
    ans += int((-1 + math.sqrt(1 + 8 * len(a[i])))/2)

print(ans)

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
a = []
b= []
while n % 2 == 0:
    b.append(2)
    n //= 2
if(len(b)!= 0):
    a.append(b)
    b= [] 
f = 3
while f * f <= n:

    if n % f == 0:
        b.append(f)
        n //= f
    else:
        f += 2
        if(len(b)!= 0):
            a.append(b)
            b= [] 

       
if(len(b)!= 0):
        a.append(b)
        b= [] 
if (n != 1 ):
    if(n == a[len(a)-1][0]):
        a[len(a)-1].append(n)
    else:
        b.append(n)
        a.append(b)

ans =0
for i in range(len(a)):
    ans += int((-1 + math.sqrt(1 + 8 * len(a[i])))/2)

print(ans)
Problem p02732 (python)

Fixed submission:
import math
n = int(input())
a = list(map(int,input().split()))
mx = max(a)
b=[0] * 2000000
ans = 0
for i in range(len(a)):
    b[a[i]-1] += 1

for i in range(mx):
    if(b[i] == 0 or b[i] == 1):
        ans += 0
    else:
        ans = ans + int(b[i] * (b[i]-1)/2)
ans1 = 0


for i in range(len(a)):
    ans1 = ans
    if(b[a[i]-1] >2):
        ans1 = ans1 -int((b[a[i]-1]*(b[a[i]-1]-1))/2) + int(((b[a[i]-1]-1) * (b[a[i]-1]-2))/2)
        print(int(ans1))
    elif(b[a[i]-1] == 2):
        print(int(ans1-1))
    elif(b[a[i]-1] < 2):
        print(int(ans1))

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
a = list(map(int,input().split()))
mx = max(a)
b=[0] * mx
ans = 0
for i in range(n):
    b[a[i]-1] += 1

for i in range(mx):
    if(b[i] == 0 or b[i] == 1):
        ans += 0
    else:
        ans = ans + math.factorial(b[i])/2 / math.factorial(b[i]-2)
ans1 = 0


for i in range(n):
    ans1 = ans
    if(b[a[i]-1] >2):
        ans1 = ans1 -(math.factorial(b[a[i]-1])/2 / math.factorial(b[a[i]-1]-2)) + (math.factorial(b[a[i]-1]-1)/2 / math.factorial(b[a[i]-1]-3))
        print(int(ans1))
    elif(b[a[i]-1] == 2):
        print(int(ans1-1))
    elif(b[a[i]-1] < 2):
        print(int(ans1))

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
a = list(map(int,input().split()))
mx = max(a)
b=[0] * mx
ans = 0
for i in range(n):
    b[a[i]-1] += 1

for i in range(mx):
    if(b[i] == 0 or b[i] == 1):
        ans += 0
    else:
        ans = ans + math.factorial(b[i])/2 / math.factorial(b[i]-2)
ans1 = 0


for i in range(n):
    ans1 = ans -(math.factorial(b[a[i]-1])/2 / math.factorial(b[a[i]-1]-2))
    if(b[a[i]-1]-1 < 2):
        print(int(ans1))
    else:
        ans1 = ans1 + (math.factorial(b[a[i]-1]-1)/2 / math.factorial(b[a[i]-1]-3))
        print(int(ans1))
Problem p02756 (python)

Fixed submission:
from collections import deque

s = list(input())
q = int(input())

mae = deque()
usi = deque()
k = 0
m = 0
for i in range(q):
    a = input().split()
    if(a[0] == '1'):
        k += 1
    if(a[0] == '2'):
        if(k %2 == 0):
            if(a[1] == '1'):
                mae.appendleft(a[2])
            else:
                usi.append(a[2])
        else:
            if(a[1] == '1'):
                usi.append(a[2])
            else:
                mae.appendleft(a[2])
mae = list(mae)
usi = list(usi)

if(k % 2 == 1):
    mae = mae[::-1]
    usi=usi[::-1]
    s = s[::-1]
    s = ''.join(usi+s+mae)
else:
    s = ''.join(mae+s+usi)
print(s)

Buggy submission (verdict: Runtime Error):
import math

s = list(input())
q = int(input())

mae = []
usi = []
k = 0
m = 0
for i in range(q):
    a = input().split()
    if(a[0] == '1'):
        k += 1
    if(a[0] == '2'):
        if(k %2 == 0):
            if(a[1] == '1'):
                mae.appendleft(a[2])
            else:
                usi.append(a[2])
        else:
            if(a[1] == '1'):
                usi.append(a[2])
            else:
                mae.appendleft(a[2])

if(k % 2 == 1):
    mae = mae[::-1]
    usi = usi[::-1]
    s = s[::-1]
    s = ''.join(usi+s+mae)
else:
    s = ''.join(mae+s+usi)
print(s)
Problem p02613 (python)

Fixed submission:
num = int(input())
count = {"AC":0, "WA":0, "TLE":0, "RE":0}
 
for i in range(num):
  word = input()
  for (key , n) in count.items():
    if word == key:
      count[key] += 1
 
for (key , n) in count.items():
  print(key + " x " + str(n))

Buggy submission (verdict: Runtime Error):
num = int(input)
count = {"AC":0, "WA":0, "TLE":0, "RE":0}

for i in range(num):
  word = input()
  for (key , n) in count.items():
    if word == key:
      n += 1
 
for (key , n) in count.items():
  print(key + " × " + str(n))
Problem p03126 (python)

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

ka=[]
ans=0

for i in range(n):
    atmp=list(input().split())
    ka.append(atmp)


like=ka[0][1::]

if n>1:
    for i in range(1,n):
        liketmp=ka[i][1::]
        for k in range(0,len(like)):
            if like[k] not in liketmp:
                     like[k]='0'

for j in range(len(like)):
    if like[j]!='0':
        ans+=1
print(ans)

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

ka=[]
for i in range(n):
    atmp=list(input().split())
    ka.append(atmp)


like=ka[0][1::]
ans=len(like)

if n>1:
    for i in range(1,n):
        liketmp=ka[i][1::]
        for k in range(0,len(like)):
             if like[k] not in liketmp:
                 if ans>0:
                     ans-=1
                     del like[k]
                     if ans==0:
                         break

print(ans)
Problem p03239 (python)

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

C=[]

for i in range(N):
    c,t=map(int,input().split())

    if t<=T:
        C.append(c)

if not C:
    print('TLE')
else:
    print(min(C))

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

C=[]

for i in range(N):
    c,t=map(int,input().split())

    if t<=T:
        C.append(c)

print(min(C))

Buggy submission (verdict: Runtime Error):
N=int(input())
T=int(input())
check=1
ansc=1001

for i in range(N):
    c=int(input())
    t=int(input())

    if t<T and c<ansc:
        ansc=c
        T=t
        check=0

if check==0:
    print(ansc)
else:
    print('TLE')
Problem p03316 (python)

Fixed submission:
n=int(input())
s=0
ntmp=n

for i in range(0,10):
    if ntmp>=10**i:
        s+=int((ntmp%10**(i+1))/10**i)
        ntmp-=ntmp%10**(i+1)
    else:
        break

if n%s:
    print('No')
else:
    print('Yes')

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

for i in range(0,9):
    if ntmp>=10**i:
        s+=int((ntmp%10**(i+1))/10**i)
        ntmp-=ntmp%10**(i+1)
    else:
        break

if n%s:
    print('No')
else:
    print('Yes')
Problem p03486 (python)

Fixed submission:
s=input();t=input()
s=sorted(s)
t=sorted(t)
tnew=[]

for i in range(len(t)-1,-1,-1):
    #print(i)
    tnew.append(t[i])
cnt=0

if len(s)<=len(t):
    L=len(s)
else:
    L=len(t)


for i in range(L):
    if s[i]<tnew[i]:
        print('Yes')
        cnt=1
        break
    if s[i]>tnew[i]:
        print('No')
        cnt=1
        break

if cnt==0:
    if len(tnew)>len(s):
        print('Yes')
    else:
        print('No')

Buggy submission (verdict: Runtime Error):
s=input();t=input()
s=sorted(s)
t=sorted(t)
tnew=[]

for i in range(len(t)-1,-1,-1):
    #print(i)
    tnew.append(t[i])
cnt=0

for i in range(len(s)):
    if s[i]<tnew[i]:
        print('Yes')
        cnt=1
        break
    if s[i]>tnew[i]:
        print('No')
        cnt=1
        break

if cnt==0:
    if len(tnew)>len(s):
        print('Yes')
    else:
        print('No')
Problem p02612 (python)

Fixed submission:
N = input()
M = int(N)
 
def cal(a):
	return a%1000
 
 
if M % 1000==0:
  print(0)
 
 
else:
	print(1000-cal(M))

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

def cal(a):
	return a%1000

 
if M=1000
  print(0)


else:
	print(1000-cal(M))

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

def cal(a):
	return a%1000

 
if M=1000
  print(0)


print(1000-cal(M))
Problem p02675 (python)

Fixed submission:
N= int(input())
 
N1=N%10
 
if N1==2:
	print("hon")
elif N1==4:
	print("hon")
elif N1==5:
	print("hon")
elif N1==7:
	print("hon")
elif N1==9:
	print("hon")
elif N1==0:
	print("pon")
elif N1==1:
	print("pon")
elif N1==6:
	print("pon")
elif N1==8:
	print("pon")
else:
  	print("bon")

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

N1=N%10

if N1=2,4,5,7,9:
	print(hon)
elif N1=0,1,6,8:
	print(pon)
else:
  	print(bon)
Problem p02756 (python)

Fixed submission:
def main():

    S = input()
    Q = int(input())

    reverse = False
    head = ''
    tail = ''

    for _ in range(Q):
        query= input()
        if query == '1':
            reverse = not reverse
            head, tail = tail, head
        else:
            _, f, c = query.split()
            if f == '1':
                head = ''.join([head,c])
            else:
                tail = ''.join([tail,c])

    if reverse:
        S = S[::-1]

    print(''.join([head[::-1], S, tail]))

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
S = input()
Q = int(input())
query_q = [input().split() for _ in range(Q)]

for query in query_q:
    if query[0] == '1':
        S = S[::-1]
    elif query[0] == '2':
        if query[1] == '1':
            S = ''.join([query[2],*S])
        elif query[1] == '2':
            S = ''.join([*S,query[2]])

print(S)
Problem p02900 (python)

Fixed submission:
import fractions

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

a,b=map(int,input().split())
ab_gcd=fractions.gcd(a,b)
div_list=make_divisors(ab_gcd)
prime_list=[]

for i in div_list:
    flg=True
    for j in prime_list:
        if j == 1:
            continue
        if i % j == 0:
            flg = False
            break
    if flg:
        prime_list.append(i)

print(len(prime_list))

Buggy submission (verdict: Runtime Error):
import math

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

a,b=map(int,input().split())
ab_gcd=math.gcd(a,b)
div_list=make_divisors(ab_gcd)
prime_list=[]

for i in div_list:
    flg=True
    for j in prime_list:
        if j == 1:
            continue
        if i % j == 0:
            flg = False
            break
    if flg:
        prime_list.append(i)

print(len(prime_list))

Buggy submission (verdict: Runtime Error):
import math

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

a,b=map(int,input().split())
ab_gcd=math.gcd(a,b)
div_list=make_divisors(ab_gcd)
prime_list=[]

for i in div_list:
    flg=True
    for j in prime_list:
        if j == 1:
            continue
        if i % j == 0:
            flg = False
            break
    if flg:
        prime_list.append(i)

print(len(prime_list))
Problem p02922 (python)

Fixed submission:
import sys
sys.setrecursionlimit(1000000000)

a,b=map(int,input().split()[:2])

i=0
while True:

    if (a*i -i + 1) >=b:
        print(i)
        exit()
    i+=1

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(100000000000)

a,b=map(int,input().split()[:2])

i=1
while True:
    if (a*i -i + 1) >=b:
        print(i)
        exit()
    i+=1
Problem p02924 (python)

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

Buggy submission (verdict: Runtime Error):
import numpy as np
N=int(input())
print(np.sum(np.array(np.arange(N))))

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(1000000000)

N=int(input())
print(sum(list(range(N))))