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

Fixed submission:
import math
a_h, b_m, hour, minute = map(int, input().split(" "))
pi = math.pi
arg_h = (hour + minute/60) * 360/12
arg_m = minute * 360/60

diff_arg = abs(arg_h - arg_m)
ans_square = a_h**2 + b_m**2 - 2 * a_h * b_m * math.cos(math.radians(diff_arg)) 
ans = math.sqrt(ans_square)
print(ans)

Buggy submission (verdict: Runtime Error):
import math
a_h, b_m, hour, minute = map(int, input().split(" "))
pi = math.pi
arg_h = (hour + minute/60) * 360/12
arg_m = minute * 360/60

diff_arg_abs = abs(arg_h - arg_m)
if diff_arg_abs > 180:
    diff_arg = diff_arg_abs - 180
elif diff_arg_abs < 180:
    diff_arg = diff_arg_abs
else:
    print(0)
    exit
    
ans_square = a_h**2 + b_m**2 - 2 * a_h * b_m * math.cos(math.radians(diff_arg)) 
ans = math.sqrt(ans_square)
print(ans)

Buggy submission (verdict: Runtime Error):
import math
a_h, b_m, hour, minute = map(int, input().split(" "))
pi = math.pi
arg_h = hour * 30 + minute * 0.5
arg_m = minute * 6

diff_arg_abs = abs(arg_h - arg_m)
if diff_arg_abs > 180:
    diff_arg = diff_arg_abs -180
    print(diff_arg)
elif diff_arg_abs < 180:
    diff_arg = diff_arg_abs
    print(diff_arg)
else:
    print(0)
    exit
    
ans_square = a_h**2 + b_m**2 - 2 * a_h * b_m * math.cos(math.radians(diff_arg)) 
ans = math.sqrt(ans_square)
print(ans)

Buggy submission (verdict: Runtime Error):
import math
a_h, b_m, hour, minute = map(int, input().split(" "))
pi = math.pi
arg_h = hour * 30 + minute * 0.5
arg_m = minute * 6

diff_arg_abs = abs(arg_h - arg_m)
if diff_arg_abs > 180:
    diff_arg = diff_arg_abs -180
elif diff_arg_abs < 180:
    diff_arg = diff_arg_abs
else:
    print(0)
    exit
    
diff_arg_rad = diff_arg / 180 * pi
ans_square = a_h**2 + b_m**2 - 2 * a_h * b_m * math.cos(diff_arg_rad) 
ans = math.sqrt(ans_square)
print(ans)
Problem p02683 (python)

Fixed submission:
import itertools
import numpy as np

N_book, M_algo, X_skill = map(int, input().split())  

A = []
for _ in range(N_book):
    a = list(map(int, input().split()))
    A.append(a)

flg = False
ans = float('inf')
for selector in list(itertools.product([1, 0], repeat=N_book))[:-1]:
    C = []
    for i in range(N_book):
        if selector[i] == 1:
            C.append(A[i])
    
    D = list(np.array(C).sum(axis=0))
    if (False in [i >= X_skill for i in D[1:]]):
        continue
    else:
        flg = True
        ans = min(ans, D[0])

if flg:
    print(ans)
else:
    print(-1)

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

N_book, M_algo, X_skill = map(int, input().split())  

A = []
for _ in range(N_book):
    a = list(map(int, input().split()))
    A.append(a)

flg = False
ans = float('inf')
for selector in list(itertools.product([1, 0], repeat=N_book))[:-1]:
    C = []
    for i in range(N_book):
        if selector[i] == 1:
            C.append(A[i])
    
    D = list(np.array(C).sum(axis=0))
    if (False in [i >= X_skill for i in D[1:]]):
        continue
    else:
        flg = True
        ans = min(ans, D[0])

if flg:
    print(ans)
else:
    print(-1)
Problem p03085 (python)

Fixed submission:
s = input()
if s == 'A':
    ans = 'T'
elif s== 'T':
    ans = 'A'
elif s == 'G':
    ans = 'C'
elif s == 'C':
    ans = 'G'
else:
    print("error")
    
print(ans)

Buggy submission (verdict: Runtime Error):
s = input()
if s == 'A':
    ans = 'T'
elif s== 'T':
    ans = 'A'
elif s == G:
    ans = 'C'
elif s == C:
    ans = 'G'
else:
    print("error")
    
print(ans)

Buggy submission (verdict: Runtime Error):

