#include "helper.h"

constexpr int kMaxX = 1'000'000'000;

int main(int argc, char* argv[]) {
    registerGen(argc, argv, 1);

    int n = opt<int>("n");
    int g = opt<int>("g");
    int cf = 2;
    if (has_opt("cf")) {
        cf = opt<int>("cf");
    }
    bool group_triangle = opt<bool>("group_triangle");

    auto poly = random_polygon(cf * n, int(kMaxX * 0.99));

    int cnt_positive = 0;
    for (const auto& p : poly) {
        if (p.x + p.y >= 0) {
            cnt_positive++;
        }
    }
    if (cnt_positive < n) {
        for (auto& p : poly) {
            p.x = -p.x;
            p.y = -p.y;
        }
    }
    auto old_poly = poly;
    poly.clear();
    for (const auto& p : old_poly) {
        if (p.x + p.y >= 0) {
            poly.emplace_back(p);
        }
    }

    shuffle(poly.begin(), poly.end());
    poly.resize(n);
    if (group_triangle) {
        poly.resize(n - 3);
        poly.emplace_back(-kMaxX, kMaxX);
        poly.emplace_back(kMaxX, -kMaxX);
        poly.emplace_back(kMaxX, kMaxX);
    }
    shuffle(poly.begin(), poly.end());

    println(n, g);
    for (int i = 0; i < n; i++) {
        println(poly[i].x, poly[i].y);
    }

    return 0;
}