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 13, 2026 05:19olliecrowolliecrowScore: 3,380Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Mar 13, 2026 06:103,36764,217,48636,038,0001,001,0002,281,472
2Mar 13, 2026 05:183,36965,672,44536,054,0001,001,0002,367,488
3Mar 13, 2026 05:183,37057,439,03535,071,0002,004,0002,363,392
4Mar 13, 2026 05:223,37163,918,29036,075,0001,002,0002,281,472
5Mar 13, 2026 06:103,37357,504,80635,097,0002,005,0002,281,472
6Mar 13, 2026 05:193,38061,206,99536,180,0001,005,0002,281,472
7Mar 13, 2026 06:103,38060,290,32035,173,0002,009,0002,281,472
8Mar 13, 2026 05:193,38159,779,27136,187,0001,005,0002,367,488
9Mar 13, 2026 05:223,38162,047,24335,179,0002,010,0002,363,392
10Mar 13, 2026 05:183,39660,039,32936,348,0001,009,0002,281,472
11Mar 13, 2026 05:193,40260,401,29736,416,0001,011,0002,281,472
12Mar 13, 2026 05:223,40461,009,87036,434,0001,012,0002,453,504