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

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

Challenge History
DateChallengerCostTypeStatus
Sep 8, 2026 06:47C#_user10.00CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 8, 2026 06:49018,633,4837,667,0001,050,0002,117,632expected "2 ", got "0 "
2Sep 8, 2026 06:49018,531,0967,597,0001,042,0002,113,536expected "2 ", got "0 "
3Sep 8, 2026 06:49018,654,0947,737,0001,011,0002,117,632expected "2 ", got "0 "
4Mar 27, 2026 05:533,14155,340,81834,554,00002,277,376
5Mar 27, 2026 05:533,14256,322,85134,563,00002,519,040
6Mar 27, 2026 05:533,14464,099,19634,580,00002,494,464
7Mar 27, 2026 05:533,14666,058,16233,591,0001,017,0002,400,256
8Mar 27, 2026 05:533,14764,882,85634,618,00002,277,376
9Mar 27, 2026 05:533,14763,697,61633,604,0001,018,0002,396,160
10Mar 27, 2026 05:533,14762,727,05533,601,0001,018,0002,277,376
11Mar 27, 2026 05:533,14863,354,52133,615,0001,018,0002,400,256
12Mar 27, 2026 05:533,14861,744,61534,624,00002,396,160
13Mar 27, 2026 05:533,14960,574,87633,623,0001,018,0002,277,376
14Mar 27, 2026 05:533,15063,868,69933,635,0001,019,0002,396,160
15Mar 27, 2026 05:533,15061,827,22633,629,0001,019,0002,404,352
16Mar 27, 2026 05:533,15059,502,48033,635,0001,019,0002,277,376
17Mar 27, 2026 05:533,15062,515,65934,653,00002,277,376
18Mar 27, 2026 05:533,15166,785,41134,656,00002,396,160
19Mar 27, 2026 05:533,15260,809,80833,658,0001,019,0002,277,376
20Mar 27, 2026 05:533,15266,076,90533,649,0001,019,0002,277,376
21Mar 27, 2026 05:533,15362,623,26233,666,0001,020,0002,277,376
22Mar 27, 2026 05:533,15559,868,00433,689,0001,020,0002,277,376
23Mar 27, 2026 05:533,16863,323,10132,854,0001,991,0002,400,256
24Mar 27, 2026 05:533,16968,853,38834,861,00002,392,064
25Mar 27, 2026 05:533,17158,913,48732,891,0001,993,0002,277,376
26Mar 27, 2026 05:533,17457,522,85732,920,0001,995,0002,277,376
27Mar 27, 2026 05:533,17559,704,48932,928,0001,995,0002,482,176