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:00olliecrowolliecrowScore: 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:003,13266,951,51433,440,0001,013,0002,400,256
2Mar 27, 2026 05:003,13460,957,30833,465,0001,014,0002,277,376
3Mar 27, 2026 05:003,13955,716,94933,510,0001,015,0002,404,352
4Mar 27, 2026 05:003,14056,676,39833,528,0001,016,0002,519,040
5Mar 27, 2026 05:003,14162,144,26634,556,00002,277,376
6Mar 27, 2026 05:003,14161,778,31733,540,0001,016,0002,277,376
7Mar 27, 2026 05:003,14361,564,97434,576,00002,400,256
8Mar 27, 2026 05:003,14357,061,25534,576,00002,277,376
9Mar 27, 2026 05:003,14455,885,93333,563,0001,017,0002,404,352
10Mar 27, 2026 05:003,14561,137,66433,582,0001,017,0002,277,376
11Mar 27, 2026 05:003,14563,405,98033,574,0001,017,0002,519,040
12Mar 27, 2026 05:003,14660,781,85433,587,0001,017,0002,400,256
13Mar 27, 2026 05:003,14666,901,51734,602,00002,277,376
14Mar 27, 2026 05:003,14759,920,07233,596,0001,018,0002,400,256
15Mar 27, 2026 05:003,14863,667,96934,630,00002,392,064
16Mar 27, 2026 05:003,15161,606,18433,646,0001,019,0002,392,064
17Mar 27, 2026 05:003,15260,681,38134,673,00002,277,376
18Mar 27, 2026 05:003,15559,891,96033,681,0001,020,0002,396,160
19Mar 27, 2026 05:003,15862,650,60333,744,000992,0002,277,376
20Mar 27, 2026 05:003,16464,999,10033,811,000994,0002,392,064
21Mar 27, 2026 05:003,16665,047,03632,839,0001,990,0002,273,280
22Mar 27, 2026 05:003,16761,045,44533,846,000995,0002,277,376
23Mar 27, 2026 05:003,16859,833,39132,854,0001,991,0002,400,256
24Mar 27, 2026 05:003,16860,004,60933,856,000995,0002,396,160
25Mar 27, 2026 05:003,16956,453,77433,839,0001,025,0002,396,160
26Mar 27, 2026 05:003,17457,514,67633,915,000997,0002,277,376
27Mar 27, 2026 05:003,17457,818,13032,919,0001,995,0002,277,376
28Mar 27, 2026 05:003,17460,986,63433,920,000997,0002,486,272
29Mar 27, 2026 05:003,17555,306,86433,928,000997,0002,281,472
30Mar 27, 2026 05:003,17756,372,62432,953,0001,997,0002,404,352