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 17, 2026 20:02Charles CabergsCharles CabergsScore: 44,560Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Apr 17, 2026 20:0244,142510,458,464288,739,000196,822,0002,281,472
2Apr 17, 2026 20:0244,358512,620,765284,967,000202,976,0002,396,160
3Apr 17, 2026 20:0244,410520,459,108286,713,000201,798,0002,379,776
4Apr 17, 2026 20:0244,547516,115,182282,010,000208,008,0002,416,640
5Apr 17, 2026 20:0244,560516,367,505289,501,000200,654,0002,437,120
6Apr 17, 2026 20:0244,770519,755,842275,706,000216,769,0002,494,464
7Apr 17, 2026 20:0244,839523,028,909277,564,000215,661,0002,289,664
8Apr 17, 2026 20:0244,840518,849,595281,567,000211,674,0002,367,488
9Apr 17, 2026 20:0245,153525,583,641270,828,000225,857,0002,408,448