This code works fine on eclipse and prints the correct output but here it's showing rum time error

import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.util.Scanner;

public class AverageofSlidingWindows {

public static class Queue {
	int front, ms, cs, rear;
	int[] arr;

	public Queue(int n) {
		arr = new int[n];
		cs = 0;
		ms = n;
		front = 0;
		rear = n - 1;
	}

	void push(int data) {
		if (cs == ms)
			return;
		rear = (rear + 1) % ms;
		arr[rear] = data;
		cs++;
	}

	void pop() {
		if (cs == 0)
			return;
		front = (front + 1) % ms;
		cs--;
	}

	boolean empty() {
		return cs == 0;
	}

	boolean full() {
		return cs == ms;
	}

	int front() {
		return arr[front];
	}

	int size() {
		return cs;
	}

}

public static void circularQueue(int k) {
	Scanner scn = new Scanner(System.in);
	DecimalFormat df = new DecimalFormat("#.0000");
	df.setRoundingMode(RoundingMode.CEILING);
	Queue q = new Queue(k);
	int sum = 0;
	int n = scn.nextInt();
	while (n != -1) {
		sum = sum + n;
		if (q.full()) {
			sum = sum - q.front();
			q.pop();
		}
		q.push(n);
		System.out.print(df.format((double) sum / q.size()) + " ");
		n = scn.nextInt();
	}
}

public static void main(String[] args) {

	Scanner scn = new Scanner(System.in);
	// size of the window
	int k = scn.nextInt();

	circularQueue(k);

}

}

@Utkarsh-Patiyal-2067329909961088 hey please check the input format you are giving as code is looking fine.

the input format seems fine to me too

@Utkarsh-Patiyal-2067329909961088 hey ,I have checked it ,it is running fine .

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.