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

Fixed submission:
import math
# import datetime

def s(n):
	sum = 0
	for c in str(n):
		sum += int(c)
	return sum

k = int(input())
found=0

def next_sunuke(n, s_n, s_n_div):

	global found

	if n == 1:
		return

	log_n = int(math.log(n,10))
	m = n - 10 ** int(log_n // 1.25)
	# m = n - 1

	while m >= 1:
		s_m = s(m)
		s_mplus1 = s(m + 1)

		# if (s_m < s_mplus1 or (s_n - s_m != 1 and s_n - s_m != -8)) and m > 9:
		if (s_m < s_mplus1) and m > 9:
			m -= 10 ** int(log_n // 1.25)
			continue

		# print("check: " + str(m))

		s_m_div = m / s(m)

		if s_m_div <= s_n_div:
			next_sunuke(m, s_m, s_m_div)
			if found >= k:
				return

			found += 1
			# print("{0:d}".format(m), "{0:+d}".format(n-m), "{0:d}".format(s_m), s_m_div)
			print(m)
			break
		# else:
		# 	log_m = int(math.log(m,10))
		# 	if (m + 1) / (10 ** (log_m - 1)) == 19:

		# 		print ("skip: " + str(m) + " to " + str(10 ** log_m - 1))

		# 		m = 10 ** log_m - 1
		# 		s_mplus1 = s(m+1)
		# 		continue

		m -= 10 ** int(log_n // 1.25)


# 適当な大きいスヌケ数
current_sunuke = 999999999999999
s_current_sunuke = s(current_sunuke)
s_current_sunuke_div = current_sunuke / s_current_sunuke

# start = datetime.datetime.now()
next_sunuke(current_sunuke, s_current_sunuke, s_current_sunuke_div)
if found < k:
	print(current_sunuke)
# end = datetime.datetime.now()
# print(str(end-start))

# sunukes=[]

# n = current_sunuke - 1

# while(n >= 1):
# 	s_n = n / s(n)
# 	if s_n <= current_sunuke_n:
# 		#sunukes.insert(0,n)
# 		sunukes.append(n)
# 		current_sunuke = n
# 		current_sunuke_n = s_n
# 	n -= 1

# for n in sunukes:
# 	print (n)

Buggy submission (verdict: Runtime Error):
import math
#import datetime

def s(n):
	sum = 0
	for c in str(n):
		sum += int(c)
	return sum

k = int(input())
found=0

def next_sunuke(n, s_n, s_n_div):

	global found

	if n == 1:
		return

	m = n - 1
	s_mplus1 = s(m + 1)

	while m >= 1:
		s_m = s(m)

		if (s_m < s_mplus1 or (s_n - s_m != 1 and s_n - s_m != -8)) and m > 9:
			m -= 1
			s_mplus1 = s_m
			continue

		# print("check: " + str(m))

		s_m_div = m / s(m)

		if s_m_div <= s_n_div:
			next_sunuke(m, s_m, s_m_div)
			if found >= k:
				return

			found += 1
			# print("{0:5d}".format(m), "{0:2d}".format(s_m), s_m_div)
			print(m)
			break
		# else:
		# 	log_m = int(math.log(m,10))
		# 	if (m + 1) / (10 ** (log_m - 1)) == 19:

		# 		print ("skip: " + str(m) + " to " + str(10 ** log_m - 1))

		# 		m = 10 ** log_m - 1
		# 		s_mplus1 = s(m+1)
		# 		continue
		m -= 1
		s_mplus1 = s_m


# 適当な大きいスヌケ数
current_sunuke = 999999
s_current_sunuke = s(current_sunuke)
s_current_sunuke_div = current_sunuke / s_current_sunuke

#start = datetime.datetime.now()
next_sunuke(current_sunuke, s_current_sunuke, s_current_sunuke_div)
#end = datetime.datetime.now()
print(str(end-start))

# sunukes=[]

# n = current_sunuke - 1

# while(n >= 1):
# 	s_n = n / s(n)
# 	if s_n <= current_sunuke_n:
# 		#sunukes.insert(0,n)
# 		sunukes.append(n)
# 		current_sunuke = n
# 		current_sunuke_n = s_n
# 	n -= 1

# for n in sunukes:
# 	print (n)
Problem p03636 (python)

Fixed submission:
s = input()
print(s[0] + str(len(s)-2) + s[-1])

Buggy submission (verdict: Runtime Error):
s = input()
print(s[0] + (len(s)-2) + s[-1])
Problem p03128 (python)

Fixed submission:
cost = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]

''' 再帰が深すぎて, 再起不能
def solve(yoshida, possible, dp):
    if(yoshida == 0):
        dp[0] = 0
    elif(dp[yoshida] == -1):
        for x in possible:
            if(yoshida >= cost[x]):
                idx = yoshida - cost[x]
                solve(idx, possible, dp)
                a = (dp[idx]) * 10 + x
                dp[yoshida] = max(dp[yoshida], a)
'''

def solve(yoshida, possible, dp):
    dp[0] = 0
    for i in range(n):
        a = 10 * dp[i]
        for x in possible:
            dp[i + cost[x]] = max(dp[i + cost[x]], a + x)
if __name__ == '__main__':
    n, m = map(int, input().split())
    lst = list(map(int, input().split(" ")))
    DP = [-1] * (n + 10)
    solve(n, lst, DP)
    '''
    for i in range(n + 1):
        print("{} : {}".format(i, DP[i]))
    '''
    print(DP[n])

Buggy submission (verdict: Runtime Error):
cost = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]
def solve(yoshida, possible, dp):
    if(yoshida == 0):
        dp[0] = 0
    elif(dp[yoshida] == -1):
        for x in possible:
            if(yoshida >= cost[x]):
                idx = yoshida - cost[x]
                solve(idx, possible, dp)
                a = (dp[idx]) * 10 + x
                dp[yoshida] = max(dp[yoshida], a)

if __name__ == '__main__':
    n, m = map(int, input().split())
    lst = list(map(int, input().split(" ")))
    DP = [-1] * (n + 1)
    solve(n, lst, DP)
    '''
    for i in range(n + 1):
        print("{} : {}".format(i, DP[i]))
    '''
    print(DP[n])

Buggy submission (verdict: Runtime Error):
# Pythonで楽々いけちゃったりしないかな？
cost = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]
def solve(yoshida, possible, dp):
    if(yoshida == 0):
        dp[0] = 0
        return 0
    if(dp[yoshida] != -1):
        return dp[yoshida]
    for x in possible:
        if(yoshida >= cost[x]):
            if(solve(yoshida - cost[x], possible, dp) != -2):
                a = dp[yoshida - cost[x]] * 10 + x
                dp[yoshida] = max(dp[yoshida], a)
    if(dp[yoshida] == -1):
        dp[yoshida] = -2
    return dp[yoshida]

