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 listJun 12, 2026 12:52Victor MerckléVictor MerckléScore: 2,113Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Jun 12, 2026 12:562,09432,067,15621,986,0001,053,0002,174,976
2Jun 12, 2026 12:562,09432,029,67321,957,0001,081,0002,174,976
3Jun 12, 2026 12:562,11032,237,64322,129,0001,081,0002,129,920
4Jun 12, 2026 12:562,11032,239,24822,126,0001,085,0002,174,976
5Jun 12, 2026 12:562,11332,260,01422,175,0001,078,0002,129,920
6Jun 12, 2026 12:562,11532,288,23322,216,0001,056,0002,129,920
7Jun 12, 2026 12:562,11732,320,03522,219,0001,076,0002,129,920
8Jun 12, 2026 12:562,12032,310,23422,246,0001,083,0002,129,920
9Jun 12, 2026 12:562,12132,260,23422,267,0001,073,0002,134,016