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 30, 2024 07:21NoSIMD_C#NoSIMD_C#Score: 29,649Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Nov 30, 2024 07:2129,090348,258,614268,992,00050,998,0002,441,216
2Nov 30, 2024 07:2029,196347,239,071272,135,00049,024,0002,465,792
3Nov 30, 2024 07:2029,208354,740,236267,409,00053,880,0002,437,120
4Nov 30, 2024 07:2129,649356,655,986264,109,00062,025,0002,433,024
5Nov 30, 2024 07:2129,953357,537,612259,590,00069,889,0002,347,008
6Nov 30, 2024 07:2030,073354,582,368279,831,00050,969,0002,473,984