Chef has two numbers NN and MM. Help Chef to find number of integer NN-tuples (A1,A2,…,AN)(A1,A2,…,AN) such that 0≤A1,A2,…,AN≤2M−10≤A1,A2,…,AN≤2M−1 and A1&A2&…&AN=0A1&A2&…&AN=0, where && denotes the bitwise AND operator.
Since the number of tuples can be large, output it modulo 109+7109+7.
For the work from home Internship Programs : Click here to apply now
- The first line contains a single integer TT denoting the number of test cases. The description of TT test cases follows.
- The first and only line of each test case contains two integers NN and MM.
For each test case, output in a single line the answer to the problem modulo 109+7109+7.
Subtask #1 (100 points): original constraints
4 1 2 2 2 4 2 8 4
1 9 225 228250597
Test Case 11: The only possible tuple is (0)(0).
Test Case 22: The tuples are (0,0)(0,0), (0,1)(0,1), (0,2)(0,2), (0,3)(0,3), (1,0)(1,0), (2,0)(2,0), (3,0)(3,0), (1,2)(1,2), (2,1)(2,1).
Due to copyright issues we won't be able to update the solution here immediately. However you can download the code file from our telegram channel. So join our telegram channel for further updates. Keep tracking, the solution will be updated on this website soon.
- HACKEREARTH IS HIRING FOR INTERN || APPLY NOW
- INTEL IS HIRING FOR SOFTWARE DEVELOPER INTERN || APPLY Now
- DATA SCIENCE INTERNSHIP | SONY RESEARCH INDIA || APPLY NOW
- CodeChef: June Challenge | Optimal Xor Set OPTSET | Python, Java, C++ Solution
- CodeChef: June Challenge | Minimum Subtree Cover | Python, Java, C++ Solution
- CodeChef: June Challenge | Minimum Dual Area DAREA| Python, Java, C++ Solutions
- CodeChef: June Challenge | Bitwise Tuples | BITTUP| Python, Java, C++ Solution
- CodeChef: June Challenge | Shortest Route | Full Solution
Read more post Here