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

Fixed submission:
n = int(input())
a = [int(input()) for _ in range(n)]
a.sort()

def fanc(n, a):
    if n == 1: 
        print(1)
        return 0
    cnt = 0
    while len(a) > 1:
        same_cnt = 0
        j = 1
        while a[0] == a[j]:
            same_cnt += 1
            if j == len(a) - 1:
                break
            j += 1
        if same_cnt  % 2 == 0:
            cnt += 1
        del a[0:same_cnt+1]
    if len(a) == 1: cnt += 1
    print(cnt)
    return 0

fanc(n, a)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [int(input()) for _ in range(n)]
a.sort()

def fanc(n, a):
    if n == 1: 
        print(1)
        return 0
    cnt = 0
    while len(a) > 0:
        same_cnt = 1
        j = 1
        while a[0] == a[j]:
            same_cnt += 1
            if j == len(a) - 1:
                break
            j += 1
        if same_cnt  % 2 == 1:
            cnt += 1
        del a[0:same_cnt]
    print(cnt)
    return 0

fanc(n, a)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [int(input()) for _ in range(n)]
a.sort()

if len(a) == 1: cnt = 1
else: cnt = 0
while len(a) > 0:
    same_cnt = 1
    j = 1
    while a[0] == a[j]:
        same_cnt += 1
        if j == len(a) - 1:
            break
        j += 1
    if same_cnt  % 2 == 1:
        cnt += 1
    del a[0:same_cnt]
print(cnt)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [int(input()) for _ in range(n)]
a.sort()

cnt = 0
while len(a) > 0:
    same_cnt = 1
    j = 1
    while a[0] == a[j]:
        same_cnt += 1
        if j == len(a) - 1:
            break
        j += 1
    if same_cnt  % 2 == 1:
        cnt += 1
    del a[0:same_cnt]
print(cnt)
Problem p03680 (python)

Fixed submission:
n = int(input())
a = [int(input()) for _ in range(n)]

i = 0
cnt = 0
while not i == 1:
    i = a[i] - 1
    cnt += 1
    if i >= n or cnt > 100000:
        print(-1)
        exit()
print(cnt)

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

i = 0
cnt = 0
while not i == 1:
    i = a[i] - 1
    cnt += 1
    if i >= n or cnt > 100000:
        exit("-1")
print(cnt)
Problem p03283 (python)

Fixed submission:
import numpy as np
n,m,q = map(int,raw_input().split())

imos = [[0 for i in xrange(n)] for j in xrange(n)]

for i in xrange(m):
	f,t = map(int,raw_input().split())
	f -= 1
	t -= 1
	imos[f][t] += 1

for i in range(n-1,0,-1):
	for j in range(n):
		imos[i-1][j] = imos[i][j] + imos[i-1][j]

for i in xrange(n):
	imos[i] = np.cumsum(imos[i])

for i in xrange(q):
	a,b = map(int,raw_input().split())
	print imos[a-1][b-1]

Buggy submission (verdict: Runtime Error):
import numpy as np
n,m,q = map(int,raw_input().split())

imos = [[0 for i in xrange(n)] for j in xrange(n)]

for i in xrange(m):
	f,t = map(int,raw_input().split())
	f -= 1
	t -= 1
	for j in range(f+1):
		imos[j][t] += 1

#for i in range(n):
#	for j in range(1,n):
#		imos[i][j] = imos[i][j-1] + imos[i][j]

for i in xrange(n):
	imos[i] = np.cumsum(imos[i])

for i in xrange(q):
	a,b = map(int,raw_input().split())
	print imos[a-1][b-1]
Problem p03304 (python)

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

print (((n-d)*2)/float(n**2))*(m-1) if d != 0 else ((((n-d)*2)/float(n**2))*(m-1))/2

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

print (((n-d)*2)*(m-1)*n)/float(n**m)
Problem p03309 (python)

Fixed submission:
import numpy as np
n = int(input())

arr = map(int,raw_input().split())

arrb = []

for i in range(n):
	arrb.append(arr[i]-i)

med = np.median(arrb)

ans = 0
for i in range(n):
	ans += abs(arrb[i]-med)

print int(ans)

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

arr = map(int,raw_input().split())

for i in range(n):
	arr[i] -= (i+1)

mi = min(arr)
ma = max(arr)


ans = float("inf")
for i in range(mi,ma+1):
	count = 0
	for j in range(n):
		count += abs(arr[j]-i)

	ans = min(ans,count)

print ans
Problem p03337 (python)

