In eclipse ide my code gives correct output and hackerblocks ide gives error why?

ProblemLink:-https://online.codingblocks.com/app/player/183619/content/174146/4692/code-challenge

Code:-
import java.util.Scanner;

public class Main {

public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	int num = sc.nextInt();
	while (num != 0) {
		int n = sc.nextInt();
		System.out.println(binaryToDecimal(n));
	}
}

public static int binaryToDecimal(int n) {
	int num = n;
	int dec_value = 0;
	int base = 1;
	int temp = num;
	while (temp > 0) {
		int last_digit = temp % 10;
		temp = temp / 10;
		dec_value += last_digit * base;
		base = base * 2;
	}
	return dec_value;
}

}

Error:-
Exception in thread β€œmain” java.util.NoSuchElementException
at java.util.Scanner.throwFor(Scanner.java:862)
at java.util.Scanner.next(Scanner.java:1485)
at java.util.Scanner.nextInt(Scanner.java:2117)
at java.util.Scanner.nextInt(Scanner.java:2076)
at Main.main(Main.java:7)