#include using namespace std; template using V = vector; int gcd(int a, int b) { a = abs(a); b = abs(b); while (b != 0) { int r = a % b; a = b; b = r; } return a; } int area(const V& v1, const V& v2) { int x1 = v1[0], y1 = v1[1]; int x2 = v2[0], y2 = v2[1]; return (x1 * y2 - x2 * y1); } bool arg_sort(const V& v1, const V& v2) { return area(v1, v2) > 0; } int main(void) { V > vec = { {1,0} }; int n = 642, m = 500000; for (int i = 1; i < n; ++i) { for (int j = 1; j < n; ++j) { if (gcd(j, i) > 1) { continue; } vec.push_back({ j,i }); vec.push_back({ j,-i }); } } int N = vec.size(); if (N > m) { vec.resize(m); N = m; } sort(vec.begin(), vec.end(), arg_sort); int M = 1000000000; int x = -M, y = 0; cout << (N << 1) << endl; // return 0; for (V v : vec) { x += v[0]; y += v[1]; cout << x << ' ' << y << endl; } for (V v : vec) { x -= v[0]; y -= v[1]; cout << x << ' ' << y << endl; } return 0; }