Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
k,n=int(input().split())
a = list(map(int,input().split()))
m = k-a[n-1]+a[0]
 
for i in range(n-1):
	m = max(m,a[i+1]-m[n])

x = k-m
print(x)

Fixed submission:
k,n=map(int,input().split())
a = list(map(int,input().split()))
m = k-a[n-1]+a[0]
for i in range(n-1):
	m = max(m,a[i+1]-a[i])
x = k-m
print(x)

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

for i in range(n-1)
	m = max(m,a[i+1]-m[n])

x = k-m
print(x)

Fixed submission:
k,n=map(int,input().split())
a = list(map(int,input().split()))
m = k-a[n-1]+a[0]
for i in range(n-1):
	m = max(m,a[i+1]-a[i])
x = k-m
print(x)
Buggy python submission (verdict: Runtime Error):
from sys import stdin
n,k=map(int,input().split())
c=0
while n > 0:
    c += 1
    n//=k
print(c)


Fixed submission:
from sys import stdin

n,r=map(int,input().split())

if n < 10:
    print(r + 100 * (10-n))
else:
    print(r)

Buggy python submission (verdict: Runtime Error):
from sys import stdin
n,k=list(map(int,input().split()))
c=0
while n > 0:
    c += 1
    n//=k
print(c)


Fixed submission:
from sys import stdin

n,r=map(int,input().split())

if n < 10:
    print(r + 100 * (10-n))
else:
    print(r)

Buggy python submission (verdict: Runtime Error):
from sys import stdin
n,k=list(map(int,input().split()))
c=1
while True:
    n//=k
    if n == 0
        break
    else:
        c+=1

print(c)


Fixed submission:
from sys import stdin

n,r=map(int,input().split())

if n < 10:
    print(r + 100 * (10-n))
else:
    print(r)

Buggy python submission (verdict: Runtime Error):
from sys import stdin

n = input()
r = input()

if n < 10:
    print(r + 100 * (10-n))
else:
    print(r)


Fixed submission:
from sys import stdin

n,r=map(int,input().split())

if n < 10:
    print(r + 100 * (10-n))
else:
    print(r)

Buggy python submission (verdict: Runtime Error):
from sys import stdin

n = int(input())
r = int(input())

if n < 10:
    print(r + 100 * (10-n))
else:
    print(r)


Fixed submission:
from sys import stdin

n,r=map(int,input().split())

if n < 10:
    print(r + 100 * (10-n))
else:
    print(r)

Buggy python submission (verdict: Runtime Error):
from sys import stdin

n = int(input())
r = int(input())

if n < 11:
    a = r + 100 * (10-n)
else:
    a = r

print(a)


Fixed submission:
from sys import stdin

n,r=map(int,input().split())

if n < 10:
    print(r + 100 * (10-n))
else:
    print(r)

Buggy python submission (verdict: Runtime Error):
from sys import stdin

n = int(input())
r = int(input())

if n < 11:
    a = r + 100 * (10-n)
else:
    a = r

print(n)


Fixed submission:
from sys import stdin

n,r=map(int,input().split())

if n < 10:
    print(r + 100 * (10-n))
else:
    print(r)

Buggy python submission (verdict: Runtime Error):
from sys import stdin

n = int(input())
r = int(input())

if n < 11:
    a = r - 100 * (10-n)
else:
    a = r

print(n)


Fixed submission:
from sys import stdin

n,r=map(int,input().split())

if n < 10:
    print(r + 100 * (10-n))
else:
    print(r)
Buggy python submission (verdict: Runtime Error):
from sys import stdin

n,k=map(int,input().split())
num = n
sum_k = k
for sum_k <= n:
    sum_k= sum_k * k
print(len(sum_k))
 


Fixed submission:
from sys import stdin
n,k=map(int,input().split())
c=0
while n > 0:
    c += 1
    n=n//k
print(c)

Buggy python submission (verdict: Runtime Error):
from sys import stdin

n,k=map(int,input().split())
num = k
sum_k = n
for sum_k <= n:
    sum_k= sum_k*n
print(len(sumk))
 


Fixed submission:
from sys import stdin
n,k=map(int,input().split())
c=0
while n > 0:
    c += 1
    n=n//k
print(c)
Buggy python submission (verdict: Runtime Error):
from sys import stdin
if m >= n:
    print("Yes")
else:
    print("No")

Fixed submission:
from sys import stdin
n,m=map(int,input().split())
if m >= n:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
from sys import stdin

