Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())

K = [list(map(int, input().split())) for row in range(N)]
if N = 1:
	print(K[0][0])
else:
	for i in range(N):
		K[i].pop(K[i][0])

	foods = set(K[0])
	i = 0
	while i < N:
		foods = foods.intersection(set(K[i]))
		if foods == set():
			break
		
		else:
			i += 1
	print(len(list(foods)))





Fixed submission:
N, M = map(int, input().split())

K = [list(map(int, input().split())) for row in range(N)]
if N == 1:
	print(K[0][0])
else:
	for i in range(N):
		K[i].remove(K[i][0])

	foods = set(K[0])
	i = 0
	while i < N:
		foods = foods.intersection(set(K[i]))
		if foods == {}:
			
			break
			exit()
		i += 1
	print(len(list(foods)))

Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())

K = [list(map(int, input().split())) for row in range(N)]
if N = 1:
	print(K[0][0])
else:
	for i in range(N):
		K[i].pop(K[i][0])

	foods = set(K[0])
	i = 0
	while i < N:
		foods = foods.intersection(set(K[i]))
		if foods == set():
			break
		
		else:
			i += 1
	print(len(list(foods)))





Fixed submission:
N, M = map(int, input().split())

K = [list(map(int, input().split())) for row in range(N)]
if N == 1:
	print(K[0][0])
else:
	for i in range(N):
		K[i].remove(K[i][0])

	foods = set(K[0])
	i = 0
	while i < N:
		foods = foods.intersection(set(K[i]))
		if foods == {}:
			
			break
			exit()
		i += 1
	print(len(list(foods)))

Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())

K = [list(map(int, input().split())) for row in range(N)]
if N = 1:
	print(K[0][0])
else:
	for i in range(N):
		K[i].pop(K[i][0])

	foods = set(K[0])
	i = 0
	while i < N:
		foods = foods.intersection(set(K[i]))
		if foods == set():
			break
		
		else:
			i += 1
	print(len(list(foods)))





Fixed submission:
N, M = map(int, input().split())

K = [list(map(int, input().split())) for row in range(N)]
if N == 1:
	print(K[0][0])
else:
	for i in range(N):
		K[i].remove(K[i][0])

	foods = set(K[0])
	i = 0
	while i < N:
		foods = foods.intersection(set(K[i]))
		if foods == {}:
			
			break
			exit()
		i += 1
	print(len(list(foods)))
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
print(max(a+b, a-b a*b))

Fixed submission:
a,b=map(int,input().split())
print(max(a+b,a-b,a*b))
Buggy python submission (verdict: Time Limit Exceeded):
a, b = map(int, input().split())
for k in range(10**9):
  if (a+k) == (b+k):
    print(k)
    exit()
print("IMPOSSIBLE")

Fixed submission:
a, b = map(int, input().split())
if (a+b)%2 != 0:
  print("IMPOSSIBLE")
else:
  print((a+b)//2)
Buggy python submission (verdict: Runtime Error):
N = int(input())
a = [int(input()) for i in range(N)]
a.sort(reverse=True)
amax = a[0]
for i in range(len(a)):
  if a[i]==amax:
    print(a[i+1])
  else:
    print(amax)

Fixed submission:
N = int(input())
a = [int(input()) for i in range(N)]
amax = max(a)
amax2 = sorted(a)[-2]
for i in range(len(a)):
  if a[i]==amax:
    print(amax2)
  else:
    print(amax)

Buggy python submission (verdict: Runtime Error):
N = int(input())
a = set8int(input()) for i in range(N))
for i in range(len(list(a))):
  b = a.copy()
  del b[i]
  print((max(b)))

Fixed submission:
N = int(input())
a = [int(input()) for i in range(N)]
amax = max(a)
amax2 = sorted(a)[-2]
for i in range(len(a)):
  if a[i]==amax:
    print(amax2)
  else:
    print(amax)

