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

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
while len(a)>1:
    m=min(a)
    def f(n):
        return n%m
    a=map(f,a)
    a=set(a)
    a.add(m)
    a.remove(0)
    a=list(a)
print(a[0])

Buggy submission (verdict: Runtime Error):
n=input()
a=list(map(int,input().split()))
for i in range(0,len(a)):
    a[i]=a[i]%min(a)
    a.append(min(a))
    for j in range(len(a)):
        if a[j]==0:
            a.remove(a[j])
print(a[0])

Buggy submission (verdict: Runtime Error):
n=input()
a=list(map(int,input().split()))
k=[0,99999999]
for i in range(0,n):
    a[i]=a[i]%min(a)
    a.append(min(a))
    for j in range(n+1):
        if a[j]==0:
            a.remove(a[j])
            n-=1
print(a[0])
Problem p03135 (python)

Fixed submission:
a, b = map(int, input().split( ))
k = round((a / b), 10)
print("{0:.10f}".format(k))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split( ))
datas = list(map(int, input().split( )))
datas.sort()
Ms = M - 1

dest = list()
K = 0
i = 0
for i in range(Ms):
  K = datas[i+1] - datas[i]
  dest.append(K)

dest.sort()
L = 0
MN = M - N
for j in range(MN):
  L = L + dest[j]

print(L)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split( ))
#print(N)
#print(M)
datas = list(map(int, input().split( )))
#print(datas)
datas.sort()
#print(datas)
Ms = M - 1

dest = list()
K = 0
i = 0
for i in range(Ms):
  K = datas[i+1] - datas[i]
  dest.append(K)
  dest.sort()
  #print(K)

#print(dest)
L = 0
MN = M - N
for j in range(MN):
  L = L + dest[j]

print(L)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split( ))
datas = list(map(int, input().split( )))
datas.sort()
Ms = M - 1

dest = list()
K = 0
i = 0
for i in range(Ms):
  K = datas[i+1] - datas[i]
  dest.append(K)
  dest.sort()

L = 0
MN = M - N

for j in range(MN):
  L = L + dest[j]

print(L)
Problem p03137 (python)

Fixed submission:
N, M = map(int, input().split( ))
datas = list(map(int, input().split( )))
datas.sort()
Ms = M - 1

dest = list()
K = 0
i = 0
for i in range(Ms):
  K = datas[i+1] - datas[i]
  dest.append(K)

dest.sort()
L = 0
MN = M - N
for j in range(MN):
  L = L + dest[j]

print(L)

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

Ms = M -1
dest = list()

for i in range(Ms):
  K = X[i+1] - X[i]
  dest = list.append(K)

dest.sort()
L = 0
NM = N - M
for j in range(NM):
  L = L + dest(j)

print(L)
Problem p03207 (python)

Fixed submission:
n=int(input())
a=[0]*n
kei=0
for i in range(0,n,1):
    a[i]=int(input())
    kei=kei+a[i]

a.sort(reverse=True)
kei=kei-a[0]//2
print(kei)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=[]*n
kei=0
for i in range(0,n,1):
    a[i]=int(input())
    kei=kei+a[i]

a.sort(reverse=True)
kei=kei-a[0]/2
print("%d",kei)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=[n]
for i in range(0,n,1):
    a[i]=int(input())
    kei=kei+a[i]

a.sort(reverse=True)
kei=kei-a[0]/2
print("%d",kei)
Problem p03135 (python)

Fixed submission:
T, X = map(int, input().split())
print(T / X)

Buggy submission (verdict: Runtime Error):
S = input().split("/")
N = S[0] + S[1] + S[2]
if int(N) <= 20190430: print("Heisei")
else: print("TBD")

Buggy submission (verdict: Runtime Error):
S = input().split("/")
N = S[0] + S[1] + S[2]
if int(N) <= 20190430: print("Heisei")
else: print("TBD")
Problem p03135 (python)

Fixed submission:
i=list(map(int,input().split()))
t=(1/i[1])*i[0]
print(t)

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

t=(1/X)*T
print(t)
Problem p03108 (python)

