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

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

Challenge History
DateChallengerCostTypeStatus
Sep 8, 2026 03:50C#_user10.00CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 8, 2026 03:52018,518,9837,631,0001,011,0002,117,632expected "2 ", got "0 "
2Sep 8, 2026 03:52018,681,3707,671,0001,028,0002,117,632expected "2 ", got "0 "
3Sep 8, 2026 03:52018,571,2157,647,0001,013,0002,117,632expected "2 ", got "0 "
4Mar 27, 2026 04:183,13755,056,65233,492,0001,014,0002,408,448
5Mar 27, 2026 04:183,14054,525,62933,527,0001,015,0002,404,352
6Mar 27, 2026 04:183,14259,176,06734,562,00002,400,256
7Mar 27, 2026 04:183,14358,621,79734,578,00002,277,376
8Mar 27, 2026 04:183,14361,399,46533,557,0001,016,0002,277,376
9Mar 27, 2026 04:183,14460,946,69134,586,00002,277,376
10Mar 27, 2026 04:183,14459,972,68433,572,0001,017,0002,400,256
11Mar 27, 2026 04:183,14562,189,32933,574,0001,017,0002,404,352
12Mar 27, 2026 04:183,14560,919,53834,598,00002,400,256
13Mar 27, 2026 04:183,14664,390,36033,592,0001,017,0002,277,376
14Mar 27, 2026 04:183,14664,965,39033,586,0001,017,0002,277,376
15Mar 27, 2026 04:183,14760,389,02433,598,0001,018,0002,277,376
16Mar 27, 2026 04:183,14859,803,95933,605,0001,018,0002,277,376
17Mar 27, 2026 04:183,14965,755,86834,639,00002,387,968
18Mar 27, 2026 04:183,15067,686,20033,633,0001,019,0002,277,376
19Mar 27, 2026 04:183,15261,744,03734,669,00002,392,064
20Mar 27, 2026 04:183,16759,562,81533,840,000995,0002,404,352
21Mar 27, 2026 04:183,16864,918,93732,853,0001,991,0002,277,376
22Mar 27, 2026 04:183,16865,545,73533,853,000995,0002,277,376
23Mar 27, 2026 04:183,17059,694,48233,878,000996,0002,277,376
24Mar 27, 2026 04:183,17561,911,27833,923,000997,0002,404,352
25Mar 27, 2026 04:183,17559,335,61032,927,0001,995,0002,277,376
26Mar 27, 2026 04:183,17658,819,84232,936,0001,996,0002,277,376
27Mar 27, 2026 04:183,17658,591,38832,938,0001,996,0002,281,472