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

Fixed submission:
S = input()

def mySort(S):
    if 'a' not in S:
        return 'No'
    elif 'b' not in S:
        return 'No'
    elif 'c' not in S:
        return 'No'
    else:
        return 'Yes'
    
print(mySort(S))

Buggy submission (verdict: Runtime Error):
def mySort(S):
    if 'a' not in S:
        return 'No'
    elif 'b' not in S:
        return 'No'
    elif 'c' not in S:
        return 'No'
    else:
        return 'Yes'
    
mySort(S)

Buggy submission (verdict: Runtime Error):
def mySort(arg1):
    if 'a' not in S:
        return 'No'
    elif 'b' not in S:
        return 'No'
    elif 'c' not in S:
        return 'No'
    else:
        return 'Yes'
    
mySort(S)
Problem p03386 (python)

Fixed submission:
import sys

#A = input('Aを入力してください')
#B = input('Bを入力してください')
#K = input('Cを入力してください')
#print('A= ', A)
#print('B= ', B)
#print('K= ', K)

#A = 1
#B = 10
#K = 6

#S = input('ABKを入力してください')
S = input()
S = S.split(' ')

#for i in range(len(S)):
#    print(S[i])

#sys.exit()

A = int(S[0])
B = int(S[1])
K = int(S[2])

ANS = []
for i in range(K):
    if A + i <= B:
        ANS.append(A + i)


for j in range(K):
    if B - j not in ANS and B - j >= A:
        ANS.append(B - j)

ANS.sort()

#print(ANS)

for i in range(len(ANS)):
    print(ANS[i])

Buggy submission (verdict: Runtime Error):
#A = input('Aを入力してください')
#B = input('Bを入力してください')
#K = input('Cを入力してください')
#print('A= ', A)
#print('B= ', B)
#print('K= ', K)

#A = 1
#B = 10
#K = 6

S = input()
S = S.split(' ')

#for i in range(len(S)):
#    print(S[i])

A = S[0]
B = S[1]
K = S[2]

ANS = []

for i in range(K + 1):
    ANS.append(A + i)


for j in range(K + 1):
    if B - j not in ANS:
        ANS.append(B - j)

ANS.sort()

#print(ANS)

for i in range(len(ANS)):
    print(ANS[i])

Buggy submission (verdict: Runtime Error):
#A = input('Aを入力してください')
#B = input('Bを入力してください')
#K = input('Cを入力してください')
#print('A= ', A)
#print('B= ', B)
#print('K= ', K)

#A = 1
#B = 10
#K = 6

S = input()
S = S.split(' ')

for i in range(len(S)):
    print(S[i])

A = S[0]
B = S[1]
K = S[2]

ANS = []

for i in range(K + 1):
    ANS.append(A + i)


for j in range(K + 1):
    if B - j not in ANS:
        ANS.append(B - j)

ANS.sort()

#print(ANS)

for i in range(len(ANS)):
    print(ANS[i])

Buggy submission (verdict: Runtime Error):
#A = input('Aを入力してください')
#B = input('Bを入力してください')
#K = input('Cを入力してください')
#print('A= ', A)
#print('B= ', B)
#print('K= ', K)

#A = 1
#B = 10
#K = 6

S = input()

A = S[0]
B = S[1]
K = S[2]

ANS = []

for i in range(K + 1):
    ANS.append(A + i)


for j in range(K + 1):
    if B - j not in ANS:
        ANS.append(B - j)

ANS.sort()

#print(ANS)

for i in range(len(ANS)):
    print(ANS[i])

Buggy submission (verdict: Runtime Error):
A = input('Aを入力してください')
B = input('Bを入力してください')
K = input('Cを入力してください')
#print('A= ', A)
#print('B= ', B)
#print('K= ', K)

#A = 1
#B = 10
#K = 6

ANS = []

for i in range(K + 1):
    ANS.append(A + i)


for j in range(K + 1):
    if B - j not in ANS:
        ANS.append(B - j)

ANS.sort()

#print(ANS)

for i in range(len(ANS)):
    print(ANS[i])

