Checklist
Make sure to read all of How to ask for help on a problem before asking for help.
Problem Info
USACO 2023 February Contest, Bronze
Problem 3. Watching Mooloo
https://usaco.org/index.php?page=viewproblem2&cpid=1301
Question
Why is stdout empty?
What I’ve Tried
I’ve tried moving the System.out.println() everywhere in the main function, and i have tried flushing it, I always get this error

My Work
import java.util.*;
import java.io.*;
public class WatchingMooloo {
    public static void main(String[] args) throws Exception{
        System.out.println("Hello");
        System.out.flush();
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] temp = br.readLine().split(" ");
        int numOfNums = Integer.parseInt(temp[0]);
        int kVal = Integer.parseInt(temp[1]);
        String[] vals = br.readLine().split(" ");
        long last = Long.parseLong(vals[0]);
        long answer = kVal+1;
        for(int i = 1; i < numOfNums; i++) {
            long curr = Long.parseLong(vals[i]);
            answer += Math.min(kVal + 1, curr-last);
            last = curr;
        }
        System.out.println(answer);
        System.out.println("HELP WHY IS NOTHING BEING PRINTED");
        System.out.flush();
    }
}
My algorithm works fine when ran locally

