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 07:13olliecrowolliecrowScore: 3,150Success
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 07:133,13259,202,02533,442,0001,013,0002,396,160
2Mar 27, 2026 07:133,13957,167,92633,514,0001,015,0002,277,376
3Mar 27, 2026 07:133,14160,743,24732,581,0001,974,0002,396,160
4Mar 27, 2026 07:133,14263,048,78433,544,0001,016,0002,277,376
5Mar 27, 2026 07:133,14260,595,27533,547,0001,016,0002,400,256
6Mar 27, 2026 07:133,14360,304,68634,571,00002,277,376
7Mar 27, 2026 07:133,14363,324,32033,558,0001,016,0002,396,160
8Mar 27, 2026 07:133,14561,848,52433,575,0001,017,0002,387,968
9Mar 27, 2026 07:133,14662,977,77134,605,00002,277,376
10Mar 27, 2026 07:133,14764,098,38433,598,0001,018,0002,400,256
11Mar 27, 2026 07:133,15064,953,69834,646,00002,404,352
12Mar 27, 2026 07:133,15063,308,36533,627,0001,019,0002,277,376
13Mar 27, 2026 07:133,15065,159,22534,650,00002,277,376
14Mar 27, 2026 07:133,15168,743,02633,643,0001,019,0002,396,160
15Mar 27, 2026 07:133,15660,833,48533,722,000991,0002,277,376
16Mar 27, 2026 07:133,16666,939,37033,834,000995,0002,277,376
17Mar 27, 2026 07:133,16760,530,99733,842,000995,0002,277,376
18Mar 27, 2026 07:133,16860,588,05533,855,000995,0002,277,376
19Mar 27, 2026 07:133,16859,264,84633,848,000995,0002,277,376
20Mar 27, 2026 07:133,16960,514,53033,861,000995,0002,269,184
21Mar 27, 2026 07:133,16959,081,59132,867,0001,991,0002,277,376
22Mar 27, 2026 07:133,17162,230,03833,882,000996,0002,277,376
23Mar 27, 2026 07:133,17559,567,08132,931,0001,995,0002,404,352
24Mar 27, 2026 07:133,17662,877,73533,939,000998,0002,408,448