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 18:14TudyMTudyMScore: 4,053Success
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 18:194,04459,337,07743,446,0001,038,0002,363,392
2May 3, 2026 18:194,04458,884,24343,451,0001,040,0002,351,104
3May 3, 2026 18:194,04960,936,51643,466,0001,083,0002,371,584
4May 3, 2026 18:194,05060,874,73943,489,0001,071,0002,375,680
5May 3, 2026 18:194,05362,684,73243,501,0001,091,0002,367,488
6May 3, 2026 18:194,05562,014,47943,528,0001,077,0002,363,392
7May 3, 2026 18:194,06359,166,85943,640,0001,056,0002,371,584
8May 3, 2026 18:194,06361,369,80043,600,0001,093,0002,359,296
9May 3, 2026 18:194,06961,994,95243,679,0001,087,0002,375,680