func_code_string: #include <bits/stdc++.h>   using namespace std;   using ll = long long;   using P = pair<int, int>;   const long long MOD = 1000000007;   const long long INF = 1LL << 60;   const int INT_INF = 1000000000;   int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};   void solve() {     int n;     cin >> n;     vector<ll> a(n);     for (auto &ai : a) cin >> ai;     bool positive;     if (a[0] < 0)       positive = false;     else       positive = true;     ll sum = 0;     ll tmp = a[0];     for (int i = 1; i < n; i++) {       if (positive) {         if (a[i] > 0) {           tmp = max(tmp, a[i]);         } else {           sum += tmp;           tmp = a[i];           positive = false;         }       } else {         if (a[i] > 0) {           sum += tmp;           tmp = a[i];           positive = true;         } else {           tmp = max(tmp, a[i]);         }       }     }     sum += tmp;     cout << sum << endl;   }   int main() {     ios::sync_with_stdio(false);     cin.tie(nullptr);     int t;     cin >> t;     for (int i = 0; i < t; i++) solve();     return 0;   }   