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 02:11olliecrowolliecrowScore: 3,146Success
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 02:113,13557,204,11834,489,00002,400,256
2Mar 27, 2026 02:113,13856,990,79534,520,00002,277,376
3Mar 27, 2026 02:113,14055,411,25833,520,0001,015,0002,277,376
4Mar 27, 2026 02:113,14160,623,43433,539,0001,016,0002,277,376
5Mar 27, 2026 02:113,14256,757,67034,561,00002,277,376
6Mar 27, 2026 02:113,14263,944,07034,558,00002,277,376
7Mar 27, 2026 02:113,14360,681,80634,571,00002,277,376
8Mar 27, 2026 02:113,14460,905,34834,579,00002,277,376
9Mar 27, 2026 02:113,14460,478,86633,569,0001,017,0002,400,256
10Mar 27, 2026 02:113,14467,549,48833,572,0001,017,0002,404,352
11Mar 27, 2026 02:113,14558,476,55134,599,00002,273,280
12Mar 27, 2026 02:113,14559,248,77434,591,00002,396,160
13Mar 27, 2026 02:113,14661,211,85733,587,0001,017,0002,408,448
14Mar 27, 2026 02:113,14865,025,28933,615,0001,018,0002,277,376
15Mar 27, 2026 02:113,14865,149,50634,628,00002,277,376
16Mar 27, 2026 02:113,14961,008,55934,639,00002,277,376
17Mar 27, 2026 02:113,15163,735,57533,638,0001,019,0002,277,376
18Mar 27, 2026 02:113,15162,378,60733,637,0001,019,0002,387,968
19Mar 27, 2026 02:113,15262,396,69733,649,0001,019,0002,387,968
20Mar 27, 2026 02:113,15561,046,20034,704,00002,400,256
21Mar 27, 2026 02:113,16763,002,96832,851,0001,991,0002,482,176
22Mar 27, 2026 02:113,16859,543,38832,860,0001,991,0002,396,160
23Mar 27, 2026 02:113,17066,871,03533,873,000996,0002,396,160
24Mar 27, 2026 02:113,17258,377,64032,900,0001,993,0002,277,376