The sample is running fine, but the test cases are failing

#include
using namespace std;
int main() {
int row, col;
cin>>row>>col;
int arr[row][col];
for(int i=0;i<row;i++)
{
for(int j=0;j<col;j++)
{
cin>>arr[i][j];
}
}
for(int i=0;i<row;i++)
{
if ((i%2)==0)
{
for(int j=0; j<col; j++)
{
cout<<arr[j][i]<<", β€œ;
}
}
else
{
for(int j=col-1; j>=0; j–)
{
cout<<arr[j][i]<<”, ";
}
}
}
cout<<β€œEND”<<endl;
return 0;
}

hi @varun.saxena
your code will run only when row==col
you can check this at your own

modified code