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

Fixed submission:
N, M = map(int, input().split())
a_data = input()
a = a_data.split(' ')

sum = 0
# sum = sum(a)
for item in a:
  sum += int(item)

if sum > N:
  print(-1)
else:
  print(N-sum)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
a_data = input()
a = a_data.split(' ')

sum = 0
# sum = sum(a)
for item as a:
  sum += int(item)

if sum > N:
  print(-1)
else:
  print(N-sum)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
a_data = input()
a = a_data.split(' ')

sum = sum(a)

if sum > N:
  print(-1)
else:
  print(N-sum)
Problem p02741 (python)

Fixed submission:
seq = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(seq[int(input()) - 1])

Buggy submission (verdict: Runtime Error):
seq = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(seq[int(input())])
Problem p03316 (python)

Fixed submission:
def sum_digits(n):
    s = 0
    while n:
        s += n % 10
        n //= 10
    return s


num = int(input())
if num % sum_digits(num) == 0:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
def sum_digits(n):
    s = 0
    while n:
        s += n % 10
        n //= 10
    return s


while True:
    num = int(input())
    if num % sum_digits(num) == 0:
        print('Yes')
    else:
        print('No')
Problem p02743 (python)

Fixed submission:
import math
 
a,b,c = map(int,input().split())
 
if( a*a + b*b + c*c > 2*(a*b + a*c + b*c) and c-(a+b) > 0 ):
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
import math
 
a,b,c = map(int,input().split())
 
if( a*a + b*b + c*c > 2*(a*b + a*c + b*c) && c-(a+b) > 0 ):
  print('Yes')
else:
  print('No')

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

if(a*a + b*b + c*c > 2*(a*b + a*c + b*c && c-(a+b) > 0)):
  print('Yes')
else:
  print('No')

print(a*a + b*b + c*c)
print(2*(a*b + a*c + b*c))
Problem p02664 (python)

Fixed submission:
T = list(input())
for i in range(len(T)):
    if T[i] == '?':
        T[i] = 'D'

print(''.join(T))

Buggy submission (verdict: Runtime Error):
import itertools

T = list(input())
location_q = []
Tstr = []
count_D_PD = []

for s in range(len(T)):
    if T[s] == '?':
        location_q.append(s)

for i in itertools.product(['P','D'], repeat=3):
    for j in range(len(location_q)):
        T[location_q[j]] = i[j]
    Tstr.append(''.join(T))
# print(Tstr)

for k in range(len(Tstr)):
    count_D_PD.append(Tstr[k].count('D') + Tstr[k].count('PD'))
# print(count_D_PD)
# print(max(count_D_PD))
# print(count_D_PD.index(max(count_D_PD)))
print(Tstr[count_D_PD.index(max(count_D_PD))])
Problem p02687 (python)

Fixed submission:
from sys import stdin

S = stdin.readline().rstrip()

if S == 'ABC':
    print('ARC')
else:
    print('ABC')

Buggy submission (verdict: Runtime Error):
S = stdin.readline().rstrip()

if S == 'ABC':
    print('ARC')
else:
    print('ABC')
Problem p02853 (python)

Fixed submission:
X, Y = map(int, input().split())

if X == 1 and Y == 1:
    print(1000000)

elif (X == 1 and Y == 2) or (X == 2 and Y == 1):
    print(500000)

elif (X == 1 and Y == 3) or (X == 3 and Y == 1) or (X == 2 and Y == 2):
    print(400000)

elif (X == 1 and Y >= 4) or (X >= 4 and Y == 1) or (X == 2 and Y == 3) or (X == 3 and Y == 2):
    print(300000)

elif (X == 2 and Y >= 4) or (X >= 4 and Y == 2) or (X == 3 and Y == 3):
    print(200000)

elif (X == 3 and Y >= 4) or (X >= 4 and Y == 3):
    print(100000)

else:
    print(0)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
whole_length = sum(A)
middle_length = whole_length / 2
sum_length_before = 0
sum_length = 0
sum = 0
cost_before = abs(sum_length_before - middle_length)
cost_after = abs(sum_length_after - middle_length)

for i in range(N):
    if A[i] < middle_length:
        sum_length_before = sum_length
        sum_length_after += A[i]
        sum = i
    else:
        break

if cost_before >= cost_after:
    print(cost_after)

else:
    print(cost_before)
Problem p02613 (python)

Fixed submission:
n = int(input())
d = {"AC":0,"WA":0,"TLE":0,"RE":0}
for i in range(n):
    s = input()
    d[s] += 1 
    

