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 07:00Sergey StreminSergey StreminError
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Sep 7, 2026 16:34C#_user10.00CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 7, 2026 16:34011,187,14001,425,00028,672Exit with code 101: thread 'main' panicked at 'assertion failed: `(left == right)` left: `48`, right: `32`', main.rs:251:5 note: run with `RUST_BACKTRACE=1` environment variable to display a backtracestderr
2May 11, 2021 07:0010,879145,831,53786,487,00033,187,0002,281,472
3May 11, 2021 07:0010,914148,575,02686,037,00034,014,0002,375,680
4May 11, 2021 07:0010,922142,657,05190,110,00030,036,0002,367,488
5May 11, 2021 07:0010,931143,501,84796,190,00024,047,0002,371,584
6May 11, 2021 07:0010,932142,389,23396,202,00024,050,0002,289,664
7May 11, 2021 07:0010,949144,919,17988,320,00032,116,0002,289,664
8May 11, 2021 07:0010,991147,797,58888,924,00031,972,0002,289,664
9May 11, 2021 07:0010,994150,362,87088,949,00031,981,0002,289,664
10May 11, 2021 07:0011,036144,284,01793,306,00028,092,0002,371,584