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 listMar 19, 2026 22:37Dominique GarmierDominique GarmierScore: 8,236Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Mar 19, 2026 22:378,215114,864,59289,362,0001,004,0002,498,560
2Mar 19, 2026 22:378,227115,185,29689,495,0001,005,0002,490,368
3Mar 19, 2026 22:378,235117,242,41389,574,0001,006,0002,498,560
4Mar 19, 2026 22:378,236118,657,37489,593,0001,006,0002,326,528
5Mar 19, 2026 22:378,236124,460,94089,594,0001,006,0002,502,656
6Mar 19, 2026 22:378,241116,297,21789,646,0001,007,0002,506,752
7Mar 19, 2026 22:378,259118,253,13588,849,0001,996,0002,498,560
8Mar 19, 2026 22:378,271115,970,36288,980,0001,999,0002,326,528
9Mar 19, 2026 22:378,275121,238,96990,030,0001,000,0002,326,528