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 22:11Dominique GarmierDominique GarmierError
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Sep 8, 2026 07:17C#_user10.00CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 8, 2026 07:17025,670,51914,422,0001,085,0002,138,112expected "2 ", got "1 "
2Sep 8, 2026 07:17025,598,68114,320,0001,132,0002,138,112expected "2 ", got "1 "
3Sep 8, 2026 07:17026,290,09414,289,0001,141,0002,138,112expected "2 ", got "1 "
4Mar 21, 2026 13:586,382101,204,08869,200,0001,002,0002,502,656
5Mar 22, 2026 21:486,38496,807,62369,217,0001,003,0002,326,528
6Mar 22, 2026 22:116,38694,617,81268,242,0002,007,0002,330,624
7Mar 22, 2026 22:366,386104,246,78268,236,0002,006,0002,330,624
8Mar 21, 2026 13:586,39097,921,99168,283,0002,008,0002,330,624
9Mar 22, 2026 21:486,39397,753,40469,321,0001,004,0002,326,528
10Mar 22, 2026 22:366,40397,767,67068,424,0002,012,0002,326,528
11Mar 22, 2026 21:356,40697,290,95069,461,0001,006,0002,502,656
12Mar 22, 2026 21:356,40897,886,85070,483,00002,330,624
13Mar 22, 2026 22:116,41096,439,43669,499,0001,007,0002,506,752
14Mar 21, 2026 13:586,41192,555,68770,517,00002,498,560
15Mar 22, 2026 22:116,421102,338,65569,625,0001,009,0002,502,656
16Mar 22, 2026 21:486,42398,558,95469,647,0001,009,0002,326,528
17Mar 22, 2026 21:356,42691,898,48470,688,00002,297,856
18Mar 22, 2026 22:366,426104,411,37069,674,0001,009,0002,330,624