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 listApr 24, 2026 15:47olliecrowolliecrowError
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Sep 8, 2026 05:02C#_user10.00CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 8, 2026 05:04020,487,1389,445,0001,300,0002,170,880expected "2 ", got "0 "
2Sep 8, 2026 05:04020,614,5539,506,0001,305,0002,129,920expected "2 ", got "0 "
3Sep 8, 2026 05:04020,667,2579,511,0001,314,0002,174,976expected "2 ", got "0 "
4Apr 24, 2026 15:504,42157,226,75146,654,0001,985,0002,375,680
5Apr 24, 2026 15:504,43866,034,53146,826,0001,992,0002,314,240
6Apr 24, 2026 15:504,44256,833,70746,875,0001,994,0002,355,200
7Apr 24, 2026 15:504,44956,907,74345,945,0002,996,0002,326,528
8Apr 24, 2026 15:504,46057,286,79447,065,0002,002,0002,379,776
9Apr 24, 2026 15:504,46357,397,48947,099,0002,004,0002,375,680
10Apr 24, 2026 15:504,50056,672,69349,501,00002,375,680
11Apr 24, 2026 15:504,52256,853,20946,701,0003,045,0002,359,296
12Apr 24, 2026 15:504,53257,069,47746,803,0003,052,0002,359,296