#include <iostream>
#include <vector>
int main() {
int n, m;
std::cout << "Введите размерность массива (n m): ";
std::cin >> n >> m;
std::vector<std::vector<int>> array(n, std::vector<int>(m));
std::cout << "Введите элементы массива:\n";
for (int i = 0; i < n; ++i) {
for (int j = 0; j < m; ++j) {
std::cin >> array[i][j];
}
}
for (int i = 0; i < n; ++i) {
for (int j = 0; j < m; ++j) {
array[i][j] *= array[i][j]; // Квадрат элемента
}
}
std::cout << "Массив после замены элементов на их квадраты:\n";
for (const auto& row : array) {
for (const auto& elem : row) {
std::cout << elem << " ";
}
std::cout << std::endl;
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dmVjdG9yPgoKaW50IG1haW4oKSB7CiAgICBpbnQgbiwgbTsKICAgIHN0ZDo6Y291dCA8PCAi0JLQstC10LTQuNGC0LUg0YDQsNC30LzQtdGA0L3QvtGB0YLRjCDQvNCw0YHRgdC40LLQsCAobiBtKTogIjsKICAgIHN0ZDo6Y2luID4+IG4gPj4gbTsKCiAgICBzdGQ6OnZlY3RvcjxzdGQ6OnZlY3RvcjxpbnQ+PiBhcnJheShuLCBzdGQ6OnZlY3RvcjxpbnQ+KG0pKTsKICAgIHN0ZDo6Y291dCA8PCAi0JLQstC10LTQuNGC0LUg0Y3Qu9C10LzQtdC90YLRiyDQvNCw0YHRgdC40LLQsDpcbiI7CiAgICBmb3IgKGludCBpID0gMDsgaSA8IG47ICsraSkgewogICAgICAgIGZvciAoaW50IGogPSAwOyBqIDwgbTsgKytqKSB7CiAgICAgICAgICAgIHN0ZDo6Y2luID4+IGFycmF5W2ldW2pdOwogICAgICAgIH0KICAgIH0KCiAgICBmb3IgKGludCBpID0gMDsgaSA8IG47ICsraSkgewogICAgICAgIGZvciAoaW50IGogPSAwOyBqIDwgbTsgKytqKSB7CiAgICAgICAgICAgIGFycmF5W2ldW2pdICo9IGFycmF5W2ldW2pdOyAvLyDQmtCy0LDQtNGA0LDRgiDRjdC70LXQvNC10L3RgtCwC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