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 listNov 10, 2024 10:06NoSIMD_C#NoSIMD_C#Score: 29,736Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Nov 10, 2024 10:0629,629350,760,382271,934,00053,987,0002,449,408
2Nov 10, 2024 10:0629,629344,543,903270,937,00054,987,0002,510,848
3Nov 10, 2024 10:0629,675358,042,746273,514,00052,906,0002,322,432
4Nov 10, 2024 10:0629,711350,055,836281,843,00044,975,0002,519,040
5Nov 10, 2024 10:0629,736353,142,753269,075,00058,016,0002,314,240
6Nov 10, 2024 10:0629,736345,356,069275,078,00052,014,0002,539,520
7Nov 10, 2024 10:0629,856356,287,354271,516,00056,898,0002,449,408
8Nov 10, 2024 10:0629,857357,045,956271,529,00056,901,0002,433,024
9Nov 10, 2024 10:0630,192361,091,027270,276,00061,834,0002,367,488