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 9, 2021 18:25Sergey 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,123,4601,417,000028,672Exit with code 101: thread 'main' panicked at 'assertion failed: `(left == right)` left: `48`, right: `32`', main.rs:249:5 note: run with `RUST_BACKTRACE=1` environment variable to display a backtracestderr
2May 9, 2021 18:2511,461146,789,83790,052,00036,020,0002,371,584
3May 9, 2021 18:2511,477149,934,25693,181,00033,064,0002,371,584
4May 9, 2021 18:2511,490150,085,33397,298,00029,089,0002,289,664
5May 9, 2021 18:2511,491148,248,47897,308,00029,092,0002,371,584
6May 9, 2021 18:2511,492152,782,924101,331,00025,081,0002,371,584
7May 9, 2021 18:2511,510151,714,44395,461,00031,150,0002,281,472
8May 9, 2021 18:2511,512153,057,96094,474,00032,161,0002,289,664
9May 9, 2021 18:2511,528152,660,45497,854,00028,957,0002,289,664
10May 9, 2021 18:2511,528156,264,09592,862,00033,949,0002,494,464