if __name__ == '__main__':
    n, m = map(int, input().split())
    lst = list(map(int, input().split()))
    DP = [-1] * (n + 1)
    print(solve(n, lst, DP))
    '''
    for i in range(n + 1):
        print("{} : {}".format(i, solve(i, lst, DP)))
    '''
Problem p03220 (python)

Fixed submission:
n = int(input())
t, a = map(int, input().split())
t *= 1000
a *= 1000
lst = list(map(int, input().split()))
tmp = abs(t - 6 * lst[0] - a)
tmpa = 0
for i in range(1, n):
    temp = abs(t - 6 * lst[i] - a)
    if temp < tmp:
        tmp = temp
        tmpa = i
print(tmpa + 1)

Buggy submission (verdict: Runtime Error):
n = int(input())
t, a = map(int, input().split())
t *= 1000
a *= 1000
lst = list(map(int, input().split()))
tmp = abs(t - 6 * lst[0] - a)
tmpa = 0
for i in range(1, n):
    temp = abs(t - 6 * lst[i] - a)
    if temp < tmp:
        tmp = tmp
        tmpa = i
print(tmpa + 1)
n = int(input())
t, a = map(int, input().split())
t *= 1000
a *= 1000
lst = list(map(int, input().split()))
tmp = abs(t - 6 * lst[0] - a)
tmpa = 0
for i in range(1, n):
    temp = abs(t - 6 * lst[i] - a)
    if temp < tmp:
        tmp = temp
        tmpa = i
