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

Fixed submission:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(200005)
n, q = map(int, input().split())

to = [[] for i in range(n+1)]


for i in range(n-1):
    a, b = map(int, input().split())
    to[a].append(b)
    to[b].append(a)

score = [0]*(n+1)
for i in range(q):
    p, x = map(int, input().split())
    score[p] += x


def down_tree(index, parent):
    for i in to[index]:
        if i == parent:
            continue
        score[i] += score[index]
        down_tree(i, index)



down_tree(1, 1)

print(' '.join(map(str, score[1:])))

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(200005)
n, q = map(int, input().split())

to = [[] for i in range(n+1)]


for i in range(n-1):
    a, b = map(int, input().split())
    to[a].append(b)
    to[b].append(a)

score = [0]*(n+1)
q = [0] * (n+1)
for i in range(q):
    p, x = map(int, input().split())
    q[p] += x


def down_tree(index, parent):
    global score
    score[index] += score[parent] + q[index]
    for i in to[index]:
        if i == parent:
            continue
        down_tree(i, index)
    return


down_tree(1, 1)

print(*score[1:])

Buggy submission (verdict: Runtime Error):

n, q = map(int, input().split())

to = [[] for i in range(n)]


for i in range(n-1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    to[a].append(b)
    to[b].append(a)

score = [0]*n

for i in range(q):
    p, x = map(int, input().split())
    score[p-1] += x


def down_tree(index, parent=-1):
    global score
    for i in to[index]:
        if i == parent:
            continue
        score[i] += score[index]
        down_tree(i, index)
    return


down_tree(0)

for i in range(len(score)):
	print(score[i])

Buggy submission (verdict: Runtime Error):

n, q = map(int, input().split())

to = [[] for i in range(n)]


for i in range(n-1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    to[a].append(b)
    to[b].append(a)

score = [0]*n

for i in range(q):
    p, x = map(int, input().split())
    score[p-1] += x


def down_tree(index, parent=-1):
    global score
    for i in to[index]:
        if i == parent:
            continue
        score[i] += score[index]
        down_tree(i, index)
    return


down_tree(0)

print(*score)

Buggy submission (verdict: Runtime Error):
from operator import itemgetter

n,q = map(int, input().split())

a = [0]*(n-1)
b = [0]*(n-1)
for i in range(n-1):
    a[i],b[i] = map(int, input().split())

p = [0]*q
x = [0]*q

for i in range(q):
    p[i],x[i] = map(int, input().split())

a,b = (list(x) for x in zip(*sorted(zip(a, b))))
p,x = (list(y) for y in zip(*sorted(zip(p,x))))


score = [0]*n

def down_tree(parent, add_score, q_start, n_start):
    global score
    for i in range(q_start, q):
        if p[i]-1 == parent:
            add_score += x[i]
        if p[i]-1 >parent:
            q_start = i
            break
    for i in range(n_start, n-1):
        if a[i]-1 == parent:
            down_tree(b[i]-1, add_score, q_start, i)
        if a[i]-1 > parent:
            break

    score[parent] += add_score

    return 0

down_tree(0, 0, 0, 0)

print(*score)
Problem p03086 (python)

Fixed submission:
s = input()
#print(s)
#print(len(s))
s = s+'X'
ans = []
cnt = 0
for i in range(len(s)):
  #print(s[i])
  if (s[i] != 'A') and (s[i] != 'T') and (s[i] != 'C') and (s[i] != 'G'):
    ans.append(cnt)
    #print(ans)
    cnt = 0
  elif s[i] == 'A':
    cnt += 1
    continue
  elif s[i] == 'T':
    cnt += 1
    continue
  elif s[i] == 'C':
    cnt += 1
  elif s[i] == 'G':
    cnt += 1

#print(ans)
print(max(ans))

Buggy submission (verdict: Runtime Error):
s = input()
#print(s)
#print(len(s))
ans = []
cnt = 0
for i in range(len(s)):
  #print(s[i])
  if (s[i] != 'A') and (s[i] != 'T') and (s[i] != 'C') and (s[i] != 'G'):
    ans.append(cnt)
    #print(ans)
    cnt = 0
  elif s[i] == 'A':
    cnt += 1
    continue
  elif s[i] == 'T':
    cnt += 1
    continue
  elif s[i] == 'C':
    cnt += 1
  elif s[i] == 'G':
    cnt += 1
print(max(ans))
Problem p03105 (python)

Fixed submission:
a, b, c = map(int, input().split())
ans = b//a
print(c if ans>c else ans)

Buggy submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
print([i for i in range(1,101) if a%i+b%i<1][-k])
Problem p03163 (python)

Fixed submission:
import numpy as np
n, W = map(int, input().split())
dp = np.zeros(W+1,'i8')

for i in range(n):
  w, v = map(int, input().split())
  dp[w:] = np.maximum(dp[w:], dp[:-w]+v)
print(dp[-1])

Buggy submission (verdict: Runtime Error):
import numpy as np
n, wt = map(int, input().split())
 
d = np.full(n*10**7+1,wt+1, 'i8')
d[0] = 0
for _ in range(n):
  w, v = map(int, input().split())
  d[v:] = np.minimum(d[v:], d[:-v]+w)
print(np.max(np.where(d<=wt)))

Buggy submission (verdict: Runtime Error):
import numpy as np
n, wt = map(int, input().split())

d = np.fill(n*10**7+1,wt+1, 'i8')
d[0] = 0
for _ in range(n):
  w, v = map(int, input().split())
  d[v:] = np.minimum(d[v:], d[:-v]+w)
print(np.max(np.where(d<=wt)))
Problem p03164 (python)

Fixed submission:
import numpy as np
n, wt = map(int, input().split())
 
d = np.full(n*1000+1,wt+1, 'i8')
d[0] = 0
for _ in range(n):
  w, v = map(int, input().split())
  d[v:] = np.minimum(d[v:], d[:-v]+w)
print(np.max(np.where(d<=wt)))

Buggy submission (verdict: Runtime Error):
import numpy as np
n, wt = map(int, input().split())
d = np.zeros(wt+1,'i8')

for i in range(n):
  w, v = map(int, input().split())
  d[w:] = np.maximum(d[w:], d[:-w]+v)
print(d[-1])
Problem p03166 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**6)

n, m = map(int, input().split())
g = [[] for i in range(n)]
for i in range(m):
  x, y = map(int,input().split())
  g[x-1].append(y-1)
#print(g)
mem = [-1]*n

def dfs(v):
  if mem[v] != -1:
    return mem[v]
  mem[v] = r = max(dfs(w) for w in g[v]) +1 if g[v] else 0
  return r
print(max(dfs(t) for t in range(n)))

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
g = [[] for i in range(n)]
for i in range(m):
  x, y = map(int,input().split())
  g[x-1].append(y-1)

mem = [-1]*n

def dfs(v):
  if mem[v] != -1:
    return mem[v]
  mem[v] = r = max(dfs(w) for w in g[v]) +1 if g[v] else 0
  return r
print(max(dfs(t) for t in range(n)))
Problem p03167 (python)

Fixed submission:
h, w = map(int,input().split())
g = [list(input()) for _ in range(h)]
#print(g)
dp = [[0]*w for _ in range(h)]
dp[0][0] = 1
#print(g[1][0] == '.')
#print(g[1][0])
#print(g[0][3])
mod = 10**9+7
for i in range(h):
  for j in range(w):
    if i+1<h and g[i+1][j] == '.':
      dp[i+1][j] = (dp[i+1][j] + dp[i][j])%mod
    if j+1<w and g[i][j+1] == '.':
      dp[i][j+1] = (dp[i][j+1] + dp[i][j])%mod
print(dp[-1][-1])

Buggy submission (verdict: Runtime Error):
import numpy as np
h, w = map(int,input().split())
f = lambda:list(map(str,input().split()))
g = []
for i in range(h):
  li = f()
  g.append(li)
#print(g)
dp = np.zeros((h,w))
dp[0][0] = 1
#print(g[1][0] == '.')
#print(g[1][0])
#print(g[0][3])
mod = 10**9+7
for i in range(h):
  for j in range(w):
    if i+1<h and g[i+1][j] == '.':
      dp[i+1][j] = (dp[i+1][j] + dp[i][j])%mod
    if j+1<w and g[i][j+1] == '.':
      dp[i][j+1] = (dp[i][j+1] + dp[i][j])%mod
print(dp[-1][-1])

Buggy submission (verdict: Runtime Error):
import numpy as np
h, w = map(int,input().split())
f = lambda:list(map(str,input().split()))
g = []
for i in range(h):
  li = f()
  g.append(li)
#print(g)
dp = np.zeros((h,w))
dp[0][0] = 1
#print(g[1][0] == '.')
#print(g[1][0])
#print(g[0][3])
for i in range(h):
  for j in range(w):
    if i+1<h and g[i+1][j] == '.':
      dp[i+1][j] = dp[i+1][j] + dp[i][j]
    if j+1<w and g[i][j+1] == '.':
      dp[i][j+1] =dp[i][j+1] + dp[i][j]
print(dp)
ans = int(dp[-1][-1])
print(ans%(10**9+7))

Buggy submission (verdict: Runtime Error):
import numpy as np
h, w = map(int,input().split())
f = lambda:list(map(str,input().split()))
g = []
for i in range(h):
  li = f()
  g.append(li)
#print(g)
dp = np.zeros((h,w))
#print(g[1][0] == '.')
#print(g[1][0])
#print(g[0][3])
for i in range(1,h):
  for j in range(1,w):
    if g[i-1][j] == '.' and g[i][j] != '#':
      if dp[i-1][j] == 0:
        dp[i][j] += 1
      else:
        dp[i][j] += dp[i-1][j]
    if g[i][j-1] == '.' and g[i][j] != '#':
      if dp[i][j-1] == 0:
        dp[i][j] += 1
      else:
        dp[i][j] += dp[i][j-1]
#print(dp)
ans = int(dp[-1][-1])
print(ans%(10**9+7))
Problem p03796 (python)

Fixed submission:
import math
n = int(input())
mod = 10**9+7
print(math.factorial(n)%mod)

Buggy submission (verdict: Runtime Error):
n = int(input())
mod = 10**9+7
def Fac(x):
  return x*Fac(x-1)%mod if x != 0 else 1
print(Fac(n))

Buggy submission (verdict: Runtime Error):
n = int(input())
mod = 10**9+7
def Fac(x):
  return x*Fac(x-1) if x != 0 else 1
print(Fac(n)%mod)
Problem p03798 (python)

Fixed submission:
n = int(input())
s = input()
l = ['SS','WS','SW','WW']

for i in range(n):
  for j in range(len(l)):
    l[j] += 'SW'[::-1 if s[i]=='o' else 1][l[j][i]==l[j][i+1]]
for i in range(len(l)):
  if l[i][1]==l[i][n+1] and l[i][0]==l[i][n]:
    print(l[i][1:n+1])
    exit()
print(-1)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
l = ['SS','WS','SW','WW']

for i in range(n):
  for j in range(len(l)):
    l[j] += 'SW'[::-1 if s[i]=='o' else 1][l[j][i]==l[j][i+1]]
for i in range(n):
  if l[i][1]==l[i][n+1] and l[i][0]==l[i][n]:
    print(l[i][1:n+1])
    exit()
print(-1)
Problem p03828 (python)

Fixed submission:
n = int(input())
t = [0]*n
f = 1
mod = 10**9+7
for i in range(2,n+1):
  fa = 1
  while i > 1:
    fa += 1
    while i % fa == 0:
      i = i//fa
      t[fa-2] += 1

for j in range(n):
  f = f*(t[j]+1)%mod
print(f)

Buggy submission (verdict: Runtime Error):
import math
n = math.factorial(int(input()))
mod = 10**9+7
#print(n)
def div(n):
  di = []
  for i in range(1,int(n**0.5)+1):
    if n % i == 0:
      di.append(i)
      if i != n//i:
        di.append(n//i)
  return di
print(len(div(n))%mod)

Buggy submission (verdict: Runtime Error):
import math
n = math.factorial(int(input()))
#print(n)
def div(n):
  di = []
  for i in range(1,int(n**0.5)+1):
    if n % i == 0:
      di.append(i)
      if i != n//i:
        di.append(n//i)
  return di
print(len(div(n)))
Problem p03844 (python)

Fixed submission:
a, p, b = map(str,input().split())
print(int(a)+int(b) if p == '+' else int(a)-int(b))

Buggy submission (verdict: Runtime Error):
import collections
n = int(input())
*pr, = map(int,input().split())
#print(pr)
d = collections.Counter(pr)
#print(d)
mod = 10**9+7
if n % 2 != 0:
  if d[0] != 1:
    print(0)
    exit()
  else:
    for k, v in d.items():
      if k != 0 and v != 2:
        print(0)
        exit()
      elif k%2 != 0:
        print(0)
        exit()
    print(((len(d)-1)**2)%mod)
else:
  for ky,vl in d.items():
    if ky == 0:
      print(0)
      exit()
    elif ky%2 == 0:
      print(0)
      exit()
    elif vl != 2:
      print(0)
      exit()
  print((len(d)**2)%mod)

Buggy submission (verdict: Runtime Error):
n = int(input())
pr = list(map(int,input().split()))
#print(pr)
m = int(input())
f = lambda:map(int,input().split())
for i in range(m):
  n, d = f()
  #print(n,d)
  mot = pr[n-1]
  pr[n-1] = d
  print(sum(pr))
  pr[n-1] = mot
Problem p03998 (python)

Fixed submission:
dic = {s:list(input()) for s in 'abc'}

flag = 'a'
while dic[flag]:
  flag = dic[flag].pop(0)
print(flag.upper())

Buggy submission (verdict: Runtime Error):
A = input()
B = input()
C = input()
flag = 'A'

def chk(A, B, C, flag, st):
    if len(st) == 0:
        return flag
    elif st[0].upper() == flag:
        if flag == 'A':
            A = st[1:]
            st = A
        elif flag == 'B':
            B = st[1:]
            st = B
        elif flag == 'C':
            C = st[1:]
            st = C
    elif st[0] == 'a':
        flag = 'A'
        st = A[1:]
    elif st[0] == 'b':
        flag = 'B'
        st = B[1:]
    elif st[0] == 'c':
        flag = 'C'
        st = C[1:]
    return chk(A, B, C, flag, st)

print(chk(A, B, C, flag, st=A))
Problem p04011 (python)

Fixed submission:
N = int(input())
K = int(input())
X = int(input())
Y = int(input())

if N > K:
  print(X*K+Y*(N-K))
elif N <= K:
  print(X*N)

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

flag = False

if s == n:
  print(n+1)
  exit()

def chk(b, n):
  if n//b == 0:
    return n
  else:
    return chk(b,n//b) + n%b

for b in range(2, int(n**0.5)+1):
  if chk(b, n) == s:
    print(b)
    flag = True
    exit()

for i in range(int(n**0.5), 0, -1):
  b = (n-s)//i + 1
  if chk(b, n) == s:
    print(b)
    flag = True
    exit()

if flag == False:
  print(-1)
Problem p04029 (python)

Fixed submission:
N = int(input())
counter = 0
for i in range(1, N+1):
  counter += i
print(counter)

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

import math
from statistics import mean, median
mean_ai = mean(ai_list)
median_ai = median(ai_list)
mean_lo = math.floor(mean_ai)
mean_high = math.ceil(mean_ai)

ans_list = []
cost1 = 0
cost2 = 0
cost3 = 0
for n in ai_list:
  cost1 += (n - mean_lo)**2
  cost2 += (n - mean_high)**2
  cost3 += (n - median_ai)**2
ans_list.append(cost1)
ans_list.append(cost2)
ans_list.append(cost3)
print(min(ans_list))
Problem p04030 (python)

Fixed submission:
S = input()
str = ''

for w in S:
  if w == 'B':
    if str == '':
      continue
    else:
      str = str[:-1]
  elif w == '0':
    str += '0'
  elif w == '1':
    str += '1'
print(str)

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

for w in S:
  if w == 'B':
    if str[-1] == '0':
      str = str.rstrip('0')
    elif str[-1] == '1':
      str = str.rstrip('1')
  elif w == '0':
    str += '0'
  elif w == '1':
    str += '1'
print(str)
Problem p04032 (python)

Fixed submission:
def solve(s):
  for i in range(len(s)-1):
    if s[i] == s[i+1]:
      return '{0} {1}'.format(i+1, i+2)
  for i in range(len(s)-2):
    if s[i] == s[i+2]:
      return '{0} {1}'.format(i+1, i+3)
  return '{0} {1}'.format(-1, -1)

print(solve(input()))

Buggy submission (verdict: Runtime Error):
def solve(s):
  for i, j in zip(range(0, len(s)-1), range(1, len(s))):
    if s[i] == s[j]:
      return '{0} {1}'.format(i+1,j+1)
  for i, j in zip(range(0, len(s)-2), range(2, len(s))):
    if s[i] == s[j]:
      return '{0} {1}'.format(i+1, j+1)
  return '{0} {1}'.format(-1 -1)

print(solve(input()))

Buggy submission (verdict: Runtime Error):
s = input()
dic = {}
flag = False

for key in s:
  if key not in dic:
    dic[key] = 0
  dic[key] += 1

for k, v in dic.items():
  if len(s) % 2 == 0:
    if v > len(s)/2:
      answ = k
      flag = True
  elif len(s) % 2 == 1:
    if v >= len(s)/2:
      answ = k
      flag = True
    
if flag == False:
  print(-1, -1)

start = s.find(answ)+1
end = s.rfind(answ)+1
print(start, end)

Buggy submission (verdict: Runtime Error):
s = input()
dic = {}
flag = False

for key in s:
  if key not in dic:
    dic[key] = 0
  dic[key] += 1

for k, v in dic.items():
  if v >= len(s)/2:
    answ = k
    flag = True
    
if flag == False:
  print(-1, -1)

start = s.find(answ)+1
end = s.rfind(answ)+1
print(start, end)
Problem p04045 (python)

Fixed submission:
N, K = map(int, input().split())
de_num = list(map(int, input().split()))
ok_num = []
cand_num = []
ans_num = []
#print(de_num)

for i in range(10):
  if i not in de_num:
    ok_num.append(i)
#print(ok_num)

for i in ok_num:
  for j in ok_num:
    for k in ok_num:
      for l in ok_num:
        for m in ok_num:
          if len(str(N)) == 4:
            num = 10000*i + 1000*j + 100*k + 10*l + m
            cand_num.append(num)
            num_s = 1000*j + 100*k + 10* l +m
            cand_num.append(num_s)
          elif len(str(N)) == 3:
            num = 1000*j + 100*k + 10*l + m
            cand_num.append(num)
            num_s = 100*k + 10*l + m
            cand_num.append(num_s)
          elif len(str(N)) == 2:
            num = 100*k + 10*l + m
            cand_num.append(num)
            num_s = 10*l + m
            cand_num.append(num_s)
          elif len(str(N)) == 1:
            num = 10*l + m
            cand_num.append(num)
            num_s = m
            cand_num.append(num_s)
            

for cd in cand_num:
  if cd >= N:
    ans_num.append(cd)

print(min(ans_num))

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
de_num = list(map(int, input().split()))
ok_num = []
cand_num = []
ans_num = []

for i in range(10):
  if i not in de_num:
    ok_num.append(i)

for i in ok_num:
  for j in ok_num:
    for k in ok_num:
      for l in ok_num:
        num = 1000*i + 100*j + 10*k + l
        cand_num.append(num)

for cd in cand_num:
  if cd >= N:
    ans_num.append(cd)

print(min(ans_num))
Problem p02952 (python)

Fixed submission:
#ACB-136-B1

N = int(input())

str_N= str(N)
ans = 0
for i in range(1,N+1):
	if len(str(i)) % 2 ==1:
		ans +=1
print(ans)

Buggy submission (verdict: Runtime Error):
#ACB-136-B1

N = int(input())

str_N= str(N)

for i in range(1,N+1):
	if len(str(i)) % 2 ==1:
		ans +=1
print(ans)

Buggy submission (verdict: Runtime Error):
#ACB-136-B1

N = int(input())

str_N= str(N)

for i in range(1,N+1):
	if len(str(i)) % 2 ==1:
		ans +-1
print(ans)
Problem p02934 (python)

Fixed submission:
N = int(input())
out = 1 / sum([1/int(a) for a in input().split()])
print(out)

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

sum_a = 0
for _ in range(N):
	a = int(input())
    sum_a += 1/a

print(1/sum_a)
Problem p02945 (python)

Fixed submission:
a,b = map(int,input().split())
print(max(a*b,a+b,a-b))

Buggy submission (verdict: Runtime Error):
n = int(input())
lis = []
for i in range(n):
  word = str(input())
  lis.append({letter:word.count(letter) for letter in word})
counter = 0
while True:
  m = lis.count(lis[0])
  counter += (m*(m-1))//2
  lis.remove(lis[0])
  if len(lis) == 0:
    break
print(counter)

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
print(max(a*b,a+b,a-b)
Problem p02958 (python)

Fixed submission:
N = int(input())
lis = list(map(int,input().split()))
counter = 0
for i in range(N):
  if lis[i] - i-1 != 0:
    counter += 1
if counter > 2:
  print('NO')
else:
  print('YES')

Buggy submission (verdict: Runtime Error):
N = int(input())
lis = list(map(int,input().split()))
counter = 0
for i in N:
  if lis[i-1] - N != 0:
    counter += 1
if counter > 2:
  print('NO')
else:
  print('YES')
Problem p03067 (python)

Fixed submission:
a,b,c = map(int,input().split())
if (a>c>b):
  print("Yes")
elif(b>c>a):
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
s = list(str(input()))
lis = []
for i in range(1,n):
    lis.append(s[:i:].count("#") + s[i::].count("."))
lis.append(s.count("#"))
lis.append(s.count("."))
lis.sort()
print(lis[0])

Buggy submission (verdict: Runtime Error):
n = int(input())
s = list(str(input()))
a = 0
b = 0
for i in range(n):
  if s[i] == ".":
    a += 1
  else:
    break
for i in range(n):
  if s[-i-1] =="#":
    b += 1
  else:
    break
sb = s.count("#")
sw = s.count(".")
if sb-b>sw-a:
  print(sw-a)
else:
  print(sb-b)
Problem p02934 (python)

Fixed submission:
n = int(input())
a = input().split(' ')
for i in range(n):
  a[i] = int(a[i])
  
res = 0.0
for i in range(n):
  res += 1 / a[i]

print(1 / res)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = input().split(' ')
for i in range(n):
  a[i] = int(a[i])
print(a)

def gcd(a,b):
  while b!=0:
    a,b=b,a%b
  return a

bunshi = 1
bunbo = a[0]
for i in range(1, n):
  bunshi = bunbo + a[i]
  bunbo = bunbo * a[i]
  gcd = gcd(bunbo, bunshi)
  bunbo = bunbo / gcd
  bunshi = bunshi / gcd
print(bunbo / bunshi)
Problem p02934 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
sam = 0
for i in range(N):
  sam += A[i]**-1
print(sam**-1)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [int(x) for x in input().split()]
for i in range(N):
  sam += A[i]**-2
print(sam**-2)

Buggy submission (verdict: Runtime Error):
a = int(input())
sam = 0
b = 0
for i in range(5):
  b = int(input())
  sam += b**-2
print(sam**-2)

Buggy submission (verdict: Runtime Error):
a = int(input())
sam = 0
b = 0
for i in range(a):
  b = int(input())
  sam += pow(b, -1)
print(pow(sam, -1)

Buggy submission (verdict: Runtime Error):
a = int(input())
sum = 0
for i in range(a):
  b = int(input())
  sum += pow(b, -1)
print(pow(sum, -1)

Buggy submission (verdict: Runtime Error):
import numpy as np
a = int(input())
sum = 0
for i in range(a):
  b = int(input())
  sum += b
np.reciprocal(sum)
np.reciprocal(sum)
print(sum)

Buggy submission (verdict: Runtime Error):
import numpy as np
a = int(input())
sum = 0
for i in range(a):
  bb = int(input())
  sum += b
np.reciprocal(sum)
np.reciprocal(sum)
print(sum)

Buggy submission (verdict: Runtime Error):
a = int(input())
b = []
sum = 0
for i in range(a):
  b[i] = int(input())
  sum += b[i]
print(sum)

Buggy submission (verdict: Runtime Error):
import numpy as np
a = int(input())
b = []
sum = 0
for i in range(a):
  b[i] = int(input())
  sum += b[i]
np.reciprocal(sum)
np.reciprocal(sum)
print(sum)

Buggy submission (verdict: Runtime Error):
import numpy as np
a = int(input())
b = []
sum = 0
for i in range(a):
  b[i] = int(input())
  sum += b[i]
print(np.reciprocal(np.reciprocal(sum)))

Buggy submission (verdict: Runtime Error):
import numpy as np
a = int(input())
b = []
sum = 0
for i in a:
  b[i] = int(input())
  sum += b[i]
print(np.reciprocal(np.reciprocal(sum)))

Buggy submission (verdict: Runtime Error):
a = int(input())
b = []
sum = 0
for i in a:
  b[i] = int(input())
  sum += b[i]
print(reciprocal(reciprocal(sum)))

Buggy submission (verdict: Runtime Error):
a = input()
b = []
sum = 0
for i in a:
  b[i] = input()
  sum += b[i]
print(reciprocal(reciprocal(sum)))
Problem p02934 (python)

Fixed submission:

n = int(input())

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

sum = 0
for el in lst:
    sum += 1/el

print(1/sum)

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

lst = []

for i in range(n):
    lst.append(int(input()))

sum = 0
for el in lst:
    sum += 1/el

print(1/sum)
Problem p02981 (python)

Fixed submission:
(n,a,b)=map(int,input().split())
print(min(n*a,b))

Buggy submission (verdict: Runtime Error):
(n,a,b)=map(int,inpput().split())
print(mini(n*a,b))
Problem p03777 (python)

Fixed submission:
x, y = input().split()
if x == y:
  print("H")
else:
  print("D")

Buggy submission (verdict: Runtime Error):
x, y = input.split()
if x == y:
  print("H")
else:
  print("D")
Problem p04044 (python)

Fixed submission:
n, l = map(int,input().split())
li = sorted([input() for i in range(n)])
print(*li, sep="")

Buggy submission (verdict: Runtime Error):

def resolve():
    num, long = list(input().split())
    string = sorted([input for i in range(num)])
    print(*string, sep="")

if __name__ == '__main__':
    resolve()