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

Fixed submission:
from collections import deque

def bfs(idx,k,colored):
  q = deque()
  visited[idx] = True
  q.append(idx)
  while q:
    r = q.pop()
    color = 0
    for n in graph[r].keys():
      if not visited[n]:
        if color == colored[r]: color+=1
        colored[n] = color
        graph[r][n] = color
        graph[n][r] = color
        color += 1

        visited[n] = True
        q.append(n)

        
N = int(input())
graph = {}
colored = [-1]*(N+1)
visited = [False]*(N+1)
for i in range(N+1):
  graph[i] = {}
ab = []
for i in range(N-1):
  a,b = map(int,input().split())
  ab.append((a,b))
  graph[a][b] = -1
  graph[b][a] = -1
  
k = max([len(graph[i]) for i in range(1,N+1)])

bfs(1,k,colored)
print(k)
for a,b in ab:
  print(graph[a][b]+1)

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

def dfs(node,par,color,k):
  for i in range(len(graph[node])):
    if graph[node][i][0] == par:
      graph[node][i][1] = color
      color = graph[node][i][1]       
      continue
    graph[node][i][1] = (i+2)%k +((i+2)%k == 0) if (i+1) == color else (i+1)%k +((i+1)%k == 0)
    dfs(graph[node][i][0],node,graph[node][i][1],k)

N = int(input())
graph = {}
for i in range(N+1):
  graph[i] = []
ab = []
for i in range(N-1):
  a,b = map(int,input().split())
  ab.append([a,b])
  graph[a].append([b,-1])
  graph[b].append([a,-1])
k = 0
for i in range(1,N+1):
  k = max(k,len(graph[i]))

dfs(1,0,0,k+1)
print(k)
for i in range(N-1):
  a,b = ab[i]
  for j in range(len(graph[a])):
    if graph[a][j][0] == b:
      print(graph[a][j][1])
Problem p03044 (python)

Fixed submission:
import sys
sys.setrecursionlimit(100001)

def dfs(node,w):
  weight = w
  for l in tree[node]:
    if color[l[0]] > -1:
      continue
    if l[1]%2 == 0:
      color[l[0]] = color[node]
    else:
      color[l[0]] = int(not color[node])
    dfs(l[0],l[1])
    


N = int(input())
tree = {}
color = [-1]*(N+1)

for i in range(1,N+1):
  tree[i] = []
for i in range(N-1):
  u,v,w = map(int,input().split())
  tree[u].append([v,w])
  tree[v].append([u,w])
  
color[1] = 0
dfs(1,0)
color = [c  if c>-1 else 0 for c in color]
print('\n'.join(map(str,color[1:])))

Buggy submission (verdict: Runtime Error):
def dfs(node,w):
  weight = w
  for l in tree[node]:
    if color[l[0]] > -1:
      continue
    if l[1]%2 == 0:
      color[l[0]] = color[node]
    else:
      color[l[0]] = int(not color[node])
    dfs(l[0],l[1])
    


N = int(input())
tree = {}
color = [-1]*(N+1)

for i in range(1,N+1):
  tree[i] = []
for i in range(N-1):
  u,v,w = map(int,input().split())
  tree[u].append([v,w])
  tree[v].append([u,w])
  
color[1] = 0
dfs(1,0)
color = [c  if c>-1 else 0 for c in color]
print('\n'.join(map(str,color[1:])))

Buggy submission (verdict: Runtime Error):
def dfs(node,w):
  weight = w
  for l in tree[node]:
    if color[l[0]] > -1:
      continue
    if (l[1]-weight)%2 == 0:
      color[l[0]] = color[node]
    else:
      color[l[0]] = int(not color[node])
    dfs(l[0],l[1])
    


N = int(input())
tree = {}
color = [-1]*(N+1)
color[1] = 0
for i in range(1,N+1):
  tree[i] = []
  
for i in range(N-1):
  u,v,w = map(int,input().split())
  tree[u].append([v,w])
  tree[v].append([u,w])
dfs(1,0)
color = [c  if c>-1 else 0 for c in color]
print('\n'.join(map(str,color[1:])))

Buggy submission (verdict: Runtime Error):
def dfs(node,w):
  weight = w
  for l in tree[node]:
    if color[l[0]] > -1:
      continue
    if (l[1]-weight)%2 == 0:
      color[l[0]] = color[node]
    else:
      color[l[0]] = int(not color[node])
    dfs(l[0],l[1])
    