Buggy python submission (verdict: Runtime Error):
N = int(input())
a = [int(input()) for i in range(N)]
for i in range(len(a)):
  b = a.copy()
  del b[i]
  print((max(b)))

Fixed submission:
N = int(input())
a = [int(input()) for i in range(N)]
amax = max(a)
amax2 = sorted(a)[-2]
for i in range(len(a)):
  if a[i]==amax:
    print(amax2)
  else:
    print(amax)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = [int(input()) for i in range(N)]
for i in range(len(a)):
  b = a.copy()
  del b[i]
  print((max(b)))

Fixed submission:
N = int(input())
a = [int(input()) for i in range(N)]
amax = max(a)
amax2 = sorted(a)[-2]
for i in range(len(a)):
  if a[i]==amax:
    print(amax2)
  else:
    print(amax)
Buggy python submission (verdict: Runtime Error):
import numpy as np
n,a,b=map(int, input().split())
print([n*a, n*b].min())

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

Buggy python submission (verdict: Runtime Error):
n,a,b = list(map(int, input().split()))
d = n*a
t = n*b
print(int(np.min([d, t])))

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

Buggy python submission (verdict: Runtime Error):
n,a,b = list(map(int, input().split()))
d = n*a
t = n*b
print(np.min([d, t]))

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

Buggy python submission (verdict: Runtime Error):
n,a,b = list(map(int, input().split()))
taxi = n*a
densya = n*b
print(np.min([taxi, densya]))

Fixed submission:
n,a,b=map(int, input().split())
print(min(n*a, b))
Buggy python submission (verdict: Runtime Error):
S = list(input())
result = []
if len(set(S))==2:
  for s in S:
    result.append(S.count(s))
    if result[0]==result[1]:
      print("Yes")
    else:
      print("No")
else:
  print("No")

Fixed submission:
S = list(input())
result = []
if len(set(S))==2:
  for s in list(set(S)):
    result.append(S.count(s))
  if result[0]==result[1]:
    print("Yes")
  else:
    print("No")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
S = list(input())
result = []
if len(set(S))==2:
  for s in S:
    result.append(S.count(s))
    if result[0]==result[1]:
      print("Yes")
      exit()
print("No")

Fixed submission:
S = list(input())
result = []
if len(set(S))==2:
  for s in list(set(S)):
    result.append(S.count(s))
  if result[0]==result[1]:
    print("Yes")
  else:
    print("No")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
S = list(input())
result = []
if len(set(S))==2:
  for s in S:
    result.append(S.count(s))
    if (result[0]==result[1]) == 2:
      print("Yes")
  

Fixed submission:
S = list(input())
result = []
if len(set(S))==2:
  for s in list(set(S)):
    result.append(S.count(s))
  if result[0]==result[1]:
    print("Yes")
  else:
    print("No")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
S = list(map(int, input().rstrip()))
for i in range(4):
  if S[i]==S[i+1]:
    print("Bad")
    exit()
print("Good")

Fixed submission:
S = list(map(int, input().rstrip()))
for i in range(3):
  if S[i]==S[i+1]:
    print("Bad")
    exit()
print("Good")

Buggy python submission (verdict: Runtime Error):
S = list(map(int, input().rstrip()))
for i in range(4):
  if S[i]==S[i+1]:
    print("Bad")
    exit()
print("Yes")

Fixed submission:
S = list(map(int, input().rstrip()))
for i in range(3):
  if S[i]==S[i+1]:
    print("Bad")
    exit()
print("Good")

Buggy python submission (verdict: Runtime Error):
S = list(input().split())
for i in range(4):
  if S[i]==S[i+1]:
    print("Bad")
    exit()
print("Good")


Fixed submission:
S = list(map(int, input().rstrip()))
for i in range(3):
  if S[i]==S[i+1]:
    print("Bad")
    exit()
print("Good")
Buggy python submission (verdict: Runtime Error):
N = int(input())
mydict = []
for i in range(1, N+1):
  a, b=input().split()
  mydict.append([str(a), int(b), i])
