Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

for i in range(N):
  ans = 0
  for j in range(i, N + i):
    if (j - i) % 2 == 0:
      ans += A[j % N]
    else:
      ans -= A[j % N]
  print(ans ,end = "")
  if i != N - 1:
    print(" ", end = "")
  else:
    print()

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

ans = 0
for i in range(N):
  tmp = ans
  if i == 0:
    for j in range(N):
      if j % 2 == 0:
        ans += A[j]
      else:
        ans -= A[j]
  else:
    ans = 2 * A[i - 1] - tmp

  tmp = ans
  print(ans, end = "")
  if i != N - 1:
    print(" ", end = "")
  else:
    print()

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N = int(input())
A = list(map(int, input().split()))

for i in range(N):
  ans = 0
  for j in range(i, N + i):
    if (j - i) % 2 == 0:
      ans += A[j % N]
    else:
      ans -= A[j % N]
  print(ans ,end = "")
  if i != N - 1:
    print(" ", end = "")
  else:
    print()

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

ans = 0
for i in range(N):
  tmp = ans
  if i == 0:
    for j in range(N):
      if j % 2 == 0:
        ans += A[j]
      else:
        ans -= A[j]
  else:
    ans = 2 * A[i - 1] - tmp

  tmp = ans
  print(ans, end = "")
  if i != N - 1:
    print(" ", end = "")
  else:
    print()

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N = int(input())
A = list(map(int, input().split()))

left = [[0 for _ in range(N)] for _ in range(N)]
right = [[] for _ in range(N)]
for i in range(N):
  right[i].append(A[i] * 2)
  for j in range(N):
    if j == i or j == (i + 1) % N:
      left[i][j] = 1

A = np.matrix(left)
Y = np.matrix(right)
ans = np.dot(np.linalg.inv(A), Y)

for i in range(N):
  print(int(round(ans[i,0])), end = "")
  if i == N - 1:
    print()
  else:
    print(" ", end = "")

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

ans = 0
for i in range(N):
  tmp = ans
  if i == 0:
    for j in range(N):
      if j % 2 == 0:
        ans += A[j]
      else:
        ans -= A[j]
  else:
    ans = 2 * A[i - 1] - tmp

  tmp = ans
  print(ans, end = "")
  if i != N - 1:
    print(" ", end = "")
  else:
    print()

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N = int(input())
A = list(map(int, input().split()))

left = [[0 for _ in range(N)] for _ in range(N)]
right = [[] for _ in range(N)]
for i in range(N):
  right[i].append(A[i])
  for j in range(N):
    if j == i or j == (i + 1) % N:
      left[i][j] = 0.5

A = np.matrix(left)
Y = np.matrix(right)
ans = np.dot(np.linalg.inv(A), Y)

for i in range(N):
  print(int(round(ans[i,0])), end = "")
  if i == N - 1:
    print()
  else:
    print(" ", end = "")

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

ans = 0
for i in range(N):
  tmp = ans
  if i == 0:
    for j in range(N):
      if j % 2 == 0:
        ans += A[j]
      else:
        ans -= A[j]
  else:
    ans = 2 * A[i - 1] - tmp

  tmp = ans
  print(ans, end = "")
  if i != N - 1:
    print(" ", end = "")
  else:
    print()

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N = int(input())
A = list(map(int, input().split()))

left = [[0 for _ in range(N)] for _ in range(N)]
right = [[] for _ in range(N)]
for i in range(N):
  right[i].append(2 * A[i] + 2 * A[(i + 1) % N])
  for j in range(N):
    if j == i or j == (i + 2) % N:
      left[i][j] = 1
    if j == (i + 1) % N:
      left[i][j] = 2

A = np.matrix(left)
Y = np.matrix(right)
ans = np.dot(np.linalg.inv(A), Y)

for i in range(N):
  print(int(round(ans[i,0])), end = "")
  if i == N - 1:
    print()
  else:
    print(" ", end = "")

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

ans = 0
for i in range(N):
  tmp = ans
  if i == 0:
    for j in range(N):
      if j % 2 == 0:
        ans += A[j]
      else:
        ans -= A[j]
  else:
    ans = 2 * A[i - 1] - tmp

  tmp = ans
  print(ans, end = "")
  if i != N - 1:
    print(" ", end = "")
  else:
    print()

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N = int(input())
A = list(map(int, input().split()))

left = [[0 for _ in range(N)] for _ in range(N)]
right = [[] for _ in range(N)]
for i in range(N):
  right[i].append(2 * A[i] + 2 * A[(i + 1) % N])
  for j in range(N):
    if j == i or j == (i + 2) % N:
      left[i][j] = 1
    if j == (i + 1) % N:
      left[i][j] = 2

A = np.matrix(left)
Y = np.matrix(right)
ans = np.linalg.inv(A) * Y

for i in range(N):
  print(int(round(ans[i,0])), end = "")
  if i == N - 1:
    print()
  else:
    print(" ", end = "")

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

ans = 0
for i in range(N):
  tmp = ans
  if i == 0:
    for j in range(N):
      if j % 2 == 0:
        ans += A[j]
      else:
        ans -= A[j]
  else:
    ans = 2 * A[i - 1] - tmp

  tmp = ans
  print(ans, end = "")
  if i != N - 1:
    print(" ", end = "")
  else:
    print()

Buggy python submission (verdict: Runtime Error):
from numpy.linalg import solve
N = int(input())
A = list(map(int, input().split()))

left = [[0 for _ in range(N)] for _ in range(N)]
right = []
for i in range(N):
  right.append(2 * A[i] + 2 * A[(i + 1) % N])
  for j in range(N):
    if j == i or j == (i + 2) % N:
      left[i][j] = 1
    if j == (i + 1) % N:
      left[i][j] = 2

ans = solve(left, right)
for i in range(N):
  print(int(round(ans[i])), end = "")
  if i == N - 1:
    print()
  else:
    print(" ", end = "")

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

ans = 0
for i in range(N):
  tmp = ans
  if i == 0:
    for j in range(N):
      if j % 2 == 0:
        ans += A[j]
      else:
        ans -= A[j]
  else:
    ans = 2 * A[i - 1] - tmp

  tmp = ans
  print(ans, end = "")
  if i != N - 1:
    print(" ", end = "")
  else:
    print()

Buggy python submission (verdict: Time Limit Exceeded):
from numpy.linalg import solve
N = int(input())
A = list(map(int, input().split()))

left = [[0 for _ in range(N)] for _ in range(N)]
right = []
for i in range(N):
  right.append(2 * A[i] + 2 * A[(i + 1) % N])
  for j in range(N):
    if j == i or j == (i + 2) % N:
      left[i][j] = 1
    if j == (i + 1) % N:
      left[i][j] = 2

ans = solve(left, right)
for i in range(N):
  print(int(round(ans[i])), end = "")
  if i == N - 1:
    print()
  else:
    print(" ", end = "")

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

ans = 0
for i in range(N):
  tmp = ans
  if i == 0:
    for j in range(N):
      if j % 2 == 0:
        ans += A[j]
      else:
        ans -= A[j]
  else:
    ans = 2 * A[i - 1] - tmp

  tmp = ans
  print(ans, end = "")
  if i != N - 1:
    print(" ", end = "")
  else:
    print()