Fixed submission:
class Unionfind():
    def __init__(self, progsize):
        self.table = [-1 for _ in range(progsize)]
        self.size = [1 for _ in range(progsize)]

    def find(self, x):
        while(self.table[x] >= 0):
            x = self.table[x]
        return x

    def union(self, x, y):
        xl = self.find(x)
        yl = self.find(y)
        if xl != yl:
            if self.table[xl] <= self.table[yl]:
                self.table[yl] = xl
                self.table[xl] -= 1
                self.size[xl] += self.size[yl]
            else:
                self.table[xl] = yl
                self.table[yl] -= 1
                self.size[yl] += self.size[xl]

n, m = map(int, input().split())
bridge = [tuple(map(int, input().split())) for _ in range(m)]
bridge.reverse()
uf = Unionfind(n)
cur = n * (n-1) // 2
ans = [cur]
for a, b in bridge:
    ap = uf.find(a-1)
    bp = uf.find(b-1)
    if ap != bp:
        cur -= uf.size[ap] * uf.size[bp]
    uf.union(a-1, b-1)
    ans.append(cur)
for a in reversed(ans[0:m]):
    print(a)

Buggy submission (verdict: Runtime Error):
class Unionfind():
    def __init__(self, progsize):
        self.table = [-1 for _ in range(progsize)]
        self.size = [1 for _ in range(progsize)]

    def find(self, x):
        while(self.table[x] >= 0):
            x = self.table[x]
        return x

    def union(self, x, y):
        xl = self.find(x)
        yl = self.find(y)
        if xl != yl:
            if self.table[xl] <= self.table[yl]:
                self.table[yl] = xl
                self.table[xl] -= 1
                self.size[xl] += self.size[yl]
            else:
                self.table[xl] = yl
                self.table[yl] -= 1
                self.size[yl] += self.size[xl]

n, m = [int(x) for x in input().split()]
b = [tuple(map(int, input().split())) for _ in range(m)]
r = []
t = n*(n-1)//2
ds = Unionfind(n)
for i in range(m):
  q, p = b[-i-1]
  r.insert(0, t)
  qq, pp = ds.find(p), ds.find(q)
  if pp != qq:
    t -= ds.size[pp] * ds.size[qq]
  ds.union(p, q)
for x in r:
  print(x)
Problem p03104 (python)

Fixed submission:
A, B = [int(i) for i in raw_input().split()]


def func(n, m):
	return int((n + 1) / (2 ** m)) * 2 ** (m - 1) + max(0, (n + 1) % (2 ** m) - 2 ** (m - 1))

print sum((func(B, i) - func(A-1, i)) % 2 * 2 ** (i - 1) for i in range(1, 64))

Buggy submission (verdict: Runtime Error):
A, B = [int(i) for i in raw_input().split()]
print(reduce((lambda x,y:(x|y)-(x&y)),range(A,B+1)))
Problem p03242 (python)

Fixed submission:
question="A"
input=raw_input
if question=="A":
	t=input()
	t=t.replace("9","n")
	t=t.replace("1","o")
	t=t.replace("n","1")
	t=t.replace("o","9")
	print(t)
if question=="B":
	pass
if question=="C":
	pass
if question=="D":
	pass
if question=="E":
	pass

Buggy submission (verdict: Runtime Error):
question="C"
input=raw_input
if question=="A":
	t=input()
	t=t.replace("9","n")
	t=t.replace("1","o")
	t=t.replace("n","1")
	t=t.replace("o","9")
	print(t)
if question=="B":
	s=int(input())
	t=[111,222,333,444,555,666,777,888,999]
	t=filter(lambda x:x>=s,t)[0]
	print(t)
if question=="C":
	N=int(input())
	a=map(int,input().split())
	A=Amoto=a[0:][::2]
	B=Bmoto=a[1:][::2]
	def f(x):
		a=[(i, x.count(i)) for i in set(x)]
		a=sorted(a,key=lambda x:-x[1])
		return a
	A=f(A)
	B=f(B)
	if A[0][1]<B[0][1]:
		A,B=B,A
	A=A[0][0]
	B.append((0,0))
	B=filter(lambda x:(x[0]!=A),B)[0][0]
	print N-Amoto.count(A)-Bmoto.count(B)
