#include <stdio.h>

int main() {
    int m, n; // m for rows, n for columns

    printf("Enter the number of rows (m) and columns (n): ");
    scanf("%d %d", &m, &n);

    int matrix[m]; // Declare the 2D matrix

    printf("Enter the elements of the matrix:\n");
    for (int i = 0; i < m; i++) {
        for (int j = 0; j < n; j++) {
            scanf("%d", &matrix[i][j]);
        }
    }

    int maxSum = -2147483647; // Initialize with a very small number (minimum int value)
    int maxRowIndex = 0;

    for (int i = 0; i < m; i++) {
        int currentSum = 0;
        for (int j = 0; j < n; j++) {
            currentSum += matrix[i][j];
        }

        if (currentSum > maxSum) {
            maxSum = currentSum;
            maxRowIndex = i;
        }
    }

    printf("The index of the row with the maximum sum is: %d\n", maxRowIndex);

    return 0;
}