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

Fixed submission:
N = int(input())
a = 0
w = 0
t = 0
r = 0
S = []
for _ in range(N):
    S.append(str(input()))

for s in S:
    if s == 'AC':
        a += 1
    elif s == 'WA':
        w += 1
    elif s == 'TLE':
        t += 1
    else:
        r += 1
print('AC x '+str(a))
print('WA x '+str(w))
print('TLE x '+str(t))
print('RE x '+str(r))

Buggy submission (verdict: Runtime Error):
N = int(input())
a = 0
w = 0
t = 0
r = 0
for _ in range(N):
    if input() == 'AC':
        a += 1
    elif input() == 'WA':
        w += 1
    elif input() == 'TLE':
        t += 1
    else:
        r += 1
print('AC x '+str(a))
print('WA x '+str(w))
print('TLE x '+str(t))
print('RE x '+str(r))
Problem p02553 (python)

Fixed submission:
inputs = [int(d) for d in input().split()]

results = []
for i in (0, 1):
  for j in (2, 3):
    results.append(inputs[i] * inputs[j])

print(max(results))

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

results = []
for i in (0, 1):
  for j in (2, 3):
    results.append(inputs[i] * inputs[j])

print(max(results))

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

results = []
for i in (0, 1):
  for j in (2, 3):
    reults.append(inputs[i] * inputs[j])

print(max(results))
Problem p02784 (python)

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

At = 0
for i in range(N):
  At += int(A[i])
  
if At >= H:
  print('Yes')
else:
  print('No')

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

At = 0
for i in range(N):
  At += A[i]
  
if At >= H:
  print('Yes')
else:
  print('No')
Problem p02791 (python)

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

c = 1
a = d[0]

for i in range(1,N):
  if d[i] <= a:
    c += 1
    a = d[i]

print(c)

Buggy submission (verdict: Runtime Error):
N = int(input())
L = []
for i in range(N):
  P = int(input())
  L.append(P)
  
F = 0

A = 0

for i in range(N):
  for j in range(1, i):
    if L[j] < L[i]:
      F = 0
      break
    else:
      F = 1
  if(F == 1):
    A += 1

print(A+1)

Buggy submission (verdict: Runtime Error):
N = int(input())
L = []
for i in range(N):
  P = int(input())
  L.append(P)
  
#フラグ
F = 0

#答え
A = 0

for i in range(N):
  for j in range(1, i):
    if L[j] < L[i]:
      F = 0
      break
    else:
      F = 1
  if(F == 1):
    A += 1

print(A+1)

Buggy submission (verdict: Runtime Error):
N = int(input())
L = []
for i in range(N):
  P = int(input())
  L.append(P)

#フラグ
F = 0

#答え
A = 0

for i in range(N):
  for j in range(1, i):
    if L[j] < L[i]:
      F = 0
      break
    else:
      F = 1
  if(F == 1):
    A += 1

print(A+1)

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

L = []
for i in range(N):
  P = int(input())
  L.append(P)

F = 0

for i in range(1, N):
  P = L[i]
  for j in range(0, i):
    if L[j] < L[i]:
      F = 0
      break
    else:
      F = 1
      
  if F = 1:
    A += 1
    
print(A)
Problem p02848 (python)

Fixed submission:
AL = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
 
N = int(input())
 
S = input()
A = []
 
for i in range(len(S)):
  B = AL.index(S[i])+N
  if B >= 26:
    B = B -26
  A.append(AL[B])
  
for j in range(len(S)):
  print(A[j], end='')

Buggy submission (verdict: Runtime Error):
AL = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

N = int(input())

S = input()
A = []

for i in range(len(S)):
  B = AL.index(S[i])+N
  A.append(AL[B])
  
for j in range(len(S)):
  print(A[j], end='')

Buggy submission (verdict: Runtime Error):
AL = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
 
N = 2
 
S = ABCXYZ
A = []
 
for i in range(len(S)):
  B = AL.index(S[i])+N
  if B >= 26:
    B = B - 26
  A.append(S[B])
  
for j in range(len(S)):
  print(A[j], end='')

Buggy submission (verdict: Runtime Error):
AL = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

N = int(input())

S = input()
A = []

for i in range(len(S)):
  B = AL.index(S[i])+N
  if B >= 26:
    B = B - 26
  A.append(S[B])
  
for j in range(len(S)):
  print(A[j], end='')

Buggy submission (verdict: Runtime Error):
AL = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

N = int(input())
S = input()

A = ''

