DCEPC13D  The Ultimate Riddle
The Joker has played his cards again. This time he has chosen to attack DCE Coders. Gitanshu, and other coders have been abducted.
Mishra has solved the first part of the riddle and estimated N locations. Now, it's up to you to choose R locations among these N.
Calculate the number of ways you can chose the R locations. Since the answer can be large calculate the answer modulo M.
Input
First line contains T number of testcases.
Each line contains 3 integers N, R, M.
Output
Output the required answer
Constraints
1 <= T <= 10^{4}
1 <= M <= 10^{9}
1 <= R <= N <= 10^{9}
M is a squarefree number having prime factors less than 50.
Example
Input: 4 5 2 1001 5 2 6 20 6 210 13 4 39 Output: 10 4 120 13
hide comments
codephilic:
20201004 07:53:56
using CRT!! 

nimphy:
20180519 17:23:54
lucas！ 

RIVU DAS:
20150508 07:07:22
Time limit is too strict for python!! 

dce coders:
20150502 12:33:06
@Min_25 You are right, there was a problem in an input file.


Min_25:
20150502 11:50:10
@dce coders


asgerix:
20150330 10:46:29
A hint to others: Check for empty lines in the input file, and output 0 as answer for these. 

Min_25:
20150320 04:08:29
@dce coders


asgerix:
20150319 15:51:04
Could there be a problem with the input data?

Added by:  dce coders 
Date:  20150307 
Time limit:  1s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All except: ASM64 JSMONKEY 
Resource:  dce_coders 