n=int(input())
p=list(map(int,input().split()))

a=p[0]
cnt=1

for i in range(1,n):
    if p[i]<=a:
    cnt+=1
    a = p[i]

print(cnt)
      

Fixed submission:
from sys import stdin

n=int(input())
p=list(map(int,input().split()))

a=p[0]
cnt=1

for i in range(1,n):
    if p[i]<a:
        cnt+=1
        a = p[i]

print(cnt)

Buggy python submission (verdict: Runtime Error):
from sys import stdin

n=int(input())
p=list(map(int,input().split()))

a=p[0]
cnt=0

for i in range(1,n):
    if p[i]<=a
    cnt+=1
    a = p[i]

print(cnt)
      

Fixed submission:
from sys import stdin

n=int(input())
p=list(map(int,input().split()))

a=p[0]
cnt=1

for i in range(1,n):
    if p[i]<a:
        cnt+=1
        a = p[i]

print(cnt)

Buggy python submission (verdict: Runtime Error):
from sys import stdin

n=int(input())
p=list(map(int,input().split()))

a=p[0]
cnt=1

for i in range(1,n):
    if p[i]<=a
    cnt+=1
    a = p[i]

print(cnt)
      

Fixed submission:
from sys import stdin

n=int(input())
p=list(map(int,input().split()))

a=p[0]
cnt=1

for i in range(1,n):
    if p[i]<a:
        cnt+=1
        a = p[i]

print(cnt)

Buggy python submission (verdict: Runtime Error):
from sys import stdin

n=int(input())
p=list(map(int,input().split()))

a=p[0]
cnt=0

for i in range(1,n):
    if p[i]<=a
    cnt+=1
    a = p[1]

print(cnt)
      

Fixed submission:
from sys import stdin

n=int(input())
p=list(map(int,input().split()))

a=p[0]
cnt=1

for i in range(1,n):
    if p[i]<a:
        cnt+=1
        a = p[i]

print(cnt)
Buggy python submission (verdict: Runtime Error):
from sys import stdin

P,Q,R = int(stdin.readline().rstrip().split())
print(min(P+Q,Q+R,P+R))

Fixed submission:
from sys import stdin

P,Q,R = map(int,input().split())
print(min(P+Q,Q+R,P+R))
Buggy python submission (verdict: Runtime Error):
a = int(input())
if a==7 or a==5 or a==3:
	print("YES")
else print("NO")

Fixed submission:
a = int(input())
if a==7 or a==5 or a==3:
	print("YES")
else:
	print("NO")
Buggy python submission (verdict: Runtime Error):
import numpy as np
N = int(input()) 
ai = np.arange(1,(n+1))
result = 0
for i in ai:
    if i % 3 == 0 or i % 5 == 0:
      result += i
print(result)

Fixed submission:
N = input()
if N[-1] == str(7):
    print('Yes')
elif N[-2] == str(7):
    print('Yes')
elif N[-3] == str(7):
    print('Yes')    
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
n = input()
i = 7
if i in n:
 print('Yes')
else:
  print('No')

Fixed submission:
N = input()
if N[-1] == str(7):
    print('Yes')
elif N[-2] == str(7):
    print('Yes')
elif N[-3] == str(7):
    print('Yes')    
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
a,b,c = map(int,input().split())

if a = b = c :
  print('No')
else:
  print('Yes')

Fixed submission:
a,b,c = map(int,input().split())
if a == b == c == a:
  print('No')
elif a == b or b == c or a == c:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
a, b, c = map(int, input().split())

if a + b = c:
  print('yes')
elif b + c = a:
  print('yes')
elif c + a = b:
  print('Yes')
else:
  print('No')


Fixed submission:
a, b, c = map(int, input().split())
 
if a + b == c:
  print('Yes')
elif b + c == a:
  print('Yes')
elif c + a == b:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
K = int(input())
S = input()
 
if len(S) =< len(K):
    print(S)
    
else:
    print(S[1:len(S)]+'...')

Fixed submission:
K = int(input())
S = input()
 
if len(S) <= K:
    print(S)
    
else:
    print(S[0:K]+'...')

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

if len(S) =< len(K):
    print(S)
    
else:
    print((str[1:S])+'...')

Fixed submission:
K = int(input())
S = input()
 
if len(S) <= K:
    print(S)
    
else:
    print(S[0:K]+'...')
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
Ss = []
while N > 0:
    s = input()
    if s not in Ss:
        Ss.append(s)
    N = N -1

