http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=1574
from functools import reduce
from math import factorial
from operator import mul
def comb(m, n):
if 0 == n or m == n:
return 1
if m - n > n:
n = m - n
return reduce(mul, range(n + 1, m + 1)) // reduce(mul, range(1, m - n + 1))
n = int(input())
for i in range(n):
a, b = input().split()
a = int(a)
b = int(b)
print(factorial(a) // factorial(a - b) // factorial(b))
print(comb(a, b))
http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=2543
n = int(input())
print(n // 5 + n // 6 + n // 8 - n // 30 - n // 40 - n // 24 + n // 120)
http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=1064
def fn(n):
ret = []
i = 0
while n:
if n & 1:
ret.append(str(i))
n >>= 1
i += 1
return ret
n = int(input())
for i in range(n):
print(' '.join(fn(int(input()))))