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 listJan 6, 2026 23:50Josu San MartinJosu San MartinScore: 4,444Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Jan 6, 2026 23:504,43376,951,28847,772,000995,0002,445,312
2Jan 6, 2026 23:504,43477,046,65247,774,000995,0002,363,392
3Jan 6, 2026 23:504,43976,572,14846,840,0001,993,0002,441,216
4Jan 6, 2026 23:504,44074,495,40745,854,0002,990,0002,428,928
5Jan 6, 2026 23:504,44476,906,24545,892,0002,993,0002,379,776
6Jan 6, 2026 23:504,44675,615,23445,912,0002,994,0002,363,392
7Jan 6, 2026 23:504,44779,903,79546,920,0001,996,0002,359,296
8Jan 6, 2026 23:504,44775,252,50545,924,0002,995,0002,379,776
9Jan 6, 2026 23:504,45181,992,44045,964,0002,997,0002,543,616