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

Fixed submission:
N = int(input())
h = list(map(int,input().split()))
sum = []
sum.append(0)
for i in range(1,N):
    if i>1:
        sum.append(min(sum[i-1]+abs(h[i-1]-h[i]),sum[i-2]+abs(h[i-2]-h[i])))
    else:
        sum.append(sum[i-1]+abs(h[i-1]-h[i]))
print(sum[N-1])

Buggy submission (verdict: Runtime Error):
def dp(n,cost):
    global N,h
    if n==N-1:
        return cost
    if n==N-2:
        return dp(n+1,cost+abs(h[n]-h[n+1]))
    else:
        take1 = dp(n+1,cost+abs(h[n]-h[n+1]))
        take2 = dp(n+2,cost+abs(h[n]-h[n+2]))
        return min(take1, take2)
N = int(input())
h = list(map(int,input().split()))
print(dp(0,0))
Problem p03450 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**8)
def f(v,p,G,T):
    global ans
    INF = 10**10
    for C in G[v]:
        c,d = C[0],C[1]
        if T[c]==INF:
            T[c] = T[v]+d
            f(c,v,G,T)
        elif T[c]!=T[v]+d:
            ans = "No"
def main():
    global ans
    N,M = map(int,input().split())
    G = [[] for i in range(N+1)]
    for i in range(M):
        L,R,D = map(int,input().split())
        G[L].append([R,D])
        G[R].append([L,-D])
    INF = 10**10
    T = [INF]*(N+1)
    while T.count(INF)!=0:
        for i in range(N+1):
            if T[i] == INF:
                T[i]=0
                f(i,-1,G,T)
        if ans=="No":break
ans = "Yes"
main()
print(ans)

Buggy submission (verdict: Runtime Error):
def f(v,p,G,T):
    global ans
    INF = 10**10
    for C in G[v]:
        c,d = C[0],C[1]
        if T[c]==INF:
            T[c] = T[v]+d
            f(c,v,G,T)
        elif T[c]!=T[v]+d:
            ans = "No"
def main():
    global ans
    N,M = map(int,input().split())
    G = [[] for i in range(N+1)]
    for i in range(M):
        L,R,D = map(int,input().split())
        G[L].append([R,D])
        G[R].append([L,-D])
    INF = 10**10
    T = [INF]*(N+1)
    while T.count(INF)!=0:
        for i in range(N+1):
            if T[i] == INF:
                T[i]=0
                f(i,-1,G,T)
        if ans=="No":break
ans = "Yes"
main()
print(ans)
Problem p03555 (python)

Fixed submission:
c1 = list(input())
c2 = list(input())
for i in range(3):
    if c1[i]!=c2[2-i]:
        print("NO")
        exit()
print("YES")

Buggy submission (verdict: Runtime Error):
c1 = list(input())
c2 = list(input())
for i in range(3):
    if c1[i]!=c[2-i]:
        print("NO")
        exit()
print("YES")
Problem p03781 (python)

Fixed submission:
X = int(input())
sum_time = 0
for i in range(X):
    sum_time+=(i+1)
    if sum_time>=X:
        print(i+1)
        break

Buggy submission (verdict: Runtime Error):
X = int(input())
def dfs(t, x):
    global X
    if t>X:
        return X
    if x==X:
        return t-1
    return min(dfs(t+1,x+t),dfs(t+1,x))
print(dfs(0,0))
Problem p03861 (python)

Fixed submission:
a,b,x = map(int,input().split())
b = b//x
a = a//x-1 if a%x==0 else a//x
print(b-a)

Buggy submission (verdict: Runtime Error):
a,b,x = map(int,input().split)
if a>0:
  a-=1
else:
  b+=1
