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 listMay 17, 2026 14:33M-RochatM-RochatError
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1May 17, 2026 14:340127,338,026115,553,0001,007,0002,113,536expected "404481769 ", got "o usd=199737 tx=900330 ord=0,367540,285002,82672,82487,82629 c=90416/495152 self=102 "
2May 17, 2026 14:340126,169,857115,827,0001,027,0002,113,536expected "403803604 ", got "o usd=199748 tx=897789 ord=0,366182,284645,82434,81983,82545 c=89515/493293 self=87 "
3May 17, 2026 14:340125,599,470115,787,0001,030,0002,113,536expected "404109913 ", got "o usd=200219 tx=899705 ord=0,367183,284744,82759,82285,82734 c=90079/494906 self=87 "