#pragma GCC target("avx") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include using namespace std; int main() { cin.tie(0); ios::sync_with_stdio(false); int N = 1000000; vector> v; set> s; for( int p = 1; p <= 1000; p++ ) { for( int q = 1; q <= 2000; q++ ) { long long g = gcd(p, q); if( s.insert(make_pair(p/g, q/g)).second ) { v.emplace_back(make_pair(p/g, q/g)); } } } sort(v.begin(), v.end(), [](pair& x, pair& y) { return x.first*y.second < y.first*x.second; }); long long x = -1000000000, y = -1000000000; cout << N << endl; for( int i = 0; i < N; i++ ) { cout << x << ' ' << y << '\n'; x += v[i].first; y += v[i].second; } }