print(b//x - a//x)
Problem p03963 (python)

Fixed submission:
N,K = map(int,input().split())
S = K
while(1):
    if N==1:
        break
    S *= (K-1)
    N-=1
print(S)

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
print(K*((M-1)**(K-1)))
Problem p03966 (python)

Fixed submission:
N = int(input())
for i in range(N):
  a,t = map(int,input().split())
  if i == 0:
    x,y = a,t
  else:
    xa = x//a if x%a==0 else x//a+1
    yt = y//t if y%t==0 else y//t+1
    c = max(xa,yt)
    x,y = a*c,t*c
print(x+y)

Buggy submission (verdict: Runtime Error):
import math
N = int(input())
for i in range(N):
  a,t = map(int,input().split())
  if i == 0:
    x,y = a,t
  else:
    xa = math.ceil(x/a)
    yb = math.ceil(y/b)
    c = max(xa,yb)
    x,y = a*c,b*c
print(x+b)

Buggy submission (verdict: Runtime Error):
import math
N = int(input())
for i range(N):
  a,t = map(int,input().split())
  if i == 0:
    x,y = a,t
  else:
    xa = math.ceil(x/a)
    yb = math.ceil(y/b)
    c = max(xa,yb)
    x,y = a*c,b*c
print(x+y)

Buggy submission (verdict: Runtime Error):
import math
N = int(input())
for i range(N):
  a,t = map(int,input().split())
  if i == 0:
    x,y = a,t
  else:
    xa = math.ceil(x/a)
    yb = math.ceil(y/b)
    c = max(xa,yb)
    x,y = a*c,b*c
print(x+b)
Problem p02783 (python)

Fixed submission:
H,A = map(int,input().split())
print(H//A if H%A == 0 else H//A+1)

Buggy submission (verdict: Runtime Error):
H,A = map(int(),input().split)
print(H//A if H%A == 0 else H//A+1)
Problem p03068 (python)

Fixed submission:
input()
S=input()
k=int(input())
for s in S:print(s if s==S[k-1] else "*",end="")

Buggy submission (verdict: Runtime Error):
input()
S = input()
K = int(input())
for s in S:(s if s == S[k-1] else *, end="")
Problem p03145 (python)

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

Buggy submission (verdict: Runtime Error):
a,b,c = map(int, input.split())
print(a*b//2)
Problem p03206 (python)

Fixed submission:
D=input()
D=int(D)

if D==25:
    print("Christmas")

if D==24:
    print("Christmas Eve")

if D==23:
    print("Christmas Eve Eve")

if D==22:
    print("Christmas Eve Eve Eve")

Buggy submission (verdict: Runtime Error):
D=input()
D=int(d)

if D==25:
    print("Christmas")

if D==24:
    print("Christmas Eve")

if D==23:
    print("Christmas Eve Eve")

if D==22:
    print("Christmas Eve Eve Eve")
Problem p03210 (python)

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

if a==7 or a==5 or a==3:
    print('YES')

else:
    print('NO')

Buggy submission (verdict: Runtime Error):
a=imput()
a=int(a)

if a==7 or a==5 or a==3:
    print('YES')

else:
    print('NO')
Problem p03369 (python)

Fixed submission:
S=input()
print(S.count("o")*100+700)

Buggy submission (verdict: Runtime Error):
S=input()
print(S.count(o)*100+700)

Buggy submission (verdict: Runtime Error):
S=input(y)
y=700+100*o
print(y.count(o)*100+700)

Buggy submission (verdict: Runtime Error):
S=int(input())
y=700+100*o
print(y.count(o)*100+700)

Buggy submission (verdict: Runtime Error):
S=int(input(y))
y=700+100*o
print(y.count(o)*100+700)
Problem p03433 (python)

Fixed submission:
N=int(input())
A=int(input())
if N%500<=A:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
N=int(input()),A=int(input())
print("Yes" if N%500<=A else "No")

Buggy submission (verdict: Runtime Error):
N,A=map(int,input().split())
if N%500<=A:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
N,A=map(int,input().split())
print("Yes" if N%500<=A else "No")
Problem p03455 (python)

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

if (a*b)%2==0:
    print("Even")

else:
    print("Odd")

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

if (a*b)%2==0:
    print("Even")

else:
    print("Odd")

Buggy submission (verdict: Runtime Error):
a,b=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=int(input()), b=int(input())

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")

if else:
    print("Odd")

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

c=a*b

c=int(c)

if c%2==0:
    print("Even")

if else:
    print("Odd")

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

c=a*b

if c%2==0:
    print("Even")

if else:
    print("Odd")
Problem p03469 (python)

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

Buggy submission (verdict: Runtime Error):
S=input()
print(S[4]"8")
Problem p03486 (python)

Fixed submission:
s=list(input())
t=list(input())

u=sorted(s)
v=sorted(t,reverse=True)

print("Yes" if u<v else "No")

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

u=sorted([s])
v=sorted([t],reversed=True)

print("Yes" if u<v else "No")
Problem p03493 (python)

Fixed submission:
s=input()
print(s.count("1"))

Buggy submission (verdict: Runtime Error):
s=input()
print(s.count("1")

Buggy submission (verdict: Runtime Error):
s=int(input())
print(s.count("1")
Problem p03693 (python)

Fixed submission:
r, g, b = map(int, input().split())
if (g * 10 + b) % 4 == 0:
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
r,g,b=map(int,input().split())
print('YES' if (10*g+b)%4=0 else 'NO')

Buggy submission (verdict: Runtime Error):
r,g,b=map(int,input().split())
print('YES' if (10*g+b)%4==0 else 'NO'

Buggy submission (verdict: Runtime Error):
r,g,b=map(int,input().split())
print('YES' if (10*g+b)%4=0 else 'NO'

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

if (r*100 +g*10 +b)%4==0:
    print("Yes")

else:
    prinnt('No')

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

if (r*100+g*10+b)%4==0:
    print("Yes")

else:
    prinnt('No')
Problem p02830 (python)

Fixed submission:
N = int(input())
S,T=input().split()
lists=[]
for i in range(N):
    lists+=S[i]
    lists+=T[i]
print(*lists,sep="")

Buggy submission (verdict: Runtime Error):
N = int(input())
S,T=input().split()
lists=[]
for i in range(N):
    lists+=S[i]
    lists+=T[i]
print(*lists.split())
Problem p04044 (python)

Fixed submission:
n,l=map(int,input().split())
s=sorted([input() for i in range(n)])
print(*s,sep="")

Buggy submission (verdict: Runtime Error):
N,L=map(int,input().split())
S=[input() for i in range(N)] 
S.sorted()
for i in range(len(S)):
    print(S[i])

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
s=sorted([input() for i in range(n)])
print(*s,sep="")

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
s=sorted([input() for i in range(N)])
print(*s,sep="")

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
s=sorted([input() for i in range(n)])
print(*s,sep="")

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
s=sorted([input() for i in range(n)])
print(*s,sep="")

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
s=[]
for i in range(n):
    s.append(input())
s.sort()
print("".join(s))

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
c=input()
s=[]
for i in range(N):
    s.append(input())
s.sort()
print(*s,sep="")

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
c=input()
s=[]
for i in range(N):
    s.append(input())
s.sort()
print("".join(s))
Problem p02576 (python)

Fixed submission:
N, X, T = map(int, input().split())
min_time = 0
while N > 0:
    min_time += T
    N -= X
print(min_time)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
A.reverse()
ans = 0
max_step = 0
for i in range(N):
    max_step = max(A[i:]) - A[i]
    ans += max_step
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
A.reverse()
ans = 0
max_step = 0
for i in range(N):
    max_step = max(A[i:]) - A[i]
    ans += max_step
print(ans)
Problem p02582 (python)

Fixed submission:
S = input()
cnt = 0
ans = 0
for s in S:
    if s == 'R':
        cnt += 1
    else:
        cnt = 0
    ans = max(ans, cnt)
print(ans)

Buggy submission (verdict: Runtime Error):
X, K, D = map(int, input().split())
X = abs(X)
r = X % D
t = X // D
if t >= K:
    ans = abs(X - K * D)
elif (K - t) % 2 == 0:
    ans = r
else:
    ans = D - r
print(ans)

Buggy submission (verdict: Runtime Error):
X, K, D = map(int, input().split())
X = abs(X)
point = X % D
q = X // D
ans = 0
if q >= K:
    ans = abs(X-D*K)
elif (K - q) % 2 == 0:
    ans = point
else:
    ans = D-point
print(ans)
Problem p02606 (python)

Fixed submission:
list = list(map(int,input().split()))
large = list[1] // list[2]
small = list[0] // list[2]
amari = list[0] % list[2]
if amari == 0:
  print(large - small + 1)
  
else:
  print(large - small)

Buggy submission (verdict: Runtime Error):
list = list(map(int,inout().split()))
large = list[1] // list[2]
small = list[0] // list[2]
amari = list[0] % list[2]
if amari == 0:
  print(large - small + 1)
  
else:
  print(large - small)
Problem p02614 (python)

Fixed submission:
import itertools
import numpy as np

H, W, K = map(int, input().split())

temp = []
for _ in range(H):
    C = list(input())
    A = [c.replace('.', '0') for c in C]
    A = [a.replace('#', '1') for a in A]
    A = list(map(lambda x: int(x), A))
    temp.append(A)

C = np.array(temp)

count = 0
l = [0, 1]
wide = itertools.product(l, repeat=W)
for w in wide:
    hight = itertools.product(l, repeat=H)
    for h in hight:
        copy_C = C.copy()
        for num, i in enumerate(w):
            if i == 1:
                copy_C[:, num-1] = 0
            for num2, j in enumerate(h):
                if j == 1:
                    copy_C[num2-1, :] = 0
        if copy_C.sum() == K:
            count += 1

print(count)

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

H, W, K = map(int, input().split())

temp = []
for _ in range(H):
  C = list(input())
  A = [c.replace('.', '0') for c in C]
  A = [a.replace('#', '1') for a in A]
  A = list(map(lambda x: int(x), A))
  temp.append(A)
  
C = np.array(temp)

count = 0
l = [0, 1]
wide = itertools.product(1, repeat=W)
for w in wide:
  height = itertools.product(1, repeat=H)
  for h in height:
    copy_C = C.copy()
    for num, i in enumerate(w):
      if i == 1:
        copy_C[:, num - 1] = 0
      for num2, j in enumerate(h):
        if j == 1:
          copy_C[num2 - 1, :] = 0
      if copy_C.sum() == K:
        count = count + 1
print(count)
Problem p02918 (python)

Fixed submission:
import re

n, k = map(int, input().split())
str = input()

pattern = re.compile("RL")
X = len(pattern.findall(str))
result = n - X * 2

if str[0] == 'L' and str[-1] == 'R':
    result -= 2
    Y = 1
elif str[0] == 'L' or str[-1] == 'R':
    result -= 1
    Y = 0
else:
    Y = -1
    
if k <= X:
    result += 2 * k
else:
    result += 2 * X + Y

print(result)

Buggy submission (verdict: Runtime Error):
import re

n, k = map(int, input().split())
str = input()

pattern = re.compile("RL")
X = len(pattern.findall(str))
result = n - X * 2

if str[0] == 'L' and str[-1] == 'R':
    result -= 2
    Y = 1
elif str[0] == 'L' or str[-1] == 'R':
    result -= 1
    Y = 0

if X + Y <= k:
    result += 2 * X + Y
else:
    if X >= k:
        result += 2 * k
    else:
        result += 2 * X + (k-X)

print(result)
Problem p02921 (python)

Fixed submission:
a = input()
b = input()
ct = 0
for i, j in zip(a, b):
    if i == j:
        ct += 1

print(ct)

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
ct = 1
k = 0
while True:
    if ct >= b:
        break
    k += 1
    ct += a - 1
print(k)
Problem p02985 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readlines

from collections import deque

def main():

    lines = input()
    n, k = list(map(int, lines[0].split()))
    a = [[] for i in range(n+1)]

    for i in range(1, n):
        r, l = list(map(int, lines[i].split()))
        a[r].append(l)
        a[l].append(r)

    que = deque()
    que.append(1)
    colors = [-1] * (n+1)
    colors[1] = k
    ways = k

    while que:
        p = que.popleft()
        # root no toki
        if p == 1:
            now_color = k
            for son in a[p]:
                now_color -= 1
                ways = (ways * now_color) % 1_000_000_007
                colors[son] = now_color
                que.append(son)
        else:
            now_color = k-1
            for son in a[p]:
                if colors[son] < 0:
                    now_color -= 1
                    colors[son] = now_color
                    ways = (ways * now_color) % 1_000_000_007
                    que.append(son)

    print(ways)

main()

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readlines

from collections import deque

def main():

    lines = input()
    n, k = list(map(int, lines[0].split()))
    a = [[] for i in range(n+1)]

    for i in range(1, n):
        r, l = list(map(int, lines[i].split()))
        a[r].append(l)
        a[l].append(r)

    que = deque()
    que.append(1)
    colors = [-1] * (n+1)
    colors[1] = k
    ways = k

    def bfs(que, height):
        if que:
            nonlocal ways
            p = que.popleft()
            # root no toki
            if height == 0:
                now_color = k
                for son in a[p]:
                    now_color -= 1
                    ways = (ways * now_color) % 1_000_000_007
                    colors[son] = now_color
                    que.append(son)
            else:
                now_color = k-1
                for son in a[p]:
                    if colors[son] < 0:
                        now_color -= 1
                        colors[son] = now_color
                        ways = (ways * now_color) % 1_000_000_007
                        que.append(son)

        bfs(que, height+1)

    bfs(que, 0)

    print(ways)

main()
Problem p02576 (python)

Fixed submission:
N, X, T = input().strip().split()
N, X, T = [int(N), int(X), int(T)]

q=N // X
mod = N % X

if mod != 0:
 q = q + 1

time = T*q

print(time)

Buggy submission (verdict: Runtime Error):
N=int(input())
A=list(map(int, input().split()))
B=A
M=max(A)
k=0
Fumi=0

for k in range(1,N):
    if A[k-1]>A[k]:
        Fumi=Fumi+A[k-1]-A[k]
        A[k]=A[k-1]
    k=k+1

print(Fumi)
Problem p02681 (python)

Fixed submission:
name = list(input())
new_name = list(input())
new_name.pop()
 
if name == new_name:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
base_name = input()
new_name = input()

if new_name[:-1] = base_name:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
base_name = input()
new_name = input()

if new_name[:-1] = base_name:
  print('Yes')
else:
  print('No')
Problem p02687 (python)

Fixed submission:
S = input()
if S == "ABC":
  print("ARC")
else:
  print('ABC')

Buggy submission (verdict: Runtime Error):
s = input()
if s == 'ABC':
  print()'ARC'
else:
  print('ABC')
Problem p02576 (python)

Fixed submission:
# coding: utf-8
# Your code here!
import math
n=input().split()
a=int(n[0])/int(n[1])
b=math.floor(a)
if int(n[0])%int(n[1])!=0:
  b=b+1
print(b*int(n[2]))

Buggy submission (verdict: Runtime Error):
n=input().split()
a=int(n[0])/int(n[1])
if int(n[0])%int(n[1])!=0:
  a+1
print(a*int(n[2])
Problem p02576 (python)

Fixed submission:
n,x,t=map(int,input().split())
count=0
a=0
a=x
if(n<=x):
        print(t,end='\n')
        
elif(x==1):
        print((n)*t)
else:    
    while(x<n):
        count=count+1
        x=x+a    
    print((count+1)*t)

Buggy submission (verdict: Runtime Error):
n,x,t=map(int(input().split()))
count=0
if(n<=x):
  print(t,end='\n')
else:
  while(x>=n):
    count=count+1
    x=x+x
print((count+1)*t)
Problem p02576 (python)

Fixed submission:
a = list(map(int, input().split()))
if a[0]%a[1]==0:
  print((a[0]//a[1])*a[2])
else:
  print(a[2]*(a[0]//a[1])+a[2])

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

if a%b==0:
	print(c*(a/b))
else:
		print((c*((a//b)+1)))
Problem p02612 (python)

Fixed submission:
i= input()
pay=int(i)
if (pay%1000) == 0:
  print(0)
else: print(1000-(pay%1000))

Buggy submission (verdict: Runtime Error):
n=input()
n=int(n)
ac=0
wa=0
tle=0
re=0

for val in range(n):
  judge=input()
  if judge =='AC':
    ac=ac+1
  elif judge=='WA':
    wa=wa+1
  elif judge=='TLE':
    tle=tle+1
  elif judge=='RE':
    re=re+1
    
print('AC x',ac)
print('WA x',wa)
print('TLE x',tle)
print('RE x',re)
Problem p02576 (python)

Fixed submission:
n,x,t=map(int,input().split())

if n%x==0:
   a=int(n//x)
else:
   a=int(n//x+1)

b=int(a*t)

print(b)

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

if n%x=0:
   a=int(n//x)
else:
   a=int(n//x+1)

b=int(a*t)

print(b)

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

if n%x=0:
   a=int(n//x)
if n%x!=0:
   a=int(n//x+1)

b=int(a*t)

print(b)

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

if n%x=0:
   a=n//x
if n%x!=0:
   a=n//x+1

b=int(a*t)

print(b)

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

if n%x=0:
   a=n//x
else:
   a=n//x+1

b=int(a*t)

print(b)

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

if n%x=0:
   a=n//x
else:
   a=n//x+1

b=a*t

print(b)

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

if n%x=o:
   a=n//x
else:
   a=n//x+1

b=a*t

print(b)
Problem p03044 (python)

Fixed submission:
from collections import deque

N = int(input())
S = [[]for i in range(N)]
for i in range(N-1):
    u,v,w = map(int,input().split())
    S[u-1].append([v-1,w])
    S[v-1].append([u-1,w])
Node = [None]*N
Node[0] = True
queue = deque([0])
while queue != deque([]):
    p = queue.popleft()
    for u,w in S[p]:
        if Node[u] == None:
            queue.append(u)
            Node[u] = (Node[p])^(w%2==1)
for i in range(N):
    print([0,1][Node[i]])

Buggy submission (verdict: Runtime Error):
n=int(input())
tree=[[]for _ in range(n+1)]
for _ in range(n-1):
    u,v,w=map(int,input().split())
    tree[u].append([v,w])
    tree[v].append([u,w])
d=[-1]*(n+1)
d[1]=0
q=[1]
while q:
    now=q.pop()
    for n_i,n_l in tree[now]:
        if d[n_i]==-1:
            d[n_i]=d[now]+[n_l]
            q.append(n_i)
for l in d[1:]:
    print(l%2)
Problem p03164 (python)

Fixed submission:
import numpy as np 
N,W=map(int,input().split())
w,v=[],[]
for i in range(N):
    a,b=map(int,input().split())
    w+=[a]
    v+=[b]
DP=np.ones(N*1000+1,dtype=int)*(W+1)
DP[0]=0
for i in range(N):
    DP[v[i]:]=np.minimum(DP[:-v[i]]+w[i],DP[v[i]:])
ans=0
for k in range(N*1000+1):
    if DP[k]<=W:
        ans=k
print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np 
N,W==map(int,input().split())
w,v=[],[]
for i in range(N):
    a,b=map(int,input().split())
    w+=[a]
    v+=[b]
DP=np.ones(N*1000+1,dtype=int)*(W+1)
DP[0]=0
for i in range(N):
    DP[v[i]:]=np.minimum(DP[:-v[i]]+w[i],DP[v[i]:])
ans=0
for k in range(N*1000+1):
    if DP[k]<=W:
        ans=k
print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np 
N,W=map(int,input().split())
w,v=[],[]
for i in range(N):
    a,b=map(int,input().split())
    w+=[a]
    v+=[b]
DP=np.zeros(W+1,dtype=int)
for i in range(N):
    DP[w[i]:]=np.maximum(DP[:-w[i]]+v[i],DP[w[i]:])
print(max(DP))
Problem p03362 (python)

Fixed submission:
import math
def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True
s=[]
n=int(input())
for i in range(2,55555):
    if is_prime(i)==True:
        if i%5==1:
            s.append(i)
print(' '.join(map(str, s[:n])))

Buggy submission (verdict: Runtime Error):
def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True
s=[]
n=int(input())
for i in range(2,55555):
    if is_prime(i)==True:
        if i%5==1:
            s.append(i)
print(' '.join(map(str, s[:n])))