Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N = int(input())
# h,n,w
temp = int((3*N)/4)
hlist = [i+1 for i in range(temp)]
flag = False
for i in hlist:
    temp = 4/N - 1/i
    if(temp > 0):
        nlist = [i+1 for i in range(int(2/temp))]
        for j in nlist:
            beta = 4/N - 1/i - 1/j
            if (beta > 0):
                if(1/beta == int(1/beta)):
                    w = int(1/beta)
                    n = j
                    h = i
                    flag = True
                    break

    if flag:
        break

print(str(h)+ " " + str(n)+ " " +str(w))

Fixed submission:
S = int(input())
ans = 0
for i in range(6):
    A = S%10
    B = int(S/10)
    S = B
    ans += A
print(int(ans))
Buggy python submission (verdict: Runtime Error):
N = int(input())
K = int(input())
x = []
for i in range(N):
    x.append([int(i) for i in input().split()])

ans = 0
for i in range(N):
    if(abs(K-x[i]) >= x[i]):
        ans += x[i]
    else:
        ans += abs(K-x[i])
        
print(ans)

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

ans = 0
for i in range(N):
    if(abs(K-x[i]) >= x[i]):
        ans += x[i]
    else:
        ans += abs(K-x[i])

print(ans*2)
Buggy python submission (verdict: Runtime Error):
l,r = map(int,input().split())

m = [-1]*(r-l+1)

if (r-l+1)>=2019:
    print(0)
else:
    for i in range(r-l+1):
        m[i] = (l+i)%2019
    sm = sorted(m)
    print(sm[0]*sm[1])

Fixed submission:
l,r = map(int,input().split())

if (r-l+1)>=2019:
    print(0)
else:
    ans = (l*(l+1))%2019
    for j in range(l,r+1):
        for i in range(l,j):
            if ((i*j)%2019)<ans:
                ans = (i*j)%2019
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n,a,b,c,d,e=[int(input()) for i in range(6)]

city1 = [n]
city2 = [0]
city3 = [0]
city4 = [0]
city5 = [0]
city6 = [0]

t = 0

while city6[t-1]<n:
    
    if city1[t]==0:
        city1.append(0)
        city2.append(city2[t])
    elif city1[t]>=a:
        city1.append(city1[t]-a)
        city2.append(city2[t]+a)
    else:
        city1.append(0)
        city2.append(city2[t]+city1[t])
    
    if city2[t]==0:
        city3.append(city3[t])
    elif city2[t]>=b:
        city2[t+1] -= b
        city3.append(city3[t]+b)
    else:
        city2[t+1] -= city2[t]
        city3.append(city3[t]+city2[t])
    
    if city3[t]==0:
        city4.append(city4[t])
    elif city3[t]>=c:
        city3[t+1] -= c
        city4.append(city4[t]+c)
    else:
        city3[t+1] -= city3[t]
        city4.append(city4[t]+city3[t])
    
    if city4[t]==0:
        city5.append(city5[t])
    elif city4[t]>=d:
        city4[t+1] -= d
        city5.append(city5[t]+d)
    else:
        city4[t+1] -= city4[t]
        city5.append(city5[t]+city4[t])
        
    if city5[t]==0:
        city6.append(city6[t])
    elif city5[t]>=e:
        city5[t+1] -= e
        city6.append(city6[t]+e)
    else:
        city5[t+1] -= city5[t]
        city6.append(city6[t]+city5[t])
        
    t += 1

print(t-1)


Fixed submission:
n,a,b,c,d,e=[int(input()) for i in range(6)]

lis = [a,b,c,d,e]
neck = min(lis)

