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 11, 2021 06:58Sergey StreminSergey StreminError
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Sep 7, 2026 16:32C#_user10.00CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 7, 2026 16:33011,078,0151,412,000028,672Exit with code 101: thread 'main' panicked at 'internal error: entered unreachable code', main.rs:244:14 note: run with `RUST_BACKTRACE=1` environment variable to display a backtracestderr
2May 11, 2021 06:589,377127,352,53264,089,00039,054,0002,375,680
3May 11, 2021 06:589,388129,004,56070,181,00033,085,0002,281,472
4May 11, 2021 06:589,398128,036,63575,274,00028,102,0002,375,680
5May 11, 2021 06:589,401124,349,65275,296,00028,110,0002,371,584
6May 11, 2021 06:589,407124,290,98986,397,00017,078,0002,371,584
7May 11, 2021 06:589,415128,375,61656,309,00047,259,0002,379,776
8May 11, 2021 06:589,416131,711,08060,336,00043,240,0002,281,472
9May 11, 2021 06:589,422129,811,36675,470,00028,175,0002,289,664
10May 11, 2021 06:589,436134,358,38570,859,00032,934,0002,379,776