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 23, 2026 05:59olliecrowolliecrowScore: 3,190Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Apr 23, 2026 05:593,17652,716,95732,940,0001,996,0002,392,064
2Apr 23, 2026 05:593,17656,859,85932,947,0001,996,0002,379,776
3Apr 23, 2026 05:593,18557,107,41933,036,0002,002,0002,383,872
4Apr 23, 2026 05:593,18555,119,26833,037,0002,002,0002,387,968
5Apr 23, 2026 05:593,19054,148,24233,085,0002,005,0002,383,872
6Apr 23, 2026 05:593,19451,985,97334,101,0001,033,0002,379,776
7Apr 23, 2026 05:593,19453,765,01433,131,0002,007,0002,383,872
8Apr 23, 2026 05:593,19653,943,86834,154,0001,004,0002,379,776
9Apr 23, 2026 05:593,19855,731,57134,177,0001,005,0002,379,776