func_code_string: #include <bits/stdc++.h>   #pragma GCC optimize( Ofast )   #pragma GCC optimize( unroll-loops )   #pragma GCC target( avx2 )   #pragma GCC optimize( Os )   using namespace std;   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     string str;     long long i, j, k, x = 0, y = 0, n, m, t, sum = 0, a = 0, b, l, c, d, id;     cin >> n;     set<long long> s;     for (i = 0; i < n; i++) {       cin >> a;       sum += a;       s.insert(a);     }     x = s.size();     if (x >= 4)       cout << -1;     else {       if (x == 1)         cout << 0;       else if (x == 2) {         a = *next(s.begin(), 0);         b = *next(s.begin(), 1);         if ((a + b) % 2 != 0)           cout << b - a;         else           cout << (b - a) / 2;       } else {         a = *next(s.begin(), 0);         b = *next(s.begin(), 1);         c = *next(s.begin(), 2);         t = c - b;         if (a + c == b * 2)           cout << t;         else           cout << -1;       }     }     return 0;   }   