Problem: There are N mountains in a circle, called Mountain 1, Mountain 2, ..., Mountain N in clockwise order. N is an _odd_ number.  Between these mountains, there are N dams, called Dam 1, Dam 2, ..., Dam N. Dam i (1 \leq i \leq N) is located between Mountain i and i+1 (Mountain N+1 is Mountain 1).  When Mountain i (1 \leq i \leq N) receives 2x liters of rain, Dam i-1 and Dam i each accumulates x liters of water (Dam 0 is Dam N).  One day, each of the mountains received a non-negative **even** number of liters of rain.  As a result, Dam i (1 \leq i \leq N) accumulated a total of A_i liters of water.  Find the amount of rain each of the mountains received. We can prove that the solution is unique under the constraints of this problem.

Submission attempts (in order):
import numpy as np

n = int(input())

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

y = np.zeros((n, 1), dtype=np.int)

for i, wa in enumerate(a):
    y[i][0] = wa


A = np.zeros((n, n), dtype=np.int)
exit()
for i in range(n-1):
    A[i][i] = 1
    A[i][i+1] = 1
exit()
A[n-1][n-1] = 1
A[n-1][0] = 1

exit()



import numpy as np

n = int(input())

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

y = np.zeros((n, 1), dtype=np.int)

for i, wa in enumerate(a):
    y[i][0] = wa

A = np.zeros((n, n), dtype=np.int)

for i in range(n-2):
    A[i][i] = 1
    A[i][i+1] = 1

A[n-1][n-1] = 1
A[n-1][0] = 1

S = np.linalg.solve(A,y)*2

for i in range(n-1):
    print(int(S[i][0]), end=" ")
print(int(S[n-1][0]))


import numpy as np

n = int(input())

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

y = np.zeros((n, 1), dtype=np.int)

for i, wa in enumerate(a):
    y[i][0] = wa

A = np.zeros((n, n), dtype=np.int)

exit()

for i in range(n-1):
    A[i][i] = 1
    A[i][i+1] = 1

A[n-1][n-1] = 1
A[n-1][0] = 1

S = np.linalg.solve(A,y)*2

for i in range(n-1):
    print(int(S[i][0]), end=" ")
print(int(S[n-1][0]))


import numpy as np

n = int(input())

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

y = np.zeros((n, 1), dtype=np.int)

for i, wa in enumerate(a):
    y[i][0] = wa

A = np.zeros((n, n), dtype=np.int)

for i in range(n-1):
    A[i][i] = 1
    A[i][i+1] = 1

A[n-1][n-1] = 1
A[n-1][0] = 1

S = np.linalg.solve(A,y)*2

for i in range(n-1):
    print(int(S[i][0]), end=" ")
print(int(S[n-1][0]))


import numpy as np

n = int(input())

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

y = np.zeros((n, 1), dtype=np.int)

for i, wa in enumerate(a):
    y[i][0] = wa
exit()

A = np.zeros((n, n), dtype=np.int)

for i in range(n-1):
    A[i][i] = 1
    A[i][i+1] = 1
exit()
A[n-1][n-1] = 1
A[n-1][0] = 1

exit()



import numpy as np

n = int(input())

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

y = np.zeros((n, 1), dtype=np.int)

for i, wa in enumerate(a):
    y[i][0] = wa

A = np.zeros((n, n), dtype=np.int)

for i in range(n-1):
    A[i][i] = 1
    A[i][i+1] = 1

A[n-1][n-1] = 1
A[n-1][0] = 1

exit()



import numpy as np

n = int(input())

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

y = np.zeros((n, 1), dtype=np.int)

for i, wa in enumerate(a):
    y[i][0] = wa

A = np.zeros((n, n), dtype=np.int)

for i in range(n-1):
    A[i][i] = 1
    A[i][i+1] = 1

A[n-1][n-1] = 1
A[n-1][0] = 1

exit()
S = np.linalg.solve(A,y)*2

for i in range(n-1):
    print(int(S[i][0]), end=" ")
print(int(S[n-1][0]))


import numpy as np

n = int(input())

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

y = np.zeros((n, 1), dtype=np.int)

for i, wa in enumerate(a):
    y[i][0] = wa

A = np.zeros((n, n), dtype=np.int8)

exit()

for i in range(n-1):
    A[i][i] = 1
    A[i][i+1] = 1

A[n-1][n-1] = 1
A[n-1][0] = 1

S = np.linalg.solve(A,y)*2

for i in range(n-1):
    print(int(S[i][0]), end=" ")
print(int(S[n-1][0]))


import numpy as np

n = int(input())

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

y = np.zeros((n, 1), dtype=np.int)

for i, wa in enumerate(a):
    y[i][0] = wa
exit()
A = np.zeros((n, n), dtype=np.int)

exit()



import numpy as np

n = int(input())

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

y = np.zeros((n, 1), dtype=np.int)

for i, wa in enumerate(a):
    y[i][0] = wa


A = np.zeros((n, n), dtype=np.int)

for i in range(n-1):
    A[i][i] = 1
    A[i][i+1] = 1
exit()
A[n-1][n-1] = 1
A[n-1][0] = 1

exit()



import numpy as np

n = int(input())

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

y = np.zeros((n, 1), dtype=np.int)

for i, wa in enumerate(a):
    y[i][0] = wa
exit()

A = np.zeros((n, n), dtype=np.int)

for i in range(n-1):
    A[i][i] = 1
    A[i][i+1] = 1

A[n-1][n-1] = 1
A[n-1][0] = 1

exit()



import numpy as np

n = int(input())

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

y = np.zeros((n, 1), dtype=np.int)

for i, wa in enumerate(a):
    y[i][0] = wa

A = np.zeros((n, n), dtype=np.int)

for i in range(n-1):
    A[i][i] = 1
    A[i][i+1] = 1

A[n-1][n-1] = 1
A[n-1][0] = 1

S = np.linalg.solve(A,y)*2

for i in range(n-1):
    print(int(S[i][0]), end=" ")
print(int(S[n-1][0]))


import numpy as np

n = int(input())

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

y = np.zeros((n, 1), dtype=np.int)

for i, wa in enumerate(a):
    y[i][0] = wa

A = np.zeros((n, n), dtype=np.int)

exit()



import numpy as np

n = int(input())

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

y = np.zeros((n, 1), dtype=np.int)

for i, wa in enumerate(a):
    y[i][0] = wa

A = np.zeros((n, n), dtype=np.int)

exit()

for i in range(n-1):
    A[i][i] = 1
    A[i][i+1] = 1

A[n-1][n-1] = 1
A[n-1][0] = 1

S = np.linalg.solve(A,y)*2

for i in range(n-1):
    print(int(S[i][0]), end=" ")
print(int(S[n-1][0]))


import numpy as np
import sys

n = int(input())

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

a_sum = sum(a)

x = []

x_0 = int(a_sum/2)

for i in range(int((n-1)/2)):
    x_0 -= a[2*i+1]

x.append(x_0)
x_tmp = x_0

for i in range(n-1):
    x_tmp = a[i] - x_tmp
    x.append(x_tmp)

x = list(map(lambda y: y*2, x))

print(*x, sep=' ')


Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Wrong Answer

Runtime Error

Runtime Error

Runtime Error

Wrong Answer

Runtime Error

Wrong Answer

Runtime Error

Runtime Error

Runtime Error

Accepted