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 listJan 19, 2025 00:43Ian MckibbenIan MckibbenError
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Sep 7, 2026 15:49C#_user10.00CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 7, 2026 15:51040,283,46431,776,00002,117,632expected "1 ", got "0"
2Sep 7, 2026 15:51040,259,15831,820,00002,121,728expected "1 ", got "0"
3Sep 7, 2026 15:51040,226,62631,780,00002,117,632expected "1 ", got "0"
4Jan 19, 2025 00:4316,075208,016,614172,832,0003,996,0002,465,792
5Jan 19, 2025 00:4316,075198,061,333165,841,00010,989,0002,453,504
6Jan 19, 2025 00:4316,081204,398,807169,898,0006,995,0002,269,184
7Jan 19, 2025 00:4316,084200,459,533168,929,0007,996,0002,310,144
8Jan 19, 2025 00:4316,089199,785,098171,977,0004,999,0002,285,568
9Jan 19, 2025 00:4316,093200,407,283165,022,00012,001,0002,445,312
10Jan 19, 2025 00:4316,097201,035,586173,064,0004,001,0002,453,504
11Jan 19, 2025 00:4316,138201,744,193170,497,0007,020,0002,457,600
12Jan 19, 2025 00:4316,163206,775,710172,794,0004,994,0002,408,448