calculate the combinatorial
Golfscript, 31 characters
n%(;{~.@.@-]{1\,{)*}/}%~/\/}%n*

Explanation:

n/(;{...}%n* splits the input by a newline, discards the first row (number of testcases), maps the rest and finally joins by a newline.

~.@.@- evals the input, rearranges it to r n n r, then subtracts r from n.
]{...}%~ collects everything on the stack into and array, maps it and explodes the array

1\,{)*}/ is the factorial function: push a 1 below the number, then create an array 0...n, then for each element, multiply the accumulator by the value + 1. The map-reduce implementation is one char longer: ,{)}%{*}*


/\/ divides n! first by factorial of the difference, then by r!.