#include <iostream>
#include <vector>
#include <cmath>
typedef std::vector<std::pair<int, int>> DType;
DType MakeHoge(std::size_t X, std::size_t Y){
double A = Y / static_cast<double>(X);//x=0 is die!LOL!!
DType R;
double YY = Y;
double XX = X;
for (std::size_t i = 1; i <= X; i++){
YY = i*A;
if (YY == std::ceil(YY)){
XX = i;
break;
}
}
for (std::size_t i = 1; i*XX <= X; i++){
R.push_back(std::make_pair(i*XX, i*YY));
}
R.push_back(std::make_pair(X,Y));
return R;
}
bool Show(DType& D){
std::cout << "a=" << D.back().first << " b=" << D.back().second << std::endl;
D.pop_back();
for (auto& o : D) std::cout << o.first << ' ' << o.second<< std::endl;
return true;
}
int main(){
auto R = MakeHoge(54, 66);
Show(R);
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dmVjdG9yPgojaW5jbHVkZSA8Y21hdGg+Cgp0eXBlZGVmIHN0ZDo6dmVjdG9yPHN0ZDo6cGFpcjxpbnQsIGludD4+IERUeXBlOwoKRFR5cGUgTWFrZUhvZ2Uoc3RkOjpzaXplX3QgWCwgc3RkOjpzaXplX3QgWSl7Cglkb3VibGUgQSA9IFkgLyBzdGF0aWNfY2FzdDxkb3VibGU+KFgpOy8veD0wIGlzIGRpZSFMT0whIQoJRFR5cGUgUjsKCWRvdWJsZSBZWSA9IFk7Cglkb3VibGUgWFggPSBYOwoJZm9yIChzdGQ6OnNpemVfdCBpID0gMTsgaSA8PSBYOyBpKyspewoJCVlZID0gaSpBOwoJCWlmIChZWSA9PSBzdGQ6OmNlaWwoWVkpKXsKCQkJWFggPSBpOwoJCQlicmVhazsKCQl9Cgl9Cglmb3IgKHN0ZDo6c2l6ZV90IGkgPSAxOyBpKlhYIDw9IFg7IGkrKyl7CgkJUi5wdXNoX2JhY2soc3RkOjptYWtlX3BhaXIoaSpYWCwgaSpZWSkpOwoJfQoJUi5wdXNoX2JhY2soc3RkOjptYWtlX3BhaXIoWCxZKSk7CgoJcmV0dXJuIFI7Cn0KC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