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:29Dominique GarmierDominique GarmierScore: 11,851Success
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 20:2111,804155,197,719127,850,0001,997,0002,387,968
2Mar 15, 2026 21:3611,823158,515,717128,058,0002,000,0002,273,280
3Mar 15, 2026 12:2911,830158,750,179129,131,0001,001,0002,396,160
4Mar 15, 2026 12:2911,830158,687,005129,133,0001,001,0002,273,280
5Mar 15, 2026 12:2911,835152,146,260128,182,0002,002,0002,273,280
6Mar 15, 2026 20:2111,838153,115,268129,215,0001,001,0002,400,256
7Mar 15, 2026 21:3611,842153,294,353129,263,0001,002,0002,392,064
8Mar 15, 2026 12:2911,851152,824,393129,364,0001,002,0002,404,352
9Mar 15, 2026 12:2911,862153,805,328130,481,00002,404,352
10Mar 15, 2026 12:2911,876159,307,952130,632,00002,273,280
11Mar 15, 2026 12:2911,877161,992,937130,646,00002,400,256
12Mar 15, 2026 12:2911,877159,012,126130,650,00002,273,280
13Mar 15, 2026 12:2911,893158,706,713129,825,000998,0002,273,280
14Mar 15, 2026 21:3611,925163,614,573129,178,0002,002,0002,400,256
15Mar 15, 2026 20:2111,966158,099,533130,619,0001,004,0002,396,160