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 15, 2026 12:06Dominique GarmierDominique GarmierScore: 13,490Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Mar 15, 2026 11:5413,415181,528,768147,568,00002,404,352
2Mar 15, 2026 11:5413,418174,275,159146,589,0001,004,0002,400,256
3Mar 15, 2026 11:5413,447176,499,886146,920,000999,0002,396,160
4Mar 15, 2026 11:5413,465180,787,655146,119,0002,001,0002,404,352
5Mar 15, 2026 12:0613,471173,533,088146,180,0002,002,0002,400,256
6Mar 15, 2026 11:5413,484171,615,306148,327,00002,396,160
7Mar 15, 2026 11:5413,490174,863,660147,388,0001,002,0002,273,280
8Mar 15, 2026 11:5413,498173,518,559148,483,00002,273,280
9Mar 15, 2026 11:5413,507177,738,207148,572,00002,273,280
10Mar 15, 2026 11:5413,518181,671,737147,698,0001,004,0002,273,280
11Mar 15, 2026 12:0613,552178,022,074148,069,0001,000,0002,387,968
12Mar 15, 2026 12:0613,592175,746,429149,510,00002,404,352