if question=="D":
	pass
if question=="E":
	pass

Buggy submission (verdict: Runtime Error):
question="C"
input=raw_input
if question=="A":
	t=input()
	t=t.replace("9","n")
	t=t.replace("1","o")
	t=t.replace("n","1")
	t=t.replace("o","9")
	print(t)
if question=="B":
	s=int(input())
	t=[111,222,333,444,555,666,777,888,999]
	t=filter(lambda x:x>=s,t)[0]
	print(t)
if question=="C":
	input()
	a=input().split()
	A=Amoto=a[0:][::2]
	B=Bmoto=a[1:][::2]
	def f(x):
		a=[(i, x.count(i)) for i in set(x)]
		a=sorted(a,key=lambda x:-x[1])
		return a
	A=f(A)
	B=f(B)
	if A[0][1]<B[0][1]:
		A,B=B,A
	A=A[0][0]
	B.append(("X",0))
	B=filter(lambda x:(x[0]!=A),B)[0][0]
	print sum(i!=A for i in Amoto) + sum(i!=B for i in Bmoto)
if question=="D":
	pass
if question=="E":
	pass
Problem p03137 (python)

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

if m <= n:
	print(0)
elif n == 1:
	print(abs(x[-1]-x[0]))
else:
	diff = [0]*(m-1)
	for it in range(m-1):
		diff[it] = x[it+1]-x[it]
	diff = sorted(diff)
	diff = diff[:m-n]
	# print(diff)
	print(sum(diff))

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

if m == 1:
	print(0)
elif n == 1:
	print(abs(max(x)-min(x)))
else:
	# print(diff)
	diff = [0]*(m-1)
	for it in range(m-1):
		diff[it] = x[it+1]-x[it]
	for it in range(n-1):
		max_d = max(diff)
		idx = diff.index(max_d)
		diff = diff[:idx] + diff[idx+1:]
	print(sum(diff))

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

if m == 1:
	print(0)
elif n == 1:
	print(abs(max(x)-min(x)))
else:
	# print(diff)
	diff = []
	for it in range(m-1):
		diff.append(x[it+1]-x[it])
	for it in range(n-1):
		max_d = max(diff)
		idx = diff.index(max_d)
		diff = diff[:idx] + diff[idx+1:]
	print(sum(diff))
Problem p03104 (python)

Fixed submission:
a, b = [int(x) for x in input().split()]

if b > 3:
    if a <= 1:
        s_c = 1
    else:
        s_c = 0

    a_keta = len(str(bin(a))) - 2
    b_keta = len(str(bin(b))) - 2
    m_a = (2 ** a_keta - a) % 4
    m_b = (b - (2 ** (b_keta-1)) + 1) % 4
    #print(m_a)
    #print(m_b)

    if m_a == 0:
        s_a = 0
    elif m_a == 1:
        s_a = a
    elif m_a == 2:
        s_a = 1
    elif m_a == 3:
        s_a = a - 1

    if m_b == 0:
        s_b = 0
    elif m_b == 1:
        s_b = b
    elif m_b == 2:
        s_b = 1
    elif m_b == 3:
        s_b = b + 1
    print(s_a ^ s_b ^ s_c)
else:
    if a == 0 and b == 0:
        print(0)
    if a == 0 and b == 1:
        print(1)
    if a == 0 and b == 2:
        print(3)
    if a == 0 and b == 3:
        print(0)
    if a == 1 and b == 1:
        print(1)
    if a == 1 and b == 2:
        print(3)
    if a == 1 and b == 3:
        print(0)
    if a == 2 and b == 2:
        print(2)
    if a == 2 and b == 3:
        print(1)
    if a == 3 and b == 3:
        print(3)

Buggy submission (verdict: Runtime Error):
a, b = [int(x) for x in input().split()]

