About the code we submit

#include<bits/stdc++.h>
using namespace std;
int main()
{
int arr[10][10],M,N;
int i, j = 0, wave = 1;
cin>>M>>N;
for(int k=0;k<M;k++)
{
for(int l=0;l<N;l++)
{
cin>>arr[k][l];
}
}
while (j <= (N-1)) {
if (wave == 1) {
for (i = 0; i < M; i++)
cout << arr[i][j] << “,”;

		wave = 0;
		j++;
	}
	else {
		for (i = M - 1; i >= 0; i--)
			cout << arr[i][j] << ",";

		wave = 1;
		j++;
	}
}

cout<<“END”;
return 0;
}

Now what is the problem in this code why it is not submitting???

These are the inputs- 4 4 11 12 13 14 21 22 23 24 31 32 33 34 41 42 43 44

this is output- 11,21,31,41,42,32,22,12,13,23,33,43,44,34,24,14,END

I have done it according to the questions then why?