N = int(input())
tree = {}
color = [-1]*(N+1)
color[1] = 0
for i in range(1,N+1):
  tree[i] = []
  
for i in range(N-1):
  u,v,w = map(int,input().split())
  tree[u].append([v,w])
  tree[v].append([u,w])
dfs(1,0)
print('\n'.join(map(str,color[1:])))
Problem p03136 (python)

Fixed submission:
N=int(input())
bars=list(map(int,input().split()))
if max(bars)<sum(bars)-max(bars):
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
N=int(input())
bars=list(map(int,input().split()))
if max(list)<sum(list)-max(list):
  print('Yes')
else:
  print('No')
Problem p03448 (python)

Fixed submission:
A,B,C,X=map(int,[input() for i in range(4)])
ans=0
for i in range(A+1):
  for j in range(B+1):
    for k in range(C+1):
      if i*500+j*100+k*50==X:
        ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
A,B,C,X=map(int,input() for i in range(4))
ans=0
for i in range(A+1):
  for j in range(B+1):
    for k in range(C+1):
      if i*500+j*100+k*50==X:
        ans+=1
print(ans)
Problem p03470 (python)

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

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

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

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

Buggy submission (verdict: Runtime Error):
N=input
s=[int(input()) for i in range(N)]
print(len(set(s)))
Problem p03478 (python)

Fixed submission:
N,A,B=map(int,input().split())
ans=0
for i in range(N+1):
  if A<=sum(map(int,str(i)))<=B:
    ans+=i
print(ans)

Buggy submission (verdict: Runtime Error):
N,A,B=map(int,input().split())
ans=0
for i in range(N+1):
  if A<=sum(map(str,i))<=B:
    ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
N,A,B=map(int,input().split())
ans=0
for i in range(N+1):
  if A<=sum(map(int,i))<=B:
    ans+=1
print(ans)
Problem p03729 (python)

Fixed submission:
A,B,C=input().split()
if A[-1]==B[0] and B[-1]==C[0]:
  print('YES')
else:
  print('NO')

Buggy submission (verdict: Runtime Error):
A,B,C=input().split()
if A[-1]==B[0] and B[-1]=C[0]:
  print('YES')
else:
  print('NO')
Problem p03738 (python)

Fixed submission:
A=int(input())
B=int(input())
print('GREATER' if (A-B)>0 else 'EQUAL' if A==B else 'LESS')

Buggy submission (verdict: Runtime Error):
A,B=map(int,input().split())
print('GREATER' if (A-B)>0 else 'EQUAL' if A==B else 'LESS')
Problem p03796 (python)

Fixed submission:
import math
N=int(input())
print(math.factorial(N) % (10**9+7))

Buggy submission (verdict: Runtime Error):
import math
N=int(input)
print(math.factorial(N)%(10**9+7))
Problem p02657 (python)

Fixed submission:
a, b = map(int, input().split())
print(a*b)

Buggy submission (verdict: Runtime Error):
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 = int(input())
b = int(input())
if a * b % 2 == 0:
  print("Even")
else:
  print("odd")

Buggy submission (verdict: Runtime Error):
a = input()
b = input()
if a * b % 2 == 0:
  print("Even")
else:
  print("Odd")
Problem p03031 (python)

Fixed submission:
import numpy as np
N,M= list(map(int, input().split()))
K = []
S=[]
state_S = np.zeros(N)
for m  in range(M):
    _input = list(map(int, input().split()))
    K.append(_input[0])
    S.append(np.array(_input[1:]))
P = list(map(int, input().split()))
ans=0
for i in range(2 ** N):
    pattern= np.array([i >> bit & 1 for bit in range(N)])
    if all(np.sum(pattern[S[j] -1 ]) % 2 == P[j] for j in range(M)):
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
N,M= list(map(int, input().split()))
K = []
S=[]
state_S = np.zeros(N)
for m  in range(M):
    _input = list(map(int, input().split()))
    K.append(_input[0])
    S.append(np.array(_input[1:]))
P = list(map(int, input().split()))
ans=0
for i in range(N ** 2):
    pattern= np.array([i >> bit & 1 for bit in range(N)])
    if all(sum(pattern[K[j] -1 ]) % 2 == P[j] for j in range(M)):
        ans += 1
