How to remove my NZEC error from this code?
import java.text.DecimalFormat;
import java.io.*;
class ATM
{
public static void main(String args[])throws IOException
{
Runtime Error(NZEC)
t=int(input())
a=[]
b=[]
c=[]
if t>=1 and t<=1000 :
for i in range(t):
a.append(int(input()))
b.append(int(input()))
if a[i]>=1 and a[i]<=10000 and b[i]>=1 and b[i]<=10000 :
c.append(a[i]+b[i])
for i in range(t):
print(c[i])
How can I solve this in codechef ?
I am also having the same problem of nzec in following program.
import java.util.*;
class Solution {
static long want = 0, red = 0;
static int i = 0;
static long[] a= new long[(int)10000];
static long[] b= new long[(int)10000];
static void marks(long e,long n) {
Scanner S = new Scanner(System.in);
if( n == 1) {
while( e > 1 ) {
long sum = S.nextLong();
a[i] = a[i] + sum;
e--;
}
}
else {
while( e > 0 ) {
long sum = S.nextLong();
a[i] = a[i] + sum;
e--;
}
}
i++;
}
static void sort() {
long temp = 0;
for ( int j = 0 ; j < i ; j++ ) {
for( int k = j+1 ; k < i ; k++ ) {
if( a[j] < a[k] ) {
temp = a[k];
a[k] =a[j];
a[j] = temp;
}
}
}
}
static void select(int k) {
int z = 0;
while ( k > 0 ) {
b[z] = a[k-1];
z++;
k--;
}
}
static long min(long k) {
if ( red > b[0] )
want = 0;
else if ( red == b[0] )
want = 1;
else
want = b[0] - red + 1;
return want;
}
public static void main(String[] args) {
Scanner S = new Scanner(System.in);
long t = S.nextLong();
while(t>0) {
for ( int l = 0 ; l < a.length ; l++ ){
a[l] = 0;
b[l] = 0;
}
i = 0;
want = 0;
red = 0;
long n = S.nextLong();
if( n < 1 || n > 10000 )
System.exit(0);
int k = S.nextInt();
if( n < 1 || n > 10000 )
System.exit(0);
long e = S.nextLong();
if( e < 1 || e > 4 )
System.exit(0);
long m = S.nextLong();
if( m < 1 || m > 1000000000 )
System.exit(0);
while( n > 0) {
marks(e,n);
n--;
}
red = a[i-1];
sort();
select(k);
long ans = min(k);
System.out.println(""+ans);
t--;
}
}
/* 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
{
BufferedReader p = new BufferedReader(new InputStreamReader(System.in));
int queries= Integer.parseInt(p.readLine());
int big,small;
for (int i =0;i<=queries;i++)
{
int a= Integer.parseInt(p.readLine());
int b= Integer.parseInt(p.readLine());
if(a>b)
{
big=a;
small=b;
}
else
{
big=b;
small=a;
}
if(a%2!=0 && b%2!=0)
{
if(a+2==b || a-2==b)
System.out.println("Yes");
}
else if (a%2==0 && b%2==0)
{
if(a+2==b || a-2==b)
System.out.println("Yes");
}
else if (big-small==1 && big%2==0)
System.out.println("Yes");
else
System.out.println("No");
}
/* 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
{
Scanner sc=new Scanner(System.in);
int x=sc.nextInt();
int y=sc.nextInt();
if (y>x)
{
double b=(y-x)-0.50;
System.out.println(b);
why does the following code give NZEC error ?
T = input()
N = [0 for i in range (0,T)]
P = [0 for i in range(T)]
res = [“no” for i in range(T)]
p = [0 for i in range(500)]
cc = [0 for i in range(500)]
ch = [0 for i in range(500)]
for i in range(0,T):
N[i] = input()
P[i] = input()
for j in range (0, N[i]):
p[j] = input()
if (p[j]>=(P[i]/2)):
cc[i] = cc[i]+1
elif (p[j]<=(P[i]/10)):
ch[i] = ch[i]+1
if((cc[i] == 1) and (ch[i] == 2)):
res[i] = “yes”
for i in range(0,T):
print res[i]
import java.io.;
import java.lang.;
public class sum
{
public static void main (String[] args)throws Exception
{
java.io.BufferedReader r = new java.io.BufferedReader (new java.io.InputStreamReader (System.in));
System.out.println(“Enter the number”);
int i=Integer.parseInt(r.readLine());
int sum=0;
for(int j=1;j<i;j++)
{
if(i%j==0)
{
sum+=j;
} }
System.out.println(sum);
}
}