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 20, 2024 05:25NoSIMD_C#NoSIMD_C#Score: 29,414Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Nov 20, 2024 05:2529,180354,143,216269,985,00050,997,0002,318,336
2Nov 20, 2024 05:2529,331354,070,260268,702,00053,940,0002,445,312
3Nov 20, 2024 05:2529,384348,579,718281,197,00042,029,0002,326,528
4Nov 20, 2024 05:2529,412349,982,457263,621,00059,913,0002,457,600
5Nov 20, 2024 05:2529,414347,929,947269,626,00053,925,0002,445,312
6Nov 20, 2024 05:2529,480351,125,762276,235,00048,040,0002,412,544
7Nov 20, 2024 05:2529,480353,081,868261,423,00062,861,0002,441,216
8Nov 20, 2024 05:2529,529350,061,219270,845,00053,969,0002,404,352
9Nov 20, 2024 05:2529,609350,451,652272,751,00052,951,0002,293,760