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

Fixed submission:
N = int(input())
v = list(map(int, input().split()))
v.sort()
ans = v[0]

for i in range(1, N):
    ans = (ans + v[i]) / 2

print(ans)

Buggy submission (verdict: Runtime Error):
from collections import deque
N = int(input())
v = list(map(int, input().split()))
v.sort()
ans = deque()

while len(v) > 1:
    odd = []
    if len(v) % 2 == 1:
        odd.append(v[len(v) - 1])
        N = len(v) - 1

    for i in range(1, N, 2):
        ans.append((v[i - 1] + v[i]) / 2)

    if len(odd) == 1:
        ans.append(odd[0])
    v = ans
    ans = deque()

print(v[0])
Problem p03723 (python)

Fixed submission:
import sys
A, B, C = map(int, input().split())
ans = 0

if A == B == C and not A == 1:
    print(-1)
    sys.exit()

while True:
    if A % 2 == 0 and B % 2 == 0 and C % 2 == 0:
        t_A, t_B, t_C = A, B, C
        A = (t_B + t_C) // 2
        B = (t_C + t_A) // 2
        C = (t_A + t_B) // 2
        ans += 1
    else:
        print(ans)
        break

Buggy submission (verdict: Runtime Error):
import sys
A, B, C = map(int, input().split())
ans = 0

if A == B == C:
    print(-1)
    sys.exit()

while True:
    if A % 2 == 0 and B % 2 == 0 and C % 2 == 0:
        t_A, t_B, t_C = A, B, C
        A = (t_B + t_C) // 2
        B = (t_C + t_A) // 2
        C = (t_A + t_B) // 2
        print(f"{A} {B} {C}")
        ans += 1
    else:
        print(ans)
        break
Problem p02623 (python)

Fixed submission:
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

a, b = [0], [0]
for i in range(N):
  a.append(a[i] + A[i])
for i in range(M):
  b.append(b[i] + B[i])

ans, j = 0, M
for i in range(N + 1):
  if a[i] > K:
    break
  while b[j] > K - a[i]:
    j -= 1
  ans = max(ans, i + j)
print(ans)

Buggy submission (verdict: Runtime Error):
n, m, k = map(int, input().split())
a_lst = list(map(int, input().split()))
b_lst = list(map(int, input().split()))

cost = 0
res = 0
while cost < k:
  if a_lst[0] < b_lst[0]:
    if a_lst[0] + cost > k:
      break
    cost += a_lst.pop(0)
    res += 1
  else:
    if b_lst[0] + cost > k:
      break
    cost += b_lst.pop(0)
    res += 1    
print(res)
Problem p02661 (python)

Fixed submission:
n = int(input())

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

mins = sorted(mins)
maxs = sorted(maxs)

