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 29, 2026 18:59olliecrowolliecrowScore: 3,177Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Mar 29, 2026 19:003,15161,969,87333,646,0001,019,0002,404,352
2Mar 29, 2026 18:593,16865,682,31333,853,000995,0002,486,272
3Mar 29, 2026 18:593,16859,934,85132,860,0001,991,0002,396,160
4Mar 29, 2026 19:003,17458,230,94632,921,0001,995,0002,277,376
5Mar 29, 2026 18:593,17767,219,43032,953,0001,997,0002,273,280
6Mar 29, 2026 19:003,18658,083,73134,045,0001,001,0002,277,376
7Mar 29, 2026 18:593,23056,844,25834,519,0001,015,0002,400,256
8Mar 29, 2026 18:593,23060,497,08734,519,0001,015,0002,396,160
9Mar 29, 2026 18:593,24264,654,26434,639,0001,018,0002,277,376