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

Fixed submission:
predict, actual = input(),input()
a = 0
for i in range(3):
    if(predict[i] == actual[i]):
        a = a + 1
print(a)

Buggy submission (verdict: Runtime Error):
a,b=map(int, input().split())
c = (b-1) / (a-1)

if( (b-1) % (a-1) > 0):
   c = c+1
print(c)

Buggy submission (verdict: Runtime Error):
predict, actual = input(),input()
a = 0
for i in range(3):
	if(predict[i] == actual[i]):
    	a = a + 1
print(a)

Buggy submission (verdict: Runtime Error):
predict = input()
actual  = input()

a = 0
for i in range(3):
	if(predict[i] == actual[i]):
    	a = a + 1
print(a)
Problem p02922 (python)

Fixed submission:
a,b=map(int, input().split())
c = (b-1) // (a-1)

if (b-1) % (a-1) > 0 :
   c = c+1
print(c)

Buggy submission (verdict: Runtime Error):
a,b=map(int, input().split())
c = (b-1) / (a-1)

if( (b-1) % (a-1) > 0:
   c = c+1
print(c)
Problem p02923 (python)

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

cnt = 0
ret = 0
for i in range(n-1):
  if h[i] >= h[i+1]:
    cnt = cnt+1
  else:
    ret = max(cnt,ret)
    cnt = 0
  if i == n-2:
    ret = max(cnt,ret)
print(ret)

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

cnt = 0
ret = 0
for i in range(n-1):
  if h[i] >= h[i+1]:
    cnt = cnt+1
  else:
    ret = max(cnt,ret)
    cnt = 0
  if i == n-2:
    ret = max(cnt,ret)
print(ret)

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

cnt = 0
ret = 0
for i in range(n-1):
  if h[i] >= h[i+1]:
    cnt = cnt+1
  else:
    ret = max(cnt,ret)
    cnt = 0
  if i == n-2:
    ret = max(cnt,ret)
print(ret)

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

cnt = 0
ret = 0
for i in range(n-1):
  if(h[i] >= h[i+1]):
    cnt = cnt+1
  else:
    ret = max(cnt,ret)
    cnt = 0
  if(i == n-2):
    ret = max(cnt,ret)
print(ret)
Problem p02924 (python)

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

Buggy submission (verdict: Runtime Error):
if n == 1:
  print(0)
else:
  print(n*(n-1)//2)
Problem p03047 (python)

Fixed submission:
n, k = (int(i) for i in input().split()) 
a =  n - k + 1
print( a)

Buggy submission (verdict: Runtime Error):
import math
r,g,b,n  = (int(i) for i in input().split())
z =  math.factorial(r) * math.factorial(b) * math.factorial(g)
a =  math.factorial(n) // z
print( a)

Buggy submission (verdict: Runtime Error):
n, k = (int(i) for i in input().split()) 

a = 0
b = 0
for i in range(1, n):
	a = a +i
for i in range(1, (n -k)):
	b = b + i
	
print(a/b)
Problem p03085 (python)

Fixed submission:
b = input()

if b=='A':
    print('T')

elif b=='T':
    print('A')

elif b=='C':
    print('G')

else:
    print('C')

Buggy submission (verdict: Runtime Error):
b = input()

if b=='A':
    print('T')

elif b=='T':
    print('A')

elif b=='C':
    print('G')

else:
    print('C')
Problem p02848 (python)

Fixed submission:
N = int(input())
S = input()
ans = ""
a = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

for i in range(len(S)):
    if a.index(S[i]) + N > 25:
        ans += a[a.index(S[i]) + N - 26]
    else:
        ans += a[a.index(S[i]) + N]

print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()
ans = ""
a = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

for i in range(len(S)):
    if a.index(S[i]) + N > 26:
        ans += a[a.index(S[i]) + N - 26]
    else:
        ans += a[a.index(S[i]) + N]

print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()
ans = ""
a = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

for i in range(len(S)):
    if a.index(S[i]) + N > 26:
        ans += a[a.index(S[i]) + N - 26]
    else:
        ans += a[a.index(S[i]) + N]

print(ans)
Problem p02957 (python)

Fixed submission:
A, B = map(int, input().split())
K = (A + B) / 2
ans = int(K) if (A + B) % 2 == 0 else "IMPOSSIBLE"
print(ans)

Buggy submission (verdict: Runtime Error):
A, B = map(int, input().split())
K = (A + B) / 2
ans = K if K % 2 == 0 else "IMPOSSIBLE"
print(int(ans))
Problem p03101 (python)

Fixed submission:
H, W = map(int, input().split())
h, w = map(int, input().split())

print((H * W) - (h * W + w * H - h * w))

Buggy submission (verdict: Runtime Error):
H, W = map(int, input().split())
h, w = map(int, input().split())

print((H * W) - (h * H + w * W - h * w)
Problem p03238 (python)

Fixed submission:
n = int(input())
if n == 1:
    print("Hello World")
else:
    a = int(input())
    b = int(input())
    print(a + b)

Buggy submission (verdict: Runtime Error):
n = input()
if n == 1:
    print("Hello World")
else:
    a, b = map(int, input().split())
    print(a + b)

Buggy submission (verdict: Runtime Error):
n = input()
if n = 1:
    print("Helllo World")
else:
    a, b = map(int, input().split())
    print(a + b)
Problem p03292 (python)

Fixed submission:
li = list(map(int, input().split()))
sli = sorted(li)

print((sli[1] - sli[0]) + (sli[2] - sli[1]))

Buggy submission (verdict: Runtime Error):
li = [map(int, input().split())]
sli = sorted(li)

print((sli[1] - sli[0]) + (sli[2] - sli[1]))
Problem p03385 (python)

Fixed submission:
s = input()

print("Yes" if s.count("a") == 1
            and s.count("b") == 1 
            and s.count("c") == 1
            else "No")

Buggy submission (verdict: Runtime Error):
s = input()

print("Yes" s.count("a") == 1 and s.count("b") == 1 and s.count("c") == 1 else "No")
Problem p03555 (python)

Fixed submission:
c1 = input()
c2 = input()

print("YES" if c1 == c2[::-1] else "NO")

Buggy submission (verdict: Runtime Error):
c1 = input()
c2 = input()

print("YES" if c1 = c2[::-1] else "NO")

Buggy submission (verdict: Runtime Error):
c1 = input()
c2 = input()

print("Yes" if c1 = c2[::-1] else "No")
Problem p03605 (python)

Fixed submission:
n = input()

print("Yes" if n[0] == "9" or n[1] == "9" else "No")

Buggy submission (verdict: Runtime Error):
n = int(input())

print("Yes" if n[0] == 9 or n[1] == 9 else "No")
Problem p03693 (python)

Fixed submission:
r, g, b = input().split()

n = int(r + g + b)

print("YES" if n % 4 == 0 else "NO")

Buggy submission (verdict: Runtime Error):
r, g, b = input().split()

n = r + g + b

print("YES" if n % 4 == 0 else "NO")
Problem p02945 (python)

Fixed submission:
a,b=map(int,input().split())
print("{}".format(max((a+b),(a-b),(a*b))))

Buggy submission (verdict: Runtime Error):
a,b=map(int,input()split())
print("{}".format(max((a+b),(a-b),(a*b))))
Problem p03285 (python)

Fixed submission:
n=int(input())
d=0
for i in range(n//4+1):
    for j in range(n//7+1):
        if 4*i+7*j==n:
            d+=1
print("Yes" if d!=0 else "No")

Buggy submission (verdict: Runtime Error):
n=int(input())
for i in range(n//4+1):
    for j in range(n//7+1):
        if 4*i+7*j==n:
            ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
for s in range(n//4+1):
    for t in range(n//7+1):
        if 4*s+7*t==n:
             print("Yes")
            break
        else:
            print("No")
Problem p03308 (python)

Fixed submission:
n=int(input())
ln=[int(n) for n in map(int,input().split())]
print(max(ln)-min(ln))

Buggy submission (verdict: Runtime Error):
n=int(input())
ln=map(int,input().split())
print(abs(max(ln)-min(ln)))

Buggy submission (verdict: Runtime Error):
n=int(input())
ln=map(int,input().split())
print(abs(max(ln)-min(ln)+1))
Problem p03370 (python)

Fixed submission:
n,x=map(int,input().split())
ln=[int(input()) for i in range(n)]
print(n+(x-sum(ln))//min(ln))

Buggy submission (verdict: Runtime Error):
n,x=map(int,input().split())
ln=map(int,input().split())
print(n+(x-sum(ln))//min(ln))
Problem p03448 (python)

Fixed submission:
a,b,c,x=[int(input()) for i in range(4)]
i=0
for _ in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if 500*_+100*j+50*k==x:
                i+=1
print(i)

Buggy submission (verdict: Runtime Error):
a,b,c,x=map(int, input().split())
i=0
for p in range(a+1):
    for q in range(b+1):
        for r in range(c+1):
            if 500*p+100*q+50*r==x:
                i+=1
print(i)

Buggy submission (verdict: Runtime Error):
a,b,c,x=map(int,input().split())
i=0
for s in range(1,a+1):
    for t in range(1,b+1):
         for r in range(1,c+1):
            if (500*s+100*t+50*r)==x:
                i+=1
print(i)

Buggy submission (verdict: Runtime Error):
a,b,c,x=map(int,input().split())
i=0
for s in range(1,a+1):
    for t in range(1,b+1):
         for r in range(1,c+1):
            if 500*s+100*t+50*r==x:
                i+=1
print(i)

Buggy submission (verdict: Runtime Error):
a,b,c,x=map(int,input().split())
i=0
for s in range(1,a+1):
    for t in range(1,b+1):
         for r in range(1,c+1):
            if 500*a+100*b+50*c==x:
                i+=1
print(i)

Buggy submission (verdict: Runtime Error):
a,b,c,x=map(int,input().split())
i=0
for s in range(1,a+1):
    foe t in range(1,b+1):
         for r in range(1,c+1):
            if 500*a+100*b+50*c==x:
                i+=1
print(i)
Problem p03469 (python)

Fixed submission:
print("2018"+input()[4:])

Buggy submission (verdict: Runtime Error):
s=input()
s[2].replace("8")
print(s)
Problem p03486 (python)

Fixed submission:
s=sorted(input())
t=sorted(input(),reverse=True)
if s<t:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
s=input().sort()
t=input().sort()
for x,y in s,t:
    if x>y:
        print("Yes")
   break
print("No")
Problem p03494 (python)

Fixed submission:
n=int(input())
ln=[int(a) for a in input().split()]
i=0
while all(a % 2 ==0 for a in ln):
    ln=[a/2 for a in ln]
    i+=1
print(i)

Buggy submission (verdict: Runtime Error):
n=int(input())
ln=[int(a) for a in input().split()]
while all(a%2==0 for a in ln):
    ln=[a//2 for a in ln]
    i+=1
print(i)

Buggy submission (verdict: Runtime Error):
n=int(input())
ln=[int(a) for a in input().split()]
i=0
while all(a % 2 ==0 for a in ln):
    ln=[a/2 foe a in ln]
    i+=1
print(i)

Buggy submission (verdict: Runtime Error):
n=int(input())
ln=[int(a) for a in input().split()]
i=0
while all([a % 2 for a in ln]==0):
    i+=1
print(i)

Buggy submission (verdict: Runtime Error):
n=int(input())
ln=[int(a) for a in input().split()]
i=0
while all([a for a in ln]%2==0):
    i+=1
print(i)
Problem p03636 (python)

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

Buggy submission (verdict: Runtime Error):
print(input()[0]+len(input()[1:-1])+input()[-1])

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

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

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

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

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

Fixed submission:
n=int(input())
ans=0
for i in range(7):
    if 2**i<=n:
        ans=2**i
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
ln=[0]*n
for a  in range(n):
    if a %2 ==0:
        ln[a-1}=a//2
    else:
        ln[a-1]=0
print(max(ln))

Buggy submission (verdict: Runtime Error):
ln=[n for n in range(int(input()))]
cnt=[0]*n
for n in ln:
    while n%2==0:
        cnt[n-1]+=1
print((max(cnt)).index()+1)
Problem p03693 (python)

Fixed submission:
R,G,B=input().split(" ")
r=int(R)
g=int(G)
b=int(B)
s=100*r+10*g+b
if s%4==0:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
R,G,B=input().split(" ")
r=R
g=G
b=B
if (100*r+10*g+b)%4==0:
    print("YES")
else:
    print("NO")
Problem p03814 (python)

Fixed submission:
s=input()
print(s.rfind("Z")-s.find("A")+1)

Buggy submission (verdict: Runtime Error):
print(input().rfind("Z")-input().find("A")+1)

Buggy submission (verdict: Runtime Error):
print(input().rfind("Z")-input().find("A")+1)

Buggy submission (verdict: Runtime Error):
s=input()
print(max(s.index("Z"))-min(s.index('A')))

Buggy submission (verdict: Runtime Error):
s=input()
print(abs(min(s.index('A'))-max(s.index("Z"))))
Problem p03493 (python)

Fixed submission:
print(sum(list(map(int,str(input())))))

Buggy submission (verdict: Runtime Error):
n = int(input())
nums = list(map(int,input().split()))
ans = 0
while sum(nums)%2 == 0:
    for i in range(n):
        nums[i]=nums[i]/2
    ans +=1
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
nums = list(map(int,input().split()))
ans = 0
while sum(nums)%2 == 0:
    for i in range(n):
        nums[i]=nums[i]//2
    ans +=1
print(ans)
Problem p02899 (python)

Fixed submission:
n1 = int(input())
l1 = [int(x) for x in input().split()]
l2 = [""] * n1

for i, v in enumerate(l1):
  l2[v -1] = i + 1

l2 = map(str,l2)
ans = " ".join(l2)
print(ans)

Buggy submission (verdict: Runtime Error):
n1 = int(input())
l1 = [int(x) for x in input().split()]
l2 = [""] * 8

for i, v in enumerate(l1):
  l2[v -1] = i + 1

ans = ""
for i in l2:
  ans = ans + str(i) + " "
print(ans[:-1])
Problem p03623 (python)

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

if x > a:
	x_a = x - a
else:
	x_a = a - x

if x > b:
	x_b = x - b
else:
	x_b = b - x
	


if x_a > x_b:
	print("B")
else:
	print("A")

Buggy submission (verdict: Runtime Error):
n = int(input())
list1 = [int(x) for x in input().split()]
#print(list1)

set1 = set(list1)
#print(set1)

listans = []

for i in set1:
  if list1.count(i) > 1:
    listans.append(i)

#print(listans)

if len(listans) < 2:
  print(0)
else:
  print(sorted(listans)[-1]*sorted(listans)[-2])

Buggy submission (verdict: Runtime Error):
n = int(input())
list1 = [int(x) for x in input().split()]
set1 = set(list1)

listans = []

for i in set1:
  if list1.count(i) > 2:
    listans.append(i)

if len(listans) < 2:
  print(0)
else:
  print(sorted(listans)[-1]*sorted(listans)[-2])

Buggy submission (verdict: Runtime Error):
n = int(input())
list1 = [int(x) for x in input().split()]
#print(list1)

set1 = set(list1)
#print(set1)

listans = []

for i in set1:
  if list1.count(i) > 2:
    listans.append(i)

#print(listans)

if len(listans) < 2:
  print(0)
else:
  print(sorted(listans)[-1]*sorted(listans)[-2])

Buggy submission (verdict: Runtime Error):
x, a, b = input().split()
x = int(x)
a = int(a)
b = int(b)

if x > a:
	x_a = x - a
else:
x_a = a - x

if x > b:
	x_b = x - b
else:
	x_b = b - x
	

if x_a > x_b:
	print("B")
else:
	print("A")
Problem p03625 (python)

Fixed submission:
n = int(input())
list1 = [int(x) for x in input().split()]
list2 = list(reversed(sorted(list1)))

fflag = 0
ans = []
for i in range(len(list2) - 1):
  if fflag ==0:
    if list2[i] == list2[i + 1]:
      ans.append(list2[i])
      fflag = 1
  elif fflag == 1:
    fflag = 0
    continue
  if len(ans) == 2:
    break

if len(ans) == 2:
  print(ans[0] * ans[1])
else:
  print(0)

Buggy submission (verdict: Runtime Error):
n = int(input())
list1 = [int(x) for x in input().split()]
list2 = list(reversed(sorted(list1)))
m = list2[0]

ans = []
for i in range(1, len(list2)):
  if list2[i] == m:
    ans.append(m)
  if len(ans) == 2:
    break
  m = list2[i]

print(ans[0] * ans[1])

Buggy submission (verdict: Runtime Error):
n = int(input())
list1 = [int(x) for x in input().split()]

set1 = set(list1)


listans = []

for i in set1:
  if list1.count(i) > 1 and list1.count(i) < 4:
    listans.append(i)
  elif list1.count(i) >3:
    listans.append(i)
    listans.append(i)




listasn = sorted(listans)
if len(listansn) < 2:
  print(0)
else:
  print(listansn[-1]*listansn[-2])
Problem p03478 (python)

Fixed submission:
n,a,b = map(int,input().split())
ans = 0
for i in range(n+1):
  f = sum([int(x) for x in str(i)])
  if (a <= f) & (f <= b):
    ans+=i
print(ans)

Buggy submission (verdict: Runtime Error):
n,a,b = map(int,input().split())
ans = 0
for i in range(n+1):
  f = sum([int(x) for x in str(i)])
  if a <= f && f <= b:
    ans+=i
print(ans)
Problem p03493 (python)

Fixed submission:
s = input()
factor = [int(x) for x in s]
print(sum(factor))

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

ans = 0
t=0

while True:
    for i in range(n):  # 0 1 2 ... n-1
        if a[i] %2 ==0:
            a[i] = a[i] / 2
        else:
            t = 1
    if t != 1:
        ans += 1
    else:
        break

print(ans)

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

ans = 0
t=0

while True:
    for i in range(n):  # 0 1 2 ... n-1
        if a[i] %2 ==0:
            a[i] = a[i] / 2
        else:
            t = 1
    if t != 1:
        ans += 1
    else:
        break

print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
li = list(map(int,input().split()))
counter = 0
while 1:
  judge = [a%2 for a in li] 
  if sum(judge) != 0:
    break
  else:
    counter+=1
    li = [a/2 for a in li]
print(counter)

Buggy submission (verdict: Runtime Error):
a,b,c = map(int, input().split())
print(str(a+b+c))
Problem p03854 (python)

Fixed submission:
import sys
li = ["dream","dreamer","erase","eraser"]
li = [s[::-1] for s in li]
sen = input()[::-1]
while 1:
  ju = 0
  for i in range(4):
    le = len(li[i])
    if sen[:le] == li[i]:
      if len(sen) == le:
        print("YES")
        sys.exit()
      else:
        sen = sen[le:]
        ju = 1
  if not ju:
    print("NO")
    sys.exit()

Buggy submission (verdict: Runtime Error):
import sys
li = ["dream","dreamer","erase","eraser"]
li = [s[::-1] for s in li]
sen = input()[::-1]
while 1:
  if sen[:5] == "maerd":
    if len(sen) == 5:
      print("YES")
      sys.exit()
    else sen = sen[5:]
  elif sen[:6] == "remaerd":
    if len(sen) == 6:
      print("YES")
      sys.exit()
    else sen = sen[6:]
  elif sen[:5] == "esare":
    if len(sen) == 5:
      print("YES")
      sys.exit()
    else sen = sen[5:]
  elif sen[:6] == "resare":
    if len(sen) == 6:
      print("YES")
      sys.exit()
    else sen = sen[6:]
  else:
    print("NO")
    sys.exit()
Problem p02842 (python)

Fixed submission:
import math

input = int(input())
guess = math.floor(input / 1.08)
if math.floor(guess * 1.08) == input:
    print(guess)
elif math.floor((guess + 1) * 1.08) == input:
    print(guess + 1)
else:
    print(':(')

Buggy submission (verdict: Runtime Error):
import math

input = int(input()
guess = math.floor(input / 1.08)
if math.floor(guess * 1.08) == input:
    print(guess)
elif math.floor((guess + 1) * 1.08) == input:
    print(guess + 1)
else:
    print(':(')

Buggy submission (verdict: Runtime Error):
import math

input = input()
guess = math.floor(input / 1.08)
if math.floor(guess * 1.08) == input:
    print(guess)
elif math.floor((guess + 1) * 1.08) == input:
    print(guess + 1)
else:
    print(':(')
Problem p02843 (python)

Fixed submission:
input = int(input())
n = input // 100
if n > 0:
    m = input % 100
    if m / n <= 5:
        print(1)
    else:
        print(0)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
input = int(input())
n = input // 100
m = input % 100
if m // n <= 5:
    print(1)
else:
    print(0)
Problem p02848 (python)

Fixed submission:
import string
A = list(string.ascii_uppercase)
N = int(input())
S = input()
Output = ''
for i in range(len(S)):
    for j in range(len(A)):
        if A[j] == S[i]:
            Output += A[(j+N) % 26]
print(Output)

Buggy submission (verdict: Runtime Error):
import string
A = list(string.ascii_uppercase)
N = int(input()) % 26
S = input()
Output = ''
for i in range(len(S)):
    for j in range(len(A)):
        if A[j] == S[i]:
            Output += A[j+N]
print(Output)
Problem p03288 (python)

Fixed submission:
N3 = int(input())
if N3 < 1200:
    print('ABC')
elif 1200 <= N3 < 2800:
    print('ARC')
else:
    print('AGC')

Buggy submission (verdict: Runtime Error):
N3 = int(input())
if N3 < 1200:
    print('ABC')
elif N3 > 1999 and N3 < 2800:
    print('ARC')
elif NR > 2799:
    print('AGC')

Buggy submission (verdict: Runtime Error):
N3 = int(input())
if N3 < 1200:
    print('ABC')
elif N3 > 1999 and NR < 2800:
    print('ARC')
else:
    print('AGC')
Problem p03229 (python)

Fixed submission:
n = int(input())
A = [int(input()) for _ in range(n)]
A.sort()
if n%2==1:print(max(2*sum(A[n-n//2:])-sum(A[n-n//2-2:n-n//2])-2*sum(A[:n-n//2-2]),-2*sum(A[:n//2])+sum(A[n//2:n//2+2])+2*sum(A[n//2+2:])))
else:print(-2*sum(A[:(n-2)//2])-A[(n-2)//2]+A[(n-2)//2+1]+2*sum(A[(n-2)//2+2:]))

Buggy submission (verdict: Runtime Error):
n = int(input());A = [int(input()) for _ in range(n)];A.sort();if n%2==1:print(max(2*sum(A[n-n//2:])-sum(A[n-n//2-2:n-n//2])-2*sum(A[:n-n//2-2]),-2*sum(A[:n//2])+sum(A[n//2:n//2+2])+2*sum(A[n//2+2:])));else:print(-2*sum(A[:(n-2)//2])-A[(n-2)//2]+A[(n-2)//2+1]+2*sum(A[(n-2)//2+2:]))

Buggy submission (verdict: Runtime Error):
n = int(input())
A = [int(input()) for _ in range(n)]
A.sort()
if n%2==1:print(max(2*sum(x[n-n//2:])-sum(x[n-n//2-2:n-n//2])-2*sum(x[:n-n//2-2]),-2*sum(x[:n//2])+sum(x[n//2:n//2+2])+2*sum(x[n//2+2:])))
else:print(-2*sum(A[:(n-2)//2])-A[(n-2)//2]+A[(n-2)//2+1]+2*sum(A[(n-2)//2+2:]))

Buggy submission (verdict: Runtime Error):
n=int(input());A=[int(input()) for _ in range(n)];A.sort();if n%2==1:print(max(2*sum(x[n-n//2:])-sum(x[n-n//2-2:n-n//2])-2*sum(x[:n-n//2-2]),-2*sum(x[:n//2])+sum(x[n//2:n//2+2])+2*sum(x[n//2+2:])));else:print(-2*sum(A[:(n-2)//2])-A[(n-2)//2]+A[(n-2)//2+1]+2*sum(A[(n-2)//2+2:]))

Buggy submission (verdict: Runtime Error):
# tenkaichi c

n = int(input())
A = [int(input()) for _ in range(n)]
A.sort()

if n%2==1:
    ans1 = 2*sum(A[n//2+2:]) + sum(A[2:n//2+2]) -2*sum(A[:2])
    ans2 = 2*sum(A[n//2+1:]) - sum(A[n//2-1:n//2+1]) -2*sum(A[:n//2-1])
    print(max(ans1,ans2))
else:
    print(-2*sum(A[:(n-2)/2])-A[(n-2)/2]+A[(n-2)/2+1]+2*sum(A[(n-2)/2+2:]))
Problem p03214 (python)

Fixed submission:
N = int(input())

frames = list(map(int, input().split(" ")))

mean = sum(frames) / N

sa = 100
ind = 0
for i in range(N):
  if sa > abs(frames[i] - mean):
    sa = abs(frames[i] - mean)
    ind = i
    
print(ind)

Buggy submission (verdict: Runtime Error):
N = int(input())

mean = 0
frames = []
for i range(N):
  frames.append(int(input()))
  mean += frames[i]

mean = mean / N

sa = 100
ind = 0
for i in range(N):
  if sa > abs(frames[i] - mean):
    sa = abs(frames[i] - mean)
    ind = i
    
print(ind)

Buggy submission (verdict: Runtime Error):
N = int(input())

frames = []
for i range(N):
  frames.append(int(input()))

mean = sum(frames) / N

sa = 100
ind = 0
for i in range(N):
  if sa > abs(frames[i] - mean):
    sa = abs(frames[i] - mean)
    ind = i
    
print(ind)

Buggy submission (verdict: Runtime Error):
N = int(input())

frames = []
for i range(N):
  frames.append(int(input()))

mean = sum(frames) / N

sa = 100
for i in range(N):
  if sa > abs(frames[i] - mean):
    sa = abs(frames[i] - mean)
    ind = i
    
print(ind)
Problem p03227 (python)

Fixed submission:
c = input()
if len(c) == 2:
  print(c)
else:
  print(c[2]+c[1]+c[0])

Buggy submission (verdict: Runtime Error):
c = input()
if len(c) == 2:
  print(c)
else:
  c[0], c[2] = c[2], c[0]
  print(c)
Problem p02939 (python)

Fixed submission:
k=0
s=t=''
for c in input():
  s+=c
  if s!=t:
    k+=1
    s,t='',s
print(k)

Buggy submission (verdict: Runtime Error):
s = input()
ans = 0
cnt = 0
while(cnt < len(s)-2):
  if s[cnt] == s[cnt+1]:
    cnt += 3
    ans += 2
  else:
    cnt += 1
    ans += 1
if s[cnt] == s[cnt+1]:
  ans += 1
else:
  ans += 2
print(ans)
Problem p02960 (python)

Fixed submission:
M=10**9+7
r=[[(j-k)*9%13for j in range(10)]for k in range(13)]
d=[1]+[0]*12
for c in input():
  d = [sum(d[j]for j in k)%M for k in r] if c>'9' else [d[(int(c)-k)*9%13]for k in range(13)]
print(d[5])

Buggy submission (verdict: Runtime Error):
s = input()
n = len(s)

dp = [[0 for i in range(n)] for j in range(13)]

if s[0] == '?':
    for i in range(10):
        dp[i][0] = 1
else:
    dp[s][0] = 1

mod_change_table = [(i * 10)%13 for i in range(13)]

for x in range(1, len(s)):
    for y in range(13):
        if s[x] == '?':
            for j in range(10):
                dp[(mod_change_table[y]+j)%13][x] += dp[y][x-1]
        else:
            dp[(mod_change_table[y]+int(s[x]))%13][x] += dp[y][x-1]
            
print(dp[5][n-1])