#include using namespace std; typedef long long ll; typedef double lf; typedef long double Lf; typedef pair pii; typedef pair pll; #define TRACE(x) cerr << #x << " " << x << endl #define FOR(i, a, b) for (int i = (a); i < int(b); i++) #define REP(i, n) FOR(i, 0, n) #define all(x) (x).begin(), (x).end() #define _ << " " << #define fi first #define sec second #define mp make_pair #define pb push_back const int MAXN = 500; ll a[MAXN][MAXN]; ll b[MAXN][MAXN]; vector flowers; int main() { ll x; cin >> x; a[0][250] = 1; flowers.pb({0, 250}); FOR(i, 1, MAXN) { FOR(j, 100, 150) { a[i][j] = rand() % 2; if (a[i][j]) flowers.pb({i * 2, j}); } } cout << flowers.size() << endl; for (auto pp : flowers) { cout << pp.first << " " << pp.second << endl; } int days = 0; ll maxi = 0; do { days ++; maxi = 0; REP(i, MAXN) { FOR(j, 1, MAXN - 1) { b[i][j] = a[i][j] + a[i][j - 1] + a[i][j + 1]; } REP(j, MAXN) { a[i][j] = b[i][j]; maxi = max(maxi, a[i][j]); } } } while (maxi < x); vector> candidates; REP(i, MAXN) REP(j, MAXN) { candidates.pb({a[i][j], {i * 2, j}}); } sort(candidates.begin(), candidates.end()); vector sol; while(candidates.size()) { auto pp = candidates.back(); candidates.pop_back(); if (pp.first == 0) continue; while (pp.first <= x) { x -= pp.first; sol.pb(pp.second); } } cout << sol.size() << " " << days << endl; for (auto pp : sol) { cout << pp.first << " " << pp.second << endl; } return 0; }