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

Fixed submission:
#106
n = int(input())
if(n<105):
    print(0)
elif(n<135):
    print(1)
elif(n<165):
    print(2)
elif(n<189):
    print(3)
elif(n<195):
    print(4)
else:
    print(5)

Buggy submission (verdict: Runtime Error):
#106
n = int(input())
if(n<105):
    print(0)
elif(n<135):
    print(1)
elif(n<165):
    print(2)
elif(n<189)
    print(3)
elif(n<195):
    print(4)
else:
    print(5)

Buggy submission (verdict: Runtime Error):
#106
n = int(input())
if(n<105):
    print(0)
elif(n<135):
    print(1)
elif(n<165):
    print(2)
elif(n<195)
    print(3)
else:
    print(4)
Problem p03289 (python)

Fixed submission:
#104
s = input()
if(s[0]=='A' and s[2:-1].count('C')==1):
    s1 = s.replace('A', "").replace("C","")
    if(s1==s1.lower()):
        print("AC")
    else:
        print("WA")
else:
    print("WA")

Buggy submission (verdict: Runtime Error):
s = input()
l = len(s)
if s[0] !="A":
    print("WA")
    break
else:
    s = s.replace(s[0],"a")
    index1 = s.find("C")
    index2 = s.find("C", 2)
    if index2 != -1 or (index1 < 2 or index1 > l-3):
        print("WA")
    else:
        s = s.replace("A","a")
        s_lower = s.lower()
        if s != s_lower:
            print("WA")
        else:
            print("AC")
Problem p03324 (python)

Fixed submission:
d,n = map(int, input().split())
if n<100:
    print(n*(100**d))
else:
    print((n+1)*(100**d))

