#include <iostream>

void remove_column(int** matrix, int rows, int cols, int column_index, int**& new_matrix) {
    new_matrix = new int*[rows];
    for (int i = 0; i < rows; ++i) {
        new_matrix[i] = new int[cols - 1];
        for (int j = 0; j < column_index; ++j) {
            new_matrix[i][j] = matrix[i][j];
        }
        for (int j = column_index + 1; j < cols; ++j) {
            new_matrix[i][j - 1] = matrix[i][j];
        }
    }
}

int main() {
    int rows = 3, cols = 3;
    int** matrix = new int*[rows];
    for (int i = 0; i < rows; ++i) {
        matrix[i] = new int[cols];
    }

    matrix[0][0] = 1; matrix[0][1] = 2; matrix[0][2] = 3;
    matrix[1][0] = 4; matrix[1][1] = 5; matrix[1][2] = 6;
    matrix[2][0] = 7; matrix[2][1] = 8; matrix[2][2] = 9;

    int column_index = 1;
    int** new_matrix;

    remove_column(matrix, rows, cols, column_index, new_matrix);

    for (int i = 0; i < rows; ++i) {
        for (int j = 0; j < cols - 1; ++j) {
            std::cout << new_matrix[i][j] << " ";
        }
        std::cout << std::endl;
    }

    for (int i = 0; i < rows; ++i) {
        delete[] matrix[i];
        delete[] new_matrix[i];
    }
    delete[] matrix;
    delete[] new_matrix;

    return 0;
}

