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 listNov 10, 2021 20:18Sergey StreminSergey StreminError
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Sep 7, 2026 16:30C#_user10.00CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 7, 2026 16:30010,886,2711,124,000028,672Exit with code 101: thread 'main' panicked at 'assertion failed: `(left == right)` left: `48`, right: `32`', main.rs:70:21 note: run with `RUST_BACKTRACE=1` environment variable to display a backtracestderr
2Nov 10, 2021 20:186,389134,701,17070,277,55302,187,264
3Nov 10, 2021 20:186,38996,821,82368,276,0002,008,0002,359,296
4Nov 10, 2021 20:186,396140,344,30970,354,92902,191,360
5Nov 10, 2021 20:186,402130,503,08870,422,42002,195,456
6Nov 10, 2021 20:186,40496,793,25370,440,00002,293,760
7Nov 10, 2021 20:186,40493,392,90869,435,0001,006,0002,293,760
8Nov 10, 2021 20:186,40894,149,73269,486,0001,007,0002,293,760
9Nov 10, 2021 20:186,41294,391,04169,523,0001,007,0002,293,760
10Nov 10, 2021 20:186,41295,224,07370,533,00002,502,656
11Nov 10, 2021 20:186,42097,981,14469,609,0001,008,0002,293,760
12Nov 10, 2021 20:186,420102,121,14069,614,0001,008,0002,293,760
13Nov 10, 2021 20:186,424102,079,45969,654,0001,009,0002,359,296