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

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

Challenge History
DateChallengerCostTypeStatus
May 17, 2026 14:15M-Rochat10.00CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1May 17, 2026 14:37010,708,4581,049,000032,768Exit with code 101: thread 'main' panicked at 'internal error: entered unreachable code', main.rs:167:14 note: run with `RUST_BACKTRACE=1` environment variable to display a backtracestderr
2Nov 10, 2021 20:405,167118,526,41656,840,53002,195,456
3Nov 10, 2021 20:405,174125,739,93856,909,17702,310,144
4Nov 10, 2021 20:405,18279,369,75155,000,0002,000,0002,359,296
5Nov 10, 2021 20:405,18286,694,29356,001,0001,000,0002,293,760
6Nov 10, 2021 20:405,18287,464,68255,005,0002,000,0002,363,392
7Nov 10, 2021 20:405,18788,164,96456,061,0001,001,0002,293,760
8Nov 10, 2021 20:405,18885,500,48056,068,0001,001,0002,293,760
9Nov 10, 2021 20:405,190122,637,93457,085,72102,203,648
10Nov 10, 2021 20:405,19680,335,01955,150,0002,005,0002,293,760
11Nov 10, 2021 20:405,19883,498,09656,175,0001,003,0002,367,488
12Nov 10, 2021 20:405,19986,162,08555,184,0002,006,0002,293,760
13Nov 10, 2021 20:405,23381,718,98556,557,0001,009,0002,367,488