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

Fixed submission:
import functools as ft

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

def main():
	N, K = list(map(int, input().split()))
	nums = list(map(int, input().split()))

	max_num = max(nums)
	g = ft.reduce(lambda x, y: gcd(x, y), nums)

	if K <= max_num and K % g == 0:
		print("POSSIBLE")
	else:
		print("IMPOSSIBLE")

if __name__ == '__main__':
	main()

Buggy submission (verdict: Runtime Error):
# encoding:utf-8
import functools as ft
import math

def main():
	N, K = list(map(int, input().split()))
	nums = list(map(int, input().split()))

	max_num = max(nums)
	g = ft.reduce(lambda x, y: math.gcd(x, y), nums)

	if K <= max_num and K % g == 0:
		print("POSSIBLE")
	else:
		print("IMPOSSIBLE")

if __name__ == '__main__':
	main()

Buggy submission (verdict: Runtime Error):
# encoding:utf-8
import functools as ft
import math

def main():
	N, K = list(map(int, input().split()))
	nums = list(map(int, input().split()))

	max_num = max(nums)
	g = ft.reduce(lambda x, y: math.gcd(x, y), nums)

	if K <= max_num and K % g == 0:
		return("POSSIBLE")
	else:
		return("IMPOSSIBLE")

if __name__ == '__main__':
	print(main())

Buggy submission (verdict: Runtime Error):
# encoding:utf-8
from functools import reduce
import math


def main():
	N, K = list(map(int, input().split()))
	nums = list(map(int, input().split()))

	max_num = max(nums)
	g = reduce(lambda x, y: math.gcd(x, y), nums)

	# 最大値が越えてたらだめ
	if K <= max_num and K % g == 0:
		return("POSSIBLE")
	else:
		return("IMPOSSIBLE")


def gcdList(nums):
	tmp = nums[0]
	for x in nums[1:]:
		tmp = math.gcd(tmp, x)
	return(tmp)

if __name__ == '__main__':
	print(main())

Buggy submission (verdict: Runtime Error):
# encoding:utf-8
import math

def main():
	N, K = list(map(int, input().split()))
	nums = list(map(int, input().split()))

	max_num = max(nums)
	min_num = min(nums)

	# 最大値が越えてたらだめ
	if K > max_num:
		return("IMPOSSIBLE")

	gcd_val = gcdList(nums)

	if K % gcd_val > 0:
		return("IMPOSSIBLE")
	else:
		return("POSSIBLE")

def gcdList(nums):
	tmp = nums[0]
	for x in nums[1:]:
		tmp = math.gcd(tmp, x)
	return(tmp)

if __name__ == '__main__':
	print(main())

Buggy submission (verdict: Runtime Error):
# encoding:utf-8
import math

def main():
	N, K = list(map(int, input().split()))
	nums = list(map(int, input().split()))

	max_num = max(nums)
	min_num = min(nums)

	# 最大値が越えてたらだめ
	if K > max_num:
		return("IMPOSSIBLE")

	gcd_val = gcdList(nums)

	if K % gcd_val > 0:
			return("IMPOSSIBLE")
	else:
		return("POSSIBLE")

def gcdList(nums):
	tmp = nums[0]
	for x in nums[1:]:
		tmp = math.gcd(tmp, x)
	return(tmp)

if __name__ == '__main__':
	print(main())
Problem p03666 (python)

Fixed submission:
# encoding:utf-8
import math

def main():
	N, A, B, C, D = list(map(int, input().split()))

	for i in range(N):
		plus_band = calcBand(i, C, D)
		minus_band = calcBand(N - i - 1, C, D)
		total_band = (plus_band[0] - minus_band[1], plus_band[1] - minus_band[0])

		if total_band[0] <= B - A <= total_band[1]:
			print("YES")
			break
	else:
		print("NO")

def calcBand(n_band, C, D):
	return((C * n_band, D * n_band))

if __name__ == '__main__':
	main()

Buggy submission (verdict: Runtime Error):
# encoding:utf-8
import math

