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:00olliecrowolliecrowScore: 3,291Success
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 05:583,27562,296,61535,030,0001,000,0002,285,568
2Mar 28, 2026 05:583,28562,934,69034,123,0002,007,0002,285,568
3Mar 28, 2026 05:593,28562,604,85535,137,0001,003,0002,404,352
4Mar 28, 2026 05:593,28662,279,88534,138,0002,008,0002,285,568
5Mar 28, 2026 06:003,28665,260,00134,139,0002,008,0002,285,568
6Mar 28, 2026 05:573,28757,368,63934,144,0002,008,0002,404,352
7Mar 28, 2026 05:583,28765,271,33534,153,0002,009,0002,285,568
8Mar 28, 2026 05:573,29158,826,73935,195,0001,005,0002,408,448
9Mar 28, 2026 05:583,29156,600,91234,195,0002,011,0002,408,448
10Mar 28, 2026 05:573,29658,529,14236,253,00002,408,448
11Mar 28, 2026 05:583,29758,372,99935,257,0001,007,0002,404,352
12Mar 28, 2026 06:003,29959,204,35336,292,00002,285,568
13Mar 28, 2026 05:583,30761,911,72235,371,0001,010,0002,285,568
14Mar 28, 2026 06:003,31662,961,90135,465,0001,013,0002,404,352
15Mar 28, 2026 05:593,32355,575,17135,539,0001,015,0002,519,040