Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
import math
import sys
sys.setrecursionlimit(int(10**9))

mod = 10**9 + 7

def power(x, y):
    if   y == 0     : return 1
    elif y == 1     : return x % mod
    elif y % 2 == 0 : return power(x, y/2)**2 % mod
    else            : return power(x, y//2)**2 * x % mod

def fact(n):
    if n == 1: 
        return 1
    else:
        return (fact(n-1)*n)%mod

def comb(n, k):
    ans = 1
    for i in range(k):
        ans *= (n-i)
        ans //= i+1
    return ans % mod

n, a, b = map(int, input().split())
now = 1
for i in range(a):
    now = (now*(n-i)*power(i+1,mod-2))%mod
cnka = now
for i in range(a,b):
    now = (now*(n-i)*power(i+1,mod-2))%mod
cnkb = now

ans = power(2, n)%mod - cnka - cnkb - 1
print(ans % mod)

Fixed submission:
import math
import sys
sys.setrecursionlimit(int(10**9))

mod = 10**9 + 7

def power(x, y):
    if   y == 0     : return 1
    elif y == 1     : return x % mod
    elif y % 2 == 0 : return power(x, y/2)**2 % mod
    else            : return power(x, y//2)**2 * x % mod

def fact(n):
    if n == 1: 
        return 1
    else:
        return (fact(n-1)*n)%mod

def comb(n, k):
    ans = 1
    for i in range(k):
        ans *= (n-i)
        ans //= i+1
    return ans % mod

n, a, b = map(int, input().split())
now = 1
for i in range(a):
    now = (now*(n-i))%mod
cnka = (now * power(math.factorial(a),mod-2) )% mod
for i in range(a,b):
    now = (now*(n-i))%mod
cnkb = (now * power(math.factorial(b),mod-2) )% mod

ans = power(2, n)%mod - cnka - cnkb - 1
print(ans % mod)

Buggy python submission (verdict: Time Limit Exceeded):
import math
import sys
sys.setrecursionlimit(int(10**9))

mod = 10**9 + 7

def power(x, y):
    if   y == 0     : return 1
    elif y == 1     : return x % mod
    elif y % 2 == 0 : return power(x, y/2)**2 % mod
    else            : return power(x, y//2)**2 * x % mod

def fact(n):
    if n == 1: 
        return 1
    else:
        return (fact(n-1)*n)%mod

def comb(n, k):
    ans = 1
    for i in range(k):
        ans *= (n-i)
        ans //= i+1
    return ans % mod

n, a, b = map(int, input().split())
cnk = []
now = 1
for i in range(b+2):
    cnk.append(now)
    now = (now*(n-i)*power(i+1,mod-2))%mod

ans = power(2, n)%mod - cnk[a] - cnk[b] - 1
print(ans % mod)

Fixed submission:
import math
import sys
sys.setrecursionlimit(int(10**9))

mod = 10**9 + 7

def power(x, y):
    if   y == 0     : return 1
    elif y == 1     : return x % mod
    elif y % 2 == 0 : return power(x, y/2)**2 % mod
    else            : return power(x, y//2)**2 * x % mod

def fact(n):
    if n == 1: 
        return 1
    else:
        return (fact(n-1)*n)%mod

def comb(n, k):
    ans = 1
    for i in range(k):
        ans *= (n-i)
        ans //= i+1
    return ans % mod

n, a, b = map(int, input().split())
now = 1
for i in range(a):
    now = (now*(n-i))%mod
cnka = (now * power(math.factorial(a),mod-2) )% mod
for i in range(a,b):
    now = (now*(n-i))%mod
cnkb = (now * power(math.factorial(b),mod-2) )% mod

ans = power(2, n)%mod - cnka - cnkb - 1
print(ans % mod)
Buggy python submission (verdict: Runtime Error):
def swap(x):
    s = len(x)//2
    out = []
    if s>=1:
        for i in range(s):
            out.append([x[i][0],x[-1-i][1]])
            out.append([x[-1-i][0],x[i][1]])
        if len(x)%2==1:
            out.append([x[s][0],x[s][1]])
    else:
        out.append(x[0])
    return out

N, K = map(int, input().split())

if K == 1:
    for i in range(N):
        print(K+i,K+2*N-i-1,K+2*N+i)
elif K <= (N+1)/2:
    ans=[]
    for i in range(N):
        ans.append([K+i,K+2*N-i-1])
    if N%2 == 0:
        s=N//2
        ans_1 = ans[:s+1]
        ans_2 = ans[s+1:-1]
        ans_3 = ans[-1]
        ans_1_new = swap(ans_1)
        ans_2_new = swap(ans_2)
        ans_new = ans_1_new + ans_2_new + ans_3
    else:
        s=(N-1)//2
        ans_1 = ans[:s+1]
        ans_2 = ans[s+1:]
        ans_1_new = swap(ans_1)
        ans_2_new = swap(ans_2)
        ans_new = ans_1_new + ans_2_new
    ans = []
    for elem in ans_new:
        ans.append([elem[0],elem[1],elem[0]+elem[1]])
    ans = sorted(ans, key=lambda x: x[2])
    for i in range(N):
        ans[i][2] = K + 2*N + i
        print(ans[i][0],ans[i][1],ans[i][2])
else:
    print(-1)

Fixed submission:
def swap(x):
    s = len(x)//2
    out = []
    if s>=1:
        for i in range(s):
            out.append([x[i][0],x[-1-i][1]])
            out.append([x[-1-i][0],x[i][1]])
        if len(x)%2==1:
            out.append([x[s][0],x[s][1]])
    else:
        out.append(x[0])
    return out

N, K = map(int, input().split())

if K == 1:
    for i in range(N):
        print(K+i,K+2*N-i-1,K+2*N+i)
elif K <= (N+1)/2:
    ans=[]
    for i in range(N):
        ans.append([K+i,K+2*N-i-1])
    if N%2 == 0:
        s=N//2
        ans_1 = ans[:s+1]
        ans_2 = ans[s+1:-1]
        ans_3 = ans[-1]
        ans_1_new = swap(ans_1)
        ans_2_new = swap(ans_2)
        ans_new = ans_1_new + ans_2_new + [ans_3]
    else:
        s=(N-1)//2
        ans_1 = ans[:s+1]
        ans_2 = ans[s+1:]
        ans_1_new = swap(ans_1)
        ans_2_new = swap(ans_2)
        ans_new = ans_1_new + ans_2_new
    ans = []
    for elem in ans_new:
        ans.append([elem[0],elem[1],elem[0]+elem[1]])
    ans = sorted(ans, key=lambda x: x[2])
    for i in range(N):
        ans[i][2] = K + 2*N + i
        print(ans[i][0],ans[i][1],ans[i][2])
else:
    print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
L= [int(i) for i in input().split()]

L.sort()
diff_L=[]

for i in range(1,N-1):
    diff=[]
    for j in range(i+1,N):
        diff.append(L[j]-L[i])
    diff_L.append(diff)
    
total=0
for i in range(N-2):
    for j in range(i,N-2):
        for elem in diff_L[j]:
            if elem < L[i]:
                total += 1
            else:
                break
print(total)

Fixed submission:
N=int(input())
L= [int(i) for i in input().split()]

L.sort()
larger=[N]
prev=1
for i in range(N):
    larger= larger +[N-i]*(L[i]-prev)
    prev=L[i]

total=0    
for i in range(N-2):
    low=L[:i+1]
    high=L[i+1:]
    for j in range(len(high)-1):
        diff = high[j+1]-high[0]
        if diff >= len(larger):
            count = 0
        else:
            count = max(larger[diff] - (N-i-1),0)
        total += count
        
print(total)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(i) for i in input().split()]
B=[0]*N
for i in range(N):
  B[A[i]-1]=i+1

ans=''
for i in range(N-1):
  ans = ans + str(B[i])+' '
ans = ans + str(B[N-1])
print(ans)

Fixed submission:
N = int(input())
A = [int(i) for i in input().split()]
B=[0]*N
for i in range(N):
  B[A[i]-1]=i+1
print(*B)

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = [int(i) for i in input().split()]
B=[]*N
for i in range(N):
  B[A[i]]=i+1

ans=''
for i in range(N-1):
  ans = ans + str(B[i])+' '
ans = ans + str(B[N-1])
print(ans)

Fixed submission:
N = int(input())
A = [int(i) for i in input().split()]
B=[0]*N
for i in range(N):
  B[A[i]-1]=i+1
print(*B)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(i) for i in input().split()]

B = [[A[i],(i+1)] for i in range(N)]
B.sort()
ans=''
for i in range(N-1):
  ans = ans + str(B[i][1])+' '
ans = ans + str(B[N-1][1])
print(ans)

Fixed submission:
N = int(input())
A = [int(i) for i in input().split()]
B=[0]*N
for i in range(N):
  B[A[i]-1]=i+1
print(*B)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(i) for i in input().split()]

B = [[A[i],(i+1)] for i in range(N)]
B.sort(key= lambda x:x[0])
ans=''
for i in range(N-1):
  ans = ans + str(B[i][1])+' '
ans = ans + str(B[N-1][1])
print(ans)

Fixed submission:
N = int(input())
A = [int(i) for i in input().split()]
B=[0]*N
for i in range(N):
  B[A[i]-1]=i+1
print(*B)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(i) for i in input().split()]

dict_A = {A[i]:(i+1) for i in range(N)}
ans=''
for i in range(1,N):
  ans = ans + str(dict_A[i])+' '
ans = ans + str(dict_A[N])
print(ans)

Fixed submission:
N = int(input())
A = [int(i) for i in input().split()]
B=[0]*N
for i in range(N):
  B[A[i]-1]=i+1
print(*B)
Buggy python submission (verdict: Runtime Error):
N, K = map(int,input().split())
L = input()
count=0
for i in range(N-1):
  if L[i]==L[i+1]:
    count += 1

print(min(count+2*L, N-1))

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

print(min(count+2*K, N-1))
Buggy python submission (verdict: Runtime Error):
a,b,c = int(input()).split()
if a=b and c != b and c != a:
  print('Yes')
elif b=c and a != b and a != c:
  print('Yes')
elif c=a and b != a and b != c:
  print('Yes')
else: print('No')

Fixed submission:
a,b,c = input().split()
if a==b and c != b and c != a:
  print('Yes')
elif b==c and a != b and a != c:
  print('Yes')
elif c==a and b != a and b != c:
  print('Yes')
else: print('No')
Buggy python submission (verdict: Runtime Error):
K , A , B = map(int, input().split())
if A >= B:
    print(K+1)
elif A < B:
    if (K-A+1)%2 == 0:
        ma = max(((K-A+1)//2-1)*(B-A)+B,K+1)
    elif (K-A+1)%2 == 1:
        ma =max(((K-A+1)//2-1)*(B-A)+B + 1,K+1)
print(ma)


Fixed submission:
K , A , B = map(int, input().split())
ma = 0
if A >= B:
    ma = K + 1
elif A < B:
    if (K-A+1)%2 == 0:
        ma = max(((K-A+1)//2-1)*(B-A)+B,K+1)
    elif (K-A+1)%2 == 1:
        ma = max(((K-A+1)//2-1)*(B-A)+B+1,K+1)
print(ma)

Buggy python submission (verdict: Runtime Error):
K , A , B = map(int, input().split())
if A >= B:
    print(K+1)
elif A < B:
    if (K-A+1)%2 == 0:
        ma = ((K-A+1)//2-1)*(B-A)+B
    elif (K-A+1)%2 == 1:
        ma = ((K-A+1)//2-1)*(B-A)+B + 1
print(ma)

Fixed submission:
K , A , B = map(int, input().split())
ma = 0
if A >= B:
    ma = K + 1
elif A < B:
    if (K-A+1)%2 == 0:
        ma = max(((K-A+1)//2-1)*(B-A)+B,K+1)
    elif (K-A+1)%2 == 1:
        ma = max(((K-A+1)//2-1)*(B-A)+B+1,K+1)
print(ma)
Buggy python submission (verdict: Runtime Error):
A, B, C = (int(n) for n in input().split())

count = 0
if C - B < 0:
  count = C + B
elif C - B =>0:
  if C - B - A =<0:
    count = C + B
  elif C - B - A >0:
    count = A + 2*B + 1
    
print(count)


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

count = 0
if C - B < 0:
    count = C + B
elif C - B >=0:
    if C - B - A <=0:
        count = C + B
    elif C - B - A >0:
        count = A + 2*B  +1
    
print(count)
Buggy python submission (verdict: Runtime Error):
N = int(input())
p_list = [int(i) for i in input().split()] 
sum = 0
for i in range(N):
  if p_list[i] == max(p_list):
    sum += int(p_list[i]/2)
  else:
    sum += p_list[i]
print(sum)


Fixed submission:
D = int(input())
if D == 25:
  print("Christmas")
elif D == 24:
  print("Christmas Eve")
elif D == 23:
  print("Christmas Eve Eve")
elif D == 22:
  print("Christmas Eve Eve Eve")

Buggy python submission (verdict: Runtime Error):
D = int(input())
 
if D ==25;
  print("Christmas)"
else if D ==24;
  print("Christmas Eve")
else if D ==23;
  print("Christmas Eve Eve")
else if D ==22;
  print("Crhistmas Eve Eve Eve")

Fixed submission:
D = int(input())
if D == 25:
  print("Christmas")
elif D == 24:
  print("Christmas Eve")
elif D == 23:
  print("Christmas Eve Eve")
elif D == 22:
  print("Christmas Eve Eve Eve")

Buggy python submission (verdict: Runtime Error):

Copy
D = int(input())
 
if D ==25;
  print("Christmas")
if D ==24;
  print("Christmas Eve")
if D ==23;
  print("Christmas Eve Eve")
if D ==22;
  print("Crhistmas Eve Eve Eve")

Fixed submission:
D = int(input())
if D == 25:
  print("Christmas")
elif D == 24:
  print("Christmas Eve")
elif D == 23:
  print("Christmas Eve Eve")
elif D == 22:
  print("Christmas Eve Eve Eve")

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

if D ==25;
  print("Christmas)"
if D ==24;
  print("Christmas Eve")
if D ==23;
  print("Christmas Eve Eve")
if D ==22;
  print("Crhistmas Eve Eve Eve")
 
 
 

Fixed submission:
D = int(input())
if D == 25:
  print("Christmas")
elif D == 24:
  print("Christmas Eve")
elif D == 23:
  print("Christmas Eve Eve")
elif D == 22:
  print("Christmas Eve Eve Eve")
Buggy python submission (verdict: Runtime Error):
X = int(input())
	if X==3 or X==5 or X==7:
    	print('Yes')
    else:
    	print('No')

Fixed submission:
X = int(input())

if X==3 or X==5 or X==7:
	print('YES')
else:
  	print('NO')
Buggy python submission (verdict: Runtime Error):
N = int(input())
T , A = (int(i) for i in input().split())
H_list = [int(h) for h in input().split()]
 
A_list = [abs((T-0.006*H_list[n])-A) for n in range(N)]

for n ,x in enumerate(A_list):
  if x == min(A_list):
    number == n
print(n)

Fixed submission:
N = int(input())
T , A = (int(i) for i in input().split())
H_list = [int(h) for h in input().split()]
 
A_list = [abs((T-0.006*H_list[n])-A) for n in range(N)]
 
number = 0
for n ,x in enumerate(A_list):
    if x == min(A_list):
        number = n+1
print(number)
Buggy python submission (verdict: Runtime Error):
N = int(input())

list = [int(c)+10*int(c)+100*int(c) for c in str(N)]
list.sort()

x = 0
for i in range(N):
    if list[i] < N:
        continue
    else:
        x = list[i]
print(x)

Fixed submission:
N = str(input())

list = [111*int(c) for c in '123456789']
list.sort()

x = 0
for number in list:
    if number < int(N):
        continue
    else:
        x = number
        break
print(x)
Buggy python submission (verdict: Runtime Error):
N, M, X, Y = (int(i) for i in input().split())
l_x = [int(x) for x in input().split()]
l_y = [int(y) for y in input().split()]

if max(l_x) => min(l_y):
    print('War')
else:
    print('No War')

Fixed submission:
N, M, X, Y = (int(i) for i in input().split())
l_x = [int(x) for x in input().split()]
l_y = [int(y) for y in input().split()]

l_x.append(X)
l_y.append(Y)
if max(l_x) >= min(l_y):
    print('War')
else:
    print('No War')
Buggy python submission (verdict: Runtime Error):
S = str(inpiut())
T = str(input())

S = S+S
if T in S:
  print('Yes')
else:
  print('No')

Fixed submission:
S = str(input())
T = str(input())
 
S = S+S
if T in S:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
X =int(input())
list = []
for k in range(X):
    for j in range(X):
        if k**2 > X:
            break
        elif k**j > X:
            list.append(k**(j-1))
            break
            
print(max(list))

Fixed submission:
X =int(input())
max = 1 #このように書かないとX = 1,2 のときに正しい値を返せない。listにappendだとlistが空になってエラーになる。
for k in range(X):
    for j in range(X):
        if k**2 > X:
            break
        elif k**j > X:
            sub_max = k**(j-1)
            if sub_max >= max:
                max = sub_max
            break
            
print(max)

Buggy python submission (verdict: Runtime Error):
X =int(input())
list = []
for k in range(X):
    for j in range(X):
        if k**2 > X:
            break
        elif k**j > X:
            list.append(k**(j-1))
            break
            
print(max(list))

Fixed submission:
X =int(input())
max = 1 #このように書かないとX = 1,2 のときに正しい値を返せない。listにappendだとlistが空になってエラーになる。
for k in range(X):
    for j in range(X):
        if k**2 > X:
            break
        elif k**j > X:
            sub_max = k**(j-1)
            if sub_max >= max:
                max = sub_max
            break
            
print(max)
Buggy python submission (verdict: Runtime Error):
n, m, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

if sum(a) + sum(b) <= k:
    print(n + m)
    exit()

lena = len(a)
lenb = len(b)

timecnt = 0
cnt = 0
while timecnt <= k:
    inda = len(a) - lena
    indb = len(b) - lenb
    if inda < 0 and indb < 0:
        break
    elif inda < 0 and indb >= 0:
        timecnt += b[indb]
        lenb -= 1
        cnt += 1
    elif inda >= 0 and indb < 0:
        timecnt += a[inda]
        lena -= 1
        cnt += 1
    elif a[inda] <= b[indb]:
        timecnt += a[inda]
        lena -= 1
        cnt += 1
    else:
        timecnt += b[indb]
        lenb -= 1
        cnt += 1

print(cnt - 1)

Fixed submission:
n, m, k = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

a, b = [0], [0]
for i in range(n):
    a.append(a[i] + A[i])
for i in range(m):
    b.append(b[i] + B[i])

ans, j = 0, m
for i in range(n + 1):
    if a[i] > k:
        break
    while b[j] > k - a[i]:
        j -= 1
    ans = max(ans, i + j)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
q = int(input())
bc = [list(map(int, input().split())) for _ in range(q)]

for i in bc:
    str_a = " ".join(map(str, a))
    str_a = str_a.replace(str(i[0]), str(i[1]))
    a = list(map(int, str_a.split()))
    print(sum(a))

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
q = int(input())
bc = [list(map(int, input().split())) for _ in range(q)]
dic = {}
suma = sum(a)

for i in a:
    if i in dic:
        dic[i] += 1
    else:
        dic[i] = 1

for j in bc:
    dif = j[1] - j[0]
    if j[0] in dic:
        suma += dif * dic[j[0]]
    else:
        print(suma)
        continue
    if j[1] in dic:
        dic[j[1]] += dic.pop(j[0])
    else:
        dic[j[1]] = dic.pop(j[0])
    print(suma)
Buggy python submission (verdict: Time Limit Exceeded):
n = input()
a = list(map(int, input().split()))
suma = 1
for i in a:
    suma *= i
if suma > 10**18:
    print(-1)
else:
    print(suma)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
suma = 1
if 0 in a:
    print(0)
    exit()
for i in a:
    suma *= i
    if suma > 10**18:
        print(-1)
        exit()
print(suma)
Buggy python submission (verdict: Time Limit Exceeded):
import math
import itertools
from functools import reduce

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

a = int(input())
list_a = [i for i in range(1, a + 1)]
res = 0
kumi = list(itertools.product(list_a, repeat=3))
for i in kumi:
    ans = gcd_list(i)
    res += ans

print(res)

Fixed submission:
import math
import itertools
from functools import reduce

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

a = int(input())
list_a = [i for i in range(1, a + 1)]
res = 0
# kumi = list(itertools.product(list_a, repeat=3))
kumi = list(itertools.combinations_with_replacement(list_a, 3))
for i in kumi:
    ans = gcd_list(i)
    if i[0] == i[1] and i[0] == i[2]:
        res += ans
    elif i[0] != i[1] and i[0] != i[2] and i[2] != i[1]:
        res += ans*6
    elif i[0] == i[1] or i[0] == i[2] or i[1] == i[2]:
        res += ans*3

print(res)
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
a = list(map(int, input().split()))
cnt = 0
 
for i in a:
  if i >= (1/(4*m)):
    cnt += 1

if cnt < M:
  print("No")
else:
  print("Yes")

Fixed submission:
n, m = map(int, input().split())
a = list(map(int, input().split()))
cnt = 0
 
for i in a:
  if i >= sum(a)*(1/(4*m)):
    cnt += 1

if cnt >= m:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
a = list(map(int, input().split()))
cnt = 0
 
if sum(a) < (1/4m) or n < m:
  print("No")
else:
  print("Yes")

Fixed submission:
n, m = map(int, input().split())
a = list(map(int, input().split()))
cnt = 0
 
for i in a:
  if i >= sum(a)*(1/(4*m)):
    cnt += 1

if cnt >= m:
  print("Yes")
else:
  print("No")

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

for i in a:
  if i >= (1/4m):
    cnt += 1

if cnt < M:
  print("No")
else:
  print("Yes")

Fixed submission:
n, m = map(int, input().split())
a = list(map(int, input().split()))
cnt = 0
 
for i in a:
  if i >= sum(a)*(1/(4*m)):
    cnt += 1

if cnt >= m:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
now = n

if n % k == 0:
  print(0)
  exit()

while True:
  n = abs(n - k)
  if n >= now:
    break
  now = n
print(now)

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

now = abs((n % k) - k)
if now < n%k:
  print(now)
else:
  print(n%k)

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
now = n

while True:
  n = abs(n - k)
  if n >= now:
    break
  now = n
print(now)

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

now = abs((n % k) - k)
if now < n%k:
  print(now)
else:
  print(n%k)
Buggy python submission (verdict: Time Limit Exceeded):
import statistics

k, n = map(int, input().split())
a = list(map(int, input().split()))
dist = []

for i in a:
  target = i
  tmp = [abs(j - target) if abs(j - target) < abs(j - (target + k)) else abs(j - (target + k)) for j in a]
  dist.append(sum(tmp))
print(min(dist))

Fixed submission:
import statistics

k, n = map(int, input().split())
a = list(map(int, input().split()))
dist = []

for num, i in enumerate(a[:]):
  if num == (n - 1):
    dist.append(abs((k + a[0]) - i))
  else:
    dist.append(abs(a[num + 1] - i))
ind = dist.index(max(dist))
dist.pop(ind)
print(sum(dist))
Buggy python submission (verdict: Runtime Error):
n, a, b = map(int, input().split())
retsu = ""
while len(retsu) < n:
    retsu += "b"*a + "r"*b
print(retsu[:n].count("b"))

Fixed submission:
n, a, b = map(int, input().split())
ans = n // (a + b) * a
rem = n % (a + b)
ans += min(a, rem)
print(ans)
Buggy python submission (verdict: Runtime Error):
n, r = map(int, input.split())
if n >= 10:
  print(r)
else:
  print(r + 100*(10 - n))

Fixed submission:
n, r = map(int, input().split())
if n >= 10:
  print(r)
else:
  print(r + 100*(10 - n))
Buggy python submission (verdict: Runtime Error):
n = list(map(int, input().split()))
if a[0] == a[1] and a[1] == a[2]:
  print("No")
elif a[0] != a[1] and a[1] != a[2] and a[0] != a[2]:
  print("No")
else:
  print("Yes")

Fixed submission:
a = list(map(int, input().split()))
if a[0] == a[1] and a[1] == a[2]:
  print("No")
elif a[0] != a[1] and a[1] != a[2] and a[0] != a[2]:
  print("No")
else:
  print("Yes")
Buggy python submission (verdict: Time Limit Exceeded):
a, b, k = map(int, input().split())

while k > 0:
    if a > 0:
        a -= 1
    elif b > 0:
        b -= 1
    elif a == 0 and b == 0:
        continue
    k -= 1

print(a, end=" ")
print(b)

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

new_a = a - k if a >= k else 0
new_b = b - (k - a) if a < k else b
if new_b < 0:
    new_b = 0

print(new_a, end=" ")
print(new_b)
Buggy python submission (verdict: Runtime Error):
s = input()
t = input()

s = [_ for _ in s]
t = [_ for _ in t]

count = 0
for i in 3:
  if s[i] == t[i]:
    count += 1
print(count)

Fixed submission:
s = str(input())
t = str(input())

s = [_ for _ in s]
t = [_ for _ in t]

count = 0
for i in range(3):
  if s[i] == t[i]:
    count += 1
print(count)

Buggy python submission (verdict: Runtime Error):
s = int(input())
t = int(input())

s = [_ for _ in s]
t = [_ for _ in t]

count = 0
for i in 3:
  if s[i] == t[i]:
    count += 1
print(count)

Fixed submission:
s = str(input())
t = str(input())

s = [_ for _ in s]
t = [_ for _ in t]

count = 0
for i in range(3):
  if s[i] == t[i]:
    count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
cnt = 1
sum_a = a
if a == b:
  print(cnt)
  return 0
while(1):
  if sum_a >= b:
    break
  sum_a = sum_a + a - 1
  cnt += 1
print(cnt)

Fixed submission:
a, b = map(int, input().split())
cnt = 0
sum_a = 1
while(sum_a < b):
  sum_a += (a - 1)
  cnt += 1
print(cnt)

Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
cnt = 1
sum_a = a
if a == b:
  print(1)
  return 0
while(1):
  if sum_a >= b:
    break
  sum_a = sum_a + a - 1
  cnt += 1
print(cnt)

Fixed submission:
a, b = map(int, input().split())
cnt = 0
sum_a = 1
while(sum_a < b):
  sum_a += (a - 1)
  cnt += 1
print(cnt)
Buggy python submission (verdict: Runtime Error):
n = input()
ans = 0.5 * n * (n - 1)
print(int(ans))

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