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

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

Challenge History
DateChallengerCostTypeStatus
Sep 8, 2026 06:46C#_user10.00CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 8, 2026 06:46018,487,9008,573,00002,113,536expected "2 ", got "0 "
2Sep 8, 2026 06:46018,571,1787,632,0001,011,0002,117,632expected "2 ", got "0 "
3Sep 8, 2026 06:46018,545,4147,675,0001,016,0002,113,536expected "2 ", got "0 "
4Mar 27, 2026 05:113,13357,940,26633,450,0001,013,0002,392,064
5Mar 27, 2026 05:113,13556,869,06734,487,00002,277,376
6Mar 27, 2026 05:113,13961,813,52733,512,0001,015,0002,404,352
7Mar 27, 2026 05:113,13959,325,75733,519,0001,015,0002,277,376
8Mar 27, 2026 05:113,14061,130,69133,529,0001,016,0002,396,160
9Mar 27, 2026 05:113,14159,923,35334,549,00002,277,376
10Mar 27, 2026 05:113,14256,793,17634,558,00002,396,160
11Mar 27, 2026 05:113,14357,244,02034,574,00002,277,376
12Mar 27, 2026 05:113,14359,602,03633,554,0001,016,0002,277,376
13Mar 27, 2026 05:113,14459,927,05633,564,0001,017,0002,400,256
14Mar 27, 2026 05:113,14463,823,98733,564,0001,017,0002,277,376
15Mar 27, 2026 05:113,14661,233,21833,593,0001,017,0002,277,376
16Mar 27, 2026 05:113,14866,348,38233,606,0001,018,0002,277,376
17Mar 27, 2026 05:113,15062,448,43733,634,0001,019,0002,277,376
18Mar 27, 2026 05:113,15262,090,44234,677,00002,277,376
19Mar 27, 2026 05:113,15759,583,57133,736,000992,0002,277,376
20Mar 27, 2026 05:113,16760,731,64433,847,000995,0002,392,064
21Mar 27, 2026 05:113,16761,558,98332,846,0001,990,0002,277,376
22Mar 27, 2026 05:113,16965,113,21133,863,000995,0002,404,352
23Mar 27, 2026 05:113,17062,741,84933,871,000996,0002,396,160
24Mar 27, 2026 05:113,17061,041,70533,878,000996,0002,277,376
25Mar 27, 2026 05:113,17358,986,56432,912,0001,994,0002,277,376
26Mar 27, 2026 05:113,17457,634,05732,918,0001,995,0002,277,376
27Mar 27, 2026 05:113,17457,641,07232,919,0001,995,0002,408,448
28Mar 27, 2026 05:113,17657,012,85433,940,000998,0002,277,376
29Mar 27, 2026 05:113,17860,942,77932,964,0001,997,0002,400,256
30Mar 27, 2026 05:113,17861,363,30433,965,000998,0002,277,376