if n % 2 != 0:
    print(maxs[((n+1)//2) - 1] - mins[((n+1)//2) - 1] + 1)
else:
    print(int(2 * ((maxs[((n+1)//2) - 1] + maxs[n//2])/2 - (mins[((n+1)//2) - 1] + mins[n//2])/2) + 1))

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

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

mins = sorted(mins)
maxs = sorted(maxs)

if n % 2 != 0:
    print(maxs[((n+1)//2) - 1] - mins[((n+1)//2) - 1] + 1)
else:
    print(((maxs[n//2] - mins[(n//2) - 1] + 1) * 2)
Problem p02693 (python)

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


if a % k == 0 or b % k == 0:
    print('OK')
else:
    if k == 1:
        print('OK')
    elif a // k < b // k:
        print('OK')
    else:
        print('NG')

Buggy submission (verdict: Runtime Error):
if a % k == 0 or b % k == 0:
    print('OK')
else:
    if k == 1:
        print('OK')
    elif a // k < b // k:
        print('OK')
    else:
        print('NG')
Problem p02771 (python)

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

if a == b and a != c:
  print("Yes")
elif a == c and a != b:
  print("Yes")
elif b == c and a != b:
  print("Yes")
else:
  print("No")

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

if a == b and a != c:
  return "Yes"
if a == c and a != b:
  return "Yes"
if b == c and a != b:
  return "Yes"
else:
  return "No"
Problem p02833 (python)

Fixed submission:
import sys

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7

def resolve():
    n = int(input())
    if n % 2 != 0:
        print(0)
        exit()
    L = n // 2
    res = 0
    while L:
        res += L // 5
        L //= 5
    print(res)

if __name__ == '__main__':
    resolve()

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

def func(x):
  if x < 2:
    return 1
  else:
    return x * func(x - 2)
  
tmp = func(n)
res = 0
while tmp % 10 == 0:
  tmp = tmp // 10
  res += 1
print(res)
Problem p03038 (python)

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

sorted_ab=sorted(bc, reverse=True, key=lambda x: x[1])
new_ab=[]
ans=[]

for i in range(m):
    if len(new_ab)<=n:
        tmp_l=[sorted_ab[i][1]]*sorted_ab[i][0]
        new_ab+=tmp_l
    else:
        break

final_list=a+new_ab
final_list.sort(reverse=True)
print(sum(final_list[:n]))

Buggy submission (verdict: Runtime Error):
n, m = [int(elem) for elem in input().split()]
a_lst = [int(elem) for elem in input().split()]
a_lst = sorted(a_lst)

lst = []
for i in range(m):
  b, c = [int(elem) for elem in input().split()]
  lst.append((c, b))
lst = sorted(lst)

i = 0
for c, b in lst:
  while c > a_lst[i] and b > 0:
    a_lst[i] = c
    i += 1
    b -= 1
  i = 0
print(sum(a_lst))
Problem p03137 (python)

Fixed submission:
# - coding : utf-8 -*-
 
n, m = list(map(int, input().split()))
xs_str = input().split()
xs = list(map(int, xs_str))
xs.sort()
 
ys = []
for x1, x2 in zip(xs[0:-1], xs[1:]):
    ys.append(abs(x2 - x1))
ys.sort()

for i in range(n - 1):
    if ys == []:
        break
    else:
        ys.pop()
print(sum(ys))

Buggy submission (verdict: Runtime Error):
# - coding : utf-8 -*-
 
n, m = input().split()
xs_str = input().split()
xs = list(map(int, xs_str))
xs.sort()
 
ys = []
for x1, x2 in zip(xs[0:-1], xs[1:]):
    ys.append(abs(x2 - x1))
ys.sort()
 
if len(ys) > n:
    out = sum(ys[0:-(n-1)])
else:
    out = 0
print(out)

Buggy submission (verdict: Runtime Error):
# - coding : utf-8 -*-
 
n, m = input().split()
xs_str = input().split()
xs = list(map(int, xs_str))
xs.sort()
 
ys = []
for x1, x2 in zip(xs[0:-1], xs[1:]):
    ys.append(abs(x2 - x1))
ys.sort()
 
if len(ys) >= n:
    out = sum(ys[0:-(n-1)])
else:
    out = 0
print(out)

Buggy submission (verdict: Runtime Error):
# - coding : utf-8 -*-
 
n, m = input().split()
xs_str = input().split()
xs = list(map(int, xs_str))
sortted(xs)
 
ys = []
for i in range(int(m) - 1):
    ys.append(abs(xs[i+1] - xs[i]))
sorted(ys)
 
out = sum(ys[0:-(int(n)-1)])
print(out)

Buggy submission (verdict: Runtime Error):
# - coding : utf-8 -*-
 
n, m = input().split()
xs_str = input().split()
xs = list(map(int, xs_str))
xs.sort()
 
ys = []
for i in range(int(m) - 1):
    ys.append(abs(xs[i+1] - xs[i])
ys.sort()
 
out = sum(ys[0:-(int(n)-1)])
print(out)

Buggy submission (verdict: Runtime Error):
# - coding : utf-8 -*-
 
n, m = input().split()
xs_str = input().split()
xs = [int(i) for i in input().split()]
xs.sort()
 
ys = []
for x1, x2 in zip(xs[0:-1], xs[1:]):
    ys.append(abs(x2 - x1))
ys.sort()
 
out = sum(ys[0:-(int(n)-1)])
print(out)

Buggy submission (verdict: Runtime Error):
# - coding : utf-8 -*-
import numpy as np

n, m = input().split()
xs_str = input().split()

xs = list(map(int, xs_str))
xs.sort()
 
ys = []
for x1, x2 in zip(xs[0:-1], xs[1:]):
    ys.append(abs(x2 - x1))
for i in range(1, int(n)):
    ys.remove(max(ys))

out = sum(ys)
print(out)
Problem p03209 (python)

Fixed submission:
def md_burger(n, x):
  if x == 1:
    if n == 0:
      return 1
    else:
      return 0
  elif 1 < x < a[n-1]+2:
    return md_burger(n-1, x-1)
  elif x == a[n-1]+2:
    return p[n-1]+1
  elif a[n-1]+2 < x < 2*a[n-1]+3:
    return p[n-1]+1+md_burger(n-1, x-2-a[n-1])
  else:
    return 2*p[n-1]+1

if __name__=="__main__":
  n, x = input().split()
  a = [1]
  p = [1]
  for i in range(0, int(n)):
    a.append(a[i] * 2 + 3)
    p.append(p[i] * 2 + 1)
  print(md_burger(int(n), int(x)))

Buggy submission (verdict: Runtime Error):
n, x = input().split()
bg = "P"
for i in range(0, int(n)):
  bg = "B" + bg + "P" + bg + "B"
print(bg[-(int(x)):].count("P"))
Problem p03252 (python)

Fixed submission:
import collections

s = input()
t = input()
c1 = collections.Counter(s)
c2 = collections.Counter(t)
s_values = sorted(list(c1.values()))
t_values = sorted(list(c2.values()))

if len(s) == len(t):
  if len(list(set(s))) == len(list(set(t))):
    if s_values == t_values:
      print("Yes")
    else:
      print("No")
  else:
    print("No")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
import collections

s = input()
t = input()
c1 = collections.Counter(s)
c2 = collections.Counter(t)
s_values = sorted(list(c1.values()))
t_values = sorted(list(c2.values()))

if len(s) == len(t):
  if len(list(set(s))) == len(list(set(t))):
    if s_values == v_values():
      print("Yes")
    else:
      print("No")
  else:
    print("No")
else:
  print("No")
Problem p02570 (python)

Fixed submission:
d,t,s=map(int, input().split())
if d/t <= s:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
d,t,s=map(int, input().split())
if d/t <= s:
  print("Yes")
else:
  prinst("No")
Problem p02546 (python)

Fixed submission:
s = input()
if s[-1] == "s":
  print(s+"es")
else:
  print(s+"s")

Buggy submission (verdict: Runtime Error):
n = int(input())
count = 0
for i in range(n):
  d1, d2 = map(int, input().split())
  if count > 2:
    break
  else:
    if d1 == d2:
      count += 1
    else:
      count = 0
if count > 2:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
count = 0
for i in range(n):
  d1, d2 = map(int, input().split())
  if count > 2:
    break
  elif d1 == d2:
    count += 1
  else:
    count == 0
if count > 2:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
count = 0
for i in range(n):
  d1, d2 = map(int, input().split())
  if count > 2:
    break
  elif d1 == d2:
    count += 1
  else:
    count == 0
if count > 2:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
count = 0
for i in range(n):
  d1, d2 = map(int, input().split())
  if count == 3:
    break
  elif d1 == d2:
    count += 1
  else:
    count == 0
if count == 3:
  print("Yes")
else:
  print("No")
Problem p02547 (python)

Fixed submission:
n = int(input())
count = 0
for i in range(n):
  d1, d2 = map(int, input().split())
  if count > 2:
    break
  else:
    if d1 == d2:
      count += 1
    else:
      count = 0
if count > 2:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
count = 0
for i in range(n):
  d1, d2 = map(int, input())
  if count == 3:
    break
  elif d1 == d2:
    count += 1
  else:
    count == 0
if count == 3:
  print("Yes")
else:
  print("No")
Problem p02693 (python)

Fixed submission:
k=int(input())
a,b=map(int,input().split())
for i in range(a,b+1):
  if i%k==0:
    print("OK")
    break
else:
  print("NG")

Buggy submission (verdict: Runtime Error):
k=int(input())
a,b=map(int,input().split())
for i in range(a,b+1):
  if i%k==0:
    print("OK")
    break
else:
  print("NG")
  break
Problem p02699 (python)

Fixed submission:
S,W = map(int,input().split())

if S > W:
    print('safe')
else:
    print('unsafe')

Buggy submission (verdict: Runtime Error):
lis =[]
abc =[]
count = 0

N = int(input())
lis =[lis.append(input()) for _ in range(N)]

for i in lis:
    if any(i == j for j in abc):
        pass
    else:
        abc.append(i)
        count += 1

print(count)
Problem p02596 (python)

Fixed submission:
K = int(input())
if K % 2 == 0 or K % 5 == 0:
    print(-1)
    
else:
    if K % 7 == 0:
        L = 9 * K // 7
    else:
        L = 9 * K
    n = 1
    P = 10 % L
    while True:
        if P == 1:
            print(n)
            break
        n += 1
        P = (10 * P) % L

Buggy submission (verdict: Runtime Error):
K = int(input())
if K % 2 == 0 or K % 5 == 0:
    print(-1)
else:
    if K % 7 == 0:
        L = 9 * K // 7
    else:
        L = 9 * K
n = 1
P = 10 % L
while True:
    if P == 1:
        print(n)
        break
    n += 1
    P = (10 * P) % L

Buggy submission (verdict: Runtime Error):
K = int(input())
if K % 2 == 0 or K % 5 == 0:
    print(-1)
else:
    if K % 7 == 0:
        L = 9 * K / 7
    else:
        L = 9 * K
n = 1
P = 10 % L
while True:
    if P == 1:
        print(n)
        break
    n += 1
    P = (10 * P) % L

Buggy submission (verdict: Runtime Error):
K = int(input())
if K % 2 == 0 or K % 5 == 0:
    print(-1)
else:
    if K % 7 == 0:
        L = 9 * K / 7
    else:
        L = 9 * K
n = 1
P = 10 % L
while True:
    if P == 1:
        print(n)
        break
    n += 1
    P = (10 * P) % K
Problem p02598 (python)

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

def is_ok(mid):
    s = 0
    for j in range(N):
        if mid < A[j]:
            s += A[j] // mid
    return s <= K

max_A = 10**9 + 1
ng = 0
ok = max_A

while abs(ok - ng) > 1:
    mid = (ok + ng) // 2
    if is_ok(mid):
        ok = mid
    else:
        ng = mid
        
print(ok)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
A = list(map(int, input().split()))
A_max = max(A)
if K == 0:
    print(A_max)
else:
    X = A_max+1//2
    y = (X+1)//2
    while True:
        c = 0
        d = 0
        for i in range(N):
            c += A[i]//X
            d += A[i]//(X+1)
        if d <= K and c > K:
            print(X+1)
            break
        elif d > K:
            X += y
            y = (y+1) // 2
        elif c <= K:
            X -= y
            y = (y+1) // 2
Problem p02624 (python)

Fixed submission:
N = int(input())
SUM = 0
for i in range(1, N+1):
    SUM += (i*(N//i)*((N//i)+1))//2
print(SUM)

Buggy submission (verdict: Runtime Error):
N = int(input())
SUM = 0
for i in range(1, N+1):
    print (i,(i*(N//i)*((N//i)+1))//2)
    SUM += (i*(N//i)*((N//i)+1))//2
print(SUM)
Problem p02546 (python)

Fixed submission:
S=input()
l=len(S)
s=list(S)
if s[l-1]=="s":
  print(S+"es")
else:
  print(S+"s")

Buggy submission (verdict: Runtime Error):
S=input()
l=len(S)
s=list(S)
if s[l]=="s":
  print(S+"es")
else:
  print(S+"s")
Problem p02594 (python)

Fixed submission:
X = input()
tem = int(X)
if tem>=30:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
s = input()
tem=str(s)
if tem>=30:
  print("Yes")
else:
  print("No")
Problem p02627 (python)

Fixed submission:
alf=input()
if alf.islower():
  print("a")
else:
  print("A")

Buggy submission (verdict: Runtime Error):
alf=input()
if alf.islower():
  print(a)
else:
  print(A)
Problem p02984 (python)

Fixed submission:
# 定数
INF = float("inf")
MOD = int(1e9 + 7)

# エントリーポイント
def main():
	# 入力
	N = int(input())
	A = list(map(int, input().split()))

	offset = 0
	for a in A:
		offset = a * 2 - offset
	offset //= 2
	for a in A:
		print(offset)
		offset = a * 2 - offset

main()

Buggy submission (verdict: Runtime Error):
import math # 階乗:factorial 切り上げ:ceil 切り捨て:floor
from operator import itemgetter as ig
from collections import defaultdict as dd
# 定数
INF = math.inf
MOD = int(1e9 + 7)

def main():
    N = int(input())
    A = tuple(map(int, input().split()))

    x = sum(A[::2]) - sum(A[1::2])
    r = [x]
    for n in range(N - 1):
        r += [A[n] * 2 - r[-1]]
    print(*r)

main()
Problem p02990 (python)

Fixed submission:
import math

N, K = map(int, input().split())

MOD = 10 ** 9 + 7

def comb(n, r):
	f = math.factorial
	return f(n) // (f(n - r) * f(r))

for k in range(1, K + 1):
	if N - K + 1 < k:
		print(0)
		continue
	print(comb(K - 1, k - 1) * comb(N - K + 1, k) % MOD)

Buggy submission (verdict: Runtime Error):
# 定数
INF = float("inf")
MOD = int(1e9 + 7)

import math

def comb(a, b):
	return math.factorial(a) // math.factorial(a - b) // (math.factorial(b))

N, K = map(int, input().split())

num_blue = K
num_red = N - K

for k in range(1, K + 1):
	comb_blue = comb(num_blue - 1, k - 1)
	comb_red = comb(num_red + 1, k)
	print((comb_blue * comb_red) % MOD)

Buggy submission (verdict: Runtime Error):
import math

N, K = map(int, input().split())

MOD = 10 ** 9 + 7

def comb(n, r):
	f = math.factorial
	return f(n) // (f(n - r) * f(r))

for k in range(1, K + 1):
	print(comb(K - 1, k - 1) * comb(N - K + 1, k) % MOD)
Problem p03053 (python)

Fixed submission:
H, W = map(int, input().split())
STAGE = [list(input()) for _ in range(H)]

black, white = [], 0
for y, line in enumerate(STAGE):
	for x, cell in enumerate(line):
		if "#" == cell:
			black += [(y, x)]
		else:
			white += 1

stage = STAGE
ds = ((0, 1), (1, 0), (0, -1), (-1, 0))

def get_next(p, d):
	n = (p[0] + d[0], p[1] + d[1])
	if 0 <= n[0] < H and 0 <= n[1] < W:
		return n
	return None

def set_val(p, v):
	global stage
	stage[p[0]][p[1]] = v

def get_val(p):
	return stage[p[0]][p[1]]

count = 0
while white:
	count += 1
	next_black = []
	for b in black:
		for d in ds:
			n = get_next(b, d)
			if n:
				v = get_val(n)
				if "." == v:
					white -= 1
					set_val(n, "#")
					next_black += [n]
	black = next_black

print(count)

Buggy submission (verdict: Runtime Error):
H, W = map(int, input().split())
STAGE = [list(input()) for _ in range(H)]

black, white = [], 0
for y, line in enumerate(STAGE):
	for x, cell in enumerate(line):
		if "#" == cell:
			black += [(y, x)]
		else:
			white += 1

stage = STAGE.copy()
ds = ((0, 1), (1, 0), (0, -1), (-1, 0))

def get_next(p, d):
	n = (p[0] + d[0], p[1] + d[1])
	if 0 <= n[0] < H and 0 <= n[1] < W:
		return n
	return None

def set_val(p, v):
	global stage
	stage[p[0]][p[1]] = v

def get_val(p):
	return stage[p[0]][p[1]]

count = 0
while white:
	count += 1
	next_black = []
	for b in black:
		for d in ds:
			n = get_next(b, d)
			if n:
				v = get_val(n)
				if "." == v:
					white -= 1
					set_val(n, "#")
					next_black += [n]
	black = next_black

print(count)
Problem p03804 (python)

Fixed submission:
N, M = map(int, input().split())
A = [input() for _ in range(N)]
B = [input() for _ in range(M)]

l = 0
while l <= len(A[0]) - len(B[0]):
	for i in range(N - M + 1):
		s = A[i][l:]
		if not B[0] in s:
			continue
		if 0 == s.index(B[0]):
			for m in range(1, M):
				if not B[m] in A[i + m][l:]:
					break
				if 0 != A[i + m][l:].index(B[m]):
					break
			else:
				print("Yes")
				exit()
	l += 1
print("No")

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
A = [input() for _ in range(N)]
B = [input() for _ in range(M)]

l = 0
while l <= len(A[0]) - len(B[0]):
	for i in range(N - M + 1):
		s = A[i][l:]
		if not B[0] in s:
			continue
		if 0 == s.index(B[0]):
			for m in range(1, M):
				if 0 != A[i + m][l:].index(B[m]):
					break
			else:
				print("Yes")
				exit()
	l += 1
print("No")

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
A = [input() for _ in range(N)]
B = [input() for _ in range(M)]

l = 0
w = len(A[0])
while l <= len(A) - len(B):
	for n in range(len(A) - len(B)):
		if B[0] not in A[n][l:]:
			continue
		if 0 == A[n][l:].index(B[0]):
			for m in range(1, len(B)):
				if 0 != A[n + m][l:].index(B[m]):
					break
				else:
					#print(n, m)
					print("Yes")
					exit()
	l += 1
print("No")

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
A = [input() for _ in range(N)]
B = [input() for _ in range(M)]

l = 0
w = len(A[0])
while l <= len(A[0]) - len(B[0]):
	for n in range(len(A) - len(B)):
		if B[0] not in A[n][l:]:
			continue
		if 0 == A[n][l:].index(B[0]):
			for m in range(1, len(B)):
				if 0 != A[n + m][l:].index(B[m]):
					break
				else:
					#print(n, m)
					print("Yes")
					exit()
	l += 1
print("No")

Buggy submission (verdict: Runtime Error):
def INSTR():
	return input()

def INNUM():
	return int(INSTR())

def INSTR_S():
	return INSTR().split()

def INNUM_S():
	return map(int, INSTR_S())

def INSTR_M(n):
	return [INSTR() for _ in range(n)]

def INNUM_SM(n):
	return [tuple(INNUM_S()) for _ in range(n)]

N, M = INNUM_S()
NPIC = INSTR_M(N)
MPIC = INSTR_M(M)

for i, npic in enumerate(NPIC):
	if MPIC[0] in npic:
		c = npic.find(MPIC[0])
		for j, mpic in enumerate(MPIC):
			if c != NPIC[i + j].find(mpic):
				break
		else:
			print("Yes")
			exit()
print("No")
Problem p02546 (python)

Fixed submission:
val = input()
valf=val[-1]
if(valf=="s"):
    print(val+"es")
else:
    print(val+"s")

Buggy submission (verdict: Runtime Error):
val = input()
valf=val[-1]
if(valf==s):
    print(val+"es")
else
    print(val+"s")
Problem p02659 (python)

Fixed submission:
A, B = map(float, input().split())

a = int(A)
b = round(B * 100)

print(a * b // 100)

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

a = int(A)
b = B

print(int(a * b))
Problem p02695 (python)

Fixed submission:
N, M, Q = map(int, input().split())
abcd = [list(map(int, input().split())) for i in range(Q)]

A = [0] * N
A[0] = 1
result = []


def dfs(d, n, A):
    # 深さがNを超えるか、数字がMを超えたらreturn
    if d > N or n > M:
        return
    # 深さdの数字にnを入力
    A[d - 1] = n

    # 最深まで値が入ったら総和を計算
    if d == N:
        total = 0
        for i in range(Q):
            ai = abcd[i][0]
            bi = abcd[i][1]
            ci = abcd[i][2]
            di = abcd[i][3]
            if A[bi - 1] - A[ai - 1] == ci:
                total += di
        result.append(total)

    dfs(d + 1, n, A)
    dfs(d, n + 1, A)


dfs(2, 1, A)

print(max(result))

Buggy submission (verdict: Runtime Error):
N, N, Q = map(int, input().split())
abcd = [list(map(int, input().split())) for i in range(Q)]

abcd.sort()
total = 0

for i in range(2 ** Q):
    now = str(format(i, 'b')).zfill(Q)
    A = [-1] * N
    flag = 0
    tmp = 0
    for j in range(Q):
        if now[j] == '1':
            mi = abcd[j][0] - 1
            ma = abcd[j][1] - 1
            if A[mi] == -1:
                A[mi] = 0
            if A[ma] == -1:
                A[ma] = A[mi] + abcd[j][2]
            elif A[ma] != A[mi] + abcd[j][2]:
                flag = 1
                break
            tmp += abcd[j][3]
    if tmp > total:
        total = tmp
print(total)