My sample output is coming out the same still its not accepted

#include<bits/stdc++.h>
using namespace std;
int main() {
int m,n;
cin>>m>>n;
int a[m][n];
for(int i = 0;i<m;i++)
{
for(int j = 0;j<n;j++)
{
cin>>a[i][j];
}
}

for(int i = 0;i<n;i++)
{
	if(i%2==1)
	{
		for(int j = n-1;j>=0;j--)
		{
			cout<<a[j][i]<<", ";
		}
	}else
	{
		for(int j = 0;j<n;j++)
		{
			cout<<a[j][i]<<", ";
		}
	}
}
cout<<"END";
return 0;

}

your code doesn’t work for cases with n!=m