def main():
	N, A, B, C, D = list(map(int, input().split()))
	cur_list = [(A, A)]

	for i in range(N - 1):
		cur_list = calcNextList(cur_list, C, D)
		cur_list =[x for x in cur_list if x[0] >= 0 and x[1] <= 10 ** 9]
		cur_list = merge(cur_list)

	print(cur_list)
	for x in cur_list:
		if x[0] <= B <= x[1]:
			print("YES")
			break
	else:
		print("NO")


# def Enlarge(input_taple, D):
# 	return((input_taple[0] - D, input_taple[1] + D))

def Duplicate(input_taple, C, D):
	first_tuple = (input_taple[0] + C, input_taple[1] + D)
	second_tuple = (input_taple[0] - D, input_taple[1] - C)
	return([first_tuple, second_tuple])

def calcNextList(cur_list, C, D):
	next_list = []
	for x in cur_list:
		next_list.extend(Duplicate(x, C, D))
	return(next_list)

def merge(cur_list):
	cur_list.sort()

	next_list = [cur_list[0]]

	for i in range(len(cur_list) - 1):
		if next_list[-1][1] >= cur_list[i+1][0]:
			merged = (next_list[-1][0], max(next_list[-1][1], cur_list[i+1][1]))
			next_list.pop()
			next_list.append(merged)
		else:
			next_list.append(cur_list[i+1])

	return(next_list)

if __name__ == '__main__':
	main()
Problem p03671 (python)

Fixed submission:
# encoding:utf-8
a, b, c = list(map(int, input().split()))
print(min(a + b, b+ c, c + a))

Buggy submission (verdict: Runtime Error):
# encoding:utf-8
n = int(input())
ary = list(map(int, input().split()))

if n % 2 == 0:
	out = [i for i in range(2, n, 2)]
	out.reverse()
	out.extend([i for i in range(1, n, 2)])
	out = list(map(str, out))
else:
	out = [i for i in range(1, n, 2)]
	out.reverse()
	out.extend([i for i in range(2, n, 2)])
	out = list(map(str, out))

print(" ".join(out))
Problem p03693 (python)

Fixed submission:
# encoding:utf-8
def main():
	r, g, b = list(map(int, input().split()))
	if (r * 100 + g * 10 + b) % 4 == 0:
		print("YES")
	else:
		print("NO")
	
if __name__ == '__main__':
	main()

