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

Fixed submission:
A, B, C = map(int, input().split())
if A > B:
  if C < A and C > B:
    print("Yes")
  else:
    print("No")
else:
  if C > A and C < B:
    print("Yes")
  else:
    print("No")

Buggy submission (verdict: Runtime Error):
A, B, C = map(int, input().split())
if C => A and C <= B:
  print("Yes")
else:
  print("No")
Problem p03076 (python)

Fixed submission:
list = [int(input()) for n in range(5)]
min = 100
min_arg = 0
for i in range(5):
  if min > list[i] % 10 and list[i] % 10 != 0:
    min = list[i] % 10
    min_arg = i
ans = 0
for i in range(5):
  if i == min_arg:
    continue
  ans += list[i]
  if ans % 10 != 0:
    ans = ans - (ans % 10) + 10
ans += list[min_arg]
print(ans)

Buggy submission (verdict: Runtime Error):
list = [int(input()) for n in range(5)]
min = 100
for i in range(5):
  if min > list[i] % 10 and list[i] % 10 != 0:
    min = list[i] % 10
    min_arg = i
ans = 0
for i in range(5):
  if i == min_arg:
    continue
  ans += list[i]
  if ans % 10 != 0:
    ans = ans - (ans % 10) + 10
ans += list[min_arg]
print(ans)
Problem p03080 (python)

Fixed submission:
N=int(input())
s=input()
b_count=0
r_count=0
for i in range(N):
  if s[i]=='R':
    r_count+=1
  elif s[i]=='B':
    b_count+=1
if r_count>b_count:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
N=int(input())
s=input()
b_count=0
r_count=0
for i in range(N):
  is s[i]=='R':
    r_count+=1
  elif s[i]=='B':
    b_count+=1
if r_count>b_count:
  print('Yes')
else:
  print('No')
Problem p03085 (python)

Fixed submission:
b = input()
if b == 'A':
  print("T")
elif b == 'T':
  print("A")
elif b == 'G':
  print("C")
elif b == 'C':
  print("G")

Buggy submission (verdict: Runtime Error):
b = input()
if b = 'A':
  print("T")
elif b = 'T':
  print("G")
elif b = 'G':
  print("C")
elif b = 'C':
  print("G")
Problem p03106 (python)

Fixed submission:
A, B, K = map(int, input().split())
n = min(A, B)
list1 =[]
for i in range(1, n+1):
  if A % i == 0 and B % i == 0:
    list1.append(i)
list1 = list1[::-1]
print(list1[K-1])

Buggy submission (verdict: Runtime Error):
A, B, K = map(int, input().split())
n = max(A, B)
list1 =[]
count = 0
for i in range(1, n):
  if A % i == 0 and B % i == 0:
    list1.append(i)
list1 = list1[::-1]
if K == 1:
  print("1")
else:
  print(list1[K-1])

Buggy submission (verdict: Runtime Error):
A, B, K = map(int, input().split())
n = max(A, B)
list1 =[]
count = 0
for i in range(1, n):
  if A % i == 0 and B % i == 0:
    list1.append(i)
list1 = list1[::-1]
print(list1[K-1])
Problem p03150 (python)

Fixed submission:
def main():
    s = input()
    keyence = 'keyence'

    if keyence == s:
        print("YES")
        return

    List = []
    for i in range(len(keyence)):
        List.append((keyence[0:i], keyence[i:len(keyence)]))

    ans = "NO"

    for left, right in List:
        l = len(left)
        r = len(right)
        if s[0:l] == left and s[-r:] == right:

            ans = "YES"

    print(ans)
    return


main()

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

keyence = 'keyence'
flag = 0
k_i = 0
en = ""
en_list = []

for i in range(len(s)):
    if s[i] == keyence[k_i]:
        k_i += 1
        flag = 1
        if en != "":
            en_list.append(en)
            en = ""
    else:
        en += s[i]

if len(en_list) <= 1 and flag:
    print("YES")
else:
    print("NO")
Problem p03219 (python)

Fixed submission:
X, Y = map(int, input().split())
print(int(X+Y/2))

Buggy submission (verdict: Runtime Error):
X Y = map(int, input().split())
print(int(X + Y/2))
Problem p03251 (python)

Fixed submission:
N, M, X, Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
x = max(X, max(x))
y = min(Y, min(y))
if x < y:
  print("No War")
else:
  print("War")