Buggy submission (verdict: Runtime Error):
A = input('Aを入力してください')
B = input('Bを入力してください')
K = input('Cを入力してください')
#print('A= ', A)
#print('B= ', B)
#print('K= ', K)

#A = 1
#B = 10
#K = 6

ANS = []

for i in range(K + 1):
    ANS.append(A + i)


for j in range(K + 1):
    if B - j not in ANS:
        ANS.append(B - j)

ANS.sort()

#print(ANS)

for i in range(len(ANS)):
#    print(ANS[i])

Buggy submission (verdict: Runtime Error):
A = input('Aを入力してください')
B = input('Bを入力してください')
K = input('Cを入力してください')
#print('A= ', A)
#print('B= ', B)
#print('K= ', K)

#A = 1
#B = 10
#K = 6

ANS = []

for i in range(K + 1):
    ANS.append(A + i)


for j in range(K + 1):
    if B - j not in ANS:
        ANS.append(B - j)

ANS.sort()

print(ANS)

#for i in range(len(ANS)):
#    print(ANS[i])
Problem p03599 (python)

Fixed submission:
A, B, C, D, E, F = map(int, input().split())

best = -1.0
a = ws = sg = 0

while 100 * a * A <= F:
    b = 0
    while True:
        w = 100 * (a * A + b * B)
        if w > F: break
        c = 0
        while w + c * C <= F and 100 * c * C <= w * E:
            d = 0
            while True:
                s = c * C + d * D
                if w + s > F or 100 * s > w * E:
                    break
                elif w + s != 0 and best < s / (w + s):
                    best = s / (w + s)
                    ws = w + s
                    sg = s
                d += 1
            c += 1
        b += 1
    a += 1
print(ws, sg)

Buggy submission (verdict: Runtime Error):
import strutils

proc input: string =
  while true:
    let tmp = readChar stdin
    if not isSpace tmp:
      safeAdd result, tmp
    elif tmp != '\r': break

let
  A, B, C, D, E, F = parseInt input()
var
  best = -1.0
  ws, sg = 0

for a in countup(0, F, 100 * A):
  for b in countup(0, F - a, 100 * B):
    let
      w = a + b
      m = min(F - w, w * E div 100)

    if w == 0: continue
    for c in countup(0, m, C):
      for d in countup(0, m - c, D):
        let s = c + d
        if best < s / (w + s):
          best = s / (w + s)
          ws = w + s
          sg = s

echo ws, " ", sg
Problem p03778 (python)

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

if a < b:
    print(max(0, b - (a + W)))
else:
    print(max(0, a - (b + W)))

Buggy submission (verdict: Runtime Error):
from sys import stdin


def main() -> int:
    global W
    W = next_int()
    a, b = map(int, input())

    if b + W < a:
        ans = diff(b + W, a)
    elif a + W < b:
        ans = diff(a + W, b)
    else:
        ans = 0

    print(ans)
    return 0


def diff(a: int, b: int) -> int:
    return abs(a - b)


def next_int() -> int:
    return int(next_str())


def next_str() -> str:
    result = ""
    while True:
        tmp = stdin.read(1)
        if tmp.strip() != "":
            result += tmp
        elif tmp != '\r':
            break
    return result


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

Fixed submission:
import math

def gcd(a,b):
    """Compute the greatest common divisor of a and b"""
    while b > 0:
        a, b = b, a % b
    return a

def lcm(a, b):
    """Compute the lowest common multiple of a and b"""
    return a * b / gcd(a, b)


def best_alignment(lst, small):

	ans = 0

	p = []

	if(small):
		p.append(lst[-1])
		p.append(lst[-1])
		del lst[-1:]
	else:
		m = min(lst)
		p.append(lst[0])
		p.append(lst[0])
		lst.pop(0)


	while(len(lst)>0):

		if(small):
			ans = ans + abs(max(p)-lst[0])
			if(len(lst)==1):
				break

			ans = ans + abs(min(p)-lst[1])

			p = []
			p.append(lst.pop(0))
			p.append(lst.pop(0))
			small = False
			continue
		else:
			ans = ans + abs(min(p)-lst[-1])
			if(len(lst)==1):
				break

			ans = ans + abs(max(p)-lst[-2])

			p = []
			p.append(lst[-1])
			p.append(lst[-2])
			del lst[-2:]
			small = True
			continue

	return ans	




