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

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

Challenge History
DateChallengerCostTypeStatus
Sep 8, 2026 09:03C#_user10.00CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 8, 2026 09:04018,561,5198,604,00002,117,632expected "2 ", got "0 "
2Sep 8, 2026 09:04018,585,7517,697,0001,020,0002,117,632expected "2 ", got "0 "
3Sep 8, 2026 09:04018,600,9057,704,0001,020,0002,117,632expected "2 ", got "0 "
4Mar 27, 2026 06:213,14256,786,40934,559,00002,387,968
5Mar 27, 2026 06:213,14362,939,61934,569,00002,277,376
6Mar 27, 2026 06:213,14363,242,98134,568,00002,392,064
7Mar 27, 2026 06:213,14459,512,48933,566,0001,017,0002,277,376
8Mar 27, 2026 06:213,14469,912,71033,572,0001,017,0002,277,376
9Mar 27, 2026 06:213,14560,293,25534,593,00002,277,376
10Mar 27, 2026 06:213,14860,804,92233,609,0001,018,0002,277,376
11Mar 27, 2026 06:213,14963,227,28333,619,0001,018,0002,400,256
12Mar 27, 2026 06:213,14964,471,07034,638,00002,514,944
13Mar 27, 2026 06:213,15062,093,38634,654,00002,404,352
14Mar 27, 2026 06:213,15160,495,71234,661,00002,408,448
15Mar 27, 2026 06:213,15166,346,64533,643,0001,019,0002,396,160
16Mar 27, 2026 06:213,15362,052,02134,678,00002,277,376
17Mar 27, 2026 06:213,15560,362,55733,681,0001,020,0002,277,376
18Mar 27, 2026 06:213,15560,772,83634,703,00002,277,376
19Mar 27, 2026 06:213,15663,153,31033,692,0001,020,0002,277,376
20Mar 27, 2026 06:213,15861,858,41533,713,0001,021,0002,404,352
21Mar 27, 2026 06:213,16760,446,66133,847,000995,0002,400,256
22Mar 27, 2026 06:213,16860,531,62034,851,00002,277,376
23Mar 27, 2026 06:213,16960,553,62832,867,0001,991,0002,277,376
24Mar 27, 2026 06:213,16963,232,39233,860,000995,0002,277,376
25Mar 27, 2026 06:213,17256,654,77334,892,00002,277,376
26Mar 27, 2026 06:213,17461,141,05533,918,000997,0002,392,064
27Mar 27, 2026 06:213,17660,964,32533,937,000998,0002,400,256