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 27, 2026 00:51olliecrowolliecrowScore: 3,157Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Mar 27, 2026 00:513,14459,118,47933,570,0001,017,0002,400,256
2Mar 27, 2026 00:503,14762,778,03934,619,00002,277,376
3Mar 27, 2026 00:513,15261,842,57933,656,0001,019,0002,400,256
4Mar 27, 2026 00:513,15261,166,41233,654,0001,019,0002,277,376
5Mar 27, 2026 00:513,15761,380,28234,728,00002,277,376
6Mar 27, 2026 00:503,16865,152,98032,860,0001,991,0002,400,256
7Mar 27, 2026 00:503,17061,719,37332,874,0001,992,0002,404,352
8Mar 27, 2026 00:513,17459,994,37133,915,000997,0002,277,376
9Mar 27, 2026 00:513,17457,025,11932,918,0001,995,0002,396,160