Fast Bit Counting

View as PDF

Submit solution

Points: 3 (partial)
Time limit: 0.5s
Memory limit: 64M

Problem type
Allowed languages
C, C++

Given 64-bit unsigned integers, count the bits set in each one.


One function:

int setbits(unsigned long long);

Your function may be called up to 10^8 times.


Your code must be less than 560 characters in length. 560 characters is plenty for any sane solution. Otherwise, only half of the points are awarded.


  • 0
    Dingledooper  commented on Aug. 12, 2023, 11:28 p.m.

    Is this intentional, or a fundamental flaw in the system?

    • 0
      BalintR  commented on Aug. 13, 2023, 11:19 a.m.

      The grader has been updated so that the grader's process never actually computes the answer. Similar exploits should no longer be possible.

  • 30
    d  commented on April 23, 2020, 6:34 p.m.

    • -14
      wleung_bvg  commented on June 15, 2020, 8:36 p.m.

      This comment is hidden due to too much negative feedback. Show it anyway.