if b > 3:
    if a <= 1:
        s_c = 1

    a_keta = len(str(bin(a))) - 2
    b_keta = len(str(bin(b))) - 2
    m_a = (2 ** a_keta - a) % 4
    m_b = (b - (2 ** (b_keta-1)) + 1) % 4
    #print(m_a)
    #print(m_b)

    if m_a == 0:
        s_a = 0
    elif m_a == 1:
        s_a = a
    elif m_a == 2:
        s_a = 1
    elif m_a == 3:
        s_a = a - 1

    if m_b == 0:
        s_b = 0
    elif m_b == 1:
        s_b = b
    elif m_b == 2:
        s_b = 1
    elif m_b == 3:
        s_b = b + 1
    print(s_a ^ s_b ^ s_c)
else:
    if a == 0 and b == 0:
        print(0)
    if a == 0 and b == 1:
        print(1)
    if a == 0 and b == 2:
        print(3)
    if a == 0 and b == 3:
        print(0)
    if a == 1 and b == 1:
        print(1)
    if a == 1 and b == 2:
        print(3)
    if a == 1 and b == 3:
        print(0)
    if a == 2 and b == 2:
        print(2)
    if a == 2 and b == 3:
        print(1)
    if a == 3 and b == 3:
        print(3)
Problem p03805 (python)

Fixed submission:
# -*- coding: utf-8 -*-
n, m = [int(x) for x in input().split()]
adj = [[0]*n for i in range(n)]
visited = [0]*n
for i in range(m):
    a, b = [int(x) for x in input().split()]
    adj[a-1][b-1] = 1
    adj[b-1][a-1] = 1

ans = 0
def dfs(v):
    global ans
    if sum(visited) == n:
        ans += 1
    for i in range(n):
        if adj[v-1][i] == 1 and visited[i] == 0:
            visited[i] = 1
            dfs(i+1)
            visited[i] = 0

visited[0] = 1
dfs(1)
print(ans)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
n, m = [int(x) for x in input().split()]
adj = [[0]*n for i in range(n)]
visited = [0]*n
for i in range(n):
    a, b = [int(x) for x in input().split()]
    adj[a-1][b-1] = 1
    adj[b-1][a-1] = 1

ans = 0
def dfs(v):
    global ans
    if sum(visited) == n:
        ans += 1
    for i in range(n):
        if adj[v-1][i] == 1 and visited[i] == 0:
            visited[i] = 1
            dfs(i+1)
            visited[i] = 0

visited[0] = 1
dfs(1)
print(ans)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
n, m = [int(x) for x in input().split()]
adj = [[0]*m for i in range(m)]
visited = [0]*m
for i in range(m):
    a, b = [int(x) for x in input().split()]
    adj[a-1][b-1] = 1
    adj[b-1][a-1] = 1

ans = 0
def dfs(v):
    global ans
    if sum(visited) == m:
        ans += 1
    for i in range(m):
        if adj[v-1][i] == 1 and visited[i] == 0:
            visited[i] = 1
            dfs(i+1)
            visited[i] = 0

visited[0] = 1
dfs(1)
print(ans)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
n, m = [int(x) for x in input().split()]
adj = [[0]*m for i in range(m)]
visited = [0]*m
for i in range(m):
    a, b = [int(x) for x in input().split()]
    adj[a-1][b-1] = 1
    adj[b-1][a-1] = 1

ans = 0
def dfs(v):
    global ans
    if sum(visited) == m:
        ans += 1
    for i in range(m):
        if adj[v-1][i] == 1 and visited[i] == 0:
            visited[i] = 1
            dfs(i)
            visited[i] = 0

dfs(1)
print(ans)
Problem p03426 (python)

Fixed submission:
import numpy as np
H, W, D = list(map(int, input().split()))

px, py = [None for i in range(H*W+1)], [None for i in range(H*W+1)]
for i in range(H):
    A = list(map(int, input().split()))
    for j in range(W):
        px[A[j]] = i
        py[A[j]] = j

d = [0 for i in range(H*W+1)]
for i in range(D+1, H*W+1):
    d[i]= d[i-D]+abs(px[i]-px[i-D])+abs(py[i]-py[i-D])

Q = int(input())

for i in range(Q):
    L, R = list(map(int, input().split()))
    print(d[R]-d[L])

