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

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

n,g,s = map(int,input().split())
G = [[] for _ in range(n)]
for i in range(n-1):
  a,b = map(int,input().split())
  G[a-1].append(b-1)
  G[b-1].append(a-1)
  
def dfs(V,v,d):
  if V[v] != -1:
    return
  V[v] = d
  for nv in G[v]:
    dfs(V,nv,d+1)
  
if len(G[g-1])==1 and G[g-1][0]==s-1:
  print(0)
else:
  vs = [-1]*n
  vg = [-1]*n
  dfs(vs,s-1,0)
  dfs(vg,g-1,0)
  
  ans = 0
  for i in range(n):
    if vs[i]>vg[i]:
      ans = max(ans,vs[i])
      
  print(ans-1)

Buggy submission (verdict: Runtime Error):
n,g,s = map(int,input().split())
G = [[] for _ in range(n)]
for i in range(n):
  a,b = map(int,input().split())
  G[a-1].append(b-1)
  G[b-1].append(a-1)
  
def dfs(V,v,d):
  if V[v] != -1:
    return
  V[v] = d
  for nv in G[v]:
    dfs(V,nv,d+1)
  
if len(G[g-1])==1 and G[g-1][0]==s-1:
  print(0)
else:
  vs = [-1]*n
  vg = [-1]*n
  dfs(vs,s-1,0)
  dfs(vg,g-1,0)
  
  ans = 0
  for i in range(n):
    if vs[i]>vg[i]:
      ans = max(ans,vs[i])
      
  print(ans-1)

Buggy submission (verdict: Runtime Error):
n,g,s = map(int,input().split())
G = [[] for _ in range(n)]
for i in range(n-1):
  a,b = map(int,input().split())
  G[a-1].append(b-1)
  G[b-1].append(a-1)
  
def dfs(V,v,d):
  if V[v] != -1:
    return
  V[v] = d
  for nv in G[v]:
    dfs(V,nv,d+1)
  
if len(G[g-1])==1 and G[g-1][0]==s-1:
  print(0)
else:
  vs = [-1]*n
  vg = [-1]*n
  dfs(vs,s-1,0)
  dfs(vg,g-1,0)
  
  ans = 0
  for i in range(n):
    if vs[i]>vg[i]:
      ans = max(ans,vs[i])
      
  print(ans-1)

Buggy submission (verdict: Runtime Error):
n,g,s = map(int,input().split())
G = [[] for _ in range(n)]
for i in range(n-1):
  a,b = map(int,input().split())
  G[a-1].append(b-1)
  G[b-1].append(a-1)
  
def dfs(v,d):
  if vs[v] != -1:
    return
  vs[v] = d
  for nv in G[v]:
    dfs(nv,d+1)

def dfs2(v,d):
  if vg[v] != -1:
    return
  vg[v] = d
  if d >= vs[v]:
    return  
  for nv in G[v]:
    dfs2(nv,d+1)
  
vs = [-1]*n
vg = [-1]*n

dfs(s-1,0)
dfs2(g-1,0)

print(max(vg))
Problem p02847 (python)

Fixed submission:
day = ['SUN','MON','TUE','WED','THU','FRI','SAT'][::-1]
dic = {d:i+1 for i,d in zip(range(len(day)),day)}
print(dic[input()])

Buggy submission (verdict: Runtime Error):
s = input() 
day = ['SUN','MON','TUE','WED','THU','FRI','SAT'][::-1]
dic = {d:i+1 in i,d zip(range(len(day),day))}
print(dic[s])
Problem p02912 (python)

Fixed submission:
# dequeにinsert追加されたのは 3.5 から
from heapq import heappop,heappush,heapify
n,m = map(int,input().split())
aa = list(map(int,input().split()))
aa = list(map(lambda x:-x,aa))