if(n%neck==0):
  print(( (n//neck))+4)
else:
  print(( (n//neck) +1)+4)
Buggy python submission (verdict: Runtime Error):
n = input()
p = [int(i) for i in input().split()]
ans = 0
for i in range(n-3):
  if p[i+1] == max(p[i], p[i+1], p[i+2]) or p[i+1] == min(p[i], p[i+1], p[i+2]):
    ans += 0
  else:
    ans += 1
print(ans)

Fixed submission:
n = int(input())
p = [int(i) for i in input().split()]
ans = 0
for i in range(n-2):
  if p[i+1] == max(p[i], p[i+1], p[i+2]) or p[i+1] == min(p[i], p[i+1], p[i+2]):
    ans += 0
  else:
    ans += 1
print(ans)

Buggy python submission (verdict: Runtime Error):
n = input()
p = [int(i) for i in input().split()]
ans = 0
for i in range(n-1):
  if p[i+1] == max(p[i], p[i+1], p[i+2]) or p[i+1] == min(p[i], p[i+1], p[i+2]):
    ans += 0
  else:
    ans += 1
print(ans)

Fixed submission:
n = int(input())
p = [int(i) for i in input().split()]
ans = 0
for i in range(n-2):
  if p[i+1] == max(p[i], p[i+1], p[i+2]) or p[i+1] == min(p[i], p[i+1], p[i+2]):
    ans += 0
  else:
    ans += 1
print(ans)

Buggy python submission (verdict: Runtime Error):
n = input()
p = [int(i) for i in input().split()]
ans = 0
for i in range(n-1):
  if p[i+1] == max(p[i], p[i+1], p[i+2]) or min(p[i], p[i+1], p[i+2]):
    ans += 0
  else:
    ans += 1

print(ans)

Fixed submission:
n = int(input())
p = [int(i) for i in input().split()]
ans = 0
for i in range(n-2):
  if p[i+1] == max(p[i], p[i+1], p[i+2]) or p[i+1] == min(p[i], p[i+1], p[i+2]):
    ans += 0
  else:
    ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
import math

a,b,c,d = map(int, input().split())

lcm = int(c * d / math.gcd(c, d))

bb = int((b // c) + (b // d) - (b // lcm))

aa = int(((a-1) // c) + ((a-1) // d) - ((a-1) // lcm))

print(bb, aa)

print((b-a) - int(bb-aa) + 1)

Fixed submission:
from fractions import gcd

a,b,c,d = map(int, input().split())

lcm = int(c * d / gcd(c, d))

bb = int((b // c) + (b // d) - (b // lcm))

aa = int(((a-1) // c) + ((a-1) // d) - ((a-1) // lcm))

print((b-a) - int(bb-aa) + 1)

Buggy python submission (verdict: Runtime Error):
import math

a,b,c,d = map(int, input().split())

lcm = c * d / math.gcd(c, d)

bb = ((b // c) + (b // d) - (b // lcm))

aa = ((a // c) + (a // d) - (a // lcm))

print((b-a) - int(bb-aa) + 1)

Fixed submission:
from fractions import gcd

a,b,c,d = map(int, input().split())

lcm = int(c * d / gcd(c, d))

bb = int((b // c) + (b // d) - (b // lcm))

aa = int(((a-1) // c) + ((a-1) // d) - ((a-1) // lcm))

print((b-a) - int(bb-aa) + 1)
Buggy python submission (verdict: Runtime Error):
l = [map(int, input())]

l.sort()

print(l[0] + l[1])

Fixed submission:
p,q,r = map(int, input().split())

l = [p, q, r]

l.sort()

print(l[0] + l[1])
Buggy python submission (verdict: Runtime Error):
N = int(input())
W = [int(i) for i in input().split()]
s = sum(W)
a = 0

for i in range(N):
	_ = a + W[i]
	if abs(a - (s - a)) <= abs(_ - (s - _)):
		break
	else:
		a = _

print abs(a-(s - a))

Fixed submission:
N = int(input())
W = [int(i) for i in input().split()]
s = sum(W)
a = 0

for i in range(N):
	_ = a + W[i]
	if abs(a - (s - a)) <= abs(_ - (s - _)):
		break
	else:
		a = _

print(abs(a-(s - a)))
Buggy python submission (verdict: Runtime Error):
#C - Stones
#黒い石のすぐ右に白い石があるような箇所がないようにしたいです。 

n = int(input())
state = input()
state_list = list(state)
prob_num = 0
state_list.append(" ")
for i in range(n):
	if state_list[i] == "#" and state_list[i+1] == ".":
		prob_num += 1

print(prob_num)

Fixed submission:
#A - On the Way

coords = list(map(int, input().split()))
a, b, c = coords

if a < c < b:
	print("Yes")
elif b < c < a:
	print("Yes")
else:
	print("No")
Buggy python submission (verdict: Runtime Error):
buttons = {"A","B"}
buttons["A","B"]=(A,B)

def game():
  num = 0
  value = 0
  while num < 2:
    if buttons["A"] >= button["B"]:
      value += buttons["A"]
      buttons["A"] -= 1
    else:
      value += buttons["B"]
      buttons["B"] -= 1
    num += 1
  return(value)
print(game())

Fixed submission:
 # A - Buttons
a, b = list(map(int, input().split()))
first = max(a, b)
if a == first:
	a -= 1
else:
 	b -= 1
second = max(a, b)
print(first + second)
Buggy python submission (verdict: Time Limit Exceeded):
# C - GeT AC
n, q = list(map(int, input().split()))
s = input()
q_range = [ list(map(int, input().split())) for i in range(q)]
for i in q_range:
	s_ = s[i[0]-1:i[1]]
	r= 0
	for i in range(len(s_)-1):
		if s_[i] == "A" and s_[i+1] == "C":
			r += 1
	print(r)

Fixed submission:
# C - GeT AC
n, q = map(int, input().split())
s = input()
t = [0] * (n + 1)
for i in range(n):
	t[i + 1] = t[i] + (1 if s[i : i + 2] == 'AC' else 0)
for i in range(q):
	l, r = map(int, input().split())
	print(t[r-1] - t[l-1])
Buggy python submission (verdict: Runtime Error):
n, a, b = map(int, input())

max_ = min(a,b)
if max(n, a+b) == a+b:
    min_ = a + b - n
else:
    min_ = n - (a + b)

print(max_, min_)

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

max_ = min(a, b)

if max(n, a+b) == a+b:
    min_ = a + b - n
else:
    min_ = 0

print(max_, min_)

Buggy python submission (verdict: Runtime Error):
n, a, b = map(int, input())

max_ = min(a,b)
if max(n, a+b) == a+b:
	min_ = a + b - n
else:
	min_ = n - (a + b)

print(max_, min_)

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

max_ = min(a, b)

if max(n, a+b) == a+b:
    min_ = a + b - n
else:
    min_ = 0

print(max_, min_)
Buggy python submission (verdict: Runtime Error):
import sys
n = int(input())
ab = [list(map(int, input().split())) for i in range(n)]

ab.sort(key=lambda x: x[1])
now = 0 #現在時刻
for i in range(n):
    now = now + ab[i][0]
    if now > ab[i][1]:
        print('No')
        sys.exit()

print('Yes')


Fixed submission:
s = str(input())
if s[0] == s[1] or s[1] == s[2] or s[2] == s[3]:
    print("Bad")
else:
    print("Good")
Buggy python submission (verdict: Runtime Error):
from math import gcd

def lcm(x, y):
    ret = (x*y)//gcd(x,y)
    return ret

def f(n, c, d):
    x = n
    x -= n//c
    x -= n//d
    x += n//lcm(c,d)
    return x

a, b, c, d = map(int, input().split())
r = f(b, c, d) - f(a-1, c, d)
print(r)


Fixed submission:
from fractions import gcd

def lcm(x, y):
    ret = (x*y)//gcd(x,y)
    return ret

def f(n, c, d):
    x = n
    x -= n//c
    x -= n//d
    x += n//lcm(c,d)
    return x

a, b, c, d = map(int, input().split())
r = f(b, c, d) - f(a-1, c, d)
print(r)

Buggy python submission (verdict: Runtime Error):
from math import gcd

def lcm(x, y):
    ret = (x*y)//gcd(x,y)
    return ret

def f(n, c, d):
    x = n
    x -= n//c
    x -= n//d
    x += n//lcm(c,d)
    return x

a, b, c, d = map(int, input().split())
r = f(b, c, d) - f(a-1, c, d)
print(r)


Fixed submission:
from fractions import gcd

def lcm(x, y):
    ret = (x*y)//gcd(x,y)
    return ret

def f(n, c, d):
    x = n
    x -= n//c
    x -= n//d
    x += n//lcm(c,d)
    return x

a, b, c, d = map(int, input().split())
r = f(b, c, d) - f(a-1, c, d)
print(r)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# Input
list = [int(a) for a in input().split()]

#ソート
list.sort()
print

if list[0] > list[1] + 1:
    num = list[0] * 2 - 1
else:
    mum = sum(list)

print(num)


Fixed submission:
# -*- coding: utf-8 -*-
# Input
list = [int(a) for a in input().split()]

#ソート
list.sort()

num = 0
if list[1] > list[0] + 1:
    num = list[1] * 2 - 1
else:
    num = sum(list)

print(num)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# Input
list = []
for _ in range(4):
    list += [int(input())]

count = 0
for ii in range(list[0] + 1):
    for jj in range(list[1] + 1):
        for kk in range(list[2] + 1):
            if list[3] == 500 * ii + 100 * jj + 50 * kk:
                count += 1
            else if list[3] < 500 * ii + 100 * jj + 50 * kk:
                break

print(count)


Fixed submission:
# -*- coding: utf-8 -*-
# Input
list = []
for _ in range(4):
    list += [int(input())]

count = 0
for ii in range(list[0] + 1):
    for jj in range(list[1] + 1):
        for kk in range(list[2] + 1):
            if list[3] == 500 * ii + 100 * jj + 50 * kk:
                count += 1

print(count)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# Input
list = []
for _ in range(3):
    list += [int(input())]

total = 0
for ii in range(1, list[0] + 1):
    sum = 0
    tmp = ii
    while tmp > 0:
        sum += tmp % 10
        tmp = tmp // 10

    if sum >= list[1] and sum <= list[2]:
        total += ii
print(total)


Fixed submission:
# -*- coding: utf-8 -*-
# Input
list = []
n, a, b = map(int, input().split())

total = 0
for ii in range(1, n + 1):
    sum = 0
    tmp = ii
    while tmp > 0:
        sum += tmp % 10
        tmp = tmp // 10

    if sum >= a and sum <= b:
        total += ii
print(total)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# 入力
a = list(str(input))
# String to Int
num = [int(s) for s in a]
# Output
print(sum(num))


Fixed submission:
# -*- coding: utf-8 -*-
a = list(str(input()))
num = [int(s) for s in a]
print(sum(num))

Buggy python submission (verdict: Runtime Error):
a = list(str(input))
num = [int(s) for s in a]
print(sum(num))


Fixed submission:
# -*- coding: utf-8 -*-
a = list(str(input()))
num = [int(s) for s in a]
print(sum(num))
Buggy python submission (verdict: Runtime Error):
n = int(input())
s_list = []
for _ in range(n):
    s_list.append(input())

ans = 0
head_b = 0
tail_a = 0
headAndTail = 0

for s in s_list:
    if 'AB' in s:
        ans += 1
    if s.startswith('B') and s.endswith('A')::
       headAndTail += 1
    elif s.startswith('B'):
        head_b += 1
    elif s.endswith('A'):
        tail_a += 1

ans += min([head_b, tail_a])

if head_b == 0 and tail_a == 0:
    ans += max([0,headAndTail-1])
else:
    ans += headAndTail

print(ans)

Fixed submission:
n = int(input())
s_list = []
for _ in range(n):
    s_list.append(input())

ans = 0
head_b = 0
tail_a = 0
headAndTail = 0

for s in s_list:
    ans += s.count('AB')

    if s.startswith('B') and s.endswith('A'):
       headAndTail += 1
    elif s.startswith('B'):
        head_b += 1
    elif s.endswith('A'):
        tail_a += 1

ans += min([head_b, tail_a])

if head_b == 0 and tail_a == 0:
    ans += max([0,headAndTail-1])
else:
    ans += headAndTail

print(ans)
Buggy python submission (verdict: Runtime Error):
import sys

arg = sys.argv
T = int(arg[1])
X = int(arg[2])
t = T / X
print(t)

Fixed submission:
import sys

def main():
    arg = sys.stdin.readline().rstrip().split()
    T = int(arg[0])
    X = int(arg[1])
    t = T / X
    print(t)


if __name__ == "__main__":
    main()

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

def main():
    arg = sys.argv
    T = int(arg[1])
    X = int(arg[2])
    t = T / X
    print(t)


if __name__ == "__main__":
    main()

Fixed submission:
import sys

def main():
    arg = sys.stdin.readline().rstrip().split()
    T = int(arg[0])
    X = int(arg[1])
    t = T / X
    print(t)


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
import math

a,b,c,d=map(int, input().split())
tisai = c*d/math.gcd(c,d)
n=[c,d]
count=0
for k in range(2):
    count+= ((b+1)//n[k])-(a//n[k])
    # print(count)
count-= ((b+1)//tisai)-(a//tisai)
# print(count)
print(int((b-a+1)-count))

Fixed submission:
from fractions import gcd

a,b,c,d=map(int, input().split())
tisai = int(c*d/gcd(c,d))
n=[c,d]
count=0
for k in range(2):
    count += ((b//n[k])-((a-1)//n[k]))
count -= ((b//tisai)-((a-1)//tisai))
print(int((b-a+1)-count))
Buggy python submission (verdict: Time Limit Exceeded):
n,q = map(int, input().split())
s = input()
for _ in range(q):
    l,r = map(int, input().split())
    print(s[l-1:r].count("AC"))

Fixed submission:
n,q = map(int, input().split())
s = input()
count = [0]*n
for i in range(1,n):
    count[i] += count[i-1]
    if s[i-1:i+1]=="AC": count[i]+=1
for i in range(q):
    l,r = map(int, input().split())
    print(count[r-1]-count[l-1])

Buggy python submission (verdict: Time Limit Exceeded):
NQ = list(map(int, input().split()))
word = input()
word_list = list(word)
for i in range(0, NQ[1]):
    rl = list(map(int, input().split()))
    word = word_list[rl[0]-1:rl[1]]
    word = ''.join(word)
    print(word.count('AC'))

Fixed submission:
n,q = map(int, input().split())
s = input()
count = [0]*n
for i in range(1,n):
    count[i] += count[i-1]
    if s[i-1:i+1]=="AC": count[i]+=1
for i in range(q):
    l,r = map(int, input().split())
    print(count[r-1]-count[l-1])

Buggy python submission (verdict: Runtime Error):
NQ = list(map(int, input().split()))
word = input()
word_list = [*word]
for i in range(0, NQ[1]):
    rl = list(map(int, input().split()))
    word = word_list[rl[0]-1:rl[1]]
    word = ''.join(word)
    print(word.count('AC'))

Fixed submission:
n,q = map(int, input().split())
s = input()
count = [0]*n
for i in range(1,n):
    count[i] += count[i-1]
    if s[i-1:i+1]=="AC": count[i]+=1
for i in range(q):
    l,r = map(int, input().split())
    print(count[r-1]-count[l-1])

Buggy python submission (verdict: Time Limit Exceeded):
NQ = list(map(int, input().split()))
word = input()
word_list = []
for i in word:
    word_list.append(i)
for i in range(0, NQ[1]):
    rl = list(map(int, input().split()))
    word = word_list[rl[0]-1:rl[1]]
    word = ''.join(word)
    print(word.count('AC'))

Fixed submission:
n,q = map(int, input().split())
s = input()
count = [0]*n
for i in range(1,n):
    count[i] += count[i-1]
    if s[i-1:i+1]=="AC": count[i]+=1
for i in range(q):
    l,r = map(int, input().split())
    print(count[r-1]-count[l-1])

Buggy python submission (verdict: Time Limit Exceeded):
NQ = list(map(int, input().split()))
word = input()
word_list = []
for i in word:
    word_list.append(i)

for i in range(0, NQ[1]):
    rl = list(map(int, input().split()))
    word = ''
    for loop in range(rl[0]-1, rl[1]):
        word += word_list[loop]
    print(word.count('AC'))

Fixed submission:
n,q = map(int, input().split())
s = input()
count = [0]*n
for i in range(1,n):
    count[i] += count[i-1]
    if s[i-1:i+1]=="AC": count[i]+=1
for i in range(q):
    l,r = map(int, input().split())
    print(count[r-1]-count[l-1])
Buggy python submission (verdict: Runtime Error):
N = int(input())
K = int(input())

if (2 * K - 1 <= N):
    print("YES")
else: 
    print("NO")


Fixed submission:
N = list(map(int, input().split()))
if (2 * N[1] - 1 <= N[0]):
    print("YES")
else: 
    print("NO")
Buggy python submission (verdict: Runtime Error):
S = [*input()] # これで文字列を一文字にできる
T = input()

for i in range(0, len(S)):
    word = ''
    for j in range(0, len(S)):
        index = (i + j) % len(S)
        word += S[index]
    if word == T:
        print('Yes')
        break
    elif i == j:
        print('No')
        break


Fixed submission:
S = tuple(input()) # これで文字列を一文字にできる
T = input()

for i in range(0, len(S)):
    word = ''
    for j in range(0, len(S)):
        index = (i + j) % len(S)
        word += S[index]
    if word == T:
        print('Yes')
        break
    elif i == j:
        print('No')
        break

Buggy python submission (verdict: Runtime Error):
S = [*input()] # これで文字列を一文字にできる
T = input()

for i in range(0, len(S)):
    word = ''
    for j in range(0, len(S)):
        index = (i + j) % len(S)
        word += S[index]
    if(word == T):
        print('Yes')
        break
    elif(i == j):
        print('No')
        break


Fixed submission:
S = tuple(input()) # これで文字列を一文字にできる
T = input()

for i in range(0, len(S)):
    word = ''
    for j in range(0, len(S)):
        index = (i + j) % len(S)
        word += S[index]
    if word == T:
        print('Yes')
        break
    elif i == j:
        print('No')
        break

Buggy python submission (verdict: Runtime Error):
S = [*input()] # これで文字列を一文字にできる
T = input()
for i in range(0, len(S)):
    word = ''
    for j in range(0, len(S)):
        index = (i + j) % len(S)
        word += S[index]
    if(word == T):
        print('Yes')
        break
    elif(i == j):
        print('No')


Fixed submission:
S = tuple(input()) # これで文字列を一文字にできる
T = input()

for i in range(0, len(S)):
    word = ''
    for j in range(0, len(S)):
        index = (i + j) % len(S)
        word += S[index]
    if word == T:
        print('Yes')
        break
    elif i == j:
        print('No')
        break

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

S = [*input()] # これで文字列を一文字にできる
T = input()
for i in range(0, len(S)):
    word = ''
    for j in range(0, len(S)):
        index = (i + j) % len(S)
        word += S[index]
    if(word == T):
        print('Yes')
        sys.exit()
print("No")


Fixed submission:
S = tuple(input()) # これで文字列を一文字にできる
T = input()

for i in range(0, len(S)):
    word = ''
    for j in range(0, len(S)):
        index = (i + j) % len(S)
        word += S[index]
    if word == T:
        print('Yes')
        break
    elif i == j:
        print('No')
        break
Buggy python submission (verdict: Runtime Error):
def maxElem( lis ):
  L = lis[:]#copy
  S = set(lis)
  S = list(S)
  MaxCount=0
  ret='nothing...'

  for elem in S:
    c=0
    while elem in L:
      ind = L.index(elem)
      foo = L.pop(ind)
      c+=1
    if c>MaxCount:
      MaxCount=c
      ret = elem
  return ret

if __name__ == "__main__" :
    n = int(input())
    array = list(map(int, input().split()))

    for i in range(0, n):
        array[i] = array[i] - (i + 1)
    elem = int(maxElem(array))
    
    for i in range(0, n):
        array[i] = abs(array[i] - elem)

    sum_n = sum(array)

    print(sum_n)

Fixed submission:
N = int(input())
if N % 2 != 0:
    N = N * 2

print(N)
Buggy python submission (verdict: Time Limit Exceeded):
def maxElem( lis ):
  '''
  与えられたリストの中に、最も多く存在する要素を返す
  (最大の数の要素が複数ある場合、pythonのsetで先頭により近い要素を返す)
  '''
  L = lis[:]#copy
  S = set(lis)
  S = list(S)
  MaxCount=0
  ret='nothing...'

  for elem in S:
    c=0
    while elem in L:
      ind = L.index(elem)
      foo = L.pop(ind)
      c+=1
    if c>MaxCount:
      MaxCount=c
      ret = elem
  return ret


if __name__ == "__main__" :
    n = int(input())
    array = list(map(int, input().split()))

    for i in range(0, n):
        array[i] = array[i] - (i + 1)
    elem = int(maxElem(array))
    
    for i in range(0, n):
        array[i] = abs(array[i] - elem)

    sum_n = sum(array)

    print(sum_n)

Fixed submission:
import collections
from statistics import median

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

for i in range(0, n):
    array[i] = array[i] - (i + 1)
c = collections.Counter(array)
elem = int(c.most_common()[0][0])

# print(c.most_common()[0][0])
# print(array)
# print(elem)
# if c.most_common()[0][1] != 1:
#     # print("test")
#     for j in range(0, n):
#         array[j] = abs(array[j] - elem)
# else:
#     for j in range(0, n):
#         array[j] = abs(array[j])
b = int(median(array))
for j in range(0, n):
    array[j] = int(abs(array[j] - b))

print(sum(array))

Buggy python submission (verdict: Time Limit Exceeded):
def maxElem( lis ):
  '''
  与えられたリストの中に、最も多く存在する要素を返す
  (最大の数の要素が複数ある場合、pythonのsetで先頭により近い要素を返す)
  '''
  L = lis[:]#copy
  S = set(lis)
  S = list(S)
  MaxCount=0
  ret='nothing...'

  for elem in S:
    c=0
    while elem in L:
      ind = L.index(elem)
      foo = L.pop(ind)
      c+=1
    if c>MaxCount:
      MaxCount=c
      ret = elem
  return ret


if __name__ == "__main__" :
    n = int(input())
    array = list(map(int, input().split()))

    for i in range(0, n):
        array[i] = array[i] - i - 1
    elem = int(maxElem(array))
    # print(maxElem(array))
    # print(array)
    
    for i in range(0, n):
        array[i] = abs(array[i] - elem)

    # sum_n = sum(array)

    # if sum_n > n:
    #     for j in range(0, n):
    #         array[j] = array[j] * array[j]
    sum_n = sum(array)

    print(sum_n)

Fixed submission:
import collections
from statistics import median

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

for i in range(0, n):
    array[i] = array[i] - (i + 1)
c = collections.Counter(array)
elem = int(c.most_common()[0][0])

# print(c.most_common()[0][0])
# print(array)
# print(elem)
# if c.most_common()[0][1] != 1:
#     # print("test")
#     for j in range(0, n):
#         array[j] = abs(array[j] - elem)
# else:
#     for j in range(0, n):
#         array[j] = abs(array[j])
b = int(median(array))
for j in range(0, n):
    array[j] = int(abs(array[j] - b))

print(sum(array))
Buggy python submission (verdict: Runtime Error):
n = int(input())
c = 1
for i in range(1, n):
    for j in range(2, n):
        if i**j<=x:
            c=max(c, i**j)
print(c)

Fixed submission:
n = int(input())
c = 1
for i in range(1, n):
    for j in range(2, n):
        if i**j<=n:
            c=max(c, i**j)
        else:break
print(c)

Buggy python submission (verdict: Runtime Error):
n = int(input())
c = 1
for i in range(1, n):
    for j in range(2, n):
        if i**j<=x:
            c=max(c, i**j)
print(c)

Fixed submission:
n = int(input())
c = 1
for i in range(1, n):
    for j in range(2, n):
        if i**j<=n:
            c=max(c, i**j)
        else:break
print(c)