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 listSep 10, 2026 23:54Andrew EpsteinAndrew EpsteinScore: 3,889Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 10, 2026 23:553,88252,821,13041,603,0001,102,0002,113,536
2Sep 10, 2026 23:553,88652,888,86541,646,0001,108,0002,113,536
3Sep 10, 2026 23:553,88753,607,47541,652,0001,109,0002,113,536
4Sep 10, 2026 23:553,88852,805,77741,684,0001,094,0002,113,536
5Sep 10, 2026 23:553,88952,747,81841,683,0001,105,0002,113,536
6Sep 10, 2026 23:553,89152,821,83341,697,0001,111,0002,113,536
7Sep 10, 2026 23:553,89652,818,12141,781,0001,078,0002,113,536
8Sep 10, 2026 23:553,90454,196,04441,823,0001,128,0002,113,536
9Sep 10, 2026 23:553,91053,047,63141,923,0001,090,0002,113,536