Buggy submission (verdict: Runtime Error):
d,n = map(int, input().split())
print(n*(10**d)
Problem p03325 (python)

Fixed submission:
import math
n = input()
a = list(map(int, input().split()))
ans = 0
for i in a:
    ans = ans + (len(bin(i)) - bin(i).rfind("1") - 1)
print(round(ans))

Buggy submission (verdict: Runtime Error):
import math
n = input()
a = list(map(int, input().split()))
ans = float("inf")
for i in a:
    ans = ans + (len(bin(i)) - bin(i).rfind("1") - 1)
print(round(ans))

Buggy submission (verdict: Runtime Error):
import math
n = input()
a = list(map(int, input().split()))
ans = float("inf")
for i in a:
    ans = max(ans, len(bin(i)) - bin(i).rfind("1") - 1)
print(round(ans))
Problem p03370 (python)

Fixed submission:
import math
N, X = map(int, input().split())
a = []
for i in range(N):
    a.append(int(input()))
    
kosuu = len(a)
X = X - sum(a)

kosuu = kosuu + math.floor(X/min(a))

print(kosuu)

Buggy submission (verdict: Runtime Error):
import math
N, X = map(int, input().split())
a = []
for i in range(N):
    a.append(input())
    
kosuu = len(a)
X = X - sum(a)

kosuu = kosuu + math.floor(X/min(a))

print(kosuu)
Problem p03378 (python)

Fixed submission:
N, M, X = map(int, input().split())
A = list(map(int, input().split()))
count = 0

for i in range(X+1):
    count += A.count(i)

ans = min(count, len(A)-count)
print(ans)

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

for i in range(X+1)
    count += A.count(i)

ans = min(count, len(A)-count)
print(ans)
Problem p03400 (python)

Fixed submission:
N = int(input())
D, X = map(int, input().split())
a = []
for i in range(N):
    a.append(int(input()))
sum = 0
for i in range(N):
    sum += int((D-1) / a[i] + 1)
print(sum+X)

Buggy submission (verdict: Runtime Error):
N = int(input())
D, X = map(int, input().split())
a = []
for i in range(N):
    a.append(input())
sum = 0
for i in range(N):
    sum += int((D-1) / a[i] + 1)
print(sum+X)
Problem p03408 (python)

Fixed submission:
N = int(input())
s = []
for i in range(N):
    s.append(input())

M = int(input())
t = []
for i in range(M):
    t.append(input())

sum = 0
for i in range(N):
    temp = 0
    sample = s[i]
    for j in range(N):
        if sample == s[j]:
            temp += 1
    for k in range(M):
        if sample == t[k]:
            temp -= 1
    if temp > sum:
        sum = temp
print(sum)

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

M = int(input())
t = []
for i in range(N):
    t.append(input())

sum = 0
for i in range(N):
    temp = 0
    sample = s[i]
    for j in range(N):
        if sample == s[j]:
            temp += 1
    for k in range(M):
        if sample == t[k]:
            temp -= 1
    if temp > sum:
        sum = temp
print(sum)
Problem p03415 (python)

Fixed submission:
#ABC90
a = [input() for i in range(3)]
print(a[0][0]+a[1][1]+a[2][2])

Buggy submission (verdict: Runtime Error):
a = []
for i in range(3)
    a.append(map(int, raw_input().split()))
print(a[0][0], a[1][1], a[2][2])
Problem p03605 (python)

Fixed submission:
#ABC73
n = input()
if(n[0]=="9" or n[1]=="9"):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
#ABC73
n = input()
if(n[0]=="9" or n[1]=="9"):
    print(Yes)
else:
    print(No)
Problem p02921 (python)

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

Buggy submission (verdict: Runtime Error):
    S=input()
    T=input()
    a=0
    for i in range(3):
        if S[i]==T[i]:
            a+=1
    print(a)
Problem p02885 (python)

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

Buggy submission (verdict: Runtime Error):
    a,b = map(int, input().split())
    print( max(0, a-b*2) )

Buggy submission (verdict: Runtime Error):
a,b = (int, input().split())
print( max(0, a-b*2) )
Problem p02969 (python)

Fixed submission:
r = int(input())
print(3*r*r)

Buggy submission (verdict: Runtime Error):

n = int(input())
a = []
for i in range(n):
  a.append(int(input()))

import bisect

color = []
color.append(a.pop(0))
color_count =0 
for i, ai in enumerate(a): 
    index = bisect.bisect_left(color, ai)
    if index > 0:
        color[index -1] = ai
    else:
        color.insert(0, ai)
print(len(color))
Problem p02971 (python)

Fixed submission:
n = int(input())
a = []
for i in range(n):
  a.append(int(input()))
amax = max(a)
amax_id = int(a.index(amax))
a.pop(amax_id)
amax2 = max(a)
for i in range(n):
  if i == amax_id:
    print(amax2)
  else:
    print(amax)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = []
for i in range(n):
  a.append(int(input()))
amax = max(a)
amax_id = a.index(amax)
amax2 = max(a.pop(amax_id))
for i in range(n):
  if i == amax_id:
    print(amax2)
  else:
    print(amax)
Problem p02973 (python)

Fixed submission:
n = int(input())
a = []
for i in range(n):
  a.append(int(input()))
from collections import deque
import bisect

color = deque([a.pop(0)])
color_count =0 
for ai in a: 
    index = bisect.bisect_left(color, ai)
    if index > 0:
        color[index -1] = ai
    else:
        color.appendleft(ai)
print(len(color))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = []
for i in range(n):
  a.append(int(input()))

from collections import deque
import bisect
color = deque([a.pop(0)])
color_count =0 
for i, ai in enumerate(a): 
    index = bisect.bisect_left(color, ai)
    print(index-1, ai, color)
    if index > 0:
        color[index -1] = ai
    else:
        color.appendleft(ai)
print(len(color))

Buggy submission (verdict: Runtime Error):

n = int(input())
a = []
for i in range(n):
  a.append(int(input()))

import bisect

color = []
color.append(a.pop(0))
color_count =0 
for i, ai in enumerate(a): 
    index = bisect.bisect_left(color, ai)
    print(index-1, ai, color)
    if index > 0:
        color[index -1] = ai
    else:
        color.insert(0, ai)
print(len(color), color)
Problem p02975 (python)

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

for i in range(n):
  aa = aa ^ a[i]

if aa == 0:
  print("Yes")
else:
  print("No")

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

for i in range(N):
    aa = aa ^ a[i]
    
if aa == 0:
  print("Yes")
else:
  print("No")
Problem p02996 (python)

Fixed submission:
import numpy as np
    
N  = int(input())
    
AB = []
time = 0
    
for _ in range(N):
    AB.append(list(map(int, input().split())))
    
AB = np.array(AB)
    
sorted_AB = AB[AB[:,1].argsort(), :]
    
for i in range(N):
    time += sorted_AB[i,0]
    
    if time > sorted_AB[i,1]:
        print('No')
        exit()
    
print('Yes')

Buggy submission (verdict: Runtime Error):
def addTimesheet(ts, a, b):
    for i in range(0, len(ts)):
        if(not ts[i] is 1):
            ts[i] = 1
            a -= 1
        if(a is 0):
            break
    if(not a is 0):
      return ts, False
    return ts, True

n = int(input())
a = []
b = []
for i in range(0, n):
    str = input().split(" ")
    a.append(int(str[0]))
    b.append(int(str[1]))

timesheet = [0]*max(b)
flag = True
for ia, ib in zip(a, b):
    timesheet, flag = addTimesheet(timesheet, ia, ib)
    if(flag is False):
    	break
if(flag is True):
	print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
def addTimesheet(ts, a, b):
    for i in range(0, len(ts)):
        if(not ts[i] is 1):
            ts[i] = 1
            a -= 1
        if(a is 0):
            break
    if(not a is 0):
      return ts, False
    return ts, True

n = int(input())
a = []
b = []
for i in range(0, n):
    str = input().split(" ")
    a.append(int(str[0]))
    b.append(int(str[1]))

timesheet = [0]*max(b)

for ia, ib in zip(a, b):
    timesheet, flag = addTimesheet(timesheet, ia, ib)
    if(flag is False):
    	break
if(flag is True):
	print("Yes")
else:
    print("No")
Problem p02973 (python)

Fixed submission:
import sys
input = sys.stdin.readline
from bisect import bisect_right

N = int(input())
l = [-int(input())]

for i in range(N-1):
  ai = -int(input())
# 各色の最大値がlの要素になるようにリストを拡大させていく
  if l[-1] <= ai:
    l.append(ai)
  else:
    b = bisect_right(l, ai)
    l[b] = ai
    
print(len(l))

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

N = int(input())
l = [int(input())]

for i in range(N-1):
  ai = int(input())
  flag = False
  for m in l:
    if max(m) < ai:
      m.append(ai)
      flag = True
      break
  if flag == False:
    l.append([ai])
    
print(len(l))
Problem p03103 (python)

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

store = []

for i in range(n):
  price,stock = map(int,input().split())
  store.append([price,stock])

store.sort()

total_cost = 0
for i in range(n):
  if m > 0:
    buy = min([m,store[i][1]])
    total_cost += buy * store[i][0]
    m -= buy
  else:
    break

print(total_cost)

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

store = []

for i in range(n):
  price,stock = map(int,input().split())
  store.append([price,stock])

store.sort()

total_cost = 0
for i in range(n):
  if m > 0:
    buy = min([m,store[1][i]])
    total_cost += buy * store[0][i]
    m -= buy
  else:
    break

print(total_cost)
Problem p02981 (python)

Fixed submission:
N, A, B = map(int, input().split())
print(min(N*A, B))

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

if R - L >= 2050:
    print(0)
else:
    ans = 20000000
    for i in range(L, R):
        for j in range(i+1, R+1):
            ans = min(ans, (i * j) % 2019)
    print(ans)
Problem p02995 (python)

Fixed submission:
def gcd(a, b): # a < b
    while True:
        c = b%a
        if c == 0:
            break
        b = a
        a = c

    return a


A, B, C, D = map(int, input().split())

start = A // C
end = B // C
if A % C != 0:
    start = start + 1
C_num = end - start + 1

start = A // D
end = B // D
if A % D != 0:
    start = start + 1
D_num = end - start + 1

CD = C * D // gcd(C, D)
start = A // CD
end = B // CD
if A % CD != 0:
    start = start + 1
CD_num = end - start + 1

ans = (B - A + 1) - (C_num + D_num - CD_num)

print(ans)

Buggy submission (verdict: Runtime Error):
import math

A, B, C, D = map(int, input().split())

start = A // C
end = B // C
if A % C != 0:
    start = start + 1
C_num = end - start + 1

start = A // D
end = B // D
if A % D != 0:
    start = start + 1
D_num = end - start + 1

CD = C * D // math.gcd(C, D)
start = A // CD
end = B // CD
if A % CD != 0:
    start = start + 1
CD_num = end - start + 1

ans = (B - A + 1) - (C_num + D_num - CD_num)

print(ans)
Problem p03069 (python)

Fixed submission:
def get_cost_change_black(S):
    return S.count(".")

N = int(input())
S = str(input())

indexs = [i for i, x in enumerate(S) if x == "#"]
if len(indexs) == 0:
    print(0)
else:
    answer = 10000000000
    change_white = 0
    change_black = get_cost_change_black(S[indexs[0]:])
    for i, ind in enumerate(indexs):
        x = change_white + change_black
        if x < answer:
            answer = x
        change_white = change_white + 1
        if i == len(indexs) - 1:
            if change_white < answer:
                answer = change_white
            break
        change_black = change_black - (indexs[i+1] - indexs[i] - 1)
    print(answer)

Buggy submission (verdict: Runtime Error):
def get_min_cost(S):
    if len(S) == 0:
        return 0
    if len(S) == 1:
        return 0
    return min(1 + get_min_cost(S[1:]), get_cost_change_black(S))

def get_cost_change_black(S):
    return S.count(".")

N = int(input())
S = str(input())

if '#' in S:
    answer = get_min_cost(S[S.index('#'):])
    print(answer)
else:
    print(0)
Problem p03085 (python)

Fixed submission:
map = {
    "A":"T",
    "T":"A",
    "C":"G",
    "G":"C"
}

a = str(input())
print(map[a])

Buggy submission (verdict: Runtime Error):
def get_answer(s):
    count = 0
    for i, c in enumerate(s):
        if i == len(s) - 1:
            return count
        if c == "A" and s[i + 1] == "C":
            count += 1

    return count

n, q = map(int, input().split())
s = str(input())
questions = []
for _ in range(q):
    a, b = map(int, input().split())
    questions.append((a - 1, b - 1))

for question in questions:
    print(get_answer(s[question[0]: question[1] + 1]))

Buggy submission (verdict: Runtime Error):
def get_answer(s):
    count = 0
    for i, c in enumerate(s):
        if i == len(s) - 1:
            return count
        if c == "A" and s[i + 1] == "C":
            count += 1

    return count

n, q = map(int, input().split())
s = str(input())
questions = []
for i in range(q):
    a, b = map(int, input().split())
    questions.append((a - 1, b - 1))

for question in questions:
    print(get_answer(s[question[0]: question[1] + 1]))
Problem p03086 (python)

Fixed submission:
def is_ACGT(c):
    if (c == "A") or (c == "C") or (c == "G") or (c == "T"):
        return True
    else:
        return False

def get_ACGT_length(s):
    if len(s) == 0:
        return 0

    if not is_ACGT(s[0]):
        return 0

    return 1 + (get_ACGT_length(s[1:]))


s = str(input())

result = 0
for i, c in enumerate(s):
    if is_ACGT(c):
        result = max(get_ACGT_length(s[i:]), result)

print(result)

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

#0文字の場合をチェック
if ("A" not in s) and ("C" not in s) and ("G" not in s) and ("T" not in s):
    print 0

max = 0
for i, c in enumerate(s):
    if is_ACGT(c):
        if i == (len(s) - 1):
            break
        max = get_ACGT_length(s[i+1:])

print(max)

def is_ACGT(c):
    if (c == "A") or (c == "C") or (c == "G") or (c == "T"):
        return True
    else:
        return False

def get_ACGT_length(s):
    if len(s) == 0:
        return 0

    if not is_ACGT(s[0]):
        return 0

    if len(s) == 1:
        return 1
    return 1 + get_ACGT_length(s[1:])
Problem p03126 (python)

Fixed submission:
N, M = map(int, input().split())
result = [0] * M

for i in range(N):
    s = list(map(int, input().split()))
    K = s[0]
    A = s[1:]
    for j in range(K):
        result[A[j]-1] = result[A[j]-1] + 1

print(result.count(N))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
result = [0] * N

for i in range(N):
    s = list(map(int, input().split()))
    K = s[0]
    A = s[1:]
    for j in range(K):
        result[A[j]-1] = result[A[j]-1] + 1

print(result.count(N))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
result = [0] * N

for i in range(N):
    K, A = list(map(int, input().split()))
    K = s[0]
    A = s[1:]
    for j in range(K):
        result[A[j]-1] = result[A[j]-1] + 1

print(result.count(N))
Problem p03206 (python)

Fixed submission:
D = int(input())

if D == 22:
    print("Christmas Eve Eve Eve")
elif D == 23:
    print("Christmas Eve Eve")
elif D == 24:
    print("Christmas Eve")
elif D == 25:
    print("Christmas")

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

if D == 22:
    print("Christmas Eve Eve Eve")
else if D == 23:
    print("Christmas Eve Eve")
else if D == 24:
    print("Christmas Eve")
else if D == 25:
    print("Christmas")
Problem p02921 (python)

Fixed submission:
s=list(input())
t=list(input())
count = 0
for i in range(len(s)):
  if s[i] == t[i]:
    count += 1
print(int(count))

Buggy submission (verdict: Runtime Error):
s=list(int(input()))
t=list(int(input()))
count = 0
for i in range(len(s)):
  if s[i] == t[i]:
    count += 1
print(int(count))
Problem p02946 (python)

Fixed submission:
k,x = map(int,input().split())	
li = [str(x-k+1+i) for i in range(2*k-1)]
l = ' '.join(li)
print(l)

Buggy submission (verdict: Runtime Error):
k = int(input())
x = int(input())
li = [str(x-k+1+i) for i in range(2*k-1)]
l = ' '.join(li)
print(l)

Buggy submission (verdict: Runtime Error):
k = int(input())
x = int(input())
li = [str(x-k+1+i) for i in range(2*k-1)]
l = ' '.join(li)
print(int(l))

Buggy submission (verdict: Runtime Error):
k = int(input())
x = int(input())
li = [str(x-k+1+i) for i in range(2*k-1)]
l = ' '.join(li)
print(l)

Buggy submission (verdict: Runtime Error):
k = int(input())
x = int(input())
li = [str(2*k-1+i) for i in range(2*k-1)]
l = ' '.join(li)
print(l)
Problem p02981 (python)

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

Buggy submission (verdict: Runtime Error):
n,a,b = map(int,input().split())	
if n*a=<b:
  print(int(n*a))
else:
  print(b)
Problem p02988 (python)

Fixed submission:
a=int(input())
li = list(map(int,input().split()))	
count = 0
for i in range(1,a-1):
  if li[i-1]<li[i] and li[i]<li[i+1]:
    count += 1
  elif li[i-1]>li[i] and li[i]>li[i+1]:
    count += 1
  else:
    pass
print(count)

Buggy submission (verdict: Runtime Error):
a=int(input())
li = list(map(int,input().split()))	
count = 0
for i in range(1:a):
  if li[i-1]<li[i] and li[i]<li[i+1]:
    count += 1
  else:
    pass
print(count)
Problem p03547 (python)

Fixed submission:
x, y = input().split()
a = {'A':10, 'B':11, 'C':12, 'D':13, 'E':14, 'F':15}
if a[x] < a[y]:
    print('<')
elif a[x] > a[y]:
    print('>')
else:
    print('=')

Buggy submission (verdict: Runtime Error):
x, y = input().split()
a = {'A':10, 'B':11, 'C':12, 'D':13, 'E':14, 'D':15}
if a[x] < a[y]:
    print('<')
elif a[x] > a[y]:
    print('>')
else:
    print('=')
Problem p03220 (python)

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

Hn = [abs(A - (T - i * 0.006)) for i in H]
print(Hn.index(min(Hn)) + 1)

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

Hn = [abs(A - (T - i * 0.006)) for i in H]
print(Hn.index(min(Hn)) + 1)
N = int(input())
Problem p03331 (python)

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

for i in str(N):
    a += int(i)
if a == 1:
    print(10)
else:
    print(a)

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

if N=10*i for i in range(1,5+1):
    print("10")
else
    print(sum(int(str(N)))
Problem p03373 (python)

Fixed submission:
A,B,C,X,Y = map(int,input().split())
a = 0

if A + B < C * 2:
    a += (A + B) * min(X, Y)
else:
    a += 2 * C * min(X, Y)

if X > Y:
    a += min(A, C * 2) * (X - Y)
else:
    a += min(B, C * 2) * (Y - X)
        
print(a)

Buggy submission (verdict: Runtime Error):
A,B,C,X,Y = map(int,input().split())
a = 0

if A+B < C*2:
    a += (A+B) * min(X,Y)
else
    a += C*2 * min(X,Y)
if X > Y:
    a += min(A,C*2)*(X-Y)
else:
    a += min(B,C*2)*(Y-X)
print(a)
Problem p03416 (python)

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

for i in range(A,B+1):
    if str(i) == str(i)[::-1]:
        C += 1
print(C)

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

for i in range(A,B+1):
    if i[1:2] = i[4:5]:
        a += 1
print("a")
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 = int(input())
b = int(input())

if a * b % 2 = 0:
	print('even')
else:
	print('odd')

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

c = a * b

if c % 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')

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

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

if (a + b) % 2 == 0:
    print((a + b) // 2)
else:
    print((a + b) // 2 + 1)

Buggy submission (verdict: Runtime Error):
a,b = map(open(0).read().split())

print(int(-(-(a + b) // 2)))
Problem p03502 (python)

Fixed submission:
N = int(input())

if N % sum(map(int,str(N))) == 0:
    print("Yes")
else:
    print("No")

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

if N % sum(str(N)) == 0:
    print("Yes")
else:
    print("No")
Problem p03610 (python)

Fixed submission:
s = input()

print(s[::2])

Buggy submission (verdict: Runtime Error):
print(input[::2])
Problem p03238 (python)

Fixed submission:
N = int(input())

if N == 1:
    print("Hello World")
else:
    A = int(input())
    B = int(input())
    print(A + B)

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

if N == 1:
  print('Hello World')
else:
  A = int(imput())
  B = int(imput())
  print(A + B)

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

if N == 1:
  print('Hello World')

else:
  A = int(imput())
  B = int(imput())
  print(A + B)

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

if N == 1:
  print('Hello World')

else:
  A = int(imput())
  B = int(imput())
  
  print(A + B)
Problem p03026 (python)

Fixed submission:
from collections import deque
import sys
sys.setrecursionlimit(100000)

N=int(input())
AB=[list(map(int,input().split())) for _ in range(N-1)]
C=deque(sorted(map(int,input().split())))
edges=[[] for _ in range(N)]
for a,b in AB:
    edges[a-1].append(b-1)
    edges[b-1].append(a-1)

ps=[0]*N

def dfs(prev, curr):
    ps[curr]=C.pop()
    for dst in edges[curr]:
        if prev==dst:
            continue
        dfs(curr,dst)
dfs(-1,0)

ans=0
for a,b in AB:
    ans += min(ps[a-1],ps[b-1])

print(ans)
print(" ".join([str(p) for p in ps]))

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

N=int(input())
AB=[list(map(int,input().split())) for _ in range(N-1)]
C=deque(sorted(map(int,input().split())))
edges=[[] for _ in range(N)]
for a,b in AB:
    edges[a-1].append(b-1)
    edges[b-1].append(a-1)

ps=[0]*N

def dfs(prev, curr):
    ps[curr]=C.pop()
    for dst in edges[curr]:
        if prev==dst:
            continue
        dfs(curr,dst)
dfs(-1,0)

ans=0
for a,b in AB:
    ans += min(ps[a-1],ps[b-1])

print(ans)
print(" ".join([str(p) for p in ps]))