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

Fixed submission:
# -*- coding: utf-8 -*-
from collections import deque
N, M = map(int, input().split())
abn = [list(map(int, input().split())) for _ in range(M)]

abn.sort(key=lambda x:x[1])

ans = 0
bnum = -1
for a,b in abn:
    if bnum == -1:
        bnum = b - 1
        ans += 1
    elif a <= bnum < b:
        continue
    else:
        bnum = b - 1
        ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import numpy as np

N, M = map(int, input().split())
a = []
b = []

for j in range(M):
    ta, tb = map(int, input().split())
    a.append(ta)
    b.append(tb)

# print(a)
# print(b)

br_tbl = np.zeros((N-1, M), dtype=np.bool)
for j in range(M):
    for i in range(a[j]-1,b[j]-1):
        br_tbl[i,j] = 1

max_list = []
skip_list = np.zeros((M), dtype=np.bool)
br_cnt = 0
for j in range(M):
    # print('j=',j)
    max_col = 0
    if skip_list[j] == 1:
        continue
    sum_list = np.zeros((N-1), dtype=np.uint)
    for i in range(N-1):
        if  br_tbl[i,j] == 1:
            # print('i=',i)
            sum = 0
            for j2 in range(j,M):
                # print('j2=',j2)
                sum += br_tbl[i,j2]
            sum_list[i] = sum
            # print(sum)
    max_col = np.argmax(sum_list)
    max_list.append(max_col)
    # print('sum_list=',sum_list)
    # print('max_col=',max_col)
    br_cnt += 1

    for j3 in range(j,M):
        # print('j3=',j3)
        if br_tbl[max_col,j3] == 1:
            skip_list[j3] = 1
#     print(skip_list)
#
# print()
# print(br_tbl)

print(br_cnt)
Problem p03634 (python)

Fixed submission:
# -*- coding: utf-8 -*-
from collections import defaultdict,deque
N = int(input())
abc = [list(map(int, input().split())) for _ in range(N-1)]
Q, K = map(int, input().split())
xy = [list(map(int, input().split())) for _ in range(Q)]

# graph = defaultdict(lambda: defaultdict(int))
graph = [defaultdict(int) for _ in range(N)]

for a,b,c in abc:
    graph[a-1][b-1] = c
    graph[b-1][a-1] = c

def xfs(v):
    dist = [-1 for _ in range(N)]
    dist[v] = 0
    que = deque()
    que.append(v)
    while len(que) > 0:
        i = que.pop()  # 深さ優先探索        
        # i = que.popleft() #幅優先探索
        for n, val in graph[i].items():
            if dist[n] == -1:
                dist[n] = dist[i] + val
                que.append(n)
    return dist

dist = xfs(K-1)

for x,y in xy:
    print(dist[x-1] + dist[y-1])

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
from pprint import pprint as pp
import numpy as np
from scipy.sparse.csgraph import floyd_warshall
from collections import defaultdict
N = int(input())
abc = [list(map(int, input().split())) for _ in range(N-1)]
Q, K = map(int, input().split())
xy = [list(map(int, input().split())) for _ in range(Q)]

# graph = [[float('inf') for _ in range(N)] for _ in range(N)]
# graph = defaultdict(lambda: defaultdict(lambda:float('inf')))
graph = np.zeros((N,N), dtype=np.int32)

for a,b,c in abc:
    graph[a-1][b-1] = c
    graph[b-1][a-1] = c

# pp(graph)
dist = floyd_warshall(graph, directed=False)

for x,y in xy:
    print(int(dist[x-1][K-1] + dist[K-1][y-1]))
Problem p03775 (python)

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

N = int(input())

def primes(n):
    primfac = []
    d = 2
    while d*d <= n:
        while (n % d) == 0:
            primfac.append(d)  # supposing you want multiple factors repeated
            n //= d
        d += 1
    if n > 1:
       primfac.append(n)
    return primfac

def F(a,b):
    return max([len(str(a)), len(str(b))])
    
if N == 1:
    print(1)
    exit()
    
