#K72537. Ordered Pairs and Bitwise Operations

    ID: 33775 Type: Default 1000ms 256MiB

Ordered Pairs and Bitwise Operations

Ordered Pairs and Bitwise Operations

Given two integers N and M, determine the number of ordered pairs ((i, j)) such that (1 \le i \le j \le N) and the bitwise AND of (i) and (j) is greater than their bitwise OR, i.e., (i & j > i | j). Note that for any two integers, the bitwise AND operation always results in a value less than or equal to the bitwise OR operation. Hence, no such pairs exist, and the answer is always 0. The answer should be printed modulo (M).

Input: Two integers N and M separated by a space.
Output: A single integer representing the count of such pairs modulo M.

inputFormat

Standard input contains two space-separated integers: N (the upper limit for the indices) and M (the modulo value).

outputFormat

Standard output should contain a single integer: the number of ordered pairs that satisfy the condition, modulo M. Since no valid pair exists, the output will always be 0.## sample

4 1000000007
0

</p>