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:55olliecrowolliecrowScore: 3,168Success
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:573,14561,217,24333,582,0001,017,0002,277,376
2Mar 29, 2026 18:573,14863,051,29633,607,0001,018,0002,400,256
3Mar 29, 2026 18:563,15160,037,14033,647,0001,019,0002,387,968
4Mar 29, 2026 18:533,15359,829,82833,668,0001,020,0002,404,352
5Mar 29, 2026 18:573,15460,972,55033,679,0001,020,0002,277,376
6Mar 29, 2026 18:543,15459,333,92434,695,00002,277,376
7Mar 29, 2026 18:563,15462,229,13233,671,0001,020,0002,404,352
8Mar 29, 2026 18:583,16467,322,53833,812,000994,0002,404,352
9Mar 29, 2026 18:533,16660,612,05034,829,00002,277,376
10Mar 29, 2026 18:533,16860,227,12332,859,0001,991,0002,277,376
11Mar 29, 2026 18:583,16858,810,24334,851,00002,277,376
12Mar 29, 2026 18:573,16865,579,03733,858,000995,0002,277,376
13Mar 29, 2026 18:573,16859,156,79632,858,0001,991,0002,277,376
14Mar 29, 2026 18:533,16863,002,86932,857,0001,991,0002,277,376
15Mar 29, 2026 18:543,16869,063,57433,853,000995,0002,396,160
16Mar 29, 2026 18:543,16866,019,53533,852,000995,0002,277,376
17Mar 29, 2026 18:543,16861,029,20234,848,00002,408,448
18Mar 29, 2026 18:573,16964,293,01832,865,0001,991,0002,277,376
19Mar 29, 2026 18:533,16962,897,53633,868,000996,0002,277,376
20Mar 29, 2026 18:543,16967,249,02433,859,000995,0002,277,376
21Mar 29, 2026 18:543,17063,971,50834,871,00002,277,376
22Mar 29, 2026 18:583,17062,983,76532,874,0001,992,0002,277,376
23Mar 29, 2026 18:573,17067,041,61632,883,0001,992,0002,404,352
24Mar 29, 2026 18:553,17066,988,65834,867,00002,277,376
25Mar 29, 2026 18:563,17356,184,45233,904,000997,0002,404,352
26Mar 29, 2026 18:573,17456,655,73732,916,0001,994,0002,404,352
27Mar 29, 2026 18:533,17461,559,53932,917,0001,995,0002,277,376
28Mar 29, 2026 18:553,17758,242,81032,952,0001,997,0002,277,376
29Mar 29, 2026 18:553,17755,855,33132,955,0001,997,0002,400,256
30Mar 29, 2026 18:573,18460,212,40733,024,0002,001,0002,404,352