print(ans)
Problem p03371 (python)

Fixed submission:
A,B,AB,X,Y= list(map(int, input().split()))
ans = (X * A) + (Y * B)
max_ab_cnt = max(X,Y)
for ab_cnt in range(max_ab_cnt+1):
    a_cnt = max(X - ab_cnt, 0)
    b_cnt = max(Y - ab_cnt,0)
    tmp = (a_cnt *A) + (ab_cnt * 2 * AB) + (b_cnt * B)
    ans = min(ans, tmp)
print(ans)

Buggy submission (verdict: Runtime Error):
A,B,AB,X,Y= int(input.split())
ans = (X * A) + (Y * B)
max_ab_cnt = max(X,Y)
for ab_cnt in (max_ab_cnt+1):
    a_cnt = max(X - ab_cnt, 0)
    b_cnt = max(Y - ab_cnt,0)
    tmp = (a_cnt *A) + (ab_cnt * 2 * AB) + (b_cnt * B)
    ans = min(ans, tmp)
print(ans)
Problem p02641 (python)

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

A = [0]*101

for i in P:
    A[i] = 1

if A[X] == 0:
    print(X)
    exit()

count = 1
while(1):
    if (X - count) >= 0:
        if (X - count) < 101:
            if A[X - count] == 0:
                print(X - count)
                exit()
        else:
            print(101)
            exit()

    if count > 0:
        count = -count
    else:
        count = -count
        count += 1

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

A = [0]*101
for i in P:
    A[i] = 1

if A[X] == 0:
    print(X)
    exit()

count = 1
while(1):
    if (X - count) <= 101 and (X - count) >= 0:
        if A[X - count] == 0:
            print(X - count)
            exit()

    if count > 0:
        count = -count
    else:
        count = -count
        count += 1

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

A = [0]*101
for i in P:
    A[i] = 1

if A[X] == 0:
    print(X)
    exit()

count = 1
while(1):
    if A[X - count] == 0:
        print(X - count)
        exit()

    if count > 0:
        count = -count
    else:
        count = -count
        count += 1
Problem p02658 (python)

Fixed submission:
N = int(input())

P = list(map(int, input().split()))

out_range = 10**18

ans=1
if  0 in P:
    print(0)
    exit()

for i in range(N):
    tmp = P[i]
    ans *= tmp
    if  ans > out_range:
        print(-1)
        exit()

print(ans)

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

P = int(input())

out_range = 10**18

for i in range(N-1):
    tmp = int(input())
    if  P > out_range or tmp > out_range:
        print(-1)
        exit()
    if tmp == 0:
        print(0)
        exit()
    P = tmp * P

print(P)

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

P = int(input())

out_range = 10**18

for i in range(N-1):
    tmp = int(input())
    if  P > out_range or tmp > out_range:
        print(-1)
    P = tmp * P

print(P)

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

P = int(input())

out_range = 10**18
for i in range(N-1):    
    tmp = int(input())
    if  P > out_range || tmp > out_range:
        print(-1)
    P = tmp * P

print(P)
Problem p02921 (python)

Fixed submission:
a = str(input())
b = str(input())
count = 0
for i in range(3):
	if a[i] == b[i]:
		count += 1
        
print(count)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
count = 0
if b==1:
  print(0)
else :
  while(b>=0):
    b-=a
    a-=1
    count+=1
  print(count)

Buggy submission (verdict: Runtime Error):
a = input()
b = input()
count = 0
for i in renge(3):
	if a[i] == b[i]:
    	count += 1
print(count)

Buggy submission (verdict: Runtime Error):
a = str(input())
b = str(input())
count = 0
for i in renge(3):
	if a[i] == b[i]:
    	count += 1
print(count)

Buggy submission (verdict: Runtime Error):
a = input()
b = input()
count = 0
for i in renge(3):
	if a[i] == b[i]:
    	count += 1
print(count)

Buggy submission (verdict: Runtime Error):
a = str(input())
b = str(input())
count = 0
for i in renge(3)
	if a[i] == b[i]:
    	count += 1
print(count)

Buggy submission (verdict: Runtime Error):
a = input()
b = input()
count = 0
for i in renge(3)
	if a[i] == b[i]:
    	count += 1
print(count)
Problem p02663 (python)

Fixed submission:
h1, m1, h2, m2, k = list(map(int, input().split(' ')))