print(len(Ss))

Fixed submission:
N = int(input())
Ss = set()
while N > 0:
    s = input()
    if s not in Ss:
        Ss.add(s)
    N = N -1

print(len(Ss))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
Ss = []
while N > 0:
    s = input()
    if s not in Ss:
        Ss.append(s)
    N = N -1

print(len(Ss))

Fixed submission:
N = int(input())
Ss = set()
while N > 0:
    s = input()
    if s not in Ss:
        Ss.add(s)
    N = N -1

print(len(Ss))
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = input()
a = len(s)
if s <= n:
  print(s)
else:
  print(s[0:n-1] + '...')


Fixed submission:
n = int(input())
s = input()
a = len(s)
if a <= n:
  print(s)
else:
  print(s[0:n] + '...')
Buggy python submission (verdict: Runtime Error):
s = list(input())
t = list(input())
n = int(len(t))
if s =  t[0:n-2]:
  print('Yes')
else:
  print('No')


Fixed submission:
s = list(input())
t = list(input())
n = int(len(t))
m = int(len(s))
if s == t[0:n-1] and n-1 == m:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
s = list(input())
t = list(input())
n = int(len(t))
if s =  t[0:n-1]:
  print('Yes')
else:
  print('No')


Fixed submission:
s = list(input())
t = list(input())
n = int(len(t))
m = int(len(s))
if s == t[0:n-1] and n-1 == m:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
s = list(input())
t = list(input())
n = len(t)
if s =  t[0:n-1]:
  print('Yes')
else:
  print('No')

Fixed submission:
s = list(input())
t = list(input())
n = int(len(t))
m = int(len(s))
if s == t[0:n-1] and n-1 == m:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
s = input())
t = input())
n = 1
m = len(t)
if s == t[0:m-1]:
  print('Yes')
else:
  print('No')

Fixed submission:
s = list(input())
t = list(input())
n = int(len(t))
m = int(len(s))
if s == t[0:n-1] and n-1 == m:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
n = list(int,input())
if n[0] == 7 or n[1] == 7 or n[2] == 7
  print('Yes')
else:
  print('No')

Fixed submission:
n = input()
if '7' in n:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
n = list(int,input())
if n[0] == 7 or n[1] == 7 or n[2] == 7
  print('Yes')
elif:
  print('No')


Fixed submission:
n = input()
if '7' in n:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
n = list(int,input())
if 7 in n:
  print('Yes')
elif:
  print('No')


Fixed submission:
n = input()
if '7' in n:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
x = int(input())
a = 500
b = 5
q = x//a
mod = x%a
if q > 0:
  c = q * 1000