Fixed submission:
a,b = map(int,raw_input().split())

print max(a+b,a-b,a*b)

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

print max(a+b,a-b,a*b)
Problem p03369 (python)

Fixed submission:
s = raw_input()
 
print 700 + s.count('o')*100

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

print 700 + s.count(o)*100
Problem p03425 (python)

Fixed submission:
import itertools
n = int(raw_input())

d = {'M':0,'A':0,'R':0,'C':0,'H':0}

for i in range(n):
	s = raw_input()
	if d.has_key(s[0]):
		d[s[0]] += 1

count = 0

for comb in list(itertools.combinations(d.keys(),3)):
	count += d[comb[0]]* d[comb[1]]*d[comb[2]]

print count

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

arr = []
for i in range(n):
	arr.append(raw_input())

count = 0

def dfs(rest_str,person_count,i):
	global count
	if person_count == 3:
		count += 1

	elif i < n:
		if arr[i][0] in rest_str :
			dfs(rest_str.replace(arr[i][0],''),person_count+1,i+1)

		dfs(rest_str,person_count,i+1)

dfs('MARCH',0,0)
print count
Problem p03504 (python)

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

r = [[0 for i in range(c)] for j in range(100000)] 
for dummy in range(n): 
    s, t, c = map(int, input().split())
    for j in range(s - 1, t):
        r[j][c - 1] = 1 

ans = 0
for i in range(100000):
    if sum(r[i]) > ans:
        ans = sum(r[i]) 

print(ans)

Buggy submission (verdict: Runtime Error):
n, c = map(int,raw_input().split())

arr = [[0 for i in range(c)] for j in range(10**5+1)]

for i in range(n):
	s,t,ch = map(int,raw_input().split())
	s -= 1
	ch -= 1
	for i in range(s,t):
		arr[i][ch] = 1

ans = 0

for i in range(10**5+1):
	ans = max(ans,sum(arr[i]))

print ans

Buggy submission (verdict: Runtime Error):
n,c = map(int,raw_input().split())

arr = [[0 for i in range((10**5+1))] for i in range(c)]

for i in range(n):
	s,t,ch = map(int,raw_input().split())
	arr[ch-1][s-1] = 1
	arr[ch-1][t] = -1

for i in range(c):
	for j in range(1,(10**5+1)):
		arr[i][j] += arr[i][j-1]



ans = 0
for i in range(((10**5+1))):
	count = 0
	for j in range(c):
		if arr[j][i] > 0 :
			count += 1

	ans = max(ans,count)

print ans

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

r = [[0 for i in range(c)] for j in range(100000)] 
for i in range(n):
    s, t, c = map(int, input().split())
    for j in range(s - 1, t):
        r[j][c - 1] = 1 

