CodeChef is broken

Just try to run this code in the Problem: HS08TEST

It gives a runtime error of NZEC but when I submitted it. CodeChef accepted the code. CodeChef is broken. This wasted my 2 days and now I won’t be using this platform.

import java.util.;
import java.lang.
;
import java.io.;
import java.text.
;

/* 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 amount;
double balance;
Scanner scanner = new Scanner(System.in);
amount = scanner.nextInt();
balance = scanner.nextDouble();
DecimalFormat df = new DecimalFormat("###.00");
if((amount>0 && amount<=2000) && (balance>=0 && balance<=2000)){
if(amount%5==0 && amount<=balance && (amount+0.5<=balance)){
balance = balance-amount;
balance = balance-0.50;
System.out.println(df.format(balance));
}
else{
System.out.println(df.format(balance));
}
}else{
System.out.println(df.format(balance));
}

}

}

Running without input it does give random error sometimes, and that is not a problem ,you have to give custom input before you run on codechef ide.

1 Like

bhai, if you run this code on codechef ide then you have to give custom inputs, otherwise it will give you NZEC, i also wasted so many days figuring this out.
so, whenever you run any code, and if it requires any input(like amount and balance is required in your code) then do give custom input then run, else directly try to submit.

provide custom input before running the program.