fork(7) download
  1. #!/usr/bin/python
  2. import sys,ctypes
  3. if sys.version_info[0]>=3:
  4. raw_input=input
  5. xrange=range
  6.  
  7. if sys.platform=='linux':
  8. libc=ctypes.cdll.LoadLibrary('libc.so.6')
  9. popcount=lambda n:libc.__sched_cpucount(ctypes.sizeof(ctypes.c_long),(ctypes.c_long*1)(n))
  10. elif sys.platform=='darwin':
  11. libc=ctypes.cdll.LoadLibrary('libSystem.dylib')
  12. popcount=lambda n:libc.__popcountdi2(n)
  13. else:
  14. popcount=lambda n:0 if n==0 else popcount(n/2)+n%2
  15.  
  16. print(1<<popcount(int(raw_input())))
Success #stdin #stdout 0.02s 9312KB
stdin
98765432
stdout
8192