#include using namespace std; const int N = 20 + 3; struct Point{ int x, y; int dist2(){ return x * x + y * y; } Point operator-(Point o){ return {x - o.x, y - o.y}; } double dist(){ return sqrt(dist2()); } int dot(Point o){ return x * o.x + y * o.y; } }; int n; double radius; vector p; vector adj[N * N]; bool ok(Point P){ if(P.x < radius || n < radius + P.x) return false; if(P.y < radius || n < radius + P.y) return false; return true; } vector solve(int dx, int dy){ Point dir{dx, dy}; sort(p.begin(), p.end(), [&](auto l, auto r){ return l.dot(dir) < r.dot(dir); }); vector ans; for(Point cp: p){ bool ok = true; for(Point ap: ans){ if((ap - cp).dist() < 2 * radius){ ok = false; break; } } if(ok){ ans.push_back(cp); } } return ans; } clock_t timer = clock(); int main(){ ios::sync_with_stdio(false); cin.tie(NULL); cin >> n >> radius; for(int i = 1; i <= n - 1; ++i){ for(int j = 1; j <= n - 1; ++j){ if(ok(Point{i, j})){ p.push_back({i, j}); } } } mt19937 mt(3); vector ans; while((((float)clock() - (float)timer) / (float)CLOCKS_PER_SEC) <= 3.5){ auto cand = solve(mt() % n, mt() % n); if(cand.size() > ans.size()){ ans = cand; } } cout << ans.size() << "\n"; for(auto [x, y]: ans){ cout << x << " " << y << "\n"; } }