awake_time = (h2 - h1) * 60 + (m2 - m1)
y = awake_time - k

print(y)

Buggy submission (verdict: Runtime Error):
h1, m1, h2, m2, k = int(input().split(' '))

awake_time = (h2 - h1) * 60 + (m2 - m1)
y = awake_time - k

print(y)
Problem p02641 (python)

Fixed submission:
x,n= list(map(int, input().split()))
p = list(map(int, input().split())) 
import numpy as np

if x not in p:
    print(x)
else:
    t = [i for i in range(-101,201)]
    for i in range(n):    
        t.remove(p[i])
#         print(t)

    res = 100
    s = 1000
    for i in range(len(t)):
#         print(t[i])
        if s >= abs (x - t[len(t)-1-i]):
            s = abs (x - t[len(t)-1-i])
            res = t[len(t)-1-i]
    print(res)

Buggy submission (verdict: Runtime Error):
x,n= list(map(int, input().split()))
p = list(map(int, input().split())) 
import numpy as np

def getNearestValue(list, num):
    # リスト要素と対象値の差分を計算し最小値のインデックスを取得
    idx = np.abs(np.asarray(list) - num).argmin()
    return list[idx]
if x not in p:
    print(x)
else:
    t = [i for i in range(1,101)]
    for i in range(n):    
        t.remove(p[i])
#     print(t)
    print(getNearestValue(t, x))

Buggy submission (verdict: Runtime Error):
x,n= list(map(int, input().split()))
p = list(map(int, input().split())) 
import numpy as np
def getNearestValue(list, num):
    # リスト要素と対象値の差分を計算し最小値のインデックスを取得
    idx = np.abs(np.asarray(list) - num).argmin()
    return list[idx]
if x not in p:
    print(x)
else:
    t = [i for i in range(100)]
    for i in range(n):    
        t.remove(p[i])
    print(getNearestValue(t, x))
Problem p02958 (python)

Fixed submission:
n = int(input())
p =  list(map(int, input().split()))

b = sorted(p)
cnt = 0
if p == b:
    print("YES")
else:
    for i in range(n):
        if p[i] != b[i]:
            cnt += 1
            if cnt == 3:
                print("NO")
                break    
    if cnt == 1:
        print("NO")
    if cnt == 2:
        print("YES")

Buggy submission (verdict: Runtime Error):
n = int(input())
p =  list(map(int, input().split()))¥

b = sorted(p)
cnt = 0
if p == b:
    print("YES")
else:
    for i in range(n):
        if p[i] != b[i]:
            cnt += 1
            if cnt == 3:
                print("NO")
                break    
    if cnt == 1:
        print("NO")
    if cnt == 2:
        print("YES")
Problem p02983 (python)

Fixed submission:
L, R = list(map(int, input().split(" ")))

if R - L >= 2019:
    print(0)
else:
    L = L % 2019
    R = R % 2019
    
    if L >R:
        print(0)
    else:
        mi = (L*(L+1)) %2019
        for i in range(L, R):
            for j in range(i+1, R+1):
                tmp = (i*j) % 2019
                if tmp < mi:
                    mi = tmp
                    
        print(mi)

Buggy submission (verdict: Runtime Error):
l,r = list(map(int, input().split())) l  %= 2019
r %= 2019
res=2019
if r-l >= 2019:
    print(0)
else:
    for i in range(r-l+1):
        if res > l*(l+1):
            print(l*(l+1))
            break
Problem p03059 (python)

Fixed submission:
x = input().split()
a, b,t = int(x[0]),int(x[1]),int(x[2])
t += 0.5
num = t//a
sum = int(num * b)
print(sum)

Buggy submission (verdict: Runtime Error):
x = input().split()¥a, b,t = int(x[0]),int(x[1]),int(x[2])
t += 0.5
num = t//a
sum = int(num * b)
print(num)
Problem p03469 (python)

Fixed submission:
x = input()
print("2018"+x[4:])

Buggy submission (verdict: Runtime Error):
x = input()
x[0],x[1],x[2],x[3] = "2","0","1","8"
print(x)
Problem p02641 (python)

Fixed submission:
x, n = map(int, input().split())
 
if n != 0:
    s = set(map(int, input().split()))
    origin_set = set(range(-1, 102))
    result_set = origin_set - s
    result_list = list(result_set)
    result_num = 1000
 
    for i in result_list:
      if abs(x-i) < result_num:
        min_num = i
        result_num = abs(x-i)
      elif abs(x-i) == result_num:
        if i < min_num:
          min_num = i
    print(min_num)
