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 1, 2026 04:48olliecrowolliecrowScore: 4,469Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1May 1, 2026 04:514,44365,108,80546,879,0001,994,0002,314,240
2May 1, 2026 04:514,45657,308,67047,017,0002,000,0002,367,488
3May 1, 2026 04:514,46157,441,01446,069,0003,004,0002,359,296
4May 1, 2026 04:514,46857,456,43647,142,0002,006,0002,359,296
5May 1, 2026 04:514,46957,357,70046,157,0003,010,0002,375,680
6May 1, 2026 04:514,47257,288,87046,189,0003,012,0002,375,680
7May 1, 2026 04:514,47857,514,71247,248,0002,010,0002,375,680
8May 1, 2026 04:514,48057,462,76047,274,0002,011,0002,375,680
9May 1, 2026 04:514,50157,501,74747,493,0002,021,0002,375,680