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 listMar 20, 2026 03:15Yuriy LyfenkoYuriy LyfenkoScore: 3,288Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Mar 20, 2026 03:153,28362,228,98634,109,0002,006,0002,256,896
2Mar 20, 2026 03:153,28362,363,38934,110,0002,006,0002,260,992
3Mar 20, 2026 03:153,28467,626,88834,121,0002,007,0002,371,584
4Mar 20, 2026 03:153,28669,003,73834,138,0002,008,0002,260,992
5Mar 20, 2026 03:153,28859,218,12034,159,0002,009,0002,375,680
6Mar 20, 2026 03:153,29564,879,04934,235,0002,013,0002,256,896
7Mar 20, 2026 03:153,29562,126,57235,243,0001,006,0002,260,992
8Mar 20, 2026 03:153,29959,288,72935,282,0001,008,0002,260,992
9Mar 20, 2026 03:153,30060,754,34834,282,0002,016,0002,519,040