#include #include #include constexpr int sgn_x[4] = { +1, -1, -1, +1 }; constexpr int sgn_y[4] = { +1, +1, -1, -1 }; int main() { std::vector> ds; auto dfs = [&](auto dfs, int ld, int ln, int rd, int rn) -> void { int md = ld + rd; int mn = ln + rn; if (md <= 641) { ds.emplace_back(md, mn); if (ds.size() == 125000) return; dfs(dfs, ld, ln, md, mn); if (ds.size() == 125000) return; dfs(dfs, md, mn, rd, rn); } }; dfs(dfs, 1, 0, 1, 1); long long sd = 0, sn = 0; for (auto& [d, n] : ds) { sd += d; sn += n; } std::sort( ds.begin(), ds.end(), [&](const std::pair& p, const std::pair& q) { auto [pd, pn] = p; auto [qd, qn] = q; return pn * qd < qn* pd; } ); std::cout << 1000000 << '\n'; long long cx = 0, cy = 0; for (int i = 0; i < 4; ++i) { for (int j = 0; j < 2; ++j) { for (auto& [x, y] : ds) { std::cout << cx << ' ' << cy << '\n'; cx += sgn_x[i] * x, cy += sgn_y[i] * y; std::swap(x, y); } } } std::cout.flush(); return 0; }