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
Date AuthorLanguageStatus Score
Mar 29, 2026 17:13olliecrowolliecrowCPPg++13.3.0Error
Mar 29, 2026 17:11olliecrowolliecrowCPPg++13.3.0Error
Mar 29, 2026 17:09olliecrowolliecrowCPPg++13.3.0Error
Mar 29, 2026 17:07olliecrowolliecrowCPPg++13.3.0Error
Mar 29, 2026 16:56olliecrowolliecrowCPPg++13.3.0Error
Mar 29, 2026 16:53olliecrowolliecrowCPPg++13.3.0Error
Mar 29, 2026 16:51olliecrowolliecrowCPPg++13.3.0Error
Mar 29, 2026 16:48olliecrowolliecrowCPPg++13.3.0Error
Mar 29, 2026 16:45olliecrowolliecrowCPPg++13.3.0Error
Mar 29, 2026 16:43olliecrowolliecrowCPPg++13.3.0Error
Mar 29, 2026 16:40olliecrowolliecrowCPPg++13.3.0Success3,223
Mar 29, 2026 16:37olliecrowolliecrowCPPg++13.3.0Error
Mar 29, 2026 16:35olliecrowolliecrowCPPg++13.3.0Error
Mar 29, 2026 16:32olliecrowolliecrowCPPg++13.3.0Error
Mar 29, 2026 16:29olliecrowolliecrowCPPg++13.3.0Success3,211
Mar 29, 2026 16:26olliecrowolliecrowCPPg++13.3.0Error
Mar 29, 2026 16:24olliecrowolliecrowCPPg++13.3.0Error
Mar 29, 2026 16:21olliecrowolliecrowCPPg++13.3.0Error
Mar 29, 2026 16:17olliecrowolliecrowCPPg++13.3.0Error
Mar 29, 2026 16:14olliecrowolliecrowCPPg++13.3.0Success3,244
Mar 29, 2026 02:47Dominique GarmierDominique GarmierGOgo1.26.1Success31,916
Mar 28, 2026 06:19olliecrowolliecrowRUSTrust-1.93.0Success3,241
Mar 28, 2026 06:18olliecrowolliecrowRUSTrust-1.93.0Success3,247
Mar 28, 2026 06:15olliecrowolliecrowRUSTrust-1.93.0Success3,239
Mar 28, 2026 06:14olliecrowolliecrowRUSTrust-1.93.0Success3,333
Mar 28, 2026 06:13olliecrowolliecrowRUSTrust-1.93.0Success3,243
Mar 28, 2026 06:13olliecrowolliecrowRUSTrust-1.93.0Success3,639
Mar 28, 2026 06:11olliecrowolliecrowRUSTrust-1.93.0Error
Mar 28, 2026 06:10olliecrowolliecrowRUSTrust-1.93.0Success3,258
Mar 28, 2026 06:10olliecrowolliecrowRUSTrust-1.93.0Success3,265
Mar 28, 2026 06:08olliecrowolliecrowRUSTrust-1.93.0Success3,236+28.39 RP
Mar 28, 2026 06:07olliecrowolliecrowRUSTrust-1.93.0Success3,266+23.26 RP
Mar 28, 2026 06:06olliecrowolliecrowRUSTrust-1.93.0Success3,292
Mar 28, 2026 06:05olliecrowolliecrowRUSTrust-1.93.0Success3,336
Mar 28, 2026 06:01olliecrowolliecrowRUSTrust-1.93.0Success3,358
Mar 28, 2026 06:00olliecrowolliecrowRUSTrust-1.93.0Success3,291+2.77 RP
Mar 28, 2026 05:57olliecrowolliecrowRUSTrust-1.93.0Success3,329
Mar 28, 2026 05:55olliecrowolliecrowRUSTrust-1.93.0Success3,329
Mar 28, 2026 05:54olliecrowolliecrowRUSTrust-1.93.0Success3,512
Mar 28, 2026 05:51olliecrowolliecrowRUSTrust-1.93.0Success3,318
Mar 28, 2026 05:49olliecrowolliecrowRUSTrust-1.93.0Success3,335
Mar 28, 2026 05:48olliecrowolliecrowRUSTrust-1.93.0Success3,360
Mar 28, 2026 05:37olliecrowolliecrowRUSTrust-1.93.0Success3,294
Mar 28, 2026 05:35olliecrowolliecrowRUSTrust-1.93.0Success3,304
Mar 28, 2026 05:24olliecrowolliecrowRUSTrust-1.93.0Success3,448
Mar 28, 2026 05:23olliecrowolliecrowRUSTrust-1.93.0Success3,294+8.27 RP
Mar 28, 2026 05:21olliecrowolliecrowRUSTrust-1.93.0Error
Mar 28, 2026 05:19olliecrowolliecrowRUSTrust-1.93.0Error
Mar 28, 2026 05:11olliecrowolliecrowRUSTrust-1.93.0Success3,442
Mar 28, 2026 05:10olliecrowolliecrowRUSTrust-1.93.0Success3,303+10.96 RP
Mar 28, 2026 04:40olliecrowolliecrowRUSTrust-1.93.0Error
Mar 28, 2026 04:39olliecrowolliecrowRUSTrust-1.93.0Success3,531
Mar 28, 2026 04:34olliecrowolliecrowRUSTrust-1.93.0Error
Mar 28, 2026 04:29olliecrowolliecrowRUSTrust-1.93.0Error
Mar 28, 2026 04:28olliecrowolliecrowRUSTrust-1.93.0Success3,326
Mar 28, 2026 04:24olliecrowolliecrowRUSTrust-1.93.0Error
Mar 28, 2026 04:23olliecrowolliecrowRUSTrust-1.93.0Success3,441
Mar 28, 2026 04:22olliecrowolliecrowRUSTrust-1.93.0Success3,531
Mar 28, 2026 04:20olliecrowolliecrowRUSTrust-1.93.0Error
Mar 28, 2026 04:19olliecrowolliecrowRUSTrust-1.93.0Error
Mar 28, 2026 04:17olliecrowolliecrowRUSTrust-1.93.0Error
Mar 28, 2026 04:16olliecrowolliecrowRUSTrust-1.93.0Success3,329
Mar 28, 2026 04:15olliecrowolliecrowRUSTrust-1.93.0Success3,448
Mar 28, 2026 04:15olliecrowolliecrowRUSTrust-1.93.0Success3,459
Mar 28, 2026 04:13olliecrowolliecrowRUSTrust-1.93.0Success3,531
Mar 28, 2026 04:11olliecrowolliecrowRUSTrust-1.93.0Error
Mar 28, 2026 04:10olliecrowolliecrowRUSTrust-1.93.0Success3,513
Mar 28, 2026 04:10olliecrowolliecrowRUSTrust-1.93.0Error
Mar 28, 2026 04:09olliecrowolliecrowRUSTrust-1.93.0Success3,510
Mar 28, 2026 04:08olliecrowolliecrowRUSTrust-1.93.0Error
Mar 28, 2026 04:07olliecrowolliecrowRUSTrust-1.93.0Success3,528
Mar 28, 2026 04:06olliecrowolliecrowRUSTrust-1.93.0Success3,517
Mar 27, 2026 20:45olliecrowolliecrowRUSTrust-1.93.0Error
Mar 27, 2026 20:41olliecrowolliecrowRUSTrust-1.93.0Success3,454
Mar 27, 2026 14:56olliecrowolliecrowCPPg++13.3.0Error
Mar 27, 2026 08:56olliecrowolliecrowCPPg++13.3.0Success3,151
Mar 27, 2026 08:56olliecrowolliecrowCPPg++13.3.0Error
Mar 27, 2026 08:56olliecrowolliecrowCPPg++13.3.0Error
Mar 27, 2026 08:56olliecrowolliecrowCPPg++13.3.0Error
Mar 27, 2026 08:56olliecrowolliecrowCPPg++13.3.0Error
Mar 27, 2026 08:56olliecrowolliecrowCPPg++13.3.0Error
Mar 27, 2026 08:56olliecrowolliecrowCPPg++13.3.0Error
Mar 27, 2026 08:56olliecrowolliecrowCPPg++13.3.0Error
Mar 27, 2026 08:56olliecrowolliecrowCPPg++13.3.0Error
Mar 27, 2026 08:49olliecrowolliecrowCPPg++13.3.0Success3,151
Mar 27, 2026 08:49olliecrowolliecrowCPPg++13.3.0Error
Mar 27, 2026 08:49olliecrowolliecrowCPPg++13.3.0Error
Mar 27, 2026 08:49olliecrowolliecrowCPPg++13.3.0Error
Mar 27, 2026 08:49olliecrowolliecrowCPPg++13.3.0Error
Mar 27, 2026 08:49olliecrowolliecrowCPPg++13.3.0Error
Mar 27, 2026 08:49olliecrowolliecrowCPPg++13.3.0Error
Mar 27, 2026 08:49olliecrowolliecrowCPPg++13.3.0Error
Mar 27, 2026 08:49olliecrowolliecrowCPPg++13.3.0Error
Mar 27, 2026 08:44olliecrowolliecrowCPPg++13.3.0Success3,168
Mar 27, 2026 08:44olliecrowolliecrowCPPg++13.3.0Error
Mar 27, 2026 08:44olliecrowolliecrowCPPg++13.3.0Error
Mar 27, 2026 08:44olliecrowolliecrowCPPg++13.3.0Error
Mar 27, 2026 08:44olliecrowolliecrowCPPg++13.3.0Error
Mar 27, 2026 08:44olliecrowolliecrowCPPg++13.3.0Error
Mar 27, 2026 08:44olliecrowolliecrowCPPg++13.3.0Error