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 08:06olliecrowolliecrowError
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Sep 8, 2026 07:34C#_user10.00CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 8, 2026 07:35018,639,3968,682,00002,117,632expected "2 ", got "0 "
2Sep 8, 2026 07:35018,573,5328,588,00002,117,632expected "2 ", got "0 "
3Sep 8, 2026 07:35018,469,6668,563,00002,113,536expected "2 ", got "0 "
4Mar 27, 2026 08:063,13156,802,85634,446,00002,277,376
5Mar 27, 2026 08:063,13758,345,78234,503,00002,277,376
6Mar 27, 2026 08:063,13856,745,48634,517,00002,404,352
7Mar 27, 2026 08:063,13852,358,93334,523,00002,277,376
8Mar 27, 2026 08:063,14156,659,21334,555,00002,404,352
9Mar 27, 2026 08:063,14155,950,11133,538,0001,016,0002,400,256
10Mar 27, 2026 08:063,14257,955,99433,543,0001,016,0002,400,256
11Mar 27, 2026 08:063,14360,231,08134,569,00002,277,376
12Mar 27, 2026 08:063,14461,241,76033,565,0001,017,0002,392,064
13Mar 27, 2026 08:063,14456,212,06633,571,0001,017,0002,277,376
14Mar 27, 2026 08:063,14465,644,69733,572,0001,017,0002,408,448
15Mar 27, 2026 08:063,14563,061,74133,579,0001,017,0002,396,160
16Mar 27, 2026 08:063,14567,743,99033,580,0001,017,0002,392,064
17Mar 27, 2026 08:063,14563,915,38133,583,0001,017,0002,277,376
18Mar 27, 2026 08:063,14761,654,26633,595,0001,018,0002,277,376
19Mar 27, 2026 08:063,15164,982,90434,659,00002,277,376
20Mar 27, 2026 08:063,15169,360,05634,663,00002,277,376
21Mar 27, 2026 08:063,15266,898,50234,674,00002,510,848
22Mar 27, 2026 08:063,15465,066,87033,673,0001,020,0002,396,160
23Mar 27, 2026 08:063,15466,482,82034,697,00002,277,376
24Mar 27, 2026 08:063,15562,032,54334,709,00002,400,256
25Mar 27, 2026 08:063,15563,147,06833,683,0001,020,0002,404,352
26Mar 27, 2026 08:063,16660,933,75432,836,0001,990,0002,277,376
27Mar 27, 2026 08:063,17058,225,28233,877,000996,0002,277,376
28Mar 27, 2026 08:063,17162,661,43632,884,0001,992,0002,277,376
29Mar 27, 2026 08:063,17164,610,30033,889,000996,0002,400,256
30Mar 27, 2026 08:063,17157,100,19832,892,0001,993,0002,277,376
31Mar 27, 2026 08:063,17660,907,01833,936,000998,0002,277,376
32Mar 27, 2026 08:063,17862,777,54232,959,0001,997,0002,277,376
33Mar 27, 2026 08:063,18055,209,82333,976,000999,0002,277,376