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 listNov 16, 2024 16:26Dan StolyarovDan StolyarovScore: 2,815,091Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Nov 16, 2024 16:262,798,00213,747,403,75913,591,259,000118,949,0002,289,664
2Nov 16, 2024 16:262,807,50113,787,672,76413,643,816,000112,940,0002,281,472
3Nov 16, 2024 16:262,813,28913,821,084,41113,650,173,000134,942,0002,281,472
4Nov 16, 2024 16:262,813,82013,819,398,37213,649,790,000137,927,0002,289,664
5Nov 16, 2024 16:262,815,09113,828,856,66313,663,015,000130,933,0002,281,472
6Nov 16, 2024 16:262,815,91213,836,813,09113,665,038,000132,932,0002,289,664
7Nov 16, 2024 16:262,819,93313,854,270,46113,683,753,000133,919,0002,281,472
8Nov 16, 2024 16:262,820,96513,854,711,67113,679,805,000142,924,0002,281,472
9Nov 16, 2024 16:262,822,59713,860,925,79113,694,799,000135,928,0002,281,472