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

Fixed submission:
n, k = [int(i) for i in input().split()]
s = input()

a = s[:k-1]
c = s[k-1]
b = s[k:]

if c == 'A':
    print(a + 'a' + b)
elif c == 'B':
    print(a + 'b' + b)
else:
    print(a + 'c' + b)

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

BLACK = -1
GRAY = 0
WHITE = 1
nodes = [GRAY] * N
nodes[0] = BLACK
neighbors = [[] for _ in range(N)]

for n in range(N-1):
    u, v, w = [int(i) for i in input().split()]
    neighbors[u-1].append((v-1, w))
    neighbors[v-1].append((u-1, w))

for u in range(N):
    neiss = neighbors[u]
    for neis in neiss:
        v, w = neis
        if nodes[u] == GRAY and nodes[v] == GRAY:
            next
        if nodes[u] == GRAY:
            if w % 2 == 0:
                nodes[u] = nodes[v]
            else:
                nodes[u] = -nodes[v]
        if nodes[v] == GRAY:
            if w % 2 == 0:
                nodes[v] = nodes[u]
            else:
                nodes[v] = -nodes[u]

for u in range(N):
    neiss = neighbors[u]
    for neis in neiss:
        v, w = neis
        if nodes[u] == GRAY and nodes[v] == GRAY:
            next
        if nodes[u] == GRAY:
            if w % 2 == 0:
                nodes[u] = nodes[v]
            else:
                nodes[u] = -nodes[v]
        if nodes[v] == GRAY:
            if w % 2 == 0:
                nodes[v] = nodes[u]
            else:
                nodes[v] = -nodes[u]

for u in range(N):
    neiss = neighbors[u]
    for neis in neiss:
        v, w = neis
        if nodes[u] == GRAY and nodes[v] == GRAY:
            next
        if nodes[u] == GRAY:
            if w % 2 == 0:
                nodes[u] = nodes[v]
            else:
                nodes[u] = -nodes[v]
        if nodes[v] == GRAY:
            if w % 2 == 0:
                nodes[v] = nodes[u]
            else:
                nodes[v] = -nodes[u]

for n in nodes:
    if n == BLACK:
        print(0)
    else:
        print(1)
Problem p02959 (python)

Fixed submission:
a = int(input())
b = input().split()
teki = [int(i) for i in b]
c = input().split()
yuusya = [int(i) for i in c]

count = 0

if yuusya[0] >= teki[0]:
    yuusya[0] -= teki[0]
    count += teki[0]
    teki[0] = 0
else:
    count += yuusya[0]
    teki[0] -= yuusya[0]
    yuusya[0] = 0

for i in range(1, len(yuusya)):
    if yuusya[i - 1] > 0:
        if yuusya[i - 1] > teki[i]:
            count += teki[i]
            yuusya[i - 1] = 0
            teki[i] = 0
            continue
        else:
            count += yuusya[i-1]
            teki[i]-=yuusya[i-1]
    if yuusya[i] >= teki[i]:
        yuusya[i] -= teki[i]
        count += teki[i]
        teki[i] = 0
    else:
        count += yuusya[i]
        teki[i] -= yuusya[i]
        yuusya[i] = 0

if len(teki) > len(yuusya) and len(teki) > 2:
    if yuusya[i] >= teki[i+1]:
        yuusya[i] -= teki[i+1]
        count += teki[i+1]
    else:
        count += yuusya[i]
        teki[i] -= yuusya[i]
        yuusya[i] = 0

print(count)

Buggy submission (verdict: Runtime Error):
a = int(input())
b = input().split()
teki = [int(i) for i in b]
c = input().split()
yuusya = [int(i) for i in c]

count = 0

if yuusya[0] >= teki[0]:
    yuusya[0] -= teki[0]
    count += teki[0]
    teki[0] = 0
else:
    count += yuusya[0]
    teki[0] -= yuusya[0]
for i in range(1, len(yuusya)):
    if yuusya[i - 1] > 0:
        if yuusya[i - 1] > teki[i]:
            count += teki[i]
            continue
        else:
            count += yuusya[i-1]
            teki[i]-=yuusya[i-1]
    if yuusya[i] >= teki[i]:
        yuusya[i] -= teki[i]
        count += teki[i]
        teki[i] = 0
    else:
        count += yuusya[i]
        teki[i] -= yuusya[i]
        yuusya[i] = 0
        

if yuusya[i] >= teki[i+1]:
    yuusya[i] -= teki[i+1]
    count += teki[i+1]
