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 22, 2026 11:43Dominique GarmierDominique GarmierScore: 16,686Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Apr 22, 2026 11:4316,650196,422,730182,152,0001,000,0002,383,872
2Apr 22, 2026 11:4316,671202,396,128182,383,0001,002,0002,375,680
3Apr 22, 2026 11:4316,673199,682,170182,411,0001,002,0002,383,872
4Apr 22, 2026 11:4316,679197,088,201182,476,0001,002,0002,387,968
5Apr 22, 2026 11:4316,686199,106,262182,551,0001,003,0002,310,144
6Apr 22, 2026 11:4316,686199,607,013181,555,0001,995,0002,375,680
7Apr 22, 2026 11:4316,688200,975,397182,565,0001,003,0002,383,872
8Apr 22, 2026 11:4316,690198,064,271182,590,0001,003,0002,379,776
9Apr 22, 2026 11:4316,692197,549,681182,610,0001,003,0002,387,968