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 listFeb 13, 2026 20:44olliecrowolliecrowError
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Sep 11, 2026 00:22Andrew Epstein10.00CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 11, 2026 00:22058,471,97147,365,0001,092,0002,113,536expected "5048054264 ", got "79332409404738 "
2Sep 11, 2026 00:22058,687,60047,579,0001,065,0002,113,536expected "5047891487 ", got "78293030172200 "
3Sep 11, 2026 00:22058,378,83747,247,0001,149,0002,113,536expected "5048187794 ", got "78353156948692 "
4Feb 13, 2026 20:443,80469,164,12839,848,0001,992,0002,404,352
5Feb 13, 2026 20:443,80571,740,23639,862,0001,993,0002,383,872
6Feb 13, 2026 20:443,80572,423,12740,862,000996,0002,400,256
7Feb 13, 2026 20:443,80766,267,28640,856,0001,021,0002,277,376
8Feb 13, 2026 20:443,80765,708,09439,885,0001,994,0002,396,160
9Feb 13, 2026 20:443,80864,187,19140,887,000997,0002,514,944
10Feb 13, 2026 20:443,81564,795,32740,962,000999,0002,400,256
11Feb 13, 2026 20:443,81563,801,10340,971,000999,0002,400,256
12Feb 13, 2026 20:443,82168,774,79640,031,0002,001,0002,277,376