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 21, 2026 17:24BenBenScore: 20,776Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Apr 21, 2026 17:2420,743246,805,108194,150,00034,026,0002,326,528
2Apr 21, 2026 17:2420,750247,348,832195,215,00033,036,0002,355,200
3Apr 21, 2026 17:2420,756246,200,942196,274,00032,044,0002,310,144
4Apr 21, 2026 17:2420,774249,934,763195,442,00033,074,0002,347,008
5Apr 21, 2026 17:2420,776247,624,442194,610,00033,932,0002,326,528
6Apr 21, 2026 17:2420,822249,105,914195,037,00034,006,0002,428,928
7Apr 21, 2026 17:2420,827246,811,505195,085,00034,014,0002,351,104
8Apr 21, 2026 17:2420,856246,889,296197,362,00032,058,0002,338,816
9Apr 21, 2026 17:2420,874249,061,267193,675,00035,939,0002,347,008