#include <iostream>
#include <vector>
using namespace std;
int main()
{
vector<vector<double>>out = {{1,2}, {3,4}, {5,6}};
std::cout << "out: \n";
for(size_t i=0; i<out.size(); ++i)
{
for(size_t j=0; j<out[0].size(); ++j)
std::cout << out[i][j] << ' ';
std::cout << '\n';
}
vector<vector<double>> outtrans(out[0].size(),
vector<double>(out.size()));
for (size_t i = 0; i < out.size(); ++i)
for (size_t j = 0; j < out[0].size(); ++j)
outtrans[j][i] = out[i][j];
std::cout << "outtrans: \n";
for(size_t i=0; i<outtrans.size(); ++i)
{
for(size_t j=0; j<outtrans[0].size(); ++j)
std::cout << outtrans[i][j] << ' ';
std::cout << '\n';
}
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dmVjdG9yPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwppbnQgbWFpbigpCnsKICAgIHZlY3Rvcjx2ZWN0b3I8ZG91YmxlPj5vdXQgPSB7ezEsMn0sIHszLDR9LCB7NSw2fX07CgogICAgc3RkOjpjb3V0IDw8ICJvdXQ6IFxuIjsKICAgIGZvcihzaXplX3QgaT0wOyBpPG91dC5zaXplKCk7ICsraSkKICAgIHsKICAgICAgICBmb3Ioc2l6ZV90IGo9MDsgajxvdXRbMF0uc2l6ZSgpOyArK2opCiAgICAgICAgICAgIHN0ZDo6Y291dCA8PCBvdXRbaV1bal0gPDwgJyAnOwogICAgICAgIHN0ZDo6Y291dCA8PCAnXG4nOwogICAgfQoKICAgIHZlY3Rvcjx2ZWN0b3I8ZG91YmxlPj4gb3V0dHJhbnMob3V0WzBdLnNpemUoKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmVjdG9yPGRvdWJsZT4ob3V0LnNpemUoKSkpOwogICAgZm9yIChzaXplX3QgaSA9IDA7IGkgPCBvdXQuc2l6ZSgpOyArK2kpCiAgICAgICAgZm9yIChzaXplX3QgaiA9IDA7IGogPCBvdXRbMF0uc2l6ZSgpOyArK2opCiAgICAgICAgICAgIG91dHRyYW5zW2pdW2ldID0gb3V0W2ldW2pdOwoKICAgIHN0ZDo6Y291dCA8PCAib3V0dHJhbnM6IFxuIjsKICAgIGZvcihzaXplX3QgaT0wOyBpPG91dHRyYW5zLnNpemUoKTsgKytpKQogICAgewogICAgICAgIGZvcihzaXplX3Qgaj0wOyBqPG91dHRyYW5zWzBdLnNpemUoKTsgKytqKQogICAgICAgICAgICBzdGQ6OmNvdXQgPDwgb3V0dHJhbnNbaV1bal0gPDwgJyAnOwogICAgICAgIHN0ZDo6Y291dCA8PCAnXG4nOwogICAgfQp9Cg==