Problem Code: ZCO13001

" Problem Link: https://www.codechef.com/ZCOPRAC/problems/ZCO13001 "
When I submit my code the first subtask runs successfully but the last two test cases of subtask 2 shows an Time Limit Exe. Error! what should I do?
My Source Code:

#include <stdio.h>
int main(void) {
	long long int i,n,temp=1,power[200000],sum=0,val,j;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
	    scanf("%d",&power[i]);
	}
	
	 for(i=0;i<n;i++)
	 {
	     for(j=i+1;j<n;j++)
	     {
	        
                val=abs(power[j]-power[i]);
                sum=sum+val;
            
	     }
	 }
	printf("%d",sum);
	return 0;
}
//