```
#include <bits/stdc++.h>
using namespace std;
/*
T cases
EACH CASE:
N--> workers
w1, w2, w3, w4... salaries of workers
*/
int main(){
int T,nw,salary;
T = 0;
nw = 0;
salary = 0;
cin>>T;
for(int i = 0; i<T;++i)
{
cin>>nw;
vector<int> v;
vector<int> res;
for(int j = 0;j<nw;++j)
{
cin>>salary;
v.push_back(salary);
}
int maxe = *max_element(v.begin(),v.end());
for(int l:v){
res.push_back(maxe-l);
}
//int steps=1;
int val = accumulate(res.begin(),res.end(),0);
cout<<val<<"\n";
}
}
```

I tried to solve this great problem in this way and it shows correct ans in mentioned example But i guess there is some mistake in this method can anyone help me!

THANKS