elif mod // b > 0:
  d = (mod // b) * 5
  print(c + d)
else:
  print('0')
  

Fixed submission:
x = int(input())
s = 1000*(x//500) + 5*((x%500)//5)
print(s)
Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
print(N * (N -1) //　2 + M * (M - 1) // 2)


Fixed submission:
N,M = map(int,input().split())
print(N*(N-1)//2+M*(M-1)//2)

Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
print(N * (N -1) //　2 + M * (M - 1) // 2

Fixed submission:
N,M = map(int,input().split())
print(N*(N-1)//2+M*(M-1)//2)
Buggy python submission (verdict: Runtime Error):
S = input()
N = len(S)
A = (len(S) - 1) // 2
B = (len(S) + 3) // 2
if S[0:A] == S[B - 1:N]:
  print('Yes')
elif:
  print('No')

Fixed submission:
S = input()
N = len(S)
A = (len(S) - 1) // 2
B = (len(S) + 3) // 2
if S[0:A] == S[B - 1:N]:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
S = input()
N = len(S)
A = (N - 1) // 2
B = ((N + 3) // 2)
if S[0:A] == S[B - 1:N]:
  print('Yes')
elif:
  print('No')

Fixed submission:
S = input()
N = len(S)
A = (len(S) - 1) // 2
B = (len(S) + 3) // 2
if S[0:A] == S[B - 1:N]:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
S= input()
N = len(S)
A = (len(S) - 1) // 2
B = (len(S) + 3) // 2
if S[0:A] == S[B - 1:N]:
  print('Yes')
elif:
  print('No')

Fixed submission:
S = input()
N = len(S)
A = (len(S) - 1) // 2
B = (len(S) + 3) // 2
if S[0:A] == S[B - 1:N]:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
S = input()
N = len(S)
A = (N - 1) // 2
B = ((N + 3) // 2)
if S[0:A] == S[B - 1:N]:
  print('Yes')
elif:
  print('No')

Fixed submission:
S = input()
N = len(S)
A = (len(S) - 1) // 2
B = (len(S) + 3) // 2
if S[0:A] == S[B - 1:N]:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
S = input()
N = len(S)
A = (N-1)//2
B = ((N+2)//2)
if S[0:A] == S[B:N]:
  print('Yes')
elif:
  print('No')

Fixed submission:
S = input()
N = len(S)
A = (len(S) - 1) // 2
B = (len(S) + 3) // 2
if S[0:A] == S[B - 1:N]:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
S = input()
N = len(S)
A = (N-1)//2
B = ((N+2)//2)
if S[0:A] == [B:N]:
  print('Yes')
elif:
  print('No')

Fixed submission:
S = input()
N = len(S)
A = (len(S) - 1) // 2
B = (len(S) + 3) // 2
if S[0:A] == S[B - 1:N]:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
S = input()
N = len(S)
if S[0:(N-1)//2] == [((N+2)//2):N]:
  print('Yes')
elif:
  print('No')

Fixed submission:
S = input()
N = len(S)
A = (len(S) - 1) // 2
B = (len(S) + 3) // 2
if S[0:A] == S[B - 1:N]:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
S = input()
N = len(S)
i = list(S)
if i[0:(N-1)//2] == [((N+2)//2):N]:
  print('Yes')
elif:
  print('No')

Fixed submission:
S = input()
N = len(S)
A = (len(S) - 1) // 2
B = (len(S) + 3) // 2
if S[0:A] == S[B - 1:N]:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
S = input()
N = len(S)
i = list(S)
if i[0:((N+3)//2-2)] == [((N+3)//2):N]:
  print('Yes')
elif:
  print('No')

Fixed submission:
S = input()
N = len(S)
A = (len(S) - 1) // 2
B = (len(S) + 3) // 2
if S[0:A] == S[B - 1:N]:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
S = input()
N = len(S)
i = list(S)
if i[0:((N+2)//2)] == [(N+4)//2:N]:
  print('Yes')
elif:
  print('No')

Fixed submission:
S = input()
N = len(S)
A = (len(S) - 1) // 2
B = (len(S) + 3) // 2
if S[0:A] == S[B - 1:N]:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
L = int(input())
print((l/3)**3)

Fixed submission:
L = int(input())
print((L/3)**3)

Buggy python submission (verdict: Runtime Error):
L = int(input())
if L % 3 == 0:
  A = L / 3
  B = A ** 3
  print('{:.12f}'.format(B))
else:
  C = L / 3
  D = C ** 3
  print('{:.12f}'.format(B))

Fixed submission:
L = int(input())
print((L/3)**3)
Buggy python submission (verdict: Runtime Error):
N, M = input().split()
A = 0.25
B = (0.25 / int(M))

C = map(int, input().split())
D = B * sum(C)



E = sum(x > int(D) for x in C)
print(E)

Fixed submission:
# -*- coding: utf-8 -*-
# 整数の入力
X, Y, Z =  input().split()
# スペース区切りの整数の入力

# 文字列の入力

# 出力
print("{} {} {}".format(Z, X, Y))
Buggy python submission (verdict: Runtime Error):
1 100

Fixed submission:
t, x = map(int, input().split(' '))
print(t / x)
Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
a = [0] + list(map(int,input().split())) #1_indexed
tele = [1]
appear = []
while True:
    next_number = a[tele[len(tele)-1]]
    if not next_number in appear:
        tele.append(next_number)
        appear.append(next_number)
    else:
        repeat = tele.index(next_number)
        tele_1 = tele[:repeat]
        tele_2 = tele[repeat:]
        break

if k < len(tele_1):
    print(tele_1[k])
else:
    k_new = (k-len(tele_1)+1) % len(tele_2)
    print(tele_2[k_new-1])

Fixed submission:
n,k = map(int,input().split())
a = [0] + list(map(int,input().split())) #1_indexed
tele = [1]
used = [False for i in range(n)]
while True:
    next_number = a[tele[len(tele)-1]]
    if not used[next_number-1]:
        tele.append(next_number)
        used[next_number-1] = True
    else:
        repeat = tele.index(next_number)
        tele_1 = tele[:repeat]
        tele_2 = tele[repeat:]
        break

if k < len(tele_1):
    print(tele_1[k])
else:
    k_new = (k-len(tele_1)+1) % len(tele_2)
    print(tele_2[k_new-1])
Buggy python submission (verdict: Runtime Error):
K = int(input())
A, =B map(int,input().split())

if B // K < A // K :
    print('OK')
else :
    print('NG')

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

if A % K == 0:
    print('OK')
else:
    m = A // K
    if (m + 1) * K <= B:
        print('OK')
    else:
        print('NG')
Buggy python submission (verdict: Runtime Error):
S = input()
n = len(S)
dp = {0:1}
q = 1
p = 0
for i in range(n):
    p += int(S[n-1-i])*q
    q *= 10
    q = q % 2019
    p = p % 2019
    if p not in dp:
        dp[p] = 1
    else:
        dp[p] += 1
print(dp)
print(sum(dp[i]*(dp[i]-1)//2 for i in dp))

Fixed submission:
s,w = map(int,input().split())
print("safe" if s > w else "unsafe")

Buggy python submission (verdict: Runtime Error):
import collections
s_str = input()
s = [int(s_str[i]) for i in range(len(s_str))] #リスト型に文字列を格納します
n = len(s_str)
s_block = []
for k in range(n):
    a = sum(s[i]*10**(n-i-1) for i in range(k,n)) % 2019
    s_block.append(a)
s_dict = list(dict(collections.Counter(s_block)).values())
ans = sum(s_dict[i]*(s_dict[i]-1)/2 for i in range(len(s_dict)))
print(int(ans))

Fixed submission:
s,w = map(int,input().split())
print("safe" if s > w else "unsafe")
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = list(set([int(input()) for _ in range(n)]))
print(len(s) )

Fixed submission:
n = int(input())
s = list(set([input() for _ in range(n)]))
print(len(s) )
Buggy python submission (verdict: Time Limit Exceeded):
import collections
s = list(input())
s = list(map(int,s))
s_mod =[0]
mod = 0
for i in range(len(s)):
    a = s[len(s) - 1- i]* (10**i)
    mod += a
    mod = mod % 2019
    s_mod.append(mod)
s_values = list(collections.Counter(s_mod).values())
print(int(sum(s_values[i]*(s_values[i]-1)/2 for i in range(len(s_values)))))

Fixed submission:
S = input()
n = len(S)
dp = {0:1}
q = 1
p = 0
for i in range(n):
    p += int(S[n-1-i])*q
    q *= 10
    q = q % 2019
    p = p % 2019
    if p not in dp:
        dp[p] = 1
    else:
        dp[p] += 1
print(sum(dp[i]*(dp[i]-1)//2 for i in dp))
Buggy python submission (verdict: Runtime Error):
n = int(input())
A = []
ans = 0
for i in range(n):
    x =int(input())
    lists = [list(map(int,input().split())) for j in range(x)]
    A.append(lists)

for i in range(2**n):
    honesty = [0]*n
    for j in range(n):
        if (i>>j) & 1:
            honesty[j] = 1
    true = 1
    for j in range(n):
        if honesty[j] == 1:
            for k in range(len(A[j])):
                x,y = A[j][k]
                
                if  honesty[x] != y :
                    true = 0
                    break
    if true == 1:
        ans = max(ans,sum(honesty))
print(ans)

Fixed submission:
n = int(input())
A = []
ans = 0
for i in range(n):
    x =int(input())
    lists = [list(map(int,input().split())) for j in range(x)]
    A.append(lists)

for i in range(2**n):
    honesty = [0]*n
    for j in range(n):
        if (i>>j) & 1:
            honesty[j] = 1
    true = 1
    for j in range(n):
        if honesty[j] == 1:
            for k in range(len(A[j])):
                x,y = A[j][k]
                if not honesty[x-1] == y:
                    true = 0
                    break
    if true == 1:
        ans = max(ans,sum(honesty))
print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
A = []
ans = 0
for i in range(n):
    x =int(input())
    lists = [list(map(int,input().split())) for j in range(x)]
    A.append(lists)

for i in range(2**n):
    honesty = [0]*n
    for j in range(n):
        if (i>>j) & 1:
            honesty[j] = 1
    true = 1
    for j in range(n):
        if honesty[j] == 1:
            for k in range(len(A[j])):
                x,y = A[j][k]
                
                if  honesty[x] != y :
                    true = 0
                    break
    if true == 1:
        ans = max(ans,sum(honesty))
print(ans)

Fixed submission:
n = int(input())
A = []
ans = 0
for i in range(n):
    x =int(input())
    lists = [list(map(int,input().split())) for j in range(x)]
    A.append(lists)

for i in range(2**n):
    honesty = [0]*n
    for j in range(n):
        if (i>>j) & 1:
            honesty[j] = 1
    true = 1
    for j in range(n):
        if honesty[j] == 1:
            for k in range(len(A[j])):
                x,y = A[j][k]
                if not honesty[x-1] == y:
                    true = 0
                    break
    if true == 1:
        ans = max(ans,sum(honesty))
print(ans)
Buggy python submission (verdict: Runtime Error):
8
-406 10
512 859
494 362
-955 -475
128 553
-986 -885
763 77
449 310

Fixed submission:
import numpy as np
import itertools 
def distance(a,b):
    x1,y1 = a
    x2,y2 = b
    return np.sqrt((x1-x2)**2 + (y1- y2)**2)
n = int(input())
xy = []
for _ in range(n):
    x,y = map(int,input().split())
    xy.append([x,y])
n_permutations = itertools.permutations(range(n))
dist_list=[]
for one_case in n_permutations:
    dist = 0
    for i in range(n-1):
        a = xy[one_case[i]]
        b = xy[one_case[i+1]]
        dist += distance(a,b)
    dist_list.append(dist)
print(sum(dist_list)/len(dist_list))
Buggy python submission (verdict: Runtime Error):
if m<=n or i ==1:
    print(0)
else:
    n,m = map(int,input().split())
    x = list(map(int,input().split()))
    x_delta=[]
    x.sort()
    for i in range(len(x)-1):
        delta = x[i+1] - x[i]
        x_delta.append(delta)
    print(sum(sorted(x_delta)[:m-n]))

Fixed submission:
n,m = map(int,input().split())
x = list(map(int,input().split()))
if m<=n :
    print(0)
else:
    x_delta=[]
    x.sort()
    for i in range(len(x)-1):
        delta = x[i+1] - x[i]
        x_delta.append(delta)
    print(sum(sorted(x_delta)[:m-n]))
Buggy python submission (verdict: Time Limit Exceeded):
n,K = map(int,input().split())
h = list(map(int,input().split()))
dp = [float("inf")]*n
dp[0] = 0
for i in range(1,n):
    for k in range(1,K+1):
        if i-k>=0:
            dp[i] = min(dp[i],dp[i-k] + abs(h[i-k] - h[i]))
print(dp[n-1])

Fixed submission:
n,K = map(int,input().split())
h = list(map(int,input().split()))
dp = [float("inf")]*n
dp[0] = 0
for i in range(1,n):
    for k in range(1,K+1):
        if i-k>=0:
            dp[i] = min(dp[i],dp[i-k] + abs(h[i-k] - h[i]))
print(dp[n-1])
Buggy python submission (verdict: Time Limit Exceeded):
n,W = map(int,input().split())
w = []
v = []
for _ in range(n):
    weight,value = map(int,input().split())
    w.append(weight)
    v.append(value)

INF = float("inf")
order = 10**5  + 1 
dp = [[INF] * order for _ in range(n+1)] #dp[i+1][value] i番目まで選んで価値をvalue以上にする時の重さの最小値
dp[0][0] = 0

for i in  range(n):
    for value in range(order):
        if value-v[i]>= 0:
            dp[i+1][value] = min(dp[i+1][value],dp[i][value-v[i]] + w[i])
        dp[i+1][value] = min(dp[i+1][value],dp[i][value])

ans = 0
for value in range(order):
    if dp[n][value] <= W:
        ans = max(ans,value)
print(ans)

Fixed submission:
n,W = map(int,input().split())
w = []
v = []
for _ in range(n):
    weight,value = map(int,input().split())
    w.append(weight)
    v.append(value)

INF = float("inf")
order = 10**5  + 1 
dp = [[INF] * order for _ in range(n+1)] #dp[i+1][value] i番目まで選んで価値をvalue以上にする時の重さの最小値
dp[0][0] = 0

for i in  range(n):
    for value in range(order):
        if value-v[i]>= 0:
            dp[i+1][value] = min(dp[i+1][value],dp[i][value-v[i]] + w[i])
        dp[i+1][value] = min(dp[i+1][value],dp[i][value])

ans = 0
for value in range(order):
    if dp[n][value] <= W:
        ans = max(ans,value)
print(ans)