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 19, 2026 18:35lipapipalipapipaScore: 4,656Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Mar 19, 2026 18:384,64181,559,13349,052,0002,002,0002,375,680
2Mar 19, 2026 18:384,64282,218,06549,065,0002,002,0002,375,680
3Mar 19, 2026 18:384,64475,428,42649,080,0002,003,0002,375,680
4Mar 19, 2026 18:384,65078,073,92450,148,0001,002,0002,301,952
5Mar 19, 2026 18:384,65184,318,82150,160,0001,003,0002,301,952
6Mar 19, 2026 18:384,65375,160,86249,172,0002,007,0002,371,584
7Mar 19, 2026 18:384,65481,130,83449,188,0002,007,0002,383,872
8Mar 19, 2026 18:384,65678,890,62350,208,0001,004,0002,379,776
9Mar 19, 2026 18:384,65676,606,08650,208,0001,004,0002,375,680
10Mar 19, 2026 18:384,66075,730,19549,248,0002,010,0002,301,952
11Mar 19, 2026 18:384,66373,109,17050,293,0001,005,0002,310,144
12Mar 19, 2026 18:384,67279,714,39650,384,0001,007,0002,310,144
13Mar 19, 2026 18:354,67774,787,42550,434,0001,008,0002,441,216
14Mar 19, 2026 18:354,68984,802,03050,567,0001,011,0002,445,312
15Mar 19, 2026 18:354,69384,592,00650,616,0001,012,0002,396,160