Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import math
x, y = map(int, input().split())
print(round(log2(float(y/x))))

Fixed submission:
X,Y=map(int,input().split())
count=1
while True:
    X*=2
    if X>Y: break
    else: count+=1
print(count)

Buggy python submission (verdict: Runtime Error):
import math
x, y = map(int, input().split())
print(round(log2(y/x)))

Fixed submission:
X,Y=map(int,input().split())
count=1
while True:
    X*=2
    if X>Y: break
    else: count+=1
print(count)
Buggy python submission (verdict: Runtime Error):
n = input()
a = list(map(int, input().split()))
ans = float("inf")
for i in a:
    ans = min(ans, len(bin(i) - bin(i).rfind("1") - 1)
print(round(ans))

Fixed submission:
print(input().count("1"))
Buggy python submission (verdict: Runtime Error):
import math
n = input()
a = list(map(int, input().split()))
ans = float("inf")
for i in a:
    ans = min(ans, len(bin(i) - bin(i).rfind("1") - 1)
print(round(ans))

Fixed submission:
import math
n = input()
a = list(map(int, input().split()))
ans = float("inf")
for i in a:
    ans = min(ans, len(bin(i)) - bin(i).rfind("1") - 1)
print(round(ans))

Buggy python submission (verdict: Runtime Error):
n = input()
a = list(map(int, input().split()))
ans = float("inf")
for i in a:
    ans = min(ans, len(bin(i) - bin(i).rfind("1") - 1)
print(round(ans))

Fixed submission:
import math
n = input()
a = list(map(int, input().split()))
ans = float("inf")
for i in a:
    ans = min(ans, len(bin(i)) - bin(i).rfind("1") - 1)
print(round(ans))
Buggy python submission (verdict: Runtime Error):
str_input_list = input().rstrip().split(' ')
int_input_list = []
for a in str_input_list:
    int_input_list.append(int(a))
    
keyence_list = [1, 9, 7, 4]

for a in range(4):
    if keyence_list[a] in int_input_list:
        keyence_list.remove(keyence_list[a])
        int_input_list.remove(keyence_list[a])

if keyence_list == []:
    print('YES')
else:
    print('NO')

Fixed submission:
str_input_list = input().rstrip().split(' ')
int_input_list = []
for a in str_input_list:
    int_input_list.append(int(a))
    
keyence_list = [1, 9, 7, 4]

for a in range(4):
    if keyence_list[a] in int_input_list:
        keyence_list[a] = '*'

if keyence_list == ['*', '*', '*', '*']:
    print('YES')
else:
    print('NO')
Buggy python submission (verdict: Runtime Error):
amount, length = map(int, input().split())
S = sorted([input() for a in range(amount)])
print(''.join(S))

Fixed submission:
haiku_list = ['5', '7', '5']

str_input_list = input().rstrip().split(' ')

for a in range(3):
    if haiku_list[a] in str_input_list:
        str_input_list.remove(haiku_list[a])
        haiku_list[a] = '*'

if haiku_list == ['*', '*', '*']:
    print('YES')
else:
    print('NO')

Buggy python submission (verdict: Runtime Error):
#最初に入力される情報を整理する
str_input_list = input().rstrip().split(' ')

int_input_list = []
for a in str_input_list:
    int_input_list.append(int(a))

length = int_input_list[0]
amount = int_input_list[1]

#文字列を受け取りリストに格納
mojiretu_list = []
for a in range(amount):
    mojiretu_list.append(input())


#文字列を小さい順に並べ、結合
sorted_list = sorted(mojiretu_list)
min_mojiretu = ''
for a in range(amount):
    min_mojiretu += sorted_list[a]

#出力
print(min_mojiretu)
print()

Fixed submission:
haiku_list = ['5', '7', '5']

str_input_list = input().rstrip().split(' ')

for a in range(3):
    if haiku_list[a] in str_input_list:
        str_input_list.remove(haiku_list[a])
        haiku_list[a] = '*'

if haiku_list == ['*', '*', '*']:
    print('YES')
else:
    print('NO')
Buggy python submission (verdict: Runtime Error):
#最初に入力される情報を整理する
str_input_list = input().rstrip().split(' ')

int_input_list = []
for a in str_input_list:
    int_input_list.append(int(a))

length = int_input_list[0]
amount = int_input_list[1]

#文字列を受け取りリストに格納
mojiretu_list = []
for a in range(amount):
    mojiretu_list.append(input())


#文字列を小さい順に並べ、結合
sorted_list = sorted(mojiretu_list)
min_mojiretu = ''
for a in range(amount):
    min_mojiretu += sorted_list[a]

#出力
print(min_mojiretu)

Fixed submission:
amount, length = map(int, input().split())
S = sorted([input() for a in range(amount)])
print(''.join(S))

Buggy python submission (verdict: Runtime Error):
#最初に入力される情報を整理する
str_input_list = input().rstrip().split(' ')

int_input_list = []
for a in str_input_list:
    int_input_list.append(int(a))

length = int_input_list[0]
amount = int_input_list[1]

#文字列を受け取りリストに格納
mojiretu_list = []
for a in range(amount):
    mojiretu_list.append(input())

#文字列を小さい順に並べ、結合
sorted_list = sorted(mojiretu_list)
min_mojiretu = ''
for a in range(amount):
    min_mojiretu += sorted_list[a]

#出力
print(min_mojiretu)

Fixed submission:
amount, length = map(int, input().split())
S = sorted([input() for a in range(amount)])
print(''.join(S))
Buggy python submission (verdict: Runtime Error):
S=input()
N=len(S)
for i in range(0,N+1):
    for j in range(i,N+1):
        if "".join(S[:i] + S[j:]) == 'keyence':
            print("YES")
            exit(1)
else:
    print('NO')

Fixed submission:
S=input()
N=len(S)
for i in range(0,N+1):
    for j in range(i,N+1):
        if  S[:i] + S[j:] == 'keyence':
            print("YES")
            exit(0)
else:
    print('NO')

Buggy python submission (verdict: Runtime Error):
S=list('keyekeyencence')
N=len(S)
for i in range(0,N+1):
    for j in range(i,N+1):
        if "".join(S[:i] + S[j:]) == 'keyence':
            print("YES")
            exit(1)
else:
    print('NO')

Fixed submission:
S=input()
N=len(S)
for i in range(0,N+1):
    for j in range(i,N+1):
        if  S[:i] + S[j:] == 'keyence':
            print("YES")
            exit(0)
else:
    print('NO')
Buggy python submission (verdict: Runtime Error):
f = []
f = input().split()
if '1' in f:
if '9' in f:
if '7' in f:
if '4' in f:
print("YES")
else:
print("NO")
else:
print("NO")
else:
print("NO")
else:
print("NO")


Fixed submission:
f = []
f = input().split()
if '1' in f:
     if '9' in f:
          if '7' in f:
               if '4' in f:
                    print("YES")
               else:
                    print("NO")
          else:
               print("NO")
     else:
          print("NO")
else:
     print("NO")

Buggy python submission (verdict: Runtime Error):
f = []
f = input().split()

if '1' in f:
     if '9' in f:
          if '7' in f:
               if '4' in f:
                    print("YES")
               else:
                    print("NO")
           else:
                print("NO")
     else:
          print("NO")
else:
     print("NO")
     

Fixed submission:
f = []
f = input().split()
if '1' in f:
     if '9' in f:
          if '7' in f:
               if '4' in f:
                    print("YES")
               else:
                    print("NO")
          else:
               print("NO")
     else:
          print("NO")
else:
     print("NO")
Buggy python submission (verdict: Runtime Error):
n=input()
t,a=input().split()
b=input().split()
n=int(n)
t=int(t)
a=int(a)
min=1000
for i in range(n):
     diff=abs(a-t+0.006*int(b[i]))
     if min>diff:
          id=i+1
          min=diff
print(id)

Fixed submission:
fare = input().split()
print(int(int(fare[0])+int(fare[1])/2))
Buggy python submission (verdict: Runtime Error):
n=input()
t,a=input().split()
h=[]
n=int(n)
t=int(t)
a=int(a)
b=input().split()
min=1000
for i in range(n):
     b[i]=int(b[i])
     if min > abs(a-t+0.006*b[i]):
          min=abs(a-t+0.006*b[i]))
          id=i+1
print(id)

Fixed submission:
n=input()
t,a=input().split()
n=int(n)
t=int(t)
a=int(a)
b=input().split()
min=1000
for i in range(n):
    diff=abs(a-t+0.006*int(b[i]))
    if min>diff:
        id=i+1
        min=diff

print (id)
Buggy python submission (verdict: Runtime Error):
s = set(*args)
r_s = set([1, 9, 4, 7])
if s == r_s:
 print(YES)
else:
 print(NO)

Fixed submission:
from sets import Set

l = map(int, raw_input().split())
s = Set(l)
r_s = Set([1, 9, 7, 4])
if s == r_s:
	print 'YES'
else:
	print 'NO'

Buggy python submission (verdict: Runtime Error):
li = list(map(int, input().split()))
if (li in 1) and (li in 9) and (li in 7) and (li in 4):
  print('YES')
else:
  print('NO')


Fixed submission:
li = list(map(int, input().split()))
if (1 in li) and (9 in li) and (7 in li) and (4 in li):
  print('YES')
else:
  print('NO')
Buggy python submission (verdict: Runtime Error):
s = input()
t = 'keyence'
cnt = 0
j = False
p = 0
for i in range(len(s)):
  if t[p] == s[i]:
    if j == True:
      j = False
      cnt = cnt + 1
    p = p + 1
  else:
    j = True
print('YES' if p == len(t) and cnt <= 1 else 'N0')

Fixed submission:

def solve(s):
  t = 'keyence'
  if t in s[0:7] or t in s[-7:]:
    return 'YES'

  p = 0
  for i in range(len(s)):
    if t[p] == s[i]:
      p = p + 1
    else:
      if t[p:] in s[-7+p:]:
        return 'YES'
      else:
        return 'NO'
  return 'NO'

print(solve(input()))

Buggy python submission (verdict: Runtime Error):
File Edit Options Buffers Tools YASnippet Complete In/Out Signals Help                                                                     
l = raw_input()
flag = False
if len(l) == 7:
    if l == "keyence":
        flag = True
elif len(l) == 8:
    for i in range(8):
        tmp = l[:i] + l[i+1:]
        if tmp == "keyence":
            flag = True
else:
    flag = False
if flag == True:
    print "YES"
else:
    print "NO"


Fixed submission:
l = raw_input()
flag = False
if len(l) >= 6:
    for i in range(7):
        tmp = l[0:i] + l[-7+i:]
        if tmp == "keyence":
            flag = True
if flag == True:
    print "YES"
else:
    print "NO"

Buggy python submission (verdict: Runtime Error):
def main(pro):
    ans = 'keyence'
    try:
        lokasi = pro.index(ans)
        if lokasi > 0 and lokasi + len(ans) < len(pro):
            raise ValueError()
            return
        else:
            print('YES')
            return
    except:
        # it is split
        for i in range(len(ans)):
            if ans[i] != pro[i]:
                break
        r = len(ans) - i
        for a in range(1,r+1):
            if ans[-r] != pro[-r]:
                print('NO')
                return
        print('YES')
while True:
    main(input())

Fixed submission:
def main(pro):
    ans = 'keyence'
    try:
        lokasi = pro.index(ans)
        if lokasi > 0 and lokasi + len(ans) < len(pro):
            raise ValueError()
        else:
            print('YES')
            return
    except:
        for i in range(len(ans)):
            if ans[i] != pro[i]:
                break
        r = len(ans) - i
        for a in range(1,r+1):
            if ans[-r] != pro[-r]:
                print('NO')
                return
        print('YES')

main(input())
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import numpy as np
N = input()
t, x, y = [0], [0], [0]
for _ in range(N):
    _t, _x, _y = map(float, raw_input().split())
    t.append(_t)
    x.append(_x)
    y.append(_y)

# /w1 = w[0]


txy = np.array([[_t, _x, _y] for _t, _x, _y in zip(t, x, y)], dtype=np.int32)

dm = np.diff(txy, axis=0)
for d in dm:
    total = np.abs(d[1]) + np.abs(d[2])
    if d[0] >= total  and (d[0] - total) % 2 == 0:
        print 'Yes'
        exit()

print 'No'

Fixed submission:
# -*- coding: utf-8 -*-
a, b = map(int, raw_input().split())

if a * b % 2 == 0:
    print "Even"
else:
    print "Odd"

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
a, b = map(int, raw_input().split())

if a * b % 2 == 0:
    print "Even"
else:
    print "Odd"




Fixed submission:
# -*- coding: utf-8 -*-
a, b = map(int, raw_input().split())

if a * b % 2 == 0:
    print "Even"
else:
    print "Odd"
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import numpy as np

a, b = map(str, raw_input().split())
i = int(a + b)

if i == int(np.sqrt(i)) ** 2:
    print "Yes"
else:
    print "No"




Fixed submission:
# -*- coding: utf-8 -*-
import numpy as np

a, b = map(str, raw_input().split())
i = int(a + b)

if i == int(np.sqrt(i)) ** 2:
    print "Yes"
else:
    print "No"
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

# def flatten(nested_list):
#     return [e for inner_list in nested_list for e in inner_list]

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

a = [0] * N
b = [0] * N
ab = [[0, 0]] * N
for i in range(N):
    _a, _b = map(int, raw_input().split())
    ab[i] = [_a, _b]
ab.sort(key=lambda x:x[0])

j = 0
index = 0
while j < K:
    j += ab[index][1]
    if j < K:
        index += 1
print ab[index][0]


Fixed submission:
# -*- coding: utf-8 -*-
a, b, c = map(int, raw_input().split())

if a <= c <= b:
    print "Yes"
else:
    print "No"
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-

def flatten(nested_list):
    return [e for inner_list in nested_list for e in inner_list]

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

a = [0] * N
b = [0] * N
ab = [[0, 0]] * N
for i in range(N):
    _a, _b = map(int, raw_input().split())
    ab[i] = [_a, _b]
ab.sort(key=lambda x:x[0])

ans = flatten([[a] * b for a, b in ab])
print ans[K - 1]


Fixed submission:
# -*- coding: utf-8 -*-
N, K = map(int, raw_input().split())

ab = [[0, 0]] * N
for i in range(N):
    _a, _b = map(int, raw_input().split())
    ab[i] = [_a, _b]
ab.sort(key=lambda x:x[0])

j = 0
index = 0
while j < K:
    j += ab[index][1]
    if j < K:
        index += 1

print ab[index][0]

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
N, K = map(int, raw_input().split())

ans = []
for _ in range(N):
    a, b = map(int, raw_input().split())
    ans = ans + [a] * b

ans.sort()
print ans[K - 1]


Fixed submission:
# -*- coding: utf-8 -*-
N, K = map(int, raw_input().split())

ab = [[0, 0]] * N
for i in range(N):
    _a, _b = map(int, raw_input().split())
    ab[i] = [_a, _b]
ab.sort(key=lambda x:x[0])

j = 0
index = 0
while j < K:
    j += ab[index][1]
    if j < K:
        index += 1

print ab[index][0]
Buggy python submission (verdict: Time Limit Exceeded):
S = list(input().rstrip())

count = 0
flag = True
while flag:
    for i in range(len(S)-1):
        if S[i] == 'B' and S[i+1] == 'W':
            S[i], S[i+1] = S[i+1], S[i]
            count += 1
            break
        
        if i == len(S)-2:
            flag = False

print(count)

Fixed submission:
S = list(input().rstrip())

ans = 0
countw = 0
for i, c in enumerate(S):
    if c == 'W':
        ans += i - countw
        countw += 1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
V = list(map(int, input().split()))
A = set(V)

if len(A) == 1:
	print(len(V)//2)
	exit(0)

ans = 0
for i in range(len(V)-2):
	if V[i] != V[i+2]:
		for d in A:
			if V[i] == d:
				V[i+2] = d
				ans += 1
print(ans)


Fixed submission:
from collections import Counter
n = int(input())
V = list(map(int, input().split()))

even = []
odd = []
for i, v in enumerate(V):
	if i % 2 == 0: even.append(v)
	else: odd.append(v)

cnt_even = Counter(even).most_common(2)
cnt_odd = Counter(odd).most_common(2)

if cnt_even[0][0] != cnt_odd[0][0]:
	ans = len(V) - cnt_even[0][1] - cnt_odd[0][1]
else:
	if cnt_even[0][1] + cnt_odd[0][1] == len(V):
		ans = len(V) // 2

	elif len(cnt_odd) < 2 or len(cnt_even) < 2:
		ans = len(V) - cnt_even[0][1] - cnt_odd[0][1]
	else:
		ans1 = len(V) - cnt_even[0][1] - cnt_odd[1][1]
		ans2 = len(V) - cnt_even[1][1] - cnt_odd[0][1]
		ans = min(ans1, ans2)

print(ans)
Buggy python submission (verdict: Runtime Error):
D, N = map(int, input())
if D == 2 and N == 100: print(1010000)
else: print(100**D*N)

Fixed submission:
D, N = map(int, input().split())
if N == 100: print(100**D*101)
else: print(100**D*N)
Buggy python submission (verdict: Time Limit Exceeded):
a, b = map(int, input().split())
for n in range(1, 1000):
    h1 = n*(n+1)//2
    h2 = (n+1)*(n+2)//2
    for x in range(1, h2+1):
        if h1 - x == a and h2 - x == b:
            print(x)
            exit(0)

Fixed submission:
a, b = map(int, input().split())
for n in range(1, 1000):
    h1 = n*(n+1)//2
    h2 = (n+1)*(n+2)//2
    if h1 - a == h2 - b:
        print(h1-a)
        break
Buggy python submission (verdict: Time Limit Exceeded):
from math import factorial

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


ans = 1

if m != 1:
    factorization = {}
    while True:
        for i in range (2, m//2 + 1):
            if m % i == 0:
                if i in factorization:
                    factorization[i] += 1
                else:
                    factorization[i] = 1
                m = m // i
                break
        else:
            if m in factorization:
                    factorization[m] += 1
            else:
                factorization[m] = 1
            break


    for i in factorization.keys():
        k = factorization[i]

        num = 1
        for i in range(k):
            num *= (n+k-1-i)
        num //= factorial(k)
        ans *= num % (10**9+7)
        ans = ans % (10**9+7)



print(ans)





Fixed submission:
from math import factorial, sqrt

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


ans = 1

if m != 1:
    factorization = {}
    while True:
        for i in range (2, int(sqrt(m))+1):
            if m % i == 0:
                if i in factorization:
                    factorization[i] += 1
                else:
                    factorization[i] = 1
                m = m // i
                break
        else:
            if m in factorization:
                    factorization[m] += 1
            else:
                factorization[m] = 1
            break


    for i in factorization.keys():
        k = factorization[i]

        num = 1
        for i in range(k):
            num *= (n+k-1-i)
        num //= factorial(k)
        ans *= num % (10**9+7)
        ans = ans % (10**9+7)



print(ans)
Buggy python submission (verdict: Runtime Error):
S = list(input())
w = int(input())
li = [S[w*i] for i in range(len(S)//w + 1)]
result = ''.join(li)

print(result)

Fixed submission:
S = list(input())
w = int(input())
li = [S[w*i] for i in range((len(S)-1)//w + 1)]
result = ''.join(li)

print(result)
Buggy python submission (verdict: Time Limit Exceeded):
n, m, d = input().split()
n = int(n)
m = int(m)
d = int(d)

if d == 0:
    x = n
    if n == 1:
        result = m - 1
    else:
        result = x*(m-1)*n**(m-2)/n**m


else:
    x = 2*(n - d)

    result = x*(m-1)*n**(m-2)/n**m

print(result)

Fixed submission:
n, m, d = input().split()
n = int(n)
m = int(m)
d = int(d)

if d == 0:
    x = n
    if n == 1:
        result = m - 1
    else:
        result = x*(m-1)/n**2


else:
    x = 2*(n - d)

    result = x*(m-1)/n**2

print(result)
Buggy python submission (verdict: Runtime Error):
from statistics import *



n = int(input())
list = input().split()

for i in range(n):
    list[i] = int(list[i]) - (i + 1)

b = int(median(list))

for i in range(n):
    list[i] = abs(list[i] - b)

print(sum(list))



Fixed submission:
a = int(input())

if a % 2 == 0:
    b = a
else:
    b = 2*a
print(b)

Buggy python submission (verdict: Runtime Error):
if a % 2 == 0:
    b = a
else:
    b = 2*a
print(b)

Fixed submission:
a = int(input())

if a % 2 == 0:
    b = a
else:
    b = 2*a
print(b)
Buggy python submission (verdict: Runtime Error):
n = int(input())
list = input().split()

for i in range(n):
    list[i] = int(list[i]) - (i + 1)

b = int(median(list))

for i in range(n):
    list[i] = abs(list[i] - b)

print(sum(list))



Fixed submission:
from statistics import *



n = int(input())
list = input().split()

for i in range(n):
    list[i] = int(list[i]) - (i + 1)

b = int(median(list))

for i in range(n):
    list[i] = abs(list[i] - b)

print(sum(list))
Buggy python submission (verdict: Runtime Error):
'''input
3 5
1 2 3
'''
from fractions import gcd
n,x = map(int,raw_input().split())
arr = map(int,raw_input().split())
arr.append(x)
arr.sort()
diff = []
for i in range(1,n):
	diff.append(arr[i]-arr[i-1])
gc = diff[0]
for i in range(1,len(diff)):
	gc = gcd(gc,diff[i])
print gc


Fixed submission:
'''input
2 2
'''
from sys import exit
a,b = map(int,raw_input().split())
for i in range(1,4):
	if a*b*i&1:
		print "Yes"
		exit(0)
print "No"
Buggy python submission (verdict: Runtime Error):
'''input
3 5
1 2 3
'''
from fractions import gcd
n,x = map(int,raw_input().split())
arr = map(int,raw_input().split())
arr.append(x)
arr.sort()
diff = []
for i in range(1,n):
	diff.append(arr[i]-arr[i-1])
gc = diff[0]
for i in range(1,len(diff)):
	gc = gcd(gc,diff[i])
print gc


Fixed submission:
'''input
2 1
555 556
'''
from fractions import gcd
n,x = map(int,raw_input().split())
arr = map(int,raw_input().split())
arr.append(x)
arr.sort()
diff = []
for i in range(1,n+1):
	diff.append(arr[i]-arr[i-1])
gc = diff[0]
for i in range(1,len(diff)):
	gc = gcd(gc,diff[i])
print gc

Buggy python submission (verdict: Runtime Error):
'''input
3 81
33 105 57
'''
from fractions import gcd
n,x = map(int,raw_input().split())
arr = map(int,raw_input().split())
arr.append(x)
arr.sort()
diff = []
for i in range(1,n):
	diff.append(arr[i]-arr[i-1])
gc = diff[0]
for i in range(1,len(diff)):
	gc = gcd(gc,diff[i])
print gc


Fixed submission:
'''input
2 1
555 556
'''
from fractions import gcd
n,x = map(int,raw_input().split())
arr = map(int,raw_input().split())
arr.append(x)
arr.sort()
diff = []
for i in range(1,n+1):
	diff.append(arr[i]-arr[i-1])
gc = diff[0]
for i in range(1,len(diff)):
	gc = gcd(gc,diff[i])
print gc
Buggy python submission (verdict: Runtime Error):
n = input()
arr = map(int,raw_input().split())
print sum(arr)-n

Fixed submission:
arr = map(int,raw_input().split())
arr.sort()
cost = arr[1]-arr[0] + arr[2]-arr[1]
print cost
Buggy python submission (verdict: Runtime Error):
'''input
7
1 1 1 1 2 3 4
'''
n = input()
arr = map(int,raw_input().split())
for i in range(n):
	arr[i] = (arr[i]-(i+1))
arr.sort()
mean = float(arr[n//2]+arr[n//2+1])/2
ans = 10**30
for i in range(int(mean)-30,int(mean)+30):
	q = 0
	for j in range(n):
		q += abs(arr[j]-i)
	ans = min(q,ans)
print ans

Fixed submission:
'''input
7
1 1 1 1 2 3 4
'''
n = input()
arr = map(int,raw_input().split())
for i in range(n):
	arr[i] = (arr[i]-(i+1))
arr.sort()
mean = float(arr[n//2])
ans = 10**30
for i in range(int(mean)-30,int(mean)+30):
	q = 0
	for j in range(n):
		q += abs(arr[j]-i)
	ans = min(q,ans)
print ans

Buggy python submission (verdict: Runtime Error):
'''input
7
1 1 1 1 2 3 4
'''
n = input()
arr = map(int,raw_input().split())
for i in range(n):
	arr[i] = (arr[i]-(i+1))
arr.sort()
mean = float(arr[n//2]+arr[n//2+1])/n
ans = 10**30
for i in range(int(mean)-30,int(mean)+30):
	q = 0
	for j in range(n):
		q += abs(arr[j]-i)
	ans = min(q,ans)
print ans

Fixed submission:
'''input
7
1 1 1 1 2 3 4
'''
n = input()
arr = map(int,raw_input().split())
for i in range(n):
	arr[i] = (arr[i]-(i+1))
arr.sort()
mean = float(arr[n//2])
ans = 10**30
for i in range(int(mean)-30,int(mean)+30):
	q = 0
	for j in range(n):
		q += abs(arr[j]-i)
	ans = min(q,ans)
print ans

Buggy python submission (verdict: Runtime Error):
'''input
7
1 1 1 1 2 3 4
'''
n = input()
arr = map(int,raw_input().split())
for i in range(n):
	arr[i] = (arr[i]-(i+1))
arr.sort()
median = float(arr[n//2]+arr[n//2+1])/n
ans = 10**30
for i in range(int(mean)-30,int(mean)+30):
	q = 0
	for j in range(n):
		q += abs(arr[j]-i)
	ans = min(q,ans)
print ans

Fixed submission:
'''input
7
1 1 1 1 2 3 4
'''
n = input()
arr = map(int,raw_input().split())
for i in range(n):
	arr[i] = (arr[i]-(i+1))
arr.sort()
mean = float(arr[n//2])
ans = 10**30
for i in range(int(mean)-30,int(mean)+30):
	q = 0
	for j in range(n):
		q += abs(arr[j]-i)
	ans = min(q,ans)
print ans
Buggy python submission (verdict: Runtime Error):
'''input
3 14 3 25
3 1 1
'''
a = input()
b = input()
if a > 8 or b > 8 :
	print ":("
else:
	print "Yay!"

Fixed submission:
'''input
4 5
'''
a,b = map(int,raw_input().split())
if a > 8 or b > 8 :
	print ":("
else:
	print "Yay!"
Buggy python submission (verdict: Runtime Error):
n,z,w = map(int,raw_input().split())
arr = map(int,raw_input().split())
print max(abs(arr[-1]-w),abs(arr[-1]-arr[-2]))


Fixed submission:
'''input
4
4 3 2 1
'''
n,z,w = map(int,raw_input().split())
arr = map(int,raw_input().split())
if n > 1:
	print max(abs(arr[-1]-w),abs(arr[-1]-arr[-2]))
else:
	print abs(arr[-1]-w)