#include using namespace std; using ll = long long; using vi = vector; using vc = vector; using vs = vector; using vll = vector; #define int long long #define f first #define s second #define pb push_back #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define foo(i,a,b) for (int i = (a); i < (b); ++i) #define rfoo(i,a,b) for (int i = (a); i >= (b); --i) #define input(v) for (auto &x : v) cin >> x #define print(v) { for (auto x : v) cout << x << " "; cout << '\n'; } #define yes cout << "YES\n"; #define no cout << "NO\n"; #define nl cout << "\n"; const int MOD = 1e9 + 7; const ll INF = 1e18; #define fastio ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr) // ll gcd(ll a, ll b) { // return std::gcd(a, b); // } ll power(ll a, ll b) { ll res = 1; while (b > 0) { if (b & 1) res *= a; a *= a; b >>= 1; } return res; } ll modexp(ll a, ll b, ll mod = MOD) { ll res = 1; a = (a % mod + mod) % mod; while (b > 0) { if (b & 1) res = (__int128)res * a % mod; a = (__int128)a * a % mod; b >>= 1; } return res; } bool isprime(ll n) { if (n < 2) return false; for (ll i = 2; i <= n / i; ++i) { if (n % i == 0) return false; } return true; } void sieve(int n, vector &isPrime) { if (n < 0) { isPrime.clear(); return; } isPrime.assign(n + 1, true); isPrime[0] = false; if (n >= 1) isPrime[1] = false; for (int i = 2; i <= n / i; ++i) { if (isPrime[i]) { for (ll j = 1LL * i * i; j <= n; j += i) { isPrime[j] = false; } } } } bool ispoftwo(ll n) { return n > 0 && !(n & (n - 1)); } int countSetBits(ll n) { return __builtin_popcountll(n); } int digitCount(ll n, int base = 10) { if (base <= 1) return -1; unsigned long long x = n < 0 ? 0ULL - (unsigned long long)n : (unsigned long long)n; if (x == 0) return 1; int cnt = 0; while (x > 0) { cnt++; x /= base; } return cnt; } vll factors(ll n) { vll res; if (n <= 0) return res; for (ll i = 1; i <= n / i; i++) { if (n % i == 0) { res.pb(i); if (i != n / i) res.pb(n / i); } } sort(all(res)); return res; } #define count_occ(v, x) (ub(v, x) - lb(v, x)) bool already (int a, int b, int x) { if (x > a-b) { return true; } else { return false; } } signed main() { fastio; int t = 1; cin >> t; while (t--) { int n; cin>>n; vi v(n); input(v); int i = 0, j = 1; int min_operations = 0; while (j < n) { int a = v[i], b = v[j]; if (!already (a,b, min_operations)) { int extra_needed = a - b + 1 - min_operations; min_operations += extra_needed; } i++; j++; } cout<