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 GarmierScore: 6,396Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Mar 22, 2026 15:136,37196,225,40968,078,0002,002,0002,498,560
2Mar 22, 2026 15:166,37796,850,58968,145,0002,004,0002,502,656
3Mar 22, 2026 15:136,379103,185,02769,169,0001,002,0002,498,560
4Mar 22, 2026 15:166,388100,738,53269,260,0001,003,0002,498,560
5Mar 22, 2026 15:226,39095,174,85868,286,0002,008,0002,326,528
6Mar 22, 2026 15:196,39296,716,37769,304,0001,004,0002,502,656
7Mar 22, 2026 15:136,395100,766,86470,347,00002,502,656
8Mar 22, 2026 15:136,396102,001,64369,355,0001,005,0002,330,624
9Mar 22, 2026 15:226,402104,054,42069,415,0001,006,0002,502,656
10Mar 22, 2026 15:226,405100,045,28869,453,0001,006,0002,326,528
11Mar 22, 2026 15:136,406100,088,28669,459,0001,006,0002,326,528
12Mar 22, 2026 15:136,41296,285,75470,528,00002,330,624
13Mar 22, 2026 15:196,420101,309,78469,612,0001,008,0002,326,528
14Mar 22, 2026 15:166,432102,667,63568,758,0001,993,0002,326,528
15Mar 22, 2026 15:196,44294,824,46468,863,0001,996,0002,330,624