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 12, 2024 16:52NoSIMD_C#NoSIMD_C#Score: 29,373Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Nov 12, 2024 16:5229,180342,570,111270,981,00049,996,0002,351,104
2Nov 12, 2024 16:5229,236350,356,734268,664,00052,933,0002,482,176
3Nov 12, 2024 16:5229,284352,141,566265,104,00057,022,0002,297,856
4Nov 12, 2024 16:5229,287349,175,068265,132,00057,028,0002,482,176
5Nov 12, 2024 16:5229,373354,115,965260,083,00063,020,0002,375,680
6Nov 12, 2024 16:5229,480349,812,178272,391,00051,884,0002,342,912
7Nov 12, 2024 16:5229,494348,197,705259,547,00064,886,0002,437,120
8Nov 12, 2024 16:5229,543356,778,994274,981,00049,996,0002,330,624
9Nov 12, 2024 16:5229,734347,630,592271,064,00056,013,0002,531,328