heapify(aa)
for i in range(m):
  tmp = heappop(aa)  
  heappush(aa,-(-tmp//2))

print(-sum(aa))

Buggy submission (verdict: Runtime Error):
from bisect import bisect_right
from collections import deque

n,m = map(int,input().split())
aa = list(map(int,input().split()))
q = deque()
q.extend(sorted(aa))

for i in range(m):
  tmp = q.pop()//2  
  pos = bisect_right(q,tmp)
  q.insert(pos,tmp)
  
print(sum(q))
Problem p02948 (python)

Fixed submission:
from heapq import heappush,heappop

n,m = map(int,input().split())
ab = [list(map(int,input().split())) for _ in range(n)]
ab = sorted(ab, key= lambda x:(x[0]))

hq = []
j = 0
ans = 0

for i in range(m):
  while j<n and ab[j][0] <= i+1:
    heappush(hq,-ab[j][1])
    j+=1
  if len(hq)>0:
    ans += -heappop(hq)
    
print(ans)

Buggy submission (verdict: Runtime Error):
ab = sorted(ab, key= lambda x:(x[0]))

from heapq import heappush,heappop

n,m = map(int,input().split())
ab = [list(map(int,input().split())) for _ in range(n)]

hq = []
j = 0
ans = 0

for i in range(m):
  while j<n and ab[j][0] <= i+1:
    heappush(hq,-ab[j][1])
    j+=1
  if len(hq)>0:
    ans += -heappop(hq)
    
print(ans)
Problem p03013 (python)

Fixed submission:
n,m = map(int,input().split())
a = [int(input()) for _ in range(m)]
dp=[0]*(n+1)
dp[0]=1

af = [0]*(n+1)
for ai in a:
  af[ai]+=1

if 1 in a:
  dp[1]=0
else:
  dp[1]=1

  
for i in range(2,n+1):
  dp[i]=dp[i-2]+dp[i-1]
  if af[i]==1:    
    dp[i]=0

print(dp[-1]%1000000007)

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

dp = {i:0 for i in A}

dp[0]=1 # 0段目
if A[0]==1:
  dp[1]=0
  A.remove(1)
else:
  dp[1]=1

safe_stairs = list(range(2,N+1))
[safe_stairs.remove(int(a)) for a in A]
  
for i in safe_stairs:  
  dp[i]= int(dp[i-1]+dp[i-2])
print(dp[N]%1000000007)

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

dp = {i:0 for i in A}

dp[0]=1 # 0段目

safe_stairs = list(range(1,N+1))
[safe_stairs.remove(a) for a in A]
  
for i in safe_stairs:  
  dp[i]=dp[i-1]+dp[i-2]
print(dp[N]%1000000007)

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

dp = []
dp.append(1) # 0段目
if 1 in A: # 1段目
  dp.append(0) 
else :
  dp.append(1) 

for i in range(2,N+1):  
  if i in A:
    dp.append(0)
  else :
    dp.append(dp[i-1]+dp[i-2])
print(dp[N])

Buggy submission (verdict: Runtime Error):
N,M = (map(int,input1.split()))
A = list(map(int,input2.split()))

dp = []
dp.append(1) # 0段目
if 1 in A: # 1段目
  dp.append(0) 
else :
  dp.append(1) 

for i in range(2,N+1): # N段目
  if i in A:
    dp.append(0)
  else :
    dp.append(dp[i-1]+dp[i-2])
print(dp[N])
Problem p03041 (python)

Fixed submission:
n,k = map(int,input().split())
s = list(input())
s[k-1]= str.lower(s[k-1])
print("".join(s))

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
s = list(input())
s[k-1]= str.lower(s[k-1])
"".join(s)uu
Problem p03075 (python)

Fixed submission:
a = [int(input()) for _ in range(5)]
k = int(input())
m = 0
for ai in a:
  for aj in a:    
    if m < abs(ai - aj):
      m = abs(ai - aj)
if m <= k:
  print('Yay!')
else:
  print(':(')

Buggy submission (verdict: Runtime Error):
a = [int(input()) for _ in range(5)]
k = int(input())
m = 0
for ai in a:
  for aj in a:    
    if m < abs(ai - aj):
      m = abs(ai - aj)
if m <= k:
  print('Yay!'')
else:
  print(':(')
Problem p03272 (python)

Fixed submission:
n,i = map(int,input().split())
print(n-i+1)

Buggy submission (verdict: Runtime Error):
n,i = (map,int(input()))
print(n-i+1)
Problem p03634 (python)

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

def search_unseen(fr,to,cost):  
  cost_from_k[to] += cost_from_k[fr] + cost
  for n_to,n_cost in es[to]:
    if cost_from_k[n_to] == 0 and k!=n_to:
      search_unseen(to, n_to, n_cost)

n = int(input())
es = {i:[] for i in range(n)}
for i in range(n-1):
  a,b,c = map(int,input().split())
  es[a-1].append((b-1,c))
  es[b-1].append((a-1,c))      
      
q,k = map(int,input().split())
xy = [list(map(int,input().split())) for _ in range(q)]
k -=1

cost_from_k = [0]*n      
search_unseen(k, k, 0)

for x,y in xy:
  print(cost_from_k[x-1] + cost_from_k[y-1])

Buggy submission (verdict: Runtime Error):
import sys 
sys.setrecursionlimit(10**5)

def search_unseen(fr,to,cost):  
  cost_from_k[to] += cost_from_k[fr] + cost
  for n_to,n_cost in es[to]:
    if cost_from_k[n_to] == 0 and k!=n_to:
      search_unseen(to, n_to, n_cost)

n = int(input())
es = {i:[] for i in range(n)}
for i in range(n-1):
  a,b,c = map(int,input().split())
  es[a-1].append((b-1,c))
  es[b-1].append((a-1,c))      
      
q,k = map(int,input().split())
xy = [list(map(int,input().split())) for _ in range(q)]
k -=1

cost_from_k = [0]*n      
search_unseen(k, k, 0)

for x,y in xy:
  print(cost_from_k[x-1] + cost_from_k[y-1])

Buggy submission (verdict: Runtime Error):
INF = float('inf')

def search_unseen(fr,to,cost):  
  cost_from_k[to] += cost_from_k[fr]+cost
  for n_to,n_cost in es[to]:
    if cost_from_k[n_to] == 0 and k!=n_to:
      search_unseen(to,n_to,n_cost)

n = int(input())
es = {i:[] for i in range(n)}
for i in range(n-1):
  a,b,c = map(int,input().split())
  es[a-1].append((b-1,c))
  es[b-1].append((a-1,c))      
      
q,k = map(int,input().split())
xy = [list(map(int,input().split())) for _ in range(q)]
k -=1

cost_from_k = [0]*n      
search_unseen(k,k,0)

for x,y in xy:
  print(cost_from_k[x-1] + cost_from_k[y-1])
Problem p02546 (python)

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

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

if line[len(line)] == ("s"):
  line += "es"
else:
  line += "s"
print(line)
Problem p02547 (python)

Fixed submission:
n = int(input())
z = []
y = 0
for i in range(n):
  line = input().split(" ")
  if int(line[0])==int(line[1]):
    z.append(i)

for i in range(len(z)-2):
  if z[i]==z[i+1]-1:
    if z[i+1]==z[i+2]-1:
      y += 1
if y > 0:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
z = []
y = 0
for i in range(n):
  line = input().split(" ")
  if int(line[0])==int(line[1]):
    z.append(int(line[0]))

for i in range(n-3):
  if z[i]==z[i+1]-1:
    if z[i+1]==z[i+2]-1:
      y += 1
if y > 0:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
z = []
y = 0
for i in range(n):
  line = input().split(" ")
  if int(line[0])==int(line[1]):
    z.append(i)

for i in range(n-3):
  if z[i]==z[i+1]-1:
    if z[i+1]==z[i+2]-1:
      y += 1
if y > 0:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
z = []
y = 0
for i in range(n):
  line = input().split(" ")
  if int(line[0])==int(line[1]):
    z.append(i)

for i in range(n-3):
  if z[i]==z[i+1]-1:
    if z[i+1]==z[i+2]-1:
      y += 1
if y > 0:
  print("yes")
else:
  print("no")

Buggy submission (verdict: Runtime Error):
n = int(input())
z = []
y = o
for i in range(n):
  line = input().split(" ")
  if int(line[0])==int(line[1]):
    z.append(i)

for i in range(n-3):
  if z[i]==z[i+1]:
    if z[i+1]==z[i+2]:
      y += 1
if y > 0:
  print("yes")
else:
  print("no")
Problem p02552 (python)

Fixed submission:
x=input()

if int(x)==1:
  print(0)
else:
  print(1)

Buggy submission (verdict: Runtime Error):
x=input().rstrip.split(" ")
z=[]
for i in range(2):
	z.append(x[i-2]*x[0])
    z.append(x[i-2]*x[1])
print(max(z))
Problem p02951 (python)

Fixed submission:
#!/bin/python3
 
import os
import sys


a = input().split()
result = int(a[2])+int(a[1])-int(a[0])
if result < 0:
  result = 0
print(result)

Buggy submission (verdict: Runtime Error):
#!/bin/python3

import os
import sys


if __name__ == '__main__':
    a = input().split()
    b = input().split()
    c = input().split()

	result = c - (a - b)
    if result > 0:
      result = 0
    print(result)
Problem p02831 (python)

Fixed submission:
from fractions import *
a, b=map(int, input().split())
print(a * b // gcd(a, b))

Buggy submission (verdict: Runtime Error):
# C - Snack
from math import gcd
A, B = map(int, input().split())
ans = A
while ans % B != 0:
    ans += A
print(ans)

Buggy submission (verdict: Runtime Error):
# C - Snack
from math import gcd
A, B = map(int, input().split())
i = 1 
ans = A
while ans % B != 0:
    i += 1
    ans = A * i
print(ans)

Buggy submission (verdict: Runtime Error):
# C - Snack
from math import gcd
A, B = map(int, input().split())
print(A * B // gcd(A, B))

Buggy submission (verdict: Runtime Error):
# C - Snack
from math import gcd
A, B = map(int, input().split())
print(int(A * B / gcd(A, B)))
Problem p03186 (python)

Fixed submission:
A, B, C = map(int, input().split())
if A + B >= C - 1:
    print(B+C)
else:
    print(A+2*B+1)

Buggy submission (verdict: Runtime Error):
A, B, C = map(int, input().split())
if A + B >= C - 1:
    print("{}".format(B+C)
else:
    print("{}".format(A+2*B+1))
Problem p02596 (python)

Fixed submission:
k=int(input())
ans=7
ans2=10
prev=7
hbe=False
if ans%k==0:
    print(1)
    hbe=True
else:
    for i in range(0, k + 1, 1):
        ans=(7*ans2+prev)%k
        if ans%k==0:
            print(i+2)
            hbe=True
            break
        prev=ans
        ans2=(ans2*10)%k
if hbe==False:
    print(-1)

Buggy submission (verdict: Runtime Error):
k=input()
ans=7
ans2=10
prev=7
if ans%k==0:
    print(1)
else:
    for i in range(0, k + 1, 1):
        ans=7*ans2+prev
        if ans%k==0:
            print(i+2)
            break
        prev=ans
        ans2=ans2*10
Problem p02552 (python)

Fixed submission:
x = int(input())

if x == 0: print(1)
else: print(0)

Buggy submission (verdict: Runtime Error):
x = int(input())
if x == 0: pritn(1)
else: print(0)
Problem p02577 (python)

Fixed submission:
N = list(map(int, str(input())))
s = sum(N)
 
if(s % 9 == 0): print('Yes')
else: print('No')

Buggy submission (verdict: Runtime Error):
N = list(map(int, str(input())))

s = 0
for n in range(N):
  s += n

if(s % 9 == 0): print('Yes')
else: print('No')
Problem p02578 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split())) 
ans = 0
 
for n in range(N-1):
  t = A[n] - A[n+1]
  if t <= 0: continue
  else:
    A[n+1] += t
    ans += t

print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split())) 
s = [0]*(N-1)
 
for n in range(N-1):
  s[n] = A[n] - A[n+1]
  if s[n] <= 0: 
    continue
  else:
    A[n+1] += s[n]
 
print(min(s))

Buggy submission (verdict: Runtime Error):
N = int(input())
s = [input() for i in range(N)]
t = [0]*(N-1)
 
for n in range(N-1):
  t[n] = s[n] - s[n+1]
  if t[n] <= 0: 
    continue
  else:
    s[n+1] += t[n]
 
print(min(t))

Buggy submission (verdict: Runtime Error):
N = int(input())
s = [input() for i in range(N)]
t = [0]*(N-1)

for n in range(N-1):
  t[n] = s[n] - s[n+1]
  if t[n] <= 0: 
    continue
  else:
    s[n+1] += t[n]

print(min(t))

Buggy submission (verdict: Runtime Error):
N = int(input())
s = [input() for i in range(N)]

print(N, s)
Problem p02622 (python)

Fixed submission:
S = list(input())
T = list(input())
 
ans = 0
for i in range(len(S)):
  if S[i] != T[i]: ans += 1
print(ans)

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

ans = 0
for i in range(len(S)):
  if s[i] != T[i]: ans += 1
print(ans)
Problem p02682 (python)

Fixed submission:
A, B, C, K = map(int, input().split())

ans = 0
if A > K:
  ans += 1*K
else:
  ans += 1*A
  K = K - A
  if B > K: 
    ans += 0*K
  else:
    ans += 0*B
    K = K - B
    if C > K:
      ans += -1*K
    else:
      ans += -1*C

print(ans)

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

l = [1]*A + [0]*B + [-1]*C
ans = sum(l[:K])

print(ans)
Problem p02701 (python)

Fixed submission:
N = int(input())
S = [input() for _ in range(N)]
 
print(len(set(S)))

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

print(len(set(S))
Problem p02723 (python)

Fixed submission:
S = input()
 
if S[2] == S[3] and S[4] == S[5]: print('Yes')
else: print('No')

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

if S[3] == S[4] and S[5] == S[6]: print('Yes')
else: print('No')
Problem p02725 (python)

Fixed submission:
K, N = map(int, input().split())
A = list(map(int, input().split()))
 
A.append(A[0]+K)
l = 0
for i in range(N):
  l = max(l, A[i+1]-A[i])

print(K-l)

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

K.append(A[0]+K)
l = K+1
for i in range(N):
  l = min(l, A[i+1]-A[i])

print(K-l)
Problem p02753 (python)

Fixed submission:
S = input()
 
if S == 'AAA' or S == 'BBB': print('No')
else: print('Yes')

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

if S = 'AAA' or 'BBB': print('No')
else: print('Yes')
Problem p02766 (python)

Fixed submission:
def from_10_to_n(x, n):
  tmp = x
  out = ''
  while tmp > 0:
    out = str(x % n) + out
    tmp = tmp // n
  return out
 
N, K = map(int, input().split())
N = from_10_to_n(N, K)
print(len(N))

Buggy submission (verdict: Runtime Error):
def from_10_to_n(x, n):
  tmp = x
  out = ''
  while tmp > 0:
    out = str(x % n) + out
    tmp = tmp // n
  return out

N, K = map(int, input().split())
N = from_10_to_n(x, n)
print(len(N))
Problem p02779 (python)

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

if N == len(set(A)): print('YES')
else: print('NO')

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

if N == len(set(A)): print('Yes')
else: print('No')
Problem p02790 (python)

Fixed submission:
a_str, b_str = input().split()
a = int(a_str)
b = int(b_str)

A = a_str*b
B = b_str*a
 
print(min(A, B))

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
 
if a > b:
  print(str(b) * a)
else
  print(str(a) * b)

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

A = a_str*b
B = b_str*a

print(min(A, B))
Problem p02831 (python)

Fixed submission:
import math
a, b = map(int, input().split())

print(a * b // math.gcd(a, b))

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

lcm = 0
for i in range(1, B+1):
  if (A * i) % B == 0:
    lcm = A * i
  
print(lcm)
Problem p02879 (python)

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

if 1<=A<=9 and 1<=B<=9: print(A*B)
else: print(-1)

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

print(A*B)
Problem p02970 (python)

Fixed submission:
N, D = map(int, input().split())
 
# 前から最適に配置せよ
# 一人目は, 1,...,D, D+1, D+2,...,2D+1 を監視
# 二人目は, 2D+2,..., 3D+2, ...,4D+2 を監視
# x人まで繰り返すと、1,...,x(2D+1)まで監視できる
 
# x(2D+1) > N を満たす最小のxは？
# x_min = ceil(N/(2D+1))
 
print(-(-N//(2*D+1)))

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

# 前から最適に配置せよ
# 一人目は, 1,...,D, D+1, D+2,...,2D+1 を監視
# 二人目は, 2D+2,..., 3D+2, ...,4D+2 を監視
# x人まで繰り返すと、1,...,x(2D+1)まで監視できる

# x(2D+1) > N を満たす最小のxは？
# x_min = ceil(N/(2D+1))

print(-(-N//(2D+1)))
Problem p02989 (python)

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

d = sorted(d)
print(d[N//2] - d[(N//2)-1])

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

N = int(input())
d = list(map(int, input().split()))

ans = 0
for K in range(1, 10**5+1):
  if np.sum(d[d>=K]) == np.sum(d[d<K]): ans += 1

print(ans)
Problem p03011 (python)

Fixed submission:
P, Q, R = map(int, input().split())

print(min(P+Q, Q+R, R+P))

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

# O(N^2)で解いても間に合う
m = 10**10
for i in range(1, N):
  a, b = 0, 0
  for j in range(i):
    a += W[j]
  for j in range(i, N):
    b += W[j]
  m = min(m, abs(a-b))
print(m)
Problem p03012 (python)

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

m = 10**10
for i in range(1, N):
  m = min(m, abs(sum(W[:i]) - sum(W[i:])))
                 
print(m)

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

m = 10**10
for i in range(1, W):
  m = min(m, abs(sum(W[:i]), sum(W[i:])))

print(m)
Problem p03041 (python)

Fixed submission:
N, K = map(int, input().split())
S = input()
 
if S[K-1] == 'A': rep = 'a'
elif S[K-1] == 'B': rep = 'b'
else: rep = 'c'

# (K-1)文字目まで + K文字目 + K+1文字目から
print(S[:K-1] + rep + S[K:])

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

if S[K-1] == 'A': rep = 'a'
elif S[K-1] == 'B': rep = 'b'
else: rep = 'c'
  
print(S[:K] + rep + S[K+1:])
Problem p02577 (python)

Fixed submission:
N = str(input())
M = list(map(int, N))
S = sum(M)

if S % 9 == 0:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
N = str(input())

s = list(map(int,N))

S = sum(s)

if S % 9 = 0:
  print(Yes)
else:
  print(No)
Problem p02594 (python)

Fixed submission:
X = int(input())

if X < 30:
  print("No")
else:
  print("Yes")

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

if X < 30:
  print(No)
else:
  print(Yes)
Problem p02627 (python)

Fixed submission:
import sys

x = input()
if ord(x) < 91:
    print('A')
else:
    print('a')

Buggy submission (verdict: Runtime Error):
  1 ini = lambda : int(input())
  2 inm = lambda : map(int,input().split())
  3 inl = lambda : list(map(int,input().split()))
  4 gcd = lambda x,y : gcd(y,x%y) if x%y else y
  5 a = input()
  6 if ord(a) < ord('a'):
  7         print('A')
  8 else: 
  9         print('a')
Problem p02771 (python)

Fixed submission:
a,b,c = map(int,input().split())
if (a == b and a == c) or (a != b and a != c and b != c):
    print('No')
else:
    print('Yes')

Buggy submission (verdict: Runtime Error):
a,b,c = map(int,input().split())
if (a == b and a == c) or (a != b and a != c and b != c):
    print('No')
else:
    print('Yes')
~
Problem p02859 (python)

Fixed submission:
print((int(input()))**2)

Buggy submission (verdict: Runtime Error):
print((int(input())**2)
Problem p02935 (python)

Fixed submission:
import math
def py():
    print("Yes")
def pn():
    print("No")
def iin():
    x = int(input())
    return x

neko = 0
nya = 0
nuko = 0

n = iin()
a = [int(x) for x in input().split()]
for i in range(n-1):
    a.sort()
    a[i + 1] = (a[i]+a[i + 1])/2
print(a[n-1])

Buggy submission (verdict: Runtime Error):
n = iin()
a = [int(x) for x in input().split()]
for i in range(n-1):
    a.sort()
    a[i + 1] = (a[i]+a[i + 1])/2
print(a[n-1])
Problem p02959 (python)

Fixed submission:
import math
import re
import copy
import sys

n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = 0

for i in range(n):
    c += min(a[i],b[i])
    if a[i] < b[i]:
        c += min(a[i+1],b[i]-a[i])
        a[i+1] -= min(a[i+1],b[i]-a[i])

print(c)

Buggy submission (verdict: Runtime Error):
import math
import re
import copy
import sys
import numpy as np

n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = 0

for i in range(n):
    c += min(a[i],b[i])
    if a[i] < b[i]:
        a[i+1] -= b[i]-a[i]
        c += b[i]-a[i]

print(c)
Problem p03242 (python)

Fixed submission:
n = input()
ans = ''
for i in range(3):
    if n[i] == '9':
        ans += '1'
    else:
        ans +=  '9'
print(int(ans))

Buggy submission (verdict: Runtime Error):
n = input()
for i in range(3):
    if n[i] == '9':
        n[i] = '1'
    else:
        n[i] = '9'
print(int(n))
Problem p02695 (python)

Fixed submission:
from itertools import combinations_with_replacement
def main():
    n,m,q=map(int,input().split())
    ABCD=[list(map(int,input().split())) for _ in range(q)]
    ans=0
    L=list(range(1,m+1))
    for Q in combinations_with_replacement(L,n):
        Q=list(sorted(Q))
        tmp=0
        for a,b,c,d in ABCD:
            if Q[b-1]-Q[a-1]==c:
                tmp+=d
        ans=max(ans,tmp)
    print(ans)
    
if __name__=='__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n,m,q=map(int,input().split())
    ABCD=[list(map(int,input().split())) for _ in range(q)]
    ans=0
    L=list(range(1,m+1))
    for Q in combinations_with_replacement(L,n):
        Q=list(sorted(Q))
        tmp=0
        for a,b,c,d in ABCD:
            if Q[b-1]-Q[a-1]==c:
                tmp+=d
        ans=max(ans,tmp)
    print(ans)
    
if __name__=='__main__':
    main()