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 listFeb 28, 2025 05:23NoSIMD_C#NoSIMD_C#Score: 27,899Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Feb 28, 2025 05:2327,719326,787,006257,922,00046,985,0002,400,256
2Feb 28, 2025 05:2327,737334,628,032243,084,00062,021,0002,310,144
3Feb 28, 2025 05:2327,760334,692,774248,297,00057,068,0002,396,160
4Feb 28, 2025 05:2327,783332,897,012255,676,00049,936,0002,351,104
5Feb 28, 2025 05:2327,899336,750,174247,907,00058,978,0002,514,944
6Feb 28, 2025 05:2327,931337,030,373262,203,00045,034,0002,400,256
7Feb 28, 2025 05:2327,954336,595,727247,595,00059,902,0002,314,240
8Feb 28, 2025 05:2328,016334,266,597261,152,00047,027,0002,519,040
9Feb 28, 2025 05:2328,208364,949,912249,820,00060,472,0002,338,816