else:
    count += yuusya[i]
    teki[i] -= yuusya[i]
    yuusya[i] = 0

print(count)
Problem p02948 (python)

Fixed submission:
import heapq

N, M = list(map(int,input().split()))
A = [[] for _ in range(M)]

for i in range(N):
    a, b = list(map(int,input().split()))
    if a <= M:
        A[a-1].append(-b)
    
ans = 0
cand = []

for i in range(M):
    
    for j in A[i]:
        heapq.heappush(cand, j)
        
    if cand:
        ans -= heapq.heappop(cand)
    
print(ans)

Buggy submission (verdict: Runtime Error):
import heapq

N,M = list(map(int,input().split()))
A = [[] for _ in range(M)]

for i in range(N):
    a,b = list(map(int,input().split()))
    A[a-1].append(-b)
    
ans = 0
cand = []

for i in range(M):
    
    for j in A[i]:
        cand.append(j)
        
    if cand:
        heapq.heapify(cand)
        ans -= heapq.heappop(cand)
    
print(ans)
Problem p03137 (python)

Fixed submission:
import numpy as np
N,M=list(map(int,input().split()))
X=np.sort(np.array(list(map(int,input().split()))))

if N>=M:
    print(0)
else:
    L=np.sort(np.diff(X))
    ans=X[-1]-X[0]
    for i in range(1,N):
        ans-=L[-i]
    print(ans)

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

def select():
    max_=0
    index=0
    for i in X:
        temp=min(abs(a-i))+i
        if temp>max_:
            max_=temp
            index=i
    return index

def walk(a,X,ans):
    min_=float('inf')
    x=0
    ppp=0
    for i in X:
        p=abs(a-i)
        dis_min_index=np.argmin(p)
        temp=p[dis_min_index]
        if temp<min_:
            ppp=dis_min_index
            min_=temp
            x=i
    if a[ppp]>x:
        a[ppp]-=min_
    else:
        a[ppp]+=min_
    ans+=min_
    X.remove(x)
    return ans,X

N,M=list(map(int,input().split()))
X=sorted(list(map(int,input().split())))
if N==1:
    print(X[-1]-X[0])  
elif N>=M:
    print(0)
else:
    a=np.array([X[0],X[-1]])
    ans=0
    for i in range(N-2):
        a=np.append(a,select())
    for i in a:
        X.remove(i)
    while(X!=[]):
        ans,X=walk(a,X,ans)
    print(ans)
Problem p03242 (python)

Fixed submission:
N=input()
a=[]
for i in range(3):
    if(N[i]=="1"):
        a.append("9")
    elif(N[i]=="9"):
        a.append("1")
    else:
        a.append(N[i])
print("".join(a))

Buggy submission (verdict: Runtime Error):
def cal(n,v):
    k=n//2
    even=range(0,2*k,2)
    odd=range(1,2*k+1,2)

    el=[]
    for i in even:
        el.append(v[i])
    ol=[]
    for i in odd:
        ol.append(v[i])

    d={}
    for i in el:
        if((i in d) is False):
            d[i]=0
        else:
            d[i]+=1

    f={}
    for i in ol:
        if((i in f) is False):
            f[i]=0
        else:
            f[i]+=1

    while(True):
        e = max(d, key=d.get)
        o = max(f, key=f.get)
        if(e==o):
            if(d[e]>f[e]):
                del f[e]
            elif(d[e]<f[e]):
                del d[e]
            else:
                return print(k)
        else:
            break

    sum=0
    for i in el:
        if(i!=e):
            sum+=1
    for i in ol:
        if(i!=o):
            sum+=1
    return print(sum)

n=int(input())
v=list(map(int,input().split()))
cal(n,v)

Buggy submission (verdict: Runtime Error):
n=int(input())
v=list(map(int,input().split()))
 
k=n//2
even=range(0,2*k,2)
odd=range(1,2*k+1,2)
 
el=[]
for i in even:
    el.append(v[i])
ol=[]
for i in odd:
    ol.append(v[i])
 
d={}
for i in el:
    if((i in d)is False ):
        d[i]=0
    else:
        d[i]+=1
e = max(d, key=d.get)
 
d={}
for i in ol:
    if((i in d)is False ):
        d[i]=0
    else:
        d[i]+=1
o = max(d, key=d.get)
 
if(el==ol):
    print(k)
else:
    sum=0
    for i in el:
        if(i!=e):
            sum+=1
    for i in ol:
        if(i!=o):
            sum+=1
    print(sum)