for i in range(len(S)):
  B = AL.index(S[i]) + N
  A += AL[B]

print(A)
Problem p02911 (python)

Fixed submission:
# 入力
data = input().split()
 
# プレイヤ人数
player = int(data[0])
# はじめのポイント
initPoint = int(data[1])
# 質問回数
question = int(data[2])
 
# 正解しない場合のプレイヤのポイント
playerPoint = []
 
for i in range(player):
  playerPoint.append(initPoint - question)
 
# 問題解答
for i in range(question):
  # 正解者
  corrPlayer = int(input())
  # 正解者のポイントを+1(減らさない)
  playerPoint[corrPlayer -1] = playerPoint[corrPlayer -1] + 1
  
# 解答
for i in range(player):
  if playerPoint[i] <= 0:
    print('No')
  else:
    print('Yes')

Buggy submission (verdict: Runtime Error):
# 入力
data = input().split()
 
# プレイヤ人数
player = int(data[0])
# はじめのポイント
initPoint = int(data[1])
# 質問回数
question = int(data[2])
 
# はじめの各プレイヤのポイント
playerPoint = []
 
for i in range(player):
  playerPoint.append(initPoint)
 
# 問題解答
for i in range(question):
  # 全員のポイントを-1
  playerPoint = [i-1 for i in playerPoint]
  # 正解者
  corrPlayer = int(input())
  # 正解者のポイントを+1(減らさない)
  playerPoint[corrPlayer -1] = playerPoint[corrPlayer -1] + 1
  
# 解答
for i in range(player):
  if playerPoint(i) <= 0:
    print('No')
  else:
    print('Yes')

Buggy submission (verdict: Runtime Error):
# 入力
data = input().split()

# プレイヤ人数
player = int(data[0])
# はじめのポイント
initPoint = int(data[1])
# 質問回数
question = int(data[2])

# はじめの各プレイヤのポイント
playerPoint = []

for i in range(player):
  playerPoint.append(initPoint)

# 問題解答
for i in range(question):
  # 全員のポイントを-1
  playerPoint = [i-1 for i in playerPoint]
  # 正解者
  corrPlayer = int(input())
  # 正解者のポイントを+1(減らさない)
  playerPoint[corrPlayer -1] = playerPoint[corrPlayer -1] + 1
  
