Parse JSON Sergey Svistunov

Compute the total amount of non-canceled external USD transactions from a stream of JSON records as fast as possible.

Input: 1 000 000 JSON records on STDIN, one per line. Each record has the following structure:

{
    "user_id": 0,
    "currency": "USD",
    "transactions": [
        {
            "amount": 0,
            "to_user_id": 0,
            "canceled": false
        }
    ]
}
Field Constraints
user_id Integer, max 10 000
currency One of "GBP", "USD", "RUB", "JPY", "CHF"
transactions Array, max 10 elements
amount Integer, max 1000
canceled Boolean; may be omitted when false

Field order is not guaranteed within any object.

Output: The total amount of all transactions where:

  • record.currency == "USD"
  • transaction.to_user_id != record.user_id (external)
  • transaction.canceled is false or absent
Back to listApr 10, 2025 03:32NoSIMD_C#NoSIMD_C#Score: 27,517Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Apr 10, 2025 03:3227,391326,843,745250,249,00051,050,0002,523,136
2Apr 10, 2025 03:3227,432328,213,579250,793,00050,958,0002,514,944
3Apr 10, 2025 03:3227,499329,141,973238,596,00063,891,0002,519,040
4Apr 10, 2025 03:3227,512334,126,490251,696,00050,938,0002,408,448
5Apr 10, 2025 03:3227,517333,366,752241,747,00060,936,0002,449,408
6Apr 10, 2025 03:3227,523329,238,456234,807,00067,944,0002,519,040
7Apr 10, 2025 03:3227,549328,783,808258,031,00045,005,0002,433,024
8Apr 10, 2025 03:3227,561326,841,716252,140,00051,028,0002,400,256
9Apr 10, 2025 03:3227,567330,047,320255,204,00048,038,0002,392,064