Problem p03326 (python)

Fixed submission:
n,m = [int(i) for i in input().split()]

cakes = []
ranking = [[] for i in range(8)]
ranking2 = []

for i in range(n):
    cakes.append(list(map(int,input().split())))

a = 0
for i in range(2):
    for j in range(2):
        for k in range(2):
            for x in range(n):
                kirei = cakes[x][0]
                oisii = cakes[x][1]
                ninki = cakes[x][2]
                if i ==1:
                    kirei = (-1)*kirei
                if j ==1:
                    oisii = (-1) * oisii
                if k==1:
                    ninki = (-1)*ninki
                sum = kirei + oisii + ninki
                ranking[a].append(sum)
            a += 1

for i in ranking:
    i = sorted(i)
    i = i[::-1]
    ranking2.append(i)

ans = 0

maxi = 0

for x in ranking2:
    ans = 0
    for i in range(m):
        ans += x[i]
    maxi = max(maxi,ans)
print(maxi)

Buggy submission (verdict: Runtime Error):
n,m = [int(i) for i in input().split()]

cakes = []
ranking = [[] for i in range(8)]
ranking2 = []

for i in range(n):
    cakes.append(list(map(int,input().split())))

a = 0
for i in range(2):
    for j in range(2):
        for k in range(2):
            for x in range(n):
                kirei = cakes[x][0]
                oisii = cakes[x][1]
                ninki = cakes[x][2]
                if i ==1:
                    kirei = (-1)*kirei
                if j ==1:
                    oisii = (-1) * oisii
                if k==1:
                    ninki = (-1)*ninki
                sum = kirei + oisii + ninki
                ranking[a].append(sum)
            a += 1

for i in ranking:
    i = sorted(i)
    i = i[::-1]
    ranking2.append(i)

ans = 0

maxi = 0

for x in ranking2:
    ans = 0
    for i in range(m):
        ans += x[i]
    maxi = max(maxi,ans)
print(maxi)n,m = [int(i) for i in input().split()]

cakes = []
ranking = [[] for i in range(8)]
ranking2 = []

for i in range(n):
    cakes.append(list(map(int,input().split())))

a = 0
for i in range(2):
    for j in range(2):
        for k in range(2):
            for x in range(n):
                kirei = cakes[x][0]
                oisii = cakes[x][1]
                ninki = cakes[x][2]
                if i ==1:
                    kirei = (-1)*kirei
                if j ==1:
                    oisii = (-1) * oisii
                if k==1:
                    ninki = (-1)*ninki
                sum = kirei + oisii + ninki
                ranking[a].append(sum)
            a += 1

for i in ranking:
    i = sorted(i)
    i = i[::-1]
    ranking2.append(i)

ans = 0

maxi = 0

for x in ranking2:
    ans = 0
    for i in range(m):
        ans += x[i]
    maxi = max(maxi,ans)
print(maxi)
Problem p03137 (python)

Fixed submission:
N, M = map(int, input().split())
X = list(set(map(int, input().split())))
M = len(X)

if N>=M:
  print(0)
else:
  X.sort()
  Y=[]
  for i in range(len(X)-1):
    Y.append([i,X[i+1]-X[i]])
  Y.sort(reverse=True, key=lambda x:x[1])
  Y=Y[:N-1]
  Y.sort()
  ans=0
  old=0
  for i in range(N-1):
    tmp=X[old:Y[i][0]+1]
    ans+=max(tmp)-min(tmp)
    old=Y[i][0]+1
  else:
    if old<len(X):
      tmp=X[old:]
      ans+=max(tmp)-min(tmp)
  print(ans)

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

if N>=M:
  print(0)
else:
  X.sort()
  Y=[]
  for i in range(len(X)-1):
    Y.append([i,X[i+1]-X[i]])
  Y.sort(reverse=True, key=lambda x:x[1])
  ans=0
  old=0
  for i in range(N-1):
    tmp=X[old:Y[i][0]+1]
    ans+=max(tmp)-min(tmp)
    old=Y[i][0]+1
  else:
    tmp=X[old:]
    ans+=max(tmp)-min(tmp)
  print(ans)

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

if N>=M:
  print(0)
else:
  X.sort()
  Y=[]
  for i in range(len(X)-1):
    Y.append([i,X[i+1]-X[i]])
  Y.sort(reverse=True, key=lambda x:x[1])
  ans=0
  old=0
  for i in range(N-1):
    tmp=X[old:Y[i][0]+1]
    ans+=max(tmp)-min(tmp)
    old=Y[i][0]+1
  else:
    if old<len(X):
      tmp=X[old:]
      ans+=max(tmp)-min(tmp)
  print(ans)

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