Buggy submission (verdict: Runtime Error):
import numpy as np
H, W, D = map(int, input().split())

px, py = np.zeros(H*W+1, dtype=int), np.zeros(H*W+1, dtype=int)
for i in range(H):
    A = map(int, input().split())
    for j in range(W):
        px[A[j]] = i
        py[A[j]] = j

d = np.zeros(H*W+1, dtype=int)
for i in range(D+1, H*W+1):
    d[i]= d[i-D]+abs(px[i]-px[i-D])+abs(py[i]-py[i-D])

Q = int(input())

for i in range(Q):
    L, R = map(int, input().split())
    print(d[R]-d[L])

Buggy submission (verdict: Runtime Error):
import numpy as np
sitei = input().split()
H, W, D = int(sitei[0]), int(sitei[1]), int(sitei[2])
_masume = np.zeros([H, W])
for i in range(H):
    _masume[i] = np.array(input().split())
masume = _masume.astype(int)

Q = int(input())

_settei = np.zeros([Q, 2])
#print(settei.dtype)
for i in range(Q):
    _settei[i] = np.array(input().split())

settei = _settei.astype(int)
maryoku = 0

zahyou = [np.where(masume==l) for l in range(1, H*W+1)]
#print(zahyou)

for l in range(Q):
    atai = settei[l][0]
    while (atai != settei[l][1]):
        maryoku += abs((zahyou[atai+D-1])[0]-(zahyou[atai-1])[0]) + abs((zahyou[atai+D-1])[1]-(zahyou[atai-1])[1])
        atai += D

maryoku, = maryoku
print(maryoku)
Problem p03767 (python)

Fixed submission:
import numpy as np


N = int(input())
a = list(map(int, input().split(' ')))
a.sort()

res = 0
for i in range(len(a[N:])):
    if i % 2 == 0:
        res += a[N+i]

print(res)

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

memo = {}
def dp(v, d, c):
    if memo.get((v, d), False):
        return None

    memo[(v, d)] = True
    if d == 0:
        res[v-1] = c
        return None

    dp(v, d-1, c)
    for e in dic.get(v, []):
        dp(e, d-1, c)


N, M = tuple(map(int, input().split(' ')))

dic = defaultdict(list)

for m in range(M):
    a, b = tuple(map(int, input().split(' ')))
    dic[a].append(b)
    dic[b].append(a)

Q = int(input())

vdc = [None]*Q

for q in range(Q):
    vdc[q] = tuple(map(int, input().split(' ')))

res = np.zeros(N)

for q in range(Q-1, -1, -1):
    v, d, c = vdc[q]
    dp(v, d, c)


for i in range(N):
    print(int(res[i]))

Buggy submission (verdict: Runtime Error):
import numpy as np
from numpy import linalg as LA
import math

mat_dic = {}

def f(mat, n):
    if mat_dic.get(n, None) is not None:
        return mat_dic.get(n, None)

    if n == 1:
        return mat

    if int(math.sqrt(n))**2 == n:
        return LA.matrix_power(f(mat, int(math.sqrt(n))), 2)

    return mat.dot(f(mat, n-1))



N, M = tuple(map(int, input().split(' ')))

mat = np.identity(N)
res = np.zeros(N)

for m in range(M):
    a, b = tuple(map(int, input().split(' ')))
    mat[a-1, b-1] = 1
    mat[b-1, a-1] = 1
    mat[a-1, a-1] = 1
    mat[b-1, b-1] = 1

Q = int(input())

for q in range(Q):
    v, d, c = tuple(map(int, input().split(' ')))
    x = f(mat, d)
    res[x[v-1,:] > 0] = c


for i in range(N):
    print(int(res[i]))

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


N = int(input())
a = list(map(int, input().split(' ')))
a.sort()

x = []
for n in range(N):
    x.append([])
    for i in range(3):
        x[n].append(0)

