Calculating inversion in array

code https://ide.codingblocks.com/#/s/15691
problem_link https://hack.codingblocks.com/contests/c/452/270

test case 2 is failing

i ve used linked list to sort the values as they are input