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:13Andrey TsvetkovAndrey TsvetkovError
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:07082,134,30571,798,0001,172,0002,138,112expected "2 ", got "0 "
2Sep 8, 2026 09:07081,115,51071,508,0001,074,0002,138,112expected "2 ", got "0 "
3Sep 8, 2026 09:07081,598,70871,794,0001,140,0002,138,112expected "2 ", got "0 "
4Jun 16, 2021 22:1312,163161,682,258130,798,0002,995,0002,330,624
5Jun 16, 2021 22:1312,167160,444,857130,838,0002,996,0002,502,656
6Jun 16, 2021 22:1312,168159,672,324131,849,0001,997,0002,502,656
7Jun 16, 2021 22:1312,186163,648,066132,045,0002,000,0002,510,848
8Jun 16, 2021 22:1312,187157,386,457132,060,0002,000,0002,330,624
9Jun 16, 2021 22:1312,191159,281,181133,105,0001,000,0002,306,048
10Jun 16, 2021 22:1312,199160,195,427132,185,0002,002,0002,506,752
11Jun 16, 2021 22:1312,200157,029,992133,196,0001,001,0002,510,848
12Jun 16, 2021 22:1312,211190,777,817134,316,37202,179,072
13Jun 16, 2021 22:1312,212187,322,006134,333,83202,306,048
14Jun 16, 2021 22:1312,218157,354,641131,385,0003,008,0002,510,848
15Jun 16, 2021 22:1312,248205,395,168134,731,92402,306,048