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()))
a = np.array(A)
l = int(((N**2)+1)/2)
b = []
for i in range(l):
    b.append([1,-1])
    print(b)
b = np.array(b).reshape(1,2*l)
c = (np.delete(b, 2*l-1, axis=None)).reshape(N,N)
d = c.reshape(N,N)
inv = 0.5*( np.triu(c) - ( np.tril(c) - np.eye(N) ) )
g = np.eye(N)
x = 2*(np.dot(inv,a))
ans = list(map(str, list(map(int, list(x)))))
print(" ".join(ans))

import numpy as np
N = int(input())
A = list(map(int, input().split()))
a = np.array(A)
l = int(((N*N)+1)/2)
b = []
for i in range(l):
    b.append(1)
    b.append(-1)
b = b[:-1]
c = (np.array(b).reshape(N,N)
# print(b)
# c = (np.delete(b, 2*l-1, axis=None)).reshape(N,N)
# print(c)
# d = c.reshape(N,N)
inv = 0.5*( np.triu(c) - ( np.tril(c) - np.eye(N) ) )
g = np.eye(N)
x = 2*(np.dot(inv,a))
ans = list(map(str, list(map(int, list(x)))))
print(" ".join(ans))

import numpy as np

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

a = np.array(A)
l = int(((N**2)+1)/2)
b = np.tile((1,-1),(1,l))
c = (np.delete(b, 2*l-1, axis=None)).reshape(N,N)
# print(c)
# d = c.reshape(N,N)
inv = 0.5*( np.triu(c) - ( np.tril(c) - np.eye(N) ) )
# g = np.eye(N)
# print(inv)
print(1)
# x = 2*(np.dot(inv,a))
# print(x)

# ans = list(map(str, list(map(int, list(x)))))
# print(" ".join(ans))

import numpy as np

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

a = np.array(A)
l = int(((N**2)+1)/2)
b = np.tile((1,-1),(1,l))
c = (np.delete(b, 2*l-1, axis=None)).reshape(N,N)
# print(c)
# d = c.reshape(N,N)
print(1)
# inv = 0.5*( np.triu(c) - ( np.tril(c) - np.eye(N) ) )
# g = np.eye(N)
# print(inv)

# x = 2*(np.dot(inv,a))
# print(x)

# ans = list(map(str, list(map(int, list(x)))))
# print(" ".join(ans))

import numpy as np

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

a = np.array(A)
l = int(((N**2)+1)/2)
b = np.tile((1,-1),(1,l))
c = np.delete(b, 2*l-1, axis=None)
d = c.reshape(N,N)
e = np.triu(d)
f = np.tril(d)
g = np.eye(N)

inv = 0.5*(e-(f-g))

x = 2*(np.dot(inv,a))

print(x)

ans = list(map(str, list(map(int, list(x)))))
print(" ".join(ans))

import numpy as np

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

print(1)

# a = np.array(A)
# l = int(((N**2)+1)/2)
# b = np.tile((1,-1),(1,l))
# c = (np.delete(b, 2*l-1, axis=None)).reshape(N,N)
# print(c)
# d = c.reshape(N,N)

# inv = 0.5*( np.triu(c) - ( np.tril(c) - np.eye(N) ) )
# g = np.eye(N)
# print(inv)

# x = 2*(np.dot(inv,a))
# print(x)

# ans = list(map(str, list(map(int, list(x)))))
# print(" ".join(ans))

import numpy as np

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

a = np.array(A)
l = int(((N**2)+1)/2)
b = np.tile((1,-1),(1,l))
c = (np.delete(b, 2*l-1, axis=None)).reshape(N,N)
# print(c)
# d = c.reshape(N,N)
inv = 0.5*( np.triu(c) - ( np.tril(c) - np.eye(N) ) )
# g = np.eye(N)
# print(inv)
x = 2*(np.dot(inv,a))
# print(x)
print(1)
# ans = list(map(str, list(map(int, list(x)))))
# print(" ".join(ans))

import numpy as np

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



a = np.array(A)
l = int(((N**2)+1)/2)

print(1)

# b = np.tile((1,-1),(1,l))
# c = (np.delete(b, 2*l-1, axis=None)).reshape(N,N)
# # print(c)
# d = c.reshape(N,N)

# inv = 0.5*( np.triu(c) - ( np.tril(c) - np.eye(N) ) )
# g = np.eye(N)
# print(inv)

# x = 2*(np.dot(inv,a))
# print(x)

# ans = list(map(str, list(map(int, list(x)))))
# print(" ".join(ans))

import numpy as np

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



a = np.array(A)
l = int(((N**2)+1)/2)



b = np.tile((1,-1),(1,l))

print(1)

# c = (np.delete(b, 2*l-1, axis=None)).reshape(N,N)
# # print(c)
# d = c.reshape(N,N)

# inv = 0.5*( np.triu(c) - ( np.tril(c) - np.eye(N) ) )
# g = np.eye(N)
# print(inv)

# x = 2*(np.dot(inv,a))
# print(x)

# ans = list(map(str, list(map(int, list(x)))))
# print(" ".join(ans))

import numpy as np
N = int(input())
A = list(map(int, input().split()))
a = np.array(A)
# l = int(((N*N)+1)/2)
b = []
for i in range(N):
    if i%2==0:
        b.append(1)
    else:
        b.append(-1)
c = np.dot(np.array(b),a)
x = [c]
for j in range(1,N):
    x_j = 2*a[j-1] - x[j-1]
    x.append(x_j)
ans = list(map(str, list(map(int, list(x)))))
print(" ".join(ans))

Verdicts: Wrong Answer

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Wrong Answer

Runtime Error

Wrong Answer

Runtime Error

Accepted