else:
  print(x)

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

if n != 0:
    s = set(map(int, input().split()))
    origin_set = set(range(1, 101))
    result_set = origin_set - s
    result_list = list(result_set)
    result_num = 1000

    for i in result_list:
      if abs(x-i) < result_num:
        min_num = i
        result_num = abs(x-i)
      elif abs(x-i) == result_num:
        if i < min_num:
          min_num = i
    print(min_num)
else:
  print(x)
Problem p02885 (python)

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

if a - 2*b >= 0:
  print(a - 2*b)
else:
  print(0)

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

if a - 2*b >= 0:
  print(a - 2*b)
else:
  print(0)
Problem p02971 (python)

Fixed submission:
n = int(input())
a = [int(input()) for i in range(n)]
m_num = max(a)
m_index = [i for i, x in enumerate(a) if x == m_num]

if len(m_index) > 1:
  for i in range(n):
    print(m_num)
else:
  if len(a) == 1:
    print(a[0])
  else:
    m2_num = sorted(a)[-2]
    for i in range(n):
      if (i in m_index):
        print(m2_num)
      else:
        print(m_num)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [int(input()) for i in range(n)]
m_num = max(a)
m_index = [i for i, x in enumerate(a) if x == m_num]
m2_num = sorted(set(a))[-2]

for i in range(n):
  if i in m_index:
    print(m2_num)
  else:
    print(m_num)
Problem p03547 (python)

Fixed submission:
x,y = input().split()

if x < y:
  print('<')
elif x > y:
  print('>')
else:
  print('=')

Buggy submission (verdict: Runtime Error):
x,y = map(input().split())

if x < y:
  print('<')
elif x > y:
  print('>')
else:
  print('=')

Buggy submission (verdict: Runtime Error):
x,y = map(int,input().split())

if x < y:
  print('<')
elif x > y:
  print('>')
else:
  print('=')
Problem p03597 (python)

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

print(int((n*n) - a))

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

print((n*n) - a)

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

print((n**n) - a)
Problem p04044 (python)

Fixed submission:
n, l = map(int, input().split())
s_list = [input() for _ in range(n)]

s_list = sorted(s_list)

print(*s_list, sep='')

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

s_list = sorted(s_list)

print('{}{}{}'.format(s_list[0], s_list[1], s_list[2]))
Problem p02696 (python)

Fixed submission:
#int(input())
#map(int,input().split())
#list(map(int,input().split()))
import math
a,b,n=map(int,input().split())
l=[]
if n>=b:
    x=b-1
else:
    x=n
print(math.floor((a*x)/b)-a*math.floor(x/b))

Buggy submission (verdict: Runtime Error):
#int(input())
#map(int,input().split())
#list(map(int,input().split()))

a,b,n=map(int,input().split())
l=[]
if n>=b:
    x=b-1
else:
    x=n
print(math.floor((a*x)/b)-a*math.floor(x/b))
Problem p02761 (python)

Fixed submission:
import numpy as np
N,M=map(int,input().split())
A=np.zeros(N)
ans=0
for i in range(M):
  s,t=map(int,input().split())
  if s==1 and t==0 and N!=1:
    ans=1
  elif t==0:
    A[s-1]=99
  else:
    if A[s-1]==0:
      A[s-1]=t
    elif A[s-1]==t:
      A[s-1]=t
    else:
      ans=1
if N!=1:      
  if A[0]==0:
    A[0]=1

if ans==1:
  print(-1)
else:
  for i in range(N):
    if A[i]==99:
      A[i]=0
    ans+=A[i]*(10**(N-i-1))
  print(int(ans))

Buggy submission (verdict: Runtime Error):
import numpy as np
N,M=map(int,input().split())
A=np.zeros(N)
ans=0
for i in range(M):
  s,t=map(int,input().split())
  if s==1 and t==0:
    ans=1
  elif t==0:
    A[s-1]="o"
  else:
    if A[s-1]==0:
      A[s-1]=t
    elif A[s-1]==t:
      A[s-1]=t
    else:
      ans=1
if N!=1:      
  if A[0]==0:
    A[0]=1

if ans==1:
  print(-1)
