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 listNov 30, 2026 23:54Dominique GarmierDominique GarmierScore: 5,691Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Nov 30, 2026 23:575,67970,192,95161,213,0001,257,0002,146,304
2Nov 30, 2026 23:575,68471,879,85961,289,0001,241,0002,146,304
3Nov 30, 2026 23:575,68870,423,90461,417,0001,157,0002,146,304
4Nov 30, 2026 23:575,69170,318,43061,431,0001,172,0002,146,304
5Nov 30, 2026 23:575,69170,488,55361,562,0001,046,0002,146,304
6Nov 30, 2026 23:575,70170,710,80861,482,0001,238,0002,146,304
7Nov 30, 2026 23:575,70170,323,41961,696,0001,020,0002,146,304
8Nov 30, 2026 23:575,70470,460,53961,503,0001,242,0002,146,304
9Nov 30, 2026 23:575,70970,521,10561,539,0001,261,0002,146,304