func_code_string: #include <bits/stdc++.h>   using namespace std;   typedef long long ll;   const int N = 1000;   const int MAX_WEIGHT = 20000;   const ll INF =10000000000000;      int n, m;   vector<int> b[2], a[2];   vector<int> suff[2];   map<int,bool> exist;      int get(int i, int j, int c) {     int result = 0;     int value = b[i][j] + c - 1;     int s = j, e = b[i].size() - 1, mid ,best = j;     while (s <= e) {       mid = s + e;       mid >>= 1;       if (b[i][mid] <= value) {         best = mid;         s = mid + 1;       } else {         e = mid - 1;       }     }     result = best - j + 1;     return result;   }      void solve() {     for (int i = 0 ; i < 2 ; i++) {       sort(a[i].begin(), a[i].end());       sort(b[i].begin(), b[i].end());       suff[i].clear();       suff[i].resize(a[i].size() + 1);     }        suff[0][a[0].size()] = suff[1][a[1].size()] = 0;        for (int j = 0 ; j < 2 ; j++)       for (int i = a[j].size() - 1 ; i >= 0 ; i--) {         suff[j][i] = suff[j][i + 1] + exist[(j == 0 ? 1 : -1) * a[j][i]];       }     int answer = 0;     for (int i = 0 ; i < 2 ; i++) {       if (a[i].size() == 0)         continue;       int last_moved = 0;       int mx = 0;       int num_moved = 1;       for (int j = 0 ; j < (int) b[i].size() ; j++) {         if (b[i][j] < a[i][0])           continue;         while (last_moved != (int) a[i].size() && a[i][last_moved] < b[i][j] + num_moved)           last_moved++, num_moved++;         num_moved--;         last_moved--;         mx = max(mx, suff[i][last_moved + 1] + get(i, j, num_moved));       }       answer += mx;     }     cout << answer << endl;      }      void read() {     cin >> n>> m;     a[0].clear();     b[0].clear();     a[1].clear();     b[1].clear();     exist.clear();     for (int i = 0, a ; i < n ; i++) {       scanf( %d , &a);       ::a[a < 0].push_back(a * (a < 0 ? -1 : 1));     }     for (int i = 0, b ; i < m ; i++) {       scanf( %d , &b);       exist[b] = true;       ::b[b < 0].push_back(b * (b < 0 ? -1 : 1));     }   }      signed main() {     int t = 1;     cin >> t;     while (t--) {       read();       solve();     }        return 0;   }   