l = primes(N)
l.append(1)
ans = []
for i in range(1,len(l)//2+1):
    comb = itertools.combinations(l, i)
    comb = list(set(list(comb)))
    for comblist in comb:
        # print(tmp)
        tmp = 1
        for x in comblist:
            tmp *= x

        ans.append(F(tmp,N//tmp))

# print(ans)
print(min(ans))

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

N = int(input())

def primes(n):
    primfac = []
    d = 2
    while d*d <= n:
        while (n % d) == 0:
            primfac.append(d)  # supposing you want multiple factors repeated
            n //= d
        d += 1
    if n > 1:
       primfac.append(n)
    return primfac

def F(a,b):
    return max([len(str(a)), len(str(b))])
    
l = primes(N)
l.append(1)
ans = []
for i in range(1,len(l)//2+1):
    comb = itertools.combinations(l, i)
    comb = list(set(list(comb)))
    for comblist in comb:
        # print(tmp)
        tmp = 1
        for x in comblist:
            tmp *= x

        ans.append(F(tmp,N//tmp))

# print(ans)
print(min(ans))
Problem p03135 (python)

Fixed submission:
a,b=map(int,input().split())
z=float(a/b)
print(z)

Buggy submission (verdict: Runtime Error):
a,b=int(input().split())
z=float(a/b)
print(z)

Buggy submission (verdict: Runtime Error):
a,b=int(input().split())
z=float(t/x)
print(z)
Problem p03207 (python)

Fixed submission:
n=int(input())
a=[int(input()) for i in range(n)]
b=sum(a)-max(a)/2
print(int(b))

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input())
b=sum(a)-max(a)/2
print(b)
Problem p03265 (python)

Fixed submission:
a,b,c,d=map(int,input().split())
e=c-a
f=d-b
g=c-f
h=d+e
i=g-e
j=h-f
print(g)
print(h)
print(i)
print(j)

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
e=c-a
f=d-b
g=c-f
h=d+e
i=g-e
j=h-f
print(g h i j)

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
e=c-a
f=d-b
g=c-f
h=d+e
i=g-e
j=h-f
print(list[g,h,i,j])

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
e=c-a
f=d-b
g=c-f
h=d+e
i=g-e
j=h-f
print(list[g,h,i,j])

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
e=c-a
f=d-b
g=c-f
h=d+e
i=g-e
j=h-f
print(int(g) int(h) int(i) int(j))
Problem p03075 (python)

Fixed submission:
a = []

for i in range(6):
    a.append(int(input()))

if a[4] - a[0] <= a[5]:
    print('Yay!')
else:
    print(':(')

Buggy submission (verdict: Runtime Error):
for i in range(6):
    a.append(int(input()))

if a[4] - a[0] <= a[5]:
    print('Yay!')
else:
    print(':(')
Problem p03075 (python)

Fixed submission:
import sys

loops1 = 4
loops2 = 5
arg1 = 0
arg2 = 1

i=0
j=0

args = [int(input()) for i in range(6)]

for i in range(arg1,loops1):
	for j in range(arg2,loops2):
		if (args[j] - args[i]) > args[5]:
			print(":(")
			sys.exit()
print("Yay!")

Buggy submission (verdict: Runtime Error):
import sys

args = [int(input()) for i in range(6)]

 if (args[4] - arg[0]) > args[5]:
    print(":(")
print("Yay!")

Buggy submission (verdict: Runtime Error):
import sys

args = [int(input()) for i in range(6)]

if (args[4] - arg[0]) > args[5]:
    print(":(")
    sys.exit()
print("Yay!")

Buggy submission (verdict: Runtime Error):
import sys

args = [int(input()) for i in range(6)]

 if (args[0] - arg[4]) > args[5]:
        print(":(")
        sys.exit()
print("Yay!")

Buggy submission (verdict: Runtime Error):
import sys

args = [int(input()) for i in range(6)]

 if (args[0] - arg[4]) > args[5]:
            print(":(")
            sys.exit()
print("Yay!")

Buggy submission (verdict: Runtime Error):
import sys

args = [input() for i in range(6)]

for arg1 in args[:5]:
    for arg2 in args[1:5]
        if (arg2 - arg1) > args[5]:
            print(":(")
            sys.exit()
print("Yay!")

Buggy submission (verdict: Runtime Error):
import sys

args = [input() for i in range(6)]

for arg1 in args[:5]:
    for arg2 in args[1:5]:
        if (arg2 - arg1) > args[5]:
            print(":(")
            sys.exit()
print("Yay!")

Buggy submission (verdict: Runtime Error):
import sys

args = [input() for i in range(6)]

for arg1 in args[:5]:
    for arg2 in args[1:5]
        if (arg2 - arg1) > args[5]:
            print(":(")
            sys.exit()
print("Yay!")

Buggy submission (verdict: Runtime Error):

import sys

loops1 = 4
loops2 = 5
arg1 = 0
arg2 = 1

i=0
j=0

int args = [input() for i in range(6)]

for i in range(arg1,loops1):
	for j in range(arg2,loops2):
		if (args[j] - args[i]) > args[5]:
			print(":(")
			sys.exit()
print("Yay!")

Buggy submission (verdict: Runtime Error):

import sys

loops1 = 4
loops2 = 5
arg1 = 0
arg2 = 1

i=0
j=0

args = [input() for i in range(6)]


for i in range(arg1,loops1):
	for j in range(arg2,loops2):
		if (args[j] - args[i]) > args[5]:
			print(":(")
			sys.exit()
print("Yay!")

Buggy submission (verdict: Runtime Error):
import sys

args = [input() for i in range(6)]

loops1 = 4
loops2 = 5
arg1 = 0
arg2 = 1

for i in range(arg1,loops1):
	for j in range(arg2,loops2):
		if (args[j] - args[i]) > args[5]:
			print(":(")
			sys.exit()
print("Yay!")

Buggy submission (verdict: Runtime Error):

import sys

args = [input() for i in range(6)]

loops1 = 4
loops2 = 5
arg1 = 0
arg2 = 1

for i in range(arg1,loops1):
	for j in range(arg2,loops2):
		if (args[j] - args[i]) > args[5]:
			print(":(")
			sys.exit()
print("Yay!")
Problem p03077 (python)

Fixed submission:
import math
n = int(input())
a = [int(input()) for i in range(5)]
print(math.ceil(n/min(a[0],a[1],a[2],a[3],a[4]))+4)

Buggy submission (verdict: Runtime Error):
nn = [0] * 6
nn[0] = n
count = 0
while nn[5] != n:
    idou_1 = min(a[0],nn[0])
    idou_2 = min(a[1],nn[1])
    idou_3 = min(a[2],nn[2])
    idou_4 = min(a[3],nn[3])
    idou_5 = min(a[4],nn[4])
    nn[0] -= idou_1
    nn[1] += idou_1
    nn[1] -= idou_2
    nn[2] += idou_2
    nn[2] -= idou_3
    nn[3] += idou_3
    nn[3] -= idou_4
    nn[4] += idou_4
    nn[4] -= idou_5
    nn[5] += idou_5
    count += 1
print(count)
Problem p03075 (python)

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
dists = [a, b, c, d, e]
if max(dists) - min(dists) > k:
    print(":(")
else:
    print("Yay!")

Buggy submission (verdict: Runtime Error):
# https://img.atcoder.jp/abc123/editorial.pdf
# 問題D: Cake 123 解法 #3 - さらに高速な解法、priority-queue を用いて O(K log K)

from heapq import heappush, nlargest

def solve(X, Y, Z, K, A, B, C):
    A.sort(reverse=True)
    B.sort(reverse=True)
    C.sort(reverse=True)

    Q = []
    for a in A:
        for b in B:
            heappush(Q, a+ b)
    AB = nlargest(K, Q)

    Q2 = []
    for ab in AB:
        for c in C:
            heappush(Q2, ab + c)
    ABC = nlargest(K, Q2)
    print("\n".join(map(str, ABC)))

if __name__ == "__main__":
    X, Y, Z, K = list(map(int, input().split()))
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))
    C = list(map(int, input().split()))
    solve(X, Y, Z, K, A, B, C)
Problem p03631 (python)

Fixed submission:
N = input()
n=int(N)
n2=(n%10)*100
n2+=(n%100)-n%10
n2+=(n-n%100)/100
if n==n2 :
	print('Yes\n')
else:
	print('No\n')
quit()

Buggy submission (verdict: Runtime Error):
def gcd(a,b):
    if a<b:
     c=a
     a=b
     b=c
     
    c=a%b
    
    if c==0:
     return a
    else:
     return b
 
def lcm(a,b):
    c=gcd(a,b)
    return a/c*b
 
 
 
n=int(input())
t=[0]*n
 
for lop2 in range(n):
    t[lop2]=int(input())
 
ans=t[0]
 
for lop in range(1,n):
    ans=lcm(ans,t[lop])
print(int(ans))

Buggy submission (verdict: Runtime Error):
def gcd(a,b):
    if a<b:
     c=a
     a=b
     b=c
     
    c=a%b
    return b
 
def lcm(a,b):
    c=gcd(a,b)
    return a/c*b
 
 
 
n=int(input())
t=[0]*n
 
for lop2 in range(n):
    t[lop2]=int(input())
 
ans=t[0]
 
for lop in range(1,n):
    ans=lcm(ans,t[lop])
print(int(ans))

Buggy submission (verdict: Runtime Error):

def gcd(a,b):
    if a<b:
        d=a
        a=b
        b=d
    c=a%b

    if c==0:
        return b
    else:
        return gcd(b,c)

def lcm(a,b):
    c=gcd(a,b)
    return a/c*b

n=int(input())
t=[0]*n

for lop2 in range(n):
    t[lop2]=int(input())

ans=t[0]

for lop in range(1,n):
    ans=lcm(ans,t[lop])
print(int(ans))

Buggy submission (verdict: Runtime Error):

def gcd(a,b):
        return b


def lcm(a,b):
    c=gcd(a,b);
    return a/c*b

n=int(input())
t=[0]*n

for lop2 in range(n):
    t[lop2]=int(input())

ans=t[0]

for lop in range(1,n):
    ans=lcm(ans,t[lop])
print(int(ans))

Buggy submission (verdict: Runtime Error):

def gcd(a,b):
            return b


def lcm(a,b):
    c=gcd(a,b);
    return a/c*b

n=int(input())
t=[0]*n

for lop2 in range(n):
    t[lop2]=int(input())

ans=t[0]

for lop in range(1,n):
    ans=lcm(ans,t[lop])
print(int(ans))

Buggy submission (verdict: Runtime Error):

def gcd(a,b):
    if a<b:
        d=a;
        a=b;
        b=d;
    c=a%b

    if c==0:
        return b
    else:
        return gcd(b,c)

def lcm(a,b):
    c=gcd(a,b);
    return a/c*b

n=int(input())
t=[0]*n

for lop2 in range(n):
    t[lop2]=int(input())

ans=t[0]

for lop in range(1,n):
    ans=lcm(ans,t[lop])
print(int(ans))
Problem p03072 (python)

Fixed submission:
import math
import os
import random
import re
import sys
from collections import defaultdict

# sys.stdin = open('input.in', 'r')
# sys.stdout = open('output.out', 'w') 

def count(n, h):
	count = 0
	if len(h) < 1:
		return count
	max = h[0]
	for i in h:
		if i >= max:
			max = i 
			count += 1

	return count

if __name__ == '__main__':
	n = int(input())
	h = list(map(int, input().rstrip().split()))
	print(count(n, h))

Buggy submission (verdict: Runtime Error):
import math
import os
import random
import re
import sys
from collections import defaultdict

sys.stdin = open('input.in', 'r')
sys.stdout = open('output.out', 'w') 

def count(n, h):
	count = 0
	if len(h) < 1:
		return count
	max = h[0]
	for i in h:
		if i >= max:
			max = i 
			count += 1

	return count

if __name__ == '__main__':
	n = int(input())
	h = list(map(int, input().rstrip().split()))
	print(count(n, h))

Buggy submission (verdict: Runtime Error):
import math
import os
import random
import re
import sys
from collections import defaultdict

def count(n, h):
	count = 0
	if len(h) < 1:
		return count
	max = h[0]
	for i in h:
		if i >= max:
			max = i 
			count += 1

	return count

if __name__ == '__main__':
	n = int(input())
    h = list(map(int, input().rstrip().split()))
    print(count(n, h))
Problem p03073 (python)

Fixed submission:
import math
import os
import random
import re
import sys
from collections import defaultdict

# sys.stdin = open('input.in', 'r')
# sys.stdout = open('output.out', 'w') 

def onezero(a):
	count = 0
	for i in range(0, len(a), 2):
		if a[i] == 0:
			count += 1
	for i in range(1, len(a), 2):
		if a[i] == 1:
			count += 1
	return count

def zeroone(a):
	count = 0
	for i in range(0, len(a), 2):
		if a[i] == 1:
			count += 1
	for i in range(1, len(a), 2):
		if a[i] == 0:
			count += 1
	return count


def count(n):
	return min(onezero(n),zeroone(n))

if __name__ == '__main__':
	N = [int(d) for d in input()]
	print(count(N))

Buggy submission (verdict: Runtime Error):
import math
import os
import random
import re
import sys
from collections import defaultdict

sys.stdin = open('input.in', 'r')
sys.stdout = open('output.out', 'w') 

def onezero(a):
	count = 0
	for i in range(0, len(a), 2):
		if a[i] == 0:
			count += 1
	for i in range(1, len(a), 2):
		if a[i] == 1:
			count += 1
	return count

def zeroone(a):
	count = 0
	for i in range(0, len(a), 2):
		if a[i] == 1:
			count += 1
	for i in range(1, len(a), 2):
		if a[i] == 0:
			count += 1
	return count


def count(n):
	return min(onezero(n),zeroone(n))

if __name__ == '__main__':
	N = [int(d) for d in input()]
	print(count(N))
Problem p03077 (python)

Fixed submission:
import math
N = int(input())
transporter = [0]*5
for i in range(5):
    transporter[i] = int(input())
min_trans = min(transporter)
ans = math.ceil(N/min_trans) - 1 + 5
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
transporter = [0]*5
transporter_lag = [0]*5
for i in range(5):
    transporter[i] = int(input())
for i in range(1,5):
    if transporter[i] >= transporter[i-1]:
        transporter_lag[i] = 0
    else :
        transporter_lag[i] = math.ceil(transporter[i-1]/transporter[i]) - 1
if math.ceil(N/transporter[0]) <= 5:
    ans = 5+ sum(transporter_lag)
else :
    ans = math.ceil(N/transporter[0]) + sum(transporter_lag) + 4
print(ans)
Problem p03107 (python)

Fixed submission:
s = input()
zero = s.count("0")
one = s.count("1")
print(min(zero, one)*2)

Buggy submission (verdict: Runtime Error):
s = str(input())
i = 0
score = 0
str_length = len(s)
while True:
    str_length = len(s)
    if str_length == 2:
        if int(s[0]) ^ int(s[1]) == 1:
            score += 2
            print(score)
            exit()
        else:
            print(score)
            exit()
    i = 0
    while True:
        j = i + 1
        cur_num = int(s[j])
        prev_num = int(s[j-1])
        next_num = int(s[j+1])
        if (cur_num ^ prev_num) == 1:
            score += 2
            s = s[:j-1] + s[j+1:]
            break
            
        elif (cur_num ^ prev_num) == 1:
            score += 2
            s = s[:j] + s[j+2:]
            break
        else :
            i += 1
            if i == str_length:
                print(score)
                exit()
Problem p03127 (python)

Fixed submission:
def euclid_devider(num_devided, num_devider):
    while num_devided % num_devider != 0:
        temp = num_devided % num_devider
        num_devided = num_devider
        num_devider = temp
    return num_devider

N = int(input())
A = list(map(int, input().split()))
ans = A[0]
for i in range(1,N):
    ans = euclid_devider(A[i], ans)
print(ans)

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

while len(A) != 1:
    print(A)
    attack_monster = random.randint(0,10**9) % len(A)
    damage_monster = random.randint(0,10**9) % len(A)
    if attack_monster != damage_monster:
        A[damage_monster] = A[damage_monster] - A[attack_monster]
        if A[damage_monster] <= 0:
            del A[damage_monster]
print(A[0])
Problem p03137 (python)

Fixed submission:
N, M = map(int, input().split())
X = list(map(int, input().split()))
X.sort()
X_distance = [0]*(M-1)
for i in range(M-1):
    X_distance[i] = abs(X[i]-X[i+1])
X_distance.sort(reverse=True)

if N >= M:
    print(0)
elif M == 1:
    print(0)
else :
    for i in range(N-1):
        X_distance[i] = 0
    print(sum(X_distance))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
X = list(map(int, input().split()))
X.sort()
X_distance = [0]*(M-1)
for i in range(M-1):
    X_distance[i] = abs(X[i]-X[i+1])
X_distance.sort(reverse=True)

if N == M:
    print(0)
elif M == 1:
    print(0)
else :
    for i in range(N-1):
        X_distance[i] = 0
    print(sum(X_distance))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
X = list(map(int, input().split()))
X.sort()
X_distance = [0]*(M-1)
for i in range(M-1):
    X_distance[i] = abs(X[i]-X[i+1])

if N == M:
    print(0)
else :
    for i in range(N-1):
        max_index = X_distance.index(max(X_distance))
        X_distance[max_index] = 0
    print(sum(X_distance))
Problem p03327 (python)

Fixed submission:
N = int(input())
if N<=999:
    print('ABC')
else:
    print('ABD')

Buggy submission (verdict: Runtime Error):
def dfs(cost, N):
    if N<6 :
        return cost+N
    else:
        ret0 = 6 ** math.floor(math.log(N, 6))
        ret1 = 9 ** math.floor(math.log(N, 9))
        if (ret0>1) and (ret1>1):
            return min(dfs(cost+1, N-ret0), dfs(cost+1, N-ret1))
        else:
            ret = max(ret0, ret1)
            return dfs(cost+1, N-ret)

N = int(input())
print(dfs(0, N))
Problem p03329 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**6) 

def memorize(f):
    table = {}
    def func(*args):
        if not args in table:
            table[args] = f(*args)
        return table[args]
    return func

@memorize
def memDFS(n):
    if n==0:
        return 0
    else:
        res = n
        pow6 = 1
        while(pow6<=n):
            res = min(res, memDFS(n-pow6)+1)
            pow6 *= 6
        pow9 = 1
        while(pow9<=n):
            res = min(res, memDFS(n-pow9)+1)
            pow9 *= 9
        return res

N = int(input())
print(memDFS(N))

Buggy submission (verdict: Runtime Error):
def dfs(cost, N):
    if N<6 :
        return cost+N
    else:
        ret0 = 6 ** math.floor(math.log(N, 6))
        ret1 = 9 ** math.floor(math.log(N, 9))
        if (ret0>1) and (ret1>1):
            return min(dfs(cost+1, N-ret0), dfs(cost+1, N-ret1))
        else:
            ret = max(ret0, ret1)
            return dfs(cost+1, N-ret)

N = int(input())
print(dfs(0, N))
Problem p03077 (python)

Fixed submission:
n = int(input())
li = []
for i in range(5):
  li.append(int(input()))
m = min(li)
if n % m != 0:
	t = n // m
else:
  t = n // m - 1
print(t + 5)

Buggy submission (verdict: Runtime Error):
n = int(input())
li = []
for i in range(5):
  li.append(int(input())
m = min(li)
t = int(n / m)
print(t + 5)
Problem p03307 (python)

Fixed submission:
n = int(input())
if n%2 == 0 :
    print(n)
else :
    print(2*n)

Buggy submission (verdict: Runtime Error):
n = int(input()
if n%2 == 0 :
    print(n)
else :
    print(2*n)
Problem p03127 (python)

Fixed submission:
from fractions import *
from functools import *

n = int(input())
print(reduce(gcd, map(int, input().split())))

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

n = int(input())
print(reduce(gcd, map(int, input().split())))
Problem p03137 (python)

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

if m == 1:
    print(0)
    exit()

x.sort()

z = []
for i in range(len(x) - 1):
    z.append(abs(x[i] - x[i + 1]))

z.sort()
for _ in range(n - 1):
    if len(z) > 0:
        z.pop()

print(sum(z))

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

if m == 1:
    print(0)
    exit()

x.sort()

z = []
for i in range(len(x) - 1):
    z.append(abs(x[i] - x[i + 1]))

z.sort()
for _ in range(n - 1):
    z.pop()

print(sum(z))
Problem p03265 (python)

Fixed submission:
x1, y1, x2, y2 = list(map(int, input().split()))

xx = x2 - x1
yy = y2 - y1

x3 = x2 - yy
y3 = y2 + xx
x4 = x3 - xx
y4 = y3 - yy

print(x3, y3, x4, y4)

Buggy submission (verdict: Runtime Error):
1, y1, x2, y2 = list(map(int, input().split()))

xx = x2 - x1
yy = y2 - y1

x3 = x2 - yy
y3 = y2 + xx
x4 = x3 - xx
y4 = y3 - yy

print(x3, y3, x4, y4)
Problem p03107 (python)

Fixed submission:
S = input()
N = len(S)
zc,oc = 0,0
for i in range(N):
    if S[i]=='1':
        oc += 1
    else:
        zc += 1
print(2*min(oc,zc))

Buggy submission (verdict: Runtime Error):
N = len(S)
zc,oc = 0,0
for i in range(N):
    if S[i]=='1':
        oc += 1
    else:
        zc += 1
print(2*min(oc,zc))
Problem p03135 (python)

Fixed submission:
t,x = map(int,input().split())
print(t/x)

Buggy submission (verdict: Runtime Error):
x.t = map(int,input().split())
print(x/t)
Problem p03329 (python)

Fixed submission:
N = int(input())
cnt = 0
i = 10
dp = [0,1,2,3,4,5,1,2,3,1]
while i<=N:
    idx_n,idx_s = 0,0
    while i-(9**idx_n)>=0:
        idx_n += 1
    idx_n -= 1
    while i-(6**idx_s)>=0:
        idx_s += 1
    idx_s -= 1
    dp.append(min(1+dp[i-(9**idx_n)],1+dp[i-(6**idx_s)]))
    i += 1
print(dp[N])

Buggy submission (verdict: Runtime Error):
cnt = 0
i = 10
dp = [0,1,2,3,4,5,1,2,3,1]
while i<=N:
    idx_n,idx_s = 0,0
    while i-(9**idx_n)>=0:
        idx_n += 1
    idx_n -= 1
    while i-(6**idx_s)>=0:
        idx_s += 1
    idx_s -= 1
    dp.append(min(1+dp[i-(9**idx_n)],1+dp[i-(6**idx_s)]))
    i += 1
print(dp[N])
Problem p03345 (python)

Fixed submission:
INF = 10**18
A,B,C,K = map(int,input().split())
print((B-A if K%2==1 else A-B))

Buggy submission (verdict: Runtime Error):
INF = 10**18
A,B,C,K = map(int,input().split())
print((B-A if K%2==1 else A-B)
Problem p03775 (python)

Fixed submission:
import math
n = int(input())
dv = []
dved = []
for i in range(1,int(math.sqrt(n)+1)):
    if n%i==0 and not(i in dved):
        dv.append(i)
        dved.append(n//i) 
    if i in dved:
        break
print(len(str(dved[-1]))if len(dv)>0 else 1)

Buggy submission (verdict: Runtime Error):
n = int(input())
dv = []
dved = []
for i in range(1,n):
    if n%i==0 and not(i in dved):
        dv.append(i)
        dved.append(n//i) 
    if i in dved:
        break
print(len(str(dved[-1])))