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 listMar 21, 2026 17:35Dominique GarmierDominique GarmierScore: 6,420Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Mar 21, 2026 18:266,40396,992,18569,427,0001,006,0002,330,624
2Mar 21, 2026 17:346,404100,031,46969,439,0001,006,0002,330,624
3Mar 21, 2026 17:376,40495,056,51470,443,00002,342,912
4Mar 21, 2026 18:266,40696,185,06769,463,0001,006,0002,334,720
5Mar 21, 2026 17:386,40898,626,39769,478,0001,006,0002,351,104
6Mar 21, 2026 18:266,40997,265,08669,495,0001,007,0002,445,312
7Mar 21, 2026 17:346,41297,774,91970,535,00002,347,008
8Mar 21, 2026 17:376,41595,439,41869,562,0001,008,0002,330,624
9Mar 21, 2026 18:266,417101,150,32969,578,0001,008,0002,334,720
10Mar 21, 2026 17:376,42095,286,38667,592,0003,026,0002,330,624
11Mar 21, 2026 18:266,420103,033,45170,618,00002,338,816
12Mar 21, 2026 18:266,424100,618,38069,660,0001,009,0002,342,912
13Mar 21, 2026 18:266,424102,631,54468,649,0002,019,0002,342,912
14Mar 21, 2026 17:386,44199,952,89668,852,0001,995,0002,330,624
15Mar 21, 2026 18:266,44196,322,75768,856,0001,995,0002,342,912
16Mar 21, 2026 17:356,44195,754,98068,853,0001,995,0002,457,600
17Mar 21, 2026 17:346,444102,489,55369,888,000998,0002,338,816
18Mar 21, 2026 18:266,458101,623,01369,034,0002,001,0002,334,720
19Mar 21, 2026 17:386,46397,201,67269,094,0002,002,0002,347,008
20Mar 21, 2026 17:356,48197,264,49670,292,0001,004,0002,330,624
21Mar 21, 2026 17:356,50496,041,77670,532,0001,007,0002,330,624