Buggy submission (verdict: Runtime Error):
N, M, X, Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
x = max(x)
x = min(X, max(x))
y = min(y)
y = min(Y, min(y))
if x < y:
  print("No War")
else:
  print("War")

Buggy submission (verdict: Runtime Error):
N, M, X, Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
x = max(x)
x = min(X, max(x))
y = min(y)
y = min(Y, min(y))
if x < y:
  print("No War")
else:
  print("War")
Problem p03261 (python)

Fixed submission:
N = int(input())
w_list = [""]*N
is_cor = True
for i in range(N):
  w_list[i] = input()
for i in range(N-1):
  b = w_list.copy()
  b[i] = ""
  if w_list[i][len(w_list[i])-1] != w_list[i+1][0] or w_list[i] in b:
    print("No")
    is_cor = False
    break
if is_cor:
  print("Yes")

Buggy submission (verdict: Runtime Error):
N = int(input())
w_list = ""
is_cor = True
for i in range(N):
  w_list[i] = input()
a = w_list[0]
for i in range(1, N-1):
  b = w_list
  b[i] = 0
  if a[len(a)-1] != w_list[i][0] or w_list[i] in b:
    print("No")
    is_cor = False
    break
if is_cor:
  print("Yes")
Problem p03264 (python)

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

Buggy submission (verdict: Runtime Error):
a = int(input())
print(int(k/2) * int((k+1)/ 2))

