File or terminal?

I’m currently trying to solve Haybale Stacking. You can find this problem in Silver -> prefix sum -> last problem on the first list of problems. It directs me to Sphere Online Judge. I was wondering if you submit your code with terminal or with a file.

This is my code so far.

import java.util.Arrays;
import java.util.Scanner;
public class Haybale_Stacking {
public static void main(String[] args) {
Scanner sc1 = new Scanner(;

	int stacks = sc1.nextInt();
	int instructions = sc1.nextInt();
	int start = 0;
	int end = 0;
	int[] bales = new int[stacks];
	for(int x = 0; x < instructions;x++) {
		start = sc1.nextInt();
		end = sc1.nextInt();
		for(int y = start; y <= end;y++) {
			bales[y-1] ++;



So… what’s your question?

Do we submit the code with like I did, or is there a file?

In the problem in USACO guide, the problem has a file, but nothing is specified in sphere. I put that in the about post too.

This is for using sphere, not the USACO website.

Try both…

tried and got compilation error… Everything works in Eclipes… Also what would the file name be. Heres the link,

Probably the same as the one provided by USACO… and haybale.out

Please format your code properly, as described at:

No, it’s stdin / stdout …

You need to start your class with class Main (or public class Main), like the example code shown below:

Thank you!