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 15:48Victor MerckléVictor MerckléScore: 2,093Success
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 15:492,08530,487,68821,869,0001,075,0002,150,400
2Jun 12, 2026 15:492,08630,454,35721,825,0001,130,0002,150,400
3Jun 12, 2026 15:492,08830,480,72421,896,0001,082,0002,150,400
4Jun 12, 2026 15:492,08830,601,82321,901,0001,068,0002,150,400
5Jun 12, 2026 15:492,09330,512,39921,959,0001,065,0002,150,400
6Jun 12, 2026 15:492,09430,522,89921,942,0001,094,0002,150,400
7Jun 12, 2026 15:492,09630,714,09921,970,0001,086,0002,150,400
8Jun 12, 2026 15:492,09730,651,90921,968,0001,100,0002,150,400
9Jun 12, 2026 15:492,09930,685,81022,002,0001,093,0002,150,400