Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
s1 = input()
s2 = input()

x, y, z = [int(i) for i in s1.split()]
l = [int(i) for i in s2.split()]
 
if x = 1:
  print(abs(z - l[x-1]))
else:
  if abs(z - l[x-1]) > abs(l[x-1] - l[x-2]):
    print(abs(z - l[x-1]))
  else:
    print(abs(l[x-1] - l[x-2]))

Fixed submission:
s1 = input()
s2 = input()

x, y, z = [int(i) for i in s1.split()]
l = [int(i) for i in s2.split()]

if x == 1:
  print(abs(z - l[x-1]))
else:
  if abs(z - l[x-1]) > abs(l[x-1] - l[x-2]):
    print(abs(z - l[x-1]))
  else:
    print(abs(l[x-1] - l[x-2]))

Buggy python submission (verdict: Runtime Error):
x, y, z = [int(i) for i in s.split()]
l = [int(i) for i in s.split()]

if x = 1:
  print(abs(z - l[x-1]))
else:
  if abs(z - l[x-1]) > abs(l[x-1] - l[x-2]):
    print(abs(z - l[x-1]))
  else:
    print(abs(l[x-1] - l[x-2]))

Fixed submission:
s1 = input()
s2 = input()

x, y, z = [int(i) for i in s1.split()]
l = [int(i) for i in s2.split()]

if x == 1:
  print(abs(z - l[x-1]))
else:
  if abs(z - l[x-1]) > abs(l[x-1] - l[x-2]):
    print(abs(z - l[x-1]))
  else:
    print(abs(l[x-1] - l[x-2]))
Buggy python submission (verdict: Runtime Error):
import numpy as np

S=input()

print(sum(np.array(list(S[int(len(S)/2)+1:]))!=np.array(list(S[:int(len(S)/2)][::-1]))))

Fixed submission:
import numpy as np

S=input()

half_a=''
half_b=''

if len(S)%2==0:
    half_a=np.array(list(S[int(len(S)/2):]))
    half_b=np.array(list(S[:int(len(S)/2)][::-1]))
    
if len(S)%2==1:
    half_a=np.array(list(S[int(len(S)/2)+1:]))
    half_b=np.array(list(S[:int(len(S)/2)][::-1]))


print(np.sum(half_a!=half_b))

Buggy python submission (verdict: Runtime Error):
import numpy as np

S=input()

print(sum(np.array(list(S[int(len(S)/2):]))!=np.array(list(S[:int(len(S)/2)][::-1]))))

Fixed submission:
import numpy as np

S=input()

half_a=''
half_b=''

if len(S)%2==0:
    half_a=np.array(list(S[int(len(S)/2):]))
    half_b=np.array(list(S[:int(len(S)/2)][::-1]))
    
if len(S)%2==1:
    half_a=np.array(list(S[int(len(S)/2)+1:]))
    half_b=np.array(list(S[:int(len(S)/2)][::-1]))


print(np.sum(half_a!=half_b))
Buggy python submission (verdict: Runtime Error):
in = list(map(int, input().split()))
s = sum(in)
if s>21:
  print('burst')
else:
  print('win')

Fixed submission:
nums = [int(e) for e in input().split()]

s = sum(nums)
if s>21:
  print('bust')
else:
  print('win')
Buggy python submission (verdict: Runtime Error):
s = input()
c = 0
n = len(s)
print(n)
if n%2 == 0:  
	for i in range(n/2):
		if s[i]!=s[-(i+1)]:
			c = c + 1
else:
    for i in range(int((n+1)/2)):
        if s[i]!=s[-(i+1)]:
            c = c + 1
print(c)

Fixed submission:
s = input()
c = 0
n = len(s)
if n%2 == 0:  
	for i in range(int(n/2)):
		if s[i]!=s[-(i+1)]:
			c = c + 1
else:
    for i in range(int((n+1)/2)):
        if s[i]!=s[-(i+1)]:
            c = c + 1
print(c)

Buggy python submission (verdict: Runtime Error):
s = input()
c = 0
n = len(s)
if n%2 == 0:  
	for i in range(n/2):
      if s[i]==s[-i]:
        c += 1
