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 29, 2026 18:32olliecrowolliecrowScore: 3,170Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Mar 29, 2026 18:323,15361,704,80233,659,0001,019,0002,277,376
2Mar 29, 2026 18:333,15360,504,86634,682,00002,277,376
3Mar 29, 2026 18:343,16764,607,12733,845,000995,0002,277,376
4Mar 29, 2026 18:343,16760,964,77533,845,000995,0002,277,376
5Mar 29, 2026 18:323,16867,612,45033,848,000995,0002,404,352
6Mar 29, 2026 18:323,16964,655,67133,865,000996,0002,277,376
7Mar 29, 2026 18:333,16962,727,43034,857,00002,396,160
8Mar 29, 2026 18:343,17064,767,49632,876,0001,992,0002,400,256
9Mar 29, 2026 18:333,17165,168,34532,885,0001,993,0002,277,376
10Mar 29, 2026 18:333,17455,271,59332,918,0001,995,0002,510,848
11Mar 29, 2026 18:333,17459,746,71132,923,0001,995,0002,277,376
12Mar 29, 2026 18:323,17657,180,68732,938,0001,996,0002,277,376
13Mar 29, 2026 18:323,17661,769,35132,945,0001,996,0002,404,352
14Mar 29, 2026 18:333,17857,764,17533,965,000998,0002,277,376
15Mar 29, 2026 18:323,17962,930,52133,968,000999,0002,277,376