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 27, 2026 19:19Charles CabergsCharles CabergsScore: 7,842Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Apr 27, 2026 19:197,813103,685,25783,950,0001,998,0002,523,136stderr
2Apr 27, 2026 19:197,818104,244,80784,004,0002,000,0002,334,720stderr
3Apr 27, 2026 19:197,822104,489,05283,049,0003,001,0002,527,232stderr
4Apr 27, 2026 19:197,826104,401,13285,092,0001,001,0002,514,944stderr
5Apr 27, 2026 19:197,842108,383,87085,261,0001,003,0002,519,040stderr
6Apr 27, 2026 19:197,847103,293,44885,316,0001,003,0002,514,944stderr
7Apr 27, 2026 19:197,856104,627,79986,424,00002,514,944stderr
8Apr 27, 2026 19:197,856106,413,49885,421,0001,004,0002,510,848stderr
9Apr 27, 2026 19:197,861104,733,65885,475,0001,005,0002,527,232stderr