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

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

Challenge History
DateChallengerCostTypeStatus
Sep 7, 2026 16:26C#_user10.00CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 7, 2026 16:26010,878,2971,129,000028,672Exit with code 101: thread 'main' panicked at 'internal error: entered unreachable code', main.rs:171:14 note: run with `RUST_BACKTRACE=1` environment variable to display a backtracestderr
2Nov 10, 2021 20:325,19377,436,94855,119,0002,004,0002,293,760
3Nov 10, 2021 20:325,19983,836,60755,188,0002,006,0002,293,760
4Nov 10, 2021 20:325,20683,135,56855,261,0002,009,0002,293,760
5Nov 10, 2021 20:325,21579,858,10956,362,0001,006,0002,293,760
6Nov 10, 2021 20:325,21879,999,97657,400,00002,363,392
7Nov 10, 2021 20:325,21885,276,84856,396,0001,007,0002,293,760
8Nov 10, 2021 20:325,221115,317,73657,434,24402,187,264
9Nov 10, 2021 20:325,22780,009,74556,488,0001,008,0002,363,392
10Nov 10, 2021 20:325,23079,509,59356,520,0001,009,0002,293,760
11Nov 10, 2021 20:325,232116,463,64157,549,20502,195,456
12Nov 10, 2021 20:325,237120,920,58157,610,18002,199,552
13Nov 10, 2021 20:325,23786,264,33156,601,0001,010,0002,359,296