#include using namespace std; using ll = long long; // This is an implementation of Paul's solution as described in the README. struct pt { ll v[3]; }; // This just permutes the axes of the points in pts so they fit in the input rectangl-oid. void fix_and_print(const vector& pts, ll in[3]) { ll p[3] = {0, 1, 2}; do { bool ok = true; for (pt vtx : pts) ok = ok && vtx.v[p[0]] <= in[0] && vtx.v[p[1]] <= in[1] && vtx.v[p[2]] <= in[2]; if (ok) break; } while (next_permutation(p, p+3)); cout << pts.size() << '\n'; for (pt vtx : pts) cout << vtx.v[p[0]] << ' ' << vtx.v[p[1]] << ' ' << vtx.v[p[2]] << '\n'; exit(0); } void sort(ll &a, ll &b, ll &c) { if (a > b) swap(a, b); if (b > c) swap(b, c); if (a > b) swap(a, b); } void tetra_corner(vector& pts, ll cx, ll cy, ll cz, ll rx, ll ry, ll rz) { pts.push_back(pt{cx ? cx - rx : rx, cy, cz}); pts.push_back(pt{cx, cy ? cy - ry : ry, cz}); pts.push_back(pt{cx, cy, cz ? cz - rz : rz}); } struct Option { ll prod, x, y, z; }; vector