Buggy submission (verdict: Runtime Error):
a = int(input())
print((k//2) * ((k+1)//2))

Buggy submission (verdict: Runtime Error):
a = int(input())
print(k//2 * (k+1)//2)
Problem p03338 (python)

Fixed submission:
def main():
    n = int(input())
    s = input()
    ma = 0
    for i in range(1, n):
        x = s[:i]
        y = s[i:]
        ma = max(ma, count_same(x, y))
    print(ma)


def count_same(x, y):
    return len(set(x) & set(y))


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
\def main():
    n = int(input())
    s = input()
    ma = 0
    for i in range(1, n):
        x = s[:i]
        y = s[i:]
        ma = max(ma, count_same(x, y))
    print(ma)


def count_same(x, y):
    return len(set(x) & set(y))


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

Fixed submission:
N = int(input())
Ai = input().split()
Ai = [int(n) for n in Ai]
Ai = sorted(Ai, reverse=True)
Alice = 0
Bob = 0
i = 0
while True:
  if i+1 <= N-1:
    Alice += Ai[i]
    Bob += Ai[i+1]
  if i == N-1:
    Alice += Ai[i]
  if i > N-1:
    break
  i = i + 2

print(Alice - Bob)

Buggy submission (verdict: Runtime Error):
N = int(input())
Ai = input().split()
Ai = [int(n) for n in Ai]
Ai = sorted(Ai, reverse=True)
Alice = 0
Bob = 0
i = 0
while True:
  if i+1 <= N:
    Alice += Ai[i]
    Bob = Alice[i+1]
  if i == N:
    Alice += Ai[i]
  if i > N:
    break
  i = i + 2

print(Alice - Bob)
Problem p03457 (python)

Fixed submission:
N = int(input())
t = [0] * (N+1)
x = [0] * (N+1)
y = [0] * (N+1)
for i in range(N):
  t[i+1], x[i+1], y[i+1] = map(int, input().split())
is_able = True
 
for i in range(N):
  dt = t[i+1] - t[i]
  dist = abs(x[i+1] - x[i]) + abs(y[i+1] - y[i])
  if dt < dist:
    is_able = False
  if dt % 2 != dist % 2:
    is_able = False
  
if is_able:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
N = int(input())
for i in range(N):
  t[i], x[i], y[i] = map(int, input().split())

is_able = True

for i in range(N-1):
  dt = t[i+1] - t[i]
  dist = abs(x[i+1] - x[i]) + abs(y[i+1] - y[i])
  if dt < dist:
    is_able = False
  if dt % 2 != dist % 2:
    is_able = False
  
if is_able:
  print("YES")
else:
  print("NO")
Problem p03469 (python)

Fixed submission:
y, m, d = input().split('/')
y = '2018'
print(y + '/' + m + '/' + d)

Buggy submission (verdict: Runtime Error):
y, m, d = input()
y = '2018'
print(y + '/' + m + '/' + d)

Buggy submission (verdict: Runtime Error):
N, Y = map(int, input().split())
sum = 0
is_exist = False
for i in range(N+1):
  for j in range(N+1):
    k = N - i - j
    sum = i * 10000 + j * 5000 + k * 1000
    if sum == Y and i + j + k == N:
      printf("{} {} {}".format(i, j, k))
      is_exist = True
      break
  if is_exist:
    break
if is_exist == False:
  print("-1 -1 -1")
Problem p03471 (python)

Fixed submission:
def find(n, y):
  for i in range(n+1):
    for j in range(n+1-i):
      if 10000 * i + 5000 * j + 1000 * (n - i - j) == y:
        return i, j, n-i-j
  return -1, -1, -1
N, Y = map(int, input().split())
i, j, k = find(N, Y)
print("{} {} {}".format(i, j, k))

Buggy submission (verdict: Runtime Error):
def find(n, y):
  for i in range(n+1):
    for j in range(n+1-i):
      if 10000 * i + 5000 * j + 1000 * (n - i - j) == y:
        return i, j, n-i-j
  return -1, -1, -1
N, Y = map(int, input().split())
i, j, k = find(N, Y)
print("{} {} {}".format(i, j, k)

Buggy submission (verdict: Runtime Error):
N, Y = map(int, input().split())
goukei = 0
is_exist = False
for i in range(N+1):
  for j in range(N+1):
    k = N - i - j
    goukei = i * 10000 + j * 5000 + k * 1000
    if goukei == Y and i + j + k == N:
      printf("{} {} {}".format(i, j, k))
      is_exist = True
      break
  if is_exist:
    break
if is_exist == False:
  print("-1 -1 -1")

Buggy submission (verdict: Runtime Error):
N, Y = map(int, input().split())
sum = 0
is_exist = False
for i in range(N+1):
  for j in range(N+1):
    k = N - i - j
    sum = i * 10000 + j * 5000 + k * 1000
    if sum == Y and i + j + k == N:
      printf("{} {} {}".format(i, j, k))
      is_exist = True
      break
  if is_exist:
    break
if is_exist == False:
  print("-1 -1 -1")

Buggy submission (verdict: Runtime Error):
N, Y = map(int, input().split())
sum = 0
is_exist = False
for i in range(N+1):
  for j in range(N+1):
    k = N - i - j
    sum = i * 10000 + j * 5000 + k * 1000
    if sum == Y and i + j + k == N:
      printf("{} {} {}".format(i, j, k))
      is_exist = True
      break
if is_exist == False:
  print("-1 -1 -1")

Buggy submission (verdict: Runtime Error):
N, Y = map(int, input().split())
sum = 0
is_exist = False
for i in range(N+1):
  for j in range(N+1):
    k = N - i - j
    sum = i * 10000 + j * 5000 + k * 1000
    if sum == Y and i + j + k == N:
      printf(str(i) + " " + str(j) + " " + str(k))
      is_exist = True
      break
if is_exist == False:
  print("-1 -1 -1")

Buggy submission (verdict: Runtime Error):
N, Y = map(int, input().split())
sum = 0
is_exist = False
for i in range(N+1):
  for j in range(N+1):
    for k in range(N+1):
      if i + j + k > N:
        break
      sum = i * 10000 + j * 5000 + k * 1000
      if sum == Y:
        printf(str(i) + " " + str(j) + " " + str(k))
        is_exist = True
        break
if is_exist == False:
  print("-1 -1 -1")

Buggy submission (verdict: Runtime Error):
N, Y = map(int, input().split())
sum = 0
is_exist = False
for i in range(N+1):
  for j in range(N+1):
    for k in range(N+1):
      if i + j + k > N:
        break
      sum = i * 10000 + j * 5000 + k * 1000
      if sum == Y:
        printf(str(i) + " " + str(j) + " " + str(k))
        is_exist = True
        break
if is_exist = False:
  print("-1 -1 -1")
Problem p03474 (python)

Fixed submission:
def main():
  a, b = map(int, input().split())
  s = input()
  for i in range(len(s)):
    if i == a:
      if s[i] != '-':
       	return False
    else:
      if s[i] == '-':
        return False
  return True
 
if __name__ == '__main__':
  if main():
    print('Yes')
  else:
    print('No')

Buggy submission (verdict: Runtime Error):
def main():
  a, b = map(int, input().split())
  s = input()
  for i in range(1, len(s)+1):
    if i == a+1:
      if s[i] != '-':
       	return False
    else:
      if s[i] == '-':
        return False
  return True

if __name__ == '__main__':
  if main():
    print('Yes')
  else:
    print('No')
Problem p03478 (python)

Fixed submission:
N, A, B = input().split()
A = int(A)
B = int(B)
k_sum = 0
ans = 0
for j in range(1, int(N)+1):
  j = str(j)
  k_sum = 0
  for i in range(len(j)):
  	k_sum += int(j[i])
  if k_sum >= A and k_sum <= B:
    ans += int(j)
print(ans)

Buggy submission (verdict: Runtime Error):
N, A, B = input().split()
A = int(A)
B = int(B)
k_sum = 0
ans = 0
for j in range(1, int(N)+1):
  j = str(j)
  for i in range(len(j)):
  	k_sum += int(j[i])
  if k_sum >= A and k_sum <= B:
    ans += int[j]

print(j)
Problem p03657 (python)

Fixed submission:
a, b = map(int, 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 = map(int, input().split())
if a % 3 == 0 or b % 3 == 0 or (a+b) % 3 == 0:
  print("Possible")
else:
  Print("Impossible")
Problem p03658 (python)

Fixed submission:
n, k = map(int, input().split())
li = sorted(list(map(int, input().split())), reverse=True)
ans = 0

for i in range(k):
  ans += li[i]
  
print(ans)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
li = sorted(list(map(int, input().split())), reverse=True)

print(li[0]+li[1]+li[2])
Problem p03712 (python)

Fixed submission:
h, w = map(int, input().split())
 
for i in range(h+2):
  if i == 0 or i == h+1:
    print("#"*(w+2))
  else:
    print("#"+input()+"#")

Buggy submission (verdict: Runtime Error):
h, w = map(int, input().split())

for i in range(h+2):
  if i == 0 or i == h+1:
    print("#"*(w+2))
  else:
    print("#"+input()"#")
Problem p03738 (python)

Fixed submission:
a = int(input())
b = int(input())

if a > b:
  print("GREATER")
elif a == b:
  print("EQUAL")
else:
  print("LESS")

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
if a > b:
  print("GREATER")
elif a == b:
  print("EQUAL")
else:
  print("LESS")
Problem p03778 (python)

Fixed submission:
w, a, b = map(int, input().split())
ans = 0
if a < b:
  if a+w > b:
    ans = 0
  else:
    ans = b - (a+w)
elif a == b:
  ans = 0
 
else:
  if b+w > a:
    ans = 0
  else:
    ans = a - (b+w)
 
print(ans)

Buggy submission (verdict: Runtime Error):
w, a, b = map(int, input().split())
ans = 0
if a < b:
  if a+w > b:
    ans = 0
  else:
    ans = b - a+w
else if a == b:
  ans = 0

else:
  if b+w > a:
    ans = 0
  else:
    ans = a - b+w

print(ans)
Problem p02760 (python)

Fixed submission:
import numpy as np

a = [list(map(int, input().split())) for _ in range(3)]
a = np.array(a)
n = int(input())

for _ in range(n):
    b = int(input())
    
    for j in range(3):
        for i in range(3):
            if a[j][i] == b:
                a[j][i] = 0

at = a.transpose()
flag = False
for i in range(3):
    if sum(a[:][i]) == 0 or sum(at[:][i]) == 0:
        flag = True
        break
diag = a[0][0] + a[1][1] + a[2][2]
diag2 = a[2][0] + a[1][1] + a[0][2]
if diag == 0 or diag2 == 0:
    flag = True

print("Yes" if flag else "No")

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

flag = False
for i in range(3):
    if a[i][0] in b and a[i][1] in b and a[i][2] in b:
        flag = True
        break
    if a[0][i] in b and a[1][i] in b and a[2][i] in b:
        flag = True
        break
if a[0][0] in b and a[1][1] in b and a[2][2] in b:
    flag = True
if a[2][0] in b and a[1][1] in b and a[0][2] in b:
    flag = True
    
print("Yes" if flag else "No")
Problem p03076 (python)

Fixed submission:
Time = []
Time_Zero = []

for i in range(5):
    A = int(input())
    ra = A%10
    qa = A//10
    if ra == 0:
      Time_Zero.append([ra,qa,A])
    else:
      Time.append([ra,qa,A])

Time.sort(reverse=True)

ans = 0
for r,q,A in Time_Zero:
  ans += 10*q

for r,q,A in Time:
  ans += 10*(q+1)

if len(Time) > 0:
  ans += Time[-1][2] - 10*(Time[-1][1]+1)

print(ans)

Buggy submission (verdict: Runtime Error):
Time = []
Time_Zero = []

for i in range(5):
    A = int(input())
    ra = A%10
    qa = A//10
    if ra == 0:
      Time_Zero.append([ra,qa,A])
    else:
      Time.append([ra,qa,A])

Time.sort(reverse=True)

ans = 0
for r,q,A in Time_Zero:
  ans += 10*q

for r,q,A in Time:
  ans += 10*(q+1)

ans += Time[-1][2] - 10*(Time[-1][1]+1)

print(ans)
Problem p03086 (python)

Fixed submission:
S = input()

acgt =['A','C','G','T']

count = 0
ans = 0

for i in range(len(S)):
    if acgt.count(S[i]):
        count += 1
    else:
        count = 0
    ans = max(ans,count)

print(ans)

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

cnt = 0
ans = 0

for ss in S:
    if ss in 'ACGT':
        len += 1
    else:
        len = 0
    ans = max(ans,len)
    
print(ans)
Problem p03282 (python)

Fixed submission:
S = input()
K = int(input())
 
k = min(K,len(S))

ans = 1

for i in range(k):
    if S[i] != '1':
        ans = S[i]
        break
print(ans)

Buggy submission (verdict: Runtime Error):
S = input()
K = int(input())

k = min(K,len(S))

for i in range(k):
    if S[i] != '1':
        ans = S[i]
        break
print(ans)

Buggy submission (verdict: Runtime Error):
S = input()
K = int(input())

for i in range(K):
    if S[i] != '1':
        ans = S[i]
        break
print(ans)
Problem p03290 (python)

Fixed submission:
D,G = map(int,input().split())
G = G//100
pc = []

for i in range(D):
    p,c = map(int,input().split())
    pc.append((p,c//100))

ans = 1e9

for i in range(1<<D):
    points = 0
    cost = 0
    for j in range(D):
        jbit = ((i>>j)&1)
        
        points += jbit*( (j+1)*pc[j][0] + pc[j][1])
        cost += jbit * pc[j][0]
        
    if points >= G:
        ans = min(ans,cost)
        continue
    res = G - points
    for k in range(D-1,-1,-1):
        kbit = ((i>>k)&1)
        if not kbit:
            test = (res+k) // (k+1)
            #print(test)
            if test <= pc[k][0]-1:
                res = 0
                cost += test
                ans = min(ans, cost)
            else:
                res -= (k+1)*(pc[k][0]-1)
                cost += pc[k][0]-1
    
print(ans)

Buggy submission (verdict: Runtime Error):
D,G = map(int,input().split())
G = G//100
pc = []

for i in range(D):
    p,c = maap(int,input().split())
    pc.append((p,c//100))

ans = 1e9

for i in range(1<<D):
    points = 0
    cost = 0
    for j in range(D):
        jbit = ((i>>j)&1)
        
        points += jbit*( (j+1)*pc[j][0] + pc[j][1])
        cost += jbit * pc[j][0]
        
    if points >= G:
        ans = min(ans,cost)
        continue
    res = G - points
    for k in range(D-1,-1,-1):
        kbit = ((i>>k)&1)
        if not kbit:
            test = res // (k+1)
            #print(test)
            if test <= pc[k][0]-1:
                res = 0
                cost += test
                ans = min(ans, cost)
            else:
                res -= (k+1)*(pc[k][0]-1)
                cost += pc[k][0]-1
    
print(ans)
Problem p03361 (python)

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

shift = [[1,0],[-1,0],[0,-1],[0,1]]

flag = True
for j in range(H):
    for i in range(W):
        if s[j][i] == ".":
            continue
        else:
            flag = False
            for dx,dy in shift:
                nx = i + dx
                ny = j + dy
                
                if nx >= 0 and nx < W and ny >= 0 and ny < H:
                    if s[ny][nx] == "#":
                        flag = True
            if not flag:
                print("No")
                exit(0)

print("Yes")

Buggy submission (verdict: Runtime Error):
H, W = map(int,input().split())

s = []
for i in range(H):
    ss = input()
    s.append(ss)

shift = [[1,0],[-1,0],[0,1],[0,-1]]

for j in range(H):
    for i in range(W):
        if s[j][i] == "#":
            flag = False
            for dx, dy in shift:
                nx = i + dx
                ny = j + dy
                if nx >= 0 and nx < W and ny >= 0 and ny < H:
                    if s[ny][nx] == "#":
                        flag = True
            if not flag:
                exit(0)

if flag:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
H, W = map(int,input().split())

s = []
for i in range(H):
    ss = input()
    s.append(ss)

shift = [[1,0],[-1,0],[0,1],[0,-1]]

for j in range(H):
    for i in range(W):
        if s[j][i] == "#":
            flag = False
            for dx, dy in shift:
                nx = i + dx
                ny = j + dy
                if nx >= 0 and nx < W and ny >= 0 and ny < H:
                    if s[ny][nx] == "#":
                        flag = True
            if not flag:
                break

if flag:
    print("Yes")
else:
    print("No")
Problem p03450 (python)

Fixed submission:
N, M = map(int,input().split())

connect = [[] for _ in range(N)]
visited = [False for _ in range(N)]
cord = [0 for _ in range(N)]

for _ in range(M):
    l,r,d = map(int,input().split())
    l -= 1
    r -= 1
    connect[l].append((r,d))
    connect[r].append((l,-d))

def dfs(i):
    q = [i]
    
    while q:
        x = q.pop()
        for nx, d in connect[x]:
            if not visited[nx]:
                visited[nx] = True
                cord[nx] = cord[x] + d
                q.append(nx)
            else:
                if cord[nx] != cord[x] + d:
                    return False
            
    return True

for i in range(N):
    if not visited[i]:
        visited[i] = True
        flag = dfs(i)
    if not flag:
        break

if flag:
    print('Yes')
else:
    print('No')

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

connect = [[] for _ in range(N)]
visited = [False for _ in range(N)]
cord = [0 for _ in range(N)]

for _ in range(M):
    l,r,d = map(int,input().split())
    l -= 1
    r -= 1
    connect[l].append((r,d))
    connect[r].append((l,-d))

def dfs(i):
    q = [i]
    
    while q:
        x = q.pop()
        for nx, d in connect[x]:
            if not visited[nx]:
                visited[nx] = True
                cord[nx] = cord[x] + d
                q.append(nx)
        else:
            if cord[nx] != cord[x] + d:
                return False
            
    return True

for i in range(N):
    if not visited[i]:
        visited[i] = True
        flag = dfs(i)
    if not flag:
        break

if flag:
    print('Yes')
else:
    print('No')

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

connect = [[] for _ in range(N)]
visited = [False for _ in range(N)]
cord = [0 for _ in range(N)]

for _ in range(M):
    l,r,d = map(int,input().split())
    l -= 1
    r -= 1
    connect[l].append((r,-d))
    connect[r].append((l,d))

def dfs(i,depth):
    for x, d in connect[i]:
        if not visited[x]:
            visited[x] = True
            cord[x] = depth + d
            dfs(x, cord[x])
        else:
            if cord[x] != depth + d:
                return False
    return True

for i in range(N):
    if not visited[i]:
        visited[i] = True
        flag = dfs(i, 0)
    if not flag:
        break

if flag:
    print('Yes')
else:
    print('No')
Problem p02783 (python)

Fixed submission:
h, a = list(map(int , input().split()))
count = 0
while h > 0:
    h = h - a
    count += 1

print(count)

Buggy submission (verdict: Runtime Error):
h, n = map(int , input().split())
a = list(map(int, input().split()))
sum = 0
for i in range(n):
    sum += a[i]
print(sum)
if (h <= sum):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
a, h = map(int , input().split())
count = 0

while(h < 0){
    h -= a;
    count++
}
print(count)
Problem p02742 (python)

Fixed submission:
import math
H, W = list(map(int, input().split()))

sum = float(H*W)
if sum%2 == 0:
    if H == 1 or W == 1:
        print(1)
    else:
        print(H*W//2)
else:
    if H == 1 or W == 1:
        print(1)
    else:
        print(math.floor(H*W/2)+1)

Buggy submission (verdict: Runtime Error):
import math
H, W = list(map(int, input().split()))

sum = float(H*W)

if sum == 0:
    print(0)
else if sum%2 == 0:
    print(H*W//2)
else:
    print(math.floor(H*W/2)+1)
Problem p02842 (python)

Fixed submission:
import math
N = int(input())

res = []
for i in range(1,N+1):
    cal = math.floor(i * 1.08)
    if cal == N:
        res.append(i)
if len(res) == 0:
    print(':(')
else:
    print(res[0])

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

res = []
for i in range(N):
    cal = math.floor(i * 1.08)
    if cal == N:
        res.append(i)
print(res[0])