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

Fixed submission:
N=input()
cnt=0

for i in range(len(N)):
    cnt+=int(N[i])

if int(N)%cnt==0:
    print("Yes")
    
else:
    print("No")

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

f=int(N[0])+int(N[1])

if int(N)%f==0:
    print("Yes")
    
else:
    print("No")
Problem p03679 (python)

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

if b-a<=x and b-a<=0:
    print("delicious")
elif b-a<=x and b-a>0:
    print("safe")
else:
    print("dangerous")

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

if b-a=<x and b-a<=0:
    print("delicious")
elif b-a<=x and b-a>0:
    print("safe")
else:
    print("dangerous")
Problem p03813 (python)

Fixed submission:
x=int(input())
if x>=1200:
    print("ARC")
else:
    print("ABC")

Buggy submission (verdict: Runtime Error):
x=input()
if x>=1200:
    print("ARC")
else:
    print("ABC")
Problem p04044 (python)

Fixed submission:
n,l=map(int,input().split())
list=[]
for _ in range(n):
    list.append(input())
 
list.sort()
ans=""
for i in list:
    ans+=i
print(ans)

Buggy submission (verdict: Runtime Error):
n,l=map(int,input().split())
list=[]
for _ in range(n):
    list.append(str(input())

list.sort()
ans=""
for i in list:
    ans+=i
print(ans)

Buggy submission (verdict: Runtime Error):
l,n=map(int,input().split())
list=[]
for _ in range(n):
    list.append(input())

list.sort()
ans=""
for i in len(list):
    ans+=list[i]
print(ans)

Buggy submission (verdict: Runtime Error):
l,n=map(int,input().split())
list=[]
for _ in range(n):
    list.append(input())

list.sort()
ans=""
for i in list:
    ans+=i
print(ans)

Buggy submission (verdict: Runtime Error):
l,n=map(int,input().split())
list=[]
for _ in range(n):
    list.append(str(input()))

list.sort()
ans=""
for i in list:
    ans+=i
print(ans)

Buggy submission (verdict: Runtime Error):
l,n=map(int,input().split())
D=[]
for _ in range(n):
    D.append(str(input()))

D.sort()
m=""
for i in S:
    m+=i

print(m)

Buggy submission (verdict: Runtime Error):
l,n=map(int,input().split())
D=[]
for _ in range(n):
    D.append(str(input()))

S.sort(D,reverse=False)
m=" "
for i in S:
    m+=i

print(m)

Buggy submission (verdict: Runtime Error):
l,n=map(int,input().split())
D=[]
for _ in range(n):
    D.append(str(input()))

S=sorted(D,reverse=False)
m=" "
for i in S:
    m+=i

print(m)
Problem p02691 (python)

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

count = 0

def solve():
    from collections import Counter
    cc=Counter()
    ans=0
    for i,val in enumerate(A,1):
        if i-val>0:
            ans+=cc[i-val]
        cc[i+val]+=1
    print(ans)
    
def dfs(x, y):
    global count
    if x >= N or y >= N:
        return
    
    if (A[x]+A[y]) == y-x:
        count += 1

    if x+1 >= N and y+1 >= N:
        return
        
    if y+1 >= N:
        dfs(x+1, x+2)
    else:
        dfs(x, y+1)


#dfs(0, 1)
#print(count)
solve()

Buggy submission (verdict: Runtime Error):
from functools import lru_cache

N = int(input())
A = list(map(int, input().split()))

count = 0

@lru_cache(maxsize=1000)
def dfs(x, y):
    global count
    if x >= N or y >= N:
        return
    
    if (A[x]+A[y]) == y-x:
        count += 1

    if x+1 >= N and y+1 >= N:
        return
        
    if y+1 >= N:
        dfs(x+1, x+2)
    else:
        dfs(x, y+1)


dfs(0, 1)
print(count)

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

count = 0

def dfs(x, y):
    global count
    if x >= N or y >= N:
        return
    
    if (A[x]+A[y]) == y-x:
        count += 1

    if x+1 >= N and y+1 >= N:
        return
        
    if y+1 >= N:
        dfs(x+1, x+2)
    else:
        dfs(x, y+1)


dfs(0, 1)
print(count)

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

count = 0

def dfs(x, y):
    global count
    if x >= N or y >= N:
        return
    
    if (A[x]+A[y]) == y-x:
        count += 1
    
    if y+1 >= N:
        dfs(x+1, x+2)
    else:
        dfs(x, y+1)


dfs(0, 1)

print(count)

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

count = 0

def dfs(x, y):
    global count
    if x >= N or y >= N:
        return
    diff = abs(x - y)
    if (A[x]+A[y]) == diff:
        count += 1
    
    if y+1 >= N:
        dfs(x+1, x+2)
    dfs(x, y+1)


dfs(0, 1)
print(count)
Problem p02696 (python)

Fixed submission:
import math

A, B, N = map(int, input().split())

if N < B:
    x = N
else:
    x = B - 1

def check(x):
    return math.floor((A * x) / B)
            
print(check(x))

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

A, B, N = map(int, input().split())

def check():
    x = np.arange(1, N+1)
    tmp = np.floor(A * (x/B) ) - (A * np.floor(x / B))
    print(int(max(tmp)))
        
check()

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

A, B, N = map(int, input().split())

def check():
    x = np.arange(1, N+1)
    tmp = np.floor(A * (x/B) ) - (A * np.floor(x / B))
    #ans = math.floor((A * x)/B) - (A*math.floor(x/b))
    print(int(max(tmp)))


def solve():
    ans = 0
    for x in range(1, N+1):
        tmpans = math.floor((A * x)/B) - (A * math.floor(x/B))
        ans = max(tmpans, ans)
    print(ans)
#solve()
check()

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

A, B, N = map(int, input().split())

def check():
    x = np.arange(1, N+1)
    tmp = np.floor((A * x)/B ) - (A * np.floor(x / B))
    #ans = math.floor((A * x)/B) - (A*math.floor(x/b))
    print(int(max(tmp)))


def solve():
    ans = 0
    for x in range(1, N+1):
        tmpans = math.floor((A * x)/B) - (A * math.floor(x/B))
        ans = max(tmpans, ans)
    print(ans)
#solve()
check()
Problem p02713 (python)

Fixed submission:
import math

K = int(input())
sum = 0

for i in range(K):
    for j in range(K):
        tmp = math.gcd(i+1, j+1)
        for k in range(K):
            sum += math.gcd(tmp, k+1)
        
print(sum)

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce

K = int(input())
sum = 0

def gcd(*numbers):
    return reduce(math.gcd, numbers)

for i in range(K):
    for j in range(K):
        tmp = math.gcd(i+1, j+1)
        for k in range(K):
            sum += gcd(g, k+1)
        
print(sum)
Problem p02811 (python)

Fixed submission:
num, max = input().split()
if (int(num) * 500 >= int(max)):
    print('Yes');
else:
    print('No');

Buggy submission (verdict: Runtime Error):
number, max = input().split()

if (int(number) * 500 >= int(max)) {
	print('yes'); 
}
print('no');
Problem p02885 (python)

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

if A-2*B >= 0:
    print(A-2*B)
else:
    print(0)

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

count = 0

for i in range(N):
    for j in range(i+1,N):
        count += list_d[i]*list_d[j]

print(count)
Problem p02921 (python)

Fixed submission:
S = input()
T = input()

count = 0

for i in range(3):
    if S[i] == T[i]:
        count +=1

print(count)

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

count_p = 0
count = 0

if b = 1:
    print(count)

while True:
    if count == 0:
        count_p += a
    
    else:
        count_p += a-1
    
    count += 1
    
    if count_p >= b:
        break

print(count)
Problem p02922 (python)

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

count_p = 0
count = 0

if b == 1:
    print(count)

else:
    while True:
        if count == 0:
            count_p += a
    
        else:
            count_p += a-1
    
        count += 1
    
        if count_p >= b:
            break

    print(count)

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

count_p = 0
count = 0

if b = 1:
    print(count)

while True:
    if count == 0:
        count_p += a
    
    else:
        count_p += a-1
    
    count += 1
    
    if count_p >= b:
        break

print(count)
Problem p02957 (python)

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

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

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

if abs(a-b)%2 != 0
    print(abs(a-b)/2)
else:
    print('IMPOSSIBLE')
Problem p02999 (python)

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

if x<a:
    print(0)
else:
    print(10)

Buggy submission (verdict: Runtime Error):
x,a = map(int,itput().split())

if x<a:
    print(0)
else:
    print(10)
Problem p03206 (python)

Fixed submission:
D = int(input())

print('Christmas' if D == 25 else 'Christmas Eve' if D == 24 else 'Christmas Eve Eve' if D == 23 else 'Christmas Eve Eve Eve')

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

print('Christmas' if D == 25 else 'Christmas Eve' if D == 24 else 'Christmas Eve Eve' else 'Christmas Eve Eve Eve')
Problem p02691 (python)

Fixed submission:
# -*- coding: utf-8 -*-
# 整数の入力
n = int(input())
h_list = input().split()
h_list = [int(h) for h in h_list]

count = 0
result_dict = {}

for i in range(n):
    key = (i+1) + h_list[i]
    value = result_dict.get(key, 0)
    result_dict[key] = value + 1

for j in range(n):
    key = (j+1) - h_list[j]
    count += result_dict.get(key, 0)

print(count)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# 整数の入力
n = int(input())
h_list = input().split()
h_list = [int(h) for h in h_list]

count = 0

for i in range(n):
    a_height = h_list[i]
    for k in range(i + 1 + a_height, i+21):
        b_height = h_list[k]
        if k - i == a_height + b_height:
            count += 1

print(count)
Problem p02692 (python)

Fixed submission:
# -*- coding: utf-8 -*-
n, a, b, c = map(int, input().split())

value_dict = {'A': a, 'B': b, 'C': c}
result_list = []
input_list = []
flag = True

for i in range(n):
    input_list.append(input())

for next, input in enumerate(input_list, 1):
    if value_dict[input[0]] < value_dict[input[1]]:
        value_dict[input[0]] += 1
        value_dict[input[1]] -= 1
        result_list.append(input[0])
    elif value_dict[input[1]] < value_dict[input[0]]:
        value_dict[input[1]] += 1
        value_dict[input[0]] -= 1
        result_list.append(input[1])
    else:
        if value_dict[input[0]] == 0:
            flag = False
            break
        elif next == len(input_list):
            result_list.append(input[0])
        elif input[0] in input_list[next]:
            value_dict[input[0]] += 1
            value_dict[input[1]] -= 1
            result_list.append(input[0])
        else:
            value_dict[input[1]] += 1
            value_dict[input[0]] -= 1
            result_list.append(input[1])

if flag:
    print('Yes')
    for result in result_list:
        print(result)

else:
    print('No')

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# 整数の入力
n = int(input())
h_list = input().split()
h_list = [int(h) for h in h_list]

count = 0

for i in range(n):
    a_height = h_list[i]
    if i + 21 < n:
        n_aa = i + 21
    else:
        n_aa = n
    for k in range(i + 1 + a_height, n_aa):
        b_height = h_list[k]
        if k - i == a_height + b_height:
            count += 1

print(count)
Problem p03455 (python)

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

if a*b % 2 != 0:
    print('Odd')
else:
    print('Even')

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

t = [0]
x = [0]
y = [0]
for i in range(N):
    t1, x1, y1 = [int(j) for j in input().split()]
    t.append(t1)
    x.append(x1)
    y.append(y1)

count = 0
for i in range(N):
    dt = t[i+1] - t[i]
    dist = abs(x[i+1] - x[i]) + abs(y[i+1] - y[i])
    if dist > dt:
        break
    elif dt%2 != dist%2:
        break
    else:
        count += 1

if count == N:
    print('Yes')
else:
    print('No')
Problem p02708 (python)

Fixed submission:
N, K = map(int, input().split())
number = [ i for i in range(0, N + 1)]


left = number[K - 1]
right = number[-K]
s_min = sum(number[0:K])
s_max = sum(number[-K:])
count = s_max - s_min + 1
for i in range(K + 1, N + 2):
    left += 1
    right -= 1
    s_min += left
    s_max += right
    count += s_max - s_min + 1
print(count % 1000000007)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
number = [ i for i in range(0, N + 1)]


left = number[K - 1]
right = number[-K]
count = sum(number[0:i]) - sum(number[0:i]) + 1
for i in range(K + 1, N + 2):
    count += (left - 1) - (right + 1)
print(count % 1000000007)
Problem p02756 (python)

Fixed submission:
# -*- coding: utf-8 -*-
S = input()
Q = int(input())

reverse = 0
head = []
tail = []
for i in range(Q):
    query = input()
    if len(query) == 1:
        reverse = (reverse + 1) % 2

    else:
        t, F, C = query.split()
        if reverse == 0:
            if F == "1":
                head.append(C)
            else:
                tail.append(C)
        else:
            if F == "1":
                tail.append(C)
            else:
                head.append(C)

if reverse == 0:
    S = ''.join(head[::-1] + list(S) + tail)
else:
    S = ''.join(tail[::-1] + list(S[::-1]) + head)


print(S)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
from collenctions import deque

S = input()
Q = int(input())

querys = []
op1_cnt = 0
op2_cnt = 0
prefix = deque()
suffix = deque()
for i in range(Q):
    query = input()
    if len(query) == 1:
        op1_cnt += 1

        if op2_cnt != 0:
            prefix.extend(S)
            prefix.extend(suffix)
            S = ''.join(prefix)
            prefix.clear()
            suffix.clear()
            op2_cnt = 0

    else:
        op2_cnt += 1

        if op1_cnt % 2 != 0:
            S = S[::-1]

        op1_cnt = 0

        t, F, C = query.split()
        if F == "1":
            prefix.appendleft(C)
        else:
            suffix.append(C)

if op1_cnt % 2 != 0:
    S = S[::-1]

if op2_cnt != 0:
    prefix.extend(S)
    prefix.extend(suffix)
    S = ''.join(prefix)


print(S)
Problem p02761 (python)

Fixed submission:
# -*- coding: utf-8 -*-

N, M = map(int, input().split())
result = [-1] * N

for i in range(1, M + 1):
    s, c = map(int, input().split())
    if result[s - 1] == -1:
        result[s - 1] = c
    elif result[s - 1] == c:
        continue
    else:
        print(-1)
        exit(0)

if N != 1 and result[0] == 0:
    print(-1)
    exit(0)

if N == 1 and result[0] == -1:
    print(0)
    exit(0)

if N != 1 and result[0] == -1:
    result[0] = 1

for i in range(len(result)):
    if result[i] == -1:
        print(0, end="")
    else:
        print(result[i], end="")
print()

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

N, M = map(int, input().split())
result = [-1] * N

if M == 0:


for i in range(1, M + 1):
    s, c = map(int, input().split())
    if result[s - 1] == -1:
        result[s - 1] = c
    elif result[s - 1] == c:
        continue
    else:
        print(-1)
        exit(0)

if N != 1 and result[0] == 0:
    print(-1)
    exit(0)

if N == 1 and result[0] == -1:
    print(0)
    exit(0)

if N != 1 and result[0] == -1:
    result[0] = 1

for i in range(len(result)):
    if result[i] == -1:
        print(0, end="")
    else:
        print(result[i], end="")
print()
Problem p02705 (python)

Fixed submission:
import math
R = int(input())
l = 2*R*math.pi
print(l)

Buggy submission (verdict: Runtime Error):
import math
R = input()
l = 2*R*math.pi
print(l)

Buggy submission (verdict: Runtime Error):
import math
R = input()
l = 2*R*math.pi
print(l)
Problem p02706 (python)

Fixed submission:
N, M = map(int,input().split())
l = list(map(int,input().split()))
su = sum(l)
if N < su:
    print('-1')
else:
    print(N - su)

Buggy submission (verdict: Runtime Error):
N, M = map(int,input().split()))
l = list(map(int,input().split()))
su = l.sum()
if N < su:
    print(-1)
