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:46olliecrowolliecrowScore: 3,155Success
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:463,13554,813,39533,467,0001,014,0002,277,376
2Mar 27, 2026 07:463,13956,859,90234,527,00002,277,376
3Mar 27, 2026 07:463,14057,202,06034,545,00002,277,376
4Mar 27, 2026 07:463,14162,709,28334,556,00002,277,376
5Mar 27, 2026 07:463,14158,047,30533,537,0001,016,0002,277,376
6Mar 27, 2026 07:463,14562,930,34634,595,00002,273,280
7Mar 27, 2026 07:463,14662,474,49734,601,00002,277,376
8Mar 27, 2026 07:463,14760,913,77433,598,0001,018,0002,277,376
9Mar 27, 2026 07:463,14765,032,75334,615,00002,400,256
10Mar 27, 2026 07:463,15059,347,30934,652,00002,277,376
11Mar 27, 2026 07:463,15259,645,38634,676,00002,400,256
12Mar 27, 2026 07:463,15261,114,03334,671,00002,490,368
13Mar 27, 2026 07:463,15561,464,43633,682,0001,020,0002,277,376
14Mar 27, 2026 07:463,16763,819,25634,840,00002,392,064
15Mar 27, 2026 07:463,16762,954,57934,836,00002,277,376
16Mar 27, 2026 07:463,16960,607,00533,867,000996,0002,408,448
17Mar 27, 2026 07:463,16961,090,89333,868,000996,0002,404,352
18Mar 27, 2026 07:463,16960,748,49934,856,00002,269,184
19Mar 27, 2026 07:463,16962,239,12732,866,0001,991,0002,400,256
20Mar 27, 2026 07:463,17262,142,78533,892,000996,0002,400,256
21Mar 27, 2026 07:463,17256,467,29533,897,000996,0002,277,376
22Mar 27, 2026 07:463,17365,001,35033,901,000997,0002,277,376
23Mar 27, 2026 07:463,17857,946,76932,961,0001,997,0002,404,352
24Mar 27, 2026 07:463,18160,300,15732,992,0001,999,0002,400,256