else:
  for i in range(N):
    if A[i]=="o":
      A[i]=0
    ans+=A[i]*(10**(2-i))
  print(int(ans))
Problem p02780 (python)

Fixed submission:
def main():
    """"ここに今までのコード"""
import sys
input = sys.stdin.readline

N,K=map(int,input().split())
p=list(map(int,input().split()))
t=0
k=sum(p[0:K])

if N==K:
  print((k+K)/2)
else:
  for i in range(N-K):
    k-=p[i]
    k+=p[i+K]
    if k>t:
      t=k
    
  print((K+t)/2)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

N,K=map(int,input().split())
p=list(map(int,input().split()))
t=0
k=sum(p[0:K])
s=[]

for i in range(N-K):
  k-=p[i]
  k+=p[i+K]
  s.append(k)
    
print((K+max(s))/2)
Problem p02797 (python)

Fixed submission:
N,K,S=map(int,input().split())
a=[]

for i in range(K):
  a.append(S)

if N>len(a):
  for i in range(N-len(a)):
    if S==10**9:
      a.append(S-1)
    else:
      a.append(S+1)
      
print(' '.join(map(str, a)))

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

for i in range(K):
  a.append(S)

if N>len(a):
  for i in range(N-len(S))
  a.append(S+1)
      
print(' '.join(map(str, a)))
Problem p03502 (python)

Fixed submission:
N=int(input())
def kakuwa(N):
  summ=0
  i=0
  while N>10**i:
    i+=1
  for k in range(i+1)[::-1]:
    summ+=N//(10**k)
    N-=(10**k)*(N//(10**k))
  return(summ)

if N%kakuwa(N)==0:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
N=int(input())
i=0
summ=0

def kakuwa(N):
  while N>10**i:
    i+=1
  for k in range(i+1)[::-1]:
    summ+=N//(10**k)
    N-=(10**k)*(N//(10**k))
  return(summ)

if N%kakuwa(N)==0:
  print("Yes")
else:
  print("No")
Problem p04043 (python)

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

if a.count(5)==2 and a.count(7)==1:
  print("YES")
else:
  print("NO")

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

if a.count(5)==2 and a.count(7)==1:
  print("Yes")
else:
  print("No")
Problem p02971 (python)

Fixed submission:
N = int(input())
A = [int(input()) for i in range(N) ]
left = []
right = []
left_max = 0
right_max = 0
for i in range(N):
    if i == 0:
        left.append(0)
    else:
        left.append(max(left_max, A[i-1]))
    
    if (A[i-1] > left_max) and i != 0:
        left_max = A[i-1]
        
for i in range(N-1, -1, -1):
    if i == N-1:
        right.append(0)
    else:
        right.append(max(right_max, A[i+1]))
    
    if i != N-1:
        if A[i+1] > right_max:
            right_max = A[i+1]
right.reverse()

for i in range(N):
    print(max(left[i],right[i]))

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

for i in range(N):
    tmp = A.copy()
    tmp.pop(i)
    print(max(tmp))
Problem p02994 (python)

Fixed submission:
import numpy as np

def main():

    N,L = (int(i) for i in input().split())
    L_list = [int(L+i) for i in range(N)]

    if L_list[0] < 0:
        if L_list[0]+N-1 >= 0 :
            print(sum(L_list[:]))
        else:
            print(sum(L_list[:-1]))
    else:
        print(sum(L_list[1:]))


if __name__ == '__main__':
    main()

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

def main():

    N,L = (int(i) for i in input().split())
    L_list = [int(L+i) for i in range(N)]

    Tmp = L_list[0]


    if L_list[0] < 0:
        if L_list[0]+N-1 >= 0 :
            print(sum(L_list[:]))
        else:
            print(sum(L_list[:-1]))
    else:
        print(sum(L_list[1:]))


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

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

if X < A:
    print("0")
else:
    print("10")

Buggy submission (verdict: Runtime Error):
N,K = map(int, input().split())
A_list = [int(i) for i in input().split()]


sum_tmp = 0
Answer = 0

if N==1 : Answer = 0

else :
    for i in range(N):
        sum_tmp = A_list[i]
        for j in range(i+1,N):
            sum_tmp += A_list[j]
            #print(sum_tmp)
            if sum_tmp < K:
                continue
            else:
                Answer += N - j
                #print('answer += {0:5d}'.format(N-j))
                break

print(Answer)