import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
public class marbles {
public static void main(String[] args) throws Exception {
BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
//PrintWriter w = new PrintWriter(System.out);
int n = Integer.parseInt(r.readLine());
for (int i = 0; i < n; i++) {
String[] inputs = r.readLine().split(" ");
int spaces = Integer.parseInt(inputs[0]) - 1;
int bars = Integer.parseInt(inputs[1]) - 1;
System.out.println(choose(spaces, bars));
//w.println(choose(spaces, bars));
}
//w.flush();
System.exit(0);
}
public static long choose(int n, int k) {
long num = 1;
long denom = 1;
int diff = n - k;
for (int i = n; i > diff; i--) {
num *= i;
}
for (int i = 1; i <= k; i++) {
denom *= i;
}
return num/denom;
}
}
This code is giving me an NZEC error, but the only places where exceptions can possibly be thrown are in the input. What is wrong with the code?