# 解答
for i in range(player):
  if playerPoint(i) <= 0:
    print('No)
  else:
    print('Yes')
Problem p03493 (python)

Fixed submission:
D = input()
DL = [D[i] for i in range(3)]

print(DL.count('1'))

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

print(D.count('0'))
Problem p04043 (python)

Fixed submission:
data = input().split()
 
flag1 = 0
flag2 = 0
 
for i in range(3):
  if data[i] == '5':
    flag1 += 1
  elif data[i] == '7':
    flag2 += 1
 
if flag1 == 2 and flag2 == 1:
  print('YES')
else:
  print('NO')

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

flag1 = 0
flag2 = 0

for i in range(3):
  if data[i] = '5':
    flag1 += 1
  elif data[i] = '7':
    flag2 += 1

if flag1 == 1 and flag2 == 2:
  print('YES')
else:
  print('NO')
Problem p02681 (python)

Fixed submission:
s = input()
t = input()
if t.startswith(s):
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
s = input()
t = input()
if t.startswich(s):
  print('Yes')
else:
  print('No')
Problem p02924 (python)

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

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(range(1,n+1))
print(sum(a)-max(a))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(range(n,0,-1))
print(sum(a)-a[0])
Problem p03068 (python)

Fixed submission:
n = int(input())
s = str(input())
k = int(input())
word = ""
w = s[k-1]
for i in s:
    if w != i:
        word += "*"
    else:
        word += w
print(word)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = str(input())
k = int(input())
wordn = ""
w = s[k-1]
for i in s:
    if w != i:
        word += "*"
    else:
        word += w
print(word)
Problem p03076 (python)

Fixed submission:
w = [str(input()) for i in range(5)]
num = ['0','9','8','7','6','5','4','3','2','1']
w1 = []
m = 0
t = 0
for h in w:
    for j in num:
        if h[-1] == j:
            w1.append(int(h)+num.index(j))
            if m <= num.index(j):
                m = num.index(j)
                k = w.index(h)
for l in range(5):
    if l != k:
        t += w1[l]
print(t+int(w[k]))

Buggy submission (verdict: Runtime Error):
w = [str(input()) for i in range(5)]
num = ['0','9','8','7','6','5','4','3','2','1']
w1 = []
m = 0
t = 0
for h in w:
    for j in num:
        if h[-1] == j:
            w1.append(int(h)+num.index(j))
            if m < num.index(j):
                m = num.index(j)
                k = w.index(h)
for l in range(5):
    if l != k:
        t += w1[l]
print(t+int(w[k]))
Problem p03086 (python)

Fixed submission:
s = str(input())
w = ""
l = []
for i in s:
    if i=='A' or i=='C' or i=='G' or i=='T':
        w += i
    else:
        l.append(len(w))
        w = ""
l.append(len(w))
print(max(l))

Buggy submission (verdict: Runtime Error):
s = str(input())
w = ""
l = []
for i in s:
    if i=='A' or i=='C' or i=='G' or i=='T':
        w += i
    else:
        l.append(len(w))
        w = ""
print(max(l))
Problem p03316 (python)

Fixed submission:
n = str(input())
num = 0
for i in range(len(n)):
    num += int(n[i])
if int(n)%num == 0:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
N = int(input())
num = list(N)
sum = sum(num)
M = int(sum)
if N%M == 0:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
N = int(input())
num = list(N)
sum = sum(num)
if N%sum == 0:
  print('Yes')
else:
  print('No')
Problem p03380 (python)

Fixed submission:
import itertools
n = int(input())
a = list(map(int, input().split()))
m = max(a)
t = (10**9)+1
for i in a:
    if abs(i-(m//2)) < t and i != m:
        t = abs(i-(m//2))
        s = i
print(m,s)

Buggy submission (verdict: Runtime Error):
import itertools
n = int(input())
a = list(map(int, input().split()))
m = 0
for i in itertools.combinations(a,2):
    j = [h for h in itertools.combinations(range(max(i[0],i[1])), min(i[0],i[1]))]
    if m < len(j):
        m = len(j)
        l = i
print(max(l[0],l[1]),min(l[0],l[1]))
Problem p03544 (python)

Fixed submission:
n = int(input())
if n == 0:
    print(2)
elif n == 1:
    print(1)
else:
    l1 = 2
    l2 = 1
    l3 = 0
    for i in range(n-1):
        l3 = l1
        l1 = l2
        l2 += l3
    print(l2)

Buggy submission (verdict: Runtime Error):
n = int(input())
if n == 0:
    print(2)
elif n == 1:
    print(1)
else:
    l1 = 2
    l2 = 1
    l3 = 0
    for i in range(n-1):
        l3 = l1
        l1 = l2
        l2 += l3
print(l2)
Problem p03695 (python)

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

w = []
num = 0
for i in a:
    if 1 <= i <= 399:
        if 1 not in w:
            w.append(1)
    elif 400 <= i <= 799:
        if 400 not in w:
            w.append(400)
    elif 800 <= i <= 1199:
        if 800 not in w:
            w.append(800)
    elif 1200 <= i <= 1599:
        if 1200 not in w:
            w.append(1200)
    elif 1600 <= i <= 1999:
        if 1600 not in w:
            w.append(1600)
    elif 2000 <= i <= 2399:
        if 2000 not in w:
            w.append(2000)
    elif 2400 <= i <= 2799:
        if 2400 not in w:
            w.append(2400)
    elif 2800 <= i <= 3199:
        if 2800 not in w:
            w.append(2800)
    else:
        num += 1
if 0 < len(w):
    print(len(w), len(w)+num)
else:
    print(1, len(w)+num)

Buggy submission (verdict: Runtime Error):
w = []
num = 0
for i in a:
    if 1 <= i <= 399:
        if 1 not in w:
            w.append(1)
    elif 400 <= i <= 799:
        if 400 not in w:
            w.append(400)
    elif 800 <= i <= 1199:
        if 800 not in w:
            w.append(800)
    elif 1200 <= i <= 1599:
        if 1200 not in w:
            w.append(1200)
    elif 1600 <= i <= 1999:
        if 1600 not in w:
            w.append(1600)
    elif 2000 <= i <= 2399:
        if 2000 not in w:
            w.append(2000)
    elif 2400 <= i <= 2799:
        if 2400 not in w:
            w.append(2400)
    elif 2800 <= i <= 3199:
        if 2800 not in w:
            w.append(2800)
    else:
        num += 1
if 0 < len(w):
    print(len(w), len(w)+num)
else:
    print(1, len(w)+num)
Problem p03997 (python)

Fixed submission:
a = int(input())
b = int(input())
h = int(input())
print(int(((a+b)*h)/2))

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
h = int(input())
print(in(((a+b)*h)/2))
Problem p02613 (python)

Fixed submission:
ac = 0
wa = 0
tle = 0
re = 0
for _ in range(int(input())):
	s = input()
	if s=='AC':
		ac+=1
	elif s=='WA':
		wa+=1
	elif s=='TLE':
		tle+=1
	else:
		re+=1
print('AC x {}'.format(ac))
print('WA x {}'.format(wa))
print('TLE x {}'.format(tle))
print('RE x {}'.format(re))

Buggy submission (verdict: Runtime Error):
ac, wa,tle,re = 0,0,0,0
for _ in range(int(input()):
	s = input()
    if s == 'AC':
    	ac+=1
    elif s=='WA':
        wa+=1
    elif s=='TLE':
        tle+=1
    else:
        re+=1
print('AC x {}'.format(ac))
print('WA x {}'.format(wa))
print('TLE x {}'.format(tle))
print('RE x {}'.format(re))
Problem p02582 (python)

Fixed submission:
s = input()
 
ans = 0
for i in range(0, 3):
	if s[i] == 'R':
			ans += 1
      
if ans == 2 and s[1] == 'S':
  	ans -= 1
    
print(ans)

Buggy submission (verdict: Runtime Error):
s = input()
 
ans = 0
for i in range(0, 3):
	if s[i] == 'R':
    	ans += 1
      
if ans == 2 and s[1] == 'S':
  	ans -= 1
    
print(ans)

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

ans = 0
for i in range(0, 3):
	if s[i] == 'R':
      ans += 1
      
if ans == 2 and s[1] == 'S':
  	ans -= 1
    
print(ans)
Problem p02692 (python)

Fixed submission:
n, a, b, c = list(map(int, input().split()))
s = [list(input()) for _ in range(n)]
s.append(["A", "B"])
d = {"A": a, "B": b, "C": c}
ans = []

def calc(add, sub):
    d[add] += 1
    d[sub] -= 1
    ans.append(add)

for i, [j, k] in enumerate(s):
    if i == n:
        print('Yes')
        print('\n'.join(ans))
        break
    if d[j] == 0 and d[k] == 0:
        print("No")
        break
    elif j == "A" and k == "B":
        
        if d[j] < d[k]:
            calc(j, k)
        elif d[j] > d[k]:
            calc(k, j)
        else:
            if s[i + 1][0] == "A":
                calc(j, k)
            else:
                calc(k, j)
    elif j == "A" and k == "C":

        if d[j] < d[k]:
            calc(j, k)
        elif d[j] > d[k]:
            calc(k, j)
        else:
            if s[i + 1][0] == "A":
                calc(j, k)
            else:
                calc(k, j)
    elif j == "B" and k == "C":

        if d[j] < d[k]:
            calc(j, k)
        elif d[j] > d[k]:
            calc(k, j)
        else:
            if s[i + 1][0] == "A" and s[i + 1][1] == "C":
                calc(k, j)
            else:
                calc(j, k)

Buggy submission (verdict: Runtime Error):
n, a, b, c = list(map(int, input().split()))
s = [list(input()) for _ in range(n)]
d = {"A": a, "B": b, "C": c}
ans = []
for i, [j, k] in enumerate(s):
    if d[j] == 0 and d[k] == 0:
        print("No")
        break
    elif d[j] > d[k]:
        calc(k, j)
    elif d[j] < d[k]:
        calc(j, k)
    elif i + 1 != n:
        if j == "A":
            if s[i + 1][1] == "C":
                calc(k, j)
            else:
                calc(j, k)        
        else:
            if s[i + 1] == ["A", "C"]:
                calc(k, j)
            else:
                calc(j, k)
    else:
        calc(j, k)
else:
    print("Yes")
    for i in ans:
        print(i)
Problem p02811 (python)

Fixed submission:
k,  x = list(map(int, input().split()))
if 500 * k < x:
    print('No')
else:
    print('Yes')

Buggy submission (verdict: Runtime Error):
k,  x = list(map(int, input().split()))
if 500 * k < x:
    print(“No”)
else:
    print(“Yes”)
Problem p02813 (python)

Fixed submission:
import itertools
n = int(input())
p = tuple(map(int, input().split()))
q = tuple(map(int, input().split()))
l = list(range(1, n + 1))
ll = list(itertools.permutations(l, n))
if p == q:
    ans = 0
else:
    for i in ll:
        if i == p:
            p_n = ll.index(i) + 1
        elif i == q:
            q_n = ll.index(i) + 1
    ans = abs(p_n - q_n)
print(ans)

Buggy submission (verdict: Runtime Error):
import itertools
n = int(input())
p = tuple(map(int, input().split()))
q = tuple(map(int, input().split()))
l = list(range(1, n + 1))
ll = list(itertools.permutations(l, n))

for i in ll:
    if i == p:
        p_n = ll.index(i) + 1
    elif i == q:
        q_n = ll.index(i) + 1
ans = abs(p_n - q_n)
print(ans)
Problem p02922 (python)

Fixed submission:
a, b = list(map(int, input().split()))
ans = 0
count = 1
if b != 1:
    while count < b:
        count += a - 1
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
a, b = list(map(int, imput().split()))
ans = 0
if b == 1:
  print(ans)
else:
  while a < b:
    ans += 1
    a += a
  print(ans)

Buggy submission (verdict: Runtime Error):
a, b = list(map(int, imput().split()))
ans = 0
if b == 1:
  print(ans)
else:
  while True:
    ans += 1
    a += a
    if a >= b:
      print(ans)
      break:

Buggy submission (verdict: Runtime Error):
a, b = list(map(int, imput().split()))
ans = 0
count = 1
if b == 1:
  print(ans)
else:
  while True:
    ans += 1
    count += a
    if count >= b:
      print(ans)
      break:
Problem p02963 (python)

Fixed submission:
s = int(input())
x1 = 10 ** 9
if s < x1:
    print(0, 0, s, 0, 0, 1)
else:
    y2 = s // x1
    if s % x1 == 0:
        print(0, 0, x1, 0, 0, y2)
    else:
        y2 += 1
        y1 = y2 * x1 - s
        print(0, 0, x1, y1, 1, y2)

Buggy submission (verdict: Runtime Error):
s = int(input())
x1 = 10 ** 9
y2 = s // x1
if s % x1 != 0:
    y2 += 1
    y1 = y2 * x1 - s
print(0, 0, x1, y1, 1, y2)

Buggy submission (verdict: Runtime Error):
s = int(input())
x1 = 10 ** 9

if s < x1:
    print(0, 0, s, 0, 0, 1)
elif a - int(a) == 0:
    print(0, 0, i, 0, 0, i)
else:
    y2 = s // x1
    if s % x1 == 0:
        print(0, 0, x1, 0, 0, y2)
    else:
        y2 += 1
        y1 = y2 * x1 - s
        print(0, 0, x1, y1, 1, y2)
Problem p03029 (python)

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

ans = (a * 3 + p) // 2
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
l = []
for i in range(n):
    s, p = input().split()
    l.appen([s, -int(p), i + 1])

l.sort()
for i in l:
    print(i[2])
Problem p03030 (python)

Fixed submission:
n = int(input())
l = []
for i in range(n):
    s, p = input().split()
    l.append((s, -int(p), i + 1))

l.sort()
for i in l:
    print(i[2])

Buggy submission (verdict: Runtime Error):
n = int(input())
l = []
for i in range(n):
    s, p = input().split()
    l.appen([s, -int(p), i + 1])

l.sort()
for i in l:
    print(i[2])

Buggy submission (verdict: Runtime Error):
n = int(input())
l = []
for i in range(n):
    s, p = input().split()
    l.append[(s, -int(p), i + 1])

l.sort()
for i in l:
    print(i[2])
Problem p03076 (python)

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

l = [a, b, c, d, e]
s = []

for i in l:
    if i % 10 > 0:
        s.append(10 - (i % 10))
if len(s) > 0:
    s.sort()
    del s[-1]

ans = sum(l) + sum(s)
print(ans)

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

l = [a, b, c, d, e]
s = []
for i in l:
    if i % 10 > 0:
        s.append(10 - (i % 10))    
s.sort()
del s[-1]
ans = sum(l) + sum(s)
print(ans)
Problem p02614 (python)

Fixed submission:
import numpy as np
import itertools
H, W, K = map(int, input().split())
L = np.array([list(input()) for i in range(H)])
Ans = 0
for h in range(H):
    for w in range(W):
        if L[h,w] == '.':
            L[h,w] = '0'
        else:
            L[h,w] = '1'
L = L.astype("int64")

def del_w(w):#w列目
    if w != 0:
        for h1 in range(H):
            L1[h1,w-1] =  0   

def del_h(h):#h行目
    if h != 0:
        for w1 in range(W):
            L1[h-1,w1] =  0
            
H_list = []
for h in range(H+1):
    H_list += list(itertools.combinations(range(1,H+1),h))

W_list = []
for w in range(W+1):
    W_list += list(itertools.combinations(range(1,W+1),w))
    
for h_list in H_list:
    for w_list in W_list:
        
        L1 = L.copy()
        
        for w1 in w_list :
            for h in range(H):
                L1[h,w1-1] =  0
                
        for h1 in h_list :
            for w in range(W):
                L1[h1-1,w] =  0 
                
        if np.sum(L1) == K:
            #print(L1,h_list,w_list)
            Ans += 1
            
print(Ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
import itertools
H, W, K = map(int, input().split())
L = np.array([list(input()) for i in range(H)])
Ans = 0
for h in range(H):
    for w in range(W):
        if L[h,w] == '.':
            L[h,w] = '0'
        else:
            L[h,w] = '1'
L = L.astype("int64")

def del_w(w):#w列目
    if w != 0:
        for h1 in range(H):
            L1[h1,w-1] =  0   

def del_h(h):#h行目
    if h != 0:
        for w1 in range(W):
            L1[h-1,w1] =  0
            
H_list = []
for h in range(H+1):
    H_list += list(itertools.combinations(range(1,H+1),h))

W_list = []
for w in range(W+1):
    W_list += list(itertools.combinations(range(1,W+1),w))
    
for h_list in H_list:
    for w_list in W_list:
        
        L1 = L.copy()
        
        for w1 in w_list :
            for h in range(H):
                L1[h,w1-1] =  0
                
        for h1 in h_list :
            for w in range(W):
                L1[h1-1,w] =  0 
                
        if np.sum(L1) == K:
            #print(L1,h_list,w_list)
            Ans += 1
            
print(Ans)
Problem p02639 (python)

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

Buggy submission (verdict: Runtime Error):
A, B = map(int, input().split())
L=list(map(int,input().split()))
L = [abs(i - A) for i in L]
L +=[0]
L=sorted(L)
x=0
i,j=0,1
while True:
    if L[i] == x and L[j] == x :
        i,j = i+2,j+2
        x += 1
    else:
        break
print(A+x)
Problem p02657 (python)

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

Buggy submission (verdict: Runtime Error):
N = int(input())
 
pn=[2];A=100000
for L in range(3,A):
    chk=True
    for L2 in pn:
        if L%L2 == 0:chk=False
    if chk==True:pn.append(L)
        
A246655 = []
for p in pn:
    pe = p
    while pe < A:
        A246655.append(pe)
        pe *= p
A246655 = sorted(A246655)
 
c=0
for i in range(len(A246655)):
    if N%A246655[i]==0:
        N = N//A246655[i]
        c+=1
print(c)
Problem p02681 (python)

Fixed submission:
from sys import stdin
def main():
    N1 = stdin.readline().rstrip()
    N2 = stdin.readline().rstrip()
    if N1 == N2[:-1]:
        print('Yes')
    else:
        print('No')
    
main()

Buggy submission (verdict: Runtime Error):
from sys import stdin
def main():
    N, K = [int(x) for x in stdin.readline().rstrip().split()]
    A = [int(x) for x in stdin.readline().rstrip().split()]
    K = K % N
    X = 1
    C = 0
    Log = [1]
    while C <= K:
        X = A[X-1]
        C += 1
        if (X in Log) == True:
            break
      
        Log += [X]
    
    K = (K - C)%(C - Log.index(X))
 
    print(Log[Log.index(X)+K])
    
main()
Problem p02687 (python)

Fixed submission:
S=input()
if S=='ABC':
    print('ARC')
else:
    print('ABC')

Buggy submission (verdict: Runtime Error):
import numpy as np
N=int(input())
A = np.array(list(map(int, input().split())))
X = A+np.arange(N)+1
S = A*(-1)+np.arange(N)+1
Ans=0
for i in range(N):
    Ans += np.count_nonzero(S[i:] == X[i])
print(Ans)
Problem p02924 (python)

Fixed submission:
N = int(input())
if N % 2 == 0:
    print(int(N/2) * (N-1))
else:
    print(int((N-1)/2) * N)

Buggy submission (verdict: Runtime Error):
N = int(input())
L = list(range(1, N + 1))
print(sum(L[:-1]))
Problem p02934 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
B = [1/i for i in A]
print(1/sum(B))

Buggy submission (verdict: Runtime Error):
N=int(input())
s=0
for i in range(N):
  a=int(input())
  s+=1/a
print(1/s)