else:
  	for i in range((n-1)/2):
      if s[i]==s[-i]:
        c += 1
print(c)

Fixed submission:
s = input()
c = 0
n = len(s)
if n%2 == 0:  
	for i in range(int(n/2)):
		if s[i]!=s[-(i+1)]:
			c = c + 1
else:
    for i in range(int((n+1)/2)):
        if s[i]!=s[-(i+1)]:
            c = c + 1
print(c)
Buggy python submission (verdict: Runtime Error):
n = int(input())
S = input()

ans=[]
for i in range(len(S)):
  s = S[i]
  sind = ord('A') + (ord(s)-ord('A')+ n)%26
  ans.append(chr(sind))

print(ans)

Fixed submission:
import numpy as np
s = input()
slist = np.array(['SUN','MON','TUE','WED','THU','FRI','SAT'])
i = np.where(slist==s)[0][0]

print(7-i)

Buggy python submission (verdict: Runtime Error):
s = input()
slist = [SUN,MON,TUE,WED,THU,FRI,SAT]
i = slist[s]
  
print(7-i)

Fixed submission:
import numpy as np
s = input()
slist = np.array(['SUN','MON','TUE','WED','THU','FRI','SAT'])
i = np.where(slist==s)[0][0]

print(7-i)

Buggy python submission (verdict: Runtime Error):
s = input()
slist = [SUN,MON,TUE,WED,THU,FRI,SAT]
i = slist[s]
if i == 6:
  i = -1
  
print(slist[i+1])

Fixed submission:
import numpy as np
s = input()
slist = np.array(['SUN','MON','TUE','WED','THU','FRI','SAT'])
i = np.where(slist==s)[0][0]

print(7-i)
Buggy python submission (verdict: Runtime Error):

r = int(input())

print({0}.format(r^2))

Fixed submission:

r = int(input())

r2 = int(r**2)

print(r2)

Buggy python submission (verdict: Runtime Error):

r = input()

print(r^2)

Fixed submission:

r = int(input())

r2 = int(r**2)

print(r2)

Buggy python submission (verdict: Runtime Error):

r = input()

r^2

Fixed submission:

r = int(input())

r2 = int(r**2)

print(r2)
Buggy python submission (verdict: Runtime Error):
n,s = input().sprit()
n = int(n)
 
if n%2 == 0 :
	if s[:2/n-1] == s[2/n:]:
      print('Yes')
    else:
      print('No')
else:
	print('No')

Fixed submission:
n= int(input())
s = input()

if n%2 ==0:
    if s[:int(n/2)] == s[int(n/2):]:
        print('Yes')
    else:
        print('No')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):

n,s = input().sprit()
n = int(n)

if n%2 ==0:
	if s[:2/n-1] == s[2/n:]:
      print('Yes')
    else:
      print('No')
else:
	print('No')

Fixed submission:
n= int(input())
s = input()

if n%2 ==0:
    if s[:int(n/2)] == s[int(n/2):]:
        print('Yes')
    else:
        print('No')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
S=input()

if S=="SUN":
    x=7
elif S=="MON":
    x=6
elif S=="TUE":
    x=5
elif S=="WED":
    x=4
elif S=="THU":
    x=3
elif S=="FRI":
    x=2
elif S=="STU":
    x=1
    
print(x)

Fixed submission:
S=input()

if S=="SUN":
    x=7
elif S=="MON":
    x=6
elif S=="TUE":
    x=5
elif S=="WED":
    x=4
elif S=="THU":
    x=3
elif S=="FRI":
    x=2
elif S=="SAT":
    x=1
    
print(x)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

import math

a, b, x = map(int, input().split())

V = a**2 * b
V_2 = V / a

x_2 = x / a

if x_2 > V_2/2:
    c = 2*x/a**2 - b
    theta = math.atan(a/(b-c))
    deg = math.degrees(theta)
else:
    c = 2*x/(a*b)
    theta = math.atan(c/b)
    deg = math.degrees(theta)

print("{}".format(90.0-deg))


