func_code_string: #include <bits/stdc++.h>   using namespace std;   const uint64_t seed =       std::chrono::system_clock::now().time_since_epoch().count();   mt19937_64 rnd(seed);   const int MOD = 998244353;   void solve() {     int n;     cin >> n;     vector<int> a(n);     for (int i = 0; i < n; i++) cin >> a[i];     set<pair<long long, long long>> ss;     int cnt = 0;     long long x = 1, y = 0;     auto has = [&](int v) {       long long d = (v - y) / x;       auto it = ss.upper_bound({d, LLONG_MAX});       if (it != ss.begin()) {         it = prev(it);         return it->first <= d && it->second >= d;       }       return false;     };     for (int p : a) {       if (p % 2 == 0 && has(p / 2)) {         ss.clear();         ss.insert({p / 2, p / 2});         x = 1, y = 0;         continue;       };       x = -x;       y = p - y;       cnt++;       if (p % 2 == 0) {         long long d = (p / 2 - y) / x;         ss.insert({d, d});       }       long long r1 = (1 - y) / x;       long long r2 = (p - 1 - y) / x;       if (r1 > r2) swap(r1, r2);       for (auto it = ss.begin(); it != ss.end();) {         long long aa, bb;         tie(aa, bb) = *it;         aa = max(aa, r1);         bb = min(bb, r2);         if (aa > bb)           it = ss.erase(it);         else {           ss.erase(it);           ss.insert({aa, bb});           break;         }       }       for (auto it = ss.rbegin(); it != ss.rend();) {         long long aa, bb;         tie(aa, bb) = *it;         aa = max(aa, r1);         bb = min(bb, r2);         it = decltype(it){ss.erase(next(it).base())};         if (aa <= bb) {           ss.insert({aa, bb});           break;         }       }       if (ss.empty()) {         cnt++;         ss.insert({r1, r2});       }     }     cout << cnt <<   n ;   }   int main() {     std::ios::sync_with_stdio(false);     cin.tie(NULL);     cout.precision(10);     int T = 1;     cin >> T;     for (int i = 1; i <= T; i++) {       solve();     }     cout.flush();     return 0;   }   