else:
    print(N - su)
Problem p02772 (python)

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

result = "APPROVED"

for i in range(N):
    if not( (A[i] % 2 == 1) or ((A[i] % 2 == 0) and (A[i] % 3 == 0 or A[i] % 5 == 0)) ):
        result ="DENIED"
        break

###########　出力
print(result)

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

result = "APPROVED"

for i in range(N):
    if (A[i] % 2 == 1) or ((A[i] % 2 == 0) and (A[i] % 3 == 0 or A[i] % 5 == 0)):
    else:
        result ="DENIED"
        break

###########　出力
print(result)
Problem p02690 (python)

Fixed submission:
#!/usr/bin/env python3
import sys
import math

def solve(X: int):
    lim = 200

    for A in range(-lim, lim):
        for B in range(-lim, lim):
            x = math.pow(A, 5) - math.pow(B, 5)
            if X == int(x):
                print(A, B)
                return
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  # type: int
    solve(X)

if __name__ == '__main__':
    main()

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


def main():
    N = int(input())
    A = [i for i in map(int, input().split())]
    #print (N, A)
    gsize = 10
    numg = (N - 1) // gsize + 1
    maxg = [0] * numg
    ming = [0] * numg
    size = len(A)
    for g in range(0, numg):
        gA = A[gsize*g:min(gsize*(g+1), size)]
        maxg[g] = max(gA)
        ming[g] = min(gA)

    count = 0
    for g1 in range(0, numg):
        for g2 in range(g1, numg):
            #print('checking group', g1, g2)
            gd = abs(g1 - g2)
            if maxg[g1] + maxg[g2] < gsize * (gd - 1):
                continue
            if ming[g1] + ming[g2] > gsize * (gd + 1):
                continue
            for g1i in range(gsize*g1, min(gsize*(g1+1), size)):
                for g2i in range(max(g1i+1, gsize*g2), min(gsize*(g2+1), size)):
                    d = abs(g1i - g2i)
                    if A[g1i] + A[g2i] == d:
                        count += 1
    print(count)


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