ans = 0
for i in range(100000):
  	ans = max(ans,sum(r[i])

print(ans)

Buggy submission (verdict: Runtime Error):
n,c = map(int,raw_input().split())

arr = [[0 for i in range((10**5) * 2)] for i in range(c)]

for i in range(n):
	s,t,ch = map(int,raw_input().split())
	arr[ch-1][s*2-1] = 1
	arr[ch-1][t*2] = -1

for i in range(c):
	for j in range(1,(10**5)*2):
		arr[i][j] = arr[i][j-1] + arr[i][j]



ans = 0
for i in range((10**5*2)):
	count = 0
	for j in range(c):
		if arr[j][i] > 0 :
			count += 1

	ans = max(ans,count)

print ans
Problem p03546 (python)

Fixed submission:
h,w = map(int,raw_input().split())
d = [map(int,raw_input().split()) for i in range(10)]
for t in xrange(10):
	for i in range(10):
		for j in range(10):
			for k in range(10):
				d[i][j] = min(d[i][j], d[i][k] + d[k][j])
arr = [map(int,raw_input().split()) for i in range(h)]

print sum(sum(d[a][1] if a>=0 else 0 for a in aa) for aa in arr)

Buggy submission (verdict: Runtime Error):
h,w = map(int,raw_input().split())
d = [map(int,raw_input().split()) for i in range(10)]

	for k in range(10):
		for i in range(10):
			for j in range(10):
				d[i][j] = min(d[i][j], d[i][k] + d[k][j])
arr = [map(int,raw_input().split()) for i in range(h)]

print sum(sum(d[a][1] if a>=0 else 0 for a in aa) for aa in arr)
Problem p03608 (python)

Fixed submission:
from itertools import permutations
import sys

def main():
    
    N, M, R = map(int, sys.stdin.readline().split())
    r = [i - 1 for i in map(int, sys.stdin.readline().split())]
    
    d = [[float('inf')] * N for _ in range(N)]
    
    for i in range(N):
        d[i][i] = 0
        
    for i in range(M):
        a, b, c = map(int,sys.stdin.readline().split())
        d[a-1][b-1] = c
        d[b-1][a-1] = c
        
    for k in range(N):
        for i in range(N):
            for j in range(N):
                if d[i][j] > d[i][k] + d[k][j]:
                    d[i][j] = d[i][k] + d[k][j]
    
    ans = 10**12
    
    for each in permutations(r):
        t_dis = 0
        for i in range(R-1):
            t_dis += d[each[i]][each[i+1]]  
        
        ans = min(ans, t_dis)
    
    print(ans)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
from itertools import permutations

inf = float("inf")
n,m,r = map(int,raw_input().split())
arr = map(int,raw_input().split())
x = range(n)
d = [[inf for i in x] for j in x]

for i in range(n):
	d[i][i] = 0

for i in x:
	f,t,c = map(int,raw_input().split())
	d[f-1][t-1] = c
	d[t-1][f-1] = c



for i in x:
	for j in x:
		for k in x:
			d[i][j] = min(d[i][j], d[i][k] + d[k][j])


ans = inf
for i in permutations(arr):
	distance = 0
	for j in range(r-1):
		distance += d[i[j]-1][i[j+1]-1]

	ans = min(ans,distance)

print ans
Problem p03633 (python)

Fixed submission:
def gcd(a,b):
	if b == 0 :
		return a
	else :
		return gcd(b,a%b)
 
def lcm(a,b):
	return a*b/gcd(a,b)
 
n = int(input())
arr = []
for i in range(n):
 
	arr.append(int(input()))
 
 
def mlcm():
 	if n == 1:
 		return arr[0]

	ans = lcm(arr[0],arr[1])
 
	i = 2
	while i<n:
		ans = lcm(ans,arr[i])
		i+=1
 
	return ans
 
print mlcm()

Buggy submission (verdict: Runtime Error):
def gcd(a,b):
	if b == 0 :
		return a
	else :
		return gcd(b,a%b)
 
def lcm(a,b):
	return a*b/gcd(a,b)
 
n = int(input())
arr = []
for i in range(n):
 
	arr.append(int(input()))
 
 
def mlcm():
 	if n = 1:
 		return arr[0]
 		
	ans = lcm(arr[0],arr[1])
 
	i = 2
	while i<n:
		ans = lcm(ans,arr[i])
		i+=1
 
	return ans
 
print mlcm()

Buggy submission (verdict: Runtime Error):
def gcd(a,b):
	if b == 0 :
		return a
	else :
		return gcd(b,a%b)

def lcm(a,b):
	return a*b/gcd(a,b)

n = int(input())
arr = []
for i in range(n):

	arr.append(int(input()))


def mlcm():

	ans = lcm(arr[0],arr[1])

	i = 2
	while i<n:
		ans = lcm(ans,arr[i])
		i+=1

	return ans

print mlcm()
Problem p03660 (python)

Fixed submission:
n = int(input())

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

for i in range(n-1):
    f,t = map(int,raw_input().split())
    f -= 1
    t -= 1

    edge[f].append(t)
    edge[t].append(f)

inf = float("inf")
dist1 = [inf for i in range(n)]

dist1[0] = 0
stk = []
for i in edge[0]:
    stk.append([i,1])

while stk:
    t,c = stk.pop()
    if dist1[t] == inf :
        dist1[t] = c
        for i in edge[t]:
            stk.append([i,c+1])

dist2 = [inf for i in range(n)]
dist2[n-1] = 0
for i in edge[n-1]:
    stk.append([i,1])
while stk:
    t,c = stk.pop()
    if dist2[t] == inf :
        dist2[t] = c
        for i in edge[t]:
            stk.append([i,c+1])

fennec = 0
snuke = 0

for i in range(n):
    if dist1[i] <= dist2[i]:
        fennec += 1
    else :
        snuke += 1


if fennec > snuke:
    print "Fennec"
else:
    print "Snuke"

Buggy submission (verdict: Runtime Error):
inf = float("inf")
dist1 = [inf for i in range(n)]

dist1[0] = 0
stk = []
for i in edge[0]:
    stk.append([i,1])

while stk:
    t,c = stk.pop()
    if dist1[t] == inf :
        dist1[t] = c
        for i in edge[t]:
            stk.append([i,c+1])

dist2 = [inf for i in range(n)]
dist2[n-1] = 0
for i in edge[n-1]:
    stk.append([i,1])
while stk:
    t,c = stk.pop()
    if dist2[t] == inf :
        dist2[t] = c
        for i in edge[t]:
            stk.append([i,c+1])

fennec = 0
snuke = 0

for i in range(n):
    if dist1[i] <= dist2[i]:
        fennec += 1
    else :
        snuke += 1
print fennec
print snuke

if fennec > snuke:
    print "Fennec"
else:
    print "Snuke"
Problem p03994 (python)

Fixed submission:

aord = ord("a")
s = list(raw_input())
k = int(input())
i = 0

while k > 0 and i < len(s):
	if k >= ord('z') - ord(s[i]) + 1:
		if s[i] != "a":
			k -= ord('z') - ord(s[i]) + 1
			s[i] = "a"

	i += 1
k = k%26
s[len(s)-1] = chr(ord(s[len(s)-1]) + k)
print ''.join(s)

Buggy submission (verdict: Runtime Error):

aord = ord("a")
s = list(raw_input())
k = int(input())
i = 0

while k > 0 and i < len(s):
	if k >= ord('z') - ord(s[i]) + 1:
		if s[i] == "a": continue
		k -= ord('z') - ord(s[i]) + 1
		s[i] = "a"

	i += 1

s[len(s)-1] = chr(ord(s[len(s)-1]) + k)
print ''.join(s)

Buggy submission (verdict: Runtime Error):

aord = ord("a")
s = list(raw_input())
k = int(input())
i = 0

while k > 0 and i < len(s):
	if k >= (aord + 26 - ord(s[i])):
		k -= (aord + 26 - ord(s[i]))
		s[i] = "a"

	i += 1

s[len(s)-1] = chr(ord(s[len(s)-1]) + k)
print ''.join(s)
Problem p04047 (python)

Fixed submission:
n = int(input())

arr = map(int,raw_input().split())

arr.sort()

count = 0
for i in range(n):
	count += arr[i*2]

print count

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

arr = [map(int,raw_input().split()) for i in range(n)]

count = 0
for i in range(n-1):
	for j in range(i+1,n):
			s = sum(arr[i]) + sum(arr[j])
			comb = s*(s-1)/2
			count += comb

print count%(1000000000+7)
Problem p02865 (python)

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

Buggy submission (verdict: Runtime Error):
N=input()
if N%2==0:
    print((N)/2-1)
else:
    print((N-1)/2)

Buggy submission (verdict: Runtime Error):
if N%2==0:
    print((N)/2-1)
else:
    print((N-1)/2)

Buggy submission (verdict: Runtime Error):
 if N%2==0 :
    print((N)/2-1)
 else:
  print((N-1)/2)
Problem p03455 (python)

Fixed submission:
a, b = input().rsplit()
c = int(a) * int(b)

if c % 2 == 0:
  print("Even")
  
elif c % 2 != 0:
  print("Odd")

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

if c % 2 == 0:
  print("Even")
  
elif c % 2 != 0:
  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")
Problem p03434 (python)

Fixed submission:
n = int(input())
a = sorted(map(int, input().split()))
print(abs(sum(a[0:][::2])-sum(a[1:][::2])))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = sorted(map(int, input().split()), reverse=True)
print(sum(a[0:][::2])-sum(a[1:][::2])
Problem p03494 (python)

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

def cnt(li, c):
    arr = []
    for i in li:
        arr.append(i/2)
        if i%2!=0: return c
    return cnt(arr, c+1)

print(cnt(a,0))

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

def cnt(arr):
    g = c = 0
    for i in arr: g = math.gcd(g,i)
    while g%2==0:
        g/=2
        c += 1
    return c

print(cnt(a))
Problem p02911 (python)

Fixed submission:
def main():
  n,k,q = [int(x) for x in raw_input().split()]
  memo = {}

  for _ in xrange(q):
      pid = int(raw_input()) - 1
      if pid not in memo:
          memo[pid] = 0
      memo[pid] += 1

  for pid in xrange(n):
      score = k - q + memo.get(pid, 0)
      print("Yes" if score > 0 else "No")

main()

Buggy submission (verdict: Runtime Error):
def main():
  n,k,q = [int(x) for x in raw_input().split()]
  answers = [int(raw_input())-1 for x in xrange(q)]
  scores = [k,] * n
  
  for answer in answers:
    for i in xrange(q):
      if i != answer:
        scores[i] -= 1
  
  for score in scores:
    print("Yes" if score > 0 else "No")

main()
Problem p02865 (python)

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

Buggy submission (verdict: Runtime Error):
N = int(input())
D = list(map(int, input().split()))
if (D[0]!=0) or (0 in D[1:]):
  print(0)
else:
  mapping = dict()
  max_ = 0
  for n in D[1:]:
    if n in mapping:
      mapping[n]+=1
    else:
      mapping[n]=1
      if max_ < n :
        max_ = n
  ans=1
  for i in range(1,max_):
    if (i in mapping) and (i+1 in mapping):
      ans *= mapping[i]**(mapping[i+1])
    else:
      ans = 0
      break
  print(ans % 998244353)

Buggy submission (verdict: Runtime Error):
N = str(input())
print((N-1)//2)
Problem p02866 (python)

Fixed submission:
N = int(input())
D = list(map(int, input().split()))
if (D[0]!=0) or (0 in D[1:]):
  print(0)
else:
  mapping = dict()
  max_ = 0
  for n in D[1:]:
    if n in mapping:
      mapping[n]+=1
    else:
      mapping[n]=1
      if max_ < n :
        max_ = n
  ans=1
  for i in range(1,max_):
    if (i in mapping) and (i+1 in mapping):
      ans *= mapping[i]**(mapping[i+1])
    else:
      ans = 0
      break
  print(ans % 998244353)

Buggy submission (verdict: Runtime Error):
N = int(input())
D = list(map(int, input().split()))
if (D[0]!=0) or (0 in D[1:]):
  print(0)
else:
  mapping = dict()
  max_ = 0
  for n in D[1:]:
    if n in mapping:
      mapping[n]+=1
    else:
      mapping[n]=1
      if max_ < n :
        max_ = n
  ans=1
  for i in range(1,max_):
    ans *= mapping[i]**(mapping[i+1])
  print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
D = list(map(int, input().split()))
if (D[0]!=0) or (0 in D[1:]):
  print(0)
else:
  mapping = dict()
  max_ = 0
  for n in D[1:]:
    if n in mapping:
      mapping[n]+=1
    else:
      mapping[n]=1
      if max_ < n :
        max_ = n
  ans=1
  for i in range(1,max_):
    ans *= mapping[i]**(mapping[i+1])
print(ans)
Problem p03068 (python)

Fixed submission:
n = int(input())
s = input()
k = int(input())

char = s[k-1]
ans=''
for i in s:
    if i!=char:
        ans+='*'
    else:
        ans+=char
print(ans)

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

char = s[k-1]
ans=''
for i in s:
    if i!=char:
        ans+='*'
    else:
        ans+=char
print(ans)

Buggy submission (verdict: Runtime Error):
n,s,k = map(str, input().split('\n'))
n = int(n)
k = int(k)
char = s[k-1]
ans=''
for i in s:
    if i!=char:
        ans+='*'
    else:
        ans+=char
print(ans)
Problem p03069 (python)

Fixed submission:
n=int(input())
s=input()
w = s.count('.')
b = 0
ans=w+b
for i in s:
    if i=='#':
        b+=1
    else:
        w-=1
    if ans>=b+w:
        ans=b+w
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
s=input()
ans=0
w = s.count('.')
for i in range(0,n-1):
    if (s[i]=='#')&&(s[i+1]=='.'):
        ans+=1
        s[i+1]='#'
print(min(ans,w,n-w))

Buggy submission (verdict: Runtime Error):
n=int(input())
s=input()
ans=0
w = s.count('.')
for i in range(0,n-1):
    if (s[i]=='#')&(s[i+1]=='.'):
        ans+=1
        s[i+1]='#'
print(min(ans,w,n-w))
Problem p02945 (python)

Fixed submission:
A, B = (int(x) for x in input().split())
c = A + B
d = A - B
e = A * B

if c <= d:
    if d <= e:
        print(e)
    if d > e:
        print(d)

if c > d:
    if c >= e:
        print(c)
    if c < e:
        print(e)

Buggy submission (verdict: Runtime Error):
A = int( input() )
B = int( input() )
c = A + B
d = A - B
e = A * B

if c < d:
    if d < e:
        print(e)
    if d > e:
        print(d)

if c > d:
    if c > e:
        print(c)
Problem p02957 (python)

Fixed submission:
A , B = (int(x) for x in input().split())
k = (B + A) / 2
K = (B + A) % 2
if K == 0:
    print(int(k))
else:
    print("IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(int(x) for x in input().split())
B = list(int(x) for x in input().split())
a = 0
b = 0
for x in range(N):
    B[x] = B[x] + a
    if A[x] > B[x]:
        b = b + B[x]
        a = 0
    else:
        b = b + A[x]
        if A[x] > a:
            a = B[x] - A[x]
        else:
            a = B[x]
if A[N - 1] > B[N - 1]:
    print(b)
else:
    if A[N] > a:
        print(b + a)
    else:
        print(b + A[N])

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(int(x) for x in input().split())
B = list(int(x) for x in input().split())
a = 0
b = 0
for x in range(N):
    B[x] = B[x] + a
    if A[x] > B[x]:
        b = b + B[x]
        a = 0
    else:
        b = b + A[x]
        if A[x] > a:
            a = B[x] - A[x]
        else:
            a = B[x]
if A[N - 1] > B[N - 1]:
    print(b)
else:
    if A[N] > a:
        print(b + a)
    else:
        print(b + A[N])
Problem p03102 (python)

Fixed submission:
n, m, c = map(int, input().split())
b = list(map(int, input().split()))
a = [list(map(int, input().split())) for _ in range(n)]

res = 0
for p in a:
  if sum(i*j for i,j in zip(p,b)) + c > 0:
    res += 1
print(res)

Buggy submission (verdict: Runtime Error):
n, m, c = map(int, input().split())
b = list(map(int, input().split()))
a = [list(map(int, input().split())) for _ in range(n)]

res = 0
for p in a:
  if sum(i+j for i,j in zip(p,b)) + c > 0:
    res += 1
return res
Problem p03110 (python)

Fixed submission:
n = int(input())
xs, us = [], []
for _ in range(n):
  x, u = input().split(' ')
  xs.append(float(x))
  us.append(u)
total_yen = 0
for x, u in zip(xs, us):
  if u == 'BTC':
    total_yen += (x*380000.0)
  else:
    total_yen += x
print(total_yen)

Buggy submission (verdict: Runtime Error):
n = int(input())
xs, us = [], []
for _ in range(n):
  x, u = input()
  xs.append(float(x))
  us.append(u)
total_yen = 0
for x, u in zip(xs, us):
  if u == 'BTC':
    total_yen += (x*380000.0)
  else:
    total_yen += x
print(total_yen)
Problem p03111 (python)

Fixed submission:

import numpy as np

N, A, B, C = map(int, input().split(' '))
ls = []
for _ in range(N):
    ls.append(int(input()))
n = 0
INF = 10 ** 9

def dfs(n, a, b, c):
    if n == N:
        return INF if min(a, b, c) == 0 else abs(a-A) + abs(b-B) + abs(c-C) - 30
    res0 = dfs(n+1, a, b, c)
    res1 = dfs(n+1, a+ls[n], b, c) + 10
    res2 = dfs(n+1, a, b+ls[n], c) + 10
    res3 = dfs(n+1, a, b, c+ls[n]) + 10
    return min(res0, res1, res2, res3)

print(dfs(0, 0, 0, 0))

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

n, a, b, c = map(int, input().split(' '))
ls = []
for _ in range(n):
    ls.append(int(input()))
n = 0
def solve(obj):
  c = len(ls)
  dp = np.zeros((obj+1, c+1), dtype=int)
  dp[1:, 0] = np.inf
  for j in range(1, c+1):
    dp[0, j] = min(ls[:j])
  for i in range(1, obj+1):
    for j in range(1, c+1):
      dp[i, j] = min(dp[i-1, j] + 1, dp[i, j-1], dp[i-ls[j-1], j-1] + 10, abs(ls[j-1]) - i)
  return dp[obj, c]

for obj in [a, b, c]:
  if obj in ls:
    continue
  else:
    n += solve(obj)
print(n)
Problem p03125 (python)

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

Buggy submission (verdict: Runtime Error):
a, b = map(int, ' '.split(input()))
if b%a == 0:
  print(a+b)
else:
  print(b-a)
Problem p03147 (python)

Fixed submission:
N = int(input())
H = list(map(int, input().split(' ')))
cost = 0
for i in range(N-1):
  if H[i] > H[i+1]:
    cost += (H[i] - H[i+1])
cost += H[N-1]
print(cost)

Buggy submission (verdict: Runtime Error):
N = int(input())
H = [int(input()) for _ in range(N)]
cost = 0
for i in range(N-1):
  if H[i] > H[i+1]:
    cost += (H[i] - H[i+1])
cost += H[N-1]
print(cost)