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 listApr 25, 2026 08:05Charles CabergsCharles CabergsScore: 8,111Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Apr 25, 2026 08:068,088108,893,75885,973,0002,999,0002,519,040stderr
2Apr 25, 2026 08:068,091108,225,66887,010,0002,000,0002,514,944stderr
3Apr 25, 2026 08:068,101106,346,03186,117,0003,004,0002,334,720stderr
4Apr 25, 2026 08:068,105105,033,43386,159,0003,005,0002,514,944stderr
5Apr 25, 2026 08:068,111107,908,64387,224,0002,005,0002,519,040stderr
6Apr 25, 2026 08:068,116103,085,18287,273,0002,006,0002,519,040stderr
7Apr 25, 2026 08:068,117104,300,16687,283,0002,006,0002,523,136stderr
8Apr 25, 2026 08:068,126109,856,77487,386,0002,008,0002,527,232stderr
9Apr 25, 2026 08:068,127104,999,37686,394,0003,013,0002,519,040stderr