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

Fixed submission:
n = int(input())
l0 = 2
l1 = 1
if n == 0:
    print(l0)
elif n == 1:
    print(l1)
elif n>= 2:
    ll = [l0, l1] + [0 for _ in range(n-1)]
    for i in range(2,n+1):
        ll[i] = ll[i-1] + ll[i-2]
    print(ll[n])

Buggy submission (verdict: Runtime Error):
n = int(input())
l0 = 2
l1 = 1
if n == 0:
    print(l0)
elif n == 1:
    print(l1)
elif n>= 2:
    ll = [l0, l1] + [0 for _ in range(n-1)]
    for i in range(2,n+1):
        ll[i] = ll[i-1] + ll[i-2]

print(ll[n])
Problem p03624 (python)

Fixed submission:
s = input()
ll = [i for i in range(97,123,1)]
for j in s:
    s_num = ord(j)
    if s_num in ll:
        ll.remove(s_num)
    else:
        pass
if len(ll) != 0:
    print(chr(ll[0]))
else:
    print("None")

Buggy submission (verdict: Runtime Error):
s = input()
ll = [i for i in range(97,123,1)]
for j in s:
    s_num = ord(j)
    if s_num in ll:
        ll.remove(s_num)
    else:
        pass
print(chr(ll[0]))
Problem p03680 (python)

Fixed submission:
n = int(input())
al = [int(input()) for i in range(n)]

i = 0
for j in range(n):
    i = al[i]-1
    if i == 1:
        print(j+1)
        exit()
print(-1)

Buggy submission (verdict: Runtime Error):
n = int(input())
al = [0 for _ in range(n)]
for i in range(n):
    al[i] = int(input())

def check(al,bl,i):
    bl.append(i)
    i = al[i]-1
    if len(bl) == len(al):
        print(-1)
    elif i in bl:
        print(-1)
    elif i == 1:
        print(len(bl))
    else:
        check(al,bl,i)

bl = []
check(al,bl,0)

Buggy submission (verdict: Runtime Error):
n = int(input())
al = [0 for _ in range(n)]
for i in range(n):
    al[i] = int(input())

def check(al,bl,i):
    bl.append(i)
    i = al[i]-1
    if i in bl:
        print(-1)
    elif i == 1:
        print(len(bl))
    else:
        check(al,bl,i)

bl = []
check(al,bl,0)

Buggy submission (verdict: Runtime Error):
n = int(input())
al = [0 for _ in range(n)]
for i in range(n):
    al[i] = int(input())

def check(al,bl,i):
    bl.append(i)
    i = al[i]-1
    if i in bl:
        print("-1")
    elif i == 1:
        print(len(bl))
    else:
        check(al,bl,i)

bl = []
check(al,bl,0)
Problem p03720 (python)

Fixed submission:
n, m = map(int, input().split())
ll = [[0]] + [ [] for _ in range(n)]
for i in range(m):
    a, b = map(int, input().split())
    ll[a].append(b)
    ll[b].append(a)
for l in ll[1:]:
    print(len(l))

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
ll = [0] + [ 0 * n]
for i in range(m):
    a, b = map(int, input().split())
    ll[a] += 1
    ll[b] += 1
for l in ll[1:]:
    print()
Problem p02971 (python)

Fixed submission:
n = int(input())
ls = [int(input()) for _ in range(n)]
ls_sort = sorted(ls,reverse=True)

for i in range(n):
    if ls[i] == ls_sort[0]:
        print(ls_sort[1])
    else:
        print(ls_sort[0])

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

n = int(input())
ls = [int(input()) for _ in range(n)]
p = 50
ans = 0
if n>p:p=n

def cul(n, x):
    l = len(x)
    b = [x[i] for i in range(l)]
    b.pop(n)
    return max(b)
    
for i in range(p):
    s = cul(i,ls[:p])
    print(s)
Problem p03030 (python)

