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 08:58NoSIMD_C#NoSIMD_C#Score: 30,003Success
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 08:5829,893356,201,282277,852,00050,972,0002,535,424
2Nov 10, 2024 08:5829,909354,413,237276,003,00053,000,0002,314,240
3Nov 10, 2024 08:5829,990355,721,397273,912,00055,982,0002,547,712
4Nov 10, 2024 08:5829,992360,116,711279,926,00049,986,0002,404,352
5Nov 10, 2024 08:5830,003358,948,905274,027,00056,005,0002,433,024
6Nov 10, 2024 08:5830,055358,748,177284,665,00045,945,0002,310,144
7Nov 10, 2024 08:5830,095354,683,838267,040,00064,009,0002,396,160
8Nov 10, 2024 08:5830,127357,503,792281,485,00049,908,0002,383,872
9Nov 10, 2024 08:5830,285363,393,442279,117,00054,022,0002,445,312