fork download
  1. def g(x):
  2. while x:
  3. while 1 - (1 + ~int(x % -2)) & 1: x //= -2
  4. break
  5. while 1-x:
  6. return 0
  7. return 5
  8.  
  9. for num in range(-32,32):
  10. print num, g(num)
Success #stdin #stdout 0s 23352KB
stdin
Standard input is empty
stdout
-32 5
-31 0
-30 0
-29 0
-28 0
-27 0
-26 0
-25 0
-24 0
-23 0
-22 0
-21 0
-20 0
-19 0
-18 0
-17 0
-16 0
-15 0
-14 0
-13 0
-12 0
-11 0
-10 0
-9 0
-8 5
-7 0
-6 0
-5 0
-4 0
-3 0
-2 5
-1 0
0 0
1 5
2 0
3 0
4 5
5 0
6 0
7 0
8 0
9 0
10 0
11 0
12 0
13 0
14 0
15 0
16 5
17 0
18 0
19 0
20 0
21 0
22 0
23 0
24 0
25 0
26 0
27 0
28 0
29 0
30 0
31 0