xenny-and-counting

Xynazog was playing a game. He needed to score k points and he could play at most N moves and at least 1 move. In each move, he could get [0,k] points. Note: the number of points gained is always an integer.

Xynazog's friend PowerShell challenged Xenny to find the number of ways in which he could score k points in exactly N moves as per the given rules.

Input Format:

First line contains a natural no. T, denoting the no. of testcases.
Each of the following T lines contains 2 space-separated integers N and k.

Output Format:

Output the answer to each testcase on a new line.

Constraints:

1 ≤ T ≤ 100000

1 ≤ N,k ≤ 19

SAMPLE INPUT
1
2 2

SAMPLE OUTPUT
3

Explanation

Given k=2

k = 2 + 0
k = 0 + 2
k = 1 + 1

Source: hackerearth | Difficulty: UNKNOWN_DIFFICULTY


Solutions:
import math
def combinations(n,r):
	z=math.factorial(n)
	x=math.factorial(n-r)
	y=math.factorial(r)
	r=z/x
	r=r/y
	return r;
     
x=eval(input())
o=[]
for i in range(0,x):
	a,b=input().split()
	a=int(a)
	b=int(b)
	print((combinations(a+b-1,a-1)))


import math
def combinations(n,r):
	z=math.factorial(n)
	x=math.factorial(n-r)
	y=math.factorial(r)
	r=z/x
	r=r/y
	return r;
     
x=eval(input())
o=[]
for i in range(0,x):
	a,b=input().split()
	a=int(a)
	b=int(b)
	print((combinations(a+b-1,a-1)))


import math
def combinations(n,r):
	z=math.factorial(n)
	x=math.factorial(n-r)
	y=math.factorial(r)
	r=z/x
	r=r/y
	return r;
     
x=eval(input())
o=[]
for i in range(0,x):
	a,b=input().split()
	a=int(a)
	b=int(b)
	o.append(combinations(a+b-1,a-1))
	
for i in range(0,x):
	print(int(o[i]))