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:31NoSIMD_C#NoSIMD_C#Score: 29,817Success
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:3129,586354,163,656262,554,00062,893,0002,465,792
2Nov 12, 2024 16:3129,704357,373,184272,789,00053,958,0002,437,120
3Nov 12, 2024 16:3129,717358,958,995249,916,00076,974,0002,428,928
4Nov 12, 2024 16:3129,762356,428,685276,476,00050,903,0002,371,584
5Nov 12, 2024 16:3129,817354,874,575264,993,00062,998,0002,408,448
6Nov 12, 2024 16:3129,863355,547,918270,584,00057,910,0002,392,064
7Nov 12, 2024 16:3129,901349,606,566267,929,00060,983,0002,514,944
8Nov 12, 2024 16:3129,942359,127,713278,465,00050,902,0002,465,792
9Nov 12, 2024 16:3130,307364,696,530277,485,00055,896,0002,531,328