NZEC error in java code for problems SUMTRIAN and SPOON

Following are the two codes that ran perfectly in my ide namely eclipse and also ran in online ide: ideone.com with correct output. However codechef gives NZEC error while there is no “division by zero” in any of the codes,which mainly causes NZEC (as mentioned in FAQ). I have also tried using try catch(as referred by FAQ) but result remains the same! No improvement!
HELP ME PLEASE!!!

http://ideone.com/Jprqlz

http://ideone.com/V6gqGW

whenever i got those errors i inserted my code in:
try{
//code here…
}catch(Exception err){return;}
and it worked (i mean WA,TLE,AC whatever…)

trust me i have tried that. i got it included under try catch blocks but its the same result. i presumed that it was caused in this line
System.out.println(e.getMessage());
then just wrote
e.getMessage(); changed class name to public class Main.changed IOException to just Exception(hoping that would work) yet i get nzec :frowning: any further suggestion?

@codegagu you are considering only the first character of the input as r, and only the last character as c. R,C can be upto 100. So if R is 100 you assume it to be 1. (in reference to the spoon problem)

here is a test case that causes RTE
http://ideone.com/Jprqlz#ul_inouterr

@aichemzee Thank you so much for paying detail to every minutiae of my code.What you have mentioned was actually creating the problem. :slight_smile: Now the problem is solved(no NZEC) after making the following changes:
String arrdim[]=br.readLine().split(" ");
int row=Integer.parseInt(arrdim[0]);
int column=Integer.parseInt(arrdim[1]);

But now i get a TLE :frowning: