func_code_string: /*   python3 ../../CompetitionHelpers/run_codeforces.py --problem A --test 0   g++ -ggdb -fsanitize=address -std=c++17 A.cpp && ./a.out <<<  1   4   0 3 5 6    */      #include <bits/stdc++.h>   using namespace std;      #define rep(i, a, b) for (int i = a; i < (b); i++)   #define trav(a, x) for (auto& a : x)   #define all(x) begin(x), end(x)   #define sz(x) (int)(x).size()   typedef long long ll;   typedef pair<int, int> pii;   typedef vector<int> vi;      string to_string(pii p) { return  (  + to_string(p.first) +  ,  + to_string(p.second) +  ) ; }   template <typename A>   string to_string(A v) { int cnt = 0; string res; for (const auto &x : v) { if (cnt++) res +=    ; res += to_string(x); } return  [  + res +  ] ; }   string to_string(const string& s) { return     + s +    ; }   string to_string(const char* s) { return to_string((string) s); }      void debug_out() { cerr << endl; }   template <typename Head, typename... Tail>   void debug_out(Head H, Tail... T) { cerr <<     << to_string(H); debug_out(T...); }   #define debug(...) cerr <<  [  << #__VA_ARGS__ <<  ]: , debug_out(__VA_ARGS__)      template<typename T>   void output_vector(const vector<T> &v, int start = 0, int end = -1) {       if (end < 0) end = int(v.size());       for (int i = start; i < end; i++)           cout << v[i] << (i < end - 1 ?     :   n );   }      int main() {       cin.sync_with_stdio(0); cin.tie(0);       cin.exceptions(cin.failbit);          int T; cin >> T; while (T--) {           ll n; cin >> n;           vector<ll> Arr(n); rep(i, 0, n) cin >> Arr[i];              sort(all(Arr));              ll ans = Arr.back();           for (ll i = 1; i < n; i++) {               ans -= (Arr[i] - Arr[i - 1]) * i * (n - i);           }              cout << ans <<   n ;       }   }