https://www.codechef.com/problems/SEAARASU

```
#include <iostream>
#include <algorithm>
int main()
{
int t;
std::cin >> t;
while(t--)
{
int n;
std::cin >> n;
int arr[n];
for(int i=0;i< n;++i)
{
std::cin >> arr[i];
}
int j;
int i;
for(i=n-1,j=i-1;i>=0 && j>=0;--i,--j)
{
arr[i] = arr[i] - arr[j];
}
int sum = 0;
for(int i=0 ;i<n;++i)
{
sum = sum + arr[i];
}
std::cout << sum << " ";
std::cout << '\n';
}
return 0 ;
}
```