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 listDec 1, 2026 23:17Dominique GarmierDominique GarmierScore: 4,590Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Dec 1, 2026 23:184,57757,961,82749,198,0001,154,0002,146,304
2Dec 1, 2026 23:184,57958,100,88249,198,0001,180,0002,146,304
3Dec 1, 2026 23:184,58058,232,64649,161,0001,220,0002,146,304
4Dec 1, 2026 23:184,58458,308,42749,184,0001,250,0002,146,304
5Dec 1, 2026 23:184,59060,571,78649,250,0001,247,0002,146,304
6Dec 1, 2026 23:184,59158,469,61249,258,0001,250,0002,146,304
7Dec 1, 2026 23:184,59258,437,10449,263,0001,251,0002,146,304
8Dec 1, 2026 23:184,59458,550,64149,268,0001,274,0002,146,304
9Dec 1, 2026 23:184,61058,408,99449,433,0001,281,0002,146,304