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 listSep 10, 2026 03:48Andrew EpsteinAndrew EpsteinScore: 3,863Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 10, 2026 03:483,85452,404,81041,295,0001,105,0002,113,536
2Sep 10, 2026 03:483,85552,572,05841,295,0001,116,0002,113,536
3Sep 10, 2026 03:483,86152,583,64941,395,0001,086,0002,113,536
4Sep 10, 2026 03:483,86252,504,01341,363,0001,124,0002,113,536
5Sep 10, 2026 03:483,86352,563,90141,387,0001,113,0002,113,536
6Sep 10, 2026 03:483,86552,514,99841,433,0001,090,0002,113,536
7Sep 10, 2026 03:483,86752,610,47941,451,0001,095,0002,113,536
8Sep 10, 2026 03:483,86753,800,40541,432,0001,114,0002,113,536
9Sep 10, 2026 03:483,87052,646,98541,468,0001,104,0002,113,536