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 19:40Sergey StreminSergey StreminError
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Sep 7, 2026 15:48C#_user30.87CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 7, 2026 15:50024,949,29313,555,0001,034,00024,576Exit with code 101: thread 'main' panicked at 'internal error: entered unreachable code', main.rs:219:14 note: run with `RUST_BACKTRACE=1` environment variable to display a backtracestderr
2Nov 10, 2021 19:405,161119,791,95756,770,49602,187,264
3Nov 10, 2021 19:405,186115,714,48457,041,02102,191,360
4Nov 10, 2021 19:405,18684,792,89355,050,0002,001,0002,461,696
5Nov 10, 2021 19:405,18979,322,32255,081,0002,002,0002,367,488
6Nov 10, 2021 19:405,19383,019,34955,117,0002,004,0002,363,392
7Nov 10, 2021 19:405,19478,161,23055,131,0002,004,0002,293,760
8Nov 10, 2021 19:405,19677,942,77856,153,0001,002,0002,367,488
9Nov 10, 2021 19:405,19783,098,53055,158,0002,005,0002,351,104
10Nov 10, 2021 19:405,19782,572,33955,161,0002,005,0002,293,760
11Nov 10, 2021 19:405,21180,883,76456,312,0001,005,0002,457,600
12Nov 10, 2021 19:405,22678,532,76756,477,0001,008,0002,363,392
13Nov 10, 2021 19:405,263113,722,64357,890,87202,203,648