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 8, 2021 21:07Sergey 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,066,96601,423,00028,672Exit with code 101: thread 'main' panicked at 'assertion failed: `(left == right)` left: `48`, right: `32`', main.rs:252:5 note: run with `RUST_BACKTRACE=1` environment variable to display a backtracestderr
2May 8, 2021 21:0712,171162,428,853104,903,00028,973,0002,289,664
3May 8, 2021 21:0712,200160,671,436104,155,00030,044,0002,289,664
4May 8, 2021 21:0712,226161,411,341105,377,00029,104,0002,379,776
5May 8, 2021 21:0712,227158,914,650106,397,00028,105,0002,289,664
6May 8, 2021 21:0712,235160,047,039110,484,00024,105,0002,371,584
7May 8, 2021 21:0712,240160,578,445106,509,00028,134,0002,371,584
8May 8, 2021 21:0712,251160,201,952102,820,00031,944,0002,441,216
9May 8, 2021 21:0712,256164,406,998103,862,00030,958,0002,289,664
10May 8, 2021 21:0712,272164,248,775103,997,00030,999,0002,281,472