s = input()
if s == 'A':
    print('T')
elif s== 'T':
    print('A')
elif s == G:
    print('C')
else:
    print('G')

Buggy submission (verdict: Runtime Error):
s = input()
if s == 'A':
    print('C')
elif s== 'C':
    print('A')
elif s == G:
    print('T')
else:
    print('G')
Problem p03106 (python)

Fixed submission:
def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

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

set_a = set(make_divisors(A))
set_b = set(make_divisors(B))
set_ab = set_a.intersection(set_b)

list_ab = list(set_ab)
list_ab.sort()
# print(list_ab)

print(list_ab[-K])

Buggy submission (verdict: Runtime Error):
import sympy

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

set_a = set(sympy.divisors(A))
set_b = set(sympy.divisors(B))
# print(f'set_a ({A}): {set_a}')
# print(f'set_b ({B}): {set_b}')

set_ab = set_a.intersection(set_b)

list_ab = list(set_ab)
list_ab.sort()
# print(list_ab)

print(list_ab[K - 1])
Problem p02684 (python)

Fixed submission:
nk = input(' ')
n = int(nk.split()[0])
k = int(nk.split()[1])
alist = list(map(int,input('').split()))

loop_start=0
loop_end=0
root = [1]
next_val=1
flag=[True]*n
flag[0]=False # 踏んだかどうか判定機
a=1
for i in range(k):
    a = alist[a-1]
    if flag[a-1]: # 踏んでたらそこでブレイク
        root.append(a)
        flag[a-1]=False # 踏んだらFalseに
    else:
        break

#print("{} {}->{}".format(root,loop_start,loop_end))

loop_start=root.index(a)
loop_end=len(root)
step=(k-loop_start)%(len(root)-loop_start)
#print("step:({}-{})%({} - {})={}".format(k,loop_start,loop_end,loop_start,step))
#print("root[{}+{}]={}".format(loop_start,step,root[loop_start+step]))
print(root[loop_start+step])

Buggy submission (verdict: Runtime Error):
nk = input(' ')
n = int(nk.split()[0])
k = int(nk.split()[1])
alist = list(map(int,input('').split()))

loop_start=0
loop_end=0
root = []
next_val=1
for i in range(k):
    a = next_val
    next_val = alist[a-1]
    root.append(a)
    #print("{}: {}->{} [{}]".format(i,a,next,root))
    
    if next_val in root:
        loop_start=root.index(next_val)
        loop_end=len(root)
        break

#print("{} {}->{}".format(root,loop_start,loop_end))

step=k
if loop_end!= loop_start:
    step=(k-loop_start)%(loop_end-loop_start)
#print("step:({}-{})%({} - {})={}".format(k,loop_start,loop_end,loop_start,step))
#print("root[{}+{}]={}".format(loop_start,step,root[loop_start+step]))
if k < loop_start:
    print(root[k])
else:
    print(root[loop_start+step])

Buggy submission (verdict: Runtime Error):
nk = input(' ')
n = int(nk.split()[0])
k = int(nk.split()[1])
alist = list(map(int,input('').split()))

loop_start=0
loop_end=0
root = []
next=1
for i in range(k):
    a = next
    next = alist[a-1]
    root.append(a)
    #print("{}: {}->{} [{}]".format(i,a,next,root))
    if next in root:
        loop_start=root.index(next)
        loop_end=len(root)
        break

#print("{} {}->{}".format(root,loop_start,loop_end))

step=(k-loop_start)%(loop_end-loop_start)
#print("step:({}-{})%({} - {})={}".format(k,loop_start,loop_end,loop_start,step))
#print("root[{}+{}]={}".format(loop_start,step,root[loop_start+step]))
if k < loop_start:
    print(root[k])
else:
    print(root[loop_start+step])

Buggy submission (verdict: Runtime Error):
nk = input(' ')
n = int(nk.split()[0])
k = int(nk.split()[1])
alist = list(map(int,input('').split()))

loop_start=0
loop_end=0
root = []
next=1
for i in range(k):
    a = next
    next = alist[a-1]
    root.append(a)
#    print("{}: {}->{} [{}]".format(i,a,next,root))
    if next in root:
        loop_start=root.index(next)
        loop_end=len(root)
        break

#print("{} {}->{}".format(root,loop_start,loop_end))

