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 04:39olliecrowolliecrowError
Source Code

Source code access is restricted. Log in to request access.

Challenge History
DateChallengerCostTypeStatus
Sep 8, 2026 05:04C#_user10.00CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 8, 2026 05:06018,720,5527,697,0001,018,0002,117,632expected "2 ", got "0 "
2Sep 8, 2026 05:06018,546,9178,582,00002,117,632expected "2 ", got "0 "
3Sep 8, 2026 05:06018,505,2828,560,00002,117,632expected "2 ", got "0 "
4Mar 27, 2026 04:393,13161,625,05533,433,0001,013,0002,277,376
5Mar 27, 2026 04:393,13856,412,91734,523,00002,277,376
6Mar 27, 2026 04:393,13958,249,62033,514,0001,015,0002,277,376
7Mar 27, 2026 04:393,14059,457,89133,521,0001,015,0002,277,376
8Mar 27, 2026 04:393,14056,768,49534,536,00002,277,376
9Mar 27, 2026 04:393,14359,266,95433,561,0001,017,0002,396,160
10Mar 27, 2026 04:393,14464,237,04134,589,00002,396,160
11Mar 27, 2026 04:393,14461,014,29134,589,00002,277,376
12Mar 27, 2026 04:393,14562,954,30633,578,0001,017,0002,396,160
13Mar 27, 2026 04:393,14663,704,07633,591,0001,017,0002,277,376
14Mar 27, 2026 04:393,14667,265,09833,592,0001,017,0002,277,376
15Mar 27, 2026 04:393,14661,555,70633,589,0001,017,0002,277,376
16Mar 27, 2026 04:393,14767,330,44533,595,0001,018,0002,277,376
17Mar 27, 2026 04:393,14863,177,19634,633,00002,396,160
18Mar 27, 2026 04:393,14860,874,14833,610,0001,018,0002,404,352
19Mar 27, 2026 04:393,14961,613,26134,641,00002,408,448
20Mar 27, 2026 04:393,14962,637,20434,636,00002,277,376
21Mar 27, 2026 04:393,15162,483,02633,637,0001,019,0002,396,160
22Mar 27, 2026 04:393,15164,638,93834,657,00002,396,160
23Mar 27, 2026 04:393,15267,526,87033,657,0001,019,0002,400,256
24Mar 27, 2026 04:393,15460,135,89933,672,0001,020,0002,277,376
25Mar 27, 2026 04:393,16761,504,61332,849,0001,990,0002,277,376
26Mar 27, 2026 04:393,16760,357,92232,844,0001,990,0002,277,376
27Mar 27, 2026 04:393,16964,684,35534,864,00002,277,376
28Mar 27, 2026 04:393,16962,106,70433,860,000995,0002,277,376
29Mar 27, 2026 04:393,16958,477,20832,864,0001,991,0002,277,376
30Mar 27, 2026 04:393,17058,402,69033,869,000996,0002,506,752
31Mar 27, 2026 04:393,17060,939,26933,879,000996,0002,277,376
32Mar 27, 2026 04:393,17257,398,28232,899,0001,993,0002,400,256
33Mar 27, 2026 04:393,17660,654,45332,945,0001,996,0002,277,376