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 listMay 3, 2026 15:02TudyMTudyMScore: 4,112Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1May 3, 2026 15:114,10561,208,15844,096,0001,068,0002,371,584
2May 3, 2026 15:114,10563,355,06644,074,0001,087,0002,375,680
3May 3, 2026 15:114,10660,524,92744,081,0001,092,0002,367,488
4May 3, 2026 15:114,10963,623,43144,115,0001,092,0002,375,680
5May 3, 2026 15:114,11259,882,27244,157,0001,077,0002,363,392
6May 3, 2026 15:114,11359,379,04844,176,0001,074,0002,359,296
7May 3, 2026 15:114,11862,653,83544,213,0001,085,0002,371,584
8May 3, 2026 15:114,13162,963,09444,358,0001,092,0002,367,488
9May 3, 2026 15:114,14060,048,99444,442,0001,100,0002,351,104