step=(k-loop_start)%(loop_end-loop_start)
#print("step:({}-{})%({} - {})={}".format(k,loop_start,loop_end,loop_start,step))
#print("root[{}+{}]={}".format(loop_start,step,root[loop_start+step]))
if k < loop_start:
    print(root[k])
else:
    print(root[loop_start+step])
Problem p02705 (python)

Fixed submission:
import math
r = int(input(''))
print(2*r*math.pi)

Buggy submission (verdict: Runtime Error):
r = int(input(""))
print(r*2*math.pi)

Buggy submission (verdict: Runtime Error):
r = int(input(''))
print(2*r*math.pi)
Problem p02761 (python)

Fixed submission:
in1 = input('')
n = int(in1.split(' ')[0])
m = int(in1.split(' ')[1])
l = []
for i in range(0,n):
  l.append(-1)

hasError = False
for i in range(0,m):
  in2 = input('')
  idx = int(in2.split(' ')[0])-1
  li = int(in2.split(' ')[1])
  if l[idx] != -1 and l[idx] != li:
    hasError = True
  else:
    l[idx] = li

for i in range(0,n):
  if l[i] == -1:
    if i == 0 and n > 1:
      l[i] = 1
    else:
      l[i] = 0

result = 0
for i in range(0,n):
  ix = 1
  for j in range(0,(n-i-1)):
    ix*=10
  result += int(l[i])*ix

if result < 0:
  result = -1
if n == 1 and result == 0:
  result = 0
elif len(str(result)) != n:
  result = -1
if hasError == True:
  result = -1
print(result)

Buggy submission (verdict: Runtime Error):
in1 = input('')
n = int(in1.split(' ')[0])
m = int(in1.split(' ')[1])
l = []
for i in range(0,n):
  l.append(0)

hasError = False
for i in range(0,m):
  in2 = input('')
  idx = int(in2.split(' ')[0])
  li = int(in2.split(' ')[1])
  if l[idx-1] != li:
    hasError = True
  else:
    l[idx-1] = li

result = 0
for i in range(0,n):
  ix = 1
  for j in range(0,(n-i-1)):
    ix*=10
  result += int(l[i])*ix

if result < 0:
  result = -1
if n == 1 and result == 0:
  result = 0
elif len(str(result)) != n:
  result = -1
if hasError = True:
  result = -1
print(result)
Problem p02579 (python)

Fixed submission:
from itertools import product
from collections import deque
from sys import stdin
input = stdin.readline

H,W = map(int, input().split())
Ch,Cw = map(lambda x: int(x) - 1, input().split())
Dh,Dw = map(lambda x: int(x) - 1, input().split())
S = [None]*H
for i in range(H):
    S[i] = list(input())

moveA = ((1,0),(0,1),(-1,0),(0,-1))
moveB = []
for i,j in product((-2,-1,0,1,2), repeat=2):
    if (i,j) not in moveA:
        moveB.append((i,j))

mapmatrix = [[-1]*W for _ in range(H)]
queue = deque()
queue.append((Cw,Ch))
mapmatrix[Ch][Cw] = 0

worpqueue = deque()
worpqueue.append((Cw,Ch))
while queue or worpqueue:
    while queue:
        x,y = queue.popleft()
        worpnum = mapmatrix[y][x]

        for dx, dy in moveA:
            X = x + dx; Y = y + dy
            if X >= 0 and X < W and Y >= 0 and Y < H:
                if mapmatrix[Y][X] == -1 and S[Y][X] == '.':
                    mapmatrix[Y][X] = worpnum
                    queue.append((X,Y))
                    worpqueue.append((X,Y))
                    
    nextworpqueue = deque()
    while worpqueue:
        x,y = worpqueue.popleft()
        worpnum = mapmatrix[y][x]

        for dx, dy in moveB:
            X = x + dx; Y = y + dy
            if X >= 0 and X < W and Y >= 0 and Y < H:
                if mapmatrix[Y][X] == -1 and S[Y][X] == '.':
                    mapmatrix[Y][X] = worpnum + 1
                    queue.append((X,Y))
                    nextworpqueue.append((X,Y))
    
    while nextworpqueue:
        x,y = nextworpqueue.popleft()
        worpqueue.append((x,y))
        
print(mapmatrix[Dh][Dw])

Buggy submission (verdict: Runtime Error):
from collections import deque
from sys import stdin, setrecursionlimit
input = stdin.readline

setrecursionlimit(100000)

