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 9, 2026 17:20Daniel MastalerzDaniel MastalerzScore: 19,213Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Mar 9, 2026 17:2019,186232,519,628209,051,0002,000,0002,277,376
2Mar 9, 2026 17:2019,192233,157,917209,109,0002,001,0002,277,376
3Mar 9, 2026 17:2019,200234,001,071210,205,0001,000,0002,273,280
4Mar 9, 2026 17:2019,208232,645,256209,290,0002,002,0002,531,328
5Mar 9, 2026 17:2019,213232,732,572211,348,00002,289,664
6Mar 9, 2026 17:2019,214238,538,358211,358,00002,289,664
7Mar 9, 2026 17:2019,363235,428,664210,998,0001,999,0002,289,664
8Mar 9, 2026 17:2019,389235,694,629212,276,0001,001,0002,535,424
9Mar 9, 2026 17:2019,403235,649,406212,428,0001,002,0002,289,664