Fixed submission:
n = int(input())
ls = []
for i in range(1,n+1):
    s,p = input().split()
    ls.append([i,s,int(p)])
ls.sort(key=lambda x:(x[1], -x[2]))
for j in range(len(ls)):
    print(ls[j][0])

Buggy submission (verdict: Runtime Error):
n = iint(input())
ls = []
for i in range(1,n+1):
  s,p = input().split()
  ls.append([i,s,int(p)])
ls.sort(key=lambda x:(x[1], x[2]))
for j in range(len(ls)):
  print(ls[j][0])
Problem p03031 (python)

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

s = [[int(j) for j in input().split()][1:] for i in range(m)]
p = [int(i) for i in input().split()]

ans = 0

for i in range(2**n):
    b = array([(i>>j)&1 for j in range(n)])
    if [sum(b[array(k)-1]) % 2 for k in s] == p:
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
s = [[int(x) for x in input().split()][1:] for y in range(m)]
p = [int(z) for z in input().split()]
ans = 0

for i in range(2**n):
    b = array([(i>>j)&1 for j in range(n)])
    if [sum(b[array(k) - 1]) % 2 for k in s] == p:
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
s = [[int(x) for x in input().split()][1:] for y in range(m)]
p = [int(z) for z in range(m)]
ans = 0

for i in range(2**n):
    b = array([(i>>j)&1 for j in range(n)])
    if [sum(array(k) - 1) % 2 for k in s] == p:
        ans += 1
print(ans)

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

s = [[int(j) for j in input().split()][1:] for i in range(m)]
p = [int(i) for i in input().split()]

ans = 0

for i in range(2**n):
    b = array([(i >> j)&1 for j in range(n)])
    if [sum(b[array(k) - 1] % 2 for k in s)] == p:
        ans += 1
print(ans)
Problem p03037 (python)

Fixed submission:
n,m = map(int, input().split())
ans = 0
L = 1
R = n
for i in range(m):
    l,r = map(int, input().split())
    L = max(l,L)
    R = min(r,R)
    
if L <= R:
    print(R-L+1)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
import numpy as np
n,m = map(int, input().split())
ls = []
for i in range(m):
    l,r = map(int, input().split())
    tmp = list(range(l,r+1))
    ls.append(tmp)
binary = [0] * n
ls = [flatten for inner in ls for flatten in inner]
for i in ls:
    binary[i] += 1
print(binary.count(m))

Buggy submission (verdict: Runtime Error):
import numpy as np
n,m = map(int, input().split())
ls = []
for i in range(m):
    l,r = map(int, input().split())
    tmp = list(range(l,r+1))
    ls.append(tmp)
binary = [0] * n

for i in ls:
    for j in i:
        binary[j] += 1
print(binary.count(m))

Buggy submission (verdict: Runtime Error):
import numpy as np
n,m = map(int, input().split())
ls = []
for i in range(m):
    l,r = map(int, input().split())
    tmp = list(range(l,r+1))
    ls.append(tmp)

print(ls)

binary = [0] * n

for i in ls:
    for j in i:
        binary[j] += 1
print(binary.count(m))
Problem p03061 (python)

Fixed submission:
import fractions

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

l = [0]
r = [0]
for i in range(n):
    l.append(fractions.gcd(l[i], a[i]))
    r.append(fractions.gcd(r[i], a[-(i+1)]))
    
m = [fractions.gcd(l[i], r[-(i+2)]) for i in range(n)]
print(max(m))

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

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

n = int(input())
ls = list(map(int, input().split()))
ls_com = itertools.combinations(ls, n-1)
ans = 0

for i in ls_com:
    ans = max(gcd_list(i),ans)
print(ans)
Problem p03076 (python)

Fixed submission:
n =  [int(input()) for x in range(5)]
minNum = 10
array = 0
for i in range(len(n)):
    num = n[i] % 10
    if((num <= minNum) and (num != 0)):
        minNum = num
        array = i
        
