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 GarmierScore: 6,406Success
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 13:586,382101,204,08869,200,0001,002,0002,502,656
2Mar 22, 2026 21:486,38496,807,62369,217,0001,003,0002,326,528
3Mar 22, 2026 22:116,38694,617,81268,242,0002,007,0002,330,624
4Mar 22, 2026 22:366,386104,246,78268,236,0002,006,0002,330,624
5Mar 21, 2026 13:586,39097,921,99168,283,0002,008,0002,330,624
6Mar 22, 2026 21:486,39397,753,40469,321,0001,004,0002,326,528
7Mar 22, 2026 22:366,40397,767,67068,424,0002,012,0002,326,528
8Mar 22, 2026 21:356,40697,290,95069,461,0001,006,0002,502,656
9Mar 22, 2026 21:356,40897,886,85070,483,00002,330,624
10Mar 22, 2026 22:116,41096,439,43669,499,0001,007,0002,506,752
11Mar 21, 2026 13:586,41192,555,68770,517,00002,498,560
12Mar 22, 2026 22:116,421102,338,65569,625,0001,009,0002,502,656
13Mar 22, 2026 21:486,42398,558,95469,647,0001,009,0002,326,528
14Mar 22, 2026 21:356,42691,898,48470,688,00002,297,856
15Mar 22, 2026 22:366,426104,411,37069,674,0001,009,0002,330,624