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 27, 2026 05:59olliecrowolliecrowScore: 3,151Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Mar 27, 2026 05:593,14262,670,29133,549,0001,016,0002,277,376
2Mar 27, 2026 05:593,14268,454,98534,561,00002,277,376
3Mar 27, 2026 05:593,14466,545,11333,567,0001,017,0002,400,256
4Mar 27, 2026 05:593,14559,221,98433,575,0001,017,0002,396,160
5Mar 27, 2026 05:593,14562,076,30333,580,0001,017,0002,277,376
6Mar 27, 2026 05:593,14662,706,84934,611,00002,277,376
7Mar 27, 2026 05:593,14659,695,68534,602,00002,396,160
8Mar 27, 2026 05:593,14664,984,25933,591,0001,017,0002,277,376
9Mar 27, 2026 05:593,14661,301,81233,591,0001,017,0002,277,376
10Mar 27, 2026 05:593,14660,473,11933,593,0001,017,0002,482,176
11Mar 27, 2026 05:593,14957,415,90833,622,0001,018,0002,277,376
12Mar 27, 2026 05:593,15068,963,15633,634,0001,019,0002,277,376
13Mar 27, 2026 05:593,15160,140,86833,643,0001,019,0002,277,376
14Mar 27, 2026 05:593,15158,557,13233,637,0001,019,0002,277,376
15Mar 27, 2026 05:593,15162,700,90234,659,00002,277,376
16Mar 27, 2026 05:593,15360,064,46634,681,00002,277,376
17Mar 27, 2026 05:593,15364,515,55633,662,0001,020,0002,392,064
18Mar 27, 2026 05:593,15458,560,97532,707,0001,982,0002,277,376
19Mar 27, 2026 05:593,16464,540,34833,813,000994,0002,404,352
20Mar 27, 2026 05:593,16963,237,51633,863,000995,0002,404,352
21Mar 27, 2026 05:593,17260,773,78832,901,0001,994,0002,277,376
22Mar 27, 2026 05:593,17259,126,72132,895,0001,993,0002,404,352
23Mar 27, 2026 05:593,17260,631,23333,897,000996,0002,277,376
24Mar 27, 2026 05:593,17462,056,69532,915,0001,994,0002,396,160