Company: Zeta_26june
Difficulty: medium
Bitwise Operations Count Problem Description Karan has two non-negative integers N and X. He now wants to find the number of integers K such that 0 ≤ K ≤ N, and (N ⊕ K) & X = 0. Note that '⊕' denotes the bitwise XOR operator and '&' denotes the bitwise AND operator. Help Karan in finding the total required count. Input Format: The first line of input will contain a single integer T, denoting the number of test cases. Each test case consists of a single line of input containing N and X denoting the two integers as described in the statement. Output Format: For each test case, output the total number of integers K which satisfy the requirements mentioned. Examples Example 1: Input: N = 4, X = 5 Output: 0 Explanation: For N=4, X=5, we need to find the number of K, which satisfy 0 ≤ K ≤ 4, and (4 ⊕ K) & 5 = 0. Let's check values of K from 0 to 3 (as shown in the original explanation): K=0 (000 2 ): (100 2 ⊕ 000 2 ) & 101 2 = 100 2 & 101 2 = 100 2 ≠ 0 K=1 (001 2 ): (100 2 ⊕ 001 2 ) & 101 2