if N>M:
  print(0)
else:
  X.sort()
  Y=[]
  for i in range(len(X)-1):
    Y.append([i,X[i+1]-X[i]])
  Y.sort(reverse=True, key=lambda x:x[1])
  ans=0
  old=0
  for i in range(N-1):
    tmp=X[old:Y[i][0]+1]
    ans+=max(tmp)-min(tmp)
    old=Y[i][0]+1
  else:
    tmp=X[old:]
    ans+=max(tmp)-min(tmp)
  print(ans)
Problem p03286 (python)

Fixed submission:
N=int(input())

if N%2==0:
  ans='0'
else:
  ans='1'
  N-=1
  
i=2
while abs(N)>0:
  if N%((-2)**i)==0:
    ans='0'+ans
  else:
    ans='1'+ans
    N-=(-2)**(i-1)
  i+=1
    
print(ans)

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

if N%2==0:
  ans='0'
else:
  ans='1'
  
i=2
while abs(tmp)<=abs(N):
  if N%((-2)**i)==0:
    ans='0'+ans
  else:
    ans='1'+ans
    
print(ans)
Problem p03835 (python)

Fixed submission:
K, S=map(int,input().split())

answer=0
for x in range(K+1):
  for y in range(K+1):
    if S-(x+y)>=0 and S-(x+y)<=K:
      answer+=1
      
print(answer)

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

answer=0
for x in range(K+1):
  for y in range(K+1):
    if S-(x+y)<=K:
      answer+=1
      
print(answer)
Problem p02987 (python)

Fixed submission:
from collections import defaultdict

S = input().rstrip()

char_dict = defaultdict(int)
for char in S:
    char_dict[char] += 1

kind = len(char_dict.keys())
val_set = set(char_dict.values())

if kind == 2 and val_set == {2}:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
n = int(input().rstrip())
p = [int(x) for x in input().rstrip().split()]

count = 0
for i in range(1, n - 1):
    if (p[i] > p[i - 1] and p[i] < p[i + 1]) or \
        (p[i] < p[i - 1] and p[i] > p[i + 1]):
        count += 1
print(count)
Problem p03038 (python)

Fixed submission:
#!/usr/bin/env python3
N, M = map(int, input().rstrip().split())
A = list(map(int, input().rstrip().split()))

B = []
C = []
for _ in range(M):
    b, c = map(int, input().rstrip().split())
    B.append(b)
    C.append(c)

Index = sorted(range(M), key=lambda i: C[i], reverse=True)

sum = 0
A.sort()
for index in Index:
    if A and A[0] >= C[index]:
        break
    count = 0
    i = 0
    while True:
        if i >= len(A):
            break
        if A[i] < C[index] and count < B[index]:
            sum += C[index]
            A.pop(i)
            # print(A)
            count += 1
            continue
        if A[i] >= C[index] or count >= B[index]:
            break
        i += 1

if A:
    for a in A:
        sum += a

print(sum)

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
N, M = map(int, input().rstrip().split())
A = list(map(int, input().rstrip().split()))

B = []
C = []
for _ in range(M):
    b, c = map(int, input().rstrip().split())
    B.append(b)
    C.append(c)

Index = sorted(range(M), key=lambda i: C[i], reverse=True)

sum = 0
A.sort()
for index in Index:
    if A[0] >= C[index]:
        break
    count = 0
    i = 0
    while True:
        if i >= len(A):
            break
        if A[i] < C[index] and count < B[index]:
            sum += C[index]
            A.pop(i)
            # print(A)
            count += 1
            continue
        if A[i] >= C[index] or count >= B[index]:
            break
        i += 1

if A:
    for a in A:
        sum += a

print(sum)
Problem p02935 (python)

Fixed submission:
N = int(input())
v = list(map(int, input().split()))
v.sort()
v.reverse()
result = 0

for i, x in enumerate(v):
    if i == N - 1:
        i = N - 2
    result += x / pow(2, i + 1)

print(result)

Buggy submission (verdict: Runtime Error):
N=int(input())
List=list(map(int,input().split()))
List.sort(reverse=True)
ans=0
for i in range(N-1):
  k = List[i]/(2**(i+1))
  ans += k
l = List[N]/(2**(N-1))
ans += l
print(ans)
Problem p02970 (python)

