Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
s = input()
print(s[0] + (len(s) - 2) + s[-1])

Fixed submission:
s = input()
print(s[0] + str((len(s) - 2)) + s[-1])
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(_m)]
cands = set(b if a == 1 else a for a, b in AB if a == 1 or b == 1)
if any(a in cands and b == n or b in cands and a == n for a, b in AB):
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

Fixed submission:
from collections import deque

def solve(n, m, AB):
    g = [[] for _ in range(n)]
    for a, b in AB:
        g[a - 1].append(b - 1)
        g[b - 1].append(a - 1)

    q = deque(maxlen = n)
    q.append((0, 0))
    used = {0}
    while len(q) > 0:
        i, d = q.popleft()
        if d >= 2:
            break
        for c in g[i]:
            if c in used:
                continue
            if d == 1 and c == n - 1:
                return 'POSSIBLE'
            q.append((c, d + 1))
            used.add(c)
    return 'IMPOSSIBLE'

_n, _m = map(int, input().split())
_AB = [map(int, input().split()) for _ in range(_m)]
print(solve(_n, _m, _AB))
Buggy python submission (verdict: Runtime Error):
def gcd(a, b):
  if a > b:
    a, b = b, a
  while a % b != 0:
    a, b = b, a % b
  return b

n, k = map(int, input().split())
A = list(map(int, input().split()))

l = A.pop()
for a in A:
  l = gcd(l, a)

print('POSSIBLE' if k % l == 0 and max(A) >= k else 'IMPOSSIBLE')

Fixed submission:
def gcd(a, b):
  if a > b:
    a, b = b, a
  while a % b != 0:
    a, b = b, a % b
  return b

n, k = map(int, input().split())
A = list(map(int, input().split()))

g = A[0]
for i in range(1, n):
  g = gcd(g, A[i])

if k in A or max(A) > k and k % g == 0:
  print('POSSIBLE')
else:
  print('IMPOSSIBLE')
Buggy python submission (verdict: Runtime Error):
n = int(input())
A = [int(input()) for _ in range(n)]
used = {1}
pos = 1
count = 0
for _ in range(n):
  pos = A[pos - 1]
  count += 1
  if pos in used:
    print(-1)
    break
  used.append(pos)
  if pos == 2:
    print(count)
    break


Fixed submission:
n = int(input())
A = [int(input()) for _ in range(n)]
used = {1}
pos = 1
count = 0
for _ in range(n):
  pos = A[pos - 1]
  count += 1
  if pos in used:
    print(-1)
    break
  used.add(pos)
  if pos == 2:
    print(count)
    break
