#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
void print_table(unsigned limit)
{
std::cout << '\n' << std::right << std::setw(5) << '|';
for (unsigned i = 1; i <= limit; ++i)
std::cout << std::setw(4) << i;
std::cout << '\n' << std::string(5 + 4 * limit, '-') << '\n';
for (unsigned i = 1; i <= limit; ++i)
{
std::cout << std::setw(4) << i << '|';
for (unsigned j = 1; j <= limit; ++j)
std::cout << std::setw(4) << i*j;
std::cout << '\n';
}
}
int main()
{
std::cout << "Limit?\n> ";
unsigned limit;
std::cin >> limit;
print_table(limit);
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8aW9tYW5pcD4KI2luY2x1ZGUgPHN0cmluZz4KI2luY2x1ZGUgPHZlY3Rvcj4KCgp2b2lkIHByaW50X3RhYmxlKHVuc2lnbmVkIGxpbWl0KQp7CiAgICBzdGQ6OmNvdXQgPDwgJ1xuJyA8PCBzdGQ6OnJpZ2h0IDw8IHN0ZDo6c2V0dyg1KSA8PCAnfCc7CiAgICBmb3IgKHVuc2lnbmVkIGkgPSAxOyBpIDw9IGxpbWl0OyArK2kpCiAgICAgICAgc3RkOjpjb3V0IDw8IHN0ZDo6c2V0dyg0KSA8PCBpOwogICAgc3RkOjpjb3V0IDw8ICdcbicgPDwgc3RkOjpzdHJpbmcoNSArIDQgKiBsaW1pdCwgJy0nKSA8PCAnXG4nOwoKICAgIGZvciAodW5zaWduZWQgaSA9IDE7IGkgPD0gbGltaXQ7ICsraSkKICAgIHsKICAgICAgICBzdGQ6OmNvdXQgPDwgc3RkOjpzZXR3KDQpIDw8IGkgPDwgJ3wnOwogICAgICAgIGZvciAodW5zaWduZWQgaiA9IDE7IGogPD0gbGltaXQ7ICsraikKICAgICAgICAgICAgc3RkOjpjb3V0IDw8IHN0ZDo6c2V0dyg0KSA8PCBpKmo7CiAgICAgICAgc3RkOjpjb3V0IDw8ICdcbic7CiAgICB9Cn0KCmludCBtYWluKCkKewogICAgc3RkOjpjb3V0IDw8ICJMaW1pdD9cbj4gIjsKCiAgICB1bnNpZ25lZCBsaW1pdDsKICAgIHN0ZDo6Y2luID4+IGxpbWl0OwoKICAgIHByaW50X3RhYmxlKGxpbWl0KTsKfQoK