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 8, 2021 21:09Sergey StreminSergey StreminError
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Sep 7, 2026 16:35C#_user10.00CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 7, 2026 16:35011,162,7021,416,000028,672Exit with code 101: thread 'main' panicked at 'assertion failed: `(left == right)` left: `48`, right: `32`', main.rs:252:5 note: run with `RUST_BACKTRACE=1` environment variable to display a backtracestderr
2May 8, 2021 21:0911,854150,262,099104,316,00026,079,0002,469,888
3May 8, 2021 21:0911,863157,897,332102,391,00028,107,0002,289,664
4May 8, 2021 21:0911,864152,915,206108,417,00022,085,0002,289,664
5May 8, 2021 21:0911,864158,028,977106,411,00024,093,0002,289,664
6May 8, 2021 21:0911,869160,880,85699,426,00031,133,0002,289,664
7May 8, 2021 21:0911,880156,495,91499,515,00031,161,0002,281,472
8May 8, 2021 21:0911,892166,596,115105,848,00024,964,0002,289,664
9May 8, 2021 21:0911,895156,911,230105,684,00025,162,0002,289,664
10May 8, 2021 21:0911,910160,655,779104,004,00027,001,0002,289,664