Showing Runtime error while submitting, but output was correct on execution

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

class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{

         Scanner scanner = new Scanner(System.in);
        String[] test = new String[scanner.nextInt()];
        scanner.nextLine();
        for (int k = 0; k < test.length; k++) {
            int[] ee = new int[scanner.nextInt()];
            int[] cc = new int[scanner.nextInt()];
            scanner.nextLine();
            int[] dd = new int[ee.length];

            int d = 0;

            for (int i = 0; i < dd.length; i++) {
                dd[i] = scanner.nextInt();
                d += dd[i];
            }
            if (d <= cc.length) {
                test[k] = "Yes";
            } else {
                test[k] = "No";
            }
        }
        for (String s : test) {
            System.out.println(s);
        }
  
       
   
}

}

Hoping you’re trying to solve this problem.
1 ≤ C ≤ 10^9
This was mentioned in the constraints. I guess the following statement in your code is giving RTE.

Thanks

1 Like