Format integers Sergey Svistunov

Compute a checksum over the decimal representations of binary integers as fast as possible.

Input: 250 000 000 uint32 values in little-endian binary on STDIN (4 bytes each).

Output: A uint64 checksum computed as:

CRC = sum of number_crc(n) for each n

where number_crc(n) converts n to its decimal string and sums ascii(digit) * position over each digit (0-indexed from the left).

Example: For n = 42, the decimal string is "42", so number_crc(42) = ascii('4') * 0 + ascii('2') * 1 = 52 * 0 + 50 * 1 = 50.

Back to listDec 29, 2024 03:01Joad NacerJoad NacerError
Source Code

Source code access is restricted. Log in to request access.

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Dec 29, 2024 03:0000000Error: expected "560382819572 ", got "558503771380 "stderr
2Dec 29, 2024 03:0000000Error: expected "560374121515 ", got "560367043627 "stderr
3Dec 29, 2024 03:01144,671733,784,542707,889,000999,0002,531,328
4Dec 29, 2024 03:01144,683737,542,690707,946,000999,0002,424,832
5Dec 29, 2024 03:01144,697728,358,059707,016,0002,000,0002,424,832
6Dec 29, 2024 02:59144,753738,377,756707,291,0001,997,0002,531,328
7Dec 29, 2024 02:59144,770736,360,539708,376,000999,0002,531,328
8Dec 29, 2024 02:59144,779735,084,808708,417,000999,0002,269,184
9Dec 29, 2024 02:59144,783735,339,706708,437,000999,0002,428,928
10Dec 29, 2024 03:01144,785740,580,071707,450,0001,998,0002,269,184
11Dec 29, 2024 02:59144,814734,952,309708,591,000999,0002,416,640
12Dec 29, 2024 03:01144,817731,874,503707,606,0001,998,0002,269,184
13Dec 29, 2024 02:59144,831731,499,492708,672,000999,0002,424,832
14Dec 29, 2024 03:01144,838736,017,459708,706,000999,0002,428,928
15Dec 29, 2024 02:59144,838736,886,521707,709,0001,999,0002,269,184
16Dec 29, 2024 03:01144,843734,151,907707,730,0001,999,0002,420,736
17Dec 29, 2024 03:01144,850729,237,154708,768,000999,0002,531,328
18Dec 29, 2024 02:59144,854730,613,689708,786,000999,0002,424,832
19Dec 29, 2024 02:59144,858732,616,116708,807,000999,0002,531,328
20Dec 29, 2024 03:01144,861732,656,870709,817,00002,531,328
21Dec 29, 2024 03:01144,866737,900,786709,841,00002,428,928
22Dec 29, 2024 03:01147,934751,710,056723,876,000999,0002,416,640
23Dec 29, 2024 03:01155,991785,121,699762,356,0001,998,0002,424,832