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 28, 2026 06:07olliecrowolliecrowScore: 3,266Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Mar 28, 2026 06:043,25862,342,19533,847,0001,991,0002,408,448
2Mar 28, 2026 06:033,25967,842,52433,857,0001,991,0002,396,160
3Mar 28, 2026 06:043,25967,034,18934,857,000995,0002,408,448
4Mar 28, 2026 06:043,26160,890,08834,871,000996,0002,285,568
5Mar 28, 2026 06:033,26363,878,46234,892,000996,0002,285,568
6Mar 28, 2026 06:033,26358,532,23433,895,0001,993,0002,285,568
7Mar 28, 2026 06:033,26661,650,64033,926,0001,995,0002,285,568
8Mar 28, 2026 06:033,26660,706,44033,931,0001,995,0002,285,568
9Mar 28, 2026 06:043,26661,897,30434,928,000997,0002,400,256
10Mar 28, 2026 06:043,27257,453,39833,989,0001,999,0002,510,848
11Mar 28, 2026 06:043,27257,454,26733,994,0001,999,0002,510,848
12Mar 28, 2026 06:073,27359,576,95233,999,0001,999,0002,400,256
13Mar 28, 2026 06:033,27458,126,88235,012,0001,000,0002,285,568
14Mar 28, 2026 06:073,27763,095,88034,045,0002,002,0002,285,568
15Mar 28, 2026 06:073,28962,129,95435,177,0001,005,0002,408,448