print(tmpa + 1)

Buggy submission (verdict: Runtime Error):
n = int(input())
t, a = map(int, input().split())
t *= 1000
a *= 1000
lst = list(map(int, input().split()))
tmp = abs(t - 6 * lst[0] - a)
tmpa = 0
for i in range(1, n):
    if temp < tmp:
        tmp = tmp
        tmpa = i
print(tmpa + 1)
Problem p03262 (python)

Fixed submission:
# 正の数を受け取るように定義
def gcd(a,b):
    if b == 0:
        return a 
    return gcd(b,a % b)

N, X = map(int,input().split())
k = [abs(int(x) - X) for x in input().split()] # リスト内包表記で入力の受け取り
a = k[0]
for i in range(1,N):
    a = gcd(a,k[i])
print(str(a))

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

def LGcd(l):
    a = l[0]
    for i in range(1,len(l)):
        a = gcd(a,l[i])
    return a
N, X = map(int,input().split())
k = np.array(input().split())
k = k.astype(np.int64)
k -= X
if N == 1:
    print(str(abs(k[0])))
else:
    print(str(LGcd(k)))

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

def LGcd(l):
    a = l[0]
    for i in range(1,len(l)):
        a = gcd(a,l[i])
    return a
N, X = map(int,input().split())
k = np.array(input().split())
k = k.astype(np.int32)
k -= X
if N == 1:
    print(str(abs(k[0])))
else:
    print(str(LGcd(k)))

Buggy submission (verdict: Runtime Error):
import numpy as np
from math import gcd
from functools import reduce
def LGcd(l):
    a = l[0]
    for i in range(1,len(l)):
        a = gcd(a,l[i])
    return a
N, X = map(int,input().split())
k = np.array(input().split())
k = k.astype(np.int32)
k -= X
if N == 1:
    print(str(abs(k[0])))
else:
    print(str(LGcd(k)))

Buggy submission (verdict: Runtime Error):
import numpy as np
from math import gcd
from functools import reduce
def LGcd(l):
    return reduce(gcd,l)
N, X = map(int,input().split())
k = np.array(input().split())
k = k.astype(np.int32)
k -= X
if N == 1:
    print(str(abs(k[0])))
else:
    print(str(LGcd(k)))
Problem p03309 (python)

Fixed submission:
n = int(input())
lst = [int(x) for x in input().split()]
a = 0
for i in range(n):
    lst[i] = lst[i] - (i + 1)
lst.sort()
def sum(k):
    a = 0
    for i in range(n):
        a += abs(lst[i]-k)
    return a
ans = 0
if ans % 2 == 0:
    ans = min([sum(lst[int(n/2)-1]),sum(lst[int(n/2)])])
else:
    ans = sum(lst[int(n/2)])
print(str(ans))

Buggy submission (verdict: Runtime Error):
n = int(input())
lst = [int(x) for x in input().split()]
a = 0
for i in range(n):
    lst[i] = lst[i] - (i + 1)
lst.sort()
def sum(k):
    a = 0
    for i in range(n):
        a += abs(lst[i]-k)
    return a
ans = 0
if ans % 2 == 0:
    ans = min([sum(lst[int(n/2)]),sum(lst[int(n/2)+1])])
else:
    ans = sum(lst[int(n/2)+1])
print(str(ans))

Buggy submission (verdict: Runtime Error):
n = int(input())
lst = [int(x) for x in input().split()]
a = 0
for i in range(n):
    lst[i] = lst[i] - (i + 1)
def sum(k):
    a = 0
    for i in range(n):
        a += abs(lst[i]-k)
    return a
ans = min([sum(lst[int(n/2)]),sum(lst[int(n/2)+1])])
print(str(ans))
Problem p03457 (python)

Fixed submission:
import numpy as np
n = int(input())
T = []
X = []
Y = []
t1 = 0
x1 = 0
y1 = 0
for i in range(n):
    m = input().split()
    T.append(int(m[0]) - t1)
    t1 = int(m[0])
    X.append(abs(int(m[1]) - x1))
    x1 = int(m[1])
    Y.append(abs(int(m[2]) - y1))
    y1 = int(m[2])
