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

Fixed submission:
a, b, c = sorted([ int(v) for v in input().split() ])
k = int(input())
print(a+b+c*(2**k))

Buggy submission (verdict: Runtime Error):
a, b, c = sorted([ int(v) for v in input().split() ])
n = int(input())
print(a+b+c*(2**k))
Problem p03380 (python)

Fixed submission:
import bisect

n = int(input())
num_list = sorted([ int(v) for v in input().split() ])

x = num_list[-1]
x_half = x / 2
y = bisect.bisect_left(num_list,x_half)
if y != 0:
    if y == n-1:
        y -= 1
    else:
        if abs(num_list[y] - x_half) >= abs(num_list[y-1] - x_half):
            y -= 1
print(x,num_list[y])

Buggy submission (verdict: Runtime Error):

n = int(input())
num_list = sorted([ int(v) for v in input().split() ])

x = num_list[-1]
x_half = x / 2
y = bisect.bisect_left(num_list,x_half)
if y != 0:
    if y == n-1:
        y -= 1
    else:
        if abs(num_list[y] - x_half) >= abs(num_list[y-1] - x_half):
            y -= 1
print(x,num_list[y])
Problem p03399 (python)

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
print(min(a,b)+min(c,d))

Buggy submission (verdict: Runtime Error):
print(min(int(input(),int(input()))+min(int(input(),int(input())))))

