Please tell me, what's the problem in this code? 3/4 test cases are getting passed

#include <iostream>
#define size 10

int main() {
    int M = 0, N = 0, arr[size][size];
    std::cin >> M >> N;
    for (int i = 0; i < M; ++i)
        for (int j = 0; j < N; ++j) std::cin >> arr[i][j];
    int start_row = 0, end_row = M - 1, start_col = 0, end_col = N - 1;
    while (start_row <= end_row && start_col <= end_col) {
        for (int i = start_row; i <= end_row; ++i)
            if (start_col < end_col) std::cout << arr[i][start_col] << ", ";
        start_col++;
        for (int i = start_col; i <= end_col; ++i)
            if (start_row < end_row) std::cout << arr[end_row][i] << ", ";
        end_row--;
        for (int i = end_row; i >= start_row; --i)
            std::cout << arr[i][end_col] << ", ";
        end_col--;
        for (int i = end_col; i >= start_col; --i)
            std::cout << arr[start_row][i] << ", ";
        start_row++;
    }
    std::cout << "END";
    return 0;
}

if (start_col <= end_col)// <= here in condn

if (start_row <= end_row) // <= here in condn

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.