func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MOD = 1000 * 1000 * 1000 + 7;   const int INF = 2000 * 1000 * 1000;   const double EPS = 1e-9;   const double pi = acos(-1.0);   template <typename T>   inline T sqr(T n) {     return (n * n);   }   long long gcd(int a, int b) {     while (a && b) {       a %= b;       swap(a, b);     }     return a + b;   }   struct Point {     long long x, y;     Point() {}     Point(int x, int y) : x(x), y(y) {}     Point(const Point& a) { *this = a; }     Point operator-(const Point& a) const { return Point(x - a.x, y - a.y); }     inline long long dist() { return sqr(x) + sqr(y); }     bool operator<(const Point& p1) const {       return (x < p1.x || (x == p1.x && y < p1.y));     }   };   struct Line {     long long a, b, c;     Line() {}     inline void normalize() {       if (a < 0 || (a == 0 && b < 0)) {         a *= -1;         b *= -1;         c *= -1;       }       long long g = gcd(gcd(abs(a), abs(b)), abs(c));       if (g > 1) {         a /= g;         b /= g;         c /= g;       }     }     Line(int aa, int bb, int cc) {       a = aa, b = bb, c = cc;       normalize();     }     Line(const Point& p1, const Point& p2) {       a = p2.y - p1.y;       b = p1.x - p2.x;       c = p1.y * p2.x - p1.x * p2.y;       normalize();     }   };   const int maxn = 300010;   vector<pair<Point, int> > v[maxn];   vector<int> vec[maxn];   map<long long, int> position;   vector<Point> tmp[maxn];   Point center[2000];   long long rad[2000];   long long get_hash(const Line& l) {     long long a = l.a + 50000;     long long b = l.b + 50000;     long long c = l.c + 2000000000;     long long ret = c * 2000000000LL;     ret += a * 100000;     ret += b;     return ret;   }   void prepare(int pos) {     vector<pair<Point, int> >& cur = v[pos];     sort((cur).begin(), (cur).end());     vec[pos].resize(cur.size());     int cnt = 0;     for (size_t i = 0; i < cur.size(); i++) {       if (cur[i].second == 0)         cnt++;       else         cnt--;       vec[pos][i] = cnt;     }   }   long long get_ans(const Point& p1, const Point& p2) {     Line cur(p1, p2);     Point mid((p1.x + p2.x) / 2, (p1.y + p2.y) / 2);     Point norm(cur.a, cur.b);     norm.x += mid.x;     norm.y += mid.y;     cur = Line(mid, norm);     long long h = get_hash(cur);     if (!position.count(h)) return 0;     int pos = position[h];     int q = upper_bound((v[pos]).begin(), (v[pos]).end(), make_pair(mid, 1)) -             v[pos].begin() - 1;     if (q != -1) return vec[pos][q];     return 0;   }   int main() {     int n, m;     scanf( %d%d , &n, &m);     Point p1, p2;     int sz = 0;     for (int i = 0; i < n; i++) {       scanf( %I64d%I64d%I64d%I64d , &p1.x, &p1.y, &p2.x, &p2.y);       p1.x *= 2, p1.y *= 2;       p2.x *= 2, p2.y *= 2;       Line cur(p1, p2);       long long h = get_hash(cur);       int pos = 0;       if (position.count(h))         pos = position[h];       else {         pos = sz++;         position[h] = pos;       }       v[pos].push_back(make_pair(p1, (p1 < p2) ? 0 : 2));       v[pos].push_back(make_pair(p2, (p1 < p2) ? 2 : 0));     }     for (int i = 0; i < sz; i++) prepare(i);     long long ans = 0;     for (int i = 0; i < m; i++) {       scanf( %I64d%I64d%I64d , &center[i].x, &center[i].y, &rad[i]);       center[i].x *= 2;       center[i].y *= 2;       rad[i] *= 2;       for (size_t j = 0; j < tmp[rad[i]].size(); j++) {         if ((center[i] - tmp[rad[i]][j]).dist() > 4 * sqr(rad[i]))           ans += get_ans(center[i], tmp[rad[i]][j]);       }       tmp[rad[i]].push_back(center[i]);     }     printf( %I64d , ans);     return 0;   }   