Help me in solving ZCO14001 problem

My code

``````#include <iostream>
#include<bits/stdc++.h>
#define int long long
int row[100001];
using namespace std;

int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);

int n;
int h;
cin>>n>>h;
for(int i=0;i<n;i++)
{
cin>>row[i];
}
int flag=1;
int command=-1;
int now=0;
while(command!=0)
{
cin>>command;
if(command==1)
{
if(now!=0)
now--;
}
if(command==2)
{
if(now!=n-1)
{
now++;
}
}
if(command==3)
{
if(flag!=0 && row[now]>0)
{
flag=0;
row[now]--;

}
}
if(command==4)
{
if(flag=0 && row[now]<h)
{
flag=1;
row[now]++;
}
}
}
for(int i=0;i<n;i++)
{
cout<<row[i];
}

return 1;
}

``````

Problem Link: CodeChef: Practical coding for everyone

@neelakshi12
have corrected your code just two little mistakes.
include
#include<bits/stdc++.h>
int row[100001];
using namespace std;

int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);

int n;
int h;
cin>>n>>h;
for(int i=0;i<n;i++)
{
cin>>row[i];
}
int flag=1;
int command;
int now=0;
while(cin>>command)
{
if(command==1)
{
if(now!=0)
now–;
}
if(command==2)
{
if(now!=n-1)
{
now++;
}
}
if(command==3)
{
if(flag!=0 && row[now]>0)
{
flag=0;
row[now]–;

``````    }
}
if(command==4)
{
if(flag==0 && row[now]<h)
{
flag=1;
row[now]++;
}
}
``````

}
for(int i=0;i<n;i++)
{
cout<<row[i]<<" ";
}

return 0;
}