why do i get a wrong answer?

Question link = https://www.codechef.com/problems/NOMATCH

my answer link = https://www.codechef.com/viewsolution/22021703

I don’t understand why your solution would work. In the question, you must have to subtract half the elements from other half. While you are just adding all of them.(and making all the negative elements positive.)

Here is my another answer for this problem. Check that out.