#include <iostream>
#include <cstdlib>
#include <ctime>

int main() {
    int arr1[5][10];
    int arr2[5][5];

    std::srand(static_cast<unsigned int>(std::time(0)));

    for (int i = 0; i < 5; ++i) {
        for (int j = 0; j < 10; ++j) {
            arr1[i][j] = std::rand() % 51;
        }
    }

    for (int i = 0; i < 5; ++i) {
        arr2[i][0] = arr1[i][0] + arr1[i][1];
        arr2[i][1] = arr1[i][2] + arr1[i][3];
        arr2[i][2] = arr1[i][4] + arr1[i][5];
        arr2[i][3] = arr1[i][6] + arr1[i][7];
        arr2[i][4] = arr1[i][8] + arr1[i][9];
    }

    std::cout << "Первый массив (5x10):" << std::endl;
    for (int i = 0; i < 5; ++i) {
        for (int j = 0; j < 10; ++j) {
            std::cout << arr1[i][j] << " ";
        }
        std::cout << std::endl;
    }

    std::cout << "Второй массив (5x5):" << std::endl;
    for (int i = 0; i < 5; ++i) {
        for (int j = 0; j < 5; ++j) {
            std::cout << arr2[i][j] << " ";
        }
        std::cout << std::endl;
    }

    return 0;
}