numList = []
a = n[array]
n[array] = 0

for x in n:
    k = ((x + 9) // 10) * 10
    numList.append(k)  
print(sum(numList) + a)

Buggy submission (verdict: Runtime Error):
ls = [int(input()) for i in range(5)]
ans = []
num = 0
minNum = 10
    
for j in ls:
    x = j % 10
    if x < minNum and x > 0:
        num = j
        minNum = x
ans.append(num)
ls.pop(ls.index(num))

for i in ls:
    y = ((i + 9) // 10) * 10
    ans.append(y)

print(sum(ans))

Buggy submission (verdict: Runtime Error):
ls = [int(input()) for i in range(5)]
ans = []
num = 0
minNum = 10
    
for j in ls:
    x = j % 10
    if x < minNum and x != 0:
        num = j
        minNum = x
ans.append(num)
ls.pop(ls.index(num))

for i in ls:
    y = ((i + 9) // 10) * 10
    ans.append(y)


print(sum(ans))

Buggy submission (verdict: Runtime Error):
n = [int(input()) for _ in range(5)]
minNum = 9
x = 0
for i in n:
    if i % 10 < minNum and i % 10 != 0:
        minNum = i % 10
        x = i
n.pop(n.index(x))
total = x
for j in n:
    total += ((j + 9) // 10) * 10
print(total)

Buggy submission (verdict: Runtime Error):
n = [int(input()) for _ in range(5)]
minNum = 9
x = 0
for i in n:
    if i % 10 < minNum and i % 10 != 0:
        minNum = i % 10
        x = i
n.pop(n.index(x))
total = x
print(total)
for j in n:
    total += ((j + 9) // 10) * 10
print(total)

Buggy submission (verdict: Runtime Error):
n = []
n[0] = int(input())
n[1] = int(input())
n[2] = int(input())
n[3] = int(input())
n[4] = int(input())

minNum = 10
array = 0
for i in range(len(n)):
	num = n[i] % 10
	if(num <= minNum):
		minNum = num
		array = i

arraySum = []
for j in n:
	k = ((j + 9) // 10) * 10
	arraySum.append(k)
	
print(sum(arraySum) + n[array])
Problem p03087 (python)

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

t = [0] * (n +1)
for i in range(n):
    t[i+1] = t[i] + (1if s[i:i+2] == "AC" else 0)
    
for i in range(q):
    l,r = map(int, input().split())
    print(t[r-1] - t[l-1])

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

t = [0] * n +1
for i in range(n):
    t[i+1] = t[i] + (1if s[i:i+2] == "AC" else 0)
    
for i in range(q):
    l,r = map(int, input().split())
    print(t[r-1] - t[l-1])

Buggy submission (verdict: Runtime Error):
n,q = map(int, input().split())
s = input()
flag = False
cnt = 0
dp = []
for i in range(len(s)):
    if s[i] == "A":
        flag = True
        dp.append(cnt)
        continue
    if s[i] == "C" and flag:
        cnt += 1
        dp.append(cnt)
        flag = False
for i in range(q):
    l,r = map(int, input().split())
    print(max(dp[l:r]) - dp[l-1])
Problem p03125 (python)

Fixed submission:
A,B=(int(x) for x in input().split())
if(B % A == 0):
  print(A + B)
else:
  print(B - A)

Buggy submission (verdict: Runtime Error):
A,B = int(input().split())
if(B % A == 0):
  print(A + B)
else:
  print(B - A)
Problem p03145 (python)

Fixed submission:
a,b,c = [int(i) for i in input().split()]
print(a * b // 2)

Buggy submission (verdict: Runtime Error):
a,b,c = [int(i) for i in input().split()]
print((a * b) / 2))
Problem p03196 (python)

Fixed submission:
import sys
n, p = map(int, input().split())

if n == 1:
    print(p)
    sys.exit()
# 素因数分解
ls = {}
for i in range(2, int(p**0.5) + 1):
    while p % i == 0:
        ls[i] = ls.get(i, 0) + 1
        p //= i
if p > 1:
    ls[p] = 1
ans = 1

for key, value in ls.items():
    while value >= n:
        ans *= key
        value -= n
print(ans)

Buggy submission (verdict: Runtime Error):
import sympy

n, p = map(int, input().split())
ls = sympy.factorint(p)
maxNum = 0
ans = 1

for key, value in ls.items():
    if value >= n:
        ans *= key
print(ans)
Problem p03206 (python)

Fixed submission:
D = int(input())
eve = "Eve " * (25 - D)
print("Christmas " + str(eve))

Buggy submission (verdict: Runtime Error):
D = int(input)
eve = "Eve" * (25 - D)
print("Christmas" + str(eve))

Buggy submission (verdict: Runtime Error):
D = int(input)
eve = Eve * (25 - D)
print("Christmas" + str(eve))
Problem p03212 (python)

Fixed submission:
N = int(input())

def dfs(s): 
    if int(s) > N:
        return 0
    ret = 1 if all(s.count(c) > 0 for c in '753') else 0
    for c in '753':
        ret += dfs(s + c)
    return ret

print(dfs('0'))

Buggy submission (verdict: Runtime Error):
n = int(input())
def dfs(cur, a, b, c):
    if cur == n:
        return 0
    ret = 1 if all(s.count(c)) > 0 for c in "753") else 0
    for i in "753":
        ret += dfs(s+c)
    return ret
print(dfs("0"))
Problem p03238 (python)

Fixed submission:
N = int(input())
if(N == 1):
  print("Hello World")
else:
  a = int(input())
  b = int(input())
  print(a + b)

Buggy submission (verdict: Runtime Error):
N = int(input())
if(N == 1):
  print("Hello World")
else:
  a,b = [int(i) for i in input().split()]
  print(a + b)
Problem p03240 (python)

Fixed submission:
import sys
n = int(input())
xyh = [list(map(int, input().split())) for i in range(n)]
xyh.sort(key=lambda x: -x[2])
for cx in range(101):
    for cy in range(101):
        good = True
        h = xyh[0][2]+abs(cx-xyh[0][0])+abs(cy-xyh[0][1])
        for i in range(n):
            if xyh[i][2] != max(h-abs(cx-xyh[i][0])-abs(cy-xyh[i][1]), 0):
                good = False
                break
        if good:
            print(cx, cy, h)
            sys.exit()

Buggy submission (verdict: Runtime Error):
n = int(input())
xyh = [list(map(int, input().split())) for i in range(n)]
xyh.sort(key=lambda x: -x[2])
for cx in range(101):
    for cy in range(101):
        good = True
        h = xyh[0][2]+abs(cx-xyh[0][0])+abs(cy-xyh[0][1])
        for i in range(n):
            if xyh[i][2] != max(h-abs(cx-xyh[i][0])-abs(cy-xyh[i][1]), 0):
                good = False
                break
        if good:
            print(cx, cy, h)
            sys.exit()
Problem p03243 (python)

Fixed submission:
n = input()
for i in range(1,10):
    N = str(i) + str(i) + str(i)
    if n <= N:
        print(N)
        break

Buggy submission (verdict: Runtime Error):
n = input()
if n[0]*3 == n:
    print(n)
elif int(n[0]) > int(n[1]) and int(n[0]) > int(n[3]):
    print(n[0] * 3)
else:
    print(str(int(n[0]) +1) * 3)
Problem p03251 (python)

Fixed submission:
N,M,X,Y = map(int, input().split())
x = [int(_) for _ in input().split()]
y = list(map(int, input().split()))
maxX = max(x)
minY = min(y)
flag = True
for i in range(Y+1):
    if X < i <= Y and maxX < i and minY >= i:
        print("No War")
        flag = False
        break
if flag:
    print("War")

Buggy submission (verdict: Runtime Error):
N,M,X,Y = map(int, input().split())
x = [int(_) for _ in input().split()]
y = list(map(int, input().split()))
maxX = max(x)
minY = min(y)

print(maxX,maxY)
for i in range(Y+1):
    if X < i <= Y and maxX < i and minY >= i:
        print("No War")
        break
    elif i == Y:
        print("War")
        break
Problem p03316 (python)

Fixed submission:
n = input()
num = int(n)
total = 0
for i in n:
    total += int(i)
    
if num % total == 0:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
n = input()
e = len(n)
totalList = []
for i in range(len(n)):
  totalList.append(n[i])
  
total = sum(totalList)
if(total == 0):
  print("Yes")
if(n % total == 0):
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n = input())
total = 0
for i in range(len(n)):
  total+=int(n[i])

if(total == 0):
  print("No")
if(int(n) % total == 0):
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n = input())
total = 0
for i in range(len(n)):
  total+=int(n[i])
  if(total == 0):
    print("No")
if(int(n) % total == 0):
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
total = 0
for i in range(len(n)):
  total+=n[i]
if(total == 0):
  print("No")
if(n % total == 0):
  print("Yes")
else:
  print("No")
Problem p03324 (python)

Fixed submission:
D, N =map(int,input().split())
if N == 100:
  N = 101
print(N*(100**D))

Buggy submission (verdict: Runtime Error):
d,k = [int(x) for x in input().split()]
print((100 ** d) * k
Problem p03328 (python)

Fixed submission:
a,b = map(int, input().split())
s = b -a
ans = 0
for i in range(1,s):
  ans += i
  
print(ans - a)

Buggy submission (verdict: Runtime Error):
a,b = map(int, input().split())
total = 0
ans = 0
for i in range(1,1000):
    total += i
    if total - b => 0:
        ans = total -b
        break
        
print(ans)
Problem p03423 (python)

Fixed submission:
n = int(input())
print(n // 3)

Buggy submission (verdict: Runtime Error):
N = int(input())
s = set(map(str,input().split()))
if(len(s) == 3):
  print("Three")
else:
  print("Four")
Problem p03424 (python)

Fixed submission:
N = int(input())
a = list(input().split())

if("Y" in a):
  print("Four")
else:
  print("Three")

Buggy submission (verdict: Runtime Error):
N = int(input())
s = set()
for i in range(N+1):
    a = input()
    s.add(a)
if(len(s) == 3):
  print("Three")
else:
  print("Four")

Buggy submission (verdict: Runtime Error):
N = int(input())
s = set()
for i in range(N):
    a = input()
    s.add(a)
if(len(s) == 3):
  print("Three")
else:
  print("Four")

Buggy submission (verdict: Runtime Error):
N = int(input())
s = set()
for i in range(N):
    a = input()
    s.add(a)
print(len(s))
Problem p03455 (python)

Fixed submission:
a,b = [int(x) for x in input().split()]

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

Buggy submission (verdict: Runtime Error):
a,b = [int(x) for x in input().split()]

if (a * b) % == 0:
  print("Even")
else:
  print("Odd")
Problem p03478 (python)

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

def sum(k):
  s = 0
  for j in range(len(k)):
    s+=int(k[j])
  return s

for i in range(1,n+1):
  if a<=sum(str(i))<=b:
    ans+=i
print(ans)

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

def sum(k):
  s = 0
  for j in range(len(s)):
    s+=int(k[j])
  return s

for i in range(1,n+1):
  if a<=sum(str(i))<=b:
    ans+=i
print(ans)
Problem p03485 (python)

Fixed submission:
import math
a,b = [int(x) for x in input().split()]
 
print(math.ceil((a+b)/2))

Buggy submission (verdict: Runtime Error):
import math
a,b = [int(x) for x in input().split()]
 
print(math.ceil((a+b)/2)
Problem p03495 (python)

Fixed submission:
from collections import Counter

N,K = map(int, input().split())
A = list(map(int, input().split()))

c = Counter(A)
d = sorted(c.values())
l = len(d)
print(sum(d[0:l-K]))

Buggy submission (verdict: Runtime Error):
n,k = map(int, input().split())
binary = [0 for _ in range(n)]
ls = list(map(int, input().split()))
for i in ls:
    binary[i-1] += 1
binary = sorted(binary)
binary.pop(binary.index(0))

ans = 0
i = 0
while k < len(binary) - binary.count(0):
    if binary[i] != 0:
        ans += binary[i]
        binary.pop(i)
    i+=1
print(ans)

Buggy submission (verdict: Runtime Error):
n,k = map(int, input().split())
binary = [0 for _ in range(n)]
ls = list(map(int, input().split()))
for i in ls:
    binary[i-1] += 1
binary = sorted(binary)
binary.pop(binary.index(0))
print(binary)
ans = 0
i = 0
while k < len(binary) - binary.count(0):
    if binary[i] != 0:
        ans += binary[i]
        binary.pop(i)
    i+=1
print(ans)

Buggy submission (verdict: Runtime Error):
n,k = map(int, input().split())
a = list(map(int, input().split()))
setA = set(a)
c = Counter(A)
ans = 0

for w, v in sorted(c.items(), key=lambda x: x[1]):
    if k < len(set(a)):
        while w in a:
            aIndex = a.index(w)
            a.pop(aIndex)
            ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
n,k = map(int, input().split())
a = list(map(int, input().split()))
setA = set(a)
c = Counter(A)
ans = 0


for w, v in sorted(c.items(), key=lambda x: x[1]):
    if k < len(set(a)):
        while w in a:
            aIndex = a.index(w)
            a.pop(aIndex)
            ans+=1
print(ans)
Problem p03679 (python)

Fixed submission:
x,a,b = map(int, input().split())
if a >= b:
    print("delicious")    
elif b <= x + a:
    print("safe")
else:
    print("dangerous")

Buggy submission (verdict: Runtime Error):
x,a,b = map(int, input().split())
if a => b:
    print("delicious")    
elif b <= x + a:
    print("safe")
else:
    print("dangerous")
Problem p03738 (python)

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

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
if a > b:
    print("GREATER")
elif a < b:
    print("LESS")
else:
    print("EQUAL")
Problem p03861 (python)

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

Buggy submission (verdict: Runtime Error):
a,b,x = map(int, inpu().split())
na = (a-1) // x + 1
nb = b // x + 1
print(nb-na)
Problem p03944 (python)

Fixed submission:
W,H,N = map(int, input().split())
ans = [[1 for _ in range(W)] for _ in range(H)]

for i in range(N):
    x,y,a = map(int, input().split())
    if a == 1:
        for i in range(H):
            for j in range(x):
                ans[i][j] = 0
    if a == 2:
        for  i in range(H):
            for j in range(x, W):
                ans[i][j] = 0
    if a == 3:
        for i in range(y):
            for j in range(W):
                ans[i][j] = 0
    if a == 4:
        for i in range(y, H):
            for j in range(W):
                ans[i][j] = 0
print(sum([sum(ans[i]) for i in range(H)]))

Buggy submission (verdict: Runtime Error):
w,h,n = map(int,input().split())))
for i in range(n):
    a=list(map(int,input().split()))))
    if a[-1]==1:
        w-=a[0]
    elif a[-1]==2:
        w = a[0]
    elif a[-1]==3:
        h-=a[1]
    elif a[-1]==4:
        h = a[1]
print(h*w)
Problem p02691 (python)

Fixed submission:
import collections
goukei = 0

N = int(input())
Ai = list(map(int, input().split()))
number = [j for j in range(1, N+1, 1)]
plus_Ai = [x + y for (x, y) in zip(Ai, number)]
minus_Ai = [x - y for (y, x) in zip(Ai, number)]
c = collections.Counter(plus_Ai)

for i in minus_Ai:
    goukei += c[i]
print(goukei)

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

N = int(input()) * (-1)
Ai = list(map(int, input().split()))
array_Ai = np.array(Ai)
number = np.array([j for j in range(0, N, -1)])
number_1 = np.array([1 for k in range(-N)])
new_ai = number + array_Ai
new_ai = new_ai - number_1
for i in range(len(Ai)):
    new_ai = new_ai + number_1
    goukei += np.count_nonzero(new_ai == -Ai[i])
print(goukei)

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

N = int(input()) * (-1)
Ai = list(map(int, input().split()))
array_Ai = np.array(Ai)
for i in range(len(Ai)):
    number = np.array([j + i for j in range(0, N, -1)])
    new_ai = number + array_Ai
    goukei += np.count_nonzero(new_ai == -Ai[i])
print(goukei)

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

N = int(input()) * (-1)
Ai = list(map(int, input().split()))
array_Ai = np.array(Ai)
for i in range(len(Ai)):
    number = np.array([j + i for j in range(0, N, -1)])
    new_ai = number + array_Ai
    goukei += np.count_nonzero(new_ai == -Ai[i])

print(goukei)
Problem p02812 (python)

Fixed submission:
N = int(input())
S = input()
print(S.count('ABC'))

Buggy submission (verdict: Runtime Error):
N = int(input())
S = list(map(str, input()))
count = 0
for i in range(len(S)):
    if S[i] == 'A' and S[i+1] == 'B' and S[i+2] == 'C':
        count += 1
print(count)
Problem p03238 (python)

Fixed submission:
*N,= map(int,open(0).read().split())
if N[0] == 1:
    print("Hello World")
if N[0] == 2:
    print(N[1] + N[2])

Buggy submission (verdict: Runtime Error):
N, A, B = map(int,open(0).read().split())
if N == 1:
    print("Hello World")
if N == 2:
    print(A + B)
Problem p03371 (python)

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

if X >= Y:
    ans = min(A*X + B*Y, 2*C*Y + A*(X-Y), 2*C*X)
else:
    ans = min(A*X + B*Y, 2*C*X + B*(Y-X), 2*C*Y)

print(ans)

Buggy submission (verdict: Runtime Error):
A, B, C, X, Y = map(int, input().split())
if A + B < 2 * C:
    ans = A * X + B * Y
elif A + B >= 2 * C:
    nokori = abs(X - Y)
    if X >= Y and A >= 2 * C:
        ans = C * 2 * X
    if Y >= X and B >= 2 * C:
        ans = C * 2 * Y
    if X > Y and A < 2 * C:
        ans = C * 2 * Y + nokori * A
    if Y > X and B < 2 * C:
        ans = C * 2 * X + nokori * B
print(ans)

Buggy submission (verdict: Runtime Error):
A, B, C, X, Y = map(int, input().split())
if A + B < 2 * C:
    ans = A * X + B * Y
elif A + B > 2 * C:
    nokori = abs(X - Y)
    if X >= Y and A >= 2 * C:
        ans = C * 2 * X
    if Y >= X and B >= 2 * C:
        ans = C * 2 * Y
    if X > Y and A < 2 * C:
        ans = C * 2 * Y + nokori * A
    if Y > X and B < 2 * C:
        ans = C * 2 * X + nokori * B
print(ans)

Buggy submission (verdict: Runtime Error):
A, B, C, X, Y = map(int, input().split())
if A + B < 2 * C:
    ans = A * X + B * Y
elif A + B > 2 * C:
    nokori = abs(X - Y)
    if X > Y and A >= 2 * C:
        ans = C * 2 * X
    if Y > X and B >= 2 * C:
        ans = C * 2 * Y
    if X > Y and A < 2 * C:
        ans = C * 2 * Y + nokori * A
    if Y > X and B < 2 * C:
        ans = C * 2 * X + nokori * B
print(ans)