def DFS(x,y):
    #global blocknum
    if mapmatrix[y][x] == '.' and blocknumlist[y][x] == -1:
        #blocknumlist[y][x] = blocknum
        num = blocknumlist[y][x]
        for dx, dy in move:
            X = x + dx; Y = y + dy
            if X == Dw and Y == Dh:
                print(num)
                exit()
            if X >= 0 and X < W and Y >= 0 and Y < H:
                if blocknumlist[Y][X] == -1 and mapmatrix[Y][X] == '.':
                    blocknumlist[Y][X] = num
                    DFS(X,Y)
        for dx, dy in move2:
            X = x + dx; Y = y + dy
            if X == Dw and Y == Dh:
                print(num + 1)
                exit()
            if X >= 0 and X < W and Y >= 0 and Y < H:
                if blocknumlist[Y][X] == -1 and mapmatrix[Y][X] == '.':
                    blocknumlist[Y][X] = num + 1
                    DFS(X,Y)

H,W = map(int, input().split())
Ch, Cw = map(int, input().split())
Dh, Dw = map(int, input().split())
Ch -= 1
Cw -= 1
Dh -= 1
Dw -= 1
mapmatrix = [None]*H
for i in range(H):
    mapmatrix[i] = list(input())

move = ((1,0),(-1,0),(0,-1),(0,1))
move2 = ((2,0),(-2,0),(0,-2),(0,2),(1,1),(-1,-1),(1,-1),(-1,1))
blocknumlist = [[-1]*W for _ in range(H)]
blocknum = 0

DFS(Cw,Ch)
print(-1)
Problem p02600 (python)

Fixed submission:
x = int(input())
a = (x - 400)//200
print(8-a)

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

cnt = 0
while b <= a:
    cnt += 1
    b *= 2
while c <= b:
    cnt += 1
    c *= 2
if cnt <= K:
    print('Yes')
else:
    print('No')
Problem p02631 (python)

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

X = 0
for a in A:
    X = X ^ a

lis = []
for a in A:
    Y = X ^ a
    lis.append(Y)
print(*lis)

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

lis = []
for a in A:
    stra = str(a)
    S = '0b'
    i = 0
    for s in stra:
        s = 0 | (a >> i)
        if i%2 == 0:
            S = s + S
        else:
            if s == '0':
                S = '1' + S
            else:
                S = '0' + S
        i += 1
    lis.append(int(S))
print(*S)
Problem p02642 (python)

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

INF = 10**6

A.sort()
check = [False] + [True]*(INF)

setA = list(set(A))
length = len(setA)
for i in range(length):
    x = setA[i]
    for j in range(2, int(INF/x)+1):
        check[x*j] = False

prev = 0
count = 0
flag = False #重複チェック
for i in range(N):
    x = A[i]
    if check[x]:
        if x != prev:
            count += 1
            flag = True
        elif flag:
            count -= 1
            flag = False
        prev = x
