Getting NZEC

import java.util.;
import java.lang.
;
import java.io.*;

/* Name of the class has to be “Main” only if the class is public. */
class Codechef
{
public static void main(String[] args)throws java.lang.Exception
{
// your code goes here
int i,j;
int c,status=0;
Scanner s = new Scanner(System.in);
i= s.nextInt();
j=s.nextInt();
int a[]= new int[i];
for(int k=0;k<i;k++)
{
if(s.hasNextInt())
a[k]=s.nextInt();
}
int k=0;

c=s.nextInt();
while(c!=0)
{
  switch(c)
  {
    case 1:
      if(k>0)
      k--;
      break;
    case 2:
      if(k<i-1)
      k++;
      break;
    case 3:
      if(a[k]>0&&status==0)
      {a[k]--;
      status =1;}
      break;
    case 4:
      if(a[k]<j&&status==1)
      {
        a[k]++;
        status =0;
      }
      break;
  }
  c=s.nextInt();
}
for( j=0;j<i;j++)
{
  System.out.print(a[j]+" ");
}

}

}

Please either format your code or link to your submission - the forum software has mangled it and it won’t compile! :slight_smile:

Also - what problem are you trying to solve?

ZCO14001

i am not getting what u told

it is working on repl as well