Buggy submission (verdict: Runtime Error):
# encoding:utf-8
def main():
	N = int(input())
	scores = list(map(int, input().split()))
	ranges_colored = set([x // 400 for x in scores if x <= 3199])
	n_colored = len(ranges_colored)
	n_free = len([x for x in scores if x > 3200])
	print(max(n_colored, 1), min(n_free + n_colored, 8))
	
if __name__ == '__main__':
	main()
Problem p03035 (python)

Fixed submission:
def main():
    age, cost = map(int, input().split())

    if age <= 5:
        print(0)
    elif age >= 6 and age <= 12:
        print(cost // 2)
    else:
        print(cost)

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    N, M = map(int, input().split())
    A = [int(x) for x in input().split()]
    for m in range(0, M):
        tmp = [int(x) for x in input().split()]
        A.extend([tmp[1]] * tmp[0])

    A = A.sort(A, reverse = True)
    sum_a = 0
    for i in range(0, N):
        sum_a += A[i]

    print(sum_a)


if __name__ == "__main__":
    main()
Problem p03105 (python)

Fixed submission:
def main():
    a, b, c = map(int, input().split())

    if b // a >= c:
        print(c)
    else:
        print(b // a)
    
if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    a, b, c = map(int, input().split())

    b // a >= c ? print(c) : print(b // a)

if __name__ == "__main__":
    main()
Problem p03160 (python)

Fixed submission:
def main():
    N = int(input())
    h = [int(x) for x in input().split()]

    dp = [float('inf')] * (2 * N)

    dp[0] = 0

    for i in range(1, N):
        dp[i] = min(dp[i], dp[i-1] + abs(h[i] - h[i-1]))
        if i > 1:
            dp[i] = min(dp[i], dp[i-2] + abs(h[i] - h[i-2]))

    print(dp[N-1])


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n = int(input())
    h = [int(x) for x in input().split()]

    dp = [10000] * n
    dp[0] = 0

    for i in range(1, n):
        tmp = dp[i-1] + abs(h[i] - h[i - 1])
        if dp[i] > tmp:
            dp[i] = tmp
        if i > 1:
            tmp = dp[i - 2] + abs(h[i] - h[i - 2])
            if dp[i] > tmp:
                dp[i] = tmp

        print(dp)

    print(dp[n-1])

if __name__ == "__main__":
    main()
Problem p03574 (python)

Fixed submission:
def main():
    h, w = map(int, input().split())
    grid = []
    for height in range(0, h):
        grid.append(list(input()))

    replaced = []
    for height in range(0, h):
        replaced.append([0] * w)

    dx = [0, 0, 1, 1, 1, -1, -1, -1]
    dy = [1, -1, 1, -1, 0, 1, -1, 0]

    for height in range(0, h):
        for width in range(0, w):
            if grid[height][width] == '#':
                replaced[height][width] = '#'
                continue
            for i in range(0, 8):
                if (height + dy[i] < 0) or (height + dy[i] >= h) or (width + dx[i] < 0) or (width + dx[i] >= w):
                    continue
                if (grid[height + dy[i]][width + dx[i]]) == '#':
                    replaced[height][width] += 1

    for height in range(0, h):
        for width in range(0, w):
            print(replaced[height][width], end='')
        print()


if __name__ == "__main__":
  main()

Buggy submission (verdict: Runtime Error):
def main():
    h, w = map(int, input().split())
    grid = []
    for height in range(0, h):
        grid.append(list(input()))

    replaced = []
    for height in range(0, h):
        replaced.append([0] * w)

    dx = [0, 0, 1, 1, 1, -1, -1, -1]
    dy = [1, -1, 1, -1, 0, 1, -1, 0]

    for height in range(0, h):
        for width in range(0, w):
            if grid[height][width] == '#':
                replaced[height][width] = '#'
            for i in range(0, 8):
                if (height + dy[i] < 0) or (height + dy[i] >= h) or (width + dx[i] < 0) or (width + dx[i] >= w):
                    continue
                if (grid[height + dy[i]][width + dx[i]]) == '#':
                    replaced[height][width] += 1

    for height in range(0, h):
        for width in range(0, w):
            print(replaced[height][width], end='')
        print()


if __name__ == "__main__":
  main()
Problem p03943 (python)

Fixed submission:
def main():
    a, b, c = map(int, input().split() )

    if a == b + c or  b == c + a or c == a + b:
        print("Yes")
    else:
        print("No")

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    list = [int(x) for x in input().split()]

    sum = x[0] + x[1] + x[2]
    max = x[0]
    if max <= x[1]:
        max = x[1]
    if max <= x[2]:
        max = x[2]

    if max * 2 == sum:
        print("Yes")
    else:
        print("No")

if __name__ == "__main__":
    main()
Problem p03385 (python)

Fixed submission:
s = input().rstrip()

if s[0] != s[1] and s[1] != s[2] and s[2] != s[0]:
    print('Yes')
else:
    print('No')

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

if a != b != c:
    print('Yes')
else:
    print('No')
Problem p03477 (python)

Fixed submission:
a, b, c, d = map(int, input().split())
l = a + b
r = c + d

if l == r:
    answer = 'Balanced'
elif l > r:
    answer = 'Left'
else:
    answer = 'Right'

print(answer)

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

ans = 0

for i in range(1, n + 1):
    num = i
    total = 0
    while num != 0:
        total += num % 10
        num //= 10

    if a <= total <= b:
        ans += i

print(ans)
Problem p03485 (python)

Fixed submission:
import math

a, b = map(int, input().split())
mean = (a + b) / 2
mean = math.ceil(mean)
print(mean)

Buggy submission (verdict: Runtime Error):
s = input().rstrip()
t = input().rstrip()
s = sorted(s)
t = sorted(t, reverse=True)
if s < t:
    print('Yes')
else:
    print('No')
Problem p03493 (python)

Fixed submission:
s = input()
print(s.count('1'))

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

ans = 10 ** 9

for n in l:
    count = 0
    while n % 2 == 0:
        n //= 2
        count += 1
    ans = min(ans, count)

print(ans)
Problem p02628 (python)

Fixed submission:
n,k=map(int,input().split())
l=[int(_) for _ in input().split()]
l.sort()
 
ans=0
for i in range(k):
  ans+=l[i]
print(ans)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
l=[int(_) for _ in input().split()]
l.sort()

ans=0
for i in range(k):
  ans+=l[k]

print(ans)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
l=[int(_) for _ in input().split()]
l.sort()
sum=0
for i in range(k):
  sum+=l[k]
print(sum)
Problem p02767 (python)

Fixed submission:
import statistics
n=int(input())
x=[int(_) for _ in input().split()]
mid=int(statistics.mean(x))
mmid=mid-1
pmid=mid+1
cnt=0
cntm=0
cntp=0
for i in range(len(x)):
  cnt+= (x[i]-mid)**2
  cntm+=(x[i]-mmid)**2
  cntp+=(x[i]-pmid)**2
print(min(cnt,cntm,cntp))

Buggy submission (verdict: Runtime Error):
import statistics
n=int(input())
x=[int(_) for _ in input().split()]
mid=int(statistics.mean(x))
mmid=mid-1
cnt=0
cntm=0
for i in range(len(x)):
  cnt+= (x[i]-mid)**2
  cntm+=(x[i]-mmid)**2
print(min(cnt,cntm,cntp))
Problem p02784 (python)

Fixed submission:
N,K=map(int,input().split())
A=[int(i) for i in input().split()]
v=0
for i in range(K):
  v+=A[i]
if v>=N:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
A=[int(i) for i in input().split()]
v=A.sum()
if v>=N:
  print('Yes')
else:
  print('No')
Problem p02811 (python)

Fixed submission:
K,X=map(int,input().split())
if K*500>=X:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
import itertools
 
N=int(input())
P=list(map(int,input().split()))
Q=list(map(int,input().split()))
nlis=[i for i in range(1,N+1)]
 
j=list(itertools.permutations(nlis))
cp=j.index(P)+1
cq=j.index(Q)+1
print(abs(cp-cq))
Problem p02823 (python)

Fixed submission:
n,a,b=map(int,input().split())
if (b-a)%2==0:
  print(int((b-a)//2))
else:
  print(int((b-a-1)//2+min(n-b,a-1)+1))

Buggy submission (verdict: Runtime Error):
n,a,b=map(int,input().split())
if (b-a)%2==0:
  print(int((b-a)/2))
else:
  print(int((b-a-1)/2+1+min(n-b,a-1))
Problem p02910 (python)

Fixed submission:
S=input()
K=[]
G=[]
for i in range(0,len(S),2):
  K.append(S[i])
  try:
    G.append(S[i+1])
  except:
    pass
if ('L' in K) or ('R' in G):
  print('No')
else:
  print('Yes')

Buggy submission (verdict: Runtime Error):
S=input()
K=[]
G[]
for i in range(0,len(S),2):
  K.append(S[i])
  try:
    G.append(S[i+1])
  except:
    pass
if ('L' in K) or ('R' in G):
  print('No')
else:
  print('Yes')
Problem p02922 (python)

Fixed submission:
A,B=map(int,input().split())
cnt=0
while True:
  if (A-1)*cnt+1>=B:
    break
  cnt+=1
print(cnt)

Buggy submission (verdict: Runtime Error):
A,B=map(int,input().split())
cmt=0
while True:
  if (A-1)*cnt+1>=B:
    break
  cnt+=1
print(cnt)
Problem p02988 (python)

Fixed submission:
n=int(input())
p=[int(i) for i in input().split()]
cnt=0
for i in range(1,n-1):
  if p[i-1]<p[i] and p[i]<p[i+1]:
    cnt+=1
  elif p[i-1]>p[i] and p[i]>p[i+1]:
    cnt+=1
print(cnt)

Buggy submission (verdict: Runtime Error):
n=int(input())
p=[int(i) for i in input().split()]
cnt=0
for i in range(1,N-1):
  if p[i-1]<p[i] and p[i]<p[i+1]:
    cnt+=1
print(cnt)
Problem p02936 (python)

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

def input():
    return sys.stdin.readline()[:-1]

n, q = map(int,input().split())
g = [[] for _ in range(n+1)]
for  _ in range(n-1):
    a,b = map(int,input().split())
    g[a].append(b)
    g[b].append(a)
points = [0]*(n+1)
for _ in range(q):
    p, x = map(int,input().split())
    points[p] += x
# print(g)
# print(points)
def dfs(e,preve = -1):
    for nexte in g[e]:
        # print(nexte)
        if nexte == preve:
            continue
        points[nexte] = points[nexte] + points[e]
        dfs(nexte,e)
dfs(1)
print(*points[1:])

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

n,q = map(int,input().split())
points = [0]*(n+1)
tree = [[] for _ in range(n+1)]
for i in range(n-1):
    l, m = map(int,input().split())
    tree[l].append(m)

def dfs(e,p):
    points[e] += p
    for i in tree[e]:
        dfs(i,p)


for i in range(q):
    e, p = map(int, input().split())
    dfs(e,p)
print(*points[1:])
# print(tree)

Buggy submission (verdict: Runtime Error):
n,q = map(int,input().split())
points = [0]*(n+1)
tree = [[] for _ in range(n+1)]
for i in range(n-1):
    l, m = map(int,input().split())
    tree[l].append(m)

def dfs(e,p):
    points[e] += p
    for i in tree[e]:
        dfs(i,p)


for i in range(q):
    e, p = map(int, input().split())
    dfs(e,p)
print(*points[1:])
# print(tree)
Problem p03997 (python)

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

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

Fixed submission:
h, w, n = map(int, input().split())
from collections import defaultdict
d = defaultdict(int)
surround = [(0, 0), (1,1), (1, 0), (1, -1), (0, -1), (-1, -1), (-1, 0), (-1, 1), (0, 1)]
for _ in range(n):
    x, y  = map(int, input().split())
    x -= 1
    y -= 1
    for i in surround:
        if x + i[0] >= h or x + i[0] < 0 or y + i[1] < 0 or y + i[1] >= w:
            continue
        else:
            d[(x+i[0], y + i[1])] += 1
num = [0]*10
for key in d:
    if key[0] >= 1 and key[0] < h -1 and key[1] >= 1 and key[1] < w-1:
        num[d[key]] += 1

num[0] = (h-2)*(w-2) - sum(num)

for ans in num:
    print(ans)

Buggy submission (verdict: Runtime Error):
h, w, n = map(int, input().split())
from collections import defaultdict
d = defaultdict(int)
surround = [(0, 0), (1,1), (1, 0), (1, -1), (0, -1), (-1, -1), (-1, 0), (-1, 1), (0, 1)]
for _ in range(n):
    x, y  = map(int, input().split())
    x -= 1
    y -= 1
    for i in surround:
        if x + i[0] >= w or x + i[0] < 0 or y + i[1] < 0 or y + i[1] >= h:
            continue
        else:
            d[(x+i[0], y + i[1])] += 1
num = [0]*9
for key in d:
    if key[0] >= 1 and key[0] < h -1 and key[1] >= 1 and key[1] < w-1:
        num[d[key]] += 1
        
num[0] = (h-2)*(w-2) - sum(num)

for ans in num:
    print(ans)

Buggy submission (verdict: Runtime Error):
h, w, n = map(int, input().split())
from collections import defaultdict
d = defaultdict(int)
surround = [(0, 0), (1,1), (1, 0), (1, -1), (0, -1), (-1, -1), (-1, 0), (-1, 1), (0, 1)]
for _ in range(n):
    x, y  = map(int, input().split())
    x -= 1
    y -= 1
    for i in surround:
        if x + i[0] >= w or x + i[0] < 0 or y + i[1] < 0 or y + i[1] >= h:
            continue
        else:
            d[(x+i[0], y + i[1])] += 1
num = [0]*9
for key in d:
    if key[0] >= 1 and key[0] < h -1 and key[1] >= 1 and key[1] < w-1:
        num[d[key]] += 1
        
num[0] = (h-2)*(w-2) - sum(num)

for ans in num:
    print(ans)
Problem p04014 (python)

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

import math
def f(b, n):
    # print(b, n)
    if n<b:
        return n
    else:
        x = f(b, n//b) + n%b
        return x
ans = 0
if n<s:
    print(-1)
    exit()
if n==s:
    print(n+1)
    exit()
for b in range(2,int(math.sqrt(n))+500):
    if f(b, n) == s:
        ans = b
        print(ans)
        exit()
for p in range(int(math.sqrt(n)), 0, -1):
    if (n+p-s) %p == 0:
        # print(p)
        if f((n+p-s)//p, n) == s:
            print((n+p-s)//p)
            exit()


print(-1)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = int(input())
import sys
sys.setrecursionlimit(20000)

import math
def f(b, n):
    # print(b, n)
    if n<b:
        return n
    else:
        x = f(b, n//b) + n%b
        return x
# print(f(100000000000,100000000000))
ans = 0
# if n<s:
#     print(-1)
#     exit()
if n==s:
    print(n+1)
    exit()
for b in range(2,int(math.sqrt(n))+500):
    if f(b, n) == s:
        ans = b
        print(ans)
        exit()
for p in range(int(math.sqrt(n)), 0, -1):
    if (n+p-s) %p == 0:
        # print(p)
        if f((n+p-s)//p, n) == s:
            print((n+p-s)//p)
            exit()


print(-1)

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

import math
def f(b, n):
    # print(b, n)
    if n<b:
        return n
    else:
        
        x = f(b, n//b) + n%b
        return x
ans = 0
if n<s:
    print(-1)
    exit()
for b in range(2,int(math.sqrt(n))+500):
    if f(b, n) == s:
        ans = b
        print(ans)
        exit()
for p in range(int(math.sqrt(n)), 0, -1):
    if (n+p-s) %p == 0:
        # print(p)
        if f((n+p-s)/p, n) == s:
            print((n+p-s)//p)
            exit()


print(-1)

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

import math
def f(b, n):
    # print(b, n)
    if n<b:
        return n
    else:
        
        x = f(b, n//b) + n%b
        return x
ans = 0
if n<s:
    print(-1)
    exit()
for b in range(2,int(math.sqrt(n))+500):
    if f(b, n) == s:
        ans = b
        print(ans)
        exit()
for p in range(int(math.sqrt(n)), 0, -1):
    if (n+p-s) %p == 0:
        # print(p)
        if f((n+p-s)/p, n) == s:
            print((n+p-s)//p)
            exit()


print(-1)
Problem p04026 (python)

Fixed submission:
s = input()
# print(s)
flag=0
for i in range(len(s)-1):
    if s[i]==s[i+1]:
        print(i+1,i+2)
        flag = 1
        break
    if i<len(s)-2:
        if s[i]==s[i+2]:
            print(i+1,i+3)
            flag = 1
            break
if flag ==0:
    print(-1,-1)

Buggy submission (verdict: Runtime Error):
s = input()
# print(s)
for i in range(len(s)-1):
    if s[i]==s[i+1]:
        print(i+1,i+2)
        break
    if i<=len(s)-2:
        if s[i]==s[i+2]:
            print(i+1,i+3)
            break
    if i == len(s)-3:
        print(-1,-1)
Problem p04029 (python)

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

Buggy submission (verdict: Runtime Error):
n = int(input())
print(n(n-1)/2)
Problem p02683 (python)

Fixed submission:
n,m,x = map(int,input().split())
C = list()
A = list()
for i in range(n):
    temp = list(map(int,input().split()))
    C.append(temp[0])
    A.append(temp[1:])

maxnum = 10000000000
def dfs(a,cost,i):
    if min(a) >= x:
        return cost
    elif i == n:
        return maxnum
    
    getA = [x+y for (x,y) in zip(a,A[i])]
    
    return min(dfs(a,cost,i+1), dfs(getA,cost+C[i],i+1))

ans = dfs([0]*m,0,0)

if ans == maxnum:
    print(-1)
else:
    print(ans)

Buggy submission (verdict: Runtime Error):
n,m,x = map(int,input().split())
C = [0]*n
A = [[0]*m for i in range(n)]
for i in range(n):
    b = list(map(int,input().split()))
    C[i] = b[0]
    for j in range(1,m+1):
        A[i][j-1] = b[j]
    
MAX = 100000000000
def dfs(a,c,i):
    if min(a)>=x:
        return cost
    elif i == n:
        return MAX
    total_A = [u+v for (u,v) in zip(a,A[i])]
    return min(dfs(a,c,i+1), dfs(total_A,c + C[i], i+1))

ans = dfs([0]*m,0,0)
if ans == MAX:
    print(-1)
else:
    print(ans)
Problem p02696 (python)

Fixed submission:
a,b,n = map(int,input().split())
import math
if n < b:
    print(int(math.floor(a*n/b) - a*math.floor(n/b)))
else:
    print(int(math.floor(a*(b-1)/b) - a*math.floor((b-1)/b)))

Buggy submission (verdict: Runtime Error):
a,b,n = map(int,input().split())
import math
if n < b:
    print(int(math.floor(a*n/b) - a*np.floor(n/b)))
else:
    print(int(math.floor(a*(b-1)/b) - a*np.floor((b-1)/b)))
Problem p02843 (python)

Fixed submission:
import numpy as np
x=int(input())
if x<=99:
    print(0)
    exit()
elif x==100 or x==101 or x==102:
    print(1)
    exit()
a=[100,101,102,103,104,105]
m=[1000000]*6
dplist = np.ones((7,x+1))*(-1)
dplist[0,0] = 0
for i in range(6):
    for j in range(x+1):
        if dplist[i,j] >= 0:
            dplist[i+1,j] = m[i]
        elif dplist[i+1,j-a[i]]<= 0:
            dplist[i+1,j] = -1
        elif j - a[i] < 0:
            dplist[i+1,j] = -1
        else:
            dplist[i+1][j] = dplist[i+1,j-a[i]] -1

if dplist[6,x] >= 0:
    print(1)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
import numpy as np
x=int(input())
a=[100,101,102,103,104,105]
m=[1000000]*6
dplist = np.ones((7,x+1))*(-1)
dplist[0,0] = 0
for i in range(6):
    for j in range(x+1):
        if dplist[i,j] >= 0:
            dplist[i+1,j] = m[i]
        elif dplist[i+1,j-a[i]]<= 0:
            dplist[i+1,j] = -1
        elif j - a[i] < 0:
            dplist[i+1,j] = -1
        else:
            dplist[i+1][j] = dplist[i+1,j-a[i]] -1

if dplist[6,x] >= 0:
    print(1)
else:
    print(0)
Problem p02909 (python)

Fixed submission:
wethear = ['Sunny','Cloudy','Rainy']
print(wethear[wethear.index(str(input())) - 2])

Buggy submission (verdict: Runtime Error):
wethear = ['Sunny','Cloudy','Rainy']
print(wethear[wethear.index(str(input())) + 1])
Problem p02921 (python)

Fixed submission:
S = list(input())
T = list(input())
c = 0
for _ in range(3):
    if S[_] == T[_]:
        c += 1
print(c)

Buggy submission (verdict: Runtime Error):
S=list(input())
T=list(input())
c=0
for u,v = zip(S,T):
    if u==v:
        c+=1
print(c)