Buggy submission (verdict: Runtime Error):
print(min(int(input(),int(input()))+min(int(input(),int(input()))))

Buggy submission (verdict: Runtime Error):
print(min(int(input(),int(input()))+min(int(input(),int(input())))
Problem p03407 (python)

Fixed submission:
ans = "No"
a, b, c = [ int(v) for v in input().split() ]
if a + b >= c:
  ans = "Yes"
print(ans)

Buggy submission (verdict: Runtime Error):
ans = "No"
if int(input()) + int(input()) >= int(input()):
  ans = "Yes"
print(ans)
Problem p03434 (python)

Fixed submission:
n = int(input())

num_list = sorted([ int(v) for v in input().split() ])

a_sum, b_sum = 0, 0

for i in range(n):
  if i % 2 == 0:
    a_sum += num_list[i]
  else:
    b_sum += num_list[i]

print(abs(a_sum-b_sum))

Buggy submission (verdict: Runtime Error):
    n = int(input())
     
    num_list = sorted([ int(v) for v in input().split() ],reverse = True)
     
    a_sum, b_sum = 0, 0
     
    for i in range(n):
      if i % 2 == 0:
        a_sum += num_list[i]
      else:
        b_sum += num_list[i]
     
    print(a_sum-b_sum)

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

num_list = [ int(v) for v in input().split() ]

a_sum, b_sum = 0, 0

for i in range(n):
  if i % 2 == 0:
    a_sum += num_list[i]
  else:
    b_sum += num_list[i]

print(a-b)
Problem p03455 (python)

Fixed submission:
a,b = map(int, input().split(" "))
if (a * b) % 2 == 0:
	print("Even")
else:
	print("Odd")

Buggy submission (verdict: Runtime Error):
a,b = map(int, input().split(" "))
if (a * b) % 2 == 0:
  print("Even")
  else:
    print("Odd")
Problem p03456 (python)

Fixed submission:

a, b =  [ v for v in input().split() ]

c = int(a+b)

if int(c**0.5)**2 == c:
	print("Yes")
else:
	print("No")

Buggy submission (verdict: Runtime Error):

a, b =  [ v for v in input().split() ]

c = int(a+b)

if int(math.sqrt(c))**2 == c:
	print("Yes")
else:
	print("No")
Problem p03502 (python)

Fixed submission:
n = input()
n1 = int(n)
n2 = int(sum([int(v) for v in list(n)]))

if n1 % n2 == 0:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n = input()
n1 = int(n)
n2 = int(sum(list(n)))

if n1 % n2 == 0:
  print("YES")
else:
  print("No")
Problem p03505 (python)

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

if a >= k:
    ans = 1
elif b >= a:
    ans = -1
else:
    ans = 1 + ( ( k - b - 1 ) // (a - b) ) * 2
print(ans)

Buggy submission (verdict: Runtime Error):

k, a, b = [ int(v) for v in input().split() ]

if a >= k:
    ans = 1
elif b > a:
    ans = -1
else:
    ans = 1 + ( ( k - b - 1 ) // (a - b) ) * 2
print(ans)
Problem p03506 (python)

Fixed submission:
import bisect
n, q = [ int(v) for v in input().split() ]

if n != 1:
    tree_list = [0] + [ (n**(i+1)-1) // (n-1) for i in range(100) if (n**(i+1)-1) // (n-1) <= 10**9 ]

def upward(a):
    d = bisect.bisect_left(tree_list,a) - 1
    outlist = []
    for i in range(d+1):
        outlist.append(a)
        if i < d:
            a -= tree_list[d-i] + 1
            a //= n
            a += tree_list[d-i-1] + 1
    return d, outlist

def lca(a,b):
    da, a_list = upward(a)
    db, b_list = upward(b)

    if da < db:
        da, db = db, da
        a_list, b_list = b_list, a_list
    s = da - db
    ans = None
    for i in range(db+1):
        if a_list[s+i] == b_list[i]:
            ans = a_list[s+i]
            break
    return ans



for i in range(q):
    v, w = [ int(v) for v in input().split() ]
    if n != 1:
        print(lca(v,w))
    else:
        print(min(v,w))

Buggy submission (verdict: Runtime Error):
import bisect
n, q = [ int(v) for v in input().split() ]

tree_list = [0] + [ (n**(i+1)-1) // (n-1) for i in range(100) if (n**(i+1)-1) // (n-1) <= 10**9 ]

def upward(a):
    d = bisect.bisect_left(tree_list,a) - 1
    outlist = []
    for i in range(d+1):
        outlist.append(a)
        if i < d:
            a -= tree_list[d-i] + 1
            a //= n
            a += tree_list[d-i-1] + 1
    return d, outlist

def lca(a,b):
    da, a_list = upward(a)
    db, b_list = upward(b)

    if da < db:
        da, db = db, da
        a_list, b_list = b_list, a_list
    s = da - db
    ans = None
    for i in range(db+1):
        if a_list[s+i] == b_list[i]:
            ans = a_list[s+i]
            break
    return ans



for i in range(q):
    v, w = [ int(v) for v in input().split() ]
    print(lca(v,w))
Problem p03508 (python)

Fixed submission:
import collections

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


def dfs(a):
    color = [ 0 for i in range(n) ]
    color[a] = 1
    stack = collections.deque([a])
    r = 0

    while stack:
        s = stack.pop()
        color[s] = 2
        r += 1
        for i in connect_list[s]:
            if color[i] == 0:
                color[i] = 1
                stack.append(i)
    return r

x, y = dfs(0), dfs(1)
x, y = max(x, y), min(x, y)

def part_edge(a):
    return a*(a-1)//2

x = n - y
total_edge = part_edge(x) + part_edge(y)
print(total_edge-m)

Buggy submission (verdict: Runtime Error):
n, m = [ int(v) for v in input().split() ]
connect_list = [ [] for i in range(n) ]
for i in range(m):
    a, b = [ int(v)-1 for v in input().split() ]
    connect_list[a].append(b)
    connect_list[b].append(a)


def dfs(a):
    color = [ 0 for i in range(n) ]
    color[a] = 1
    stack = collections.deque([a])
    r = 0

    while stack:
        s = stack.pop()
        color[s] = 2
        r += 1
        for i in connect_list[s]:
            if color[i] == 0:
                color[i] = 1
                stack.append(i)
    return r

x, y = dfs(0), dfs(1)
x, y = max(x, y), min(x, y)

def part_edge(a):
    return a*(a-1)//2

x = n - y
total_edge = part_edge(x) + part_edge(y)
print(total_edge-m)
Problem p03567 (python)

Fixed submission:
    
s = input()
ans = "No"
for i in range(len(s)-1):
  if s[i] == "A" and s[i+1] == "C":
    ans = "Yes"
    break
print(ans)

Buggy submission (verdict: Runtime Error):
s = input()
ans = "No"
for i in range(len(s)-1):
  if s[i] == "A" and s[i+1] == "C":
    ans = "Yes"
 	break
print(ans)
Problem p03608 (python)

Fixed submission:
import itertools
import sys
input = sys.stdin.readline

n, m, r = [ int(v) for v in input().split() ]
town_list = [ int(v)-1 for v in input().split() ]

road_matrix = [ [ 10**9 for j in range(n) ] for i in range(n) ]


for i in range(m):
	s, e, d = [ int(v) - 1 for v in input().split() ]
	road_matrix[s][e] = d + 1
	road_matrix[e][s] = d + 1


for k in range(n):
	 for i in range(n):
		 for j in range(n):
			 road_matrix[i][j]  = min(road_matrix[i][k] + road_matrix[k][j], road_matrix[i][j])


mindist = 10**9
for i in itertools.permutations(town_list,r):
	dist = 0
	for j in range(r-1):
		dist += road_matrix[i[j]][i[j+1]]

	mindist = min(mindist,dist)
print(mindist)

Buggy submission (verdict: Runtime Error):
n, m, r = [ int(v) for v in input().split() ]
town_list = [ int(v)-1 for v in input().split() ]

road_matrix = [ [ 10**9 for j in range(n) ] for i in range(n) ]


for i in range(m):
	s, e, d = [ int(v) - 1 for v in input().split() ]
	road_matrix[s][e] = d + 1
	road_matrix[e][s] = d + 1


for k in range(n):
	 for i in range(n):
		 for j in range(n):
			 road_matrix[i][j]  = min(road_matrix[i][k] + road_matrix[k][j], road_matrix[i][j])


mindist = 10**9
for i in itertools.permutations(town_list,r):
	dist = 0
	for j in range(r-1):
		dist += road_matrix[i[j]][i[j+1]]

	mindist = min(mindist,dist)
print(mindist)

Buggy submission (verdict: Runtime Error):
n, m, r = [ int(v) for v in input().split() ]
town_list = [ int(v)-1 for v in input().split() ]

road_matrix = [ [ 10**9 for j in range(n) ] for i in range(n) ]


for i in range(m):
	s, e, d = [ int(v) - 1 for v in input().split() ]
	road_matrix[s][e] = d + 1
	road_matrix[e][s] = d + 1


min_dist_matrix = []
for h in range(n):
	min_dist = road_matrix[h]
	searched_point = []
	sarching_point = []
	j = h
	while len(searched_point) < n:
		searched_point.append(j)
		for i in range(n):
			if road_matrix[j][i] != 10**9 and i != h:
				sarching_point.append((road_matrix[j][i],i))
				min_dist[i] = min(min_dist[i],min_dist[j] + road_matrix[j][i])
		sarching_point.sort()

		for k in range(len(sarching_point)):
			if sarching_point[k][1] not in searched_point:
				j = sarching_point[k][1]
				sarching_point = sarching_point[k+1:]
				break
	min_dist_matrix.append(min_dist)


mindist = 10**9
for i in itertools.permutations(town_list,r):
	dist = 0
	for j in range(r-1):
		dist += min_dist_matrix[i[j]][i[j+1]]

	mindist = min(mindist,dist)
print(mindist)

Buggy submission (verdict: Runtime Error):

n, m, r = [ int(v) for v in input().split() ]
town_list = [ int(v)-1 for v in input().split() ]

road_matrix = [ [ 10**9 for j in range(n) ] for i in range(n) ]


for i in range(m):
	s, e, d = [ int(v) - 1 for v in input().split() ]
	road_matrix[s][e] = d + 1
	road_matrix[e][s] = d + 1

mindist = 10**9
for i in itertools.permutations(town_list,r):
	dist = 0
	for j in range(r-1):
		dist += road_matrix[i[j]][i[j+1]]

	mindist = min(mindist,dist)
print(mindist)
Problem p03611 (python)

Fixed submission:

n = int(input())
num_list = [ int(v) for v in input().split() ]

ans_list = [ 0 for i in range(10**5+2) ]

for i in num_list:
    ans_list[i] += 1
    ans_list[i+1] += 1
    ans_list[i+2] += 1

print(max(ans_list))

Buggy submission (verdict: Runtime Error):
n = int(input())
num_list = [ int(v) for v in input().split() ]

ans_list = [ 0 for i in range(n+2) ]

for i in num_list:
    ans_list[i] += 1
    ans_list[i+1] += 1
    ans_list[i+2] += 1

print(max(ans_list))
Problem p03624 (python)

Fixed submission:
s = sorted(list(set(input()))) + ["A"] *26
t = "abcdefghijklmnopqrstuvwxyz"

ans = "None"
for i in range(len(t)):
	if s[i] != t[i]:
		ans = (t[i])
		break
print(ans)

Buggy submission (verdict: Runtime Error):

s = sorted(list(set(input()))) + ["A"] *26
t = "abcdefghijklmnopqrstuvwxyz"

ans = "None"
for i in range(len(s)):
	if s[i] != t[i]:
		ans = (t[i])
		break
print(ans)

Buggy submission (verdict: Runtime Error):

s = list(set(input()))
t = "abcdefghijklmnopqrstuvwxyz"

ans = -1
for i in len(s):
	if s[i] != t[i]:
		ans = (s[i])
		break
print(ans)
Problem p03636 (python)

Fixed submission:
s = input()

print(s[0]+ str(len(s)-2) +s[-1])

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

print(s[0]+ str(len(s-2)) +s[-1])
Problem p03657 (python)

Fixed submission:
a, b = [ int(v) for v in input().split() ]
if a % 3 == 0 or b % 3 == 0 or (a+b) % 3 == 0:
  print("Possible")
else:
  print("Impossible")

Buggy submission (verdict: Runtime Error):
a, b = [ int(input()) for i in input().split() ]
ans = "Impossible"
if a % 3 == 0 or b % 3 == 0 or (a+b) % 3 == 0:
  ans = "Possible"
print(ans)

Buggy submission (verdict: Runtime Error):
a, b = [ int(input()) for i in input().split() ]
ans = "Impossible"
if a % 3 == 0 or b % 3 == 0 or (a+b) % 3 == 0:
  ans = "Possible"
print(ans)
Problem p03721 (python)

Fixed submission:
n, k =  [ int(v) for v in input().split() ]
num_list = sorted([ tuple(map(int, input().split())) for i in range(n) ])
order_list, value_list = [ 0 for i in range(n) ], [ 0 for i in range(n) ]
for i in range(n):
	order_list[i] = num_list[i][1] + order_list[i-1]
	value_list[i] = num_list[i][0]


for i in range(n):
	if order_list[i] - k >= 0:
		print(value_list[i])
		break

Buggy submission (verdict: Runtime Error):

import bisect
n, k =  [ int(v) for v in input().split() ]
num_list = sorted([ tuple(map(int, input().split())) for i in range(n) ])
order_list, value_list = [ 0 for i in range(n) ], [ 0 for i in range(n) ]
for i in range(n):
	order_list[i] = num_list[i][1] + order_list[i-1]
	value_list[i] = num_list[i][0]


print(value_list[bisect.bisect(order_list,k)])
Problem p03730 (python)

Fixed submission:
ans = 0
a, b, c = [ int(v) for v in input().split() ]
for i in range(1,b+1):
    if (a * i) % b == c:
        ans = 1
        break
if ans == 1:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
ans = 0
a, b, c = [ int(v) for v in input().split() ]
for i in range(1,b+1):
    if (a * i) % b == c:
        ans = 1
        break
if ans == 1:
    print("YES")
else:
Problem p03734 (python)

Fixed submission:
n, w = [ int(v) for v in input().split() ]
knapsack = [ [ int(v) for v in input().split() ] for i in range(n) ]

dp_list = [ [ None for i in range(4*n+1) ] for i in range(n+1) ]
dp_list[0][0] = 0
base = knapsack[0][0]


for wi, vi in knapsack:
    wi -= base
    for i in range(n-1,-1,-1):
        for j in range(4*n,-1,-1):
            if 0 <= j-wi < 4*n+1 and 0 <= j < 4*n+1:
                if dp_list[i][j-wi] is not None:
                    if dp_list[i+1][j] is None:
                        dp_list[i+1][j] = dp_list[i][j-wi] + vi
                    else:
                        dp_list[i+1][j] = max(dp_list[i][j-wi] + vi, dp_list[i+1][j])

ans_list = [0]
for i in range(1,n+1):
    l = w - i*base
    for j in range(min(4*n+1,l+1)):
        if dp_list[i][j] is not None:
            ans_list.append(dp_list[i][j])


print(max(ans_list))

Buggy submission (verdict: Runtime Error):
n, w = [ int(v) for v in input().split() ]
knapsack = [ [ int(v) for v in input().split() ] for i in range(n) ]

dp_list = [ [ None for i in range(4*n+1) ] for i in range(n+1) ]
dp_list[0][0] = 0
base = knapsack[0][0]


for wi, vi in knapsack:
    wi -= base
    for i in range(n-1,-1,-1):
        for j in range(4*n,-1,-1):
            if 0 <= j-wi < 4*n+1 and 0 <= j < 4*n+1:
                if dp_list[i][j-wi] is not None:
                    if dp_list[i+1][j] is None:
                        dp_list[i+1][j] = dp_list[i][j-wi] + vi
                    else:
                        dp_list[i+1][j] = max(dp_list[i][j-wi] + vi, dp_list[i+1][j])

ans_list = [0]
for i in range(1,n+1):
    l = w - i*base
    for j in range(l+1):
        if dp_list[i][j] is not None:
            ans_list.append(dp_list[i][j])


print(max(ans_list))

Buggy submission (verdict: Runtime Error):
n, w = [ int(v) for v in input().split() ]
knapsack = [ [ int(v) for v in input().split() ] for i in range(n) ]

dp_list = [ [ None for i in range(4*n+1) ] for i in range(n+1) ]
dp_list[0][0] = 0
base = knapsack[0][0]


for wi, vi in knapsack:
    wi -= base
    for i in range(n-1,-1,-1):
        for j in range(4*n,-1,-1):
            if 0 <= j-wi < 4*n+1:
                if dp_list[i][j-wi] is not None:
                    if dp_list[i+1][j] is None:
                        dp_list[i+1][j] = dp_list[i][j-wi] + vi
                    else:
                        dp_list[i+1][j] = max(dp_list[i][j-wi] + vi, dp_list[i+1][j])


ans_list = [0]
for i in range(1,n+1):
    l = w-base*i
    for j in range(l+1):
        if dp_list[i][j] is not None:
            ans_list.append(dp_list[i][j])


print(max(ans_list))
Problem p03738 (python)

Fixed submission:

a = input()
b = input()
	
ans = "EQUAL"
la, lb = len(a), len(b)
if la < lb:
	ans = "LESS"
elif la > lb:
	ans = "GREATER"
else:
	for i in range(la):
		if a[i] < b[i]:
			ans = "LESS"
			break
		elif a[i] > b[i]:
			ans = "GREATER"
			break
print(ans)

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

ans = "EQUAL"
la, lb = len(a), len(b)
if la < lb:
  ans = "LESS"
elif la > lb:
  ans = "GREATER"
else:
  for i in range(n):
    if a[i] < b[i]:
      ans = "LESS"
      break
  	elif a[i] > b[i]:
      ans = "GREATER"
      break
print(ans)
Problem p03759 (python)

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

if (a-b) == (b-c):
  print("YES")
else:
  print("NO")

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

if (a-b) == (b-c):
  print("YES")
else:
  print("NO)
Problem p03773 (python)

Fixed submission:
a, b = [ int(v) for v in input().split() ]
print((a+b)%24)

Buggy submission (verdict: Runtime Error):
print((int(input())+int(input()))%24)
Problem p03777 (python)

Fixed submission:
if [ v for v in input().split() ].count("H") == 1:
	print("D")
else:
	print("H")

Buggy submission (verdict: Runtime Error):
if [input(),input()].count("H") == 1:
	print("D")
else:
	print("H")

Buggy submission (verdict: Runtime Error):
if [input(),input()].count("H") == 1:
  print("D")
else:
  print("H")
Problem p03795 (python)

Fixed submission:
n = int(input())
x = 800 * n
y = 200 * (n // 15)
print(x-y)

Buggy submission (verdict: Runtime Error):
def next_to_you(t,a):
	if a == "o":
		if t[-1] == "S":
			if  t[-2] == "W":
				return "W"
			elif t[-2] == "S":
				return "S"
		elif t[-1] == "W":
			if  t[-2] == "W":
				return "S"
			elif t[-2] == "S":
				return "W"
	elif a == "x":
		if t[-1] == "S":
			if  t[-2] == "W":
				return "S"
			elif t[-2] == "S":
				return "W"
		elif t[-1] == "W":
			if  t[-2] == "W":
				return "W"
			elif t[-2] == "S":
				return "S"



n = int(input())
s = input()
t1, t2, t3, t4 = "SS", "SW", "WS", "WW"

for i in range(1,n):
	t1 += next_to_you(t1,s[i])
	t2 += next_to_you(t2,s[i])
	t3 += next_to_you(t3,s[i])
	t4 += next_to_you(t4,s[i])

ans = -1
for i in [t1,t2,t3,t4]:
	if i[0] == i[-1]:
		ans = i[:n]
		break
print(ans)
Problem p03796 (python)

Fixed submission:
n = int(input())

power = 1
mod = 10**9+7

for i in range(n):
  power = (power * (i+1)) % mod
print(power)

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

power = 1
mod = 10**9+7

for i in range(n):
  p = (p * (i+1)) % mod
print(p)
Problem p03814 (python)

Fixed submission:
s = input()
n = len(s)
for i in range(n):
	if s[i] == "A":
		l = i
		break
for i in range(n-1,-1,-1):
	if s[i] == "Z":
		r = i
		break
print(r-l+1)

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

for i in range(n):
  if s[i] == "A":
    l = i
    break
for i in range(n-1,-1,-1):
  if s[i] == "Z":
    r = i
    break
print(s[l:r+1])
Problem p03815 (python)

Fixed submission:
n = int(input())

a = (n // 11) *2

b = n % 11

c = 0
if 7 > b > 0:
	c = 1
elif b >= 7:
	c = 2
print(a+c)

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

a = n // 11 *2
b = n % 11
if c > 0:
	c = 1
elif b >= 7:
	c = 2
print(a+c)
Problem p03845 (python)

Fixed submission:
n = int(input())
time_list = [ int(v) for v in input().split() ]
total_time = sum(time_list)
m = int(input())

for i in range(m):
	p, t = [ int(v) for v in input().split() ]
	print(total_time - time_list[p-1] + t)

Buggy submission (verdict: Runtime Error):
n = int(inout())
time_list = [ int(v) for v in input().split() ]
total_time = sum(time_list)
m = int(input())

for i in range(m):
  p, t = [ int(v) for v in input().split() ]
  print(total_time - time_list[p-1] + t)
Problem p03853 (python)

Fixed submission:
h, w = [ int(v) for v in input().split() ]

for i in range(h):
  s = input()
  print(s)
  print(s)

Buggy submission (verdict: Runtime Error):
h, w = [ int(v) for v in input().split() ]

for i in range(k):
  s = input()
  print(s)
  print(s)
Problem p04015 (python)

Fixed submission:

n, a = [ int(v) for v in input().split() ]
num_list = [ int(v) for v in input().split() ]
max_num = max(num_list)
field = [ [ 0 for i in range(5000) ] for i in range(n+1) ]
field[0][0] = 1

b = num_list[0]
for i in num_list:
    for j in range(n,0,-1):
        for k in range(5000):
            if k >= i:
                field[j][k] += field[j-1][k-i]



ans = 0
for i in range(1,n+1):
    ans += field[i][a*i]
print(ans)

Buggy submission (verdict: Runtime Error):
n, a = [ int(v) for v in input().split() ]
num_list = [ int(v) for v in input().split() ]
max_num = max(num_list)
field = [ [ 0 for i in range(max_num*n+1) ] for i in range(n+1) ]
field[0][0] = 1

b = num_list[0]
for i in num_list:
    for j in range(n,0,-1):
        for k in range(max_num*n+1):
            if k >= i:
                field[j][k] += field[j-1][k-i]



ans = 0
for i in range(1,n+1):
    ans += field[i][a*i]
print(ans)
Problem p04044 (python)

Fixed submission:
n, l = [ int(v) for v in input().split() ]
string_list = sorted([ input() for v in range(n) ])
print("".join(string_list))

Buggy submission (verdict: Runtime Error):
n, l = [ v for v in input().split() ]
string_list = sorted([ input() for v in range(n) ])
print("".join(string_list))
Problem p04045 (python)

Fixed submission:

n, m = [ int(v) for v in input().split() ]
num_list = [ v for v in input().split() ]
t = n
while True:
	if all([ ( v not in num_list ) for v in list(str(t))]):
		print(t)
		break
	t += 1

Buggy submission (verdict: Runtime Error):

n, m = [ int(v) for v in input().split() ]
num_list = [ v for v in input().split() ]
t = n
while:
	if all([ ( v not in num_list ) for v in list(str(i))]):
		print(i)
		break
	t += 1
Problem p02702 (python)

Fixed submission:
S = input()
count = 0
l = [0]*2019
l[0] = 1
mod = 2019
tmp = 0

for i in range(1,len(S)+1):
    tmp = (tmp + int(S[len(S)-i])*pow(10,i-1,mod))%mod
    l[tmp] += 1
    

for j in range(2019):
    if l[j] >= 2:
        count += l[j]*(l[j]-1)//2

print(count)

Buggy submission (verdict: Runtime Error):
import numpy as np
S = input()
count = 0
l = [0]*2019
l[0] = 1
l = np.array(l)

for i in range(1,len(S)+1):
    n =(int(S[len(S)-i:])%2019)
    l[n] += 1
    

for j in range(2019):
    if l[j] >= 2:
        count += l[j]*(l[j]-1)//2

print(count)
Problem p02744 (python)

Fixed submission:
from collections import deque
N = int(input())
alpha = ['a','b','c','d','e','f','g','h','i','j']
ans = []

stack = deque(['a'])

while stack:
    if len(stack[-1]) == N:
        break
    s = stack.pop()
    s_list = sorted(list(s))
    index = alpha.index(s_list[-1])
    for i in range(index+2):
        stack.appendleft(s+alpha[i])
    

stack.reverse()
for j in range(len(stack)):
    print(stack[j])

Buggy submission (verdict: Runtime Error):
from collections import deque
N = int(input())
alpha = ['a','b','c','d','e','f','g','h','i','j']
ans = []

stack = deque(['a'])

while stack:
    print(stack)
    if len(stack[-1]) == N:
        break
    s = stack.pop()
    s_list = list(s)
    index = alpha.index(s_list[-1])
    print(index)
    for i in range(index+2):
        stack.appendleft(s+alpha[i])
    

stack.reverse()
for j in range(len(stack)):
    print(stack[j])
Problem p02780 (python)

Fixed submission:
N,K = list(map(int, input().split()))
p = list(map(int, input().split()))
max_l = 0
Max_l = p[0:K]
S = [0]
s=0
for j in range(N):
    s += p[j]
    S.append(s)

for i in range(N-K+1):
    m = S[K+i]-S[i]
    if m > max_l:
        max_l = m



print((max_l+K)/2)

Buggy submission (verdict: Runtime Error):
N,K = list(map(int, input().split()))
p = list(map(int, input().split()))
max_l = 0
Max_l = p[0:K]

for i in range(N-K+1):
    m = sum(p[i:i+K])
    if m > max_l:
        max_l = m
        Max_l = p[i:i+K]


print((sum(L)+K)//2)