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 22, 2026 15:19Dominique GarmierDominique GarmierError
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Sep 8, 2026 07:04C#_user10.00CustomSolution Broken
Sep 8, 2026 03:13C#_user10.00CustomSolution Held
Sep 7, 2026 15:49C#_user10.00CustomSolution Held
May 17, 2026 14:15M-Rochat10.00CustomSolution Held
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 8, 2026 07:04026,201,90114,298,0001,132,0002,134,016expected "2 ", got "1 "
2Sep 8, 2026 07:04026,419,60214,372,0001,146,0002,138,112expected "2 ", got "1 "
3Sep 8, 2026 07:04026,205,98314,138,0001,133,0002,138,112expected "2 ", got "1 "
4Mar 22, 2026 15:136,37196,225,40968,078,0002,002,0002,498,560
5Mar 22, 2026 15:166,37796,850,58968,145,0002,004,0002,502,656
6Mar 22, 2026 15:136,379103,185,02769,169,0001,002,0002,498,560
7Mar 22, 2026 15:166,388100,738,53269,260,0001,003,0002,498,560
8Mar 22, 2026 15:226,39095,174,85868,286,0002,008,0002,326,528
9Mar 22, 2026 15:196,39296,716,37769,304,0001,004,0002,502,656
10Mar 22, 2026 15:136,395100,766,86470,347,00002,502,656
11Mar 22, 2026 15:136,396102,001,64369,355,0001,005,0002,330,624
12Mar 22, 2026 15:226,402104,054,42069,415,0001,006,0002,502,656
13Mar 22, 2026 15:226,405100,045,28869,453,0001,006,0002,326,528
14Mar 22, 2026 15:136,406100,088,28669,459,0001,006,0002,326,528
15Mar 22, 2026 15:136,41296,285,75470,528,00002,330,624
16Mar 22, 2026 15:196,420101,309,78469,612,0001,008,0002,326,528
17Mar 22, 2026 15:166,432102,667,63568,758,0001,993,0002,326,528
18Mar 22, 2026 15:196,44294,824,46468,863,0001,996,0002,330,624