N = int(input().strip())
A = []
for i in range(N):
	A.append(int(input().strip()))

A.sort()
A_=A.copy()

print(max(best_alignment(A, True), best_alignment(A_, False)))

Buggy submission (verdict: Runtime Error):
import math

def gcd(a,b):
    """Compute the greatest common divisor of a and b"""
    while b > 0:
        a, b = b, a % b
    return a

def lcm(a, b):
    """Compute the lowest common multiple of a and b"""
    return a * b / gcd(a, b)


def best_alignment(lst, small):

	ans = 0

	p = []

	if(small):
		p.append(lst[-1])
		p.append(lst[-1])
		del lst[-1:]
	else:
		m = min(lst)
		p.append(lst[0])
		p.append(lst[0])
		lst.pop(0)


	while(len(lst)>0):

		print(small)
		print(lst)
		print(p)
		print(ans)
		print("")

		if(small):
			ans = ans + abs(max(p)-lst[0])
			if(len(lst)==1):
				break

			ans = ans + abs(min(p)-lst[1])

			p = []
			p.append(lst.pop(0))
			p.append(lst.pop(0))
			small = False
			continue
		else:
			ans = ans + abs(min(p)-lst[-1])
			if(len(lst)==1):
				break

			ans = ans + abs(max(p)-lst[-2])

			p = []
			p.append(lst[-1])
			p.append(lst[-2])
			del lst[-2:]
			small = True
			continue

	return ans	




N = int(input().strip())
A = []
for i in range(N):
	A.append(int(input().strip()))

A.sort()
A_=A.copy()

print(max(best_alignment(A, True), best_alignment(A_, False)))
Problem p03244 (python)

Fixed submission:
import operator

n=int(input().strip())
lst=input().split(' ')
map(int, lst)

d1 = {}
d2 = {}

for i in range(len(lst)):
    if i % 2 == 0:
        if lst[i] in d1:
            d1[lst[i]] += 1
        else:
            d1[lst[i]] = 1
    else:
        if lst[i] in d2:
            d2[lst[i]] += 1
        else:
            d2[lst[i]] = 1

sd1 = sorted(d1.values(), reverse=True)
sd2 = sorted(d2.values(), reverse=True)
key1 = max(d1.items(), key=operator.itemgetter(1))[0]
key2 = max(d2.items(), key=operator.itemgetter(1))[0]

if(key1 == key2):

    v11 = sd1[0]
    if(len(d1) == 1):
        v12 = 0
    else:
        v12 = sd1[1]

    v21 = sd2[0]
    if(len(d2) == 1):
        v22 = 0
    else:
        v22 = sd2[1]

    print(min(n-v11-v22, n-v12-v21))

else:
    print(n-sd1[0]-sd2[0])

Buggy submission (verdict: Runtime Error):
import operator

n=int(input().strip())
lst=input().split(' ')
map(int, lst)

d1 = {}
d2 = {}

for i in range(len(lst)):
    if i % 2 == 0:
        if lst[i] in d1:
            d1[lst[i]] += 1
        else:
            d1[lst[i]] = 1
    else:
        if lst[i] in d2:
            d2[lst[i]] += 1
        else:
            d2[lst[i]] = 1

sd1 = sorted(d1.values(), reverse=True)
sd2 = sorted(d2.values(), reverse=True)
key1 = max(d1.items(), key=operator.itemgetter(1))[0]
key2 = max(d2.items(), key=operator.itemgetter(1))[0]

if(key1 == key2):

    v11 = sd1[0]
    if(len(d1) == 1):
        v12 = 0
    else:
        v12 = sd1[1]

    v21 = sd2[0]
    if(len(d2) == 1):
        v22 = 0
    else:
        v22 = sd2[1]

    print(min(n-v11-v22, n-v12-v21))

