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 listJun 16, 2021 22:04Andrey TsvetkovAndrey TsvetkovError
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Sep 8, 2026 17:24C#_user10.00CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 8, 2026 17:24076,310,63766,565,0001,092,00045,056expected "2 ", got "0 "
2Sep 8, 2026 17:24077,261,72966,744,0001,232,0002,138,112expected "2 ", got "0 "
3Sep 8, 2026 17:24076,286,57766,618,0001,236,0002,138,112expected "2 ", got "0 "
4Jun 16, 2021 22:0412,196159,984,522133,160,0001,001,0002,322,432
5Jun 16, 2021 22:0412,215158,890,971133,367,0001,002,0002,514,944
6Jun 16, 2021 22:0412,219192,033,087134,411,55802,187,264
7Jun 16, 2021 22:0412,219159,443,825132,407,0002,006,0002,310,144
8Jun 16, 2021 22:0412,224157,495,870132,460,0002,006,0002,326,528
9Jun 16, 2021 22:0412,227205,540,928134,496,83702,191,360
10Jun 16, 2021 22:0412,232158,897,041132,542,0002,008,0002,322,432
11Jun 16, 2021 22:0412,233163,504,963131,547,0003,012,0002,506,752
12Jun 16, 2021 22:0412,239162,994,876134,628,00002,326,528
13Jun 16, 2021 22:0412,241159,576,148131,634,0003,014,0002,326,528
14Jun 16, 2021 22:0412,243162,563,872132,661,0002,010,0002,498,560
15Jun 16, 2021 22:0412,248192,657,673134,729,84602,183,168