#include using namespace std; #define rep(i, n) for(int i=0; i #include int main() { int T; cin >> T; rep(test, T) { int N; cin >> N; vector v(N); rep(i, N) { cin >> v[i]; } ll ans = 0; rep(i, N - 1) { if (v[i + 1] <= v[i]) { ans = max(ans, v[i] - v[i + 1] + 1); } } cout << ans << endl; } }