print(count)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
A.sort()
INF = 10**6+1
lis = [1]*INF
exist = [0]*INF
for i in range(N):
    a = A[i]
    exist[a] += 1
    if lis[a]:
        for q in range(2, INF // a + 1):
            lis[a*q] = 0
cnt = 0
for a in A:
    if lis[a] and exist[a] == 1:
        cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
A.sort()
i = 0
while True:
    x = A[i]
    u = 0
    flag = True
    for j in range(i+1,N):
        j -= u
        if x == A[j]:
            flag = False
        if A[j]%x == 0:
            A.pop(j)
            N -= 1
            u += 1
        if j == N-1:
            break
    if flag == False:
        A.pop(i)
        N -= 1
        u += 1
    if i == N-1:
        break
    i += 1
print(len(A))
Problem p02646 (python)

Fixed submission:
a,v = map(int, input().split())
b,w = map(int, input().split())
T = int(input())
if abs(b-a) <= (v-w)*T:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
a,v = map(int, input().split())
b,w = map(int, input().split())
T = int(input())
if b-a < (v-w)*T and (b-a)%(v-w) == 0:
    print('YES')
else:
    print('NO')
Problem p02706 (python)

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

ans = N - sum(A)
print(max(ans,-1))

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

ans = max(N - sum(A))
print(ans)
Problem p02936 (python)

Fixed submission:
from sys import stdin, setrecursionlimit
input = stdin.readline

setrecursionlimit(10**6)

N,Q = map(int, input().split())
neighborlist = [[] for _ in range(N+1)]

for _ in range(N-1):
    a, b = map(int, input().split())
    neighborlist[a].append(b)
    neighborlist[b].append(a)

pointlist = [0]*(N+1)
for _ in range(Q):
    p, x = map(int, input().split())
    pointlist[p] += x

def DFS(v):
    if not checkedlist[v]:
        checkedlist[v] = True
        
        global point
        point += pointlist[v]
        for neighbor in neighborlist[v]:
            DFS(neighbor)
        
        totallist[v] = point
        point -= pointlist[v]
        
totallist = [0]*(N+1)
checkedlist = [False]*(N+1)
point = 0
for i in range(1,N+1):
    if not checkedlist[i]:
        DFS(i)

print(*totallist[1:])

Buggy submission (verdict: Runtime Error):
N,Q = map(int, input().split())
childlist = [[] for _ in range(N+1)]

for _ in range(N-1):
    a, b = map(int, input().split())
    childlist[a].append(b)

pointlist = [0]*(N+1)
for _ in range(Q):
    p, x = map(int, input().split())
    pointlist[p] += x

def DFS(v):
    if not checkedlist[v]:
        checkedlist[v] = True
        
        global point
        point += pointlist[v]
        for child in childlist[v]:
            DFS(child)
        
        totallist[v] = point
        point -= pointlist[v]
        
totallist = [0]*(N+1)
checkedlist = [False]*(N+1)
point = 0
for i in range(1,N+1):
    if not checkedlist[i]:
        DFS(i)

print(*totallist[1:])
Problem p03160 (python)

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

minlist = [0]*N
minlist[0] = 0
minlist[1] = abs(H[1] - H[0])
for i in range(2,N):
    minlist[i] = min(minlist[i-2] + abs(H[i-2] - H[i]), minlist[i-1] + abs(H[i-1] - H[i]))

print(minlist[N-1])

Buggy submission (verdict: Runtime Error):
#メモ化再起
N = int(input())
H = list(map(int, input().split()))

INF = 10**4 + 1
minlist = [INF]*N
def minstepsearch(i):
    if i == 0:
        minlist[i] = 0
        return 0
    
    minlist[i] = min(minlist[i], minstepsearch(i-1) + abs(H[i] - H[i-1]))
    if i > 1:
        minlist[i] = min(minlist[i], minstepsearch(i-2) + abs(H[i] - H[i-2]))
    return minlist[i]

print(minstepsearch(N-1))
Problem p02658 (python)

Fixed submission:

def main():
    n = int(input())
    al = list(map(int,input().split()))
    al_p = 1

    if 0 in al:
        print(0)
        return

    for i in range(n):
        al_p *= al[i]
        if al_p > 10**18:
            print(-1)
            return
        
    print(al_p)

main()

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

for i in range(n):
    al_p *= al[i]
    if al_p > 10**18:
        print(-1)
        return
        
print(al_p)

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

for i in range(n):
    al_p *= al[i]
    if al_p > 10*18:
        print(-1)
        return
        
print(al_p)
Problem p02681 (python)

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

Buggy submission (verdict: Runtime Error):
s,t = input().split()
if s == t[:-1]:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
s,t = input().split()
if s in t and len(t) == len(s) + 1:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
s,t = input().split()
if s in t:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
s,t = list(input().split())
if s in t:
    print('Yes')
else:
    print('No')
Problem p02760 (python)

Fixed submission:
bingo_list = [list(map(int,input().split())) for i in range(3)]
bingo_list = sum(bingo_list,[])
n = int(input())
bingo_number = [int(input())for i in range(n)]
check_list = [0 for i in range(9)]

for j in bingo_number:
    if j in bingo_list:
        check_list[bingo_list.index(j)] = 1

if  [1,1,1]  in [check_list[:3], check_list[3:6], check_list[6:], check_list[0:7:3], check_list[1:8:3],check_list[2:9:3],check_list[0:9:4],check_list[2:7:2]]:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
bingo_list = [list(map(int,input().split())) for i in range(3)]
bingo_list = sum(bingo_list,[])
n = int(input())
bingo_number = [int(input())for i in range(n)]
check_list = [0 for i in range(9)]

for j in bingo_number:
    if j in bingo_list:
        check_list[bingo_list.index(j)] = 1

if [1,1,1] in [check_list[:3],check_list[3:6],check_list[6:],check_list[0:7:3],check_list[1:8:3]check_list[2:9:3],check_list[0:9:4],check_list[2:8:2]]:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
bingo_list = [list(map(int,input().split())) for i in range(3)]
bingo_list = sum(bingo_list,[])
n = int(input())
bingo_number = [int(input())for i in range(n)]
check_list = [0 for i in range(9)]

for j in bingo_number:
    if j in bingo_list:
        check_list[bingo_list.index(j)] = 1

if [1,1,1]in [check_list[:3],check_list[3:6],check_list[6:],check_list[0:7:3],check_list[1:8:3]check_list[2:9:3],check_list[0:9:4],check_list[2:7:2]]:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
bingo_list = [list(map(int,input().split())) for i in range(3)]
bingo_list = sum(bingo_list,[])
n = int(input())
bingo_number = [int(input())for i in range(n)]
check_list = [0 for i in range(9)]

for j in bingo_number:
    if j in bingo_list:
        check_list[bingo_list.index(j)] = 1

if [1,1,1]in [check_list[:3],check_list[3:6],check_list[6:],
             check_list[0:7:3],check_list[1:8:3]check_list[2:9:3],
             check_list[0:9:4],check_list[2:7:2]]:
    print('Yes')
else:
    print('No')
Problem p02767 (python)

Fixed submission:
N = int(input())
X = list(map(int,input().split()))
ans = []

for i in range(min(X),max(X)+1):
    cnt = 0
    for j in X:
        cnt += (j-i)**2
    ans.append(cnt)
        
print(min(ans))

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

for i in range(min(X),max(X)+1):
    ans.append(cnt)
    cnt = 0
    for j in X:
        cnt += (j-i)**2
    #ans.append(cnt)
        
print(min(ans))

Buggy submission (verdict: Runtime Error):
N = int(input())
X = list(map(int,input().split()))
ans = []
cnt = 0
for i in range(min(X),max(X)+1):
    ans.append(cnt)
    cnt = 0
    for j in X:
        cnt += (j-i)**2
print(min(ans[1:]))
Problem p02899 (python)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
ans = [0] * N
for i,val in enumerate(A):
    ans[val-1] = i+1
print(*ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
ans = [0] * N
for i,val in enumerate(A):
    ans[val-1] = i+1
print(' '.join(ans))
Problem p02947 (python)

Fixed submission:
import collections

N = int(input())
S = [''.join(sorted(input())) for _ in range(N)]
c = collections.Counter(S)
ans = 0
for i in set(S):
    n = c[i]
    ans += n*(n-1)//2
print(ans)

Buggy submission (verdict: Runtime Error):
import collections

N = int(input())
S = [(sorted(input())) for _ in range(N)]
c = collections.Counter(S)
ans = 0
for i in set(S):
    n = c[i]
    ans += n*(n-1)//2
print(ans)

Buggy submission (verdict: Runtime Error):
import collections

N = int(input())
S = [(sorted(input()))for _ in range(N)]
c = collections.Counter(S)
ans = 0
print(S)

for i in set(S):
    n = c[i]
    ans += n*(n-1)//2
print(ans)

Buggy submission (verdict: Runtime Error):
import collections

N = int(input())
S = [{sorted(input())}for _ in range(N)]
c = collections.Counter(S)
ans = 0
print(S)

for i in set(S):
    n = c[i]
    ans += n*(n-1)//2
print(ans)

Buggy submission (verdict: Runtime Error):
import collections

N = int(input())
S = [sorted(input())for _ in range(N)]
c = collections.Counter(S)
ans = 0

for i in set(S):
    n = c[i]
    ans += n*(n-1)//2
print(ans)
Problem p03000 (python)

Fixed submission:
N,X = map(int,input().split())
l = list(map(int,input().split()))
p = 0
count = 1

for i in l:
    p += i
    count += 1
    if p > X:
        count -= 1
        break
print(count)

Buggy submission (verdict: Runtime Error):
N,X = map(int,input().split())
l = list(map(int,input().split()))
p = 0
count = 0

for i in range(N+1):
    p += l[i]
    count += 1
    if p > X:
        print(count)
        break
Problem p03106 (python)

Fixed submission:
a,b,k = map(int,input().split())
l=[]
for i in range(1,101):
    if a%i ==0 and b%i ==0:
        l.append(i)

print(l[-k])

Buggy submission (verdict: Runtime Error):
a,b,k = map(int,input().split())
l=[]
for i in range(1,101):
    if a%i ==0 and b%i ==0:
        l.append(i)

print(l[-2])