Fixed submission:
# -*- coding: utf-8 -*-

import math

a, b, x = map(int, input().split())

V = a**2 * b
V_2 = V / a

x_2 = x / a

if x_2 > V_2/2:
    c = 2*x/a**2 - b
    theta = math.atan2(a,(b-c))
    deg = math.degrees(theta)
else:
    c = 2*x/(a*b)
    theta = math.atan2(c,b)
    deg = math.degrees(theta)

print("{}".format(90.0-deg))

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

import math

a, b, x = map(int, input().split())

V = a**2 * b
V_2 = V / a

x_2 = x / a

if x_2 > V_2/2:
    c = 2*x/a**2 - b
    theta = math.atan(a/(b-c))
    deg = math.degrees(theta)
else:
    c = 2*x/(a*b)
    theta = math.atan(c/b)
    deg = math.degrees(theta)

print("{:.9}".format(90-deg))


Fixed submission:
# -*- coding: utf-8 -*-

import math

a, b, x = map(int, input().split())

V = a**2 * b
V_2 = V / a

x_2 = x / a

if x_2 > V_2/2:
    c = 2*x/a**2 - b
    theta = math.atan2(a,(b-c))
    deg = math.degrees(theta)
else:
    c = 2*x/(a*b)
    theta = math.atan2(c,b)
    deg = math.degrees(theta)

print("{}".format(90.0-deg))
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-

import numpy as np

N = int(input())
S = []

a_ascii = ord('a')
bins_of_char = np.zeros((N, 26),dtype=np.int)
num_of_anagram = 0

for i in range(N):
    S.append(input())

for i in range(N):
    for char in map(ord, S[i]):
        bins_of_char[i, char-a_ascii] += 1

for i in range(0, N-1):
    for j in range(i+1, N):
        if np.all(bins_of_char[i] == bins_of_char[j]):
            num_of_anagram += 1

print(num_of_anagram)

Fixed submission:
# -*- coding: utf-8 -*-

# refered to editorial

import numpy as np

N = int(input())
S = []
hash_table = {}

a_ascii = ord('a')
bins_of_char = np.zeros((N, 26),dtype=np.int)
num_of_anagram = 0

for i in range(N):
    S.append(''.join(sorted(input())))
S = sorted(S)

for i in range(N):
    if S[i] in hash_table:
        num_of_anagram += hash_table[S[i]]
        hash_table[S[i]] += 1
    else:
        hash_table[S[i]] = 1


print(num_of_anagram)

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-

import numpy as np

N = int(input())
S = []

a_ascii = ord('a')
bins_of_char = np.zeros((N, 26),dtype=np.int)
num_of_anagram = 0

for i in range(N):
    S.append(input())

for i in range(N):
    for char in S[i]:
        char_num = ord(char) - a_ascii
        bins_of_char[i, char_num] += 1

for i in range(0, N-1):
    for j in range(i+1, N):
        if np.all(bins_of_char[i] == bins_of_char[j]):
            num_of_anagram += 1

print(num_of_anagram)

Fixed submission:
# -*- coding: utf-8 -*-

# refered to editorial

import numpy as np

N = int(input())
S = []
hash_table = {}

a_ascii = ord('a')
bins_of_char = np.zeros((N, 26),dtype=np.int)
num_of_anagram = 0

for i in range(N):
    S.append(''.join(sorted(input())))
S = sorted(S)

for i in range(N):
    if S[i] in hash_table:
        num_of_anagram += hash_table[S[i]]
        hash_table[S[i]] += 1
    else:
        hash_table[S[i]] = 1


print(num_of_anagram)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

import math

N, K = map(int, input().split())
A = np.array(list(map(int, input().split())), dtype=np.int)

