#include <bits/stdc++.h>   using namespace std;   const long double PI = acos(-1);   struct Point {     long long x, y, r;     Point() {}     Point(long long a, long long b, long long c) {       x = a;       y = b;       r = c;     }   };   long double rad;   long double cor(long double angle) {     if (angle < 0) {       return angle + 2 * PI;     }     return angle;   }   pair<long double, long double> fnd(Point& p) {     long double kor = sqrt(p.x * p.x + p.y * p.y);     if (kor > rad + p.r) {       return {20, 20};     }     if (rad - p.r > kor) {       return {20, 20};     } else {       long double an1 =           acos((rad * rad + p.x * p.x + p.y * p.y - p.r * p.r) / (2 * rad * kor));       long double tmp = sqrt(p.x * p.x + p.y * p.y - p.r * p.r);       long double l = cor(atan2(p.y, p.x));       return {l - an1, l + an1};     }   }   signed main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     long double d;     long long n;     cin >> n;     cin >> d;     rad = 0;     vector<Point> sp(n);     long long x, y, r;     for (long long i = 0; i < n; ++i) {       cin >> x >> y >> r;       sp[i].x = x;       sp[i].y = y;       sp[i].r = r;     }     vector<pair<long double, long long> > al(0);     for (long long kol = 0; kol < 2850; ++kol) {       rad += d;       for (long long i = 0; i < n; ++i) {         pair<long double, long double> now = fnd(sp[i]);         if (now.first == 20) {           continue;         } else if (now.first == 30) {           continue;         } else if (now.first < 0 && now.second > 0) {           al.push_back({cor(now.first), 0});           al.push_back({2 * PI, 1});           al.push_back({0, 0});           al.push_back({now.second, 1});         } else if (now.second > 2 * PI) {           al.push_back({now.first, 0});           al.push_back({2 * PI, 1});           al.push_back({0, 0});           al.push_back({now.second - 2 * PI, 1});         } else {           al.push_back({now.first, 0});           al.push_back({now.second, 1});         }       }     }     sort(al.begin(), al.end());     long long now = 0;     long long mx = 0;     for (auto p : al) {       if (p.second == 0) {         ++now;       } else {         --now;       }       mx = max(mx, now);     }     cout << mx << endl;     return 0;   }   