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 11, 2025 22:47Ian MckibbenIan MckibbenError
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Sep 7, 2026 16:15C#_user10.00CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 7, 2026 16:15065,807,82052,117,0003,514,0002,113,536expected "2 ", got "0"
2Sep 7, 2026 16:15067,310,31352,252,0003,538,0002,113,536expected "2 ", got "0"
3Sep 7, 2026 16:15066,094,77052,780,0003,197,0002,113,536expected "2 ", got "0"
4Jan 11, 2025 22:4718,229226,400,843189,490,00011,028,0002,326,528
5Jan 11, 2025 22:4718,268225,946,127191,948,0008,997,0002,387,968
6Jan 11, 2025 22:4718,271223,924,665189,982,00010,998,0002,338,816
7Jan 11, 2025 22:4718,274227,658,258191,017,00010,000,0002,342,912
8Jan 11, 2025 22:4718,288224,824,179186,160,00015,012,0002,457,600
9Jan 11, 2025 22:4718,303227,093,349190,318,00011,018,0002,289,664
10Jan 11, 2025 22:4718,303230,071,199190,320,00011,018,0002,375,680
11Jan 11, 2025 22:4718,319229,247,348192,483,0009,022,0002,396,160
12Jan 11, 2025 22:4718,345230,659,687184,810,00016,982,0002,392,064