Require help in code submission (code chef editor giving runtime error) Problem: LECANDY

import java.util.Scanner;

public class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
// BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
// String test_Cases = br.readLine();
// String[] inputLine1 = br.readLine().split(" “);
// String[] inputLine2 = br.readLine().split(” ");

// int t = Integer.parseInt(test_Cases);
// int n = Integer.parseInt(inputLine1[0]);
// int c = Integer.parseInt(inputLine1[1]);

	Scanner sc = new Scanner(System.in);
	int t = sc.nextInt();
	int n = sc.nextInt();
	int c = sc.nextInt();
	int[] arr = new int[n];
	for (int i = 0; i < n; i++)
	{
		arr[i] = sc.nextInt();
	}
	
	boolean flag = false;
	
	while (t != 0)
	{
	    for (int i = 0; i < arr.length; i++)
	    {
	    	int num = arr[i];
	        if (num >= i && c > num)
	        {
	        	c = c - num;
	            continue;
	        }
	        else
	        {
	            flag = true;
	            break;
	        }
	    }
	    if (!flag)
	    {
	        System.out.println("Yes");
	    }
	    else
	    {
	        System.out.println("No");    
	    }
	    t--;
	}
	
}

}

u should give custom input.(to avoid runtime error)

(hint: u can solve this question easily by taking sum of entire array and compare with c)