else:
    print(n-sd1[0]-sd2[key2])
Problem p03284 (python)

Fixed submission:
result = 0

N, K=map(int,input().strip().split(' '))

if N % K != 0:
  result = 1

print(result)

Buggy submission (verdict: Runtime Error):
result = 0

N, K=map(int,input().strip().split(' '))

if N mod K != 0:
  result = 1

print(result)
Problem p04014 (python)

Fixed submission:
import math

def gcd(a,b):
    """Compute the greatest common divisor of a and b"""
    while b > 0:
        a, b = b, a % b
    return a
 
def lcm(a, b):
    """Compute the lowest common multiple of a and b"""
    return a * b / gcd(a, b)
 

def f(b,n):
	if n < b:
		return n
	return f(b, n//b) + n%b
 
N = int(input())
S = int(input())

if N == S:
	print(N+1)
	exit()

if N < S:
	print(-1)
	exit()

for B in range(2, int(math.sqrt(N))+1):
	if(f(B,N)==S):
		print(B)
		exit()


for p in range(int(math.sqrt(N))+1, 0, -1):
	B = (N-S)/p + 1
	if(B==int(B) and f(int(B),N)==S):
		print(int(B))
		exit()


print(-1)

Buggy submission (verdict: Runtime Error):
import math

def gcd(a,b):
    """Compute the greatest common divisor of a and b"""
    while b > 0:
        a, b = b, a % b
    return a
 
def lcm(a, b):
    """Compute the lowest common multiple of a and b"""
    return a * b / gcd(a, b)
 

def f(b,n):
	if n < b:
		return n
	return f(b, n//b) + n%b
 
N = int(input())
S = int(input())

if N == S:
	print(N+1)
	exit()

if N < S:
	print(-1)
	exit()

for B in range(2, int(math.sqrt(N))+1):
	if(f(B,N)==S):
		print(B)
		exit()


for p in range(0,int(math.sqrt(N))):
	B = (N-S)/p + 1
	if(B==int(B) and f(int(B),N)==S):
		print(B)
		exit()


print(-1)
Problem p03436 (python)

Fixed submission:
import array
import itertools
from collections import defaultdict, deque


def log(s):
    # print("| " + str(s), file=sys.stderr)
    pass


def output(x):
    print(x, flush=True)


def input_ints():
    return map(int, input().split())


def solve():
    def find_path(p0, p1):
        queue = deque()
        footsteps = dict()

        queue.append((p0, 0))

        while queue:
            p, s = queue.popleft()
            footsteps[p] = s

            if p == p1:
                return s

            for pp in [(p[0] + 1, p[1]), (p[0] - 1, p[1]), (p[0], p[1] + 1), (p[0], p[1] - 1)]:
                if 0 <= pp[0] < width and 0 <= pp[1] < height and field[pp[1]][pp[0]] == '.' and pp not in footsteps:
                    queue.append((pp, s + 1))
                    footsteps[pp] = -1  # placeholder

        return -1

    height, width = tuple(input_ints())
    field = [input() for _ in range(height)]

    s = find_path((0, 0), (width - 1, height - 1))

    if s < 0:
        return -1
    else:
        return "".join(field).count(".") - (s + 1)


def main():
    print(solve())


main()

Buggy submission (verdict: Runtime Error):
import array
import itertools
from collections import defaultdict, deque


def log(s):
    # print("| " + str(s), file=sys.stderr)
    pass


def output(x):
    print(x, flush=True)


def input_ints():
    return map(int, input().split())


def solve():
    def find_path(p0, p1):
        queue = deque()
        footsteps = dict()

        queue.append((p0, 0))

        while queue:
            p, s = queue.popleft()
            footsteps[p] = s

            if p == p1:
                return s

            for pp in [(p[0] + 1, p[1]), (p[0] - 1, p[1]), (p[0], p[1] + 1), (p[0], p[1] - 1)]:
                if 0 <= pp[0] < width and 0 <= pp[1] < height and field[pp[1]][pp[0]] == '.' and pp not in footsteps:
                    queue.append((pp, s + 1))
                    footsteps[pp] = -1  # placeholder

    height, width = tuple(input_ints())
    field = [input() for _ in range(height)]

    s = find_path((0, 0), (width - 1, height - 1))

    return "".join(field).count(".") - (s + 1)


def main():
    print(solve())


main()
Problem p02639 (python)

Fixed submission:
x = list(map(int, input().split()))
for i in range(5):
    if x[i] == 0:
        print(i+1)
        exit()

Buggy submission (verdict: Runtime Error):
N = int(input())
A = sorted(map(int, input().split()), reverse=False)
dp = [0] * (max(A)+1)

for i in range(N):
    if dp[A[i]] == 0:
        dp[A[i]] = 1
        for j in range(i+1, N):
            if A[j] != 2 and A[j] % A[i] == 0:
                dp[A[j]] = 2
print(dp.count(1))
Problem p02642 (python)

Fixed submission:
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
c = Counter(a)
p = [True] * (10 ** 6 + 1)
s = list(set(a))
for x in s:
    t = x * 2
    while t <= 10 ** 6:
        p[t] = False
        t += x
ans = 0
for x in a:
    if c[x] == 1 and p[x] == True:
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = sorted(list(set(list(map(int, input().split())))), reverse=True)
count = 0
for i in range(N):
    for j in range(N-1, i-1, -1):
        if i != j and A[i] % A[j] == 0:
            break
        if j == i:
            count += 1
    if i == N-1 and A[N-1] in A[:N-1]:
        count -= 1
print(count)
Problem p02665 (python)

Fixed submission:
N = int(input())
A_leaf = list(map(int, input().split()))
if N == 0:
    print(1 if A_leaf[0] == 1 else -1)
    exit()
s = [0]*(N+2)
for i in range(1, N+2):
    s[i] = s[i-1] + A_leaf[i-1]
node = [1]*(N+1)
for i in range(1, N+1):
    node[i] = min((node[i-1] - A_leaf[i-1])*2, s[N+1]-s[i])
    if node[i] < A_leaf[i]:
        print(-1)
        exit()
else:
    print(sum(node))

Buggy submission (verdict: Runtime Error):
N = int(input())
    A = list(map(int, input().split()))
    s = [0] * (N + 2)
    for i in range(N + 1):
        s[i + 1] = s[i] + A[i]
    node, leaf = 1, 1
    for d in range(1, N + 1):
        if leaf < A[d]:
            print(-1)
            break
        leaf = min((leaf - A[d - 1]) * 2, s[N + 1] - s[d])
        if leaf < A[d]:
            print(-1)
            break
        node += leaf
    else:
        print(node)
Problem p03373 (python)

Fixed submission:
A, B, C, X, Y = map(int, input().split())
cost = A*X + B*Y
new_cost = cost
plus = 0
for i in range(1, max(X, Y)+1):
  if i <= min(X, Y):
    plus = - A - B + 2*C
  else:
    plus = -A + 2*C if X > Y else -B + 2*C
  if plus < 0:
    new_cost += plus
  else:
    break
print(new_cost)

Buggy submission (verdict: Runtime Error):
A, B, C, X, Y = map(int, input().split())
not_in_C = A*X + B*Y
if X > Y:
  cost = 2 * C * Y 
  if A < C:
    cost += A * (X - Y)
  else:
    cost += 2 * C * (X - Y)
elif X < Y
  cost = 2 * C * X
  if B < C:
    cost += B * (Y - X)
  else:
    cost += 2 * C * (Y - X)
elif X == Y:
  cost = 2 * C * Y
print(min(not_in_C, cost))

Buggy submission (verdict: Runtime Error):
A, B, C, X, Y = map(int, input().split())
not_in_C = A*X + B*Y
if X > Y:
  cost = 2 * C * Y 
  if A < C:
    cost += A * (X - Y)
  else:
    cost += 2 * C * (X - Y)
elif X < Y:
  cost = 2 * C * X
  if B < C:
    cost += B * (Y - X)
  else:
    cost += 2 * C * (Y - X)
print(min(not_in_C, cost))

Buggy submission (verdict: Runtime Error):
A, B, C, X, Y = map(int, input().split())
not_in_C = A*X + B*Y
if X > Y:
  cost = 2 * C * Y 
  if A < C:
    cost += A * (X - Y)
  else:
    cost += 2 * C * (X - Y)
elif X < Y
  cost = 2 * C * X
  if B < C:
    cost += B * (Y - X)
  else:
    cost += 2 * C * (Y - X)
print(min(not_in_C, cost))
Problem p03636 (python)

Fixed submission:
s = input()
print(s[0], len(s) - 2, s[-1], sep="")

Buggy submission (verdict: Runtime Error):
s = input()
print(f"{s[0]}{len(s) - 2}{s[-1]}")
Problem p03282 (python)

Fixed submission:
from fractions import gcd
from sys import stdin
import math 
S = str(input())
K = int(input())
ans = 1

for itr in range(100):
    if S[itr] != '1':
        ans = int(S[itr])  
        break
    if itr+1 == K:
        break

print(ans)

Buggy submission (verdict: Runtime Error):
from fractions import gcd
from sys import stdin
import math 
S = str(input())
K = int(input())
ans = 1

for itr in range(100):
    if S[itr] != '1':
        ans = int(S[itr])  
        break
    if itr == K:
        break

print(ans)
Problem p03296 (python)

Fixed submission:
from sys import stdin
data = [stdin.readline().rstrip().split() for _ in range(2)]
count = 0
i = 0
while i + count+ 1 < int(data[0][0]):
    if (data[1][i + count+ 1] == data[1][i + count]):
        count = count + 1
    i = i + 1
print(count)

Buggy submission (verdict: Runtime Error):
from sys import stdin
import math
columns = int(stdin.readline().rstrip())
datas = [stdin.readline().rstrip().split() for _ in range(columns)]
for data in datas:
    A = int(data[0])
    B = int(data[1])
    C = int(data[2])
    D = int(data[3])
    if A < B:
        print("No")
        continue
    if D < B:
        print("No")
        continue
    if C > B:
        print("Yes")
        continue
    g = math.gcd(B,D)
    if (B - g + A % g) >C :
        print("No")
    else:
        print("Yes")
Problem p03297 (python)

Fixed submission:
from sys import stdin
from fractions import gcd
columns = int(stdin.readline().rstrip())
datas = [stdin.readline().rstrip().split() for _ in range(columns)]
for data in datas:
    A = int(data[0])
    B = int(data[1])
    C = int(data[2])
    D = int(data[3])
    if A < B:
        print("No")
        continue
    if D < B:
        print("No")
        continue
    if C > B:
        print("Yes")
        continue
    g = gcd(B,D)
    if (B - g + A % g) >C :
        print("No")
    else:
        print("Yes")

Buggy submission (verdict: Runtime Error):
from sys import stdin
import math
columns = int(stdin.readline().rstrip())
datas = [stdin.readline().rstrip().split() for _ in range(columns)]
for data in datas:
    A = int(data[0])
    B = int(data[1])
    C = int(data[2])
    D = int(data[3])
    if A < B:
        print("No")
        continue
    if D < B:
        print("No")
        continue
    if C > B:
        print("Yes")
        continue
    g = math.gcd(B,D)
    if (B - g + A % g) >C :
        print("No")
    else:
        print("Yes")

Buggy submission (verdict: Runtime Error):
from sys import stdin
import math
colomns = int(stdin.readline().rstrip())
datas = [stdin.readline().rstrip().split() for _ in range(1,colomns+1,1)]
for data in datas:
    A = int(data[0])
    B = int(data[1])
    C = int(data[2])
    D = int(data[3])
    if A < B:
        print("No")
        continue
    if D < B:
        print("No")
        continue
    if C > B:
        print("Yes")
        continue
    g = math.gcd(B,D)
    if (B - g + A % g) >C :
        print("No")
    else:
        print("Yes")
Problem p02628 (python)

Fixed submission:
n, k = [int(j) for j in input().split(' ')]
p = [int(j) for j in input().split(' ')]
 
p.sort()
sum = 0
 
for i in range(0,k):
  sum+=p[i]
  
print(sum)

Buggy submission (verdict: Runtime Error):
n, k = [int(j) for j in input().split(' ')]
p = input().split(' ')
 
p.sort()
sum = 0
 
for i in range(0,k):
  sum+=int(p[i])
  
return sum

Buggy submission (verdict: Runtime Error):
n, k = [int(j) for j in input().split(' ')]
p = input().split(' ')

p.sort()
sum = 0

for i in range(0,k):
  sum+=p[i]
  
print(sum)
Problem p02630 (python)

Fixed submission:
nb=int(input())
liste = [int(x) for x in input().split()]
liste2= [0]*((10**5)+1)
for loop in range(len(liste)):
  liste2[liste[loop]] +=1
nba = int(input())
somme = sum(liste)
for loop in range(nba):
  n,r = map(int,input().split())
  roger = liste2[n]
  diff = r-n
  somme += diff * roger
  liste2[r] += liste2[n]
  liste2[n] = 0
  print(somme)

Buggy submission (verdict: Runtime Error):
nb=int(input())
liste = [int(x) for x in input().split()]
liste2= [0]*(10**5)
for loop in range(len(liste)):
  liste2[liste[loop]] = liste.count(liste[loop])
nba = int(input())
somme = sum(liste)
for loop in range(nba):
  n,r = map(int,input().split())
  roger = liste2[n]
  for loop in range(len(liste)):
    if liste[loop]==n:
      liste[loop] = r
  diff = r-n
  somme += diff * roger
  liste2[r] += liste2[n]
  liste2[n] = 0
  print(somme)
Problem p02705 (python)

Fixed submission:
import math
x = input()

# 円の周を計算する
def circle_round(radius):
  return 2 * math.pi * radius

if __name__ == '__main__':
  print(circle_round(int(x)))

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

for num in range(x):
    print(A.count(num+1))
Problem p03644 (python)

Fixed submission:
n = int(input())
precount = 0
if n==1:
    ans = 1
for i in range(1, n+1):
    tmp = i
    flag = 1
    count = 0
    while flag :
        flag = 0
        if i%2 == 0:
            i = i//2
            flag = 1
            count += 1
    if precount < count :
        precount = count
        ans = tmp
        
    
            

print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
precount = 0
for i in range(1, n+1):
    tmp = i
    flag = 1
    count = 0
    while flag :
        flag = 0
        if i%2 == 0:
            i = i//2
            flag = 1
            count += 1
    if precount < count :
        precount = count
        ans = tmp
        
    
            

print(ans)
Problem p03693 (python)

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

Buggy submission (verdict: Runtime Error):
r, g, b = map(int, input().split())
a = str(r) + str(g) + str(b)
if a%4 == 0:
    print("YES")
else:
    print("NO")
Problem p02628 (python)

Fixed submission:
N, K = map(int, input().split()) 
A = list(map(int, input().split()))
A.sort()
print(sum(A[0:K]))

Buggy submission (verdict: Runtime Error):
N = int(input())
K = int(input())
A = list(map(int, input().split()))
A.sort()
print(sum(A[0:K]))

Buggy submission (verdict: Runtime Error):
N = int(input())
K = int(input())
A = list(map(int, input().split()))
print(sum(A.sort()[0:K]))
Problem p03633 (python)

Fixed submission:
from fractions import gcd
def lcm(x, y):
    return (x * y) // gcd(x, y)

N = int(input())
ans = 1

for i in range(N):
    tmp = int(input())
    ans = lcm(ans, tmp)

print(ans)

Buggy submission (verdict: Runtime Error):
import math

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

N = int(input())
ans = 1

for i in range(N):
    tmp = int(input())
    ans = lcm(ans, tmp)

print(ans)