T = np.array(T)
X = np.array(X)
Y = np.array(Y)
for i in range(n):
    if X[i] + Y[i] > T[i] or (X[i] + Y[i] + T[i]) % 2 == 1:
        print('No')
        break
else:
    print('Yes')

Buggy submission (verdict: Runtime Error):
n = int(input())
t1 = 0
x1 = 0
y1 = 0
boolean = True

for _ in range(n):
    t, x, y = [int(_) for _ in input().split()]
    if boolean:
        temp1 = x
        temp2 = t
        x = abs(x - x1) + abs(y - y1)
        t -= t1
        x1 = temp
        y1 = y
        t1 = temp2
        if x > t or (x + t) % 2 == 1:
            boolean = False
if boolean:
    print('Yes')
else:
    print('No')
Problem p03501 (python)

Fixed submission:
n, a, b = map(int, input().split())
print(min(n * a, b))

Buggy submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
res = min(n * a, b)
print(res)
Problem p04045 (python)

Fixed submission:
N , K = map(int,input().split())
lst = input().split()

start = N
while True:
    for num in str(start):
        if num in lst:
            break
    else:
        break
    start += 1
print(str(start))

Buggy submission (verdict: Runtime Error):
N , K = map(int,input().split())
lst = []
for i in range(K):
    lst.append(input())
start = N
while True:
    for num in str(start):
        if num in lst:
            break
    else:
        break
    start += 1
print(str(start))
Problem p04029 (python)

Fixed submission:
#!/usr/bin/python
# -*- coding: UTF-8 -*-

import sys


def std_in():
    return sys.stdin.readline().strip()


def _main():
    N = int(std_in())
    r = range(1, N + 1)
    print(sum(r))


if __name__ == "__main__":
    _main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/python
# -*- coding: UTF-8 -*-

import sys


def get_ints():
    return map(int, sys.stdin.readline().strip().split())


def _main():
    input()
    an = list(get_ints())

    t = 0
    old = 1000000000
    while 1:
        ans = sq(t, an)
        g = sq(t+1, an) - ans
        t -= g / abs(g)
        if old > ans:
            old = ans
        else:
            break
    print(int(old))


def sq(t, an):
    ans = 0
    for ai in an:
        ans += pow(ai - t, 2)
    return ans


if __name__ == "__main__":
    _main()
Problem p04043 (python)

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

s = input()
if s.count("5") == 2 and s.count("7") == 1:
	print("YES")
else:
  	print("NO")

Buggy submission (verdict: Runtime Error):
#!/usr/bin/python
# -*- coding: UTF-8 -*-

import sys


def input():
    return sys.stdin.readline().strip()


def _main():
	input()
    s = sorted(list(input().split()))
    print("".join(s))


if __name__ == "__main__":
    _main()
Problem p04044 (python)

Fixed submission:
#!/usr/bin/python
# -*- coding: UTF-8 -*-

import sys


def get_ints():
    return map(int, sys.stdin.readline().strip().split())


def input():
    return sys.stdin.readline().strip()


def _main():
    n, length = get_ints()
    s_list = [""] * n
    for i in range(n):
        s_list[i] = input()
    s = sorted(s_list)
    print("".join(s))


if __name__ == "__main__":
    _main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/python
# -*- coding: UTF-8 -*-

import sys


def input():
    return sys.stdin.readline().strip()


def _main():
	input()
    s = sorted(list(input().split()))
    print("".join(s))


if __name__ == "__main__":
    _main()
Problem p02536 (python)

Fixed submission:
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


N,M = map(int, input().split())
uf = UnionFind(N)
for _ in range(M):
    a,b=map(int, input().split())
    uf.union(a-1,b-1)
cnt = 0
for i in range(N-1):
    if(not uf.same(i,i+1)):
        cnt += 1
        uf.union(i+1,i)
print(cnt)

Buggy submission (verdict: Runtime Error):
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


N,M = map(int, input().split())
uf = UnionFind(N)
for _ in range(M):
    a,b=map(int, input().split())
    uf.union(a,b)
cnt = 0
for i in range(N-1):
    if(not uf.same(i,i+1)):
        cnt += 1
        uf.union(i,i+1)
