I am getting correct ans for my test case. But codechef compiler is giving time sigtstp error.
int T,N,moves,minW;
long sum = 0;
cin >> T;
for(int t=0; t<T; t++)
{
cin >> N;
vector<int> W(N);
for(int i=0; i<N; i++)
{
cin >> W[i];
sum += W[i];
}
minW = *min_element(W.begin(),W.end());
moves= sum -N*minW;
cout <<moves << endl;
}
return 0;
}