func_code_string: #include <bits/stdc++.h>   using namespace std;   bool debug = false;   int n, m, k;   int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};   long long ln, lk, lm;   int gg(int x, int y) {     int z = y;     while (x % y != 0) {       z = x % y;       x = y;       y = z;     }     return z;   }   map<int, vector<int>> X[2];   map<pair<pair<int, int>, pair<int, int>>, vector<int>> mp[2];   int cx[20005], cy[20005], cr[20005], ans;   int dis(int i, int j) {     return (cx[i] - cx[j]) * (cx[i] - cx[j]) + (cy[i] - cy[j]) * (cy[i] - cy[j]);   }   pair<int, int> gett(int x, int y) {     if (y == 0) return {0, 1};     int tmp = gg(abs(x), abs(y));     pair<int, int> tt = {abs(y / tmp), abs(x / tmp)};     if ((y < 0 && x > 0) || (y > 0 && x < 0)) tt.second *= -1;     return tt;   }   void cal(int i, int j) {     if (cy[i] == cy[j]) {       int x = cx[i] + cx[j];       if (x % 2 != 0) return;       x /= 2;       auto p = X[0][x];       int sz = p.size();       if (sz == 0) return;       int tar = cy[i];       int c = p.end() - upper_bound(p.begin(), p.end(), tar);       p = X[1][x];       c += sz - (p.end() - lower_bound(p.begin(), p.end(), tar));       ans += sz - c;       return;     }     int x = cx[i] - cx[j], y = cy[i] - cy[j];     int zx = (cx[i] + cx[j]), zy = (cy[i] + cy[j]);     pair<int, int> kk = gett(y * -1, x);     pair<int, int> bb = gett(kk.second * 2, kk.second * zy - kk.first * zx);     if (mp[0].find({kk, bb}) == mp[0].end()) return;     auto p = mp[0][{kk, bb}];     int sz = p.size();     int tar = zx / 2;     int c = p.end() - upper_bound(p.begin(), p.end(), tar);     p = mp[1][{kk, bb}];     c += sz - (p.end() - lower_bound(p.begin(), p.end(), tar));     ans += sz - c;   }   int main() {     scanf( %d%d , &n, &m);     int a, b, c, d;     for (int(i) = 0; (i) < (int)(n); (i)++) {       scanf( %d%d%d%d , &a, &b, &c, &d);       if (a == c) {         X[0][a].push_back({min(b, d)});         X[1][a].push_back({max(b, d)});       } else {         int x = a - c, y = b - d;         pair<int, int> tt = gett(x, y);         y = d * a - c * b;         pair<int, int> bb = gett(x, y);         mp[0][{tt, bb}].push_back(min(a, c));         mp[1][{tt, bb}].push_back(max(a, c));       }     }     for (int(i) = 0; (i) < (int)(2); (i)++) {       for (auto &p : X[i]) sort(p.second.begin(), p.second.end());       for (auto &p : mp[i]) sort(p.second.begin(), p.second.end());     }     for (int(i) = 0; (i) < (int)(m); (i)++)       scanf( %d%d%d , cx + i, cy + i, cr + i);     for (int(i) = 0; (i) < (int)(m); (i)++)       for (int j = i + 1; j < m; j++)         if (cr[i] == cr[j]) {           int D = cr[i] + cr[j];           D *= D;           if (dis(i, j) > D) {             cal(i, j);           }         }     printf( %d n , ans);     return 0;   }   