Fixed submission:
#!/usr/bin/env python3
import sys
import math

def solve(A: int, B: int, N: int):
    x = min(B-1, N)
    print(math.floor(A*x/B) - A*math.floor(x/B))
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    N = int(next(tokens))  # type: int
    solve(A, B, N)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
    #!/usr/bin/env python3
    import sys
    import math
     
    def solve(A: int, B: int, N: int):
     
        x = min(B-1, N)
        print(math.floor(A*x/B) - A*math.floor(x/B))
     
        return
     
     
    def main():
        def iterate_tokens():
            for line in sys.stdin:
                for word in line.split():
                    yield word
        tokens = iterate_tokens()
        A = int(next(tokens))  # type: int
        B = int(next(tokens))  # type: int
        N = int(next(tokens))  # type: int
        solve(A, B, N)
     
    if __name__ == '__main__':
        main()

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

def solve(A: int, B: int, N: int):

    x = min(B-1, N)
    print(math.floor(A*x/B) - A*math.floor(x/B)

    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    N = int(next(tokens))  # type: int
    solve(A, B, N)

if __name__ == '__main__':
    main()

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

def solve(A: int, B: int, N: int):
    # max_pos = 0
    # max_v = 0
    # for x in range(1, B):
    #     v = math.floor(A*x/B) - A*math.floor(x/B)
    #     if v > max_v:
    #         max_v = v
    #         max_pos = x
    #p = max([math.floor(A*x/B) - A*math.floor(x/B) for x in range(1, B+1)])

    print(max([math.floor(A*x/B) - A*math.floor(x/B) for x in range(1, min(B, N+1))]))

    #r = A % B
    #print(max([A//B * x + math.floor((r * x)/B) for x in range(1, min(B+1, N+1))]))
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    N = int(next(tokens))  # type: int
    solve(A, B, N)

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

Fixed submission:
s = input()
if s == "hi" *(len(s)//2):
    print("Yes")
else:
    print("No")

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

if set(s) == {'h', 'i'}:
    print("Yes")
else:z
    print("No")

Buggy submission (verdict: Runtime Error):
s = input()
flag = False
if "hi" in s:
    if s[s.find("hi")+2] == "i":
        flag = False
    else:
        flag = True
else:
    flag = False
    
if flag == False:
    print("No")
else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
s = input()
if "hi" in s:
    if s[s.find("hi")+2] == "i":
        flag = False
    else:
        flag = True
else:
    flag = False
    
if flag == False:
    print("No")
else:
    print("Yes")
Problem p02748 (python)

Fixed submission:
A,B,M = map(int,input().split(" "))
a = list(map(int,input().split(" ")))
b = list(map(int,input().split(" ")))
ans = min(a) + min(b)
for i in range(M):
    x,y,c = map(int,input().split(" "))
    tmp = a[x-1]+b[y-1]-c
    ans = min(tmp,ans)
print(ans)

Buggy submission (verdict: Runtime Error):
A,B,M = map(int,input().split(" "))
a = list(map(int,input().split(" ")))
b = list(map(int,input().split(" ")))
tmp = 1000000000
for i in range(M):
    c = int(input())
    sum1 = a[i]+b[i]-c
    ans = min(tmp,sum1)
print(ans)

Buggy submission (verdict: Runtime Error):
A,B,M = map(int,input().split(","))
a = list(map(int,input().split(",")))
b = list(map(int,input().split(",")))
tmp = 1000000000
for i in range(M):
    c = int(input())
    sum1 = a[i]+b[i]-c
    ans = min(tmp,sum1)
print(ans)
Problem p02767 (python)

Fixed submission:
n = int(input())
x = [int(i) for i in input().split()]
d = []
for i in range(min(x), max(x)+1):
  a = 0
  for j in x:
    a += (j - i)**2
#    print("({}-{})**2={}".format(j,i,(j - i)**2))
  d.append(a)
print(min(d))

Buggy submission (verdict: Runtime Error):
n = int(input())
x = [int(i) for i in input().split()]
d = []
for i in range(min(x), max(x)):
  a = 0
  for j in x:
    a += (j - i)**2
#    print("({}-{})**2={}".format(j,i,(j - i)**2))
  d.append(a)
print(min(d))

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

b = 0
for i in range(min(x), max(x)):
  a = 0
  for j in x:
    a += (i - j)**2
#    print("({}-{})**2={}".format(j,i,(j - i)**2))
  d.append(a)
print(min(d))

Buggy submission (verdict: Runtime Error):
n = int(input())
x = [int(i) for i in input().split()]
d = {}

def m(x, p):
  a = (x - p)**2
  return a
for i in range(min(x), max(x)):
  b = 0
  for j in x:
    b += m(j,i)
  d[i]=[b]
print(min(d.values())[0])

Buggy submission (verdict: Runtime Error):
n = int(input())
x = [int(i) for i in input().split()]
d = {}

def m(x, p):
  a = (x - p)**2
  return a
#d.setdefault(j, []).append([i, j, m(i,j)])
for i in range(min(x), max(x)):
  b = 0
  for j in x:
    b += m(j,i)
  d[i]=[b]
print(min(d.values())[0]
Problem p03485 (python)

Fixed submission:
import math
a = list(map(int, input().split()))
print(math.ceil(sum(a)/2))

Buggy submission (verdict: Runtime Error):
import math
a = [map(int, input().split())]
print(math.ceil(sum(a)))
Problem p02717 (python)

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

Buggy submission (verdict: Runtime Error):
# A
A, B, C = map(int,input().split())
print(C+" "+B+" "+A)