p = str(d["AC"])
q = str(d["WA"])
r = str(d["TLE"])
s = str(d["RE"])

print("AC x " + p)
print("WA x " + q)
print("TLE x " + r)
print("RE x " + s)

Buggy submission (verdict: Runtime Error):
n = int((
Problem p02658 (python)

Fixed submission:
import sys

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

if 0 in a:
    print(0)
else:
    cur = 1
    for x in a:
        cur *= x
        if cur > 10 ** 18:
            print(-1)
            sys.exit()
    print(cur)

Buggy submission (verdict: Runtime Error):
import sys

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

if 0 in a:
    print(0)
else:
    cur = 1
    for x in a:
        cur *= a
        if cur > 10 ** 18:
            print(-1)
            sys.exit()
        print(cur)

Buggy submission (verdict: Runtime Error):
import sys

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

cur = 1
for x in a:
    cur *= a
    if cur > 10 ** 18:
        print(-1)
        sys.exit()
print(cur)

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

n = int(input())
a_list = []

a_list = list(map(int,input().split()))

result = np.prod(a_list)

if result > 10 ** 18:
    print('-1')
else:
    print(result)
Problem p02681 (python)

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

t = t[:-1]
if s == t:
    print('Yes')
else:
    print('No')

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

t = t[:-1]

if s == t:
    print('Yes')
else:
    print('No1')
Problem p02789 (python)

Fixed submission:
n,m = map(int,input().split())
if n == m:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
p_num = int(input())
p = list(map(int,input().split()))

count = 0
for i in range(p_num):
    for j in range(i+1):
        if p[i] > p[j]:
            break
    else:
        count += 1
        

print(count)
Problem p02791 (python)

Fixed submission:
p_num = int(input())
p = list(map(int,input().split()))

count = 1
min_num = p[0]


for i in p[1:]:
    if i < min_num:
        min_num = i
        count += 1
        

print(count)

Buggy submission (verdict: Runtime Error):
p_num = int(input())
p = list(map(int,input().split()))

count = 1
min = p[0]


for i in p[1:]:
    if i < min_num:
        min_num = i
        count += 1
        

print(count)

Buggy submission (verdict: Runtime Error):
p_num = int(input())
p = list(map(int,input().split()))

count = 1
min = List[0]


for i in List[1:]:
    if i < min_num:
        min_num = i
        count += 1
        

print(count)
Problem p03455 (python)

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

def judge(a,b):
	c = a*b
	if a*b % 2 == 0:
		print('Even')
	else:
		print('Odd')

judge(a,b)

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

def half(n,z):
	existodd = 0
	count = 0
	while True: 
		for i in z:
			if i % 2 != 0:
				existodd = 1

		if existodd:
			print(count)
			break
		
		for i in range(n):		
			z[i] /= 2
		
		count += 1
	
half(n,z)
Problem p02630 (python)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
Q = int(input())
S = [list(map(int, input().split())) for l in range(Q)]

l = [0] * 10**6
tot = 0
for i in range(N) :
    l[A[i]]+=1
    tot += A[i]
for i in range(Q):
    s0 = S[i][0]
    s1 = S[i][1]
    tot += s1 * (l[s0] + l[s1]) - (s0 * l[s0] + s1*l[s1])
    l[s1] += l[s0]
    l[s0] = 0
    print(tot)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
Q = int(input())
S = [list(map(int, input().split())) for l in range(Q)]

l = [0] * 10**5
tot = 0
for i in range(N) :
    l[A[i]]+=1
    tot += A[i]
for i in range(Q):
    s0 = S[i][0]
    s1 = S[i][1]
    tot += s1 * (l[s0] + l[s1]) - (s0 * l[s0] + s1*l[s1])
    l[s1] += l[s0]
    l[s0] = 0
    print(tot)

Buggy submission (verdict: Runtime Error):
l = [0] * 10**5
tot = 0
for i in range(N) :
    l[A[i]]+=1
    tot += A[i]
for i in range(Q):
    s0 = S[i][0]
    s1 = S[i][1]
    tot += s1 * (l[s0] + l[s1]) - (s0 * l[s0] + s1*l[s1])
    l[s1] += l[s0]
    l[s0] = 0
    print(tot)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
Q = int(input())
S = [list(map(int, input().split())) for l in range(Q)]

l = [0] * 10**5
s = set()
for i in range(N) :
    l[A[i]]+=1
    s.add(A[i])
for i in range(Q):
    s0 = S[i][0]
    s1 = S[i][1]
    l[s1] += l[s0]
    try:
        s.remove(s0)
        s.add(s1)
    except :
        pass
    l[s0] = 0
    tot = 0
    for j in s:
        tot += j * l[j]
    print(tot)
Problem p02677 (python)

Fixed submission:
import math
A, B, H, M = map(int, input().split())
sitaH = (H*60+M) / 720 * 2 * math.pi
sitaM =  M/60 * 2 * math.pi

posXH = A * math.cos(sitaH)
posYH = A * math.sin(sitaH)
posXM = B * math.cos(sitaM)
posYM = B * math.sin(sitaM)

delX = posXH - posXM
delY = posYH - posYM

d = (delX*delX + delY*delY)**(1/2)
print(d)

Buggy submission (verdict: Runtime Error):
A, B, H, M = map(int, input().split())
sitaH = (H*60+M) / 720 * 2 * math.pi
sitaM =  M/60 * 2 * math.pi

posXH = A * math.cos(sitaH)
posYH = A * math.sin(sitaH)
posXM = B * math.cos(sitaM)
posYM = B * math.sin(sitaM)

delX = posXH - posXM
delY = posYH - posYM

d = (delX*delX + delY*delY)**(1/2)
print(d)

Buggy submission (verdict: Runtime Error):
sitaH = (H*60+M) / 720 * 2 * math.pi
sitaM =  M/60 * 2 * math.pi

posXH = A * math.cos(sitaH)
posYH = A * math.sin(sitaH)
posXM = B * math.cos(sitaM)
posYM = B * math.sin(sitaM)

delX = posXH - posXM
delY = posYH - posYM

d = (delX*delX + delY*delY)**(1/2)
print(d)
Problem p02927 (python)

Fixed submission:
m,d = map(int,input().split(" "))
count = 0
for i in range(1, m+1) :
  for j in range(1, d+1) :
    if j < 10 :
      continue
    str_j = str(j)
    d1, d2 = int(str_j[0]), int(str_j[1])
    if d1 < 2 or d2 < 2 :
    	continue
    temp = d1 * d2
    if temp == i :
      count+=1
print(count)

Buggy submission (verdict: Runtime Error):
m,d = map(int,input())
count = 0
for i in range(m) :
  for j in range(d) :
    if j <11 :
      continue
    str_j = str(j)
    temp = int(str_j[0]) * int(str_j[1])
    if temp == i :
      count+=1
print(count)
Problem p03106 (python)

Fixed submission:

A,B,K  = map(int, input().split(" "))
count = 0
i = 1
tempList = []
for i in range(1,200) :
    if A%i == 0 and B%i == 0:
        tempList.append(i)
print(tempList[-K])

Buggy submission (verdict: Runtime Error):

A,B,K  = map(int, input().split(" "))
count = 0
i = 1
tempList = []
for i in range(1,max(A,B)) :
    if A%i == 0 and B%i == 0:
        tempList.append(i)
print(tempList[-K])
Problem p03240 (python)

Fixed submission:
def execute() :
    n = int(input())
    p = [[int(i) for i in input().split()] for i in range(n)]
    
    for posX in range(101) :
        for posY in range(101) :
            needH = -1
    
            for i in range(n) :
                x, y, h = p[i]
                if h > 0 :
                    tmp = h + abs(posY-y) + abs(posX-x)
                    if needH == -1 :
                        needH = tmp
                    else :
                        if needH != tmp :
                            needH = -2
                            break
            if needH == -2 : 
                continue
    
            for i in range(n) :
                x, y, h = p[i]
                if h == 0 :
                    dist =  abs(posY-y) + abs(posX - x)
                    if needH > dist :
                        needH = -2
                        break
            if needH == -2 : 
                continue
            
            return (posX, posY, needH)

result = execute()     
print(result[0], result[1], result[2])

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

max = 100

for posX in range(0,101) :
    for posY in range(0,101) :
        needH = -1
        
        for i in range(0,n) :
            if p[i][2] > 0 :
                tmp = p[i][2] + abs(posY-p[i][1]) + abs(posX - p[i][0])
                if needH == -1 :
                    needH = tmp
            else :
                if needH != tmp :
                    needH = -2
                    break
        if needH == -2 : continue
            
        for i in range(0,n) :
            if p[i][2] == 0 :
                dist =  abs(posY-p[i][1]) + abs(posX - p[i][0])
                if needH > dist :
                    needH = -2
                    break
        if needH == -2 : continue
        
        print(posX, posY, needH)
        break
    break
Problem p03244 (python)

Fixed submission:
from collections import Counter

n = int(input())
v = [int(i) for i in input().split()]

ki = v[::2]
gu = v[1::2]

ki = Counter(ki)
gu = Counter(gu)

ki = ki.most_common()
gu = gu.most_common()

if ki[0][0] == gu[0][0] :
    if len(ki) == 1 and len(gu) == 1 :
        print(int(n/2))
    else :
        if ki[1][1] > gu[1][1] :
            print(n-ki[1][1]-gu[0][1])
        else :
            print(n-ki[0][1]- gu[1][1])

else :
    print(n-ki[0][1]-gu[0][1])

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

n = int(input())
v = [int(i) for i in input().split()]

ki = v[::2]
gu = v[1::2]

ki = Counter(ki)
gu = Counter(gu)

ki = ki.most_common()
gu = ki.most_common()

if ki[0][0] == gu[0][0] :
    if(len(ki) == len(gu)) :
        print(n/2)
    else :
        if(ki[1][1] > gu[1][1]) :
            print(n-ki[1][1]-gu[0][1])
        else :
            print(n-ki[0][1]- gu[1][1])

else :
    print(n-ki[0][1]-gu[0][1])
Problem p02640 (python)

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

for a in range(x + 1):
    tem = 2 * a + 4 * (x - a)
    if (tem == y):
        #  and (2 * x <= y <= 4 * x):
        print('Yes')
        exit()

print('No')

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

for a in range(x + 1):
    tem = 2 * a + 4 * (x - a)
    if (tem == y):
        #  and (2 * x <= y <= 4 * x):
        print('Yes')
        exit(1)

print('No')

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

for a in range(x + 1):
    if (2 * a + 4 * (x - a) == y) and (2 * x <= y <= 4 * x):
        print('Yes')
        exit(1)

print('No')

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

for a in range(x + 1):
    if  a == - y / 2 + x:
        print('Yes')
        exit(1)

print('No')

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

for a in range(x + 1):
    if (2 * a + 4 * (x - a) == y):
        print('Yes')
        exit(1)

print('No')
Problem p02641 (python)

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

if n != 0:
    p = list(map(int, input().split()))
else:
    print(x)
    exit()

dif = 100
ans = 0

for i in range(min(p) - 1, max(p) + 2):
    if not (i in p):
        if dif > abs(x - i):
            dif = abs(x - i)
            ans = i

print(ans)

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

if n != 0:
    p = list(map(int, input().split()))
else:
    print(x)
    exit(1)

dif = 100
ans = 0

for i in range(min(p) - 1, max(p) + 2):
    if not (i in p):
        if dif > abs(x - i):
            dif = abs(x - i)
            ans = i

print(ans)
Problem p02842 (python)

Fixed submission:
import math

N = int(input())

a = math.floor(N / 1.08)
b = a + 1

aa = math.floor(a * 1.08)
bb = math.floor(b * 1.08)

if(aa == N):
    print(a)
else:
    if(bb == N):
        print(b)
    else:
        print(":(")

Buggy submission (verdict: Runtime Error):
import math

N = int(input())

a = math.floor(n / 1.08)
b = a + 1

aa = math.floor(a * 1.08)
bb = math.floor(b * 1.08)

if(aa == N):
    print(aa)
elif(bb == N):
    print(bb)
else:
    print(":(")
Problem p02924 (python)

Fixed submission:
n = int(input())
print(n*(n-1)//2)

Buggy submission (verdict: Runtime Error):
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)

	ans := 0
	for i := 1; i < n; i++ {
		ans += i
	}

	fmt.Println(ans)
}
Problem p03037 (python)

Fixed submission:
n, m = map(int, input().split())
l, r = [0]*m, [0]*m
for i in range(m):
    l[i], r[i] = map(int, input().split())

if max(l) <= min(r):
    print(min(r)-max(l)+1)
else:
    print('0')

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
l, r = [0]*(m+1), [0]*(m+1)
for i in range(m):
    l[i], r[i] = map(int, input().split())

res = [i+1 for i in range(n)]

for i in range(m):
    if min(res) < l[i]:
        for j in range(min(res), l[i]):
            if j in res:
                res.remove(j)
    if max(res) > r[i]:
        for j in range(r[i]+1, max(res)+1):
            if j in res:
                res.remove(j)

print(len(res))
Problem p03378 (python)

Fixed submission:
n, m, x = map(int, input().split())
a = list(map(int, input().split()))
cost_0, cost_n = 0, 0

# if max(a) <= x or min(a) >= x:
#     print(0)
#     exit(1)

for i in range(1, x):
    if i in a:
        cost_0 += 1

for i in range(x + 1, n):
    if i in a:
        cost_n += 1

print(min(cost_0, cost_n))

Buggy submission (verdict: Runtime Error):
n, m, x = map(int, input().split())
a = list(map(int, input().split()))
cost_0, cost_n = 0, 0

if max(a) <= x or min(a) >= x:
    print(0)
    exit(1)

for i in range(1, x):
    if i in a:
        cost_0 += 1

for i in range(x + 1, n):
    if i in a:
        cost_n += 1

print(min(cost_0, cost_n))

Buggy submission (verdict: Runtime Error):
n, m, x = map(int, input().split())
a = list(map(int, input().split()))
cost_0, cost_n = 0, 0

if max(a) <= x or min(a) >= x:
    print(0)
    exit(1)

for i in range(x + 1):
    if i in a:
        cost_0 += 1

for i in range(x, n + 1):
    if i in a:
        cost_n += 1

print(min(cost_0, cost_n))
Problem p03861 (python)

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

Buggy submission (verdict: Runtime Error):
a, b, n = map(int, input().split())
print(b // x - (a - 1) // x)
Problem p03998 (python)

Fixed submission:
d = {"a": input(), "b": input(), "c": input()}

def func(s):
    if len(d[s]) == 0:
        return s.upper()
    next = d[s][0]
    d[s] = d[s][1:]
    return func(next)

print(func("a"))

Buggy submission (verdict: Runtime Error):
d = {"a": input(), "b": input(), "c": input()}

def func(s):
    if len(d[s]) == 0:
        return s.upper()
    next = d[s][0]
    d[s] = d[s][1:]
    return func(next)

print(func(a))

Buggy submission (verdict: Runtime Error):
d = {"a": input(), "b": input(), "c": input()}

def func(s):
    if len(d[s]) == 0:
        return upper()
    next = d[s][0]
    d[s] = d[s][1:]
    return func(next)

print(func(a))
Problem p04043 (python)

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

if i[0] == 5 and i[1] == 5 and i[2] == 7:
    print('YES')
elif i[0] == 5 and i[1] == 7 and i[2] == 5:
    print('YES')
elif i[0] == 7 and i[1] == 5 and i[2] == 5:
    print('YES')
else: print('NO')

Buggy submission (verdict: Runtime Error):
if int(input()) == 5 and int(input()) == 5 and int(input()) == 7:
    print('YES')
elif int(input()) == 5 and int(input()) == 7 and int(input()) == 5:
    print('YES')
elif int(input()) == 7 and int(input()) == 5 and int(input()) == 5:
    print('YES')
else: print('NO')
Problem p03471 (python)

Fixed submission:
def calcPattern(N, Y):
    for i in range(0, N+1):
        for j in range(0, N+1):
            if i == ((Y - 1000*N - 4000*j) / 9000):
                if (N-i-j) >= 0: return (str(i) + " " + str(j) + " " +str(N-i-j))
    return ("-1 -1 -1")

n,y = map(int, input().split())
print(calcPattern(n,y))

Buggy submission (verdict: Runtime Error):
for i in range(0, N+1):
    for j in range(0, N+1-i):
        if i == ((Y - 1000*N - 4000*j) / 9000):
            if (N-i-j) >= 0: print(str(i) + " " + str(j) + " " +str(N-i-j))
            exit()
print ("-1 -1 -1")

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

for i in range(0, N+1):
  for j in range(0, N+1):
    if i == ((Y - 1000*N - 4000*j) / 9000):
      if (N-i-j) >= 0: print(str(i) + " " + str(j) + " " +str(N-i-j))
        return 0
print("-1 -1 -1")
Problem p02639 (python)

Fixed submission:
x = [int(v) for v in input().rstrip().split()]
i = x.index(0)
print(i + 1)

Buggy submission (verdict: Runtime Error):
x = [int(v) for v in input().rstrip().split()
i = x.index(0)
print(i + 1)
Problem p02641 (python)

Fixed submission:
def run():
	X, N = [int(v) for v in input().rstrip().split()]
	p = []
	if N > 0:
		p = [int(v) for v in input().rstrip().split()]

	i = -1
	try:
		i = p.index(X)
	except ValueError:
		pass

	if i == -1:
		# not contained	
		return X

	d1 = {}
	for k in range(0, 102):
		d1[k] = k

	for v in p:
		del d1[v]

	l2 = sorted(list(d1.keys()))

	l2.append(X)
	l2.sort()
	i = l2.index(X)

	r = 0
	if i == 0:
		r = l2[1]
	elif (i + 1) == len(l2):
		r = l2[-2]
	else:
		v1 = l2[i + 1] - X
		v2 = X - l2[i - 1]
		if v1 < v2 :
			r = l2[i + 1]
		elif v1 > v2 :
			r = l2[i - 1]
		else:
			# v1 == v2
			r = l2[i - 1]


	return r

r = run()
print(r)

Buggy submission (verdict: Runtime Error):
def run():
	X, N = [int(v) for v in input().rstrip().split()]
	p = []
	if N > 0:
		p = [int(v) for v in input().rstrip().split()]

	i = -1
	try:
		i = p.index(X)
	except ValueError:
		pass

	if i == -1:
		# not contained	
		return X

	d1 = {}
	for k in range(1, 101):
		d1[k] = k

	for v in p:
		del d1[v]

	l2 = sorted(list(d1.keys()))

	l2.append(X)
	l2.sort()
	i = l2.index(X)

	r = 0
	if i == 0:
		r = l2[1]
	elif (i + 1) == len(l2):
		r = l2[-2]
	else:
		v1 = l2[i + 1] - X
		v2 = X - l2[i - 1]
		if v1 < v2 :
			r = l2[i + 1]
		elif v1 > v2 :
			r = l2[i - 1]
		else:
			# v1 == v2
			r = l2[i - 1]


	return r

r = run()
print(r)
Problem p02705 (python)

Fixed submission:
import math

r = int(input().rstrip())
print(r * 2 * math.pi)

Buggy submission (verdict: Runtime Error):
n, m = list(map(int, input().rstrip().split()))
total = sum([int(i) for i in input().rstrip().split()])
result = -1 if n < total else n - total
print(result)
Problem p04044 (python)

Fixed submission:
N, L = map(int, input().split())
input_line1 = [input() for i in range(N)]
input_line2 = []
for i in range(N):
	input_line2.append(min(input_line1))
	input_line1.remove(min(input_line1))
print("".join(input_line2))

Buggy submission (verdict: Runtime Error):
N, L = map(int, input().split())
input_line1 = [input() for i in range(N)]
input_line2 = []
for i in range(N):
 	input_line2.append(min(input_line1))
    input_line1.remove(min(input_line1))
print("".join(input_line2))
Problem p02983 (python)

Fixed submission:
L, R = map(int, input().split())
if L//2019 != R//2019:
    print(0)
elif L % 2019 <= 673 and R % 2019 >= 673 and R - L >= 2:
    print(0)
else:
    ans = 2019
    for i in range(L, R):
        for j in range(i+1,R+1):
            ans = min(ans, (i*j)%2019)
    print(ans)

Buggy submission (verdict: Runtime Error):
L, R = map(int, input().split())
if L//2019 != R//2019:
    print(0
elif:
    L%2019<= 673 and R%2019 >= 673 and L-R >= 2:
    print(0)
else:
    print(min((L*(L+1))%2019,(R*(R-1)%2019)))
Problem p03086 (python)

Fixed submission:
S = input()
cnt = 0
ans = 0
for i in range(len(S)):
    if S[i] == "A" or S[i] == "C" or S[i] == "G" or S[i] == "T":
        cnt += 1
    else:
        ans = max(ans, cnt)
        cnt = 0
ans = max(ans, cnt)
print(ans)

Buggy submission (verdict: Runtime Error):
S = input()
cnt = 0
ans = 0
for i in range(len(S)):
    if S[i] == "A" or S[i] == "C" or S[i] == "G" or S[i] == "T":
        cnt += 1
    else:
        ans = max(ans, cnt)
        cnt =
ans = max(ans, cnt)
print(ans)
Problem p03106 (python)

Fixed submission:
A, B, K = map(int, input().split())
n = max(A, B)
k = 0
while True:
    if A % n == 0 and B % n == 0:
        k = k + 1
    if k >= K:
        break
    n = n - 1
print(n)

Buggy submission (verdict: Runtime Error):
A, B, K = map(int, input().split())
n = max(A, B)
k = 0
if n == 1:
    print("1")
else:
    while k < K:
        n = n - 1
        if A % n == 0 and B % n == 0:
            k = k + 1
    print(n)