Fixed submission:
n, d = map(int, input().split())
if n%(2*d+1) == 0:
    print(n//(2*d+1))
else:
    print(n//(2*d+1)+1)

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

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

Buggy submission (verdict: Runtime Error):
a,b=input().split()
c=input()
c[b-1]=c[b-1].upper()
print(c)
Problem p03307 (python)

Fixed submission:
import fractions
N = int(input())
def lcm(x, y):
    return (x * y) / fractions.gcd(x, y)

print(int(lcm(2, N)))

Buggy submission (verdict: Runtime Error):
import math
N = input()
def lcm(x, y):
    return (x * y) // math.gcd(x, y)

print(lcm(2, N))

Buggy submission (verdict: Runtime Error):
import fractions
N = input()
k = fractions.gcd(2, N)
print(2*N / k)

Buggy submission (verdict: Runtime Error):
import fractions
N = input()
k = fraction.gcd(2, N)
print(2*N / k)

Buggy submission (verdict: Runtime Error):
import fraction
N = input()
k = fraction.gcd(2, N)
print(2*N / k)
Problem p03315 (python)

Fixed submission:
S = input()
print(S.count("+") - S.count('-'))

Buggy submission (verdict: Runtime Error):
[a, b, c, d] = input()  # 3文字の文字列
list = [a, b, c, d] 
k = 0
for f in list:
    if f = '+':
        k += 1
    else:
        k -= 1    
print(k)
Problem p03221 (python)

Fixed submission:
import bisect
def index(alist, x):
    i = bisect.bisect_left(alist, x)
    if i != len(alist) and alist[i] == x:
        return i
    raise ValueError

n, m = map(int, input().split())
p, y = [0] * m, [0] * m
year_list = [[] for _ in range(n)]
for i in range(m):
    p[i], y[i] = map(int, input().split())
    year_list[p[i] - 1].append(y[i])
for j in range(n):
    year_list[j].sort()
for i in range(m):
    x = index(year_list[p[i] - 1], y[i]) + 1
    print(str(p[i]).zfill(6) + str(x).zfill(6))

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
p, y = [0] * m, [0] * m
sort_year = [0] * m
initial_index, count_city = [0] * n, [0] * n
tmp_counter = [0] * n 
for i in range(m):
    p[i], y[i] = map(int, input().split())
    count_city[p[i] - 1] += 1
for j in range(1, n):
  	initial_index[j] = initial_index[j] + count_city[j - 1]
for i in range(m):
    sort_year[initial_index[p[i] - 1] + tmp_counter[p[i] - 1]] = y[i]
    tmp_counter[p[i] - 1] += 1
for j in range(n):
    sort_year[initial_index[j] : initial_index[j] + count_city[j - 1]].sort()
for i in range(m):
    x = sort_year.index(y[i]) - initial_index[p[i] - 1] + 1
    print(str(p[i]).zfill(6) + str(x).zfill(6))

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
p, y = [0] * m, [0] * m
sort_year = [0] * m
initial_index, count_city = [0] * n, [0] * n
tmp_counter = [0] * n 
for i in range(m):
    p[i], y[i] = map(int, input().split())
    count_city[p[i] - 1] += 1
for j in range(1, n):
  	initial_index[j] = initial_index[j] + count_city[j - 1]
for i in range(m):
    sort_year[initial_index[p[i] - 1] + tmp_counter[p[i] - 1]] = y[i]
    tmp_counter[p[i] - 1] += 1
for j in range(n):
    sort_year[initial_index[j] : initial_index[j] + count_city[j - 1]].sort()
for i in range(m):
    x = sort_year.index(y[i]) - initial_index[p[i] - 1] + 1
    print(str(p[i]).zfill(8) + str(x).zfill(8))
Problem p02989 (python)

Fixed submission:
import bisect

n = int(input())
d = list(int(x) for x in input().split())
d.sort()

print(d[(n // 2)] - d[(n // 2) - 1])

"""
for k in range(d[n // 2], d[(n // 2) + 1]):
    if bisect.bisect_left(d, k) == n // 2:
        ans += 1
"""

Buggy submission (verdict: Runtime Error):
import bisect

n = int(input())
d = list(int(x) for x in input().split())
d.sort()

ans = 0

for k in range(min(d), d[(n // 2) + 1]):
    idx = bisect.bisect_left(d, k)
    if idx == n // 2:
        ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
import bisect

n = int(input())
d = list(int(x) for x in input().split())
d.sort()

ans = 0

for k in range(min(d), d[(n // 2) + 1]):
    idx = bisect.bisect_left(d, k)
    abc_num = idx
    arc_num = n - abc_num
    if arc_num == abc_num:
        ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
d = list(int(x) for x in input().split())
d.sort()

ans = 0

for k in range(min(d), d[(n // 2) + 1]):
    arc_num = 0
    abc_num = 0
    
    for i in range(n):
        if d[i] >= k:
            break
        else:
            abc_num += 1
    arc_num = n - abc_num
    if arc_num == abc_num:
        ans += 1

print(ans)
Problem p02933 (python)

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

if (a >= 3200):
  print(s)
else:
  print('red')

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

sum = 0.0
for x in a:
  sum = sum + 1 / x

print(1/sum)

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

sum = 0.0
for x in a:
  sum = sum + 1 / x

print(1/sum)

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

if (a >= 3200):
  print s
else:
  print('red')

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

if (a >= 3200):
  print s
else:
  print('red')

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

print(s if (a >= 3200) else 'red')
Problem p02935 (python)

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

v.sort()

value = v[0]
for i in range(1, len(v)):
  value = (value + v[i]) / 2

print(value)

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

v.sort()

value = v[0]
for i in range(1, len(v)):
  value = (value + v[i]) / 2

print(value)
Problem p02933 (python)

Fixed submission:
input_number = int(input())
input_string = input()
if input_number < 3200:
    print("red")
else:
    print(input_string)

Buggy submission (verdict: Runtime Error):
input_line = list(map(int,input().split()))
tree_info = []
for i in range(input_line[0]-1):
    info = list(input().split())
    tree_info.append(info)
counter = [0] * input_line[0]
for i in range(input_line[1]):
    count_info = list(map(int, input().split()))
    counter[count_info[0]-1] += count_info[1]
for i in range(1,len(counter)):
    counter[i] += counter[int(tree_info[i-1][0])-1]
print(" ".join(list(map(str,counter))))

Buggy submission (verdict: Runtime Error):
input_number = map(int,input())
input_string = input()
if input_number < 3200:
  print(input_number)
else:
  print(input_string)
Problem p02951 (python)

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

Buggy submission (verdict: Runtime Error):
a,b,c = map(input().split())
print (c-(a-b))
Problem p02987 (python)

Fixed submission:
import collections
S = input()
L = collections.Counter(S)
T = L.most_common()
if len(T) == 2 and T[0][1] == 2:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
import collections
S = input()
L = collections.Counter(S)
if len(L) == 2 and L[0][1] == 2:
  print('Yes')
else:
  print('No')
Problem p03011 (python)

Fixed submission:
List = list(map(int,input().split(' ')))
List.sort()
print(sum(List[0:2]))

Buggy submission (verdict: Runtime Error):
P,Q,R = map(int,input().split(' '))
List = [P,Q,R].sort()
print(List[0]+List[1])
Problem p03242 (python)

Fixed submission:
N = str(input())

def reverse(N):
  Answer = ''
  for x in N:
    if x == '1':
      Answer += '9'
    else:
      Answer += '1'
  return Answer
print(reverse(N))

Buggy submission (verdict: Runtime Error):
import collections
N = int(input())
V = input().split(' ')

EVEN = V[0::2]
ODD = V[1::2]
EVEN_V = collections.Counter(EVEN)
ODD_V = collections.Counter(ODD)
if N == 2:
  print(0)
A = len(EVEN_V)
B = len(ODD_V)


if EVEN_V.most_common()[0][1] >= ODD_V.most_common()[0][1]:
  MAX_ELE = EVEN_V.most_common()[0][0]
  count_max =EVEN_V.most_common()[0][1]
  for i in range(B):
    if MAX_ELE != ODD_V.most_common()[i][0]:
      SECOND_ELE = ODD_V.most_common()[i][0]
      count_SEC = ODD_V.most_common()[i][1]
      break
    else:
      count_SEC = N/2
  
else:
  MAX_ELE = ODD_V.most_common()[0][0]
  count_max = ODD_V.most_common()[0][1]
  for i in range(A):
    if MAX_ELE != EVEN_V.most_common()[i][0]:
      SECOND_ELE =EVEN_V.most_common()[i][0]
      count_SEC = EVEN_V.most_common()[i][1]
      break
    else:
      count_SEC = N/2
print((N- int(count_max) - int(count_SEC)))
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().split(' '))
print(N-i+1)

Buggy submission (verdict: Runtime Error):
N, i = map(int,input().spkit(' '))
print(N-i+1)