for i in range(N*3):
    x[i % N][i // N] = a[i]

for i in range(N-1, -1, -1):
    for j in range(i-1, -1, -1):
        if x[i][1] == x[j][1] and [j][2] < x[i][1] and x[i][2] > x[j][2]:
            x[j][2], x[i][1] = x[i][1], x[j][2]
            break
        else:
            break


res = 0

for n in range(N):
    res += x[n][1]

print(res)
Problem p03209 (python)

Fixed submission:
#!/usr/bin/env python3

def calc(N, X):
    if X == 0:
        return 0
    elif X == 2 ** (N + 2) - 3:
        return 2 ** (N + 1) - 1

    Y = 2 ** (N + 1) - 1
    if X == Y:
        return 2 ** N
    elif X == Y - 1:
        return 2 ** N - 1
    elif X < Y - 1:
        return calc(N - 1, X - 1)
    else:
        return 2 ** (N + 1) - 1 - calc(N - 1, 2 ** (N + 2) - 4 - X)

def main():
    [N, X] = list(map(int, input().split()))

    r = calc(N, X)


    print(r)


if __name__ == '__main__':
    main()

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

def calc(N, X):
    if X == 0:
        return 0

    Y = 2 ** (N + 1) - 1
    if X == Y:
        return 2 ** N
    elif X == Y - 1:
        return 2 ** N - 1
    elif X < Y - 1:
        return calc(N - 1, X - 1)
    else:
        return 2 ** (N + 1) - 1 - calc(N - 1, 2 ** (N + 2) - 4 - X)

def main():
    [N, X] = list(map(int, input().split()))

    r = calc(N, X)


    print(r)


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

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

print(t/x)

Buggy submission (verdict: Runtime Error):
t, x = list(map(int, input()))

print(t/x)
Problem p03295 (python)

Fixed submission:
import heapq


def solve(N, M, a, b):
    q = []
    ret = 0
    conditions = sorted([(b[i], a[i]) for i in range(M)], key = lambda x: x[1])
    ci = 0
    for i in range(N+1):
        while ci < len(conditions) and i == conditions[ci][1]:
            heapq.heappush(q, conditions[ci])
            ci += 1
        if len(q) > 0 and i == q[0][0]-1:
            ret += 1
            q = []
    return ret





def main():
    N, M = list(map(int, input().split(' ')))
    a = []
    b = []
    for i in range(M):
        ai, bi = list(map(int, input().split(' ')))
        a.append(ai)
        b.append(bi)

    print(solve(N, M, a, b))



if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
from typing import List
from preconditions import preconditions
import heapq


def solve(N: int, M: int, a: List[int], b: List[int]) -> int:
    q = []
    ret = 0
    conditions = sorted([(b[i], a[i]) for i in range(M)], key = lambda x: x[1])
    ci = 0
    for i in range(N+1):
        while ci < len(conditions) and i == conditions[ci][1]:
            heapq.heappush(q, conditions[ci])
            ci += 1
        if len(q) > 0 and i == q[0][0]-1:
            ret += 1
            q = []
    return ret





def main():
    N, M = list(map(int, input().split(' ')))
    a = []
    b = []
    for i in range(M):
        ai, bi = list(map(int, input().split(' ')))
        a.append(ai)
        b.append(bi)

    print(solve(N, M, a, b))



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

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

Buggy submission (verdict: Runtime Error):
n = input
ans = ''
for i in range(len(n)):
    if n[i] == '1':
        ans += '9'
    else :
        ans += '1'
print(ans)

Buggy submission (verdict: Runtime Error):
n = input
ans - ''
for i in range(len(n)):
    if n[i] == '1':
        ans += '9'
    else :
        ans += '1'
print(ans)

Buggy submission (verdict: Runtime Error):
n = input
ans - ''
for i in range(len(n)):
    if n[i] == '1':
        ans += '9'
    else ans += '1'
print(ans)
Problem p03250 (python)

Fixed submission:
num = list(map(int,input().split()))
num.sort()
ans = num[2]*10 + num[1] + num[0]
print(ans)

Buggy submission (verdict: Runtime Error):
import math

N,X = map(int,input().split())
x = list(map(int,input().split()))
if N == 1:
    print(abs(x[0] - X))
else:
    xlen = [abs(x[0]-X)]
    for i in range(N-1):
        xlen.append(x[i+1]- x[i])
    ans = xlen[0]
    for i in range(N-2):
        ans = math.gcd(ans,xlen[i+1])
    print(ans)
Problem p03775 (python)

Fixed submission:
N=int(input())
a=[]
for i in range(1,int(N**(0.5)+1)):
    if N%i==0:
        a.append(max(len(str(i)),len(str(N//i))))
print(min(a))

Buggy submission (verdict: Runtime Error):
N=int(input())
a=[]
for i in range(1,int(N**(0.5))):
    if N%i==0:
        a.append(max(len(str(i)),len(str(N//i))))
print(min(a))
Problem p03785 (python)

Fixed submission:
N,C,K=map(int,input().split())
A=[]
for i in range(N):
    a=int(input())
    A.append(a)
A.sort()
k=K
a=0
c=C-1
j=1
while j<N:
    k-=A[j]-A[j-1]
    c-=1
    if k>=0 and c>=0:    
        j+=1
    else:     
        a+=1
        c=C-1
        k=K
        j+=1
print(a+1)

Buggy submission (verdict: Runtime Error):
N,C,K=map(int,input().split())
A=[]
for i in range(N):
    a=int(input())
    A.append(a)
A.sort()
k=K
a=0
c=C
j=1
while j<N:
    k-=A[j]-A[j-1]
    n-=1
    if k>0 and c>0:    
        j+=1
    else:     
        a+=1
        c=C
        k=K
        j+=1
print(a+1)

Buggy submission (verdict: Runtime Error):
N,C,K=map(int,input().split())
A=[]
for i in range(N):
    a=int(input())
    A.append(a)
A.sort()
k=K
a=0
c=C
j=1
while j<N:
    k-=A[j]-A[j-1]
    n-=1
    if k>0 and c>0:    
        j+=1
    else:     
        a+=1
        c=C
        k=K
        j+=1
print(a+1)
Problem p03986 (python)

Fixed submission:
S=input()
t=0
u=0
for i in range(len(S)):
    if S[i]=="S":
        t+=1
    else:
        if t>=1:
            u+=2
            t-=1
print(len(S)-u)

Buggy submission (verdict: Runtime Error):
S=list(input())
i=0
while 0<=i<=len(S)-2:
    if S[i]=="S":
        if S[i+1]=="T":
            S.remove(S[i])
            S.remove(S[i])
            i=0
        if S[i+1]=="S":
            i+=1
    if S[i]=="T":
        i+=1
print(len(S))

Buggy submission (verdict: Runtime Error):
S=list(input())
i=0
while 0<=i<=len(S)-2:
    if S[i]=="S":
        if S[i+1]=="T":
            S.remove(S[i])
            S.remove(S[i])
        if S[i+1]=="S":
            i+=1
    if S[i]=="T":
        i+=1
while 0<=i<=len(S)-2:
    if S[i]=="S":
        if S[i+1]=="T":
            S.remove(S[i])
            S.remove(S[i])
            i=0
        if S[i+1]=="S":
            i+=1
    if S[i]=="T":
        i+=1
print(len(S))

Buggy submission (verdict: Runtime Error):
S=list(input())
i=0
while 0<=i<=len(S)-1:
    if S[i]=="S":
        if S[i+1]=="T":
            S.remove(S[i])
            S.remove(S[i])
            i-=1
        else:
            i+=1
    else:
        i+=1
print(len(S))

Buggy submission (verdict: Runtime Error):
S=list(input())
i=0
while 0<=i<=len(S)-1:
    if S[i]=="S":
        if S[i+1]=="T":
            S.remove(S[i])
            S.remove(S[i])
            i=0
        else:
            i+=1
    else:
        i+=1
print(len(S))
Problem p03107 (python)

Fixed submission:
S = input()
num_0 = list(S).count('0')
num_1 = list(S).count('1')
print(len(S) - abs(num_0 - num_1))

Buggy submission (verdict: Runtime Error):
import numpy as np
S = input()
u, counts = np.unique(list(S),return_counts=True)
result = 0 if len(u) == 1 else len(S) - abs(counts[0]-counts[1])
print(result)