print(math.ceil(N-1//K-1))

Fixed submission:
# -*- coding: utf-8 -*-

import math

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

print(math.ceil((N-1)/(K-1)))

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

import numpy as np
import sys

N, K = map(int, input().split())
A = np.array(list(map(int, input().split())), dtype=np.int)

arg = 0
op_l = 0
while(True):
    arg_new = arg + K - 1
    op_l += 1
    if np.any(A[arg:arg_new+1] == 1):
        last_arg = (arg, arg_new)
        break
    arg = arg_new

if arg_new == N-1:
    print(op_l)
    sys.exit()

arg = N-1
op_r = 0
while(True):
    arg_new = arg - K + 1
    op_r += 1
    if np.any(A[arg_new:arg+1] == 1):
        if (arg_new, arg) == last_arg:
            op_r -= 1
        break
    if arg_new = last_arg[1]+1:
        break
    arg = arg_new

print(op_l+op_r)

Fixed submission:
# -*- coding: utf-8 -*-

import math

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

print(math.ceil((N-1)/(K-1)))

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-

import numpy as np
import itertools

N, K = map(int, input().split())
A = np.array(list(map(int, input().split())), dtype=np.int)

first_index = np.arange(0, N-K+1)

perm = list(itertools.permutations(first_index))

step_min = len(first_index)

for indexs in perm:
    Ac = A.copy()
    step = 0
    for i in indexs:
        Ac[i:i+K] = Ac[i:i+K].min()
        step += 1
        if np.all(Ac == 1) and step < step_min:
            step_min = step
            break
        if step > step_min:
            break
                
print(step_min)

Fixed submission:
# -*- coding: utf-8 -*-

import math

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

print(math.ceil((N-1)/(K-1)))
Buggy python submission (verdict: Runtime Error):
if int(input) >= 3200:
    print(input())
else:
    print("red")
    exit()

Fixed submission:
a = int(input())
s = input()

if a >= 3200:
    print(s)
else:
    
    print("red")
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
s = []
for _ in range(N):
    s.append(sorted(input()))

ans = 0

for i in range(N):
    for j in range(i+1, N):
        if s[i] == s[j]:
            ans += 1
print(ans)

Fixed submission:
from collections import Counter

d = Counter()
N = int(input())
ans = 0
for i in range(N):
    t = str("".join(sorted(input())))
    if t in d:
        ans += d[t]
    d[t] += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
A, B, C = map(int, input().split())

print(max(C - (A - B)), 0)

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

print(max(C - (A - B), 0))
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n, m = map(int, input().split())
c = np.array([True for _ in range(n)])
for _ in range(m):
    l, r = map(int, input().split())
    l = np.array([i for i in range(l-1)])
    r = np.array([i for i in range(r, n)])
    if len(l) != 0:
        c[l] = False
    if len(r) != 0:
        c[r] = False
print(sum(c))

Fixed submission:

n, m = map(int, input().split())
l = 1
r = n
for _ in range(m):
    a, b = map(int, input().split())
    l = max(a, l)
    r = min(b, r)
print(max(0, r - l + 1))
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
A = list(map(int, input().split()))
BC = []
for _ in range(M):
    bc = list(map(int, input().split()))
    BC.append(bc)
BC = sorted(BC, key=lambda x:x[1], reverse=True)

for b, c in BC:
    A = sorted(A)
    if A[0] >= c:
        break
    for i in range(b):
        if A[i] < c:
            A[i] = c
        else:
            break
print(sum(A))

Fixed submission:
N, M = map(int, input().split())
A = list(map(int, input().split()))
BC = []
for _ in range(M):
    bc = list(map(int, input().split()))
    BC.append(bc)
BC = sorted(BC, key=lambda x:x[1], reverse=True)
cnt = 0
for b, c in BC:
    A += [c] * b
    cnt += b
    if cnt >= N:
        break
A.sort(reverse=True)
print(sum(A[:N]))

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
A = list(map(int, input().split()))
BC = []
for _ in range(M):
    bc = list(map(int, input().split()))
    BC.append(bc)
BC = sorted(BC, key=lambda x:x[1], reverse=True)
#print(BC)
for b, c in BC:
    A = sorted(A)
    if A[0] >= c:
        break
    for i in range(b):
        if A[i] < c:
            A[i] = c
        else:
            break
print(sum(A))

Fixed submission:
N, M = map(int, input().split())
A = list(map(int, input().split()))
BC = []
for _ in range(M):
    bc = list(map(int, input().split()))
    BC.append(bc)
BC = sorted(BC, key=lambda x:x[1], reverse=True)
cnt = 0
for b, c in BC:
    A += [c] * b
    cnt += b
    if cnt >= N:
        break
A.sort(reverse=True)
print(sum(A[:N]))
Buggy python submission (verdict: Runtime Error):

l = lsit(map(int, input().split(' ')))
s = lsit(map(int, input().split(' ')))

print(int((l[1]-s[1])*(l[0]-s[0])))

Fixed submission:

l = list(map(int, input().split(' ')))
s = list(map(int, input().split(' ')))

print(int((l[1]-s[1])*(l[0]-s[0])))
Buggy python submission (verdict: Time Limit Exceeded):
S = input()

N = len(S)
l = [int(x) for x in list(str(S))]

count = 0
idx = 0
len_S = 0

while True:
    if len(l) <= 1:
        break
    if (l[idx] == 0 and l[idx+1] == 1) or (l[idx] == 1 and l[idx+1] == 0):
        l.pop(idx)
        l.pop(idx)
        count += 2
        idx = 0
        if len(set(l)) == 1:
            break
        continue
    if idx+1 == len(l)-1:
        break
    idx += 1

print(count)

Fixed submission:
S = input()

l0 = 0
l1 = 0

for i in S:
    if i == '0':
        l0 += 1
    elif i == '1':
        l1 += 1

ans = min(l0, l1) * 2

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
S = input()

N = len(S)
l = [int(x) for x in list(str(S))]

count = 0
idx = 0
len_S = 0

while True:
    if len(l) <= 1:
        break
    if (l[idx] == 0 and l[idx+1] == 1) or (l[idx] == 1 and l[idx+1] == 0):
        l.pop(idx)
        l.pop(idx)
        count += 2
        idx = 0
        continue
    if idx+1 == len(l)-1:
        break
    idx += 1

print(count)

Fixed submission:
S = input()

l0 = 0
l1 = 0

for i in S:
    if i == '0':
        l0 += 1
    elif i == '1':
        l1 += 1

ans = min(l0, l1) * 2

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
S = input()

N = len(S)
l = [int(x) for x in list(str(S))]

count = 0
idx = 0
len_S = 0

while True:
    if len(l) == 1:
        break
    if l[idx] == 0 and l[idx+1] == 1:
        l.pop(idx)
        l.pop(idx)
        count += 2
        idx = 0
        if len(l) == 0:
            break
        continue
    elif l[idx] == 1 and l[idx+1] == 0:
        l.pop(idx)
        l.pop(idx)
        count += 2
        idx = 0
        if len(l) == 0:
            break
        continue
    if idx+1 == len(l)-1:
        break
    idx += 1

print(count)

Fixed submission:
S = input()

l0 = 0
l1 = 0

for i in S:
    if i == '0':
        l0 += 1
    elif i == '1':
        l1 += 1

ans = min(l0, l1) * 2

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
h = list(map(int, input().split()))
c = [0] * N
for i in range(1, N):
    temp = []
    for j in range(1,K+1):
        if (i - j) == -1:
            break
        else:
            temp.append(c[i-j]+abs(h[i]-h[i-j]))
    c[i] = min(temp)
    #print(c, temp)
print(c[-1])

Fixed submission:
N, K = map(int, input().split())
h = list(map(int, input().split()))
c = [0] * N
for i in range(1, N):
    temp = []
    for j in range(1,K+1):
        if (i - j) == -1:
            break
        else:
            temp.append(c[i-j]+abs(h[i]-h[i-j]))
    c[i] = min(temp)
    #print(c, temp)
print(c[-1])
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
a = list(map(int, input().split()))

# 部分和の作成
l = []
for i in range(n):
    t=0
    for j in range(i, n):
        t += a[j]
        l.append(t)
ans = 0
for i in range(40, -1, -1):
    x = 2 ** i
    s = []
    for ll in l:
        if (ans + x) & ll == (ans + x):
            s.append(ll)
    if len(s) >= k:
        ans += x
print(ans)



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

# 部分和の作成
l = []
for i in range(n):
    t=0
    for j in range(i, n):
        t += a[j]
        l.append(t)
ans = 0
for i in range(40, -1, -1):
    x = 2 ** i
    s = []
    for ll in l:
        if (ans + x) & ll == (ans + x):
            s.append(ll)
    if len(s) >= k:
        ans += x
print(ans)

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

# 部分和の作成
l = []
for i in range(n):
    t=0
    for j in range(i, n):
        t += a[j]
        l.append(t)
ans = 0
for i in range(40, -1, -1):
    x = 2 ** i
    s = []
    for ll in l:
        if (ans + x) & ll == (ans + x):
            s.append(ll)
    if len(s) >= k:
        ans += x
print(ans)



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

# 部分和の作成
l = []
for i in range(n):
    t=0
    for j in range(i, n):
        t += a[j]
        l.append(t)
ans = 0
for i in range(40, -1, -1):
    x = 2 ** i
    s = []
    for ll in l:
        if (ans + x) & ll == (ans + x):
            s.append(ll)
    if len(s) >= k:
        ans += x
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

A = [int(x) for x in input().split(' ')]
N = A[0]
M = A[1]
PY = []
for i in range(M):
    PY.append(input().split(' '))

PY = np.array(PY).astype(int)
P = [int(PY[i][0]) for i in range(M)]
#Y = [int(PY[i][1]) for i in range(M)]
P_list = set(P)

for x in P_list:
    Y = set(PY[(PY[:,0]==x),1])
    Y = sorted(Y)
    for i in range(len(Y)):
        PY[(PY[:,1]==Y[i]),1] = i+1

for i in range(M):
    print('%06d'%PY[i][0], end='')
    print('%06d'%PY[i][1])

Fixed submission:
N, M = map(int, input().split())
D = [[] for i in range(N)]

for i in range(M):
    P, Y = map(int, input().split())
    D[P-1].append((Y,i))

ans = [None] * M

for i, d in enumerate(D):
    d.sort()
    for k, (y, j) in enumerate(d):
        ans[j] = str(i+1).zfill(6) + str(k+1).zfill(6)
print(*ans, sep='\n')
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = [int(input()) for _ in range(N)]
A.sort()
ans=0
if N % 2 == 0:
    ans = 2 * (sum(A[N // 2 + 1:]) - sum(A[:N // 2 - 1])) + A[N // 2] - A[N // 2 - 1]
else:
    x = 2 * (sum(A[N // 2 + 1:]) - sum(A[:N // 2 - 1])) - A[N // 2] - A[N // 2 - 1]
    y = 2 * (sum(A[N // 2 + 2:]) - sum(A[:N // 2])) + A[N // 2] + A[N // 2 + 1]
    ans = max(x, y)
print(ans)

Fixed submission:
s = input()
ans = []
if len(s) == 2:
    print(s)
elif len(s) == 3:
    for i in range(len(s)):
        ans.append(s[2-i])
    ans_ = map(str, ans)
    print("".join(ans_))

Buggy python submission (verdict: Runtime Error):
import numpy as np
import pandas as pd

N = int(input())
A = [int(input()) for _ in range(N)]
A.sort()
ans=0
if N % 2 == 0:
    ans = 2 * (sum(A[N // 2 + 1:]) - sum(A[:N // 2 - 1])) + A[N // 2] - A[N // 2 - 1]
else:
    x = 2 * (sum(A[N // 2 + 1:]) - sum(A[:N // 2 - 1])) - A[N // 2] - A[N // 2 - 1]
    y = 2 * (sum(A[N // 2 + 2:]) - sum(A[:N // 2])) + A[N // 2] + A[N // 2 + 1]
    ans = max(x, y)
print(ans)

Fixed submission:
s = input()
ans = []
if len(s) == 2:
    print(s)
elif len(s) == 3:
    for i in range(len(s)):
        ans.append(s[2-i])
    ans_ = map(str, ans)
    print("".join(ans_))
Buggy python submission (verdict: Runtime Error):
import numpy as np
import pandas as pd

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

if N % 2 == 0:
    ans = 2 * (sum(A[N // 2 + 1:]) - sum(A[:N // 2 - 1])) + A[N // 2] - A[N // 2 - 1]
else:
    x = 2 * (sum(A[N // 2 + 1:]) - sum(A[:N // 2 - 1])) - A[N // 2] - A[N // 2 - 1]
    y = 2 * (sum(A[N // 2 + 2:]) - sum(A[:N // 2])) + A[N // 2] + A[N // 2 + 1]
    ans = max(x, y)
print(ans)

Fixed submission:
N = int(input())
A = [int(input()) for _ in range(N)]
A.sort()
ans=0
if N % 2 == 0:
    ans = 2 * (sum(A[N // 2 + 1:]) - sum(A[:N // 2 - 1])) + A[N // 2] - A[N // 2 - 1]
else:
    x = 2 * (sum(A[N // 2 + 1:]) - sum(A[:N // 2 - 1])) - A[N // 2] - A[N // 2 - 1]
    y = 2 * (sum(A[N // 2 + 2:]) - sum(A[:N // 2])) + A[N // 2] + A[N // 2 + 1]
    ans = max(x, y)
print(ans)
Buggy python submission (verdict: Runtime Error):
from math import gcd
N, X = map(int, input().split())
x = list(map(int, input().split()))
l = []
for xx in x:
    l.append(abs(xx - X))

g = l[0]

for i in range(1, len(l)):
    g = gcd(g, l[i])

print(g)

Fixed submission:
from fractions import gcd
N, X = map(int, input().split())
x = list(map(int, input().split()))
l = []
for xx in x:
    l.append(abs(xx - X))

g = l[0]

for i in range(1, len(l)):
    g = gcd(g, l[i])

print(g)
Buggy python submission (verdict: Runtime Error):
X = int(input())
b = []

for i in range(2, 32):
    p = 2
    while i ** p <= X:
        b.append(i ** p)
        p += 1

print(max(b))

Fixed submission:

X = int(input())
b = [1]

for i in range(2, 32):
    p = 2
    while i ** p <= X:
        b.append(i ** p)
        p += 1

print(max(b))

Buggy python submission (verdict: Runtime Error):
X = int(input())
b = []

for i in range(2, 32):
    p = 2
    while i ** p <= X:
        b.append(i ** p)
        p += 1

print(max(b))

Fixed submission:

X = int(input())
b = [1]

for i in range(2, 32):
    p = 2
    while i ** p <= X:
        b.append(i ** p)
        p += 1

print(max(b))

Buggy python submission (verdict: Runtime Error):

X = int(input())
b = []

for i in range(2, 32):
    p = 2
    while i ** p <= X:
        b.append(i ** p)
        p += 1

print(max(b))

Fixed submission:

X = int(input())
b = [1]

for i in range(2, 32):
    p = 2
    while i ** p <= X:
        b.append(i ** p)
        p += 1

print(max(b))
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
K = int(input())

ans = set()
for i in range(len(s)):
    for j in range(i+1, len(s)+1):
        ans.add(s[i:j])
ans = sorted(ans)
print(ans[K-1])

Fixed submission:
s = input()
K = int(input())

ans = set()
for i in range(len(s)):
    for j in range(K):
        ans.add(s[i:i+1+j])
ans = sorted(ans)
print(ans[K-1])
Buggy python submission (verdict: Runtime Error):
N = int(input())
s = []
for _ in range(N):
    s.append(input())
M = int(input())
t = []
for _ in range(M):
    t.append(input())
ans = []
for ss in set(s):
    ans.append(s.count(ss) - t.count(ss))
p = ans if ans > 0 else 0
print(p)

Fixed submission:
N = int(input())
s = []
for _ in range(N):
    s.append(input())
M = int(input())
t = []
for _ in range(M):
    t.append(input())
ans = []
for ss in set(s):
    ans.append(s.count(ss) - t.count(ss))
p = max(ans) if max(ans) > 0 else 0
print(p)