Buggy python submission (verdict: Runtime Error):
n = input()
A = list(map(int, input().split()))
flags = [0] * 8
count = 0
for a in A:
  if a < 3200:
    flags[a // 400] += True
  else:
    counts += 1
print(sum(flags), sum(flags) + count)

Fixed submission:
n = input()
A = list(map(int, input().split()))
flags = [False] * 8
count = 0
for a in A:
  if a < 3200:
    flags[a // 400] = True
  else:
    count += 1
print(max(sum(flags), 1), sum(flags) + count)
Buggy python submission (verdict: Runtime Error):
N,M,X = map(int, input().split())
A = np.array([[int(i) for i in input().split()] for _ in range(N)])
total = np.sum(A,axis=0)
flag = True if all((a>=X  for a in total[1:])) else False
ans = total[0]

if flag:
    for i in range(1,N+1):
        for v in itertools.combinations([i for i in range(N)], i):
            B = np.array([A[j] for j in v])
            total2 = np.sum(B, axis=0)
            sabun = total-total2
            if all(a>=X for a in sabun[1:]):
                ans = min(ans, sabun[0])
print(ans if flag else -1)

Fixed submission:
import numpy as np
import itertools

def check():
    N,M,X = map(int, input().split())
    A = np.array([[int(i) for i in input().split()] for _ in range(N)])
    total = np.sum(A,axis=0)
    flag = True if all((a>=X  for a in total[1:])) else False
    ans = total[0]

    if flag:
        for i in range(1,N+1):
            for v in itertools.combinations([i for i in range(N)], i):
                B = np.array([A[j] for j in v])
                total2 = np.sum(B, axis=0)
                sabun = total-total2
                if all(a>=X for a in sabun[1:]):
                    ans = min(ans, sabun[0])
    print(ans if flag else -1)
    
check()
Buggy python submission (verdict: Runtime Error):
N,K = map(int, input().split())
A = [int(i) for i in input().split()]
used = [0]
now_town = 0
flag = False

for i,_ in enumerate(range(K)):
    now_town = A[now_town]-1
    if now_town in used:
        break        
    used.append(now_town)
else:
    flag = True

roop_first = used.index(now_town)
ans_index = (K-roop_first)%(i-roop_first+1)

print(now_town+1 if flag else used[roop_first:][ans_index]+1)

Fixed submission:
from collections import defaultdict

N,K = map(int, input().split())
A = [int(i) for i in input().split()]
used_dict = defaultdict(int)
used_dict[0] += 1
now_town = 0
flag = False

for i in range(min(N,K)):
    now_town = A[now_town]-1
    if used_dict[now_town]:
        used_dict[now_town] += 1
        break
    used_dict[now_town] += 1
else:
    flag = True

if not flag:
    now_town2 = 0
    cnt = 0
    while 1:
        if now_town2 == now_town:
            for _ in range((K-cnt)%(i-cnt+1)):
                now_town = A[now_town]-1
            break
        now_town2 = A[now_town2]-1
        cnt += 1
print(now_town+1)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
from math import factorial

N = int(input())
A = [int(i) for i in input().split()]
cnt_list = Counter(A)
ans_dict = {}

for i in range(N):        
    if not ans_dict.get(A[i]):
        ans = 0
        for num, cnt in cnt_list.items():
            if num == A[i]:
                cnt = cnt-1
            ans += factorial(cnt) // factorial(2) // factorial(cnt - 2) if cnt > 1 else 0
        ans_dict[A[i]] = ans
    print(ans_dict[A[i]])

Fixed submission:
from collections import Counter

N = int(input())
A = [int(i) for i in input().split()]
cnt_list = Counter(A)

total = sum([cnt*(cnt-1)//2 if cnt > 1 else 0 for cnt in cnt_list.values()])
print(*[total-cnt_list[a]+1 for a in A], sep='\n')
Buggy python submission (verdict: Time Limit Exceeded):
S = input()
Q = int(input())

for _ in range(Q):
    q = input().split()
    if q[0] == '1':
        S = S[::-1]
    else:
        S = q[2] + S if q[1]=='1' else S + q[2]
print(S)

Fixed submission:
S = input()
Q = int(input())
line = True
first, last = '',''

for _ in range(Q):
    q = input().split()
    if q[0] == '1':
        line = True if line==False else False
    else:
        if line == True:
            if q[1] == '1':
                first = q[2] + first
            else:
                last = last + q[2]
        elif line==False:
            if q[1] == '1':
                last = last + q[2]
            else:
                first = q[2] + first
S = first+S+last
print(S if line else S[::-1])
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
keta = ['?']*N

for _ in range(M):
    s, c = map(int, input().split())        
    if keta[s-1] == '?' or keta[s-1] == c:
        keta[s-1] = c
    else:
        return -1
if keta[0] == 0:
    return -1

keta = [0 if num == '?' else num for num in keta]

print(''.join(map(str, keta)))

Fixed submission:
def check():
    N, M = map(int, input().split())
    keta = ['?']*N
    
    for _ in range(M):
        s, c = map(int, input().split())      
        if keta[s-1] == '?' or keta[s-1] == c:
            keta[s-1] = c
        else:
            return -1
    if keta[0] == 0 and N !=1:
        return -1
    
    keta = [0 if num == '?' else num for num in keta]
    
    if N == 1:
        return keta[0]
    
    keta = [1 if i==0 and num==0 else num for i,num in enumerate(keta)]
    
    return ''.join(map(str, keta))
  
print(check())
Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int, input().split())
P = [int(i) for i in input().split()]
maxP = 0

for i in range(N-K+1):
    a = sum(P[i:i+K])
    if maxP < a:
        maxP, array = a, P[i:i+K]
print(sum([i*(i+1)/2/i for i in array]))

Fixed submission:
N,K = map(int, input().split())
P = [int(i) for i in input().split()]
total, maxS = 0, 0
S = [0]
for p in P:
    total += p*(p+1)/2/p
    S.append(total)

for i in range(N-K+1):
    if maxS < S[i+K]-S[i]:
        maxS = S[i+K]-S[i]
print(maxS)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()
cnt = 0

for i in range(1000):
    target = str(i).zfill(3)
    j = 0
    for s in S:
        if s == target[j]:
            j += 1
        if j==3:
            cnt += 1
            break
print(cnt)

Fixed submission:
N = int(input())
S = input()
cnt = 0

for i in range(100):
    num_set = set()
    target = str(i).zfill(2)
    j = 0
    for s in S:
        if j<2 and s == target[j]:
            j += 1
        elif j==2:
            num_set.add(s)
    cnt += len(num_set)
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
import math
from itertools import permutations

N = int(input())
mati = np.array([list(map(int, input().split())) for _ in range(N)])
total = 0

for v in permutations(mati,N):
    for i in range(N-1):
        total += np.linalg.norm(v[i+1]-v[i])
print(total/math.factorial(N))

Fixed submission:
import math
from itertools import permutations


def get_distance(a,b):
    d = math.sqrt((a[1] - b[1]) ** 2 + (a[0] - b[0]) ** 2)
    return d

N = int(input())
mati = [list(map(int, input().split())) for _ in range(N)]
total = 0

for v in permutations(mati,N):
    for i in range(N-1):
        total += get_distance(v[i+1], v[i])
print(total/math.factorial(N))
Buggy python submission (verdict: Runtime Error):
N = int(input())

for i in range(math.floor(N**0.5),0,-1):
    if N % i == 0:
        x,y = i, N//i
        break
print(x+y-2)

Fixed submission:
import math

N = int(input())
for i in range(math.floor(N**0.5),0,-1):
    if N % i == 0:
        x,y = i, N//i
        break
print(x+y-2)
Buggy python submission (verdict: Time Limit Exceeded):
N,K,Q = [int(i) for i in input().split(' ')]
pointList = [K for _ in range(N)]

for _ in range(Q):
    answer = int(input())
    i = 0
    for point in pointList:
        if answer-1 != i:
            pointList[i] = point-1
        i += 1
for point in pointList:
    if point <= 0:
        print('No')
    else:
        print('Yes')

Fixed submission:
N,K,Q = [int(i) for i in input().split(' ')]
pointList = [K-Q for _ in range(N)]

for _ in range(Q):
    answer = int(input())
    pointList[answer-1] += 1
    
for point in pointList:
    if point <= 0:
        print('No')
    else:
        print('Yes')
Buggy python submission (verdict: Runtime Error):
N,M = [int(i) for i in input().split(' ')]
itemList = [int(i) for i in input().split(' ')]
heap = []

for i in itemList:
    heappush(heap, -i)

for _ in range(M):
    heappush(heap, math.ceil(heappop(heap)/2))
print(-sum(heap))

Fixed submission:
from heapq import heappush, heappop
import math

N,M = [int(i) for i in input().split(' ')]
itemList = [int(i) for i in input().split(' ')]
heap = []

for i in itemList:
    heappush(heap, -i)

for _ in range(M):
    heappush(heap, math.ceil(heappop(heap)/2))
print(-sum(heap))

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N,M = [int(i) for i in input().split(' ')]
itemList = np.array([int(i) for i in input().split(' ')])

for _ in range(M):
    itemList[np.argmax(itemList)] //= 2        

print(sum(itemList))

Fixed submission:
from heapq import heappush, heappop
import math

N,M = [int(i) for i in input().split(' ')]
itemList = [int(i) for i in input().split(' ')]
heap = []

for i in itemList:
    heappush(heap, -i)

for _ in range(M):
    heappush(heap, math.ceil(heappop(heap)/2))
print(-sum(heap))

Buggy python submission (verdict: Runtime Error):
N,M = [int(i) for i in input().split(' ')]
itemList = np.array([int(i) for i in input().split(' ')])

for _ in range(M):
    itemList[np.argmax(itemList)] //= 2        

print(sum(itemList))

Fixed submission:
from heapq import heappush, heappop
import math

N,M = [int(i) for i in input().split(' ')]
itemList = [int(i) for i in input().split(' ')]
heap = []

for i in itemList:
    heappush(heap, -i)

for _ in range(M):
    heappush(heap, math.ceil(heappop(heap)/2))
print(-sum(heap))

Buggy python submission (verdict: Time Limit Exceeded):
N,M = [int(i) for i in input().split(' ')]
itemList = [int(i) for i in input().split(' ')]
itemList.sort(reverse=True)

for _ in range(M):
    itemList[0] //= 2        
    for i in range(1,N):
        if itemList[0] > itemList[i]:
            item = itemList.pop(0)
            itemList.insert(i-1,item)
            break
        if i == N-1:
            item = itemList.pop(0)
            itemList.append(item)
print(sum(itemList))

Fixed submission:
from heapq import heappush, heappop
import math

N,M = [int(i) for i in input().split(' ')]
itemList = [int(i) for i in input().split(' ')]
heap = []

for i in itemList:
    heappush(heap, -i)

for _ in range(M):
    heappush(heap, math.ceil(heappop(heap)/2))
print(-sum(heap))

Buggy python submission (verdict: Time Limit Exceeded):
N,M = [int(i) for i in input().split(' ')]
itemList = [int(i) for i in input().split(' ')]

for _ in range(M):
    itemList.sort()
    itemList[-1] //= 2
    
print(sum(itemList))

Fixed submission:
from heapq import heappush, heappop
import math

N,M = [int(i) for i in input().split(' ')]
itemList = [int(i) for i in input().split(' ')]
heap = []

for i in itemList:
    heappush(heap, -i)

for _ in range(M):
    heappush(heap, math.ceil(heappop(heap)/2))
print(-sum(heap))
Buggy python submission (verdict: Runtime Error):
def check():
    N = int(input())
    B = [int(i) for i in input().split(' ')]

    total = B[0]
    for i in range(N):
        total += B[i]
    print(total)

check()

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

total = B[0]
for i in range(N-2):
    total += min(B[i],B[i+1])
total += B[N-2]

print(total)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
total = 0

for i in range(N):
    total += i
print(total)

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

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

print(long(N*(N-1)*0.5))

Fixed submission:
N = int(input())
print(N*(N-1)//2)
Buggy python submission (verdict: Time Limit Exceeded):
S = input()
start_posi = [int(i) for i in range(len(S))]
cnt = 0

posi = start_posi
pre_posi = {}
next_posi = start_posi
while not posi in  pre_posi.values():
    pre_posi[cnt] = next_posi
    next_posi = []
    for i in posi:
        next_posi.append(i + 1 if S[i] == 'R' else i - 1)        
    posi = next_posi
    cnt += 1
    
for key, v in pre_posi.items():
    if posi == v:
        loop_width = cnt-key
        loop_point = key
        break
loop = (10**100 - loop_point)%loop_width

answer_dict = {i : 0 for i in range(len(S))}
for mass in pre_posi[loop+loop_point]:
    answer_dict[mass] += 1
print(' '.join(map(str,answer_dict.values())))

Fixed submission:
def double_dp(dp,num):
    dp_new = [0]*num
    for i in range(num):
        dp_new[i] = dp[dp[i]]
    return dp_new

S = input()
dp = [int(i) for i in range(len(S))]

for i in range(len(S)):
    dp[i] = dp[i] + 1 if S[dp[i]] == 'R' else dp[i] - 1

for _ in range(17):
    dp = double_dp(dp, len(S))
        
answer_dict = {i : 0 for i in range(len(S))}
for mass in dp:
    answer_dict[mass] += 1
print(' '.join(map(str,answer_dict.values())))
Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter

N = int(input())
S = input()
min_stone = Counter(S).most_common()[-1][1]
if min_stone == N:
    min_stone = 0

for i in range(1,N):
    A, B = Counter(S[:i])['#'], Counter(S[i:])['.']
    if min_stone > A+B:
        min_stone = A+B
print(min_stone)

Fixed submission:
from collections import Counter

N = int(input())
S = input()
counter_s = Counter(S)
min_stone = counter_s.most_common()[-1][1]
if min_stone == N:
    min_stone = 0
A, B = 0, counter_s['.']
for s in S:
    if s == '#':
        A += 1
    else:
        B -= 1
    if min_stone > A+B:
        min_stone = A+B
print(min_stone)
Buggy python submission (verdict: Runtime Error):
import math

N =int(input())
monster = sorted([int(i) for i in input().split()])

print(math.gcd(monster[0], monster[1]))

Fixed submission:
from functools import reduce
import fractions


def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)


N =int(input())
monster = [int(i) for i in input().split()]
print(gcd_list(monster))
Buggy python submission (verdict: Runtime Error):
    N = int(input())
    T,A = [int(i) for i in input().split(' ')]
    H = [int(i) for i in input().split(' ')]
    minTemp = 600
    
    for i,h in enumerate(H):
        temp = T - h * 0.006
        if abs(temp-A) < minTemp:
            minTemp = abs(temp-A)
            place = i+1
    print(place)

Fixed submission:
N = int(input())
T,A = [int(i) for i in input().split(' ')]
H = [int(i) for i in input().split(' ')]
minTemp = 600

for i,h in enumerate(H):
    temp = T - h * 0.006
    if abs(temp-A) < minTemp:
        minTemp = abs(temp-A)
        place = i+1
print(place)
Buggy python submission (verdict: Time Limit Exceeded):
import fractions


def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

def check():
    N, M = map(int, input().split())
    S = input()
    T = input()
    length = lcm(N,M)
        
    for i in range(length):
        if i%(length//N)==0 and i%(length//M)==0:
            if S[i//(length//N)] != T[i//(length//M)]:
                return -1
    return length
  
print(check())

Fixed submission:
import fractions


def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

def check():
    N, M = map(int, input().split())
    S = input()
    T = input()
    length = lcm(N,M)
        
    for i in [a*(length//N) for a in range(N)]:
        if i%(length//M)==0:
            if S[i//(length//N)] != T[i//(length//M)]:
                return -1
    return length
  
print(check())

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


def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)


N, M = map(int, input().split())
S = input()
T = input()
length = lcm(N,M)
    
for i in range(length):
    if i%(length//N)==0 and i%(length//M)==0:
        if S[i//(length//N)] != T[i//(length//M)]:
            return -1
return length

Fixed submission:
import fractions


def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

def check():
    N, M = map(int, input().split())
    S = input()
    T = input()
    length = lcm(N,M)
        
    for i in [a*(length//N) for a in range(N)]:
        if i%(length//M)==0:
            if S[i//(length//N)] != T[i//(length//M)]:
                return -1
    return length
  
print(check())
Buggy python submission (verdict: Time Limit Exceeded):
def check():
    a = []
    bDict2 = {}
    count = 0
    removeList = []
    N, K = [int(i) for i in input().split(' ')]
    for i in range(1,N+1):
        if (2*i)%K == 0:
            a.append(i)


    while a != []:
        temp = a[0]
        for i in a:
            if (temp+i)%K == 0:
                removeList.append(i)
                if str(temp) not in bDict2:
                    bDict2[str(temp)] = 1
                else:
                    bDict2[str(temp)] += 1  
                    
        for i in removeList:
            a.remove(i)
        removeList.clear()
            
    for i in bDict2:
        count += bDict2[i]**3

    print(count)
check()

Fixed submission:
N, K = map(int, input().split())
cnt1,cnt2 = 0,0

for i in range(1,N+1):
    if i%K == 0:
        cnt1 += 1
    elif i%K == K/2:
        cnt2 += 1
print(cnt1**3+cnt2**3)

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

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

def check():
    a = []
    b = []
    count = 0
    bDict = {}
    bDict2 = {}
    removeList = []
    N, K = [int(i) for i in input().split(' ')]
    for i in range(1,N+1):
        if (2*i)%K == 0:
            a.append(i)
    count += len(a)
    
    while a != []:
        temp = a[0]
        for i in a:
            #print(i)
            if (temp+i)%K == 0:
                removeList.append(i)
                if str(temp) not in bDict2:
                    bDict2[str(temp)] = 1
                else:
                    bDict2[str(temp)] += 1  
                    
        for i in removeList:
            a.remove(i)
        removeList.clear()
       
    for i in bDict2:
        count += 3*permutations_count(bDict2[i], 2)
        if bDict2[i] > 2:
            count += permutations_count(bDict2[i], 3)

    print(count)
check()

Fixed submission:
N, K = map(int, input().split())
cnt1,cnt2 = 0,0

for i in range(1,N+1):
    if i%K == 0:
        cnt1 += 1
    elif i%K == K/2:
        cnt2 += 1
print(cnt1**3+cnt2**3)

Buggy python submission (verdict: Time Limit Exceeded):
import math

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

def check():
    a = []
    b = []
    count = 0
    bDict = {}
    N, K = [int(i) for i in input().split(' ')]
    for i in range(1,N+1):
        if (2*i)%K == 0:
            a.append(i)
    #print(a)
    for i in a:
        for j in range(1,N+1):
            if (i + j)%K == 0 and i != j:
                b.append((i,j))
                if str(i) not in bDict:
                    bDict[str(i)] = 1
                else:
                    bDict[str(i)] += 1
    
    for i in bDict:
        if bDict[i] > 1:
            count += permutations_count(bDict[i]+1, 3)//(bDict[i]+1)

    #print(b)
    print(3*len(b)+len(a)+count)
check()

Fixed submission:
N, K = map(int, input().split())
cnt1,cnt2 = 0,0

for i in range(1,N+1):
    if i%K == 0:
        cnt1 += 1
    elif i%K == K/2:
        cnt2 += 1
print(cnt1**3+cnt2**3)
Buggy python submission (verdict: Time Limit Exceeded):
N,M,Q = [int(i) for i in input().split()]
LR = [[int(i) for i in input().split()] for _ in range(M)]
QList = [[int(i) for i in input().split()] for _ in range(Q)]
count = {i:0 for i in range(1,Q+1)}
qnum = 0

for ql,qr in QList:
    qnum += 1
    for l,r in LR:
        if ql <= l and r <= qr:
            count[qnum] += 1
for i in count.values():
    print(i)

Fixed submission:
import numpy as np

N,M,Q = [int(i) for i in input().split()]
T = [[0]*(N+1)]*(N+1)
T=np.array(T)

for _ in range(M):
    l, r = map(int, input().split())
    T[l][r] += 1

np.cumsum(T, axis=0, out=T)
np.cumsum(T, axis=1, out=T)
data = T.tolist()

for _ in range(Q):
    ql, qr = [int(i) for i in input().split()]
    answer = data[qr][qr] - data[qr][ql-1] +  data[ql-1][ql-1] - data[ql-1][qr]
    print(answer)
Buggy python submission (verdict: Runtime Error):
S = input()

if re.fullmatch(r'A[a-z]+C[a-z]+', S):
    print('AC')
else:
    print('WA')

Fixed submission:
import re
S = input()

if re.fullmatch(r'A[a-z]+C[a-z]+', S):
    print('AC')
else:
    print('WA')
Buggy python submission (verdict: Runtime Error):
    N = int(input())
    A = [int(i) for i in input().split()]
    total, plus = A[0], A[1]
    for i in range(N-1):
        total += abs(A[i+1]-A[i])
    total += abs(A[N-1])
    print(total+A[1]-abs(A[1]-A[0])-A[0])
    for i in range(1,N-1):        
        print(total+abs(A[i-1]-A[i+1])-abs(A[i-1]-A[i])-abs(A[i]-A[i+1]))    
    print(total+A[N-2]-abs(A[N-2]-A[N-1])-abs(A[N-1]))

Fixed submission:
N = int(input())
A = [int(i) for i in input().split()]
total = abs(A[0])
for i in range(N-1):
    total += abs(A[i+1]-A[i])
total += abs(A[N-1])
print(total+abs(A[1])-abs(A[1]-A[0])-abs(A[0]))
for i in range(1,N-1):        
    print(total+abs(A[i-1]-A[i+1])-abs(A[i-1]-A[i])-abs(A[i]-A[i+1]))    
print(total+abs(A[N-2])-abs(A[N-2]-A[N-1])-abs(A[N-1]))
Buggy python submission (verdict: Runtime Error):
N = int(input())
L0 = 2
L1 = 1

for _ in range(N-1):
    L = L1 + L0
    L0 = L1
    L1 = L
print(L)

Fixed submission:
N = int(input())
L0 = 2
L1 = 1
if N == 0:
    print(L0)
elif N == 1:
    print(L1)
else:    
    for _ in range(N-1):
        L = L1 + L0
        L0 = L1
        L1 = L
    print(L)