print(cnt)
Problem p02924 (python)

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

Buggy submission (verdict: Runtime Error):
print(sum(list(range(int(input())))))
Problem p02995 (python)

Fixed submission:
import fractions

def main():
    A,B,C,D = map(int, input().split())  
    lc = lcm(C, D)
    Bsum = B - (B//C) - (B//D) + (B//lc)
    A1 = A-1
    Asum = A1 - (A1//C) - (A1//D) + (A1//lc)
    print(Bsum-Asum)
    
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)



if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import math

def main():
    A,B,C,D = map(int, input().split())  
    lc = lcm(C, D)
    Bsum = B - (B//C) - (B//D) + (B//lc)
    A1 = A-1
    Asum = A1 - (A1//C) - (A1//D) + (A1//lc)
    print(Bsum-Asum)
    
def lcm(x, y):
    return (x * y) // math.gcd(x, y)



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

Fixed submission:
R,G,B,N = map(int, input().split())  

BALL = [0]*(N+100)
BALL[0] = 1

for num in range(0,N+1,1):
    if BALL[num] != 0 and num + R <= N:
        BALL[num+R] += BALL[num]
for num in range(0,N+1,1):
    if BALL[num] != 0 and num + G <= N:
        BALL[num+G] += BALL[num]

for num in range(0,N+1,1):
    if BALL[num] != 0 and num + B <= N:
        BALL[num+B] += BALL[num]

print(BALL[N])

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

BALL = [0]*(N+100)
BALL[0] = 1

for num in range(0,N+1,1):
    if BALL[num] != 0:
        BALL[num+R] += BALL[num]
for num in range(0,N+1,1):
    if BALL[num] != 0:
        BALL[num+G] += BALL[num]

for num in range(0,N+1,1):
    if BALL[num] != 0:
        BALL[num+B] += BALL[num]

print(BALL[N])
Problem p03282 (python)

Fixed submission:
def main():
    S  = input()
    K  = int(input())

    cnt = 0
    while cnt<len(S) and  S[cnt]=='1':
        cnt = cnt + 1
    
    if K<=cnt:
        print(S[0])
    elif cnt==len(S):
        print(S[cnt-1])
    else:
        print(S[cnt])


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    S  = input()
    K  = int(input())

    cnt = 0
    while S[cnt]=='1' and cnt<len(S):
        cnt = cnt + 1
    
    if K<=cnt:
        print(S[0])
    elif cnt==len(S):
        print(S[cnt-1])
    else:
        print(S[cnt])


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    S  = input()
    K  = int(input())

    cnt = 0
    while S[cnt]=='1' and cnt<len(S):
        cnt = cnt + 1
    
    if K<=cnt:
        print(S[0])
    else:
        print(S[cnt])


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):

def main():
    S  = input()
    K  = input()

    cnt = 0
    while S[cnt]=='1':
        cnt = cnt + 1
    
    if K<=cnt:
        print(S[0])
    else:
        print(S[cnt+1])




if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    S  = input()
    K  = input()
    if K==1:
        print(S[0])
    elif S[0]=='1':
        print(S[1])
    else:
        print(S[0])



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

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

max_x = 0
idx = 0
x = 0

if n == k:
    print((sum(p) + k) / 2)
    exit()

for i in range(n-k):
    x += p[i+k] - p[i]
    if max_x < x:
        max_x = x
        idx = i+1

ans = (sum(p[idx:idx+k]) + k) / 2
print(ans)

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

max_x = 0
idx = 0
x = 0

for i in range(n-k+1):
    x += p[i+k] - p[i]
    if max_x < x:
        max_x = x
        idx = i

ans = (sum(p[i:i+k]) + k) / 2
print(ans)

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

max_x = 0
idx = 0
x = 0

for i in range(n-k):
    x += p[i+k] - p[i]
    if max_x < x:
        max_x = x
        idx = i

ans = (sum(p[i:i+k]) + k) / 2
print(ans)
Problem p02797 (python)

Fixed submission:
n, k, s = map(int, input().split())
ans = [s] * k
if s // 2 + 1 == s:
    ss = s // 2 + 10
else:
    ss = s // 2 + 1
ex = [ss] * (n-k)
ans.extend(ex)

for e in ans:
    print(e, end=' ')
print()

Buggy submission (verdict: Runtime Error):
n, k, s = map(int, input().split())
ans = [s] * k
ex = [s//2+1] * (n-k) if s != 1 else 2
ans.extend(ex)

for e in ans:
    print(e, end=' ')
print()
Problem p02841 (python)

Fixed submission:
m1, d1 = map(int, input().split())
m2, d2 = map(int, input().split())

if (m1 != m2):
    print("1")
else:
    print("0")

Buggy submission (verdict: Runtime Error):
m1, d1 = map(int, input().split())
m2, d2 = map(int, input().split())

if (mi != m2):
    print("1")
else:
    print("0")
Problem p02861 (python)

Fixed submission:
n = int(input())
pl = list()
for i in range(n):
    pl.append(list(map(int, input().split())))

import math
lsum = 0
for i in range(n):
    for j in range(n):
        if i != j:
            a, b = pl[i]
            c, d = pl[j]
            lsum += math.sqrt((a-c) ** 2 + (b-d) ** 2)
print(lsum /(n))

Buggy submission (verdict: Runtime Error):
n = int(input())
pl = list()
for i in range(n):
    pl.append(list(map(int, input().split())))

import math
lsum = 0
for i in range(n):
    for j in range(n):
        if i != j:
            a, b = pl[i]
            c, d = pl[j]
            lsum += math.sqrt((a-c) ** 2 + (b-d) ** 2)
print(lsum /(n)

Buggy submission (verdict: Runtime Error):
n = int(input())
pl = list()
for i in range(n):
    pl.append(list(map(int, input().split())))

import math
lsum = 0
for i in range(n):
    for j in range(n):
        if i != j:
            a, b = pl[i]
            c, d = pl[j]
            lsum += math.sqrt((a-c) ** 2 + (b-d) ** 2)
print(lsum /(2 * n)

Buggy submission (verdict: Runtime Error):
n = int(input())
pl = list()
for i in range(n):
    pl.append(list(map(int, input().split(()))))

import math
lsum = 0
for i in range(n):
    for j in range(n): 
        if i != j:
            a, b = pl[i]
            c, d = pl[j]
            lsum += math.sqrt((a-c) ** 2 + (b-d) ** 2)
print(lsum / 4 * math.factorial(n) * 2 / 3)
Problem p02865 (python)

Fixed submission:
n = int(input())
if n % 2 == 1:
    print(int((n - 1) / 2))
else:
    print(int(n / 2 - 1))

Buggy submission (verdict: Runtime Error):
n = int(input())
if n % 2 == 1:
    print((int(n - 1) / 2))
else:
    printint((n / 2 - 1))
Problem p02947 (python)

Fixed submission:
import sys
input = sys.stdin.readline

n = int(input())
ss = [[""]]*n
for i in range(n):
    s = list(input())
    s.sort()
    ss[i] = s

ss.sort()

ans = 0
while len(ss) != 0:
    f = ss.pop(0)
    c = 1
    while len(ss) > 0:
        d = ss[0]
        if f == d:
            ss.pop(0)
            ans += c
            c += 1
        else:
            break

print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
ss = [[""]]*n
for i in range(n):
    s = list(input())
    s.sort()
    ss[i] = s

def annagram(s1: str, s2: str) -> bool:
    for i in range(10):
        if s1[i] != s2[i]:
            return False
    return True


ans: int = 0
for i in range(n-1):
    for j in range(i+1, n):
        if annagram(ss[i], ss[j]):
            ans += 1

print(ans)
Problem p02994 (python)

Fixed submission:
(n, l) = map(int, input().split())
d = [l + i for i in range(n)]
c = [abs(i) for i in d.copy()]
nearest0 = c.index(min(c))
d.remove(d[nearest0])
ans = sum(d)
print(ans)

Buggy submission (verdict: Runtime Error):
(n, l) = map(int, input().split())
d = [l + i for i in range(n)]
c = [abs(i) for i in d.copy()]
nearest0 = c.index(min(c))
d.remove(d[nearest0])
ans = sum(d)
print(ans)