mydict = sorted(mydict, key=lambda x:(x[0][1]))
for i in mydict:
  print(i[2])


Fixed submission:
N = int(input())
mydict = []
for i in range(1, N+1):
  a, b=input().split()
  mydict.append([str(a), int(b), i])
mydict = sorted(mydict, key=lambda x:x[1], reverse=True)
mydict = sorted(mydict, key=lambda x:x[0])
for i in mydict:
  print(i[2])

Buggy python submission (verdict: Runtime Error):
N = int(input())
mydict = []
for i in range(N):
  a, b=input().split()
  mydict.append([str(a), int(b)])
mydict.sort()
fot i in range(N):
  print(mydict[i][1])

Fixed submission:
N = int(input())
mydict = []
for i in range(1, N+1):
  a, b=input().split()
  mydict.append([str(a), int(b), i])
mydict = sorted(mydict, key=lambda x:x[1], reverse=True)
mydict = sorted(mydict, key=lambda x:x[0])
for i in mydict:
  print(i[2])

Buggy python submission (verdict: Runtime Error):
N = int(input())
mydict = []
for i in range(N):
  a, b=input().split()
  mydict.append([str(a), int(b)])
mydict.sort()
print(mydict[0], mydict[1])

Fixed submission:
N = int(input())
mydict = []
for i in range(1, N+1):
  a, b=input().split()
  mydict.append([str(a), int(b), i])
mydict = sorted(mydict, key=lambda x:x[1], reverse=True)
mydict = sorted(mydict, key=lambda x:x[0])
for i in mydict:
  print(i[2])
Buggy python submission (verdict: Runtime Error):
import numpy as np
N = input()
kuku_array = np.zeros((9, 9))
for i in range(9):
  for j in range(9):
    kuku_array[i][j] = i*j
if np.any(kuku_array = N) == True:
  print('Yes')
else:
  print('No')

Fixed submission:
import numpy as np
N = int(input())
kuku_array = np.zeros((9, 9))
for i in range(1,10):
  for j in range(i,10):
    kuku_array[i-1][j-1] = i*j
if np.any(kuku_array == N) == True:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
N = int(input())
d = map(int, input().split())
more = N - 1
total = 0
for i in range(N):
  for j in range(more):
    try:
      total +=  int(d[i]) * int(d[i + j + 1])
    except IndexError:
      break
  more -= 1
print(total)

Fixed submission:
N = int(input())
d = list(map(int, input().split()))
more = N - 1
total = 0
for i in range(N):
  for j in range(more):
    try:
      total +=  int(d[i]) * int(d[i + j + 1])
    except IndexError:
      break
  more -= 1
print(total)

Buggy python submission (verdict: Runtime Error):
N = int(input())
d = map(int, input().split())
more = N - 1
total = 0
for i in range(N):
  for j in range(more):
    try:
      total +=  int(d[i]) * int(d[i + j + 1])
    except IndexError:
      break
  more -= 1
print(total)

Fixed submission:
N = int(input())
d = list(map(int, input().split()))
more = N - 1
total = 0
for i in range(N):
  for j in range(more):
    try:
      total +=  int(d[i]) * int(d[i + j + 1])
    except IndexError:
      break
  more -= 1
print(total)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
junb = []
inde = 0
basyo = 0
for touko in A:
    basyo = A.index(str(inde))
    junb.append.basyo
    inde += 1
print(str.junb)

