100 atcoder#ARC144D. [ARC144D] AND OR Equation
[ARC144D] AND OR Equation
Score : points
Problem Statement
You are given positive integers and . Find the number, modulo , of integer sequences that satisfy all of the following conditions:
- for all non-negative integers ().
- $f(x) + f(y) = f(x \,\mathrm{AND}\, y) + f(x \,\mathrm{OR}\, y)$ for all non-negative integers and ()
Here, and denote the bitwise AND and OR, respectively.
Constraints
Input
Input is given from Standard Input in the following format:
Output
Print the number, modulo , of integer sequences that satisfy the conditions.
2 1
6
The following six integer sequences satisfy the conditions:
2 2
19
100 123456789123456789
34663745