Fixed submission:
N = int(input())
kisuu = -(-N // 2)
print(kisuu / N)

Buggy python submission (verdict: Runtime Error):
N = input()
kisuu = -(-N // 2)
print(kisuu / N)

Fixed submission:
N = int(input())
kisuu = -(-N // 2)
print(kisuu / N)

Buggy python submission (verdict: Runtime Error):
N = input(int())
kisuu = -(-N // 2)
print(kisuu / N)

Fixed submission:
N = int(input())
kisuu = -(-N // 2)
print(kisuu / N)
Buggy python submission (verdict: Runtime Error):
N, X = map(int, input().split())
L = list(map(int, input().split()))
D = 0
count = 1
for i in L
  D += i
  if X < D:
    break
  count += 1
print(count)

Fixed submission:
N, X = map(int, input().split())
L = list(map(int, input().split()))
D = 0
count = 1
for i in L:
  D += i
  if X < D:
    break
  count += 1
print(count)

Buggy python submission (verdict: Runtime Error):
N, X = map(int, input().split())
L = list(map(int, input().split()))
D = 0
count = 1
for i in L
  D = D + i
  if X < D:
    break
  count += 1
print(count)

Fixed submission:
N, X = map(int, input().split())
L = list(map(int, input().split()))
D = 0
count = 1
for i in L:
  D += i
  if X < D:
    break
  count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
N = int(input())
W = int,input().split()
list = []
for n in range(N):
  a = 1
  b = n + 1
  Down = 0
  Up = 0
  while a <= n:
    Down += W[a - 1]
    a += 1
  while b <= N:
    Up += W[b - 1]
    b += 1
  list.append(abs(Down - Up))
list.sort()
print(list[0])

Fixed submission:
N = int(input())
W = list(map(int,input().split()))
list = []
for n in range(N):
  a = 1
  b = n + 1
  Down = 0
  Up = 0
  while a <= n:
    Down += W[a - 1]
    a += 1
  while b <= N:
    Up += W[b - 1]
    b += 1
  list.append(abs(Down - Up))
list.sort()
print(list[0])

Buggy python submission (verdict: Runtime Error):
N = int(input())
W = map(int,input().split())
list = []
for n in range(N):
  a = 1
  b = n + 1
  Down = 0
  Up = 0
  while a <= n:
    Down += W[a - 1]
    a += 1
  while b <= N:
    Up += W[b - 1]
    b += 1
  list.append(abs(Down - Up))
list.sort()
print(list[0])

Fixed submission:
N = int(input())
W = list(map(int,input().split()))
list = []
for n in range(N):
  a = 1
  b = n + 1
  Down = 0
  Up = 0
  while a <= n:
    Down += W[a - 1]
    a += 1
  while b <= N:
    Up += W[b - 1]
    b += 1
  list.append(abs(Down - Up))
list.sort()
print(list[0])
Buggy python submission (verdict: Runtime Error):
import math

n = int(input())
tmp_list = []

for i in range(1, int(math.sqrt(n)), 1):
    if(n%i==0):
        tmp_list.append(i)

i = tmp_list[len(tmp_list)-1]
j = n//i

print(i+j-2)

Fixed submission:
import math

n = int(input())
tmp_list = []

for i in range(1, int(math.sqrt(n))+1, 1):
    if(n%i==0):
        tmp_list.append(i)

i = tmp_list[len(tmp_list)-1]
j = n//i

print(i+j-2)
Buggy python submission (verdict: Time Limit Exceeded):
num, point, ques = list(map(int, input().split(" ")))
ans_list = []
point_list = []

for i in range(ques):
    ans_list.append(int(input()))

for i in range(num):
    point_list.append(point)

for ans in ans_list:
    point_list[ans-1]+=1
    for i in range(num):
        point_list[i] -= 1

for i in range(num):
    if(point_list[i]<=0):
        print("No")
    else:
        print("Yes")

Fixed submission:
num, point, ques = list(map(int, input().split(" ")))
ans_list = []
point_list = []

for i in range(num):
    point_list.append(point)

for i in range(ques):
    point_list[int(input())-1]+=1

for i in range(num):
    if(point_list[i]-ques<=0):
        print("No")
    else:
        print("Yes")
Buggy python submission (verdict: Runtime Error):
N = int(input())
 
P = list(range(2, N+1)) + [1]
I = range(1, N+1)
 
total = 0
for i in range(1, N+1):
    p = (i + 1) if i < N else 1
    total += i % p
print(total)    


Fixed submission:
N = int(input())

if N == 0:
    print(1)
else:
    print(int(N * (N - 1) // 2))

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

print(sum(range(N))


Fixed submission:
N = int(input())

if N == 0:
    print(1)
else:
    print(int(N * (N - 1) // 2))

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

print(sum(range(N))


Fixed submission:
N = int(input())

if N == 0:
    print(1)
else:
    print(int(N * (N - 1) // 2))

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

P = list(range(2, N+1)) + [1]
I = range(1, N+1)

print(sum((i % p) for p, i in zip(P, I)))

Fixed submission:
N = int(input())

if N == 0:
    print(1)
else:
    print(int(N * (N - 1) // 2))
Buggy python submission (verdict: Runtime Error):
W, H, x, y = map(int, input().split())

if x in [0, W] and y in [0, H]:
    S = 0
    print(0, 1)
    exit()

if (x == W / 2 and y == H / 2):
    S = W * H / 2
    print(S, 1)
    exit()

if x in [0, W]:
    S = W * min(y, H - y)
    print(S, 0)
    exit()

if y in [0, H]:
    S = min(x, W - x) * H
    print(S, 0)
    exit()

X1 = x
X2 = (W - x)
Y1 = y
Y2 = (H - y)

X = min(X1, X2)
Y = min(Y1, Y2)

if X * H == W * Y:
    multi = 1

S = max(X * H, W * Y)

print(S, multi)


Fixed submission:
W, H, x, y = map(int, input().split())

S = W * H / 2
multi = 2 * x == W and 2 * y == H

print(S, int(multi))

Buggy python submission (verdict: Runtime Error):
W, H, x, y = map(int, input().split())

# print(W, H, x, y)

multi = 0

# print(x / W, y / H)

if x / W == y / H:
    multi = 1
elif x / W <= y / H:
    S = x * H
elif x / W >= y / H:
    S = W * y

print(S, multi)


Fixed submission:
W, H, x, y = map(int, input().split())

S = W * H / 2
multi = 2 * x == W and 2 * y == H

print(S, int(multi))
Buggy python submission (verdict: Runtime Error):
def read_line(*types): return [f(a) for a, f in zip(input().split(), types)]

s, = read_line(str)

s = [int(c) for c in s]

c = 0

def fb(s, i):
    for i in reversed(range(0, i + 1)):
        if s[i] >= 0:
            return i
    return None

def ff(s, i):
    for i in range(i + 1, len(s)):
        if s[i] >= 0:
            return i
    return None

for i in range(len(s) - 1):
    j = 0
    while True:
        pos = fb(s, i - j), ff(s, i - j)
        if pos[0] is None:
            break

        if s[pos[0]] != s[pos[1]]:
            s[pos[0]] = s[pos[1]] = -1
            j += 1
            c += 2
        else:
            break

print(c)


Fixed submission:
def read_line(*types): return [f(a) for a, f in zip(input().split(), types)]

s, = read_line(str)

s = [int(c) for c in s]

c = 0

ss = 0

for i in range(0, len(s)):
    if s[i] == 1:
        if ss < 0:
            c += 2
        ss += 1
    else:
        if ss > 0:
            c += 2
        ss -= 1
print(c)

Buggy python submission (verdict: Time Limit Exceeded):
def read_line(*types): return [f(a) for a, f in zip(input().split(), types)]

s, = read_line(str)

s = [int(c) for c in s]

c = 0
while True:
    i = 0
    while i < len(s) - 1:
        if s[i] != s[i + 1]:
            s[i] = s[i + 1] = -1
            i += 2
            c += 2
        i += 1
    s = [c for c in s if c >= 0]
    l = len([c for c in s if c == 0])
    if l == 0 or l == len(s):
        break

print(c)


Fixed submission:
def read_line(*types): return [f(a) for a, f in zip(input().split(), types)]

s, = read_line(str)

s = [int(c) for c in s]

c = 0

ss = 0

for i in range(0, len(s)):
    if s[i] == 1:
        if ss < 0:
            c += 2
        ss += 1
    else:
        if ss > 0:
            c += 2
        ss -= 1
print(c)
Buggy python submission (verdict: Runtime Error):
N = int(input())

xyh = []
for _ in range(N):
    x, y, h = map(int, input().split())
    xyh.append((x, y, h))

# print(xyh)

# h = max(H - |x - Cx| - |y - Cy|, 0)

'''
  0 1 2 3
0
1     5
2   5   5
3     5

   99 100
0 192
1 191 192
'''


def f():
    for tx in range(101):
        for ty in range(101):
            th = xyh[0][2] + abs(xyh[0][0] - tx) + abs(xyh[0][1] - ty)
            if all(h == max(th - abs(tx - x) - abs(ty - y), 0) for x, y, h in xyh):
                return tx, ty, th
print(*f())


Fixed submission:
N = int(input())

xyh = []
for _ in range(N):
    x, y, h = map(int, input().split())
    if h != 0:
        xx, yy, hh = x, y, h
    xyh.append((x, y, h))

# print(xyh)

# h = max(H - |x - Cx| - |y - Cy|, 0)

'''
  0 1 2 3
0
1     5
2   5   5
3     5

   99 100
0 192
1 191 192
'''


def f():
    for tx in range(101):
        for ty in range(101):
            th = hh + abs(xx - tx) + abs(yy - ty)
            if all(h == max(th - abs(tx - x) - abs(ty - y), 0) for x, y, h in xyh):
                return tx, ty, th

print(*f())
Buggy python submission (verdict: Runtime Error):
import math

def read_line(*types): return [f(a) for a, f in zip(input().split(), types)]

n, = read_line(int)

A = [int(x) for x in input().split()]

AA = [a - (i + 1) for i, a in enumerate(A)]

AA.sort()

if len(AA) % 2 == 0:
    b = int(len(AA) / 2 - 1)
else:
    b = int((len(AA) - 1) / 2)

sadness = 0
for i, a in enumerate(A):
    # sadness1 += abs(a - (i + b1 + 1))
    # sadness2 += abs(a - (i + b2 + 1))
    sadness += abs(a - (i + AA[b] + 1))

print(sadness)


Fixed submission:
def read_line(*types): return [f(a) for a, f in zip(input().split(), types)]

n, = read_line(int)

if n % 2 == 0:
    print(n)
else:
    print(n * 2)
Buggy python submission (verdict: Time Limit Exceeded):
def read_line(*types): return [f(a) for a, f in zip(input().split(), types)]

n, = read_line(int)

A = [int(x) for x in input().split()]

AA = [a - (i + 1) for i, a in enumerate(A)]

min_sadness = float('inf')
b = None
for i in range(min(AA), max(AA) + 1):
    sadness = 0
    for a in AA:
        sadness += abs(a - i)

    if min_sadness > sadness:
        min_sadness = sadness
        b = i

print(min_sadness)


Fixed submission:
import math

def read_line(*types): return [f(a) for a, f in zip(input().split(), types)]

n, = read_line(int)

A = [int(x) for x in input().split()]

AA = [a - (i + 1) for i, a in enumerate(A)]

AA.sort()

if len(AA) % 2 == 0:
    b = int(len(AA) / 2 - 1)
else:
    b = int((len(AA) - 1) / 2)

sadness = 0
for i, a in enumerate(A):
    # sadness1 += abs(a - (i + b1 + 1))
    # sadness2 += abs(a - (i + b2 + 1))
    sadness += abs(a - (i + AA[b] + 1))

print(sadness)
Buggy python submission (verdict: Time Limit Exceeded):
input()

a = list(map(int, input().split()))

count = 0
flag = True
while flag:
    flag = False
    for i, aa in enumerate(a):
        if aa % 2 == 0:
            a[i] = int(a[i] / 2)
            flag = True
            break
    if flag:
        count += 1
print(count)


Fixed submission:
input()

a = list(map(int, input().split()))

count = 0
for i, aa in enumerate(a):
    while aa % 2 == 0:
        aa = int(aa / 2)
        count += 1
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
def read_line(*types): return [f(a) for a, f in zip(input().split(), types)]

n, = read_line(int)
a = read_line(*([int] * n))

def price(aa, skip):
    sum = 0

    prev = 0
    for i in range(len(aa)):
        if i == skip:
            continue
        sum += abs(prev - aa[i])
        prev = aa[i]

    sum += abs(prev)
    return sum

for i in range(len(a)):
    print(price(a, i))


Fixed submission:
#!/usr/bin/env python

def read_line(*types): return [f(a) for a, f in zip(input().split(), types)]

n, = read_line(int)
a = read_line(*([int] * n))

def price(aa):
    sum = 0

    prev = 0
    for i in range(len(aa)):
        sum += abs(prev - aa[i])
        prev = aa[i]

    sum += abs(prev)
    return sum

aa = [0] + a + [0]
price_all = 0

for i in range(len(aa) - 1):
    price_all += abs(aa[i] - aa[i + 1])

for i in range(1, len(aa) - 1):
    p = price_all
    p -= abs(aa[i - 1] - aa[i])
    p -= abs(aa[i] - aa[i + 1])
    p += abs(aa[i - 1] - aa[i + 1])
    print(p)

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python

from copy import deepcopy

def read_line(*types): return [f(a) for a, f in zip(input().split(), types)]

n, = read_line(int)
a = read_line(*([int] * n))

def price(aa, skip):
    sum = 0

    prev = 0
    for i in range(len(aa)):
        if i == skip:
            continue
        sum += abs(prev - aa[i])
        prev = aa[i]

    sum += abs(prev)
    return sum

for i in range(len(a)):
    print(price(a, i))


Fixed submission:
#!/usr/bin/env python

def read_line(*types): return [f(a) for a, f in zip(input().split(), types)]

n, = read_line(int)
a = read_line(*([int] * n))

def price(aa):
    sum = 0

    prev = 0
    for i in range(len(aa)):
        sum += abs(prev - aa[i])
        prev = aa[i]

    sum += abs(prev)
    return sum

aa = [0] + a + [0]
price_all = 0

for i in range(len(aa) - 1):
    price_all += abs(aa[i] - aa[i + 1])

for i in range(1, len(aa) - 1):
    p = price_all
    p -= abs(aa[i - 1] - aa[i])
    p -= abs(aa[i] - aa[i + 1])
    p += abs(aa[i - 1] - aa[i + 1])
    print(p)

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python

from copy import deepcopy

def read_line(*types): return [f(a) for a, f in zip(input().split(), types)]

n, = read_line(int)
a = read_line(*([int] * n))

def price(aa):
    sum = 0
    for j in range(len(aa) - 1):
        sum += abs(aa[j] - aa[j + 1])

    return sum

for i in range(len(a)):
    aa = deepcopy(a)

    del aa[i]

    aa = [0] + aa + [0]

    print(price(aa))


Fixed submission:
#!/usr/bin/env python

def read_line(*types): return [f(a) for a, f in zip(input().split(), types)]

n, = read_line(int)
a = read_line(*([int] * n))

def price(aa):
    sum = 0

    prev = 0
    for i in range(len(aa)):
        sum += abs(prev - aa[i])
        prev = aa[i]

    sum += abs(prev)
    return sum

aa = [0] + a + [0]
price_all = 0

for i in range(len(aa) - 1):
    price_all += abs(aa[i] - aa[i + 1])

for i in range(1, len(aa) - 1):
    p = price_all
    p -= abs(aa[i - 1] - aa[i])
    p -= abs(aa[i] - aa[i + 1])
    p += abs(aa[i - 1] - aa[i + 1])
    print(p)